diff options
author | Ted Gould <ted@gould.cx> | 2009-12-02 11:55:27 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2009-12-02 11:55:27 -0600 |
commit | 47741f6a4e84f187858caa54dc625a9d3d5e2b07 (patch) | |
tree | dc31888f2106019130da16fb1af5e1bba63bb46b /src/custom-service.c | |
parent | f23c54ff5fee5587c31ecb8bf176b58fa3d4be1d (diff) | |
parent | 8c7ce8faffe025e5c5cf8f4f23d9cf97cf719533 (diff) | |
download | libayatana-appindicator-47741f6a4e84f187858caa54dc625a9d3d5e2b07.tar.gz libayatana-appindicator-47741f6a4e84f187858caa54dc625a9d3d5e2b07.tar.bz2 libayatana-appindicator-47741f6a4e84f187858caa54dc625a9d3d5e2b07.zip |
Create a service and start using it. Also updating to libindicator 0.3.0.
Diffstat (limited to 'src/custom-service.c')
-rw-r--r-- | src/custom-service.c | 52 |
1 files changed, 46 insertions, 6 deletions
diff --git a/src/custom-service.c b/src/custom-service.c index d96a9de..5bd9b96 100644 --- a/src/custom-service.c +++ b/src/custom-service.c @@ -1,16 +1,56 @@ + +#include "libindicator/indicator-service.h" #include "notification-item-client.h" +#include "custom-service-appstore.h" +#include "custom-service-watcher.h" +#include "dbus-shared.h" -void _notification_watcher_server_register_service (void) { }; -void _notification_watcher_server_registered_services (void) { }; -void _notification_watcher_server_protocol_version (void) { }; -void _notification_watcher_server_register_notification_host (void) { }; -void _notification_watcher_server_is_notification_host_registered (void) { }; +/* The base main loop */ +static GMainLoop * mainloop = NULL; +/* Where the application registry lives */ +static CustomServiceAppstore * appstore = NULL; +/* Interface for applications */ +static CustomServiceWatcher * watcher = NULL; +/* The service management interface */ +static IndicatorService * service = NULL; -#include "notification-watcher-server.h" +/* 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_CUSTOM_DBUS_ADDR); + g_signal_connect(G_OBJECT(service), "disconnected", G_CALLBACK(service_disconnected), NULL); + + /* Building our app store */ + appstore = CUSTOM_SERVICE_APPSTORE(g_object_new(CUSTOM_SERVICE_APPSTORE_TYPE, NULL)); + + /* Adding a watcher for the Apps coming up */ + watcher = custom_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; } |