static GtkWidget* create_updating_page (ModestHildon2GlobalSettingsDialog *self);
-static gboolean on_range_error (HildonNumberEditor *editor,
- HildonNumberEditorErrorType type,
- gpointer user_data);
-
-static void on_size_notify (HildonNumberEditor *editor,
- GParamSpec *arg1,
- gpointer user_data);
-
static void on_auto_update_clicked (GtkButton *button,
gpointer user_data);
static void update_sensitive (ModestGlobalSettingsDialog *dialog);
{
ModestHildon2GlobalSettingsDialogPrivate *priv;
ModestGlobalSettingsDialogPrivate *ppriv;
+ GtkWidget *align;
+ GtkWidget *top_vbox;
priv = MODEST_HILDON2_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (self);
ppriv = MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (self);
ppriv->updating_page = create_updating_page (self);
+ top_vbox = gtk_vbox_new (FALSE, 0);
+ align = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
+ gtk_alignment_set_padding (GTK_ALIGNMENT (align), 0, 0, MODEST_MARGIN_DOUBLE, 0);
/* Add the buttons: */
gtk_dialog_add_button (GTK_DIALOG (self), _HL("wdgt_bd_save"), GTK_RESPONSE_OK);
g_object_set_data (G_OBJECT(ppriv->updating_page), DEFAULT_FOCUS_WIDGET,
(gpointer)ppriv->auto_update);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (self)->vbox), ppriv->updating_page);
+ gtk_container_add (GTK_CONTAINER (top_vbox), ppriv->updating_page);
+ gtk_container_add (GTK_CONTAINER (align), top_vbox);
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (self)->vbox), align);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (self)->vbox), MODEST_MARGIN_HALF);
- gtk_window_set_default_size (GTK_WINDOW (self), -1, 340);
+ gtk_window_set_default_size (GTK_WINDOW (self), -1, MODEST_DIALOG_WINDOW_MAX_HEIGHT);
+
+ gtk_widget_show (align);
+ gtk_widget_show (top_vbox);
}
static void
static GtkWidget*
create_updating_page (ModestHildon2GlobalSettingsDialog *self)
{
- GtkWidget *vbox, *vbox_update, *vbox_limit, *label, *hbox;
+ GtkWidget *vbox;
GtkSizeGroup *title_size_group;
GtkSizeGroup *value_size_group;
ModestGlobalSettingsDialogPrivate *ppriv;
- GtkWidget *pannable;
+ GtkWidget *pannable, *separator;
ModestHildon2GlobalSettingsDialogPrivate *priv;
priv = MODEST_HILDON2_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (self);
ppriv = MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (self);
vbox = gtk_vbox_new (FALSE, MODEST_MARGIN_HALF);
- vbox_update = gtk_vbox_new (FALSE, MODEST_MARGIN_HALF);
title_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
value_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- /* Auto update */
- ppriv->auto_update = hildon_check_button_new (MODEST_EDITABLE_SIZE);
- gtk_button_set_label (GTK_BUTTON (ppriv->auto_update), _("mcen_fi_options_autoupdate"));
- gtk_button_set_alignment (GTK_BUTTON (ppriv->auto_update), 0.0, 0.5);
- gtk_box_pack_start (GTK_BOX (vbox_update), ppriv->auto_update, FALSE, FALSE, MODEST_MARGIN_HALF);
- g_signal_connect (ppriv->auto_update, "clicked", G_CALLBACK (on_auto_update_clicked), self);
-
- /* Connected via */
-
- /* Note: This ModestPairList* must exist for as long as the picker
- * that uses it, because the ModestSelectorPicker uses the ID opaquely,
- * so it can't know how to manage its memory. */
- ppriv->connect_via_list = _modest_global_settings_dialog_get_connected_via ();
- ppriv->connect_via = modest_selector_picker_new (MODEST_EDITABLE_SIZE,
- HILDON_BUTTON_ARRANGEMENT_VERTICAL,
- ppriv->connect_via_list, g_int_equal);
- modest_maemo_utils_set_vbutton_layout (title_size_group,
- _("mcen_fi_options_connectiontype"),
- ppriv->connect_via);
- gtk_box_pack_start (GTK_BOX (vbox_update), ppriv->connect_via, FALSE, FALSE, MODEST_MARGIN_HALF);
-
- /* Update interval */
-
- /* Note: This ModestPairList* must exist for as long as the picker
- * that uses it, because the ModestSelectorPicker uses the ID opaquely,
- * so it can't know how to manage its memory. */
- ppriv->update_interval_list = _modest_global_settings_dialog_get_update_interval ();
- ppriv->update_interval = modest_selector_picker_new (MODEST_EDITABLE_SIZE,
- HILDON_BUTTON_ARRANGEMENT_VERTICAL,
- ppriv->update_interval_list, g_int_equal);
- modest_maemo_utils_set_vbutton_layout (title_size_group,
- _("mcen_fi_options_updateinterval"),
- ppriv->update_interval);
- gtk_box_pack_start (GTK_BOX (vbox_update), ppriv->update_interval, FALSE, FALSE, MODEST_MARGIN_HALF);
-
/* Default account selector */
ppriv->accounts_list = get_accounts_list ();
ppriv->default_account_selector = modest_selector_picker_new (MODEST_EDITABLE_SIZE,
ppriv->initial_state.default_account = default_account;
}
}
- modest_maemo_utils_set_vbutton_layout (title_size_group,
- _("mcen_ti_default_account"),
+ modest_maemo_utils_set_vbutton_layout (title_size_group,
+ _("mcen_ti_default_account"),
ppriv->default_account_selector);
- gtk_box_pack_start (GTK_BOX (vbox_update), ppriv->default_account_selector,
- FALSE, FALSE, MODEST_MARGIN_HALF);
+ gtk_box_pack_start (GTK_BOX (vbox), ppriv->default_account_selector,
+ FALSE, FALSE, 0);
- /* Add to vbox */
- gtk_box_pack_start (GTK_BOX (vbox), vbox_update, FALSE, FALSE, MODEST_MARGIN_HALF);
+ /* Message format */
+ /* Note: This ModestPairList* must exist for as long as the picker
+ * that uses it, because the ModestSelectorPicker uses the ID opaquely,
+ * so it can't know how to manage its memory. */
+ ppriv->msg_format_list = _modest_global_settings_dialog_get_msg_formats ();
+ ppriv->msg_format = modest_selector_picker_new (MODEST_EDITABLE_SIZE,
+ HILDON_BUTTON_ARRANGEMENT_VERTICAL,
+ ppriv->msg_format_list, g_int_equal);
+ modest_maemo_utils_set_vbutton_layout (title_size_group,
+ _("mcen_fi_options_messageformat"),
+ ppriv->msg_format);
- g_object_unref (title_size_group);
- g_object_unref (value_size_group);
+ gtk_box_pack_start (GTK_BOX (vbox), ppriv->msg_format, FALSE, FALSE, 0);
- /* Limits */
- vbox_limit = gtk_vbox_new (FALSE, MODEST_MARGIN_HALF);
- title_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- value_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ /* Separator label */
+ separator = gtk_label_new (_("mcen_ti_updating"));
+ gtk_label_set_justify ((GtkLabel *) separator, GTK_JUSTIFY_CENTER);
+ gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, MODEST_MARGIN_DEFAULT);
- /* 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);
- 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"));
- hbox = gtk_hbox_new (FALSE, MODEST_MARGIN_HALF);
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), ppriv->size_limit, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (vbox_limit), hbox, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_box_pack_start (GTK_BOX (vbox), vbox_limit, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show_all (vbox_limit);
+ /* Auto update */
+ ppriv->auto_update = hildon_check_button_new (MODEST_EDITABLE_SIZE);
+ gtk_button_set_label (GTK_BUTTON (ppriv->auto_update), _("mcen_fi_options_autoupdate"));
+ gtk_button_set_alignment (GTK_BUTTON (ppriv->auto_update), 0.0, 0.5);
+ gtk_box_pack_start (GTK_BOX (vbox), ppriv->auto_update, FALSE, FALSE, 0);
+ g_signal_connect (ppriv->auto_update, "clicked", G_CALLBACK (on_auto_update_clicked), self);
+
+ /* Connected via */
/* Note: This ModestPairList* must exist for as long as the picker
* that uses it, because the ModestSelectorPicker uses the ID opaquely,
* so it can't know how to manage its memory. */
- ppriv->msg_format_list = _modest_global_settings_dialog_get_msg_formats ();
- ppriv->msg_format = modest_selector_picker_new (MODEST_EDITABLE_SIZE,
- HILDON_BUTTON_ARRANGEMENT_VERTICAL,
- ppriv->msg_format_list, g_int_equal);
+ ppriv->connect_via_list = _modest_global_settings_dialog_get_connected_via ();
+ ppriv->connect_via = modest_selector_picker_new (MODEST_EDITABLE_SIZE,
+ HILDON_BUTTON_ARRANGEMENT_VERTICAL,
+ ppriv->connect_via_list, g_int_equal);
modest_maemo_utils_set_vbutton_layout (title_size_group,
- _("mcen_fi_options_messageformat"),
- ppriv->msg_format);
+ _("mcen_fi_options_connectiontype"),
+ ppriv->connect_via);
+ gtk_box_pack_start (GTK_BOX (vbox), ppriv->connect_via, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), ppriv->msg_format, FALSE, FALSE, MODEST_MARGIN_HALF);
+ /* Update interval */
+
+ /* Note: This ModestPairList* must exist for as long as the picker
+ * that uses it, because the ModestSelectorPicker uses the ID opaquely,
+ * so it can't know how to manage its memory. */
+ ppriv->update_interval_list = _modest_global_settings_dialog_get_update_interval ();
+ ppriv->update_interval = modest_selector_picker_new (MODEST_EDITABLE_SIZE,
+ HILDON_BUTTON_ARRANGEMENT_VERTICAL,
+ ppriv->update_interval_list, g_int_equal);
+ modest_maemo_utils_set_vbutton_layout (title_size_group,
+ _("mcen_fi_options_updateinterval"),
+ ppriv->update_interval);
+ gtk_box_pack_start (GTK_BOX (vbox), ppriv->update_interval, FALSE, FALSE, 0);
pannable = g_object_new (HILDON_TYPE_PANNABLE_AREA, "initial-hint", TRUE, NULL);
g_return_if_fail (MODEST_IS_GLOBAL_SETTINGS_DIALOG (user_data));
update_sensitive ((ModestGlobalSettingsDialog *) user_data);
}
-static gboolean
-on_range_error (HildonNumberEditor *editor,
- HildonNumberEditorErrorType type,
- gpointer user_data)
-{
- gchar *msg;
- gint new_val;
-
- switch (type) {
- case HILDON_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:
- 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:
- msg = g_strdup_printf (dgettext("hildon-libs", "ckct_ib_set_a_value_within_range"),
- MSG_SIZE_MIN_VAL,
- MSG_SIZE_MAX_VAL);
- /* FIXME: use the previous */
- new_val = MSG_SIZE_DEF_VAL;
- break;
- default:
- g_return_val_if_reached (FALSE);
- }
-
- /* Restore value */
- hildon_number_editor_set_value (editor, new_val);
-
- /* Show error */
- hildon_banner_show_information (GTK_WIDGET (user_data), NULL, msg);
-
- /* Free */
- g_free (msg);
- return TRUE;
+static ModestConnectedVia
+current_connection (void)
+{
+ return modest_platform_get_current_connection ();
}
-static void
-on_size_notify (HildonNumberEditor *editor,
- GParamSpec *arg1,
- gpointer user_data)
+static gint
+order_by_acc_name (gconstpointer a,
+ gconstpointer b)
{
- ModestHildon2GlobalSettingsDialog *dialog = MODEST_HILDON2_GLOBAL_SETTINGS_DIALOG (user_data);
- gint value = hildon_number_editor_get_value (editor);
+ ModestPair *pair_a, *pair_b;
- gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, value > 0);
-}
+ pair_a = (ModestPair *) a;
+ pair_b = (ModestPair *) b;
-static ModestConnectedVia
-current_connection (void)
-{
- return modest_platform_get_current_connection ();
+ if (pair_a->second && pair_b->second) {
+ gint compare = g_utf8_collate ((gchar *) pair_a->second,
+ (gchar *) pair_b->second);
+ if (compare > 0)
+ compare = -1;
+ else if (compare < 0)
+ compare = 1;
+
+ return compare;
+ } else {
+ return 0;
+ }
}
-static ModestPairList *
+static ModestPairList *
get_accounts_list (void)
{
GSList *list = NULL;
gchar *account_name;
ModestAccountSettings *settings;
ModestServerAccountSettings *store_settings;
-
+
account_name = (gchar*)cursor->data;
-
+
settings = modest_account_mgr_load_account_settings (account_mgr, account_name);
if (!settings) {
g_printerr ("modest: failed to get account data for %s\n", account_name);
+ cursor = cursor->next;
continue;
}
store_settings = modest_account_settings_get_store_settings (settings);
g_strdup (account_name),
g_strdup (modest_account_settings_get_display_name (settings)),
FALSE);
- list = g_slist_prepend (list, pair);
+ list = g_slist_insert_sorted (list, pair, order_by_acc_name);
}
}
{
ModestConf *conf;
gboolean checked;
- gint combo_id, value;
+ gint combo_id;
GError *error = NULL;
ModestGlobalSettingsDialogPrivate *ppriv;
(gpointer) &combo_id);
ppriv->initial_state.connect_via = combo_id;
- /* Emit toggled to update the visibility of connect_by caption */
- gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (ppriv->auto_update));
-
/* Update interval */
combo_id = modest_conf_get_int (conf, MODEST_CONF_UPDATE_INTERVAL, &error);
if (error) {
(gpointer) &combo_id);
ppriv->initial_state.update_interval = combo_id;
- /* Size limit */
- value = modest_conf_get_int (conf, MODEST_CONF_MSG_SIZE_LIMIT, &error);
- if (error) {
- g_error_free (error);
- error = NULL;
- value = 1000;
- }
- /* 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);
- ppriv->initial_state.size_limit = value;
-
/* Play sound */
checked = modest_conf_get_bool (conf, MODEST_CONF_PLAY_SOUND_MSG_ARRIVE, &error);
if (error) {
error = NULL;
checked = FALSE;
}
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ppriv->play_sound), checked);
ppriv->initial_state.play_sound = checked;
/* Msg format */