[balsa] filter-run-dialog: Disable "Apply selected"



commit f2125f441047968de92542bdf80cf93c4aa67f32
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Mon Jun 8 20:12:05 2020 -0400

    filter-run-dialog: Disable "Apply selected"
    
    Disable "Apply selected" and "Apply now" when the mailbox is not currently
    being viewed in the main window. It no longer crashes, because of the
    previous commit, but it does not actually carry out any filters, so the
    user should see the option as disabled.
    
    * src/filter-run-dialog.c (available_list_selection_changed), (selected_list_selection_changed):

 ChangeLog               | 11 +++++++++++
 src/filter-run-dialog.c | 10 ++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9aa15ead1..fdfb7c351 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2020-06-08  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       filter-run-dialog: Disable "Apply selected" and "Apply now" when
+       the mailbox is not currently being viewed in the main window. It
+       no longer crashes, because of the previous commit, but it does
+       not actually carry out any filters, so the user should see the
+       option as disabled.
+
+       * src/filter-run-dialog.c (available_list_selection_changed),
+       (selected_list_selection_changed):
+
 2020-06-08  Peter Bloomfield  <pbloomfield bellsouth net>
 
        Do not crash when selecting "Apply selected" when the mailbox is
diff --git a/src/filter-run-dialog.c b/src/filter-run-dialog.c
index 337f47d7a..5fbe1fe3a 100644
--- a/src/filter-run-dialog.c
+++ b/src/filter-run-dialog.c
@@ -248,9 +248,12 @@ available_list_selection_changed(GtkTreeSelection *selection,
 {
     BalsaFilterRunDialog *p = user_data;
     gboolean selected;
+    gboolean viewing;
 
     selected = gtk_tree_selection_count_selected_rows(selection) > 0;
-    gtk_widget_set_sensitive(p->apply_selected_button, selected);
+    viewing = balsa_find_notebook_page_num(p->mbox) >= 0;
+
+    gtk_widget_set_sensitive(p->apply_selected_button, selected && viewing);
     gtk_widget_set_sensitive(p->add_button, selected);
 }
 
@@ -261,9 +264,12 @@ selected_list_selection_changed(GtkTreeSelection *selection,
 {
     BalsaFilterRunDialog *p = user_data;
     gboolean selected;
+    gboolean viewing;
 
     selected = gtk_tree_selection_count_selected_rows(selection) > 0;
-    gtk_widget_set_sensitive(p->apply_now_button, selected);
+    viewing = balsa_find_notebook_page_num(p->mbox) >= 0;
+
+    gtk_widget_set_sensitive(p->apply_now_button, selected && viewing);
     gtk_widget_set_sensitive(p->remove_button, selected);
     gtk_widget_set_sensitive(p->move_up_button, selected);
     gtk_widget_set_sensitive(p->move_down_button, selected);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]