[jhbuild: 28/60] [gui] select currently active module in module selection dialog



commit 3554928f6bc0fcf146f4df172ef1d8684f0dd593
Author: Frédéric Péters <fpeters 0d be>
Date:   Sun May 17 18:41:15 2009 +0200

    [gui] select currently active module in module selection dialog
---
 jhbuild/frontends/gtkui.py |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/jhbuild/frontends/gtkui.py b/jhbuild/frontends/gtkui.py
index 86ffaf1..ce102d3 100644
--- a/jhbuild/frontends/gtkui.py
+++ b/jhbuild/frontends/gtkui.py
@@ -239,7 +239,8 @@ class AppWindow(gtk.Window, buildscript.BuildScript):
             return
         # "Others..." got clicked, modal dialog to let the user select a
         # specific module
-        dlg = SelectModulesDialog(self)
+        current_module = self.modules_list_model.get(old_selected_iter, 0)[0]
+        dlg = SelectModulesDialog(self, current_module)
         response = dlg.run()
         if response != gtk.RESPONSE_OK:
             dlg.destroy()
@@ -427,11 +428,19 @@ class AppWindow(gtk.Window, buildscript.BuildScript):
 
 
 class SelectModulesDialog(gtk.Dialog):
-    def __init__(self, parent):
+    def __init__(self, parent, default_module=None):
         gtk.Dialog.__init__(self, '', parent)
         self.app = parent
         self.create_model()
         self.create_ui()
+
+        if default_module:
+            for module_row in self.modules_model:
+                if self.modules_model.get(module_row.iter, 0)[0] == default_module:
+                    self.treeview.get_selection().select_iter(module_row.iter)
+                    self.treeview.scroll_to_cell(
+                            self.modules_model.get_path(module_row.iter))
+                    break
         self.connect('response', self.on_response_cb)
 
     def create_model(self):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]