[nautilus-actions] Remove no more used default values



commit d6802af8da294564179d66f807e646529adead6f
Author: Pierre Wieser <pwieser trychlos org>
Date:   Fri Jan 14 16:39:01 2011 +0100

    Remove no more used default values

 ChangeLog                        |    9 +++++++++
 src/nact/nact-gtk-utils.c        |   25 +++++++++++--------------
 src/nact/nact-gtk-utils.h        |    7 ++-----
 src/nact/nact-icommand-tab.c     |    4 ++--
 src/nact/nact-ienvironment-tab.c |    4 ++--
 5 files changed, 26 insertions(+), 23 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c9c8667..3d6fb9a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -29,6 +29,15 @@
 	* src/utils/nautilus-actions-run.c:
 	* src/utils/nautilus-actions-schemas.c: Add locale.h include.
 
+	* src/nact/nact-gtk-utils.c:
+	* src/nact/nact-gtk-utils.h (nact_gtk_utils_select_file,
+	nact_gtk_utils_select_file_with_preview, nact_gtk_utils_select_dir):
+	Remove no more used default value.
+
+	* src/nact/nact-icommand-tab.c (on_path_browse, on_wdir_browse):
+	* src/nact/nact-ienvironment-tab.c (on_try_exec_browse,
+	on_show_if_running_browse): Updated accordingly.
+
 	* src/core/na-boxed.c (string_list_from_array, uint_list_from_array):
 	Do not allocate the empty last element.
 
diff --git a/src/nact/nact-gtk-utils.c b/src/nact/nact-gtk-utils.c
index f5d9514..a9b4b4e 100644
--- a/src/nact/nact-gtk-utils.c
+++ b/src/nact/nact-gtk-utils.c
@@ -287,8 +287,6 @@ nact_gtk_utils_render( const gchar *name, GtkImage *widget, GtkIconSize size )
  *  its size and position.
  * @entry: the #GtkEntry which is associated with the selected file.
  * @entry_name: the name of the entry in Preferences to be readen/written.
- * @default_dir_uri: the URI of the directory which should be set if there is
- *  not yet any preference (see @entry_name)
  *
  * Opens a #GtkFileChooserDialog and let the user choose an existing file
  * -> choose and display an existing file name
@@ -301,11 +299,10 @@ nact_gtk_utils_render( const gchar *name, GtkImage *widget, GtkIconSize size )
 void
 nact_gtk_utils_select_file( BaseWindow *window,
 				const gchar *title, const gchar *dialog_name,
-				GtkWidget *entry, const gchar *entry_name,
-				const gchar *default_dir_uri )
+				GtkWidget *entry, const gchar *entry_name )
 {
 	nact_gtk_utils_select_file_with_preview(
-			window, title, dialog_name, entry, entry_name, default_dir_uri, NULL );
+			window, title, dialog_name, entry, entry_name, NULL );
 }
 
 /**
@@ -316,8 +313,6 @@ nact_gtk_utils_select_file( BaseWindow *window,
  *  its size and position.
  * @entry: the #GtkEntry which is associated with the selected file.
  * @entry_name: the name of the entry in Preferences to be readen/written.
- * @default_dir_uri: the URI of the directory which should be set if there is
- *  not yet any preference (see @entry_name)
  * @update_preview_cb: the callback function in charge of updating the
  *  preview widget. May be NULL.
  *
@@ -333,7 +328,6 @@ void
 nact_gtk_utils_select_file_with_preview( BaseWindow *window,
 				const gchar *title, const gchar *dialog_name,
 				GtkWidget *entry, const gchar *entry_name,
-				const gchar *default_dir_uri,
 				GCallback update_preview_cb )
 {
 	NactApplication *application;
@@ -374,8 +368,10 @@ nact_gtk_utils_select_file_with_preview( BaseWindow *window,
 
 	} else {
 		uri = na_settings_get_string( settings, entry_name, NULL, NULL );
-		gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( dialog ), uri );
-		g_free( uri );
+		if( uri ){
+			gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( dialog ), uri );
+			g_free( uri );
+		}
 	}
 
 	if( gtk_dialog_run( GTK_DIALOG( dialog )) == GTK_RESPONSE_ACCEPT ){
@@ -415,8 +411,7 @@ nact_gtk_utils_select_file_with_preview( BaseWindow *window,
 void
 nact_gtk_utils_select_dir( BaseWindow *window,
 				const gchar *title, const gchar *dialog_name,
-				GtkWidget *entry, const gchar *entry_name,
-				const gchar *default_dir_uri )
+				GtkWidget *entry, const gchar *entry_name )
 {
 	NactApplication *application;
 	NAUpdater *updater;
@@ -449,8 +444,10 @@ nact_gtk_utils_select_dir( BaseWindow *window,
 
 	} else {
 		uri = na_settings_get_string( settings, entry_name, NULL, NULL );
-		gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( dialog ), uri );
-		g_free( uri );
+		if( uri ){
+			gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( dialog ), uri );
+			g_free( uri );
+		}
 	}
 
 	if( gtk_dialog_run( GTK_DIALOG( dialog )) == GTK_RESPONSE_ACCEPT ){
diff --git a/src/nact/nact-gtk-utils.h b/src/nact/nact-gtk-utils.h
index 614886e..4ed749d 100644
--- a/src/nact/nact-gtk-utils.h
+++ b/src/nact/nact-gtk-utils.h
@@ -57,19 +57,16 @@ void       nact_gtk_utils_render( const gchar *name, GtkImage *widget, GtkIconSi
  */
 void       nact_gtk_utils_select_file( BaseWindow *window,
 				const gchar *title, const gchar *dialog_name,
-				GtkWidget *entry, const gchar *entry_name,
-				const gchar *default_dir_uri );
+				GtkWidget *entry, const gchar *entry_name );
 
 void       nact_gtk_utils_select_file_with_preview( BaseWindow *window,
 				const gchar *title, const gchar *dialog_name,
 				GtkWidget *entry, const gchar *entry_name,
-				const gchar *default_dir_uri,
 				GCallback update_preview_cb );
 
 void       nact_gtk_utils_select_dir( BaseWindow *window,
 				const gchar *title, const gchar *dialog_name,
-				GtkWidget *entry, const gchar *entry_name,
-				const gchar *default_dir_uri );
+				GtkWidget *entry, const gchar *entry_name );
 
 G_END_DECLS
 
diff --git a/src/nact/nact-icommand-tab.c b/src/nact/nact-icommand-tab.c
index e827128..96de907 100644
--- a/src/nact/nact-icommand-tab.c
+++ b/src/nact/nact-icommand-tab.c
@@ -560,7 +560,7 @@ on_path_browse( GtkButton *button, NactICommandTab *instance )
 	nact_gtk_utils_select_file(
 			BASE_WINDOW( instance ),
 			_( "Choosing a command" ), NA_IPREFS_COMMAND_CHOOSER_WSP,
-			get_path_entry( instance ), NA_IPREFS_COMMAND_CHOOSER_URI, "file:///bin" );
+			get_path_entry( instance ), NA_IPREFS_COMMAND_CHOOSER_URI );
 }
 
 static void
@@ -601,7 +601,7 @@ on_wdir_browse( GtkButton *button, NactICommandTab *instance )
 		nact_gtk_utils_select_dir(
 				BASE_WINDOW( instance ),
 				_( "Choosing a working directory" ), NA_IPREFS_WORKING_DIR_WSP,
-				wdir_entry, NA_IPREFS_WORKING_DIR_URI, default_value );
+				wdir_entry, NA_IPREFS_WORKING_DIR_URI );
 
 		g_free( default_value );
 	}
diff --git a/src/nact/nact-ienvironment-tab.c b/src/nact/nact-ienvironment-tab.c
index 78052dc..e77416a 100644
--- a/src/nact/nact-ienvironment-tab.c
+++ b/src/nact/nact-ienvironment-tab.c
@@ -752,7 +752,7 @@ on_try_exec_browse( GtkButton *button, NactIEnvironmentTab *instance )
 	nact_gtk_utils_select_file(
 			BASE_WINDOW( instance ),
 			_( "Choosing an executable" ), NA_IPREFS_TRY_EXEC_WSP,
-			entry, NA_IPREFS_TRY_EXEC_URI, "file:///bin" );
+			entry, NA_IPREFS_TRY_EXEC_URI );
 }
 
 static void
@@ -810,7 +810,7 @@ on_show_if_running_browse( GtkButton *button, NactIEnvironmentTab *instance )
 	nact_gtk_utils_select_file(
 			BASE_WINDOW( instance ),
 			_( "Choosing an executable" ), NA_IPREFS_SHOW_IF_RUNNING_WSP,
-			entry, NA_IPREFS_SHOW_IF_RUNNING_URI, "file:///bin" );
+			entry, NA_IPREFS_SHOW_IF_RUNNING_URI );
 }
 
 static void



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