[Xfce4-commits] <xfdesktop:master> Work around Gtk 2.16 function (bug #6883).

Nick Schermer noreply at xfce.org
Thu Dec 9 20:26:01 CET 2010


Updating branch refs/heads/master
         to 8ad257bf053c0b6842d85c5bd1f08e35e4659c37 (commit)
       from a6de3601cdf7e38b5479ea4d3a64819a82d08b76 (commit)

commit 8ad257bf053c0b6842d85c5bd1f08e35e4659c37
Author: Nick Schermer <nick at xfce.org>
Date:   Thu Dec 9 20:24:22 2010 +0100

    Work around Gtk 2.16 function (bug #6883).

 src/xfdesktop-app-menu-item.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/src/xfdesktop-app-menu-item.c b/src/xfdesktop-app-menu-item.c
index e10696a..58ab6f9 100644
--- a/src/xfdesktop-app-menu-item.c
+++ b/src/xfdesktop-app-menu-item.c
@@ -225,6 +225,9 @@ static void
 xfdesktop_app_menu_item_changed(XfdesktopAppMenuItem *app_menu_item)
 {
     const gchar *label;
+#if !GTK_CHECK_VERSION (2, 16, 0)
+    GtkWidget   *child;
+#endif
 
     g_return_if_fail(XFCE_IS_APP_MENU_ITEM(app_menu_item));
     g_return_if_fail(GARCON_IS_MENU_ITEM(app_menu_item->item));
@@ -233,7 +236,24 @@ xfdesktop_app_menu_item_changed(XfdesktopAppMenuItem *app_menu_item)
         xfdesktop_app_menu_item_set_icon(app_menu_item);
 
     label = garcon_menu_item_get_name(app_menu_item->item);
-    gtk_menu_item_set_label(GTK_MENU_ITEM(app_menu_item), label ? label : "");
+    if (G_UNLIKELY (label == NULL))
+      label = "";
+
+#if GTK_CHECK_VERSION(2, 16, 0)
+    gtk_menu_item_set_label(GTK_MENU_ITEM(app_menu_item), label);
+#else
+    child = gtk_bin_get_child(GTK_BIN (app_menu_item));
+    if (child == NULL) {
+        child = gtk_accel_label_new(label);
+        gtk_container_add(GTK_CONTAINER(app_menu_item), child);
+        gtk_misc_set_alignment(GTK_MISC(child), 0.0, 0.5);
+        gtk_accel_label_set_accel_widget(GTK_ACCEL_LABEL(child), GTK_WIDGET(app_menu_item));
+        gtk_widget_show(child);
+    } else {
+        g_return_if_fail(GTK_IS_LABEL(child));
+        gtk_label_set_text (GTK_LABEL (child), label ? label : "");
+    }
+#endif
 }
 
 static void



More information about the Xfce4-commits mailing list