Added management for the grab-focus to a child widget, like a range, we need to fade...
authorAlejandro G. Castro <alex@igalia.com>
Tue, 26 Aug 2008 10:56:03 +0000 (10:56 +0000)
committerAlejandro G. Castro <alex@igalia.com>
Tue, 26 Aug 2008 10:56:03 +0000 (10:56 +0000)
* src/hildon-pannable-area.c,
(hildon_pannable_area_init): Connected the grab-focus signal to
the callback.
(hildon_pannable_area_grab_notify): Added this function in order
to manage the situation when the grab-focus ends. We have to
fade-out the scrollbar.

ChangeLog
src/hildon-pannable-area.c

index 555fec5..031c57e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2008-08-26  Alejandro G. Castro         <alex@igalia.com>
+
+       Added management for the grab-focus to a child widget, like a
+       range, we need to fade out the scrollbar when releasing.
+
+       * src/hildon-pannable-area.c,
+       (hildon_pannable_area_init): Connected the grab-focus signal to
+       the callback.
+       (hildon_pannable_area_grab_notify): Added this function in order
+       to manage the situation when the grab-focus ends. We have to
+       fade-out the scrollbar.
+
 2008-08-25  Alberto Garcia  <agarcia@igalia.com>
 
        * src/hildon-app-menu.c: Minor documentation update.
index 113bc87..5f4ba4f 100644 (file)
@@ -160,6 +160,9 @@ static void hildon_pannable_area_style_set (GtkWidget * widget,
                                             GtkStyle * previous_style);
 static void hildon_pannable_area_map (GtkWidget * widget);
 static void hildon_pannable_area_unmap (GtkWidget * widget);
+static void hildon_pannable_area_grab_notify (GtkWidget *widget,
+                                              gboolean was_grabbed,
+                                              gpointer user_data);
 static void rgb_from_gdkcolor (GdkColor *color, gdouble *r, gdouble *g, gdouble *b);
 static void hildon_pannable_draw_vscroll (GtkWidget * widget,
                                           GdkColor *back_color,
@@ -453,6 +456,8 @@ hildon_pannable_area_init (HildonPannableArea * area)
                            G_CALLBACK (hildon_pannable_area_redraw), area);
   g_signal_connect_swapped (G_OBJECT (priv->vadjust), "value-changed",
                            G_CALLBACK (hildon_pannable_area_redraw), area);
+  g_signal_connect (G_OBJECT (area), "grab-notify",
+                    G_CALLBACK (hildon_pannable_area_grab_notify), NULL);
 }
 
 static void
@@ -808,6 +813,30 @@ hildon_pannable_area_unmap (GtkWidget * widget)
 }
 
 static void
+hildon_pannable_area_grab_notify (GtkWidget *widget,
+                                  gboolean was_grabbed,
+                                  gpointer user_data)
+{
+  /* an internal widget has grabbed the focus and now has returned it,
+     we have to do some release actions */
+  if (was_grabbed) {
+    HildonPannableAreaPrivate *priv = PANNABLE_AREA_PRIVATE (widget);
+
+    priv->scroll_indicator_event_interrupt = 0;
+    priv->scroll_delay_counter = SCROLLBAR_FADE_DELAY;
+
+    if (!priv->scroll_indicator_timeout) {
+      priv->scroll_indicator_timeout = g_timeout_add
+        ((gint) (1000.0 / (gdouble) priv->sps),
+         (GSourceFunc) hildon_pannable_area_scroll_indicator_fade, widget);
+    }
+
+    priv->last_type = 3;
+    priv->moved = FALSE;
+  }
+}
+
+static void
 rgb_from_gdkcolor (GdkColor *color, gdouble *r, gdouble *g, gdouble *b)
 {
   *r = (color->red >> 8) / 255.0;