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

« back to all changes in this revision

Viewing changes to blueman/plugins/applet/StatusIcon.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
from __future__ import print_function
 
2
from __future__ import division
 
3
from __future__ import absolute_import
 
4
from __future__ import unicode_literals
 
5
 
1
6
from blueman.main.PluginManager import StopException
2
7
from blueman.Functions import *
3
8
from blueman.plugins.AppletPlugin import AppletPlugin
7
12
 
8
13
class StatusIcon(AppletPlugin, Gtk.StatusIcon):
9
14
    __unloadable__ = False
10
 
    __icon__ = "blueman"
11
 
 
12
 
    def on_entry_changed(self, entry, ic, image):
13
 
 
14
 
        if ic.has_icon(self.get_option("icon")):
15
 
            icon = Gtk.STOCK_APPLY
16
 
        else:
17
 
            icon = Gtk.STOCK_CANCEL
18
 
 
19
 
        image.set_from_stock(icon, Gtk.IconSize.LARGE_TOOLBAR)
20
 
 
21
 
        if self.timeout:
22
 
            GObject.source_remove(self.timeout)
23
 
 
24
 
        self.timeout = GObject.timeout_add(1000, lambda: self.IconShouldChange())
25
 
 
26
 
    def widget_decorator(self, widget, name, options):
27
 
        entry = widget.get_children()[1]
28
 
        image = Gtk.Image()
29
 
 
30
 
        completion = Gtk.EntryCompletion()
31
 
        entry.set_completion(completion)
32
 
 
33
 
        liststore = Gtk.ListStore(GObject.TYPE_STRING)
34
 
 
35
 
        completion.set_model(liststore)
36
 
 
37
 
        completion.set_text_column(0)
38
 
 
39
 
        ic = Gtk.IconTheme.get_default()
40
 
        icons = ic.list_icons("Applications")
41
 
        for i in icons:
42
 
            liststore.append([i])
43
 
 
44
 
        if ic.has_icon(self.get_option("icon")):
45
 
            icon = Gtk.STOCK_APPLY
46
 
        else:
47
 
            icon = Gtk.STOCK_CANCEL
48
 
 
49
 
        image.set_from_stock(icon, Gtk.IconSize.LARGE_TOOLBAR)
50
 
        image.show()
51
 
        widget.pack_start(image, True, 0, 0)
52
 
        entry.connect("changed", self.on_entry_changed, ic, image)
53
 
 
54
 
    __options__ = {"icon": {"type": str,
55
 
                            "default": "blueman",
56
 
                            "name": _("Icon Name"),
57
 
                            "desc": _("Custom icon to use for the notification area"),
58
 
                            "decorator": widget_decorator
59
 
    }
60
 
    }
 
15
    __icon__ = "blueman-tray"
61
16
 
62
17
    FORCE_SHOW = 2
63
18
    SHOW = 1
127
82
 
128
83
    def update_tooltip(self):
129
84
        s = ""
130
 
        keys = self.lines.keys()
 
85
        keys = list(self.lines.keys())
131
86
        keys.sort()
132
87
        for k in keys:
133
88
            s += self.lines[k] + "\n"
147
102
        self.QueryVisibility()
148
103
 
149
104
    def on_status_icon_resized(self):
150
 
        self.icon = "blueman"
151
 
 
152
 
        #p = GdkPixbuf.Pixbuf(GdkPixbuf.Colorspace.RGB, True, 8, 22, 22)
153
 
        #p.fill(0)
154
 
 
155
 
 
156
 
        #self.pixbuf.copy_area(0, 0, self.pixbuf.props.width, self.pixbuf.props.height, p, 5, 0)
157
 
 
158
 
        #self.pixbuf = p
 
105
        self.icon = "blueman-tray"
 
106
 
159
107
        ic = Gtk.IconTheme.get_default()
160
108
 
161
109
        def callback(inst, ret):