2007-10-05 [paul] 3.0.2cvs13
authorPaul Mangan <paul@claws-mail.org>
Fri, 5 Oct 2007 09:29:34 +0000 (09:29 +0000)
committerPaul Mangan <paul@claws-mail.org>
Fri, 5 Oct 2007 09:29:34 +0000 (09:29 +0000)
* src/prefs_actions.c
* src/prefs_filtering.c
* src/prefs_template.c
fix bug 1343, 'Filtering..'s close button
silently discards new filter'
Thanks to Colin

ChangeLog
PATCHSETS
configure.ac
src/prefs_actions.c
src/prefs_filtering.c
src/prefs_template.c

index 54a3c995b6b00e112cd4da21c03a9e1cbbab3604..a0914f1d1f32e6ef0b7020c1535e4202c34c5cd6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-10-05 [paul]      3.0.2cvs13
+
+       * src/prefs_actions.c
+       * src/prefs_filtering.c
+       * src/prefs_template.c
+               fix bug 1343, 'Filtering..'s close button
+               silently discards new filter'
+               Thanks to Colin
+
 2007-10-05 [paul]      3.0.2cvs12
 
        * configure.ac
 2007-10-05 [paul]      3.0.2cvs12
 
        * configure.ac
index b5a22936372f3c1c68b80c9e6bb82172f31c7bee..1c57a617fd736f28ba15832be1fdf3776b335840 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.1.2.42 -r 1.1.2.43 manual/advanced.xml;  cvs diff -u -r 1.1.2.11 -r 1.1.2.12 manual/es/advanced.xml;  ) > 3.0.2cvs10.patchset
 ( cvs diff -u -r 1.49.2.99 -r 1.49.2.100 src/procmime.c;  cvs diff -u -r 1.1.4.8 -r 1.1.4.9 src/common/mgutils.c;  ) > 3.0.2cvs11.patchset
 ( cvs diff -u -r 1.654.2.2980 -r 1.654.2.2981 configure.ac;  cvs diff -u -r 1.155.2.76 -r 1.155.2.77 src/Makefile.am;  ) > 3.0.2cvs12.patchset
 ( cvs diff -u -r 1.1.2.42 -r 1.1.2.43 manual/advanced.xml;  cvs diff -u -r 1.1.2.11 -r 1.1.2.12 manual/es/advanced.xml;  ) > 3.0.2cvs10.patchset
 ( cvs diff -u -r 1.49.2.99 -r 1.49.2.100 src/procmime.c;  cvs diff -u -r 1.1.4.8 -r 1.1.4.9 src/common/mgutils.c;  ) > 3.0.2cvs11.patchset
 ( cvs diff -u -r 1.654.2.2980 -r 1.654.2.2981 configure.ac;  cvs diff -u -r 1.155.2.76 -r 1.155.2.77 src/Makefile.am;  ) > 3.0.2cvs12.patchset
+( cvs diff -u -r 1.60.2.51 -r 1.60.2.52 src/prefs_actions.c;  cvs diff -u -r 1.59.2.58 -r 1.59.2.59 src/prefs_filtering.c;  cvs diff -u -r 1.12.2.48 -r 1.12.2.49 src/prefs_template.c;  ) > 3.0.2cvs13.patchset
index 70858dd0b7a1b495058b553c139436fdefebdfc4..acc9a70e653c01de7d2dc58a14e61fc5c8673fac 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=0
 MICRO_VERSION=2
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=2
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=12
+EXTRA_VERSION=13
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index de45174bf620f9505f4b0553eccc91ca8af1514e..a6eb2eed4525f73873f155bce9d5df846f88bd66 100644 (file)
@@ -70,6 +70,7 @@ static struct Actions
 } actions;
 
 static int modified = FALSE;
 } actions;
 
 static int modified = FALSE;
+static int modified_list = FALSE;
 
 /* widget creating functions */
 static void prefs_actions_create       (MainWindow *mainwin);
 
 /* widget creating functions */
 static void prefs_actions_create       (MainWindow *mainwin);
@@ -593,6 +594,7 @@ static void prefs_actions_register_cb(GtkWidget *w, gpointer data)
 {
        prefs_actions_clist_set_row(NULL);
        modified = FALSE;
 {
        prefs_actions_clist_set_row(NULL);
        modified = FALSE;
+       modified_list = TRUE;
 }
 
 static void prefs_actions_substitute_cb(GtkWidget *w, gpointer data)
 }
 
 static void prefs_actions_substitute_cb(GtkWidget *w, gpointer data)
@@ -618,6 +620,7 @@ static void prefs_actions_substitute_cb(GtkWidget *w, gpointer data)
        gtk_tree_path_free(path_sel);
        gtk_tree_path_free(path_new);
        modified = FALSE;
        gtk_tree_path_free(path_sel);
        gtk_tree_path_free(path_new);
        modified = FALSE;
+       modified_list = TRUE;
 }
 
 static void prefs_actions_delete_cb(GtkWidget *w, gpointer data)
 }
 
 static void prefs_actions_delete_cb(GtkWidget *w, gpointer data)
@@ -645,6 +648,7 @@ static void prefs_actions_delete_cb(GtkWidget *w, gpointer data)
 
        prefs_common.actions_list = g_slist_remove(prefs_common.actions_list,
                                                   action);
 
        prefs_common.actions_list = g_slist_remove(prefs_common.actions_list,
                                                   action);
+       modified_list = TRUE;
 }
 
 static void prefs_actions_up(GtkWidget *w, gpointer data)
 }
 
 static void prefs_actions_up(GtkWidget *w, gpointer data)
@@ -690,6 +694,7 @@ static void prefs_actions_up(GtkWidget *w, gpointer data)
 
        gtk_list_store_swap(store, &iprev, &isel);
        prefs_actions_set_list();
 
        gtk_list_store_swap(store, &iprev, &isel);
        prefs_actions_set_list();
+       modified_list = TRUE;
 }
 
 static void prefs_actions_down(GtkWidget *w, gpointer data)
 }
 
 static void prefs_actions_down(GtkWidget *w, gpointer data)
@@ -723,6 +728,7 @@ static void prefs_actions_down(GtkWidget *w, gpointer data)
 
        gtk_list_store_swap(store, &next, &sel);
        prefs_actions_set_list();
 
        gtk_list_store_swap(store, &next, &sel);
        prefs_actions_set_list();
+       modified_list = TRUE;
 }
 
 static gint prefs_actions_deleted(GtkWidget *widget, GdkEventAny *event,
 }
 
 static gint prefs_actions_deleted(GtkWidget *widget, GdkEventAny *event,
@@ -754,8 +760,14 @@ static void prefs_actions_cancel(GtkWidget *w, gpointer data)
                                 GTK_STOCK_CLOSE, _("+_Continue editing"),
                                 NULL) != G_ALERTDEFAULT) {
                return;
                                 GTK_STOCK_CLOSE, _("+_Continue editing"),
                                 NULL) != G_ALERTDEFAULT) {
                return;
+       } else if (modified_list && alertpanel(_("Actions list not saved"),
+                                _("The actions list has been modified. Close anyway?"),
+                                GTK_STOCK_CLOSE, _("+_Continue editing"), 
+                                NULL) != G_ALERTDEFAULT) {
+               return;
        }
        modified = FALSE;
        }
        modified = FALSE;
+       modified_list = FALSE;
        prefs_actions_read_config();
        gtk_widget_hide(actions.window);
        inc_unlock();
        prefs_actions_read_config();
        gtk_widget_hide(actions.window);
        inc_unlock();
@@ -774,8 +786,14 @@ static void prefs_actions_ok(GtkWidget *widget, gpointer data)
                                 GTK_STOCK_CLOSE, _("+_Continue editing"),
                                 NULL) != G_ALERTDEFAULT) {
                return;
                                 GTK_STOCK_CLOSE, _("+_Continue editing"),
                                 NULL) != G_ALERTDEFAULT) {
                return;
+       } else if (modified_list && alertpanel(_("Actions list not saved"),
+                                _("The actions list has been modified. Close anyway?"),
+                                GTK_STOCK_CLOSE, _("+_Continue editing"), 
+                                NULL) != G_ALERTDEFAULT) {
+               return;
        }
        modified = FALSE;
        }
        modified = FALSE;
+       modified_list = FALSE;
        prefs_actions_set_list();
        prefs_actions_write_config();
 
        prefs_actions_set_list();
        prefs_actions_write_config();
 
index 5177c64edcdeae0e3cf2ff8a2760a3b1d0005815..039d3eb1f9ee9a79ed201723cbe3878fa5f68708 100644 (file)
@@ -154,6 +154,8 @@ static void prefs_filtering_account_option_menu_populate(void);
 
 static gulong signal_id = 0; /* filtering.help_btn clicked signal */
 
 
 static gulong signal_id = 0; /* filtering.help_btn clicked signal */
 
+static int modified = FALSE;
+
 void prefs_filtering_open(GSList ** p_processing,
                          const gchar *title,
                          const gchar *help_url_anchor,
 void prefs_filtering_open(GSList ** p_processing,
                          const gchar *title,
                          const gchar *help_url_anchor,
@@ -1127,6 +1129,7 @@ static void prefs_filtering_register_cb(void)
        filteringprop_free(prop);
 
        prefs_filtering_reset_dialog();
        filteringprop_free(prop);
 
        prefs_filtering_reset_dialog();
+       modified = TRUE;
 }
 
 static void prefs_filtering_substitute_cb(void)
 }
 
 static void prefs_filtering_substitute_cb(void)
@@ -1158,6 +1161,7 @@ static void prefs_filtering_substitute_cb(void)
        filteringprop_free(prop);
 
        prefs_filtering_reset_dialog();
        filteringprop_free(prop);
 
        prefs_filtering_reset_dialog();
+       modified = TRUE;
 }
 
 static void prefs_filtering_delete_cb(void)
 }
 
 static void prefs_filtering_delete_cb(void)
@@ -1183,6 +1187,7 @@ static void prefs_filtering_delete_cb(void)
        gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
 
        prefs_filtering_reset_dialog();
        gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
 
        prefs_filtering_reset_dialog();
+       modified = TRUE;
 }
 
 static void prefs_filtering_top(void)
 }
 
 static void prefs_filtering_top(void)
@@ -1203,6 +1208,7 @@ static void prefs_filtering_top(void)
 
        gtk_list_store_move_after(GTK_LIST_STORE(model), &sel, &top);
        gtkut_list_view_select_row(filtering.cond_list_view, 1);
 
        gtk_list_store_move_after(GTK_LIST_STORE(model), &sel, &top);
        gtkut_list_view_select_row(filtering.cond_list_view, 1);
+       modified = TRUE;
 }
 
 static void prefs_filtering_up(void)
 }
 
 static void prefs_filtering_up(void)
@@ -1223,6 +1229,7 @@ static void prefs_filtering_up(void)
 
        gtk_list_store_swap(GTK_LIST_STORE(model), &top, &sel);
        gtkut_list_view_select_row(filtering.cond_list_view, row - 1);
 
        gtk_list_store_swap(GTK_LIST_STORE(model), &top, &sel);
        gtkut_list_view_select_row(filtering.cond_list_view, row - 1);
+       modified = TRUE;
 }
 
 static void prefs_filtering_down(void)
 }
 
 static void prefs_filtering_down(void)
@@ -1243,6 +1250,7 @@ static void prefs_filtering_down(void)
                        
        gtk_list_store_swap(GTK_LIST_STORE(model), &top, &sel);
        gtkut_list_view_select_row(filtering.cond_list_view, row + 1);
                        
        gtk_list_store_swap(GTK_LIST_STORE(model), &top, &sel);
        gtkut_list_view_select_row(filtering.cond_list_view, row + 1);
+       modified = TRUE;
 }
 
 static void prefs_filtering_bottom(void)
 }
 
 static void prefs_filtering_bottom(void)
@@ -1263,6 +1271,7 @@ static void prefs_filtering_bottom(void)
 
        gtk_list_store_move_after(GTK_LIST_STORE(model), &top, &sel);           
        gtkut_list_view_select_row(filtering.cond_list_view, n_rows - 1);
 
        gtk_list_store_move_after(GTK_LIST_STORE(model), &top, &sel);           
        gtkut_list_view_select_row(filtering.cond_list_view, n_rows - 1);
+       modified = TRUE;
 }
 
 static void prefs_filtering_select_set(FilteringProp *prop)
 }
 
 static void prefs_filtering_select_set(FilteringProp *prop)
@@ -1311,7 +1320,7 @@ static gboolean prefs_filtering_key_pressed(GtkWidget *widget, GdkEventKey *even
        return FALSE;
 }
 
        return FALSE;
 }
 
-static void prefs_filtering_ok(void)
+static gboolean prefs_filtering_check_mod(gboolean check_changed_list)
 {
        FilteringProp * prop;
        gchar * str;
 {
        FilteringProp * prop;
        gchar * str;
@@ -1320,6 +1329,17 @@ static void prefs_filtering_ok(void)
         AlertValue val;
        
        prop = prefs_filtering_dialog_to_filtering(FALSE);
         AlertValue val;
        
        prop = prefs_filtering_dialog_to_filtering(FALSE);
+       
+       if (check_changed_list) {
+               if (modified && alertpanel(_("Filtering rules not saved"),
+                                        _("The list of filtering rules have been modified. Close anyway?"),
+                                        GTK_STOCK_CLOSE, _("+_Continue editing"), 
+                                        NULL) != G_ALERTDEFAULT) {
+                       return TRUE;
+               }
+       }
+       
+       /* check if a rule is being edited */
        if (prop != NULL) {
                str = filteringprop_to_string(prop);
 
        if (prop != NULL) {
                str = filteringprop_to_string(prop);
 
@@ -1340,7 +1360,7 @@ static void prefs_filtering_ok(void)
                                g_free(filtering_str);
                                g_free(str); /* fixed two leaks: huzzah! */
                                filteringprop_free(prop);
                                g_free(filtering_str);
                                g_free(str); /* fixed two leaks: huzzah! */
                                filteringprop_free(prop);
-                               return;
+                               return TRUE;
                        }
                }               
 
                        }
                }               
 
@@ -1362,13 +1382,21 @@ static void prefs_filtering_ok(void)
                                g_free(name);
                                g_free(condition);
                                g_free(action);
                                g_free(name);
                                g_free(condition);
                                g_free(action);
-                               return;
+                               return TRUE;
                        }
                }
                g_free(name);
                g_free(condition);
                g_free(action);
        }
                        }
                }
                g_free(name);
                g_free(condition);
                g_free(action);
        }
+       return FALSE;
+}
+
+static void prefs_filtering_ok(void)
+{
+       if (prefs_filtering_check_mod(FALSE))
+               return;
+       modified = FALSE;
        prefs_filtering_set_list();
        prefs_matcher_write_config();
        prefs_filtering_close();
        prefs_filtering_set_list();
        prefs_matcher_write_config();
        prefs_filtering_close();
@@ -1376,6 +1404,9 @@ static void prefs_filtering_ok(void)
 
 static void prefs_filtering_cancel(void)
 {
 
 static void prefs_filtering_cancel(void)
 {
+       if (prefs_filtering_check_mod(TRUE))
+               return;
+       modified = FALSE;
        prefs_matcher_read_config();
        prefs_filtering_close();
 }
        prefs_matcher_read_config();
        prefs_filtering_close();
 }
index bb78b5d76e7322fa58f3fe26f816394e8c420785..b062bee6e1e97087904a095b14b5c12ecb7e7eb5 100644 (file)
@@ -63,7 +63,7 @@ static struct Templates {
 } templates;
 
 static int modified = FALSE;
 } templates;
 
 static int modified = FALSE;
-
+static int modified_list = FALSE;
 /* widget creating functions */
 static void prefs_template_window_create       (void);
 static void prefs_template_window_setup                (void);
 /* widget creating functions */
 static void prefs_template_window_create       (void);
 static void prefs_template_window_setup                (void);
@@ -475,8 +475,14 @@ static void prefs_template_ok_cb(void)
                                 GTK_STOCK_CLOSE, _("+_Continue editing"), 
                                 NULL) != G_ALERTDEFAULT) {
                return;
                                 GTK_STOCK_CLOSE, _("+_Continue editing"), 
                                 NULL) != G_ALERTDEFAULT) {
                return;
+       } else if (modified_list && alertpanel(_("Templates list not saved"),
+                                _("The templates list has been modified. Close anyway?"),
+                                GTK_STOCK_CLOSE, _("+_Continue editing"), 
+                                NULL) != G_ALERTDEFAULT) {
+               return;
        }
        modified = FALSE;
        }
        modified = FALSE;
+       modified_list = FALSE;
        tmpl_list = prefs_template_get_list();
        template_set_config(tmpl_list);
        compose_reflect_prefs_all();
        tmpl_list = prefs_template_get_list();
        template_set_config(tmpl_list);
        compose_reflect_prefs_all();
@@ -492,8 +498,14 @@ static void prefs_template_cancel_cb(void)
                                 GTK_STOCK_CLOSE, _("+_Continue editing"),
                                 NULL) != G_ALERTDEFAULT) {
                return;
                                 GTK_STOCK_CLOSE, _("+_Continue editing"),
                                 NULL) != G_ALERTDEFAULT) {
                return;
+       } else if (modified_list && alertpanel(_("Templates list not saved"),
+                                _("The templates list has been modified. Close anyway?"),
+                                GTK_STOCK_CLOSE, _("+_Continue editing"), 
+                                NULL) != G_ALERTDEFAULT) {
+               return;
        }
        modified = FALSE;
        }
        modified = FALSE;
+       modified_list = FALSE;
        prefs_template_clear();
        gtk_widget_hide(templates.window);
        inc_unlock();
        prefs_template_clear();
        gtk_widget_hide(templates.window);
        inc_unlock();
@@ -683,6 +695,7 @@ static gboolean prefs_template_list_view_set_row(GtkTreeIter *row)
 static void prefs_template_register_cb(void)
 {
        modified = !prefs_template_list_view_set_row(NULL);
 static void prefs_template_register_cb(void)
 {
        modified = !prefs_template_list_view_set_row(NULL);
+       modified_list = TRUE;
 }
 
 static void prefs_template_substitute_cb(void)
 }
 
 static void prefs_template_substitute_cb(void)
@@ -705,6 +718,7 @@ static void prefs_template_substitute_cb(void)
        if (!tmpl) return;
 
        modified = !prefs_template_list_view_set_row(&row);
        if (!tmpl) return;
 
        modified = !prefs_template_list_view_set_row(&row);
+       modified_list = TRUE;
 }
 
 static void prefs_template_delete_cb(void)
 }
 
 static void prefs_template_delete_cb(void)
@@ -733,7 +747,8 @@ static void prefs_template_delete_cb(void)
                       NULL) != G_ALERTALTERNATE)
                return;
 
                       NULL) != G_ALERTALTERNATE)
                return;
 
-       gtk_list_store_remove(GTK_LIST_STORE(model), &row);             
+       gtk_list_store_remove(GTK_LIST_STORE(model), &row);
+       modified_list = TRUE;   
 }
 
 static void prefs_template_top_cb(void)
 }
 
 static void prefs_template_top_cb(void)
@@ -754,6 +769,7 @@ static void prefs_template_top_cb(void)
 
        gtk_list_store_move_after(GTK_LIST_STORE(model), &sel, &top);
        gtkut_list_view_select_row(templates.list_view, 1);
 
        gtk_list_store_move_after(GTK_LIST_STORE(model), &sel, &top);
        gtkut_list_view_select_row(templates.list_view, 1);
+       modified_list = TRUE;
 }
 
 static void prefs_template_up_cb(void)
 }
 
 static void prefs_template_up_cb(void)
@@ -774,6 +790,7 @@ static void prefs_template_up_cb(void)
 
        gtk_list_store_swap(GTK_LIST_STORE(model), &top, &sel);
        gtkut_list_view_select_row(templates.list_view, row - 1);
 
        gtk_list_store_swap(GTK_LIST_STORE(model), &top, &sel);
        gtkut_list_view_select_row(templates.list_view, row - 1);
+       modified_list = TRUE;
 }
 
 static void prefs_template_down_cb(void)
 }
 
 static void prefs_template_down_cb(void)
@@ -794,6 +811,7 @@ static void prefs_template_down_cb(void)
                        
        gtk_list_store_swap(GTK_LIST_STORE(model), &top, &sel);
        gtkut_list_view_select_row(templates.list_view, row + 1);
                        
        gtk_list_store_swap(GTK_LIST_STORE(model), &top, &sel);
        gtkut_list_view_select_row(templates.list_view, row + 1);
+       modified_list = TRUE;
 }
 
 static void prefs_template_bottom_cb(void)
 }
 
 static void prefs_template_bottom_cb(void)
@@ -814,6 +832,7 @@ static void prefs_template_bottom_cb(void)
 
        gtk_list_store_move_after(GTK_LIST_STORE(model), &top, &sel);           
        gtkut_list_view_select_row(templates.list_view, n_rows - 1);
 
        gtk_list_store_move_after(GTK_LIST_STORE(model), &top, &sel);           
        gtkut_list_view_select_row(templates.list_view, n_rows - 1);
+       modified_list = TRUE;
 }
 
 static GtkListStore* prefs_template_create_data_store(void)
 }
 
 static GtkListStore* prefs_template_create_data_store(void)