2006-09-19 Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
authorMichael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
Tue, 19 Sep 2006 10:29:51 +0000 (10:29 +0000)
committerMichael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
Tue, 19 Sep 2006 10:29:51 +0000 (10:29 +0000)
* hildon-widgets/hildon-time-editor.c:
(hildon_time_editor_entry_clicked): This function has been
removed. It is not needed any more.
(_hildon_time_editor_entry_select_all): Added in order to perform
the whole text selection into the entry with an idle call.
(hildon_time_editor_entry_focusin): Modified to just add the
function above to the idle queue.
Fixes #NB40665.

* hildon-widgets/hildon-caption.c (hildon_caption_button_press):
Added condition to return when the widget has already the focus.
Fixes #NB31086.

ChangeLog
hildon-widgets/hildon-caption.c
hildon-widgets/hildon-time-editor.c

index 298653b..0732199 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
 2006-09-19  Michael Dominic Kostrzewa  <michael.kostrzewa@nokia.com> 
 
+       * hildon-widgets/hildon-time-editor.c:
+       (hildon_time_editor_entry_clicked): This function has been
+       removed. It is not needed any more.
+       (_hildon_time_editor_entry_select_all): Added in order to perform
+       the whole text selection into the entry with an idle call.
+       (hildon_time_editor_entry_focusin): Modified to just add the
+       function above to the idle queue.
+       Fixes #NB40665.
+
+       * hildon-widgets/hildon-caption.c (hildon_caption_button_press):
+       Added condition to return when the widget has already the focus.
+       Fixes #NB31086. 
+
+2006-09-19  Michael Dominic Kostrzewa  <michael.kostrzewa@nokia.com> 
+
        * hildon-widgets/hildon-color-button.c: Draw insensitive grid over the
        color button widget if the widget is insensitive. Fixes #NB40329. 
 
index bc2183b..afd756e 100644 (file)
@@ -511,6 +511,10 @@ static gboolean hildon_caption_button_press( GtkWidget *widget,
   HildonCaptionPrivate *priv = HILDON_CAPTION_GET_PRIVATE(widget);
   GtkWidget *child = GTK_BIN(widget)->child;
 
+  /* nothing to do */
+  if (priv->is_focused == TRUE)
+    return;
+
   /* 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))
index e3513cb..f030b29 100644 (file)
@@ -213,10 +213,6 @@ static gboolean hildon_time_editor_ampm_clicked(GtkWidget       *widget,
 static gboolean hildon_time_editor_icon_clicked(GtkWidget       *widget,
                                                 gpointer         data);
 
-static gboolean hildon_time_editor_entry_clicked(GtkWidget      *widget,
-                                                 GdkEventButton *event,
-                                                 gpointer        data);
-
 static void     hildon_time_editor_size_request(GtkWidget       *widget,
                                                 GtkRequisition  *requisition);
 
@@ -243,6 +239,10 @@ hildon_time_editor_validate (HildonTimeEditor *editor, gboolean allow_intermedia
 
 static void hildon_time_editor_set_to_current_time (HildonTimeEditor * editor);
 
+static gboolean
+_hildon_time_editor_entry_select_all(GtkWidget *widget);
+
+
 /***
  * Utility functions
  */
@@ -520,9 +520,6 @@ static void hildon_time_editor_init(HildonTimeEditor * editor)
       gtk_entry_set_max_length  (GTK_ENTRY(priv->entries[i]), 2);
       gtk_entry_set_width_chars (GTK_ENTRY(priv->entries[i]), 2);
 
-      /* Connect signals */
-      g_signal_connect(priv->entries[i], "button-release-event",
-                       G_CALLBACK(hildon_time_editor_entry_clicked), editor);
       g_signal_connect(priv->entries[i], "focus-in-event",
                        G_CALLBACK(hildon_time_editor_entry_focusin), editor);
       g_signal_connect(priv->entries[i], "focus-out-event",
@@ -1253,16 +1250,8 @@ static gboolean hildon_time_editor_entry_focusin(GtkWidget * widget,
                                                  GdkEventFocus * event, 
                                                  gpointer data)
 {
-    /* If we were trying to move away from a field with invalid value,
-       we get moved back to it. Here we want to select the text in the field.
-       The !button check checks that the entry wasn't focused with a mouse
-       click.
-
-       The selection happens temporarily if we got here with left/right
-       keys, but it gets immediately unselected within same call due to some
-       inner entry/clipboard magic. */
-    if (!GTK_ENTRY(widget)->button)
-        gtk_editable_select_region(GTK_EDITABLE(widget), 0, 2);
+    g_idle_add((GSourceFunc) _hildon_time_editor_entry_select_all,
+               GTK_ENTRY(widget));
 
     return FALSE;
 }
@@ -1622,28 +1611,6 @@ hildon_time_editor_icon_clicked(GtkWidget * widget, gpointer data)
     return FALSE;
 }
 
-static gboolean hildon_time_editor_entry_clicked(GtkWidget * widget,
-                                                 GdkEventButton * event,
-                                                 gpointer data)
-{
-    HildonTimeEditor *editor;
-    HildonTimeEditorPrivate *priv;
-
-    editor = HILDON_TIME_EDITOR (data);
-    priv = HILDON_TIME_EDITOR_GET_PRIVATE (editor);
-
-    /* If the focus has been grabbed back before the "clicked"
-     * signal gets processed, don't highlight the text.
-     * This happens when input in one H:M:S field is invalid and we're
-     * trying to move to another field. The focus moves back to the invalid
-     * field.
-     */
-    if (gtk_widget_is_focus (widget))
-        gtk_editable_select_region(GTK_EDITABLE(widget), 0, 2);
-
-    return FALSE;
-}
-
 static void hildon_time_editor_size_request(GtkWidget * widget,
                                             GtkRequisition * requisition)
 {
@@ -1892,3 +1859,13 @@ void hildon_time_editor_enable_duration_mode(HildonTimeEditor * editor,
 {
     hildon_time_editor_set_duration_mode (editor, enable);
 }
+
+/* Idle callback */
+static gboolean
+_hildon_time_editor_entry_select_all (GtkWidget *widget)
+{
+       GDK_THREADS_ENTER ();
+       gtk_editable_select_region(GTK_EDITABLE(widget), 0, -1);
+       GDK_THREADS_LEAVE ();
+       return FALSE;
+}