[nautilus-actions] Fix action import
- From: Pierre Wieser <pwieser src gnome org>
- To: svn-commits-list gnome org
- Subject: [nautilus-actions] Fix action import
- Date: Wed, 15 Jul 2009 23:38:27 +0000 (UTC)
commit f7dd990d6d19a466727396aa2c6cd8dcdd93e7d7
Author: Pierre Wieser <pwieser trychlos org>
Date: Tue Jul 14 21:14:22 2009 +0200
Fix action import
ChangeLog | 8 ++++++++
src/common/na-utils.c | 37 +++++++++++++++++++++++++++++++++++++
src/nact/nact-assist-import.c | 14 ++++++++++++--
src/nact/nact-gconf-reader.c | 3 ---
4 files changed, 57 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 965489f..6cbdec6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2009-07-14 Pierre Wieser <pwieser trychlos org>
+ * src/common/na-utils.c:
+ Implement na_utils_schema_to_gslist function.
+
+ * src/nact/nact-assist-import.c:
+ Write the imported action to the I/O provider.
+
+2009-07-14 Pierre Wieser <pwieser trychlos org>
+
* configure.ac: Bump version number to 1.11.2.
2009-07-14 Pierre Wieser <pwieser trychlos org>
diff --git a/src/common/na-utils.c b/src/common/na-utils.c
index 5b3aa2d..131f7f0 100644
--- a/src/common/na-utils.c
+++ b/src/common/na-utils.c
@@ -253,6 +253,42 @@ GSList *
na_utils_schema_to_gslist( const gchar *value )
{
GSList *list = NULL;
+ const gchar *ptr = value;
+ const gchar *start = NULL;
+ gchar *str_list = NULL;
+ gchar **str_list_splited = NULL;
+ int i;
+
+ /* first remove the surrounding brackets [] */
+ while( *ptr != '[' ){
+ ptr++;
+ }
+
+ if( *ptr == '[' ){
+ ptr++;
+ start = ptr;
+ i = 0;
+ while( *ptr != ']' ){
+ i++;
+ ptr++;
+ }
+ if( *ptr == ']' ){
+ str_list = g_strndup( start, i );
+ }
+ }
+
+ /* split the result and fill the list */
+ if( str_list != NULL ){
+
+ str_list_splited = g_strsplit( str_list, ",", -1 );
+ i = 0;
+ while( str_list_splited[i] != NULL ){
+ list = g_slist_append( list, g_strdup( str_list_splited[i] ));
+ i++;
+ }
+ g_strfreev( str_list_splited );
+ }
+
return( list );
}
@@ -268,6 +304,7 @@ na_utils_boolean_to_schema( gboolean b )
/**
* Converts a string to a boolean
+ * Not case sensitive, accepts abbreviations
*/
gboolean
na_utils_schema_to_boolean( const gchar *value, gboolean default_value )
diff --git a/src/nact/nact-assist-import.c b/src/nact/nact-assist-import.c
index 64c1726..13e7f73 100644
--- a/src/nact/nact-assist-import.c
+++ b/src/nact/nact-assist-import.c
@@ -37,6 +37,7 @@
#include <string.h>
#include <common/na-action.h>
+#include <common/na-iio-provider.h>
#include <common/na-utils.h>
#include "base-application.h"
@@ -486,15 +487,24 @@ do_import( NactAssistImport *window, GtkAssistant *assistant )
static const gchar *thisfn = "nact_assist_import_do_import";
g_debug( "%s: window=%p", thisfn, window );
+ NAPivot *pivot = NA_PIVOT( nact_window_get_pivot( NACT_WINDOW( window )));
+
GtkWidget *chooser = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_FILES_SELECTION );
GSList *uris = gtk_file_chooser_get_uris( GTK_FILE_CHOOSER( chooser ));
- GSList *is, *msg ;
+ GSList *is, *msg;
+ gchar *error;
for( is = uris ; is ; is = is->next ){
msg = NULL;
NAAction *action = nact_gconf_reader_import( G_OBJECT( window ), ( const gchar * ) is->data, &msg );
- g_debug( "%s: msg has %d lines", thisfn, g_slist_length( msg ));
+
+ if( action && na_pivot_write_action( pivot, G_OBJECT( action ), &error ) != NA_IIO_PROVIDER_WRITE_OK ){
+ g_object_unref( action );
+ action = NULL;
+ msg = g_slist_append( msg, error );
+ g_free( error );
+ }
ImportUriStruct *str = g_new0( ImportUriStruct, 1 );
str->uri = g_strdup(( const gchar * ) is->data );
diff --git a/src/nact/nact-gconf-reader.c b/src/nact/nact-gconf-reader.c
index 4219053..2eab015 100644
--- a/src/nact/nact-gconf-reader.c
+++ b/src/nact/nact-gconf-reader.c
@@ -310,10 +310,7 @@ nact_gconf_reader_import( GObject *window, const gchar *uri, GSList **msg )
}
xmlCleanupParser();
-
- g_debug( "%s: messages has %d lines", thisfn, g_slist_length( reader->private->messages ));
*msg = na_utils_duplicate_string_list( reader->private->messages );
- g_debug( "%s: after", thisfn );
if( reader->private->action ){
g_assert( NA_IS_ACTION( reader->private->action ));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]