diff options
Diffstat (limited to 'community/cinnamon/gnome-3.8.patch')
-rw-r--r-- | community/cinnamon/gnome-3.8.patch | 231 |
1 files changed, 231 insertions, 0 deletions
diff --git a/community/cinnamon/gnome-3.8.patch b/community/cinnamon/gnome-3.8.patch index 4053a151b..5af7c3a79 100644 --- a/community/cinnamon/gnome-3.8.patch +++ b/community/cinnamon/gnome-3.8.patch @@ -3950,3 +3950,234 @@ index c8427ac..a7b2e09 100644 -- 1.8.1.6 +From 1f209cec0fa0e9d12b3c29884302f4b8e70ff4c9 Mon Sep 17 00:00:00 2001 +From: Michael Webster <miketwebster@gmail.com> +Date: Thu, 9 May 2013 11:48:08 -0400 +Subject: [PATCH] Fix notifications and other stuff + +--- + .../cinnamon/applets/sound@cinnamon.org/applet.js | 2 +- + js/ui/notificationDaemon.js | 7 +- + src/main.c | 169 ++++++++++++--------- + 3 files changed, 103 insertions(+), 75 deletions(-) + +diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js +index b037e07..58b2df3 100644 +--- a/js/ui/notificationDaemon.js ++++ b/js/ui/notificationDaemon.js +@@ -220,7 +220,12 @@ NotificationDaemon.prototype = { + NotifyAsync: function(params, invocation) { + let [appName, replacesId, icon, summary, body, actions, hints, timeout] = params; + let id; +- ++ ++ for (let hint in hints) { ++ // unpack the variants ++ hints[hint] = hints[hint].deep_unpack(); ++ } ++ + let rewrites = rewriteRules[appName]; + if (rewrites) { + for (let i = 0; i < rewrites.length; i++) { +diff --git a/src/main.c b/src/main.c +index 418fb60..773fb65 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -34,99 +34,122 @@ + #define OVERRIDES_SCHEMA "org.cinnamon.overrides" + + static void ++cinnamon_dbus_acquire_name (GDBusProxy *bus, ++ guint32 request_name_flags, ++ guint32 *request_name_result, ++ gchar *name, ++ gboolean fatal) ++{ ++ GError *error = NULL; ++ GVariant *request_name_variant; ++ ++ if (!(request_name_variant = g_dbus_proxy_call_sync (bus, ++ "RequestName", ++ g_variant_new ("(su)", name, request_name_flags), ++ 0, /* call flags */ ++ -1, /* timeout */ ++ NULL, /* cancellable */ ++ &error))) ++ { ++ g_printerr ("failed to acquire %s: %s\n", name, error->message); ++ if (!fatal) ++ return; ++ exit (1); ++ } ++ g_variant_get (request_name_variant, "(u)", request_name_result); ++} ++ ++static void ++cinnamon_dbus_acquire_names (GDBusProxy *bus, ++ guint32 request_name_flags, ++ gchar *name, ++ gboolean fatal, ...) G_GNUC_NULL_TERMINATED; ++ ++static void ++cinnamon_dbus_acquire_names (GDBusProxy *bus, ++ guint32 request_name_flags, ++ gchar *name, ++ gboolean fatal, ...) ++{ ++ va_list al; ++ guint32 request_name_result; ++ va_start (al, fatal); ++ for (;;) ++ { ++ cinnamon_dbus_acquire_name (bus, ++ request_name_flags, ++ &request_name_result, ++ name, fatal); ++ name = va_arg (al, gchar *); ++ if (!name) ++ break; ++ fatal = va_arg (al, gboolean); ++ } ++ va_end (al); ++} ++ ++static void + cinnamon_dbus_init (gboolean replace) + { ++ GDBusConnection *session; ++ GDBusProxy *bus; + GError *error = NULL; +- DBusGConnection *session; +- DBusGProxy *bus; + guint32 request_name_flags; + guint32 request_name_result; + +- /** TODO: +- * In the future we should use GDBus for this. However, in +- * order to do that, we need to port all of the JavaScript +- * code. Otherwise, the name will be claimed on the wrong +- * connection. +- */ +- session = dbus_g_bus_get (DBUS_BUS_SESSION, NULL); ++ session = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); + +- bus = dbus_g_proxy_new_for_name (session, +- DBUS_SERVICE_DBUS, +- DBUS_PATH_DBUS, +- DBUS_INTERFACE_DBUS); ++ if (error) { ++ g_printerr ("Failed to connect to session bus: %s", error->message); ++ exit (1); ++ } + +- request_name_flags = DBUS_NAME_FLAG_DO_NOT_QUEUE | DBUS_NAME_FLAG_ALLOW_REPLACEMENT; ++ bus = g_dbus_proxy_new_sync (session, ++ G_DBUS_PROXY_FLAGS_NONE, ++ NULL, /* interface info */ ++ "org.freedesktop.DBus", ++ "/org/freedesktop/DBus", ++ "org.freedesktop.DBus", ++ NULL, /* cancellable */ ++ &error); ++ ++ request_name_flags = G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT; + if (replace) + request_name_flags |= DBUS_NAME_FLAG_REPLACE_EXISTING; +- if (!dbus_g_proxy_call (bus, "RequestName", &error, +- G_TYPE_STRING, CINNAMON_DBUS_SERVICE, +- G_TYPE_UINT, request_name_flags, +- G_TYPE_INVALID, +- G_TYPE_UINT, &request_name_result, +- G_TYPE_INVALID)) +- { +- g_printerr ("failed to acquire org.Cinnamon: %s\n", error->message); +- exit (1); +- } ++ ++ cinnamon_dbus_acquire_name (bus, ++ request_name_flags, ++ &request_name_result, ++ CINNAMON_DBUS_SERVICE, TRUE); + if (!(request_name_result == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER + || request_name_result == DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER)) + { +- g_printerr ("%s already exists on bus and --replace not specified\n", +- CINNAMON_DBUS_SERVICE); ++ g_printerr (CINNAMON_DBUS_SERVICE " already exists on bus and --replace not specified\n"); + exit (1); + } + +- /* Also grab org.gnome.Panel to replace any existing panel process */ +- if (!dbus_g_proxy_call (bus, "RequestName", &error, G_TYPE_STRING, +- "org.gnome.Panel", G_TYPE_UINT, +- DBUS_NAME_FLAG_REPLACE_EXISTING | request_name_flags, +- G_TYPE_INVALID, G_TYPE_UINT, +- &request_name_result, G_TYPE_INVALID)) +- { +- g_print ("failed to acquire org.gnome.Panel: %s\n", error->message); +- exit (1); +- } +- +- /* ...and the org.gnome.Magnifier service. +- */ +- if (!dbus_g_proxy_call (bus, "RequestName", &error, +- G_TYPE_STRING, MAGNIFIER_DBUS_SERVICE, +- G_TYPE_UINT, DBUS_NAME_FLAG_REPLACE_EXISTING | request_name_flags, +- G_TYPE_INVALID, +- G_TYPE_UINT, &request_name_result, +- G_TYPE_INVALID)) +- { +- g_print ("failed to acquire %s: %s\n", MAGNIFIER_DBUS_SERVICE, error->message); +- /* Failing to acquire the magnifer service is not fatal. Log the error, +- * but keep going. */ +- } +- +- /* ...and the org.freedesktop.Notifications service; we always +- * specify REPLACE_EXISTING to ensure we kill off +- * notification-daemon if it was running. ++ /* ++ * We always specify REPLACE_EXISTING to ensure we kill off ++ * the existing service if it was running. + */ +- if (!dbus_g_proxy_call (bus, "RequestName", &error, +- G_TYPE_STRING, "org.freedesktop.Notifications", +- G_TYPE_UINT, DBUS_NAME_FLAG_REPLACE_EXISTING | request_name_flags, +- G_TYPE_INVALID, +- G_TYPE_UINT, &request_name_result, +- G_TYPE_INVALID)) +- { +- g_print ("failed to acquire org.freedesktop.Notifications: %s\n", error->message); +- } ++ request_name_flags |= G_BUS_NAME_OWNER_FLAGS_REPLACE; + ++ cinnamon_dbus_acquire_names (bus, ++ request_name_flags, ++ /* Also grab org.gnome.Panel to replace any existing panel process */ ++ "org.gnome.Panel", TRUE, ++ /* ...and the org.gnome.Magnifier service. */ ++ MAGNIFIER_DBUS_SERVICE, FALSE, ++ /* ...and the org.freedesktop.Notifications service. */ ++ "org.freedesktop.Notifications", FALSE, ++ NULL); + /* ...and the on-screen keyboard service */ +- if (!dbus_g_proxy_call (bus, "RequestName", &error, +- G_TYPE_STRING, "org.gnome.Caribou.Keyboard", +- G_TYPE_UINT, DBUS_NAME_FLAG_REPLACE_EXISTING, +- G_TYPE_INVALID, +- G_TYPE_UINT, &request_name_result, +- G_TYPE_INVALID)) +- { +- g_print ("failed to acquire org.gnome.Caribou.Keyboard: %s\n", error->message); +- } +- ++ cinnamon_dbus_acquire_name (bus, ++ DBUS_NAME_FLAG_REPLACE_EXISTING, ++ &request_name_result, ++ "org.gnome.Caribou.Keyboard", FALSE); + g_object_unref (bus); ++ g_object_unref (session); + } + + static void +-- +1.8.1.6 |