diff options
| author | Sebastian Heinlein <renate@hph4> | 2006-04-17 16:02:01 +0200 |
|---|---|---|
| committer | Sebastian Heinlein <renate@hph4> | 2006-04-17 16:02:01 +0200 |
| commit | b06e74048b8b959e4216e79af759d0d4ad365573 (patch) | |
| tree | 565196570ae10d30b21cbcbcaa406e8017788e53 /SoftwareProperties | |
| parent | 9df8fab9dfb94faaf938c9959e743c87a814a88f (diff) | |
| download | python-apt-b06e74048b8b959e4216e79af759d0d4ad365573.tar.gz | |
* remove a source entry if it contains no components
Diffstat (limited to 'SoftwareProperties')
| -rw-r--r-- | SoftwareProperties/dialog_add.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/SoftwareProperties/dialog_add.py b/SoftwareProperties/dialog_add.py index fbf741c5..b5fbe07f 100644 --- a/SoftwareProperties/dialog_add.py +++ b/SoftwareProperties/dialog_add.py @@ -172,13 +172,19 @@ class dialog_add: self.selected_comps = [] vbox = self.gladexml.get_widget("vbox_comps") vbox.foreach(self.get_enabled_comps) + # check if we are in 'add' or 'edit' mode if self.source_entry: # 'edit' - ode - if not self.custom: - entry = self._make_source_entry() - if entry: - self.sourceslist.list[self.source_entry_index] = entry + # check if there are no selected components + if len(self.selected_comps) < 1: + # remove the source + self.sourceslist.remove(self.source_entry) + else: + if not self.custom: + entry = self._make_source_entry() + if entry: + self.sourceslist.list[self.source_entry_index] = entry else: # 'add' mode self.sourceslist.add(self.selected.type, |
