Merge lp:~dobey/ubuntuone-client/no-msg-menu into lp:ubuntuone-client
- no-msg-menu
- Merge into trunk
Proposed by
dobey
on 2012-11-15
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | dobey on 2012-11-30 | ||||
| Approved revision: | 1360 | ||||
| Merged at revision: | 1361 | ||||
| Proposed branch: | lp:~dobey/ubuntuone-client/no-msg-menu | ||||
| Merge into: | lp:ubuntuone-client | ||||
| Diff against target: |
677 lines (+0/-568) 8 files modified
tests/platform/messaging/__init__.py (+0/-27) tests/platform/messaging/test_linux.py (+0/-170) tests/status/test_aggregator.py (+0/-51) ubuntuone/platform/messaging/__init__.py (+0/-53) ubuntuone/platform/messaging/linux.py (+0/-150) ubuntuone/platform/messaging/windows.py (+0/-62) ubuntuone/status/aggregator.py (+0/-3) ubuntuone/status/messaging.py (+0/-52) |
||||
| To merge this branch: | bzr merge lp:~dobey/ubuntuone-client/no-msg-menu | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Roberto Alsina (community) | 2012-11-15 | Approve on 2012-11-27 | |
|
Review via email:
|
|||
Commit Message
Remove the messaging menu integration.
Description of the Change
To post a comment you must log in.
review:
Approve
| Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
Download full text (411.2 KiB)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
| 1 | === removed directory 'tests/platform/messaging' |
| 2 | === removed file 'tests/platform/messaging/__init__.py' |
| 3 | --- tests/platform/messaging/__init__.py 2012-04-30 18:55:40 +0000 |
| 4 | +++ tests/platform/messaging/__init__.py 1970-01-01 00:00:00 +0000 |
| 5 | @@ -1,27 +0,0 @@ |
| 6 | -# Copyright 2012 Canonical Ltd. |
| 7 | -# |
| 8 | -# This program is free software: you can redistribute it and/or modify it |
| 9 | -# under the terms of the GNU General Public License version 3, as published |
| 10 | -# by the Free Software Foundation. |
| 11 | -# |
| 12 | -# This program is distributed in the hope that it will be useful, but |
| 13 | -# WITHOUT ANY WARRANTY; without even the implied warranties of |
| 14 | -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 15 | -# PURPOSE. See the GNU General Public License for more details. |
| 16 | -# |
| 17 | -# You should have received a copy of the GNU General Public License along |
| 18 | -# with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | -# |
| 20 | -# In addition, as a special exception, the copyright holders give |
| 21 | -# permission to link the code of portions of this program with the |
| 22 | -# OpenSSL library under certain conditions as described in each |
| 23 | -# individual source file, and distribute linked combinations |
| 24 | -# including the two. |
| 25 | -# You must obey the GNU General Public License in all respects |
| 26 | -# for all of the code used other than OpenSSL. If you modify |
| 27 | -# file(s) with this exception, you may extend this exception to your |
| 28 | -# version of the file(s), but you are not obligated to do so. If you |
| 29 | -# do not wish to do so, delete this exception statement from your |
| 30 | -# version. If you delete this exception statement from all source |
| 31 | -# files in the program, then also delete it here. |
| 32 | -"""Platform/Messaging test code.""" |
| 33 | |
| 34 | === removed file 'tests/platform/messaging/test_linux.py' |
| 35 | --- tests/platform/messaging/test_linux.py 2012-10-11 15:57:48 +0000 |
| 36 | +++ tests/platform/messaging/test_linux.py 1970-01-01 00:00:00 +0000 |
| 37 | @@ -1,170 +0,0 @@ |
| 38 | -# tests.platform.linux.test_messaging |
| 39 | -# |
| 40 | -# Author: Eric Casteleijn <eric.casteleijn@canonical.com> |
| 41 | -# |
| 42 | -# Copyright 2010-2012 Canonical Ltd. |
| 43 | -# |
| 44 | -# This program is free software: you can redistribute it and/or modify it |
| 45 | -# under the terms of the GNU General Public License version 3, as published |
| 46 | -# by the Free Software Foundation. |
| 47 | -# |
| 48 | -# This program is distributed in the hope that it will be useful, but |
| 49 | -# WITHOUT ANY WARRANTY; without even the implied warranties of |
| 50 | -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 51 | -# PURPOSE. See the GNU General Public License for more details. |
| 52 | -# |
| 53 | -# You should have received a copy of the GNU General Public License along |
| 54 | -# with this program. If not, see <http://www.gnu.org/licenses/>. |
| 55 | -# |
| 56 | -# In addition, as a special exception, the copyright holders give |
| 57 | -# permission to link the code of portions of this program with the |
| 58 | -# OpenSSL library under certain conditions as described in each |
| 59 | -# individual source file, and distribute linked combinations |
| 60 | -# including the two. |
| 61 | -# You must obey the GNU General Public License in all respects |
| 62 | -# for all of the code used other than OpenSSL. If you modify |
| 63 | -# file(s) with this exception, you may extend this exception to your |
| 64 | -# version of the file(s), but you are not obligated to do so. If you |
| 65 | -# do not wish to do so, delete this exception statement from your |
| 66 | -# version. If you delete this exception statement from all source |
| 67 | -# files in the program, then also delete it here. |
| 68 | -""" |
| 69 | -Test the messaging on linux. These tests are kind of stupid, but at |
| 70 | -least they ensure 100% coverage and hence no silly/syntax errors. |
| 71 | -""" |
| 72 | - |
| 73 | -import sys |
| 74 | - |
| 75 | -from mocker import Mocker, ANY |
| 76 | -from twisted.internet import defer |
| 77 | -from twisted.trial.unittest import TestCase |
| 78 | -from ubuntuone.devtools.testcases import skipIf |
| 79 | -from ubuntuone.platform.messaging import linux |
| 80 | -from ubuntuone.platform.messaging.linux import ( |
| 81 | - Messaging, |
| 82 | - _server_callback, |
| 83 | - indicate, |
| 84 | -) |
| 85 | - |
| 86 | -FAKE_TIME = 123 |
| 87 | -FAKE_TIME2 = 456 |
| 88 | -FAKE_COUNT = 11 |
| 89 | -FAKE_SENDER = "Mom" |
| 90 | -FAKE_ICON = object() |
| 91 | - |
| 92 | - |
| 93 | -def callback(indicator, message_time=None): |
| 94 | - """Dummy callback.""" |
| 95 | - pass |
| 96 | - |
| 97 | - |
| 98 | -@skipIf(indicate is None, "No valid Indicate found.") |
| 99 | -class MessagingTestCase(TestCase): |
| 100 | - """Test the Messaging API.""" |
| 101 | - |
| 102 | - @defer.inlineCallbacks |
| 103 | - def setUp(self): |
| 104 | - yield super(MessagingTestCase, self).setUp() |
| 105 | - self.mocker = Mocker() |
| 106 | - |
| 107 | - @defer.inlineCallbacks |
| 108 | - def tearDown(self): |
| 109 | - yield super(MessagingTestCase, self).tearDown() |
| 110 | - self.mocker.restore() |
| 111 | - self.mocker.verify() |
| 112 | - |
| 113 | - # pylint: disable=R0913 |
| 114 | - def _show_message_setup(self, message_time=None, message_count=None, |
| 115 | - icon=None, update_count=None, real_callback=False): |
| 116 | - """Set up the mocker expectations for show_method.""" |
| 117 | - mock_server = self.mocker.mock() |
| 118 | - if 'gobject' in sys.modules and sys.modules['gobject'] is not None: |
| 119 | - indicate = self.mocker.replace("indicate") |
| 120 | - indicate.indicate_server_ref_default() |
| 121 | - else: |
| 122 | - indicate = self.mocker.replace('gi.repository.Indicate') |
| 123 | - indicate.Server.ref_default() |
| 124 | - self.mocker.result(mock_server) |
| 125 | - mock_server.connect('server-display', _server_callback) |
| 126 | - mock_server.set_type("message.u1") |
| 127 | - mock_server.set_desktop_file( |
| 128 | - "/usr/share/applications/ubuntuone-installer.desktop") |
| 129 | - mock_server.show() |
| 130 | - mock_indicator = self.mocker.mock() |
| 131 | - indicate.Indicator() |
| 132 | - self.mocker.result(mock_indicator) |
| 133 | - mock_indicator.set_property("subtype", "u1") |
| 134 | - mock_indicator.set_property("name", FAKE_SENDER) |
| 135 | - mock_indicator.set_property("sender", FAKE_SENDER) |
| 136 | - mock_indicator.connect("user-display", ANY) |
| 137 | - if icon is not None: |
| 138 | - mock_indicator.set_property_icon("icon", icon) |
| 139 | - if message_count is not None: |
| 140 | - mock_indicator.set_property("count", str(message_count)) |
| 141 | - else: |
| 142 | - if message_time is not None: |
| 143 | - mock_indicator.set_property_time("time", message_time) |
| 144 | - mock_indicator.set_property("draw-attention", "true") |
| 145 | - if update_count: |
| 146 | - mock_indicator.get_property("count") |
| 147 | - self.mocker.result("1200") |
| 148 | - mock_indicator.set_property("count", '2500') |
| 149 | - mock_indicator.show() |
| 150 | - if real_callback: |
| 151 | - open_volumes = self.mocker.replace( |
| 152 | - "ubuntuone.platform.messaging.linux.open_volumes") |
| 153 | - open_volumes() |
| 154 | - mock_indicator.set_property('draw-attention', 'false') |
| 155 | - mock_indicator.hide() |
| 156 | - self.mocker.replay() |
| 157 | - # pylint: enable=R0913 |
| 158 | - |
| 159 | - def test_show_message(self): |
| 160 | - """On message, libnotify receives the proper calls.""" |
| 161 | - self._show_message_setup() |
| 162 | - messaging = Messaging() |
| 163 | - messaging.show_message(FAKE_SENDER, callback) |
| 164 | - |
| 165 | - def test_show_message_with_time(self): |
| 166 | - """On message with time, libnotify receives the proper calls.""" |
| 167 | - self._show_message_setup(FAKE_TIME) |
| 168 | - messaging = Messaging() |
| 169 | - messaging.show_message(FAKE_SENDER, callback, message_time=FAKE_TIME) |
| 170 | - |
| 171 | - def test_show_message_with_icon(self): |
| 172 | - """On message with icon, libnotify receives the proper calls.""" |
| 173 | - self._show_message_setup(icon=FAKE_ICON) |
| 174 | - messaging = Messaging() |
| 175 | - messaging.show_message(FAKE_SENDER, callback, icon=FAKE_ICON) |
| 176 | - |
| 177 | - def test_show_message_with_count(self): |
| 178 | - """On message with count, libnotify receives the proper calls.""" |
| 179 | - self._show_message_setup(message_count='1200') |
| 180 | - messaging = Messaging() |
| 181 | - messaging.show_message(FAKE_SENDER, callback, message_count=1200) |
| 182 | - |
| 183 | - def test_update_count(self): |
| 184 | - """On message count update, libnotify receives the proper calls.""" |
| 185 | - self._show_message_setup(message_count='1200', update_count='1300') |
| 186 | - messaging = Messaging() |
| 187 | - messaging.show_message( |
| 188 | - FAKE_SENDER, callback, message_count=1200) |
| 189 | - messaging.update_count(messaging.indicators[-1], 1300) |
| 190 | - |
| 191 | - def test_callback(self): |
| 192 | - """When the callback fires, libnotify receives the proper calls.""" |
| 193 | - self._show_message_setup(real_callback=True) |
| 194 | - messaging = Messaging() |
| 195 | - messaging.show_message(FAKE_SENDER) |
| 196 | - self.assertEquals(1, len(messaging.indicators)) |
| 197 | - actual_callback = messaging.create_callback() |
| 198 | - actual_callback(messaging.indicators[-1]) |
| 199 | - self.assertEquals(0, len(messaging.indicators)) |
| 200 | - |
| 201 | - def test_open_u1(self): |
| 202 | - """Check that the proper action is executed.""" |
| 203 | - data = [] |
| 204 | - |
| 205 | - self.patch(linux, "spawn_command_line_async", data.append) |
| 206 | - _server_callback(None) |
| 207 | - self.assertEqual(data, ['ubuntuone-control-panel-qt']) |
| 208 | |
| 209 | === modified file 'tests/status/test_aggregator.py' |
| 210 | --- tests/status/test_aggregator.py 2012-10-24 16:08:32 +0000 |
| 211 | +++ tests/status/test_aggregator.py 2012-11-15 13:37:20 +0000 |
| 212 | @@ -42,7 +42,6 @@ |
| 213 | from ubuntuone.devtools.testcases import skipTest |
| 214 | from ubuntuone.status import aggregator |
| 215 | from ubuntuone.status.notification import AbstractNotification |
| 216 | -from ubuntuone.status.messaging import AbstractMessaging |
| 217 | from ubuntuone.syncdaemon import ( |
| 218 | status_listener, |
| 219 | RECENT_TRANSFERS, |
| 220 | @@ -194,37 +193,6 @@ |
| 221 | return get_instance |
| 222 | |
| 223 | |
| 224 | -class FakeMessaging(AbstractMessaging): |
| 225 | - """A fake messaging class.""" |
| 226 | - |
| 227 | - def __init__(self): # pylint: disable=W0231 |
| 228 | - self.messages_shown = {} |
| 229 | - self.messages_updated = {} |
| 230 | - self.callbacks = [] |
| 231 | - |
| 232 | - # pylint: disable=R0913 |
| 233 | - def show_message(self, sender, callback=None, message_time=None, |
| 234 | - message_count=None, icon=None): |
| 235 | - """Show a message to the user.""" |
| 236 | - if message_count and sender in self.messages_shown: |
| 237 | - self.update_count(sender, message_count) |
| 238 | - self.messages_shown[sender] = ( |
| 239 | - callback, message_time, message_count, icon) |
| 240 | - # pylint: enable=R0913 |
| 241 | - |
| 242 | - def update_count(self, sender, add_count): |
| 243 | - """Update the count for an existing indicator.""" |
| 244 | - self.messages_updated[sender] = (sender, add_count) |
| 245 | - |
| 246 | - def _callback(self, indicator, message_time=None): |
| 247 | - """Fake callback.""" |
| 248 | - self.callbacks.append((indicator, message_time)) |
| 249 | - |
| 250 | - def create_callback(self): |
| 251 | - """Create the callback.""" |
| 252 | - return self._callback |
| 253 | - |
| 254 | - |
| 255 | class FakeStatusAggregator(object): |
| 256 | """A fake status aggregator.""" |
| 257 | |
| 258 | @@ -813,7 +781,6 @@ |
| 259 | self.patch(aggregator, "StatusAggregator", FakeAggregator) |
| 260 | self.patch(aggregator, "ToggleableNotification", |
| 261 | FakeNotificationSingleton()) |
| 262 | - self.patch(aggregator, "Messaging", FakeMessaging) |
| 263 | self.fakefsm = None |
| 264 | self.fakevm = FakeVolumeManager() |
| 265 | self.status_frontend = aggregator.StatusFrontend() |
| 266 | @@ -1087,11 +1054,6 @@ |
| 267 | self.listener.handle_VM_SHARE_CREATED(SHARE_ID) |
| 268 | self.assertEqual( |
| 269 | 1, len(self.status_frontend.notification.notifications_shown)) |
| 270 | - msg = self.status_frontend.messaging.messages_shown[FAKE_SENDER] |
| 271 | - # msg did not receive a time argument |
| 272 | - self.assertEqual(None, msg[1]) |
| 273 | - # msg did not receive a count argument |
| 274 | - self.assertEqual(None, msg[2]) |
| 275 | |
| 276 | def test_already_subscribed_new_udf_available(self): |
| 277 | """A new udf that was already subscribed.""" |
| 278 | @@ -1100,10 +1062,6 @@ |
| 279 | self.listener.handle_VM_UDF_CREATED(udf) |
| 280 | self.assertEqual( |
| 281 | 0, len(self.status_frontend.notification.notifications_shown)) |
| 282 | - self.assertEqual( |
| 283 | - 0, len(self.status_frontend.messaging.messages_shown)) |
| 284 | - self.assertEqual( |
| 285 | - 0, len(self.status_frontend.messaging.messages_updated)) |
| 286 | |
| 287 | def test_new_udf_available(self): |
| 288 | """A new udf is available for subscription.""" |
| 289 | @@ -1111,11 +1069,6 @@ |
| 290 | self.listener.handle_VM_UDF_CREATED(udf) |
| 291 | self.assertEqual( |
| 292 | 1, len(self.status_frontend.notification.notifications_shown)) |
| 293 | - self.assertEqual( |
| 294 | - 0, len(self.status_frontend.messaging.messages_shown)) |
| 295 | - self.assertEqual( |
| 296 | - 0, len(self.status_frontend.messaging.messages_updated)) |
| 297 | - self.assertEqual(0, len(self.status_frontend.messaging.callbacks)) |
| 298 | |
| 299 | def test_two_new_udfs_available(self): |
| 300 | """A new udf is available for subscription.""" |
| 301 | @@ -1125,10 +1078,6 @@ |
| 302 | self.listener.handle_VM_UDF_CREATED(udf2) |
| 303 | self.assertEqual( |
| 304 | 2, len(self.status_frontend.notification.notifications_shown)) |
| 305 | - self.assertEqual( |
| 306 | - 0, len(self.status_frontend.messaging.messages_shown)) |
| 307 | - self.assertEqual( |
| 308 | - 0, len(self.status_frontend.messaging.messages_updated)) |
| 309 | |
| 310 | def test_server_connection_lost(self): |
| 311 | """The client connected to the server.""" |
| 312 | |
| 313 | === removed directory 'ubuntuone/platform/messaging' |
| 314 | === removed file 'ubuntuone/platform/messaging/__init__.py' |
| 315 | --- ubuntuone/platform/messaging/__init__.py 2012-05-01 11:37:26 +0000 |
| 316 | +++ ubuntuone/platform/messaging/__init__.py 1970-01-01 00:00:00 +0000 |
| 317 | @@ -1,53 +0,0 @@ |
| 318 | -# -*- coding: utf-8 *-* |
| 319 | -# ubuntuone.syncdaemon.platform.messaging - Messages to the user |
| 320 | -# |
| 321 | -# Copyright 2011-2012 Canonical Ltd. |
| 322 | -# |
| 323 | -# This program is free software: you can redistribute it and/or modify it |
| 324 | -# under the terms of the GNU General Public License version 3, as published |
| 325 | -# by the Free Software Foundation. |
| 326 | -# |
| 327 | -# This program is distributed in the hope that it will be useful, but |
| 328 | -# WITHOUT ANY WARRANTY; without even the implied warranties of |
| 329 | -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 330 | -# PURPOSE. See the GNU General Public License for more details. |
| 331 | -# |
| 332 | -# You should have received a copy of the GNU General Public License along |
| 333 | -# with this program. If not, see <http://www.gnu.org/licenses/>. |
| 334 | -# |
| 335 | -# In addition, as a special exception, the copyright holders give |
| 336 | -# permission to link the code of portions of this program with the |
| 337 | -# OpenSSL library under certain conditions as described in each |
| 338 | -# individual source file, and distribute linked combinations |
| 339 | -# including the two. |
| 340 | -# You must obey the GNU General Public License in all respects |
| 341 | -# for all of the code used other than OpenSSL. If you modify |
| 342 | -# file(s) with this exception, you may extend this exception to your |
| 343 | -# version of the file(s), but you are not obligated to do so. If you |
| 344 | -# do not wish to do so, delete this exception statement from your |
| 345 | -# version. If you delete this exception statement from all source |
| 346 | -# files in the program, then also delete it here. |
| 347 | -"""Module that implements sending messages to the end user.""" |
| 348 | - |
| 349 | -# TODO: We may want to enable different messaging systems. When none |
| 350 | -# of them are available, we should fall back to silently discarding |
| 351 | -# messages. |
| 352 | - |
| 353 | -import sys |
| 354 | - |
| 355 | - |
| 356 | -APPLICATION_NAME = 'Ubuntu One Client' |
| 357 | - |
| 358 | - |
| 359 | -if sys.platform == "win32": |
| 360 | - from ubuntuone.platform.messaging import windows as source |
| 361 | - hide_message = source.hide_message |
| 362 | -else: |
| 363 | - from ubuntuone.platform.messaging import linux as source |
| 364 | - DBUS_BUS_NAME = source.DBUS_BUS_NAME |
| 365 | - DBUS_IFACE_GUI = source.DBUS_IFACE_GUI |
| 366 | - TRANSLATION_DOMAIN = source.TRANSLATION_DOMAIN |
| 367 | - _server_callback = source._server_callback |
| 368 | - |
| 369 | -Messaging = source.Messaging |
| 370 | -open_volumes = source.open_volumes |
| 371 | |
| 372 | === removed file 'ubuntuone/platform/messaging/linux.py' |
| 373 | --- ubuntuone/platform/messaging/linux.py 2012-10-11 15:57:48 +0000 |
| 374 | +++ ubuntuone/platform/messaging/linux.py 1970-01-01 00:00:00 +0000 |
| 375 | @@ -1,150 +0,0 @@ |
| 376 | -# ubuntuone.syncdaemon.platform.messaging - Messages to the user |
| 377 | -# |
| 378 | -# Author: Eric Casteleijn <eric.casteleijn@canonical.com> |
| 379 | -# |
| 380 | -# Copyright 2011-2012 Canonical Ltd. |
| 381 | -# |
| 382 | -# This program is free software: you can redistribute it and/or modify it |
| 383 | -# under the terms of the GNU General Public License version 3, as published |
| 384 | -# by the Free Software Foundation. |
| 385 | -# |
| 386 | -# This program is distributed in the hope that it will be useful, but |
| 387 | -# WITHOUT ANY WARRANTY; without even the implied warranties of |
| 388 | -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 389 | -# PURPOSE. See the GNU General Public License for more details. |
| 390 | -# |
| 391 | -# You should have received a copy of the GNU General Public License along |
| 392 | -# with this program. If not, see <http://www.gnu.org/licenses/>. |
| 393 | -# |
| 394 | -# In addition, as a special exception, the copyright holders give |
| 395 | -# permission to link the code of portions of this program with the |
| 396 | -# OpenSSL library under certain conditions as described in each |
| 397 | -# individual source file, and distribute linked combinations |
| 398 | -# including the two. |
| 399 | -# You must obey the GNU General Public License in all respects |
| 400 | -# for all of the code used other than OpenSSL. If you modify |
| 401 | -# file(s) with this exception, you may extend this exception to your |
| 402 | -# version of the file(s), but you are not obligated to do so. If you |
| 403 | -# do not wish to do so, delete this exception statement from your |
| 404 | -# version. If you delete this exception statement from all source |
| 405 | -# files in the program, then also delete it here. |
| 406 | -"""Module that implements sending messages to the end user.""" |
| 407 | - |
| 408 | -# TODO: We may want to enable different messaging systems. When none |
| 409 | -# of them are available, we should fall back to silently discarding |
| 410 | -# messages. |
| 411 | - |
| 412 | -import logging |
| 413 | -import sys |
| 414 | - |
| 415 | -indicate = None |
| 416 | -glib = None |
| 417 | -spawn_command_line_async = None |
| 418 | -try: |
| 419 | - if 'gobject' in sys.modules and sys.modules['gobject'] is not None: |
| 420 | - import shlex |
| 421 | - import indicate as pyindicate |
| 422 | - import glib as GLib |
| 423 | - indicate = pyindicate |
| 424 | - glib = GLib |
| 425 | - using_gi = False |
| 426 | - |
| 427 | - def spawn_command_line(command_line): |
| 428 | - """Spawn the command line.""" |
| 429 | - glib.spawn_async(shlex.split(command_line), |
| 430 | - flags=glib.SPAWN_SEARCH_PATH) |
| 431 | - |
| 432 | - spawn_command_line_async = spawn_command_line |
| 433 | - else: |
| 434 | - from gi.repository import GLib |
| 435 | - glib = GLib |
| 436 | - from gi.repository import Indicate |
| 437 | - indicate = Indicate |
| 438 | - using_gi = True |
| 439 | - spawn_command_line_async = glib.spawn_command_line_async |
| 440 | -except ImportError: |
| 441 | - pass |
| 442 | - |
| 443 | -DBUS_BUS_NAME = 'com.ubuntuone.controlpanel.gui' |
| 444 | -DBUS_PATH = '/gui' |
| 445 | -DBUS_IFACE_GUI = 'com.ubuntuone.controlpanel.gui' |
| 446 | -TRANSLATION_DOMAIN = 'ubuntuone-control-panel' |
| 447 | - |
| 448 | -from ubuntuone.status.messaging import AbstractMessaging |
| 449 | - |
| 450 | -logger = logging.getLogger("ubuntuone.platform.Messaging") |
| 451 | - |
| 452 | - |
| 453 | -def open_volumes(): |
| 454 | - """Open the control panel to the shares tab.""" |
| 455 | - _server_callback(None) |
| 456 | - |
| 457 | - |
| 458 | -def _server_callback(the_indicator, message_time=None): |
| 459 | - """Open the control panel to the shares tab.""" |
| 460 | - try: |
| 461 | - spawn_command_line_async('ubuntuone-control-panel-qt') |
| 462 | - except glib.GError as e: |
| 463 | - logger.warning('Failed to open the control panel: %s' % e) |
| 464 | - |
| 465 | - |
| 466 | -class Messaging(AbstractMessaging): |
| 467 | - """Notification of the end user.""" |
| 468 | - |
| 469 | - def __init__(self, server_callback=_server_callback): |
| 470 | - self.server_callback = server_callback |
| 471 | - self.indicators = [] |
| 472 | - if indicate is None: |
| 473 | - return |
| 474 | - if using_gi: |
| 475 | - self.server = indicate.Server.ref_default() |
| 476 | - else: |
| 477 | - self.server = indicate.indicate_server_ref_default() |
| 478 | - self.server.connect("server-display", server_callback) |
| 479 | - self.server.set_type("message.u1") |
| 480 | - self.server.set_desktop_file( |
| 481 | - "/usr/share/applications/ubuntuone-installer.desktop") |
| 482 | - self.server.show() |
| 483 | - |
| 484 | - # pylint: disable=R0913 |
| 485 | - def show_message(self, sender, callback=None, message_time=None, |
| 486 | - message_count=None, icon=None): |
| 487 | - """Show a message in the messaging menu.""" |
| 488 | - if indicate is None: |
| 489 | - return |
| 490 | - indicator = indicate.Indicator() |
| 491 | - indicator.set_property("subtype", "u1") |
| 492 | - indicator.set_property("name", sender) |
| 493 | - indicator.set_property("sender", sender) |
| 494 | - |
| 495 | - if callback is None: |
| 496 | - callback = self.create_callback() |
| 497 | - indicator.connect("user-display", callback) |
| 498 | - |
| 499 | - if icon is not None: |
| 500 | - indicator.set_property_icon("icon", icon) |
| 501 | - if message_count is not None: |
| 502 | - indicator.set_property("count", str(message_count)) |
| 503 | - else: |
| 504 | - if message_time is not None: |
| 505 | - indicator.set_property_time("time", message_time) |
| 506 | - indicator.set_property("draw-attention", "true") |
| 507 | - indicator.show() |
| 508 | - self.indicators.append(indicator) |
| 509 | - # pylint: enable=R0913 |
| 510 | - |
| 511 | - def create_callback(self): |
| 512 | - """Create the callback to be used.""" |
| 513 | - |
| 514 | - def callback(indicator, message_time=None): # pylint: disable=W0613 |
| 515 | - """Callback to be executed when message is clicked.""" |
| 516 | - open_volumes() |
| 517 | - indicator.set_property("draw-attention", "false") |
| 518 | - indicator.hide() |
| 519 | - self.indicators.remove(indicator) |
| 520 | - return callback |
| 521 | - |
| 522 | - def update_count(self, indicator, add_count): |
| 523 | - """Update the count for an existing indicator.""" |
| 524 | - new_count = int(indicator.get_property('count')) + add_count |
| 525 | - indicator.set_property('count', str(new_count)) |
| 526 | |
| 527 | === removed file 'ubuntuone/platform/messaging/windows.py' |
| 528 | --- ubuntuone/platform/messaging/windows.py 2012-04-30 18:55:40 +0000 |
| 529 | +++ ubuntuone/platform/messaging/windows.py 1970-01-01 00:00:00 +0000 |
| 530 | @@ -1,62 +0,0 @@ |
| 531 | -# ubuntuone.syncdaemon.platform.messaging - Messages to the user |
| 532 | -# |
| 533 | -# Author: Eric Casteleijn <eric.casteleijn@canonical.com> |
| 534 | -# |
| 535 | -# Copyright 2011-2012 Canonical Ltd. |
| 536 | -# |
| 537 | -# This program is free software: you can redistribute it and/or modify it |
| 538 | -# under the terms of the GNU General Public License version 3, as published |
| 539 | -# by the Free Software Foundation. |
| 540 | -# |
| 541 | -# This program is distributed in the hope that it will be useful, but |
| 542 | -# WITHOUT ANY WARRANTY; without even the implied warranties of |
| 543 | -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 544 | -# PURPOSE. See the GNU General Public License for more details. |
| 545 | -# |
| 546 | -# You should have received a copy of the GNU General Public License along |
| 547 | -# with this program. If not, see <http://www.gnu.org/licenses/>. |
| 548 | -# |
| 549 | -# In addition, as a special exception, the copyright holders give |
| 550 | -# permission to link the code of portions of this program with the |
| 551 | -# OpenSSL library under certain conditions as described in each |
| 552 | -# individual source file, and distribute linked combinations |
| 553 | -# including the two. |
| 554 | -# You must obey the GNU General Public License in all respects |
| 555 | -# for all of the code used other than OpenSSL. If you modify |
| 556 | -# file(s) with this exception, you may extend this exception to your |
| 557 | -# version of the file(s), but you are not obligated to do so. If you |
| 558 | -# do not wish to do so, delete this exception statement from your |
| 559 | -# version. If you delete this exception statement from all source |
| 560 | -# files in the program, then also delete it here. |
| 561 | -"""Module that implements sending messages to the end user.""" |
| 562 | - |
| 563 | -# TODO: We may want to enable different messaging systems. When none |
| 564 | -# of them are available, we should fall back to silently discarding |
| 565 | -# messages. |
| 566 | - |
| 567 | -from ubuntuone.status.messaging import AbstractMessaging |
| 568 | - |
| 569 | - |
| 570 | -class Messaging(AbstractMessaging): |
| 571 | - """Notification of the end user.""" |
| 572 | - |
| 573 | - # pylint: disable=R0913 |
| 574 | - def show_message(self, sender, callback=None, message_time=None, |
| 575 | - message_count=None, icon=None): |
| 576 | - """Show a message in the messaging menu.""" |
| 577 | - # TODO: make this work |
| 578 | - # pylint: enable=R0913 |
| 579 | - |
| 580 | - def update_count(self, sender, add_count): |
| 581 | - """Update the count for an existing indicator.""" |
| 582 | - # TODO: make this work |
| 583 | - |
| 584 | - |
| 585 | -def hide_message(indicator): # pylint: disable=W0613 |
| 586 | - """Remove the message once it has been dealt with.""" |
| 587 | - # TODO: make this work |
| 588 | - |
| 589 | - |
| 590 | -def open_volumes(the_indicator, message_time=None): # pylint: disable=W0613 |
| 591 | - """Open the control panel to the shares tab.""" |
| 592 | - # TODO: make this work |
| 593 | |
| 594 | === modified file 'ubuntuone/status/aggregator.py' |
| 595 | --- ubuntuone/status/aggregator.py 2012-10-24 09:06:01 +0000 |
| 596 | +++ ubuntuone/status/aggregator.py 2012-11-15 13:37:20 +0000 |
| 597 | @@ -45,7 +45,6 @@ |
| 598 | notification, |
| 599 | sync_menu |
| 600 | ) |
| 601 | -from ubuntuone.platform.messaging import Messaging |
| 602 | from ubuntuone.platform.launcher import UbuntuOneLauncher, DummyLauncher |
| 603 | |
| 604 | ONE_DAY = 24 * 60 * 60 |
| 605 | @@ -823,7 +822,6 @@ |
| 606 | """Initialize this instance.""" |
| 607 | self.aggregator = StatusAggregator(clock=clock) |
| 608 | self.notification = self.aggregator.get_notification() |
| 609 | - self.messaging = Messaging() |
| 610 | self.quota_timer = None |
| 611 | |
| 612 | self.syncdaemon_service = service |
| 613 | @@ -900,7 +898,6 @@ |
| 614 | |
| 615 | def new_share_available(self, share): |
| 616 | """A new share is available for subscription.""" |
| 617 | - self.messaging.show_message(share.other_visible_name) |
| 618 | self.notification.send_notification( |
| 619 | UBUNTUONE_TITLE, ShareAvailableStatus(share=share).one()) |
| 620 | |
| 621 | |
| 622 | === removed file 'ubuntuone/status/messaging.py' |
| 623 | --- ubuntuone/status/messaging.py 2012-04-09 20:07:05 +0000 |
| 624 | +++ ubuntuone/status/messaging.py 1970-01-01 00:00:00 +0000 |
| 625 | @@ -1,52 +0,0 @@ |
| 626 | -# ubuntuone.status.messaging - Messages to the user |
| 627 | -# |
| 628 | -# Author: Eric Casteleijn <eric.casteleijn@canonical.com> |
| 629 | -# |
| 630 | -# Copyright 2011-2012 Canonical Ltd. |
| 631 | -# |
| 632 | -# This program is free software: you can redistribute it and/or modify it |
| 633 | -# under the terms of the GNU General Public License version 3, as published |
| 634 | -# by the Free Software Foundation. |
| 635 | -# |
| 636 | -# This program is distributed in the hope that it will be useful, but |
| 637 | -# WITHOUT ANY WARRANTY; without even the implied warranties of |
| 638 | -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 639 | -# PURPOSE. See the GNU General Public License for more details. |
| 640 | -# |
| 641 | -# You should have received a copy of the GNU General Public License along |
| 642 | -# with this program. If not, see <http://www.gnu.org/licenses/>. |
| 643 | -# |
| 644 | -# In addition, as a special exception, the copyright holders give |
| 645 | -# permission to link the code of portions of this program with the |
| 646 | -# OpenSSL library under certain conditions as described in each |
| 647 | -# individual source file, and distribute linked combinations |
| 648 | -# including the two. |
| 649 | -# You must obey the GNU General Public License in all respects |
| 650 | -# for all of the code used other than OpenSSL. If you modify |
| 651 | -# file(s) with this exception, you may extend this exception to your |
| 652 | -# version of the file(s), but you are not obligated to do so. If you |
| 653 | -# do not wish to do so, delete this exception statement from your |
| 654 | -# version. If you delete this exception statement from all source |
| 655 | -# files in the program, then also delete it here. |
| 656 | -"""Module that defines the interfaces for messaging the end user.""" |
| 657 | - |
| 658 | -from abc import ABCMeta, abstractmethod |
| 659 | - |
| 660 | -APPLICATION_NAME = 'Ubuntu One Client' |
| 661 | - |
| 662 | - |
| 663 | -class AbstractMessaging(object): |
| 664 | - """Abstract Base Class for notification implementations.""" |
| 665 | - |
| 666 | - __metaclass__ = ABCMeta |
| 667 | - |
| 668 | - # pylint: disable=R0913 |
| 669 | - @abstractmethod |
| 670 | - def show_message(self, sender, callback=None, message_time=None, |
| 671 | - message_count=None, icon=None): |
| 672 | - """Show a message in the messaging menu.""" |
| 673 | - # pylint: enable=R0913 |
| 674 | - |
| 675 | - @abstractmethod |
| 676 | - def update_count(self, sender, add_count): |
| 677 | - """Update the count for an existing indicator.""" |


The attempt to merge lp:~dobey/ubuntuone-client/no-msg-menu into lp:ubuntuone-client failed. Below is the output from the failed tests.
/usr/bin/ gnome-autogen. sh MACRO_DIR, `m4'. unknown- linux-gnu unknown- linux-gnu
checking for autoconf >= 2.53...
testing autoconf2.50... not found.
testing autoconf... found 2.69
checking for automake >= 1.10...
testing automake-1.12... not found.
testing automake-1.11... found 1.11.6
checking for libtool >= 1.5...
testing libtoolize... found 2.4.2
checking for intltool >= 0.30...
testing intltoolize... found 0.50.2
checking for pkg-config >= 0.14.0...
testing pkg-config... found 0.26
checking for gtk-doc >= 1.0...
testing gtkdocize... found 1.18
Checking for required M4 macros...
Checking for forbidden M4 macros...
Processing ./configure.ac
Running libtoolize...
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
Running intltoolize...
Running gtkdocize...
Running aclocal-1.11...
Running autoconf...
Running autoheader...
Running automake-1.11...
Running ./configure --enable-gtk-doc --enable-debug ...
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking how to create a ustar tar archive... gnutar
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for library containing strerror... none required
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking build system type... x86_64-
checking host system type... x86_64-
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell unders...