[Xfce4-commits] <ristretto:master> Cleanup thumbnailer object.

Stephan Arts noreply at xfce.org
Thu Dec 1 22:10:01 CET 2011


Updating branch refs/heads/master
         to 6339e18fad389b145669656e29d237e11ac460c9 (commit)
       from 31fbabd1e6233795087b801e3e0407bf0623cbd1 (commit)

commit 6339e18fad389b145669656e29d237e11ac460c9
Author: Stephan Arts <stephan at xfce.org>
Date:   Thu Dec 1 22:07:45 2011 +0100

    Cleanup thumbnailer object.

 src/main_window.c   |   31 ++++++++++++++++++-------------
 src/thumbnail_bar.c |   32 ++++++++++++++++++++++++++------
 src/thumbnailer.c   |    1 -
 3 files changed, 44 insertions(+), 20 deletions(-)

diff --git a/src/main_window.c b/src/main_window.c
index 7caa156..c7aa6b4 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -789,22 +789,27 @@ rstto_main_window_dispose(GObject *object)
 {
     RsttoMainWindow *window = RSTTO_MAIN_WINDOW(object);
 
-    if (window->priv->ui_manager)
+    if (window->priv)
     {
-        g_object_unref (window->priv->ui_manager);
-        window->priv->ui_manager = NULL;
-    } 
+        if (window->priv->ui_manager)
+        {
+            g_object_unref (window->priv->ui_manager);
+            window->priv->ui_manager = NULL;
+        } 
 
-    if (window->priv->settings_manager)
-    {
-        g_object_unref (window->priv->settings_manager);
-        window->priv->settings_manager = NULL;
-    }
+        if (window->priv->settings_manager)
+        {
+            g_object_unref (window->priv->settings_manager);
+            window->priv->settings_manager = NULL;
+        }
 
-    if (window->priv->image_list)
-    {
-        g_object_unref (window->priv->image_list);
-        window->priv->image_list = NULL;
+        if (window->priv->image_list)
+        {
+            g_object_unref (window->priv->image_list);
+            window->priv->image_list = NULL;
+        }
+        g_free (window->priv);
+        window->priv = NULL;
     }
 
     G_OBJECT_CLASS (parent_class)->dispose(object); 
diff --git a/src/thumbnail_bar.c b/src/thumbnail_bar.c
index 18b0b59..61129e8 100644
--- a/src/thumbnail_bar.c
+++ b/src/thumbnail_bar.c
@@ -151,7 +151,14 @@ rstto_thumbnail_bar_get_type (void)
 static void
 rstto_thumbnail_bar_init(RsttoThumbnailBar *bar)
 {
-    bar->priv = g_new0(RsttoThumbnailBarPriv, 1);
+    RsttoThumbnailBarPriv *priv;
+
+    priv = G_TYPE_INSTANCE_GET_PRIVATE (
+            bar,
+            RSTTO_TYPE_THUMBNAIL_BAR,
+            RsttoThumbnailBarPriv);
+
+    bar->priv = priv;
 
     bar->priv->auto_center = TRUE;
     bar->priv->thumbnailer = rstto_thumbnailer_new();
@@ -210,6 +217,7 @@ rstto_thumbnail_bar_class_init(RsttoThumbnailBarClass *bar_class)
 		0, G_MAXINT, 0,
 		G_PARAM_READABLE));
 
+    g_type_class_add_private (bar_class, sizeof (RsttoThumbnailBarPriv));
 }
 
 
@@ -218,10 +226,19 @@ rstto_thumbnail_bar_dispose (GObject *object)
 {
     RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR (object);
 
-    if (bar->priv->image_list)
+    if (bar->priv)
     {
-        g_object_unref (bar->priv->image_list);
-        bar->priv->image_list = NULL;
+        if (bar->priv->image_list)
+        {
+            g_object_unref (bar->priv->image_list);
+            bar->priv->image_list = NULL;
+        }
+
+        if (bar->priv->thumbnailer)
+        {
+            g_object_unref (bar->priv->thumbnailer);
+            bar->priv->thumbnailer = NULL;
+        }
     }
 
     G_OBJECT_CLASS (parent_class)->dispose(object); 
@@ -662,14 +679,17 @@ rstto_thumbnail_bar_remove(GtkContainer *container, GtkWidget *child)
 }
 
 static void
-rstto_thumbnail_bar_forall(GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data)
+rstto_thumbnail_bar_forall (
+        GtkContainer *container,
+        gboolean include_internals,
+        GtkCallback callback,
+        gpointer callback_data )
 {
     RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR(container);
 
     g_return_if_fail(callback != NULL);
 
     g_list_foreach(bar->priv->thumbs, (GFunc)callback, callback_data);
-
 }
 
 static GType
diff --git a/src/thumbnailer.c b/src/thumbnailer.c
index f210ccc..c8fcfbd 100644
--- a/src/thumbnailer.c
+++ b/src/thumbnailer.c
@@ -269,7 +269,6 @@ rstto_thumbnailer_set_property (
         default:
             break;
     }
-
 }
 
 static void


More information about the Xfce4-commits mailing list