summaryrefslogtreecommitdiff
path: root/SoftwareProperties
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-03-24 16:03:23 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2006-03-24 16:03:23 +0100
commit3d4f9a0c623acf75b7b9159c2a3f987deebee755 (patch)
tree9a3092fe2a291d9bb3f29aeab9248101c77f7aaf /SoftwareProperties
parent8fc275dc1e0ba0bd54c564367f769d56ebfc2e30 (diff)
parentb151c61e5838fe08af8cc25c36c045a44ad0c98b (diff)
downloadpython-apt-3d4f9a0c623acf75b7b9159c2a3f987deebee755.tar.gz
* merged from glatzor
Diffstat (limited to 'SoftwareProperties')
-rw-r--r--SoftwareProperties/SoftwareProperties.py43
1 files changed, 34 insertions, 9 deletions
diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py
index 5d39f5b1..9613b49e 100644
--- a/SoftwareProperties/SoftwareProperties.py
+++ b/SoftwareProperties/SoftwareProperties.py
@@ -224,15 +224,15 @@ 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:
- if path_x == None or self.treeview_sources.set_cursor(path_x):
+ # try to reselect the latest selected channel or if it fails the first
+ # one
+ if len(self.source_store) > 0 and \
+ (path_x == None or self.treeview_sources.set_cursor(path_x)):
self.treeview_sources.set_cursor(0)
- self.button_remove.set_sensitive(True)
- self.button_edit.set_sensitive(True)
-
+ else:
+ # call the cursor_changed signal if no channel is selected
+ self.treeview_sources.emit("cursor_changed")
+
def reload_keyslist(self):
self.keys_store.clear()
for key in self.apt_key.list():
@@ -368,7 +368,32 @@ class SoftwareProperties(SimpleGladeApp):
if dialog.run() == gtk.RESPONSE_OK:
self.reload_sourceslist()
self.modified = True
-
+
+ def on_channel_activated(self, treeview, path, column):
+ """Open the edit dialog if a channel was double clicked"""
+ # check if the channel can be edited
+ if self.button_edit.get_property("sensitive") == True:
+ self.on_edit_clicked(treeview)
+
+ def on_treeview_sources_cursor_changed(self, treeview):
+ """set the sensitiveness of the edit and remove button
+ corresponding to the selected channel"""
+ sel = self.treeview_sources.get_selection()
+ (model, iter) = sel.get_selected()
+ if not iter:
+ # No channel is selected, so disable edit and remove
+ self.button_edit.set_sensitive(False)
+ self.button_remove.set_sensitive(False)
+ return
+ # allow to remove the selected channel
+ self.button_remove.set_sensitive(True)
+ # disable editing of cdrom sources
+ source_entry = model.get_value(iter, LIST_ENTRY_OBJ)
+ if source_entry.uri.startswith("cdrom:"):
+ self.button_edit.set_sensitive(False)
+ else:
+ self.button_edit.set_sensitive(True)
+
def on_remove_clicked(self, widget):
sel = self.treeview_sources.get_selection()
(model, iter) = sel.get_selected()