[nautilus-actions] Create new NadpDesktopModule plugin
- From: Pierre Wieser <pwieser src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Create new NadpDesktopModule plugin
- Date: Wed, 25 Nov 2009 21:24:59 +0000 (UTC)
commit 8876dc35b21d3630fbca39eb84de9de231a77d98
Author: Pierre Wieser <pwieser trychlos org>
Date: Wed Nov 25 00:06:55 2009 +0100
Create new NadpDesktopModule plugin
It will handle actions in desktop entry files.
ChangeLog | 13 ++
configure.ac | 1 +
m4/na-log-domains.m4 | 3 +
nautilus-actions/Makefile.am | 1 +
nautilus-actions/io-provider-desktop/Makefile.am | 55 ++++++
.../io-provider-desktop/nadp-desktop-provider.c | 173 ++++++++++++++++++++
.../io-provider-desktop/nadp-desktop-provider.h | 85 ++++++++++
nautilus-actions/io-provider-desktop/nadp-module.c | 105 ++++++++++++
8 files changed, 436 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f1f83db..24b6c69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2009-11-24 Pierre Wieser <pwieser trychlos org>
+ Create NadpDesktopProvider module.
+
+ * nautilus-actions/io-provider-desktop/Makefile.am:
+ * nautilus-actions/io-provider-desktop/nadp-desktop-provider.c:
+ * nautilus-actions/io-provider-desktop/nadp-desktop-provider.h:
+ * nautilus-actions/io-provider-desktop/nadp-module.c: New files.
+
+ * configure.ac:
+ * nautilus-actions/Makefile.am: Updated accordingly.
+
+ * m4/na-log-domains.m4:
+ Define new NA_LOGDOMAIN_DESKTOP_PROVIDER log domain.
+
Have smaller sources in NagpGConfProvider.
Remove na-utils dependancy.
diff --git a/configure.ac b/configure.ac
index 5568faa..63660e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,6 +49,7 @@ AC_CONFIG_FILES([
icons/scalable/Makefile
nautilus-actions/Makefile
nautilus-actions/api/Makefile
+ nautilus-actions/io-provider-desktop/Makefile
nautilus-actions/io-provider-gconf/Makefile
nautilus-actions/nact/Makefile
nautilus-actions/plugin/Makefile
diff --git a/m4/na-log-domains.m4 b/m4/na-log-domains.m4
index 517e333..877235c 100644
--- a/m4/na-log-domains.m4
+++ b/m4/na-log-domains.m4
@@ -8,6 +8,9 @@ AC_DEFUN([NA_LOG_DOMAINS],[
AC_SUBST([NA_LOGDOMAIN_API],[NA-api])
AC_DEFINE_UNQUOTED([NA_LOGDOMAIN_API],["NA-api"],[Log domain of API library])
+ AC_SUBST([NA_LOGDOMAIN_IO_PROVIDER_DESKTOP],[NA-io-provider-desktop])
+ AC_DEFINE_UNQUOTED([NA_LOGDOMAIN_IO_PROVIDER_DESKTOP],["NA-io-provider-desktop"],[Log domain of desktop IO Provider])
+
AC_SUBST([NA_LOGDOMAIN_IO_PROVIDER_GCONF],[NA-io-provider-gconf])
AC_DEFINE_UNQUOTED([NA_LOGDOMAIN_IO_PROVIDER_GCONF],["NA-io-provider-gconf"],[Log domain of GConf IO Provider])
diff --git a/nautilus-actions/Makefile.am b/nautilus-actions/Makefile.am
index f55be48..9d84c1d 100644
--- a/nautilus-actions/Makefile.am
+++ b/nautilus-actions/Makefile.am
@@ -30,6 +30,7 @@ SUBDIRS = \
api \
private \
runtime \
+ io-provider-desktop \
io-provider-gconf \
nact \
plugin \
diff --git a/nautilus-actions/io-provider-desktop/Makefile.am b/nautilus-actions/io-provider-desktop/Makefile.am
new file mode 100644
index 0000000..432510a
--- /dev/null
+++ b/nautilus-actions/io-provider-desktop/Makefile.am
@@ -0,0 +1,55 @@
+# Nautilus Actions
+# A Nautilus extension which offers configurable context menu actions.
+#
+# 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)
+#
+# This Program 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.
+#
+# This Program 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 this Library; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA 02111-1307, USA.
+#
+# Authors:
+# Frederic Ruaudel <grumz grumz net>
+# Rodrigo Moya <rodrigo gnome-db org>
+# Pierre Wieser <pwieser trychlos org>
+# ... and many others (see AUTHORS)
+
+pluginsdir = $(pkglibdir)
+
+plugins_LTLIBRARIES=libna-io-provider-desktop.la
+
+AM_CPPFLAGS += \
+ -I $(top_srcdir) \
+ $(NAUTILUS_ACTIONS_CFLAGS) \
+ -DG_LOG_DOMAIN=\"${NA_LOGDOMAIN_IO_PROVIDER_DESKTOP}\" \
+ $(NULL)
+
+libna_io_provider_desktop_la_SOURCES = \
+ nadp-desktop-provider.c \
+ nadp-desktop-provider.h \
+ nadp-module.c \
+ $(NULL)
+
+libna_io_provider_desktop_la_LIBADD = \
+ -L$(top_builddir)/nautilus-actions/api -lna-api \
+ -L$(top_builddir)/nautilus-actions/private -lna-private \
+ $(NULL)
+
+VERSION_INFO = 1:0:0
+libna_io_provider_desktop_la_LDFLAGS = \
+ -module \
+ -no-undefined \
+ -version-number $(VERSION_INFO) \
+ $(NULL)
diff --git a/nautilus-actions/io-provider-desktop/nadp-desktop-provider.c b/nautilus-actions/io-provider-desktop/nadp-desktop-provider.c
new file mode 100644
index 0000000..5774eec
--- /dev/null
+++ b/nautilus-actions/io-provider-desktop/nadp-desktop-provider.c
@@ -0,0 +1,173 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * 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)
+ *
+ * This Program 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.
+ *
+ * This Program 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 this Library; see the file COPYING. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Frederic Ruaudel <grumz grumz net>
+ * Rodrigo Moya <rodrigo gnome-db org>
+ * Pierre Wieser <pwieser trychlos org>
+ * ... and many others (see AUTHORS)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+
+#include <nautilus-actions/api/na-iio-provider.h>
+
+#include "nadp-desktop-provider.h"
+
+/* private class data
+ */
+struct NadpDesktopProviderClassPrivate {
+ void *empty; /* so that gcc -pedantic is happy */
+};
+
+static GType st_module_type = 0;
+static GObjectClass *st_parent_class = NULL;
+
+static void class_init( NadpDesktopProviderClass *klass );
+static void iio_provider_iface_init( NAIIOProviderInterface *iface );
+static void instance_init( GTypeInstance *instance, gpointer klass );
+static void instance_dispose( GObject *object );
+static void instance_finalize( GObject *object );
+
+GType
+nadp_desktop_provider_get_type( void )
+{
+ return( st_module_type );
+}
+
+void
+nadp_desktop_provider_register_type( GTypeModule *module )
+{
+ static const gchar *thisfn = "nadp_desktop_provider_register_type";
+
+ static GTypeInfo info = {
+ sizeof( NadpDesktopProviderClass ),
+ NULL,
+ NULL,
+ ( GClassInitFunc ) class_init,
+ NULL,
+ NULL,
+ sizeof( NadpDesktopProvider ),
+ 0,
+ ( GInstanceInitFunc ) instance_init
+ };
+
+ static const GInterfaceInfo iio_provider_iface_info = {
+ ( GInterfaceInitFunc ) iio_provider_iface_init,
+ NULL,
+ NULL
+ };
+
+ g_debug( "%s", thisfn );
+
+ st_module_type = g_type_module_register_type( module, G_TYPE_OBJECT, "NadpDesktopProvider", &info, 0 );
+
+ g_type_module_add_interface( module, st_module_type, NA_IIO_PROVIDER_TYPE, &iio_provider_iface_info );
+}
+
+static void
+class_init( NadpDesktopProviderClass *klass )
+{
+ static const gchar *thisfn = "nadp_desktop_provider_class_init";
+ GObjectClass *object_class;
+
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
+
+ st_parent_class = g_type_class_peek_parent( klass );
+
+ object_class = G_OBJECT_CLASS( klass );
+ object_class->dispose = instance_dispose;
+ object_class->finalize = instance_finalize;
+
+ klass->private = g_new0( NadpDesktopProviderClassPrivate, 1 );
+}
+
+static void
+iio_provider_iface_init( NAIIOProviderInterface *iface )
+{
+ static const gchar *thisfn = "nadp_desktop_provider_iio_provider_iface_init";
+
+ g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
+
+ iface->read_items = NULL;
+ iface->is_willing_to_write = NULL;
+ iface->is_writable = NULL;
+ iface->write_item = NULL;
+ iface->delete_item = NULL;
+}
+
+static void
+instance_init( GTypeInstance *instance, gpointer klass )
+{
+ static const gchar *thisfn = "nadp_desktop_provider_instance_init";
+ NadpDesktopProvider *self;
+
+ g_debug( "%s: instance=%p, klass=%p", thisfn, ( void * ) instance, ( void * ) klass );
+ g_return_if_fail( NADP_IS_DESKTOP_PROVIDER( instance ));
+ self = NADP_DESKTOP_PROVIDER( instance );
+
+ self->private = g_new0( NadpDesktopProviderPrivate, 1 );
+
+ self->private->dispose_has_run = FALSE;
+}
+
+static void
+instance_dispose( GObject *object )
+{
+ static const gchar *thisfn = "nadp_desktop_provider_instance_dispose";
+ NadpDesktopProvider *self;
+
+ g_debug( "%s: object=%p", thisfn, ( void * ) object );
+ g_return_if_fail( NADP_IS_DESKTOP_PROVIDER( object ));
+ self = NADP_DESKTOP_PROVIDER( object );
+
+ if( !self->private->dispose_has_run ){
+
+ self->private->dispose_has_run = TRUE;
+
+ /* chain up to the parent class */
+ if( G_OBJECT_CLASS( st_parent_class )->dispose ){
+ G_OBJECT_CLASS( st_parent_class )->dispose( object );
+ }
+ }
+}
+
+static void
+instance_finalize( GObject *object )
+{
+ NadpDesktopProvider *self;
+
+ g_assert( NADP_IS_DESKTOP_PROVIDER( object ));
+ self = NADP_DESKTOP_PROVIDER( object );
+
+ g_free( self->private );
+
+ /* chain call to parent class */
+ if( G_OBJECT_CLASS( st_parent_class )->finalize ){
+ G_OBJECT_CLASS( st_parent_class )->finalize( object );
+ }
+}
diff --git a/nautilus-actions/io-provider-desktop/nadp-desktop-provider.h b/nautilus-actions/io-provider-desktop/nadp-desktop-provider.h
new file mode 100644
index 0000000..8b0fe9c
--- /dev/null
+++ b/nautilus-actions/io-provider-desktop/nadp-desktop-provider.h
@@ -0,0 +1,85 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * 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)
+ *
+ * This Program 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.
+ *
+ * This Program 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 this Library; see the file COPYING. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Frederic Ruaudel <grumz grumz net>
+ * Rodrigo Moya <rodrigo gnome-db org>
+ * Pierre Wieser <pwieser trychlos org>
+ * ... and many others (see AUTHORS)
+ */
+
+#ifndef __NADP_DESKTOP_PROVIDER_H__
+#define __NADP_DESKTOP_PROVIDER_H__
+
+/**
+ * SECTION: nadp_desktop_provider
+ * @short_description: #NadpDesktopProvider class definition.
+ * @include: na-gconf-provider.h
+ *
+ * This class manages the GConf I/O storage subsystem, or, in other words,
+ * the GConf subsystem as an NAIIOProvider. As this, it should only be
+ * used through the NAIIOProvider interface.
+ *
+ * #NadpDesktopProvider uses #NAGConfMonitor to watch at the configuration
+ * tree. Modifications are notified to the NAIIOProvider interface.
+ */
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define NADP_DESKTOP_PROVIDER_TYPE ( nadp_desktop_provider_get_type())
+#define NADP_DESKTOP_PROVIDER( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NADP_DESKTOP_PROVIDER_TYPE, NadpDesktopProvider ))
+#define NADP_DESKTOP_PROVIDER_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( klass, NADP_DESKTOP_PROVIDER_TYPE, NadpDesktopProviderClass ))
+#define NADP_IS_DESKTOP_PROVIDER( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NADP_DESKTOP_PROVIDER_TYPE ))
+#define NADP_IS_DESKTOP_PROVIDER_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NADP_DESKTOP_PROVIDER_TYPE ))
+#define NADP_DESKTOP_PROVIDER_GET_CLASS( object ) ( G_TYPE_INSTANCE_GET_CLASS(( object ), NADP_DESKTOP_PROVIDER_TYPE, NadpDesktopProviderClass ))
+
+/* private instance data
+ */
+typedef struct NadpDesktopProviderPrivate {
+ gboolean dispose_has_run;
+}
+ NadpDesktopProviderPrivate;
+
+typedef struct {
+ GObject parent;
+ NadpDesktopProviderPrivate *private;
+}
+ NadpDesktopProvider;
+
+typedef struct NadpDesktopProviderClassPrivate NadpDesktopProviderClassPrivate;
+
+typedef struct {
+ GObjectClass parent;
+ NadpDesktopProviderClassPrivate *private;
+}
+ NadpDesktopProviderClass;
+
+GType nadp_desktop_provider_get_type ( void );
+void nadp_desktop_provider_register_type( GTypeModule *module );
+
+G_END_DECLS
+
+#endif /* __NADP_DESKTOP_PROVIDER_H__ */
diff --git a/nautilus-actions/io-provider-desktop/nadp-module.c b/nautilus-actions/io-provider-desktop/nadp-module.c
new file mode 100644
index 0000000..a81e070
--- /dev/null
+++ b/nautilus-actions/io-provider-desktop/nadp-module.c
@@ -0,0 +1,105 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * 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)
+ *
+ * This Program 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.
+ *
+ * This Program 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 this Library; see the file COPYING. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Frederic Ruaudel <grumz grumz net>
+ * Rodrigo Moya <rodrigo gnome-db org>
+ * Pierre Wieser <pwieser trychlos org>
+ * ... and many others (see AUTHORS)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <syslog.h>
+
+#include <nautilus-actions/api/na-api.h>
+
+#include "nadp-desktop-provider.h"
+
+/*
+ * A Nautilus-Actions extension must implement four functions :
+ *
+ * - na_api_module_init
+ * - na_api_module_list_types
+ * - na_api_module_get_name
+ * - na_api_module_shutdown
+ *
+ * The first two functions are called at Nautilus-Actions startup.
+ *
+ * The prototypes for these functions are defined in
+ * nautilus-actions/api/na-api.h
+ */
+
+gboolean
+na_api_module_init( GTypeModule *module )
+{
+ static const gchar *thisfn = "nadp_module_na_api_module_initialize";
+ static const gchar *name = "NadpDesktopIOProvider";
+
+ g_debug( "%s: module=%p", thisfn, ( void * ) module );
+
+ g_type_module_set_name( module, name );
+
+ nadp_desktop_provider_register_type( module );
+
+ return( TRUE );
+}
+
+gint
+na_api_module_list_types( const GType **types )
+{
+ static const gchar *thisfn = "nadp_module_na_api_module_list_types";
+ #define count 1
+ static GType type_list[count];
+
+ g_debug( "%s: types=%p", thisfn, ( void * ) types );
+
+ type_list[0] = NADP_DESKTOP_PROVIDER_TYPE;
+ *types = type_list;
+
+ return( count );
+}
+
+const gchar *
+na_api_module_get_name( GType type )
+{
+ static const gchar *thisfn = "nadp_module_na_api_module_get_name";
+
+ g_debug( "%s: type=%ld", thisfn, ( gulong ) type );
+
+ if( type == NADP_DESKTOP_PROVIDER_TYPE ){
+ return( "Nautilus-Actions Desktop IO Provider" );
+ }
+
+ return( NULL );
+}
+
+void
+na_api_module_shutdown( void )
+{
+ static const gchar *thisfn = "nadp_module_na_api_module_shutdown";
+
+ g_debug( "%s", thisfn );
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]