[nautilus-actions] base_gtk_utils_get_widget_by_name() is replaced by na_gtk_utils_search_for_child_widget()
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] base_gtk_utils_get_widget_by_name() is replaced by na_gtk_utils_search_for_child_widget()
- Date: Fri, 25 Feb 2011 01:07:36 +0000 (UTC)
commit 2881185a33e7a4e9c25d037830ea3428cf121afd
Author: Pierre Wieser <pwieser trychlos org>
Date: Fri Feb 25 02:05:40 2011 +0100
base_gtk_utils_get_widget_by_name() is replaced by na_gtk_utils_search_for_child_widget()
src/core/na-gtk-utils.h | 2 +-
src/core/na-iabout.c | 270 ------------------------------------------
src/core/na-iabout.h | 89 --------------
src/nact/base-gtk-utils.c | 64 ----------
src/nact/base-gtk-utils.h | 4 -
src/nact/base-window.c | 4 +-
src/nact/nact-icon-chooser.c | 4 +-
7 files changed, 7 insertions(+), 430 deletions(-)
---
diff --git a/src/core/na-gtk-utils.h b/src/core/na-gtk-utils.h
index a0d0e35..b291867 100644
--- a/src/core/na-gtk-utils.h
+++ b/src/core/na-gtk-utils.h
@@ -33,7 +33,7 @@
/* @title: GTK+
* @short_description: The Gtk+ Library Utilities.
- * @include: nautilus-action/na-core-utils.h
+ * @include: core/na-gtk-utils.h
*/
#include <gtk/gtk.h>
diff --git a/src/nact/base-gtk-utils.c b/src/nact/base-gtk-utils.c
index c400392..c3840cb 100644
--- a/src/nact/base-gtk-utils.c
+++ b/src/nact/base-gtk-utils.c
@@ -54,8 +54,6 @@ static void int_list_to_position( const BaseWindow *window, GList *list,
static GList *position_to_int_list( const BaseWindow *window, gint x, gint y, gint width, gint height );
static void free_int_list( GList *list );
-static GtkWidget *search_for_child_widget( GtkContainer *container, const gchar *name );
-
/**
* base_gtk_utils_position_window:
* @window: this #BaseWindow-derived window.
@@ -743,65 +741,3 @@ base_gtk_utils_select_dir( BaseWindow *window,
gtk_widget_destroy( dialog );
}
-
-/**
- * base_gtk_utils_get_widget_by_name:
- * @toplevel: the #GtkWindow toplevel.
- * @name: the name of the searched child.
- *
- * Returns: a pointer to the named widget which is a child of @toplevel,
- * or %NULL. the returned pointer is owned by #GtkBuilder instance, and
- * should not be released by the caller.
- */
-GtkWidget *
-base_gtk_utils_get_widget_by_name( GtkWindow *toplevel, const gchar *name )
-{
- static const gchar *thisfn = "base_gtk_utils_get_widget_by_name";
- GtkWidget *widget = NULL;
-
- g_return_val_if_fail( GTK_IS_WINDOW( toplevel ), NULL );
-
- widget = search_for_child_widget( GTK_CONTAINER( toplevel ), name );
-
- if( !widget ){
- g_warning( "%s: widget not found: %s", thisfn, name );
-
- } else {
- g_return_val_if_fail( GTK_IS_WIDGET( widget ), NULL );
- }
-
- return( widget );
-}
-
-static GtkWidget *
-search_for_child_widget( GtkContainer *container, const gchar *name )
-{
- GList *children = gtk_container_get_children( container );
- GList *ic;
- GtkWidget *found = NULL;
- GtkWidget *child;
- const gchar *child_name;
-
- for( ic = children ; ic ; ic = ic->next ){
- if( GTK_IS_WIDGET( ic->data )){
- child = GTK_WIDGET( ic->data );
- child_name = gtk_buildable_get_name( GTK_BUILDABLE( child ));
- if( child_name && strlen( child_name )){
- /*g_debug( "%s: child=%s", thisfn, child_name );*/
- if( !g_ascii_strcasecmp( name, child_name )){
- found = child;
- break;
-
- } else if( GTK_IS_CONTAINER( child )){
- found = search_for_child_widget( GTK_CONTAINER( child ), name );
- if( found ){
- break;
- }
- }
- }
- }
- }
-
- g_list_free( children );
- return( found );
-}
diff --git a/src/nact/base-gtk-utils.h b/src/nact/base-gtk-utils.h
index 7bd8e53..32e3ec9 100644
--- a/src/nact/base-gtk-utils.h
+++ b/src/nact/base-gtk-utils.h
@@ -83,10 +83,6 @@ void base_gtk_utils_select_dir( BaseWindow *window,
const gchar *title, const gchar *wsp_name,
GtkWidget *entry, const gchar *entry_name );
-/* GtkWidget
- */
-GtkWidget *base_gtk_utils_get_widget_by_name( GtkWindow *toplevel, const gchar *name );
-
G_END_DECLS
#endif /* __BASE_GTK_UTILS_H__ */
diff --git a/src/nact/base-window.c b/src/nact/base-window.c
index 5aa7213..301582a 100644
--- a/src/nact/base-window.c
+++ b/src/nact/base-window.c
@@ -36,6 +36,8 @@
#include <stdlib.h>
#include <string.h>
+#include <core/na-gtk-utils.h>
+
#include "base-application.h"
#include "base-window.h"
#include "base-gtk-utils.h"
@@ -1068,7 +1070,7 @@ base_window_get_widget( const BaseWindow *window, const gchar *name )
if( !window->private->dispose_has_run ){
- widget = base_gtk_utils_get_widget_by_name( window->private->gtk_toplevel, name );
+ widget = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( window->private->gtk_toplevel ), name );
}
return( widget );
diff --git a/src/nact/nact-icon-chooser.c b/src/nact/nact-icon-chooser.c
index 061e59a..ecc5290 100644
--- a/src/nact/nact-icon-chooser.c
+++ b/src/nact/nact-icon-chooser.c
@@ -32,6 +32,8 @@
#include <config.h>
#endif
+#include <core/na-gtk-utils.h>
+
#include "base-keysyms.h"
#include "nact-application.h"
#include "base-gtk-utils.h"
@@ -614,7 +616,7 @@ on_destroy( GtkWidget *widget, GdkEvent *event, void *foo )
/* clear the various models
*/
- context_view = GTK_TREE_VIEW( base_gtk_utils_get_widget_by_name( GTK_WINDOW( widget ), "ThemedTreeView" ));
+ context_view = GTK_TREE_VIEW( na_gtk_utils_search_for_child_widget( 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 )){
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]