[arch-commits] Commit in cinnamon/trunk (PKGBUILD gnome-3.8.patch)

Alexandre Filgueira faidoc at nymeria.archlinux.org
Sat May 11 13:07:52 EDT 2013


    Date: Saturday, May 11, 2013 @ 19:07:51
  Author: faidoc
Revision: 90346

Fix notifications

Modified:
  cinnamon/trunk/PKGBUILD
  cinnamon/trunk/gnome-3.8.patch

-----------------+
 PKGBUILD        |    4 
 gnome-3.8.patch |  231 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 233 insertions(+), 2 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2013-05-11 16:54:22 UTC (rev 90345)
+++ PKGBUILD	2013-05-11 17:07:51 UTC (rev 90346)
@@ -6,7 +6,7 @@
 
 pkgname=cinnamon
 pkgver=1.8.2
-pkgrel=1
+pkgrel=2
 pkgdesc="Linux desktop which provides advanced innovative features and a traditional user experience"
 arch=('i686' 'x86_64')
 url="http://cinnamon.linuxmint.com/"
@@ -34,7 +34,7 @@
 sha256sums=('83179f98f9e6c88928146d43a9d3f581c64706c0a60dac5e58d845a30a275a91'
             'a0c05c995102b16f1060cbd43931eeaefeafd0265a0335e4ca14a143bd4c8c30'
             'ee5694bdc997ffa35a817f691b15bae13747137d35ec2aecd0da298d7edbe426'
-            '0971ac14bc31167d3b94ea93e608c5d49518a12b89f40c97f84d80e715657aa3'
+            '9a091c0b651a5af1700c8eca90b9e81bb9a50a8a9bfa6a7352d0c0daa2f3f271'
             '921a1f63d2890dd54c149aa27a3d3209ac2fb843be597ae4ef3b4621e76a2262'
             'fc8e8f5b7772ff331212280b0d4cf624c5ca2a442e8e8defc319cc2f2b060f2e'
             'b34c30299fb88228c59f36fced90d56346847019a080bc7b8157b72caa659100')

Modified: gnome-3.8.patch
===================================================================
--- gnome-3.8.patch	2013-05-11 16:54:22 UTC (rev 90345)
+++ gnome-3.8.patch	2013-05-11 17:07:51 UTC (rev 90346)
@@ -3950,3 +3950,234 @@
 -- 
 1.8.1.6
 
+From 1f209cec0fa0e9d12b3c29884302f4b8e70ff4c9 Mon Sep 17 00:00:00 2001
+From: Michael Webster <miketwebster at gmail.com>
+Date: Thu, 9 May 2013 11:48:08 -0400
+Subject: [PATCH] Fix notifications and other stuff
+
+---
+ .../cinnamon/applets/sound at 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



More information about the arch-commits mailing list