From: Paul Mangan Date: Fri, 5 Oct 2007 09:29:34 +0000 (+0000) Subject: 2007-10-05 [paul] 3.0.2cvs13 X-Git-Tag: rel_3_1_0~148 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=19f0b423489612cf12b21a5bcd1ce9b64ade18a7;ds=sidebyside 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 --- diff --git a/ChangeLog b/ChangeLog index 54a3c995b..a0914f1d1 100644 --- 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 diff --git a/PATCHSETS b/PATCHSETS index b5a229363..1c57a617f 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -2925,3 +2925,4 @@ ( 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 diff --git a/configure.ac b/configure.ac index 70858dd0b..acc9a70e6 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=0 MICRO_VERSION=2 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=12 +EXTRA_VERSION=13 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/prefs_actions.c b/src/prefs_actions.c index de45174bf..a6eb2eed4 100644 --- a/src/prefs_actions.c +++ b/src/prefs_actions.c @@ -70,6 +70,7 @@ static struct Actions } actions; static int modified = FALSE; +static int modified_list = FALSE; /* 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; + modified_list = TRUE; } 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; + modified_list = TRUE; } 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); + modified_list = TRUE; } 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(); + modified_list = TRUE; } 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(); + modified_list = TRUE; } 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; + } 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_list = FALSE; 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; + } 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_list = FALSE; prefs_actions_set_list(); prefs_actions_write_config(); diff --git a/src/prefs_filtering.c b/src/prefs_filtering.c index 5177c64ed..039d3eb1f 100644 --- a/src/prefs_filtering.c +++ b/src/prefs_filtering.c @@ -154,6 +154,8 @@ static void prefs_filtering_account_option_menu_populate(void); 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, @@ -1127,6 +1129,7 @@ static void prefs_filtering_register_cb(void) filteringprop_free(prop); prefs_filtering_reset_dialog(); + modified = TRUE; } 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(); + modified = TRUE; } 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(); + modified = TRUE; } 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); + modified = TRUE; } 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); + modified = TRUE; } 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); + modified = TRUE; } 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); + modified = TRUE; } static void prefs_filtering_select_set(FilteringProp *prop) @@ -1311,7 +1320,7 @@ static gboolean prefs_filtering_key_pressed(GtkWidget *widget, GdkEventKey *even return FALSE; } -static void prefs_filtering_ok(void) +static gboolean prefs_filtering_check_mod(gboolean check_changed_list) { FilteringProp * prop; gchar * str; @@ -1320,6 +1329,17 @@ static void prefs_filtering_ok(void) 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); @@ -1340,7 +1360,7 @@ static void prefs_filtering_ok(void) 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); - return; + return TRUE; } } 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(); @@ -1376,6 +1404,9 @@ static void prefs_filtering_ok(void) static void prefs_filtering_cancel(void) { + if (prefs_filtering_check_mod(TRUE)) + return; + modified = FALSE; prefs_matcher_read_config(); prefs_filtering_close(); } diff --git a/src/prefs_template.c b/src/prefs_template.c index bb78b5d76..b062bee6e 100644 --- a/src/prefs_template.c +++ b/src/prefs_template.c @@ -63,7 +63,7 @@ static struct Templates { } 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); @@ -475,8 +475,14 @@ static void prefs_template_ok_cb(void) 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_list = FALSE; 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; + } 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_list = FALSE; 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); + modified_list = TRUE; } 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); + modified_list = TRUE; } static void prefs_template_delete_cb(void) @@ -733,7 +747,8 @@ static void prefs_template_delete_cb(void) 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) @@ -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); + modified_list = TRUE; } 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); + modified_list = TRUE; } 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); + modified_list = TRUE; } 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); + modified_list = TRUE; } static GtkListStore* prefs_template_create_data_store(void)