aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk/menuitem.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-06-23 09:07:27 -0500
committerTed Gould <ted@gould.cx>2010-06-23 09:07:27 -0500
commitf071a21b449e8ac1d34b593dc788929e175d987f (patch)
tree3a88dff1ea45823813d2b5459658349c41f071ab /libdbusmenu-gtk/menuitem.c
parentc94eb1cfe25551c528409fdcb9d56446a915ed0f (diff)
downloadlibdbusmenu-f071a21b449e8ac1d34b593dc788929e175d987f.tar.gz
libdbusmenu-f071a21b449e8ac1d34b593dc788929e175d987f.tar.bz2
libdbusmenu-f071a21b449e8ac1d34b593dc788929e175d987f.zip
Building us some custom types.
Diffstat (limited to 'libdbusmenu-gtk/menuitem.c')
-rw-r--r--libdbusmenu-gtk/menuitem.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/libdbusmenu-gtk/menuitem.c b/libdbusmenu-gtk/menuitem.c
index 44e78e1..532f478 100644
--- a/libdbusmenu-gtk/menuitem.c
+++ b/libdbusmenu-gtk/menuitem.c
@@ -29,6 +29,7 @@ License version 3 and version 2.1 along with this program. If not, see
#include "menuitem.h"
#include <gdk/gdk.h>
#include <gtk/gtk.h>
+#include <dbus/dbus-gtype-specialized.h>
/**
dbusmenu_menuitem_property_set_image:
@@ -274,6 +275,27 @@ dbusmenu_menuitem_property_set_shortcut_menuitem (DbusmenuMenuitem * menuitem, c
return dbusmenu_menuitem_property_set_shortcut(menuitem, key->accel_key, key->accel_mods);
}
+static const gchar * wrapper_type_name = "wrapper-type";
+static const gchar * string_array_type_name = "string-array-type";
+
+static GType wrapper_type = 0;
+static GType string_array_type = 0;
+
+/* Works with dbus to get types for the collections that we're using.
+ Should be pretty quick if we've done this once already. */
+static void
+setup_collections (void) {
+ if (string_array_type == 0) {
+ dbus_g_type_get_collection(string_array_type_name, G_TYPE_STRING);
+ }
+
+ if (wrapper_type == 0) {
+ dbus_g_type_get_collection(wrapper_type_name, string_array_type);
+ }
+
+ return;
+}
+
/**
dbusmenu_menuitem_property_get_shortcut:
@menuitem: The #DbusmenuMenuitem to get the shortcut off
@@ -290,6 +312,7 @@ dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * ke
*modifier = 0;
g_return_if_fail(DBUSMENU_IS_MENUITEM(menuitem));
+ setup_collections();
const GValue * wrapper = dbusmenu_menuitem_property_get_value(menuitem, DBUSMENU_MENUITEM_PROP_SHORTCUT);
if (wrapper == NULL) {