[retro-gtk: 8/12] gl-display: Drop the 'pixbuf' property



commit 290d863d5c70005f16d214b467fbb397ee0b0fa9
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Sat Nov 18 10:04:14 2017 +0100

    gl-display: Drop the 'pixbuf' property
    
    Instead, let accessing the pixbuf via the set_pixbuf() and get_pixbuf()
    methods as previously done.
    
    This avoid notifying changes of the pixbuf and accidentally building the
    pixbuf on during the notification chain when building the pixbuf on
    demand from the pixdata as will be introduced  in the next commit.

 retro-gtk/retro-gl-display.c |   68 +-----------------------------------------
 1 files changed, 1 insertions(+), 67 deletions(-)
---
diff --git a/retro-gtk/retro-gl-display.c b/retro-gtk/retro-gl-display.c
index 98938d8..1209711 100644
--- a/retro-gtk/retro-gl-display.c
+++ b/retro-gtk/retro-gl-display.c
@@ -22,13 +22,6 @@ struct _RetroGLDisplay
 
 G_DEFINE_TYPE (RetroGLDisplay, retro_gl_display, GTK_TYPE_GL_AREA)
 
-enum {
-  PROP_PIXBUF = 1,
-  N_PROPS,
-};
-
-static GParamSpec *properties [N_PROPS];
-
 typedef struct {
   struct {
     float x, y;
@@ -317,64 +310,11 @@ retro_gl_display_finalize (GObject *object)
 }
 
 static void
-retro_gl_display_get_property (GObject    *object,
-                               guint       prop_id,
-                               GValue     *value,
-                               GParamSpec *pspec)
-{
-  RetroGLDisplay *self = RETRO_GL_DISPLAY (object);
-
-  switch (prop_id) {
-  case PROP_PIXBUF:
-    g_value_set_object (value, retro_gl_display_get_pixbuf (self));
-
-    break;
-  default:
-    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-
-    break;
-  }
-}
-
-static void
-retro_gl_display_set_property (GObject      *object,
-                               guint         prop_id,
-                               const GValue *value,
-                               GParamSpec   *pspec)
-{
-  RetroGLDisplay *self = RETRO_GL_DISPLAY (object);
-
-  switch (prop_id) {
-  case PROP_PIXBUF:
-    retro_gl_display_set_pixbuf (self, g_value_get_object (value));
-
-    break;
-  default:
-    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-
-    break;
-  }
-}
-
-static void
 retro_gl_display_class_init (RetroGLDisplayClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
   object_class->finalize = retro_gl_display_finalize;
-  object_class->get_property = retro_gl_display_get_property;
-  object_class->set_property = retro_gl_display_set_property;
-
-  properties[PROP_PIXBUF] =
-    g_param_spec_object ("pixbuf",
-                         "Pixbuf",
-                         "The displayed pixbuf",
-                         gdk_pixbuf_get_type (),
-                         G_PARAM_READWRITE |
-                         G_PARAM_STATIC_NAME |
-                         G_PARAM_STATIC_NICK |
-                         G_PARAM_STATIC_BLURB);
-  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PIXBUF, properties[PROP_PIXBUF]);
 }
 
 static void
@@ -413,12 +353,6 @@ retro_gl_display_init (RetroGLDisplay *self)
                            (GCallback) queue_draw,
                            GTK_WIDGET (self),
                            0);
-
-  g_signal_connect_object (G_OBJECT (self),
-                           "notify::pixbuf",
-                           (GCallback) queue_draw,
-                           GTK_WIDGET (self),
-                           0);
 }
 
 static void
@@ -506,7 +440,7 @@ retro_gl_display_set_pixbuf (RetroGLDisplay *self,
   if (pixbuf != NULL)
     self->pixbuf = g_object_ref (pixbuf);
 
-  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PIXBUF]);
+  gtk_widget_queue_draw (GTK_WIDGET (self));
 }
 
 /**


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