aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-01-07 10:55:06 -0600
committerTed Gould <ted@gould.cx>2011-01-07 10:55:06 -0600
commit06270832fc023e972cac3c66fcf870a1d5b4a965 (patch)
treebf6e28ae3985e48e29e22dc4c9e12eacf3c3c411
parent55ae3fd12fae5dd33ad30704e85f053e29a3bf83 (diff)
downloadlibayatana-indicator-06270832fc023e972cac3c66fcf870a1d5b4a965.tar.gz
libayatana-indicator-06270832fc023e972cac3c66fcf870a1d5b4a965.tar.bz2
libayatana-indicator-06270832fc023e972cac3c66fcf870a1d5b4a965.zip
Parsing the XML file for the interface description on class init
-rw-r--r--libindicator/indicator-service.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c
index ed95559..3635b45 100644
--- a/libindicator/indicator-service.c
+++ b/libindicator/indicator-service.c
@@ -25,7 +25,11 @@ License along with this library. If not, see
#include "config.h"
#endif
+#include <gio/gio.h>
+
#include "indicator-service.h"
+#include "gen-indicator-service.xml.h"
+#include "dbus-shared.h"
static void unwatch_core (IndicatorService * service, const gchar * name);
static void proxy_destroyed (GObject * proxy, gpointer user_data);
@@ -34,9 +38,6 @@ static gboolean watchers_remove (gpointer key, gpointer value, gpointer user_dat
static gboolean _indicator_service_server_watch (IndicatorService * service, DBusGMethodInvocation * method);
static gboolean _indicator_service_server_un_watch (IndicatorService * service, DBusGMethodInvocation * method);
-#include "indicator-service-server.h"
-#include "dbus-shared.h"
-
/* Private Stuff */
/**
IndicatorSevicePrivate:
@@ -75,6 +76,9 @@ enum {
PROP_VERSION
};
+static GDBusNodeInfo * node_info = NULL;
+static GDBusInterfaceInfo * interface_info = NULL;
+
/* The strings so that they can be slowly looked up. */
#define PROP_NAME_S "name"
#define PROP_VERSION_S "version"
@@ -140,6 +144,25 @@ indicator_service_class_init (IndicatorServiceClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0, G_TYPE_NONE);
+ /* Setting up the DBus interfaces */
+ if (node_info == NULL) {
+ GError * error = NULL;
+
+ node_info = g_dbus_node_info_new_for_xml(_indicator_service, &error);
+ if (error != NULL) {
+ g_error("Unable to parse Indicator Service Interface description: %s", error->message);
+ g_error_free(error);
+ }
+ }
+
+ if (interface_info == NULL) {
+ interface_info = g_dbus_node_info_lookup_interface(node_info, INDICATOR_SERVICE_INTERFACE);
+
+ if (interface_info == NULL) {
+ g_error("Unable to find interface '" INDICATOR_SERVICE_INTERFACE "'");
+ }
+ }
+
/* Initialize the object as a DBus type */
dbus_g_object_type_install_info(INDICATOR_SERVICE_TYPE,
&dbus_glib__indicator_service_server_object_info);