gnome-shell r145 - trunk/js/ui



Author: danw
Date: Tue Jan 13 20:43:03 2009
New Revision: 145
URL: http://svn.gnome.org/viewvc/gnome-shell?rev=145&view=rev

Log:
Remove unused workspaces at startup (since mutter uses the same gconf
prefs as metacity, we're likely to start out with 4 workspaces)


Modified:
   trunk/js/ui/main.js

Modified: trunk/js/ui/main.js
==============================================================================
--- trunk/js/ui/main.js	(original)
+++ trunk/js/ui/main.js	Tue Jan 13 20:43:03 2009
@@ -101,6 +101,27 @@
     for (let i = 0; i < children.length; i++)
         children[i].destroy();
 
+    // metacity-clutter currently uses the same prefs as plain metacity,
+    // which probably means we'll be starting out with multiple workspaces;
+    // remove any unused ones
+    let windows = global.get_windows();
+    let maxWorkspace = 0;
+    for (let i = 0; i < windows.length; i++) {
+        let win = windows[i];
+
+        if (!win.get_meta_window().is_on_all_workspaces() &&
+            win.get_workspace() > maxWorkspace) {
+            maxWorkspace = win.get_workspace();
+        }
+    }
+    let screen = global.screen;
+    if (screen.n_workspaces > maxWorkspace) {
+        for (let w = screen.n_workspaces - 1; w > maxWorkspace; w--) {
+            let workspace = screen.get_workspace_by_index(w);
+            screen.remove_workspace(workspace, 0);
+        }
+    }
+
     global.connect('panel-run-dialog', function(panel) {
         // Make sure not more than one run dialog is shown.
         if (!runDialog) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]