~ubuntu-core-dev/update-manager/main

« back to all changes in this revision

Viewing changes to UpdateManager/Core/AlertWatcher.py

  • Committer: Michael Vogt
  • Date: 2011-07-08 07:46:54 UTC
  • mfrom: (2146.2.16 pygi)
  • Revision ID: michael.vogt@ubuntu.com-20110708074654-nbcspqmsrlbxc6p0
merged from the pygi branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20
20
#  USA
21
21
 
22
 
import gobject
 
22
from gi.repository import GObject
23
23
import dbus
24
24
from dbus.mainloop.glib import DBusGMainLoop
25
25
 
26
 
class AlertWatcher(gobject.GObject):
 
26
class AlertWatcher(GObject.GObject):
27
27
    """ a class that checks for alerts and reports them, like a battery
28
28
    or network warning """
29
29
    
30
 
    __gsignals__ = {"network-alert": (gobject.SIGNAL_RUN_FIRST,
31
 
                                      gobject.TYPE_NONE,
32
 
                                      (gobject.TYPE_INT,)),
33
 
                    "battery-alert": (gobject.SIGNAL_RUN_FIRST,
34
 
                                      gobject.TYPE_NONE,
35
 
                                      (gobject.TYPE_BOOLEAN,)),
36
 
                    "network-3g-alert": (gobject.SIGNAL_RUN_FIRST,
37
 
                                         gobject.TYPE_NONE,
38
 
                                        (gobject.TYPE_BOOLEAN,
39
 
                                         gobject.TYPE_BOOLEAN,)),
 
30
    __gsignals__ = {"network-alert": (GObject.SignalFlags.RUN_FIRST,
 
31
                                      None,
 
32
                                      (GObject.TYPE_INT,)),
 
33
                    "battery-alert": (GObject.SignalFlags.RUN_FIRST,
 
34
                                      None,
 
35
                                      (GObject.TYPE_BOOLEAN,)),
 
36
                    "network-3g-alert": (GObject.SignalFlags.RUN_FIRST,
 
37
                                         None,
 
38
                                        (GObject.TYPE_BOOLEAN,
 
39
                                         GObject.TYPE_BOOLEAN,)),
40
40
                    }
41
41
    
42
42
    def __init__(self):
43
 
        gobject.GObject.__init__(self)
 
43
        GObject.GObject.__init__(self)
44
44
        DBusGMainLoop(set_as_default=True)
45
45
        self.bus = dbus.Bus(dbus.Bus.TYPE_SYSTEM)
46
46
        self.network_state = 3 # make it always connected if NM isn't available