diff options
author | Ted Gould <ted@gould.cx> | 2009-12-01 09:58:05 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2009-12-01 09:58:05 -0600 |
commit | 8a1912e7b9f8a7a0351ef252359ae04ff9fc4402 (patch) | |
tree | 9260a4eb03582de67214dc2e447e9619242b1765 /libindicator/indicator-service.c | |
parent | ad2ef4d35017d674caecc65ccde4e500b0740982 (diff) | |
download | libayatana-indicator-8a1912e7b9f8a7a0351ef252359ae04ff9fc4402.tar.gz libayatana-indicator-8a1912e7b9f8a7a0351ef252359ae04ff9fc4402.tar.bz2 libayatana-indicator-8a1912e7b9f8a7a0351ef252359ae04ff9fc4402.zip |
Add an unwatch function with a basic handler.
Diffstat (limited to 'libindicator/indicator-service.c')
-rw-r--r-- | libindicator/indicator-service.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index 69422c5..dda00a9 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -8,6 +8,7 @@ /* DBus Prototypes */ 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" @@ -309,6 +310,31 @@ _indicator_service_server_watch (IndicatorService * service, DBusGMethodInvocati return TRUE; } +static gboolean +_indicator_service_server_un_watch (IndicatorService * service, DBusGMethodInvocation * method) +{ + g_return_val_if_fail(INDICATOR_IS_SERVICE(service), FALSE); + IndicatorServicePrivate * priv = INDICATOR_SERVICE_GET_PRIVATE(service); + + /* Remove us from the watcher list here */ + + + /* If we're out of watchers set the timeout for shutdown */ + if (priv->watchers == NULL) { + if (priv->timeout != 0) { + /* This should never really happen, but let's ensure that + bad things don't happen if it does. */ + g_warning("No watchers timeout set twice. Resolving, but odd."); + g_source_remove(priv->timeout); + priv->timeout = 0; + } + priv->timeout = g_timeout_add(500, timeout_no_watchers, service); + } + + dbus_g_method_return(method); + return TRUE; +} + /* API */ /** |