From e48b26bcffdf75b4454611f88018c1a783c2e9c9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 20 Feb 2014 14:48:59 -0600 Subject: Removes the indicator service code --- src/application-service.c | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'src/application-service.c') diff --git a/src/application-service.c b/src/application-service.c index 5262d9d..21e3f9d 100644 --- a/src/application-service.c +++ b/src/application-service.c @@ -32,30 +32,12 @@ static GMainLoop * mainloop = NULL; static ApplicationServiceAppstore * appstore = NULL; /* Interface for applications */ static ApplicationServiceWatcher * watcher = NULL; -/* The service management interface */ -static IndicatorService * service = NULL; -/* Recieves the disonnection signal from the service - object and closes the mainloop. */ -static void -service_disconnected (IndicatorService * service, gpointer data) -{ - g_debug("Service disconnected"); - if (mainloop != NULL) { - g_main_loop_quit(mainloop); - } - return; -} - /* Builds up the core objects and puts us spinning into a main loop. */ int main (int argc, char ** argv) { - /* Bring us up as a basic indicator service */ - service = indicator_service_new_version(INDICATOR_APPLICATION_DBUS_ADDR, INDICATOR_APPLICATION_SERVICE_VERSION); - g_signal_connect(G_OBJECT(service), INDICATOR_SERVICE_SIGNAL_SHUTDOWN, G_CALLBACK(service_disconnected), NULL); - /* Building our app store */ appstore = application_service_appstore_new(); @@ -69,7 +51,6 @@ main (int argc, char ** argv) /* Unref'ing all the objects */ g_object_unref(G_OBJECT(watcher)); g_object_unref(G_OBJECT(appstore)); - g_object_unref(G_OBJECT(service)); return 0; } -- cgit v1.2.3 From b12215e8f5872e02c23fdceaa51415f1bd8dd058 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 20 Feb 2014 15:21:11 -0600 Subject: Own the name --- src/application-service.c | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) (limited to 'src/application-service.c') diff --git a/src/application-service.c b/src/application-service.c index 21e3f9d..7024e91 100644 --- a/src/application-service.c +++ b/src/application-service.c @@ -21,7 +21,7 @@ with this program. If not, see . */ -#include "libindicator/indicator-service.h" +#include #include "application-service-appstore.h" #include "application-service-watcher.h" #include "dbus-shared.h" @@ -33,22 +33,57 @@ static ApplicationServiceAppstore * appstore = NULL; /* Interface for applications */ static ApplicationServiceWatcher * watcher = NULL; -/* Builds up the core objects and puts us spinning into - a main loop. */ -int -main (int argc, char ** argv) +/* Make sure we can set up all our objects before we get the name */ +static void +bus_acquired (GDBusConnection * con, const gchar * name, gpointer user_data) { + g_debug("Bus Acquired, building objects"); + /* Building our app store */ appstore = application_service_appstore_new(); /* Adding a watcher for the Apps coming up */ watcher = application_service_watcher_new(appstore); +} + +/* Nice to know, but we're not doing anything special */ +static void +name_acquired (GDBusConnection * con, const gchar * name, gpointer user_data) +{ + g_debug("Name Acquired"); +} + +/* Shouldn't happen under normal usage */ +static void +name_lost (GDBusConnection * con, const gchar * name, gpointer user_data) +{ + g_warning("Name Lost"); + g_main_loop_quit(mainloop); +} + +/* Builds up the core objects and puts us spinning into + a main loop. */ +int +main (int argc, char ** argv) +{ + guint nameownership = g_bus_own_name(G_BUS_TYPE_SESSION, + INDICATOR_APPLICATION_DBUS_ADDR, + G_BUS_NAME_OWNER_FLAGS_NONE, + bus_acquired, + name_acquired, + name_lost, + NULL, NULL); /* Building and executing our main loop */ mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); + g_debug("Finishing Main Loop"); + + g_bus_unown_name(nameownership); + /* Unref'ing all the objects */ + g_main_loop_unref(mainloop); g_object_unref(G_OBJECT(watcher)); g_object_unref(G_OBJECT(appstore)); -- cgit v1.2.3