[balsa] Fix enhancement bug #620221
- From: Peter Bloomfield <PeterB src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] Fix enhancement bug #620221
- Date: Wed, 14 Jul 2010 21:41:06 +0000 (UTC)
commit f4db2bc52477671b704836d6f5f2209ebdbac833
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Wed Jul 14 17:39:30 2010 -0400
Fix enhancement bug #620221
* src/balsa-app.h: new member ask_before_select.
* src/balsa-app.c (balsa_app_init): initialize it FALSE.
* src/main-window.c: uncomment dialog and make it conditional on
balsa_app.ask_before_select.
* src/pref-manager.c (open_preferences_manager), (apply_prefs),
(set_prefs), (main_window_group): manage it.
* src/save-restore.c (config_global_load), (config_save): save
and restore it, default FALSE.
ChangeLog | 15 +++++++++++++++
src/balsa-app.c | 1 +
src/balsa-app.h | 1 +
src/main-window.c | 43 ++++++++++++++++++++++---------------------
src/pref-manager.c | 12 ++++++++++++
src/save-restore.c | 2 ++
6 files changed, 53 insertions(+), 21 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 141b70d..47d5f07 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2010-07-14 Peter Bloomfield
+
+ Install dialog to ask the user before selecting a different
+ mailbox, and an option to not use it; fixes bug #620221
+ (ghisha email it).
+
+ * src/balsa-app.h: new member ask_before_select.
+ * src/balsa-app.c (balsa_app_init): initialize it FALSE.
+ * src/main-window.c: uncomment dialog and make it conditional on
+ balsa_app.ask_before_select.
+ * src/pref-manager.c (open_preferences_manager), (apply_prefs),
+ (set_prefs), (main_window_group): manage it.
+ * src/save-restore.c (config_global_load), (config_save): save
+ and restore it, default FALSE.
+
2010-07-10 Peter Bloomfield
Support IMAP server that complies with RFC 2086 but not with
diff --git a/src/balsa-app.c b/src/balsa-app.c
index 1859610..50dcabb 100644
--- a/src/balsa-app.c
+++ b/src/balsa-app.c
@@ -339,6 +339,7 @@ balsa_app_init(void)
balsa_app.show_notebook_tabs = FALSE;
balsa_app.layout_type = LAYOUT_DEFAULT;
balsa_app.view_message_on_open = TRUE;
+ balsa_app.ask_before_select = FALSE;
balsa_app.mw_action_after_move = NEXT_UNREAD;
balsa_app.index_num_width = NUM_DEFAULT_WIDTH;
diff --git a/src/balsa-app.h b/src/balsa-app.h
index f045f9c..2a95e81 100644
--- a/src/balsa-app.h
+++ b/src/balsa-app.h
@@ -293,6 +293,7 @@ extern struct BalsaApplication {
gboolean show_notebook_tabs;
enum { LAYOUT_DEFAULT, LAYOUT_WIDE_MSG, LAYOUT_WIDE_SCREEN } layout_type;
gboolean view_message_on_open;
+ gboolean ask_before_select;
gboolean pgdownmod;
gint pgdown_percent;
#if defined(ENABLE_TOUCH_UI)
diff --git a/src/main-window.c b/src/main-window.c
index d42a248..e960f07 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -3694,10 +3694,6 @@ balsa_window_next_unread(BalsaWindow * window)
BalsaIndex *index =
BALSA_INDEX(balsa_window_find_current_index(window));
LibBalsaMailbox *mailbox = index ? index->mailbox_node->mailbox : NULL;
-#if WE_REALLY_WANT_TO_GET_IN_THE_USERS_FACE
- GtkWidget *dialog;
- gint response;
-#endif /* WE_REALLY_WANT_TO_GET_IN_THE_USERS_FACE */
if (libbalsa_mailbox_get_unread(mailbox) > 0) {
if (!balsa_index_select_next_unread(index)) {
@@ -3713,28 +3709,33 @@ balsa_window_next_unread(BalsaWindow * window)
if (!mailbox || libbalsa_mailbox_get_unread(mailbox) == 0)
return FALSE;
-#if WE_REALLY_WANT_TO_GET_IN_THE_USERS_FACE
- dialog =
- gtk_message_dialog_new(GTK_WINDOW(window), 0,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_YES_NO,
- _("The next unread message is in %s"),
- mailbox->name);
+ if (balsa_app.ask_before_select) {
+ GtkWidget *dialog;
+ gint response;
+
+ dialog =
+ gtk_message_dialog_new(GTK_WINDOW(window), 0,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_YES_NO,
+ _("The next unread message is in %s"),
+ mailbox->name);
#if HAVE_MACOSX_DESKTOP
- libbalsa_macosx_menu_for_parent(dialog, GTK_WINDOW(window));
+ libbalsa_macosx_menu_for_parent(dialog, GTK_WINDOW(window));
#endif
- gtk_message_dialog_format_secondary_text
- (GTK_MESSAGE_DIALOG(dialog),
- _("Do you want to switch to %s?"), mailbox->name);
- gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES);
- response = gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_destroy(dialog);
- if (response != GTK_RESPONSE_YES)
- return FALSE;
-#endif /* WE_REALLY_WANT_TO_GET_IN_THE_USERS_FACE */
+ gtk_message_dialog_format_secondary_text
+ (GTK_MESSAGE_DIALOG(dialog),
+ _("Do you want to select %s?"), mailbox->name);
+ gtk_dialog_set_default_response(GTK_DIALOG(dialog),
+ GTK_RESPONSE_YES);
+ response = gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(dialog);
+ if (response != GTK_RESPONSE_YES)
+ return FALSE;
+ }
balsa_mblist_open_mailbox(mailbox);
index = balsa_find_index_by_mailbox(mailbox);
+ g_print("%s next unread is in \"%s\", index is %s\n", __func__, mailbox->name, index ? "nonNULL" : "NULL");
if (index)
balsa_index_select_next_unread(index);
else
diff --git a/src/pref-manager.c b/src/pref-manager.c
index 00631b6..bdd636a 100644
--- a/src/pref-manager.c
+++ b/src/pref-manager.c
@@ -113,6 +113,7 @@ typedef struct _PropertyUI {
GtkWidget *previewpane;
GtkWidget *layout_type;
GtkWidget *view_message_on_open;
+ GtkWidget *ask_before_select;
GtkWidget *pgdownmod;
GtkWidget *pgdown_percent;
GtkWidget *view_allheaders;
@@ -610,6 +611,8 @@ open_preferences_manager(GtkWidget * widget, gpointer data)
G_CALLBACK(properties_modified_cb), property_box);
g_signal_connect(G_OBJECT(pui->view_message_on_open), "toggled",
G_CALLBACK(properties_modified_cb), property_box);
+ g_signal_connect(G_OBJECT(pui->ask_before_select), "toggled",
+ G_CALLBACK(properties_modified_cb), property_box);
g_signal_connect(G_OBJECT(pui->pgdownmod), "toggled",
G_CALLBACK(pgdown_modified_cb), property_box);
g_signal_connect(G_OBJECT(pui->pgdown_percent), "changed",
@@ -891,6 +894,9 @@ apply_prefs(GtkDialog * pbox)
balsa_app.view_message_on_open =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
(pui->view_message_on_open));
+ balsa_app.ask_before_select =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
+ (pui->ask_before_select));
balsa_app.pgdownmod =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->pgdownmod));
balsa_app.pgdown_percent =
@@ -1147,6 +1153,9 @@ set_prefs(void)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
(pui->view_message_on_open),
balsa_app.view_message_on_open);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
+ (pui->ask_before_select),
+ balsa_app.ask_before_select);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->pgdownmod),
balsa_app.pgdownmod);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(pui->pgdown_percent),
@@ -2221,6 +2230,9 @@ main_window_group(GtkWidget * page)
pui->view_message_on_open =
pm_group_add_check(group, _("Automatically view message "
"when mailbox opened"));
+ pui->ask_before_select =
+ pm_group_add_check(group, _("Ask me before selecting a different "
+ "mailbox to show an unread message"));
table = create_table(1, 3, page);
pm_group_add(group, table, FALSE);
diff --git a/src/save-restore.c b/src/save-restore.c
index d2063f5..abafb65 100644
--- a/src/save-restore.c
+++ b/src/save-restore.c
@@ -786,6 +786,7 @@ config_global_load(void)
balsa_app.layout_type != LAYOUT_WIDE_SCREEN)
balsa_app.layout_type = LAYOUT_DEFAULT;
balsa_app.view_message_on_open = libbalsa_conf_get_bool("ViewMessageOnOpen=true");
+ balsa_app.ask_before_select = libbalsa_conf_get_bool("AskBeforeSelect=false");
balsa_app.pgdownmod = libbalsa_conf_get_bool("PageDownMod=false");
balsa_app.pgdown_percent = libbalsa_conf_get_int("PageDownPercent=50");
if (balsa_app.pgdown_percent < 10)
@@ -1299,6 +1300,7 @@ config_save(void)
libbalsa_conf_set_int("ProgressWindow", balsa_app.pwindow_option);
libbalsa_conf_set_int("LayoutType", balsa_app.layout_type);
libbalsa_conf_set_bool("ViewMessageOnOpen", balsa_app.view_message_on_open);
+ libbalsa_conf_set_bool("AskBeforeSelect", balsa_app.ask_before_select);
libbalsa_conf_set_bool("PageDownMod", balsa_app.pgdownmod);
libbalsa_conf_set_int("PageDownPercent", balsa_app.pgdown_percent);
#if defined(ENABLE_TOUCH_UI)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]