[gthumb] Remove gtk_object_sink and some unused code, bug 575017



commit 79074a3a2b078a954123c0c75e33abce6ee7293e
Author: Marc Pavot <marc pavot gmail com>
Date:   Fri May 29 08:45:29 2009 -0400

    Remove gtk_object_sink and some unused code, bug 575017
---
 libgthumb/gth-image-list.c |    6 +--
 src/gth-image-selector.c   |   76 ++++---------------------------------------
 2 files changed, 9 insertions(+), 73 deletions(-)

diff --git a/libgthumb/gth-image-list.c b/libgthumb/gth-image-list.c
index dbe4f9f..9948d46 100644
--- a/libgthumb/gth-image-list.c
+++ b/libgthumb/gth-image-list.c
@@ -1954,8 +1954,7 @@ set_scroll_adjustments (GthImageList  *image_list,
 
 	if (image_list->priv->hadjustment != hadj) {
 		image_list->priv->hadjustment = hadj;
-		g_object_ref (image_list->priv->hadjustment);
-		gtk_object_sink (GTK_OBJECT (image_list->priv->hadjustment));
+		g_object_ref_sink (GTK_OBJECT (image_list->priv->hadjustment));
 
 		g_signal_connect (G_OBJECT (image_list->priv->hadjustment),
 				  "value_changed",
@@ -1969,8 +1968,7 @@ set_scroll_adjustments (GthImageList  *image_list,
 
 	if (image_list->priv->vadjustment != vadj) {
 		image_list->priv->vadjustment = vadj;
-		g_object_ref (image_list->priv->vadjustment);
-		gtk_object_sink (GTK_OBJECT (image_list->priv->vadjustment));
+		g_object_ref_sink (GTK_OBJECT (image_list->priv->vadjustment));
 
 		g_signal_connect (G_OBJECT (image_list->priv->vadjustment),
 				  "value_changed",
diff --git a/src/gth-image-selector.c b/src/gth-image-selector.c
index 578cf3a..a616a1f 100644
--- a/src/gth-image-selector.c
+++ b/src/gth-image-selector.c
@@ -1336,6 +1336,11 @@ finalize (GObject *object)
 
 		g_free (selector->priv);
 		selector->priv = NULL;
+
+                if (priv->hadj)
+                        g_object_unref (priv->hadj);
+                if (priv->vadj)
+                        g_object_unref (priv->vadj);
 	}
 
         /* Chain up */
@@ -1716,70 +1721,6 @@ vadj_value_changed (GtkObject        *adj,
 }
 
 
-static void
-set_scroll_adjustments (GtkWidget     *widget,
-			GtkAdjustment *hadj,
-			GtkAdjustment *vadj)
-{
-	GthImageSelector     *selector;
-	GthImageSelectorPriv *priv;
-
-        g_return_if_fail (widget != NULL);
-        g_return_if_fail (GTH_IS_IMAGE_SELECTOR (widget));
-
-        selector = GTH_IMAGE_SELECTOR (widget);
-	priv = selector->priv;
-
-        if (hadj)
-                g_return_if_fail (GTK_IS_ADJUSTMENT (hadj));
-        else
-                hadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0,
-							   0.0, 0.0, 0.0));
-
-        if (vadj)
-                g_return_if_fail (GTK_IS_ADJUSTMENT (vadj));
-        else
-                vadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0,
-							   0.0, 0.0, 0.0));
-
-        if (priv->hadj && priv->hadj != hadj) {
-		g_signal_handlers_disconnect_by_data (G_OBJECT (priv->hadj),
-						      selector);
-		g_object_unref (priv->hadj);
-		priv->hadj = NULL;
-        }
-
-        if (priv->vadj && priv->vadj != vadj) {
-		g_signal_handlers_disconnect_by_data (G_OBJECT (priv->vadj),
-						      selector);
-		g_object_unref (priv->vadj);
-		priv->vadj = NULL;
-        }
-
-        if (priv->hadj != hadj) {
-                priv->hadj = hadj;
-                g_object_ref (priv->hadj);
-                gtk_object_sink (GTK_OBJECT (priv->hadj));
-
-		g_signal_connect (G_OBJECT (priv->hadj),
-				  "value_changed",
-				  G_CALLBACK (hadj_value_changed),
-				  selector);
-        }
-
-        if (priv->vadj != vadj) {
-		priv->vadj = vadj;
-		g_object_ref (priv->vadj);
-		gtk_object_sink (GTK_OBJECT (priv->vadj));
-
-		g_signal_connect (G_OBJECT (priv->vadj),
-				  "value_changed",
-				  G_CALLBACK (vadj_value_changed),
-				  selector);
-        }
-}
-
-
 static gboolean scroll_event (GtkWidget *widget, GdkEventScroll *event);
 
 
@@ -1846,7 +1787,6 @@ class_init (GthImageSelectorClass *class)
 	widget_class->motion_notify_event  = motion_notify;
 	widget_class->scroll_event         = scroll_event;
 
-	class->set_scroll_adjustments = set_scroll_adjustments;
         widget_class->set_scroll_adjustments_signal =
 		g_signal_new ("set_scroll_adjustments",
 			      G_TYPE_FROM_CLASS (class),
@@ -1886,10 +1826,8 @@ init (GthImageSelector *selector)
 	selector->priv->vadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 1.0, 0.0,
 								   1.0, 1.0, 1.0));
 
-	g_object_ref (selector->priv->hadj);
-	gtk_object_sink (GTK_OBJECT (selector->priv->hadj));
-	g_object_ref (selector->priv->vadj);
-	gtk_object_sink (GTK_OBJECT (selector->priv->vadj));
+	g_object_ref_sink (selector->priv->hadj);
+	g_object_ref_sink (selector->priv->vadj);
 
 	g_signal_connect (G_OBJECT (selector->priv->hadj),
 			  "value_changed",



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]