Merge lp:~verterok/ubuntuone-client/dbus-quit into lp:ubuntuone-client

Proposed by Guillermo Gonzalez
Status: Superseded
Proposed branch: lp:~verterok/ubuntuone-client/dbus-quit
Merge into: lp:ubuntuone-client
Diff against target: None lines
To merge this branch: bzr merge lp:~verterok/ubuntuone-client/dbus-quit
Reviewer Review Type Date Requested Status
dobey (community) Abstain
Review via email: mp+6553@code.launchpad.net

This proposal has been superseded by a proposal from 2009-05-14.

To post a comment you must log in.
Revision history for this message
Guillermo Gonzalez (verterok) wrote :

 Expose quit via Dbus and add --quit option to u1sdtool

Revision history for this message
dobey (dobey) wrote :

If you could update the applet to call quit instead of disconnect for the quit menu item callback as well, this would also fix bug #365103.

review: Abstain
Revision history for this message
Guillermo Gonzalez (verterok) wrote :

sure, I'll do that

On Wed, May 13, 2009 at 7:17 PM, Rodney Dawes
<email address hidden> wrote:
> Review: Abstain
> If you could update the applet to call quit instead of disconnect for the quit menu item callback as well, this would also fix bug #365103.
> --
> https://code.edge.launchpad.net/~verterok/ubuntuone-client/dbus-quit/+merge/6553
> You are the owner of lp:~verterok/ubuntuone-client/dbus-quit.
>

Revision history for this message
Guillermo Gonzalez (verterok) wrote :

After testing this a bit, if I click quit on applet, and the daemon is stopped, it'll started again by nautilus as soon the user open it (via the dbus call).
Maybe the nautilus plugin should support an "stooped" daemon?

11. By Guillermo Gonzalez

 quit syncdaemon with the applet, and turn off autoconnect

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/u1sdtool'
--- bin/u1sdtool 2009-05-13 15:33:22 +0000
+++ bin/u1sdtool 2009-05-13 19:58:44 +0000
@@ -26,6 +26,7 @@
26import warnings26import warnings
2727
28from canonical.ubuntuone.storage.syncdaemon.tools import SyncDaemonTool28from canonical.ubuntuone.storage.syncdaemon.tools import SyncDaemonTool
29from canonical.ubuntuone.storage.syncdaemon.dbus_interface import DBUS_IFACE_NAME
29from dbus.mainloop.glib import DBusGMainLoop30from dbus.mainloop.glib import DBusGMainLoop
30from optparse import OptionParser31from optparse import OptionParser
31from twisted.internet import reactor32from twisted.internet import reactor
@@ -35,7 +36,7 @@
35 usage = "Usage: %prog [option]"36 usage = "Usage: %prog [option]"
36 parser = OptionParser(usage=usage)37 parser = OptionParser(usage=usage)
37 parser.add_option("-w", "--wait", dest="wait", action="store_true",38 parser.add_option("-w", "--wait", dest="wait", action="store_true",
38 help="Wait until SyncDaemon reachs nirvana")39 help="Wait until ubuntuone-syncdaemon reachs nirvana")
39 parser.add_option("", "--accept-share", dest="accept_share",40 parser.add_option("", "--accept-share", dest="accept_share",
40 metavar="SHARE_ID",41 metavar="SHARE_ID",
41 help="accept the share with the specified id")42 help="accept the share with the specified id")
@@ -62,6 +63,8 @@
62 parser.add_option("", "--current-transfers", dest="current_transfers", 63 parser.add_option("", "--current-transfers", dest="current_transfers",
63 action="store_true",64 action="store_true",
64 help=" show the current uploads and downloads")65 help=" show the current uploads and downloads")
66 parser.add_option("-q", "--quit", dest="quit", action='store_true',
67 help="shutdown the syncdaemon")
6568
66 (options, args) = parser.parse_args(argv)69 (options, args) = parser.parse_args(argv)
6770
@@ -72,7 +75,7 @@
72 if options.wait:75 if options.wait:
73 def callback(result):76 def callback(result):
74 """ wait_for_nirvana callback (stop the reactor and exit)"""77 """ wait_for_nirvana callback (stop the reactor and exit)"""
75 print "\nSyncDaemon became a fully enlightened Buddha!"78 print "\nubuntuone-syncdaemon became a fully enlightened Buddha!"
7679
77 d = sync_daemon_tool.wait_for_nirvana(verbose=True)80 d = sync_daemon_tool.wait_for_nirvana(verbose=True)
78 d.addCallbacks(callback)81 d.addCallbacks(callback)
@@ -154,6 +157,15 @@
154 d.addCallback(show_uploads)157 d.addCallback(show_uploads)
155 d.addCallback(lambda _: sync_daemon_tool.get_current_downloads())158 d.addCallback(lambda _: sync_daemon_tool.get_current_downloads())
156 d.addCallback(show_downloads)159 d.addCallback(show_downloads)
160 elif options.quit:
161 d = sync_daemon_tool.quit()
162 def shutdown_check(result):
163 if result is None and \
164 DBUS_IFACE_NAME in bus.list_names():
165 print "ubuntuone-syncdaemon stopped"
166 else:
167 print "ubuntuone-syncdaemon still running."
168 d.addBoth(shutdown_check)
157 else:169 else:
158 parser.print_help()170 parser.print_help()
159 sys.exit(0)171 sys.exit(0)
160172
=== modified file 'canonical/ubuntuone/storage/syncdaemon/dbus_interface.py'
--- canonical/ubuntuone/storage/syncdaemon/dbus_interface.py 2009-05-13 13:38:20 +0000
+++ canonical/ubuntuone/storage/syncdaemon/dbus_interface.py 2009-05-13 19:58:44 +0000
@@ -369,6 +369,15 @@
369 items = [(mdobj.share_id, mdobj.node_id, "")]369 items = [(mdobj.share_id, mdobj.node_id, "")]
370 self.dbus_iface.action_queue.query(items)370 self.dbus_iface.action_queue.query(items)
371371
372 @dbus.service.method(DBUS_IFACE_SYNC_NAME,
373 in_signature='', out_signature='',
374 async_callbacks=('reply_handler', 'error_handler'))
375 def quit(self, reply_handler=None, error_handler=None):
376 """ shutdown the syncdaemon. """
377 self.dbus_iface.log.debug('Quit requested')
378 if reply_handler:
379 reply_handler()
380 self.dbus_iface.quit()
372381
373class FileSystem(DBusExposedObject):382class FileSystem(DBusExposedObject):
374 """ A dbus interface to the FileSystem Manager. """383 """ A dbus interface to the FileSystem Manager. """
@@ -645,3 +654,7 @@
645 """ Push the SYS_DISCONNECT event. """654 """ Push the SYS_DISCONNECT event. """
646 self.event_queue.push('SYS_DISCONNECT')655 self.event_queue.push('SYS_DISCONNECT')
647656
657 def quit(self):
658 """ calls Main.quit. """
659 self.log.debug('Calling Main.quit')
660 self.main.quit()
648661
=== modified file 'docs/man/u1sdtool.1'
--- docs/man/u1sdtool.1 2009-05-13 15:33:22 +0000
+++ docs/man/u1sdtool.1 2009-05-13 19:58:44 +0000
@@ -34,6 +34,9 @@
34.br34.br
35.B u1sdtool35.B u1sdtool
36\-\-current-transfers36\-\-current-transfers
37.br
38.B u1sdtool
39\-\-quit
3740
38.SH DESCRIPTION41.SH DESCRIPTION
39u1sdtool is a command line command line utility for controlling 42u1sdtool is a command line command line utility for controlling
@@ -46,7 +49,7 @@
46.SH OPTIONS49.SH OPTIONS
47.TP50.TP
48\fB\-\-wait\fR51\fB\-\-wait\fR
49Wait until SyncDaemon reaches nirvana (no more events, uploads and/or downloads)52Wait until ubuntuone-syncdaemon reachs nirvana
50.TP53.TP
51\fB\-\-accept-share\fR=\fISHARE_ID\fR54\fB\-\-accept-share\fR=\fISHARE_ID\fR
52accept the share with the specified id55accept the share with the specified id
@@ -108,6 +111,10 @@
108.TP111.TP
109\fB\-\-current-transfers\fR112\fB\-\-current-transfers\fR
110Show the current uploads and downloads113Show the current uploads and downloads
114.TP
115\fB\-\-quit
116shutdown ubuntuone-syncdaemon
117
111.SH AUTHOR118.SH AUTHOR
112This manual page was written by Guillermo Gonzalez <guillermo.gonzalez@canonical.com>.119This manual page was written by Guillermo Gonzalez <guillermo.gonzalez@canonical.com>.
113120
114121
=== modified file 'tests/syncdaemon/test_dbus.py'
--- tests/syncdaemon/test_dbus.py 2009-05-13 13:38:20 +0000
+++ tests/syncdaemon/test_dbus.py 2009-05-13 19:58:44 +0000
@@ -512,6 +512,23 @@
512 error_handler=self.error_handler)512 error_handler=self.error_handler)
513 return d513 return d
514514
515 def test_quit(self):
516 """ test the quit exposed method. """
517 client = DBusClient(self.bus, '/', DBUS_IFACE_SYNC_NAME)
518 d = defer.Deferred()
519 # helper functions, we need to call quit but don't quit
520 # pylint: disable-msg=C0111,W0601,W0602
521 def fake_quit():
522 pass
523 self.main.quit = fake_quit
524 def handler(result):
525 d.callback(True)
526 d.addCallback(lambda result: self.assertTrue(result))
527 client.call_method('quit',
528 reply_handler=handler,
529 error_handler=self.error_handler)
530 return d
531
515532
516class DBusInterfaceUnicodeTests(DBusTwistedTestCase):533class DBusInterfaceUnicodeTests(DBusTwistedTestCase):
517 """ Unicode variant of basic tests to the objects exposed with D-Bus"""534 """ Unicode variant of basic tests to the objects exposed with D-Bus"""

Subscribers

People subscribed via source and target branches