aboutsummaryrefslogtreecommitdiffstats
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
parent4edfed50a633c889bba97732920760b54279a87e (diff)
downloadgsoc2013-evolution-62b482ca293ced476d6f682bd03e34139f4ff5b1.tar
gsoc2013-evolution-62b482ca293ced476d6f682bd03e34139f4ff5b1.tar.gz
gsoc2013-evolution-62b482ca293ced476d6f682bd03e34139f4ff5b1.tar.bz2
gsoc2013-evolution-62b482ca293ced476d6f682bd03e34139f4ff5b1.tar.lz
gsoc2013-evolution-62b482ca293ced476d6f682bd03e34139f4ff5b1.tar.xz
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
-rw-r--r--mail/ChangeLog28
-rw-r--r--mail/em-composer-utils.c60
-rw-r--r--mail/em-format-html-display.c1
-rw-r--r--mail/em-format.c2
-rw-r--r--mail/em-message-browser.c26
-rw-r--r--mail/em-subscribe-editor.c16
-rw-r--r--mail/em-utils.c62
-rw-r--r--mail/em-utils.h2
-rw-r--r--mail/evolution-mail.schemas14
9 files changed, 123 insertions, 88 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index dba68ab36b..dfc30a058b 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,31 @@
+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.
+
2003-12-01 Ettore Perazzoli <ettore@ximian.com>
* mail-mt.c (do_op_status): Use data->activity_id, not local
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index f64ecee5dd..bc076a7f77 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -103,19 +103,11 @@ composer_destroy_cb (gpointer user_data, GObject *deadbeef)
static gboolean
ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EABDestination **recipients)
{
- gboolean show_again, res;
- GConfClient *gconf;
+ gboolean res;
GString *str;
int i;
- gconf = mail_config_get_gconf_client ();
-
- if (!gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/unwanted_html", NULL))
- return TRUE;
-
- /* FIXME: this wording sucks */
- str = g_string_new (_("You are sending an HTML-formatted message. Please make sure that\n"
- "the following recipients are willing and able to receive HTML mail:\n"));
+ str = g_string_new("");
for (i = 0; recipients[i] != NULL; ++i) {
if (!eab_destination_get_html_mail_pref (recipients[i])) {
const char *name;
@@ -125,33 +117,24 @@ ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EABDestination **rec
g_string_append_printf (str, " %s\n", name);
}
}
-
- g_string_append (str, _("Send anyway?"));
- res = em_utils_prompt_user ((GtkWindow *) composer, GTK_RESPONSE_YES, &show_again, "%s", str->str);
+
+ /* FIXME: this wording sucks */
+ res = em_utils_prompt_user((GtkWindow *) composer, GTK_RESPONSE_YES, "/apps/evolution/mail/prompts/unwanted_html",
+ _("You are sending an HTML-formatted message. Please make sure that\n"
+ "the following recipients are willing and able to receive HTML mail:\n"
+ "%s"
+ "Send anyway?"),
+ str->str);
g_string_free (str, TRUE);
- gconf_client_set_bool (gconf, "/apps/evolution/mail/prompts/unwanted_html", show_again, NULL);
-
return res;
}
static gboolean
ask_confirm_for_empty_subject (EMsgComposer *composer)
{
- gboolean show_again, res;
- GConfClient *gconf;
-
- gconf = mail_config_get_gconf_client ();
-
- if (!gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/empty_subject", NULL))
- return TRUE;
-
- res = em_utils_prompt_user ((GtkWindow *) composer, GTK_RESPONSE_YES, &show_again,
+ return em_utils_prompt_user((GtkWindow *)composer, GTK_RESPONSE_YES, "/apps/evolution/mail/prompts/empty_subject",
_("This message has no subject.\nReally send?"));
-
- gconf_client_set_bool (gconf, "/apps/evolution/mail/prompts/empty_subject", show_again, NULL);
-
- return res;
}
static gboolean
@@ -159,12 +142,6 @@ ask_confirm_for_only_bcc (EMsgComposer *composer, gboolean hidden_list_case)
{
gboolean show_again, res;
const char *first_text;
- GConfClient *gconf;
-
- gconf = mail_config_get_gconf_client ();
-
- if (!gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/only_bcc", NULL))
- return TRUE;
/* If the user is mailing a hidden contact list, it is possible for
them to create a message with only Bcc recipients without really
@@ -179,17 +156,12 @@ ask_confirm_for_only_bcc (EMsgComposer *composer, gboolean hidden_list_case)
} else {
first_text = _("This message contains only Bcc recipients.");
}
-
- res = em_utils_prompt_user ((GtkWindow *) composer, GTK_RESPONSE_YES, &show_again,
- "%s\n%s", first_text,
- _("It is possible that the mail server may reveal the recipients "
- "by adding an Apparently-To header.\nSend anyway?"));
-
- gconf_client_set_bool (gconf, "/apps/evolution/mail/prompts/only_bcc", show_again, NULL);
-
- return res;
-}
+ return em_utils_prompt_user ((GtkWindow *) composer, GTK_RESPONSE_YES, "/apps/evolution/mail/prompts/only_bcc",
+ "%s\n%s", first_text,
+ _("It is possible that the mail server may reveal the recipients "
+ "by adding an Apparently-To header.\nSend anyway?"));
+}
struct _send_data {
struct emcs_t *emcs;
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index 2980e2e39b..808f8d030e 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -954,6 +954,7 @@ efhd_attachment_popup(GtkWidget *w, GdkEventButton *event, struct _attach_puri *
item = &efhd_menu_items[info->shown?2:1];
item->activate_data = info;
menus = g_slist_prepend(menus, item);
+ em_popup_add_items(emp, menus, (GDestroyNotify)g_slist_free);
menu = em_popup_create_menu_once(emp, target, target->mask, target->mask);
if (event)
diff --git a/mail/em-format.c b/mail/em-format.c
index 63c1b3936f..2642b5becd 100644
--- a/mail/em-format.c
+++ b/mail/em-format.c
@@ -52,7 +52,7 @@
#include "em-format.h"
-#define d(x) x
+#define d(x)
static void emf_builtin_init(EMFormatClass *);
static const char *emf_snoop_part(CamelMimePart *part);
diff --git a/mail/em-message-browser.c b/mail/em-message-browser.c
index 5621fe07bf..9a72fec0c5 100644
--- a/mail/em-message-browser.c
+++ b/mail/em-message-browser.c
@@ -183,10 +183,32 @@ emmb_set_message(EMFolderView *emfv, const char *uid)
}
static void
+emmb_close(BonoboUIComponent *uid, void *data, const char *path)
+{
+ EMMessageBrowser *emmb = data;
+
+ gtk_widget_destroy(gtk_widget_get_toplevel((GtkWidget *)emmb));
+}
+
+static BonoboUIVerb emmb_verbs[] = {
+ BONOBO_UI_UNSAFE_VERB ("MessageBrowserClose", emmb_close),
+ BONOBO_UI_VERB_END
+};
+
+static void
emmb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int state)
{
- emmb_parent->activate(emfv, uic, state);
+ if (state) {
+ emmb_parent->activate(emfv, uic, state);
- if (state)
+ bonobo_ui_component_add_verb_list_with_data(uic, emmb_verbs, emfv);
bonobo_ui_component_set_prop(uic, "/commands/EditPaste", "sensitive", "0", NULL);
+ } else {
+ const BonoboUIVerb *v;
+
+ for (v = &emmb_verbs[0]; v->cname; v++)
+ bonobo_ui_component_remove_verb(uic, v->cname);
+
+ emmb_parent->activate(emfv, uic, state);
+ }
}
diff --git a/mail/em-subscribe-editor.c b/mail/em-subscribe-editor.c
index e00b79ce8c..1fb9066362 100644
--- a/mail/em-subscribe-editor.c
+++ b/mail/em-subscribe-editor.c
@@ -127,6 +127,7 @@ struct _EMSubscribeNode {
static void sub_editor_busy(EMSubscribeEditor *se, int dir);
static int sub_queue_fill_level(EMSubscribe *sub, EMSubscribeNode *node);
+static void sub_selection_changed(GtkTreeSelection *selection, EMSubscribe *sub);
static void
sub_node_free(char *key, EMSubscribeNode *node, EMSubscribe *sub)
@@ -197,7 +198,7 @@ sub_folder_subscribe (struct _mail_msg *mm)
static void
sub_folder_subscribed (struct _mail_msg *mm)
{
- struct _zsubscribe_msg *m = (struct _zsubscribe_msg *) mm;
+ struct _zsubscribe_msg *m = (struct _zsubscribe_msg *)mm, *next;
GtkTreeIter iter;
GtkTreeModel *model;
EMSubscribeNode *node;
@@ -225,11 +226,14 @@ sub_folder_subscribed (struct _mail_msg *mm)
d(printf("node mismatch, or subscribe state changed failed\n"));
}
- /* queue any further ones */
- m = (struct _zsubscribe_msg *)e_dlist_remhead(&m->sub->subscribe);
- if (m) {
- m->sub->subscribe_id = m->msg.seq;
- e_thread_put (mail_thread_new, (EMsg *)m);
+ /* queue any further ones, or if out, update the ui */
+ next = (struct _zsubscribe_msg *)e_dlist_remhead(&m->sub->subscribe);
+ if (next) {
+ next->sub->subscribe_id = next->msg.seq;
+ e_thread_put(mail_thread_new, (EMsg *)next);
+ } else {
+ /* should it go off the model instead? */
+ sub_selection_changed(gtk_tree_view_get_selection(m->sub->tree), m->sub);
}
}
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);
diff --git a/mail/em-utils.h b/mail/em-utils.h
index d315710ae5..6befbd6fe9 100644
--- a/mail/em-utils.h
+++ b/mail/em-utils.h
@@ -41,7 +41,7 @@ struct _GtkSelectionData;
struct _GtkAdjustment;
struct _EMsgComposer;
-gboolean em_utils_prompt_user (struct _GtkWindow *parent, int def, gboolean *again, const char *fmt, ...);
+gboolean em_utils_prompt_user(struct _GtkWindow *parent, int def, const char *promptkey, const char *fmt, ...);
GPtrArray *em_utils_uids_copy (GPtrArray *uids);
void em_utils_uids_free (GPtrArray *uids);
diff --git a/mail/evolution-mail.schemas b/mail/evolution-mail.schemas
index 013af3f96a..1a004050c1 100644
--- a/mail/evolution-mail.schemas
+++ b/mail/evolution-mail.schemas
@@ -540,6 +540,20 @@
</schema>
<schema>
+ <key>/schemas/apps/evolution/mail/prompts/empty_trash</key>
+ <applyto>/apps/evolution/mail/prompts/empty_trash</applyto>
+ <owner>evolution-mail</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Prompt when user empties the trash</short>
+ <long>
+ Do we prompt the user when he or she tries to empty the trash.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/evolution/mail/prompts/only_bcc</key>
<applyto>/apps/evolution/mail/prompts/only_bcc</applyto>
<owner>evolution-mail</owner>