[nautilus-actions] Implement second tab of action conditions



commit 264355ad5233ebce18f4bef643358244c83de9f3
Author: Pierre Wieser <pwieser trychlos org>
Date:   Tue Jun 30 14:14:31 2009 +0200

    Implement second tab of action conditions

 ChangeLog                           |   14 ++-
 src/common/na-action-profile.c      |   59 ++++++++-
 src/common/na-action-profile.h      |    8 +-
 src/common/na-utils.c               |   59 ++++++++
 src/common/na-utils.h               |    5 +-
 src/nact/nact-iprofile-conditions.c |  272 +++++++++++++++++++++++++----------
 src/nact/nautilus-actions-config.ui |   12 --
 7 files changed, 330 insertions(+), 99 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c8c2098..d90eef8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,15 @@
 2009-06-30 Pierre Wieser <pwieser trychlos org>
 
+	* src/common/na-action-profile.c:
+	* src/common/na-action-profile.h
+	(na_action_profile_set_matchcase, na_action_profile_set_mimetypes,
+	na_action_profile_set_isfiledir, na_action_profile_set_multiple):
+	New functions.
+
 	* src/common/na-utils.c:
-	* src/common/na-utils.h (na_utils_gstring_joinv): New function.
+	* src/common/na-utils.h (na_utils_gstring_joinv,
+	na_utils_string_list_to_text, na_utils_text_to_string_list):
+	New functions.
 
 	* src/nact/nact-action-conditions-editor.c:
 	Call _dispose functions when closing the window.
@@ -15,13 +23,15 @@
 	(nact_iprofile_conditions_dispose): New function.
 
 	* src/nact/nact-iprofile-conditions.c:
-	All first tab is now implemented.
+	All first and second tabs are now implemented.
 
 	* src/nact/nact-utils.c:
 	* src/nact/nact-utils.h: Removed files.
 
 	* src/nact/nautilus-actions-config.ui:
 	Add LegendDialog window.
+	Remove all embedded action handlers (as I don't want pollute my
+	public namespace with these).
 
 2009-06-29 Pierre Wieser <pwieser trychlos org>
 
diff --git a/src/common/na-action-profile.c b/src/common/na-action-profile.c
index 56990bc..9af352d 100644
--- a/src/common/na-action-profile.c
+++ b/src/common/na-action-profile.c
@@ -61,11 +61,11 @@ struct NAActionProfilePrivate {
 	gchar    *label;
 	gchar    *path;
 	gchar    *parameters;
-	gboolean  accept_multiple_files;
 	GSList   *basenames;
+	gboolean  match_case;
 	gboolean  is_dir;
 	gboolean  is_file;
-	gboolean  match_case;
+	gboolean  accept_multiple_files;
 	GSList   *mimetypes;
 	GSList   *schemes;
 };
@@ -894,6 +894,61 @@ na_action_profile_set_basenames( NAActionProfile *profile, GSList *basenames )
 }
 
 /**
+ * Set the 'match_case' flag, indicating if specified basename patterns
+ * are, or not, case sensitive.
+ *
+ * @profile: this NAActionProfile object.
+ *
+ * @matchcase: TRUE if basename patterns are case sensitive.
+ */
+void
+na_action_profile_set_matchcase( NAActionProfile *profile, gboolean matchcase )
+{
+	g_object_set( G_OBJECT( profile ), PROP_PROFILE_MATCHCASE_STR, matchcase, NULL );
+}
+
+/**
+ * Set the mimetypes on which this profile applies.
+ *
+ * @profile: this NAActionProfile object.
+ *
+ * @mimetypes: list of mimetypes to be matched.
+ */
+void
+na_action_profile_set_mimetypes( NAActionProfile *profile, GSList *mimetypes )
+{
+	g_object_set( G_OBJECT( profile ), PROP_PROFILE_MIMETYPES_STR, mimetypes, NULL );
+}
+
+/**
+ * Set the 'isfile' and 'isdir' flags on which this profile applies.
+ *
+ * @profile: this NAActionProfile object.
+ *
+ * @isfile: the profile applies only to files.
+ *
+ * @isdir: the profile applies only to folders.
+ */
+void
+na_action_profile_set_isfiledir( NAActionProfile *profile, gboolean isfile, gboolean isdir )
+{
+	g_object_set( G_OBJECT( profile ), PROP_PROFILE_ISFILE_STR, isfile, PROP_PROFILE_ISDIR_STR, isdir, NULL );
+}
+
+/**
+ * Does this profile accept multiple selection ?
+ *
+ * @profile: this NAActionProfile object.
+ *
+ * @multiple: TRUE if it does.
+ */
+void
+na_action_profile_set_multiple( NAActionProfile *profile, gboolean multiple )
+{
+	g_object_set( G_OBJECT( profile ), PROP_PROFILE_ACCEPT_MULTIPLE_STR, multiple, NULL );
+}
+
+/**
  * Determines if the given profile is candidate to be displayed in the
  * Nautilus context menu, regarding the list of currently selected
  * items.
diff --git a/src/common/na-action-profile.h b/src/common/na-action-profile.h
index 978ca24..35f75fa 100644
--- a/src/common/na-action-profile.h
+++ b/src/common/na-action-profile.h
@@ -75,11 +75,11 @@ typedef struct {
 #define PROP_PROFILE_LABEL_STR					"profile-desc-name"
 #define PROP_PROFILE_PATH_STR					"profile-path"
 #define PROP_PROFILE_PARAMETERS_STR				"profile-parameters"
-#define PROP_PROFILE_ACCEPT_MULTIPLE_STR		"profile-accept-multiple-files"
 #define PROP_PROFILE_BASENAMES_STR				"profile-basenames"
+#define PROP_PROFILE_MATCHCASE_STR				"profile-matchcase"
 #define PROP_PROFILE_ISDIR_STR					"profile-isdir"
 #define PROP_PROFILE_ISFILE_STR					"profile-isfile"
-#define PROP_PROFILE_MATCHCASE_STR				"profile-matchcase"
+#define PROP_PROFILE_ACCEPT_MULTIPLE_STR		"profile-accept-multiple-files"
 #define PROP_PROFILE_MIMETYPES_STR				"profile-mimetypes"
 #define PROP_PROFILE_SCHEMES_STR				"profile-schemes"
 
@@ -107,6 +107,10 @@ gboolean         na_action_profile_are_equal( NAActionProfile *first, NAActionPr
 void             na_action_profile_set_path( NAActionProfile *profile, const gchar *path );
 void             na_action_profile_set_parameters( NAActionProfile *profile, const gchar *parameters );
 void             na_action_profile_set_basenames( NAActionProfile *profile, GSList *basenames );
+void             na_action_profile_set_matchcase( NAActionProfile *profile, gboolean matchcase );
+void             na_action_profile_set_mimetypes( NAActionProfile *profile, GSList *mimetypes );
+void             na_action_profile_set_isfiledir( NAActionProfile *profile, gboolean isfile, gboolean isdir );
+void             na_action_profile_set_multiple( NAActionProfile *profile, gboolean multiple );
 
 gboolean         na_action_profile_is_candidate( const NAActionProfile *profile, GList *files );
 gchar           *na_action_profile_parse_parameters( const NAActionProfile *profile, GList *files );
diff --git a/src/common/na-utils.c b/src/common/na-utils.c
index ad2fb1c..6aedb22 100644
--- a/src/common/na-utils.c
+++ b/src/common/na-utils.c
@@ -31,7 +31,10 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
+
 #include <glib-object.h>
+#include <string.h>
+
 #include "na-utils.h"
 
 /**
@@ -122,6 +125,62 @@ na_utils_free_string_list( GSList *list )
 }
 
 /**
+ * Concatenates a string list to a semi-colon-separated text.
+ */
+gchar *
+na_utils_string_list_to_text( GSList *strlist )
+{
+	GSList *ib;
+	gchar *tmp;
+	gchar *text = g_strdup( "" );
+
+	for( ib = strlist ; ib ; ib = ib->next ){
+		if( strlen( text )){
+			tmp = g_strdup_printf( "%s; ", text );
+			g_free( text );
+			text = tmp;
+		}
+		tmp = g_strdup_printf( "%s%s", text, ( gchar * ) ib->data );
+		g_free( text );
+		text = tmp;
+	}
+
+	return( text );
+}
+
+/**
+ * Extracts a list of strings from a semi-colon-separated text.
+ */
+GSList *
+na_utils_text_to_string_list( const gchar *text )
+{
+	GSList *strlist = NULL;
+	gchar **tokens, **iter;
+	gchar *tmp;
+	gchar *source = g_strdup( text );
+
+	tmp = g_strstrip( source );
+	if( !strlen( tmp )){
+		strlist = g_slist_append( strlist, g_strdup( "*" ));
+
+	} else {
+		tokens = g_strsplit( source, ";", -1 );
+		iter = tokens;
+
+		while( *iter ){
+			tmp = g_strstrip( *iter );
+			strlist = g_slist_append( strlist, g_strdup( tmp ));
+			iter++;
+		}
+
+		g_strfreev( tokens );
+	}
+
+	g_free( source );
+	return( strlist );
+}
+
+/**
  * Concatenates a gchar **list of strings to a GString.
  */
 gchar *
diff --git a/src/common/na-utils.h b/src/common/na-utils.h
index 3d36b90..ac4fd3d 100644
--- a/src/common/na-utils.h
+++ b/src/common/na-utils.h
@@ -39,12 +39,11 @@ G_BEGIN_DECLS
  * Some functions to ease the GSList list manipulations.
  */
 gboolean na_utils_find_in_list( GSList *list, const gchar *str );
-
 gboolean na_utils_string_lists_are_equal( GSList *first, GSList *second );
-
 GSList  *na_utils_duplicate_string_list( GSList *list );
-
 void     na_utils_free_string_list( GSList *list );
+gchar   *na_utils_string_list_to_text( GSList *list );
+GSList  *na_utils_text_to_string_list( const gchar *text );
 
 /*
  * Some functions for GString manipulations.
diff --git a/src/nact/nact-iprofile-conditions.c b/src/nact/nact-iprofile-conditions.c
index d01c19f..f3b78c4 100644
--- a/src/nact/nact-iprofile-conditions.c
+++ b/src/nact/nact-iprofile-conditions.c
@@ -72,17 +72,29 @@ static gchar        *parse_parameters( NactWindow *window );
 static void          on_legend_clicked( GtkButton *button, gpointer user_data );
 static void          show_legend_dialog( NactWindow *window );
 static void          hide_legend_dialog( NactWindow *window );
-static GtkWidget    *get_legend_button( NactWindow *window );
-static GtkWidget    *get_legend_dialog( NactWindow *window );
+static GtkButton    *get_legend_button( NactWindow *window );
+static GtkWindow    *get_legend_dialog( NactWindow *window );
 
 static void          on_basenames_changed( GtkEntry *entry, gpointer user_data );
+static GtkWidget    *get_basenames_widget( NactWindow *window );
+static void          on_matchcase_toggled( GtkToggleButton *button, gpointer user_data );
+static GtkButton    *get_matchcase_button( NactWindow *window );
+static void          on_mimetypes_changed( GtkEntry *entry, gpointer user_data );
+static GtkWidget    *get_mimetypes_widget( NactWindow *window );
+static void          on_isfiledir_toggled( GtkToggleButton *button, gpointer user_data );
+static void          get_isfiledir( NactWindow *window, gboolean *isfile, gboolean *isdir );
+static void          set_isfiledir( NactWindow *window, gboolean isfile, gboolean isdir );
+static GtkButton    *get_isfile_button( NactWindow *window );
+static GtkButton    *get_isdir_button( NactWindow *window );
+static GtkButton    *get_both_button( NactWindow *window );
+static void          on_multiple_toggled( GtkToggleButton *button, gpointer user_data );
+static GtkButton    *get_multiple_button( NactWindow *window );
+
 static void          on_scheme_selection_toggled( GtkCellRendererToggle *renderer, gchar *path, gpointer user_data );
 static void          on_scheme_keyword_edited( GtkCellRendererText *renderer, const gchar *path, const gchar *text, gpointer user_data );
 static void          on_scheme_desc_edited( GtkCellRendererText *renderer, const gchar *path, const gchar *text, gpointer user_data );
 static void          on_scheme_list_selection_changed( GtkTreeSelection *selection, gpointer user_data );
 
-static gchar        *basenames_to_text( GSList *basenames );
-static GSList       *text_to_basenames( const gchar *text );
 static GtkTreeView  *get_schemes_tree_view( NactWindow *window );
 static GtkTreeModel *get_schemes_tree_model( NactWindow *window );
 static void          create_schemes_selection_list( NactWindow *window );
@@ -186,21 +198,44 @@ nact_iprofile_conditions_runtime_init( NactWindow *dialog, NAActionProfile *prof
 	gtk_entry_set_text( GTK_ENTRY( parameters_widget ), parameters );
 	g_free( parameters );
 
-	button = get_legend_button( dialog );
+	button = GTK_WIDGET( get_legend_button( dialog ));
 	nact_window_signal_connect( dialog, G_OBJECT( button ), "clicked", G_CALLBACK( on_legend_clicked ));
 
-	GtkWidget *basenames_widget = base_window_get_widget( BASE_WINDOW( dialog ), "PatternEntry" );
+	GtkWidget *basenames_widget = get_basenames_widget( dialog );
 	nact_window_signal_connect( dialog, G_OBJECT( basenames_widget ), "changed", G_CALLBACK( on_basenames_changed ));
 	GSList *basenames = na_action_profile_get_basenames( profile );
-	gchar *basenames_text = basenames_to_text( basenames );
+	gchar *basenames_text = na_utils_string_list_to_text( basenames );
 	gtk_entry_set_text( GTK_ENTRY( basenames_widget ), basenames_text );
 	g_free( basenames_text );
 	na_utils_free_string_list( basenames );
 
-	/* TODO: match case */
-	/* TODO: mime types */
-	/* TODO: file/dir */
-	/* TODO: multiple selection */
+	GtkButton *matchcase_button = get_matchcase_button( dialog );
+	nact_window_signal_connect( dialog, G_OBJECT( matchcase_button ), "toggled", G_CALLBACK( on_matchcase_toggled ));
+	gboolean matchcase = na_action_profile_get_matchcase( profile );
+	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( matchcase_button ), matchcase );
+
+	GtkWidget *mimetypes_widget = get_mimetypes_widget( dialog );
+	nact_window_signal_connect( dialog, G_OBJECT( mimetypes_widget ), "changed", G_CALLBACK( on_mimetypes_changed ));
+	GSList *mimetypes = na_action_profile_get_mimetypes( profile );
+	gchar *mimetypes_text = na_utils_string_list_to_text( mimetypes );
+	gtk_entry_set_text( GTK_ENTRY( mimetypes_widget ), mimetypes_text );
+	g_free( mimetypes_text );
+	na_utils_free_string_list( mimetypes );
+
+	GtkButton *isfile_button = get_isfile_button( dialog );
+	nact_window_signal_connect( dialog, G_OBJECT( isfile_button ), "toggled", G_CALLBACK( on_isfiledir_toggled ));
+	GtkButton *isdir_button = get_isdir_button( dialog );
+	nact_window_signal_connect( dialog, G_OBJECT( isdir_button ), "toggled", G_CALLBACK( on_isfiledir_toggled ));
+	GtkButton *both_button = get_both_button( dialog );
+	nact_window_signal_connect( dialog, G_OBJECT( both_button ), "toggled", G_CALLBACK( on_isfiledir_toggled ));
+	gboolean isfile = na_action_profile_get_is_file( profile );
+	gboolean isdir = na_action_profile_get_is_dir( profile );
+	set_isfiledir( dialog, isfile, isdir );
+
+	GtkButton *multiple_button = get_multiple_button( dialog );
+	nact_window_signal_connect( dialog, G_OBJECT( multiple_button ), "toggled", G_CALLBACK( on_multiple_toggled ));
+	gboolean multiple = na_action_profile_get_multiple( profile );
+	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( multiple_button ), multiple );
 
 	GtkTreeView *scheme_widget = get_schemes_tree_view( dialog );
 
@@ -392,12 +427,9 @@ parse_parameters( NactWindow *window )
 
 	g_string_append_printf( tmp_string, "%s ", command );
 
-	gboolean is_file = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( window ), "OnlyFilesButton" )));
-	gboolean is_dir = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( window ), "OnlyFoldersButton" )));
-	if (gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( window ), "BothButton" )))){
-		is_file = TRUE;
-		is_dir = TRUE;
-	}
+	gboolean is_file, is_dir;
+	get_isfiledir( window, &is_file, &is_dir );
+
 	gboolean accept_multiple = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( window ), "AcceptMultipleButton" )));
 
 	GtkTreeModel* scheme_model = get_schemes_tree_model( window );
@@ -524,39 +556,39 @@ on_legend_clicked( GtkButton *button, gpointer user_data )
 static void
 show_legend_dialog( NactWindow *window )
 {
-	GtkWidget *legend_dialog = get_legend_dialog( window );
-	gtk_window_set_deletable( GTK_WINDOW( legend_dialog ), FALSE );
+	GtkWindow *legend_dialog = get_legend_dialog( window );
+	gtk_window_set_deletable( legend_dialog, FALSE );
 
 	GtkWindow *toplevel = base_window_get_toplevel_widget( BASE_WINDOW( window ));
 	gtk_window_set_transient_for( GTK_WINDOW( legend_dialog ), toplevel );
 
-	gtk_widget_show( legend_dialog );
+	gtk_widget_show( GTK_WIDGET( legend_dialog ));
 }
 
 /* TODO: save the current position */
 static void
 hide_legend_dialog( NactWindow *window )
 {
-	GtkWidget *legend_dialog = get_legend_dialog( window );
-	gtk_widget_hide( legend_dialog );
+	GtkWindow *legend_dialog = get_legend_dialog( window );
+	gtk_widget_hide( GTK_WIDGET( legend_dialog ));
 
 	/* set the legend button state consistent for when the dialog is
 	 * hidden by another mean (eg. close the edit profile dialog)
 	 */
-	GtkWidget *legend_button = get_legend_button( window );
+	GtkButton *legend_button = get_legend_button( window );
 	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( legend_button ), FALSE );
 }
 
-static GtkWidget *
+static GtkButton *
 get_legend_button( NactWindow *window )
 {
-	return( base_window_get_widget( BASE_WINDOW( window ), "LegendButton" ));
+	return( GTK_BUTTON( base_window_get_widget( BASE_WINDOW( window ), "LegendButton" )));
 }
 
-static GtkWidget *
+static GtkWindow *
 get_legend_dialog( NactWindow *window )
 {
-	return( base_window_get_widget( BASE_WINDOW( window ), "LegendDialog" ));
+	return( GTK_WINDOW( base_window_get_widget( BASE_WINDOW( window ), "LegendDialog" )));
 }
 
 static void
@@ -567,13 +599,147 @@ on_basenames_changed( GtkEntry *entry, gpointer user_data )
 
 	NAActionProfile *edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
 	const gchar *text = gtk_entry_get_text( entry );
-	GSList *basenames = text_to_basenames( text );
+	GSList *basenames = na_utils_text_to_string_list( text );
 	na_action_profile_set_basenames( edited, basenames );
 	na_utils_free_string_list( basenames );
 
 	v_field_modified( dialog );
 }
 
+static GtkWidget *
+get_basenames_widget( NactWindow *window )
+{
+	return( base_window_get_widget( BASE_WINDOW( window ), "PatternEntry" ));
+}
+
+static void
+on_matchcase_toggled( GtkToggleButton *button, gpointer user_data )
+{
+	g_assert( NACT_IS_WINDOW( user_data ));
+	NactWindow *dialog = NACT_WINDOW( user_data );
+
+	NAActionProfile *edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
+	gboolean matchcase = gtk_toggle_button_get_active( button );
+	na_action_profile_set_matchcase( edited, matchcase );
+
+	v_field_modified( dialog );
+}
+
+static GtkButton *
+get_matchcase_button( NactWindow *window )
+{
+	return( GTK_BUTTON( base_window_get_widget( BASE_WINDOW( window ), "MatchCaseButton" )));
+}
+
+static void
+on_mimetypes_changed( GtkEntry *entry, gpointer user_data )
+{
+	g_assert( NACT_IS_WINDOW( user_data ));
+	NactWindow *dialog = NACT_WINDOW( user_data );
+
+	NAActionProfile *edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
+	const gchar *text = gtk_entry_get_text( entry );
+	GSList *mimetypes = na_utils_text_to_string_list( text );
+	na_action_profile_set_mimetypes( edited, mimetypes );
+	na_utils_free_string_list( mimetypes );
+
+	v_field_modified( dialog );
+}
+
+static GtkWidget *
+get_mimetypes_widget( NactWindow *window )
+{
+	return( base_window_get_widget( BASE_WINDOW( window ), "MimeTypeEntry" ));
+}
+
+/*
+ * Note that this callback is triggered twice: first, for the
+ * deactivated button, then a second time for the newly activated one.
+ * I don't know what to do to be triggered only once..?
+ */
+static void
+on_isfiledir_toggled( GtkToggleButton *button, gpointer user_data )
+{
+	/*static const gchar *thisfn = "nact_iprofile_conditions_on_isfiledir_toggled";*/
+
+	g_assert( NACT_IS_WINDOW( user_data ));
+	NactWindow *dialog = NACT_WINDOW( user_data );
+
+	gboolean isfile, isdir;
+	get_isfiledir( dialog, &isfile, &isdir );
+	NAActionProfile *edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
+	na_action_profile_set_isfiledir( edited, isfile, isdir );
+
+	v_field_modified( dialog );
+}
+
+static void
+get_isfiledir( NactWindow *window, gboolean *isfile, gboolean *isdir )
+{
+	g_assert( isfile );
+	g_assert( isdir );
+
+	gboolean both = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( get_both_button( window )));
+	if( both ){
+		*isfile = TRUE;
+		*isdir = TRUE;
+	} else {
+		*isfile = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( get_isfile_button( window )));
+		*isdir = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( get_isdir_button( window )));
+	}
+}
+
+static void
+set_isfiledir( NactWindow *window, gboolean isfile, gboolean isdir )
+{
+	if( isfile && isdir ){
+		gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( get_both_button( window )), TRUE );
+
+	} else if( isfile ){
+		gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( get_isfile_button( window )), TRUE );
+
+	} else if( isdir ){
+		gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( get_isdir_button( window )), TRUE );
+	}
+}
+
+static GtkButton *
+get_isfile_button( NactWindow *window )
+{
+	return( GTK_BUTTON( base_window_get_widget( BASE_WINDOW( window ), "OnlyFilesButton" )));
+}
+
+static GtkButton *
+get_isdir_button( NactWindow *window )
+{
+	return( GTK_BUTTON( base_window_get_widget( BASE_WINDOW( window ), "OnlyFoldersButton" )));
+}
+
+static GtkButton *
+get_both_button( NactWindow *window )
+{
+	return( GTK_BUTTON( base_window_get_widget( BASE_WINDOW( window ), "BothButton" )));
+}
+
+static void
+on_multiple_toggled( GtkToggleButton *button, gpointer user_data )
+{
+	g_assert( NACT_IS_WINDOW( user_data ));
+	NactWindow *dialog = NACT_WINDOW( user_data );
+
+	NAActionProfile *edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
+	gboolean multiple = gtk_toggle_button_get_active( button );
+	na_action_profile_set_multiple( edited, multiple );
+
+	v_field_modified( dialog );
+}
+
+static GtkButton *
+get_multiple_button( NactWindow *window )
+{
+	return( GTK_BUTTON( base_window_get_widget( BASE_WINDOW( window ), "AcceptMultipleButton" )));
+}
+
 static void
 on_scheme_selection_toggled( GtkCellRendererToggle *renderer, gchar *path, gpointer user_data )
 {
@@ -634,56 +800,6 @@ on_scheme_list_selection_changed( GtkTreeSelection *selection, gpointer user_dat
 	v_field_modified( dialog );
 }
 
-static gchar *
-basenames_to_text( GSList *basenames )
-{
-	GSList *ib;
-	gchar *tmp;
-	gchar *text = g_strdup( "" );
-
-	for( ib = basenames ; ib ; ib = ib->next ){
-		if( strlen( text )){
-			tmp = g_strdup_printf( "%s; ", text );
-			g_free( text );
-			text = tmp;
-		}
-		tmp = g_strdup_printf( "%s%s", text, ( gchar * ) ib->data );
-		g_free( text );
-		text = tmp;
-	}
-
-	return( text );
-}
-
-static GSList *
-text_to_basenames( const gchar *text )
-{
-	GSList *basenames = NULL;
-	gchar **tokens, **iter;
-	gchar *tmp;
-	gchar *source = g_strdup( text );
-
-	tmp = g_strstrip( source );
-	if( !strlen( tmp )){
-		basenames = g_slist_append( basenames, g_strdup( "*" ));
-
-	} else {
-		tokens = g_strsplit( source, ";", -1 );
-		iter = tokens;
-
-		while( *iter ){
-			tmp = g_strstrip( *iter );
-			basenames = g_slist_append( basenames, g_strdup( tmp ));
-			iter++;
-		}
-
-		g_strfreev( tokens );
-	}
-
-	g_free( source );
-	return( basenames );
-}
-
 static GtkTreeView *
 get_schemes_tree_view( NactWindow *window )
 {
diff --git a/src/nact/nautilus-actions-config.ui b/src/nact/nautilus-actions-config.ui
index a84c081..dd71c27 100644
--- a/src/nact/nautilus-actions-config.ui
+++ b/src/nact/nautilus-actions-config.ui
@@ -351,7 +351,6 @@
                             <property name="receives_default">False</property>
                             <property name="tooltip_text" translatable="yes">Click to choose a custom icon from a file instead of a predefined icon from the drop-down list.</property>
                             <property name="use_underline">True</property>
-                            <signal name="clicked" handler="action_icon_browse_button_clicked_cb"/>
                           </object>
                           <packing>
                             <property name="expand">False</property>
@@ -464,7 +463,6 @@
                             <property name="can_focus">True</property>
                             <property name="tooltip_text" translatable="yes">The command that will be launched by selecting the action in Nautilus popup menu.</property>
                             <property name="width_chars">10</property>
-                            <signal name="changed" handler="action_field_changed_cb"/>
                           </object>
                           <packing>
                             <property name="position">1</property>
@@ -478,7 +476,6 @@
                             <property name="receives_default">False</property>
                             <property name="tooltip_text" translatable="yes">Click to choose a command from the file chooser dialog.</property>
                             <property name="use_underline">True</property>
-                            <signal name="clicked" handler="action_path_browse_button_clicked_cb"/>
                           </object>
                           <packing>
                             <property name="expand">False</property>
@@ -514,7 +511,6 @@
                             <property name="can_focus">True</property>
                             <property name="tooltip_text" translatable="yes">Parameters that will be sent to the program. Click on the 'Legend' button to see the different replacement tokens.</property>
                             <property name="width_chars">10</property>
-                            <signal name="changed" handler="action_field_changed_cb"/>
                           </object>
                           <packing>
                             <property name="position">1</property>
@@ -526,7 +522,6 @@
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
                             <property name="tooltip_text" translatable="yes">Click to toggle the display of the list of special tokens you can use in the parameter field.</property>
-                            <signal name="toggled" handler="action_legend_button_toggled_cb"/>
                             <child>
                               <object class="GtkAlignment" id="alignment16">
                                 <property name="visible">True</property>
@@ -672,7 +667,6 @@
                             <property name="can_focus">True</property>
                             <property name="tooltip_text" translatable="yes">A string with wildcards (? or *) that will be used to match the filenames. You can set several filename patterns by separating them with a semi-colon (;).</property>
                             <property name="text">*</property>
-                            <signal name="changed" handler="action_field_changed_cb"/>
                           </object>
                           <packing>
                             <property name="position">1</property>
@@ -707,7 +701,6 @@
                             <property name="tooltip_text" translatable="yes">If selected, the filename patterns will be matched case sensitive (eg, *.jpg will not match photo.JPG)</property>
                             <property name="use_underline">True</property>
                             <property name="draw_indicator">True</property>
-                            <signal name="toggled" handler="action_field_changed_cb"/>
                           </object>
                           <packing>
                             <property name="position">1</property>
@@ -742,7 +735,6 @@
                             <property name="can_focus">True</property>
                             <property name="tooltip_text" translatable="yes">A string with wildcards (? or *) that will be used to match the mimetypes of files. You can set several mimetype patterns by separating them with a semi-colon (;).</property>
                             <property name="text">*/*</property>
-                            <signal name="changed" handler="action_field_changed_cb"/>
                           </object>
                           <packing>
                             <property name="position">1</property>
@@ -786,7 +778,6 @@
                         <property name="receives_default">False</property>
                         <property name="use_underline">True</property>
                         <property name="draw_indicator">True</property>
-                        <signal name="toggled" handler="action_field_changed_cb"/>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -803,7 +794,6 @@
                         <property name="use_underline">True</property>
                         <property name="draw_indicator">True</property>
                         <property name="group">OnlyFilesButton</property>
-                        <signal name="toggled" handler="action_field_changed_cb"/>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -820,7 +810,6 @@
                         <property name="use_underline">True</property>
                         <property name="draw_indicator">True</property>
                         <property name="group">OnlyFilesButton</property>
-                        <signal name="toggled" handler="action_field_changed_cb"/>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -842,7 +831,6 @@
                     <property name="receives_default">False</property>
                     <property name="use_underline">True</property>
                     <property name="draw_indicator">True</property>
-                    <signal name="toggled" handler="action_field_changed_cb"/>
                   </object>
                   <packing>
                     <property name="expand">False</property>



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