diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index 8dd35c94..985d9e11 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -2193,14 +2193,22 @@ static void setup_ok_cb (GtkWidget *but, GtkWidget *win) { PreferencesPersistenceResult save_result; + struct zoitechatprefs old_prefs; char buffer[192]; - theme_preferences_stage_commit (); + memcpy (&old_prefs, &prefs, sizeof (prefs)); + theme_preferences_stage_apply (); setup_apply (&setup_prefs); save_result = preferences_persistence_save_all (); - gtk_widget_destroy (win); if (save_result.success) + { + theme_preferences_stage_commit (); + gtk_widget_destroy (win); return; + } + + memcpy (&prefs, &old_prefs, sizeof (prefs)); + theme_preferences_stage_discard (); if (save_result.partial_failure) { diff --git a/src/fe-gtk/theme/theme-preferences.c b/src/fe-gtk/theme/theme-preferences.c index 8ad1acd7..3e83bf12 100644 --- a/src/fe-gtk/theme/theme-preferences.c +++ b/src/fe-gtk/theme/theme-preferences.c @@ -188,12 +188,21 @@ theme_preferences_stage_begin (void) } void -theme_preferences_stage_commit (void) +theme_preferences_stage_apply (void) { if (!theme_preferences_stage.active) return; theme_preferences_stage_sync_runtime_to_staged (); +} + +void +theme_preferences_stage_commit (void) +{ + if (!theme_preferences_stage.active) + return; + + theme_preferences_stage_apply (); memset (&theme_preferences_stage, 0, sizeof (theme_preferences_stage)); } diff --git a/src/fe-gtk/theme/theme-preferences.h b/src/fe-gtk/theme/theme-preferences.h index 428adaca..5e3dbad0 100644 --- a/src/fe-gtk/theme/theme-preferences.h +++ b/src/fe-gtk/theme/theme-preferences.h @@ -14,6 +14,7 @@ GtkWidget *theme_preferences_create_color_page (GtkWindow *parent, gboolean *color_change_flag); void theme_preferences_apply_to_session (session_gui *gui, InputStyle *input_style); void theme_preferences_stage_begin (void); +void theme_preferences_stage_apply (void); void theme_preferences_stage_commit (void); void theme_preferences_stage_discard (void);