[gtk+/wip/baedert/gtkimageview: 216/228] abstractimage: Fix ::changed signature



commit a463352ab1229bb54b04ba935aba2032cc0e743d
Author: Timm Bäder <mail baedert org>
Date:   Fri Apr 1 11:25:32 2016 +0200

    abstractimage: Fix ::changed signature

 gtk/gtkabstractimage.c |    2 ++
 gtk/gtkabstractimage.h |    2 +-
 gtk/gtkimageview.c     |    9 ++++++++-
 3 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkabstractimage.c b/gtk/gtkabstractimage.c
index 1256df5..cd29a54 100644
--- a/gtk/gtkabstractimage.c
+++ b/gtk/gtkabstractimage.c
@@ -47,6 +47,8 @@ gtk_abstract_image_class_init (GtkAbstractImageClass *klass)
                                          NULL, NULL,
                                          _gtk_marshal_VOID__VOID,
                                          G_TYPE_NONE, 0);
+
+  klass->changed = NULL;
 }
 
 int
diff --git a/gtk/gtkabstractimage.h b/gtk/gtkabstractimage.h
index f0b7510..2dbe28b 100644
--- a/gtk/gtkabstractimage.h
+++ b/gtk/gtkabstractimage.h
@@ -51,7 +51,7 @@ struct _GtkAbstractImageClass
   int    (*get_scale_factor) (GtkAbstractImage *image);
   void   (*draw) (GtkAbstractImage *image, cairo_t *ct);
 
-  void   (*changed) (GtkAbstractImage image);
+  void   (*changed) (GtkAbstractImage *image);
 };
 
 GDK_AVAILABLE_IN_3_20
diff --git a/gtk/gtkimageview.c b/gtk/gtkimageview.c
index 4209fae..7989266 100644
--- a/gtk/gtkimageview.c
+++ b/gtk/gtkimageview.c
@@ -263,7 +263,7 @@ gtk_image_view_transitions_enabled (GtkImageView *image_view)
   return priv->transitions_enabled && animations_enabled && priv->image;
 }
 
-void
+static void
 image_changed_cb (GtkAbstractImage *image, gpointer user_data)
 {
   GtkImageView *image_view = user_data;
@@ -1946,6 +1946,13 @@ gtk_image_view_finalize (GObject *object)
   g_clear_object (&priv->hadjustment);
   g_clear_object (&priv->vadjustment);
 
+
+  if (priv->image)
+    {
+      g_signal_connect (priv->image, "changed", G_CALLBACK (image_changed_cb), image_view);
+      g_clear_object (&priv->image);
+    }
+
   G_OBJECT_CLASS (gtk_image_view_parent_class)->finalize (object);
 }
 


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