[PATCH] Convert the mount point entry to one containing a drop down.

Chris Lumens clumens at redhat.com
Thu Feb 7 15:08:33 UTC 2013


The idea here is that it makes things like "swap" more discoverable because
the user can pick them, plus it gets rid of the tooltip that is not at all
accessible.
---
 pyanaconda/ui/gui/spokes/custom.glade | 38 +++++++++++++++++++++--------------
 pyanaconda/ui/gui/spokes/custom.py    |  8 +++++---
 2 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/custom.glade b/pyanaconda/ui/gui/spokes/custom.glade
index 39e3866..6319a50 100644
--- a/pyanaconda/ui/gui/spokes/custom.glade
+++ b/pyanaconda/ui/gui/spokes/custom.glade
@@ -205,21 +205,6 @@ after creating the mount point below.</property>
               </packing>
             </child>
             <child>
-              <object class="GtkEntry" id="addMountPointEntry">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="tooltip_text" translatable="yes">eg: "/", "/home", "swap" (minus the quotation marks)</property>
-                <property name="invisible_char">‚óŹ</property>
-                <property name="completion">mountPointCompletion</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">2</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
               <object class="GtkBox" id="addLabelWarningBox">
                 <property name="can_focus">False</property>
                 <property name="valign">start</property>
@@ -278,6 +263,28 @@ use.  Try something else?</property>
               </packing>
             </child>
             <child>
+              <object class="GtkComboBoxText" id="addMountPointEntry">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="has_entry">True</property>
+                <property name="entry_text_column">0</property>
+                <property name="id_column">1</property>
+                <child internal-child="entry">
+                  <object class="GtkEntry" id="comboboxtext-entry">
+                    <property name="can_focus">True</property>
+                    <property name="buffer">mountPointEntryBuffer</property>
+                    <property name="completion">mountPointCompletion</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">2</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
               <placeholder/>
             </child>
           </object>
@@ -1981,6 +1988,7 @@ use.  Try something else?</property>
   <object class="GtkEntryCompletion" id="mountPointCompletion">
     <property name="model">mountPointStore</property>
   </object>
+  <object class="GtkEntryBuffer" id="mountPointEntryBuffer"/>
   <object class="GtkListStore" id="mountPointStore">
     <columns>
       <!-- column-name path -->
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 8d00108..503ff11 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -192,7 +192,7 @@ def validate_mountpoint(mountpoint, used_mountpoints, strict=True):
     return valid
 
 class AddDialog(GUIObject):
-    builderObjects = ["addDialog", "mountPointStore", "mountPointCompletion"]
+    builderObjects = ["addDialog", "mountPointStore", "mountPointCompletion", "mountPointEntryBuffer"]
     mainWidgetName = "addDialog"
     uiFile = "spokes/custom.glade"
 
@@ -205,13 +205,14 @@ class AddDialog(GUIObject):
 
         store = self.builder.get_object("mountPointStore")
         populate_mountpoint_store(store, self.mountpoints)
+        self.builder.get_object("addMountPointEntry").set_model(store)
 
         completion = self.builder.get_object("mountPointCompletion")
         completion.set_text_column(0)
         completion.set_popup_completion(True)
 
     def on_add_confirm_clicked(self, button, *args):
-        self.mountpoint = self.builder.get_object("addMountPointEntry").get_text()
+        self.mountpoint = self.builder.get_object("addMountPointEntry").get_active_text()
         self._error = validate_mountpoint(self.mountpoint, self.mountpoints,
                                           strict=False)
         self._warningLabel.set_text(_(mountpoint_validation_msgs[self._error]))
@@ -417,7 +418,8 @@ class HelpDialog(GUIObject):
 class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
     builderObjects = ["customStorageWindow", "sizeAdjustment",
                       "partitionStore", "raidStoreFiltered", "raidLevelStore",
-                      "addImage", "removeImage", "settingsImage"]
+                      "addImage", "removeImage", "settingsImage",
+                      "mountPointCompletion", "mountPointStore"]
     mainWidgetName = "customStorageWindow"
     uiFile = "spokes/custom.glade"
 
-- 
1.7.11.2



More information about the anaconda-patches mailing list