2007-10-05 [paul] 3.0.2cvs13
[claws.git] / src / prefs_actions.c
index 891159ad282f5fd3192530fb4f26a23f13f6aed6..a6eb2eed4525f73873f155bce9d5df846f88bd66 100644 (file)
@@ -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);
@@ -568,8 +569,11 @@ static gint prefs_actions_clist_set_row(GtkTreeIter *row)
        }
 
        if (action_get_type(entry_text) == ACTION_ERROR) {
-               alertpanel_error(_("The command\n%s\nhas a syntax error."), 
-                                entry_text);
+               gchar *message;
+               message = g_markup_printf_escaped(_("The command\n%s\nhas a syntax error."),
+                                               entry_text);
+               alertpanel_error(message);
+               g_free(message);
                return -1;
        }
 
@@ -590,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)
@@ -615,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)
@@ -642,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)
@@ -687,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)
@@ -720,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,
@@ -751,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();
@@ -771,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();
 
@@ -823,6 +844,7 @@ static gchar *actions_desc_strings[] = {
        "     %h",  N_("for a user provided hidden argument (e.g. password)"),
        "     %s",  N_("for the text selection"),
        "  %as{}",  N_("apply filtering actions between {} to selected messages"),
+       "     %%",  N_("for a literal %"),
        NULL, NULL
 };