[Pkg-privacy-commits] [nautilus-wipe] 23/37: Fix handling of Caja and Nemo desktops

Intrigeri intrigeri at moszumanska.debian.org
Wed Dec 7 18:46:03 UTC 2016


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to branch master
in repository nautilus-wipe.

commit 166b0a5d65673cfe8296916baf531b391ff2b158
Author: Colomban Wendling <ban at herbesfolles.org>
Date:   Mon Aug 1 00:40:54 2016 +0200

    Fix handling of Caja and Nemo desktops
---
 configure.ac                 |  3 +++
 nautilus-wipe/nw-api-impl.h  |  6 ++++++
 nautilus-wipe/nw-path-list.c | 23 ++++++++++++++++++++---
 3 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 93b0376..7af49a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,6 +80,9 @@ PKG_CHECK_MODULES([GSECUREDELETE],          gsecuredelete                 >= ${G
 AS_IF([test "$gtk_pkg" = "gtk+-2.0"],
       [PKG_CHECK_MODULES([GCONF], gconf-2.0 >= ${GCONF_REQUIRED})
        AC_DEFINE([HAVE_GCONF], [1], [Whether we have GConf])])
+# GSettings is mandatory for Caja and Nemo
+AS_CASE(["$with_nautilus"],
+        [caja|nemo], [PKG_CHECK_MODULES([GSETTINGS], [gio-2.0 >= 2.26])])
 
 # optional packages
 HAVE_GIO_UNIX=0
diff --git a/nautilus-wipe/nw-api-impl.h b/nautilus-wipe/nw-api-impl.h
index e049e3e..a8797b3 100644
--- a/nautilus-wipe/nw-api-impl.h
+++ b/nautilus-wipe/nw-api-impl.h
@@ -28,10 +28,13 @@
 # include "config.h"
 #endif
 
+/* Nautilus (GNOME) */
 #if defined(NW_NAUTILUS_IS_NAUTILUS)
 /* no mapping needed */
 # include <libnautilus-extension/nautilus-menu-provider.h>
 # include <libnautilus-extension/nautilus-file-info.h>
+# define NW_NAUTILUS_DESKTOP_URI "x-nautilus-desktop:///"
+/* Caja (MATE) */
 #elif defined(NW_NAUTILUS_IS_CAJA)
 # define PREFIX(x) CAJA##x
 # define prefix(x) caja##x
@@ -39,6 +42,8 @@
 # include "nw-api-impl.i"
 # include <libcaja-extension/caja-menu-provider.h>
 # include <libcaja-extension/caja-file-info.h>
+# define NW_NAUTILUS_DESKTOP_URI "x-caja-desktop:///"
+/* Nemo (Cinnamon) */
 #elif defined(NW_NAUTILUS_IS_NEMO)
 # define PREFIX(x) NEMO##x
 # define prefix(x) nemo##x
@@ -46,6 +51,7 @@
 # include "nw-api-impl.i"
 # include <libnemo-extension/nemo-menu-provider.h>
 # include <libnemo-extension/nemo-file-info.h>
+# define NW_NAUTILUS_DESKTOP_URI "x-nemo-desktop:///"
 #else
 # error "Unknown Nautilus API implementation"
 #endif
diff --git a/nautilus-wipe/nw-path-list.c b/nautilus-wipe/nw-path-list.c
index 108fc34..627d398 100644
--- a/nautilus-wipe/nw-path-list.c
+++ b/nautilus-wipe/nw-path-list.c
@@ -40,7 +40,8 @@ get_desktop_path (void)
 {
   gchar *path = NULL;
   
-#ifdef HAVE_GCONF
+#if defined(NW_NAUTILUS_IS_NAUTILUS)
+# ifdef HAVE_GCONF
   if (! path) {
     GConfClient *conf_client;
     
@@ -52,7 +53,23 @@ get_desktop_path (void)
     }
     g_object_unref (conf_client);
   }
-#endif /* HAVE_GCONF */
+# endif /* HAVE_GCONF */
+#elif defined(NW_NAUTILUS_IS_CAJA) || defined(NW_NAUTILUS_IS_NEMO)
+  if (! path) {
+# if defined(NW_NAUTILUS_IS_CAJA)
+    const gchar *const schema = "org.mate.caja.preferences";
+# elif defined(NW_NAUTILUS_IS_NEMO)
+    const gchar *const schema = "org.nemo.preferences";
+# endif /* Caja/Nemo */
+    GSettings *settings = g_settings_new(schema);
+    
+    if (g_settings_get_boolean(settings, "desktop-is-home-dir")) {
+      path = g_strdup (g_get_home_dir ());
+    }
+    
+    g_object_unref (settings);
+  }
+#endif /* Nautilus/Caja/Nemo */
   
   if (! path) {
     path = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
@@ -87,7 +104,7 @@ nw_path_from_nfi (NautilusFileInfo *nfi)
     
     if (! path) {
       /* if we still don't have a path, handle some specific URIs manually */
-      if (g_strcmp0 (activation_uri, "x-nautilus-desktop:///") == 0) {
+      if (g_strcmp0 (activation_uri, NW_NAUTILUS_DESKTOP_URI) == 0) {
         path = get_desktop_path ();
       }
       /* TODO: implement trash:/// */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/nautilus-wipe.git



More information about the Pkg-privacy-commits mailing list