2009-03-16 Claudio Saavedra <csaavedra@igalia.com>
[hildon] / src / hildon-gtk.c
index 9b44c00..468bb71 100644 (file)
@@ -17,7 +17,7 @@
 /**
  * SECTION:hildon-gtk
  * @short_description: Additional functions for Gtk widgets
- * @see_also: #HildonButton
+ * @see_also: #HildonButton, #HildonCheckButton
  *
  * Hildon provides some functions to extend the functionality of
  * existing Gtk widgets. This also includes convenience functions to
@@ -76,6 +76,9 @@ button_common_init                              (GtkWidget      *button,
     /* Set requested size */
     hildon_gtk_widget_set_theme_size (button, size);
 
+    /* Set focus-on-click to FALSE by default */
+    gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
+
     /* Make sure that all images in this button are always shown */
     g_signal_connect (button, "notify::image", G_CALLBACK (image_changed_cb), NULL);
 }
@@ -87,6 +90,8 @@ button_common_init                              (GtkWidget      *button,
  * widget name to allow Hildon specific styling.
  *
  * Return value: A newly created #GtkMenu widget.
+ *
+ * Since: 2.2
  **/
 GtkWidget *
 hildon_gtk_menu_new                             (void)
@@ -107,7 +112,12 @@ hildon_gtk_menu_new                             (void)
  * "gtk-button-images" setting. Images set using
  * gtk_button_set_image() are always shown.
  *
+ * Buttons created using this function have #GtkButton:focus-on-click
+ * set to %FALSE by default.
+ *
  * Return value: A newly created #GtkButton widget.
+ *
+ * Since: 2.2
  **/
 GtkWidget *
 hildon_gtk_button_new                           (HildonSizeType size)
@@ -128,7 +138,12 @@ hildon_gtk_button_new                           (HildonSizeType size)
  * "gtk-button-images" setting. Images set using
  * gtk_button_set_image() are always shown.
  *
+ * Buttons created using this function have #GtkButton:focus-on-click
+ * set to %FALSE by default.
+ *
  * Return value: A newly created #GtkToggleButton widget.
+ *
+ * Since: 2.2
  **/
 GtkWidget *
 hildon_gtk_toggle_button_new                    (HildonSizeType size)
@@ -151,7 +166,12 @@ hildon_gtk_toggle_button_new                    (HildonSizeType size)
  * "gtk-button-images" setting. Images set using
  * gtk_button_set_image() are always shown.
  *
+ * Buttons created using this function have #GtkButton:focus-on-click
+ * set to %FALSE by default.
+ *
  * Return value: A newly created #GtkRadioButton widget.
+ *
+ * Since: 2.2
  **/
 GtkWidget *
 hildon_gtk_radio_button_new                     (HildonSizeType  size,
@@ -174,7 +194,12 @@ hildon_gtk_radio_button_new                     (HildonSizeType  size,
  * "gtk-button-images" setting. Images set using
  * gtk_button_set_image() are always shown.
  *
+ * Buttons created using this function have #GtkButton:focus-on-click
+ * set to %FALSE by default.
+ *
  * Return value: A newly created #GtkRadioButton widget.
+ *
+ * Since: 2.2
  **/
 GtkWidget *
 hildon_gtk_radio_button_new_from_widget         (HildonSizeType  size,
@@ -194,6 +219,8 @@ hildon_gtk_radio_button_new_from_widget         (HildonSizeType  size,
  * @mode
  *
  * Return value: A newly created #GtkTreeView widget.
+ *
+ * Since: 2.2
  **/
 GtkWidget *
 hildon_gtk_tree_view_new                        (HildonUIMode mode)
@@ -211,6 +238,8 @@ hildon_gtk_tree_view_new                        (HildonUIMode mode)
  * @mode and the model initialized to @model.
  *
  * Return value: A newly created #GtkTreeView widget.
+ *
+ * Since: 2.2
  **/
 GtkWidget *
 hildon_gtk_tree_view_new_with_model             (HildonUIMode  mode,
@@ -225,6 +254,8 @@ hildon_gtk_tree_view_new_with_model             (HildonUIMode  mode,
  * @mode: The new #HildonUIMode
  *
  * Sets the UI mode of @treeview to @mode.
+ *
+ * Since: 2.2
  **/
 void
 hildon_gtk_tree_view_set_ui_mode                (GtkTreeView  *treeview,
@@ -242,6 +273,8 @@ hildon_gtk_tree_view_set_ui_mode                (GtkTreeView  *treeview,
  * @mode
  *
  * Return value: A newly created #GtkIconView widget
+ *
+ * Since: 2.2
  **/
 GtkWidget *
 hildon_gtk_icon_view_new                        (HildonUIMode mode)
@@ -258,6 +291,8 @@ hildon_gtk_icon_view_new                        (HildonUIMode mode)
  * @mode and the model intitialized to @model.
  *
  * Return value: A newly created #GtkIconView widget.
+ *
+ * Since: 2.2
  **/
 GtkWidget *
 hildon_gtk_icon_view_new_with_model             (HildonUIMode  mode,
@@ -272,6 +307,8 @@ hildon_gtk_icon_view_new_with_model             (HildonUIMode  mode,
  * @mode: The new #HildonUIMode
  *
  * Sets the UI mode of @iconview to @mode.
+ *
+ * Since: 2.2
  **/
 void
 hildon_gtk_icon_view_set_ui_mode                (GtkIconView  *iconview,
@@ -284,41 +321,48 @@ hildon_gtk_icon_view_set_ui_mode                (GtkIconView  *iconview,
 
 /**
  * hildon_gtk_window_set_progress_indicator:
- * @window: The window, we want to define its state
+ * @window: a #GtkWindow.
  * @state: The state we want to set: 1 -> show progress indicator, 0
  *          -> hide progress indicator.
  *
- * This functions notifies the window manager that it should add a
- * progress indicator in the title of the window. It applies to
- * #HildonDialog and #HildonWindow.
+ * This functions tells the window manager to show/hide a progress
+ * indicator in the window title. It applies to #HildonDialog and
+ * #HildonWindow (including subclasses).
+ *
+ * Note that @window must be realized for this to work.
  *
+ * Since: 2.2
  **/
 void
 hildon_gtk_window_set_progress_indicator        (GtkWindow    *window,
                                                  guint        state)
 {
-  GtkWidget *widget = GTK_WIDGET (window);
+  GdkWindow *gdkwin;
   GdkDisplay *display;
   Atom atom;
 
-  display = gdk_drawable_get_display (widget->window);
+  g_return_if_fail (GTK_IS_WINDOW (window));
+  g_return_if_fail (GTK_WIDGET_REALIZED (window));
+
+  gdkwin = GTK_WIDGET (window)->window;
+
+  display = gdk_drawable_get_display (gdkwin);
   atom = gdk_x11_get_xatom_by_name_for_display (display, "_HILDON_WM_WINDOW_PROGRESS_INDICATOR");
 
-  XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (widget->window),
+  XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (gdkwin),
                    atom, XA_INTEGER, 32, PropModeReplace,
                    (guchar *)&state, 1);
 }
 
 /**
  * hildon_gtk_hscale_new:
- * @void: 
  *
  * Creates a new horizontal scale widget that lets the user select
  * a value. The value is technically a double between 0.0 and 1.0.
  * See gtk_adjustment_configure() for reconfiguring the adjustment.
  *
  * The scale is hildonized, which means that a click or tap immediately
- * jumps to the desired position, see gtk_range_set_relative_steps().
+ * jumps to the desired position, see gtk_range_set_jump_to_position().
  * Further more the value is not displayed, see gtk_scale_set_draw_value().
  *
  * Returns: a new hildonized #GtkHScale
@@ -332,7 +376,7 @@ hildon_gtk_hscale_new                           (void)
   g_object_set (scale,
                 "draw-value", FALSE,
 #ifdef MAEMO_GTK
-                "relative-steps", FALSE,
+                "jump-to-position", TRUE,
 #endif
                 NULL);
 
@@ -341,14 +385,13 @@ hildon_gtk_hscale_new                           (void)
 
 /**
  * hildon_gtk_vscale_new:
- * @void: 
  *
  * Creates a new vertical scale widget that lets the user select
  * a value. The value is technically a double between 0.0 and 1.0.
  * See gtk_adjustment_configure() for reconfiguring the adjustment.
  *
  * The scale is hildonized, which means that a click or tap immediately
- * jumps to the desired position, see gtk_range_set_relative_steps().
+ * jumps to the desired position, see gtk_range_set_jump_to_position().
  * Further more the value is not displayed, see gtk_scale_set_draw_value().
  *
  * Returns: a new hildonized #GtkVScale
@@ -362,7 +405,7 @@ hildon_gtk_vscale_new                           (void)
   g_object_set (scale,
                 "draw-value", FALSE,
 #ifdef MAEMO_GTK
-                "relative-steps", FALSE,
+                "jump-to-position", TRUE,
 #endif
                 NULL);