aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdbusmenu-glib/server.c28
1 files 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 <gio/gio.h>
+
#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;
}