#endif /*HAVE_CONFIG_H*/
#include <modest-hildon-includes.h>
+#include <modest-scrollable.h>
#include <modest-maemo-utils.h>
#include <glib/gi18n.h>
#include <gtk/gtkcheckbutton.h>
#include "modest-runtime.h"
#include "widgets/modest-global-settings-dialog-priv.h"
-#include "modest-selector-picker.h"
-#include "hildon/hildon-pannable-area.h"
#include "modest-hildon2-global-settings-dialog.h"
#include "widgets/modest-ui-constants.h"
#include "modest-text-utils.h"
#include "modest-defs.h"
#include <tny-account-store.h>
#include <modest-account-mgr-helpers.h>
+#include <modest-toolkit-utils.h>
#define MSG_SIZE_MAX_VAL 5000
static GtkWidget*
create_updating_page (ModestHildon2GlobalSettingsDialog *self)
{
- GtkWidget *vbox, *vbox_update;
+ GtkWidget *vbox;
GtkSizeGroup *title_size_group;
GtkSizeGroup *value_size_group;
ModestGlobalSettingsDialogPrivate *ppriv;
- GtkWidget *pannable;
+ GtkWidget *scrollable, *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, 0);
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, 0);
-
- /* 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, 0);
-
/* Default account selector */
ppriv->accounts_list = get_accounts_list ();
- ppriv->default_account_selector = modest_selector_picker_new (MODEST_EDITABLE_SIZE,
- HILDON_BUTTON_ARRANGEMENT_VERTICAL,
- ppriv->accounts_list,
- g_str_equal);
+ ppriv->default_account_selector = modest_toolkit_factory_create_selector (modest_runtime_get_toolkit_factory (),
+ ppriv->accounts_list,
+ g_str_equal);
if (ppriv->accounts_list == NULL) {
gtk_widget_set_sensitive (GTK_WIDGET (ppriv->default_account_selector), FALSE);
} else {
default_account = modest_account_mgr_get_default_account (
modest_runtime_get_account_mgr ());
if (default_account) {
- modest_selector_picker_set_active_id (
- MODEST_SELECTOR_PICKER (ppriv->default_account_selector),
- default_account);
+ modest_selector_set_active_id (ppriv->default_account_selector,
+ default_account);
ppriv->initial_state.default_account = 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, 0);
+ if (GTK_IS_COMBO_BOX (ppriv->default_account_selector)) {
+ GtkWidget *caption;
+
+ caption = modest_toolkit_utils_create_vcaptioned (title_size_group,
+ _("mcen_ti_default_account"), FALSE,
+ ppriv->default_account_selector);
+ gtk_widget_show (caption);
+ gtk_box_pack_start (GTK_BOX (vbox), caption,
+ FALSE, FALSE, 0);
+ } else {
+ modest_toolkit_utils_set_vbutton_layout (title_size_group,
+ _("mcen_ti_default_account"),
+ ppriv->default_account_selector);
+ gtk_box_pack_start (GTK_BOX (vbox), ppriv->default_account_selector,
+ FALSE, FALSE, 0);
+ }
+
+ /* 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_toolkit_factory_create_selector (modest_runtime_get_toolkit_factory (),
+ ppriv->msg_format_list, g_int_equal);
+ if (GTK_IS_COMBO_BOX (ppriv->msg_format)) {
+ GtkWidget *caption;
+ caption = modest_toolkit_utils_create_vcaptioned (title_size_group,
+ _("mcen_fi_options_messageformat"), FALSE,
+ ppriv->msg_format);
+ gtk_widget_show (caption);
+ gtk_box_pack_start (GTK_BOX (vbox), caption, FALSE, FALSE, 0);
+ } else {
+ modest_toolkit_utils_set_vbutton_layout (title_size_group,
+ _("mcen_fi_options_messageformat"),
+ ppriv->msg_format);
+ gtk_box_pack_start (GTK_BOX (vbox), ppriv->msg_format, FALSE, FALSE, 0);
+ }
- /* Add to vbox */
- gtk_box_pack_start (GTK_BOX (vbox), vbox_update, FALSE, FALSE, 0);
- g_object_unref (title_size_group);
- g_object_unref (value_size_group);
+ /* Incoming notifications */
+ ppriv->notifications = hildon_check_button_new (MODEST_EDITABLE_SIZE);
+ gtk_button_set_label (GTK_BUTTON (ppriv->notifications), _("mcen_fi_options_incoming_notifications"));
+ gtk_button_set_alignment (GTK_BUTTON (ppriv->notifications), 0.0, 0.5);
+ gtk_box_pack_start (GTK_BOX (vbox), ppriv->notifications, FALSE, FALSE, 0);
- /* Limits */
- title_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- value_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ /* Automatic add to contacts */
+ ppriv->add_to_contacts = hildon_check_button_new (MODEST_EDITABLE_SIZE);
+ gtk_button_set_label (GTK_BUTTON (ppriv->add_to_contacts), _("mcen_fi_options_automatic_add"));
+ gtk_button_set_alignment (GTK_BUTTON (ppriv->add_to_contacts), 0.0, 0.5);
+ gtk_box_pack_start (GTK_BOX (vbox), ppriv->add_to_contacts, FALSE, FALSE, 0);
+
+ /* 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);
+
+ /* Auto update */
+ ppriv->auto_update = modest_toolkit_factory_create_check_button (modest_runtime_get_toolkit_factory (),
+ _("mcen_fi_options_autoupdate"));
+ 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);
- modest_maemo_utils_set_vbutton_layout (title_size_group,
- _("mcen_fi_options_messageformat"),
- ppriv->msg_format);
+ ppriv->connect_via_list = _modest_global_settings_dialog_get_connected_via ();
+ ppriv->connect_via = modest_toolkit_factory_create_selector (modest_runtime_get_toolkit_factory (),
+ ppriv->connect_via_list, g_int_equal);
+ if (GTK_IS_COMBO_BOX (ppriv->connect_via)) {
+ GtkWidget *caption;
+ caption = modest_toolkit_utils_create_vcaptioned (title_size_group,
+ _("mcen_fi_options_connectiontype"), FALSE,
+ ppriv->connect_via);
+ gtk_widget_show (caption);
+ gtk_box_pack_start (GTK_BOX (vbox), caption, FALSE, FALSE, 0);
+ } else {
+ modest_toolkit_utils_set_vbutton_layout (title_size_group,
+ _("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, 0);
+ /* Update interval */
- pannable = g_object_new (HILDON_TYPE_PANNABLE_AREA, "initial-hint", TRUE, NULL);
+ /* 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_toolkit_factory_create_selector (modest_runtime_get_toolkit_factory (),
+ ppriv->update_interval_list, g_int_equal);
+ if (GTK_IS_COMBO_BOX (ppriv->update_interval)) {
+ GtkWidget *caption;
+ caption = modest_toolkit_utils_create_vcaptioned (title_size_group,
+ _("mcen_fi_options_updateinterval"), FALSE,
+ ppriv->update_interval);
+ gtk_widget_show (caption);
+ gtk_box_pack_start (GTK_BOX (vbox), caption, FALSE, FALSE, 0);
+ } else {
+ modest_toolkit_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);
+ }
+
+ scrollable = modest_toolkit_factory_create_scrollable (modest_runtime_get_toolkit_factory ());
- hildon_pannable_area_add_with_viewport (HILDON_PANNABLE_AREA (pannable), vbox);
+ modest_scrollable_add_with_viewport (MODEST_SCROLLABLE (scrollable), vbox);
gtk_widget_show (vbox);
- gtk_widget_show (pannable);
+ gtk_widget_show (scrollable);
g_object_unref (title_size_group);
g_object_unref (value_size_group);
- return pannable;
+ return scrollable;
}
g_return_if_fail (MODEST_IS_GLOBAL_SETTINGS_DIALOG (dialog));
ppriv = MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (dialog);
- if (hildon_check_button_get_active (HILDON_CHECK_BUTTON (ppriv->auto_update))) {
+ if (modest_togglable_get_active (ppriv->auto_update)) {
gtk_widget_set_sensitive (ppriv->connect_via, TRUE);
gtk_widget_set_sensitive (ppriv->update_interval, TRUE);
} else {
ppriv = MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (self);
conf = modest_runtime_get_conf ();
+ /* Incoming notifications */
+ checked = modest_conf_get_bool (conf, MODEST_CONF_NOTIFICATIONS, &error);
+ if (error) {
+ g_clear_error (&error);
+ error = NULL;
+ checked = FALSE;
+ }
+ hildon_check_button_set_active (HILDON_CHECK_BUTTON (ppriv->notifications), checked);
+ ppriv->initial_state.notifications = checked;
+
+ /* Add to contacts */
+ checked = modest_conf_get_bool (conf, MODEST_CONF_AUTO_ADD_TO_CONTACTS, &error);
+ if (error) {
+ g_clear_error (&error);
+ error = NULL;
+ checked = FALSE;
+ }
+ hildon_check_button_set_active (HILDON_CHECK_BUTTON (ppriv->add_to_contacts), checked);
+ ppriv->initial_state.add_to_contacts = checked;
+
/* Autoupdate */
checked = modest_conf_get_bool (conf, MODEST_CONF_AUTO_UPDATE, &error);
if (error) {
error = NULL;
checked = FALSE;
}
- hildon_check_button_set_active (HILDON_CHECK_BUTTON (ppriv->auto_update), checked);
+ modest_togglable_set_active (ppriv->auto_update, checked);
ppriv->initial_state.auto_update = checked;
/* Connected by */
error = NULL;
combo_id = MODEST_CONNECTED_VIA_WLAN_OR_WIMAX;
}
- modest_selector_picker_set_active_id (MODEST_SELECTOR_PICKER (ppriv->connect_via),
- (gpointer) &combo_id);
+ modest_selector_set_active_id (ppriv->connect_via,
+ (gpointer) &combo_id);
ppriv->initial_state.connect_via = combo_id;
/* Update interval */
error = NULL;
combo_id = MODEST_UPDATE_INTERVAL_15_MIN;
}
- modest_selector_picker_set_active_id (MODEST_SELECTOR_PICKER (ppriv->update_interval),
- (gpointer) &combo_id);
+ modest_selector_set_active_id (ppriv->update_interval,
+ (gpointer) &combo_id);
ppriv->initial_state.update_interval = combo_id;
/* Play sound */
combo_id = MODEST_FILE_FORMAT_FORMATTED_TEXT;
}
combo_id = (checked) ? MODEST_FILE_FORMAT_FORMATTED_TEXT : MODEST_FILE_FORMAT_PLAIN_TEXT;
- modest_selector_picker_set_active_id (MODEST_SELECTOR_PICKER (ppriv->msg_format),
- (gpointer) &combo_id);
+ modest_selector_set_active_id (ppriv->msg_format,
+ (gpointer) &combo_id);
ppriv->initial_state.prefer_formatted_text = checked;
/* force update of sensitiveness */