2007-04-02 Lucas Rocha <lucas.rocha@nokia.com>
authorLucas Rocha <lucas.rocha@nokia.com>
Mon, 2 Apr 2007 12:59:44 +0000 (12:59 +0000)
committerLucas Rocha <lucas.rocha@nokia.com>
Mon, 2 Apr 2007 12:59:44 +0000 (12:59 +0000)
* src/hildon-range-editor.c (hildon_range_editor_init),
src/hildon-seekbar.c (hildon_seekbar_get_fraction,
hildon_seekbar_set_fraction, hildon_seekbar_set_position),
src/hildon-time-editor.c (hildon_time_editor_tap_and_hold_setup,
hildon_time_editor_class_init, hildon_time_editor_init),
src/hildon-get-password-dialog.c (invalid_input,
hildon_get_password_set_property, hildon_get_password_get_property,
create_contents, hildon_get_password_dialog_set_max_characters),
src/hildon-set-password-dialog.c (create_contents),
src/hildon-date-editor.c (hildon_date_editor_init),
src/hildon-login-dialog.c (hildon_login_dialog_init),
src/hildon-number-editor.c (hildon_number_editor_init),
src/hildon-find-toolbar.c (hildon_find_toolbar_emit_invalid_input,
hildon_find_toolbar_emit_close, hildon_find_toolbar_init): made all
the Maemo GTK+ specific API optional by adding a --with-maemo-gtk
 configure option and adding the respective checks in the code.
* src/hildon-calendar.c (hildon_calendar_paint_week_numbers,
hildon_calendar_drag_data_received): fixed some build warnings.

12 files changed:
ChangeLog
configure.ac
src/hildon-calendar.c
src/hildon-date-editor.c
src/hildon-find-toolbar.c
src/hildon-get-password-dialog.c
src/hildon-login-dialog.c
src/hildon-number-editor.c
src/hildon-range-editor.c
src/hildon-seekbar.c
src/hildon-set-password-dialog.c
src/hildon-time-editor.c

index 2b9730a..f085e76 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2007-04-02  Lucas Rocha  <lucas.rocha@nokia.com>
+
+       * src/hildon-range-editor.c (hildon_range_editor_init),
+       src/hildon-seekbar.c (hildon_seekbar_get_fraction,
+       hildon_seekbar_set_fraction, hildon_seekbar_set_position),
+       src/hildon-time-editor.c (hildon_time_editor_tap_and_hold_setup,
+       hildon_time_editor_class_init, hildon_time_editor_init),
+       src/hildon-get-password-dialog.c (invalid_input,
+       hildon_get_password_set_property, hildon_get_password_get_property,
+       create_contents, hildon_get_password_dialog_set_max_characters),
+       src/hildon-set-password-dialog.c (create_contents),
+       src/hildon-date-editor.c (hildon_date_editor_init),
+       src/hildon-login-dialog.c (hildon_login_dialog_init),
+       src/hildon-number-editor.c (hildon_number_editor_init),
+       src/hildon-find-toolbar.c (hildon_find_toolbar_emit_invalid_input,
+       hildon_find_toolbar_emit_close, hildon_find_toolbar_init): made all
+       the Maemo GTK+ specific API optional by adding a --with-maemo-gtk
+        configure option and adding the respective checks in the code.
+       * src/hildon-calendar.c (hildon_calendar_paint_week_numbers,
+       hildon_calendar_drag_data_received): fixed some build warnings.
+
 2007-03-29  Michael Dominic Kostrzewa  <michael.kostrzewa@nokia.com> 
 
        * debian/changelog: A 1.0.0 release notes.
index 003cb02..0b1c03a 100644 (file)
@@ -82,6 +82,27 @@ else
     AC_MSG_NOTICE(Will not build examples )
 fi
 
+# use maemo gtk+ specific api (or not)
+AC_ARG_WITH(maemo-gtk, 
+    AC_HELP_STRING([--with-maemo-gtk], [Use Maemo GTK+ API]),
+    [
+     case "${withval}" in
+         yes) USE_MAEMO_GTK=yes ;;
+         no)  USE_MAEMO_GTK=no ;;
+         *)   AC_MSG_ERROR(bad value ${withval} for --with-maemo-gtk) ;;
+     esac],
+     [USE_MAEMO_GTK=yes])
+
+AM_CONDITIONAL(USE_MAEMO_GTK, test "x$USE_MAEMO_GTK" = "xyes")
+
+# just print out our status
+if test x$USE_MAEMO_GTK = xyes; then
+    AC_MSG_NOTICE(Will use Maemo GTK+ specific API)
+    AC_DEFINE(MAEMO_GTK, [], [Whether to use Maemo GTK+ specific API])
+else
+    AC_MSG_NOTICE(Will not use Maemo GTK+ specific API)
+fi
+
 # build with assertion checks (or not)
 AC_ARG_WITH(asserts, 
     AC_HELP_STRING([--with-asserts], [Build with the assertion checks]),
index 6fd1b22..3a6e7d8 100644 (file)
@@ -2337,7 +2337,7 @@ hildon_calendar_paint_week_numbers              (GtkWidget *widget)
 {
     HildonCalendar *calendar;
     GdkGC *gc; 
-    gint row, week = 0, year;
+    guint row, week = 0, year;
     gint x_loc;
     char buffer[10];
     gint y_loc;
@@ -4297,7 +4297,7 @@ hildon_calendar_drag_data_received              (GtkWidget *widget,
          * supposed to call drag_status, not actually paste in the
          * data.
          */
-        str = gtk_selection_data_get_text (selection_data);
+        str = (gchar *) gtk_selection_data_get_text (selection_data);
         if (str) 
         {
             date = g_date_new ();
@@ -4316,7 +4316,7 @@ hildon_calendar_drag_data_received              (GtkWidget *widget,
     }
 
     date = g_date_new ();
-    str = gtk_selection_data_get_text (selection_data);
+    str = (gchar *) gtk_selection_data_get_text (selection_data);
     if (str) 
     {
         g_date_set_parse (date, str);
index f538b28..07e8162 100644 (file)
@@ -449,12 +449,14 @@ hildon_date_editor_init                         (HildonDateEditor *editor)
     priv->m_entry = gtk_entry_new ();
     priv->y_entry = gtk_entry_new ();
 
+#ifdef MAEMO_GTK
     g_object_set (G_OBJECT(priv->d_entry), "hildon-input-mode", 
             HILDON_GTK_INPUT_MODE_NUMERIC, NULL);
     g_object_set (G_OBJECT(priv->m_entry), "hildon-input-mode", 
             HILDON_GTK_INPUT_MODE_NUMERIC, NULL);
     g_object_set (G_OBJECT(priv->y_entry), "hildon-input-mode", 
             HILDON_GTK_INPUT_MODE_NUMERIC, NULL);
+#endif
 
     /* set entry look */
     gtk_entry_set_width_chars (GTK_ENTRY (priv->d_entry), DAY_ENTRY_WIDTH);
index f8b3690..389ebe5 100644 (file)
@@ -108,10 +108,12 @@ static void
 hildon_find_toolbar_emit_close                  (GtkButton *button, 
                                                  gpointer self);
 
+#ifdef MAEMO_GTK 
 static void
 hildon_find_toolbar_emit_invalid_input          (GtkEntry *entry, 
                                                  GtkInvalidInputType type, 
                                                  gpointer self);
+#endif
 
 static void
 hildon_find_toolbar_entry_activate              (GtkWidget *widget,
@@ -481,6 +483,7 @@ static void
 hildon_find_toolbar_emit_close                  (GtkButton *button, 
                                                  gpointer self)
 {
+#ifdef MAEMO_GTK 
     HildonFindToolbarPrivate *priv = HILDON_FIND_TOOLBAR_GET_PRIVATE (self);
     g_assert (priv);
 
@@ -489,11 +492,13 @@ hildon_find_toolbar_emit_close                  (GtkButton *button,
     {
         hildon_gtk_im_context_hide (GTK_ENTRY (entry)->im_context);
     }
+#endif
 
     /* Clicked close button */
     g_signal_emit_by_name (self, "close", NULL);
 }
 
+#ifdef MAEMO_GTK 
 static void
 hildon_find_toolbar_emit_invalid_input          (GtkEntry *entry, 
                                                  GtkInvalidInputType type, 
@@ -502,6 +507,7 @@ hildon_find_toolbar_emit_invalid_input          (GtkEntry *entry,
     if(type == GTK_INVALID_INPUT_MAX_CHARS_REACHED)
         g_signal_emit_by_name (self, "invalid_input", NULL);
 }
+#endif
 
 static void
 hildon_find_toolbar_entry_activate              (GtkWidget *widget,
@@ -647,7 +653,7 @@ hildon_find_toolbar_class_init                  (HildonFindToolbarClass *klass)
      * 
      * Gets emitted when the maximum search prefix length is reached and
      * user tries to type more.
-     */ 
+     */
     HildonFindToolbar_signal[INVALID_INPUT] = 
         g_signal_new(
                 "invalid_input", HILDON_TYPE_FIND_TOOLBAR,
@@ -696,9 +702,12 @@ hildon_find_toolbar_init                        (HildonFindToolbar *self)
 
     /* ComboBoxEntry for search prefix string / history list */
     priv->entry_combo_box = GTK_COMBO_BOX_ENTRY (gtk_combo_box_entry_new ());
+
+#ifdef MAEMO_GTK
     g_signal_connect (hildon_find_toolbar_get_entry(priv),
             "invalid_input", 
             G_CALLBACK(hildon_find_toolbar_emit_invalid_input), self);
+#endif
 
     entry_combo_box_container = gtk_tool_item_new ();
 
index a6e958c..67cc948 100644 (file)
@@ -127,10 +127,12 @@ hildon_get_password_get_property                (GObject *object,
 static void 
 create_contents                                 (HildonGetPasswordDialog *dialog);
 
+#ifdef MAEMO_GTK 
 static void 
 invalid_input                                   (GtkWidget *widget, 
                                                  GtkInvalidInputType reason, 
                                                  gpointer unused);
+#endif
 
 enum
 {
@@ -169,6 +171,7 @@ hildon_get_password_set_property                (GObject *object,
             break;
 
         case PROP_NUMBERS_ONLY:
+#ifdef MAEMO_GTK 
             /* Set input mode for the password entry */
             g_object_set(G_OBJECT (gtk_bin_get_child GTK_BIN ((priv->password_entry))),
                     "hildon-input-mode",
@@ -176,6 +179,7 @@ hildon_get_password_set_property                (GObject *object,
                      ? HILDON_GTK_INPUT_MODE_NUMERIC
                      : HILDON_GTK_INPUT_MODE_FULL),
                     NULL);
+#endif
             break;
 
         case PROP_CAPTION_LABEL:
@@ -207,7 +211,9 @@ hildon_get_password_get_property                (GObject *object,
     HildonGetPasswordDialogPrivate *priv;
     const gchar *string;
     gint max_length;
+#ifdef MAEMO_GTK 
     gint input_mode;
+#endif
 
     priv = HILDON_GET_PASSWORD_DIALOG_GET_PRIVATE (dialog);
     g_assert (priv);
@@ -225,12 +231,16 @@ hildon_get_password_get_property                (GObject *object,
             break;
 
         case PROP_NUMBERS_ONLY:
+#ifdef MAEMO_GTK 
             /* This property is set if and only if the input mode
                of the password entry has been set to numeric only */
             g_object_get (G_OBJECT (gtk_bin_get_child (GTK_BIN (priv->password_entry))),
                     "hildon-input-mode", &input_mode, NULL);
             g_value_set_boolean (value,
                     (input_mode == HILDON_GTK_INPUT_MODE_NUMERIC));
+#else
+            g_value_set_boolean (value, FALSE);
+#endif
             break;
 
         case PROP_CAPTION_LABEL:
@@ -411,7 +421,9 @@ create_contents                                 (HildonGetPasswordDialog *dialog
     control = gtk_entry_new ();
     gtk_entry_set_width_chars (GTK_ENTRY (control), 20);
 
+#ifdef MAEMO_GTK 
     g_object_set (control, "hildon-input-mode", HILDON_GTK_INPUT_MODE_FULL, NULL);
+#endif
 
     gtk_entry_set_visibility (GTK_ENTRY(control), FALSE);
     priv->password_entry = HILDON_CAPTION
@@ -625,6 +637,7 @@ hildon_get_password_dialog_set_max_characters   (HildonGetPasswordDialog *dialog
      * disconnected before connecting the new signal. Besides, this 
      * should go into the constructor */
 
+#ifdef MAEMO_GTK 
     /* Connect callback to show error banner if the limit is exceeded */
     g_signal_connect (GTK_ENTRY
             (gtk_bin_get_child
@@ -633,8 +646,10 @@ hildon_get_password_dialog_set_max_characters   (HildonGetPasswordDialog *dialog
             G_CALLBACK (invalid_input),
             NULL
             );
+#endif
 }
 
+#ifdef MAEMO_GTK 
 /* Callback that gets called when maximum chars is reached in the entry */
 static void 
 invalid_input                                   (GtkWidget *widget, 
@@ -646,3 +661,4 @@ invalid_input                                   (GtkWidget *widget,
         hildon_banner_show_information (widget, NULL, _(HILDON_GET_PASSWORD_DIALOG_MAX_CHARS));
     }
 }
+#endif
index 5d89857..931c91a 100644 (file)
@@ -274,7 +274,10 @@ hildon_login_dialog_init                        (HildonLoginDialog *dialog)
 
     /* Setup username entry */
     priv->username_entry = GTK_ENTRY (gtk_entry_new ());
+
+#ifdef MAEMO_GTK 
     g_object_set (priv->username_entry, "hildon-input-mode", HILDON_GTK_INPUT_MODE_FULL, NULL);
+#endif
 
     caption = HILDON_CAPTION (hildon_caption_new
             (group,
@@ -288,7 +291,11 @@ hildon_login_dialog_init                        (HildonLoginDialog *dialog)
 
     /* Setup password entry */
     priv->password_entry = GTK_ENTRY (gtk_entry_new ());
+
+#ifdef MAEMO_GTK
     g_object_set (priv->password_entry, "hildon-input-mode", HILDON_GTK_INPUT_MODE_FULL, NULL);
+#endif
+
     gtk_entry_set_visibility (GTK_ENTRY (priv->password_entry), FALSE);
 
     caption = HILDON_CAPTION (hildon_caption_new (group,
index b50ccc8..0d07fe2 100644 (file)
@@ -406,8 +406,10 @@ hildon_number_editor_init                       (HildonNumberEditor *editor)
             G_CALLBACK (hildon_number_editor_button_released),
             editor);
 
+#ifdef MAEMO_GTK 
     g_object_set (G_OBJECT (priv->num_entry),
             "hildon-input-mode", HILDON_GTK_INPUT_MODE_NUMERIC, NULL);
+#endif
 
     gtk_widget_show (priv->num_entry);
     gtk_widget_show (priv->minus);
index eaa1dcd..c86f958 100644 (file)
@@ -328,11 +328,13 @@ hildon_range_editor_init                        (HildonRangeEditor *editor)
     g_signal_connect (priv->end_entry, "changed", 
             G_CALLBACK (hildon_range_editor_entry_changed), editor);
 
+#ifdef MAEMO_GTK 
     g_object_set (G_OBJECT (priv->start_entry),
             "hildon-input-mode", HILDON_GTK_INPUT_MODE_NUMERIC, NULL);
 
     g_object_set( G_OBJECT (priv->end_entry),
             "hildon-input-mode", HILDON_GTK_INPUT_MODE_NUMERIC, NULL);
+#endif 
 
     gtk_widget_show (priv->start_entry);
     gtk_widget_show (priv->end_entry);
index 098c924..0fe4fe4 100644 (file)
@@ -423,7 +423,11 @@ hildon_seekbar_get_fraction                     (HildonSeekbar *seekbar)
 {
     g_return_val_if_fail (HILDON_IS_SEEKBAR (seekbar), 0);
 
+#ifdef MAEMO_GTK
     return gtk_range_get_fill_level (GTK_RANGE (seekbar));
+#else
+    return 0;
+#endif
 }
 
 /**
@@ -452,8 +456,10 @@ hildon_seekbar_set_fraction                     (HildonSeekbar *seekbar,
     fraction = CLAMP (fraction, range->adjustment->lower,
             range->adjustment->upper);
 
+#ifdef MAEMO_GTK 
     /* Update stream position of range widget */
     gtk_range_set_fill_level (range, fraction);
+#endif
 
     if (fraction < hildon_seekbar_get_position(seekbar))
         hildon_seekbar_set_position(seekbar, fraction);
@@ -504,7 +510,12 @@ hildon_seekbar_set_position                     (HildonSeekbar *seekbar,
     value = floor (adj->value);
     if (time != value) {
         value = (time < adj->upper) ? time : adj->upper;
+
+#ifdef MAEMO_GTK 
         if (value <= gtk_range_get_fill_level (range)) {
+#else
+        if (value) {
+#endif
             adj->value = value;
             gtk_adjustment_value_changed (adj);
 
index 6dd1537..3383af7 100644 (file)
@@ -275,7 +275,11 @@ create_contents                                 (HildonSetPasswordDialog *dialog
 
     /* Create the password field */
     priv->pwd1st_entry = gtk_entry_new ();
+
+#ifdef MAEMO_GTK
     g_object_set (priv->pwd1st_entry, "hildon-input-mode", HILDON_GTK_INPUT_MODE_FULL, NULL);
+#endif
+
     gtk_entry_set_visibility (GTK_ENTRY(priv->pwd1st_entry), FALSE);
     gtk_widget_show (priv->pwd1st_entry);
     priv->pwd1st_caption = hildon_caption_new (group,
@@ -291,7 +295,11 @@ create_contents                                 (HildonSetPasswordDialog *dialog
 
     /* Create the password verify field */
     priv->pwd2nd_entry = gtk_entry_new();
+
+#ifdef MAEMO_GTK
     g_object_set (priv->pwd2nd_entry, "hildon-input-mode", HILDON_GTK_INPUT_MODE_FULL, NULL);
+#endif
+
     gtk_widget_show (priv->pwd2nd_entry);
     priv->pwd2nd_caption = hildon_caption_new (group,
             priv->pwd2nd_caption_string,
index daf6693..702d5aa 100644 (file)
@@ -232,11 +232,14 @@ hildon_time_editor_entry_keypress               (GtkWidget *widget,
 static gboolean
 hildon_time_editor_check_locale                 (HildonTimeEditor *editor);
 
+#ifdef MAEMO_GTK 
 static void 
 hildon_time_editor_tap_and_hold_setup           (GtkWidget *widget,
                                                  GtkWidget *menu,
                                                  GtkCallback func,
                                                  GtkWidgetTapAndHoldFlags flags);
+#endif
+
 static void
 hildon_time_editor_validate                     (HildonTimeEditor *editor, 
                                                  gboolean allow_intermediate);
@@ -359,7 +362,9 @@ hildon_time_editor_class_init                   (HildonTimeEditorClass *editor_c
     object_class->set_property                  = hildon_time_editor_set_property;
     widget_class->size_request                  = hildon_time_editor_size_request;
     widget_class->size_allocate                 = hildon_time_editor_size_allocate;
+#ifdef MAEMO_GTK 
     widget_class->tap_and_hold_setup            = hildon_time_editor_tap_and_hold_setup;
+#endif
     widget_class->focus                         = hildon_private_composite_focus;
 
     container_class->forall                     = hildon_time_editor_forall;
@@ -455,6 +460,7 @@ hildon_time_editor_class_init                   (HildonTimeEditorClass *editor_c
                 G_PARAM_READABLE | G_PARAM_WRITABLE) );
 }
 
+#ifdef MAEMO_GTK 
 static void 
 hildon_time_editor_tap_and_hold_setup           (GtkWidget *widget,
                                                  GtkWidget *menu,
@@ -475,6 +481,7 @@ hildon_time_editor_tap_and_hold_setup           (GtkWidget *widget,
     gtk_widget_tap_and_hold_setup (priv->iconbutton, menu, func,
             GTK_TAP_AND_HOLD_NONE);
 }
+#endif
 
 static void 
 hildon_time_editor_entry_changed                (GtkWidget *widget, 
@@ -532,8 +539,10 @@ hildon_time_editor_init                         (HildonTimeEditor *editor)
         /* No frames for entries, so that they all appear to be inside one long entry */
         gtk_entry_set_has_frame (GTK_ENTRY (priv->entries[i]), FALSE);
 
+#ifdef MAEMO_GTK 
         /* Set the entries to accept only numeric characters */
         g_object_set (priv->entries[i], "hildon-input-mode", HILDON_GTK_INPUT_MODE_NUMERIC, NULL);
+#endif
 
         /* The entry fields all take exactly two characters */
         gtk_entry_set_max_length (GTK_ENTRY (priv->entries[i]), 2);