From: Jose Dapena Paz Date: Wed, 17 Dec 2008 11:29:30 +0000 (+0000) Subject: Global settings number editor migrated in hildon 2.2 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=f0a51964611b70ac0641b63f79cb689090e8091a Global settings number editor migrated in hildon 2.2 pmo-drop-split-view-r6913 --- diff --git a/src/hildon2/modest-default-account-settings-dialog.c b/src/hildon2/modest-default-account-settings-dialog.c index a8a1a09..048da3d 100644 --- a/src/hildon2/modest-default-account-settings-dialog.c +++ b/src/hildon2/modest-default-account-settings-dialog.c @@ -212,16 +212,16 @@ on_modified_checkbutton_toggled (GtkButton *button, gpointer user_data) } static void -on_modified_number_editor_changed (HildonNumberEditor *number_editor, gint new_value, gpointer user_data) +on_modified_number_editor_changed (ModestNumberEditor *number_editor, gint new_value, gpointer user_data) { set_modified (MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG (user_data), TRUE); } static void -on_number_editor_notify (HildonNumberEditor *editor, GParamSpec *arg1, gpointer user_data) +on_number_editor_notify (ModestNumberEditor *editor, GParamSpec *arg1, gpointer user_data) { ModestDefaultAccountSettingsDialog *dialog = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG (user_data); - gint value = hildon_number_editor_get_value (editor); + gint value = modest_number_editor_get_value (editor); gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, value > 0); } @@ -232,7 +232,7 @@ on_number_editor_notify (HildonNumberEditor *editor, GParamSpec *arg1, gpointer static void connect_for_modified (ModestDefaultAccountSettingsDialog *self, GtkWidget *widget) { - if (HILDON_IS_NUMBER_EDITOR (widget)) { + if (MODEST_IS_NUMBER_EDITOR (widget)) { g_signal_connect (G_OBJECT (widget), "notify::value", G_CALLBACK (on_modified_number_editor_changed), self); g_signal_connect (G_OBJECT (widget), "notify", G_CALLBACK (on_number_editor_notify), self); diff --git a/src/hildon2/modest-hildon-includes.h b/src/hildon2/modest-hildon-includes.h index 458e745..74dfc49 100644 --- a/src/hildon2/modest-hildon-includes.h +++ b/src/hildon2/modest-hildon-includes.h @@ -70,6 +70,7 @@ #include #include #include +#include #include #include #include diff --git a/src/hildon2/modest-hildon2-global-settings-dialog.c b/src/hildon2/modest-hildon2-global-settings-dialog.c index 5f8afc6..1167487 100644 --- a/src/hildon2/modest-hildon2-global-settings-dialog.c +++ b/src/hildon2/modest-hildon2-global-settings-dialog.c @@ -68,11 +68,11 @@ static ModestConnectedVia current_connection (void); static GtkWidget* create_updating_page (ModestHildon2GlobalSettingsDialog *self); -static gboolean on_range_error (HildonNumberEditor *editor, - HildonNumberEditorErrorType type, +static gboolean on_range_error (ModestNumberEditor *editor, + ModestNumberEditorErrorType type, gpointer user_data); -static void on_size_notify (HildonNumberEditor *editor, +static void on_size_notify (ModestNumberEditor *editor, GParamSpec *arg1, gpointer user_data); @@ -278,8 +278,8 @@ create_updating_page (ModestHildon2GlobalSettingsDialog *self) value_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); /* Size limit */ - ppriv->size_limit = hildon_number_editor_new (MSG_SIZE_MIN_VAL, MSG_SIZE_MAX_VAL); - hildon_number_editor_set_value (HILDON_NUMBER_EDITOR (ppriv->size_limit), MSG_SIZE_DEF_VAL); + ppriv->size_limit = modest_number_editor_new (MSG_SIZE_MIN_VAL, MSG_SIZE_MAX_VAL); + modest_number_editor_set_value (MODEST_NUMBER_EDITOR (ppriv->size_limit), MSG_SIZE_DEF_VAL); g_signal_connect (ppriv->size_limit, "range_error", G_CALLBACK (on_range_error), self); g_signal_connect (ppriv->size_limit, "notify", G_CALLBACK (on_size_notify), self); label = gtk_label_new (_("mcen_fi_advsetup_sizelimit")); @@ -341,23 +341,23 @@ on_auto_update_clicked (GtkButton *button, update_sensitive ((ModestGlobalSettingsDialog *) user_data); } static gboolean -on_range_error (HildonNumberEditor *editor, - HildonNumberEditorErrorType type, +on_range_error (ModestNumberEditor *editor, + ModestNumberEditorErrorType type, gpointer user_data) { gchar *msg; gint new_val; switch (type) { - case HILDON_NUMBER_EDITOR_ERROR_MAXIMUM_VALUE_EXCEED: + case MODEST_NUMBER_EDITOR_ERROR_MAXIMUM_VALUE_EXCEED: msg = g_strdup_printf (dgettext("hildon-libs", "ckct_ib_maximum_value"), MSG_SIZE_MAX_VAL); new_val = MSG_SIZE_MAX_VAL; break; - case HILDON_NUMBER_EDITOR_ERROR_MINIMUM_VALUE_EXCEED: + case MODEST_NUMBER_EDITOR_ERROR_MINIMUM_VALUE_EXCEED: msg = g_strdup_printf (dgettext("hildon-libs", "ckct_ib_minimum_value"), MSG_SIZE_MIN_VAL); new_val = MSG_SIZE_MIN_VAL; break; - case HILDON_NUMBER_EDITOR_ERROR_ERRONEOUS_VALUE: + case MODEST_NUMBER_EDITOR_ERROR_ERRONEOUS_VALUE: msg = g_strdup_printf (dgettext("hildon-libs", "ckct_ib_set_a_value_within_range"), MSG_SIZE_MIN_VAL, MSG_SIZE_MAX_VAL); @@ -369,7 +369,7 @@ on_range_error (HildonNumberEditor *editor, } /* Restore value */ - hildon_number_editor_set_value (editor, new_val); + modest_number_editor_set_value (editor, new_val); /* Show error */ hildon_banner_show_information (GTK_WIDGET (user_data), NULL, msg); @@ -381,12 +381,12 @@ on_range_error (HildonNumberEditor *editor, } static void -on_size_notify (HildonNumberEditor *editor, +on_size_notify (ModestNumberEditor *editor, GParamSpec *arg1, gpointer user_data) { ModestHildon2GlobalSettingsDialog *dialog = MODEST_HILDON2_GLOBAL_SETTINGS_DIALOG (user_data); - gint value = hildon_number_editor_get_value (editor); + gint value = modest_number_editor_get_value (editor); gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, value > 0); } @@ -500,7 +500,7 @@ modest_hildon2_global_settings_dialog_load_settings (ModestGlobalSettingsDialog } /* It's better to do this in the subclasses, but it's just one line, so we'll leave it here for the moment */ - hildon_number_editor_set_value (HILDON_NUMBER_EDITOR (ppriv->size_limit), value); + modest_number_editor_set_value (MODEST_NUMBER_EDITOR (ppriv->size_limit), value); ppriv->initial_state.size_limit = value; /* Play sound */ diff --git a/src/widgets/modest-global-settings-dialog.c b/src/widgets/modest-global-settings-dialog.c index 61400f8..77892e7 100644 --- a/src/widgets/modest-global-settings-dialog.c +++ b/src/widgets/modest-global-settings-dialog.c @@ -274,7 +274,11 @@ get_current_settings (ModestGlobalSettingsDialogPrivate *priv, #endif state->connect_via = *id; #ifndef MODEST_TOOLKIT_GTK +#ifdef MODEST_TOOLKIT_HILDON2 + state->size_limit = modest_number_editor_get_value (MODEST_NUMBER_EDITOR (priv->size_limit)); +#else state->size_limit = hildon_number_editor_get_value (HILDON_NUMBER_EDITOR (priv->size_limit)); +#endif #else state->size_limit = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->size_limit)); #endif