From: Sergio Villar SenĂ­n Date: Thu, 26 Nov 2009 10:35:11 +0000 (+0100) Subject: Added two new options to global settings dialog X-Git-Tag: 3.2.2~8 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=0e377cfc61f7e67a47e50096e1ad4a3dead53731 Added two new options to global settings dialog Added "Incoming notifications" and "Automatically add to contacts" options to the global settings dialog --- diff --git a/src/hildon2/modest-hildon2-global-settings-dialog.c b/src/hildon2/modest-hildon2-global-settings-dialog.c index ac94324..aae5568 100644 --- a/src/hildon2/modest-hildon2-global-settings-dialog.c +++ b/src/hildon2/modest-hildon2-global-settings-dialog.c @@ -246,6 +246,18 @@ create_updating_page (ModestHildon2GlobalSettingsDialog *self) gtk_box_pack_start (GTK_BOX (vbox), ppriv->msg_format, FALSE, FALSE, 0); + /* 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); + + /* 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); @@ -413,6 +425,26 @@ modest_hildon2_global_settings_dialog_load_settings (ModestGlobalSettingsDialog 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) { diff --git a/src/modest-defs.h b/src/modest-defs.h index 71bd007..4198225 100644 --- a/src/modest-defs.h +++ b/src/modest-defs.h @@ -240,6 +240,8 @@ const gchar *modest_defs_namespace (const gchar *string); #define MODEST_CONF_PREFER_FORMATTED_TEXT (modest_defs_namespace ("/prefer_formatted_text")) /* bool */ #define MODEST_CONF_REPLY_TYPE (modest_defs_namespace ("/reply_type")) /* int */ #define MODEST_CONF_FORWARD_TYPE (modest_defs_namespace ("/forward_type")) /* int */ +#define MODEST_CONF_NOTIFICATIONS (modest_defs_namespace ("/notifications")) /* bool */ +#define MODEST_CONF_AUTO_ADD_TO_CONTACTS (modest_defs_namespace ("/auto_add_to_contacs")) /* bool */ /* hidden global settings */ #define MODEST_CONF_FETCH_HTML_EXTERNAL_IMAGES (modest_defs_namespace ("/fetch_external_images")) /* bool */ diff --git a/src/modest-init.c b/src/modest-init.c index ce4161f..7880ee6 100644 --- a/src/modest-init.c +++ b/src/modest-init.c @@ -756,6 +756,12 @@ init_default_settings (ModestConf *conf) if (!modest_conf_key_exists (conf, MODEST_CONF_AUTO_UPDATE, NULL)) modest_conf_set_bool (conf, MODEST_CONF_AUTO_UPDATE, TRUE, NULL); + if (!modest_conf_key_exists (conf, MODEST_CONF_NOTIFICATIONS, NULL)) + modest_conf_set_bool (conf, MODEST_CONF_NOTIFICATIONS, TRUE, NULL); + + if (!modest_conf_key_exists (conf, MODEST_CONF_AUTO_ADD_TO_CONTACTS, NULL)) + modest_conf_set_bool (conf, MODEST_CONF_AUTO_ADD_TO_CONTACTS, TRUE, NULL); + if (!modest_conf_key_exists (conf, MODEST_CONF_UPDATE_WHEN_CONNECTED_BY, NULL)) modest_conf_set_int (conf, MODEST_CONF_UPDATE_WHEN_CONNECTED_BY, MODEST_CONNECTED_VIA_WLAN_OR_WIMAX, NULL); diff --git a/src/widgets/modest-global-settings-dialog-priv.h b/src/widgets/modest-global-settings-dialog-priv.h index b1f055d..7e49fc4 100644 --- a/src/widgets/modest-global-settings-dialog-priv.h +++ b/src/widgets/modest-global-settings-dialog-priv.h @@ -40,9 +40,11 @@ typedef struct _ModestGlobalSettingsState { gint connect_via; gint update_interval; gint size_limit; - gchar *default_account; + gchar *default_account; gboolean play_sound; gboolean prefer_formatted_text; + gboolean notifications; + gboolean add_to_contacts; } ModestGlobalSettingsState; typedef struct _ModestGlobalSettingsDialogPrivate ModestGlobalSettingsDialogPrivate; @@ -68,6 +70,9 @@ struct _ModestGlobalSettingsDialogPrivate { ModestPairList *msg_format_list; GtkWidget *msg_format; + GtkWidget *notifications; + GtkWidget *add_to_contacts; + ModestGlobalSettingsState initial_state; }; diff --git a/src/widgets/modest-global-settings-dialog.c b/src/widgets/modest-global-settings-dialog.c index 62f34c8..a30d6cb 100644 --- a/src/widgets/modest-global-settings-dialog.c +++ b/src/widgets/modest-global-settings-dialog.c @@ -252,13 +252,16 @@ get_current_settings (ModestGlobalSettingsDialogPrivate *priv, { gint *id; - /* Get values from UI */ #ifdef MODEST_TOOLKIT_HILDON2 id = modest_selector_picker_get_active_id (MODEST_SELECTOR_PICKER (priv->connect_via)); state->auto_update = hildon_check_button_get_active (HILDON_CHECK_BUTTON (priv->auto_update)); + state->notifications = hildon_check_button_get_active (HILDON_CHECK_BUTTON (priv->notifications)); + state->add_to_contacts = hildon_check_button_get_active (HILDON_CHECK_BUTTON (priv->add_to_contacts)); state->default_account = modest_selector_picker_get_active_id (MODEST_SELECTOR_PICKER (priv->default_account_selector)); #else id = modest_combo_box_get_active_id (MODEST_COMBO_BOX (priv->connect_via)); + state->notifications = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->notifications)); + state->add_to_contacts = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->add_to_contacts)); state->auto_update = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->auto_update)); state->default_account = NULL; #endif @@ -308,6 +311,10 @@ modest_global_settings_dialog_save_settings_default (ModestGlobalSettingsDialog get_current_settings (priv, ¤t_state); /* Save configuration */ + modest_conf_set_bool (conf, MODEST_CONF_NOTIFICATIONS, current_state.notifications, &error); + RETURN_FALSE_ON_ERROR(error); + modest_conf_set_bool (conf, MODEST_CONF_AUTO_ADD_TO_CONTACTS, current_state.add_to_contacts, &error); + RETURN_FALSE_ON_ERROR(error); modest_conf_set_bool (conf, MODEST_CONF_AUTO_UPDATE, current_state.auto_update, &error); RETURN_FALSE_ON_ERROR(error); modest_conf_set_int (conf, MODEST_CONF_UPDATE_WHEN_CONNECTED_BY, current_state.connect_via, NULL); @@ -331,7 +338,7 @@ modest_global_settings_dialog_save_settings_default (ModestGlobalSettingsDialog if (priv->initial_state.auto_update != current_state.auto_update || priv->initial_state.connect_via != current_state.connect_via || priv->initial_state.update_interval != current_state.update_interval) { - + TnyAccountStore *account_store; TnyDevice *device; @@ -377,6 +384,8 @@ settings_changed (ModestGlobalSettingsState initial_state, ModestGlobalSettingsState current_state) { if (initial_state.auto_update != current_state.auto_update || + initial_state.notifications != current_state.notifications || + initial_state.add_to_contacts != current_state.add_to_contacts || initial_state.connect_via != current_state.connect_via || initial_state.update_interval != current_state.update_interval || initial_state.size_limit != current_state.size_limit ||