[nautilus-actions] Display initial status of I/O providers as a preference
- From: Pierre Wieser <pwieser src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Display initial status of I/O providers as a preference
- Date: Sat, 30 Jan 2010 17:39:40 +0000 (UTC)
commit 008565b4825fdbc0e6cf05b3aaaaaa707551dc9f
Author: Pierre Wieser <pwieser trychlos org>
Date: Wed Jan 27 00:02:21 2010 +0100
Display initial status of I/O providers as a preference
The NAIOProvider class is refactored to maintain a list of capable I/O providers.
What are the capable I/O providers is defined when constructing the NAPivot object.
ChangeLog | 45 ++
nautilus-actions/io-provider-gconf/nagp-read.c | 4 +-
nautilus-actions/nact/nact-application.c | 2 +-
nautilus-actions/nact/nact-iaction-tab.c | 2 +-
nautilus-actions/nact/nact-preferences-editor.c | 1 +
nautilus-actions/nact/nact-providers-list.c | 433 ++-----------
nautilus-actions/plugin/nautilus-actions.c | 7 +-
nautilus-actions/plugin/nautilus-module.c | 2 +-
nautilus-actions/runtime/na-gconf-utils.c | 39 ++
nautilus-actions/runtime/na-gconf-utils.h | 3 +
nautilus-actions/runtime/na-io-provider.c | 816 +++++++++++++++++++----
nautilus-actions/runtime/na-io-provider.h | 48 ++-
nautilus-actions/runtime/na-module.c | 7 +-
nautilus-actions/runtime/na-pivot.c | 292 +++++---
nautilus-actions/runtime/na-pivot.h | 67 ++-
nautilus-actions/tracker/na-tracker-plugin.c | 2 +-
nautilus-actions/utils/nautilus-actions-new.c | 7 +-
nautilus-actions/utils/nautilus-actions-run.c | 7 +-
18 files changed, 1114 insertions(+), 670 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index cac3d0d..4b4a934 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,48 @@
+2009-01-26 Pierre Wieser <pwieser trychlos org>
+
+ * nautilus-actions/io-provider-gconf/nagp-read.c
+ (nagp_iio_provider_read_items): Remove path trace.
+
+ * nautilus-actions/nact/nact-application.c
+ (appli_initialize_application):
+ * nautilus-actions/plugin/nautilus-actions.c (instance_init):
+ * nautilus-actions/utils/nautilus-actions-new.c (write_to_gconf):
+ * nautilus-actions/utils/nautilus-actions-run.c (get_action):
+ Adapt to new na_pivot_new().
+
+ * nautilus-actions/nact/nact-iaction-tab.c (display_provider_name):
+ Adapt to the temporary new NAIOProvider API.
+
+ * nautilus-actions/nact/nact-preferences-editor.c:
+ Fix compilation error by adding nact-providers-list.h include file.
+
+ * nautilus-actions/nact/nact-providers-list.c:
+ Display list of providers with their initial state.
+
+ * nautilus-actions/plugin/nautilus-module.c:
+ * nautilus-actions/tracker/na-tracker-plugin.c:
+ (nautilus_module_initialize):
+ Prefix the log message with "[N-A]".
+
+ * nautilus-actions/runtime/na-gconf-utils.c:
+ * nautilus-actions/runtime/na-gconf-utils.h
+ (na_gconf_utils_get_subdirs, na_gconf_utils_free_subdirs):
+ New functions.
+
+ * nautilus-actions/runtime/na-io-provider.c:
+ * nautilus-actions/runtime/na-io-provider.h:
+ Refactoring to keep a static list of capable I/O providers.
+
+ * nautilus-actions/runtime/na-module.c
+ (na_module_load_modules): Only displays the name of the loaded module.
+ (is_a_na_plugin): Add a trace with the full path of the module.
+
+ * nautilus-actions/runtime/na-pivot.c:
+ * nautilus-actions/runtime/na-pivot.h:
+ Define loadable_set and io_provider_set as construct-only properties.
+ Remove unused action_changed_handler stuff.
+ No more maintain the list of capable I/O providers.
+
2009-01-25 Pierre Wieser <pwieser trychlos org>
* nautilus-actions/runtime/na-pivot.c:
diff --git a/nautilus-actions/io-provider-gconf/nagp-read.c b/nautilus-actions/io-provider-gconf/nagp-read.c
index 8eb96a8..410d439 100644
--- a/nautilus-actions/io-provider-gconf/nagp-read.c
+++ b/nautilus-actions/io-provider-gconf/nagp-read.c
@@ -88,9 +88,7 @@ nagp_iio_provider_read_items( const NAIIOProvider *provider, GSList **messages )
for( ip = listpath ; ip ; ip = ip->next ){
- const gchar *path = ( const gchar * ) ip->data;
- g_debug( "path=%s", path );
- item = read_item( self, path );
+ item = read_item( self, ( const gchar * ) ip->data );
if( item ){
items_list = g_list_prepend( items_list, item );
}
diff --git a/nautilus-actions/nact/nact-application.c b/nautilus-actions/nact/nact-application.c
index ce39b6c..51d2726 100644
--- a/nautilus-actions/nact/nact-application.c
+++ b/nautilus-actions/nact/nact-application.c
@@ -394,7 +394,7 @@ appli_initialize_application( BaseApplication *application )
fake = na_object_action_new();
g_object_unref( fake );
- NACT_APPLICATION( application )->private->pivot = na_pivot_new();
+ NACT_APPLICATION( application )->private->pivot = na_pivot_new( PIVOT_LOAD_ALL, PIVOT_IO_PROVIDER_ALL );
na_pivot_load_items( NACT_APPLICATION( application )->private->pivot );
/* call parent class */
diff --git a/nautilus-actions/nact/nact-iaction-tab.c b/nautilus-actions/nact/nact-iaction-tab.c
index 14d0f41..cad531a 100644
--- a/nautilus-actions/nact/nact-iaction-tab.c
+++ b/nautilus-actions/nact/nact-iaction-tab.c
@@ -1119,7 +1119,7 @@ display_provider_name( NactIActionTab *instance, NAPivot *pivot, NAObjectItem *i
if( item ){
provider = na_object_get_provider( item );
if( provider ){
- label = na_io_provider_get_name( pivot, provider );
+ label = na_io_provider_get_provider_name( provider );
}
}
if( !label ){
diff --git a/nautilus-actions/nact/nact-preferences-editor.c b/nautilus-actions/nact/nact-preferences-editor.c
index 721e65b..bb35b84 100644
--- a/nautilus-actions/nact/nact-preferences-editor.c
+++ b/nautilus-actions/nact/nact-preferences-editor.c
@@ -39,6 +39,7 @@
#include "base-iprefs.h"
#include "nact-application.h"
#include "nact-schemes-list.h"
+#include "nact-providers-list.h"
#include "nact-preferences-editor.h"
/* private class data
diff --git a/nautilus-actions/nact/nact-providers-list.c b/nautilus-actions/nact/nact-providers-list.c
index a4c4b41..f3ca89d 100644
--- a/nautilus-actions/nact/nact-providers-list.c
+++ b/nautilus-actions/nact/nact-providers-list.c
@@ -38,12 +38,12 @@
#include <api/na-object-api.h>
+#include <runtime/na-io-provider.h>
#include <runtime/na-iprefs.h>
#include <runtime/na-utils.h>
#include "nact-application.h"
#include "nact-gtk-utils.h"
-#include "nact-main-tab.h"
#include "nact-providers-list.h"
/* column ordering
@@ -64,26 +64,19 @@ static void init_view_connect_signals( GtkTreeView *treeview, BaseWindow *
static void init_view_select_first_row( GtkTreeView *treeview );
/*static gboolean iter_for_reset( GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data );*/
-static void iter_for_setup( gchar *scheme, GtkTreeModel *model );
-static gboolean iter_for_get( GtkTreeModel* scheme_model, GtkTreePath *path, GtkTreeIter* iter, GSList **schemes_list );
-static GSList *get_list_schemes( GtkTreeView *treeview );
-static gboolean get_list_schemes_iter( GtkTreeModel *model, GtkTreePath *path, GtkTreeIter* iter, GSList **list );
+/*static void iter_for_setup( gchar *scheme, GtkTreeModel *model );
+static gboolean iter_for_get( GtkTreeModel* scheme_model, GtkTreePath *path, GtkTreeIter* iter, GSList **schemes_list );*/
+static GList *get_list_providers( GtkTreeView *treeview );
+static gboolean get_list_providers_iter( GtkTreeModel *model, GtkTreePath *path, GtkTreeIter* iter, GList **list );
-static gboolean on_key_pressed_event( GtkWidget *widget, GdkEventKey *event, BaseWindow *window );
static void on_selection_changed( GtkTreeSelection *selection, BaseWindow *window );
-static void on_add_clicked( GtkButton *button, BaseWindow *window );
-static void on_remove_clicked( GtkButton *button, BaseWindow *window );
-static void on_desc_edited( GtkCellRendererText *renderer, const gchar *path, const gchar *text, BaseWindow *window );
-static void on_keyword_edited( GtkCellRendererText *renderer, const gchar *path, const gchar *text, BaseWindow *window );
-static void on_active_toggled( GtkCellRendererToggle *renderer, gchar *path, BaseWindow *window );
-
-static void edit_cell( BaseWindow *window, const gchar *path_string, const gchar *text, gint column, gboolean *state, gchar **old_text );
-static void edit_inline( BaseWindow *window );
-static void insert_new_row( BaseWindow *window );
-static void delete_row( BaseWindow *window );
-
-static GtkButton *get_add_button( BaseWindow *window );
-static GtkButton *get_remove_button( BaseWindow *window );
+static void on_readable_toggled( GtkCellRendererToggle *renderer, gchar *path, BaseWindow *window );
+static void on_writable_toggled( GtkCellRendererToggle *renderer, gchar *path, BaseWindow *window );
+static void on_up_clicked( GtkButton *button, BaseWindow *window );
+static void on_down_clicked( GtkButton *button, BaseWindow *window );
+
+static GtkButton *get_up_button( BaseWindow *window );
+static GtkButton *get_down_button( BaseWindow *window );
/*static GSList *get_gconf_subdirs( GConfClient *gconf, const gchar *path );
static void free_gconf_subdirs( GSList *subdirs );
static void free_gslist( GSList *list );*/
@@ -154,7 +147,6 @@ void
nact_providers_list_init_view( GtkTreeView *treeview, BaseWindow *window )
{
static const gchar *thisfn = "nact_providers_list_init_view";
- GtkButton *button;
g_debug( "%s: treeview=%p, window=%p", thisfn, ( void * ) treeview, ( void * ) window );
g_return_if_fail( BASE_IS_WINDOW( window ));
@@ -171,28 +163,30 @@ nact_providers_list_init_view( GtkTreeView *treeview, BaseWindow *window )
static void
init_view_setup_defaults( GtkTreeView *treeview, BaseWindow *window )
{
+ NactApplication *application;
+ NAPivot *pivot;
GtkListStore *model;
- GSList *schemes, *iter;
+ GList *providers, *iter;
GtkTreeIter row;
- gchar **tokens;
+ gchar *libelle;
model = GTK_LIST_STORE( gtk_tree_view_get_model( treeview ));
- schemes = get_default_providers_list( window );
+ application = NACT_APPLICATION( base_window_get_application( window ));
+ pivot = nact_application_get_pivot( application );
+ providers = na_io_provider_get_providers_list( pivot );
- for( iter = schemes ; iter ; iter = iter->next ){
+ for( iter = providers ; iter ; iter = iter->next ){
- tokens = g_strsplit(( gchar * ) iter->data, "|", 2 );
gtk_list_store_append( model, &row );
+ libelle = na_io_provider_get_name( NA_IO_PROVIDER( iter->data ));
gtk_list_store_set( model, &row,
- PROVIDERS_CHECKBOX_COLUMN, FALSE,
- PROVIDERS_KEYWORD_COLUMN, tokens[0],
- PROVIDERS_DESC_COLUMN, tokens[1],
+ PROVIDERS_READABLE_COLUMN, na_io_provider_is_to_be_read( NA_IO_PROVIDER( iter->data )),
+ PROVIDERS_WRITABLE_COLUMN, na_io_provider_is_writable( NA_IO_PROVIDER( iter->data )),
+ PROVIDERS_LIBELLE_COLUMN, libelle,
-1 );
- g_strfreev( tokens );
+ g_free( libelle );
}
-
- na_utils_free_string_list( schemes );
}
static void
@@ -200,57 +194,43 @@ init_view_connect_signals( GtkTreeView *treeview, BaseWindow *window )
{
GtkTreeViewColumn *column;
GList *renderers;
- GtkButton *add_button, *remove_button;
+ GtkButton *up_button, *down_button;
- column = gtk_tree_view_get_column( treeview, PROVIDERS_CHECKBOX_COLUMN );
+ column = gtk_tree_view_get_column( treeview, PROVIDERS_READABLE_COLUMN );
renderers = gtk_cell_layout_get_cells( GTK_CELL_LAYOUT( column ));
base_window_signal_connect(
window,
G_OBJECT( renderers->data ),
"toggled",
- G_CALLBACK( on_active_toggled ));
+ G_CALLBACK( on_readable_toggled ));
- column = gtk_tree_view_get_column( treeview, PROVIDERS_KEYWORD_COLUMN );
+ column = gtk_tree_view_get_column( treeview, PROVIDERS_WRITABLE_COLUMN );
renderers = gtk_cell_layout_get_cells( GTK_CELL_LAYOUT( column ));
base_window_signal_connect(
window,
G_OBJECT( renderers->data ),
- "edited",
- G_CALLBACK( on_keyword_edited ));
-
- column = gtk_tree_view_get_column( treeview, PROVIDERS_DESC_COLUMN );
- renderers = gtk_cell_layout_get_cells( GTK_CELL_LAYOUT( column ));
- base_window_signal_connect(
- window,
- G_OBJECT( renderers->data ),
- "edited",
- G_CALLBACK( on_desc_edited ));
+ "toggled",
+ G_CALLBACK( on_writable_toggled ));
- add_button = get_add_button( window );
+ up_button = get_up_button( window );
base_window_signal_connect(
window,
- G_OBJECT( add_button ),
+ G_OBJECT( up_button ),
"clicked",
- G_CALLBACK( on_add_clicked ));
+ G_CALLBACK( on_up_clicked ));
- remove_button = get_remove_button( window );
+ down_button = get_down_button( window );
base_window_signal_connect(
window,
- G_OBJECT( remove_button ),
+ G_OBJECT( down_button ),
"clicked",
- G_CALLBACK( on_remove_clicked ));
+ G_CALLBACK( on_down_clicked ));
base_window_signal_connect(
window,
G_OBJECT( gtk_tree_view_get_selection( treeview )),
"changed",
G_CALLBACK( on_selection_changed ));
-
- base_window_signal_connect(
- window,
- G_OBJECT( treeview ),
- "key-press-event",
- G_CALLBACK( on_key_pressed_event ));
}
static void
@@ -275,24 +255,24 @@ void
nact_providers_list_save( BaseWindow *window )
{
GtkTreeView *treeview;
- GSList *schemes;
+ GList *providers;
NactApplication *application;
NAPivot *pivot;
treeview = GTK_TREE_VIEW( g_object_get_data( G_OBJECT( window ), PROVIDERS_LIST_TREEVIEW ));
- schemes = get_list_schemes( treeview );
+ providers = get_list_providers( treeview );
application = NACT_APPLICATION( base_window_get_application( window ));
pivot = nact_application_get_pivot( application );
- na_iprefs_write_string_list( NA_IPREFS( pivot ), "schemes", schemes );
+ /*na_iprefs_write_string_list( NA_IPREFS( pivot ), "schemes", schemes );
- na_utils_free_string_list( schemes );
+ na_utils_free_string_list( schemes );*/
}
-static GSList *
-get_list_schemes( GtkTreeView *treeview )
+static GList *
+get_list_providers( GtkTreeView *treeview )
{
- GSList *list = NULL;
+ GList *list = NULL;
GtkTreeModel *model;
model = gtk_tree_view_get_model( treeview );
@@ -302,9 +282,9 @@ get_list_schemes( GtkTreeView *treeview )
}
static gboolean
-get_list_providers_iter( GtkTreeModel *model, GtkTreePath *path, GtkTreeIter* iter, GSList **list )
+get_list_providers_iter( GtkTreeModel *model, GtkTreePath *path, GtkTreeIter* iter, GList **list )
{
- gchar *keyword;
+ /*gchar *keyword;
gchar *description;
gchar *scheme;
@@ -313,7 +293,7 @@ get_list_providers_iter( GtkTreeModel *model, GtkTreePath *path, GtkTreeIter* it
g_free( description );
g_free( keyword );
- ( *list ) = g_slist_append(( *list ), scheme );
+ ( *list ) = g_slist_append(( *list ), scheme );*/
return( FALSE ); /* don't stop looping */
}
@@ -340,373 +320,80 @@ nact_providers_list_dispose( BaseWindow *window )
gtk_list_store_clear( GTK_LIST_STORE( model ));
}
-static gboolean
-on_key_pressed_event( GtkWidget *widget, GdkEventKey *event, BaseWindow *window )
-{
- gboolean stop;
- GtkTreeView *treeview;
- gboolean editable;
-
- /*g_debug( "nact_providers_list_on_key_pressed_event" );*/
-
- stop = FALSE;
- treeview = GTK_TREE_VIEW( g_object_get_data( G_OBJECT( window ), PROVIDERS_LIST_TREEVIEW ));
- editable = ( gboolean ) GPOINTER_TO_UINT( g_object_get_data( G_OBJECT( treeview ), PROVIDERS_LIST_EDITABLE ));
-
- if( editable ){
-
- if( event->keyval == GDK_F2 ){
- edit_inline( window );
- stop = TRUE;
- }
-
- if( event->keyval == GDK_Insert || event->keyval == GDK_KP_Insert ){
- insert_new_row( window );
- stop = TRUE;
- }
-
- if( event->keyval == GDK_Delete || event->keyval == GDK_KP_Delete ){
- delete_row( window );
- stop = TRUE;
- }
- }
-
- return( stop );
-}
-
static void
on_selection_changed( GtkTreeSelection *selection, BaseWindow *window )
{
/*static const gchar *thisfn = "nact_providers_list_on_selection_changed";*/
GtkTreeView *treeview;
- gboolean editable;
- GtkButton *button;
/*g_debug( "%s: selection=%p, window=%p", thisfn, ( void * ) selection, ( void * ) window );*/
/*g_debug( "%s: getting data on window=%p", thisfn, ( void * ) window );*/
treeview = GTK_TREE_VIEW( g_object_get_data( G_OBJECT( window ), PROVIDERS_LIST_TREEVIEW ));
- /*g_debug( "%s: getting data on treeview=%p", thisfn, ( void * ) treeview );*/
- editable = ( gboolean ) GPOINTER_TO_UINT( g_object_get_data( G_OBJECT( treeview ), PROVIDERS_LIST_EDITABLE ));
- /*g_debug( "%s: editable=%s, selected_rows=%d",
- thisfn, editable ? "True":"False", gtk_tree_selection_count_selected_rows( selection ));*/
-
- button = get_remove_button( window );
+ /*button = get_remove_button( window );
gtk_widget_set_sensitive( GTK_WIDGET( button ), editable && gtk_tree_selection_count_selected_rows( selection ) > 0);
+ */
}
static void
-on_add_clicked( GtkButton *button, BaseWindow *window )
-{
- insert_new_row( window );
-}
-
-static void
-on_remove_clicked( GtkButton *button, BaseWindow *window )
-{
- delete_row( window );
-}
-
-/*
- * do not allow edition of scheme description when editing an action
- */
-static void
-on_desc_edited( GtkCellRendererText *renderer, const gchar *path, const gchar *text, BaseWindow *window )
-{
- static const gchar *thisfn = "nact_providers_list_on_desc_edited";
-
- g_debug( "%s: renderer=%p, path=%s, text=%s, window=%p",
- thisfn, ( void * ) renderer, path, text, ( void * ) window );
-
- edit_cell( window, path, text, PROVIDERS_DESC_COLUMN, NULL, NULL );
-}
-
-static void
-on_keyword_edited( GtkCellRendererText *renderer, const gchar *path, const gchar *text, BaseWindow *window )
-{
- gboolean state = FALSE;
- gchar *old_text = NULL;
- NAObjectProfile *edited;
-
- edit_cell( window, path, text, PROVIDERS_KEYWORD_COLUMN, &state, &old_text );
-
- if( state ){
- /*g_debug( "%s: old_scheme=%s", thisfn, old_text );*/
- if( g_object_class_find_property( G_OBJECT_GET_CLASS( window ), TAB_UPDATABLE_PROP_EDITED_PROFILE )){
- g_object_get(
- G_OBJECT( window ),
- TAB_UPDATABLE_PROP_EDITED_PROFILE, &edited,
- NULL );
- if( edited ){
- na_object_profile_set_scheme( edited, old_text, FALSE );
- na_object_profile_set_scheme( edited, text, TRUE );
- g_signal_emit_by_name( G_OBJECT( window ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
- }
- }
- }
-
- g_free( old_text );
-}
-
-static void
-on_active_toggled( GtkCellRendererToggle *renderer, gchar *path, BaseWindow *window )
+on_readable_toggled( GtkCellRendererToggle *renderer, gchar *path, BaseWindow *window )
{
GtkTreeView *treeview;
- gboolean editable;
- NAObjectProfile *edited;
GtkTreeModel *model;
- GtkTreeIter iter;
- GtkTreePath *tree_path;
- gboolean state;
- gchar *scheme;
if( !st_on_selection_change ){
treeview = GTK_TREE_VIEW( g_object_get_data( G_OBJECT( window ), PROVIDERS_LIST_TREEVIEW ));
- editable = ( gboolean ) GPOINTER_TO_UINT( g_object_get_data( G_OBJECT( treeview ), PROVIDERS_LIST_EDITABLE ));
model = gtk_tree_view_get_model( treeview );
- tree_path = gtk_tree_path_new_from_string( path );
- gtk_tree_model_get_iter( model, &iter, tree_path );
- gtk_tree_path_free( tree_path );
- gtk_tree_model_get( model, &iter, PROVIDERS_CHECKBOX_COLUMN, &state, PROVIDERS_KEYWORD_COLUMN, &scheme, -1 );
-
- /* gtk_tree_model_get: returns the previous state
- g_debug( "%s: gtk_tree_model_get returns keyword=%s state=%s", thisfn, scheme, state ? "True":"False" );*/
-
- if( !editable ){
- g_signal_handlers_block_by_func(( gpointer ) renderer, on_active_toggled, window );
- gtk_cell_renderer_toggle_set_active( renderer, state );
- g_signal_handlers_unblock_by_func(( gpointer ) renderer, on_active_toggled, window );
-
- } else {
- gtk_list_store_set( GTK_LIST_STORE( model ), &iter, PROVIDERS_CHECKBOX_COLUMN, !state, -1 );
- if( g_object_class_find_property( G_OBJECT_GET_CLASS( window ), TAB_UPDATABLE_PROP_EDITED_PROFILE )){
- g_object_get(
- G_OBJECT( window ),
- TAB_UPDATABLE_PROP_EDITED_PROFILE, &edited,
- NULL );
- if( edited ){
- na_object_profile_set_scheme( edited, scheme, !state );
- g_signal_emit_by_name( G_OBJECT( window ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
- }
- }
- }
-
- g_free( scheme );
}
}
static void
-edit_cell( BaseWindow *window, const gchar *path_string, const gchar *text, gint column, gboolean *state, gchar **old_text )
+on_writable_toggled( GtkCellRendererToggle *renderer, gchar *path, BaseWindow *window )
{
GtkTreeView *treeview;
GtkTreeModel *model;
- GtkTreeIter iter;
- GtkTreePath *path;
- treeview = GTK_TREE_VIEW( g_object_get_data( G_OBJECT( window ), PROVIDERS_LIST_TREEVIEW ));
- model = gtk_tree_view_get_model( treeview );
- path = gtk_tree_path_new_from_string( path_string );
- gtk_tree_model_get_iter( model, &iter, path );
- gtk_tree_path_free( path );
+ if( !st_on_selection_change ){
- if( state && old_text ){
- gtk_tree_model_get( model, &iter, PROVIDERS_CHECKBOX_COLUMN, state, PROVIDERS_KEYWORD_COLUMN, old_text, -1 );
+ treeview = GTK_TREE_VIEW( g_object_get_data( G_OBJECT( window ), PROVIDERS_LIST_TREEVIEW ));
+ model = gtk_tree_view_get_model( treeview );
}
-
- gtk_list_store_set( GTK_LIST_STORE( model ), &iter, column, text, -1 );
}
-/*
- * do not allow edition of scheme description when editing an action
- */
static void
-edit_inline( BaseWindow *window )
+on_up_clicked( GtkButton *button, BaseWindow *window )
{
- static const gchar *thisfn = "nact_providers_list_edit_inline";
- GtkTreeView *listview;
- GtkTreeSelection *selection;
- GList *listrows;
- GtkTreePath *path;
- GtkTreeViewColumn *column;
-
- g_debug( "%s: window=%p", thisfn, ( void * ) window );
-
- listview = GTK_TREE_VIEW( g_object_get_data( G_OBJECT( window ), PROVIDERS_LIST_TREEVIEW ));
- selection = gtk_tree_view_get_selection( listview );
- listrows = gtk_tree_selection_get_selected_rows( selection, NULL );
-
- if( g_list_length( listrows ) == 1 ){
- gtk_tree_view_get_cursor( listview, &path, &column );
- gtk_tree_view_set_cursor( listview, path, column, TRUE );
- gtk_tree_path_free( path );
- }
-
- g_list_foreach( listrows, ( GFunc ) gtk_tree_path_free, NULL );
- g_list_free( listrows );
}
static void
-insert_new_row( BaseWindow *window )
+on_down_clicked( GtkButton *button, BaseWindow *window )
{
- GtkTreeView *listview;
- GtkTreeModel *model;
- GtkTreeSelection *selection;
- GList *listrows;
- GtkTreePath *path;
- GtkTreeIter iter, sibling;
- gboolean inserted;
- GtkTreeViewColumn *column;
-
- listview = GTK_TREE_VIEW( g_object_get_data( G_OBJECT( window ), PROVIDERS_LIST_TREEVIEW ));
- model = gtk_tree_view_get_model( listview );
- selection = gtk_tree_view_get_selection( listview );
- listrows = gtk_tree_selection_get_selected_rows( selection, NULL );
- inserted = FALSE;
- column = NULL;
-
- if( g_list_length( listrows ) == 1 ){
- gtk_tree_view_get_cursor( listview, &path, &column );
- if( gtk_tree_model_get_iter( model, &sibling, path )){
- /* though the path of sibling is correct, the new row is always
- * inserted at path=0 !
- */
- /*g_debug( "insert_new_row: sibling=%s", gtk_tree_model_get_string_from_iter( &sibling ));*/
- gtk_list_store_insert_before( GTK_LIST_STORE( model ), &iter, &sibling );
- inserted = TRUE;
- }
- gtk_tree_path_free( path );
- }
-
- if( !inserted ){
- gtk_list_store_append( GTK_LIST_STORE( model ), &iter );
- }
-
- if( !column || column == gtk_tree_view_get_column( listview, PROVIDERS_CHECKBOX_COLUMN )){
- column = gtk_tree_view_get_column( listview, PROVIDERS_KEYWORD_COLUMN );
- }
-
- gtk_list_store_set( GTK_LIST_STORE( model ), &iter,
- PROVIDERS_CHECKBOX_COLUMN, FALSE,
- /* i18n notes : scheme name set for a new entry in the scheme list */
- PROVIDERS_KEYWORD_COLUMN, _( "new-scheme" ),
- PROVIDERS_DESC_COLUMN, _( "New scheme description" ),
- -1 );
-
- g_list_foreach( listrows, ( GFunc ) gtk_tree_path_free, NULL );
- g_list_free( listrows );
-
- path = gtk_tree_model_get_path( model, &iter );
- gtk_tree_view_set_cursor( listview, path, column, TRUE );
- gtk_tree_path_free( path );
-}
-
-static void
-delete_row( BaseWindow *window )
-{
- NAObjectProfile *edited;
- GtkTreeView *listview;
- GtkTreeSelection *selection;
- GtkTreeModel *model;
- GList *rows;
- GtkTreeIter iter;
- GtkTreePath *path;
- gboolean toggle_state;
- gchar *scheme;
-
- listview = GTK_TREE_VIEW( g_object_get_data( G_OBJECT( window ), PROVIDERS_LIST_TREEVIEW ));
- selection = gtk_tree_view_get_selection( listview );
- model = gtk_tree_view_get_model( listview );
-
- rows = gtk_tree_selection_get_selected_rows( selection, &model );
-
- if( g_list_length( rows ) == 1 ){
- path = ( GtkTreePath * ) rows->data;
- gtk_tree_model_get_iter( model, &iter, path );
- gtk_tree_model_get( model, &iter,
- PROVIDERS_CHECKBOX_COLUMN, &toggle_state,
- PROVIDERS_KEYWORD_COLUMN, &scheme, -1 );
- gtk_list_store_remove( GTK_LIST_STORE( model ), &iter );
-
- if( toggle_state ){
- if( g_object_class_find_property( G_OBJECT_GET_CLASS( window ), TAB_UPDATABLE_PROP_EDITED_PROFILE )){
- g_object_get(
- G_OBJECT( window ),
- TAB_UPDATABLE_PROP_EDITED_PROFILE, &edited,
- NULL );
- if( edited ){
- na_object_profile_set_scheme( edited, scheme, FALSE );
- g_signal_emit_by_name( G_OBJECT( window ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
- }
- }
- }
-
- g_free( scheme );
-
- if( gtk_tree_model_get_iter( model, &iter, path ) ||
- gtk_tree_path_prev( path )){
-
- gtk_tree_view_set_cursor( listview, path, NULL, FALSE );
- }
- }
-
- g_list_foreach( rows, ( GFunc ) gtk_tree_path_free, NULL );
- g_list_free( rows );
}
static GtkButton *
-get_add_button( BaseWindow *window )
+get_up_button( BaseWindow *window )
{
GtkButton *button;
- button = GTK_BUTTON( base_window_get_widget( window, "AddSchemeButton" ));
+ button = GTK_BUTTON( base_window_get_widget( window, "ProviderButtonUp" ));
return( button );
}
static GtkButton *
-get_remove_button( BaseWindow *window )
+get_down_button( BaseWindow *window )
{
GtkButton *button;
- button = GTK_BUTTON( base_window_get_widget( window, "RemoveSchemeButton" ));
+ button = GTK_BUTTON( base_window_get_widget( window, "ProviderButtonDown" ));
return( button );
}
#if 0
/*
- * get_subdirs:
- * @gconf: a #GConfClient instance.
- * @path: a full path to be readen.
- *
- * Loads the subdirs of the given path.
- *
- * Returns: a GSList of full path subdirectories.
- *
- * The returned list should be free_subdirs() by the
- * caller.
- */
-static GSList *
-get_gconf_subdirs( GConfClient *gconf, const gchar *path )
-{
- static const gchar *thisfn = "get_subdirs";
- GError *error = NULL;
- GSList *list_subdirs;
-
- list_subdirs = gconf_client_all_dirs( gconf, path, &error );
-
- if( error ){
- g_warning( "%s: path=%s, error=%s", thisfn, path, error->message );
- g_error_free( error );
- return(( GSList * ) NULL );
- }
-
- return( list_subdirs );
-}
-
-/*
* free_subdirs:
* @subdirs: a list of subdirs as returned by get_subdirs().
*
diff --git a/nautilus-actions/plugin/nautilus-actions.c b/nautilus-actions/plugin/nautilus-actions.c
index 1305552..8c2e860 100644
--- a/nautilus-actions/plugin/nautilus-actions.c
+++ b/nautilus-actions/plugin/nautilus-actions.c
@@ -217,10 +217,13 @@ instance_init( GTypeInstance *instance, gpointer klass )
/* initialize NAPivot and load actions through NAIIOProvider interface
* forwarding notification messages from NAPivot to NautilusActions
*/
- self->private->pivot = na_pivot_new();
+ self->private->pivot = na_pivot_new(
+ !PIVOT_LOAD_DISABLED & !PIVOT_LOAD_INVALID,
+ PIVOT_IO_PROVIDER_AVAILABLE | PIVOT_IO_PROVIDER_READABLE_AT_STARTUP );
+
na_pivot_register_consumer( self->private->pivot, NA_IPIVOT_CONSUMER( self ));
na_pivot_set_automatic_reload( self->private->pivot, TRUE );
- na_pivot_set_loadable_population( self->private->pivot, !PIVOT_LOAD_DISABLED & !PIVOT_LOAD_INVALID );
+
na_pivot_load_items( self->private->pivot );
}
diff --git a/nautilus-actions/plugin/nautilus-module.c b/nautilus-actions/plugin/nautilus-module.c
index 54f2384..d9a3a46 100644
--- a/nautilus-actions/plugin/nautilus-module.c
+++ b/nautilus-actions/plugin/nautilus-module.c
@@ -61,7 +61,7 @@ nautilus_module_initialize( GTypeModule *module )
{
static const gchar *thisfn = "nautilus_module_initialize";
- syslog( LOG_USER | LOG_INFO, "%s Menu Extender %s initializing...", PACKAGE_NAME, PACKAGE_VERSION );
+ syslog( LOG_USER | LOG_INFO, "[N-A] %s Menu Extender %s initializing...", PACKAGE_NAME, PACKAGE_VERSION );
set_log_handler();
diff --git a/nautilus-actions/runtime/na-gconf-utils.c b/nautilus-actions/runtime/na-gconf-utils.c
index 5e3ae4a..cd2b17e 100644
--- a/nautilus-actions/runtime/na-gconf-utils.c
+++ b/nautilus-actions/runtime/na-gconf-utils.c
@@ -229,6 +229,45 @@ na_gconf_utils_get_string_list_from_entries( GSList *entries, const gchar *entry
}
/**
+ * na_gconf_utils_get_subdirs:
+ * @gconf: a #GConfClient instance.
+ * @path: a full path to be readen.
+ *
+ * Returns: a list of full path subdirectories.
+ *
+ * The returned list should be na_gconf_utils_free_subdirs() by the caller.
+ */
+GSList *
+na_gconf_utils_get_subdirs( GConfClient *gconf, const gchar *path )
+{
+ static const gchar *thisfn = "na_gconf_utils_get_subdirs";
+ GError *error = NULL;
+ GSList *list_subdirs;
+
+ list_subdirs = gconf_client_all_dirs( gconf, path, &error );
+
+ if( error ){
+ g_warning( "%s: path=%s, error=%s", thisfn, path, error->message );
+ g_error_free( error );
+ return(( GSList * ) NULL );
+ }
+
+ return( list_subdirs );
+}
+
+/**
+ * na_gconf_utils_free_subdirs:
+ * @subdirs: the subdirectory list as returned from #na_gconf_utils_get_subdirs().
+ *
+ * Release the list.
+ */
+void
+na_gconf_utils_free_subdirs( GSList *subdirs )
+{
+ na_utils_free_string_list( subdirs );
+}
+
+/**
* na_gconf_utils_path_to_key:
* @path: the full path of a key.
*
diff --git a/nautilus-actions/runtime/na-gconf-utils.h b/nautilus-actions/runtime/na-gconf-utils.h
index 7af5536..9f2877f 100644
--- a/nautilus-actions/runtime/na-gconf-utils.h
+++ b/nautilus-actions/runtime/na-gconf-utils.h
@@ -46,6 +46,9 @@ gboolean na_gconf_utils_get_bool_from_entries( GSList *entries, const gchar *ent
gboolean na_gconf_utils_get_string_from_entries( GSList *entries, const gchar *entry, gchar **value );
gboolean na_gconf_utils_get_string_list_from_entries( GSList *entries, const gchar *entry, GSList **value );
+GSList *na_gconf_utils_get_subdirs( GConfClient *gconf, const gchar *path );
+void na_gconf_utils_free_subdirs( GSList *subdirs );
+
gchar *na_gconf_utils_path_to_key( const gchar *path );
gboolean na_gconf_utils_read_bool( GConfClient *gconf, const gchar *path, gboolean use_schema, gboolean default_value );
diff --git a/nautilus-actions/runtime/na-io-provider.c b/nautilus-actions/runtime/na-io-provider.c
index c702e96..10c1b31 100644
--- a/nautilus-actions/runtime/na-io-provider.c
+++ b/nautilus-actions/runtime/na-io-provider.c
@@ -42,205 +42,484 @@
#include "na-iprefs.h"
#include "na-utils.h"
-static GList *get_merged_items_list( const NAPivot *pivot, GList *providers, GSList **messages );
-static GList *build_hierarchy( GList **tree, GSList *level_zero, gboolean list_if_empty );
-static gint search_item( const NAObject *obj, const gchar *uuid );
-static GList *sort_tree( const NAPivot *pivot, GList *tree, GCompareFunc fn );
-static GList *filter_unwanted_items( const NAPivot *pivot, GList *merged );
-static GList *filter_unwanted_items_rec( GList *merged, gboolean load_disabled, gboolean load_invalid );
+/* private class data
+ */
+struct NAIOProviderClassPrivate {
+ void *empty; /* so that gcc -pedantic is happy */
+};
-static guint try_write_item( const NAIIOProvider *instance, NAObjectItem *item, GSList **messages );
+/* private instance data
+ */
+struct NAIOProviderPrivate {
+ gboolean dispose_has_run;
+ gchar *id;
+ gchar *name;
+ gboolean read_at_startup;
+ gboolean writable;
+ NAIIOProvider *provider;
+ gulong item_changed_handler;
+};
-/**
- * na_io_provider_register_callbacks:
- * @pivot: the current #NAPivot instance.
- *
- * Registers an handler for the item-changed signal for each loaded
- * NAIIOProvider plugin.
+/* NAIOProvider properties
*/
-void
-na_io_provider_register_callbacks( const NAPivot *pivot )
+enum {
+ IO_PROVIDER_PROP_PROVIDER_ID = 1,
+};
+
+#define IO_PROVIDER_PROP_PROVIDER "na-io-provider-prop-provider"
+
+#define IO_PROVIDER_KEY_ROOT "io-providers"
+#define IO_PROVIDER_KEY_READABLE "read-at-startup"
+#define IO_PROVIDER_KEY_WRITABLE "writable"
+
+static GObjectClass *st_parent_class = NULL;
+static GList *st_io_providers = NULL;
+
+static GType register_type( void );
+static void class_init( NAIOProviderClass *klass );
+static void instance_init( GTypeInstance *instance, gpointer klass );
+static void instance_constructed( GObject *object );
+static void instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec );
+static void instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec );
+static void instance_dispose( GObject *object );
+static void instance_finalize( GObject *object );
+
+static void setup_io_providers( const NAPivot *pivot );
+static GList *setup_io_providers_from_prefs( const NAPivot *pivot, GList *runtime_providers );
+static GList *filter_available_io_providers( const NAPivot *pivot, GList *runtime_providers, NAPivotIOProviderSet set );
+static GList *remove_from_list( GList *runtime_providers, GList *to_remove );
+static GList *update_io_providers_from_prefs( const NAPivot *pivot, GList *runtime_providers );
+static NAIOProvider *find_io_provider( GList *providers, const gchar *id );
+
+static GList *get_merged_items_list( const NAPivot *pivot, GList *providers, GSList **messages );
+static GList *build_hierarchy( GList **tree, GSList *level_zero, gboolean list_if_empty );
+static gint search_item( const NAObject *obj, const gchar *uuid );
+static GList *sort_tree( const NAPivot *pivot, GList *tree, GCompareFunc fn );
+static GList *filter_unwanted_items( const NAPivot *pivot, GList *merged );
+static GList *filter_unwanted_items_rec( GList *merged, gboolean load_disabled, gboolean load_invalid );
+
+static guint try_write_item( const NAIIOProvider *instance, NAObjectItem *item, GSList **messages );
+
+GType
+na_io_provider_get_type( void )
{
- GList *providers, *ip;
+ static GType object_type = 0;
- providers = na_pivot_get_providers( pivot, NA_IIO_PROVIDER_TYPE );
-
- for( ip = providers ; ip ; ip = ip->next ){
- g_signal_connect(
- ( gpointer ) ip->data,
- NA_PIVOT_SIGNAL_ACTION_CHANGED,
- ( GCallback ) na_pivot_item_changed_handler,
- ( gpointer ) pivot );
+ if( !object_type ){
+ object_type = register_type();
}
- na_pivot_free_providers( providers );
+ return( object_type );
}
-/**
- * na_io_provider_get_provider:
- * @pivot: the #NAPivot object.
- * @id: the id of the searched I/O provider.
- *
- * Returns: the found I/O provider, or NULL.
- *
- * The returned provider should be g_object_unref() by the caller.
- */
-NAIIOProvider *
-na_io_provider_get_provider( const NAPivot *pivot, const gchar *id )
+static GType
+register_type( void )
{
- NAIIOProvider *provider;
- GList *providers, *ip;
- gchar *ip_id;
+ static const gchar *thisfn = "na_io_provider_register_type";
+ GType type;
+
+ static GTypeInfo info = {
+ sizeof( NAIOProviderClass ),
+ ( GBaseInitFunc ) NULL,
+ ( GBaseFinalizeFunc ) NULL,
+ ( GClassInitFunc ) class_init,
+ NULL,
+ NULL,
+ sizeof( NAIOProvider ),
+ 0,
+ ( GInstanceInitFunc ) instance_init
+ };
+
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( G_TYPE_OBJECT, "NAIOProvider", &info, 0 );
+
+ return( type );
+}
- provider = NULL;
- providers = na_pivot_get_providers( pivot, NA_IIO_PROVIDER_TYPE );
+static void
+class_init( NAIOProviderClass *klass )
+{
+ static const gchar *thisfn = "na_io_provider_class_init";
+ GObjectClass *object_class;
+ GParamSpec *spec;
- for( ip = providers ; ip && !provider ; ip = ip->next ){
- ip_id = na_io_provider_get_id( pivot, NA_IIO_PROVIDER( ip->data ));
- if( ip_id ){
- if( !strcmp( ip_id, id )){
- provider = NA_IIO_PROVIDER( ip->data );
- g_object_ref( provider );
+ 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->constructed = instance_constructed;
+ object_class->set_property = instance_set_property;
+ object_class->get_property = instance_get_property;
+ object_class->dispose = instance_dispose;
+ object_class->finalize = instance_finalize;
+
+ spec = g_param_spec_pointer(
+ IO_PROVIDER_PROP_PROVIDER,
+ "NAIIOProvider",
+ "A reference on the NAIIOProvider plugin module",
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
+ g_object_class_install_property( object_class, IO_PROVIDER_PROP_PROVIDER_ID, spec );
+
+ klass->private = g_new0( NAIOProviderClassPrivate, 1 );
+}
+
+static void
+instance_init( GTypeInstance *instance, gpointer klass )
+{
+ static const gchar *thisfn = "na_io_provider_instance_init";
+ NAIOProvider *self;
+
+ g_debug( "%s: instance=%p, klass=%p", thisfn, ( void * ) instance, ( void * ) klass );
+ g_return_if_fail( NA_IS_IO_PROVIDER( instance ));
+ self = NA_IO_PROVIDER( instance );
+
+ self->private = g_new0( NAIOProviderPrivate, 1 );
+
+ self->private->dispose_has_run = FALSE;
+ self->private->id = NULL;
+ self->private->name = NULL;
+ self->private->read_at_startup = TRUE;
+ self->private->writable = TRUE;
+ self->private->provider = NULL;
+ self->private->item_changed_handler = 0;
+}
+
+static void
+instance_constructed( GObject *object )
+{
+ static const gchar *thisfn = "na_io_provider_instance_constructed";
+ NAIOProvider *self;
+
+ g_debug( "%s: object=%p", thisfn, ( void * ) object );
+ g_return_if_fail( NA_IS_IO_PROVIDER( object ));
+ self = NA_IO_PROVIDER( object );
+
+ if( !self->private->dispose_has_run ){
+
+ if( self->private->provider ){
+
+ g_object_ref( self->private->provider );
+
+ if( NA_IIO_PROVIDER_GET_INTERFACE( self->private->provider )->get_id ){
+ self->private->id = NA_IIO_PROVIDER_GET_INTERFACE( self->private->provider )->get_id( self->private->provider );
+ }
+
+ if( NA_IIO_PROVIDER_GET_INTERFACE( self->private->provider )->get_name ){
+ self->private->name = NA_IIO_PROVIDER_GET_INTERFACE( self->private->provider )->get_name( self->private->provider );
}
- g_free( ip_id );
+ }
+
+ /* chain up to the parent class */
+ if( G_OBJECT_CLASS( st_parent_class )->constructed ){
+ G_OBJECT_CLASS( st_parent_class )->constructed( object );
}
}
+}
- na_pivot_free_providers( providers );
+static void
+instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec )
+{
+ NAIOProvider *self;
- return( provider );
+ g_return_if_fail( NA_IS_IO_PROVIDER( object ));
+ self = NA_IO_PROVIDER( object );
+
+ if( !self->private->dispose_has_run ){
+
+ switch( property_id ){
+ case IO_PROVIDER_PROP_PROVIDER_ID:
+ g_value_set_pointer( value, self->private->provider );
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, spec );
+ break;
+ }
+ }
}
-/**
- * na_io_provider_get_writable_provider:
- * @pivot: the #NAPivot object.
- *
- * Returns: the first willing to write I/O provider, or NULL.
- *
- * The returned provider should be g_object_unref() by the caller.
- */
-NAIIOProvider *
-na_io_provider_get_writable_provider( const NAPivot *pivot )
+static void
+instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec )
{
- NAIIOProvider *provider;
- GList *providers, *ip;
+ NAIOProvider *self;
- provider = NULL;
- providers = na_pivot_get_providers( pivot, NA_IIO_PROVIDER_TYPE );
+ g_return_if_fail( NA_IS_IO_PROVIDER( object ));
+ self = NA_IO_PROVIDER( object );
- for( ip = providers ; ip && !provider ; ip = ip->next ){
- if( na_io_provider_is_willing_to_write( pivot, NA_IIO_PROVIDER( ip->data ))){
- provider = NA_IIO_PROVIDER( ip->data );
- g_object_ref( provider );
+ if( !self->private->dispose_has_run ){
+
+ switch( property_id ){
+ case IO_PROVIDER_PROP_PROVIDER_ID:
+ self->private->provider = g_value_get_pointer( value );
+ break;
}
}
+}
- na_pivot_free_providers( providers );
+static void
+instance_dispose( GObject *object )
+{
+ static const gchar *thisfn = "na_io_provider_instance_dispose";
+ NAIOProvider *self;
- return( provider );
+ g_debug( "%s: object=%p", thisfn, ( void * ) object );
+ g_return_if_fail( NA_IS_IO_PROVIDER( object ));
+ self = NA_IO_PROVIDER( object );
+
+ if( !self->private->dispose_has_run ){
+
+ self->private->dispose_has_run = TRUE;
+
+ if( self->private->provider ){
+
+ if( g_signal_handler_is_connected( self->private->provider, self->private->item_changed_handler )){
+ g_signal_handler_disconnect( self->private->provider, self->private->item_changed_handler );
+ }
+
+ g_object_unref( self->private->provider );
+ }
+
+ /* chain up to the parent class */
+ if( G_OBJECT_CLASS( st_parent_class )->dispose ){
+ G_OBJECT_CLASS( st_parent_class )->dispose( object );
+ }
+ }
}
-/**
- * na_io_provider_get_id:
- * @pivot: the current #NAPivot instance.
- * @provider: the #NAIIOProvider whose id is to be returned.
- *
- * Returns: the provider's id as a newly allocated string which should
- * be g_free() by the caller, or NULL.
- */
-gchar *
-na_io_provider_get_id( const NAPivot *pivot, const NAIIOProvider *provider )
+static void
+instance_finalize( GObject *object )
{
- gchar *id;
+ static const gchar *thisfn = "na_io_provider_instance_finalize";
+ NAIOProvider *self;
- id = NULL;
- if( NA_IIO_PROVIDER_GET_INTERFACE( provider )->get_id ){
- id = NA_IIO_PROVIDER_GET_INTERFACE( provider )->get_id( provider );
+ g_debug( "%s: object=%p", thisfn, ( void * ) object );
+ g_return_if_fail( NA_IS_IO_PROVIDER( object ));
+ self = NA_IO_PROVIDER( object );
+
+ g_free( self->private->id );
+ g_free( self->private->name );
+
+ 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 );
}
+}
- return( id );
+/**
+ * na_io_provider_terminate:
+ *
+ * Called by on #NAPivot dispose(), free here resources allocated to
+ * the I/O providers.
+ */
+void
+na_io_provider_terminate( void )
+{
+ g_list_foreach( st_io_providers, ( GFunc ) g_object_unref, NULL );
+ g_list_free( st_io_providers );
+ st_io_providers = NULL;
}
/**
- * na_io_provider_get_name:
+ * na_io_provider_get_providers_list:
* @pivot: the current #NAPivot instance.
- * @provider: the #NAIIOProvider whose name is to be returned.
*
- * Returns: a displayble name for the provider, as a newly allocated
- * string which should be g_free() by the caller.
+ * Returns: the list of I/O providers for @pivot.
+ *
+ * The returned list is owned by #NAIOProvider class, and should not be
+ * released by the caller.
*/
-gchar *
-na_io_provider_get_name( const NAPivot *pivot, const NAIIOProvider *provider )
+GList *
+na_io_provider_get_providers_list( const NAPivot *pivot )
{
- gchar *name;
+ g_return_val_if_fail( NA_IS_PIVOT( pivot ), NULL );
- name = NULL;
- if( NA_IIO_PROVIDER_GET_INTERFACE( provider )->get_name ){
- name = NA_IIO_PROVIDER_GET_INTERFACE( provider )->get_name( provider );
+ setup_io_providers( pivot );
+
+ return( st_io_providers );
+}
+
+/*
+ * build the static list of I/O providers, depending of setup of NAPivot
+ * doing required initializations
+ */
+static void
+setup_io_providers( const NAPivot *pivot )
+{
+ GList *module_objects, *im;
+ NAIOProvider *provider;
+ GList *providers;
+
+ if( !st_io_providers ){
+
+ providers = NULL;
+ module_objects = na_pivot_get_providers( pivot, NA_IIO_PROVIDER_TYPE );
+
+ for( im = module_objects ; im ; im = im->next ){
+
+ provider = g_object_new( NA_IO_PROVIDER_TYPE, IO_PROVIDER_PROP_PROVIDER, im->data, NULL );
+
+ provider->private->item_changed_handler =
+ g_signal_connect(
+ provider->private->provider,
+ NA_PIVOT_SIGNAL_ACTION_CHANGED,
+ ( GCallback ) na_pivot_item_changed_handler,
+ ( gpointer ) pivot );
+
+ providers = g_list_prepend( providers, provider );
+ }
+
+ na_pivot_free_providers( module_objects );
+
+ st_io_providers = setup_io_providers_from_prefs( pivot, providers );
+ }
+}
+
+/*
+ * I/O providers may be configured as a GConf preference under
+ * nautilus-actions/io-providers/<provider_id> key.
+ * For each provider_id found in the preferences, we setup the I/O provider
+ * if already in the list, or allocate a new one
+ */
+static GList *
+setup_io_providers_from_prefs( const NAPivot *pivot, GList *runtime_providers )
+{
+ NAPivotIOProviderSet set;
+ GList *to_remove;
+ GList *providers;
+
+ set = na_pivot_get_io_provider_set( pivot );
+
+ /* only deals with I/O providers which are actually available at runtime
+ */
+ if( set & PIVOT_IO_PROVIDER_AVAILABLE ){
+ to_remove = filter_available_io_providers( pivot, runtime_providers, set );
+ providers = remove_from_list( runtime_providers, to_remove );
+ g_list_free( to_remove );
+
+ /* wants all I/O providers
+ * possibly adding those found in preferences, but not at runtime
+ */
} else {
- name = g_strdup( "" );
+ providers = update_io_providers_from_prefs( pivot, runtime_providers );
}
- return( name );
+ return( providers );
}
-/**
- * na_io_provider_get_version:
- * @pivot: the current #NAPivot instance.
- * @provider: the #NAIIOProvider whose id is to be returned.
- *
- * Returns: the API's version the provider supports.
- */
-guint
-na_io_provider_get_version( const NAPivot *pivot, const NAIIOProvider *provider )
+static GList *
+filter_available_io_providers( const NAPivot *pivot, GList *runtime_providers, NAPivotIOProviderSet set )
{
- guint version;
+ GConfClient *gconf;
+ GList *to_remove;
+ gchar *path, *key, *entry;
+ gboolean readable, writable;
+ GList *ip;
- version = 1;
- if( NA_IIO_PROVIDER_GET_INTERFACE( provider )->get_version ){
- version = NA_IIO_PROVIDER_GET_INTERFACE( provider )->get_version( provider );
+ to_remove = NULL;
+ path = gconf_concat_dir_and_key( NAUTILUS_ACTIONS_GCONF_BASEDIR, IO_PROVIDER_KEY_ROOT );
+ gconf = na_iprefs_get_gconf_client( NA_IPREFS( pivot ));
+
+ for( ip = runtime_providers ; ip ; ip = ip->next ){
+ key = gconf_concat_dir_and_key( path, NA_IO_PROVIDER( ip->data )->private->id );
+
+ if( set & PIVOT_IO_PROVIDER_READABLE_AT_STARTUP ){
+ entry = gconf_concat_dir_and_key( key, IO_PROVIDER_KEY_READABLE );
+ readable = na_gconf_utils_read_bool( gconf, entry, FALSE, TRUE );
+ if( !readable ){
+ to_remove = g_list_prepend( to_remove, ip->data );
+ }
+ g_free( entry );
+ }
+
+ if( set & PIVOT_IO_PROVIDER_WRITABLE ){
+ entry = gconf_concat_dir_and_key( key, IO_PROVIDER_KEY_WRITABLE );
+ writable = na_gconf_utils_read_bool( gconf, entry, FALSE, TRUE );
+ if( !writable ){
+ to_remove = g_list_prepend( to_remove, ip->data );
+ }
+ g_free( entry );
+ }
+
+ g_free( key );
}
- return( version );
+ g_free( path );
+
+ return( to_remove );
}
-/**
- * na_io_provider_is_willing_to_write:
- * @pivot: the current #NAPivot instance.
- * @provider: the #NAIIOProvider whose name is to be returned.
- *
- * Returns: %TRUE if the I/O provider is willing to write _and_ it didn't
- * has been locked down by a sysadmin.
- */
-gboolean
-na_io_provider_is_willing_to_write( const NAPivot *pivot, const NAIIOProvider *provider )
+static GList *
+remove_from_list( GList *runtime_providers, GList *to_remove )
+{
+ GList *idel;
+
+ for( idel = to_remove ; idel ; idel = idel->next ){
+ runtime_providers = g_list_remove( runtime_providers, idel->data );
+ g_object_unref( idel->data );
+ }
+
+ return( runtime_providers );
+}
+
+static GList *
+update_io_providers_from_prefs( const NAPivot *pivot, GList *runtime_providers )
{
- /*static const gchar *thisfn = "na_io_provider_is_willing_to_write";*/
- gboolean writable;
- gboolean locked;
GConfClient *gconf;
- gchar *id;
- gchar *key;
+ gchar *path, *id, *entry;
+ GSList *ids, *iid;
+ GList *providers;
+ NAIOProvider *provider;
- writable = FALSE;
- locked = FALSE;
+ providers = runtime_providers;
+ path = gconf_concat_dir_and_key( NAUTILUS_ACTIONS_GCONF_BASEDIR, IO_PROVIDER_KEY_ROOT );
+ gconf = na_iprefs_get_gconf_client( NA_IPREFS( pivot ));
- if( NA_IIO_PROVIDER_GET_INTERFACE( provider )->is_willing_to_write ){
+ ids = na_gconf_utils_get_subdirs( gconf, path );
- writable = NA_IIO_PROVIDER_GET_INTERFACE( provider )->is_willing_to_write( provider );
+ for( iid = ids ; iid ; iid = iid->next ){
+ id = na_utils_path_extract_last_dir(( const gchar * ) iid->data );
+ provider = find_io_provider( providers, id );
+ if( !provider ){
+ provider = g_object_new( NA_IO_PROVIDER_TYPE, NULL );
+ providers = g_list_prepend( providers, provider );
+ }
+ g_free( id );
- if( writable ){
- id = na_io_provider_get_id( pivot, provider );
- key = g_strdup_printf( "%s/mandatory/%s/locked", NAUTILUS_ACTIONS_GCONF_BASEDIR, id );
- gconf = na_iprefs_get_gconf_client( NA_IPREFS( pivot ));
- locked = na_gconf_utils_read_bool( gconf, key, TRUE, locked );
- /*g_debug( "%s: id=%s, locked=%s", thisfn, id, locked ? "True":"False" );*/
- g_free( key );
- g_free( id );
+ entry = gconf_concat_dir_and_key( ( const gchar * ) iid->data, IO_PROVIDER_KEY_READABLE );
+ provider->private->read_at_startup = na_gconf_utils_read_bool( gconf, entry, FALSE, TRUE );
+ g_free( entry );
+
+ entry = gconf_concat_dir_and_key( ( const gchar * ) iid->data, IO_PROVIDER_KEY_WRITABLE );
+ provider->private->writable = na_gconf_utils_read_bool( gconf, entry, FALSE, TRUE );
+ g_free( entry );
+ }
+
+ na_gconf_utils_free_subdirs( ids );
+
+ g_free( path );
+
+ return( providers );
+}
+
+static NAIOProvider *
+find_io_provider( GList *providers, const gchar *id )
+{
+ NAIOProvider *provider;
+ GList *ip;
+
+ provider = NULL;
+
+ for( ip = providers ; ip && !provider ; ip = ip->next ){
+ if( !strcmp( NA_IO_PROVIDER( ip->data )->private->id, id )){
+ provider = NA_IO_PROVIDER( ip->data );
}
}
- return( writable && !locked );
+ return( provider );
}
/**
@@ -259,7 +538,6 @@ GList *
na_io_provider_read_items( const NAPivot *pivot, GSList **messages )
{
static const gchar *thisfn = "na_io_provider_read_items";
- GList *providers;
GList *merged, *hierarchy, *filtered;
GSList *level_zero;
gint order_mode;
@@ -271,10 +549,11 @@ na_io_provider_read_items( const NAPivot *pivot, GSList **messages )
hierarchy = NULL;
*messages = NULL;
- providers = na_pivot_get_providers( pivot, NA_IIO_PROVIDER_TYPE );
- merged = get_merged_items_list( pivot, providers, messages );
- na_pivot_free_providers( providers );
+ if( !st_io_providers ){
+ setup_io_providers( pivot );
+ }
+ merged = get_merged_items_list( pivot, st_io_providers, messages );
level_zero = na_iprefs_get_level_zero_items( NA_IPREFS( pivot ));
hierarchy = build_hierarchy( &merged, level_zero, TRUE );
@@ -331,7 +610,7 @@ get_merged_items_list( const NAPivot *pivot, GList *providers, GSList **messages
for( ip = providers ; ip ; ip = ip->next ){
- instance = NA_IIO_PROVIDER( ip->data );
+ instance = NA_IO_PROVIDER( ip->data )->private->provider;
if( NA_IIO_PROVIDER_GET_INTERFACE( instance )->read_items ){
list = NA_IIO_PROVIDER_GET_INTERFACE( instance )->read_items( instance, messages );
@@ -512,6 +791,250 @@ filter_unwanted_items_rec( GList *hierarchy, gboolean load_disabled, gboolean lo
}
/**
+ * na_io_provider_is_to_be_read:
+ * @provider: this #NAIOProvider.
+ *
+ * Returns: %TRUE is this I/O provider should be read at startup, and so
+ * may participate to the global list of menus and actions.
+ *
+ * This is a user preference.
+ * If the preference is not recorded, then it defaults to %TRUE.
+ * This means that the user may adjust its personal configuration to
+ * fully ignore menu/action items from a NAIIOProvider, just by setting
+ * the corresponding flag to %FALSE.
+ */
+gboolean
+na_io_provider_is_to_be_read( const NAIOProvider *provider )
+{
+ gboolean to_be_read;
+
+ to_be_read = FALSE;
+ g_return_val_if_fail( NA_IS_IO_PROVIDER( provider ), to_be_read );
+
+ if( !provider->private->dispose_has_run ){
+
+ to_be_read = provider->private->read_at_startup;
+ }
+
+ return( to_be_read );
+}
+
+/**
+ * na_io_provider_is_writable:
+ * @provider: this #NAIOProvider.
+ *
+ * Returns: %TRUE is this I/O provider is writable.
+ */
+gboolean
+na_io_provider_is_writable( const NAIOProvider *provider )
+{
+ gboolean writable;
+
+ writable = FALSE;
+ g_return_val_if_fail( NA_IS_IO_PROVIDER( provider ), writable );
+
+ if( !provider->private->dispose_has_run ){
+
+ writable = provider->private->writable;
+ }
+
+ return( writable );
+}
+
+/**
+ * na_io_provider_get_name:
+ * @provider: this #NAIOProvider.
+ *
+ * Returns: the displayable name of this #NAIIOProvider, as a newly
+ * allocated string which should be g_free() by the caller.
+ * May return %NULL is the NAIIOProvider is not present at runtime.
+ */
+gchar *
+na_io_provider_get_name( const NAIOProvider *provider )
+{
+ gchar *name;
+
+ name = NULL;
+ g_return_val_if_fail( NA_IS_IO_PROVIDER( provider ), name );
+
+ if( !provider->private->dispose_has_run ){
+
+ if( provider->private->provider ){
+ name = na_io_provider_get_provider_name( provider->private->provider );
+ }
+ }
+
+ return( name );
+}
+
+/**
+ * na_io_provider_get_provider_name:
+ * @provider: the #NAIIOProvider whose name is to be returned.
+ *
+ * Returns: a displayble name for the provider, as a newly allocated
+ * string which should be g_free() by the caller.
+ */
+gchar *
+na_io_provider_get_provider_name( const NAIIOProvider *provider )
+{
+ gchar *name;
+
+ name = NULL;
+
+ if( NA_IIO_PROVIDER_GET_INTERFACE( provider )->get_name ){
+ name = NA_IIO_PROVIDER_GET_INTERFACE( provider )->get_name( provider );
+ } else {
+ name = g_strdup( "" );
+ }
+
+ return( name );
+}
+
+/**
+ * na_io_provider_get_provider:
+ * @pivot: the #NAPivot object.
+ * @id: the id of the searched I/O provider.
+ *
+ * Returns: the found I/O provider, or NULL.
+ *
+ * The returned provider should be g_object_unref() by the caller.
+ */
+NAIIOProvider *
+na_io_provider_get_provider( const NAPivot *pivot, const gchar *id )
+{
+ NAIIOProvider *provider;
+ GList *providers, *ip;
+ gchar *ip_id;
+
+ provider = NULL;
+ providers = na_pivot_get_providers( pivot, NA_IIO_PROVIDER_TYPE );
+
+ for( ip = providers ; ip && !provider ; ip = ip->next ){
+ ip_id = na_io_provider_get_id( pivot, NA_IIO_PROVIDER( ip->data ));
+ if( ip_id ){
+ if( !strcmp( ip_id, id )){
+ provider = NA_IIO_PROVIDER( ip->data );
+ g_object_ref( provider );
+ }
+ g_free( ip_id );
+ }
+ }
+
+ na_pivot_free_providers( providers );
+
+ return( provider );
+}
+
+/**
+ * na_io_provider_get_writable_provider:
+ * @pivot: the #NAPivot object.
+ *
+ * Returns: the first willing to write I/O provider, or NULL.
+ *
+ * The returned provider should be g_object_unref() by the caller.
+ */
+NAIIOProvider *
+na_io_provider_get_writable_provider( const NAPivot *pivot )
+{
+ NAIIOProvider *provider;
+ GList *providers, *ip;
+
+ provider = NULL;
+ providers = na_pivot_get_providers( pivot, NA_IIO_PROVIDER_TYPE );
+
+ for( ip = providers ; ip && !provider ; ip = ip->next ){
+ if( na_io_provider_is_willing_to_write( pivot, NA_IIO_PROVIDER( ip->data ))){
+ provider = NA_IIO_PROVIDER( ip->data );
+ g_object_ref( provider );
+ }
+ }
+
+ na_pivot_free_providers( providers );
+
+ return( provider );
+}
+
+/**
+ * na_io_provider_get_id:
+ * @pivot: the current #NAPivot instance.
+ * @provider: the #NAIIOProvider whose id is to be returned.
+ *
+ * Returns: the provider's id as a newly allocated string which should
+ * be g_free() by the caller, or NULL.
+ */
+gchar *
+na_io_provider_get_id( const NAPivot *pivot, const NAIIOProvider *provider )
+{
+ gchar *id;
+
+ id = NULL;
+ if( NA_IIO_PROVIDER_GET_INTERFACE( provider )->get_id ){
+ id = NA_IIO_PROVIDER_GET_INTERFACE( provider )->get_id( provider );
+ }
+
+ return( id );
+}
+
+/**
+ * na_io_provider_get_version:
+ * @pivot: the current #NAPivot instance.
+ * @provider: the #NAIIOProvider whose id is to be returned.
+ *
+ * Returns: the API's version the provider supports.
+ */
+guint
+na_io_provider_get_version( const NAPivot *pivot, const NAIIOProvider *provider )
+{
+ guint version;
+
+ version = 1;
+ if( NA_IIO_PROVIDER_GET_INTERFACE( provider )->get_version ){
+ version = NA_IIO_PROVIDER_GET_INTERFACE( provider )->get_version( provider );
+ }
+
+ return( version );
+}
+
+/**
+ * na_io_provider_is_willing_to_write:
+ * @pivot: the current #NAPivot instance.
+ * @provider: the #NAIIOProvider whose name is to be returned.
+ *
+ * Returns: %TRUE if the I/O provider is willing to write _and_ it didn't
+ * has been locked down by a sysadmin.
+ */
+gboolean
+na_io_provider_is_willing_to_write( const NAPivot *pivot, const NAIIOProvider *provider )
+{
+ /*static const gchar *thisfn = "na_io_provider_is_willing_to_write";*/
+ gboolean writable;
+ gboolean locked;
+ GConfClient *gconf;
+ gchar *id;
+ gchar *key;
+
+ writable = FALSE;
+ locked = FALSE;
+
+ if( NA_IIO_PROVIDER_GET_INTERFACE( provider )->is_willing_to_write ){
+
+ writable = NA_IIO_PROVIDER_GET_INTERFACE( provider )->is_willing_to_write( provider );
+
+ if( writable ){
+ id = na_io_provider_get_id( pivot, provider );
+ key = g_strdup_printf( "%s/mandatory/%s/locked", NAUTILUS_ACTIONS_GCONF_BASEDIR, id );
+ gconf = na_iprefs_get_gconf_client( NA_IPREFS( pivot ));
+ locked = na_gconf_utils_read_bool( gconf, key, TRUE, locked );
+ /*g_debug( "%s: id=%s, locked=%s", thisfn, id, locked ? "True":"False" );*/
+ g_free( key );
+ g_free( id );
+ }
+ }
+
+ return( writable && !locked );
+}
+
+/**
* na_io_provider_write_item:
* @pivot: the #NAPivot object which owns the list of registered I/O
* storage providers. if NULL, @action must already have registered
@@ -618,7 +1141,7 @@ try_write_item( const NAIIOProvider *provider, NAObjectItem *item, GSList **mess
* Returns: the NAIIOProvider return code.
*
* Note that a new item, not already written to an I/O subsystem,
- * doesn't have any attached provider. We so do nothing...
+ * doesn't have any attached provider. We so do nothing and return OK...
*/
guint
na_io_provider_delete_item( const NAPivot *pivot, const NAObjectItem *item, GSList **messages )
@@ -645,6 +1168,9 @@ na_io_provider_delete_item( const NAPivot *pivot, const NAObjectItem *item, GSLi
if( NA_IIO_PROVIDER_GET_INTERFACE( instance )->delete_item ){
ret = NA_IIO_PROVIDER_GET_INTERFACE( instance )->delete_item( instance, item, messages );
}
+
+ } else {
+ ret = NA_IIO_PROVIDER_WRITE_OK;
}
return( ret );
diff --git a/nautilus-actions/runtime/na-io-provider.h b/nautilus-actions/runtime/na-io-provider.h
index 8cb00c4..8f0d918 100644
--- a/nautilus-actions/runtime/na-io-provider.h
+++ b/nautilus-actions/runtime/na-io-provider.h
@@ -32,29 +32,63 @@
#define __NA_RUNTIME_IO_PROVIDER_H__
/**
- * SECTION: na_iio_provider
- * @short_description: #NAIIOProvider internal API.
+ * SECTION: na_io_provider
+ * @short_description: #NAIOProvider class definition.
* @include: runtime/na-io-provider.h
*
- * This is the API which is used by Nautilus-Actions to manage the actual
- * NAIIOProvider interface.
+ * NAIOProvider is the Nautilus-Actions class which is used to manage
+ * external I/O Providers which implement NAIIOProvider interface.
*/
#include "na-pivot.h"
G_BEGIN_DECLS
-void na_io_provider_register_callbacks( const NAPivot *pivot );
+#define NA_IO_PROVIDER_TYPE ( na_io_provider_get_type())
+#define NA_IO_PROVIDER( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NA_IO_PROVIDER_TYPE, NAIOProvider ))
+#define NA_IO_PROVIDER_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( klass, NA_IO_PROVIDER_TYPE, NAIOProviderClass ))
+#define NA_IS_IO_PROVIDER( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NA_IO_PROVIDER_TYPE ))
+#define NA_IS_IO_PROVIDER_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NA_IO_PROVIDER_TYPE ))
+#define NA_IO_PROVIDER_GET_CLASS( object ) ( G_TYPE_INSTANCE_GET_CLASS(( object ), NA_IO_PROVIDER_TYPE, NAIOProviderClass ))
+
+typedef struct NAIOProviderPrivate NAIOProviderPrivate;
+
+typedef struct {
+ GObject parent;
+ NAIOProviderPrivate *private;
+}
+ NAIOProvider;
+
+typedef struct NAIOProviderClassPrivate NAIOProviderClassPrivate;
+
+typedef struct {
+ GObjectClass parent;
+ NAIOProviderClassPrivate *private;
+}
+ NAIOProviderClass;
+
+GType na_io_provider_get_type( void );
+void na_io_provider_terminate( void );
+
+GList *na_io_provider_get_providers_list( const NAPivot *pivot );
+
+GList *na_io_provider_read_items( const NAPivot *pivot, GSList **messages );
+
+gboolean na_io_provider_is_to_be_read( const NAIOProvider *provider );
+gboolean na_io_provider_is_writable ( const NAIOProvider *provider );
+gchar *na_io_provider_get_name ( const NAIOProvider *provider );
+
+gchar *na_io_provider_get_provider_name( const NAIIOProvider *provider );
+
+/* ... */
NAIIOProvider *na_io_provider_get_provider( const NAPivot *pivot, const gchar *id );
NAIIOProvider *na_io_provider_get_writable_provider( const NAPivot *pivot );
gchar *na_io_provider_get_id( const NAPivot *pivot, const NAIIOProvider *provider );
-gchar *na_io_provider_get_name( const NAPivot *pivot, const NAIIOProvider *provider );
guint na_io_provider_get_version( const NAPivot *pivot, const NAIIOProvider *provider );
gboolean na_io_provider_is_willing_to_write( const NAPivot *pivot, const NAIIOProvider *provider );
-GList *na_io_provider_read_items( const NAPivot *pivot, GSList **messages );
guint na_io_provider_write_item( const NAPivot *pivot, NAObjectItem *item, GSList **messages );
guint na_io_provider_delete_item( const NAPivot *pivot, const NAObjectItem *item, GSList **messages );
diff --git a/nautilus-actions/runtime/na-module.c b/nautilus-actions/runtime/na-module.c
index e8488e8..44411bf 100644
--- a/nautilus-actions/runtime/na-module.c
+++ b/nautilus-actions/runtime/na-module.c
@@ -257,7 +257,7 @@ na_module_load_modules( void )
if( module ){
module->private->name = na_utils_remove_suffix( entry, suffix );
modules = g_list_prepend( modules, module );
- g_debug( "%s: module %s successfully loaded", thisfn, fname );
+ g_debug( "%s: module %s successfully loaded", thisfn, entry );
}
g_free( fname );
}
@@ -329,6 +329,7 @@ module_load( GTypeModule *gmodule )
static gboolean
is_a_na_plugin( NAModule *module )
{
+ static const gchar *thisfn = "na_module_is_a_na_plugin";
gboolean ok;
ok =
@@ -338,6 +339,10 @@ is_a_na_plugin( NAModule *module )
plugin_check( module, "na_api_module_shutdown" , ( gpointer * ) &module->private->shutdown ) &&
module->private->initialize( G_TYPE_MODULE( module ));
+ if( ok ){
+ g_debug( "%s: %s: ok", thisfn, module->private->path );
+ }
+
return( ok );
}
diff --git a/nautilus-actions/runtime/na-pivot.c b/nautilus-actions/runtime/na-pivot.c
index a265482..ec95905 100644
--- a/nautilus-actions/runtime/na-pivot.c
+++ b/nautilus-actions/runtime/na-pivot.c
@@ -52,53 +52,52 @@ struct NAPivotClassPrivate {
/* private instance data
*/
struct NAPivotPrivate {
- gboolean dispose_has_run;
+ gboolean dispose_has_run;
+
+ NAPivotLoadableSet loadable_set;
+ NAPivotIOProviderSet io_provider_set;
/* dynamically loaded modules (extension plugins)
*/
- GList *modules;
+ GList *modules;
/* list of instances to be notified of repository updates
* these are called 'consumers' of NAPivot
*/
- GList *consumers;
+ GList *consumers;
/* configuration tree
*/
- GList *tree;
+ GList *tree;
/* whether to automatically reload the whole configuration tree
* when a modification is detected in one of the underlying I/O
* storage subsystems
* defaults to FALSE
*/
- gboolean automatic_reload;
- GTimeVal last_event;
- guint event_source_id;
- gulong action_changed_handler;
-
- /* whether to load all items, or only a part
- */
- NAPivotLoadable loadable_population;
+ gboolean automatic_reload;
+ GTimeVal last_event;
+ guint event_source_id;
/* list of monitoring objects on runtime preferences
*/
- GList *monitors;
-
- /* list of I/O providers
- * note that the N-A plugin is only interested about providers which are
- * present at runtime and should be read at startup, while the NACT user
- * interface wants all i/o providers, those available at runtime as well
- * as those described in preferences
- */
- GList *io_providers;
+ GList *monitors;
};
+/* signals
+ */
enum {
ACTION_CHANGED,
LAST_SIGNAL
};
+/* NAPivot properties
+ */
+enum {
+ NAPIVOT_PROP_LOADABLE_SET_ID = 1,
+ NAPIVOT_PROP_IO_PROVIDER_SET_ID
+};
+
static GObjectClass *st_parent_class = NULL;
static gint st_signals[ LAST_SIGNAL ] = { 0 };
static gint st_timeout_msec = 100;
@@ -108,21 +107,22 @@ static GType register_type( void );
static void class_init( NAPivotClass *klass );
static void iprefs_iface_init( NAIPrefsInterface *iface );
static void instance_init( GTypeInstance *instance, gpointer klass );
+static void instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec );
+static void instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec );
static void instance_dispose( GObject *object );
static void instance_finalize( GObject *object );
-static NAObjectItem *get_item_from_tree( const NAPivot *pivot, GList *tree, const gchar *id );
-
/* NAIIOProvider management */
static gboolean on_item_changed_timeout( NAPivot *pivot );
static gulong time_val_diff( const GTimeVal *recent, const GTimeVal *old );
+static NAObjectItem *get_item_from_tree( const NAPivot *pivot, GList *tree, const gchar *id );
+
/* NAIPivotConsumer management */
static void free_consumers( GList *list );
/* NAGConf runtime preferences management */
static void monitor_runtime_preferences( NAPivot *pivot );
-
static void on_preferences_change( GConfClient *client, guint cnxn_id, GConfEntry *entry, NAPivot *pivot );
static void display_order_changed( NAPivot *pivot );
static void create_root_menu_changed( NAPivot *pivot );
@@ -178,15 +178,32 @@ class_init( NAPivotClass *klass )
{
static const gchar *thisfn = "na_pivot_class_init";
GObjectClass *object_class;
+ GParamSpec *spec;
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->set_property = instance_set_property;
+ object_class->get_property = instance_get_property;
object_class->dispose = instance_dispose;
object_class->finalize = instance_finalize;
+ spec = g_param_spec_int(
+ NAPIVOT_PROP_LOADABLE_SET,
+ "Loadable population set",
+ "Nature of population to be loaded", 0, INT_MAX, 0,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
+ g_object_class_install_property( object_class, NAPIVOT_PROP_LOADABLE_SET_ID, spec );
+
+ spec = g_param_spec_int(
+ NAPIVOT_PROP_IO_PROVIDER_SET,
+ "I/O providers set",
+ "The nature of the I/O providers we are concerned about", 0, INT_MAX, 0,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
+ g_object_class_install_property( object_class, NAPIVOT_PROP_IO_PROVIDER_SET_ID, spec );
+
klass->private = g_new0( NAPivotClassPrivate, 1 );
/* register the signal and its default handler
@@ -226,15 +243,67 @@ instance_init( GTypeInstance *instance, gpointer klass )
self->private = g_new0( NAPivotPrivate, 1 );
- /* these defaults are suitable for the NACT management user interface
- */
self->private->dispose_has_run = FALSE;
+ self->private->loadable_set = 0;
+ self->private->io_provider_set = 0;
self->private->modules = NULL;
self->private->consumers = NULL;
self->private->tree = NULL;
self->private->automatic_reload = FALSE;
self->private->event_source_id = 0;
- self->private->loadable_population = PIVOT_LOAD_ALL;
+ self->private->monitors = NULL;
+}
+
+static void
+instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec )
+{
+ NAPivot *self;
+
+ g_return_if_fail( NA_IS_PIVOT( object ));
+ self = NA_PIVOT( object );
+
+ if( !self->private->dispose_has_run ){
+
+ switch( property_id ){
+ case NAPIVOT_PROP_LOADABLE_SET_ID:
+ g_value_set_int( value, self->private->loadable_set );
+ break;
+
+ case NAPIVOT_PROP_IO_PROVIDER_SET_ID:
+ g_value_set_int( value, self->private->io_provider_set );
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, spec );
+ break;
+ }
+ }
+}
+
+static void
+instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec )
+{
+ NAPivot *self;
+
+ g_return_if_fail( NA_IS_PIVOT( object ));
+ self = NA_PIVOT( object );
+
+ if( !self->private->dispose_has_run ){
+
+ switch( property_id ){
+ case NAPIVOT_PROP_LOADABLE_SET_ID:
+ self->private->loadable_set = g_value_get_int( value );
+ break;
+
+ case NAPIVOT_PROP_IO_PROVIDER_SET_ID:
+ self->private->io_provider_set = g_value_get_int( value );
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, spec );
+ break;
+ }
+ }
}
static void
@@ -266,9 +335,8 @@ instance_dispose( GObject *object )
/* release the GConf monitoring */
na_gconf_monitor_release_monitors( self->private->monitors );
- if( g_signal_handler_is_connected( self, self->private->action_changed_handler )){
- g_signal_handler_disconnect( self, self->private->action_changed_handler );
- }
+ /* release the I/O Provider objects */
+ na_io_provider_terminate();
/* chain up to the parent class */
if( G_OBJECT_CLASS( st_parent_class )->dispose ){
@@ -304,21 +372,21 @@ instance_finalize( GObject *object )
* #NAObjectItem-derived object.
*/
NAPivot *
-na_pivot_new( void )
+na_pivot_new( NAPivotLoadableSet loadable, NAPivotIOProviderSet provider )
{
static const gchar *thisfn = "na_pivot_new";
NAPivot *pivot;
g_debug( "%s", thisfn );
- pivot = g_object_new( NA_PIVOT_TYPE, NULL );
+ pivot = g_object_new(
+ NA_PIVOT_TYPE,
+ NAPIVOT_PROP_LOADABLE_SET, loadable,
+ NAPIVOT_PROP_IO_PROVIDER_SET, provider,
+ NULL );
pivot->private->modules = na_module_load_modules();
- na_io_provider_register_callbacks( pivot );
- /*g_debug( "%s: modules=%p, count=%d",
- thisfn, ( void * ) pivot->private->modules, g_list_length( pivot->private->modules ));*/
-
monitor_runtime_preferences( pivot );
return( pivot );
@@ -339,11 +407,13 @@ na_pivot_dump( const NAPivot *pivot )
if( !pivot->private->dispose_has_run ){
+ g_debug( "%s: loadable_set=%d", thisfn, pivot->private->loadable_set );
+ g_debug( "%s: io_provider_set=%d", thisfn, pivot->private->io_provider_set );
g_debug( "%s: modules=%p (%d elts)", thisfn, ( void * ) pivot->private->modules, g_list_length( pivot->private->modules ));
g_debug( "%s: consumers=%p (%d elts)", thisfn, ( void * ) pivot->private->consumers, g_list_length( pivot->private->consumers ));
g_debug( "%s: tree=%p (%d elts)", thisfn, ( void * ) pivot->private->tree, g_list_length( pivot->private->tree ));
g_debug( "%s: automatic_reload=%s", thisfn, pivot->private->automatic_reload ? "True":"False" );
- g_debug( "%s: population=%d", thisfn, pivot->private->population );
+ g_debug( "%s: monitors=%p (%d elts)", thisfn, ( void * ) pivot->private->monitors, g_list_length( pivot->private->monitors ));
for( it = pivot->private->tree, i = 0 ; it ; it = it->next ){
g_debug( "%s: [%d]: %p", thisfn, i++, it->data );
@@ -400,7 +470,7 @@ na_pivot_free_providers( GList *providers )
/*
* this handler is trigerred by IIOProviders when an action is changed
- * in the underlying storage subsystems
+ * in their underlying storage subsystems
* we don't care of updating our internal list with each and every
* atomic modification
* instead we wait for the end of notifications serie, and then reload
@@ -428,6 +498,54 @@ na_pivot_item_changed_handler( NAIIOProvider *provider, const gchar *id, NAPivot
}
}
+/*
+ * this timer is set when we receive the first event of a serie
+ * we continue to loop until last event is at least one half of a
+ * second old
+ *
+ * there is no race condition here as we are not multithreaded
+ * or .. is there ?
+ */
+static gboolean
+on_item_changed_timeout( NAPivot *pivot )
+{
+ static const gchar *thisfn = "na_pivot_on_item_changed_timeout";
+ GTimeVal now;
+ gulong diff;
+ GList *ic;
+
+ g_debug( "%s: pivot=%p", thisfn, pivot );
+ g_return_val_if_fail( NA_IS_PIVOT( pivot ), FALSE );
+
+ g_get_current_time( &now );
+ diff = time_val_diff( &now, &pivot->private->last_event );
+ if( diff < st_timeout_usec ){
+ return( TRUE );
+ }
+
+ if( pivot->private->automatic_reload ){
+ na_pivot_load_items( pivot );
+ }
+
+ for( ic = pivot->private->consumers ; ic ; ic = ic->next ){
+ na_ipivot_consumer_notify_actions_changed( NA_IPIVOT_CONSUMER( ic->data ));
+ }
+
+ pivot->private->event_source_id = 0;
+ return( FALSE );
+}
+
+/*
+ * returns the difference in microseconds.
+ */
+static gulong
+time_val_diff( const GTimeVal *recent, const GTimeVal *old )
+{
+ gulong microsec = 1000000 * ( recent->tv_sec - old->tv_sec );
+ microsec += recent->tv_usec - old->tv_usec;
+ return( microsec );
+}
+
/**
* na_pivot_get_items:
* @pivot: this #NAPivot instance.
@@ -471,9 +589,11 @@ na_pivot_load_items( NAPivot *pivot )
na_object_free_items_list( pivot->private->tree );
pivot->private->tree = na_io_provider_read_items( pivot, &messages );
+
for( im = messages ; im ; im = im->next ){
g_warning( "%s: %s", thisfn, ( const gchar * ) im->data );
}
+
na_utils_free_string_list( messages );
}
}
@@ -664,26 +784,6 @@ na_pivot_set_automatic_reload( NAPivot *pivot, gboolean reload )
}
/**
- * na_pivot_set_loadable_population:
- * @pivot: this #NAPivot instance.
- * @population: an indicator of the population to be loaded.
- *
- * @population may be a OR of PIVOT_LOAD_DISABLED and PIVOT_LOAD_INVALID.
- * It is initialized to PIVOT_LOAD_DISABLED | PIVOT_LOAD_INVALID,
- * which mean 'loads all'.
- */
-void
-na_pivot_set_loadable_population( NAPivot *pivot, NAPivotLoadable population )
-{
- g_return_if_fail( NA_IS_PIVOT( pivot ));
-
- if( !pivot->private->dispose_has_run ){
-
- pivot->private->loadable_population = population;
- }
-}
-
-/**
* na_pivot_is_disable_loadable:
* @pivot: this #NAPivot instance.
*
@@ -699,7 +799,7 @@ na_pivot_is_disable_loadable( const NAPivot *pivot )
if( !pivot->private->dispose_has_run ){
- is_loadable = ( pivot->private->population & PIVOT_LOAD_DISABLED );
+ is_loadable = ( pivot->private->loadable_set & PIVOT_LOAD_DISABLED );
}
return( is_loadable );
@@ -721,13 +821,35 @@ na_pivot_is_invalid_loadable( const NAPivot *pivot )
if( !pivot->private->dispose_has_run ){
- is_loadable = ( pivot->private->population & PIVOT_LOAD_INVALID );
+ is_loadable = ( pivot->private->loadable_set & PIVOT_LOAD_INVALID );
}
return( is_loadable );
}
/**
+ * na_pivot_get_io_provider_set:
+ * @pivot: this #NAPivot instance.
+ *
+ * Returns: the I/O providers we are concerned about.
+ */
+NAPivotIOProviderSet
+na_pivot_get_io_provider_set( const NAPivot *pivot )
+{
+ NAPivotIOProviderSet set;
+
+ set = 0;
+ g_return_val_if_fail( NA_IS_PIVOT( pivot ), set );
+
+ if( !pivot->private->dispose_has_run ){
+
+ set = pivot->private->io_provider_set;
+ }
+
+ return( set );
+}
+
+/**
* na_pivot_sort_alpha_asc:
* @a: first #NAObjectId.
* @b: second #NAObjectId.
@@ -859,54 +981,6 @@ get_item_from_tree( const NAPivot *pivot, GList *tree, const gchar *id )
return( found );
}
-/*
- * this timer is set when we receive the first event of a serie
- * we continue to loop until last event is at least one half of a
- * second old
- *
- * there is no race condition here as we are not multithreaded
- * or .. is there ?
- */
-static gboolean
-on_item_changed_timeout( NAPivot *pivot )
-{
- static const gchar *thisfn = "na_pivot_on_item_changed_timeout";
- GTimeVal now;
- gulong diff;
- GList *ic;
-
- g_debug( "%s: pivot=%p", thisfn, pivot );
- g_return_val_if_fail( NA_IS_PIVOT( pivot ), FALSE );
-
- g_get_current_time( &now );
- diff = time_val_diff( &now, &pivot->private->last_event );
- if( diff < st_timeout_usec ){
- return( TRUE );
- }
-
- if( pivot->private->automatic_reload ){
- na_pivot_load_items( pivot );
- }
-
- for( ic = pivot->private->consumers ; ic ; ic = ic->next ){
- na_ipivot_consumer_notify_actions_changed( NA_IPIVOT_CONSUMER( ic->data ));
- }
-
- pivot->private->event_source_id = 0;
- return( FALSE );
-}
-
-/*
- * returns the difference in microseconds.
- */
-static gulong
-time_val_diff( const GTimeVal *recent, const GTimeVal *old )
-{
- gulong microsec = 1000000 * ( recent->tv_sec - old->tv_sec );
- microsec += recent->tv_usec - old->tv_usec;
- return( microsec );
-}
-
static void
free_consumers( GList *consumers )
{
@@ -917,8 +991,10 @@ free_consumers( GList *consumers )
static void
monitor_runtime_preferences( NAPivot *pivot )
{
+ static const gchar *thisfn = "na_pivot_monitor_runtime_preferences";
GList *list = NULL;
+ g_debug( "%s: pivot=%p", thisfn, ( void * ) pivot );
g_return_if_fail( NA_IS_PIVOT( pivot ));
g_return_if_fail( !pivot->private->dispose_has_run );
diff --git a/nautilus-actions/runtime/na-pivot.h b/nautilus-actions/runtime/na-pivot.h
index 0652bca..2f7a2d3 100644
--- a/nautilus-actions/runtime/na-pivot.h
+++ b/nautilus-actions/runtime/na-pivot.h
@@ -114,52 +114,73 @@ GType na_pivot_get_type( void );
* N-A plugin set the loadable population to !PIVOT_LOAD_DISABLED & !PIVOT_LOAD_INVALID
*/
typedef enum {
+ PIVOT_LOAD_NONE = 0,
PIVOT_LOAD_DISABLED = 1 << 0,
PIVOT_LOAD_INVALID = 1 << 1,
- PIVOT_LOAD_ALL = 0xff,
+ PIVOT_LOAD_ALL = 0xff
}
- NAPivotLoadable;
+ NAPivotLoadableSet;
+
+/* Which are the I/O providers we are concerned about ?
+ * NACT management user interface wants all
+ * N-A plugin is only concerned about those are actually available at
+ * runtime and marked as readable in the preferences (or not marked at all)
+ * nautilus-actions-new wants those which are available and marked as
+ * writable in the preferences (or not marked as all)
+ */
+typedef enum {
+ PIVOT_IO_PROVIDER_AVAILABLE = 1 << 0,
+ PIVOT_IO_PROVIDER_READABLE_AT_STARTUP = 1 << 1,
+ PIVOT_IO_PROVIDER_WRITABLE = 1 << 2,
+ PIVOT_IO_PROVIDER_ALL = 0
+}
+ NAPivotIOProviderSet;
+/* these properties must be set at construction time
+ */
+#define NAPIVOT_PROP_LOADABLE_SET "na-pivot-prop-loadable-set"
+#define NAPIVOT_PROP_IO_PROVIDER_SET "na-pivot-prop-io-provider-set"
-NAPivot *na_pivot_new( void );
-void na_pivot_dump( const NAPivot *pivot );
+NAPivot *na_pivot_new( NAPivotLoadableSet loadable, NAPivotIOProviderSet provider );
+void na_pivot_dump( const NAPivot *pivot );
/* providers management of any NAIxxxxProvider interface
*/
-GList *na_pivot_get_providers( const NAPivot *pivot, GType type );
-void na_pivot_free_providers( GList *providers );
+GList *na_pivot_get_providers( const NAPivot *pivot, GType type );
+void na_pivot_free_providers( GList *providers );
/* menus/actions items management
*/
-void na_pivot_item_changed_handler( NAIIOProvider *provider, const gchar *id, NAPivot *pivot );
+void na_pivot_item_changed_handler( NAIIOProvider *provider, const gchar *id, NAPivot *pivot );
-GList *na_pivot_get_items( const NAPivot *pivot );
-void na_pivot_load_items( NAPivot *pivot );
+GList *na_pivot_get_items( const NAPivot *pivot );
+void na_pivot_load_items( NAPivot *pivot );
-void na_pivot_add_item( NAPivot *pivot, const NAObjectItem *item );
-NAObjectItem *na_pivot_get_item( const NAPivot *pivot, const gchar *id );
-void na_pivot_remove_item( NAPivot *pivot, NAObject *item );
+void na_pivot_add_item( NAPivot *pivot, const NAObjectItem *item );
+NAObjectItem *na_pivot_get_item( const NAPivot *pivot, const gchar *id );
+void na_pivot_remove_item( NAPivot *pivot, NAObject *item );
-guint na_pivot_delete_item( const NAPivot *pivot, const NAObjectItem *item, GSList **messages );
-guint na_pivot_write_item( const NAPivot *pivot, NAObjectItem *item, GSList **messages );
+guint na_pivot_delete_item( const NAPivot *pivot, const NAObjectItem *item, GSList **messages );
+guint na_pivot_write_item( const NAPivot *pivot, NAObjectItem *item, GSList **messages );
/* NAIPivotConsumer interface management
*/
-void na_pivot_register_consumer( NAPivot *pivot, const NAIPivotConsumer *consumer );
+void na_pivot_register_consumer( NAPivot *pivot, const NAIPivotConsumer *consumer );
/* NAPivot properties and configuration
*/
-void na_pivot_set_automatic_reload( NAPivot *pivot, gboolean reload );
+void na_pivot_set_automatic_reload( NAPivot *pivot, gboolean reload );
+
+gboolean na_pivot_is_disable_loadable( const NAPivot *pivot );
+gboolean na_pivot_is_invalid_loadable( const NAPivot *pivot );
-void na_pivot_set_loadable_population( NAPivot *pivot, NAPivotLoadable loadable );
-gboolean na_pivot_is_disable_loadable( const NAPivot *pivot );
-gboolean na_pivot_is_invalid_loadable( const NAPivot *pivot );
+NAPivotIOProviderSet na_pivot_get_io_provider_set( const NAPivot *pivot );
-gint na_pivot_sort_alpha_asc( const NAObjectId *a, const NAObjectId *b );
-gint na_pivot_sort_alpha_desc( const NAObjectId *a, const NAObjectId *b );
+gint na_pivot_sort_alpha_asc( const NAObjectId *a, const NAObjectId *b );
+gint na_pivot_sort_alpha_desc( const NAObjectId *a, const NAObjectId *b );
-gboolean na_pivot_is_level_zero_writable( const NAPivot *pivot );
-void na_pivot_write_level_zero( const NAPivot *pivot, GList *items );
+gboolean na_pivot_is_level_zero_writable( const NAPivot *pivot );
+void na_pivot_write_level_zero( const NAPivot *pivot, GList *items );
/* notification message from NAIIOProvider to NAPivot
*/
diff --git a/nautilus-actions/tracker/na-tracker-plugin.c b/nautilus-actions/tracker/na-tracker-plugin.c
index 66261f4..faf17af 100644
--- a/nautilus-actions/tracker/na-tracker-plugin.c
+++ b/nautilus-actions/tracker/na-tracker-plugin.c
@@ -61,7 +61,7 @@ nautilus_module_initialize( GTypeModule *module )
{
static const gchar *thisfn = "nautilus_module_initialize";
- syslog( LOG_USER | LOG_INFO, "%s Tracker %s initializing...", PACKAGE_NAME, PACKAGE_VERSION );
+ syslog( LOG_USER | LOG_INFO, "[N-A] %s Tracker %s initializing...", PACKAGE_NAME, PACKAGE_VERSION );
set_log_handler();
diff --git a/nautilus-actions/utils/nautilus-actions-new.c b/nautilus-actions/utils/nautilus-actions-new.c
index 5b64445..bbd6035 100644
--- a/nautilus-actions/utils/nautilus-actions-new.c
+++ b/nautilus-actions/utils/nautilus-actions-new.c
@@ -375,9 +375,12 @@ write_to_gconf( NAObjectAction *action, GSList **msg )
guint ret;
ret = NA_IIO_PROVIDER_NOT_WILLING_TO_WRITE;
- pivot = na_pivot_new();
- provider = na_io_provider_get_writable_provider( pivot );
+ pivot = na_pivot_new(
+ PIVOT_LOAD_NONE,
+ PIVOT_IO_PROVIDER_AVAILABLE | PIVOT_IO_PROVIDER_WRITABLE );
+
+ provider = na_io_provider_get_writable_provider( pivot );
if( provider ){
na_object_set_provider( action, NA_IIO_PROVIDER( provider ));
diff --git a/nautilus-actions/utils/nautilus-actions-run.c b/nautilus-actions/utils/nautilus-actions-run.c
index b7e6394..ec4615d 100644
--- a/nautilus-actions/utils/nautilus-actions-run.c
+++ b/nautilus-actions/utils/nautilus-actions-run.c
@@ -213,9 +213,12 @@ get_action( const gchar *id )
action = NULL;
- pivot = na_pivot_new();
- na_pivot_set_loadable_population( pivot, !PIVOT_LOAD_DISABLED & !PIVOT_LOAD_INVALID );
+ pivot = na_pivot_new(
+ !PIVOT_LOAD_DISABLED & !PIVOT_LOAD_INVALID,
+ PIVOT_IO_PROVIDER_AVAILABLE | PIVOT_IO_PROVIDER_READABLE_AT_STARTUP );
+
na_pivot_load_items( pivot );
+
action = ( NAObjectAction * ) na_pivot_get_item( pivot, id );
if( !action ){
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]