diff options
-rw-r--r-- | libindicator/indicator-service.c | 29 |
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); |