aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-utils.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2003-12-02 13:16:22 +0800
committerMichael Zucci <zucchi@src.gnome.org>2003-12-02 13:16:22 +0800
commit62b482ca293ced476d6f682bd03e34139f4ff5b1 (patch)
treec128dc2593b9b32cfaab2888bdabce9002884b59 /mail/em-utils.c
parent4edfed50a633c889bba97732920760b54279a87e (diff)
downloadgsoc2013-evolution-62b482ca293ced476d6f682bd03e34139f4ff5b1.tar.gz
gsoc2013-evolution-62b482ca293ced476d6f682bd03e34139f4ff5b1.tar.zst
gsoc2013-evolution-62b482ca293ced476d6f682bd03e34139f4ff5b1.zip
Added empty_trash prompt key.
2003-12-02 Not Zed <NotZed@Ximian.com> * evolution-mail.schemas: Added empty_trash prompt key. * em-utils.c (em_utils_prompt_user): changed to take the gconf 'prompt again' key directly. Fixed callers. (em_utils_expunge_folder): prompt the user with an expunge specific message. (em_utils_empty_trash): have an empty-trash specific message for prompting confirm. (emu_confirm_expunge): removed, no longer needed. Bug #38613. (em_utils_expunge_folder): remove most line feeds, let the label wrap them. (em_utils_empty_trash): ditto. * em-subscribe-editor.c (sub_folder_subscribed): update the ui selection state after we're done. maybe we should listen on the model but this is easier. Bug #50861. * em-message-browser.c (emmb_activate): hook up our own verb list. (emmb_message_verbs[], emmb_close): implement the close verb. Bug #51558. * em-format-html-display.c (efhd_attachment_popup): duh, actually add the menu list we create. Bug #49902. * em-format.c (d): turn off debug, committed by accident. svn path=/trunk/; revision=23562
Diffstat (limited to 'mail/em-utils.c')
-rw-r--r--mail/em-utils.c62
1 files changed, 28 insertions, 34 deletions
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 0519fe02a5..6a0712d311 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -57,24 +57,29 @@ static EAccount *guess_account (CamelMimeMessage *message);
* em_utils_prompt_user:
* @parent: parent window
* @def: default response
- * @again: continue prompting the user in the future
+ * @promptkey: gconf key to check if we should prompt the user or not.
* @fmt: prompt format
* @Varargs: varargs
*
* Convenience function to query the user with a Yes/No dialog and a
* "Don't show this dialog again" checkbox. If the user checks that
- * checkbox, then @again is set to %FALSE, otherwise it is set to
+ * checkbox, then @promptkey is set to %FALSE, otherwise it is set to
* %TRUE.
*
* Returns %TRUE if the user clicks Yes or %FALSE otherwise.
**/
gboolean
-em_utils_prompt_user (GtkWindow *parent, int def, gboolean *again, const char *fmt, ...)
+em_utils_prompt_user(GtkWindow *parent, int def, const char *promptkey, const char *fmt, ...)
{
GtkWidget *mbox, *check = NULL;
va_list ap;
int button;
char *str;
+ GConfClient *gconf = mail_config_get_gconf_client();
+
+ if (promptkey
+ && !gconf_client_get_bool(gconf, promptkey, NULL))
+ return TRUE;
va_start (ap, fmt);
str = g_strdup_vprintf (fmt, ap);
@@ -84,21 +89,21 @@ em_utils_prompt_user (GtkWindow *parent, int def, gboolean *again, const char *f
"%s", str);
g_free (str);
gtk_dialog_set_default_response ((GtkDialog *) mbox, def);
- if (again) {
+ if (promptkey) {
check = gtk_check_button_new_with_label (_("Don't show this message again."));
gtk_box_pack_start ((GtkBox *)((GtkDialog *) mbox)->vbox, check, TRUE, TRUE, 10);
gtk_widget_show (check);
}
button = gtk_dialog_run ((GtkDialog *) mbox);
- if (again)
- *again = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check));
- gtk_widget_destroy (mbox);
+ if (promptkey)
+ gconf_client_set_bool(gconf, promptkey, !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check)), NULL);
+
+ gtk_widget_destroy(mbox);
return button == GTK_RESPONSE_YES;
}
-
/**
* em_utils_uids_copy:
* @uids: array of uids
@@ -2197,29 +2202,6 @@ em_utils_message_to_html(CamelMimeMessage *message, const char *credits, guint32
/* ********************************************************************** */
-static gboolean
-emu_confirm_expunge (GtkWidget *parent)
-{
- gboolean res, show_again;
- GConfClient *gconf;
-
- gconf = mail_config_get_gconf_client ();
-
- if (!gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/expunge", NULL))
- return TRUE;
-
- /* FIXME: we need to get the parent GtkWindow from @parent... */
-
- res = em_utils_prompt_user (NULL, GTK_RESPONSE_NO, &show_again,
- _("This operation will permanently erase all messages marked as\n"
- "deleted. If you continue, you will not be able to recover these messages.\n"
- "\nReally erase these messages?"));
-
- gconf_client_set_bool (gconf, "/apps/evolution/mail/prompts/expunge", show_again, NULL);
-
- return res;
-}
-
/**
* em_utils_expunge_folder:
* @parent: parent window
@@ -2230,7 +2212,15 @@ emu_confirm_expunge (GtkWidget *parent)
void
em_utils_expunge_folder (GtkWidget *parent, CamelFolder *folder)
{
- if (!emu_confirm_expunge(parent))
+ char *name;
+
+ camel_object_get(folder, NULL, CAMEL_OBJECT_DESCRIPTION, &name, 0);
+
+ if (!em_utils_prompt_user(parent, GTK_RESPONSE_NO, "/apps/evolution/mail/prompts/expunge",
+ _("This operation will permanently remove all deleted messages "
+ "in the folder `%s'. If you continue, you "
+ "will not be able to recover these messages.\n"
+ "\nReally erase these messages?"), name))
return;
mail_expunge_folder(folder, NULL, NULL);
@@ -2251,8 +2241,12 @@ em_utils_empty_trash (GtkWidget *parent)
EAccount *account;
EIterator *iter;
CamelException ex;
-
- if (!emu_confirm_expunge (parent))
+
+ if (!em_utils_prompt_user(parent, GTK_RESPONSE_NO, "/apps/evolution/mail/prompts/empty_trash",
+ _("This operation will permanently remove all deleted messages "
+ "in all folders. If you continue, you will not be able to "
+ "recover these messages.\n"
+ "\nReally erase these messages?")))
return;
camel_exception_init (&ex);