[nautilus-actions] na_gtk_utils_search_for_child_widget() renamed as na_gtk_utils_find_widget_by_name()



commit 0f60c9676c0387721567000f46c3cf6501aa14db
Author: Pierre Wieser <pwieser trychlos org>
Date:   Sun Dec 25 20:47:44 2011 +0100

    na_gtk_utils_search_for_child_widget() renamed as na_gtk_utils_find_widget_by_name()

 ChangeLog                        |   13 +++++++++++++
 src/core/na-gtk-utils.c          |    6 +++---
 src/core/na-gtk-utils.h          |    6 ++++--
 src/core/na-importer-ask.c       |   16 ++++++++--------
 src/nact/base-window.c           |    2 +-
 src/nact/nact-assistant-export.c |   34 +++++++++++++++++-----------------
 src/nact/nact-assistant-import.c |    4 ++--
 src/nact/nact-icon-chooser.c     |    2 +-
 src/nact/nact-tree-view.c        |    4 ++--
 9 files changed, 51 insertions(+), 36 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 20be08d..adf80b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,19 @@
 	* src/nact/nact-application.c:
 	* src/nact/nact-application.h (nact_application_new): Have an empty constructor.
 
+2011-12-25 Pierre Wieser <pwieser trychlos org>
+
+	* src/core/na-gtk-utils.c:
+	* src/core/na-gtk-utils.h
+	(na_gtk_utils_search_for_child_widget): Renamed as na_gtk_utils_find_widget_by_name().
+
+	* src/core/na-importer-ask.c:
+	* src/nact/base-window.c:
+	* src/nact/nact-assistant-export.c:
+	* src/nact/nact-assistant-import.c:
+	* src/nact/nact-icon-chooser.c:
+	* src/nact/nact-tree-view.c: Updated accordingly.
+
 2011-12-23 Pierre Wieser <pwieser trychlos org>
 
 	* src/core/na-gtk-utils.c:
diff --git a/src/core/na-gtk-utils.c b/src/core/na-gtk-utils.c
index d707d02..c49429d 100644
--- a/src/core/na-gtk-utils.c
+++ b/src/core/na-gtk-utils.c
@@ -73,14 +73,14 @@ na_gtk_utils_find_widget_by_type( GtkContainer *container, GType type )
 }
 
 /*
- * na_gtk_utils_search_for_child_widget:
+ * na_gtk_utils_find_widget_by_name:
  * @container: a #GtkContainer, usually the #GtkWindow toplevel.
  * @name: the name of the searched widget.
  *
  * Returns: the searched widget.
  */
 GtkWidget *
-na_gtk_utils_search_for_child_widget( GtkContainer *container, const gchar *name )
+na_gtk_utils_find_widget_by_name( GtkContainer *container, const gchar *name )
 {
 	GList *children = gtk_container_get_children( container );
 	GList *ic;
@@ -101,7 +101,7 @@ na_gtk_utils_search_for_child_widget( GtkContainer *container, const gchar *name
 					break;
 
 				} else if( GTK_IS_CONTAINER( child )){
-					found = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( child ), name );
+					found = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( child ), name );
 				}
 			}
 		}
diff --git a/src/core/na-gtk-utils.h b/src/core/na-gtk-utils.h
index e3b929d..7346283 100644
--- a/src/core/na-gtk-utils.h
+++ b/src/core/na-gtk-utils.h
@@ -40,8 +40,10 @@
 
 G_BEGIN_DECLS
 
-GtkWidget *na_gtk_utils_find_widget_by_type    ( GtkContainer *container, GType type );
-GtkWidget *na_gtk_utils_search_for_child_widget( GtkContainer *container, const gchar *name );
+/* widget hierarchy
+ */
+GtkWidget *na_gtk_utils_find_widget_by_name( GtkContainer *container, const gchar *name );
+GtkWidget *na_gtk_utils_find_widget_by_type( GtkContainer *container, GType type );
 
 #ifdef NA_MAINTAINER_MODE
 void       na_gtk_utils_dump_children          ( GtkContainer *container );
diff --git a/src/core/na-importer-ask.c b/src/core/na-importer-ask.c
index 216cb34..30a95a7 100644
--- a/src/core/na-importer-ask.c
+++ b/src/core/na-importer-ask.c
@@ -349,27 +349,27 @@ init_dialog( NAImporterAsk *editor )
 				imported_label, editor->private->parms->uri, existing_label );
 	}
 
-	widget = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( editor->private->toplevel ), "ImporterAskLabel" );
+	widget = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( editor->private->toplevel ), "ImporterAskLabel" );
 	gtk_label_set_text( GTK_LABEL( widget ), label );
 	g_free( label );
 
 	switch( editor->private->mode ){
 		case IMPORTER_MODE_RENUMBER:
-			button = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( editor->private->toplevel ), "AskRenumberButton" );
+			button = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( editor->private->toplevel ), "AskRenumberButton" );
 			break;
 
 		case IMPORTER_MODE_OVERRIDE:
-			button = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( editor->private->toplevel ), "AskOverrideButton" );
+			button = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( editor->private->toplevel ), "AskOverrideButton" );
 			break;
 
 		case IMPORTER_MODE_NO_IMPORT:
 		default:
-			button = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( editor->private->toplevel ), "AskNoImportButton" );
+			button = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( editor->private->toplevel ), "AskNoImportButton" );
 			break;
 	}
 	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), TRUE );
 
-	button = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( editor->private->toplevel ), "AskKeepChoiceButton" );
+	button = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( editor->private->toplevel ), "AskKeepChoiceButton" );
 	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), editor->private->parms->keep_choice );
 
 	na_gtk_utils_restore_window_position( editor->private->toplevel, NA_IPREFS_IMPORT_ASK_USER_WSP );
@@ -385,12 +385,12 @@ get_selected_mode( NAImporterAsk *editor )
 
 	import_mode = IMPORTER_MODE_NO_IMPORT;
 
-	button = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( editor->private->toplevel ), "AskRenumberButton" );
+	button = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( editor->private->toplevel ), "AskRenumberButton" );
 	if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ))){
 		import_mode = IMPORTER_MODE_RENUMBER;
 
 	} else {
-		button = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( editor->private->toplevel ), "AskOverrideButton" );
+		button = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( editor->private->toplevel ), "AskOverrideButton" );
 		if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ))){
 			import_mode = IMPORTER_MODE_OVERRIDE;
 		}
@@ -399,7 +399,7 @@ get_selected_mode( NAImporterAsk *editor )
 	editor->private->mode = import_mode;
 	na_iprefs_set_import_mode( NA_IPREFS_IMPORT_ASK_USER_LAST_MODE, editor->private->mode );
 
-	button = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( editor->private->toplevel ), "AskKeepChoiceButton" );
+	button = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( editor->private->toplevel ), "AskKeepChoiceButton" );
 	keep = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ));
 	na_settings_set_boolean( NA_IPREFS_IMPORT_ASK_USER_KEEP_LAST_CHOICE, keep );
 }
diff --git a/src/nact/base-window.c b/src/nact/base-window.c
index 00ee3ef..6055934 100644
--- a/src/nact/base-window.c
+++ b/src/nact/base-window.c
@@ -1093,7 +1093,7 @@ base_window_get_widget( const BaseWindow *window, const gchar *name )
 
 	if( !window->private->dispose_has_run ){
 
-		widget = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( window->private->gtk_toplevel ), name );
+		widget = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( window->private->gtk_toplevel ), name );
 	}
 
 	return( widget );
diff --git a/src/nact/nact-assistant-export.c b/src/nact/nact-assistant-export.c
index a716f00..863dc57 100644
--- a/src/nact/nact-assistant-export.c
+++ b/src/nact/nact-assistant-export.c
@@ -271,7 +271,7 @@ instance_dispose( GObject *window )
 
 		assistant = GTK_ASSISTANT( base_window_get_gtk_toplevel( BASE_WINDOW( window )));
 		page = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_ACTIONS_SELECTION );
-		pane = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( page ), "p1-HPaned" );
+		pane = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( page ), "p1-HPaned" );
 		pos = gtk_paned_get_position( GTK_PANED( pane ));
 		na_settings_set_uint( NA_IPREFS_EXPORT_ASSISTANT_PANED, pos );
 
@@ -348,7 +348,7 @@ on_base_initialize_gtk_toplevel( NactAssistantExport *window, GtkAssistant *assi
 				thisfn, ( void * ) window, ( void * ) assistant, ( void * ) user_data );
 
 		page = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_ACTIONS_SELECTION );
-		widget = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( page ), "ActionsList" );
+		widget = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( page ), "ActionsList" );
 		base_window_signal_connect(
 				BASE_WINDOW( window ),
 				G_OBJECT( widget ),
@@ -360,7 +360,7 @@ on_base_initialize_gtk_toplevel( NactAssistantExport *window, GtkAssistant *assi
 						GTK_CONTAINER( page ), "ActionsList", TREE_MODE_SELECTION );
 
 		page = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_FOLDER_SELECTION );
-		widget = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( page ), "p2-ExportFolderChooser" );
+		widget = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( page ), "p2-ExportFolderChooser" );
 		base_window_signal_connect(
 				BASE_WINDOW( window ),
 				G_OBJECT( widget ),
@@ -368,7 +368,7 @@ on_base_initialize_gtk_toplevel( NactAssistantExport *window, GtkAssistant *assi
 				G_CALLBACK( on_folder_chooser_realized ));
 
 		page = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_FORMAT_SELECTION );
-		widget = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( page ), "p3-ExportFormatTreeView" );
+		widget = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( page ), "p3-ExportFormatTreeView" );
 		base_window_signal_connect(
 				BASE_WINDOW( window ),
 				G_OBJECT( widget ),
@@ -382,23 +382,23 @@ on_base_initialize_gtk_toplevel( NactAssistantExport *window, GtkAssistant *assi
 		guint padder = 8;
 		/* selecting items */
 		page = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_ACTIONS_SELECTION );
-		GtkWidget *container = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( page ), "p1-l2-alignment1" );
+		GtkWidget *container = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( page ), "p1-l2-alignment1" );
 		g_object_set( G_OBJECT( container ), "border_width", padder, NULL );
 		/* selecting target folder */
 		page = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_FOLDER_SELECTION );
-		container = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( page ), "p2-l2-alignment1" );
+		container = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( page ), "p2-l2-alignment1" );
 		g_object_set( G_OBJECT( container ), "top_padding", padder, NULL );
 		/* choosing export format */
 		page = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_FORMAT_SELECTION );
-		container = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( page ), "p3-l2-alignment1" );
+		container = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( page ), "p3-l2-alignment1" );
 		g_object_set( G_OBJECT( container ), "border_width", padder, NULL );
 		/* summary */
 		page = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_CONFIRM );
-		container = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( page ), "p4-l2-alignment1" );
+		container = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( page ), "p4-l2-alignment1" );
 		g_object_set( G_OBJECT( container ), "border_width", padder, NULL );
 		/* import is done */
 		page = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_DONE );
-		container = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( page ), "p5-l2-alignment1" );
+		container = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( page ), "p5-l2-alignment1" );
 		g_object_set( G_OBJECT( container ), "border_width", padder, NULL );
 #endif
 	}
@@ -525,7 +525,7 @@ on_base_initialize_base_window( NactAssistantExport *window, gpointer user_data
 		pos = na_settings_get_uint( NA_IPREFS_EXPORT_ASSISTANT_PANED, NULL, NULL );
 		if( pos ){
 			page = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_ACTIONS_SELECTION );
-			pane = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( page ), "p1-HPaned" );
+			pane = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( page ), "p1-HPaned" );
 			gtk_paned_set_position( GTK_PANED( pane ), pos );
 		}
 	}
@@ -644,7 +644,7 @@ get_export_format_treeview( NactAssistantExport *window )
 {
 	GtkAssistant *assistant = GTK_ASSISTANT( base_window_get_gtk_toplevel( BASE_WINDOW( window )));
 	GtkWidget *page = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_FORMAT_SELECTION );
-	return( na_gtk_utils_search_for_child_widget( GTK_CONTAINER( page ), "p3-ExportFormatTreeView" ));
+	return( na_gtk_utils_find_widget_by_name( GTK_CONTAINER( page ), "p3-ExportFormatTreeView" ));
 }
 
 static void
@@ -691,7 +691,7 @@ assist_prepare_confirm( NactAssistantExport *window, GtkAssistant *assistant, Gt
 	 * not happen immediately - We have to wait until Gtk 3.0, most probably due
 	 * to the new width-for-height and height-for-width features...
 	 */
-	GtkWidget *vbox = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( page ), "p4-ConfirmVBox" );
+	GtkWidget *vbox = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( page ), "p4-ConfirmVBox" );
 	gtk_container_set_resize_mode( GTK_CONTAINER( vbox ), GTK_RESIZE_IMMEDIATE );
 #endif
 
@@ -709,7 +709,7 @@ assist_prepare_confirm( NactAssistantExport *window, GtkAssistant *assistant, Gt
 		}
 		g_free( label_item );
 	}
-	label = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( page ), "p4-ConfirmItemsList" );
+	label = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( page ), "p4-ConfirmItemsList" );
 	g_return_if_fail( GTK_IS_LABEL( label ));
 	gtk_label_set_text( GTK_LABEL( label ), text );
 	g_free( text );
@@ -717,7 +717,7 @@ assist_prepare_confirm( NactAssistantExport *window, GtkAssistant *assistant, Gt
 	/* display the target folder
 	 */
 	g_assert( window->private->uri && strlen( window->private->uri ));
-	label = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( page ), "p4-ConfirmTargetFolder" );
+	label = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( page ), "p4-ConfirmTargetFolder" );
 	g_return_if_fail( GTK_IS_LABEL( label ));
 	gtk_label_set_text( GTK_LABEL( label ), window->private->uri );
 
@@ -728,7 +728,7 @@ assist_prepare_confirm( NactAssistantExport *window, GtkAssistant *assistant, Gt
 	format_label = na_export_format_get_label( format );
 	format_label2 = na_core_utils_str_remove_char( format_label, "_" );
 	text = g_strdup_printf( "%s:", format_label2 );
-	label = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( page ), "p4-ConfirmExportFormat" );
+	label = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( page ), "p4-ConfirmExportFormat" );
 	g_return_if_fail( GTK_IS_LABEL( label ));
 	gtk_label_set_text( GTK_LABEL( label ), text );
 	g_free( format_label );
@@ -737,7 +737,7 @@ assist_prepare_confirm( NactAssistantExport *window, GtkAssistant *assistant, Gt
 
 	format_description = na_export_format_get_description( format );
 	format_description2 = na_core_utils_str_remove_char( format_description, "_" );
-	label = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( page ), "p4-ConfirmExportTooltip" );
+	label = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( page ), "p4-ConfirmExportTooltip" );
 	g_return_if_fail( GTK_IS_LABEL( label ));
 	gtk_label_set_text( GTK_LABEL( label ), format_description2 );
 	g_free( format_description );
@@ -821,7 +821,7 @@ assist_prepare_exportdone( NactAssistantExport *window, GtkAssistant *assistant,
 
 	errors = 0;
 	width = 15;
-	vbox = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( page ), "p5-SummaryVBox" );
+	vbox = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( page ), "p5-SummaryVBox" );
 	g_return_if_fail( GTK_IS_BOX( vbox ));
 
 #if !GTK_CHECK_VERSION( 3,0,0 )
diff --git a/src/nact/nact-assistant-import.c b/src/nact/nact-assistant-import.c
index 556545f..8b3c25c 100644
--- a/src/nact/nact-assistant-import.c
+++ b/src/nact/nact-assistant-import.c
@@ -458,7 +458,7 @@ runtime_init_file_selector( NactAssistantImport *window, GtkAssistant *assistant
 	page = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_FILES_SELECTION );
 	g_return_if_fail( GTK_IS_CONTAINER( page ));
 
-	chooser = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( page ), "ImportFileChooser" );
+	chooser = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( page ), "ImportFileChooser" );
 	g_return_if_fail( GTK_IS_FILE_CHOOSER( chooser ));
 
 	g_debug( "%s: window=%p, assistant=%p, page=%p, chooser=%p",
@@ -987,7 +987,7 @@ find_widget_from_page( GtkWidget *page, const gchar *name )
 
 	g_return_val_if_fail( GTK_IS_CONTAINER( page ), NULL );
 
-	widget = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( page ), name );
+	widget = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( page ), name );
 
 	return( widget );
 }
diff --git a/src/nact/nact-icon-chooser.c b/src/nact/nact-icon-chooser.c
index 4721490..30f5be5 100644
--- a/src/nact/nact-icon-chooser.c
+++ b/src/nact/nact-icon-chooser.c
@@ -599,7 +599,7 @@ on_destroy( GtkWidget *widget, GdkEvent *event, void *foo )
 
 	/* clear the various models
 	 */
-	context_view = GTK_TREE_VIEW( na_gtk_utils_search_for_child_widget( GTK_CONTAINER( widget ), "ThemedTreeView" ));
+	context_view = GTK_TREE_VIEW( na_gtk_utils_find_widget_by_name( GTK_CONTAINER( widget ), "ThemedTreeView" ));
 	context_store = GTK_LIST_STORE( gtk_tree_view_get_model( context_view ));
 
 	if( gtk_tree_model_get_iter_first( GTK_TREE_MODEL( context_store ), &context_iter )){
diff --git a/src/nact/nact-tree-view.c b/src/nact/nact-tree-view.c
index a69820f..1e2e7ec 100644
--- a/src/nact/nact-tree-view.c
+++ b/src/nact/nact-tree-view.c
@@ -703,7 +703,7 @@ on_base_initialize_gtk( BaseWindow *window, GtkWindow *toplevel, gpointer user_d
 		nact_tree_model_new( window, treeview, items_view->private->mode );
 
 		/* associates the ItemsView to the label */
-		label = na_gtk_utils_search_for_child_widget( items_view->private->parent, "ActionsListLabel" );
+		label = na_gtk_utils_find_widget_by_name( items_view->private->parent, "ActionsListLabel" );
 		gtk_label_set_mnemonic_widget( GTK_LABEL( label ), GTK_WIDGET( treeview ));
 
 		/* create visible columns on the tree view
@@ -1293,7 +1293,7 @@ get_selected_items( NactTreeView *view )
 static GtkWidget *
 get_tree_view( NactTreeView *items_view )
 {
-	return( na_gtk_utils_search_for_child_widget( items_view->private->parent, items_view->private->widget_name ));
+	return( na_gtk_utils_find_widget_by_name( items_view->private->parent, items_view->private->widget_name ));
 }
 
 static void



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