Merge lp:~cszikszoy/docky/service-consolidation into lp:docky
- service-consolidation
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 1610 |
Proposed branch: | lp:~cszikszoy/docky/service-consolidation |
Merge into: | lp:docky |
Diff against target: |
3491 lines (+1023/-1166) 71 files modified
Docky-2.sln (+2/-8) Docky.DBus/Docky.DBus.csproj (+0/-4) Docky.DBus/Docky.DBus/DBusManager.cs (+1/-1) Docky.DBus/Makefile.am (+0/-1) Docky.Items/Docky.Items.csproj (+0/-4) Docky.Items/Docky.Items/ApplicationDockItem.cs (+5/-4) Docky.Items/Docky.Items/ColoredIconDockItem.cs (+1/-0) Docky.Items/Docky.Items/FileApplicationProvider.cs (+14/-12) Docky.Items/Docky.Items/WindowDockItem.cs (+3/-2) Docky.Items/Docky.Items/WnckDockItem.cs (+2/-1) Docky.Items/Docky.Menus/MenuItem.cs (+1/-0) Docky.Items/Docky.Menus/WindowMenuItem.cs (+1/-1) Docky.Items/Makefile.am (+1/-2) Docky.Services/Docky.Services.csproj (+26/-6) Docky.Services/Docky.Services.dll.config (+2/-1) Docky.Services/Docky.Services/Applications/DesktopFileChangedEventArgs.cs (+1/-1) Docky.Services/Docky.Services/Applications/DesktopItem.cs (+43/-38) Docky.Services/Docky.Services/DesktopItemService.cs (+593/-0) Docky.Services/Docky.Services/DockServices.cs (+7/-0) Docky.Services/Docky.Services/DrawingService.cs (+0/-4) Docky.Services/Docky.Services/Extensions/WnckWindowExtension.cs (+18/-21) Docky.Services/Docky.Services/HelperService.cs (+4/-1) Docky.Services/Docky.Services/Helpers/Helper.cs (+3/-1) Docky.Services/Docky.Services/Helpers/HelperMetadata.cs (+1/-1) Docky.Services/Docky.Services/Helpers/HelperStatusChangedEventArgs.cs (+1/-1) Docky.Services/Docky.Services/PathsService.cs (+2/-2) Docky.Services/Docky.Services/Preferences/IPreferences.cs (+1/-1) Docky.Services/Docky.Services/Preferences/Preferences.cs (+1/-1) Docky.Services/Docky.Services/Preferences/PreferencesChangedEventArgs.cs (+1/-1) Docky.Services/Docky.Services/PreferencesService.cs (+3/-1) Docky.Services/Docky.Services/SystemService.cs (+30/-12) Docky.Services/Docky.Services/ThemeService.cs (+2/-0) Docky.Services/Docky.Services/WindowMatcherService.cs (+197/-753) Docky.Services/Docky.Services/Windows/Position.cs (+1/-2) Docky.Services/Docky.Services/Windows/WindowControl.cs (+1/-2) Docky.Services/Docky.Services/Xlib/X11Atoms.cs (+3/-3) Docky.Services/Docky.Services/Xlib/Xlib.cs (+3/-6) Docky.Services/Makefile.am (+25/-15) Docky.Windowing/AssemblyInfo.cs (+0/-42) Docky.Windowing/Docky.Windowing.csproj (+0/-85) Docky.Windowing/Docky.Windowing.dll.config (+0/-4) Docky.Windowing/Makefile.am (+0/-36) Docky.Windowing/Windowing/ClickAction.cs (+0/-31) Docky.Windowing/docky.windowing.pc.in (+0/-5) Docky/Docky.csproj (+0/-4) Docky/Docky/ConfigurationWindow.cs (+1/-0) Docky/Docky/DockController.cs (+1/-0) Docky/Docky/Docky.cs (+1/-1) Docky/Docky/HelperTile.cs (+1/-1) Docky/Docky/Interface/AutohideManager.cs (+1/-0) Docky/Docky/Interface/DockDragTracker.cs (+1/-7) Docky/Docky/Interface/DockPreferences.cs (+2/-1) Docky/Docky/Interface/DockWindow.cs (+3/-7) Docky/Docky/Items/DockyItem.cs (+1/-0) Docky/Makefile.am (+0/-1) Docky/gtk-gui/gui.stetic (+0/-1) Makefile.am (+0/-1) StandardPlugins/Clock/src/ClockDockItem.cs (+1/-0) StandardPlugins/Desktop/Desktop.csproj (+0/-4) StandardPlugins/Desktop/Makefile.am (+0/-1) StandardPlugins/GMail/src/GMailPreferences.cs (+1/-0) StandardPlugins/NPR/src/NPR.cs (+1/-1) StandardPlugins/RecentDocuments/src/RecentDocumentsItem.cs (+1/-0) StandardPlugins/SessionManager/src/SessionManagerItem.cs (+1/-0) StandardPlugins/Timer/src/TimerMainDockItem.cs (+1/-0) StandardPlugins/Trash/src/TrashDockItem.cs (+1/-0) StandardPlugins/Weather/src/WeatherPreferences.cs (+1/-0) StandardPlugins/WorkspaceSwitcher/Makefile.am (+0/-1) StandardPlugins/WorkspaceSwitcher/WorkspaceSwitcher.csproj (+2/-5) StandardPlugins/WorkspaceSwitcher/src/WorkspaceSwitcherDockItem.cs (+1/-0) configure.ac (+0/-13) |
To merge this branch: | bzr merge lp:~cszikszoy/docky/service-consolidation |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Robert Dyer (community) | Disapprove | ||
Rico Tzschichholz | Approve | ||
Review via email: mp+32003@code.launchpad.net |
Commit message
Description of the change
Completely remove the Docky.Windowing assembly. Separate DesktopItem related stuff from the WindowManager, and turn both into services. Move other items from Docky.Windowing into Docky.Services. Also clean up services in general by moving items into specialized namespaces / folders.
Chris S. (cszikszoy) wrote : | # |
do a bzr pull. I fixed that but forgot to push. It's there now. As for
po/docky.pot... I have no idea why that keeps getting deleted. I think it
happens when I run 'make clean'.
Rico Tzschichholz (ricotz) wrote : | # |
Didn't experienced problems, yet ;-)
Robert Dyer (psybers) wrote : | # |
Let's switch to BAMF and then figure out how we want to refactor the windowing code.
Rico Tzschichholz (ricotz) wrote : | # |
@Robert: I see no harm in merging this refactoring and consider a transition to BAMF afterwards. The new structure even seems to make it easier to distinguish the parts which BAMF would replace.
Chris S. (cszikszoy) wrote : | # |
I think the switch to BAMF should come post 2.1. There are a lot of unknowns and unresolved issues when dealing with BAMF. I think it'd just be better to refactor the current code (as I've done), then investigate switching to BAMF.
Preview Diff
1 | === modified file 'Docky-2.sln' |
2 | --- Docky-2.sln 2010-06-09 06:31:00 +0000 |
3 | +++ Docky-2.sln 2010-08-14 22:27:42 +0000 |
4 | @@ -9,8 +9,6 @@ |
5 | EndProject |
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Docky.CairoHelper", "Docky.CairoHelper\Docky.CairoHelper.csproj", "{B23E0EDD-6443-4F99-9EAC-B7CC906F080D}" |
7 | EndProject |
8 | -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Docky.Windowing", "Docky.Windowing\Docky.Windowing.csproj", "{888FCD95-7C79-45C4-A744-9C840DF4B9B0}" |
9 | -EndProject |
10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "StandardPlugins", "StandardPlugins", "{8D4EE2FA-9CF2-4890-B14A-1BA8752404FE}" |
11 | EndProject |
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bookmarks", "StandardPlugins\Bookmarks\Bookmarks.csproj", "{4AC9784E-7AAA-467D-BF8F-D15B8FB88708}" |
13 | @@ -93,10 +91,6 @@ |
14 | {74197632-9339-426E-B947-DE34766931E1}.Debug|Any CPU.Build.0 = Debug|Any CPU |
15 | {74197632-9339-426E-B947-DE34766931E1}.Release|Any CPU.ActiveCfg = Release|Any CPU |
16 | {74197632-9339-426E-B947-DE34766931E1}.Release|Any CPU.Build.0 = Release|Any CPU |
17 | - {888FCD95-7C79-45C4-A744-9C840DF4B9B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
18 | - {888FCD95-7C79-45C4-A744-9C840DF4B9B0}.Debug|Any CPU.Build.0 = Debug|Any CPU |
19 | - {888FCD95-7C79-45C4-A744-9C840DF4B9B0}.Release|Any CPU.ActiveCfg = Release|Any CPU |
20 | - {888FCD95-7C79-45C4-A744-9C840DF4B9B0}.Release|Any CPU.Build.0 = Release|Any CPU |
21 | {8A6E0EDD-6443-4F99-9EAC-D9CC906F080D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
22 | {8A6E0EDD-6443-4F99-9EAC-D9CC906F080D}.Debug|Any CPU.Build.0 = Debug|Any CPU |
23 | {8A6E0EDD-6443-4F99-9EAC-D9CC906F080D}.Release|Any CPU.ActiveCfg = Release|Any CPU |
24 | @@ -160,12 +154,11 @@ |
25 | {66939AAB-0832-4D2D-8282-3E29AA772B69} = {8D4EE2FA-9CF2-4890-B14A-1BA8752404FE} |
26 | EndGlobalSection |
27 | GlobalSection(MonoDevelopProperties) = preSolution |
28 | - version = 2.0 |
29 | StartupItem = Docky\Docky.csproj |
30 | Policies = $0 |
31 | $0.StandardHeader = $1 |
32 | $1.Text = @ \n Copyright (C) ${Year} Jason Smith\n\n This program is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.\n |
33 | - $1.inheritsSet = MITX11License |
34 | + $1.inheritsSet = Apache2License |
35 | $0.DotNetNamingPolicy = $2 |
36 | $2.DirectoryNamespaceAssociation = Hierarchical |
37 | $2.ResourceNamePolicy = FileName |
38 | @@ -192,5 +185,6 @@ |
39 | $7.inheritsSet = Mono |
40 | $7.inheritsScope = text/x-csharp |
41 | $7.scope = text/x-csharp |
42 | + version = 2.0 |
43 | EndGlobalSection |
44 | EndGlobal |
45 | |
46 | === modified file 'Docky.DBus/Docky.DBus.csproj' |
47 | --- Docky.DBus/Docky.DBus.csproj 2010-06-01 12:53:24 +0000 |
48 | +++ Docky.DBus/Docky.DBus.csproj 2010-08-14 22:27:42 +0000 |
49 | @@ -80,10 +80,6 @@ |
50 | <Project>{AB6E0EDD-6443-4F99-9EAC-DABC906F080D}</Project> |
51 | <Name>Docky.Items</Name> |
52 | </ProjectReference> |
53 | - <ProjectReference Include="..\Docky.Windowing\Docky.Windowing.csproj"> |
54 | - <Project>{888FCD95-7C79-45C4-A744-9C840DF4B9B0}</Project> |
55 | - <Name>Docky.Windowing</Name> |
56 | - </ProjectReference> |
57 | </ItemGroup> |
58 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> |
59 | </Project> |
60 | |
61 | === modified file 'Docky.DBus/Docky.DBus/DBusManager.cs' |
62 | --- Docky.DBus/Docky.DBus/DBusManager.cs 2010-08-06 22:37:42 +0000 |
63 | +++ Docky.DBus/Docky.DBus/DBusManager.cs 2010-08-14 22:27:42 +0000 |
64 | @@ -182,7 +182,7 @@ |
65 | |
66 | InitializeSharedBus (bus); |
67 | |
68 | - DockServices.Helpers.HelperStatusChanged += delegate(object sender, HelperStatusChangedEventArgs e) { |
69 | + DockServices.Helpers.HelperStatusChanged += delegate(object sender, Docky.Services.Helpers.HelperStatusChangedEventArgs e) { |
70 | // if a script has stopped running, trigger a refresh |
71 | if (!e.IsRunning) |
72 | ForceRefresh (); |
73 | |
74 | === modified file 'Docky.DBus/Makefile.am' |
75 | --- Docky.DBus/Makefile.am 2010-05-25 06:04:27 +0000 |
76 | +++ Docky.DBus/Makefile.am 2010-08-14 22:27:42 +0000 |
77 | @@ -17,7 +17,6 @@ |
78 | |
79 | PROJECT_REFERENCES = \ |
80 | Docky.Items \ |
81 | - Docky.Windowing \ |
82 | Docky.Services |
83 | |
84 | REFERENCES = \ |
85 | |
86 | === modified file 'Docky.Items/Docky.Items.csproj' |
87 | --- Docky.Items/Docky.Items.csproj 2010-08-01 11:25:54 +0000 |
88 | +++ Docky.Items/Docky.Items.csproj 2010-08-14 22:27:42 +0000 |
89 | @@ -106,10 +106,6 @@ |
90 | <Project>{B23E0EDD-6443-4F99-9EAC-B7CC906F080D}</Project> |
91 | <Name>Docky.CairoHelper</Name> |
92 | </ProjectReference> |
93 | - <ProjectReference Include="..\Docky.Windowing\Docky.Windowing.csproj"> |
94 | - <Project>{888FCD95-7C79-45C4-A744-9C840DF4B9B0}</Project> |
95 | - <Name>Docky.Windowing</Name> |
96 | - </ProjectReference> |
97 | </ItemGroup> |
98 | <ItemGroup> |
99 | <EmbeddedResource Include="Resources\apply.svg"> |
100 | |
101 | === modified file 'Docky.Items/Docky.Items/ApplicationDockItem.cs' |
102 | --- Docky.Items/Docky.Items/ApplicationDockItem.cs 2010-07-28 06:24:54 +0000 |
103 | +++ Docky.Items/Docky.Items/ApplicationDockItem.cs 2010-08-14 22:27:42 +0000 |
104 | @@ -27,7 +27,8 @@ |
105 | |
106 | using Docky.Menus; |
107 | using Docky.Services; |
108 | -using Docky.Windowing; |
109 | +using Docky.Services.Applications; |
110 | +using Docky.Services.Windows; |
111 | |
112 | namespace Docky.Items |
113 | { |
114 | @@ -40,7 +41,7 @@ |
115 | if (!file.Exists) |
116 | return null; |
117 | |
118 | - DesktopItem desktopItem = WindowMatcher.Default.DesktopItemForDesktopFile (file.Path); |
119 | + DesktopItem desktopItem = DockServices.DesktopItems.DesktopItemFromDesktopFile (file.Path); |
120 | |
121 | if (desktopItem == null) |
122 | desktopItem = new DesktopItem (file.Path); |
123 | @@ -70,7 +71,7 @@ |
124 | public ApplicationDockItem (DesktopItem item) |
125 | { |
126 | OwnedItem = item; |
127 | - WindowMatcher.Default.RegisterDesktopItem (OwnedItem); |
128 | + DockServices.DesktopItems.RegisterDesktopItem (OwnedItem); |
129 | can_manage_windows = true; |
130 | |
131 | UpdateInfo (); |
132 | @@ -153,7 +154,7 @@ |
133 | void UpdateWindows () |
134 | { |
135 | if (can_manage_windows) |
136 | - Windows = WindowMatcher.Default.WindowsForDesktopItem (OwnedItem); |
137 | + Windows = DockServices.WindowMatcher.WindowsForDesktopItem (OwnedItem); |
138 | else |
139 | Windows = Enumerable.Empty<Wnck.Window> (); |
140 | } |
141 | |
142 | === modified file 'Docky.Items/Docky.Items/ColoredIconDockItem.cs' |
143 | --- Docky.Items/Docky.Items/ColoredIconDockItem.cs 2010-07-23 06:50:19 +0000 |
144 | +++ Docky.Items/Docky.Items/ColoredIconDockItem.cs 2010-08-14 22:27:42 +0000 |
145 | @@ -28,6 +28,7 @@ |
146 | |
147 | using Docky.Menus; |
148 | using Docky.Services; |
149 | +using Docky.Services.Prefs; |
150 | using Docky.CairoHelper; |
151 | |
152 | namespace Docky.Items |
153 | |
154 | === modified file 'Docky.Items/Docky.Items/FileApplicationProvider.cs' |
155 | --- Docky.Items/Docky.Items/FileApplicationProvider.cs 2010-06-25 13:06:51 +0000 |
156 | +++ Docky.Items/Docky.Items/FileApplicationProvider.cs 2010-08-14 22:27:42 +0000 |
157 | @@ -29,7 +29,9 @@ |
158 | |
159 | using Docky.Menus; |
160 | using Docky.Services; |
161 | -using Docky.Windowing; |
162 | +using Docky.Services.Prefs; |
163 | +using Docky.Services.Applications; |
164 | +using Docky.Services.Windows; |
165 | |
166 | namespace Docky.Items |
167 | { |
168 | @@ -125,7 +127,7 @@ |
169 | // update the transient items when something happens in a desktop file directory |
170 | // It is possible that a .desktop file was created for a window that didn't have one before, |
171 | // this would associate that desktop file with the existing window. |
172 | - WindowMatcher.DesktopFileChanged += HandleWindowMatcherDesktopFileChanged; |
173 | + DockServices.DesktopItems.DesktopFileChanged += HandleWindowMatcherDesktopFileChanged; |
174 | |
175 | Wnck.Screen.Default.WindowOpened += WnckScreenDefaultWindowOpened; |
176 | Wnck.Screen.Default.WindowClosed += WnckScreenDefaultWindowClosed; |
177 | @@ -177,11 +179,11 @@ |
178 | if (args.Window.IsSkipTasklist) |
179 | return; |
180 | |
181 | - longMatchInProgress = !WindowMatcher.Default.WindowIsReadyForMatch (args.Window); |
182 | + longMatchInProgress = !DockServices.WindowMatcher.WindowIsReadyForMatch (args.Window); |
183 | |
184 | // ensure we run last (more or less) so that all icons can update first |
185 | GLib.Timeout.Add (150, delegate { |
186 | - if (WindowMatcher.Default.WindowIsReadyForMatch (args.Window)) { |
187 | + if (DockServices.WindowMatcher.WindowIsReadyForMatch (args.Window)) { |
188 | longMatchInProgress = false; |
189 | UpdateTransientItems (); |
190 | } else { |
191 | @@ -189,11 +191,11 @@ |
192 | // their windows will be monitored for name changes (give up after 5 seconds) |
193 | uint matching_timeout = 5000; |
194 | // wait for OpenOffice up to 1min to startup before giving up |
195 | - if (WindowMatcher.Default.WindowIsOpenOffice (args.Window)) |
196 | + if (DockServices.WindowMatcher.WindowIsOpenOffice (args.Window)) |
197 | matching_timeout = 60000; |
198 | args.Window.NameChanged += HandleUnmatchedWindowNameChanged; |
199 | GLib.Timeout.Add (matching_timeout, delegate { |
200 | - if (!WindowMatcher.Default.WindowIsReadyForMatch (args.Window)) { |
201 | + if (!DockServices.WindowMatcher.WindowIsReadyForMatch (args.Window)) { |
202 | args.Window.NameChanged -= HandleUnmatchedWindowNameChanged; |
203 | longMatchInProgress = false; |
204 | UpdateTransientItems (); |
205 | @@ -208,7 +210,7 @@ |
206 | void HandleUnmatchedWindowNameChanged (object sender, EventArgs e) |
207 | { |
208 | Wnck.Window window = (sender as Wnck.Window); |
209 | - if (WindowMatcher.Default.WindowIsReadyForMatch (window)) { |
210 | + if (DockServices.WindowMatcher.WindowIsReadyForMatch (window)) { |
211 | window.NameChanged -= HandleUnmatchedWindowNameChanged; |
212 | longMatchInProgress = false; |
213 | UpdateTransientItems (); |
214 | @@ -247,14 +249,14 @@ |
215 | .Contains (window)) |
216 | continue; |
217 | |
218 | - DesktopItem desktop_item = WindowMatcher.Default.DesktopItemForWindow (window); |
219 | + DesktopItem desktopItem = DockServices.WindowMatcher.DesktopItemForWindow (window); |
220 | WnckDockItem item; |
221 | |
222 | - if (desktop_item != null) { |
223 | + if (desktopItem != null) { |
224 | // This fixes WindowMatching for OpenOffice which is a bit slow setting up its window title |
225 | // Check if an existing ApplicationDockItem already uses this DesktopItem |
226 | ApplicationDockItem appdi = InternalItems |
227 | - .Where (adi => (adi is ApplicationDockItem && (adi as ApplicationDockItem).OwnedItem == desktop_item)) |
228 | + .Where (adi => (adi is ApplicationDockItem && (adi as ApplicationDockItem).OwnedItem == desktopItem)) |
229 | .Cast<ApplicationDockItem> () |
230 | .FirstOrDefault (); |
231 | |
232 | @@ -264,7 +266,7 @@ |
233 | continue; |
234 | } |
235 | |
236 | - item = new ApplicationDockItem (desktop_item); |
237 | + item = new ApplicationDockItem (desktopItem); |
238 | } else { |
239 | item = new WindowDockItem (window); |
240 | } |
241 | @@ -483,7 +485,7 @@ |
242 | { |
243 | base.Dispose (); |
244 | |
245 | - WindowMatcher.DesktopFileChanged -= HandleWindowMatcherDesktopFileChanged; |
246 | + DockServices.DesktopItems.DesktopFileChanged -= HandleWindowMatcherDesktopFileChanged; |
247 | |
248 | Wnck.Screen.Default.WindowOpened -= WnckScreenDefaultWindowOpened; |
249 | Wnck.Screen.Default.WindowClosed -= WnckScreenDefaultWindowClosed; |
250 | |
251 | === modified file 'Docky.Items/Docky.Items/WindowDockItem.cs' |
252 | --- Docky.Items/Docky.Items/WindowDockItem.cs 2010-05-03 03:15:39 +0000 |
253 | +++ Docky.Items/Docky.Items/WindowDockItem.cs 2010-08-14 22:27:42 +0000 |
254 | @@ -26,7 +26,8 @@ |
255 | using Wnck; |
256 | |
257 | using Docky.Menus; |
258 | -using Docky.Windowing; |
259 | +using Docky.Services; |
260 | +using Docky.Services.Windows; |
261 | |
262 | namespace Docky.Items |
263 | { |
264 | @@ -88,7 +89,7 @@ |
265 | void UpdateWindows (Wnck.Window baseWindow) |
266 | { |
267 | if (baseWindow != null) { |
268 | - Windows = WindowMatcher.Default.SimilarWindows (baseWindow) |
269 | + Windows = DockServices.WindowMatcher.SimilarWindows (baseWindow) |
270 | .Where (w => !FileApplicationProvider.ManagedWindows.Contains (w)); |
271 | } else { |
272 | Windows = Enumerable.Empty<Wnck.Window> (); |
273 | |
274 | === modified file 'Docky.Items/Docky.Items/WnckDockItem.cs' |
275 | --- Docky.Items/Docky.Items/WnckDockItem.cs 2010-07-26 03:16:20 +0000 |
276 | +++ Docky.Items/Docky.Items/WnckDockItem.cs 2010-08-14 22:27:42 +0000 |
277 | @@ -30,7 +30,8 @@ |
278 | using Docky.CairoHelper; |
279 | using Docky.Menus; |
280 | using Docky.Services; |
281 | -using Docky.Windowing; |
282 | +using Docky.Services.Prefs; |
283 | +using Docky.Services.Windows; |
284 | |
285 | namespace Docky.Items |
286 | { |
287 | |
288 | === modified file 'Docky.Items/Docky.Menus/MenuItem.cs' |
289 | --- Docky.Items/Docky.Menus/MenuItem.cs 2010-08-01 11:25:54 +0000 |
290 | +++ Docky.Items/Docky.Menus/MenuItem.cs 2010-08-14 22:27:42 +0000 |
291 | @@ -25,6 +25,7 @@ |
292 | using Gdk; |
293 | |
294 | using Docky.Services; |
295 | +using Docky.Services.Prefs; |
296 | |
297 | namespace Docky.Menus |
298 | { |
299 | |
300 | === modified file 'Docky.Items/Docky.Menus/WindowMenuItem.cs' |
301 | --- Docky.Items/Docky.Menus/WindowMenuItem.cs 2009-12-23 20:19:21 +0000 |
302 | +++ Docky.Items/Docky.Menus/WindowMenuItem.cs 2010-08-14 22:27:42 +0000 |
303 | @@ -19,7 +19,7 @@ |
304 | |
305 | using Gdk; |
306 | |
307 | -using Docky.Windowing; |
308 | +using Docky.Services.Windows; |
309 | |
310 | namespace Docky.Menus |
311 | { |
312 | |
313 | === modified file 'Docky.Items/Makefile.am' |
314 | --- Docky.Items/Makefile.am 2010-08-01 11:25:54 +0000 |
315 | +++ Docky.Items/Makefile.am 2010-08-14 22:27:42 +0000 |
316 | @@ -47,8 +47,7 @@ |
317 | |
318 | PROJECT_REFERENCES= \ |
319 | Docky.CairoHelper \ |
320 | - Docky.Services \ |
321 | - Docky.Windowing |
322 | + Docky.Services |
323 | |
324 | REFERENCES = \ |
325 | System \ |
326 | |
327 | === modified file 'Docky.Services/Docky.Services.csproj' |
328 | --- Docky.Services/Docky.Services.csproj 2010-07-11 06:39:31 +0000 |
329 | +++ Docky.Services/Docky.Services.csproj 2010-08-14 22:27:42 +0000 |
330 | @@ -84,14 +84,15 @@ |
331 | <Package>gio-sharp-2.0</Package> |
332 | </Reference> |
333 | <Reference Include="ICSharpCode.SharpZipLib" /> |
334 | + <Reference Include="wnck-sharp, Version=2.20.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f"> |
335 | + <Package>wnck-sharp-1.0</Package> |
336 | + </Reference> |
337 | </ItemGroup> |
338 | <ItemGroup> |
339 | - <Compile Include="Docky.Services\IPreferences.cs" /> |
340 | <Compile Include="Docky.Services\PreferencesService.cs" /> |
341 | <Compile Include="Docky.Services\DockServices.cs" /> |
342 | <Compile Include="Docky.Services\SystemService.cs" /> |
343 | <Compile Include="Docky.Services\DrawingService.cs" /> |
344 | - <Compile Include="Docky.Services\Preferences.cs" /> |
345 | <Compile Include="Docky.Services\NotificationService.cs" /> |
346 | <Compile Include="Docky.Services\ConnectionStatusChangeEventArgs.cs" /> |
347 | <Compile Include="Docky.Services\Logging\LogBase.cs" /> |
348 | @@ -108,13 +109,24 @@ |
349 | <Compile Include="Docky.Services\Extensions\GLibMountExtension.cs" /> |
350 | <Compile Include="Gtk\MountOperation.cs" /> |
351 | <Compile Include="Docky.Services\HelperService.cs" /> |
352 | - <Compile Include="Docky.Services\Helper.cs" /> |
353 | - <Compile Include="Docky.Services\HelperStatusChangedEventArgs.cs" /> |
354 | - <Compile Include="Docky.Services\HelperMetadata.cs" /> |
355 | <Compile Include="Docky.Services\Extensions\GtkIconThemeExtension.cs" /> |
356 | <Compile Include="Docky.Services\PathsService.cs" /> |
357 | <Compile Include="Docky.Services\ThemeService.cs" /> |
358 | - <Compile Include="Docky.Services\PreferencesChangedEventArgs.cs" /> |
359 | + <Compile Include="Docky.Services\DesktopItemService.cs" /> |
360 | + <Compile Include="Docky.Services\Helpers\Helper.cs" /> |
361 | + <Compile Include="Docky.Services\Helpers\HelperMetadata.cs" /> |
362 | + <Compile Include="Docky.Services\Helpers\HelperStatusChangedEventArgs.cs" /> |
363 | + <Compile Include="Docky.Services\Preferences\IPreferences.cs" /> |
364 | + <Compile Include="Docky.Services\Preferences\Preferences.cs" /> |
365 | + <Compile Include="Docky.Services\Preferences\PreferencesChangedEventArgs.cs" /> |
366 | + <Compile Include="Docky.Services\Applications\DesktopFileChangedEventArgs.cs" /> |
367 | + <Compile Include="Docky.Services\Applications\DesktopItem.cs" /> |
368 | + <Compile Include="Docky.Services\Windows\Position.cs" /> |
369 | + <Compile Include="Docky.Services\Windows\WindowControl.cs" /> |
370 | + <Compile Include="Docky.Services\WindowMatcherService.cs" /> |
371 | + <Compile Include="Docky.Services\Extensions\WnckWindowExtension.cs" /> |
372 | + <Compile Include="Docky.Services\Xlib\X11Atoms.cs" /> |
373 | + <Compile Include="Docky.Services\Xlib\Xlib.cs" /> |
374 | </ItemGroup> |
375 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> |
376 | <ItemGroup> |
377 | @@ -122,6 +134,14 @@ |
378 | <Folder Include="Docky.Services\Logging\" /> |
379 | <Folder Include="Docky.Services\Extensions\" /> |
380 | <Folder Include="GLibSharp\" /> |
381 | + <Folder Include="Docky.Services\Helpers\" /> |
382 | + <Folder Include="Docky.Services\Helpers\" /> |
383 | + <Folder Include="Docky.Services\Helpers\" /> |
384 | + <Folder Include="Docky.Services\Helpers\" /> |
385 | + <Folder Include="Docky.Services\Preferences\" /> |
386 | + <Folder Include="Docky.Services\Applications\" /> |
387 | + <Folder Include="Docky.Services\Windows\" /> |
388 | + <Folder Include="Docky.Services\Xlib\" /> |
389 | </ItemGroup> |
390 | <ItemGroup> |
391 | <EmbeddedResource Include="gtk-gui\gui.stetic"> |
392 | |
393 | === modified file 'Docky.Services/Docky.Services.dll.config' |
394 | --- Docky.Services/Docky.Services.dll.config 2009-11-14 04:04:00 +0000 |
395 | +++ Docky.Services/Docky.Services.dll.config 2010-08-14 22:27:42 +0000 |
396 | @@ -2,4 +2,5 @@ |
397 | <dllmap dll="libgobject-2.0" target="libgobject-2.0.so.0"/> |
398 | <dllmap dll="libgtk-x11-2.0" target="libgtk-x11-2.0.so.0"/> |
399 | <dllmap dll="gio-2.0" target="libgio-2.0.so.0"/> |
400 | -</configuration> |
401 | \ No newline at end of file |
402 | + <dllmap dll="X11" target="libX11.so.6"/> |
403 | +</configuration> |
404 | |
405 | === added directory 'Docky.Services/Docky.Services/Applications' |
406 | === renamed file 'Docky.Windowing/Windowing/DesktopFileChangedEventArgs.cs' => 'Docky.Services/Docky.Services/Applications/DesktopFileChangedEventArgs.cs' |
407 | --- Docky.Windowing/Windowing/DesktopFileChangedEventArgs.cs 2010-06-22 18:58:21 +0000 |
408 | +++ Docky.Services/Docky.Services/Applications/DesktopFileChangedEventArgs.cs 2010-08-14 22:27:42 +0000 |
409 | @@ -18,7 +18,7 @@ |
410 | using System; |
411 | using GLib; |
412 | |
413 | -namespace Docky.Windowing |
414 | +namespace Docky.Services.Applications |
415 | { |
416 | public class DesktopFileChangedEventArgs : EventArgs |
417 | { |
418 | |
419 | === renamed file 'Docky.Windowing/Windowing/DesktopItem.cs' => 'Docky.Services/Docky.Services/Applications/DesktopItem.cs' |
420 | --- Docky.Windowing/Windowing/DesktopItem.cs 2010-06-22 18:58:21 +0000 |
421 | +++ Docky.Services/Docky.Services/Applications/DesktopItem.cs 2010-08-14 22:27:42 +0000 |
422 | @@ -27,14 +27,13 @@ |
423 | |
424 | using Docky.Services; |
425 | |
426 | -namespace Docky.Windowing |
427 | +namespace Docky.Services.Applications |
428 | { |
429 | public class DesktopItem : IDisposable |
430 | { |
431 | public static Regex keyValueRegex = new Regex ( |
432 | @"(^(\s)*(?<Key>([^\=^\n]+))[\s^\n]*\=(\s)*(?<Value>([^\n]+(\n){0,1})))", |
433 | - RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled | |
434 | - RegexOptions.CultureInvariant |
435 | + RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled | RegexOptions.CultureInvariant |
436 | ); |
437 | public static Regex sectionRegex = new Regex ( |
438 | @"(^(\[)*(?<Section>([^\]^\n]+))\]$)" , |
439 | @@ -45,15 +44,20 @@ |
440 | RegexOptions.Compiled | RegexOptions.CultureInvariant |
441 | ); |
442 | |
443 | - static IEnumerable<string> locales = PostfixStringsForLocale (WindowMatcher.Locale); |
444 | - |
445 | -#region Delayed change propagation |
446 | + IEnumerable<string> Locales { |
447 | + get { |
448 | + return PostfixStringsForLocale (DockServices.System.Locale); |
449 | + } |
450 | + } |
451 | + |
452 | + #region Delayed change propagation |
453 | + |
454 | public event EventHandler HasChanged; |
455 | private uint trigger_changed_timer = 0; |
456 | private object onchanged_lock = new object (); |
457 | protected void OnChanged () |
458 | { |
459 | - if (HasChanged != null) |
460 | + if (HasChanged != null) { |
461 | lock (onchanged_lock) { |
462 | // collect changes within 2500ms then trigger events |
463 | if (trigger_changed_timer == 0) { |
464 | @@ -65,16 +69,18 @@ |
465 | }); |
466 | } |
467 | } |
468 | + } |
469 | } |
470 | -#endregion |
471 | + |
472 | + #endregion |
473 | |
474 | public Dictionary<string, string> Values { get; set; } |
475 | |
476 | - private GLib.DesktopAppInfo appinfo; |
477 | + GLib.DesktopAppInfo appinfo; |
478 | |
479 | - private GLib.FileMonitor monitor; |
480 | - private GLib.File file; |
481 | - public GLib.File File { |
482 | + GLib.FileMonitor monitor; |
483 | + GLib.File file; |
484 | + public GLib.File File { |
485 | get { |
486 | return file; |
487 | } |
488 | @@ -90,28 +96,16 @@ |
489 | monitor.Changed += HandleFileChanged; |
490 | } |
491 | } |
492 | - |
493 | - void HandleFileChanged (object o, ChangedArgs args) |
494 | - { |
495 | - Log<DesktopItem>.Debug ("file {0} changed", File.Path); |
496 | - |
497 | - Values = GetValuesFromFile (); |
498 | - |
499 | - OnChanged (); |
500 | - } |
501 | |
502 | - public string Path |
503 | - { |
504 | + public string Path { |
505 | get { return File.Path; } |
506 | } |
507 | |
508 | - public Uri Uri |
509 | - { |
510 | + public Uri Uri { |
511 | get { return File.Uri; } |
512 | } |
513 | |
514 | - public string DesktopID |
515 | - { |
516 | + public string DesktopID { |
517 | get { return System.IO.Path.GetFileNameWithoutExtension (Path); } |
518 | } |
519 | |
520 | @@ -196,6 +190,12 @@ |
521 | |
522 | return Convert.ToDouble (result); |
523 | } |
524 | + |
525 | + public void Launch (IEnumerable<string> uris) |
526 | + { |
527 | + if (File.Exists) |
528 | + DockServices.System.Open (appinfo, uris.Select (uri => GLib.FileFactory.NewForUri (uri))); |
529 | + } |
530 | |
531 | Dictionary<string, string> GetValuesFromFile () |
532 | { |
533 | @@ -223,7 +223,7 @@ |
534 | string section = match.Groups["Section"].Value; |
535 | desktop_entry_found = string.Equals (section, "Desktop Entry"); |
536 | } |
537 | - |
538 | + |
539 | } else { |
540 | |
541 | //Only add unlocalized values and values matching the current locale |
542 | @@ -234,7 +234,7 @@ |
543 | if (!string.IsNullOrEmpty (key) && !string.IsNullOrEmpty (val) && !result.ContainsKey (key)) { |
544 | match = localizedKeyRegex.Match (key); |
545 | if (match.Success) { |
546 | - if (locales.Contains (match.Groups["Locale"].Value)) { |
547 | + if (Locales.Contains (match.Groups["Locale"].Value)) { |
548 | //Remove existing value in favour of this localized one |
549 | result.Remove (match.Groups["PureKey"].Value); |
550 | result.Add (match.Groups["PureKey"].Value, val); |
551 | @@ -244,8 +244,8 @@ |
552 | result.Add (key, val); |
553 | } |
554 | } |
555 | - |
556 | - } else if (sectionRegex.Match(line).Success) |
557 | + |
558 | + } else if (sectionRegex.Match (line).Success) |
559 | break; |
560 | } |
561 | } |
562 | @@ -253,14 +253,14 @@ |
563 | } |
564 | |
565 | } catch (Exception e) { |
566 | - Log<DesktopItem>.Error (e.Message); |
567 | + Log<DesktopItem>.Error ("Failed getting values from desktop file '{0}' : {1}", Path, e.Message); |
568 | Log<DesktopItem>.Error (e.StackTrace); |
569 | } |
570 | |
571 | return result; |
572 | } |
573 | - |
574 | - static IEnumerable<string> PostfixStringsForLocale (string locale) |
575 | + |
576 | + IEnumerable<string> PostfixStringsForLocale (string locale) |
577 | { |
578 | if (string.IsNullOrEmpty (locale) || locale.Length < 2) |
579 | yield break; |
580 | @@ -282,14 +282,18 @@ |
581 | |
582 | yield return locale.Substring (0, 2); |
583 | } |
584 | - |
585 | - public void Launch (IEnumerable<string> uris) |
586 | + |
587 | + void HandleFileChanged (object o, ChangedArgs args) |
588 | { |
589 | - if (File.Exists) |
590 | - DockServices.System.Open (appinfo, uris.Select (uri => GLib.FileFactory.NewForUri (uri))); |
591 | + Log<DesktopItem>.Debug ("file {0} changed", File.Path); |
592 | + |
593 | + Values = GetValuesFromFile (); |
594 | + |
595 | + OnChanged (); |
596 | } |
597 | |
598 | #region IDisposable implementation |
599 | + |
600 | public void Dispose () |
601 | { |
602 | Values.Clear (); |
603 | @@ -302,6 +306,7 @@ |
604 | monitor.Dispose (); |
605 | } |
606 | } |
607 | + |
608 | #endregion |
609 | |
610 | } |
611 | |
612 | === added file 'Docky.Services/Docky.Services/DesktopItemService.cs' |
613 | --- Docky.Services/Docky.Services/DesktopItemService.cs 1970-01-01 00:00:00 +0000 |
614 | +++ Docky.Services/Docky.Services/DesktopItemService.cs 2010-08-14 22:27:42 +0000 |
615 | @@ -0,0 +1,593 @@ |
616 | +// |
617 | +// Copyright (C) 2010 Chris Szikszoy |
618 | +// |
619 | +// This program is free software: you can redistribute it and/or modify |
620 | +// it under the terms of the GNU General Public License as published by |
621 | +// the Free Software Foundation, either version 3 of the License, or |
622 | +// (at your option) any later version. |
623 | +// |
624 | +// This program is distributed in the hope that it will be useful, |
625 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
626 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
627 | +// GNU General Public License for more details. |
628 | +// |
629 | +// You should have received a copy of the GNU General Public License |
630 | +// along with this program. If not, see <http://www.gnu.org/licenses/>. |
631 | +// |
632 | + |
633 | +using System; |
634 | +using System.IO; |
635 | +using System.Linq; |
636 | +using System.Collections; |
637 | +using System.Collections.Generic; |
638 | +using System.Collections.ObjectModel; |
639 | +using System.Text.RegularExpressions; |
640 | + |
641 | +using GLib; |
642 | + |
643 | +using Docky.Services.Applications; |
644 | + |
645 | +namespace Docky.Services |
646 | +{ |
647 | + public class DesktopItemService |
648 | + { |
649 | + public event EventHandler<DesktopFileChangedEventArgs> DesktopFileChanged; |
650 | + |
651 | + object update_lock; |
652 | + |
653 | + // shorthand for all registered AND unregistered desktop items |
654 | + public IEnumerable<DesktopItem> DesktopItems { |
655 | + get { return RegisteredItems.Union (UnregisteredItems).AsEnumerable (); } |
656 | + } |
657 | + |
658 | + public Dictionary<string, string> Remaps { get; private set; } |
659 | + List<DesktopItem> RegisteredItems { get; set; } |
660 | + List<DesktopItem> UnregisteredItems { get; set; } |
661 | + Dictionary<string, List<DesktopItem>> ItemsByExec { get; set; } |
662 | + Dictionary<string, DesktopItem> ItemByClass { get; set; } |
663 | + |
664 | + internal DesktopItemService () |
665 | + { |
666 | + update_lock = new object (); |
667 | + |
668 | + Remaps = new Dictionary<string, string> (); |
669 | + LoadRemaps (DockServices.Paths.SystemDataFolder.GetChild ("remaps.ini")); |
670 | + LoadRemaps (DockServices.Paths.UserDataFolder.GetChild ("remaps.ini")); |
671 | + |
672 | + // Load DesktopFilesCache from docky.desktop.[LANG].cache |
673 | + RegisteredItems = LoadDesktopItemsCache (DockyDesktopFileCacheFile); |
674 | + UnregisteredItems = new List<DesktopItem> (); |
675 | + |
676 | + if (RegisteredItems == null || RegisteredItems.Count () == 0) { |
677 | + Log<DesktopItemService>.Info ("Loading *.desktop files and regenerating cache. This may take a while..."); |
678 | + UpdateDesktopItemsList (); |
679 | + ProcessAndMergeAllSystemCacheFiles (); |
680 | + SaveDesktopItemsCache (); |
681 | + } |
682 | + DesktopItemsChanged (); |
683 | + |
684 | + // Update desktopItems and save cache after 2 minutes just to be sure we are up to date |
685 | + GLib.Timeout.Add (2 * 60 * 1000, delegate { |
686 | + lock (update_lock) { |
687 | + UpdateDesktopItemsList (); |
688 | + ProcessAndMergeAllSystemCacheFiles (); |
689 | + DesktopItemsChanged (); |
690 | + SaveDesktopItemsCache (); |
691 | + } |
692 | + return false; |
693 | + }); |
694 | + |
695 | + // Set up monitors for cache files and desktop directories |
696 | + foreach (GLib.File dir in DesktopFileDirectories) |
697 | + MonitorDesktopFileDirs (dir); |
698 | + MonitorDesktopFileSystemCacheFiles (); |
699 | + } |
700 | + |
701 | + #region public API |
702 | + |
703 | + /// <summary> |
704 | + /// Find all DesktopItems by specifying the exec. |
705 | + /// </summary> |
706 | + /// <returns> |
707 | + /// A List of DesktopItems that use the supplied exec string. |
708 | + /// </returns> |
709 | + /// <param name='exec'> |
710 | + /// An exec string. |
711 | + /// </param> |
712 | + public IEnumerable<DesktopItem> DesktopItemsFromExec (string exec) |
713 | + { |
714 | + if (ItemsByExec.ContainsKey (exec)) |
715 | + return ItemsByExec [exec].AsEnumerable (); |
716 | + return Enumerable.Empty<DesktopItem> (); |
717 | + } |
718 | + |
719 | + /// <summary> |
720 | + /// Find a DesktopItem by specifying the class. |
721 | + /// </summary> |
722 | + /// <returns> |
723 | + /// The DesktopItem, if any exists. |
724 | + /// </returns> |
725 | + /// <param name='class'> |
726 | + /// The Window class from the .desktop file. |
727 | + /// </param> |
728 | + public DesktopItem DesktopItemFromClass (string @class) |
729 | + { |
730 | + if (ItemByClass.ContainsKey (@class)) |
731 | + return ItemByClass [@class]; |
732 | + return null; |
733 | + } |
734 | + |
735 | + public IEnumerable<DesktopItem> DesktopItemsFromID (string id) |
736 | + { |
737 | + if (DesktopItems.Any (item => item.DesktopID.Equals (id, StringComparison.InvariantCultureIgnoreCase))) |
738 | + return DesktopItems.Where (item => item.DesktopID.Equals (id, StringComparison.CurrentCultureIgnoreCase)); |
739 | + return Enumerable.Empty<DesktopItem> (); |
740 | + } |
741 | + |
742 | + /// <summary> |
743 | + /// Find a DesktopItem by specifying a path to a .desktop file. |
744 | + /// </summary> |
745 | + /// <returns> |
746 | + /// The DesktopItem, if any exists. |
747 | + /// </returns> |
748 | + /// <param name='file'> |
749 | + /// A path to a .desktop file. |
750 | + /// </param> |
751 | + public DesktopItem DesktopItemFromDesktopFile (string file) |
752 | + { |
753 | + if (DesktopItems.Any (item => item.Path.Equals (file, StringComparison.InvariantCultureIgnoreCase))) |
754 | + return DesktopItems.First (item => item.Path.Equals (file, StringComparison.CurrentCultureIgnoreCase)); |
755 | + return null; |
756 | + } |
757 | + |
758 | + public void RegisterDesktopItem (DesktopItem item) |
759 | + { |
760 | + // check if this item is in either the registered or unregistered items |
761 | + if (DesktopItems.Contains (item)) |
762 | + return; |
763 | + |
764 | + // if this item isn't in our desktop item list, we need to add it as an unregistered item |
765 | + UnregisteredItems.Add (item); |
766 | + |
767 | + // and make sure we process it |
768 | + // FIXME: do we really need to reload _every_ desktop file here? Probably only need to process the new one.. |
769 | + DesktopItemsChanged (); |
770 | + } |
771 | + |
772 | + #endregion |
773 | + |
774 | + void DesktopItemsChanged () |
775 | + { |
776 | + BuildExecStrings (); |
777 | + BuildClassStrings (); |
778 | + } |
779 | + |
780 | + IEnumerable<GLib.File> DesktopFileSystemCacheFiles |
781 | + { |
782 | + get { |
783 | + return DesktopFileDirectories |
784 | + .Select (d => d.GetChild (string.Format ("desktop.{0}.cache", DockServices.System.Locale))) |
785 | + .Where (f => f.Exists); |
786 | + } |
787 | + } |
788 | + |
789 | + string DockyDesktopFileCacheFile |
790 | + { |
791 | + get { |
792 | + if (!string.IsNullOrEmpty (DockServices.System.Locale)) |
793 | + return DockServices.Paths.UserCacheFolder.GetChild (string.Format ("docky.desktop.{0}.cache", DockServices.System.Locale)).Path; |
794 | + return DockServices.Paths.UserCacheFolder.GetChild ("docky.desktop.cache").Path; |
795 | + } |
796 | + } |
797 | + |
798 | + IEnumerable<GLib.File> DesktopFileDirectories |
799 | + { |
800 | + get { |
801 | + return DockServices.Paths.XdgDataDirFolders.Select (d => d.GetChild ("applications")) |
802 | + .Union (new [] { |
803 | + DockServices.Paths.XdgDataHomeFolder.GetChild ("applications"), |
804 | + DockServices.Paths.HomeFolder.GetChild (".cxoffice"), |
805 | + }) |
806 | + .Where (d => d.Exists); |
807 | + } |
808 | + } |
809 | + |
810 | + void UpdateDesktopItemsList () |
811 | + { |
812 | + if (RegisteredItems == null) |
813 | + RegisteredItems = new List<DesktopItem> (); |
814 | + |
815 | + List<DesktopItem> newItems = new List<DesktopItem> (); |
816 | + |
817 | + // Get desktop items for new "valid" desktop files |
818 | + newItems = DesktopFileDirectories |
819 | + .SelectMany (dir => dir.SubDirs ()) |
820 | + .Union (DesktopFileDirectories) |
821 | + .SelectMany (file => file.GetFiles (".desktop")) |
822 | + .Where (file => !DesktopItems.Any (existing => existing.File.Path == file.Path)) |
823 | + .Select (file => new DesktopItem (file)) |
824 | + .Where (item => item.Values.Any ()) |
825 | + .ToList (); |
826 | + |
827 | + RegisteredItems.AddRange (newItems); |
828 | + |
829 | + if (newItems.Count () > 0) { |
830 | + Log<DesktopItemService>.Debug ("{0} new application(s) found.", newItems.Count ()); |
831 | + foreach (DesktopItem item in newItems) |
832 | + Log<DesktopItemService>.Debug ("Adding '{0}'.", item.Path); |
833 | + } |
834 | + |
835 | + // Check file existence and remove unlinked items |
836 | + int removed = RegisteredItems.RemoveAll (item => !item.File.Exists); |
837 | + if (removed > 0) |
838 | + Log<DesktopItemService>.Debug ("{0} application(s) removed.", removed); |
839 | + } |
840 | + |
841 | + void ProcessAndMergeAllSystemCacheFiles () |
842 | + { |
843 | + foreach (GLib.File cache in DesktopFileSystemCacheFiles) |
844 | + ProcessAndMergeSystemCacheFile (cache); |
845 | + } |
846 | + |
847 | + void ProcessAndMergeSystemCacheFile (GLib.File cache) |
848 | + { |
849 | + if (!cache.Exists) |
850 | + return; |
851 | + |
852 | + Log<DesktopItemService>.Debug ("Processing {0}", cache.Path); |
853 | + |
854 | + try { |
855 | + using (StreamReader reader = new StreamReader (cache.Path)) { |
856 | + DesktopItem desktopItem = null; |
857 | + string line; |
858 | + |
859 | + while ((line = reader.ReadLine ()) != null) { |
860 | + if (line.Trim ().Length <= 0) |
861 | + continue; |
862 | + |
863 | + if (line.ElementAt (0) == '[') { |
864 | + Match match = DesktopItem.sectionRegex.Match (line); |
865 | + if (match.Success) { |
866 | + string section = match.Groups ["Section"].Value; |
867 | + if (section != null) { |
868 | + GLib.File file = cache.Parent.GetChild (string.Format ("{0}.desktop", section)); |
869 | + desktopItem = RegisteredItems.First (item => item.File.Path == file.Path); |
870 | + if (desktopItem == null && file.Exists) { |
871 | + desktopItem = new DesktopItem (file); |
872 | + RegisteredItems.Add (desktopItem); |
873 | + Log<DesktopItemService>.Debug ("New application found: {0}", desktopItem.Path); |
874 | + } |
875 | + continue; |
876 | + } |
877 | + } |
878 | + } else if (desktopItem != null) { |
879 | + Match match = DesktopItem.keyValueRegex.Match (line); |
880 | + if (match.Success) { |
881 | + string key = match.Groups ["Key"].Value; |
882 | + string val = match.Groups ["Value"].Value; |
883 | + if (!string.IsNullOrEmpty (key) && !string.IsNullOrEmpty (val)) |
884 | + desktopItem.SetString (key, val); |
885 | + continue; |
886 | + } |
887 | + } |
888 | + } |
889 | + reader.Close (); |
890 | + } |
891 | + } catch (Exception e) { |
892 | + Log<DesktopItemService>.Error ("Error processing desktop item cache: {0}", e.Message); |
893 | + Log<DesktopItemService>.Error (e.StackTrace); |
894 | + } |
895 | + } |
896 | + |
897 | + void LoadRemaps (GLib.File file) |
898 | + { |
899 | + if (file.Exists) { |
900 | + Log<DesktopItemService>.Debug ("Loading remap file '{0}'.", file.Path); |
901 | + } else { |
902 | + Log<DesktopItemService>.Warn ("Could not find remap file '{0}'!", file.Path); |
903 | + return; |
904 | + } |
905 | + |
906 | + Regex keyValueRegex = new Regex ( |
907 | + @"(^(\s)*(?<Key>([^\=^\n]+))[\s^\n]*\=(\s)*(?<Value>([^\n]+(\n){0,1})))", |
908 | + RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled | RegexOptions.CultureInvariant |
909 | + ); |
910 | + |
911 | + try { |
912 | + using (StreamReader reader = new StreamReader (file.Path)) { |
913 | + string line; |
914 | + |
915 | + while ((line = reader.ReadLine ()) != null) { |
916 | + line = line.Trim (); |
917 | + if (line.Length <= 0 || line.Substring (0, 1) == "#") |
918 | + continue; |
919 | + |
920 | + Match match = keyValueRegex.Match (line); |
921 | + if (match.Success) { |
922 | + string key = match.Groups ["Key"].Value; |
923 | + string val = match.Groups ["Value"].Value; |
924 | + if (!string.IsNullOrEmpty (key)) { |
925 | + Remaps [key] = val; |
926 | + Log<DesktopItemService>.Debug ("Remapping '{0}' to '{1}'.", key, val); |
927 | + } |
928 | + } |
929 | + } |
930 | + reader.Close (); |
931 | + } |
932 | + } catch (Exception e) { |
933 | + Log<DesktopItemService>.Error ("Error loading remap file: {0}", e.Message); |
934 | + Log<DesktopItemService>.Error (e.StackTrace); |
935 | + } |
936 | + } |
937 | + |
938 | + List<DesktopItem> LoadDesktopItemsCache (string filename) |
939 | + { |
940 | + if (!GLib.FileFactory.NewForPath (filename).Exists) |
941 | + return null; |
942 | + |
943 | + Log<DesktopItemService>.Debug ("Loading desktop item cache '{0}'.", DockyDesktopFileCacheFile); |
944 | + |
945 | + List<DesktopItem> items = new List<DesktopItem> (); |
946 | + |
947 | + try { |
948 | + using (StreamReader reader = new StreamReader (filename)) { |
949 | + DesktopItem desktopItem = null; |
950 | + string line; |
951 | + |
952 | + while ((line = reader.ReadLine ()) != null) { |
953 | + if (line.Trim ().Length <= 0) |
954 | + continue; |
955 | + |
956 | + if (line.ElementAt (0) == '[') { |
957 | + Match match = DesktopItem.sectionRegex.Match (line); |
958 | + if (match.Success) { |
959 | + string section = match.Groups ["Section"].Value; |
960 | + if (section != null) { |
961 | + GLib.File file = GLib.FileFactory.NewForPath (section); |
962 | + desktopItem = new DesktopItem (file, false); |
963 | + items.Add (desktopItem); |
964 | + } |
965 | + continue; |
966 | + } |
967 | + } else if (desktopItem != null) { |
968 | + Match match = DesktopItem.keyValueRegex.Match (line); |
969 | + if (match.Success) { |
970 | + string key = match.Groups ["Key"].Value; |
971 | + string val = match.Groups ["Value"].Value; |
972 | + if (!string.IsNullOrEmpty (key) && !string.IsNullOrEmpty (val)) |
973 | + desktopItem.SetString (key, val); |
974 | + continue; |
975 | + } |
976 | + } |
977 | + } |
978 | + reader.Close (); |
979 | + } |
980 | + } catch (Exception e) { |
981 | + Log<DesktopItemService>.Error ("Error loading desktop item cache: {0}", e.Message); |
982 | + Log<DesktopItemService>.Error (e.StackTrace); |
983 | + return null; |
984 | + } |
985 | + |
986 | + return items; |
987 | + } |
988 | + |
989 | + void SaveDesktopItemsCache () |
990 | + { |
991 | + Log<DesktopItemService>.Debug ("Saving desktop item cache '{0}'.", DockyDesktopFileCacheFile); |
992 | + |
993 | + try { |
994 | + using (StreamWriter writer = new StreamWriter (DockyDesktopFileCacheFile, false)) { |
995 | + foreach (DesktopItem item in RegisteredItems) { |
996 | + writer.WriteLine ("[{0}]", item.Path); |
997 | + IDictionaryEnumerator enumerator = item.Values.GetEnumerator (); |
998 | + enumerator.Reset (); |
999 | + while (enumerator.MoveNext ()) |
1000 | + writer.WriteLine ("{0}={1}", enumerator.Key, enumerator.Value); |
1001 | + writer.WriteLine (""); |
1002 | + } |
1003 | + writer.Close (); |
1004 | + } |
1005 | + } catch (Exception e) { |
1006 | + Log<DesktopItemService>.Error ("Error saving desktop item cache: {0}", e.Message); |
1007 | + Log<DesktopItemService>.Error (e.StackTrace); |
1008 | + } |
1009 | + } |
1010 | + |
1011 | + void MonitorDesktopFileSystemCacheFiles () |
1012 | + { |
1013 | + foreach (GLib.File file in DesktopFileSystemCacheFiles) { |
1014 | + GLib.FileMonitor mon = file.Monitor (GLib.FileMonitorFlags.None, null); |
1015 | + mon.RateLimit = 2500; |
1016 | + mon.Changed += delegate(object o, GLib.ChangedArgs args) { |
1017 | + if (args.EventType == GLib.FileMonitorEvent.ChangesDoneHint) { |
1018 | + DockServices.System.RunOnThread (() => |
1019 | + { |
1020 | + lock (update_lock) { |
1021 | + ProcessAndMergeSystemCacheFile (file); |
1022 | + DesktopItemsChanged (); |
1023 | + } |
1024 | + }); |
1025 | + } |
1026 | + }; |
1027 | + } |
1028 | + } |
1029 | + |
1030 | + void MonitorDesktopFileDirs (GLib.File dir) |
1031 | + { |
1032 | + // build a list of all the subdirectories |
1033 | + List<GLib.File> dirs = new List<GLib.File> () {dir}; |
1034 | + try { |
1035 | + dirs = dirs.Union (dir.SubDirs ()).ToList (); |
1036 | + } catch {} |
1037 | + |
1038 | + foreach (GLib.File d in dirs) { |
1039 | + GLib.FileMonitor mon = d.Monitor (GLib.FileMonitorFlags.None, null); |
1040 | + mon.RateLimit = 2500; |
1041 | + mon.Changed += delegate(object o, GLib.ChangedArgs args) { |
1042 | + // bug in GIO#, calling args.File or args.OtherFile crashes hard |
1043 | + GLib.File file = GLib.FileAdapter.GetObject ((GLib.Object) args.Args [0]); |
1044 | + GLib.File otherFile = GLib.FileAdapter.GetObject ((GLib.Object) args.Args [1]); |
1045 | + |
1046 | + // according to GLib documentation, the change signal runs on the same |
1047 | + // thread that the monitor was created on. Without running this part on a thread |
1048 | + // docky freezes up for about 500-800 ms while the .desktop files are parsed. |
1049 | + DockServices.System.RunOnThread (() => { |
1050 | + // if a new directory was created, make sure we watch that dir as well |
1051 | + if (file.QueryFileType (GLib.FileQueryInfoFlags.NofollowSymlinks, null) == GLib.FileType.Directory) |
1052 | + MonitorDesktopFileDirs (file); |
1053 | + |
1054 | + // we only care about .desktop files |
1055 | + if (!file.Path.EndsWith (".desktop")) |
1056 | + return; |
1057 | + |
1058 | + lock (update_lock) { |
1059 | + UpdateDesktopItemsList (); |
1060 | + DesktopItemsChanged (); |
1061 | + SaveDesktopItemsCache(); |
1062 | + } |
1063 | + |
1064 | + // Make sure to trigger event on main thread |
1065 | + DockServices.System.RunOnMainThread (() => { |
1066 | + if (DesktopFileChanged != null) |
1067 | + DesktopFileChanged (this, new DesktopFileChangedEventArgs (args.EventType, file, otherFile)); |
1068 | + }); |
1069 | + }); |
1070 | + }; |
1071 | + } |
1072 | + } |
1073 | + |
1074 | + void BuildClassStrings () |
1075 | + { |
1076 | + ItemByClass = new Dictionary<string, DesktopItem> (); |
1077 | + |
1078 | + foreach (DesktopItem item in DesktopItems) { |
1079 | + if (item == null || !item.HasAttribute ("StartupWMClass")) |
1080 | + continue; |
1081 | + |
1082 | + if (item.HasAttribute ("NoDisplay") && item.GetBool ("NoDisplay")) |
1083 | + continue; |
1084 | + |
1085 | + if (item.HasAttribute ("X-Docky-NoMatch") && item.GetBool ("X-Docky-NoMatch")) |
1086 | + continue; |
1087 | + |
1088 | + string cls = item.GetString ("StartupWMClass").Trim (); |
1089 | + // we only want exactly 1 launcher, and so if we already have one we use that |
1090 | + // otherwise it will prefer global over local launchers |
1091 | + if (!ItemByClass.ContainsKey (cls)) |
1092 | + ItemByClass [cls] = item; |
1093 | + } |
1094 | + } |
1095 | + |
1096 | + void BuildExecStrings () |
1097 | + { |
1098 | + ItemsByExec = new Dictionary<string, List<DesktopItem>> (); |
1099 | + |
1100 | + foreach (DesktopItem item in DesktopItems) { |
1101 | + if (item == null || !item.HasAttribute ("Exec")) |
1102 | + continue; |
1103 | + |
1104 | + if (item.HasAttribute ("NoDisplay") && item.GetBool ("NoDisplay")) |
1105 | + continue; |
1106 | + |
1107 | + if (item.HasAttribute ("X-Docky-NoMatch") && item.GetBool ("X-Docky-NoMatch")) |
1108 | + continue; |
1109 | + |
1110 | + string exec = item.GetString ("Exec").Trim (); |
1111 | + string vexec = null; |
1112 | + |
1113 | + // for openoffice |
1114 | + if (exec.Contains (' ') && |
1115 | + (exec.StartsWith ("ooffice") || exec.StartsWith ("openoffice") || exec.StartsWith ("soffice"))) { |
1116 | + vexec = "ooffice" + exec.Split (' ')[1]; |
1117 | + |
1118 | + // for wine apps |
1119 | + } else if ((exec.Contains ("env WINEPREFIX=") && exec.Contains (" wine ")) || |
1120 | + exec.Contains ("wine ")) { |
1121 | + int startIndex = exec.IndexOf ("wine ") + 5; |
1122 | + // length of 'wine ' |
1123 | + // CommandLineForPid already splits based on \\ and takes the last entry, so do the same here |
1124 | + vexec = exec.Substring (startIndex).Split (new[] { @"\\" }, StringSplitOptions.RemoveEmptyEntries).Last (); |
1125 | + // remove the trailing " and anything after it |
1126 | + if (vexec.Contains ("\"")) |
1127 | + vexec = vexec.Substring (0, vexec.IndexOf ("\"")); |
1128 | + |
1129 | + // for crossover apps |
1130 | + } else if (exec.Contains (".cxoffice") || (item.HasAttribute ("X-Created-By") && item.GetString ("X-Created-By").Contains ("cxoffice"))) { |
1131 | + // The exec is actually another file that uses exec to launch the actual app. |
1132 | + exec = exec.Replace ("\"", ""); |
1133 | + |
1134 | + GLib.File launcher = GLib.FileFactory.NewForPath (exec); |
1135 | + if (!launcher.Exists) { |
1136 | + Log<DesktopItemService>.Warn ("Crossover launcher decoded as: {0}, but does not exist.", launcher.Path); |
1137 | + continue; |
1138 | + } |
1139 | + |
1140 | + string execLine = ""; |
1141 | + using (GLib.DataInputStream stream = new GLib.DataInputStream (launcher.Read (null))) { |
1142 | + ulong len; |
1143 | + string line; |
1144 | + try { |
1145 | + while ((line = stream.ReadLine (out len, null)) != null) { |
1146 | + if (line.StartsWith ("exec")) { |
1147 | + execLine = line; |
1148 | + break; |
1149 | + } |
1150 | + } |
1151 | + } catch (Exception e) { |
1152 | + Log<DesktopItemService>.Error ("Error reading crossover launher: {0}", e.Message); |
1153 | + Log<DesktopItemService>.Error (e.StackTrace); |
1154 | + continue; |
1155 | + } |
1156 | + } |
1157 | + |
1158 | + // if no exec line was found, bail |
1159 | + if (string.IsNullOrEmpty (execLine)) |
1160 | + continue; |
1161 | + |
1162 | + // get the relevant part from the execLine |
1163 | + string[] parts = execLine.Split (new[] { '\"' }); |
1164 | + // find the part that contains C:/path/to/app.lnk |
1165 | + if (parts.Any (part => part.StartsWith ("C:"))) { |
1166 | + vexec = parts.First (part => part.StartsWith ("C:")); |
1167 | + // and take only app.lnk (this is what is exposed to ps -ef) |
1168 | + vexec = vexec.Split (new[] { '/' }).Last (); |
1169 | + } else { |
1170 | + continue; |
1171 | + } |
1172 | + |
1173 | + // other apps |
1174 | + } else { |
1175 | + string[] parts = exec.Split (' '); |
1176 | + |
1177 | + vexec = parts |
1178 | + .DefaultIfEmpty (null) |
1179 | + .Select (part => part.Split ( new[] { '/', '\\' }).Last ()) |
1180 | + .Where (part => !DockServices.WindowMatcher.PrefixFilters.Any (f => f.IsMatch (part))) |
1181 | + .FirstOrDefault (); |
1182 | + |
1183 | + // for AIR apps |
1184 | + if (vexec != null && vexec.Contains ('\'')) { |
1185 | + vexec = vexec.Replace ("'", ""); |
1186 | + } |
1187 | + } |
1188 | + |
1189 | + if (vexec == null) |
1190 | + continue; |
1191 | + |
1192 | + if (!ItemsByExec.ContainsKey (vexec)) |
1193 | + ItemsByExec [vexec] = new List<DesktopItem> (); |
1194 | + |
1195 | + ItemsByExec [vexec].Add (item); |
1196 | + foreach (Regex f in DockServices.WindowMatcher.SuffixFilters) { |
1197 | + if (f.IsMatch (vexec)) { |
1198 | + string vexecStripped = f.Replace (vexec, ""); |
1199 | + if (!ItemsByExec.ContainsKey (vexecStripped)) |
1200 | + ItemsByExec [vexecStripped] = new List<DesktopItem> (); |
1201 | + ItemsByExec [vexecStripped].Add (item); |
1202 | + } |
1203 | + } |
1204 | + } |
1205 | + } |
1206 | + } |
1207 | +} |
1208 | + |
1209 | |
1210 | === modified file 'Docky.Services/Docky.Services/DockServices.cs' |
1211 | --- Docky.Services/Docky.Services/DockServices.cs 2010-07-23 07:07:38 +0000 |
1212 | +++ Docky.Services/Docky.Services/DockServices.cs 2010-08-14 22:27:42 +0000 |
1213 | @@ -33,6 +33,10 @@ |
1214 | |
1215 | public static ThemeService Theme { get; private set; } |
1216 | |
1217 | + public static DesktopItemService DesktopItems { get; private set; } |
1218 | + |
1219 | + public static WindowMatcherService WindowMatcher { get; private set; } |
1220 | + |
1221 | static DockServices () |
1222 | { |
1223 | Paths = new PathsService (); |
1224 | @@ -41,6 +45,9 @@ |
1225 | System = new SystemService (); |
1226 | Helpers = new HelperService (); |
1227 | Theme = new ThemeService (); |
1228 | + WindowMatcher = new WindowMatcherService (); |
1229 | + DesktopItems = new DesktopItemService (); |
1230 | + |
1231 | NotificationService.Initialize (); |
1232 | Theme.Initialize (); |
1233 | |
1234 | |
1235 | === modified file 'Docky.Services/Docky.Services/DrawingService.cs' |
1236 | --- Docky.Services/Docky.Services/DrawingService.cs 2010-07-30 08:40:47 +0000 |
1237 | +++ Docky.Services/Docky.Services/DrawingService.cs 2010-08-14 22:27:42 +0000 |
1238 | @@ -36,10 +36,6 @@ |
1239 | { |
1240 | const string MissingIconIcon = "application-default-icon;;application-x-executable"; |
1241 | |
1242 | - internal DrawingService () |
1243 | - { |
1244 | - } |
1245 | - |
1246 | /// <summary> |
1247 | /// An empty pixbuf |
1248 | /// </summary> |
1249 | |
1250 | === renamed file 'Docky.Windowing/Wnck/Window_Extensions.cs' => 'Docky.Services/Docky.Services/Extensions/WnckWindowExtension.cs' |
1251 | --- Docky.Windowing/Wnck/Window_Extensions.cs 2009-10-07 03:35:14 +0000 |
1252 | +++ Docky.Services/Docky.Services/Extensions/WnckWindowExtension.cs 2010-08-14 22:27:42 +0000 |
1253 | @@ -1,5 +1,5 @@ |
1254 | // |
1255 | -// Copyright (C) 2009 Jason Smith |
1256 | +// Copyright (C) 2009-2010 Jason Smith, Chris Szikszoy |
1257 | // |
1258 | // This program is free software: you can redistribute it and/or modify |
1259 | // it under the terms of the GNU General Public License as published by |
1260 | @@ -16,22 +16,19 @@ |
1261 | // |
1262 | |
1263 | using System; |
1264 | -using System.Collections.Generic; |
1265 | -using System.ComponentModel; |
1266 | using System.Runtime.InteropServices; |
1267 | -using System.Linq; |
1268 | -using System.Text; |
1269 | - |
1270 | -using Docky.Windowing; |
1271 | -using Docky.Xlib; |
1272 | - |
1273 | -namespace Wnck |
1274 | + |
1275 | +using Wnck; |
1276 | + |
1277 | +using Docky.Services.Windows; |
1278 | +using Docky.Services.Xlib; |
1279 | + |
1280 | +namespace Docky.Services |
1281 | { |
1282 | |
1283 | - |
1284 | - public static class Window_Extensions |
1285 | + public static class WnckWindowExtension |
1286 | { |
1287 | - public static int Area (this Wnck.Window self) |
1288 | + public static int Area (this Window self) |
1289 | { |
1290 | Gdk.Rectangle geo = self.EasyGeometry (); |
1291 | return geo.Width * geo.Height; |
1292 | @@ -44,8 +41,8 @@ |
1293 | return geo; |
1294 | } |
1295 | |
1296 | - public static void SetWorkaroundGeometry (this Wnck.Window window, WindowGravity gravity, WindowMoveResizeMask mask, |
1297 | - int x, int y, int width, int height) |
1298 | + public static void SetWorkaroundGeometry (this Window window, WindowGravity gravity, WindowMoveResizeMask mask, |
1299 | + int x, int y, int width, int height) |
1300 | { |
1301 | // This is very weird. Don't know when they will fix it. You must subtract the top and left |
1302 | // frame extents from a move operation to get the window to actually show in the right spot. |
1303 | @@ -58,12 +55,12 @@ |
1304 | window.SetGeometry (gravity, mask, x, y, width, height); |
1305 | } |
1306 | |
1307 | - public static int [] FrameExtents (this Wnck.Window window) |
1308 | + public static int [] FrameExtents (this Window window) |
1309 | { |
1310 | return GetCardinalProperty (window, X11Atoms.Instance._NET_FRAME_EXTENTS); |
1311 | } |
1312 | |
1313 | - public static int [] GetCardinalProperty (this Wnck.Window window, IntPtr atom) |
1314 | + public static int [] GetCardinalProperty (this Window window, IntPtr atom) |
1315 | { |
1316 | X11Atoms atoms = X11Atoms.Instance; |
1317 | IntPtr display; |
1318 | @@ -75,12 +72,12 @@ |
1319 | |
1320 | IntPtr window_handle = (IntPtr) window.Xid; |
1321 | |
1322 | - display = Xlib.GdkDisplayXDisplay (Gdk.Screen.Default.Display); |
1323 | + display = X.GdkDisplayXDisplay (Gdk.Screen.Default.Display); |
1324 | type = IntPtr.Zero; |
1325 | |
1326 | - Xlib.XGetWindowProperty (display, window_handle, atom, (IntPtr) 0, |
1327 | - (IntPtr) System.Int32.MaxValue, false, atoms.XA_CARDINAL, out type, out format, |
1328 | - out nitems, out bytes_after, out prop_return); |
1329 | + X.XGetWindowProperty (display, window_handle, atom, (IntPtr) 0, |
1330 | + (IntPtr) System.Int32.MaxValue, false, atoms.XA_CARDINAL, out type, out format, |
1331 | + out nitems, out bytes_after, out prop_return); |
1332 | |
1333 | if (type == atoms.XA_CARDINAL && format == 32) { |
1334 | extents = new int [(int) nitems]; |
1335 | |
1336 | === modified file 'Docky.Services/Docky.Services/HelperService.cs' |
1337 | --- Docky.Services/Docky.Services/HelperService.cs 2010-06-24 13:55:38 +0000 |
1338 | +++ Docky.Services/Docky.Services/HelperService.cs 2010-08-14 22:27:42 +0000 |
1339 | @@ -22,6 +22,9 @@ |
1340 | |
1341 | using GLib; |
1342 | |
1343 | +using Docky.Services.Helpers; |
1344 | +using Docky.Services.Prefs; |
1345 | + |
1346 | using ICSharpCode.SharpZipLib; |
1347 | using ICSharpCode.SharpZipLib.Tar; |
1348 | |
1349 | @@ -93,7 +96,7 @@ |
1350 | |
1351 | List<FileMonitor> monitors = new List<FileMonitor> (); |
1352 | |
1353 | - public HelperService () |
1354 | + internal HelperService () |
1355 | { |
1356 | helpers = new List<Helper> (); |
1357 | |
1358 | |
1359 | === added directory 'Docky.Services/Docky.Services/Helpers' |
1360 | === renamed file 'Docky.Services/Docky.Services/Helper.cs' => 'Docky.Services/Docky.Services/Helpers/Helper.cs' |
1361 | --- Docky.Services/Docky.Services/Helper.cs 2010-06-23 01:34:47 +0000 |
1362 | +++ Docky.Services/Docky.Services/Helpers/Helper.cs 2010-08-14 22:27:42 +0000 |
1363 | @@ -19,9 +19,11 @@ |
1364 | using System; |
1365 | using Diag = System.Diagnostics; |
1366 | |
1367 | +using Docky.Services.Prefs; |
1368 | + |
1369 | using GLib; |
1370 | |
1371 | -namespace Docky.Services |
1372 | +namespace Docky.Services.Helpers |
1373 | { |
1374 | public class Helper |
1375 | { |
1376 | |
1377 | === renamed file 'Docky.Services/Docky.Services/HelperMetadata.cs' => 'Docky.Services/Docky.Services/Helpers/HelperMetadata.cs' |
1378 | --- Docky.Services/Docky.Services/HelperMetadata.cs 2010-06-12 12:15:35 +0000 |
1379 | +++ Docky.Services/Docky.Services/Helpers/HelperMetadata.cs 2010-08-14 22:27:42 +0000 |
1380 | @@ -22,7 +22,7 @@ |
1381 | using GLib; |
1382 | using Gdk; |
1383 | |
1384 | -namespace Docky.Services |
1385 | +namespace Docky.Services.Helpers |
1386 | { |
1387 | public class HelperMetadata |
1388 | { |
1389 | |
1390 | === renamed file 'Docky.Services/Docky.Services/HelperStatusChangedEventArgs.cs' => 'Docky.Services/Docky.Services/Helpers/HelperStatusChangedEventArgs.cs' |
1391 | --- Docky.Services/Docky.Services/HelperStatusChangedEventArgs.cs 2009-12-19 01:57:10 +0000 |
1392 | +++ Docky.Services/Docky.Services/Helpers/HelperStatusChangedEventArgs.cs 2010-08-14 22:27:42 +0000 |
1393 | @@ -19,7 +19,7 @@ |
1394 | |
1395 | using GLib; |
1396 | |
1397 | -namespace Docky.Services |
1398 | +namespace Docky.Services.Helpers |
1399 | { |
1400 | |
1401 | public class HelperStatusChangedEventArgs : EventArgs |
1402 | |
1403 | === modified file 'Docky.Services/Docky.Services/PathsService.cs' |
1404 | --- Docky.Services/Docky.Services/PathsService.cs 2010-06-07 03:47:56 +0000 |
1405 | +++ Docky.Services/Docky.Services/PathsService.cs 2010-08-14 22:27:42 +0000 |
1406 | @@ -87,7 +87,7 @@ |
1407 | #endregion |
1408 | |
1409 | |
1410 | - public PathsService () |
1411 | + internal PathsService () |
1412 | { |
1413 | // get environment-based settings |
1414 | File env_home = FileFactory.NewForPath (Environment.GetFolderPath (Environment.SpecialFolder.Personal)); |
1415 | @@ -142,7 +142,7 @@ |
1416 | try { |
1417 | dir.MakeDirectoryWithParents (null); |
1418 | } catch { |
1419 | - Log<PathsService>.Fatal ("Could not access the directory '" + dir.Path + "' or create it. Docky will not work properly unless this folder is writable."); |
1420 | + Log<PathsService>.Fatal ("Could not access the directory '{0}' or create it. Docky will not work properly unless this folder is writable.", dir.Path); |
1421 | } |
1422 | } |
1423 | } |
1424 | |
1425 | === added directory 'Docky.Services/Docky.Services/Preferences' |
1426 | === renamed file 'Docky.Services/Docky.Services/IPreferences.cs' => 'Docky.Services/Docky.Services/Preferences/IPreferences.cs' |
1427 | --- Docky.Services/Docky.Services/IPreferences.cs 2010-07-23 07:25:33 +0000 |
1428 | +++ Docky.Services/Docky.Services/Preferences/IPreferences.cs 2010-08-14 22:27:42 +0000 |
1429 | @@ -17,7 +17,7 @@ |
1430 | |
1431 | using System; |
1432 | |
1433 | -namespace Docky.Services |
1434 | +namespace Docky.Services.Prefs |
1435 | { |
1436 | public interface IPreferences |
1437 | { |
1438 | |
1439 | === renamed file 'Docky.Services/Docky.Services/Preferences.cs' => 'Docky.Services/Docky.Services/Preferences/Preferences.cs' |
1440 | --- Docky.Services/Docky.Services/Preferences.cs 2010-08-01 20:02:27 +0000 |
1441 | +++ Docky.Services/Docky.Services/Preferences/Preferences.cs 2010-08-14 22:27:42 +0000 |
1442 | @@ -23,7 +23,7 @@ |
1443 | using GConf; |
1444 | using Gnome.Keyring; |
1445 | |
1446 | -namespace Docky.Services |
1447 | +namespace Docky.Services.Prefs |
1448 | { |
1449 | internal class Preferences : IPreferences |
1450 | { |
1451 | |
1452 | === renamed file 'Docky.Services/Docky.Services/PreferencesChangedEventArgs.cs' => 'Docky.Services/Docky.Services/Preferences/PreferencesChangedEventArgs.cs' |
1453 | --- Docky.Services/Docky.Services/PreferencesChangedEventArgs.cs 2010-07-11 06:39:31 +0000 |
1454 | +++ Docky.Services/Docky.Services/Preferences/PreferencesChangedEventArgs.cs 2010-08-14 22:27:42 +0000 |
1455 | @@ -17,7 +17,7 @@ |
1456 | |
1457 | using System; |
1458 | |
1459 | -namespace Docky.Services |
1460 | +namespace Docky.Services.Prefs |
1461 | { |
1462 | public class PreferencesChangedEventArgs : EventArgs |
1463 | { |
1464 | |
1465 | === modified file 'Docky.Services/Docky.Services/PreferencesService.cs' |
1466 | --- Docky.Services/Docky.Services/PreferencesService.cs 2010-08-01 19:44:36 +0000 |
1467 | +++ Docky.Services/Docky.Services/PreferencesService.cs 2010-08-14 22:27:42 +0000 |
1468 | @@ -17,6 +17,8 @@ |
1469 | |
1470 | using System; |
1471 | |
1472 | +using Docky.Services.Prefs; |
1473 | + |
1474 | namespace Docky.Services |
1475 | { |
1476 | |
1477 | @@ -30,7 +32,7 @@ |
1478 | public IPreferences Get<TOwner> () |
1479 | where TOwner : class |
1480 | { |
1481 | - return new Preferences (typeof(TOwner).FullName.Replace (".", "/")); |
1482 | + return new Preferences (typeof (TOwner).FullName.Replace (".", "/")); |
1483 | } |
1484 | |
1485 | public IPreferences Get (string basePath) |
1486 | |
1487 | === modified file 'Docky.Services/Docky.Services/SystemService.cs' |
1488 | --- Docky.Services/Docky.Services/SystemService.cs 2010-07-23 07:22:42 +0000 |
1489 | +++ Docky.Services/Docky.Services/SystemService.cs 2010-08-14 22:27:42 +0000 |
1490 | @@ -20,13 +20,14 @@ |
1491 | using System.Diagnostics; |
1492 | using System.IO; |
1493 | using System.Linq; |
1494 | -using System.Runtime.InteropServices; |
1495 | -using System.Text; |
1496 | +using System.Text.RegularExpressions; |
1497 | using System.Threading; |
1498 | using System.Net; |
1499 | |
1500 | using GLib; |
1501 | |
1502 | +using Docky.Services.Prefs; |
1503 | + |
1504 | using NDesk.DBus; |
1505 | using org.freedesktop.DBus; |
1506 | |
1507 | @@ -34,7 +35,7 @@ |
1508 | { |
1509 | public class SystemService |
1510 | { |
1511 | - public static System.Threading.Thread MainThread { get; set; } |
1512 | + public System.Threading.Thread MainThread { get; set; } |
1513 | |
1514 | internal SystemService () |
1515 | { |
1516 | @@ -42,10 +43,27 @@ |
1517 | InitializeNetwork (); |
1518 | } |
1519 | |
1520 | - IPreferences GConf = DockServices.Preferences.Get ("/system/http_proxy"); |
1521 | + #region Locale |
1522 | + |
1523 | + public string Locale { |
1524 | + get { |
1525 | + string loc; |
1526 | + foreach (string env in new[] { "LC_ALL", "LC_MESSAGES", "LANG", "LANGUAGE" }) { |
1527 | + loc = Environment.GetEnvironmentVariable (env); |
1528 | + if (!string.IsNullOrEmpty (loc) && loc.Length >= 2) { |
1529 | + return loc; |
1530 | + } |
1531 | + } |
1532 | + return ""; |
1533 | + } |
1534 | + } |
1535 | + |
1536 | + #endregion |
1537 | |
1538 | #region Network |
1539 | |
1540 | + IPreferences NetworkSettings = DockServices.Preferences.Get ("/system/http_proxy"); |
1541 | + |
1542 | const string PROXY_USE_PROXY = "use_http_proxy"; |
1543 | const string PROXY_USE_AUTH = "use_authentication"; |
1544 | const string PROXY_HOST = "host"; |
1545 | @@ -71,7 +89,7 @@ |
1546 | } |
1547 | |
1548 | // watch for changes on any of the proxy keys. If they change, reload the proxy |
1549 | - GConf.Changed += delegate(object sender, PreferencesChangedEventArgs e) { |
1550 | + NetworkSettings.Changed += delegate (object sender, PreferencesChangedEventArgs e) { |
1551 | switch (e.Key) { |
1552 | case PROXY_HOST: |
1553 | case PROXY_USER: |
1554 | @@ -140,7 +158,7 @@ |
1555 | |
1556 | public bool UseProxy { |
1557 | get { |
1558 | - return GConf.Get<bool> (PROXY_USE_PROXY, false); |
1559 | + return NetworkSettings.Get<bool> (PROXY_USE_PROXY, false); |
1560 | } |
1561 | } |
1562 | |
1563 | @@ -154,11 +172,11 @@ |
1564 | return null; |
1565 | |
1566 | try { |
1567 | - string proxyUri = string.Format ("http://{0}:{1}", GConf.Get<string> (PROXY_HOST, ""), |
1568 | - GConf.Get<int> (PROXY_PORT, 0).ToString ()); |
1569 | + string proxyUri = string.Format ("http://{0}:{1}", NetworkSettings.Get<string> (PROXY_HOST, ""), |
1570 | + NetworkSettings.Get<int> (PROXY_PORT, 0).ToString ()); |
1571 | |
1572 | proxy = new WebProxy (proxyUri); |
1573 | - string[] bypassList = GConf.Get<string[]> (PROXY_BYPASS_LIST, new[] { "" }); |
1574 | + string[] bypassList = NetworkSettings.Get<string[]> (PROXY_BYPASS_LIST, new[] { "" }); |
1575 | if (bypassList != null) { |
1576 | foreach (string host in bypassList) { |
1577 | if (host.Contains ("*.local")) { |
1578 | @@ -168,9 +186,9 @@ |
1579 | proxy.BypassArrayList.Add (string.Format ("http://{0}", host)); |
1580 | } |
1581 | } |
1582 | - if (GConf.Get<bool> (PROXY_USE_AUTH, false)) |
1583 | - proxy.Credentials = new NetworkCredential (GConf.Get<string> (PROXY_USER, ""), |
1584 | - GConf.Get<string> (PROXY_PASSWORD, "")); |
1585 | + if (NetworkSettings.Get<bool> (PROXY_USE_AUTH, false)) |
1586 | + proxy.Credentials = new NetworkCredential (NetworkSettings.Get<string> (PROXY_USER, ""), |
1587 | + NetworkSettings.Get<string> (PROXY_PASSWORD, "")); |
1588 | } catch (Exception e) { |
1589 | Log.Error ("Error creating web proxy, {0}", e.Message); |
1590 | Log.Debug (e.StackTrace); |
1591 | |
1592 | === modified file 'Docky.Services/Docky.Services/ThemeService.cs' |
1593 | --- Docky.Services/Docky.Services/ThemeService.cs 2010-06-08 10:44:20 +0000 |
1594 | +++ Docky.Services/Docky.Services/ThemeService.cs 2010-08-14 22:27:42 +0000 |
1595 | @@ -27,6 +27,8 @@ |
1596 | |
1597 | using Mono.Unix; |
1598 | |
1599 | +using Docky.Services.Prefs; |
1600 | + |
1601 | using ICSharpCode.SharpZipLib; |
1602 | using ICSharpCode.SharpZipLib.Tar; |
1603 | |
1604 | |
1605 | === renamed file 'Docky.Windowing/Windowing/WindowMatcher.cs' => 'Docky.Services/Docky.Services/WindowMatcherService.cs' |
1606 | --- Docky.Windowing/Windowing/WindowMatcher.cs 2010-06-22 18:58:21 +0000 |
1607 | +++ Docky.Services/Docky.Services/WindowMatcherService.cs 2010-08-14 22:27:42 +0000 |
1608 | @@ -19,438 +19,119 @@ |
1609 | using System; |
1610 | using System.IO; |
1611 | using System.Linq; |
1612 | -using System.Text; |
1613 | using System.Collections.Generic; |
1614 | -using System.Runtime.Serialization; |
1615 | -using System.Collections; |
1616 | -using System.Collections.ObjectModel; |
1617 | using System.Text.RegularExpressions; |
1618 | |
1619 | using Wnck; |
1620 | |
1621 | using Docky.Services; |
1622 | +using Docky.Services.Applications; |
1623 | |
1624 | -namespace Docky.Windowing |
1625 | +namespace Docky.Services |
1626 | { |
1627 | - public class WindowMatcher |
1628 | + public class WindowMatcherService |
1629 | { |
1630 | - public static event EventHandler<DesktopFileChangedEventArgs> DesktopFileChanged; |
1631 | - |
1632 | - static WindowMatcher () |
1633 | - { |
1634 | - Default = new WindowMatcher (); |
1635 | - } |
1636 | - |
1637 | - public static WindowMatcher Default { get; protected set; } |
1638 | - |
1639 | - List<DesktopItem> custom_desktop_items; |
1640 | - List<DesktopItem> desktop_items; |
1641 | - IEnumerable<DesktopItem> DesktopItems { |
1642 | - get { |
1643 | - return custom_desktop_items.Union (desktop_items).AsEnumerable (); |
1644 | - } |
1645 | - } |
1646 | - |
1647 | - static string[] LocaleEnvVariables = new[] { "LC_ALL", "LC_MESSAGES", "LANG", "LANGUAGE" }; |
1648 | - static string locale; |
1649 | - public static string Locale |
1650 | - { |
1651 | - get { |
1652 | - if (!string.IsNullOrEmpty (locale)) |
1653 | - return locale; |
1654 | - |
1655 | - string loc; |
1656 | - foreach (string env in LocaleEnvVariables) { |
1657 | - loc = Environment.GetEnvironmentVariable (env); |
1658 | - if (!string.IsNullOrEmpty (loc) && loc.Length >= 2) { |
1659 | - locale = loc; |
1660 | - return locale; |
1661 | - } |
1662 | - } |
1663 | - |
1664 | - locale = ""; |
1665 | - return locale; |
1666 | - } |
1667 | - } |
1668 | - |
1669 | - IEnumerable<Wnck.Window> UnmatchedWindows { |
1670 | - get { |
1671 | - IEnumerable<Wnck.Window> matched = window_to_desktop_items.Keys.Cast<Wnck.Window> (); |
1672 | - return Wnck.Screen.Default.Windows |
1673 | - .Where (w => !w.IsSkipTasklist && !matched.Contains (w)); |
1674 | - } |
1675 | - } |
1676 | - |
1677 | - object update_lock; |
1678 | - |
1679 | - Dictionary<Wnck.Window, List<DesktopItem>> window_to_desktop_items; |
1680 | - Dictionary<string, List<DesktopItem>> exec_to_desktop_items; |
1681 | - Dictionary<string, DesktopItem> class_to_desktop_items; |
1682 | - Dictionary<string, string> remap_items; |
1683 | - readonly List<Regex> prefix_filters; |
1684 | - readonly List<Regex> suffix_filters; |
1685 | - |
1686 | - void DesktopItemsChanged () |
1687 | - { |
1688 | - exec_to_desktop_items = BuildExecStrings (); |
1689 | - class_to_desktop_items = BuildClassStrings (); |
1690 | - } |
1691 | - |
1692 | - private WindowMatcher () |
1693 | - { |
1694 | - Log<WindowMatcher>.Debug ("Initialize WindowMatcher"); |
1695 | - |
1696 | - Wnck.Screen screen = Wnck.Screen.Default; |
1697 | - |
1698 | - update_lock = new object (); |
1699 | - prefix_filters = BuildPrefixFilters (); |
1700 | - suffix_filters = BuildSuffixFilters (); |
1701 | - |
1702 | - Log<WindowMatcher>.Debug ("Loading Remaps.."); |
1703 | - remap_items = new Dictionary<string, string> (); |
1704 | - LoadRemaps (DockServices.Paths.SystemDataFolder.GetChild ("remaps.ini")); |
1705 | - LoadRemaps (DockServices.Paths.UserDataFolder.GetChild ("remaps.ini")); |
1706 | - |
1707 | - // Load DesktopFilesCache from docky.desktop.[LANG].cache |
1708 | - desktop_items = LoadDesktopItemsCache (DockyDesktopFileCacheFile); |
1709 | - custom_desktop_items = new List<DesktopItem> (); |
1710 | - |
1711 | - if (desktop_items == null || desktop_items.Count () == 0) { |
1712 | - Log<WindowMatcher>.Info ("Loading *.desktop files and regenerating cache. This may take some while..."); |
1713 | - UpdateDesktopItemsList (); |
1714 | - ProcessAndMergeAllSystemCacheFiles (desktop_items); |
1715 | - SaveDesktopItemsCache(); |
1716 | - } |
1717 | - DesktopItemsChanged (); |
1718 | - |
1719 | - // Update desktop_items and save cache after 2 minutes just to be sure we are up to date |
1720 | - GLib.Timeout.Add (2 * 60 * 1000, delegate { |
1721 | - lock (update_lock) { |
1722 | - UpdateDesktopItemsList (); |
1723 | - ProcessAndMergeAllSystemCacheFiles (desktop_items); |
1724 | - DesktopItemsChanged (); |
1725 | - SaveDesktopItemsCache(); |
1726 | - } |
1727 | - return false; |
1728 | - }); |
1729 | - |
1730 | + |
1731 | + internal WindowMatcherService () |
1732 | + { |
1733 | // Initialize window matching with currently available windows |
1734 | - window_to_desktop_items = new Dictionary<Wnck.Window, List<DesktopItem>> (); |
1735 | - foreach (Wnck.Window w in screen.Windows) |
1736 | + DesktopItemsByWindow = new Dictionary<Window, List<DesktopItem>> (); |
1737 | + |
1738 | + foreach (Window w in Wnck.Screen.Default.Windows) |
1739 | SetupWindow (w); |
1740 | |
1741 | - // Set up monitors for cache files and desktop directories |
1742 | - foreach (GLib.File dir in DesktopFileDirectories) |
1743 | - MonitorDesktopFileDirs (dir); |
1744 | - MonitorDesktopFileSystemCacheFiles (); |
1745 | - |
1746 | - screen.WindowOpened += WnckScreenDefaultWindowOpened; |
1747 | - screen.WindowClosed += WnckScreenDefaultWindowClosed; |
1748 | - } |
1749 | - |
1750 | - #region Handle DesktopItems |
1751 | - static IEnumerable<GLib.File> DesktopFileSystemCacheFiles |
1752 | - { |
1753 | - get { |
1754 | - return DesktopFileDirectories |
1755 | - .Select (d => d.GetChild (string.Format ("desktop.{0}.cache", Locale))) |
1756 | - .Where (f => f.Exists); |
1757 | - } |
1758 | - } |
1759 | - |
1760 | - static string DockyDesktopFileCacheFile |
1761 | - { |
1762 | - get { |
1763 | - if (!string.IsNullOrEmpty (Locale)) |
1764 | - return DockServices.Paths.UserCacheFolder.GetChild (string.Format ("docky.desktop.{0}.cache", Locale)).Path; |
1765 | - return DockServices.Paths.UserCacheFolder.GetChild ("docky.desktop.cache").Path; |
1766 | - } |
1767 | - } |
1768 | - |
1769 | - static IEnumerable<GLib.File> DesktopFileDirectories |
1770 | - { |
1771 | - get { |
1772 | - return DockServices.Paths.XdgDataDirFolders.Select (d => d.GetChild ("applications")) |
1773 | - .Union(new [] { |
1774 | - DockServices.Paths.XdgDataHomeFolder.GetChild ("applications"), |
1775 | - DockServices.Paths.HomeFolder.GetChild (".cxoffice"), |
1776 | - }) |
1777 | - .Where (d => d.Exists); |
1778 | - } |
1779 | - } |
1780 | - |
1781 | - void UpdateDesktopItemsList () |
1782 | - { |
1783 | - if (desktop_items == null) |
1784 | - desktop_items = new List<DesktopItem> (); |
1785 | - |
1786 | - List<GLib.File> known_desktop_files = desktop_items.Select (item => item.File).ToList (); |
1787 | - List<DesktopItem> new_items = new List<DesktopItem> (); |
1788 | - |
1789 | - // Get desktop items for new "valid" desktop files |
1790 | - new_items = DesktopFileDirectories |
1791 | - .SelectMany (dir => dir.SubDirs ()) |
1792 | - .Union (DesktopFileDirectories) |
1793 | - .SelectMany (file => file.GetFiles (".desktop")) |
1794 | - .Where (file => !known_desktop_files.Exists (known_file => (known_file.Path == file.Path))) |
1795 | - .Select (file => new DesktopItem (file)) |
1796 | - .Where (item => item.Values.Any ()) |
1797 | - .ToList (); |
1798 | - |
1799 | - desktop_items.AddRange (new_items); |
1800 | - |
1801 | - if (new_items.Count () > 0) |
1802 | - Log<WindowMatcher>.Debug ("{0} new applications found", new_items.Count ()); |
1803 | - |
1804 | - // Check file existence and remove unlinked items |
1805 | - int removed = desktop_items.RemoveAll (item => !item.File.Exists); |
1806 | - if (removed > 0) |
1807 | - Log<WindowMatcher>.Debug ("{0} applications removed", removed); |
1808 | - |
1809 | - known_desktop_files.Clear (); |
1810 | - new_items.Clear (); |
1811 | - } |
1812 | - |
1813 | - void ProcessAndMergeAllSystemCacheFiles (List<DesktopItem> items) |
1814 | - { |
1815 | - foreach (GLib.File cache_file in DesktopFileSystemCacheFiles) |
1816 | - ProcessAndMergeSystemCacheFile (cache_file, items); |
1817 | - } |
1818 | - |
1819 | - void ProcessAndMergeSystemCacheFile (GLib.File cache_file, List<DesktopItem> items) |
1820 | - { |
1821 | - if (!cache_file.Exists) |
1822 | - return; |
1823 | - |
1824 | - Log<WindowMatcher>.Debug ("Processing {0}", cache_file.Path); |
1825 | - |
1826 | - try { |
1827 | - using (StreamReader reader = new StreamReader (cache_file.Path)) { |
1828 | - DesktopItem desktop_item = null; |
1829 | - string line; |
1830 | - |
1831 | - while ((line = reader.ReadLine ()) != null) { |
1832 | - if (line.Trim ().Length <= 0) |
1833 | - continue; |
1834 | - |
1835 | - if (line.ElementAt (0) == '[') { |
1836 | - Match match = DesktopItem.sectionRegex.Match (line); |
1837 | - if (match.Success) { |
1838 | - string section = match.Groups["Section"].Value; |
1839 | - if (section != null) { |
1840 | - GLib.File file = cache_file.Parent.GetChild (string.Format ("{0}.desktop", section)); |
1841 | - desktop_item = items.First (item => item.File.Path == file.Path); |
1842 | - if (desktop_item == null && file.Exists) { |
1843 | - desktop_item = new DesktopItem (file); |
1844 | - items.Add (desktop_item); |
1845 | - Log<WindowMatcher>.Debug ("New application found: {0}", desktop_item.Path); |
1846 | - } |
1847 | - continue; |
1848 | - } |
1849 | - } |
1850 | - } else if (desktop_item != null) { |
1851 | - Match match = DesktopItem.keyValueRegex.Match (line); |
1852 | - if (match.Success) { |
1853 | - string key = match.Groups["Key"].Value; |
1854 | - string val = match.Groups["Value"].Value; |
1855 | - if (!string.IsNullOrEmpty (key) && !string.IsNullOrEmpty (val)) |
1856 | - desktop_item.SetString (key, val); |
1857 | - continue; |
1858 | - } |
1859 | - } |
1860 | - } |
1861 | - reader.Close (); |
1862 | - } |
1863 | - } catch (Exception e) { |
1864 | - Log<WindowMatcher>.Error (e.Message); |
1865 | - Log<WindowMatcher>.Error (e.StackTrace); |
1866 | - } |
1867 | - } |
1868 | - |
1869 | - void LoadRemaps (GLib.File file) |
1870 | - { |
1871 | - if (!file.Exists) |
1872 | - return; |
1873 | - |
1874 | - Regex keyValueRegex = new Regex ( |
1875 | - @"(^(\s)*(?<Key>([^\=^\n]+))[\s^\n]*\=(\s)*(?<Value>([^\n]+(\n){0,1})))", |
1876 | - RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled | |
1877 | - RegexOptions.CultureInvariant |
1878 | - ); |
1879 | - |
1880 | - try { |
1881 | - using (StreamReader reader = new StreamReader (file.Path)) { |
1882 | - string line; |
1883 | - |
1884 | - while ((line = reader.ReadLine ()) != null) { |
1885 | - line = line.Trim (); |
1886 | - if (line.Length <= 0 || line.Substring (0, 1) == "#") |
1887 | - continue; |
1888 | - |
1889 | - Match match = keyValueRegex.Match (line); |
1890 | - if (match.Success) { |
1891 | - string key = match.Groups["Key"].Value; |
1892 | - string val = match.Groups["Value"].Value; |
1893 | - if (!string.IsNullOrEmpty (key)) { |
1894 | - remap_items[key] = val; |
1895 | - Log<WindowMatcher>.Debug ("Remapping '" + key + "' to '" + val + "'"); |
1896 | - } |
1897 | - } |
1898 | - } |
1899 | - reader.Close (); |
1900 | - } |
1901 | - } catch (Exception e) { |
1902 | - Log<WindowMatcher>.Error (e.Message); |
1903 | - Log<WindowMatcher>.Error (e.StackTrace); |
1904 | - } |
1905 | - } |
1906 | - |
1907 | - List<DesktopItem> LoadDesktopItemsCache (string filename) |
1908 | - { |
1909 | - if (!GLib.FileFactory.NewForPath (filename).Exists) |
1910 | - return new List<DesktopItem> (); |
1911 | - |
1912 | - Log<WindowMatcher>.Debug ("Loading {0}", DockyDesktopFileCacheFile); |
1913 | - |
1914 | - List<DesktopItem> items = new List<DesktopItem> (); |
1915 | - |
1916 | - try { |
1917 | - using (StreamReader reader = new StreamReader (filename)) { |
1918 | - DesktopItem desktop_item = null; |
1919 | - string line; |
1920 | - |
1921 | - while ((line = reader.ReadLine ()) != null) { |
1922 | - if (line.Trim ().Length <= 0) |
1923 | - continue; |
1924 | - |
1925 | - if (line.ElementAt (0) == '[') { |
1926 | - Match match = DesktopItem.sectionRegex.Match (line); |
1927 | - if (match.Success) { |
1928 | - string section = match.Groups["Section"].Value; |
1929 | - if (section != null) { |
1930 | - GLib.File file = GLib.FileFactory.NewForPath (section); |
1931 | - desktop_item = new DesktopItem (file, false); |
1932 | - items.Add (desktop_item); |
1933 | - } |
1934 | - continue; |
1935 | - } |
1936 | - } else if (desktop_item != null) { |
1937 | - Match match = DesktopItem.keyValueRegex.Match (line); |
1938 | - if (match.Success) { |
1939 | - string key = match.Groups["Key"].Value; |
1940 | - string val = match.Groups["Value"].Value; |
1941 | - if (!string.IsNullOrEmpty (key) && !string.IsNullOrEmpty (val)) |
1942 | - desktop_item.SetString (key, val); |
1943 | - continue; |
1944 | - } |
1945 | - } |
1946 | - } |
1947 | - reader.Close (); |
1948 | - } |
1949 | - } catch (Exception e) { |
1950 | - Log<WindowMatcher>.Error (e.Message); |
1951 | - Log<WindowMatcher>.Error (e.StackTrace); |
1952 | - return null; |
1953 | - } |
1954 | - |
1955 | - return items; |
1956 | - } |
1957 | - |
1958 | - void SaveDesktopItemsCache () |
1959 | - { |
1960 | - Log<WindowMatcher>.Debug ("Saving {0}", DockyDesktopFileCacheFile); |
1961 | - |
1962 | - try { |
1963 | - using (StreamWriter writer = new StreamWriter (DockyDesktopFileCacheFile, false)) { |
1964 | - foreach (DesktopItem item in desktop_items) { |
1965 | - writer.WriteLine ("[{0}]", item.Path); |
1966 | - IDictionaryEnumerator enumerator = item.Values.GetEnumerator (); |
1967 | - enumerator.Reset(); |
1968 | - while (enumerator.MoveNext()) |
1969 | - writer.WriteLine ("{0}={1}", enumerator.Key, enumerator.Value); |
1970 | - writer.WriteLine (""); |
1971 | - } |
1972 | - writer.Close (); |
1973 | - } |
1974 | - } catch (Exception e) { |
1975 | - Log<WindowMatcher>.Error (e.Message); |
1976 | - Log<WindowMatcher>.Error (e.StackTrace); |
1977 | - } |
1978 | - } |
1979 | - |
1980 | - void MonitorDesktopFileSystemCacheFiles () |
1981 | - { |
1982 | - foreach (GLib.File file in DesktopFileSystemCacheFiles) { |
1983 | - GLib.FileMonitor mon = file.Monitor (GLib.FileMonitorFlags.None, null); |
1984 | - mon.RateLimit = 2500; |
1985 | - mon.Changed += delegate(object o, GLib.ChangedArgs args) { |
1986 | - if (args.EventType == GLib.FileMonitorEvent.ChangesDoneHint) |
1987 | - DockServices.System.RunOnThread (() => { |
1988 | - lock (update_lock) { |
1989 | - ProcessAndMergeSystemCacheFile (file, desktop_items); |
1990 | - DesktopItemsChanged (); |
1991 | - } |
1992 | - }); |
1993 | - }; |
1994 | - } |
1995 | - } |
1996 | - |
1997 | - void MonitorDesktopFileDirs (GLib.File dir) |
1998 | - { |
1999 | - // build a list of all the subdirectories |
2000 | - List<GLib.File> dirs = new List<GLib.File> () {dir}; |
2001 | - try { |
2002 | - dirs = dirs.Union (dir.SubDirs ()).ToList (); |
2003 | - } catch {} |
2004 | - |
2005 | - foreach (GLib.File d in dirs) { |
2006 | - GLib.FileMonitor mon = d.Monitor (GLib.FileMonitorFlags.None, null); |
2007 | - mon.RateLimit = 2500; |
2008 | - mon.Changed += delegate(object o, GLib.ChangedArgs args) { |
2009 | - // bug in GIO#, calling args.File or args.OtherFile crashes hard |
2010 | - GLib.File file = GLib.FileAdapter.GetObject ((GLib.Object) args.Args[0]); |
2011 | - GLib.File otherFile = GLib.FileAdapter.GetObject ((GLib.Object) args.Args[1]); |
2012 | - |
2013 | - // according to GLib documentation, the change signal runs on the same |
2014 | - // thread that the monitor was created on. Without running this part on a thread |
2015 | - // docky freezes up for about 500-800 ms while the .desktop files are parsed. |
2016 | - DockServices.System.RunOnThread (() => { |
2017 | - // if a new directory was created, make sure we watch that dir as well |
2018 | - if (file.QueryFileType (GLib.FileQueryInfoFlags.NofollowSymlinks, null) == GLib.FileType.Directory) |
2019 | - MonitorDesktopFileDirs (file); |
2020 | - |
2021 | - // we only care about .desktop files |
2022 | - if (!file.Path.EndsWith (".desktop")) |
2023 | - return; |
2024 | - |
2025 | - lock (update_lock) { |
2026 | - UpdateDesktopItemsList (); |
2027 | - DesktopItemsChanged (); |
2028 | - SaveDesktopItemsCache(); |
2029 | - } |
2030 | - |
2031 | - // Make sure to trigger event on main thread |
2032 | - DockServices.System.RunOnMainThread (() => { |
2033 | - if (DesktopFileChanged != null) |
2034 | - DesktopFileChanged (this, new DesktopFileChangedEventArgs (args.EventType, file, otherFile)); |
2035 | - }); |
2036 | - }); |
2037 | - }; |
2038 | - } |
2039 | - } |
2040 | - |
2041 | - public void RegisterDesktopItem (DesktopItem item) |
2042 | - { |
2043 | - if (DesktopItems.Contains (item)) |
2044 | - return; |
2045 | - |
2046 | - custom_desktop_items.Add (item); |
2047 | - |
2048 | - DesktopItemsChanged (); |
2049 | - } |
2050 | + Wnck.Screen.Default.WindowOpened += WnckScreenDefaultWindowOpened; |
2051 | + Wnck.Screen.Default.WindowClosed += WnckScreenDefaultWindowClosed; |
2052 | + } |
2053 | + |
2054 | + IEnumerable<Window> UnmatchedWindows { |
2055 | + get { |
2056 | + IEnumerable<Window> matched = DesktopItemsByWindow.Keys.Cast<Window> (); |
2057 | + return Wnck.Screen.Default.Windows.Where (w => !w.IsSkipTasklist && !matched.Contains (w)); |
2058 | + } |
2059 | + } |
2060 | + |
2061 | + Dictionary<Window, List<DesktopItem>> DesktopItemsByWindow; |
2062 | + |
2063 | + #region public API |
2064 | + |
2065 | + public IEnumerable<Window> WindowsForDesktopItem (DesktopItem item) |
2066 | + { |
2067 | + if (item == null) |
2068 | + throw new ArgumentNullException ("DesktopItem item cannot be null."); |
2069 | + |
2070 | + |
2071 | + foreach (KeyValuePair<Window, List<DesktopItem>> kvp in DesktopItemsByWindow) |
2072 | + if (kvp.Value.Any (df => df == item)) |
2073 | + yield return kvp.Key; |
2074 | + } |
2075 | + |
2076 | + public DesktopItem DesktopItemForWindow (Window window) |
2077 | + { |
2078 | + if (window == null) |
2079 | + throw new ArgumentNullException ("Window window cannot be null."); |
2080 | + |
2081 | + List<DesktopItem> matches; |
2082 | + if (DesktopItemsByWindow.TryGetValue (window, out matches)) { |
2083 | + DesktopItem useritem = matches.Find (item => item.File.Path.StartsWith (DockServices.Paths.HomeFolder.Path)); |
2084 | + if (useritem != null) |
2085 | + return useritem; |
2086 | + return matches.FirstOrDefault (); |
2087 | + } |
2088 | + |
2089 | + return null; |
2090 | + } |
2091 | + |
2092 | + public List<Regex> PrefixFilters { |
2093 | + get { |
2094 | + return BuildPrefixFilters (); |
2095 | + } |
2096 | + } |
2097 | + public List<Regex> SuffixFilters { |
2098 | + get { |
2099 | + return BuildSuffixFilters (); |
2100 | + } |
2101 | + } |
2102 | + |
2103 | + public IEnumerable<Window> SimilarWindows (Window window) |
2104 | + { |
2105 | + if (window == null) |
2106 | + throw new ArgumentNullException ("Window cannot be null."); |
2107 | + |
2108 | + //TODO perhaps make it a bit smarter |
2109 | + if (!DesktopItemsByWindow.ContainsKey (window)) |
2110 | + foreach (Window win in UnmatchedWindows) { |
2111 | + if (win == window) |
2112 | + continue; |
2113 | + |
2114 | + if (win.Pid == window.Pid) |
2115 | + yield return win; else if (window.Pid <= 1) { |
2116 | + if (window.ClassGroup != null && win.ClassGroup != null && !string.IsNullOrEmpty (window.ClassGroup.ResClass) && !string.IsNullOrEmpty (win.ClassGroup.ResClass) && win.ClassGroup.ResClass.Equals (window.ClassGroup.ResClass)) |
2117 | + yield return win; else if (!string.IsNullOrEmpty (win.Name) && win.Name.Equals (window.Name)) |
2118 | + yield return win; |
2119 | + } |
2120 | + } |
2121 | + |
2122 | + yield return window; |
2123 | + } |
2124 | + |
2125 | + public bool WindowIsReadyForMatch (Window window) |
2126 | + { |
2127 | + if (!WindowIsOpenOffice (window)) |
2128 | + return true; |
2129 | + |
2130 | + return SetupWindow (window); |
2131 | + } |
2132 | + |
2133 | + public bool WindowIsOpenOffice (Window window) |
2134 | + { |
2135 | + return window.ClassGroup != null && window.ClassGroup.Name.ToLower ().StartsWith ("openoffice"); |
2136 | + } |
2137 | + |
2138 | #endregion |
2139 | - |
2140 | + |
2141 | #region Window Setup |
2142 | + |
2143 | void WnckScreenDefaultWindowOpened (object o, WindowOpenedArgs args) |
2144 | { |
2145 | SetupWindow (args.Window); |
2146 | @@ -459,173 +140,39 @@ |
2147 | void WnckScreenDefaultWindowClosed (object o, WindowClosedArgs args) |
2148 | { |
2149 | if (args.Window != null) |
2150 | - window_to_desktop_items.Remove (args.Window); |
2151 | + DesktopItemsByWindow.Remove (args.Window); |
2152 | } |
2153 | |
2154 | - bool SetupWindow (Wnck.Window window) |
2155 | + bool SetupWindow (Window window) |
2156 | { |
2157 | IEnumerable<DesktopItem> items = DesktopItemsForWindow (window); |
2158 | if (items.Any ()) { |
2159 | - window_to_desktop_items [window] = items.ToList (); |
2160 | + DesktopItemsByWindow [window] = items.ToList (); |
2161 | return true; |
2162 | - } else |
2163 | + } else { |
2164 | return false; |
2165 | + } |
2166 | } |
2167 | + |
2168 | #endregion |
2169 | |
2170 | #region Window Matching |
2171 | - static IEnumerable<string> PrefixStrings { |
2172 | - get { |
2173 | - yield return "gksu(do)?"; |
2174 | - yield return "sudo"; |
2175 | - yield return "java"; |
2176 | - yield return "mono"; |
2177 | - yield return "ruby"; |
2178 | - yield return "padsp"; |
2179 | - yield return "perl"; |
2180 | - yield return "aoss"; |
2181 | - yield return "python(\\d+.\\d+)?"; |
2182 | - yield return "wish(\\d+\\.\\d+)?"; |
2183 | - yield return "(ba)?sh"; |
2184 | - yield return "-.*"; |
2185 | - yield return "*.\\.desktop"; |
2186 | - } |
2187 | - } |
2188 | - |
2189 | - List<Regex> BuildPrefixFilters () |
2190 | - { |
2191 | - return new List<Regex> (PrefixStrings.Select (s => new Regex ("^" + s + "$"))); |
2192 | - } |
2193 | - |
2194 | - static IEnumerable<string> SuffixStrings { |
2195 | - get { |
2196 | - // some wine apps are launched via a shell script that sets the proc name to "app.exe" |
2197 | - yield return "\\.exe"; |
2198 | - // some apps have a script 'foo' which does 'exec foo-bin' or 'exec foo.bin' |
2199 | - yield return "[.-]bin"; |
2200 | - // some python apps have a script 'foo' for 'python foo.py' |
2201 | - yield return "\\.py"; |
2202 | - // some apps append versions, such as '-1' or '-3.0' |
2203 | - yield return "(-)?\\d+(\\.\\d+)?"; |
2204 | - } |
2205 | - } |
2206 | - |
2207 | - List<Regex> BuildSuffixFilters () |
2208 | - { |
2209 | - return new List<Regex> (SuffixStrings.Select (s => new Regex (s + "$"))); |
2210 | - } |
2211 | - |
2212 | - public bool WindowIsReadyForMatch (Wnck.Window window) |
2213 | - { |
2214 | - if (!WindowIsOpenOffice (window)) |
2215 | - return true; |
2216 | - |
2217 | - return SetupWindow (window); |
2218 | - } |
2219 | - |
2220 | - public bool WindowIsOpenOffice (Wnck.Window window) |
2221 | - { |
2222 | - return window.ClassGroup != null && window.ClassGroup.Name.ToLower ().StartsWith ("openoffice"); |
2223 | - } |
2224 | - |
2225 | - public IEnumerable<Wnck.Window> WindowsForDesktopItem (DesktopItem item) |
2226 | - { |
2227 | - if (item == null) |
2228 | - throw new ArgumentNullException ("DesktopItem item"); |
2229 | - |
2230 | - foreach (KeyValuePair<Wnck.Window, List<DesktopItem>> kvp in window_to_desktop_items) |
2231 | - if (kvp.Value.Any (df => df == item)) |
2232 | - yield return kvp.Key; |
2233 | - } |
2234 | - |
2235 | - public IEnumerable<Wnck.Window> SimilarWindows (Wnck.Window window) |
2236 | - { |
2237 | - if (window == null) |
2238 | - throw new ArgumentNullException ("Wnck.Window window"); |
2239 | - |
2240 | - //TODO perhaps make it a bit smarter |
2241 | - if (!window_to_desktop_items.ContainsKey (window)) |
2242 | - foreach (Wnck.Window win in UnmatchedWindows) { |
2243 | - if (win == window) |
2244 | - continue; |
2245 | - |
2246 | - if (win.Pid == window.Pid) |
2247 | - yield return win; |
2248 | - else if (window.Pid <= 1) { |
2249 | - if (window.ClassGroup != null |
2250 | - && win.ClassGroup != null |
2251 | - && !string.IsNullOrEmpty (window.ClassGroup.ResClass) |
2252 | - && !string.IsNullOrEmpty (win.ClassGroup.ResClass) |
2253 | - && win.ClassGroup.ResClass.Equals (window.ClassGroup.ResClass)) |
2254 | - yield return win; |
2255 | - else if (!string.IsNullOrEmpty (win.Name) && win.Name.Equals (window.Name)) |
2256 | - yield return win; |
2257 | - } |
2258 | - } |
2259 | - |
2260 | - yield return window; |
2261 | - } |
2262 | - |
2263 | - public DesktopItem DesktopItemForDesktopFile (string file) |
2264 | - { |
2265 | - try { |
2266 | - return DesktopItems |
2267 | - .Where (df => df.Path.Equals (file, StringComparison.CurrentCultureIgnoreCase)) |
2268 | - .DefaultIfEmpty (null) |
2269 | - .FirstOrDefault (); |
2270 | - } catch (Exception e) { |
2271 | - Docky.Services.Log<WindowMatcher>.Error (e.Message); |
2272 | - Docky.Services.Log<WindowMatcher>.Debug (e.StackTrace); |
2273 | - } |
2274 | - |
2275 | - return null; |
2276 | - } |
2277 | - |
2278 | - public DesktopItem DesktopItemForWindow (Wnck.Window window) |
2279 | - { |
2280 | - if (window == null) |
2281 | - throw new ArgumentNullException ("window"); |
2282 | - |
2283 | - List<DesktopItem> matches; |
2284 | - if (window_to_desktop_items.TryGetValue (window, out matches)) { |
2285 | - DesktopItem useritem = matches.Find (item => item.File.Path.StartsWith (DockServices.Paths.HomeFolder.Path)); |
2286 | - if (useritem != null) |
2287 | - return useritem; |
2288 | - return matches.FirstOrDefault (); |
2289 | - } |
2290 | - |
2291 | - return null; |
2292 | - } |
2293 | - |
2294 | - IEnumerable<DesktopItem> DesktopItemsForDesktopID (string id) |
2295 | - { |
2296 | - IEnumerable<DesktopItem> matches = Enumerable.Empty<DesktopItem> (); |
2297 | - try { |
2298 | - matches = DesktopItems |
2299 | - .Where (df => df.DesktopID.Equals (id, StringComparison.CurrentCultureIgnoreCase)); |
2300 | - } catch (Exception e) { |
2301 | - Docky.Services.Log<WindowMatcher>.Error (e.Message); |
2302 | - Docky.Services.Log<WindowMatcher>.Debug (e.StackTrace); |
2303 | - } |
2304 | - |
2305 | - return matches; |
2306 | - } |
2307 | - |
2308 | - IEnumerable<DesktopItem> DesktopItemsForWindow (Wnck.Window window) |
2309 | + |
2310 | + IEnumerable<DesktopItem> DesktopItemsForWindow (Window window) |
2311 | { |
2312 | // use the StartupWMClass as the definitive match |
2313 | if (window.ClassGroup != null |
2314 | && !string.IsNullOrEmpty (window.ClassGroup.ResClass) |
2315 | && window.ClassGroup.ResClass != "Wine" |
2316 | - && class_to_desktop_items.ContainsKey (window.ClassGroup.ResClass)) { |
2317 | - yield return class_to_desktop_items [window.ClassGroup.ResClass]; |
2318 | + && DockServices.DesktopItems.DesktopItemFromClass (window.ClassGroup.ResClass) != null) { |
2319 | + yield return DockServices.DesktopItems.DesktopItemFromClass (window.ClassGroup.ResClass); |
2320 | yield break; |
2321 | } |
2322 | |
2323 | int pid = window.Pid; |
2324 | if (pid <= 1) { |
2325 | if (window.ClassGroup != null && !string.IsNullOrEmpty (window.ClassGroup.ResClass)) { |
2326 | - IEnumerable<DesktopItem> matches = DesktopItemsForDesktopID (window.ClassGroup.ResClass); |
2327 | + IEnumerable<DesktopItem> matches = DockServices.DesktopItems.DesktopItemsFromID (window.ClassGroup.ResClass); |
2328 | if (matches.Any ()) |
2329 | foreach (DesktopItem s in matches) |
2330 | yield return s; |
2331 | @@ -639,72 +186,109 @@ |
2332 | // get ppid and parents |
2333 | IEnumerable<int> pids = PidAndParents (pid); |
2334 | // this list holds a list of the command line parts from left (0) to right (n) |
2335 | - List<string> command_line = new List<string> (); |
2336 | + List<string> commandLine = new List<string> (); |
2337 | |
2338 | // if we have a classname that matches a desktopid we have a winner |
2339 | if (window.ClassGroup != null) { |
2340 | if (WindowIsOpenOffice (window)) { |
2341 | string title = window.Name.Trim (); |
2342 | if (title.EndsWith ("Writer")) |
2343 | - command_line.Add ("ooffice-writer"); |
2344 | + commandLine.Add ("ooffice-writer"); |
2345 | else if (title.EndsWith ("Draw")) |
2346 | - command_line.Add ("ooffice-draw"); |
2347 | + commandLine.Add ("ooffice-draw"); |
2348 | else if (title.EndsWith ("Impress")) |
2349 | - command_line.Add ("ooffice-impress"); |
2350 | + commandLine.Add ("ooffice-impress"); |
2351 | else if (title.EndsWith ("Calc")) |
2352 | - command_line.Add ("ooffice-calc"); |
2353 | + commandLine.Add ("ooffice-calc"); |
2354 | else if (title.EndsWith ("Math")) |
2355 | - command_line.Add ("ooffice-math"); |
2356 | + commandLine.Add ("ooffice-math"); |
2357 | } else if (window.ClassGroup.ResClass == "Wine") { |
2358 | // we can match Wine apps normally so don't do anything here |
2359 | } else { |
2360 | - string class_name = window.ClassGroup.ResClass.Replace (".", ""); |
2361 | - IEnumerable<DesktopItem> matches = DesktopItemsForDesktopID (class_name); |
2362 | + string className = window.ClassGroup.ResClass.Replace (".", ""); |
2363 | + IEnumerable<DesktopItem> matches = DockServices.DesktopItems.DesktopItemsFromID (className); |
2364 | |
2365 | - foreach (DesktopItem s in matches) { |
2366 | + if (matches.Any ()) { |
2367 | + foreach (DesktopItem s in matches) { |
2368 | + yield return s; |
2369 | + matched = true; |
2370 | + } |
2371 | + } |
2372 | + } |
2373 | + } |
2374 | + |
2375 | + do { |
2376 | + // do a match on the process name |
2377 | + string name = NameForPid (pids.ElementAt (currentPid)); |
2378 | + foreach (DesktopItem s in DockServices.DesktopItems.DesktopItemsFromExec (name)) { |
2379 | + yield return s; |
2380 | + matched = true; |
2381 | + } |
2382 | + |
2383 | + // otherwise do a match on the commandline |
2384 | + commandLine.AddRange (CommandLineForPid (pids.ElementAt (currentPid++)) |
2385 | + .Select (cmd => cmd.Replace (@"\", @"\\"))); |
2386 | + |
2387 | + if (commandLine.Count () == 0) |
2388 | + continue; |
2389 | + |
2390 | + foreach (string cmd in commandLine) { |
2391 | + foreach (DesktopItem s in DockServices.DesktopItems.DesktopItemsFromExec (cmd)) { |
2392 | yield return s; |
2393 | matched = true; |
2394 | } |
2395 | - } |
2396 | - } |
2397 | - |
2398 | - lock (update_lock) { |
2399 | - do { |
2400 | - // do a match on the process name |
2401 | - string name = NameForPid (pids.ElementAt (currentPid)); |
2402 | - if (exec_to_desktop_items.ContainsKey (name)) { |
2403 | - foreach (DesktopItem s in exec_to_desktop_items[name]) { |
2404 | - yield return s; |
2405 | - matched = true; |
2406 | - } |
2407 | - } |
2408 | - |
2409 | - // otherwise do a match on the commandline |
2410 | - command_line.AddRange (CommandLineForPid (pids.ElementAt (currentPid++)) |
2411 | - .Select (cmd => cmd.Replace (@"\", @"\\"))); |
2412 | - |
2413 | - if (command_line.Count () == 0) |
2414 | - continue; |
2415 | - |
2416 | - foreach (string cmd in command_line) { |
2417 | - if (exec_to_desktop_items.ContainsKey (cmd)) { |
2418 | - foreach (DesktopItem s in exec_to_desktop_items[cmd]) { |
2419 | - yield return s; |
2420 | - matched = true; |
2421 | - } |
2422 | - } |
2423 | - if (matched) |
2424 | - break; |
2425 | - } |
2426 | - |
2427 | - // if we found a match, bail. |
2428 | if (matched) |
2429 | - yield break; |
2430 | - } while (currentPid < pids.Count ()); |
2431 | - } |
2432 | - command_line.Clear (); |
2433 | + break; |
2434 | + } |
2435 | + |
2436 | + // if we found a match, bail. |
2437 | + if (matched) |
2438 | + yield break; |
2439 | + } while (currentPid < pids.Count ()); |
2440 | + |
2441 | yield break; |
2442 | } |
2443 | + |
2444 | + IEnumerable<string> PrefixStrings { |
2445 | + get { |
2446 | + yield return "gksu(do)?"; |
2447 | + yield return "sudo"; |
2448 | + yield return "java"; |
2449 | + yield return "mono"; |
2450 | + yield return "ruby"; |
2451 | + yield return "padsp"; |
2452 | + yield return "perl"; |
2453 | + yield return "aoss"; |
2454 | + yield return "python(\\d+.\\d+)?"; |
2455 | + yield return "wish(\\d+\\.\\d+)?"; |
2456 | + yield return "(ba)?sh"; |
2457 | + yield return "-.*"; |
2458 | + yield return "*.\\.desktop"; |
2459 | + } |
2460 | + } |
2461 | + |
2462 | + List<Regex> BuildPrefixFilters () |
2463 | + { |
2464 | + return new List<Regex> (PrefixStrings.Select (s => new Regex ("^" + s + "$"))); |
2465 | + } |
2466 | + |
2467 | + IEnumerable<string> SuffixStrings { |
2468 | + get { |
2469 | + // some wine apps are launched via a shell script that sets the proc name to "app.exe" |
2470 | + yield return "\\.exe"; |
2471 | + // some apps have a script 'foo' which does 'exec foo-bin' or 'exec foo.bin' |
2472 | + yield return "[.-]bin"; |
2473 | + // some python apps have a script 'foo' for 'python foo.py' |
2474 | + yield return "\\.py"; |
2475 | + // some apps append versions, such as '-1' or '-3.0' |
2476 | + yield return "(-)?\\d+(\\.\\d+)?"; |
2477 | + } |
2478 | + } |
2479 | + |
2480 | + List<Regex> BuildSuffixFilters () |
2481 | + { |
2482 | + return new List<Regex> (SuffixStrings.Select (s => new Regex (s + "$"))); |
2483 | + } |
2484 | |
2485 | IEnumerable<int> PidAndParents (int pid) |
2486 | { |
2487 | @@ -760,15 +344,15 @@ |
2488 | foreach (string sanitizedCmd in result |
2489 | .Select (s => s.Split (new []{'/', '\\'}).Last ()) |
2490 | .Distinct () |
2491 | - .Where (s => !string.IsNullOrEmpty (s) && !prefix_filters.Any (f => f.IsMatch (s)))) { |
2492 | + .Where (s => !string.IsNullOrEmpty (s) && !PrefixFilters.Any (f => f.IsMatch (s)))) { |
2493 | |
2494 | yield return sanitizedCmd; |
2495 | |
2496 | - if (remap_items.ContainsKey (sanitizedCmd)) |
2497 | - yield return remap_items [sanitizedCmd]; |
2498 | + if (DockServices.DesktopItems.Remaps.ContainsKey (sanitizedCmd)) |
2499 | + yield return DockServices.DesktopItems.Remaps [sanitizedCmd]; |
2500 | |
2501 | // if it ends with a special suffix, strip the suffix and return an additional result |
2502 | - foreach (Regex f in suffix_filters) |
2503 | + foreach (Regex f in SuffixFilters) |
2504 | if (f.IsMatch (sanitizedCmd)) |
2505 | yield return f.Replace (sanitizedCmd, ""); |
2506 | } |
2507 | @@ -795,146 +379,6 @@ |
2508 | return name.Substring (6); |
2509 | } |
2510 | |
2511 | - Dictionary<string, DesktopItem> BuildClassStrings () |
2512 | - { |
2513 | - Dictionary<string, DesktopItem> result = new Dictionary<string, DesktopItem> (); |
2514 | - |
2515 | - foreach (DesktopItem item in DesktopItems) { |
2516 | - if (item == null || !item.HasAttribute ("StartupWMClass")) |
2517 | - continue; |
2518 | - |
2519 | - if (item.HasAttribute ("NoDisplay") && item.GetBool ("NoDisplay")) |
2520 | - continue; |
2521 | - |
2522 | - if (item.HasAttribute ("X-Docky-NoMatch") && item.GetBool ("X-Docky-NoMatch")) |
2523 | - continue; |
2524 | - |
2525 | - string cls = item.GetString ("StartupWMClass").Trim (); |
2526 | - // we only want exactly 1 launcher, and so if we already have one we use that |
2527 | - // otherwise it will prefer global over local launchers |
2528 | - if (!result.ContainsKey (cls)) |
2529 | - result [cls] = item; |
2530 | - } |
2531 | - |
2532 | - return result; |
2533 | - } |
2534 | - |
2535 | - Dictionary<string, List<DesktopItem>> BuildExecStrings () |
2536 | - { |
2537 | - Dictionary<string, List<DesktopItem>> result = new Dictionary<string, List<DesktopItem>> (); |
2538 | - |
2539 | - foreach (DesktopItem item in DesktopItems) { |
2540 | - if (item == null || !item.HasAttribute ("Exec")) |
2541 | - continue; |
2542 | - |
2543 | - if (item.HasAttribute ("NoDisplay") && item.GetBool ("NoDisplay")) |
2544 | - continue; |
2545 | - |
2546 | - if (item.HasAttribute ("X-Docky-NoMatch") && item.GetBool ("X-Docky-NoMatch")) |
2547 | - continue; |
2548 | - |
2549 | - string exec = item.GetString ("Exec").Trim (); |
2550 | - string vexec = null; |
2551 | - |
2552 | - // for openoffice |
2553 | - if (exec.Contains (' ') && |
2554 | - (exec.StartsWith ("ooffice") || exec.StartsWith ("openoffice") || exec.StartsWith ("soffice"))) { |
2555 | - vexec = "ooffice" + exec.Split (' ') [1]; |
2556 | - |
2557 | - // for wine apps |
2558 | - } else if ((exec.Contains ("env WINEPREFIX=") && exec.Contains (" wine ")) || |
2559 | - exec.Contains ("wine ")) { |
2560 | - int startIndex = exec.IndexOf ("wine ") + 5; // length of 'wine ' |
2561 | - // CommandLineForPid already splits based on \\ and takes the last entry, so do the same here |
2562 | - vexec = exec.Substring (startIndex).Split (new [] {@"\\"}, StringSplitOptions.RemoveEmptyEntries).Last (); |
2563 | - // remove the trailing " and anything after it |
2564 | - if (vexec.Contains ("\"")) |
2565 | - vexec = vexec.Substring (0, vexec.IndexOf ("\"")); |
2566 | - |
2567 | - // for crossover apps |
2568 | - } else if (exec.Contains (".cxoffice") || (item.HasAttribute ("X-Created-By") && item.GetString ("X-Created-By").Contains ("cxoffice"))) { |
2569 | - // The exec is actually another file that uses exec to launch the actual app. |
2570 | - exec = exec.Replace ("\"", ""); |
2571 | - |
2572 | - GLib.File launcher = GLib.FileFactory.NewForPath (exec); |
2573 | - if (!launcher.Exists) { |
2574 | - Log<WindowMatcher>.Warn ("Crossover launcher decoded as: {0}, but does not exist.", launcher.Path); |
2575 | - continue; |
2576 | - } |
2577 | - |
2578 | - string execLine = ""; |
2579 | - using (GLib.DataInputStream stream = new GLib.DataInputStream (launcher.Read (null))) { |
2580 | - ulong len; |
2581 | - string line; |
2582 | - try { |
2583 | - while ((line = stream.ReadLine (out len, null)) != null) { |
2584 | - if (line.StartsWith ("exec")) { |
2585 | - execLine = line; |
2586 | - break; |
2587 | - } |
2588 | - } |
2589 | - } catch (Exception e) { |
2590 | - Log<WindowMatcher>.Error (e.Message); |
2591 | - Log<WindowMatcher>.Error (e.StackTrace); |
2592 | - continue; |
2593 | - } |
2594 | - } |
2595 | - |
2596 | - // if no exec line was found, bail |
2597 | - if (string.IsNullOrEmpty (execLine)) |
2598 | - continue; |
2599 | - |
2600 | - // get the relevant part from the execLine |
2601 | - string [] parts = execLine.Split (new [] {'\"'}); |
2602 | - // find the part that contains C:/path/to/app.lnk |
2603 | - if (parts.Any (part => part.StartsWith ("C:"))) { |
2604 | - vexec = parts.First (part => part.StartsWith ("C:")); |
2605 | - // and take only app.lnk (this is what is exposed to ps -ef) |
2606 | - vexec = vexec.Split (new [] {'/'}).Last (); |
2607 | - } else { |
2608 | - continue; |
2609 | - } |
2610 | - |
2611 | - // other apps |
2612 | - } else { |
2613 | - string [] parts = exec.Split (' '); |
2614 | - |
2615 | - vexec = parts |
2616 | - .DefaultIfEmpty (null) |
2617 | - .Select (part => part.Split (new [] { |
2618 | - '/', |
2619 | - '\\' |
2620 | - }).Last ()) |
2621 | - .Where (part => !prefix_filters.Any (f => f.IsMatch (part))) |
2622 | - .FirstOrDefault (); |
2623 | - |
2624 | - // for AIR apps |
2625 | - if (vexec != null && vexec.Contains ('\'')) { |
2626 | - string strippedExec = vexec.Replace ("'", ""); |
2627 | - if (!result.ContainsKey (strippedExec)) |
2628 | - result [strippedExec] = new List<DesktopItem> (); |
2629 | - result [strippedExec].Add (item); |
2630 | - } |
2631 | - } |
2632 | - |
2633 | - if (vexec == null) |
2634 | - continue; |
2635 | - |
2636 | - if (!result.ContainsKey (vexec)) |
2637 | - result [vexec] = new List<DesktopItem> (); |
2638 | - |
2639 | - result [vexec].Add (item); |
2640 | - foreach (Regex f in suffix_filters) |
2641 | - if (f.IsMatch (vexec)) { |
2642 | - string vexecStripped = f.Replace (vexec, ""); |
2643 | - if (!result.ContainsKey (vexecStripped)) |
2644 | - result [vexecStripped] = new List<DesktopItem> (); |
2645 | - result [vexecStripped].Add (item); |
2646 | - } |
2647 | - } |
2648 | - |
2649 | - return result; |
2650 | - } |
2651 | #endregion |
2652 | } |
2653 | } |
2654 | |
2655 | === added directory 'Docky.Services/Docky.Services/Windows' |
2656 | === renamed file 'Docky.Windowing/Windowing/Position.cs' => 'Docky.Services/Docky.Services/Windows/Position.cs' |
2657 | --- Docky.Windowing/Windowing/Position.cs 2009-09-03 05:09:05 +0000 |
2658 | +++ Docky.Services/Docky.Services/Windows/Position.cs 2010-08-14 22:27:42 +0000 |
2659 | @@ -17,10 +17,9 @@ |
2660 | |
2661 | using System; |
2662 | |
2663 | -namespace Docky.Windowing |
2664 | +namespace Docky.Services.Windows |
2665 | { |
2666 | |
2667 | - |
2668 | public enum Position { |
2669 | Left = 0, |
2670 | Right, |
2671 | |
2672 | === renamed file 'Docky.Windowing/Windowing/WindowControl.cs' => 'Docky.Services/Docky.Services/Windows/WindowControl.cs' |
2673 | --- Docky.Windowing/Windowing/WindowControl.cs 2009-09-23 18:32:24 +0000 |
2674 | +++ Docky.Services/Docky.Services/Windows/WindowControl.cs 2010-08-14 22:27:42 +0000 |
2675 | @@ -22,10 +22,9 @@ |
2676 | |
2677 | using Wnck; |
2678 | |
2679 | -namespace Docky.Windowing |
2680 | +namespace Docky.Services.Windows |
2681 | { |
2682 | |
2683 | - |
2684 | public static class WindowControl |
2685 | { |
2686 | |
2687 | |
2688 | === added directory 'Docky.Services/Docky.Services/Xlib' |
2689 | === renamed file 'Docky.Windowing/Xlib/X11Atoms.cs' => 'Docky.Services/Docky.Services/Xlib/X11Atoms.cs' |
2690 | --- Docky.Windowing/Xlib/X11Atoms.cs 2009-09-03 05:09:05 +0000 |
2691 | +++ Docky.Services/Docky.Services/Xlib/X11Atoms.cs 2010-08-14 22:27:42 +0000 |
2692 | @@ -23,7 +23,7 @@ |
2693 | |
2694 | using System; |
2695 | |
2696 | -namespace Docky.Xlib { |
2697 | +namespace Docky.Services.Xlib { |
2698 | |
2699 | public class X11Atoms { |
2700 | |
2701 | @@ -179,7 +179,7 @@ |
2702 | |
2703 | |
2704 | X11Atoms (Gdk.Display dsp) { |
2705 | - IntPtr display = Xlib.GdkDisplayXDisplay (dsp); |
2706 | + IntPtr display = X.GdkDisplayXDisplay (dsp); |
2707 | // make sure this array stays in sync with the statements below |
2708 | string [] atom_names = new string[] { |
2709 | "WM_PROTOCOLS", |
2710 | @@ -255,7 +255,7 @@ |
2711 | |
2712 | IntPtr[] atoms = new IntPtr [atom_names.Length];; |
2713 | |
2714 | - Xlib.XInternAtoms (display, atom_names, atom_names.Length, false, atoms); |
2715 | + X.XInternAtoms (display, atom_names, atom_names.Length, false, atoms); |
2716 | |
2717 | int off = 0; |
2718 | WM_PROTOCOLS = atoms [off++]; |
2719 | |
2720 | === renamed file 'Docky.Windowing/Xlib/Xlib.cs' => 'Docky.Services/Docky.Services/Xlib/Xlib.cs' |
2721 | --- Docky.Windowing/Xlib/Xlib.cs 2009-09-03 05:09:05 +0000 |
2722 | +++ Docky.Services/Docky.Services/Xlib/Xlib.cs 2010-08-14 22:27:42 +0000 |
2723 | @@ -22,12 +22,9 @@ |
2724 | // |
2725 | |
2726 | using System; |
2727 | -using System.Text; |
2728 | using System.Runtime.InteropServices; |
2729 | -using System.Collections.Generic; |
2730 | -using System.Linq; |
2731 | |
2732 | -namespace Docky.Xlib { |
2733 | +namespace Docky.Services.Xlib { |
2734 | |
2735 | public enum PropertyMode |
2736 | { |
2737 | @@ -67,9 +64,9 @@ |
2738 | StaticGravity = 10, |
2739 | } |
2740 | |
2741 | - public static class Xlib { |
2742 | + public static class X { |
2743 | const string libX11 = "X11"; |
2744 | - const string libGdkX11 = "libgdk-x11"; |
2745 | + const string libGdkX11 = "libgdk-x11-2.0"; |
2746 | |
2747 | [DllImport (libGdkX11)] |
2748 | static extern IntPtr gdk_x11_drawable_get_xid (IntPtr handle); |
2749 | |
2750 | === modified file 'Docky.Services/Makefile.am' |
2751 | --- Docky.Services/Makefile.am 2010-07-11 06:39:31 +0000 |
2752 | +++ Docky.Services/Makefile.am 2010-08-14 22:27:42 +0000 |
2753 | @@ -8,31 +8,40 @@ |
2754 | |
2755 | FILES = \ |
2756 | AssemblyInfo.cs \ |
2757 | + Docky.Services/Applications/DesktopFileChangedEventArgs.cs \ |
2758 | + Docky.Services/Applications/DesktopItem.cs \ |
2759 | + Docky.Services/Helpers/Helper.cs \ |
2760 | + Docky.Services/Helpers/HelperStatusChangedEventArgs.cs \ |
2761 | + Docky.Services/Helpers/HelperMetadata.cs \ |
2762 | + Docky.Services/Extensions/GdkPixbufExtension.cs \ |
2763 | Docky.Services/Extensions/GLibFileExtension.cs \ |
2764 | Docky.Services/Extensions/GLibMountExtension.cs \ |
2765 | - Docky.Services/Extensions/GdkPixbufExtension.cs \ |
2766 | Docky.Services/Extensions/GtkIconThemeExtension.cs \ |
2767 | + Docky.Services/Extensions/WnckWindowExtension.cs \ |
2768 | Docky.Services/Logging/ConsoleCrayon.cs \ |
2769 | + Docky.Services/Logging/ConsoleLog.cs \ |
2770 | Docky.Services/Logging/LogBase.cs \ |
2771 | - Docky.Services/Logging/ConsoleLog.cs \ |
2772 | + Docky.Services/Preferences/IPreferences.cs \ |
2773 | + Docky.Services/Preferences/Preferences.cs \ |
2774 | + Docky.Services/Preferences/PreferencesChangedEventArgs.cs \ |
2775 | + Docky.Services/Windows/Position.cs \ |
2776 | + Docky.Services/Windows/WindowControl.cs \ |
2777 | + Docky.Services/Xlib/X11Atoms.cs \ |
2778 | + Docky.Services/Xlib/Xlib.cs \ |
2779 | + Docky.Services/ConnectionStatusChangeEventArgs.cs \ |
2780 | + Docky.Services/DesktopItemService.cs \ |
2781 | + Docky.Services/DockServices.cs \ |
2782 | + Docky.Services/DrawingService.cs \ |
2783 | + Docky.Services/HelperService.cs \ |
2784 | Docky.Services/Log.cs \ |
2785 | Docky.Services/LogTSender.cs \ |
2786 | - Docky.Services/ConnectionStatusChangeEventArgs.cs \ |
2787 | - Docky.Services/IPreferences.cs \ |
2788 | + Docky.Services/NativeInterop.cs \ |
2789 | + Docky.Services/NotificationService.cs \ |
2790 | + Docky.Services/PathsService.cs \ |
2791 | Docky.Services/PreferencesService.cs \ |
2792 | - Docky.Services/DockServices.cs \ |
2793 | Docky.Services/SystemService.cs \ |
2794 | Docky.Services/ThemeService.cs \ |
2795 | - Docky.Services/HelperService.cs \ |
2796 | - Docky.Services/Helper.cs \ |
2797 | - Docky.Services/HelperStatusChangedEventArgs.cs \ |
2798 | - Docky.Services/HelperMetadata.cs \ |
2799 | - Docky.Services/DrawingService.cs \ |
2800 | - Docky.Services/NotificationService.cs \ |
2801 | - Docky.Services/Preferences.cs \ |
2802 | - Docky.Services/NativeInterop.cs \ |
2803 | - Docky.Services/PathsService.cs \ |
2804 | - Docky.Services/PreferencesChangedEventArgs.cs \ |
2805 | + Docky.Services/WindowMatcherService.cs \ |
2806 | Gtk/MountOperation.cs \ |
2807 | GLibSharp/AsyncReadyCallbackNative.cs |
2808 | |
2809 | @@ -57,6 +66,7 @@ |
2810 | $(GTK_SHARP_20_LIBS) \ |
2811 | $(GNOME_KEYRING_SHARP_LIBS) \ |
2812 | $(NOTIFY_SHARP_LIBS) \ |
2813 | + $(WNCK_SHARP_10_LIBS) \ |
2814 | $(LIBRSVG_SHARP_LIBS) |
2815 | |
2816 | EXTRA_DIST += Docky.Services.dll.config |
2817 | |
2818 | === removed directory 'Docky.Windowing' |
2819 | === removed file 'Docky.Windowing/AssemblyInfo.cs' |
2820 | --- Docky.Windowing/AssemblyInfo.cs 2009-08-31 23:37:37 +0000 |
2821 | +++ Docky.Windowing/AssemblyInfo.cs 1970-01-01 00:00:00 +0000 |
2822 | @@ -1,42 +0,0 @@ |
2823 | -// |
2824 | -// Copyright (C) 2009 Jason Smith |
2825 | -// |
2826 | -// This program is free software: you can redistribute it and/or modify |
2827 | -// it under the terms of the GNU General Public License as published by |
2828 | -// the Free Software Foundation, either version 3 of the License, or |
2829 | -// (at your option) any later version. |
2830 | -// |
2831 | -// This program is distributed in the hope that it will be useful, |
2832 | -// but WITHOUT ANY WARRANTY; without even the implied warranty of |
2833 | -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2834 | -// GNU General Public License for more details. |
2835 | -// |
2836 | -// You should have received a copy of the GNU General Public License |
2837 | -// along with this program. If not, see <http://www.gnu.org/licenses/>. |
2838 | -// |
2839 | -using System.Reflection; |
2840 | -using System.Runtime.CompilerServices; |
2841 | - |
2842 | -// Information about this assembly is defined by the following attributes. |
2843 | -// Change them to the values specific to your project. |
2844 | - |
2845 | -[assembly: AssemblyTitle("Docky.Windowing")] |
2846 | -[assembly: AssemblyDescription("")] |
2847 | -[assembly: AssemblyConfiguration("")] |
2848 | -[assembly: AssemblyCompany("")] |
2849 | -[assembly: AssemblyProduct("")] |
2850 | -[assembly: AssemblyCopyright("")] |
2851 | -[assembly: AssemblyTrademark("")] |
2852 | -[assembly: AssemblyCulture("")] |
2853 | - |
2854 | -// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". |
2855 | -// The form "{Major}.{Minor}.*" will automatically update the build and revision, |
2856 | -// and "{Major}.{Minor}.{Build}.*" will update just the revision. |
2857 | - |
2858 | -[assembly: AssemblyVersion("1.0.*")] |
2859 | - |
2860 | -// The following attributes are used to specify the signing key for the assembly, |
2861 | -// if desired. See the Mono documentation for more information about signing. |
2862 | - |
2863 | -//[assembly: AssemblyDelaySign(false)] |
2864 | -//[assembly: AssemblyKeyFile("")] |
2865 | |
2866 | === removed file 'Docky.Windowing/Docky.Windowing.csproj' |
2867 | --- Docky.Windowing/Docky.Windowing.csproj 2010-06-01 12:53:24 +0000 |
2868 | +++ Docky.Windowing/Docky.Windowing.csproj 1970-01-01 00:00:00 +0000 |
2869 | @@ -1,85 +0,0 @@ |
2870 | -<?xml version="1.0" encoding="utf-8"?> |
2871 | -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> |
2872 | - <PropertyGroup> |
2873 | - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
2874 | - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
2875 | - <ProductVersion>9.0.21022</ProductVersion> |
2876 | - <SchemaVersion>2.0</SchemaVersion> |
2877 | - <ProjectGuid>{888FCD95-7C79-45C4-A744-9C840DF4B9B0}</ProjectGuid> |
2878 | - <OutputType>Library</OutputType> |
2879 | - <AssemblyName>Docky.Windowing</AssemblyName> |
2880 | - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> |
2881 | - <ReleaseVersion>2.0</ReleaseVersion> |
2882 | - <RootNamespace>Docky.Windowing</RootNamespace> |
2883 | - </PropertyGroup> |
2884 | - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
2885 | - <DebugSymbols>true</DebugSymbols> |
2886 | - <DebugType>full</DebugType> |
2887 | - <Optimize>false</Optimize> |
2888 | - <OutputPath>bin\Debug</OutputPath> |
2889 | - <DefineConstants>DEBUG</DefineConstants> |
2890 | - <ErrorReport>prompt</ErrorReport> |
2891 | - <WarningLevel>4</WarningLevel> |
2892 | - <ConsolePause>false</ConsolePause> |
2893 | - </PropertyGroup> |
2894 | - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
2895 | - <DebugType>none</DebugType> |
2896 | - <Optimize>false</Optimize> |
2897 | - <OutputPath>bin\Release</OutputPath> |
2898 | - <ErrorReport>prompt</ErrorReport> |
2899 | - <WarningLevel>4</WarningLevel> |
2900 | - <ConsolePause>false</ConsolePause> |
2901 | - </PropertyGroup> |
2902 | - <ItemGroup> |
2903 | - <Reference Include="System" /> |
2904 | - <Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f"> |
2905 | - <Package>gtk-sharp-2.0</Package> |
2906 | - </Reference> |
2907 | - <Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f"> |
2908 | - <Package>glib-sharp-2.0</Package> |
2909 | - </Reference> |
2910 | - <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f"> |
2911 | - <Package>gtk-sharp-2.0</Package> |
2912 | - </Reference> |
2913 | - <Reference Include="Mono.Cairo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> |
2914 | - <Reference Include="System.Core"> |
2915 | - <RequiredTargetFramework>3.5</RequiredTargetFramework> |
2916 | - </Reference> |
2917 | - <Reference Include="wnck-sharp, Version=2.20.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f"> |
2918 | - <Package>wnck-sharp-1.0</Package> |
2919 | - </Reference> |
2920 | - <Reference Include="Mono.Posix" /> |
2921 | - <Reference Include="gio-sharp, Version=2.14.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f"> |
2922 | - <Package>gio-sharp-2.0</Package> |
2923 | - </Reference> |
2924 | - </ItemGroup> |
2925 | - <ItemGroup> |
2926 | - <Compile Include="AssemblyInfo.cs" /> |
2927 | - <Compile Include="Wnck\Window_Extensions.cs" /> |
2928 | - <Compile Include="Windowing\ClickAction.cs" /> |
2929 | - <Compile Include="Windowing\WindowControl.cs" /> |
2930 | - <Compile Include="Xlib\X11Atoms.cs" /> |
2931 | - <Compile Include="Xlib\Xlib.cs" /> |
2932 | - <Compile Include="Windowing\Position.cs" /> |
2933 | - <Compile Include="Windowing\WindowMatcher.cs" /> |
2934 | - <Compile Include="Windowing\DesktopItem.cs" /> |
2935 | - <Compile Include="Windowing\DesktopFileChangedEventArgs.cs" /> |
2936 | - </ItemGroup> |
2937 | - <ItemGroup> |
2938 | - <Folder Include="Wnck\" /> |
2939 | - <Folder Include="Windowing\" /> |
2940 | - <Folder Include="Xlib\" /> |
2941 | - </ItemGroup> |
2942 | - <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> |
2943 | - <ItemGroup> |
2944 | - <None Include="Docky.Windowing.dll.config"> |
2945 | - <CopyToOutputDirectory>Always</CopyToOutputDirectory> |
2946 | - </None> |
2947 | - </ItemGroup> |
2948 | - <ItemGroup> |
2949 | - <ProjectReference Include="..\Docky.Services\Docky.Services.csproj"> |
2950 | - <Project>{8A6E0EDD-6443-4F99-9EAC-D9CC906F080D}</Project> |
2951 | - <Name>Docky.Services</Name> |
2952 | - </ProjectReference> |
2953 | - </ItemGroup> |
2954 | -</Project> |
2955 | \ No newline at end of file |
2956 | |
2957 | === removed file 'Docky.Windowing/Docky.Windowing.dll.config' |
2958 | --- Docky.Windowing/Docky.Windowing.dll.config 2009-11-14 04:04:00 +0000 |
2959 | +++ Docky.Windowing/Docky.Windowing.dll.config 1970-01-01 00:00:00 +0000 |
2960 | @@ -1,4 +0,0 @@ |
2961 | -<configuration> |
2962 | - <dllmap dll="X11" target="libX11.so.6"/> |
2963 | - <dllmap dll="libgdk-x11" target="libgdk-x11-2.0.so.0"/> |
2964 | -</configuration> |
2965 | \ No newline at end of file |
2966 | |
2967 | === removed file 'Docky.Windowing/Makefile.am' |
2968 | --- Docky.Windowing/Makefile.am 2009-12-11 09:59:30 +0000 |
2969 | +++ Docky.Windowing/Makefile.am 1970-01-01 00:00:00 +0000 |
2970 | @@ -1,36 +0,0 @@ |
2971 | -# Simple component buildsystem |
2972 | -include $(top_srcdir)/build.rules.core.mk |
2973 | - |
2974 | -ASSEMBLY = Docky.Windowing |
2975 | -TARGET = library |
2976 | - |
2977 | -PKG_CONFIG_FILES = docky.windowing.pc |
2978 | - |
2979 | -FILES = \ |
2980 | - AssemblyInfo.cs \ |
2981 | - Wnck/Window_Extensions.cs \ |
2982 | - Windowing/ClickAction.cs \ |
2983 | - Windowing/DesktopItem.cs \ |
2984 | - Windowing/WindowControl.cs \ |
2985 | - Xlib/X11Atoms.cs \ |
2986 | - Xlib/Xlib.cs \ |
2987 | - Windowing/Position.cs \ |
2988 | - Windowing/DesktopFileChangedEventArgs.cs \ |
2989 | - Windowing/WindowMatcher.cs |
2990 | - |
2991 | -PROJECT_REFERENCES= \ |
2992 | - Docky.Services |
2993 | - |
2994 | -REFERENCES = \ |
2995 | - System \ |
2996 | - System.Core \ |
2997 | - Mono.Posix \ |
2998 | - $(GLIB_SHARP_20_LIBS) \ |
2999 | - $(GIO_SHARP_LIBS) \ |
3000 | - $(GTK_SHARP_20_LIBS) \ |
3001 | - $(WNCK_SHARP_10_LIBS) \ |
3002 | - $(MONO_CAIRO_LIBS) |
3003 | - |
3004 | -EXTRA_DIST += Docky.Windowing.dll.config |
3005 | - |
3006 | -module_DATA += Docky.Windowing.dll.config |
3007 | |
3008 | === removed directory 'Docky.Windowing/Windowing' |
3009 | === removed file 'Docky.Windowing/Windowing/ClickAction.cs' |
3010 | --- Docky.Windowing/Windowing/ClickAction.cs 2009-09-03 05:09:05 +0000 |
3011 | +++ Docky.Windowing/Windowing/ClickAction.cs 1970-01-01 00:00:00 +0000 |
3012 | @@ -1,31 +0,0 @@ |
3013 | -// |
3014 | -// Copyright (C) 2009 GNOME Do |
3015 | -// |
3016 | -// This program is free software: you can redistribute it and/or modify |
3017 | -// it under the terms of the GNU General Public License as published by |
3018 | -// the Free Software Foundation, either version 3 of the License, or |
3019 | -// (at your option) any later version. |
3020 | -// |
3021 | -// This program is distributed in the hope that it will be useful, |
3022 | -// but WITHOUT ANY WARRANTY; without even the implied warranty of |
3023 | -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3024 | -// GNU General Public License for more details. |
3025 | -// |
3026 | -// You should have received a copy of the GNU General Public License |
3027 | -// along with this program. If not, see <http://www.gnu.org/licenses/>. |
3028 | -// |
3029 | - |
3030 | -using System; |
3031 | - |
3032 | -namespace Docky.Windowing |
3033 | -{ |
3034 | - |
3035 | - |
3036 | - public enum ClickAction |
3037 | - { |
3038 | - Focus, |
3039 | - Minimize, |
3040 | - Restore, |
3041 | - None, |
3042 | - } |
3043 | -} |
3044 | |
3045 | === removed directory 'Docky.Windowing/Wnck' |
3046 | === removed directory 'Docky.Windowing/Xlib' |
3047 | === removed file 'Docky.Windowing/docky.windowing.pc.in' |
3048 | --- Docky.Windowing/docky.windowing.pc.in 2009-09-16 09:36:05 +0000 |
3049 | +++ Docky.Windowing/docky.windowing.pc.in 1970-01-01 00:00:00 +0000 |
3050 | @@ -1,5 +0,0 @@ |
3051 | -Name: Docky.Windowing |
3052 | -Description: Docky Windowing. |
3053 | -Version: @ABI_VERSION@ |
3054 | - |
3055 | -Libs: -r:@expanded_libdir@/@PACKAGE@/Docky.Windowing.dll |
3056 | |
3057 | === modified file 'Docky/Docky.csproj' |
3058 | --- Docky/Docky.csproj 2010-07-28 06:24:54 +0000 |
3059 | +++ Docky/Docky.csproj 2010-08-14 22:27:42 +0000 |
3060 | @@ -144,10 +144,6 @@ |
3061 | <Project>{AB6E0EDD-6443-4F99-9EAC-DABC906F080D}</Project> |
3062 | <Name>Docky.Items</Name> |
3063 | </ProjectReference> |
3064 | - <ProjectReference Include="..\Docky.Windowing\Docky.Windowing.csproj"> |
3065 | - <Project>{888FCD95-7C79-45C4-A744-9C840DF4B9B0}</Project> |
3066 | - <Name>Docky.Windowing</Name> |
3067 | - </ProjectReference> |
3068 | <ProjectReference Include="..\Docky.DBus\Docky.DBus.csproj"> |
3069 | <Project>{487D3B93-FAAF-4734-B337-85810A60ACCF}</Project> |
3070 | <Name>Docky.DBus</Name> |
3071 | |
3072 | === modified file 'Docky/Docky/ConfigurationWindow.cs' |
3073 | --- Docky/Docky/ConfigurationWindow.cs 2010-06-29 13:09:06 +0000 |
3074 | +++ Docky/Docky/ConfigurationWindow.cs 2010-08-14 22:27:42 +0000 |
3075 | @@ -32,6 +32,7 @@ |
3076 | |
3077 | using Docky.Interface; |
3078 | using Docky.Services; |
3079 | +using Docky.Services.Helpers; |
3080 | using Docky.Widgets; |
3081 | using Docky.Items; |
3082 | |
3083 | |
3084 | === modified file 'Docky/Docky/DockController.cs' |
3085 | --- Docky/Docky/DockController.cs 2010-08-01 11:16:08 +0000 |
3086 | +++ Docky/Docky/DockController.cs 2010-08-14 22:27:42 +0000 |
3087 | @@ -33,6 +33,7 @@ |
3088 | using Docky.Items; |
3089 | using Docky.Interface; |
3090 | using Docky.Services; |
3091 | +using Docky.Services.Prefs; |
3092 | |
3093 | namespace Docky |
3094 | { |
3095 | |
3096 | === modified file 'Docky/Docky/Docky.cs' |
3097 | --- Docky/Docky/Docky.cs 2010-07-28 06:24:54 +0000 |
3098 | +++ Docky/Docky/Docky.cs 2010-08-14 22:27:42 +0000 |
3099 | @@ -65,7 +65,7 @@ |
3100 | DockServices.System.SetProcessName ("docky"); |
3101 | |
3102 | // cache main thread |
3103 | - SystemService.MainThread = Thread.CurrentThread; |
3104 | + DockServices.System.MainThread = Thread.CurrentThread; |
3105 | |
3106 | // check compositing |
3107 | CheckComposite (); |
3108 | |
3109 | === modified file 'Docky/Docky/HelperTile.cs' |
3110 | --- Docky/Docky/HelperTile.cs 2010-06-29 13:09:06 +0000 |
3111 | +++ Docky/Docky/HelperTile.cs 2010-08-14 22:27:42 +0000 |
3112 | @@ -22,11 +22,11 @@ |
3113 | |
3114 | using Docky.Widgets; |
3115 | using Docky.Services; |
3116 | +using Docky.Services.Helpers; |
3117 | |
3118 | namespace Docky |
3119 | { |
3120 | |
3121 | - |
3122 | public class HelperTile : AbstractTileObject |
3123 | { |
3124 | public Helper Helper { get; private set; } |
3125 | |
3126 | === modified file 'Docky/Docky/Interface/AutohideManager.cs' |
3127 | --- Docky/Docky/Interface/AutohideManager.cs 2010-06-27 02:02:26 +0000 |
3128 | +++ Docky/Docky/Interface/AutohideManager.cs 2010-08-14 22:27:42 +0000 |
3129 | @@ -28,6 +28,7 @@ |
3130 | using Wnck; |
3131 | |
3132 | using Docky.Services; |
3133 | +using Docky.Services.Prefs; |
3134 | |
3135 | namespace Docky.Interface |
3136 | { |
3137 | |
3138 | === modified file 'Docky/Docky/Interface/DockDragTracker.cs' |
3139 | --- Docky/Docky/Interface/DockDragTracker.cs 2010-06-29 16:27:45 +0000 |
3140 | +++ Docky/Docky/Interface/DockDragTracker.cs 2010-08-14 22:27:42 +0000 |
3141 | @@ -17,23 +17,17 @@ |
3142 | |
3143 | using System; |
3144 | using System.Collections.Generic; |
3145 | -using System.Collections.ObjectModel; |
3146 | using System.Linq; |
3147 | -using System.Reflection; |
3148 | using System.Text; |
3149 | using System.Text.RegularExpressions; |
3150 | |
3151 | -using Cairo; |
3152 | using Gdk; |
3153 | using Gtk; |
3154 | -using Wnck; |
3155 | |
3156 | using Docky.Items; |
3157 | using Docky.CairoHelper; |
3158 | -using Docky.Menus; |
3159 | -using Docky.Painters; |
3160 | using Docky.Services; |
3161 | -using Docky.Xlib; |
3162 | +using Docky.Services.Prefs; |
3163 | |
3164 | namespace Docky.Interface |
3165 | { |
3166 | |
3167 | === modified file 'Docky/Docky/Interface/DockPreferences.cs' |
3168 | --- Docky/Docky/Interface/DockPreferences.cs 2010-08-01 19:56:58 +0000 |
3169 | +++ Docky/Docky/Interface/DockPreferences.cs 2010-08-14 22:27:42 +0000 |
3170 | @@ -23,6 +23,7 @@ |
3171 | using System.Linq; |
3172 | using System.IO; |
3173 | using System.Text; |
3174 | +using System.Text.RegularExpressions; |
3175 | |
3176 | using Cairo; |
3177 | using Gdk; |
3178 | @@ -30,7 +31,7 @@ |
3179 | |
3180 | using Docky.Items; |
3181 | using Docky.Services; |
3182 | -using System.Text.RegularExpressions; |
3183 | +using Docky.Services.Prefs; |
3184 | |
3185 | namespace Docky.Interface |
3186 | { |
3187 | |
3188 | === modified file 'Docky/Docky/Interface/DockWindow.cs' |
3189 | --- Docky/Docky/Interface/DockWindow.cs 2010-07-31 16:32:24 +0000 |
3190 | +++ Docky/Docky/Interface/DockWindow.cs 2010-08-14 22:27:42 +0000 |
3191 | @@ -18,11 +18,7 @@ |
3192 | using System; |
3193 | using System.Collections.Generic; |
3194 | using System.Collections.ObjectModel; |
3195 | -using System.Diagnostics; |
3196 | using System.Linq; |
3197 | -using System.Reflection; |
3198 | -using System.Text; |
3199 | -using System.Text.RegularExpressions; |
3200 | |
3201 | using Cairo; |
3202 | using Gdk; |
3203 | @@ -36,7 +32,7 @@ |
3204 | using Docky.Menus; |
3205 | using Docky.Painters; |
3206 | using Docky.Services; |
3207 | -using Docky.Xlib; |
3208 | +using Docky.Services.Xlib; |
3209 | |
3210 | namespace Docky.Interface |
3211 | { |
3212 | @@ -2787,10 +2783,10 @@ |
3213 | |
3214 | IntPtr [] first_struts = new [] { struts [0], struts [1], struts [2], struts [3] }; |
3215 | |
3216 | - Xlib.Xlib.XChangeProperty (GdkWindow, atoms._NET_WM_STRUT_PARTIAL, atoms.XA_CARDINAL, |
3217 | + X.XChangeProperty (GdkWindow, atoms._NET_WM_STRUT_PARTIAL, atoms.XA_CARDINAL, |
3218 | (int) PropertyMode.PropModeReplace, struts); |
3219 | |
3220 | - Xlib.Xlib.XChangeProperty (GdkWindow, atoms._NET_WM_STRUT, atoms.XA_CARDINAL, |
3221 | + X.XChangeProperty (GdkWindow, atoms._NET_WM_STRUT, atoms.XA_CARDINAL, |
3222 | (int) PropertyMode.PropModeReplace, first_struts); |
3223 | } |
3224 | #endregion |
3225 | |
3226 | === modified file 'Docky/Docky/Items/DockyItem.cs' |
3227 | --- Docky/Docky/Items/DockyItem.cs 2010-08-07 21:02:45 +0000 |
3228 | +++ Docky/Docky/Items/DockyItem.cs 2010-08-14 22:27:42 +0000 |
3229 | @@ -27,6 +27,7 @@ |
3230 | |
3231 | using Docky.Menus; |
3232 | using Docky.Services; |
3233 | +using Docky.Services.Prefs; |
3234 | |
3235 | namespace Docky.Items |
3236 | { |
3237 | |
3238 | === modified file 'Docky/Makefile.am' |
3239 | --- Docky/Makefile.am 2010-07-28 06:24:54 +0000 |
3240 | +++ Docky/Makefile.am 2010-08-14 22:27:42 +0000 |
3241 | @@ -58,7 +58,6 @@ |
3242 | Docky.DBus \ |
3243 | Docky.Items \ |
3244 | Docky.Services \ |
3245 | - Docky.Windowing \ |
3246 | Docky.Widgets |
3247 | |
3248 | REFERENCES = \ |
3249 | |
3250 | === modified file 'Docky/gtk-gui/gui.stetic' |
3251 | --- Docky/gtk-gui/gui.stetic 2010-07-18 10:49:09 +0000 |
3252 | +++ Docky/gtk-gui/gui.stetic 2010-08-14 22:27:42 +0000 |
3253 | @@ -9,7 +9,6 @@ |
3254 | <widget-library name="gnomedesktop-sharp, Version=2.20.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> |
3255 | <widget-library name="../../Docky.Services/bin/Debug/Docky.Services.dll" /> |
3256 | <widget-library name="../../Docky.Items/bin/Debug/Docky.Items.dll" /> |
3257 | - <widget-library name="../../Docky.Windowing/bin/Debug/Docky.Windowing.dll" /> |
3258 | <widget-library name="../../Docky.DBus/bin/Debug/Docky.DBus.dll" /> |
3259 | <widget-library name="../../Docky.Widgets/bin/Debug/Docky.Widgets.dll" /> |
3260 | <widget-library name="../bin/Debug/Docky.exe" internal="true" /> |
3261 | |
3262 | === modified file 'Makefile.am' |
3263 | --- Makefile.am 2010-06-01 10:30:05 +0000 |
3264 | +++ Makefile.am 2010-08-14 22:27:42 +0000 |
3265 | @@ -9,7 +9,6 @@ |
3266 | Docky.CairoHelper \ |
3267 | Docky.Services \ |
3268 | Docky.Widgets \ |
3269 | - Docky.Windowing \ |
3270 | Docky.Items \ |
3271 | Docky.DBus \ |
3272 | StandardPlugins \ |
3273 | |
3274 | === modified file 'StandardPlugins/Clock/src/ClockDockItem.cs' |
3275 | --- StandardPlugins/Clock/src/ClockDockItem.cs 2010-06-16 08:40:55 +0000 |
3276 | +++ StandardPlugins/Clock/src/ClockDockItem.cs 2010-08-14 22:27:42 +0000 |
3277 | @@ -31,6 +31,7 @@ |
3278 | using Docky.Items; |
3279 | using Docky.Menus; |
3280 | using Docky.Services; |
3281 | +using Docky.Services.Prefs; |
3282 | using Docky.Widgets; |
3283 | |
3284 | namespace Clock |
3285 | |
3286 | === modified file 'StandardPlugins/Desktop/Desktop.csproj' |
3287 | --- StandardPlugins/Desktop/Desktop.csproj 2010-08-01 19:51:00 +0000 |
3288 | +++ StandardPlugins/Desktop/Desktop.csproj 2010-08-14 22:27:42 +0000 |
3289 | @@ -60,10 +60,6 @@ |
3290 | <Project>{B23E0EDD-6443-4F99-9EAC-B7CC906F080D}</Project> |
3291 | <Name>Docky.CairoHelper</Name> |
3292 | </ProjectReference> |
3293 | - <ProjectReference Include="..\..\Docky.Windowing\Docky.Windowing.csproj"> |
3294 | - <Project>{888FCD95-7C79-45C4-A744-9C840DF4B9B0}</Project> |
3295 | - <Name>Docky.Windowing</Name> |
3296 | - </ProjectReference> |
3297 | </ItemGroup> |
3298 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> |
3299 | <ItemGroup> |
3300 | |
3301 | === modified file 'StandardPlugins/Desktop/Makefile.am' |
3302 | --- StandardPlugins/Desktop/Makefile.am 2010-03-07 15:08:38 +0000 |
3303 | +++ StandardPlugins/Desktop/Makefile.am 2010-08-14 22:27:42 +0000 |
3304 | @@ -13,7 +13,6 @@ |
3305 | PROJECT_REFERENCES= \ |
3306 | Docky.CairoHelper \ |
3307 | Docky.Items \ |
3308 | - Docky.Windowing \ |
3309 | Docky.Services |
3310 | |
3311 | REFERENCES = \ |
3312 | |
3313 | === modified file 'StandardPlugins/GMail/src/GMailPreferences.cs' |
3314 | --- StandardPlugins/GMail/src/GMailPreferences.cs 2010-04-04 06:28:19 +0000 |
3315 | +++ StandardPlugins/GMail/src/GMailPreferences.cs 2010-08-14 22:27:42 +0000 |
3316 | @@ -18,6 +18,7 @@ |
3317 | using System; |
3318 | |
3319 | using Docky.Services; |
3320 | +using Docky.Services.Prefs; |
3321 | |
3322 | namespace GMail |
3323 | { |
3324 | |
3325 | === modified file 'StandardPlugins/NPR/src/NPR.cs' |
3326 | --- StandardPlugins/NPR/src/NPR.cs 2010-04-12 12:44:59 +0000 |
3327 | +++ StandardPlugins/NPR/src/NPR.cs 2010-08-14 22:27:42 +0000 |
3328 | @@ -19,7 +19,6 @@ |
3329 | using System.Web; |
3330 | using System.Linq; |
3331 | using System.Net; |
3332 | -using System.Xml; |
3333 | using System.Xml.Linq; |
3334 | using System.Text; |
3335 | using System.IO; |
3336 | @@ -27,6 +26,7 @@ |
3337 | using System.Collections.Generic; |
3338 | |
3339 | using Docky.Services; |
3340 | +using Docky.Services.Prefs; |
3341 | |
3342 | namespace NPR |
3343 | { |
3344 | |
3345 | === modified file 'StandardPlugins/RecentDocuments/src/RecentDocumentsItem.cs' |
3346 | --- StandardPlugins/RecentDocuments/src/RecentDocumentsItem.cs 2010-07-28 23:10:53 +0000 |
3347 | +++ StandardPlugins/RecentDocuments/src/RecentDocumentsItem.cs 2010-08-14 22:27:42 +0000 |
3348 | @@ -26,6 +26,7 @@ |
3349 | using Docky.Items; |
3350 | using Docky.Menus; |
3351 | using Docky.Services; |
3352 | +using Docky.Services.Prefs; |
3353 | |
3354 | namespace RecentDocuments |
3355 | { |
3356 | |
3357 | === modified file 'StandardPlugins/SessionManager/src/SessionManagerItem.cs' |
3358 | --- StandardPlugins/SessionManager/src/SessionManagerItem.cs 2010-06-23 01:34:47 +0000 |
3359 | +++ StandardPlugins/SessionManager/src/SessionManagerItem.cs 2010-08-14 22:27:42 +0000 |
3360 | @@ -30,6 +30,7 @@ |
3361 | using Docky.Items; |
3362 | using Docky.Menus; |
3363 | using Docky.Services; |
3364 | +using Docky.Services.Prefs; |
3365 | |
3366 | namespace SessionManager |
3367 | { |
3368 | |
3369 | === modified file 'StandardPlugins/Timer/src/TimerMainDockItem.cs' |
3370 | --- StandardPlugins/Timer/src/TimerMainDockItem.cs 2010-07-23 07:29:35 +0000 |
3371 | +++ StandardPlugins/Timer/src/TimerMainDockItem.cs 2010-08-14 22:27:42 +0000 |
3372 | @@ -22,6 +22,7 @@ |
3373 | using Docky.Items; |
3374 | using Docky.Menus; |
3375 | using Docky.Services; |
3376 | +using Docky.Services.Prefs; |
3377 | |
3378 | namespace Timer |
3379 | { |
3380 | |
3381 | === modified file 'StandardPlugins/Trash/src/TrashDockItem.cs' |
3382 | --- StandardPlugins/Trash/src/TrashDockItem.cs 2010-08-01 19:56:58 +0000 |
3383 | +++ StandardPlugins/Trash/src/TrashDockItem.cs 2010-08-14 22:27:42 +0000 |
3384 | @@ -25,6 +25,7 @@ |
3385 | using Docky.Items; |
3386 | using Docky.Menus; |
3387 | using Docky.Services; |
3388 | +using Docky.Services.Prefs; |
3389 | |
3390 | namespace Trash |
3391 | { |
3392 | |
3393 | === modified file 'StandardPlugins/Weather/src/WeatherPreferences.cs' |
3394 | --- StandardPlugins/Weather/src/WeatherPreferences.cs 2010-05-14 10:20:07 +0000 |
3395 | +++ StandardPlugins/Weather/src/WeatherPreferences.cs 2010-08-14 22:27:42 +0000 |
3396 | @@ -19,6 +19,7 @@ |
3397 | using System.Globalization; |
3398 | |
3399 | using Docky.Services; |
3400 | +using Docky.Services.Prefs; |
3401 | |
3402 | namespace WeatherDocklet |
3403 | { |
3404 | |
3405 | === modified file 'StandardPlugins/WorkspaceSwitcher/Makefile.am' |
3406 | --- StandardPlugins/WorkspaceSwitcher/Makefile.am 2010-06-13 05:09:24 +0000 |
3407 | +++ StandardPlugins/WorkspaceSwitcher/Makefile.am 2010-08-14 22:27:42 +0000 |
3408 | @@ -14,7 +14,6 @@ |
3409 | PROJECT_REFERENCES= \ |
3410 | Docky.CairoHelper \ |
3411 | Docky.Items \ |
3412 | - Docky.Windowing \ |
3413 | Docky.Services |
3414 | |
3415 | REFERENCES = \ |
3416 | |
3417 | === modified file 'StandardPlugins/WorkspaceSwitcher/WorkspaceSwitcher.csproj' |
3418 | --- StandardPlugins/WorkspaceSwitcher/WorkspaceSwitcher.csproj 2010-06-13 05:09:24 +0000 |
3419 | +++ StandardPlugins/WorkspaceSwitcher/WorkspaceSwitcher.csproj 2010-08-14 22:27:42 +0000 |
3420 | @@ -6,7 +6,7 @@ |
3421 | <ProductVersion>9.0.21022</ProductVersion> |
3422 | <SchemaVersion>2.0</SchemaVersion> |
3423 | <ProjectGuid>{66939AAB-0832-4D2D-8282-3E29AA772B69}</ProjectGuid> |
3424 | - <OutputType>Exe</OutputType> |
3425 | + <OutputType>Library</OutputType> |
3426 | <RootNamespace>WorkspaceSwitcher</RootNamespace> |
3427 | <AssemblyName>WorkspaceSwitcher</AssemblyName> |
3428 | <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> |
3429 | @@ -45,10 +45,6 @@ |
3430 | <Project>{AB6E0EDD-6443-4F99-9EAC-DABC906F080D}</Project> |
3431 | <Name>Docky.Items</Name> |
3432 | </ProjectReference> |
3433 | - <ProjectReference Include="..\..\Docky.Windowing\Docky.Windowing.csproj"> |
3434 | - <Project>{888FCD95-7C79-45C4-A744-9C840DF4B9B0}</Project> |
3435 | - <Name>Docky.Windowing</Name> |
3436 | - </ProjectReference> |
3437 | <ProjectReference Include="..\..\Docky.Services\Docky.Services.csproj"> |
3438 | <Project>{8A6E0EDD-6443-4F99-9EAC-D9CC906F080D}</Project> |
3439 | <Name>Docky.Services</Name> |
3440 | @@ -70,6 +66,7 @@ |
3441 | <Reference Include="wnck-sharp, Version=2.20.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f"> |
3442 | <Package>wnck-sharp-1.0</Package> |
3443 | </Reference> |
3444 | + <Reference Include="Mono.Posix" /> |
3445 | </ItemGroup> |
3446 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> |
3447 | </Project> |
3448 | \ No newline at end of file |
3449 | |
3450 | === modified file 'StandardPlugins/WorkspaceSwitcher/src/WorkspaceSwitcherDockItem.cs' |
3451 | --- StandardPlugins/WorkspaceSwitcher/src/WorkspaceSwitcherDockItem.cs 2010-08-07 12:11:12 +0000 |
3452 | +++ StandardPlugins/WorkspaceSwitcher/src/WorkspaceSwitcherDockItem.cs 2010-08-14 22:27:42 +0000 |
3453 | @@ -33,6 +33,7 @@ |
3454 | using Docky.Items; |
3455 | using Docky.Menus; |
3456 | using Docky.Services; |
3457 | +using Docky.Services.Prefs; |
3458 | |
3459 | namespace WorkspaceSwitcher |
3460 | { |
3461 | |
3462 | === modified file 'configure.ac' |
3463 | --- configure.ac 2010-07-29 05:57:36 +0000 |
3464 | +++ configure.ac 2010-08-14 22:27:42 +0000 |
3465 | @@ -99,18 +99,6 @@ |
3466 | AC_SUBST([NOTIFY_SHARP_LIBS]) |
3467 | AC_SUBST([WNCK_SHARP_10_LIBS]) |
3468 | |
3469 | -dnl Docky references |
3470 | -DOCKY_CAIRO_LIBS="-r:$(pwd)/build/Docky.CairoHelper.dll" |
3471 | -AC_SUBST([DOCKY_CAIRO_LIBS]) |
3472 | -DOCKY_ITEMS_LIBS="-r:$(pwd)/build/Docky.Items.dll" |
3473 | -AC_SUBST([DOCKY_ITEMS_LIBS]) |
3474 | -DOCKY_SERVICES_LIBS="-r:$(pwd)/build/Docky.Services.dll" |
3475 | -AC_SUBST([DOCKY_SERVICES_LIBS]) |
3476 | -DOCKY_WIDGETS_LIBS="-r:$(pwd)/build/Docky.Widgets.dll" |
3477 | -AC_SUBST([DOCKY_WIDGETS_LIBS]) |
3478 | -DOCKY_WINDOWING_LIBS="-r:$(pwd)/build/Docky.Windowing.dll" |
3479 | -AC_SUBST([DOCKY_WINDOWING_LIBS]) |
3480 | - |
3481 | AM_CONDITIONAL(CONFIG_REQUESTED, test -z "") |
3482 | |
3483 | dnl {{{ run with heapshot |
3484 | @@ -164,7 +152,6 @@ |
3485 | Docky.Widgets/Makefile |
3486 | Docky.Services/Makefile |
3487 | Docky.Services/AssemblyInfo.cs |
3488 | -Docky.Windowing/Makefile |
3489 | Docky/docky |
3490 | Docky/AssemblyInfo.cs |
3491 | StandardPlugins/Makefile |
Compiling Docky.Services. dll... Services/ DesktopItemServ ice.cs( 224,33) : error CS1579: foreach statement cannot operate on variables of type `int' because it does not contain a definition for `GetEnumerator' or is not accessible
./Docky.
and don't delete po/docky.pot ;-)