Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~cszikszoy/docky/mmv3 |
Merge into: | lp:docky |
Diff against target: |
301 lines 6 files modified
Docky/Docky/ConfigurationWindow.cs (+22/-0) Docky/Docky/DockController.cs (+66/-5) Docky/Docky/Interface/DockPreferences.cs (+25/-14) Docky/Docky/Interface/DockWindow.cs (+1/-1) Docky/Docky/Interface/IDockPreferences.cs (+2/-0) Docky/gtk-gui/gui.stetic (+1/-4) |
To merge this branch: | bzr merge lp:~cszikszoy/docky/mmv3 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Docky Core | Pending | ||
Review via email: mp+14290@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
lp:~cszikszoy/docky/mmv3
updated
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 21:05:19 +0000 | |||
4 | @@ -151,11 +151,15 @@ | |||
5 | 151 | 151 | ||
6 | 152 | protected virtual void OnDeleteDockButtonClicked (object sender, System.EventArgs e) | 152 | protected virtual void OnDeleteDockButtonClicked (object sender, System.EventArgs e) |
7 | 153 | { | 153 | { |
8 | 154 | if (!(Docky.Controller.Docks.Count () > 1)) | ||
9 | 155 | return; | ||
10 | 156 | |||
11 | 154 | if (ActiveDock != null) { | 157 | if (ActiveDock != null) { |
12 | 155 | Docky.Controller.DeleteDock (ActiveDock); | 158 | Docky.Controller.DeleteDock (ActiveDock); |
13 | 156 | ActiveDock = null; | 159 | ActiveDock = null; |
14 | 157 | SetupConfigAlignment (); | 160 | SetupConfigAlignment (); |
15 | 158 | } | 161 | } |
16 | 162 | CheckButtons (); | ||
17 | 159 | } | 163 | } |
18 | 160 | 164 | ||
19 | 161 | protected virtual void OnNewDockButtonClicked (object sender, System.EventArgs e) | 165 | protected virtual void OnNewDockButtonClicked (object sender, System.EventArgs e) |
20 | @@ -168,6 +172,24 @@ | |||
21 | 168 | ActiveDock = newDock; | 172 | ActiveDock = newDock; |
22 | 169 | SetupConfigAlignment (); | 173 | SetupConfigAlignment (); |
23 | 170 | } | 174 | } |
24 | 175 | CheckButtons (); | ||
25 | 176 | } | ||
26 | 177 | |||
27 | 178 | void CheckButtons () | ||
28 | 179 | { | ||
29 | 180 | new_dock_button.Sensitive = true; | ||
30 | 181 | delete_dock_button.Sensitive = true; | ||
31 | 182 | if (Docky.Controller.Docks.Count () == 1) { | ||
32 | 183 | delete_dock_button.Sensitive = false; | ||
33 | 184 | new_dock_button.Sensitive = true; | ||
34 | 185 | } | ||
35 | 186 | int spotsAvailable = 0; | ||
36 | 187 | for (int i = 0; i < Screen.Default.NMonitors; i++) | ||
37 | 188 | spotsAvailable += Docky.Controller.PositionsAvailableForDock (i).Count (); | ||
38 | 189 | if (spotsAvailable == 0) { | ||
39 | 190 | delete_dock_button.Sensitive = true; | ||
40 | 191 | new_dock_button.Sensitive = false; | ||
41 | 192 | } | ||
42 | 171 | } | 193 | } |
43 | 172 | 194 | ||
44 | 173 | string AutoStartDir { | 195 | string AutoStartDir { |
45 | 174 | 196 | ||
46 | === modified file 'Docky/Docky/DockController.cs' | |||
47 | --- Docky/Docky/DockController.cs 2009-10-31 16:05:10 +0000 | |||
48 | +++ Docky/Docky/DockController.cs 2009-11-01 21:05:19 +0000 | |||
49 | @@ -31,7 +31,13 @@ | |||
50 | 31 | 31 | ||
51 | 32 | namespace Docky | 32 | namespace Docky |
52 | 33 | { | 33 | { |
54 | 34 | 34 | ||
55 | 35 | class DockMonitor | ||
56 | 36 | { | ||
57 | 37 | public Rectangle Geo { get; set; } | ||
58 | 38 | public int MonitorNumber { get; set; } | ||
59 | 39 | public IEnumerable<DockPosition> PossiblePositions { get; set; } | ||
60 | 40 | } | ||
61 | 35 | 41 | ||
62 | 36 | internal class DockController : IDisposable | 42 | internal class DockController : IDisposable |
63 | 37 | { | 43 | { |
64 | @@ -50,6 +56,21 @@ | |||
65 | 50 | get { return DockNames.Count (); } | 56 | get { return DockNames.Count (); } |
66 | 51 | } | 57 | } |
67 | 52 | 58 | ||
68 | 59 | List<DockMonitor> DockMonitors { get; set; } | ||
69 | 60 | |||
70 | 61 | public IEnumerable<DockPosition> PositionsAvailableForDock (int monitorNum) | ||
71 | 62 | { | ||
72 | 63 | foreach (DockPosition position in DockMonitors.Where (d => d.MonitorNumber == monitorNum).First ().PossiblePositions) { | ||
73 | 64 | if (!DocksForMonitor (monitorNum).Any (dock => dock.Preferences.Position == position)) | ||
74 | 65 | yield return position; | ||
75 | 66 | } | ||
76 | 67 | } | ||
77 | 68 | |||
78 | 69 | public IEnumerable<Dock> DocksForMonitor (int monitorNumber) | ||
79 | 70 | { | ||
80 | 71 | return docks.Where (d => d.Preferences.MonitorNumber == monitorNumber); | ||
81 | 72 | } | ||
82 | 73 | |||
83 | 53 | IEnumerable<string> ThemeContainerFolders { | 74 | IEnumerable<string> ThemeContainerFolders { |
84 | 54 | get { | 75 | get { |
85 | 55 | yield return Path.Combine (DockServices.System.SystemDataFolder, "themes"); | 76 | yield return Path.Combine (DockServices.System.SystemDataFolder, "themes"); |
86 | @@ -111,6 +132,7 @@ | |||
87 | 111 | { | 132 | { |
88 | 112 | docks = new List<Dock> (); | 133 | docks = new List<Dock> (); |
89 | 113 | prefs = DockServices.Preferences.Get<DockController> (); | 134 | prefs = DockServices.Preferences.Get<DockController> (); |
90 | 135 | DetectMonitors (); | ||
91 | 114 | CreateDocks (); | 136 | CreateDocks (); |
92 | 115 | 137 | ||
93 | 116 | GLib.Timeout.Add (500, delegate { | 138 | GLib.Timeout.Add (500, delegate { |
94 | @@ -119,6 +141,41 @@ | |||
95 | 119 | }); | 141 | }); |
96 | 120 | } | 142 | } |
97 | 121 | 143 | ||
98 | 144 | void DetectMonitors () | ||
99 | 145 | { | ||
100 | 146 | DockMonitors = new List<DockMonitor> (); | ||
101 | 147 | |||
102 | 148 | // first add all of the screens and their geometries | ||
103 | 149 | for (int i = 0; i < Screen.Default.NMonitors; i++) { | ||
104 | 150 | DockMonitor mon = new DockMonitor (); | ||
105 | 151 | mon.MonitorNumber = i; | ||
106 | 152 | mon.Geo = Screen.Default.GetMonitorGeometry (i); | ||
107 | 153 | DockMonitors.Add (mon); | ||
108 | 154 | } | ||
109 | 155 | |||
110 | 156 | int topDockVal = DockMonitors.OrderBy (d => d.Geo.Top).First ().Geo.Top; | ||
111 | 157 | int bottomDockVal = DockMonitors.OrderByDescending (d => d.Geo.Bottom).First ().Geo.Bottom; | ||
112 | 158 | int leftDockVal = DockMonitors.OrderBy (d => d.Geo.Left).First ().Geo.Left; | ||
113 | 159 | int rightDockVal = DockMonitors.OrderByDescending (d => d.Geo.Right).First ().Geo.Right; | ||
114 | 160 | |||
115 | 161 | // now build the list of available positions for a given screen. | ||
116 | 162 | for (int i = 0; i < DockMonitors.Count (); i++) { | ||
117 | 163 | List<DockPosition> positions = new List<DockPosition> (); | ||
118 | 164 | DockMonitor mon = DockMonitors.Where (d => d.MonitorNumber == i).First (); | ||
119 | 165 | |||
120 | 166 | if (mon.Geo.Left == leftDockVal) | ||
121 | 167 | positions.Add (DockPosition.Left); | ||
122 | 168 | if (mon.Geo.Right == rightDockVal) | ||
123 | 169 | positions.Add (DockPosition.Right); | ||
124 | 170 | if (mon.Geo.Top == topDockVal) | ||
125 | 171 | positions.Add (DockPosition.Top); | ||
126 | 172 | if (mon.Geo.Bottom == bottomDockVal) | ||
127 | 173 | positions.Add (DockPosition.Bottom); | ||
128 | 174 | |||
129 | 175 | mon.PossiblePositions = positions; | ||
130 | 176 | } | ||
131 | 177 | } | ||
132 | 178 | |||
133 | 122 | string FolderForTheme (string theme) | 179 | string FolderForTheme (string theme) |
134 | 123 | { | 180 | { |
135 | 124 | foreach (string dir in ThemeContainerFolders) { | 181 | foreach (string dir in ThemeContainerFolders) { |
136 | @@ -146,8 +203,13 @@ | |||
137 | 146 | 203 | ||
138 | 147 | public Dock CreateDock () | 204 | public Dock CreateDock () |
139 | 148 | { | 205 | { |
142 | 149 | if (docks.Count >= 4) | 206 | int mon; |
143 | 150 | return null; | 207 | for (mon = 0; mon < Screen.Default.NMonitors; mon++) { |
144 | 208 | if (PositionsAvailableForDock (mon).Any ()) | ||
145 | 209 | break; | ||
146 | 210 | if (mon == Screen.Default.NMonitors - 1) | ||
147 | 211 | return null; | ||
148 | 212 | } | ||
149 | 151 | 213 | ||
150 | 152 | string name = "Dock" + 1; | 214 | string name = "Dock" + 1; |
151 | 153 | for (int i = 2; DockNames.Contains (name); i++) | 215 | for (int i = 2; DockNames.Contains (name); i++) |
152 | @@ -155,7 +217,7 @@ | |||
153 | 155 | 217 | ||
154 | 156 | DockNames = DockNames.Concat (new [] { name }); | 218 | DockNames = DockNames.Concat (new [] { name }); |
155 | 157 | 219 | ||
157 | 158 | DockPreferences dockPrefs = new DockPreferences (name); | 220 | DockPreferences dockPrefs = new DockPreferences (name, mon); |
158 | 159 | Dock dock = new Dock (dockPrefs); | 221 | Dock dock = new Dock (dockPrefs); |
159 | 160 | docks.Add (dock); | 222 | docks.Add (dock); |
160 | 161 | 223 | ||
161 | @@ -172,7 +234,6 @@ | |||
162 | 172 | dock.Dispose (); | 234 | dock.Dispose (); |
163 | 173 | DockNames = DockNames.Where (s => s != dock.Preferences.GetName ()); | 235 | DockNames = DockNames.Where (s => s != dock.Preferences.GetName ()); |
164 | 174 | 236 | ||
165 | 175 | EnsurePluginState (); | ||
166 | 176 | return true; | 237 | return true; |
167 | 177 | } | 238 | } |
168 | 178 | 239 | ||
169 | 179 | 240 | ||
170 | === modified file 'Docky/Docky/Interface/DockPreferences.cs' | |||
171 | --- Docky/Docky/Interface/DockPreferences.cs 2009-10-31 16:05:10 +0000 | |||
172 | +++ Docky/Docky/Interface/DockPreferences.cs 2009-11-01 21:05:19 +0000 | |||
173 | @@ -128,13 +128,9 @@ | |||
174 | 128 | set { | 128 | set { |
175 | 129 | if (position == value) | 129 | if (position == value) |
176 | 130 | return; | 130 | return; |
177 | 131 | Dock other_dock = null; | ||
178 | 132 | if (Docky.Controller.Docks.Any (d => d.Preferences.Position == value)) | ||
179 | 133 | other_dock = Docky.Controller.Docks.Where (d => d.Preferences.Position == value).First(); | ||
180 | 134 | DockPosition old_position = position; | ||
181 | 135 | position = value; | 131 | position = value; |
184 | 136 | if (other_dock != null) | 132 | if (!Docky.Controller.PositionsAvailableForDock (MonitorNumber).Contains (value)) |
185 | 137 | other_dock.Preferences.Position = old_position; | 133 | position = Docky.Controller.PositionsAvailableForDock (MonitorNumber).First (); |
186 | 138 | SetOption<string> ("Position", position.ToString ()); | 134 | SetOption<string> ("Position", position.ToString ()); |
187 | 139 | OnPositionChanged (); | 135 | OnPositionChanged (); |
188 | 140 | } | 136 | } |
189 | @@ -195,7 +191,7 @@ | |||
190 | 195 | get { | 191 | get { |
191 | 196 | if (!zoom_percent.HasValue) | 192 | if (!zoom_percent.HasValue) |
192 | 197 | zoom_percent = GetOption<double?> ("ZoomPercent", 2.0); | 193 | zoom_percent = GetOption<double?> ("ZoomPercent", 2.0); |
194 | 198 | return zoom_percent.Value; | 194 | return zoom_percent.Value; |
195 | 199 | } | 195 | } |
196 | 200 | set { | 196 | set { |
197 | 201 | value = Clamp (value, 4, 1); | 197 | value = Clamp (value, 4, 1); |
198 | @@ -207,6 +203,21 @@ | |||
199 | 207 | OnZoomPercentChanged (); | 203 | OnZoomPercentChanged (); |
200 | 208 | } | 204 | } |
201 | 209 | } | 205 | } |
202 | 206 | |||
203 | 207 | int? monitor_number; | ||
204 | 208 | public int MonitorNumber { | ||
205 | 209 | get { | ||
206 | 210 | if (!monitor_number.HasValue) | ||
207 | 211 | monitor_number = GetOption<int?> ("MonitorNumber", 0); | ||
208 | 212 | return monitor_number.Value; | ||
209 | 213 | } | ||
210 | 214 | set { | ||
211 | 215 | if (monitor_number == value) | ||
212 | 216 | return; | ||
213 | 217 | monitor_number = value; | ||
214 | 218 | SetOption<int?> ("MonitorNumber", monitor_number.Value); | ||
215 | 219 | } | ||
216 | 220 | } | ||
217 | 210 | #endregion | 221 | #endregion |
218 | 211 | 222 | ||
219 | 212 | bool? window_manager; | 223 | bool? window_manager; |
220 | @@ -248,8 +259,15 @@ | |||
221 | 248 | set { prefs.Set<bool> ("FirstRun", value); } | 259 | set { prefs.Set<bool> ("FirstRun", value); } |
222 | 249 | } | 260 | } |
223 | 250 | 261 | ||
224 | 262 | public DockPreferences (string dockName, int monitorNumber) : this(dockName) | ||
225 | 263 | { | ||
226 | 264 | MonitorNumber = monitorNumber; | ||
227 | 265 | } | ||
228 | 266 | |||
229 | 251 | public DockPreferences (string dockName) | 267 | public DockPreferences (string dockName) |
230 | 252 | { | 268 | { |
231 | 269 | prefs = DockServices.Preferences.Get<DockPreferences> (); | ||
232 | 270 | |||
233 | 253 | // ensures position actually gets set | 271 | // ensures position actually gets set |
234 | 254 | position = (DockPosition) 100; | 272 | position = (DockPosition) 100; |
235 | 255 | 273 | ||
236 | @@ -264,8 +282,6 @@ | |||
237 | 264 | 282 | ||
238 | 265 | name = dockName; | 283 | name = dockName; |
239 | 266 | 284 | ||
240 | 267 | prefs = DockServices.Preferences.Get<DockPreferences> (); | ||
241 | 268 | |||
242 | 269 | BuildItemProviders (); | 285 | BuildItemProviders (); |
243 | 270 | BuildOptions (); | 286 | BuildOptions (); |
244 | 271 | 287 | ||
245 | @@ -435,13 +451,8 @@ | |||
246 | 435 | DockPosition position = (DockPosition) Enum.Parse (typeof(DockPosition), | 451 | DockPosition position = (DockPosition) Enum.Parse (typeof(DockPosition), |
247 | 436 | GetOption ("Position", DockPosition.Bottom.ToString ())); | 452 | GetOption ("Position", DockPosition.Bottom.ToString ())); |
248 | 437 | 453 | ||
249 | 438 | while (Docky.Controller.Docks.Any ((Dock d) => d.Preferences.Position == position)) { | ||
250 | 439 | Log<DockPreferences>.Error ("Dock position already in use: " + position.ToString ()); | ||
251 | 440 | position = (DockPosition) ((((int) position) + 1) % 4); | ||
252 | 441 | } | ||
253 | 442 | Position = position; | 454 | Position = position; |
254 | 443 | 455 | ||
255 | 444 | |||
256 | 445 | if (WindowManager) | 456 | if (WindowManager) |
257 | 446 | DefaultProvider.SetWindowManager (); | 457 | DefaultProvider.SetWindowManager (); |
258 | 447 | 458 | ||
259 | 448 | 459 | ||
260 | === modified file 'Docky/Docky/Interface/DockWindow.cs' | |||
261 | --- Docky/Docky/Interface/DockWindow.cs 2009-11-01 21:03:51 +0000 | |||
262 | +++ Docky/Docky/Interface/DockWindow.cs 2009-11-01 21:05:20 +0000 | |||
263 | @@ -344,7 +344,7 @@ | |||
264 | 344 | 344 | ||
265 | 345 | //fixme | 345 | //fixme |
266 | 346 | int Monitor { | 346 | int Monitor { |
268 | 347 | get { return 0; } | 347 | get { return Preferences.MonitorNumber; } |
269 | 348 | } | 348 | } |
270 | 349 | 349 | ||
271 | 350 | internal DockPosition Position { | 350 | internal DockPosition Position { |
272 | 351 | 351 | ||
273 | === modified file 'Docky/Docky/Interface/IDockPreferences.cs' | |||
274 | --- Docky/Docky/Interface/IDockPreferences.cs 2009-10-31 03:57:40 +0000 | |||
275 | +++ Docky/Docky/Interface/IDockPreferences.cs 2009-11-01 21:05:20 +0000 | |||
276 | @@ -62,6 +62,8 @@ | |||
277 | 62 | 62 | ||
278 | 63 | double ZoomPercent { get; set; } | 63 | double ZoomPercent { get; set; } |
279 | 64 | 64 | ||
280 | 65 | int MonitorNumber { get; set; } | ||
281 | 66 | |||
282 | 65 | bool SetName (string name); | 67 | bool SetName (string name); |
283 | 66 | 68 | ||
284 | 67 | string GetName (); | 69 | string GetName (); |
285 | 68 | 70 | ||
286 | === modified file 'Docky/gtk-gui/gui.stetic' | |||
287 | --- Docky/gtk-gui/gui.stetic 2009-10-31 06:37:25 +0000 | |||
288 | +++ Docky/gtk-gui/gui.stetic 2009-11-01 21:05:20 +0000 | |||
289 | @@ -7,11 +7,8 @@ | |||
290 | 7 | <import> | 7 | <import> |
291 | 8 | <widget-library name="Mono.Addins.Gui, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> | 8 | <widget-library name="Mono.Addins.Gui, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> |
292 | 9 | <widget-library name="wnck-sharp, Version=2.20.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> | 9 | <widget-library name="wnck-sharp, Version=2.20.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> |
296 | 10 | <widget-library name="../../Docky.Services/bin/Debug/Docky.Services.dll" /> | 10 | <widget-library name="gnomedesktop-sharp, Version=2.20.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> |
294 | 11 | <widget-library name="../../Docky.Items/bin/Debug/Docky.Items.dll" /> | ||
295 | 12 | <widget-library name="../../Docky.Windowing/bin/Debug/Docky.Windowing.dll" /> | ||
297 | 13 | <widget-library name="../bin/Debug/Docky.exe" internal="true" /> | 11 | <widget-library name="../bin/Debug/Docky.exe" internal="true" /> |
298 | 14 | <widget-library name="gnomedesktop-sharp, Version=2.20.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> | ||
299 | 15 | </import> | 12 | </import> |
300 | 16 | <widget class="Gtk.Bin" id="Docky.Interface.DockPreferences" design-size="368 331"> | 13 | <widget class="Gtk.Bin" id="Docky.Interface.DockPreferences" design-size="368 331"> |
301 | 17 | <property name="MemberName" /> | 14 | <property name="MemberName" /> |