[nautilus-actions] Add support for Caja filemanager



commit bcc1a347a861fde60225a6bccf278be3b9f436a7
Author: Wolfgang Ulbrich <mate raveit de>
Date:   Mon Feb 20 12:11:30 2017 +0100

    Add support for Caja filemanager
    
    Mate desktop
    Patch provided by Wolfgang Ulbrich <mate raveit de>
    https://bugzilla.gnome.org/show_bug.cgi?id=778937.

 NEWS                                    |    2 +
 configure.ac                            |    6 ++-
 fma_required_versions                   |    1 +
 m4/fma-file-manager.m4                  |   24 +++++++++
 m4/fma-fm-caja.m4                       |   80 +++++++++++++++++++++++++++++++
 maintainer/run-autogen.sh               |    1 +
 src/api/fma-fm-defines.h                |   25 ++++++++++
 src/plugin-menu/Makefile.am             |   12 +++++
 src/plugin-menu/fma-menu-module.c       |    6 ++
 src/plugin-tracker/Makefile.am          |   13 +++++
 src/plugin-tracker/fma-tracker-module.c |    6 ++
 11 files changed, 175 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 5351315..2b3a0d4 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,8 @@ Version 3.4
                As we target now GLib 2.32, support for legacy compatibility
                layers is removed: dbus-glib-1, libICE, libSM.
 
+        Add support for Caja filemanager (thanks to Wolfgang Ulbrich <mate raveit de>).
+
        New and updated translations:
 
 Version 3.2.4
diff --git a/configure.ac b/configure.ac
index 0f5a75f..e4bf029 100644
--- a/configure.ac
+++ b/configure.ac
@@ -117,7 +117,7 @@ AC_SUBST([NAUTILUS_ACTIONS_LIBS])
 # print the debug output be printed to the console
 AC_DEFINE([NAUTILUS_ACTIONS_DEBUG],["NAUTILUS_ACTIONS_DEBUG"],[Debug environment variable])
 
-# target a file manager (nautilus, nemo, ...)
+# target a file manager (nautilus, nemo, caja, ...)
 FMA_TARGET_FILE_MANAGER
 
 # add --with-default-io-provider option
@@ -200,6 +200,10 @@ if test "${with_nemo_ok}" = "yes"; then
        $as_echo "      Targeting Nemo
          installing extensions in      ${with_nemo_extdir}"
 fi
+if test "${with_caja_ok}" = "yes"; then
+       $as_echo "      Targeting Caja
+         installing extensions in      ${with_caja_extdir}"
+fi
 $as_echo "     GConf enabled                   ${enable_gconf}"
 if test "${enable_gconf}" = "yes"; then
        $as_echo "      GConf schemas installation      ${msg_schemas_install}"
diff --git a/fma_required_versions b/fma_required_versions
index a2f33e5..7bc7c7d 100644
--- a/fma_required_versions
+++ b/fma_required_versions
@@ -51,6 +51,7 @@ uuid_required=1.6.2
 # File-managers
 nautilus_required=3.4.1
 nemo_required=1.8                                      # appeared with Trusty 14 LTS
+caja_required=1.16.0                # gtk+-3 version are in f25, ubuntu-16.10, next debian
 
 REQUIRED_INTLTOOL_VERSION=${intltool_required}
 
diff --git a/m4/fma-file-manager.m4 b/m4/fma-file-manager.m4
index 3fb5353..d4ec7fe 100644
--- a/m4/fma-file-manager.m4
+++ b/m4/fma-file-manager.m4
@@ -63,6 +63,7 @@ AC_DEFUN([FMA_TARGET_FILE_MANAGER],[
 
        _AC_FMA_WITH_NAUTILUS
        _AC_FMA_WITH_NEMO
+       _AC_FMA_WITH_CAJA
 
        if test ${fma_fm_count} -eq 0; then
                _FMA_CHECK_MODULE_MSG([yes],[No suitable target file manager found])
@@ -127,3 +128,26 @@ AC_DEFUN([_AC_FMA_WITH_NEMO],[
 
        AM_CONDITIONAL([HAVE_NEMO], [test "${with_nemo_ok}" = "yes"])
 ])
+
+# targeting file manager: caja
+# user may specify --with[out]-caja; default is to rely on the
+#  availability of the extensions libraries/apis
+# requires: caja-devel be installed
+# supplementary options: --with-caja-extdir
+AC_DEFUN([_AC_FMA_WITH_CAJA],[
+
+       _AC_FMA_WITHAFM([caja],[Caja])
+
+       let fma_fm_candidate+=1
+       AC_SUBST([CAJA_ID],[${fma_fm_candidate}])
+       AC_SUBST([CAJA_LABEL],[Caja])
+       AC_DEFINE_UNQUOTED([CAJA_ID],[${fma_fm_candidate}],[Identify the candidate file manager])
+
+       AS_IF([test "$with_caja" != "no"],[FMA_CHECK_FOR_CAJA])
+
+       if test "${with_caja_ok}" = "yes"; then
+               let fma_fm_count+=1
+       fi
+
+       AM_CONDITIONAL([HAVE_CAJA], [test "${with_caja_ok}" = "yes"])
+])
diff --git a/m4/fma-fm-caja.m4 b/m4/fma-fm-caja.m4
new file mode 100644
index 0000000..96012d9
--- /dev/null
+++ b/m4/fma-fm-caja.m4
@@ -0,0 +1,80 @@
+# FileManager-Actions
+# A file-manager extension which offers configurable context menu actions.
+#
+# Copyright (C) 2005 The GNOME Foundation
+# Copyright (C) 2006-2008 Frederic Ruaudel and others (see AUTHORS)
+# Copyright (C) 2009-2015 Pierre Wieser and others (see AUTHORS)
+#
+# FileManager-Actions 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 2 of
+# the License, or (at your option) any later version.
+#
+# FileManager-Actions 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
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with FileManager-Actions; see the file COPYING. If not, see
+# <http://www.gnu.org/licenses/>.
+#
+# Authors:
+#   Frederic Ruaudel <grumz grumz net>
+#   Rodrigo Moya <rodrigo gnome-db org>
+#   Pierre Wieser <pwieser trychlos org>
+#   ... and many others (see AUTHORS)
+
+# serial 1 introduce FMA_CHECK_FOR_CAJA
+
+dnl Usage: FMA_CHECK_FOR_CAJA
+dnl Decription: Whether the user has specified '--with-caja' or does
+dnl   not have specified anything (while he does not have specified
+dnl   --without-caja), we are checking here if Caja is a suitable
+dnl   target file manager.
+dnl   This requires that the extensions library be installed, and that
+dnl   the extensions directory be defined.
+dnl
+AC_DEFUN([FMA_CHECK_FOR_CAJA],[
+       with_caja_ok="no"
+       AC_REQUIRE([_FMA_CAJA_EXTDIR])
+       if test "${with_caja_extdir}" = ""; then
+               AC_MSG_WARN([Unable to determine Caja extension folder, please use --with-caja-extdir option])
+       else
+               FMA_CHECK_MODULE([CAJA_EXTENSION],[libcaja-extension],[${caja_required}],[yes])
+               if test "${have_CAJA_EXTENSION}" = "yes"; then
+                       with_caja_ok="yes"
+               fi
+       fi
+       if test "${with_caja_ok}" = "yes"; then
+               # Check for menu update function
+               AC_CHECK_LIB([caja-extension],[caja_menu_item_new],[],[with_caja_ok="no"])
+               # doesn't make the two following checks fatal
+               AC_CHECK_FUNCS([caja_menu_provider_emit_items_updated_signal])
+               #  add toolbar items
+               AC_CHECK_FUNCS([caja_menu_provider_get_toolbar_items])
+       fi
+       if test "${with_caja_ok}" = "yes"; then
+               AC_MSG_NOTICE([installing Caja plugins in ${with_caja_extdir}])
+               AC_SUBST([CAJA_EXTENSIONS_DIR],[${with_caja_extdir}])
+       fi
+])
+
+# let the user specify an alternate caja-extension dir
+# --with-caja-extdir=<dir>
+#
+AC_DEFUN([_FMA_CAJA_EXTDIR],[
+
+       AC_ARG_WITH([caja-extdir],
+               AC_HELP_STRING(
+                       [--with-caja-extdir=DIR],
+                       [Caja extensions directory @<:@auto@:>@]),
+               [with_caja_extdir=$withval],
+               [with_caja_extdir=""])
+
+       if test "${with_caja_extdir}" = ""; then
+               if test "{PKG_CONFIG}" != ""; then
+                       with_caja_extdir=`${PKG_CONFIG} --variable=extensiondir libcaja-extension`
+               fi
+       fi
+])
diff --git a/maintainer/run-autogen.sh b/maintainer/run-autogen.sh
index fddbfeb..88ff03c 100755
--- a/maintainer/run-autogen.sh
+++ b/maintainer/run-autogen.sh
@@ -156,6 +156,7 @@ conf_args="\${conf_args} --prefix=\${heredir}/_install"
 conf_args="\${conf_args} --sysconfdir=/etc"
 conf_args="\${conf_args} --with-nautilus-extdir=\${heredir}/_install/lib/nautilus"
 conf_args="\${conf_args} --with-nemo-extdir=\${heredir}/_install/lib/nemo"
+conf_args="\${conf_args} --with-caja-extdir=\${heredir}/_install/lib/caja"
 conf_args="\${conf_args} --enable-maintainer-mode"
 conf_args="\${conf_args} --enable-docs"
 conf_args="\${conf_args} $*"
diff --git a/src/api/fma-fm-defines.h b/src/api/fma-fm-defines.h
index 1a69cf3..7c2a27b 100644
--- a/src/api/fma-fm-defines.h
+++ b/src/api/fma-fm-defines.h
@@ -43,6 +43,10 @@
 #include <libnemo-extension/nemo-extension-types.h>
 #include <libnemo-extension/nemo-menu-provider.h>
 #include <libnemo-extension/nemo-file-info.h>
+#elif FMA_TARGET_ID == CAJA_ID
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-file-info.h>
 #endif
 
 G_BEGIN_DECLS
@@ -89,6 +93,27 @@ G_BEGIN_DECLS
 #define file_manager_file_info_list_copy                      nemo_file_info_list_copy
 #define file_manager_file_info_list_free                      nemo_file_info_list_free
 #define file_manager_menu_provider_emit_items_updated_signal  nemo_menu_provider_emit_items_updated_signal
+#elif FMA_TARGET_ID == CAJA_ID
+#define FILE_MANAGER_TYPE_MENU_PROVIDER                       CAJA_TYPE_MENU_PROVIDER
+#define FILE_MANAGER_MENU_PROVIDER                            CAJA_MENU_PROVIDER
+#define FILE_MANAGER_IS_MENU                                  CAJA_IS_MENU
+#define FILE_MANAGER_MENU_ITEM                                CAJA_MENU_ITEM
+#define FILE_MANAGER_FILE_INFO                                CAJA_FILE_INFO
+#define FileManagerMenuProviderIface                          CajaMenuProviderIface
+#define FileManagerMenuProvider                               CajaMenuProvider
+#define FileManagerMenuItem                                   CajaMenuItem
+#define FileManagerMenu                                       CajaMenu
+#define FileManagerFileInfo                                   CajaFileInfo
+#define file_manager_menu_new                                 caja_menu_new
+#define file_manager_menu_append_item                         caja_menu_append_item
+#define file_manager_menu_item_new                            caja_menu_item_new
+#define file_manager_menu_item_set_submenu                    caja_menu_item_set_submenu
+#define file_manager_menu_item_list_free                      caja_menu_item_list_free
+#define file_manager_file_info_get_uri                        caja_file_info_get_uri
+#define file_manager_file_info_get_mime_type                  caja_file_info_get_mime_type
+#define file_manager_file_info_list_copy                      caja_file_info_list_copy
+#define file_manager_file_info_list_free                      caja_file_info_list_free
+#define file_manager_menu_provider_emit_items_updated_signal  caja_menu_provider_emit_items_updated_signal
 #endif
 
 G_END_DECLS
diff --git a/src/plugin-menu/Makefile.am b/src/plugin-menu/Makefile.am
index 7e27bef..c7a44e0 100644
--- a/src/plugin-menu/Makefile.am
+++ b/src/plugin-menu/Makefile.am
@@ -75,5 +75,17 @@ libfma_nemo_menu_la_CPPFLAGS = $(AM_CPPFLAGS)                        \
        $(NULL)
 endif
 
+if HAVE_CAJA
+caja_extensiondir = $(CAJA_EXTENSIONS_DIR)
+caja_extension_LTLIBRARIES = libfma-caja-menu.la
+libfma_caja_menu_la_SOURCES = $(lib_sources)
+libfma_caja_menu_la_LIBADD = $(lib_libadd)
+libfma_caja_menu_la_LDFLAGS = $(lib_ldflags)
+libfma_caja_menu_la_CPPFLAGS = $(AM_CPPFLAGS)                  \
+       -DFMA_TARGET_ID=$(CAJA_ID)                                                      \
+       -DFMA_TARGET_LABEL=\"$(CAJA_LABEL)\"                            \
+       $(NULL)
+endif
+
 # Code coverage
 @CODE_COVERAGE_RULES@
diff --git a/src/plugin-menu/fma-menu-module.c b/src/plugin-menu/fma-menu-module.c
index b2db62e..1163c23 100644
--- a/src/plugin-menu/fma-menu-module.c
+++ b/src/plugin-menu/fma-menu-module.c
@@ -63,6 +63,8 @@ void
 nautilus_module_initialize( GTypeModule *module )
 #elif FMA_TARGET_ID == NEMO_ID
 nemo_module_initialize( GTypeModule *module )
+#elif FMA_TARGET_ID == CAJA_ID
+caja_module_initialize( GTypeModule *module )
 #endif
 {
        static const gchar *thisfn = "fma_menu_module_" FMA_TARGET_LABEL "_module_initialize";
@@ -89,6 +91,8 @@ void
 nautilus_module_list_types( const GType **types, int *num_types )
 #elif FMA_TARGET_ID == NEMO_ID
 nemo_module_list_types( const GType **types, int *num_types )
+#elif FMA_TARGET_ID == CAJA_ID
+caja_module_list_types( const GType **types, int *num_types )
 #endif
 {
        static const gchar *thisfn = "fma_menu_module_" FMA_TARGET_LABEL "_module_list_types";
@@ -109,6 +113,8 @@ void
 nautilus_module_shutdown( void )
 #elif FMA_TARGET_ID == NEMO_ID
 nemo_module_shutdown( void )
+#elif FMA_TARGET_ID == CAJA_ID
+caja_module_shutdown( void )
 #endif
 {
        static const gchar *thisfn = "fma_menu_module_" FMA_TARGET_LABEL "_module_shutdown";
diff --git a/src/plugin-tracker/Makefile.am b/src/plugin-tracker/Makefile.am
index f17ff5a..a8006ea 100644
--- a/src/plugin-tracker/Makefile.am
+++ b/src/plugin-tracker/Makefile.am
@@ -100,6 +100,19 @@ libfma_nemo_tracker_la_CPPFLAGS = $(AM_CPPFLAGS)           \
        $(NULL)
 endif
 
+if HAVE_CAJA
+caja_extensiondir = $(CAJA_EXTENSIONS_DIR)
+caja_extension_LTLIBRARIES = libfma-caja-tracker.la
+nodist_libfma_caja_tracker_la_SOURCES = $(nodist_libfma_sources)
+libfma_caja_tracker_la_SOURCES = $(libfma_sources)
+libfma_caja_tracker_la_LIBADD = $(libfma_ldadd)
+libfma_caja_tracker_la_LDFLAGS = $(libfma_ldflags)
+libfma_caja_tracker_la_CPPFLAGS = $(AM_CPPFLAGS)               \
+       -DFMA_TARGET_ID=$(CAJA_ID)                                                      \
+       -DFMA_TARGET_LABEL=\"$(CAJA_LABEL)\"                            \
+       $(NULL)
+endif
+
 EXTRA_DIST = \
        fma-tracker-gdbus.xml                                                           \
        $(NULL)
diff --git a/src/plugin-tracker/fma-tracker-module.c b/src/plugin-tracker/fma-tracker-module.c
index 20f9600..b4fff72 100644
--- a/src/plugin-tracker/fma-tracker-module.c
+++ b/src/plugin-tracker/fma-tracker-module.c
@@ -60,6 +60,8 @@ void
 nautilus_module_initialize( GTypeModule *module )
 #elif FMA_TARGET_ID == NEMO_ID
 nemo_module_initialize( GTypeModule *module )
+#elif FMA_TARGET_ID == CAJA_ID
+caja_module_initialize( GTypeModule *module )
 #endif
 {
        static const gchar *thisfn = "fma_tracker_module_" FMA_TARGET_LABEL "_module_initialize";
@@ -80,6 +82,8 @@ void
 nautilus_module_list_types( const GType **types, int *num_types )
 #elif FMA_TARGET_ID == NEMO_ID
 nemo_module_list_types( const GType **types, int *num_types )
+#elif FMA_TARGET_ID == CAJA_ID
+caja_module_list_types( const GType **types, int *num_types )
 #endif
 {
        static const gchar *thisfn = "fma_tracker_module_" FMA_TARGET_LABEL "_module_list_types";
@@ -97,6 +101,8 @@ void
 nautilus_module_shutdown( void )
 #elif FMA_TARGET_ID == NEMO_ID
 nemo_module_shutdown( void )
+#elif FMA_TARGET_ID == CAJA_ID
+caja_module_shutdown( void )
 #endif
 {
        static const gchar *thisfn = "fma_tracker_module_" FMA_TARGET_LABEL "_module_shutdown";


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