Adding a patch from Tommi Komulainen to pass the correct timestamp and button to...
[hildon] / src / hildon-seekbar.c
index d22a624..0fe4fe4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * This file is part of hildon-libs
+ * This file is a part of hildon
  *
  * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
  *
@@ -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
@@ -24,7 +24,7 @@
 
 /**
  * SECTION:hildon-seekbar
- * @short_description: A widget used to identify a place from a content
+ * @short_description: A widget used to identify a place from a content.
  *
  * HildonSeekbar allows seeking in media with a range widget.  It
  * supports for setting or getting the length (total time) of the media,
@@ -48,6 +48,7 @@
 #include                                        <gtk/gtkadjustment.h>
 #include                                        <gtk/gtktoolbar.h>
 #include                                        <gdk/gdkkeysyms.h>
+#include                                        "hildon-seekbar-private.h"
 
 static GtkScaleClass*                           parent_class = NULL;
 
@@ -130,7 +131,12 @@ enum
 };
 
 /**
- * Initialises, and returns the type of a hildon seekbar.
+ * hildon_seekbar_get_type:
+ * 
+ * Initializes, and returns the type of a hildon seekbar.
+ * 
+ * @Returns : GType of #HildonSeekbar
+ * 
  */
 GType G_GNUC_CONST 
 hildon_seekbar_get_type                         (void)
@@ -180,8 +186,13 @@ hildon_seekbar_class_init                       (HildonSeekbarClass *seekbar_cla
     object_class->set_property          = hildon_seekbar_set_property;
     object_class->get_property          = hildon_seekbar_get_property;
 
+    /**
+     * HildonSeekbar:total-time:
+     *
+     * Total playing time of this media file.
+     */
     g_object_class_install_property (object_class, PROP_TOTAL_TIME,
-            g_param_spec_double ("total_time",
+            g_param_spec_double ("total-time",
                 "total time",
                 "Total playing time of this media file",
                 0,           /* min value */
@@ -189,6 +200,11 @@ hildon_seekbar_class_init                       (HildonSeekbarClass *seekbar_cla
                 0,           /* default */
                 G_PARAM_READWRITE));
 
+    /**
+     * HildonSeekbar:position:
+     *
+     * Current position in this media file.
+     */
     g_object_class_install_property (object_class, PROP_POSITION,
             g_param_spec_double ("position",
                 "position",
@@ -198,6 +214,11 @@ hildon_seekbar_class_init                       (HildonSeekbarClass *seekbar_cla
                 0,           /* default */
                 G_PARAM_READWRITE));
 
+    /**
+     * HildonSeekbar:fraction:
+     *
+     * Current fraction related to the progress indicator.
+     */
     g_object_class_install_property (object_class, PROP_FRACTION,
             g_param_spec_double ("fraction",
                 "Fraction",
@@ -402,7 +423,11 @@ hildon_seekbar_get_fraction                     (HildonSeekbar *seekbar)
 {
     g_return_val_if_fail (HILDON_IS_SEEKBAR (seekbar), 0);
 
-    return osso_gtk_range_get_stream_position (GTK_RANGE(seekbar));
+#ifdef MAEMO_GTK
+    return gtk_range_get_fill_level (GTK_RANGE (seekbar));
+#else
+    return 0;
+#endif
 }
 
 /**
@@ -426,13 +451,15 @@ hildon_seekbar_set_fraction                     (HildonSeekbar *seekbar,
             fraction >= range->adjustment->lower);
 
     /* Set to show stream indicator. */
-    g_object_set (G_OBJECT (seekbar), "stream_indicator", TRUE, NULL);
+    g_object_set (G_OBJECT (seekbar), "show-fill-level", TRUE, NULL);
 
     fraction = CLAMP (fraction, range->adjustment->lower,
             range->adjustment->upper);
 
+#ifdef MAEMO_GTK 
     /* Update stream position of range widget */
-    osso_gtk_range_set_stream_position (range, fraction);
+    gtk_range_set_fill_level (range, fraction);
+#endif
 
     if (fraction < hildon_seekbar_get_position(seekbar))
         hildon_seekbar_set_position(seekbar, fraction);
@@ -483,7 +510,12 @@ hildon_seekbar_set_position                     (HildonSeekbar *seekbar,
     value = floor (adj->value);
     if (time != value) {
         value = (time < adj->upper) ? time : adj->upper;
-        if (value <= osso_gtk_range_get_stream_position (range)) {
+
+#ifdef MAEMO_GTK 
+        if (value <= gtk_range_get_fill_level (range)) {
+#else
+        if (value) {
+#endif
             adj->value = value;
             gtk_adjustment_value_changed (adj);