[Xfce4-commits] [xfce/xfdesktop] 15/16: trivial: fix warning when no image set

noreply at xfce.org noreply at xfce.org
Wed Apr 19 17:46:32 CEST 2017


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository xfce/xfdesktop.

commit 13c901da107c806294ca757144b2a68eb53772c8
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Wed Apr 19 16:47:08 2017 +0300

    trivial: fix warning when no image set
---
 common/xfdesktop-common.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/common/xfdesktop-common.c b/common/xfdesktop-common.c
index acadd26..f3e60d9 100644
--- a/common/xfdesktop-common.c
+++ b/common/xfdesktop-common.c
@@ -217,10 +217,14 @@ xfdesktop_menu_create_menu_item_with_markup(const gchar *name,
     box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
     gtk_widget_set_halign (label, GTK_ALIGN_START);
 
-    gtk_widget_show (image);
-
     /* Add the image and label to the box, add the box to the menu item */
-    gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 0);
+    if(image && GTK_IS_WIDGET(image)) {
+        /* only add the widget if it exists */
+        gtk_widget_show (image);
+
+        gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 0);
+    }
+
     gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 6);
     gtk_widget_show_all (box);
     gtk_container_add (GTK_CONTAINER (mi), box);
@@ -247,10 +251,14 @@ xfdesktop_menu_create_menu_item_with_mnemonic(const gchar *name,
     box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
     gtk_widget_set_halign (label, GTK_ALIGN_START);
 
-    gtk_widget_show (image);
-
     /* Add the image and label to the box, add the box to the menu item */
-    gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 0);
+    if(image && GTK_IS_WIDGET(image)) {
+        /* only add the widget if it exists */
+        gtk_widget_show (image);
+
+        gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 0);
+    }
+
     gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 6);
     gtk_widget_show_all (box);
     gtk_container_add (GTK_CONTAINER (mi), box);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list