[nautilus-actions] Define new base_window_peek_widget() function



commit d4ca43f00cb11f1af200c82a2d5f8a2a151fdaf7
Author: Pierre <pierre vfedora13 virtuals pwi>
Date:   Wed Jan 12 15:50:30 2011 +0100

    Define new base_window_peek_widget() function

 ChangeLog              |    3 +++
 src/nact/base-window.c |   28 +++++++++++++++++++++++++++-
 src/nact/base-window.h |    1 +
 3 files changed, 31 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4409ab8..6c3f70c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -35,6 +35,9 @@
 
 	* run-autogen.sh: Add sysconfdir argument to autogen.sh
 
+	* src/nact/base-window.c:
+	* src/nact/base-window.h (base_window_peek_widget): New function.
+
 	* src/nact/nact-icon-chooser.c:
 	* src/nact/nact-icon-chooser.h:
 	* src/nact/nact-icon-chooser.ui: New files.
diff --git a/src/nact/base-window.c b/src/nact/base-window.c
index 06b2e46..e39647b 100644
--- a/src/nact/base-window.c
+++ b/src/nact/base-window.c
@@ -823,6 +823,7 @@ base_window_get_toplevel( const BaseWindow *window )
 GtkWidget *
 base_window_get_widget( const BaseWindow *window, const gchar *name )
 {
+	static const gchar *thisfn = "base_window_get_widget";
 	GtkWindow *toplevel;
 	GtkWidget *widget = NULL;
 
@@ -832,7 +833,7 @@ base_window_get_widget( const BaseWindow *window, const gchar *name )
 		toplevel = window->private->toplevel_window;
 		widget = search_for_widget( toplevel, name );
 		if( !widget ){
-			g_warning( "%s: widget not found", name );
+			g_warning( "%s: widget not found: %s", thisfn, name );
 		}
 	}
 
@@ -840,6 +841,31 @@ base_window_get_widget( const BaseWindow *window, const gchar *name )
 }
 
 /**
+ * base_window_peek_widget:
+ * @window: the #GtkWindow toplevel.
+ * @name: the name of the searched child.
+ *
+ * Returns: a pointer to the searched widget, or %NULL.
+ * This pointer is owned by GtkBuilder instance, and must not be
+ * released by the caller.
+ */
+GtkWidget *
+base_window_peek_widget( GtkWindow *window, const gchar *name )
+{
+	static const gchar *thisfn = "base_window_peek_widget";
+	GtkWidget *widget;
+
+	g_return_val_if_fail( GTK_IS_WINDOW( window ), NULL );
+
+	widget = search_for_widget( window, name );
+	if( !widget ){
+		g_warning( "%s: widget not found: %s", thisfn, name );
+	}
+
+	return( widget );
+}
+
+/**
  * base_window_is_willing_to_quit:
  * @window: this #BaseWindow instance.
  *
diff --git a/src/nact/base-window.h b/src/nact/base-window.h
index e9641aa..33c0c4b 100644
--- a/src/nact/base-window.h
+++ b/src/nact/base-window.h
@@ -82,6 +82,7 @@ GtkWindow       *base_window_get_named_toplevel( const BaseWindow *window, const
 BaseWindow      *base_window_get_parent( const BaseWindow *window );
 GtkWindow       *base_window_get_toplevel( const BaseWindow *window );
 GtkWidget       *base_window_get_widget( const BaseWindow *window, const gchar *name );
+GtkWidget       *base_window_peek_widget( GtkWindow *window, const gchar *name );
 gboolean         base_window_is_willing_to_quit( const BaseWindow *window );
 
 void             base_window_error_dlg( const BaseWindow *window, GtkMessageType type, const gchar *primary, const gchar *secondary );



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