diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-03-20 11:16:50 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-03-20 11:16:50 +0100 |
| commit | 78f281065fb9bbd8a36b52b457397b3e886abcc7 (patch) | |
| tree | 6bee9758f1742be4ce97cec7f4ae605bbe877cc8 /SoftwareProperties | |
| parent | 56fa71590be9df25acc234df153412ef68a30ae2 (diff) | |
| parent | 8cfb54ced335aa488ca3cfad00dad434617fb62a (diff) | |
| download | python-apt-78f281065fb9bbd8a36b52b457397b3e886abcc7.tar.gz | |
* fix the missing toggle buttons in software-properties
Diffstat (limited to 'SoftwareProperties')
| -rw-r--r-- | SoftwareProperties/SoftwareProperties.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py index 41da0b32..4902e44d 100644 --- a/SoftwareProperties/SoftwareProperties.py +++ b/SoftwareProperties/SoftwareProperties.py @@ -190,6 +190,11 @@ class SoftwareProperties(SimpleGladeApp): source_col = gtk.TreeViewColumn("Description", tr, markup=LIST_MARKUP) source_col.set_max_width(500) + toggle = gtk.CellRendererToggle() + toggle.connect("toggled", self.on_channel_toggled) + toggle_col = gtk.TreeViewColumn("Active", toggle, active=LIST_ENABLED) + + self.treeview_sources.append_column(toggle_col) self.treeview_sources.append_column(source_col) self.sourceslist = aptsources.SourcesList() @@ -207,7 +212,7 @@ class SoftwareProperties(SimpleGladeApp): def reload_sourceslist(self): self.source_store.clear() for source in self.sourceslist.list: - if source.invalid or source.disabled: + if source.invalid: continue (a_type, dist, comps) = self.matcher.match(source) @@ -217,6 +222,13 @@ class SoftwareProperties(SimpleGladeApp): contents +="<big><b>%s </b></big> (%s) <small>\n%s</small>" % (dist,a_type, comps) self.source_store.append([contents, not source.disabled, source]) + if len(self.source_store) < 1: + self.button_remove.set_sensitive(False) + self.button_edit.set_sensitive(False) + else: + self.button_remove.set_sensitive(True) + self.button_edit.set_sensitive(True) + self.treeview_sources.set_cursor(0) def reload_keyslist(self): self.keys_store.clear() @@ -445,6 +457,13 @@ class SoftwareProperties(SimpleGladeApp): self.reload_sourceslist() self.modified = True + def on_channel_toggled(self, cell_toggle, path): + """Enable or disable the selected channel""" + iter = self.source_store.get_iter((int(path),)) + source_entry = self.source_store.get_value(iter, LIST_ENTRY_OBJ) + source_entry.disabled = not source_entry.disabled + self.reload_sourceslist() + self.modified = True # FIXME: move this into a different file class GtkCdromProgress(apt.progress.CdromProgress, SimpleGladeApp): |
