diff options
author | Florian Müllner <fmuellner@gnome.org> | 2014-11-29 02:31:04 +0000 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2014-11-29 10:05:19 -0800 |
commit | a98c9300f4f6eedba8f6a54411e682107f259eda (patch) | |
tree | 61f01ad611ed3b8b78309374ff9177316d80ac1b | |
parent | 3c7ef4ae825308ec723eb684a88baf30348a9867 (diff) | |
download | nautilus-a98c9300f4f6eedba8f6a54411e682107f259eda.tar.gz |
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
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | src/nautilus-progress-ui-handler.c | 31 |
2 files changed, 22 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac index 20f409412..f8d307195 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 4fe57a1df..b98029b68 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; } |