talons

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

commit 7faa46999bc2d0454687dd1f4376c086393691f7
parent b2e357547140413bfa23f20790f5091060e001a5
Author: wwp <subscript@free.fr>
Date:   Wed,  1 Sep 2021 12:35:39 +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 @@ -1101,7 +1101,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) }, }; @@ -1305,16 +1305,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."), - _("_Cancel"), _("_Continue editing"), NULL, ALERTFOCUS_SECOND) != G_ALERTDEFAULT) + "of the command-line."), + _("_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') { @@ -1327,8 +1326,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);