[Xfce4-commits] <xfce4-panel:devel> * Remove deprecated gtk_type_class. * Fix launcher icon load after xsettings crash.

Nick Schermer nick at xfce.org
Tue Aug 11 20:22:40 CEST 2009


Updating branch refs/heads/devel
         to bb1582b4c68761243dd13d1b7e9f2767616cfd80 (commit)
       from 3c3fa3a9b84cc4779db68e4c3e1e3cab842e2a38 (commit)

commit bb1582b4c68761243dd13d1b7e9f2767616cfd80
Author: Nick Schermer <nick at xfce.org>
Date:   Fri Aug 1 21:28:35 2008 +0200

    * Remove deprecated gtk_type_class.
    * Fix launcher icon load after xsettings crash.

 libxfce4panel/xfce-hvbox.c  |   38 ++++++++++++++++++++++----------------
 plugins/launcher/launcher.c |    4 ----
 2 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/libxfce4panel/xfce-hvbox.c b/libxfce4panel/xfce-hvbox.c
index e23ac11..4e951de 100644
--- a/libxfce4panel/xfce-hvbox.c
+++ b/libxfce4panel/xfce-hvbox.c
@@ -30,13 +30,13 @@
 
 
 
-static void            xfce_hvbox_class_init    (XfceHVBoxClass *klass);
-static void            xfce_hvbox_init          (XfceHVBox      *hvbox);
-static GtkWidgetClass *xfce_hvbox_get_class     (XfceHVBox      *hvbox);
-static void            xfce_hvbox_size_request  (GtkWidget      *widget,
-                                                 GtkRequisition *requisition);
-static void            xfce_hvbox_size_allocate (GtkWidget      *widget,
-                                                 GtkAllocation  *allocation);
+static void     xfce_hvbox_class_init    (XfceHVBoxClass *klass);
+static void     xfce_hvbox_init          (XfceHVBox      *hvbox);
+static gpointer xfce_hvbox_get_class     (XfceHVBox      *hvbox);
+static void     xfce_hvbox_size_request  (GtkWidget      *widget,
+                                          GtkRequisition *requisition);
+static void     xfce_hvbox_size_allocate (GtkWidget      *widget,
+                                          GtkAllocation  *allocation);
 
 
 
@@ -65,18 +65,22 @@ xfce_hvbox_init (XfceHVBox *hvbox)
 
 
 
-static GtkWidgetClass *
+static gpointer
 xfce_hvbox_get_class (XfceHVBox *hvbox)
 {
-  GType type;
+  GType    type;
+  gpointer klass;
 
   if (hvbox->orientation == GTK_ORIENTATION_HORIZONTAL)
     type = GTK_TYPE_HBOX;
   else
     type = GTK_TYPE_VBOX;
 
-  /* return the widget class of the type */
-  return GTK_WIDGET_CLASS (gtk_type_class (type));
+  /* peek the class, this only works if the class already exists */
+  klass = g_type_class_peek (type);
+  
+  /* return the type or create the class */
+  return klass ? klass : g_type_class_ref (type);
 }
 
 
@@ -85,12 +89,13 @@ static void
 xfce_hvbox_size_request (GtkWidget      *widget,
                          GtkRequisition *requisition)
 {
-  GtkWidgetClass *klass;
+  gpointer klass;
 
   /* get the widget class */
   klass = xfce_hvbox_get_class (XFCE_HVBOX (widget));
-
-  (*klass->size_request) (widget, requisition);
+  
+  /* request the size */
+  (*GTK_WIDGET_CLASS (klass)->size_request) (widget, requisition);
 }
 
 
@@ -99,12 +104,13 @@ static void
 xfce_hvbox_size_allocate (GtkWidget     *widget,
                           GtkAllocation *allocation)
 {
-  GtkWidgetClass *klass;
+  gpointer klass;
 
   /* get the widget class */
   klass = xfce_hvbox_get_class (XFCE_HVBOX (widget));
 
-  (*klass->size_allocate) (widget, allocation);
+  /* allocate the size */
+  (*GTK_WIDGET_CLASS (klass)->size_allocate) (widget, allocation);
 }
 
 
diff --git a/plugins/launcher/launcher.c b/plugins/launcher/launcher.c
index cb02cfc..815ac9e 100644
--- a/plugins/launcher/launcher.c
+++ b/plugins/launcher/launcher.c
@@ -109,10 +109,6 @@ launcher_utility_icon_theme_changed (GSignalInvocationHint *ihint,
                                      const GValue          *param_values,
                                      LauncherPlugin        *launcher)
 {
-    /* only update if we already have an image, this fails when the signal is connected */
-    if (G_LIKELY (gtk_image_get_storage_type (GTK_IMAGE (launcher->image)) == GTK_IMAGE_EMPTY))
-        return TRUE;
-
     /* update the button icon */
     launcher_icon_button_set_icon (launcher);
 



More information about the Xfce4-commits mailing list