[Pkg-privacy-commits] [nautilus-wipe] 58/224: Support for Nautilus' desktop
Ulrike Uhlig
u-guest at moszumanska.debian.org
Thu Jul 7 19:45:34 UTC 2016
This is an automated email from the git hooks/post-receive script.
u-guest pushed a commit to branch master
in repository nautilus-wipe.
commit a79e917d0de47898f967d00bf5ecaf9805c845f1
Author: Colomban Wendling <ban at herbesfolles.org>
Date: Fri Feb 26 01:05:48 2010 +0100
Support for Nautilus' desktop
Add support for Nautilus' x-nautilus-desktop URI by translating it
to a local path.
Adds dependency on libgconf2 to read Nautilus' settings.
---
README | 1 +
configure.ac | 2 ++
nautilus-srm/nautilus-srm.c | 50 +++++++++++++++++++++++++++++++++++++++++++--
3 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/README b/README
index bfc9019..a34a19d 100644
--- a/README
+++ b/README
@@ -4,6 +4,7 @@ Dependancies
- libnautilus-extension
- libgtk2.0
- libgsecuredelete
+- libgconf2
- make
- autoconf
- libtool
diff --git a/configure.ac b/configure.ac
index 2775022..37cd1b5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,12 +25,14 @@ AM_PROG_LIBTOOL
GTK_REQUIRED=2.6
GLIB_REQUIRED=2.16
GOBJECT_REQUIRED=2.4.0
+GCONF_REQUIRED=2.0
NAUTILUS_EXTENSION=2.0
GSECUREDELETE_REQUIRED=0.1
PKG_CHECK_MODULES([NAUTILUS_SRM], \
glib-2.0 >= ${GLIB_REQUIRED} \
gtk+-2.0 >= ${GTK_REQUIRED} \
+ gconf-2.0 >= ${GCONF_REQUIRED} \
libnautilus-extension >= ${NAUTILUS_EXTENSION} \
gsecuredelete >= ${GSECUREDELETE_REQUIRED} \
)
diff --git a/nautilus-srm/nautilus-srm.c b/nautilus-srm/nautilus-srm.c
index 4bd92bf..7084efc 100644
--- a/nautilus-srm/nautilus-srm.c
+++ b/nautilus-srm/nautilus-srm.c
@@ -26,8 +26,8 @@
#include <glib.h>
#include <gtk/gtk.h>
-
#include <gio/gio.h>
+#include <gconf/gconf-client.h>
#include <gsecuredelete/gsecuredelete.h>
@@ -176,7 +176,48 @@ static void run_delete_operation (GtkWindow *parent,
GList *files);
-/* gets the path of a #NautilusFileInfo. */
+/* gets the Nautilus' desktop path (to handle x-nautilus-desktop:// URIs)
+ * heavily based on the implementation from nautilus-open-terminal */
+static gchar *
+nautilus_srm_get_desktop_path (void)
+{
+ gchar *path = NULL;
+ GConfClient *conf_client;
+
+ conf_client = gconf_client_get_default ();
+ if (gconf_client_get_bool (conf_client,
+ "/apps/nautilus/preferences/desktop_is_home_dir",
+ NULL)) {
+ path = g_strdup (g_get_home_dir ());
+ } else {
+ path = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
+ }
+ g_object_unref (conf_client);
+
+ return path;
+}
+
+/* checks whether a #NautilusFileInfo have the given URI scheme */
+static gboolean
+nautilus_srm_nfi_has_uri_scheme (NautilusFileInfo *nfi,
+ const gchar *scheme)
+{
+ gboolean matches = FALSE;
+ gchar *nfi_scheme;
+
+ nfi_scheme = nautilus_file_info_get_uri_scheme (nfi);
+ /*g_message ("does %s match %s?", nfi_scheme, scheme);*/
+ if (nfi_scheme == scheme || strcmp (nfi_scheme, scheme) == 0) {
+ matches = TRUE;
+ }
+ g_free (nfi_scheme);
+
+ return matches;
+}
+
+/* gets the path of a #NautilusFileInfo.
+ * this is different from getting if GFile then getting the path since it tries
+ * handle x-nautilus-desktop */
static gchar *
nautilus_srm_nfi_get_path (NautilusFileInfo *nfi)
{
@@ -185,6 +226,11 @@ nautilus_srm_nfi_get_path (NautilusFileInfo *nfi)
file = nautilus_file_info_get_location (nfi);
path = g_file_get_path (file);
+ if (! path) {
+ if (nautilus_srm_nfi_has_uri_scheme (nfi, "x-nautilus-desktop")) {
+ path = nautilus_srm_get_desktop_path ();
+ }
+ }
return path;
}
--
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