Make e_utils_prompt_user and callers use GSettings keys

This commit is contained in:
Rodrigo Moya
2011-10-14 13:46:33 +02:00
parent 46b0d7f513
commit 5efdc804e4
6 changed files with 35 additions and 27 deletions

View File

@ -80,7 +80,6 @@ address-count = /apps/evolution/mail/display/address_count
animate-images = /apps/evolution/mail/display/animate_images
caret-mode = /apps/evolution/mail/display/caret_mode
charset = /apps/evolution/mail/display/charset
check-if-default-mailer = /apps/evolution/mail/prompts/checkdefault
citation-colour = /apps/evolution/mail/display/citation_colour
composer-charset = /apps/evolution/mail/composer/charset
composer-current-folder = /apps/evolution/mail/composer/current_folder
@ -147,9 +146,12 @@ monospace-font = /apps/evolution/mail/display/fonts/monospace
no-folder-dots = /apps/evolution/mail/display/no_folder_dots
paned-size = /apps/evolution/mail/display/paned_size
photo-local = /apps/evolution/mail/display/photo_local
prompt-check-if-default-mailer = /apps/evolution/mail/prompts/checkdefault
prompt-on-delete-in-vfolder = /apps/evolution/mail/prompts/delete_in_vfolder
prompt-on-empty-subject = /apps/evolution/mail/prompts/empty_subject
prompt-on-empty-trash = /apps/evolution/mail/prompts/empty_trash
prompt-on-expunge = /apps/evolution/mail/prompts/expunge
prompt-on-invalid-recip = /apps/evolution/mail/prompts/send_invalid_recip
prompt-on-list-reply-to = /apps/evolution/mail/prompts/list_reply_to
prompt-on-mark-all-read = /apps/evolution/mail/prompts/mark_all_read
prompt-on-only-bcc = /apps/evolution/mail/prompts/only_bcc

View File

@ -1,6 +1,6 @@
<schemalist>
<schema gettext-domain="evolution" id="org.gnome.evolution.mail" path="/org/gnome/evolution/mail/">
<key name="check-if-default-mailer" type="b">
<key name="prompt-check-if-default-mailer" type="b">
<default>true</default>
<_summary>Check whether Evolution is the default mailer</_summary>
<_description>Every time Evolution starts, check whether or not it is the default mailer.</_description>
@ -360,11 +360,21 @@
<_summary>Prompt on empty subject</_summary>
<_description>Prompt the user when he or she tries to send a message without a Subject.</_description>
</key>
<key name="prompt-on-empty-trash" type="b">
<default>true</default>
<_summary>Prompt when emptying the trash</_summary>
<_description>Prompt the user when he or she tries to empty the trash.</_description>
</key>
<key name="prompt-on-expunge" type="b">
<default>true</default>
<_summary>Prompt when user expunges</_summary>
<_description>Prompt the user when he or she tries to expunge a folder.</_description>
</key>
<key name="prompt-on-invalid-recip" type="b">
<default>true</default>
<_summary>Prompt before sending to recipients not entered as mail addresses</_summary>
<_description>It disables/enables the repeated prompts to warn that you are trying to send a message to recipients not entered as mail addresses</_description>
</key>
<key name="prompt-on-only-bcc" type="b">
<default>true</default>
<_summary>Prompt when user only fills Bcc</_summary>

View File

@ -159,7 +159,7 @@ ask_confirm_for_unwanted_html_mail (EMsgComposer *composer,
if (str->len)
res = em_utils_prompt_user (
GTK_WINDOW (composer),
"/apps/evolution/mail/prompts/unwanted_html",
"prompt-on-unwanted-html",
"mail:ask-send-html", str->str, NULL);
else
res = TRUE;
@ -174,7 +174,7 @@ ask_confirm_for_empty_subject (EMsgComposer *composer)
{
return em_utils_prompt_user (
GTK_WINDOW (composer),
"/apps/evolution/mail/prompts/empty_subject",
"prompt-on-empty-subject",
"mail:ask-send-no-subject", NULL);
}
@ -190,7 +190,7 @@ ask_confirm_for_only_bcc (EMsgComposer *composer,
return em_utils_prompt_user (
GTK_WINDOW (composer),
"/apps/evolution/mail/prompts/only_bcc",
"prompt-on-only-bcc",
hidden_list_case ?
"mail:ask-send-only-bcc-contact" :
"mail:ask-send-only-bcc", NULL);
@ -333,7 +333,7 @@ composer_presend_check_recipients (EMsgComposer *composer)
if (invalid_addrs) {
if (!em_utils_prompt_user (
GTK_WINDOW (composer),
"/apps/evolution/mail/prompts/send_invalid_recip",
"prompt-on-invalid-recip",
strstr (invalid_addrs->str, ", ") ?
"mail:ask-send-invalid-recip-multi" :
"mail:ask-send-invalid-recip-one",

View File

@ -65,8 +65,6 @@ EMailBackend * em_subscription_editor_get_backend
(EMSubscriptionEditor *editor);
CamelStore * em_subscription_editor_get_store
(EMSubscriptionEditor *editor);
CamelStore * em_subscription_editor_get_store
(EMSubscriptionEditor *editor);
G_END_DECLS

View File

@ -105,7 +105,7 @@ em_utils_ask_open_many (GtkWindow *parent,
"Are you sure you want to open %d messages at once?",
how_many), how_many);
proceed = em_utils_prompt_user (
parent, "/apps/evolution/mail/prompts/open_many",
parent, "prompt-on-open-many",
"mail:ask-open-many", string, NULL);
g_free (string);
@ -115,7 +115,7 @@ em_utils_ask_open_many (GtkWindow *parent,
/**
* em_utils_prompt_user:
* @parent: parent window
* @promptkey: gconf key to check if we should prompt the user or not.
* @promptkey: settings key to check if we should prompt the user or not.
* @tag: e_alert tag.
*
* Convenience function to query the user with a Yes/No dialog and a
@ -136,13 +136,13 @@ em_utils_prompt_user (GtkWindow *parent,
GtkWidget *container;
va_list ap;
gint button;
GConfClient *client;
GSettings *settings;
EAlert *alert = NULL;
client = gconf_client_get_default ();
settings = g_settings_new ("org.gnome.evolution.mail");
if (promptkey && !gconf_client_get_bool (client, promptkey, NULL)) {
g_object_unref (client);
if (promptkey && !g_settings_get_boolean (settings, promptkey)) {
g_object_unref (settings);
return TRUE;
}
@ -165,14 +165,13 @@ em_utils_prompt_user (GtkWindow *parent,
button = gtk_dialog_run (GTK_DIALOG (dialog));
if (promptkey)
gconf_client_set_bool (
client, promptkey,
!gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (check)), NULL);
g_settings_set_boolean (settings, promptkey,
!gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (check)));
gtk_widget_destroy (dialog);
g_object_unref (client);
g_object_unref (settings);
return button == GTK_RESPONSE_YES;
}
@ -1256,16 +1255,15 @@ em_utils_message_to_html (CamelMimeMessage *message,
((EMFormat *) emfq)->composer = TRUE;
if (!source) {
GConfClient *gconf;
GSettings *settings;
gchar *charset;
/* FIXME We should be getting this from the
* current view, not the global setting. */
gconf = gconf_client_get_default ();
charset = gconf_client_get_string (
gconf, "/apps/evolution/mail/display/charset", NULL);
settings = g_settings_new ("org.gnome.evolution.mail");
charset = g_settings_get_string (settings, "charset");
em_format_set_default_charset ((EMFormat *) emfq, charset);
g_object_unref (gconf);
g_object_unref (settings);
g_free (charset);
}
@ -1306,7 +1304,7 @@ em_utils_expunge_folder (GtkWidget *parent,
if (!em_utils_prompt_user (
GTK_WINDOW (parent),
"/apps/evolution/mail/prompts/expunge",
"prompt-on-expunge",
"mail:ask-expunge", description, NULL))
return;
@ -1330,7 +1328,7 @@ em_utils_empty_trash (GtkWidget *parent,
g_return_if_fail (E_IS_MAIL_BACKEND (backend));
if (!em_utils_prompt_user ((GtkWindow *) parent,
"/apps/evolution/mail/prompts/empty_trash",
"prompt-on-empty-trash",
"mail:ask-empty-trash", NULL))
return;

View File

@ -372,7 +372,7 @@ action_mail_folder_mark_all_as_read_cb (GtkAction *action,
backend = E_MAIL_BACKEND (shell_backend);
session = e_mail_backend_get_session (backend);
cache = e_mail_session_get_folder_cache (session);
key = "/apps/evolution/mail/prompts/mark_all_read";
key = "prompt-on-mark-all-read";
if (mail_folder_cache_get_folder_has_children (cache, folder, NULL))
prompt = "mail:ask-mark-all-read-sub";