[maemo-commits] [maemo-commits] r11987 - in projects/haf/trunk/hildon-1: . src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed May 30 15:43:47 EEST 2007
Author: mdk
Date: 2007-05-30 15:43:46 +0300 (Wed, 30 May 2007)
New Revision: 11987

Modified:
   projects/haf/trunk/hildon-1/ChangeLog
   projects/haf/trunk/hildon-1/src/hildon-caption.c
Log:
Implementing the proper focus grabbing in the HildonCaption. Fixes NB#52379. 


Modified: projects/haf/trunk/hildon-1/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-1/ChangeLog	2007-05-30 12:03:14 UTC (rev 11986)
+++ projects/haf/trunk/hildon-1/ChangeLog	2007-05-30 12:43:46 UTC (rev 11987)
@@ -1,3 +1,8 @@
+2007-05-30  Michael Dominic Kostrzewa  <michael.kostrzewa at nokia.com> 
+
+	* src/hildon-caption.c: Implementing the proper focus grabbing in the
+	HildonCaption. Fixes NB#52379. 
+
 2007-05-30  Xan Lopez  <xan.lopez at nokia.com>
 
 	* src/hildon-bread-crumb-trail.c (crumb_activated_cb): be very paranoid about
@@ -6,7 +11,7 @@
 	is removed and the user still lets the default handler run. This would segfault
 	previously.
 
-2007-05-28  Michael Dominic K.  <michael.kostrzewa at nokia.com> 
+2007-05-28  Michael Dominic Kostrzewa  <michael.kostrzewa at nokia.com> 
 
 	* src/hildon-font-selection-dialog.c: When the font is really big, add the
 	scrollbar to the preview dialog. Fixes NB#54147.

Modified: projects/haf/trunk/hildon-1/src/hildon-caption.c
===================================================================
--- projects/haf/trunk/hildon-1/src/hildon-caption.c	2007-05-30 12:03:14 UTC (rev 11986)
+++ projects/haf/trunk/hildon-1/src/hildon-caption.c	2007-05-30 12:43:46 UTC (rev 11987)
@@ -92,6 +92,9 @@
                                                  GtkWidget *caption);
 
 static void 
+hildon_caption_grab_focus                       (GtkWidget *widget);
+
+static void 
 hildon_caption_activate                         (GtkWidget *widget);
 
 static void
@@ -213,6 +216,7 @@
     widget_class->size_request                  = hildon_caption_size_request;
     widget_class->size_allocate                 = hildon_caption_size_allocate;
     widget_class->button_press_event            = hildon_caption_button_press;
+    widget_class->grab_focus                    = hildon_caption_grab_focus;
 
     /* Create new signals and properties */
     widget_class->activate_signal = g_signal_new ("activate",
@@ -576,27 +580,9 @@
     g_assert (priv);
     GtkWidget *child = GTK_BIN (widget)->child;
 
-    /* nothing to do */
-    if (priv->is_focused == TRUE)
-        return FALSE;
+    priv->is_focused = TRUE;
+    gtk_widget_grab_focus (GTK_BIN (widget)->child);
 
-    /* If child can take focus, we simply grab focus to it */
-    if ((GTK_WIDGET_CAN_FOCUS (child) || GTK_IS_CONTAINER (child)) &&
-            GTK_WIDGET_IS_SENSITIVE (child))
-    {
-        /* Only if container can be focusable we must set is_focused to TRUE */ 
-        if (GTK_IS_CONTAINER (child))
-        {
-            if (gtk_widget_child_focus (child, GTK_DIR_TAB_FORWARD))
-                priv->is_focused = TRUE;
-        }
-        else
-        {
-            priv->is_focused = TRUE;
-            gtk_widget_grab_focus (GTK_BIN (widget)->child);
-        }
-    }
-
     return FALSE;
 }
 
@@ -1159,6 +1145,12 @@
     gtk_widget_grab_focus (child);
 }
 
+static void
+hildon_caption_grab_focus                       (GtkWidget *widget)
+{
+    gtk_widget_grab_focus (GTK_BIN (widget)->child);
+}
+
 /**
  * hildon_caption_set_child_expand:
  * @caption : a #HildonCaption


More information about the maemo-commits mailing list