summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Heinlein <sebastian.heinlein@web.de>2006-03-17 17:00:16 +0100
committerSebastian Heinlein <sebastian.heinlein@web.de>2006-03-17 17:00:16 +0100
commitc76b021053ff70b1766b2217eb5705929f1cc93e (patch)
tree11c8248f450f54c7b3749143918e1ab5487a8ce3
parent066a73badbb192b7d937473579becf39b734fbb2 (diff)
downloadpython-apt-c76b021053ff70b1766b2217eb5705929f1cc93e.tar.gz
* allow to enable and disable channels/sources
* disable edit and remove button if no sources are available * always select the first source at startup * use the reload icon on the check button
-rw-r--r--SoftwareProperties/SoftwareProperties.py21
-rw-r--r--data/SoftwarePropertiesDialogs.glade66
2 files changed, 84 insertions, 3 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):
diff --git a/data/SoftwarePropertiesDialogs.glade b/data/SoftwarePropertiesDialogs.glade
index d17f7ce5..a4d7ff41 100644
--- a/data/SoftwarePropertiesDialogs.glade
+++ b/data/SoftwarePropertiesDialogs.glade
@@ -1021,11 +1021,73 @@ Source</property>
<property name="has_default">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
- <property name="label" translatable="yes">_Reload</property>
- <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-10</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox37">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image5">
+ <property name="visible">True</property>
+ <property name="stock">gtk-refresh</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label71">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Reload</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
</widget>
</child>