talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 5c71c190d17e465b96cd1da53197ec7dfa1b88b0
parent 57ea92fc713e8d9a4305ad0addbda25761dd5c96
Author: wwp <subscript@free.fr>
Date:   Wed,  1 Sep 2021 12:34:05 +0200

Action prefs: be smarter about detecting what's been modified when cancelling
an action edit (warn if action type has changed whereas a command-line was
set before).

Diffstat:
Msrc/prefs_actions.c | 21++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/prefs_actions.c b/src/prefs_actions.c @@ -1110,7 +1110,7 @@ static GtkWidget *prefs_actions_popup_menu = NULL; static GtkActionEntry prefs_actions_popup_entries[] = { {"PrefsActionsPopup", NULL, "PrefsActionsPopup", NULL, NULL, NULL }, - {"PrefsActionsPopup/Delete", NULL, N_("_Delete"), NULL, NULL, G_CALLBACK(prefs_actions_delete_cb) }, + {"PrefsActionsPopup/Delete", NULL, N_("_Delete"), NULL, NULL, G_CALLBACK(prefs_actions_delete_cb) }, {"PrefsActionsPopup/DeleteAll", NULL, N_("Delete _all"), NULL, NULL, G_CALLBACK(prefs_actions_delete_all_cb) }, {"PrefsActionsPopup/Duplicate", NULL, N_("D_uplicate"), NULL, NULL, G_CALLBACK(prefs_actions_duplicate_cb) }, }; @@ -1316,16 +1316,15 @@ static void prefs_action_filterbtn_cb(GtkWidget *widget, gpointer data) gchar *action_str, **tokens; GSList *action_list = NULL, *cur; -/* I think this warning is useless - it's logical to clear the field when - changing its type. - - if(modified && alertpanel(_("Entry was modified"), + action_str = gtk_editable_get_chars(GTK_EDITABLE(actions.cmd_entry), 0, -1); + if(modified && + *action_str != '\0' && + alertpanel(_("Entry was modified"), _("Opening the filter action dialog will clear current modifications " - "of the command line."), - GTK_STOCK_CANCEL, _("_Continue editing"), NULL, ALERTFOCUS_SECOND) != G_ALERTDEFAULT) + "of the command-line."), + GTK_STOCK_CANCEL, _("_Continue editing"), NULL, ALERTFOCUS_SECOND) != G_ALERTDEFAULT) { return; -*/ - action_str = gtk_editable_get_chars(GTK_EDITABLE(actions.cmd_entry), 0, -1); + } tokens = g_strsplit_set(action_str, "{}", 5); if (tokens[0] && tokens[1] && *tokens[1] != '\0') { @@ -1338,8 +1337,8 @@ static void prefs_action_filterbtn_cb(GtkWidget *widget, gpointer data) if (action_list != NULL) { for(cur = action_list ; cur != NULL ; cur = cur->next) - filteringaction_free(cur->data); - } + filteringaction_free(cur->data); + } g_free(action_str); g_strfreev(tokens);