Merge lp:~ted/libdbusmenu/no-warning-for-prop into lp:libdbusmenu/0.5

Proposed by Ted Gould
Status: Merged
Merged at revision: 195
Proposed branch: lp:~ted/libdbusmenu/no-warning-for-prop
Merge into: lp:libdbusmenu/0.5
Diff against target: 59 lines (+26/-2)
1 file modified
libdbusmenu-gtk/client.c (+26/-2)
To merge this branch: bzr merge lp:~ted/libdbusmenu/no-warning-for-prop
Reviewer Review Type Date Requested Status
Jay Taoko (community) Approve
Review via email: mp+47476@code.launchpad.net

Description of the change

Seems not all GTK+ packages are keeping with this patch. Let's make it not awful if something happens to it.

To post a comment you must log in.
Revision history for this message
Jay Taoko (jaytaoko) wrote :

In function set_use_fallback(), the value of checked is never changed to TRUE. Looks like the check will be done every time the function is called.

Revision history for this message
Ted Gould (ted) wrote :

On Thu, 2011-01-27 at 04:33 +0000, Jay Taoko wrote:
> In function set_use_fallback(), the value of checked is never changed to TRUE. Looks like the check will be done every time the function is called.

Oops! Fixed in r194.

194. By Ted Gould

Actually setting the 'checked' value

Revision history for this message
Jay Taoko (jaytaoko) wrote :

Approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libdbusmenu-gtk/client.c'
--- libdbusmenu-gtk/client.c 2011-01-18 21:59:36 +0000
+++ libdbusmenu-gtk/client.c 2011-01-27 04:44:08 +0000
@@ -42,6 +42,7 @@
42};42};
4343
44#define DBUSMENU_GTKCLIENT_GET_PRIVATE(o) (DBUSMENU_GTKCLIENT(o)->priv)44#define DBUSMENU_GTKCLIENT_GET_PRIVATE(o) (DBUSMENU_GTKCLIENT(o)->priv)
45#define USE_FALLBACK_PROP "use-fallback"
4546
46/* Prototypes */47/* Prototypes */
47static void dbusmenu_gtkclient_class_init (DbusmenuGtkClientClass *klass);48static void dbusmenu_gtkclient_class_init (DbusmenuGtkClientClass *klass);
@@ -737,6 +738,29 @@
737 return TRUE;738 return TRUE;
738}739}
739740
741/* A little helper so we don't generate a bunch of warnings
742 about being able to set use-fallback */
743static void
744set_use_fallback (GtkWidget * widget)
745{
746 static gboolean checked = FALSE;
747 static gboolean available = FALSE;
748
749 if (!checked) {
750 available = (g_object_class_find_property(G_OBJECT_CLASS(GTK_IMAGE_GET_CLASS(widget)), USE_FALLBACK_PROP) != NULL);
751 if (!available) {
752 g_warning("The '" USE_FALLBACK_PROP "' is not available on GtkImage so icons may not show correctly.");
753 }
754 checked = TRUE;
755 }
756
757 if (available) {
758 g_object_set(G_OBJECT(widget), USE_FALLBACK_PROP, TRUE, NULL);
759 }
760
761 return;
762}
763
740/* This handler looks at property changes for items that are764/* This handler looks at property changes for items that are
741 image menu items. */765 image menu items. */
742static void766static void
@@ -789,7 +813,7 @@
789 gtkimage = NULL;813 gtkimage = NULL;
790 } else if (g_strcmp0(iconname, DBUSMENU_MENUITEM_ICON_NAME_BLANK) == 0) {814 } else if (g_strcmp0(iconname, DBUSMENU_MENUITEM_ICON_NAME_BLANK) == 0) {
791 gtkimage = gtk_image_new();815 gtkimage = gtk_image_new();
792 g_object_set(G_OBJECT(gtkimage), "use-fallback", TRUE, NULL);816 set_use_fallback(gtkimage);
793 } else {817 } else {
794 /* Look to see if we want to have an icon with the 'ltr' or818 /* Look to see if we want to have an icon with the 'ltr' or
795 'rtl' depending on what we're doing. */819 'rtl' depending on what we're doing. */
@@ -808,7 +832,7 @@
808 can just convert it to this name. */832 can just convert it to this name. */
809 if (gtkimage == NULL) {833 if (gtkimage == NULL) {
810 gtkimage = gtk_image_new_from_icon_name(finaliconname, GTK_ICON_SIZE_MENU);834 gtkimage = gtk_image_new_from_icon_name(finaliconname, GTK_ICON_SIZE_MENU);
811 g_object_set(G_OBJECT(gtkimage), "use-fallback", TRUE, NULL);835 set_use_fallback(gtkimage);
812 } else {836 } else {
813 gtk_image_set_from_icon_name(GTK_IMAGE(gtkimage), finaliconname, GTK_ICON_SIZE_MENU);837 gtk_image_set_from_icon_name(GTK_IMAGE(gtkimage), finaliconname, GTK_ICON_SIZE_MENU);
814 }838 }

Subscribers

People subscribed via source and target branches