*
*/
+/**
+ * SECTION:hildon-time-button
+ * @Short_Description: Button displaying and allowing selection of a time.
+ * @See_Also: #HildonPickerButton, #HildonDateButton
+ *
+ * #HildonTimeButton is a widget that shows a text label and a time, and allows
+ * the user to select a different time. Visually, it's a button that, once clicked,
+ * presents a #HildonPickerDialog containing a #HildonTimeSelector. Once the user selects
+ * a different time from the selector, this will be shown in the button.
+ */
+
+#include <libintl.h>
+
#include "hildon-time-selector.h"
#include "hildon-touch-selector.h"
#include "hildon-picker-button.h"
#include "hildon-time-button.h"
+#define _(String) \
+ dgettext("hildon-libs", String)
+
+#define c_(String) \
+ dgettext("hildon-common-strings", String)
+
G_DEFINE_TYPE (HildonTimeButton, hildon_time_button, HILDON_TYPE_PICKER_BUTTON)
#if 0
static void
hildon_time_button_init (HildonTimeButton * self)
{
- GtkWidget *time_selector;
-
- time_selector = hildon_time_selector_new ();
+}
- hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (self),
- HILDON_TOUCH_SELECTOR (time_selector));
+/**
+ * hildon_time_button_new:
+ * @size: One of #HildonSizeType
+ * @arrangement: one of #HildonButtonArrangement
+ *
+ * Creates a new #HildonTimeButton. See hildon_button_new() for details on the
+ * parameters.
+ *
+ * Returns: a new #HildonTimeButton
+ *
+ * Since: 2.2
+ **/
+GtkWidget *
+hildon_time_button_new (HildonSizeType size,
+ HildonButtonArrangement arrangement)
+{
+ return hildon_time_button_new_step (size, arrangement, 1);
}
+/**
+ * hildon_time_button_new_step:
+ * @size: One of #HildonSizeType
+ * @arrangement: one of #HildonButtonArrangement
+ * @minutes_step: step between the minutes in the selector options
+ *
+ * Creates a new #HildonTimeButton. See hildon_button_new() for details on the
+ * parameters.
+ *
+ * Returns: a new #HildonTimeButton
+ *
+ * Since: 2.2
+ **/
GtkWidget *
-hildon_time_button_new (HildonButtonFlags flags)
+hildon_time_button_new_step (HildonSizeType size,
+ HildonButtonArrangement arrangement,
+ guint minutes_step)
{
return g_object_new (HILDON_TYPE_TIME_BUTTON,
- "title", "Time", "arrangement-flags", flags, NULL);
+ "title", _("wdgt_ti_time"),
+ "arrangement", arrangement,
+ "size", size,
+ "touch-selector", hildon_time_selector_new_step (minutes_step),
+ NULL);
}
+/**
+ * hildon_time_button_get_time:
+ * @button: a #HildonTimeButton
+ * @hours: return location for the hours of the time selected
+ * @minutes: return location for the minutes of the time selected
+ *
+ * Retrieves the time from @button.
+ *
+ * Since: 2.2
+ **/
void
hildon_time_button_get_time (HildonTimeButton * button,
guint * hours, guint * minutes)
hildon_time_selector_get_time (HILDON_TIME_SELECTOR (selector), hours, minutes);
}
+/**
+ * hildon_time_button_set_time:
+ * @button: a #HildonTimeButton
+ * @hours: the hours to be set
+ * @minutes: the time to be set
+ *
+ * Sets the time to be displayed in @button. This time will
+ * be selected by default on the #HildonTimeSelector.
+ *
+ * Since: 2.2
+ **/
void
hildon_time_button_set_time (HildonTimeButton * button,
guint hours, guint minutes)
selector = hildon_picker_button_get_selector (HILDON_PICKER_BUTTON (button));
hildon_time_selector_set_time (HILDON_TIME_SELECTOR (selector), hours, minutes);
- time = hildon_touch_selector_get_current_text (HILDON_TOUCH_SELECTOR (selector));
+ time = hildon_touch_selector_get_current_text (HILDON_TOUCH_SELECTOR (selector));
hildon_button_set_value (HILDON_BUTTON (button), time);
+ g_free (time);
}