[nautilus-actions/file-manager-actions] Update plugin-tracker to build for all file-managers
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions/file-manager-actions] Update plugin-tracker to build for all file-managers
- Date: Thu, 10 Sep 2015 10:24:38 +0000 (UTC)
commit ea9b8e0d4f4fcfc0a1416e3829aaaf151ce72dd5
Author: Pierre Wieser <pwieser trychlos org>
Date: Wed Sep 9 18:19:44 2015 +0200
Update plugin-tracker to build for all file-managers
src/api/fma-fm-defines.h | 4 +++
src/plugin-tracker/Makefile.am | 38 ++++++++++++++++++++++++------
src/plugin-tracker/fma-tracker-module.c | 20 +++++++++++++---
src/plugin-tracker/fma-tracker-plugin.c | 29 ++++++++++-------------
4 files changed, 63 insertions(+), 28 deletions(-)
---
diff --git a/src/api/fma-fm-defines.h b/src/api/fma-fm-defines.h
index fe66ebd..1a69cf3 100644
--- a/src/api/fma-fm-defines.h
+++ b/src/api/fma-fm-defines.h
@@ -65,6 +65,8 @@ G_BEGIN_DECLS
#define file_manager_menu_item_list_free nautilus_menu_item_list_free
#define file_manager_file_info_get_uri nautilus_file_info_get_uri
#define file_manager_file_info_get_mime_type nautilus_file_info_get_mime_type
+#define file_manager_file_info_list_copy nautilus_file_info_list_copy
+#define file_manager_file_info_list_free nautilus_file_info_list_free
#define file_manager_menu_provider_emit_items_updated_signal
nautilus_menu_provider_emit_items_updated_signal
#elif FMA_TARGET_ID == NEMO_ID
#define FILE_MANAGER_TYPE_MENU_PROVIDER NEMO_TYPE_MENU_PROVIDER
@@ -84,6 +86,8 @@ G_BEGIN_DECLS
#define file_manager_menu_item_list_free nemo_menu_item_list_free
#define file_manager_file_info_get_uri nemo_file_info_get_uri
#define file_manager_file_info_get_mime_type nemo_file_info_get_mime_type
+#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
#endif
diff --git a/src/plugin-tracker/Makefile.am b/src/plugin-tracker/Makefile.am
index f6d7ca8..616f249 100644
--- a/src/plugin-tracker/Makefile.am
+++ b/src/plugin-tracker/Makefile.am
@@ -32,10 +32,6 @@ AM_CPPFLAGS += \
$(NAUTILUS_ACTIONS_CFLAGS) \
$(NULL)
-nautilus_extensiondir = $(NAUTILUS_EXTENSIONS_DIR)
-
-nautilus_extension_LTLIBRARIES = libfma-tracker.la
-
BUILT_SOURCES =
BUILT_SOURCES += \
@@ -55,27 +51,53 @@ fma-tracker-gdbus.c fma-tracker-gdbus.h: fma-tracker-gdbus.xml
DISTCLEANFILES = \
fma-tracker-gdbus-docs-org.filemanager_actions.DBus.Tracker.Properties1.xml
-nodist_libfma_tracker_la_SOURCES = \
+nodist_libfma_sources = \
$(BUILT_SOURCES)
\
$(NULL)
-libfma_tracker_la_SOURCES = \
+libfma_sources = \
fma-tracker-module.c \
fma-tracker-plugin.h \
fma-tracker-plugin.c \
$(NULL)
-libfma_tracker_la_LIBADD = \
+libfma_ldadd = \
$(top_builddir)/src/core/libfma-core.la \
$(NAUTILUS_ACTIONS_LIBS) \
$(NULL)
-libfma_tracker_la_LDFLAGS = \
+libfma_ldflags = \
-module
\
-no-undefined
\
-avoid-version
\
$(NULL)
+if HAVE_NAUTILUS
+nautilus_extensiondir = $(NAUTILUS_EXTENSIONS_DIR)
+nautilus_extension_LTLIBRARIES = libfma-nautilus-tracker.la
+nodist_libfma_nautilus_tracker_la_SOURCES = $(nodist_libfma_sources)
+libfma_nautilus_tracker_la_SOURCES = $(libfma_sources)
+libfma_nautilus_tracker_la_LIBADD = $(libfma_ldadd)
+libfma_nautilus_tracker_la_LDFLAGS = $(libfma_ldflags)
+libfma_nautilus_tracker_la_CPPFLAGS = $(AM_CPPFLAGS) \
+ -DFMA_TARGET_ID=$(NAUTILUS_ID) \
+ -DFMA_TARGET_LABEL=\"$(NAUTILUS_LABEL)\" \
+ $(NULL)
+endif
+
+if HAVE_NEMO
+nemo_extensiondir = $(NEMO_EXTENSIONS_DIR)
+nemo_extension_LTLIBRARIES = libfma-nemo-tracker.la
+nodist_libfma_nemo_tracker_la_SOURCES = $(nodist_libfma_sources)
+libfma_nemo_tracker_la_SOURCES = $(libfma_sources)
+libfma_nemo_tracker_la_LIBADD = $(libfma_ldadd)
+libfma_nemo_tracker_la_LDFLAGS = $(libfma_ldflags)
+libfma_nemo_tracker_la_CPPFLAGS = $(AM_CPPFLAGS) \
+ -DFMA_TARGET_ID=$(NEMO_ID) \
+ -DFMA_TARGET_LABEL=\"$(NEMO_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 b1c4571..2f377ee 100644
--- a/src/plugin-tracker/fma-tracker-module.c
+++ b/src/plugin-tracker/fma-tracker-module.c
@@ -34,7 +34,7 @@
#include <string.h>
#include <syslog.h>
-#include <libnautilus-extension/nautilus-extension-types.h>
+#include <api/fma-fm-defines.h>
#include "fma-tracker-plugin.h"
@@ -56,9 +56,13 @@ static GLogFunc st_default_log_func = NULL;
*/
void
+#if FMA_TARGET_ID == NAUTILUS_ID
nautilus_module_initialize( GTypeModule *module )
+#elif FMA_TARGET_ID == NEMO_ID
+nemo_module_initialize( GTypeModule *module )
+#endif
{
- static const gchar *thisfn = "fma_tracker_module_nautilus_module_initialize";
+ static const gchar *thisfn = "fma_tracker_module_" FMA_TARGET_LABEL "_module_initialize";
syslog( LOG_USER | LOG_INFO, "[FMA] %s Tracker %s initializing...", PACKAGE_NAME, PACKAGE_VERSION );
@@ -72,9 +76,13 @@ nautilus_module_initialize( GTypeModule *module )
}
void
+#if FMA_TARGET_ID == NAUTILUS_ID
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 )
+#endif
{
- static const gchar *thisfn = "fma_tracker_module_nautilus_module_list_types";
+ static const gchar *thisfn = "fma_tracker_module_" FMA_TARGET_LABEL "_module_list_types";
static GType type_list[1];
g_debug( "%s: types=%p, num_types=%p", thisfn, ( void * ) types, ( void * ) num_types );
@@ -85,9 +93,13 @@ nautilus_module_list_types( const GType **types, int *num_types )
}
void
+#if FMA_TARGET_ID == NAUTILUS_ID
nautilus_module_shutdown( void )
+#elif FMA_TARGET_ID == NEMO_ID
+nemo_module_shutdown( void )
+#endif
{
- static const gchar *thisfn = "fma_tracker_module_nautilus_module_shutdown";
+ static const gchar *thisfn = "fma_tracker_module_" FMA_TARGET_LABEL "_module_shutdown";
g_debug( "%s", thisfn );
diff --git a/src/plugin-tracker/fma-tracker-plugin.c b/src/plugin-tracker/fma-tracker-plugin.c
index 07ca70e..833e8e2 100644
--- a/src/plugin-tracker/fma-tracker-plugin.c
+++ b/src/plugin-tracker/fma-tracker-plugin.c
@@ -33,11 +33,8 @@
#include <gio/gio.h>
-#include <libnautilus-extension/nautilus-extension-types.h>
-#include <libnautilus-extension/nautilus-file-info.h>
-#include <libnautilus-extension/nautilus-menu-provider.h>
-
#include <api/fma-dbus.h>
+#include <api/fma-fm-defines.h>
#include "fma-tracker-plugin.h"
#include "fma-tracker-gdbus.h"
@@ -70,9 +67,9 @@ static gboolean on_properties1_get_selected_paths( FMATrackerGDBusProperties1 *p
static void instance_dispose( GObject *object );
static void instance_finalize( GObject *object );
-static void menu_provider_iface_init( NautilusMenuProviderIface *iface );
-static GList *menu_provider_get_background_items( NautilusMenuProvider *provider, GtkWidget *window,
NautilusFileInfo *folder );
-static GList *menu_provider_get_file_items( NautilusMenuProvider *provider, GtkWidget *window, GList
*files );
+static void menu_provider_iface_init( FileManagerMenuProviderIface *iface );
+static GList *menu_provider_get_background_items( FileManagerMenuProvider *provider, GtkWidget *window,
FileManagerFileInfo *folder );
+static GList *menu_provider_get_file_items( FileManagerMenuProvider *provider, GtkWidget *window, GList
*files );
static void set_uris( FMATrackerPlugin *tracker, GList *files );
static gchar **get_selected_paths( FMATrackerPlugin *tracker );
@@ -113,7 +110,7 @@ fma_tracker_plugin_register_type( GTypeModule *module )
st_module_type = g_type_module_register_type( module, G_TYPE_OBJECT, "FMATrackerPlugin", &info, 0 );
- g_type_module_add_interface( module, st_module_type, NAUTILUS_TYPE_MENU_PROVIDER,
&menu_provider_iface_info );
+ g_type_module_add_interface( module, st_module_type, FILE_MANAGER_TYPE_MENU_PROVIDER,
&menu_provider_iface_info );
}
static void
@@ -298,7 +295,7 @@ instance_finalize( GObject *object )
}
static void
-menu_provider_iface_init( NautilusMenuProviderIface *iface )
+menu_provider_iface_init( FileManagerMenuProviderIface *iface )
{
static const gchar *thisfn = "fma_tracker_plugin_menu_provider_iface_init";
@@ -309,7 +306,7 @@ menu_provider_iface_init( NautilusMenuProviderIface *iface )
}
static GList *
-menu_provider_get_background_items( NautilusMenuProvider *provider, GtkWidget *window, NautilusFileInfo
*folder )
+menu_provider_get_background_items( FileManagerMenuProvider *provider, GtkWidget *window,
FileManagerFileInfo *folder )
{
static const gchar *thisfn = "fma_tracker_plugin_menu_provider_get_background_items";
FMATrackerPlugin *tracker;
@@ -322,7 +319,7 @@ menu_provider_get_background_items( NautilusMenuProvider *provider, GtkWidget *w
if( !tracker->private->dispose_has_run ){
- uri = nautilus_file_info_get_uri( folder );
+ uri = file_manager_file_info_get_uri( folder );
g_debug( "%s: provider=%p, window=%p, folder=%s",
thisfn,
( void * ) provider,
@@ -345,7 +342,7 @@ menu_provider_get_background_items( NautilusMenuProvider *provider, GtkWidget *w
* b) in contextual menu while the selection stays unchanged
*/
static GList *
-menu_provider_get_file_items( NautilusMenuProvider *provider, GtkWidget *window, GList *files )
+menu_provider_get_file_items( FileManagerMenuProvider *provider, GtkWidget *window, GList *files )
{
static const gchar *thisfn = "fma_tracker_plugin_menu_provider_get_file_items";
FMATrackerPlugin *tracker;
@@ -383,7 +380,7 @@ set_uris( FMATrackerPlugin *tracker, GList *files )
priv = tracker->private;
priv->selected = free_selected( tracker->private->selected );
- priv->selected = nautilus_file_info_list_copy( files );
+ priv->selected = file_manager_file_info_list_copy( files );
}
/*
@@ -441,9 +438,9 @@ get_selected_paths( FMATrackerPlugin *tracker )
iter = paths;
for( it = priv->selected ; it ; it = it->next ){
- *iter = nautilus_file_info_get_uri(( NautilusFileInfo * ) it->data );
+ *iter = file_manager_file_info_get_uri(( FileManagerFileInfo * ) it->data );
iter++;
- *iter = nautilus_file_info_get_mime_type(( NautilusFileInfo * ) it->data );
+ *iter = file_manager_file_info_get_mime_type(( FileManagerFileInfo * ) it->data );
iter++;
}
@@ -453,7 +450,7 @@ get_selected_paths( FMATrackerPlugin *tracker )
static GList *
free_selected( GList *selected )
{
- nautilus_file_info_list_free( selected );
+ file_manager_file_info_list_free( selected );
return( NULL );
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]