diff options
-rw-r--r-- | src/frontend/RcUpdateWindow.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/frontend/RcUpdateWindow.py b/src/frontend/RcUpdateWindow.py index a9653e1..29533f7 100644 --- a/src/frontend/RcUpdateWindow.py +++ b/src/frontend/RcUpdateWindow.py @@ -55,7 +55,7 @@ class RcUpdateWindow(gtk.Window): for level in self.runlevels: renderer = gtk.CellRendererToggle() renderer.set_property("activatable", True) - renderer.connect("toggled", self.entry_toggled) + renderer.connect("toggled", self.entry_toggled, i) column = gtk.TreeViewColumn(level) column.pack_start(renderer, False) column.add_attribute(renderer, 'active', i) @@ -101,9 +101,22 @@ class RcUpdateWindow(gtk.Window): else: pass #say something about having to be a root user to rc-update - def entry_toggled(self, cell, path): - #column = int(path) - #self.tv_store[path][0] = not self.tv_store[path][0] + def entry_toggled(self, cell, path, column): + add = not self.tv_store[path][column] + scriptName = self.tv_store[path][0] + call = ["rc-update"] + if add: + call.append("add") + else: + call.append("del") + call.append(scriptName) + level = self.runlevels[column-1] + call.append(level) + retcode = subprocess.call(call) + if retcode == 0: + self.tv_store[path][column] = not self.tv_store[path][column] + else: + print "Call to rc-update failed." #TODO: print nice error. #self.emit("entry-toggled", path) pass |