--- desktop-effects-0.7.1/desktop-effects.c 2007-02-06 15:29:00.000000000 -0500 +++ desktop-effects-0.7.1~fix/desktop-effects.c 2007-03-05 00:13:11.000000000 -0500 @@ -33,6 +33,7 @@ #define PLUGIN_LIST_KEY "/apps/compiz/general/allscreens/options/active_plugins" #define WINDOW_MANAGER_KEY "/apps/gnome-session/rh/window_manager" +#define NUM_OF_WORKSPACES "/apps/metacity/general/num_workspaces" typedef struct App App; @@ -66,6 +68,9 @@ gboolean compiz_running; }; +#define DEFAULT_NUM_WORKSPACES_VALUE 4 +static gint num_of_workspaces = DEFAULT_NUM_WORKSPACES_VALUE; + static void update_app (App *app) { @@ -251,7 +257,11 @@ if (!g_spawn_command_line_async ("compiz --replace gconf", err)) return FALSE; - + + gconf_client_set_int (app->gconf, + NUM_OF_WORKSPACES, + 1, err); + app->compiz_running = TRUE; return TRUE; @@ -262,7 +272,7 @@ { if (!g_spawn_command_line_async ("metacity --replace", err)) return FALSE; - + app->compiz_running = FALSE; return TRUE; @@ -289,7 +299,11 @@ gconf_client_set_string (app->gconf, WINDOW_MANAGER_KEY, str, NULL); - + + gconf_client_set_int (app->gconf, + NUM_OF_WORKSPACES, + num_of_workspaces, NULL); + session_file = g_build_filename (g_get_home_dir (), ".gnome2", "session", NULL); g_unlink (session_file); @@ -476,21 +490,32 @@ return TRUE; } + +static gint +get_num_workspaces (App *app, + GError **err) +{ + return gconf_client_get_int (app->gconf, + NUM_OF_WORKSPACES, + err); +} + static void on_enable_toggled (GtkWidget *widget, gpointer data) { App *app = data; Settings settings; - + get_widget_settings (app, &settings); - + if (settings.enabled != app->compiz_running) { GError *err = NULL; if (settings.enabled) { + num_of_workspaces = get_num_workspaces(app, &err); start_compiz (app, &err); } else @@ -712,7 +740,7 @@ if (!get_gconf_settings (app, &(app->initial), err)) return FALSE; - + /* We assume here that the user has not in the meantime started * a *third* window manager. Ie., compiz is running initially * if and only if "enabled" was true initially.