aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-01-08 15:42:52 -0600
committerTed Gould <ted@gould.cx>2010-01-08 15:42:52 -0600
commita3bf98e6efdca6183b835496fecf9a873dac3ad7 (patch)
tree26fd21d38e86f50404b7c8f40773dcb648be6276
parent7f93d0d46164ef3c3be5b6fbb20377528b95425f (diff)
parente5fbe723c8c8fdd3264a99e359c3ceac379d397e (diff)
downloadayatana-indicator-application-a3bf98e6efdca6183b835496fecf9a873dac3ad7.tar.gz
ayatana-indicator-application-a3bf98e6efdca6183b835496fecf9a873dac3ad7.tar.bz2
ayatana-indicator-application-a3bf98e6efdca6183b835496fecf9a873dac3ad7.zip
* Upstream merge:
* Making the Notification Watcher register for it's own DBus name to keep the service one unique.
-rw-r--r--debian/changelog8
-rw-r--r--src/application-service-watcher.c38
-rw-r--r--src/dbus-shared.h3
-rw-r--r--src/libappindicator/app-indicator.c2
4 files changed, 49 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
index 9de63c4..90d493e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+indicator-application (0.0.6-0ubuntu1~ppa6) UNRELEASED; urgency=low
+
+ * Upstream merge:
+ * Making the Notification Watcher register for it's own DBus
+ name to keep the service one unique.
+
+ -- Ted Gould <ted@ubuntu.com> Fri, 08 Jan 2010 15:42:20 -0600
+
indicator-application (0.0.6-0ubuntu1~ppa5) karmic; urgency=low
* Upstream merge:
diff --git a/src/application-service-watcher.c b/src/application-service-watcher.c
index 1ad59d4..eff249d 100644
--- a/src/application-service-watcher.c
+++ b/src/application-service-watcher.c
@@ -26,6 +26,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
+#include <dbus/dbus-glib-bindings.h>
#include "application-service-watcher.h"
#include "dbus-shared.h"
@@ -34,6 +35,7 @@ static gboolean _notification_watcher_server_registered_status_notifier_items (A
static gboolean _notification_watcher_server_protocol_version (ApplicationServiceWatcher * appwatcher, char ** version);
static gboolean _notification_watcher_server_register_notification_host (ApplicationServiceWatcher * appwatcher, const gchar * host);
static gboolean _notification_watcher_server_is_notification_host_registered (ApplicationServiceWatcher * appwatcher, gboolean * haveHost);
+static void get_name_cb (DBusGProxy * proxy, guint status, GError * error, gpointer data);
#include "notification-watcher-server.h"
@@ -41,6 +43,7 @@ static gboolean _notification_watcher_server_is_notification_host_registered (Ap
typedef struct _ApplicationServiceWatcherPrivate ApplicationServiceWatcherPrivate;
struct _ApplicationServiceWatcherPrivate {
ApplicationServiceAppstore * appstore;
+ DBusGProxy * dbus_proxy;
};
#define APPLICATION_SERVICE_WATCHER_GET_PRIVATE(o) \
@@ -129,6 +132,23 @@ application_service_watcher_init (ApplicationServiceWatcher *self)
NOTIFICATION_WATCHER_DBUS_OBJ,
G_OBJECT(self));
+ priv->dbus_proxy = dbus_g_proxy_new_for_name_owner(session_bus,
+ DBUS_SERVICE_DBUS,
+ DBUS_PATH_DBUS,
+ DBUS_INTERFACE_DBUS,
+ &error);
+ if (error != NULL) {
+ g_error("Ah, can't get proxy to dbus: %s", error->message);
+ g_error_free(error);
+ return;
+ }
+
+ org_freedesktop_DBus_request_name_async(priv->dbus_proxy,
+ NOTIFICATION_WATCHER_DBUS_ADDR,
+ DBUS_NAME_FLAG_DO_NOT_QUEUE,
+ get_name_cb,
+ self);
+
return;
}
@@ -211,3 +231,21 @@ _notification_watcher_server_is_notification_host_registered (ApplicationService
return TRUE;
}
+/* Function to handle the return of the get name. There isn't a whole
+ lot that can be done, but we're atleast going to tell people. */
+static void
+get_name_cb (DBusGProxy * proxy, guint status, GError * error, gpointer data)
+{
+ if (error != NULL) {
+ g_warning("Unable to get watcher name '%s' because: %s", NOTIFICATION_WATCHER_DBUS_ADDR, error->message);
+ return;
+ }
+
+ if (status != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER &&
+ status != DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER) {
+ g_warning("Unable to get watcher name '%s'", NOTIFICATION_WATCHER_DBUS_ADDR);
+ return;
+ }
+
+ return;
+}
diff --git a/src/dbus-shared.h b/src/dbus-shared.h
index efc57a4..b8dc016 100644
--- a/src/dbus-shared.h
+++ b/src/dbus-shared.h
@@ -20,10 +20,11 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#define INDICATOR_APPLICATION_DBUS_ADDR "org.freedesktop.StatusNotifierWatcher"
+#define INDICATOR_APPLICATION_DBUS_ADDR "org.ayatana.indicator.application"
#define INDICATOR_APPLICATION_DBUS_OBJ "/org/ayatana/indicator/application/service"
#define INDICATOR_APPLICATION_DBUS_IFACE "org.ayatana.indicator.application.service"
+#define NOTIFICATION_WATCHER_DBUS_ADDR "org.freedesktop.StatusNotifierWatcher"
#define NOTIFICATION_WATCHER_DBUS_OBJ "/StatusNotifierWatcher"
#define NOTIFICATION_WATCHER_DBUS_IFACE "org.freedesktop.StatusNotifierWatcher"
diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c
index 5868a4d..7560a97 100644
--- a/src/libappindicator/app-indicator.c
+++ b/src/libappindicator/app-indicator.c
@@ -530,7 +530,7 @@ check_connect (AppIndicator *self)
GError * error = NULL;
priv->watcher_proxy = dbus_g_proxy_new_for_name_owner(priv->connection,
- INDICATOR_APPLICATION_DBUS_ADDR,
+ NOTIFICATION_WATCHER_DBUS_ADDR,
NOTIFICATION_WATCHER_DBUS_OBJ,
NOTIFICATION_WATCHER_DBUS_IFACE,
&error);