The home directory checkbox didn't actually do anything, the UID & GID spin buttons didn't spin, and whatever was in the home directory entry the first time around was used as the home directory, even if you hit cancel.
David Shea (3): Remove the "Create a home directory" checkbox Set an upper limit on uids and gids. Ignore the home directory setting if no change was requested (#1119900)
pyanaconda/ui/gui/spokes/advanced_user.glade | 92 ++++------------------------ pyanaconda/ui/gui/spokes/user.py | 28 +++++---- 2 files changed, 29 insertions(+), 91 deletions(-)
No one complained about the checkbox not working, so let's see if anyone complains about not having it. --- pyanaconda/ui/gui/spokes/advanced_user.glade | 90 ++++------------------------ pyanaconda/ui/gui/spokes/user.py | 10 +--- 2 files changed, 12 insertions(+), 88 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/advanced_user.glade b/pyanaconda/ui/gui/spokes/advanced_user.glade index 05f99e7..6648d2e 100644 --- a/pyanaconda/ui/gui/spokes/advanced_user.glade +++ b/pyanaconda/ui/gui/spokes/advanced_user.glade @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.16.1 --> +<!-- Generated with glade 3.18.3 --> <interface> <requires lib="gtk+" version="3.0"/> <object class="GtkAdjustment" id="gid"> @@ -89,39 +89,17 @@ </packing> </child> <child> - <object class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_top">8</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Home Directory</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> <object class="GtkBox" id="box2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="margin_left">16</property> - <property name="orientation">vertical</property> + <property name="margin_top">3</property> <child> - <object class="GtkCheckButton" id="c_home"> - <property name="label" translatable="yes" context="GUI|Advanced User">Create a _home directory for this user.</property> + <object class="GtkLabel" id="l_home"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="margin_top">4</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="GUI|Advanced User">Home _directory:</property> <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="_apply_checkboxes" swapped="no"/> + <property name="mnemonic_widget">t_home</property> </object> <packing> <property name="expand">False</property> @@ -130,40 +108,10 @@ </packing> </child> <child> - <object class="GtkBox" id="box3"> + <object class="GtkEntry" id="t_home"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_left">42</property> - <property name="margin_top">3</property> - <child> - <object class="GtkLabel" id="l_home"> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="GUI|Advanced User">Home _directory:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">t_home</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="t_home"> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can_focus">True</property> - <property name="margin_left">13</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> + <property name="can_focus">True</property> + <property name="margin_left">8</property> </object> <packing> <property name="expand">True</property> @@ -173,9 +121,9 @@ </child> </object> <packing> - <property name="expand">True</property> + <property name="expand">False</property> <property name="fill">True</property> - <property name="position">2</property> + <property name="position">1</property> </packing> </child> <child> @@ -215,8 +163,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -233,8 +179,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -251,8 +195,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -268,8 +210,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -347,8 +287,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -366,8 +304,6 @@ Groups that do not already exist will be created; specify their GID in parenthes <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -383,8 +319,6 @@ Groups that do not already exist will be created; specify their GID in parenthes <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -402,8 +336,6 @@ Groups that do not already exist will be created; specify their GID in parenthes <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> diff --git a/pyanaconda/ui/gui/spokes/user.py b/pyanaconda/ui/gui/spokes/user.py index 6fc8b1c..1444348 100644 --- a/pyanaconda/ui/gui/spokes/user.py +++ b/pyanaconda/ui/gui/spokes/user.py @@ -79,7 +79,6 @@ class AdvancedUserDialog(GUIObject, GUIDialogInputCheckHandler): self._groupDict = groupDict
def _grabObjects(self): - self._cHome = self.builder.get_object("c_home") self._cUid = self.builder.get_object("c_uid") self._cGid = self.builder.get_object("c_gid") self._tHome = self.builder.get_object("t_home") @@ -104,12 +103,9 @@ class AdvancedUserDialog(GUIObject, GUIDialogInputCheckHandler): checkbox states on the screen. It is called from the toggled Gtk event. """ - c_home = self._cHome.get_active() c_uid = self._cUid.get_active() c_gid = self._cGid.get_active()
- self._tHome.set_sensitive(c_home) - self._lHome.set_sensitive(c_home) self._spinUid.set_sensitive(c_uid) self._spinGid.set_sensitive(c_gid)
@@ -138,7 +134,6 @@ class AdvancedUserDialog(GUIObject, GUIDialogInputCheckHandler): self._tHome.set_text(homedir) self._user.homedir = homedir
- self._cHome.set_active(bool(self._user.homedir)) self._cUid.set_active(bool(self._user.uid)) self._cGid.set_active(bool(self._user.gid)) self._apply_checkboxes() @@ -166,10 +161,7 @@ class AdvancedUserDialog(GUIObject, GUIDialogInputCheckHandler):
#OK clicked if rc == 1: - if self._cHome.get_active(): - self._user.homedir = self._tHome.get_text() - else: - self._user.homedir = None + self._user.homedir = self._tHome.get_text()
if self._cUid.get_active(): self._user.uid = int(self._uid.get_value())
On Tue, 2014-07-15 at 17:54 -0400, David Shea wrote:
No one complained about the checkbox not working, so let's see if anyone complains about not having it.
Just want to say I really like this approach. ACK!
It turns out that you can't have a GtkAdjustment without an upper limit, or at least you can't in every minor release of Gtk. Set the upper limit on uid and gid input to UINT_MAX.
This was added to rhel7-branch but not pushed to master.
(cherry picked from commit 4fdf2b1b55481c002da2cafe8cc9965a655bd50b) --- pyanaconda/ui/gui/spokes/advanced_user.glade | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/pyanaconda/ui/gui/spokes/advanced_user.glade b/pyanaconda/ui/gui/spokes/advanced_user.glade index 6648d2e..2065631 100644 --- a/pyanaconda/ui/gui/spokes/advanced_user.glade +++ b/pyanaconda/ui/gui/spokes/advanced_user.glade @@ -4,12 +4,14 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkAdjustment" id="gid"> <property name="lower">1000</property> + <property name="upper">4294967295</property> <property name="value">1000</property> <property name="step_increment">1</property> <property name="page_increment">10</property> </object> <object class="GtkAdjustment" id="uid"> <property name="lower">1000</property> + <property name="upper">4294967295</property> <property name="value">1000</property> <property name="step_increment">1</property> <property name="page_increment">10</property>
This fixes a bug in which the value of username upon entering the advanced user dialog is used as the path for the user's home directory, regardless of any further changes to the username and regardless of whether the advanced user dialog was exited with OK or cancel. Only use the advanced homedir path if the path was changed and OK was clicked, but if the path was explicitly set at any point then do not use the /home/<username> default. --- pyanaconda/ui/gui/spokes/user.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/user.py b/pyanaconda/ui/gui/spokes/user.py index 1444348..654a647 100644 --- a/pyanaconda/ui/gui/spokes/user.py +++ b/pyanaconda/ui/gui/spokes/user.py @@ -78,6 +78,11 @@ class AdvancedUserDialog(GUIObject, GUIDialogInputCheckHandler): self._user = user self._groupDict = groupDict
+ # Track whether the user has requested a home directory other + # than the default. + self._origHome = None + self._homeSet = False + def _grabObjects(self): self._cUid = self.builder.get_object("c_uid") self._cGid = self.builder.get_object("c_gid") @@ -128,11 +133,12 @@ class AdvancedUserDialog(GUIObject, GUIDialogInputCheckHandler):
def refresh(self): if self._user.homedir: - self._tHome.set_text(self._user.homedir) + homedir = self._user.homedir elif self._user.name: homedir = "/home/" + self._user.name - self._tHome.set_text(homedir) - self._user.homedir = homedir + + self._tHome.set_text(homedir) + self._origHome = homedir
self._cUid.set_active(bool(self._user.uid)) self._cGid.set_active(bool(self._user.gid)) @@ -161,7 +167,13 @@ class AdvancedUserDialog(GUIObject, GUIDialogInputCheckHandler):
#OK clicked if rc == 1: - self._user.homedir = self._tHome.get_text() + # If the user changed the home directory input, either this time or + # during any earlier run of the dialog, set homedir to the value + # in the input box. + homedir = self._tHome.get_text() + if self._homeSet or self._origHome != homedir: + self._homeSet = True + self._user.homedir = homedir
if self._cUid.get_active(): self._user.uid = int(self._uid.get_value())
On Tue, Jul 15, 2014 at 05:54:28PM -0400, David Shea wrote:
The home directory checkbox didn't actually do anything, the UID & GID spin buttons didn't spin, and whatever was in the home directory entry the first time around was used as the home directory, even if you hit cancel.
David Shea (3): Remove the "Create a home directory" checkbox Set an upper limit on uids and gids. Ignore the home directory setting if no change was requested (#1119900)
pyanaconda/ui/gui/spokes/advanced_user.glade | 92 ++++------------------------ pyanaconda/ui/gui/spokes/user.py | 28 +++++---- 2 files changed, 29 insertions(+), 91 deletions(-)
-- 2.0.0
Ack
anaconda-patches@lists.fedorahosted.org