Merge lp:~unity-team/unity/workspace-configure-love into lp:unity

Proposed by Jason Smith
Status: Merged
Merged at revision: 558
Proposed branch: lp:~unity-team/unity/workspace-configure-love
Merge into: lp:unity
Diff against target: 26 lines (+15/-1)
1 file modified
targets/mutter/spaces-manager.vala (+15/-1)
To merge this branch: bzr merge lp:~unity-team/unity/workspace-configure-love
Reviewer Review Type Date Requested Status
Didier Roche-Tolomelli Approve
Review via email: mp+36570@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

It's not 5 lines of code, liar! :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'targets/mutter/spaces-manager.vala'
2--- targets/mutter/spaces-manager.vala 2010-09-24 16:06:23 +0000
3+++ targets/mutter/spaces-manager.vala 2010-09-24 16:59:00 +0000
4@@ -155,7 +155,21 @@
5 this.plugin = plugin;
6 this.plugin.workspace_switch_event.connect (this.workspace_switched);
7
8- set_desktop_layout (2, 2, 2 * 2);
9+ int num_workspaces = Mutter.meta_prefs_get_num_workspaces ();
10+
11+ if (num_workspaces <= 4)
12+ {
13+ set_desktop_layout (2, 2, 2 * 2);
14+ }
15+ else
16+ {
17+ int width = (int) Math.ceil (Math.sqrt ((double) num_workspaces));
18+ int height = 1;
19+ while (width * height < num_workspaces)
20+ height++;
21+
22+ set_desktop_layout (width, height, num_workspaces);
23+ }
24 }
25
26 void set_desktop_layout (int columns, int rows, int num_workspace)