aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk/menuitem.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-06-23 14:41:30 -0500
committerTed Gould <ted@gould.cx>2010-06-23 14:41:30 -0500
commitdf4949bb3ea62b531bf2a38cc2f37a1f9ead4991 (patch)
tree7da4144114e54ef141d79f5c5e86d74938c8b56e /libdbusmenu-gtk/menuitem.c
parent9c28ec10b2481d4374dd83310d9a894dca01d5c1 (diff)
downloadlibdbusmenu-df4949bb3ea62b531bf2a38cc2f37a1f9ead4991.tar.gz
libdbusmenu-df4949bb3ea62b531bf2a38cc2f37a1f9ead4991.tar.bz2
libdbusmenu-df4949bb3ea62b531bf2a38cc2f37a1f9ead4991.zip
The joy of specialized collections.
Diffstat (limited to 'libdbusmenu-gtk/menuitem.c')
-rw-r--r--libdbusmenu-gtk/menuitem.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/libdbusmenu-gtk/menuitem.c b/libdbusmenu-gtk/menuitem.c
index 811ff1f..3a0f117 100644
--- a/libdbusmenu-gtk/menuitem.c
+++ b/libdbusmenu-gtk/menuitem.c
@@ -201,15 +201,22 @@ dbusmenu_menuitem_property_set_shortcut (DbusmenuMenuitem * menuitem, guint key,
const gchar * keyname = gdk_keyval_name(key);
g_array_append_val(array, keyname);
- GPtrArray * wrapper = g_ptr_array_new();
- GValue wrap_val = {0};
- g_value_init(&wrap_val, G_TYPE_STRV);
- g_value_set_boxed(&wrap_val, array->data);
- g_ptr_array_add(wrapper, &wrap_val);
-
- GValue value = {0};
- g_value_init(&value, G_TYPE_PTR_ARRAY);
- g_value_set_boxed(&value, wrapper);
+ GType type = dbus_g_type_get_collection("GPtrArray", G_TYPE_STRV);
+ GPtrArray * wrapper = (GPtrArray *)dbus_g_type_specialized_construct(type);
+
+ GValue value = {0,};
+ g_value_init(&value, type);
+ g_value_take_boxed(&value, wrapper);
+
+ DBusGTypeSpecializedAppendContext ctx;
+ dbus_g_type_specialized_init_append(&value, &ctx);
+
+ GValue strval = {0,};
+ g_value_init(&strval, G_TYPE_STRV);
+ g_value_take_boxed(&strval, array->data);
+
+ dbus_g_type_specialized_collection_append(&ctx, &strval);
+ dbus_g_type_specialized_collection_end_append(&ctx);
dbusmenu_menuitem_property_set_value(menuitem, DBUSMENU_MENUITEM_PROP_SHORTCUT, &value);