aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-06-14 23:48:51 -0500
committerTed Gould <ted@gould.cx>2010-06-14 23:48:51 -0500
commit2a1ad77c4b91f35b69e42a79b48b2f0cc0f01bfb (patch)
tree76ea67fb43bbc8d4b30845653d62a061872f5189 /libdbusmenu-gtk
parentb31f6418f37bc35dc59162d5878eacb5002e3402 (diff)
downloadlibdbusmenu-2a1ad77c4b91f35b69e42a79b48b2f0cc0f01bfb.tar.gz
libdbusmenu-2a1ad77c4b91f35b69e42a79b48b2f0cc0f01bfb.tar.bz2
libdbusmenu-2a1ad77c4b91f35b69e42a79b48b2f0cc0f01bfb.zip
Switching get over to a GValueArray too!
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r--libdbusmenu-gtk/menuitem.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/libdbusmenu-gtk/menuitem.c b/libdbusmenu-gtk/menuitem.c
index 9a374b0..a448f88 100644
--- a/libdbusmenu-gtk/menuitem.c
+++ b/libdbusmenu-gtk/menuitem.c
@@ -292,19 +292,18 @@ dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * ke
return;
}
- g_return_if_fail(G_VALUE_HOLDS_BOXED(wrapper));
-
- GPtrArray * wrapperarray = (GPtrArray *)g_value_get_boxed(wrapper);
- if (wrapperarray->len == 0) {
+ GValueArray * wrapperarray = (GValueArray *)g_value_get_boxed(wrapper);
+ if (wrapperarray->n_values == 0) {
return;
}
- if (wrapperarray->len != 1) {
+ if (wrapperarray->n_values != 1) {
g_warning("Shortcut is more than one entry. Which we don't currently support. Taking the first.");
}
- GPtrArray * entryarray = g_ptr_array_index(wrapperarray, 0);
- if (entryarray->len == 0) {
+ GValue * ventryarray = g_value_array_get_nth(wrapperarray, 0);
+ GValueArray * entryarray = (GValueArray *)g_value_get_boxed(ventryarray);
+ if (entryarray->n_values == 0) {
/* Seems a little odd, but really, we're saying that it isn't a
shortcut, so I'm comfortable with exiting silently. */
return;
@@ -312,20 +311,20 @@ dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * ke
/* Parse through modifiers */
int i;
- for (i = 0; i < entryarray->len - 1; i++) {
- if (g_strcmp0(g_ptr_array_index(entryarray, i), DBUSMENU_MENUITEM_SHORTCUT_CONTROL) == 0) {
+ for (i = 0; i < entryarray->n_values - 1; i++) {
+ if (g_strcmp0(g_value_get_string(g_value_array_get_nth(entryarray, i)), DBUSMENU_MENUITEM_SHORTCUT_CONTROL) == 0) {
*modifier |= GDK_CONTROL_MASK;
continue;
}
- if (g_strcmp0(g_ptr_array_index(entryarray, i), DBUSMENU_MENUITEM_SHORTCUT_ALT) == 0) {
+ if (g_strcmp0(g_value_get_string(g_value_array_get_nth(entryarray, i)), DBUSMENU_MENUITEM_SHORTCUT_ALT) == 0) {
*modifier |= GDK_MOD1_MASK;
continue;
}
- if (g_strcmp0(g_ptr_array_index(entryarray, i), DBUSMENU_MENUITEM_SHORTCUT_SHIFT) == 0) {
+ if (g_strcmp0(g_value_get_string(g_value_array_get_nth(entryarray, i)), DBUSMENU_MENUITEM_SHORTCUT_SHIFT) == 0) {
*modifier |= GDK_SHIFT_MASK;
continue;
}
- if (g_strcmp0(g_ptr_array_index(entryarray, i), DBUSMENU_MENUITEM_SHORTCUT_SUPER) == 0) {
+ if (g_strcmp0(g_value_get_string(g_value_array_get_nth(entryarray, i)), DBUSMENU_MENUITEM_SHORTCUT_SUPER) == 0) {
*modifier |= GDK_SUPER_MASK;
continue;
}
@@ -333,7 +332,7 @@ dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * ke
GdkModifierType tempmod;
- gtk_accelerator_parse(g_ptr_array_index(entryarray, entryarray->len - 1), key, &tempmod);
+ gtk_accelerator_parse(g_value_get_string(g_value_array_get_nth(entryarray, entryarray->n_values - 1)), key, &tempmod);
return;
}