diff options
author | Ted Gould <ted@gould.cx> | 2010-11-12 14:30:46 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-11-12 14:30:46 -0600 |
commit | efd88243d8e4e8911f08e86744ef13387ac4ae6a (patch) | |
tree | 514888f67b94a8bb1e6f148576193395e19e7a2a /libdbusmenu-glib | |
parent | 030de7ba74d6560ef61b31913c244a4be1d5116b (diff) | |
download | libdbusmenu-efd88243d8e4e8911f08e86744ef13387ac4ae6a.tar.gz libdbusmenu-efd88243d8e4e8911f08e86744ef13387ac4ae6a.tar.bz2 libdbusmenu-efd88243d8e4e8911f08e86744ef13387ac4ae6a.zip |
Including the interface description and building the objects from it once
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r-- | libdbusmenu-glib/client.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index f672696..30dce89 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -41,6 +41,7 @@ License version 3 and version 2.1 along with this program. If not, see #include "client-menuitem.h" #include "server-marshal.h" #include "client-marshal.h" +#include "dbus-menu.xml.h" /* Properties */ enum { @@ -136,6 +137,10 @@ static void get_properties_globber (DbusmenuClient * client, gint id, const gcha static GQuark error_domain (void); static void item_activated (DBusGProxy * proxy, gint id, guint timestamp, DbusmenuClient * client); +/* Globals */ +static GDBusNodeInfo * dbusmenu_node_info = NULL; +static GDBusInterfaceInfo * dbusmenu_interface_info = NULL; + /* Build a type */ G_DEFINE_TYPE (DbusmenuClient, dbusmenu_client, G_TYPE_OBJECT); @@ -246,6 +251,24 @@ dbusmenu_client_class_init (DbusmenuClientClass *klass) NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); + if (dbusmenu_node_info == NULL) { + GError * error = NULL; + + dbusmenu_node_info = g_dbus_node_info_new_for_xml(dbus_menu_xml, &error); + if (error != NULL) { + g_error("Unable to parse DBusmenu Interface description: %s", error->message); + g_error_free(error); + } + } + + if (dbusmenu_interface_info == NULL) { + dbusmenu_interface_info = g_dbus_node_info_lookup_interface(dbusmenu_node_info, DBUSMENU_INTERFACE); + + if (dbusmenu_interface_info == NULL) { + g_error("Unable to find interface '" DBUSMENU_INTERFACE "'"); + } + } + return; } |