~chrismcginlay/ubuntu/natty/ubuntuone-control-panel/ubuntuone-control-panel-fix-715820

« back to all changes in this revision

Viewing changes to ubuntuone/controlpanel/dbus_client.py

  • Committer: Ken VanDine
  • Date: 2011-02-12 03:26:53 UTC
  • mfrom: (11.1.1 ubuntuone-control-panel)
  • Revision ID: ken.vandine@canonical.com-20110212032653-3q0c2phnvfxlby1o
Tags: 0.8.3-0ubuntu1
releasing version 0.8.3-0ubuntu1

Show diffs side-by-side

added added

removed removed

Lines of Context:
221
221
    return d
222
222
 
223
223
 
 
224
def get_shares_dir():
 
225
    """Retrieve the shares information from syncdaemon."""
 
226
    d = defer.Deferred()
 
227
    proxy = get_syncdaemon_proxy("/", sd_dbus_iface.DBUS_IFACE_SYNC_NAME)
 
228
    proxy.get_sharesdir(reply_handler=d.callback, error_handler=d.errback)
 
229
    return d
 
230
 
 
231
 
 
232
def get_shares_dir_link():
 
233
    """Retrieve the shares information from syncdaemon."""
 
234
    d = defer.Deferred()
 
235
    proxy = get_syncdaemon_proxy("/", sd_dbus_iface.DBUS_IFACE_SYNC_NAME)
 
236
    proxy.get_sharesdir_link(reply_handler=d.callback, error_handler=d.errback)
 
237
    return d
 
238
 
 
239
 
224
240
def get_folders():
225
241
    """Retrieve the folders information from syncdaemon."""
226
242
    d = defer.Deferred()
256
272
    proxy = get_folders_syncdaemon_proxy()
257
273
 
258
274
    sig = proxy.connect_to_signal('FolderSubscribed', d.callback)
259
 
    cb = lambda folder_info, error: d.errback(VolumesError(folder_info, error))
 
275
    cb = lambda info, error: d.errback(VolumesError(info['id'], error))
260
276
    esig = proxy.connect_to_signal('FolderSubscribeError', cb)
261
277
 
262
278
    proxy.subscribe(folder_id, reply_handler=no_op, error_handler=no_op)
277
293
    proxy = get_folders_syncdaemon_proxy()
278
294
 
279
295
    sig = proxy.connect_to_signal('FolderUnSubscribed', d.callback)
280
 
    cb = lambda folder_info, error: d.errback(VolumesError(folder_info, error))
 
296
    cb = lambda info, error: d.errback(VolumesError(info['id'], error))
281
297
    esig = proxy.connect_to_signal('FolderUnSubscribeError', cb)
282
298
 
283
299
    proxy.unsubscribe(folder_id, reply_handler=no_op, error_handler=no_op)
292
308
    return d
293
309
 
294
310
 
 
311
@defer.inlineCallbacks
 
312
def get_shares():
 
313
    """Retrieve the shares information from syncdaemon."""
 
314
    result = yield SyncDaemonTool(bus=dbus.SessionBus()).get_shares()
 
315
    defer.returnValue(result)
 
316
 
 
317
 
 
318
@defer.inlineCallbacks
 
319
def subscribe_share(share_id):
 
320
    """Subscribe to 'share_id'."""
 
321
    try:
 
322
        yield SyncDaemonTool(bus=dbus.SessionBus()).subscribe_share(share_id)
 
323
    except Exception, e:
 
324
        raise VolumesError(share_id, e)
 
325
 
 
326
 
 
327
@defer.inlineCallbacks
 
328
def unsubscribe_share(share_id):
 
329
    """Unsubscribe 'share_id'."""
 
330
    try:
 
331
        yield SyncDaemonTool(bus=dbus.SessionBus()).unsubscribe_share(share_id)
 
332
    except Exception, e:
 
333
        raise VolumesError(share_id, e)
 
334
 
 
335
 
295
336
def get_current_status():
296
337
    """Retrieve the current status from syncdaemon."""
297
338
    d = defer.Deferred()