Fix gtk-doc packaging
[hildon] / src / hildon-time-editor.c
index fd00872..f2f7f4f 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.
  *
@@ -25,7 +25,7 @@
 /**
  * SECTION:hildon-time-editor
  * @short_description: A widget used to enter time or duration in hours, minutes,
- * and optional seconds
+ * and optional seconds.
  * @see_also: #HildonTimePicker
  * 
  * HildonTimeEditor is used to edit time or duration. Time mode is
  * amount of time up to 99 hours.  It consists of entries for hours,
  * minutes and seconds, and pm/am indicator as well as a button which
  * popups a #HildonTimePicker dialog.
+ *
+ * <example>
+ * <title>HildonTimePicker example</title>
+ * <programlisting>
+ * <!-- -->
+ * editor = hildon_time_editor_new ();
+ * hildon_time_editor_set_time (editor, h, m, s);
+ * <!-- -->
+ * gtk_box_pack_start (..., editor)
+ * <!-- -->
+ * hildon_time_editor_get_time (editor, &amp;h, &amp;m, &amp;s);
+ * <!-- -->
+ * </programlisting>
+ * </example>
+ *
  */
 
 #ifdef                                          HAVE_CONFIG_H
@@ -46,6 +61,7 @@
 #include                                        <gtk/gtklabel.h>
 #include                                        <gtk/gtkframe.h>
 #include                                        <gdk/gdkkeysyms.h>
+#include                                        <gtk/gtkenums.h>
 #include                                        <string.h>
 #include                                        <time.h>
 #include                                        <stdlib.h>
 #include                                        "hildon-defines.h"
 #include                                        "hildon-time-picker.h"
 #include                                        "hildon-banner.h"
-#include                                        "hildon-input-mode-hint.h"
-#include                                        "hildon-composite-widget.h"
+#include                                        "hildon-private.h"
 #include                                        "hildon-marshalers.h"
 #include                                        "hildon-enum-types.h"
 #include                                        "hildon-time-editor-private.h"
 
-#define                                         _(String) dgettext(PACKAGE, String)
+#define                                         _(String) dgettext("hildon-libs", String)
+
+#define                                         c_(String) dgettext("hildon-common-strings", String)
 
 #define                                         TICKS(h,m,s) \
                                                 ((h) * 3600 + (m) * 60 + (s))
@@ -189,7 +206,7 @@ hildon_time_editor_entry_focus_in               (GtkWidget *widget,
 
 static gboolean
 hildon_time_editor_time_error                   (HildonTimeEditor *editor,
-                                                 HildonDateTimeEditorError type);
+                                                 HildonDateTimeError type);
 
 static gboolean 
 hildon_time_editor_ampm_clicked                 (GtkWidget *widget,
@@ -251,6 +268,13 @@ hildon_time_editor_inserted_text                (GtkEditable *editable,
                                                  gint *position,
                                                  gpointer user_data);
 
+/**
+ * hildon_time_editor_get_type:
+ *
+ * Initializes and returns the type of a hildon time editor.
+ *
+ * @Returns: GType of #HildonTimeEditor
+ */
 GType G_GNUC_CONST
 hildon_time_editor_get_type                     (void)
 {
@@ -336,7 +360,7 @@ hildon_time_editor_class_init                   (HildonTimeEditorClass *editor_c
     widget_class->size_request                  = hildon_time_editor_size_request;
     widget_class->size_allocate                 = hildon_time_editor_size_allocate;
     widget_class->tap_and_hold_setup            = hildon_time_editor_tap_and_hold_setup;
-    widget_class->focus                         = hildon_composite_widget_focus;
+    widget_class->focus                         = hildon_private_composite_focus;
 
     container_class->forall                     = hildon_time_editor_forall;
     GTK_OBJECT_CLASS (editor_class)->destroy    = hildon_time_editor_destroy;
@@ -352,7 +376,7 @@ hildon_time_editor_class_init                   (HildonTimeEditorClass *editor_c
                 G_STRUCT_OFFSET (HildonTimeEditorClass, time_error),
                 g_signal_accumulator_true_handled, NULL,
                 _hildon_marshal_BOOLEAN__ENUM,
-                G_TYPE_BOOLEAN, 1, HILDON_TYPE_DATE_TIME_EDITOR_ERROR);
+                G_TYPE_BOOLEAN, 1, HILDON_TYPE_DATE_TIME_ERROR);
 
     /**
      * HildonTimeEditor:ticks:
@@ -487,7 +511,7 @@ hildon_time_editor_init                         (HildonTimeEditor *editor)
     priv->ampm_button    = gtk_button_new();
     priv->skipper        = FALSE;
 
-    icon = gtk_image_new_from_icon_name (ICON_NAME, HILDON_ICON_SIZE_WIDG);
+    icon = gtk_image_new_from_icon_name (ICON_NAME, HILDON_ICON_SIZE_SMALL);
     hbox = gtk_hbox_new (FALSE, 0);
 
     GTK_WIDGET_SET_FLAGS (editor, GTK_NO_WINDOW);
@@ -509,7 +533,7 @@ hildon_time_editor_init                         (HildonTimeEditor *editor)
         gtk_entry_set_has_frame (GTK_ENTRY (priv->entries[i]), FALSE);
 
         /* Set the entries to accept only numeric characters */
-        g_object_set (priv->entries[i], "input-mode", HILDON_INPUT_MODE_HINT_NUMERIC, NULL);
+        g_object_set (priv->entries[i], "input-mode", HILDON_GTK_INPUT_MODE_NUMERIC, NULL);
 
         /* The entry fields all take exactly two characters */
         gtk_entry_set_max_length (GTK_ENTRY (priv->entries[i]), 2);
@@ -674,8 +698,11 @@ hildon_time_editor_finalize                     (GObject *obj_self)
     HildonTimeEditorPrivate *priv = HILDON_TIME_EDITOR_GET_PRIVATE (obj_self);
     g_assert (priv);
 
-    g_free (priv->am_symbol);
-    g_free (priv->pm_symbol);
+    if (priv->am_symbol) 
+            g_free (priv->am_symbol);
+
+    if (priv->pm_symbol)
+            g_free (priv->pm_symbol);
 
     if (priv->highlight_idle)
         g_source_remove (priv->highlight_idle);
@@ -686,7 +713,6 @@ hildon_time_editor_finalize                     (GObject *obj_self)
 
 /**
  * hildon_time_editor_get_time_separators:
- * @editor: the #HildonTimeEditor
  * @hm_sep_label: the label that will show the hour:minutes separator
  * @ms_sep_label: the label that will show the minutes:seconds separator
  *
@@ -770,7 +796,7 @@ hildon_time_editor_set_ticks                    (HildonTimeEditor *editor,
     guint i, h, m, s;
     gchar str[3];
 
-    g_assert (HILDON_IS_TIME_EDITOR (editor));
+    g_return_if_fail (HILDON_IS_TIME_EDITOR (editor));
 
     priv = HILDON_TIME_EDITOR_GET_PRIVATE (editor);
     g_assert (priv);
@@ -1274,7 +1300,7 @@ hildon_time_editor_entry_focus_in               (GtkWidget *widget,
 
 static gboolean 
 hildon_time_editor_time_error                   (HildonTimeEditor *editor,
-                                                 HildonDateTimeEditorError type)
+                                                 HildonDateTimeError type)
 {
     return TRUE;
 }
@@ -1764,7 +1790,7 @@ hildon_time_editor_entry_keypress               (GtkWidget *widget,
        (only digits and control characters are allowed )*/
     if (!g_unichar_isdigit (event->keyval) && ! (event->keyval & 0xF000)) {
         g_signal_emit (editor, time_editor_signals[TIME_ERROR], 0, HILDON_DATE_TIME_ERROR_INVALID_CHAR, &r);
-        hildon_banner_show_information (widget, NULL, _("ckct_ib_illegal_character"));
+        hildon_banner_show_information (widget, NULL, c_("ckct_ib_illegal_character"));
         return TRUE;
     }
 
@@ -1774,10 +1800,18 @@ hildon_time_editor_entry_keypress               (GtkWidget *widget,
             /* Return key popups up time picker dialog. Visually it looks as if
                the time picker icon was clicked. Before opening the time picker
                the fields are first validated and fixed. */
-            hildon_time_editor_validate (editor, FALSE);
-            hildon_gtk_button_set_depressed (GTK_BUTTON (priv->iconbutton), TRUE);
+
+            /* hildon_time_editor_validate (editor, FALSE);
+               hildon_gtk_button_set_depressed (GTK_BUTTON (priv->iconbutton), TRUE);
+               hildon_time_editor_icon_clicked (widget, data);
+               hildon_gtk_button_set_depressed (GTK_BUTTON (priv->iconbutton), FALSE); 
+
+               FIXME The above code used to be here before the consolidation that removed the 
+               _set_depressed crap. However, I think this code had NO EFFECT anyways, since
+               there is no expose event after the _set functions. So I'm just cutting it out. 
+               Another story would be to actually fix it... */
+                
             hildon_time_editor_icon_clicked (widget, data);
-            hildon_gtk_button_set_depressed (GTK_BUTTON (priv->iconbutton), FALSE);
             return TRUE;
 
         case GDK_Left:
@@ -1840,7 +1874,7 @@ convert_to_24h                                  (guint *h,
 /**
  * hildon_time_editor_set_show_hours:
  * @editor: The #HildonTimeEditor.
- * @enable: Enable or disable showing of hours.
+ * @show_hours: Enable or disable showing of hours.
  *
  * This function shows or hides the hours field.
  *
@@ -1874,7 +1908,7 @@ hildon_time_editor_set_show_hours               (HildonTimeEditor *editor,
 
 /**
  * hildon_time_editor_get_show_hours:
- * @self: the @HildonTimeEditor widget.
+ * @editor: the @HildonTimeEditor widget.
  *
  * This function returns a boolean indicating the visibility of
  * hours in the @HildonTimeEditor