~ubuntu-branches/ubuntu/karmic/pessulus/karmic

« back to all changes in this revision

Viewing changes to Pessulus/disabledapplets.py

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Sauthier
  • Date: 2009-09-09 18:22:01 UTC
  • mfrom: (1.2.16 upstream)
  • Revision ID: james.westby@ubuntu.com-20090909182201-duk67sk48mv85udb
Tags: 2.27.92-0ubuntu1
* New upstream version (LP: #419840)
* debian/control.in
  - Drop the python-glade dependency since it uses gtkbuilder now.
* debian/patches/10_desktop_file.patch:
  - updated to reflect the Encoding upstream removal.
* debian/patches/70_mandatory-autoconf.patch:
  - new version update

Show diffs side-by-side

added added

removed removed

Lines of Context:
114
114
        COLUMN_IID,
115
115
        COLUMN_NAME,
116
116
        COLUMN_ICON_NAME,
117
 
        COLUMN_ICON,
118
117
        COLUMN_DISABLED
119
 
    ) = range (5)
 
118
    ) = range (4)
120
119
 
121
120
    def __init__ (self, treeview, lockdownbutton):
122
121
        self.notify_id = None
123
122
        self.key = "/apps/panel/global/disabled_applets"
124
123
        self.disabled_applets = None
125
124
 
126
 
        self.liststore = gtk.ListStore (str, str, str, gtk.gdk.Pixbuf, bool)
 
125
        self.liststore = gtk.ListStore (str, str, str, bool)
127
126
        self.liststore.set_sort_column_id (self.COLUMN_NAME, gtk.SORT_ASCENDING)
128
127
 
129
128
        self.treeview = treeview
130
129
        self.treeview.get_selection ().set_mode (gtk.SELECTION_SINGLE)
131
130
        self.treeview.set_model (self.liststore)
132
 
        self.treeview.connect ("screen-changed", self.__on_screen_changed)
133
131
        self.treeview.connect ("destroy", self.__on_destroyed)
134
132
 
135
133
        self.lockdownbutton = lockdownbutton
136
134
        self.lockdownbutton.connect ("toggled",
137
135
                                     self.__on_lockdownbutton_toggled)
138
136
 
139
 
        screen = self.treeview.get_screen ()
140
 
        self.icon_theme = gtk.icon_theme_get_for_screen (screen)
141
 
 
142
 
        self.icon_theme.connect ("changed", self.__on_icontheme_changed)
143
 
 
144
137
        self.__fill_liststore ()
145
138
        self.__create_columns ()
146
139
 
152
145
        self.notify_id = globalvar.applier.notify_add (self.key,
153
146
                                                       self.__on_notified)
154
147
 
155
 
    def __on_screen_changed (self, widget, screen):
156
 
        self.icon_theme = gtk.icon_theme_get_for_screen (screen)
157
 
        self.__on_icontheme_changed (self.icon_theme)
158
 
 
159
 
    def __on_icontheme_changed (self, icontheme):
160
 
        def update_icon (model, path, iter, data):
161
 
            if model[iter][self.COLUMN_ICON_NAME] != "":
162
 
                model[iter][self.COLUMN_ICON] = icons.load_icon (self.icon_theme, model[iter][self.COLUMN_ICON_NAME])
163
 
 
164
 
        self.liststore.foreach (update_icon, self)
165
 
 
166
148
    def __fill_liststore (self):
167
149
        applets = bonobo.activation.query ("has_all (repo_ids, ['IDL:Bonobo/Control:1.0', 'IDL:GNOME/Vertigo/PanelAppletShell:1.0'])")
168
150
 
181
163
                elif prop.name == "name" and bestname == -1:
182
164
                    name = prop.v.value_string
183
165
                elif prop.name == "panel:icon":
184
 
                    icon = prop.v.value_string
 
166
                    icon = icons.fix_icon_name(prop.v.value_string)
185
167
 
186
168
            if name == None:
187
169
                name = applet.iid
193
175
            self.liststore.set (iter,
194
176
                                self.COLUMN_IID, applet.iid,
195
177
                                self.COLUMN_NAME, name,
196
 
                                self.COLUMN_ICON_NAME, icon,
197
 
                                self.COLUMN_ICON, icons.load_icon (self.icon_theme, icon))
 
178
                                self.COLUMN_ICON_NAME, icon)
198
179
 
199
180
    def __create_columns (self):
200
181
        column = gtk.TreeViewColumn ()
211
192
 
212
193
        cell = gtk.CellRendererPixbuf ()
213
194
        column.pack_start (cell, False)
214
 
        column.set_attributes (cell, pixbuf = self.COLUMN_ICON)
 
195
        column.set_attributes (cell, icon_name = self.COLUMN_ICON_NAME)
215
196
 
216
197
        cell = gtk.CellRendererText ()
217
198
        column.pack_start (cell, True)