[nautilus] Remove libnotify dependency



commit a98c9300f4f6eedba8f6a54411e682107f259eda
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Nov 29 02:31:04 2014 +0000

    Remove libnotify dependency
    
    After the port to GNotifications, libnotify is only used to check
    whether the server supports persistence. Just call the underlying
    DBus method directly and remove the dependency.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=740886

 configure.ac                       |    1 -
 src/nautilus-progress-ui-handler.c |   31 ++++++++++++++++++++++---------
 2 files changed, 22 insertions(+), 10 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 20f4094..f8d3071 100644
--- a/configure.ac
+++ b/configure.ac
@@ -286,7 +286,6 @@ PKG_CHECK_MODULES(NAUTILUS, [
        gio-2.0 >= glib_minver
        gio-unix-2.0 >= glib_minver
        gsettings-desktop-schemas >= schemas_minver
-       libnotify >= notify_minver
 ])
 
 dnl Multimedia keys
diff --git a/src/nautilus-progress-ui-handler.c b/src/nautilus-progress-ui-handler.c
index 4fe57a1..b98029b 100644
--- a/src/nautilus-progress-ui-handler.c
+++ b/src/nautilus-progress-ui-handler.c
@@ -34,8 +34,6 @@
 #include <libnautilus-private/nautilus-progress-info.h>
 #include <libnautilus-private/nautilus-progress-info-manager.h>
 
-#include <libnotify/notify.h>
-
 struct _NautilusProgressUIHandlerPriv {
        NautilusProgressInfoManager *manager;
 
@@ -397,7 +395,9 @@ static gboolean
 server_has_persistence (void)
 {
         static gboolean retval = FALSE;
-        GList *caps, *l;
+        GDBusConnection *conn;
+        GVariant *result;
+        char **cap, **caps;
         static gboolean initialized = FALSE;
 
         if (initialized) {
@@ -405,15 +405,28 @@ server_has_persistence (void)
         }
         initialized = TRUE;
 
-        caps = notify_get_server_caps ();
-        if (caps == NULL) {
+        conn = g_application_get_dbus_connection (g_application_get_default ());
+        result = g_dbus_connection_call_sync (conn,
+                                              "org.freedesktop.Notifications",
+                                              "/org/freedesktop/Notifications",
+                                              "org.freedesktop.Notifications",
+                                              "GetCapabilities",
+                                              g_variant_new ("()"),
+                                              G_VARIANT_TYPE ("(as)"),
+                                              G_DBUS_CALL_FLAGS_NONE,
+                                              -1, NULL, NULL);
+
+        if (result == NULL)
                 return FALSE;
-        }
 
-        l = g_list_find_custom (caps, "persistence", (GCompareFunc) g_strcmp0);
-        retval = (l != NULL);
+        g_variant_get (result, "(^a&s)", &caps);
+
+        for (cap = caps; *cap != NULL; cap++)
+                if (g_strcmp0 ("persistence", *cap) == 0)
+                        retval = TRUE;
 
-       g_list_free_full (caps, g_free);
+        g_free (caps);
+        g_variant_unref (result);
 
         return retval;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]