When realizing the widget, set the window transiency.
[hildon] / src / hildon-helper.c
index 2b5d2c5..22c5af8 100644 (file)
@@ -8,7 +8,7 @@
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
  * as published by the Free Software Foundation; version 2.1 of
- * the License.
+ * the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -235,29 +235,29 @@ hildon_helper_set_logical_font                  (GtkWidget *widget,
 }
 
 static GQuark
-hildon_helper_insensitive_message_quark (void)
+hildon_helper_insensitive_message_quark         (void)
 {
-  static GQuark quark = 0;
+    static GQuark quark = 0;
 
-  if (G_UNLIKELY (quark == 0))
-    quark = g_quark_from_static_string ("hildon-insensitive-message");
+    if (G_UNLIKELY (quark == 0))
+        quark = g_quark_from_static_string ("hildon-insensitive-message");
 
-  return quark;
+    return quark;
 }
 
-
 static void
-show_insensitive_message (GtkWidget *widget, gpointer user_data)
+show_insensitive_message                        (GtkWidget *widget, 
+                                                 gpointer user_data)
 {
-  gchar *message = NULL;
+    gchar *message = NULL;
 
-  g_assert (GTK_IS_WIDGET (widget));
+    g_assert (GTK_IS_WIDGET (widget));
 
-  message = (gchar*) g_object_get_qdata (G_OBJECT (widget),
-                                        hildon_helper_insensitive_message_quark ());
+    message = (gchar*) g_object_get_qdata (G_OBJECT (widget),
+            hildon_helper_insensitive_message_quark ());
 
-  if (message)
-    hildon_banner_show_information (widget, NULL, message);
+    if (message)
+        hildon_banner_show_information (widget, NULL, message);
 }
 
 
@@ -277,19 +277,12 @@ hildon_helper_set_insensitive_message           (GtkWidget *widget,
                                                  const gchar *message)
 {
     g_return_if_fail (GTK_IS_WIDGET (widget));
-    g_return_if_fail (message != NULL);
-
-    gpointer stored_message;
 
     /* Clean up any previous instance of the insensitive message */
     g_signal_handlers_disconnect_matched (G_OBJECT (widget), G_SIGNAL_MATCH_FUNC,
                                          0, 0, NULL,
                                          G_CALLBACK (show_insensitive_message), NULL);
     
-    stored_message = g_object_get_qdata (G_OBJECT (widget), hildon_helper_insensitive_message_quark ());
-    if (stored_message)
-      g_free (stored_message);
-
     /* We need to dup the string because the pointer might not be valid when the
      insensitive-press signal callback is executed */
     g_object_set_qdata_full (G_OBJECT (widget), hildon_helper_insensitive_message_quark (), 
@@ -313,22 +306,22 @@ hildon_helper_set_insensitive_message           (GtkWidget *widget,
  **/
 
 void
-hildon_helper_set_insensitive_messagef        (GtkWidget *widget,
-                                              const gchar *format,
-                                              ...)
+hildon_helper_set_insensitive_messagef          (GtkWidget *widget,
+                                                 const gchar *format,
+                                                 ...)
 {
-  g_return_if_fail (GTK_IS_WIDGET (widget));
+    g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  gchar *message;
-  va_list args;
+    gchar *message;
+    va_list args;
 
-  va_start (args, format);
-  message = g_strdup_vprintf (format, args);
-  va_end (args);
+    va_start (args, format);
+    message = g_strdup_vprintf (format, args);
+    va_end (args);
 
-  hildon_helper_set_insensitive_message (widget, message);
+    hildon_helper_set_insensitive_message (widget, message);
 
-  g_free (message);
+    g_free (message);
 }
 
 /**
@@ -386,3 +379,30 @@ hildon_helper_set_logical_color                 (GtkWidget *widget,
 }
 
 
+/**
+ *
+ * hildon_helper_set_thumb_scrollbar
+ * @win: A @GtkScrolledWindow to use as target
+ * @thumb: TRUE to enable the thumb scrollbar, FALSE to disable
+ *
+ * This function enables a thumb scrollbar on a given scrolled window. It'll convert the
+ * existing normal scrollbar into a larger, finger-usable scrollbar that works without a stylus. 
+ * As fingerable list rows are fairly high, consider using the whole available vertical space 
+ * of your application for the content in order to have as many rows as possible 
+ * visible on the screen at once. 
+ *
+ * Finger-Sized scrollbar should always be used together with finger-sized content.
+ **/
+void
+hildon_helper_set_thumb_scrollbar               (GtkScrolledWindow *win, 
+                                                 gboolean thumb)
+{
+    g_return_if_fail (GTK_IS_SCROLLED_WINDOW (win));
+
+    if (win->vscrollbar) 
+        gtk_widget_set_name (win->vscrollbar, (thumb) ? "hildon-thumb-scrollbar" : NULL);
+}
+
+
+
+