diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2008-05-17 03:51:18 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2008-05-17 03:51:18 +0800 |
commit | b452caf1791ce100a9f8f3024aa701a4344bbe7e (patch) | |
tree | 004adff68ff3ccf4ec39244113c0e43d27ef47e0 | |
parent | 69dcbacecf55a58638ad71d22bea8be9f0d5b7d9 (diff) | |
download | gsoc2013-evolution-b452caf1791ce100a9f8f3024aa701a4344bbe7e.tar.gz gsoc2013-evolution-b452caf1791ce100a9f8f3024aa701a4344bbe7e.tar.zst gsoc2013-evolution-b452caf1791ce100a9f8f3024aa701a4344bbe7e.zip |
** Fixes bug #514383
2008-05-16 Matthew Barnes <mbarnes@redhat.com>
** Fixes bug #514383
* plugins/mark-all-read/mark-all-read.c: Add a Cancel button.
* mail/mail.error.xml: Remove the "ask-mark-read" error.
* e-error.c (e_error_newv): Widget packing adjustments.
svn path=/trunk/; revision=35504
-rw-r--r-- | e-util/ChangeLog | 6 | ||||
-rw-r--r-- | e-util/e-error.c | 4 | ||||
-rw-r--r-- | mail/ChangeLog | 6 | ||||
-rw-r--r-- | mail/mail.error.xml | 8 | ||||
-rw-r--r-- | plugins/mark-all-read/ChangeLog | 6 | ||||
-rw-r--r-- | plugins/mark-all-read/mark-all-read.c | 167 |
6 files changed, 177 insertions, 20 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 41721887d6..5465e03bba 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,9 @@ +2008-05-16 Matthew Barnes <mbarnes@redhat.com> + + ** Fixes part of bug #514383 + + * e-error.c (e_error_newv): Widget packing adjustments. + 2008-05-14 Matthew Barnes <mbarnes@redhat.com> ** Fixes bug #531592 diff --git a/e-util/e-error.c b/e-util/e-error.c index ed6369a184..1fee2f4164 100644 --- a/e-util/e-error.c +++ b/e-util/e-error.c @@ -510,7 +510,7 @@ e_error_newv(GtkWindow *parent, const char *tag, const char *arg0, va_list ap) w = gtk_image_new_from_stock(type_map[e->type].icon, GTK_ICON_SIZE_DIALOG); gtk_misc_set_alignment((GtkMisc *)w, 0.0, 0.0); - gtk_box_pack_start((GtkBox *)hbox, w, TRUE, TRUE, 12); + gtk_box_pack_start((GtkBox *)hbox, w, FALSE, FALSE, 12); args = g_ptr_array_new(); tmp = (char *)arg0; @@ -564,7 +564,7 @@ e_error_newv(GtkWindow *parent, const char *tag, const char *arg0, va_list ap) gtk_box_pack_start((GtkBox *)hbox, scroll, FALSE, FALSE, 0); gtk_window_set_default_size ((GtkWindow *)dialog, 360, 180); } else - gtk_box_pack_start((GtkBox *)hbox, w, FALSE, FALSE, 0); + gtk_box_pack_start((GtkBox *)hbox, w, TRUE, TRUE, 0); gtk_widget_show_all(hbox); diff --git a/mail/ChangeLog b/mail/ChangeLog index 534338ec3c..7cb095136e 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2008-05-16 Matthew Barnes <mbarnes@redhat.com> + + ** Fixes part of bug #514383 + + * mail.error.xml: Remove the "ask-mark-read" error. + 2008-05-14 Jeffrey Stedfast <fejj@novell.com> Needed so that IMAP4 can allow users to configure cache diff --git a/mail/mail.error.xml b/mail/mail.error.xml index 9caf7158a6..0c6c7f3332 100644 --- a/mail/mail.error.xml +++ b/mail/mail.error.xml @@ -368,14 +368,6 @@ You can choose to ignore this folder, overwrite or append its contents, or quit. <button stock="gtk-yes" _label="Send Receipt" response="GTK_RESPONSE_YES"/> </error> - <error id="ask-mark-read" type="question" default="GTK_RESPONSE_NO"> - <_title>Mark all messages as read</_title> - <_primary>Mark all messages in this folder and subfolders as read?</_primary> - <_secondary xml:space="preserve">Do you want the operation to be performed also in the subfolders?</_secondary> - <button stock="gtk-no" _label="Only on _Current Folder" response="GTK_RESPONSE_NO"/> - <button stock="gtk-yes" _label="on Current Folder and _Subfolders" response="GTK_RESPONSE_YES"/> - </error> - <error id="ask-quick-offline" type="question" default="GTK_RESPONSE_NO"> <_primary>Synchronize folders locally for offline usage?</_primary> <_secondary xml:space="preserve">Do you want to locally synchronize the folders that are marked for offline usage?</_secondary> diff --git a/plugins/mark-all-read/ChangeLog b/plugins/mark-all-read/ChangeLog index c53c809458..bfd604cfbe 100644 --- a/plugins/mark-all-read/ChangeLog +++ b/plugins/mark-all-read/ChangeLog @@ -1,3 +1,9 @@ +2008-05-16 Matthew Barnes <mbarnes@redhat.com> + + ** Fixes bug #514383 + + * mark-all-read.c: Add a Cancel button. + 2007-12-20 Matthew Barnes <mbarnes@redhat.com> ** Fixes part of bug #362638 diff --git a/plugins/mark-all-read/mark-all-read.c b/plugins/mark-all-read/mark-all-read.c index 7e01b3f79a..1887d447a0 100644 --- a/plugins/mark-all-read/mark-all-read.c +++ b/plugins/mark-all-read/mark-all-read.c @@ -33,10 +33,161 @@ #include <camel/camel-vee-folder.h> #include "e-util/e-error.h" +#define PRIMARY_TEXT \ + N_("Mark all messages in this folder and subfolders as read?") +#define SECONDARY_TEXT \ + N_("Do you want the operation to be performed also in the subfolders?") + void org_gnome_mark_all_read (EPlugin *ep, EMPopupTargetFolder *target); static void mar_got_folder (char *uri, CamelFolder *folder, void *data); static void mar_all_sub_folders (CamelStore *store, CamelFolderInfo *fi, CamelException *ex); +static void +button_clicked_cb (GtkButton *button, + GtkDialog *dialog) +{ + gpointer response; + + response = g_object_get_data (G_OBJECT (button), "response"); + gtk_dialog_response (dialog, GPOINTER_TO_INT (response)); +} + +static void +box_mapped_cb (GtkWidget *box, + GtkWidget *label) +{ + GtkRequisition requisition; + + /* In order to get decent line wrapping we need to wait until the + * box containing the buttons is mapped, and then resize the label + * to the same width as the box. */ + gtk_widget_size_request (box, &requisition); + gtk_widget_set_size_request (label, requisition.width, -1); +} + +static gint +prompt_user (void) +{ + GtkWidget *container; + GtkWidget *dialog; + GtkWidget *label1; + GtkWidget *label2; + GtkWidget *table; + GtkWidget *widget; + GtkWidget *vbox; + gchar *markup; + gint response; + + dialog = gtk_dialog_new (); + gtk_widget_hide (GTK_DIALOG (dialog)->action_area); + gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); + gtk_window_set_title ( + GTK_WINDOW (dialog), _("Mark All Messages as Read")); + g_signal_connect ( + dialog, "map", + G_CALLBACK (gtk_widget_queue_resize), NULL); + gtk_container_set_border_width (GTK_CONTAINER (dialog), 12); + vbox = GTK_DIALOG (dialog)->vbox; + + /* Table */ + widget = gtk_table_new (3, 2, FALSE); + gtk_table_set_row_spacings (GTK_TABLE (widget), 12); + gtk_table_set_col_spacings (GTK_TABLE (widget), 12); + gtk_box_pack_start (GTK_BOX (vbox), widget, TRUE, TRUE, 0); + gtk_widget_show (widget); + + table = widget; + + /* Question Icon */ + widget = gtk_image_new_from_stock ( + GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); + gtk_misc_set_alignment (GTK_MISC (widget), 0.5, 0.0); + gtk_table_attach ( + GTK_TABLE (table), widget, 0, 1, 0, 3, + 0, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_widget_show (widget); + + /* Primary Text */ + markup = g_markup_printf_escaped ( + "<big><b>%s</b></big>", gettext (PRIMARY_TEXT)); + widget = gtk_label_new (markup); + gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE); + gtk_label_set_use_markup (GTK_LABEL (widget), TRUE); + gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.0); + gtk_table_attach ( + GTK_TABLE (table), widget, 1, 2, 0, 1, + 0, 0, 0, 0); + gtk_widget_show (widget); + g_free (markup); + label1 = widget; + + /* Secondary Text */ + widget = gtk_label_new (gettext (SECONDARY_TEXT)); + gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE); + gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.0); + gtk_table_attach ( + GTK_TABLE (table), widget, 1, 2, 1, 2, + 0, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_widget_show (widget); + label2 = widget; + + /* Action Area */ + widget = gtk_hbox_new (FALSE, 6); + g_signal_connect ( + widget, "map", + G_CALLBACK (box_mapped_cb), label1); + g_signal_connect ( + widget, "map", + G_CALLBACK (box_mapped_cb), label2); + gtk_table_attach ( + GTK_TABLE (table), widget, 1, 2, 2, 3, + GTK_EXPAND | GTK_FILL, 0, 0, 0); + gtk_widget_show (widget); + + container = widget; + + /* Cancel button */ + widget = gtk_button_new_from_stock (GTK_STOCK_CANCEL); + g_object_set_data ( + G_OBJECT (widget), "response", + GINT_TO_POINTER (GTK_RESPONSE_CANCEL)); + g_signal_connect ( + widget, "clicked", + G_CALLBACK (button_clicked_cb), dialog); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + + /* "Current Folder and Subfolders" button */ + widget = gtk_button_new_with_mnemonic ( + _("Current Folder and _Subfolders")); + g_object_set_data ( + G_OBJECT (widget), "response", + GINT_TO_POINTER (GTK_RESPONSE_YES)); + g_signal_connect ( + widget, "clicked", + G_CALLBACK (button_clicked_cb), dialog); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + + /* "Current Folder Only" button */ + widget = gtk_button_new_with_mnemonic ( + _("Current _Folder Only")); + g_object_set_data ( + G_OBJECT (widget), "response", + GINT_TO_POINTER (GTK_RESPONSE_NO)); + g_signal_connect ( + widget, "clicked", + G_CALLBACK (button_clicked_cb), dialog); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + + response = gtk_dialog_run (GTK_DIALOG (dialog)); + + gtk_widget_destroy (dialog); + + return response; +} + void org_gnome_mark_all_read (EPlugin *ep, EMPopupTargetFolder *t) { @@ -84,19 +235,15 @@ mar_got_folder (char *uri, CamelFolder *folder, void *data) return; } - if (info && (info->child || info->next)) { - response = e_error_run (NULL, "mail:ask-mark-read", NULL); - } else { - mark_all_as_read (folder); - return; - } + if (info && (info->child || info->next)) + response = prompt_user (); + else + response = GTK_RESPONSE_NO; - if (response == GTK_RESPONSE_NO) { + if (response == GTK_RESPONSE_NO) mark_all_as_read (folder); - } else if (response == GTK_RESPONSE_YES){ + else if (response == GTK_RESPONSE_YES) mar_all_sub_folders (store, info, &ex); - } - } static void |