diff options
-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; } |