Merge lp:~3v1n0/ubuntuone-client/sync-menu-use-gappinfo-launch into lp:ubuntuone-client
- sync-menu-use-gappinfo-launch
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | dobey |
Approved revision: | 1399 |
Merged at revision: | 1393 |
Proposed branch: | lp:~3v1n0/ubuntuone-client/sync-menu-use-gappinfo-launch |
Merge into: | lp:ubuntuone-client |
Diff against target: |
352 lines (+205/-48) 2 files modified
tests/platform/sync_menu/test_linux.py (+139/-20) ubuntuone/platform/sync_menu/linux.py (+66/-28) |
To merge this branch: | bzr merge lp:~3v1n0/ubuntuone-client/sync-menu-use-gappinfo-launch |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
dobey (community) | Approve | ||
Diego Sarmentero (community) | Approve | ||
Roberto Alsina (community) | Approve | ||
Review via email: mp+158503@code.launchpad.net |
Commit message
UbuntuOneSyncMe
This allows to correctly open the application with proper startup notify.
Description of the change
The linux sync-menu should use GAppInfo with LaunchContext to launch applications and URIs so that the window manager and the applications will be properly focused and launched with startup notification.
Roberto Alsina (ralsina) : | # |
- 1393. By Marco Trevisan (Treviño)
-
UbuntuOneSyncMe
nuLinux: protect the commandline- app-creation from error too
dobey (dobey) wrote : | # |
+CLIENT_DESKTOP_ID = 'ubuntuone-
+INSTALLER_
Why are both of these being used? There is no more "installer" exactly, but the filename is unchanged, to avoid breaking the launcher. Also, the "-qt-gnome.desktop" file is only for GNOME, so I think we want to use the "ubuntuone-
dobey (dobey) : | # |
- 1394. By Marco Trevisan (Treviño)
-
UbuntuOneSyncMe
nuLinux: don't crash if the display is not set, don't use the Context - 1395. By Marco Trevisan (Treviño)
-
SyncMenuTestCase: add new tests to cover changes and update the old ones
- 1396. By Marco Trevisan (Treviño)
-
SyncMenuTestCase: use random values for timestasmp
- 1397. By Marco Trevisan (Treviño)
-
UbuntuOneSyncMe
nuLinux: always use CLIENT_DESKTOP_ID as client
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
> +CLIENT_DESKTOP_ID = 'ubuntuone-
> +INSTALLER_
>
> Why are both of these being used? There is no more "installer" exactly, but
> the filename is unchanged, to avoid breaking the launcher. Also, the "-qt-
> gnome.desktop" file is only for GNOME, so I think we want to use the
> "ubuntuone-
> "INSTALLER_
> CONTROL_
> the instances.
Fine, I've moved everything to CLIENT_DESKTOP_ID set to "ubuntuone-
dobey (dobey) wrote : | # |
There are some lint issues in the test file.
== Python Lint Notices ==
./tests/
276: redefinition of unused 'time' from line 32
286: redefinition of unused 'time' from line 32
297: redefinition of unused 'time' from line 32
306: redefinition of unused 'time' from line 32
317: redefinition of unused 'time' from line 32
326: redefinition of unused 'time' from line 32
335: redefinition of unused 'time' from line 32
344: redefinition of unused 'time' from line 32
353: redefinition of unused 'time' from line 32
make: *** [lint] Error 1
dobey (dobey) wrote : | # |
Also, is there any reason to use use randint() here instead of time.time()?
Diego Sarmentero (diegosarmentero) wrote : | # |
This branch contains some lint issues:
== Python Lint Notices ==
./tests/
276: redefinition of unused 'time' from line 32
286: redefinition of unused 'time' from line 32
297: redefinition of unused 'time' from line 32
306: redefinition of unused 'time' from line 32
317: redefinition of unused 'time' from line 32
326: redefinition of unused 'time' from line 32
335: redefinition of unused 'time' from line 32
344: redefinition of unused 'time' from line 32
353: redefinition of unused 'time' from line 32
- 1398. By Marco Trevisan (Treviño)
-
SyncMenuTestCase: use time.time() instead of random.randint().
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
> This branch contains some lint issues:
They should be fixed now, thanks for pointing out.
dobey (dobey) wrote : | # |
8 +
E303 too many blank lines (3)
+ def __init__(self, command_line = "", name = "", flags = 0):
+ def __init__(self, desktop_id = ""):
+ def _open_uri(self, uri, timestamp = 0):
+ def _open_control_
+ def open_control_
+ def open_ubuntu_
+ def open_share_
+ def open_go_
+ def open_web_help(self, menuitem = None, timestamp = 0):
+ def open_get_
E251 no spaces around keyword / parameter equals
68 + self.context = context
69 +
70 +class FakeDesktopAppI
E302 expected 2 blank lines, found 1
- 1399. By Marco Trevisan (Treviño)
-
UbuntuOneSyncMe
nuLinux: fixing spaces issues
dobey (dobey) : | # |
Preview Diff
1 | === modified file 'tests/platform/sync_menu/test_linux.py' | |||
2 | --- tests/platform/sync_menu/test_linux.py 2013-04-16 13:14:42 +0000 | |||
3 | +++ tests/platform/sync_menu/test_linux.py 2013-04-16 15:23:26 +0000 | |||
4 | @@ -70,6 +70,73 @@ | |||
5 | 70 | self.callback = callback | 70 | self.callback = callback |
6 | 71 | 71 | ||
7 | 72 | 72 | ||
8 | 73 | class FakeAppLaunchContext(object): | ||
9 | 74 | def set_timestamp(self, timestamp): | ||
10 | 75 | self.timestamp = timestamp | ||
11 | 76 | |||
12 | 77 | |||
13 | 78 | class FakeGdkDisplay(object): | ||
14 | 79 | """Fake Gdk.Display""" | ||
15 | 80 | def get_app_launch_context(self): | ||
16 | 81 | return FakeAppLaunchContext() | ||
17 | 82 | |||
18 | 83 | |||
19 | 84 | class FakeNullGdk(object): | ||
20 | 85 | """Fake Gdk.Display with no default""" | ||
21 | 86 | @staticmethod | ||
22 | 87 | def get_default(): | ||
23 | 88 | return None | ||
24 | 89 | |||
25 | 90 | |||
26 | 91 | class FakeAppInfo(object): | ||
27 | 92 | """Fake Gio.AppInfo""" | ||
28 | 93 | instance = None | ||
29 | 94 | name = "" | ||
30 | 95 | desktop_id = "" | ||
31 | 96 | command_line = "" | ||
32 | 97 | opened_uri = "" | ||
33 | 98 | launched = True | ||
34 | 99 | context = None | ||
35 | 100 | files = [] | ||
36 | 101 | flags = 0 | ||
37 | 102 | |||
38 | 103 | def __new__(cls, *args, **kwargs): | ||
39 | 104 | cls.instance = super(FakeAppInfo, cls).__new__(cls, *args, **kwargs) | ||
40 | 105 | return cls.instance | ||
41 | 106 | |||
42 | 107 | def __init__(self, command_line="", name="", flags=0): | ||
43 | 108 | self.command_line = command_line | ||
44 | 109 | self.name = name | ||
45 | 110 | self.flags = flags | ||
46 | 111 | |||
47 | 112 | @classmethod | ||
48 | 113 | def launch_default_for_uri(cls, uri, context): | ||
49 | 114 | cls.opened_uri = uri | ||
50 | 115 | cls.context = context | ||
51 | 116 | |||
52 | 117 | @classmethod | ||
53 | 118 | def create_from_commandline(cls, command_line, name, flags): | ||
54 | 119 | cls.instance.__init__(command_line, name, flags) | ||
55 | 120 | return cls.instance | ||
56 | 121 | |||
57 | 122 | def launch(self, files, context): | ||
58 | 123 | self.launched = True | ||
59 | 124 | self.files = files | ||
60 | 125 | self.context = context | ||
61 | 126 | |||
62 | 127 | |||
63 | 128 | class FakeDesktopAppInfo(FakeAppInfo): | ||
64 | 129 | """Fake Gio.DestkopAppInfo""" | ||
65 | 130 | def __init__(self, desktop_id=""): | ||
66 | 131 | super(FakeDesktopAppInfo, self).__init__() | ||
67 | 132 | self.desktop_id = desktop_id | ||
68 | 133 | |||
69 | 134 | @classmethod | ||
70 | 135 | def new(cls, desktop_id): | ||
71 | 136 | cls.instance.__init__(desktop_id) | ||
72 | 137 | return cls.instance | ||
73 | 138 | |||
74 | 139 | |||
75 | 73 | class FakeSyncdaemonService(object): | 140 | class FakeSyncdaemonService(object): |
76 | 74 | """Fake SyncdaemonService.""" | 141 | """Fake SyncdaemonService.""" |
77 | 75 | 142 | ||
78 | @@ -142,6 +209,7 @@ | |||
79 | 142 | def setUp(self): | 209 | def setUp(self): |
80 | 143 | yield super(SyncMenuTestCase, self).setUp() | 210 | yield super(SyncMenuTestCase, self).setUp() |
81 | 144 | self.patch(linux.SyncMenu, "App", FakeSyncMenuApp) | 211 | self.patch(linux.SyncMenu, "App", FakeSyncMenuApp) |
82 | 212 | self.patch(linux.Gdk.Display, "get_default", FakeGdkDisplay) | ||
83 | 145 | FakeSyncMenuApp.clean() | 213 | FakeSyncMenuApp.clean() |
84 | 146 | self.syncdaemon_service = FakeSyncdaemonService() | 214 | self.syncdaemon_service = FakeSyncdaemonService() |
85 | 147 | self.status_frontend = FakeStatusFrontend() | 215 | self.status_frontend = FakeStatusFrontend() |
86 | @@ -187,54 +255,105 @@ | |||
87 | 187 | self.assertIsInstance(self.sync_menu.transfers.separator, | 255 | self.assertIsInstance(self.sync_menu.transfers.separator, |
88 | 188 | linux.Dbusmenu.Menuitem) | 256 | linux.Dbusmenu.Menuitem) |
89 | 189 | 257 | ||
90 | 258 | def test_get_launch_context_with_display(self): | ||
91 | 259 | """Check that the proper context is returned.""" | ||
92 | 260 | timestamp = time.time() | ||
93 | 261 | context = self.sync_menu._get_launch_context(timestamp) | ||
94 | 262 | self.assertEqual(timestamp, context.timestamp) | ||
95 | 263 | |||
96 | 264 | def test_get_launch_context_with_no_display(self): | ||
97 | 265 | """Check that the proper context is returned.""" | ||
98 | 266 | self.patch(linux.Gdk, "Display", FakeNullGdk) | ||
99 | 267 | context = self.sync_menu._get_launch_context(time.time()) | ||
100 | 268 | self.assertEqual(context, None) | ||
101 | 269 | |||
102 | 270 | def test_open_control_panel_by_command_line(self): | ||
103 | 271 | """Check that the proper action is executed.""" | ||
104 | 272 | appinfo = FakeAppInfo() | ||
105 | 273 | self.patch(linux.Gio, "AppInfo", appinfo) | ||
106 | 274 | timestamp = time.time() | ||
107 | 275 | self.sync_menu._open_control_panel_by_command_line(timestamp) | ||
108 | 276 | |||
109 | 277 | self.assertEqual(appinfo.command_line, linux.CLIENT_COMMAND_LINE) | ||
110 | 278 | self.assertEqual(appinfo.context.timestamp, timestamp) | ||
111 | 279 | |||
112 | 280 | def test_open_control_panel_by_command_line_with_arg(self): | ||
113 | 281 | """Check that the proper action is executed.""" | ||
114 | 282 | appinfo = FakeAppInfo() | ||
115 | 283 | self.patch(linux.Gio, "AppInfo", appinfo) | ||
116 | 284 | timestamp = time.time() | ||
117 | 285 | arg = "--test-arg" | ||
118 | 286 | self.sync_menu._open_control_panel_by_command_line(timestamp, arg) | ||
119 | 287 | |||
120 | 288 | self.assertEqual(appinfo.command_line, "%s %s" % (linux.CLIENT_COMMAND_LINE, arg)) | ||
121 | 289 | self.assertEqual(appinfo.context.timestamp, timestamp) | ||
122 | 290 | |||
123 | 291 | def test_open_uri(self): | ||
124 | 292 | """Check that the proper action is executed.""" | ||
125 | 293 | appinfo = FakeAppInfo() | ||
126 | 294 | self.patch(linux.Gio, "AppInfo", appinfo) | ||
127 | 295 | timestamp = time.time() | ||
128 | 296 | |||
129 | 297 | self.sync_menu._open_uri(linux.UBUNTUONE_LINK, timestamp) | ||
130 | 298 | self.assertEqual(appinfo.opened_uri, linux.UBUNTUONE_LINK) | ||
131 | 299 | self.assertEqual(appinfo.context.timestamp, timestamp) | ||
132 | 300 | |||
133 | 190 | def test_open_u1(self): | 301 | def test_open_u1(self): |
134 | 191 | """Check that the proper action is executed.""" | 302 | """Check that the proper action is executed.""" |
136 | 192 | data = [] | 303 | appinfo = FakeDesktopAppInfo() |
137 | 304 | timestamp = time.time() | ||
138 | 305 | self.patch(linux.Gio, "DesktopAppInfo", appinfo) | ||
139 | 193 | 306 | ||
143 | 194 | self.patch(linux.glib, "spawn_command_line_async", data.append) | 307 | self.sync_menu.open_control_panel(timestamp=timestamp) |
144 | 195 | self.sync_menu.open_control_panel() | 308 | self.assertEqual(appinfo.desktop_id, linux.CLIENT_DESKTOP_ID) |
145 | 196 | self.assertEqual(data, ['ubuntuone-control-panel-qt']) | 309 | self.assertTrue(appinfo.launched) |
146 | 310 | self.assertEqual(appinfo.files, []) | ||
147 | 311 | self.assertEqual(appinfo.context.timestamp, timestamp) | ||
148 | 197 | 312 | ||
149 | 198 | def test_open_share_tab(self): | 313 | def test_open_share_tab(self): |
150 | 199 | """Check that the proper action is executed.""" | 314 | """Check that the proper action is executed.""" |
151 | 315 | timestamp = time.time() | ||
152 | 200 | data = [] | 316 | data = [] |
153 | 201 | 317 | ||
158 | 202 | self.patch(linux.glib, "spawn_command_line_async", data.append) | 318 | self.patch(self.sync_menu, "_open_control_panel_by_command_line", lambda t, a: data.append((t, a))) |
159 | 203 | self.sync_menu.open_share_file_tab() | 319 | self.sync_menu.open_share_file_tab(timestamp=timestamp) |
160 | 204 | self.assertEqual(data, [ | 320 | self.assertEqual(data, [(timestamp, "--switch-to share_links")]) |
157 | 205 | 'ubuntuone-control-panel-qt --switch-to share_links']) | ||
161 | 206 | 321 | ||
162 | 207 | def test_go_to_web(self): | 322 | def test_go_to_web(self): |
163 | 208 | """Check that the proper action is executed.""" | 323 | """Check that the proper action is executed.""" |
164 | 324 | timestamp = time.time() | ||
165 | 209 | data = [] | 325 | data = [] |
166 | 210 | 326 | ||
170 | 211 | self.patch(linux.webbrowser, "open", data.append) | 327 | self.patch(self.sync_menu, "_open_uri", lambda u, t: data.append((t, u))) |
171 | 212 | self.sync_menu.open_go_to_web() | 328 | self.sync_menu.open_go_to_web(timestamp=timestamp) |
172 | 213 | self.assertEqual(data, [linux.DASHBOARD]) | 329 | self.assertEqual(data, [(timestamp, linux.DASHBOARD)]) |
173 | 214 | 330 | ||
174 | 215 | def test_open_ubuntu_one_folder(self): | 331 | def test_open_ubuntu_one_folder(self): |
175 | 216 | """Check that the proper action is executed.""" | 332 | """Check that the proper action is executed.""" |
176 | 333 | timestamp = time.time() | ||
177 | 217 | data = [] | 334 | data = [] |
178 | 218 | 335 | ||
182 | 219 | self.patch(linux.webbrowser, "open", data.append) | 336 | self.patch(self.sync_menu, "_open_uri", lambda u, t: data.append((t, u))) |
183 | 220 | self.sync_menu.open_ubuntu_one_folder() | 337 | self.sync_menu.open_ubuntu_one_folder(timestamp=timestamp) |
184 | 221 | self.assertEqual(data, [self.syncdaemon_service.fake_root_path]) | 338 | self.assertEqual(data, [(timestamp, "file://" + self.syncdaemon_service.fake_root_path)]) |
185 | 222 | 339 | ||
186 | 223 | def test_get_help(self): | 340 | def test_get_help(self): |
187 | 224 | """Check that the proper action is executed.""" | 341 | """Check that the proper action is executed.""" |
188 | 342 | timestamp = time.time() | ||
189 | 225 | data = [] | 343 | data = [] |
190 | 226 | 344 | ||
194 | 227 | self.patch(linux.webbrowser, "open", data.append) | 345 | self.patch(self.sync_menu, "_open_uri", lambda u, t: data.append((t, u))) |
195 | 228 | self.sync_menu.open_web_help() | 346 | self.sync_menu.open_web_help(timestamp=timestamp) |
196 | 229 | self.assertEqual(data, [linux.HELP_LINK]) | 347 | self.assertEqual(data, [(timestamp, linux.HELP_LINK)]) |
197 | 230 | 348 | ||
198 | 231 | def test_more_storage(self): | 349 | def test_more_storage(self): |
199 | 232 | """Check that the proper action is executed.""" | 350 | """Check that the proper action is executed.""" |
200 | 351 | timestamp = time.time() | ||
201 | 233 | data = [] | 352 | data = [] |
202 | 234 | 353 | ||
206 | 235 | self.patch(linux.webbrowser, "open", data.append) | 354 | self.patch(self.sync_menu, "_open_uri", lambda u, t: data.append((t, u))) |
207 | 236 | self.sync_menu.open_get_more_storage() | 355 | self.sync_menu.open_get_more_storage(timestamp=timestamp) |
208 | 237 | self.assertEqual(data, [linux.GET_STORAGE_LINK]) | 356 | self.assertEqual(data, [(timestamp, linux.GET_STORAGE_LINK)]) |
209 | 238 | 357 | ||
210 | 239 | def test_empty_transfers(self): | 358 | def test_empty_transfers(self): |
211 | 240 | """Check that the Transfers menu is empty.""" | 359 | """Check that the Transfers menu is empty.""" |
212 | 241 | 360 | ||
213 | === modified file 'ubuntuone/platform/sync_menu/linux.py' | |||
214 | --- ubuntuone/platform/sync_menu/linux.py 2013-02-20 22:41:12 +0000 | |||
215 | +++ ubuntuone/platform/sync_menu/linux.py 2013-04-16 15:23:26 +0000 | |||
216 | @@ -31,7 +31,6 @@ | |||
217 | 31 | import gettext | 31 | import gettext |
218 | 32 | import logging | 32 | import logging |
219 | 33 | import time | 33 | import time |
220 | 34 | import webbrowser | ||
221 | 35 | from twisted.python.util import OrderedDict | 34 | from twisted.python.util import OrderedDict |
222 | 36 | from operator import itemgetter | 35 | from operator import itemgetter |
223 | 37 | 36 | ||
224 | @@ -39,6 +38,8 @@ | |||
225 | 39 | from gi.repository import GLib as glib | 38 | from gi.repository import GLib as glib |
226 | 40 | from gi.repository import ( | 39 | from gi.repository import ( |
227 | 41 | Dbusmenu, | 40 | Dbusmenu, |
228 | 41 | Gdk, | ||
229 | 42 | Gio, | ||
230 | 42 | SyncMenu, | 43 | SyncMenu, |
231 | 43 | ) | 44 | ) |
232 | 44 | use_syncmenu = True | 45 | use_syncmenu = True |
233 | @@ -69,6 +70,8 @@ | |||
234 | 69 | DASHBOARD = UBUNTUONE_LINK + u'dashboard/' | 70 | DASHBOARD = UBUNTUONE_LINK + u'dashboard/' |
235 | 70 | HELP_LINK = UBUNTUONE_LINK + u'support/' | 71 | HELP_LINK = UBUNTUONE_LINK + u'support/' |
236 | 71 | GET_STORAGE_LINK = UBUNTUONE_LINK + u'services/add-storage/' | 72 | GET_STORAGE_LINK = UBUNTUONE_LINK + u'services/add-storage/' |
237 | 73 | CLIENT_COMMAND_LINE = 'ubuntuone-control-panel-qt' | ||
238 | 74 | CLIENT_DESKTOP_ID = 'ubuntuone-installer.desktop' | ||
239 | 72 | 75 | ||
240 | 73 | 76 | ||
241 | 74 | class UbuntuOneSyncMenuLinux(object): | 77 | class UbuntuOneSyncMenuLinux(object): |
242 | @@ -133,7 +136,7 @@ | |||
243 | 133 | 136 | ||
244 | 134 | self.server = Dbusmenu.Server() | 137 | self.server = Dbusmenu.Server() |
245 | 135 | self.server.set_root(self.root_menu) | 138 | self.server.set_root(self.root_menu) |
247 | 136 | self.app = SyncMenu.App.new("ubuntuone-installer.desktop") | 139 | self.app = SyncMenu.App.new(CLIENT_DESKTOP_ID) |
248 | 137 | self.app.set_menu(self.server) | 140 | self.app.set_menu(self.server) |
249 | 138 | self.app.connect("notify::paused", self.change_sync_status) | 141 | self.app.connect("notify::paused", self.change_sync_status) |
250 | 139 | 142 | ||
251 | @@ -155,36 +158,70 @@ | |||
252 | 155 | self._syncdaemon_service.connect() | 158 | self._syncdaemon_service.connect() |
253 | 156 | self._connected = True | 159 | self._connected = True |
254 | 157 | 160 | ||
256 | 158 | def open_control_panel(self, *args): | 161 | def _get_launch_context(self, timestamp): |
257 | 162 | """Returns the launch context for the current display""" | ||
258 | 163 | dpy = Gdk.Display.get_default() | ||
259 | 164 | |||
260 | 165 | if dpy: | ||
261 | 166 | context = dpy.get_app_launch_context() | ||
262 | 167 | context.set_timestamp(timestamp) | ||
263 | 168 | return context | ||
264 | 169 | |||
265 | 170 | return None | ||
266 | 171 | |||
267 | 172 | def _open_uri(self, uri, timestamp=0): | ||
268 | 173 | """Open an uri Using the default handler and the action timestamp""" | ||
269 | 174 | try: | ||
270 | 175 | Gio.AppInfo.launch_default_for_uri(uri, self._get_launch_context(timestamp)) | ||
271 | 176 | except glib.GError as e: | ||
272 | 177 | logger.warning('Failed to open the uri %s: %s.' % (uri, e)) | ||
273 | 178 | |||
274 | 179 | def _open_control_panel_by_command_line(self, timestamp, args = ''): | ||
275 | 180 | """Open the control panel by command line""" | ||
276 | 181 | flags = Gio.AppInfoCreateFlags.SUPPORTS_STARTUP_NOTIFICATION | ||
277 | 182 | command_line = CLIENT_COMMAND_LINE | ||
278 | 183 | if len(args): | ||
279 | 184 | command_line += ' ' + args | ||
280 | 185 | |||
281 | 186 | try: | ||
282 | 187 | app = Gio.AppInfo.create_from_commandline(command_line, 'Ubuntu One', flags) | ||
283 | 188 | |||
284 | 189 | if app: | ||
285 | 190 | app.launch([], self._get_launch_context(timestamp)) | ||
286 | 191 | except glib.GError as e: | ||
287 | 192 | logger.warning('Failed to open the control panel: %s.' % e) | ||
288 | 193 | |||
289 | 194 | def open_control_panel(self, menuitem=None, timestamp=0): | ||
290 | 159 | """Open the Ubuntu One Control Panel.""" | 195 | """Open the Ubuntu One Control Panel.""" |
297 | 160 | try: | 196 | app = Gio.DesktopAppInfo.new(CLIENT_DESKTOP_ID) |
298 | 161 | glib.spawn_command_line_async('ubuntuone-control-panel-qt') | 197 | |
299 | 162 | except glib.GError as e: | 198 | if app: |
300 | 163 | logger.warning('Failed to open the control panel: %s.' % e) | 199 | try: |
301 | 164 | 200 | app.launch([], self._get_launch_context(timestamp)) | |
302 | 165 | def open_ubuntu_one_folder(self, *args): | 201 | except glib.GError as e: |
303 | 202 | logger.warning('Failed to open the control panel: %s.' % e) | ||
304 | 203 | else: | ||
305 | 204 | self._open_control_panel_by_command_line(timestamp) | ||
306 | 205 | |||
307 | 206 | def open_ubuntu_one_folder(self, menuitem=None, timestamp=0): | ||
308 | 166 | """Open the Ubuntu One folder.""" | 207 | """Open the Ubuntu One folder.""" |
310 | 167 | webbrowser.open(self._syncdaemon_service.get_rootdir()) | 208 | self._open_uri("file://" + self._syncdaemon_service.get_rootdir(), timestamp) |
311 | 168 | 209 | ||
313 | 169 | def open_share_file_tab(self, *args): | 210 | def open_share_file_tab(self, menuitem=None, timestamp=0): |
314 | 170 | """Open the Control Panel in the Share Tab.""" | 211 | """Open the Control Panel in the Share Tab.""" |
332 | 171 | try: | 212 | self._open_control_panel_by_command_line(timestamp, "--switch-to share_links") |
333 | 172 | glib.spawn_command_line_async('ubuntuone-control-panel-qt ' | 213 | |
334 | 173 | '--switch-to share_links') | 214 | def open_go_to_web(self, menuitem=None, timestamp=0): |
335 | 174 | except glib.GError as e: | 215 | """Open the Ubuntu One Help Page""" |
336 | 175 | logger.warning('Failed to open the control panel: %s.' % e) | 216 | self._open_uri(DASHBOARD, timestamp) |
337 | 176 | 217 | ||
338 | 177 | def open_go_to_web(self, *args): | 218 | def open_web_help(self, menuitem=None, timestamp=0): |
339 | 178 | """Open the Ubunto One Help Page""" | 219 | """Open the Ubuntu One Help Page""" |
340 | 179 | webbrowser.open(DASHBOARD) | 220 | self._open_uri(HELP_LINK, timestamp) |
341 | 180 | 221 | ||
342 | 181 | def open_web_help(self, *args): | 222 | def open_get_more_storage(self, menuitem=None, timestamp=0): |
343 | 182 | """Open the Ubunto One Help Page""" | 223 | """Open the Ubuntu One Help Page""" |
344 | 183 | webbrowser.open(HELP_LINK) | 224 | self._open_uri(GET_STORAGE_LINK, timestamp) |
328 | 184 | |||
329 | 185 | def open_get_more_storage(self, *args): | ||
330 | 186 | """Open the Ubunto One Help Page""" | ||
331 | 187 | webbrowser.open(GET_STORAGE_LINK) | ||
345 | 188 | 225 | ||
346 | 189 | def _timeout(self, result): | 226 | def _timeout(self, result): |
347 | 190 | """The aggregating timer has expired, so update the UI.""" | 227 | """The aggregating timer has expired, so update the UI.""" |
348 | @@ -284,3 +321,4 @@ | |||
349 | 284 | UbuntuOneSyncMenu = UbuntuOneSyncMenuLinux | 321 | UbuntuOneSyncMenu = UbuntuOneSyncMenuLinux |
350 | 285 | else: | 322 | else: |
351 | 286 | UbuntuOneSyncMenu = DummySyncMenu | 323 | UbuntuOneSyncMenu = DummySyncMenu |
352 | 324 |
Tests are failing, and there isn't new tests for the new code.