From 77b2f46a4079c35ca7a5fc4ff2bb80d57e3ba024 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 27 Feb 2006 16:02:35 +0100 Subject: * show the already enabled components for a given dist if "add" is clicked --- SoftwareProperties/aptsources.py | 2 +- SoftwareProperties/dialog_add.py | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/SoftwareProperties/aptsources.py b/SoftwareProperties/aptsources.py index 0340e211..0546ef0a 100644 --- a/SoftwareProperties/aptsources.py +++ b/SoftwareProperties/aptsources.py @@ -448,7 +448,7 @@ class SourceCompTemplate: self.on_by_default = on_by_default class SourceEntryTemplates: - def __init__(self,datadir): + def __init__(self, datadir): _ = gettext.gettext self.templates = [] diff --git a/SoftwareProperties/dialog_add.py b/SoftwareProperties/dialog_add.py index a1ac713b..05737769 100644 --- a/SoftwareProperties/dialog_add.py +++ b/SoftwareProperties/dialog_add.py @@ -120,11 +120,26 @@ class dialog_add: a_iter = liststore.iter_nth_child(None, combobox.get_active()) (name, template) = liststore.get(a_iter, 0,1) self.selected = template + + # figure what is currently active in the sources.list + already_enabled_comps = [] + for entry in self.sourceslist: + if entry.disabled or entry.invalid or entry.type != "deb": + continue + if template.dist == entry.dist and \ + self.sourceslist.is_mirror(template.uri, entry.uri): + already_enabled_comps = entry.comps + comps = template.comps self.comps=[] for c in comps: checkbox = gtk.CheckButton(c.description) - checkbox.set_active(c.on_by_default) + # show what should be enabled by default if the source was not found + # else show the already enabled ones + if len(already_enabled_comps) == 0: + checkbox.set_active(c.on_by_default) + else: + checkbox.set_active(c.name in already_enabled_comps) checkbox.set_data("name",c.name) checkbox.connect("toggled", self.count_comps) self.vbox.pack_start(checkbox) @@ -150,7 +165,7 @@ class dialog_add: if res == gtk.RESPONSE_OK: # add repository if self.official == True: - self.selected_comps = [] + #self.selected_comps = [] self.sourceslist.add(self.selected.type, self.selected.uri, self.selected.dist, -- cgit v1.2.3