Merge lp:~cszikszoy/docky/mmv2 into lp:docky

Proposed by Chris S.
Status: Rejected
Rejected by: Robert Dyer
Proposed branch: lp:~cszikszoy/docky/mmv2
Merge into: lp:docky
Diff against target: 509 lines
7 files modified
Docky/Docky/ConfigurationWindow.cs (+18/-27)
Docky/Docky/DockController.cs (+63/-5)
Docky/Docky/Interface/DockPreferences.cs (+33/-10)
Docky/Docky/Interface/DockWindow.cs (+1/-1)
Docky/Docky/Interface/IDockPreferences.cs (+2/-0)
Docky/gtk-gui/Docky.ConfigurationWindow.cs (+12/-72)
Docky/gtk-gui/gui.stetic (+3/-33)
To merge this branch: bzr merge lp:~cszikszoy/docky/mmv2
Reviewer Review Type Date Requested Status
Robert Dyer (community) Needs Fixing
Review via email: mp+14273@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Chris S. (cszikszoy) wrote :

This round, MultiMonitor V2 adds support for MultiMonitors again. Also, DanRabbit's awesome UI idea is fully implemented in this branch. There's no more "add dock" or "delete dock". Upon opening the preferences widget, all docks slide in (for me this is 6 docks, 3 on each screen, for others with 1 screen that would be 4 docks) allowing you to add addins to any dock. Upon closing the preferences, empty docks are removed.

Revision history for this message
Robert Dyer (psybers) wrote :

One problem I already see is that 'on closing prefs all empty docks are removed'. Good idea... *except* what if I want a dock with only launchers (and no plugins)??? I would have to add a plugin, close it and add a launcher, then reopen and remove the plugin! Tisk Tisk. :-)

review: Needs Fixing

Unmerged revisions

375. By Chris S.

another multi-monitor implementation. Also, fully implement DanRabbit's awesome preferences UI idea.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Docky/Docky/ConfigurationWindow.cs'
2--- Docky/Docky/ConfigurationWindow.cs 2009-10-31 06:57:19 +0000
3+++ Docky/Docky/ConfigurationWindow.cs 2009-11-01 01:20:25 +0000
4@@ -68,7 +68,7 @@
5 theme_combo.Active = i;
6 }
7 i++;
8- }
9+ }
10
11 SetupConfigAlignment ();
12
13@@ -108,16 +108,19 @@
14
15 protected override void OnShown ()
16 {
17+ for (int mon = 0; mon < Screen.Default.NMonitors; mon++) {
18+ Dock dock;
19+ while ((dock = Docky.Controller.CreateDock (mon)) != null) {
20+ dock.ConfigurationClick += HandleDockConfigurationClick;
21+ dock.EnterConfigurationMode ();
22+ }
23+ }
24+
25 foreach (Dock dock in Docky.Controller.Docks) {
26 dock.EnterConfigurationMode ();
27 dock.ConfigurationClick += HandleDockConfigurationClick;
28 }
29
30- if (Docky.Controller.Docks.Count () == 1) {
31- ActiveDock = Docky.Controller.Docks.First ();
32- SetupConfigAlignment ();
33- }
34-
35 KeepAbove = true;
36 Stick ();
37
38@@ -136,11 +139,20 @@
39
40 protected override void OnHidden ()
41 {
42+ // first delete the empty docks
43+ Docky.Controller.Docks.ToList ().ForEach (dock =>
44+ {
45+ if (!dock.Preferences.ItemProviders.Any (provider => provider.Items.Count () > 0))
46+ Docky.Controller.DeleteDock (dock);
47+ });
48+
49+ // for any remaining docks, exit configuration mode
50 foreach (Dock dock in Docky.Controller.Docks) {
51 dock.ConfigurationClick -= HandleDockConfigurationClick;
52 dock.LeaveConfigurationMode ();
53 dock.UnsetActiveGlow ();
54 }
55+
56 base.OnHidden ();
57 }
58
59@@ -148,27 +160,6 @@
60 {
61 Docky.Controller.DockTheme = theme_combo.ActiveText;
62 }
63-
64- protected virtual void OnDeleteDockButtonClicked (object sender, System.EventArgs e)
65- {
66- if (ActiveDock != null) {
67- Docky.Controller.DeleteDock (ActiveDock);
68- ActiveDock = null;
69- SetupConfigAlignment ();
70- }
71- }
72-
73- protected virtual void OnNewDockButtonClicked (object sender, System.EventArgs e)
74- {
75- Dock newDock = Docky.Controller.CreateDock ();
76-
77- if (newDock != null) {
78- newDock.ConfigurationClick += HandleDockConfigurationClick;
79- newDock.EnterConfigurationMode ();
80- ActiveDock = newDock;
81- SetupConfigAlignment ();
82- }
83- }
84
85 string AutoStartDir {
86 get { return System.IO.Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "autostart"); }
87
88=== modified file 'Docky/Docky/DockController.cs'
89--- Docky/Docky/DockController.cs 2009-10-31 16:05:10 +0000
90+++ Docky/Docky/DockController.cs 2009-11-01 01:20:25 +0000
91@@ -32,7 +32,13 @@
92 namespace Docky
93 {
94
95-
96+ class DockMonitor
97+ {
98+ public Rectangle Geo { get; set; }
99+ public int MonitorNumber { get; set; }
100+ public IEnumerable<DockPosition> PossiblePositions { get; set; }
101+ }
102+
103 internal class DockController : IDisposable
104 {
105 const string DefaultTheme = "Classic";
106@@ -50,6 +56,23 @@
107 get { return DockNames.Count (); }
108 }
109
110+ List<DockMonitor> DockMonitors { get; set; }
111+
112+ // this represents the possible PHYSICALLY availabe positions
113+ // it doesn't take into account whether or not a doc is already at a given position
114+ public IEnumerable<DockPosition> PositionsAvailableForDock (int monitorNum)
115+ {
116+ foreach (DockPosition position in DockMonitors.Where (d => d.MonitorNumber == monitorNum).First ().PossiblePositions) {
117+ if (!DocksForMonitor (monitorNum).Any (dock => dock.Preferences.Position == position))
118+ yield return position;
119+ }
120+ }
121+
122+ public IEnumerable<Dock> DocksForMonitor (int monitorNumber)
123+ {
124+ return docks.Where (d => d.Preferences.MonitorNumber == monitorNumber);
125+ }
126+
127 IEnumerable<string> ThemeContainerFolders {
128 get {
129 yield return Path.Combine (DockServices.System.SystemDataFolder, "themes");
130@@ -111,6 +134,7 @@
131 {
132 docks = new List<Dock> ();
133 prefs = DockServices.Preferences.Get<DockController> ();
134+ DetectMonitors ();
135 CreateDocks ();
136
137 GLib.Timeout.Add (500, delegate {
138@@ -119,6 +143,41 @@
139 });
140 }
141
142+ void DetectMonitors ()
143+ {
144+ DockMonitors = new List<DockMonitor> ();
145+
146+ // first add all of the screens and their geometries
147+ for (int i = 0; i < Screen.Default.NMonitors; i++) {
148+ DockMonitor mon = new DockMonitor ();
149+ mon.MonitorNumber = i;
150+ mon.Geo = Screen.Default.GetMonitorGeometry (i);
151+ DockMonitors.Add (mon);
152+ }
153+
154+ int topDockVal = DockMonitors.OrderBy (d => d.Geo.Top).First ().Geo.Top;
155+ int bottomDockVal = DockMonitors.OrderByDescending (d => d.Geo.Bottom).First ().Geo.Bottom;
156+ int leftDockVal = DockMonitors.OrderBy (d => d.Geo.Left).First ().Geo.Left;
157+ int rightDockVal = DockMonitors.OrderByDescending (d => d.Geo.Right).First ().Geo.Right;
158+
159+ // now build the list of available positions for a given screen.
160+ for (int i = 0; i < DockMonitors.Count (); i++) {
161+ List<DockPosition> positions = new List<DockPosition> ();
162+ DockMonitor mon = DockMonitors.Where (d => d.MonitorNumber == i).First ();
163+
164+ if (mon.Geo.Left == leftDockVal)
165+ positions.Add (DockPosition.Left);
166+ if (mon.Geo.Right == rightDockVal)
167+ positions.Add (DockPosition.Right);
168+ if (mon.Geo.Top == topDockVal)
169+ positions.Add (DockPosition.Top);
170+ if (mon.Geo.Bottom == bottomDockVal)
171+ positions.Add (DockPosition.Bottom);
172+
173+ mon.PossiblePositions = positions;
174+ }
175+ }
176+
177 string FolderForTheme (string theme)
178 {
179 foreach (string dir in ThemeContainerFolders) {
180@@ -144,9 +203,9 @@
181 return def + "@" + System.Reflection.Assembly.GetExecutingAssembly ().FullName;
182 }
183
184- public Dock CreateDock ()
185+ public Dock CreateDock (int monitorNum)
186 {
187- if (docks.Count >= 4)
188+ if (!PositionsAvailableForDock (monitorNum).Any ())
189 return null;
190
191 string name = "Dock" + 1;
192@@ -155,7 +214,7 @@
193
194 DockNames = DockNames.Concat (new [] { name });
195
196- DockPreferences dockPrefs = new DockPreferences (name);
197+ DockPreferences dockPrefs = new DockPreferences (name, monitorNum);
198 Dock dock = new Dock (dockPrefs);
199 docks.Add (dock);
200
201@@ -172,7 +231,6 @@
202 dock.Dispose ();
203 DockNames = DockNames.Where (s => s != dock.Preferences.GetName ());
204
205- EnsurePluginState ();
206 return true;
207 }
208
209
210=== modified file 'Docky/Docky/Interface/DockPreferences.cs'
211--- Docky/Docky/Interface/DockPreferences.cs 2009-10-31 16:05:10 +0000
212+++ Docky/Docky/Interface/DockPreferences.cs 2009-11-01 01:20:25 +0000
213@@ -126,15 +126,17 @@
214 public DockPosition Position {
215 get { return position; }
216 set {
217+ int monitor = 0;
218+ if (monitor_number.HasValue)
219+ monitor = MonitorNumber;
220+
221 if (position == value)
222 return;
223- Dock other_dock = null;
224- if (Docky.Controller.Docks.Any (d => d.Preferences.Position == value))
225- other_dock = Docky.Controller.Docks.Where (d => d.Preferences.Position == value).First();
226- DockPosition old_position = position;
227 position = value;
228- if (other_dock != null)
229- other_dock.Preferences.Position = old_position;
230+
231+ if (!Docky.Controller.PositionsAvailableForDock (monitor).Contains (value))
232+ position = Docky.Controller.PositionsAvailableForDock (monitor).First ();
233+
234 SetOption<string> ("Position", position.ToString ());
235 OnPositionChanged ();
236 }
237@@ -195,7 +197,7 @@
238 get {
239 if (!zoom_percent.HasValue)
240 zoom_percent = GetOption<double?> ("ZoomPercent", 2.0);
241- return zoom_percent.Value;
242+ return zoom_percent.Value;
243 }
244 set {
245 value = Clamp (value, 4, 1);
246@@ -207,6 +209,22 @@
247 OnZoomPercentChanged ();
248 }
249 }
250+
251+ int? monitor_number;
252+ public int MonitorNumber {
253+ get {
254+ if (!monitor_number.HasValue)
255+ monitor_number = GetOption<int?> ("MonitorNumber", 0);
256+ return monitor_number.Value;
257+ }
258+ set {
259+ if (monitor_number == value)
260+ return;
261+ monitor_number = value;
262+ SetOption<int?> ("MonitorNumber", monitor_number.Value);
263+ //OnIndicatorSettingChanged ();
264+ }
265+ }
266 #endregion
267
268 bool? window_manager;
269@@ -248,6 +266,11 @@
270 set { prefs.Set<bool> ("FirstRun", value); }
271 }
272
273+ public DockPreferences (string dockName, int monitorNumber) : this(dockName)
274+ {
275+ MonitorNumber = monitorNumber;
276+ }
277+
278 public DockPreferences (string dockName)
279 {
280 // ensures position actually gets set
281@@ -435,7 +458,7 @@
282 DockPosition position = (DockPosition) Enum.Parse (typeof(DockPosition),
283 GetOption ("Position", DockPosition.Bottom.ToString ()));
284
285- while (Docky.Controller.Docks.Any ((Dock d) => d.Preferences.Position == position)) {
286+ while (Docky.Controller.DocksForMonitor (MonitorNumber).Any ((Dock d) => d.Preferences.Position == position)) {
287 Log<DockPreferences>.Error ("Dock position already in use: " + position.ToString ());
288 position = (DockPosition) ((((int) position) + 1) % 4);
289 }
290@@ -712,9 +735,9 @@
291 {
292 OnItemProvidersChanged (null, item_providers);
293
294- foreach (AbstractDockItemProvider adip in item_providers.Where (adip => adip != DefaultProvider)) {
295+ foreach (AbstractDockItemProvider adip in item_providers.Where (adip => adip != DefaultProvider))
296 PluginManager.Disable (adip);
297- }
298+
299 item_providers = new List<AbstractDockItemProvider> ();
300
301 SyncPlugins ();
302
303=== modified file 'Docky/Docky/Interface/DockWindow.cs'
304--- Docky/Docky/Interface/DockWindow.cs 2009-10-31 09:39:54 +0000
305+++ Docky/Docky/Interface/DockWindow.cs 2009-11-01 01:20:25 +0000
306@@ -343,7 +343,7 @@
307
308 //fixme
309 int Monitor {
310- get { return 0; }
311+ get { return Preferences.MonitorNumber; }
312 }
313
314 internal DockPosition Position {
315
316=== modified file 'Docky/Docky/Interface/IDockPreferences.cs'
317--- Docky/Docky/Interface/IDockPreferences.cs 2009-10-31 03:57:40 +0000
318+++ Docky/Docky/Interface/IDockPreferences.cs 2009-11-01 01:20:25 +0000
319@@ -62,6 +62,8 @@
320
321 double ZoomPercent { get; set; }
322
323+ int MonitorNumber { get; set; }
324+
325 bool SetName (string name);
326
327 string GetName ();
328
329=== modified file 'Docky/gtk-gui/Docky.ConfigurationWindow.cs'
330--- Docky/gtk-gui/Docky.ConfigurationWindow.cs 2009-10-31 06:37:25 +0000
331+++ Docky/gtk-gui/Docky.ConfigurationWindow.cs 2009-11-01 01:20:25 +0000
332@@ -42,10 +42,6 @@
333
334 private Gtk.HBox hbox3;
335
336- private Gtk.Button new_dock_button;
337-
338- private Gtk.Button delete_dock_button;
339-
340 private Gtk.VBox vbox4;
341
342 private Gtk.Button close_button;
343@@ -159,69 +155,15 @@
344 this.hbox3.Name = "hbox3";
345 this.hbox3.Spacing = 6;
346 // Container child hbox3.Gtk.Box+BoxChild
347- this.new_dock_button = new Gtk.Button();
348- this.new_dock_button.CanFocus = true;
349- this.new_dock_button.Name = "new_dock_button";
350- this.new_dock_button.UseUnderline = true;
351- this.new_dock_button.BorderWidth = ((uint)(5));
352- // Container child new_dock_button.Gtk.Container+ContainerChild
353- Gtk.Alignment w11 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
354- // Container child GtkAlignment.Gtk.Container+ContainerChild
355- Gtk.HBox w12 = new Gtk.HBox();
356- w12.Spacing = 2;
357- // Container child GtkHBox.Gtk.Container+ContainerChild
358- Gtk.Image w13 = new Gtk.Image();
359- w13.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-add", Gtk.IconSize.Menu, 16);
360- w12.Add(w13);
361- // Container child GtkHBox.Gtk.Container+ContainerChild
362- Gtk.Label w15 = new Gtk.Label();
363- w15.LabelProp = Mono.Unix.Catalog.GetString("New Dock");
364- w15.UseUnderline = true;
365- w12.Add(w15);
366- w11.Add(w12);
367- this.new_dock_button.Add(w11);
368- this.hbox3.Add(this.new_dock_button);
369- Gtk.Box.BoxChild w19 = ((Gtk.Box.BoxChild)(this.hbox3[this.new_dock_button]));
370- w19.Position = 0;
371- w19.Expand = false;
372- w19.Fill = false;
373- // Container child hbox3.Gtk.Box+BoxChild
374- this.delete_dock_button = new Gtk.Button();
375- this.delete_dock_button.CanFocus = true;
376- this.delete_dock_button.Name = "delete_dock_button";
377- this.delete_dock_button.UseUnderline = true;
378- this.delete_dock_button.BorderWidth = ((uint)(5));
379- // Container child delete_dock_button.Gtk.Container+ContainerChild
380- Gtk.Alignment w20 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
381- // Container child GtkAlignment.Gtk.Container+ContainerChild
382- Gtk.HBox w21 = new Gtk.HBox();
383- w21.Spacing = 2;
384- // Container child GtkHBox.Gtk.Container+ContainerChild
385- Gtk.Image w22 = new Gtk.Image();
386- w22.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-delete", Gtk.IconSize.Menu, 16);
387- w21.Add(w22);
388- // Container child GtkHBox.Gtk.Container+ContainerChild
389- Gtk.Label w24 = new Gtk.Label();
390- w24.LabelProp = Mono.Unix.Catalog.GetString("Delete Dock");
391- w24.UseUnderline = true;
392- w21.Add(w24);
393- w20.Add(w21);
394- this.delete_dock_button.Add(w20);
395- this.hbox3.Add(this.delete_dock_button);
396- Gtk.Box.BoxChild w28 = ((Gtk.Box.BoxChild)(this.hbox3[this.delete_dock_button]));
397- w28.Position = 1;
398- w28.Expand = false;
399- w28.Fill = false;
400- // Container child hbox3.Gtk.Box+BoxChild
401 this.vbox4 = new Gtk.VBox();
402 this.vbox4.Name = "vbox4";
403 this.vbox4.Spacing = 6;
404 this.hbox3.Add(this.vbox4);
405- Gtk.Box.BoxChild w29 = ((Gtk.Box.BoxChild)(this.hbox3[this.vbox4]));
406- w29.Position = 2;
407+ Gtk.Box.BoxChild w11 = ((Gtk.Box.BoxChild)(this.hbox3[this.vbox4]));
408+ w11.Position = 2;
409 this.hbox2.Add(this.hbox3);
410- Gtk.Box.BoxChild w30 = ((Gtk.Box.BoxChild)(this.hbox2[this.hbox3]));
411- w30.Position = 0;
412+ Gtk.Box.BoxChild w12 = ((Gtk.Box.BoxChild)(this.hbox2[this.hbox3]));
413+ w12.Position = 0;
414 // Container child hbox2.Gtk.Box+BoxChild
415 this.close_button = new Gtk.Button();
416 this.close_button.CanFocus = true;
417@@ -231,15 +173,15 @@
418 this.close_button.BorderWidth = ((uint)(5));
419 this.close_button.Label = "gtk-close";
420 this.hbox2.Add(this.close_button);
421- Gtk.Box.BoxChild w31 = ((Gtk.Box.BoxChild)(this.hbox2[this.close_button]));
422- w31.Position = 1;
423- w31.Expand = false;
424- w31.Fill = false;
425+ Gtk.Box.BoxChild w13 = ((Gtk.Box.BoxChild)(this.hbox2[this.close_button]));
426+ w13.Position = 1;
427+ w13.Expand = false;
428+ w13.Fill = false;
429 this.vbox1.Add(this.hbox2);
430- Gtk.Box.BoxChild w32 = ((Gtk.Box.BoxChild)(this.vbox1[this.hbox2]));
431- w32.Position = 1;
432- w32.Expand = false;
433- w32.Fill = false;
434+ Gtk.Box.BoxChild w14 = ((Gtk.Box.BoxChild)(this.vbox1[this.hbox2]));
435+ w14.Position = 1;
436+ w14.Expand = false;
437+ w14.Fill = false;
438 this.Add(this.vbox1);
439 if ((this.Child != null)) {
440 this.Child.ShowAll();
441@@ -249,8 +191,6 @@
442 this.Show();
443 this.start_with_computer_checkbutton.Toggled += new System.EventHandler(this.OnStartWithComputerCheckbuttonToggled);
444 this.theme_combo.Changed += new System.EventHandler(this.OnThemeComboChanged);
445- this.new_dock_button.Clicked += new System.EventHandler(this.OnNewDockButtonClicked);
446- this.delete_dock_button.Clicked += new System.EventHandler(this.OnDeleteDockButtonClicked);
447 this.close_button.Clicked += new System.EventHandler(this.OnCloseButtonClicked);
448 }
449 }
450
451=== modified file 'Docky/gtk-gui/gui.stetic'
452--- Docky/gtk-gui/gui.stetic 2009-10-31 06:37:25 +0000
453+++ Docky/gtk-gui/gui.stetic 2009-11-01 01:20:25 +0000
454@@ -7,11 +7,11 @@
455 <import>
456 <widget-library name="Mono.Addins.Gui, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
457 <widget-library name="wnck-sharp, Version=2.20.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
458+ <widget-library name="gnomedesktop-sharp, Version=2.20.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
459 <widget-library name="../../Docky.Services/bin/Debug/Docky.Services.dll" />
460 <widget-library name="../../Docky.Items/bin/Debug/Docky.Items.dll" />
461 <widget-library name="../../Docky.Windowing/bin/Debug/Docky.Windowing.dll" />
462 <widget-library name="../bin/Debug/Docky.exe" internal="true" />
463- <widget-library name="gnomedesktop-sharp, Version=2.20.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
464 </import>
465 <widget class="Gtk.Bin" id="Docky.Interface.DockPreferences" design-size="368 331">
466 <property name="MemberName" />
467@@ -632,40 +632,10 @@
468 <property name="MemberName" />
469 <property name="Spacing">6</property>
470 <child>
471- <widget class="Gtk.Button" id="new_dock_button">
472- <property name="MemberName" />
473- <property name="CanFocus">True</property>
474- <property name="Type">TextAndIcon</property>
475- <property name="Icon">stock:gtk-add Menu</property>
476- <property name="Label" translatable="yes">New Dock</property>
477- <property name="UseUnderline">True</property>
478- <property name="BorderWidth">5</property>
479- <signal name="Clicked" handler="OnNewDockButtonClicked" />
480- </widget>
481- <packing>
482- <property name="Position">0</property>
483- <property name="AutoSize">True</property>
484- <property name="Expand">False</property>
485- <property name="Fill">False</property>
486- </packing>
487+ <placeholder />
488 </child>
489 <child>
490- <widget class="Gtk.Button" id="delete_dock_button">
491- <property name="MemberName" />
492- <property name="CanFocus">True</property>
493- <property name="Type">TextAndIcon</property>
494- <property name="Icon">stock:gtk-delete Menu</property>
495- <property name="Label" translatable="yes">Delete Dock</property>
496- <property name="UseUnderline">True</property>
497- <property name="BorderWidth">5</property>
498- <signal name="Clicked" handler="OnDeleteDockButtonClicked" />
499- </widget>
500- <packing>
501- <property name="Position">1</property>
502- <property name="AutoSize">True</property>
503- <property name="Expand">False</property>
504- <property name="Fill">False</property>
505- </packing>
506+ <placeholder />
507 </child>
508 <child>
509 <widget class="Gtk.VBox" id="vbox4">

Subscribers

People subscribed via source and target branches

to status/vote changes: