[Pkg-privacy-commits] [nautilus-wipe] 22/37: Add support for Caja and Nemo

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 0bf7152c74581c4ae2462e9544c764d3114b2eac
Author: Colomban Wendling <ban at herbesfolles.org>
Date:   Sun Jul 31 18:25:34 2016 +0200

    Add support for Caja and Nemo
    
    Add `--with-nautilus` option allowing to select the Nautilus-compatible
    API.  Currently supported APIs include Nautilus, Caja and Nemo.
---
 README                                             |  7 +++
 configure.ac                                       | 35 +++++++++++---
 ...na-nautilus-extdir.m4 => nw-nautilus-extdir.m4} | 24 +++++-----
 nautilus-wipe/Makefile.am                          |  3 ++
 nautilus-wipe/extension.c                          |  2 +
 nautilus-wipe/nw-api-impl.h                        | 56 ++++++++++++++++++++++
 nautilus-wipe/nw-api-impl.i                        | 15 ++++++
 nautilus-wipe/nw-compat.h                          |  2 +-
 nautilus-wipe/nw-extension.c                       |  3 +-
 nautilus-wipe/nw-path-list.c                       |  2 +-
 nautilus-wipe/nw-path-list.h                       |  2 +-
 11 files changed, 126 insertions(+), 25 deletions(-)

diff --git a/README b/README
index 6158905..1ed3dd1 100644
--- a/README
+++ b/README
@@ -42,3 +42,10 @@ build against GTK2, you should pass the ``--without-gtk3`` flag to
 
 If you are building from Git, you first need to run ``./autogen.sh``,
 which will prepare the build system and generate the `configure` script.
+
+Support for Caja and Nemo
+-------------------------
+
+Caja and Nemo are supported through the ``--with-nautilus=caja`` and
+``--with-nautilus=nemo`` flags.  The support is however currently
+experimental.
diff --git a/configure.ac b/configure.ac
index 7a0ab2d..93b0376 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,9 +32,28 @@ GLIB_REQUIRED=2.10
 GOBJECT_REQUIRED=2.4.0
 GCONF_REQUIRED=2.0
 NAUTILUS_EXTENSION=2.0
+# FIXME: check Caja and Nemo requirement
+CAJA_EXTENSION=1.0
+NEMO_EXTENSION=3.0
 GSECUREDELETE_REQUIRED=0.1
 GIO_UNIX_REQUIRED=2.0
 
+AC_ARG_WITH([nautilus],
+            [AS_HELP_STRING([--with-nautilus=NAME],
+                            [the name of the nautilus-compatible API @<:@default=nautilus@:>@])],
+            [with_nautilus="$withval"],
+            [with_nautilus=nautilus])
+AS_CASE([$with_nautilus],
+        [nautilus],
+        [AC_DEFINE([NW_NAUTILUS_IS_NAUTILUS], [1], [Define to 1 if Nautilus is Nautilus])],
+        [caja],
+        [NAUTILUS_EXTENSION=$CAJA_EXTENSION
+         AC_DEFINE([NW_NAUTILUS_IS_CAJA], [1], [Define to 1 if Nautilus is Caja])],
+        [nemo],
+        [NAUTILUS_EXTENSION=$NEMO_EXTENSION
+         AC_DEFINE([NW_NAUTILUS_IS_NEMO], [1], [Define to 1 if Nautilus is Nemo])],
+        [AC_MSG_ERROR([Unknown Nautilus API "$withval"])])
+
 # choose whether to use GTK2 or GTK3
 AC_ARG_WITH([gtk3],
             [AS_HELP_STRING([--with-gtk3],
@@ -53,10 +72,10 @@ AS_IF([test "x$with_gtk3" = xauto],
 AC_MSG_RESULT([$gtk_pkg])
 
 # mandatory packages
-PKG_CHECK_MODULES([GLIB],                   glib-2.0              >= ${GLIB_REQUIRED})
-PKG_CHECK_MODULES([GTK],                    $gtk_pkg              >= ${GTK_REQUIRED})
-PKG_CHECK_MODULES([LIBNAUTILUS_EXTENSION],  libnautilus-extension >= ${NAUTILUS_EXTENSION})
-PKG_CHECK_MODULES([GSECUREDELETE],          gsecuredelete         >= ${GSECUREDELETE_REQUIRED})
+PKG_CHECK_MODULES([GLIB],                   glib-2.0                      >= ${GLIB_REQUIRED})
+PKG_CHECK_MODULES([GTK],                    $gtk_pkg                      >= ${GTK_REQUIRED})
+PKG_CHECK_MODULES([LIBNAUTILUS_EXTENSION],  lib${with_nautilus}-extension >= ${NAUTILUS_EXTENSION})
+PKG_CHECK_MODULES([GSECUREDELETE],          gsecuredelete                 >= ${GSECUREDELETE_REQUIRED})
 # GConf is mandatory, but only for Nautilus 2.x
 AS_IF([test "$gtk_pkg" = "gtk+-2.0"],
       [PKG_CHECK_MODULES([GCONF], gconf-2.0 >= ${GCONF_REQUIRED})
@@ -85,13 +104,15 @@ AM_GNU_GETTEXT([external])
 
 # when working in a test environment, nautilus is typically installed in
 # a non-standard location ; lets specify this here
-NA_NAUTILUS_EXTDIR
+NW_NAUTILUS_EXTDIR([$with_nautilus])
 
 # Checks for library functions.
 # If we are here we're sure we have libnautilus-extension, but we need this for
 # the check below to work (for the lib to be found).
-AC_CHECK_LIB([nautilus-extension], [nautilus_menu_provider_get_file_items])
-AC_CHECK_FUNCS([nautilus_file_info_get_location])
+AC_CHECK_LIB([${with_nautilus}-extension], [${with_nautilus}_menu_provider_get_file_items])
+AC_CHECK_FUNCS([${with_nautilus}_file_info_get_location],
+               [AC_DEFINE([HAVE_NAUTILUS_FILE_INFO_GET_LOCATION], [1],
+                          [Define to 1 if you have the 'nautilus_file_info_get_location' function.])])
 
 # Output
 AC_CONFIG_FILES([Makefile
diff --git a/m4/na-nautilus-extdir.m4 b/m4/nw-nautilus-extdir.m4
similarity index 80%
rename from m4/na-nautilus-extdir.m4
rename to m4/nw-nautilus-extdir.m4
index 2fbca47..54223c0 100644
--- a/m4/na-nautilus-extdir.m4
+++ b/m4/nw-nautilus-extdir.m4
@@ -4,6 +4,7 @@
 # Copyright (C) 2005 The GNOME Foundation
 # Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
 # Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
+# Copyright (C) 2016 Colomban Wendling (see AUTHORS)
 #
 # This Program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License as
@@ -24,16 +25,21 @@
 #   Frederic Ruaudel <grumz at grumz.net>
 #   Rodrigo Moya <rodrigo at gnome-db.org>
 #   Pierre Wieser <pwieser at trychlos.org>
+#   Colomban Wendling <ban at herbesfolles.org>
 #   ... and many others (see AUTHORS)
 
-# serial 2 change NACT_ prefix to NA_ (Nautilus Actions)
+# serial 3 support for alternative nautilus name
 
 # let the user specify an alternate nautilus-extension dir
 # --with-nautilus-extdir=<dir>
 
-AC_DEFUN([NA_NAUTILUS_EXTDIR],[
-	AC_REQUIRE([_AC_ARG_NA_NAUTILUS_EXTDIR])dnl
-	AC_REQUIRE([_AC_NA_CHECK_NAUTILUS_EXTDIR])dnl
+AC_DEFUN([NW_NAUTILUS_EXTDIR],[
+	AC_REQUIRE([_AC_ARG_NW_NAUTILUS_EXTDIR])dnl
+	AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+	if test "x${ac_with_nact_nautilus_extdir}" = "x"; then
+		nautilus=m4_default([$1], [nautilus])
+		ac_with_nact_nautilus_extdir="`${PKG_CONFIG} --variable=extensiondir lib${nautilus}-extension`"
+	fi
 	if test "x${ac_with_nact_nautilus_extdir}" = "x"; then
 		AC_MSG_ERROR([Unable to determine nautilus extension folder, please use --with-nautilus-extdir option])
 	else
@@ -42,7 +48,7 @@ AC_DEFUN([NA_NAUTILUS_EXTDIR],[
 	fi
 ])
 
-AC_DEFUN([_AC_ARG_NA_NAUTILUS_EXTDIR],[
+AC_DEFUN([_AC_ARG_NW_NAUTILUS_EXTDIR],[
 	AC_ARG_WITH(
 		[nautilus-extdir],
 		AC_HELP_STRING(
@@ -53,11 +59,3 @@ AC_DEFUN([_AC_ARG_NA_NAUTILUS_EXTDIR],[
 	[ac_with_nact_nautilus_extdir=""]
 	)
 ])
-
-AC_DEFUN([_AC_NA_CHECK_NAUTILUS_EXTDIR],[
-	if test "x${ac_with_nact_nautilus_extdir}" = "x"; then
-		if test "x${PKG_CONFIG}" != "x"; then
-			ac_with_nact_nautilus_extdir="`${PKG_CONFIG} --variable=extensiondir libnautilus-extension`"
-		fi
-	fi
-])
diff --git a/nautilus-wipe/Makefile.am b/nautilus-wipe/Makefile.am
index 8d5869d..e923a0c 100644
--- a/nautilus-wipe/Makefile.am
+++ b/nautilus-wipe/Makefile.am
@@ -4,7 +4,10 @@ nautilus_extension_LTLIBRARIES = libnautilus-wipe.la
 
 localedir = $(datadir)/locale
 
+EXTRA_DIST = nw-api-impl.i
+
 libnautilus_wipe_la_SOURCES  = extension.c \
+                               nw-api-impl.h \
                                nw-compat.h \
                                nw-delete-operation.c \
                                nw-delete-operation.h \
diff --git a/nautilus-wipe/extension.c b/nautilus-wipe/extension.c
index acc7fdc..52cf440 100644
--- a/nautilus-wipe/extension.c
+++ b/nautilus-wipe/extension.c
@@ -31,6 +31,8 @@
 #include <glib/gi18n-lib.h>
 #include <glib-object.h>
 
+#include "nw-api-impl.h"
+
 #include <gsecuredelete/gsecuredelete.h>
 
 
diff --git a/nautilus-wipe/nw-api-impl.h b/nautilus-wipe/nw-api-impl.h
new file mode 100644
index 0000000..e049e3e
--- /dev/null
+++ b/nautilus-wipe/nw-api-impl.h
@@ -0,0 +1,56 @@
+/*
+ *  nautilus-wipe - a nautilus extension to wipe file(s)
+ *
+ *  Copyright (C) 2016 Colomban Wendling <ban at herbesfolles.org>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 3 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/* Selects the Nautilus API implementation */
+
+#ifndef NW_API_IMPL_H
+#define NW_API_IMPL_H
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if defined(NW_NAUTILUS_IS_NAUTILUS)
+/* no mapping needed */
+# include <libnautilus-extension/nautilus-menu-provider.h>
+# include <libnautilus-extension/nautilus-file-info.h>
+#elif defined(NW_NAUTILUS_IS_CAJA)
+# define PREFIX(x) CAJA##x
+# define prefix(x) caja##x
+# define Prefix(x) Caja##x
+# include "nw-api-impl.i"
+# include <libcaja-extension/caja-menu-provider.h>
+# include <libcaja-extension/caja-file-info.h>
+#elif defined(NW_NAUTILUS_IS_NEMO)
+# define PREFIX(x) NEMO##x
+# define prefix(x) nemo##x
+# define Prefix(x) Nemo##x
+# include "nw-api-impl.i"
+# include <libnemo-extension/nemo-menu-provider.h>
+# include <libnemo-extension/nemo-file-info.h>
+#else
+# error "Unknown Nautilus API implementation"
+#endif
+
+
+G_END_DECLS
+
+#endif /* guard */
diff --git a/nautilus-wipe/nw-api-impl.i b/nautilus-wipe/nw-api-impl.i
new file mode 100644
index 0000000..4cb6942
--- /dev/null
+++ b/nautilus-wipe/nw-api-impl.i
@@ -0,0 +1,15 @@
+#define NAUTILUS_TYPE_MENU_PROVIDER PREFIX(_TYPE_MENU_PROVIDER)
+
+#define nautilus_file_info_create_for_uri     prefix(_file_info_create_for_uri)
+#define nautilus_file_info_get_activation_uri prefix(_file_info_get_activation_uri)
+#define nautilus_file_info_get_location       prefix(_file_info_get_location)
+#define nautilus_file_info_get_uri            prefix(_file_info_get_uri)
+#define nautilus_menu_item_new                prefix(_menu_item_new)
+#define nautilus_module_initialize            prefix(_module_initialize)
+#define nautilus_module_list_types            prefix(_module_list_types)
+#define nautilus_module_shutdown              prefix(_module_shutdown)
+
+#define NautilusFileInfo          Prefix(FileInfo)
+#define NautilusMenuItem          Prefix(MenuItem)
+#define NautilusMenuProvider      Prefix(MenuProvider)
+#define NautilusMenuProviderIface Prefix(MenuProviderIface)
diff --git a/nautilus-wipe/nw-compat.h b/nautilus-wipe/nw-compat.h
index 9731417..aa147ab 100644
--- a/nautilus-wipe/nw-compat.h
+++ b/nautilus-wipe/nw-compat.h
@@ -87,7 +87,7 @@ gtk_show_uri (GdkScreen    *screen,
 # define HAVE_NAUTILUS_FILE_INFO_GET_LOCATION 1
 
 #include <gio/gio.h>
-#include <libnautilus-extension/nautilus-file-info.h>
+#include "nw-api-impl.h"
 
 static GFile *
 nautilus_file_info_get_location (NautilusFileInfo *nfi)
diff --git a/nautilus-wipe/nw-extension.c b/nautilus-wipe/nw-extension.c
index d82202a..057ccde 100644
--- a/nautilus-wipe/nw-extension.c
+++ b/nautilus-wipe/nw-extension.c
@@ -25,8 +25,7 @@
 
 #include "nw-extension.h"
 
-#include <libnautilus-extension/nautilus-menu-provider.h>
-#include <libnautilus-extension/nautilus-file-info.h>
+#include "nw-api-impl.h"
 
 #include <glib.h>
 #include <glib/gi18n-lib.h>
diff --git a/nautilus-wipe/nw-path-list.c b/nautilus-wipe/nw-path-list.c
index 033c707..108fc34 100644
--- a/nautilus-wipe/nw-path-list.c
+++ b/nautilus-wipe/nw-path-list.c
@@ -27,7 +27,7 @@
 
 #include <string.h>
 #include <glib.h>
-#include <libnautilus-extension/nautilus-file-info.h>
+#include "nw-api-impl.h"
 #ifdef HAVE_GCONF
 # include <gconf/gconf-client.h>
 #endif
diff --git a/nautilus-wipe/nw-path-list.h b/nautilus-wipe/nw-path-list.h
index 792e5d0..617187a 100644
--- a/nautilus-wipe/nw-path-list.h
+++ b/nautilus-wipe/nw-path-list.h
@@ -24,7 +24,7 @@
 
 #include <glib.h>
 
-#include <libnautilus-extension/nautilus-file-info.h>
+#include "nw-api-impl.h"
 
 G_BEGIN_DECLS
 

-- 
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