From b06e74048b8b959e4216e79af759d0d4ad365573 Mon Sep 17 00:00:00 2001 From: Sebastian Heinlein Date: Mon, 17 Apr 2006 16:02:01 +0200 Subject: * remove a source entry if it contains no components --- SoftwareProperties/dialog_add.py | 14 ++++++++++---- 1 file 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, -- cgit v1.2.3