summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColomban Wendling <[email protected]>2017-03-25 00:00:47 +0100
committerMartin Wimpress <[email protected]>2017-03-24 23:00:47 +0000
commit2f5fb93bb06fd13e60d18b7b0bfcf0a0b13f2a47 (patch)
tree361da32ac8e3534686841aa0056015fac521fa54
parent533b880f0d64cde423bc3279a401d9e04f80936e (diff)
downloadmate-panel-2f5fb93bb06fd13e60d18b7b0bfcf0a0b13f2a47.tar.bz2
mate-panel-2f5fb93bb06fd13e60d18b7b0bfcf0a0b13f2a47.tar.xz
status-notifier-watcher: Allow re-registration of registered items (#543)
The SNI specification doesn't explicitly state what should happen when trying to register again an already registered item, so it would seem only logical to forbid it. Unfortunately, libappindicator tries re-registering pretty often, and even falls back to System Tray if it fails. So in practice we need to be forgiving and pretend it's OK, or we get a duplicate System Tray item for this one. Fixes #539.
-rw-r--r--applets/notification_area/libstatus-notifier-watcher/gf-sn-watcher-v0.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/applets/notification_area/libstatus-notifier-watcher/gf-sn-watcher-v0.c b/applets/notification_area/libstatus-notifier-watcher/gf-sn-watcher-v0.c
index 8e82c10f..3d3a97c7 100644
--- a/applets/notification_area/libstatus-notifier-watcher/gf-sn-watcher-v0.c
+++ b/applets/notification_area/libstatus-notifier-watcher/gf-sn-watcher-v0.c
@@ -284,10 +284,24 @@ gf_sn_watcher_v0_handle_register_item (GfSnWatcherV0Gen *object,
if (watch != NULL)
{
+ /* the specification doesn't explicitly state what should happen when
+ * trying to register the same item again, so it would make sense to
+ * forbid it. Unfortunately libappindicator tries re-registering pretty
+ * often, and even falls back to System Tray if it fails.
+ * So in practice we need to be forgiving and pretend it's OK. */
+#if 0
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
G_DBUS_ERROR_INVALID_ARGS,
"Status Notifier Item with bus name '%s' and object path '%s' is already registered",
bus_name, object_path);
+#else
+ g_warning ("Status Notifier Item with bus name '%s' and object path '%s' is already registered",
+ bus_name, object_path);
+ /* FIXME: is it OK to simply ignore the request instead of removing the
+ * old one and adding the new one? I don't see the problem as
+ * they are identical, but...? */
+ gf_sn_watcher_v0_gen_complete_register_item (object, invocation);
+#endif
return TRUE;
}