~ubuntu-branches/ubuntu/wily/blueman/wily

« back to all changes in this revision

Viewing changes to blueman/ods/OdsSession.py

  • Committer: Package Import Robot
  • Author(s): Sean Davis
  • Date: 2015-09-07 12:48:18 UTC
  • mfrom: (2.3.11 sid)
  • Revision ID: package-import@ubuntu.com-20150907124818-evulc0mhjotz8q29
Tags: 2.0-1ubuntu1
* Merge from Debian unstable (LP: #1482626). Remaining changes:
  - debian/patches/03_filemanage_fix.patch:
    + Dropped, no longer needed.
  - debian/patches/dhcpclient_priority
  - debian/patches/01_dont_autostart_lxde.patch
    + Refreshed patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008 Valmantas Paliksa <walmis at balticum-tv dot lt>
2
 
# Copyright (C) 2008 Tadas Dailyda <tadas at dailyda dot com>
3
 
#
4
 
# Licensed under the GNU General Public License Version 3
5
 
#
6
 
# This program is free software: you can redistribute it and/or modify
7
 
# it under the terms of the GNU General Public License as published by
8
 
# the Free Software Foundation, either version 3 of the License, or
9
 
# (at your option) any later version.
10
 
#
11
 
# This program is distributed in the hope that it will be useful,
12
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
# GNU General Public License for more details.
15
 
#
16
 
# You should have received a copy of the GNU General Public License
17
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 
19
 
from gi.repository import GObject
20
 
from blueman.ods.OdsBase import OdsBase
21
 
 
22
 
class OdsSession(OdsBase):
23
 
        __gsignals__ = {
24
 
                'connected' : (GObject.SignalFlags.RUN_FIRST, None, ()),
25
 
                'cancelled' : (GObject.SignalFlags.NO_HOOKS, None, ()),
26
 
                'disconnected' : (GObject.SignalFlags.NO_HOOKS, None, ()),
27
 
                'transfer-started' : (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT,)),
28
 
                'transfer-progress' : (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT,)),
29
 
                'transfer-completed' : (GObject.SignalFlags.NO_HOOKS, None, ()),
30
 
                'error-occurred' : (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT,)),
31
 
        }
32
 
        
33
 
        def __init__(self, obj_path):
34
 
                OdsBase.__init__(self, "org.openobex.Session", obj_path)
35
 
                self.Connected = False
36
 
                self.Handle("Cancelled", self.on_cancelled)
37
 
                self.Handle("Disconnected", self.on_disconnected)
38
 
                self.Handle("TransferStarted", self.on_trans_started)
39
 
                self.Handle("TransferProgress", self.on_trans_progress)
40
 
                self.Handle("TransferCompleted", self.on_trans_complete)
41
 
                self.Handle("ErrorOccurred", self.on_error)
42
 
                
43
 
        def __del__(self):
44
 
                dprint("deleting session")
45
 
                
46
 
        #this is executed by gobject, before the connected signal is emitted
47
 
        def do_connected(self):
48
 
                self.Connected = True
49
 
                
50
 
        def on_cancelled(self):
51
 
                self.emit("cancelled")
52
 
                #self.DisconnectAll()
53
 
                
54
 
        def on_disconnected(self):
55
 
                dprint("disconnected")
56
 
                self.Connected = False
57
 
                self.emit("disconnected")
58
 
                #self.DisconnectAll()
59
 
                
60
 
        def on_trans_started(self, filename, path, size):
61
 
                self.emit("transfer-started", filename, path, size)
62
 
                
63
 
        def on_trans_progress(self, bytes):
64
 
                self.emit("transfer-progress", bytes)
65
 
                
66
 
        def on_trans_complete(self):
67
 
                self.emit("transfer-completed")
68
 
                
69
 
        def on_error(self, name, msg):
70
 
                self.emit("error-occurred", name, msg)
71
 
                #self.DisconnectAll()