[gthumb] allow to give focus to the location chooser



commit 0a0a264f573963d34d35da1aabaa2edea3618adb
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Thu Feb 25 11:33:19 2010 +0100

    allow to give focus to the location chooser

 gthumb/gth-location-chooser.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/gthumb/gth-location-chooser.c b/gthumb/gth-location-chooser.c
index 0b07d08..09c4281 100644
--- a/gthumb/gth-location-chooser.c
+++ b/gthumb/gth-location-chooser.c
@@ -95,17 +95,29 @@ gth_location_chooser_finalize (GObject *object)
 	G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
+static void
+gth_location_chooser_grab_focus (GtkWidget *widget)
+{
+	GthLocationChooser *chooser = GTH_LOCATION_CHOOSER (widget);
+
+	gtk_widget_grab_focus (chooser->priv->combo);
+}
+
 
 static void
 gth_location_chooser_class_init (GthLocationChooserClass *class)
 {
-	GObjectClass *object_class;
+	GObjectClass   *object_class;
+	GtkWidgetClass *widget_class;
 
 	parent_class = g_type_class_peek_parent (class);
-	object_class = (GObjectClass*) class;
 
+	object_class = (GObjectClass*) class;
 	object_class->finalize = gth_location_chooser_finalize;
 
+	widget_class = (GtkWidgetClass *) class;
+	widget_class->grab_focus = gth_location_chooser_grab_focus;
+
 	gth_location_chooser_signals[CHANGED] =
 		g_signal_new ("changed",
 			      G_TYPE_FROM_CLASS (class),
@@ -121,6 +133,7 @@ gth_location_chooser_class_init (GthLocationChooserClass *class)
 static void
 gth_location_chooser_init (GthLocationChooser *chooser)
 {
+	GTK_WIDGET_SET_FLAGS (chooser, GTK_CAN_FOCUS);
 	chooser->priv = g_new0 (GthLocationChooserPrivate, 1);
 }
 



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