From f309ec2bb22cda3e2f763f96bb6a08652d9373d8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Oct 2010 10:55:58 -0500 Subject: Changing the way the static interface information is generated --- libdbusmenu-glib/server.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index c5cf2fe..bbccd73 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -30,10 +30,14 @@ License version 3 and version 2.1 along with this program. If not, see #include "config.h" #endif +#include + #include "menuitem-private.h" #include "server.h" #include "server-marshal.h" +#include "dbus-menu.xml.h" + /* DBus Prototypes */ static gboolean _dbusmenu_server_get_layout (DbusmenuServer * server, gint parent, guint * revision, gchar ** layout, GError ** error); static gboolean _dbusmenu_server_get_property (DbusmenuServer * server, gint id, gchar * property, gchar ** value, GError ** error); @@ -46,8 +50,6 @@ static gboolean _dbusmenu_server_about_to_show (DbusmenuServer * server, gint id static void _gvalue_array_append_int(GValueArray *array, gint i); static void _gvalue_array_append_hashtable(GValueArray *array, GHashTable * dict); -#include "dbusmenu-server.h" - static void layout_update_signal (DbusmenuServer * server); #define DBUSMENU_VERSION_NUMBER 2 @@ -91,6 +93,10 @@ enum { LAST_ERROR }; +/* Globals */ +static GDBusNodeInfo * dbusmenu_node_info = NULL; +static GDBusInterfaceInfo * dbusmenu_interface_info = NULL; + /* Prototype */ static void dbusmenu_server_class_init (DbusmenuServerClass *class); static void dbusmenu_server_init (DbusmenuServer *self); @@ -203,7 +209,23 @@ dbusmenu_server_class_init (DbusmenuServerClass *class) DBUSMENU_VERSION_NUMBER, DBUSMENU_VERSION_NUMBER, DBUSMENU_VERSION_NUMBER, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - dbus_g_object_type_install_info(DBUSMENU_TYPE_SERVER, &dbus_glib__dbusmenu_server_object_info); + 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, "org.ayatana.dbusmenu"); + + if (dbusmenu_interface_info == NULL) { + g_error("Unable to find interface 'org.ayatana.dbusmenu'"); + } + } return; } -- cgit v1.2.3