diff -Nrup a/libgnome-desktop/libgnomeui/monitor-db.h b/libgnome-desktop/libgnomeui/monitor-db.h --- a/libgnome-desktop/libgnomeui/monitor-db.h 2008-04-01 01:26:14.000000000 +0200 +++ b/libgnome-desktop/libgnomeui/monitor-db.h 2008-04-02 00:40:40.000000000 +0200 @@ -44,7 +44,10 @@ gboolean configuration_match Configuration *config2); gboolean configuration_save (Configuration *configuration, GError **err); +gboolean configuration_save_test (Configuration *configuration, + GError **err); gboolean configuration_apply_stored (RWScreen *screen); +gboolean configuration_apply_test (RWScreen *screen); gboolean configuration_applicable (Configuration *configuration, RWScreen *screen); diff -Nrup a/libgnome-desktop/monitor-db.c b/libgnome-desktop/monitor-db.c --- a/libgnome-desktop/monitor-db.c 2008-04-01 01:25:56.000000000 +0200 +++ b/libgnome-desktop/monitor-db.c 2008-04-02 02:31:40.000000000 +0200 @@ -631,6 +631,14 @@ get_filename (void) g_get_home_dir(), ".gnome2", "monitors.xml", NULL)); } +static const gchar * +get_test_filename (void) +{ + return idle_free ( + g_build_filename ( + g_get_home_dir(), ".gnome2", "monitors_test.xml", NULL)); +} + static const char * get_rotation_name (RWRotation r) { @@ -716,8 +724,8 @@ emit_configuration (Configuration *confi g_string_append_printf (string, "\n"); } -gboolean -configuration_save (Configuration *configuration, GError **err) +static gboolean +configuration_save_to_file (Configuration *configuration, GError **err, const char *filename) { Configuration **configurations; GString *output = g_string_new(""); @@ -738,7 +746,21 @@ configuration_save (Configuration *confi emit_configuration (configuration, output); - return g_file_set_contents (get_filename(), output->str, -1, err); + return g_file_set_contents (filename, output->str, -1, err); +} + +gboolean +configuration_save (Configuration *configuration, GError **err) +{ + g_print("Saving configuration\n"); + return configuration_save_to_file (configuration, err, get_filename()); +} + +gboolean +configuration_save_test (Configuration *configuration, GError **err) +{ + g_print("Saving TEST configuration\n"); + return configuration_save_to_file (configuration, err, get_test_filename()); } static gboolean @@ -770,15 +792,13 @@ apply_configuration (Configuration *conf return FALSE; } -gboolean -configuration_apply_stored (RWScreen *screen) +static gboolean +configuration_apply_file (RWScreen *screen, const char *file) { - char *file = g_build_filename ( - g_get_home_dir(), ".gnome2", "monitors.xml", NULL); Configuration **configs = configurations_read (file, NULL); Configuration *current; Configuration *found; - gboolean result; + gboolean result = FALSE; if (!screen) { g_print("No valid screens to apply stored configuration\n"); @@ -804,12 +824,25 @@ configuration_apply_stored (RWScreen *sc configurations_free (configs); } - g_free (file); configuration_free (current); return result; } +gboolean +configuration_apply_stored (RWScreen *screen) +{ + g_print("Applying configuration\n"); + return configuration_apply_file (screen, get_filename()); +} + +gboolean +configuration_apply_test (RWScreen *screen) +{ + g_print("Applying TEST configuration\n"); + return configuration_apply_file (screen, get_test_filename()); +} + /* * CRTC assignment