aboutsummaryrefslogtreecommitdiff
path: root/src/application-service.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2009-11-30 13:28:20 -0600
committerTed Gould <ted@gould.cx>2009-11-30 13:28:20 -0600
commit44be8d22131ab3f6e2b4173da2af1dc5194919a8 (patch)
treeb246e31d89f79defb4d3f2e8ba26a7c716e6f816 /src/application-service.c
parentf23c54ff5fee5587c31ecb8bf176b58fa3d4be1d (diff)
parentf0881be3b8f779e0411958e6637f8f29e5697cbb (diff)
downloadlibayatana-appindicator-44be8d22131ab3f6e2b4173da2af1dc5194919a8.tar.gz
libayatana-appindicator-44be8d22131ab3f6e2b4173da2af1dc5194919a8.tar.bz2
libayatana-appindicator-44be8d22131ab3f6e2b4173da2af1dc5194919a8.zip
Getting the right named files.
Diffstat (limited to 'src/application-service.c')
-rw-r--r--src/application-service.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/application-service.c b/src/application-service.c
new file mode 100644
index 0000000..56e3e80
--- /dev/null
+++ b/src/application-service.c
@@ -0,0 +1,56 @@
+
+#include "libindicator/indicator-service.h"
+#include "notification-item-client.h"
+#include "application-service-appstore.h"
+#include "application-service-watcher.h"
+#include "dbus-shared.h"
+
+/* The base main loop */
+static GMainLoop * mainloop = NULL;
+/* Where the application registry lives */
+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)
+{
+ g_type_init();
+
+ /* Bring us up as a basic indicator service */
+ service = indicator_service_new(INDICATOR_APPLICATION_DBUS_ADDR);
+ g_signal_connect(G_OBJECT(service), "disconnected", G_CALLBACK(service_disconnected), NULL);
+
+ /* Building our app store */
+ appstore = APPLICATION_SERVICE_APPSTORE(g_object_new(APPLICATION_SERVICE_APPSTORE_TYPE, NULL));
+
+ /* Adding a watcher for the Apps coming up */
+ watcher = application_service_watcher_new(appstore);
+
+ /* Building and executing our main loop */
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ /* 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;
+}