From 6ba25fa94516c748632fbcbaa925c4559231dd7f Mon Sep 17 00:00:00 2001 From: o9000 Date: Sat, 18 Apr 2015 12:53:14 +0000 Subject: [PATCH] tint2conf: backup config when writing git-svn-id: http://tint2.googlecode.com/svn/trunk@765 121b4492-b84c-0410-8b4c-0d4edfb3f3cc --- src/tint2conf/properties.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/tint2conf/properties.c b/src/tint2conf/properties.c index 841a0f3..b29766a 100644 --- a/src/tint2conf/properties.c +++ b/src/tint2conf/properties.c @@ -22,6 +22,7 @@ #include "properties_rw.h" #include "../launcher/apps-common.h" #include "../launcher/icon-theme-common.h" +#include "../util/common.h" #define ROW_SPACING 10 #define COL_SPACING 8 @@ -163,8 +164,15 @@ void panel_move_item_up(GtkWidget *widget, gpointer data); void applyClicked(GtkWidget *widget, gpointer data) { char *file = get_current_theme_file_name(); - if (file) + if (file) { + if (config_is_manual(file)) { + gchar *backup_path = g_strdup_printf("%s.backup.%ld", file, time(NULL)); + copy_file(file, backup_path); + g_free(backup_path); + } + config_save_file(file); + } int unused = system("killall -SIGUSR1 tint2"); (void)unused; g_free(file);