~osomon/moovida/upicek_plugins_management_ui

« back to all changes in this revision

Viewing changes to elisa-plugins/elisa/plugins/poblesec/plugins.py

  • Committer: Olivier Tilloy
  • Date: 2008-11-07 12:36:23 UTC
  • Revision ID: olivier@fluendo.com-20081107123623-v2fmcegxy5ytr9z8
Remove a plugin from the list of new plugins once it has been installed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
162
162
        dfr = super(FindNewPluginsController, self).initialize()
163
163
        self._plugin_dicts = {}
164
164
        dfr.addCallback(self._populate_collection)
 
165
        dfr.addCallback(self._connect_bus)
165
166
        return dfr
166
167
 
 
168
    def clean(self):
 
169
        bus = common.application.bus
 
170
        bus.unregister(self._plugin_status_changed_cb)
 
171
        return super(FindNewPluginsController, self).clean()
 
172
 
167
173
    def _populate_collection(self, result):
168
174
        def get_plugin_list(cache_file):
169
175
            plugins = \
192
198
        dfr.addCallback(lambda x: result)
193
199
        return dfr
194
200
 
 
201
    def _connect_bus(self, result):
 
202
        bus = common.application.bus
 
203
        bus.register(self._plugin_status_changed_cb, PluginStatusMessage)
 
204
        return result
 
205
 
 
206
    def _plugin_status_changed_cb(self, message, sender):
 
207
        # Notification that the status of a plugin has changed.
 
208
        # It may mean that a new plugin has been installed, in which case we
 
209
        # want to remove it from the list.
 
210
        for plugin in self.model:
 
211
            if plugin.name == message.plugin_name:
 
212
                self.model.remove(plugin)
 
213
                if len(self.model) == 0:
 
214
                    self.empty_label = _('All the available plugins have ' \
 
215
                                         'been successfully installed.')
 
216
                    self.toggle_empty_alert(True)
 
217
                break
 
218
 
195
219
    def node_clicked(self, widget, item):
196
220
        browser = self.frontend.retrieve_controllers('/poblesec/browser')[0]
197
221
        path = '/poblesec/plugins/information'