]> Pileus Git - grits/blobdiff - src/plugin-ridge.c
destructors, still need to free data in plugins though
[grits] / src / plugin-ridge.c
index a9838b9b0c16095fb23ca6c4be92ee2b95459107..90ad4d1bf9898d2b50c50080686505a8b2f5fa4c 100644 (file)
 /****************
  * GObject code *
  ****************/
+/* Plugin init */
 static void aweather_ridge_plugin_init(AWeatherPluginInterface *iface);
 static void aweather_ridge_expose(AWeatherPlugin *_ridge);
 G_DEFINE_TYPE_WITH_CODE(AWeatherRidge, aweather_ridge, G_TYPE_OBJECT,
                G_IMPLEMENT_INTERFACE(AWEATHER_TYPE_PLUGIN,
                        aweather_ridge_plugin_init));
-static void aweather_ridge_class_init(AWeatherRidgeClass *klass)
-{
-       GObjectClass *object_class = (GObjectClass*)klass;
-}
 static void aweather_ridge_plugin_init(AWeatherPluginInterface *iface)
 {
+       g_debug("AWeatherRidge: plugin_init");
        /* Add methods to the interface */
        iface->expose = aweather_ridge_expose;
 }
+/* Class/Object init */
 static void aweather_ridge_init(AWeatherRidge *ridge)
 {
+       g_debug("AWeatherRidge: init");
        /* Set defaults */
        ridge->gui = NULL;
 }
+static void aweather_ridge_dispose(GObject *gobject)
+{
+       g_debug("AWeatherRidge: dispose");
+       AWeatherRidge *self = AWEATHER_RIDGE(gobject);
+       /* Drop references */
+       G_OBJECT_CLASS(aweather_ridge_parent_class)->dispose(gobject);
+}
+static void aweather_ridge_finalize(GObject *gobject)
+{
+       g_debug("AWeatherRidge: finalize");
+       AWeatherRidge *self = AWEATHER_RIDGE(gobject);
+       /* Free data */
+       G_OBJECT_CLASS(aweather_ridge_parent_class)->finalize(gobject);
+
+}
+static void aweather_ridge_class_init(AWeatherRidgeClass *klass)
+{
+       g_debug("AWeatherRidge: class_init");
+       GObjectClass *gobject_class = (GObjectClass*)klass;
+       gobject_class->dispose  = aweather_ridge_dispose;
+       gobject_class->finalize = aweather_ridge_finalize;
+}
 
 /*********************
  * Overlay constants *
@@ -111,7 +133,8 @@ void load_texture(AWeatherRidge *self, layer_t *layer, gchar *filename)
        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 
        char *base = g_path_get_basename(filename);
-       g_message("loaded image:  w=%-3d  h=%-3d  fmt=%x  px=(%02x,%02x,%02x,%02x)  img=%s",
+       g_debug("AWeatherRidge: load_texture - "
+               "w=%-3d  h=%-3d  fmt=%x  px=(%02x,%02x,%02x,%02x)  img=%s",
                width, height, format, pixels[0], pixels[1], pixels[2], pixels[3],
                base);
        g_free(base);
@@ -144,7 +167,7 @@ void cached_cb(gchar *filename, gboolean updated, gpointer _udata)
  *************/
 static void on_site_changed(AWeatherView *view, gchar *site, AWeatherRidge *self)
 {
-       g_message("site changed to %s", site);
+       g_debug("AWeatherRidge: on_site_changed - site=%s", site);
        for (int i = 0; i < LAYER_COUNT; i++) {
                gchar *base = "http://radar.weather.gov/ridge/";
                gchar *path  = g_strdup_printf(layers[i].fmt, site);
@@ -198,7 +221,7 @@ static void aweather_ridge_expose(AWeatherPlugin *_ridge)
 {
        AWeatherRidge *ridge = AWEATHER_RIDGE(_ridge);
 
-       g_message("ridge:expose");
+       g_debug("AWeatherRidge: expose");
        glPushMatrix();
        glEnable(GL_TEXTURE_2D);
        glColor4f(1,1,1,1);