[Xfce4-commits] <xfce4-panel:andrzejr/wrapper3> panel-image: use style-update signal rather than style-set.
Andrzej
noreply at xfce.org
Mon Aug 26 00:26:03 CEST 2013
Updating branch refs/heads/andrzejr/wrapper3
to 50462009c0fa6ab1097f393dee97042b1be4471e (commit)
from 700769744a13cb166214c9ddda1e987b1ad5ef04 (commit)
commit 50462009c0fa6ab1097f393dee97042b1be4471e
Author: Andrzej <ndrwrdck at gmail.com>
Date: Sun Apr 14 01:09:57 2013 +0100
panel-image: use style-update signal rather than style-set.
Doesn't seem to make any difference here but style-set is deprecated
since Gtk+ 3.0.
libxfce4panel/xfce-panel-image.c | 43 +++++++++++++++++++++++++++++++++++++-
1 file changed, 42 insertions(+), 1 deletion(-)
diff --git a/libxfce4panel/xfce-panel-image.c b/libxfce4panel/xfce-panel-image.c
index 1fd96d4..b5afae6 100644
--- a/libxfce4panel/xfce-panel-image.c
+++ b/libxfce4panel/xfce-panel-image.c
@@ -134,8 +134,12 @@ static gboolean xfce_panel_image_draw (GtkWidget *widget
static gboolean xfce_panel_image_expose_event (GtkWidget *widget,
GdkEventExpose *event);
#endif
+#if GTK_CHECK_VERSION (3, 0, 0)
+static void xfce_panel_image_style_updated (GtkWidget *widget);
+#else
static void xfce_panel_image_style_set (GtkWidget *widget,
GtkStyle *previous_style);
+#endif
static gboolean xfce_panel_image_load (gpointer data);
static void xfce_panel_image_load_destroy (gpointer data);
static GdkPixbuf *xfce_panel_image_scale_pixbuf (GdkPixbuf *source,
@@ -171,10 +175,11 @@ xfce_panel_image_class_init (XfcePanelImageClass *klass)
gtkwidget_class->size_allocate = xfce_panel_image_size_allocate;
#if GTK_CHECK_VERSION (3, 0, 0)
gtkwidget_class->draw = xfce_panel_image_draw;
+ gtkwidget_class->style_updated = xfce_panel_image_style_updated;
#else
gtkwidget_class->expose_event = xfce_panel_image_expose_event;
-#endif
gtkwidget_class->style_set = xfce_panel_image_style_set;
+#endif
g_object_class_install_property (gobject_class,
PROP_SOURCE,
@@ -525,6 +530,41 @@ xfce_panel_image_expose_event (GtkWidget *widget,
+#if GTK_CHECK_VERSION (3, 0, 0)
+static void
+xfce_panel_image_style_updated (GtkWidget *widget)
+{
+ XfcePanelImagePrivate *priv = XFCE_PANEL_IMAGE (widget)->priv;
+ gboolean force;
+
+ /* let gtk update the widget style */
+ (*GTK_WIDGET_CLASS (xfce_panel_image_parent_class)->style_updated) (widget);
+
+ /* get style property */
+ gtk_widget_style_get (widget, "force-gtk-icon-sizes", &force, NULL);
+
+ /* update if needed */
+ if (priv->force_icon_sizes != force)
+ {
+ priv->force_icon_sizes = force;
+ if (priv->size > 0)
+ gtk_widget_queue_resize (widget);
+ }
+
+ /* update the icon if we have an icon-name source */
+ if (priv->source != NULL
+ && !g_path_is_absolute (priv->source))
+ {
+ /* unset the size to force an update */
+ priv->width = priv->height = -1;
+ gtk_widget_queue_resize (widget);
+ }
+}
+#endif
+
+
+
+#if !GTK_CHECK_VERSION (3, 0, 0)
static void
xfce_panel_image_style_set (GtkWidget *widget,
GtkStyle *previous_style)
@@ -555,6 +595,7 @@ xfce_panel_image_style_set (GtkWidget *widget,
gtk_widget_queue_resize (widget);
}
}
+#endif
More information about the Xfce4-commits
mailing list