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

[f15-branch] iscsi: disable the 'Login' button with no nodes selected.



Resolves: rhbz#700085
---
 data/ui/iscsi-dialogs.glade       |    2 +-
 pyanaconda/iw/advanced_storage.py |   11 +++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/data/ui/iscsi-dialogs.glade b/data/ui/iscsi-dialogs.glade
index 342a0b5..591cbf1 100644
--- a/data/ui/iscsi-dialogs.glade
+++ b/data/ui/iscsi-dialogs.glade
@@ -311,7 +311,7 @@
               </packing>
             </child>
             <child>
-              <widget class="GtkButton" id="button3">
+              <widget class="GtkButton" id="button_login">
                 <property name="label" translatable="yes">_Login</property>
                 <property name="response_id">1</property>
                 <property name="visible">True</property>
diff --git a/pyanaconda/iw/advanced_storage.py b/pyanaconda/iw/advanced_storage.py
index 40a3585..ade1135 100644
--- a/pyanaconda/iw/advanced_storage.py
+++ b/pyanaconda/iw/advanced_storage.py
@@ -19,6 +19,7 @@ import gettext
 _ = lambda x: gettext.ldgettext("anaconda", x)
 
 # UI methods for supporting adding advanced storage devices.
+import functools
 import gobject
 import gtk
 import gtk.glade
@@ -222,6 +223,9 @@ class iSCSIGuiWizard(pih.iSCSIWizard):
         return self._run_dialog(self.login_dialog.dialog)
 
     def display_nodes_dialog(self, found_nodes):
+        def _login_button_disabler(device_selector, login_button, checked, item):
+            login_button.set_sensitive(len(device_selector.getSelected()) > 0)
+
         (xml, dialog) = gui.getGladeWidget("iscsi-dialogs.glade", "nodes_dialog")
         store = gtk.TreeStore(
             gobject.TYPE_PYOBJECT, # teh object
@@ -237,7 +241,7 @@ class iSCSIGuiWizard(pih.iSCSIWizard):
                     False,       # not immutable
                     node.name)),  # node's name
             found_nodes)
-        
+
         # create and setup the device selector
         model = store.filter_new()
         view = gtk.TreeView(model)
@@ -245,7 +249,10 @@ class iSCSIGuiWizard(pih.iSCSIWizard):
             store,
             model,
             view)
-        ds.createSelectionCol()
+        callback = functools.partial(_login_button_disabler,
+                                     ds,
+                                     xml.get_widget("button_login"))
+        ds.createSelectionCol(toggledCB=callback)
         ds.addColumn(_("Node Name"), self.NODE_NAME_COL)
         # attach the treeview to the dialog
         sw = xml.get_widget("nodes_scrolled_window")
-- 
1.7.3.3


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