2009-02-27 Alberto Garcia <agarcia@igalia.com>
[hildon] / src / hildon-vvolumebar.c
index 8145781..d71193a 100644 (file)
@@ -3,12 +3,12 @@
  *
  * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
  *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
+ * Contact: Rodrigo Novo <rodrigo.novo@nokia.com>
  *
  * 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
  *
  */
 
-/*
+/**
  * SECTION:hildon-vvolumebar
- * @short_description: A widget that displays a vertical volume bar
+ * @short_description: A widget that displays a vertical volume bar.
  * @see_also: #HildonVolumebar, #HildonHVolumebar
  *
  * #HildonVVolumebar is a subclass of #HildonVolumebar.  It displays a
  * vertical volume bar that allows increasing or decreasing volume
  * within a predefined range, and muting when users click the mute icon.
+ * 
+ * Here is an example that creates a vertical volume bar and connects
+ * both its signals.
+ * <example>
+ * <title>HildonVVolumebar example</title>
+ * <programlisting>
+ * GtkWidget *volbar = hildon_vvolumebar_new ();
+ * g_signal_connect (G_OBJECT (volbar), "mute_toggled", G_CALLBACK (mute_toggle), NULL);
+ * g_signal_connect (G_OBJECT (volbar), "level_changed", G_CALLBACK (level_change), NULL);
+ * </programlisting>
+ * </example>
  */
 
+#undef                                          HILDON_DISABLE_DEPRECATED
+
 #ifdef                                          HAVE_CONFIG_H
 #include                                        <config.h>
 #endif
 
 #include                                        "hildon-vvolumebar.h"
-#include                                        <gtk/gtk.h>
 #include                                        "hildon-volumebar-range.h"
 #include                                        "hildon-volumebar-private.h"
 
 /* Volume bar */
-#define                                         DEFAULT_BAR_WIDTH 58
+#define                                         DEFAULT_BAR_WIDTH 60
 
 #define                                         MINIMUM_BAR_HEIGHT 165
 
 /* Toggle button */
 
-#define                                         DEFAULT_VERTICAL_TBUTTON_WIDTH 26
+#define                                         DEFAULT_VERTICAL_TBUTTON_WIDTH 60
 
-#define                                         DEFAULT_VERTICAL_TBUTTON_HEIGHT 26
+#define                                         DEFAULT_VERTICAL_TBUTTON_HEIGHT 60
 
-#define                                         DEFAULT_ENDING_SIZE 20
+#define                                         DEFAULT_ENDING_SIZE 0
 
 /* Gap to leave for mute button */
 
-#define                                         HORIZONTAL_MUTE_GAP 16
+#define                                         HORIZONTAL_MUTE_GAP 0
 
-#define                                         VERTICAL_MUTE_GAP 6
+#define                                         VERTICAL_MUTE_GAP 0
 
 static HildonVolumebarClass*                    parent_class;
 
@@ -85,7 +97,7 @@ hildon_vvolumebar_size_allocate                 (GtkWidget * widget,
  *
  * Initializes and returns the type of a hildon vvolumebar.
  *
- * @Returns: GType of #HildonVVolumebar
+ * Returns: GType of #HildonVVolumebar
  */
 GType G_GNUC_CONST
 hildon_vvolumebar_get_type                      (void)
@@ -134,8 +146,6 @@ hildon_vvolumebar_init                          (HildonVVolumebar *vvolumebar)
     priv->volumebar = HILDON_VOLUMEBAR_RANGE (hildon_volumebar_range_new
             (GTK_ORIENTATION_VERTICAL));
 
-    GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (vvolumebar), GTK_CAN_FOCUS);
-
     gtk_widget_set_parent (GTK_WIDGET (priv->tbutton), GTK_WIDGET (vvolumebar));
     gtk_widget_set_parent (GTK_WIDGET (priv->volumebar), GTK_WIDGET (vvolumebar));
 
@@ -253,6 +263,7 @@ hildon_vvolumebar_size_allocate                 (GtkWidget *widget,
         /* Allocate space for the mute button */
         button_allocation.x = allocation->x + HORIZONTAL_MUTE_GAP;
         button_allocation.y = allocation->y + allocation->height -
+            DEFAULT_VERTICAL_TBUTTON_HEIGHT -
             VERTICAL_MUTE_GAP - 2 * DEFAULT_ENDING_SIZE;
         button_allocation.width = DEFAULT_VERTICAL_TBUTTON_WIDTH;
         button_allocation.height = DEFAULT_VERTICAL_TBUTTON_HEIGHT;