aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-03-31 11:27:43 -0500
committerTed Gould <ted@gould.cx>2011-03-31 11:27:43 -0500
commit3a30b4e69664ce2c3230f1fb82376220cc096ef5 (patch)
treea1a48b29d4b5ddb5b0b5eaecd5a384d93dc63fb5 /libdbusmenu-gtk
parentccfe934dfcc15011d9be4c296cbd060bd17512b0 (diff)
parent6c9761c9c66a51d6a00a59f14048267beb7ca7f1 (diff)
downloadlibdbusmenu-3a30b4e69664ce2c3230f1fb82376220cc096ef5.tar.gz
libdbusmenu-3a30b4e69664ce2c3230f1fb82376220cc096ef5.tar.bz2
libdbusmenu-3a30b4e69664ce2c3230f1fb82376220cc096ef5.zip
Ensuring that our iterators have variants to reference and ref'ing them correctly.
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r--libdbusmenu-gtk/menuitem.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/libdbusmenu-gtk/menuitem.c b/libdbusmenu-gtk/menuitem.c
index ca2bc3e..0f511bc 100644
--- a/libdbusmenu-gtk/menuitem.c
+++ b/libdbusmenu-gtk/menuitem.c
@@ -275,6 +275,17 @@ dbusmenu_menuitem_property_set_shortcut_menuitem (DbusmenuMenuitem * menuitem, c
void
dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * key, GdkModifierType * modifier)
{
+ guint dummykey;
+ GdkModifierType dummymodifier;
+
+ if (key == NULL) {
+ key = &dummykey;
+ }
+
+ if (modifier == NULL) {
+ modifier = &dummymodifier;
+ }
+
*key = 0;
*modifier = 0;
@@ -287,15 +298,15 @@ dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * ke
if (g_variant_n_children(wrapper) != 1) {
g_warning("Unable to parse shortcut, too many keys");
- g_variant_unref(wrapper);
return;
}
GVariantIter iter;
- g_variant_iter_init(&iter, g_variant_get_child_value(wrapper, 0));
+ GVariant * child = g_variant_get_child_value(wrapper, 0);
+ g_variant_iter_init(&iter, child);
gchar * string;
- while(g_variant_iter_next(&iter, "s", &string)) {
+ while(g_variant_iter_loop(&iter, "s", &string)) {
if (g_strcmp0(string, DBUSMENU_MENUITEM_SHORTCUT_CONTROL) == 0) {
*modifier |= GDK_CONTROL_MASK;
} else if (g_strcmp0(string, DBUSMENU_MENUITEM_SHORTCUT_ALT) == 0) {
@@ -308,10 +319,10 @@ dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * ke
GdkModifierType tempmod;
gtk_accelerator_parse(string, key, &tempmod);
}
-
- g_free(string);
}
+ g_variant_unref(child);
+
return;
}