[gnome-system-tools/users-ui-redesign] Move real name, profile and password to separate edit dialogs
- From: Milan Bouchet-Valat <milanbv src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-system-tools/users-ui-redesign] Move real name, profile and password to separate edit dialogs
- Date: Tue, 17 Nov 2009 19:12:53 +0000 (UTC)
commit 95c75a4a170a3f178c75d4544e54aa0a82b41457
Author: Milan Bouchet-Valat <nalimilan club fr>
Date: Sat Nov 14 16:04:55 2009 +0100
Move real name, profile and password to separate edit dialogs
Create three similar dialogs to change these settings. Break code from user_settings_dialog_get/set_data() into smaller callbacks called on_edit_XXX(). Code updating profiles is now in update_profiles() rather than being called when showing the list. Some unused code is kept for further use (e.g. check_login()).
interfaces/users.ui | 1200 ++++++++++++++++++++++++++++++---------------
src/users/main.c | 4 -
src/users/user-settings.c | 289 ++++++++---
src/users/users-tool.c | 21 +
4 files changed, 1025 insertions(+), 489 deletions(-)
---
diff --git a/interfaces/users.ui b/interfaces/users.ui
index 5d23850..b8636fc 100644
--- a/interfaces/users.ui
+++ b/interfaces/users.ui
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
- <!-- interface-naming-policy toplevel-contextual -->
+ <!-- interface-naming-policy project-wide -->
<object class="GtkAdjustment" id="adjustment1">
<property name="step_increment">1</property>
<property name="page_increment">10</property>
@@ -60,7 +60,14 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
+ <object class="GtkListStore" id="liststore1">
+ <columns>
+ <!-- column-name login -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkWindow" id="users_dialog">
+ <property name="border_width">6</property>
<child>
<object class="GtkHBox" id="users_admin">
<property name="visible">True</property>
@@ -156,8 +163,8 @@
<child>
<object class="GtkTable" id="table1">
<property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">2</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">3</property>
<property name="column_spacing">12</property>
<property name="row_spacing">12</property>
<child>
@@ -171,49 +178,133 @@
</object>
</child>
<child>
- <object class="GtkEntry" id="user_settings_real_name">
+ <object class="GtkLabel" id="user_settings_profile_label">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Account _type:</property>
+ <property name="use_underline">True</property>
+ <attributes>
+ <attribute name="weight" value="normal"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="edit_user_name_button">
+ <property name="label">gtk-edit</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="activates_default">True</property>
- <property name="text" translatable="yes">s</property>
- <property name="shadow_type">none</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="on_edit_user_name"/>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="user_settings_real_name">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label">Real Name</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ <attribute name="size" value="13000"/>
+ </attributes>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="y_options"></property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="user_settings_profile_label">
+ <object class="GtkLabel" id="label123">
<property name="visible">True</property>
<property name="xalign">1</property>
- <property name="label" translatable="yes">Account _type:</property>
+ <property name="label" translatable="yes">_Password:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">user_settings_profile_menu</property>
+ <property name="mnemonic_widget">user_settings_passwd</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="user_settings_passwd">
+ <property name="visible">True</property>
+ <property name="label">Manual</property>
<attributes>
- <attribute name="weight" value="normal"/>
+ <attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="edit_user_passwd_button">
+ <property name="label">gtk-edit</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="on_edit_user_passwd"/>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <object class="GtkComboBox" id="user_settings_profile_menu">
+ <object class="GtkLabel" id="user_settings_profile">
<property name="visible">True</property>
+ <property name="label">Desktop user</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="edit_user_profile_button">
+ <property name="label">gtk-edit</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="on_edit_user_profile"/>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
</packing>
</child>
</object>
@@ -228,351 +319,6 @@
<property name="can_focus">True</property>
<property name="border_width">6</property>
<child>
- <object class="GtkVBox" id="vbox486">
- <property name="visible">True</property>
- <property name="border_width">12</property>
- <property name="orientation">vertical</property>
- <property name="spacing">18</property>
- <child>
- <object class="GtkTable" id="table50">
- <property name="visible">True</property>
- <property name="n_rows">9</property>
- <property name="n_columns">4</property>
- <property name="column_spacing">12</property>
- <property name="row_spacing">6</property>
- <child>
- <object class="GtkLabel" id="label236">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes"><span weight="bold">Password</span></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="right_attach">4</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label240">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Con_firmation:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">user_settings_passwd2</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="user_settings_passwd1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="visibility">False</property>
- <property name="invisible_char">●</property>
- <property name="activates_default">True</property>
- </object>
- <packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="user_settings_passwd2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="visibility">False</property>
- <property name="invisible_char">●</property>
- <property name="activates_default">True</property>
- </object>
- <packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label241">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Password set to: </property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox64">
- <property name="visible">True</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkEntry" id="user_settings_random_passwd">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="activates_default">True</property>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="user_passwd_random_new">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <child>
- <object class="GtkAlignment" id="alignment56">
- <property name="visible">True</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <child>
- <object class="GtkHBox" id="hbox65">
- <property name="visible">True</property>
- <property name="spacing">2</property>
- <child>
- <object class="GtkImage" id="image5">
- <property name="visible">True</property>
- <property name="stock">gtk-execute</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label242">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Generate</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label237">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">8</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label238">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">8</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="user_passwd_no_check">
- <property name="label" translatable="yes">Don't ask for password on _login</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">4</property>
- <property name="top_attach">8</property>
- <property name="bottom_attach">9</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="user_passwd_manual">
- <property name="label" translatable="yes">Set password b_y hand</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">4</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label239">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes">User _password:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">user_settings_passwd1</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="user_passwd_quality">
- <property name="label" translatable="yes">Check password _quality</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">4</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="user_passwd_random">
- <property name="label" translatable="yes">Generate _random password</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">user_passwd_manual</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">4</property>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label229">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">_Username:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">user_settings_name</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="user_settings_name">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="activates_default">True</property>
- </object>
- <packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label228">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="right_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- </child>
- <child type="tab">
- <object class="GtkLabel" id="label224">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Account</property>
- </object>
- <packing>
- <property name="tab_fill">False</property>
- </packing>
- </child>
- <child>
<object class="GtkTable" id="table48">
<property name="visible">True</property>
<property name="border_width">12</property>
@@ -684,9 +430,6 @@
</packing>
</child>
</object>
- <packing>
- <property name="position">1</property>
- </packing>
</child>
<child type="tab">
<object class="GtkLabel" id="label399">
@@ -694,7 +437,6 @@
<property name="label" translatable="yes">Contact Information</property>
</object>
<packing>
- <property name="position">1</property>
<property name="tab_fill">False</property>
</packing>
</child>
@@ -717,7 +459,7 @@
</child>
</object>
<packing>
- <property name="position">2</property>
+ <property name="position">1</property>
</packing>
</child>
<child type="tab">
@@ -726,7 +468,7 @@
<property name="label" translatable="yes">User Privileges</property>
</object>
<packing>
- <property name="position">2</property>
+ <property name="position">1</property>
<property name="tab_fill">False</property>
</packing>
</child>
@@ -1082,7 +824,7 @@
</child>
</object>
<packing>
- <property name="position">3</property>
+ <property name="position">2</property>
</packing>
</child>
<child type="tab">
@@ -1091,7 +833,7 @@
<property name="label" translatable="yes">Advanced</property>
</object>
<packing>
- <property name="position">3</property>
+ <property name="position">2</property>
<property name="tab_fill">False</property>
</packing>
</child>
@@ -1111,6 +853,7 @@
<object class="GtkDialog" id="group_settings_dialog">
<property name="width_request">420</property>
<property name="height_request">300</property>
+ <property name="border_width">6</property>
<property name="title" translatable="yes">Group properties</property>
<property name="modal">True</property>
<property name="type_hint">dialog</property>
@@ -1294,35 +1037,10 @@
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
- <object class="GtkButton" id="group_settings_cancel">
- <property name="label">gtk-cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
+ <placeholder/>
</child>
<child>
- <object class="GtkButton" id="group_settings_ok">
- <property name="label">gtk-ok</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
+ <placeholder/>
</child>
</object>
<packing>
@@ -1333,10 +1051,6 @@
</child>
</object>
</child>
- <action-widgets>
- <action-widget response="-6">group_settings_cancel</action-widget>
- <action-widget response="-5">group_settings_ok</action-widget>
- </action-widgets>
</object>
<object class="GtkDialog" id="profile_settings_dialog">
<property name="resizable">False</property>
@@ -2409,4 +2123,684 @@
<property name="visible">True</property>
<property name="icon_name">stock_people</property>
</object>
+ <object class="GtkDialog" id="user_name_dialog">
+ <property name="border_width">12</property>
+ <property name="title" translatable="yes">Change User Name and Login</property>
+ <property name="resizable">False</property>
+ <property name="modal">True</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="type_hint">dialog</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="skip_pager_hint">True</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox5">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">24</property>
+ <child>
+ <object class="GtkTable" id="table4">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">12</property>
+ <child>
+ <object class="GtkEntry" id="user_name_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">True</property>
+ <property name="invisible_char">•</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
+ <property name="y_padding">12</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label23">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Full _Name:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">user_name_entry</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkImage" id="user_name_face">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="pixel_size">60</property>
+ <property name="icon_name">stock_person</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ <property name="y_padding">12</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox12">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Changing user name for:</property>
+ <property name="track_visited_links">False</property>
+ <attributes>
+ <attribute name="size" value="12000"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="user_name_name">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label">Real Name</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ <attribute name="size" value="14000"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area5">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="user_name_cancel_button">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="user_name_validate_button">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">user_name_cancel_button</action-widget>
+ <action-widget response="-5">user_name_validate_button</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkDialog" id="user_passwd_dialog">
+ <property name="border_width">12</property>
+ <property name="title" translatable="yes">Change User Password</property>
+ <property name="resizable">False</property>
+ <property name="modal">True</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="type_hint">dialog</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="skip_pager_hint">True</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox7">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">24</property>
+ <child>
+ <object class="GtkTable" id="table157">
+ <property name="visible">True</property>
+ <property name="n_rows">8</property>
+ <property name="n_columns">3</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="label240">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Con_firmation:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">user_settings_passwd2</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="user_settings_passwd1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">True</property>
+ <property name="visibility">False</property>
+ <property name="invisible_char">•</property>
+ <property name="activates_default">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="user_settings_passwd2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="visibility">False</property>
+ <property name="invisible_char">•</property>
+ <property name="activates_default">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label241">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Password set to: </property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox64">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkEntry" id="user_settings_random_passwd">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">•</property>
+ <property name="activates_default">True</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="user_passwd_random_new">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <child>
+ <object class="GtkAlignment" id="alignment56">
+ <property name="visible">True</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <object class="GtkHBox" id="hbox65">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkImage" id="image5">
+ <property name="visible">True</property>
+ <property name="stock">gtk-execute</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label242">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Generate</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="user_passwd_manual">
+ <property name="label" translatable="yes">Set password b_y hand</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label239">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">User _password:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">user_settings_passwd1</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="user_passwd_quality">
+ <property name="label" translatable="yes">Check password _quality</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="user_passwd_random">
+ <property name="label" translatable="yes">Generate _random password</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">user_passwd_manual</property>
+ </object>
+ <packing>
+ <property name="right_attach">3</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox122">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="label189">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Changing user password for:</property>
+ <property name="track_visited_links">False</property>
+ <attributes>
+ <attribute name="size" value="12000"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="user_passwd_name">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label">Real Name</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ <attribute name="size" value="14000"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkImage" id="user_passwd_face">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="pixel_size">60</property>
+ <property name="icon_name">stock_person</property>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ <property name="y_padding">12</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="user_passwd_no_check">
+ <property name="label" translatable="yes">Don't ask for password on _login</property>
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="right_attach">3</property>
+ <property name="top_attach">7</property>
+ <property name="bottom_attach">8</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area7">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="user_passwd_cancel_button">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="user_passwd_validate_button">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">user_passwd_cancel_button</action-widget>
+ <action-widget response="-5">user_passwd_validate_button</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkDialog" id="user_profile_dialog">
+ <property name="border_width">12</property>
+ <property name="title" translatable="yes">Change User Account Type</property>
+ <property name="resizable">False</property>
+ <property name="modal">True</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="type_hint">dialog</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="skip_pager_hint">True</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox16">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">24</property>
+ <child>
+ <object class="GtkTable" id="table47">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">12</property>
+ <child>
+ <object class="GtkImage" id="user_profile_face">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="pixel_size">60</property>
+ <property name="icon_name">stock_person</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ <property name="y_padding">12</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox18">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="label138">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Changing account type for:</property>
+ <property name="track_visited_links">False</property>
+ <attributes>
+ <attribute name="size" value="12000"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="user_profile_name">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label">Real Name</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ <attribute name="size" value="14000"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="user_settings_profile_menu">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Account _type:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">user_settings_profile_menu</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area19">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="user_profile_cancel_button">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="user_profile_validate_button">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">user_profile_cancel_button</action-widget>
+ <action-widget response="-5">user_profile_validate_button</action-widget>
+ </action-widgets>
+ </object>
</interface>
diff --git a/src/users/main.c b/src/users/main.c
index 2d5f66a..25cd45c 100644
--- a/src/users/main.c
+++ b/src/users/main.c
@@ -41,12 +41,10 @@ void quit_cb (GstTool *tool, gpointer data);
static GstDialogSignal signals[] = {
/* User settings dialog callbacks */
- { "user_settings_name", "changed", G_CALLBACK (on_user_settings_login_changed) },
{ "user_passwd_manual", "toggled", G_CALLBACK (on_user_settings_passwd_toggled) },
{ "user_passwd_random", "toggled", G_CALLBACK (on_user_settings_passwd_toggled) },
{ "user_passwd_random_new", "clicked", G_CALLBACK (on_user_settings_passwd_random_new) },
{ "user_settings_passwd1", "changed", G_CALLBACK (on_user_settings_passwd_changed) },
- { "user_settings_profile_menu", "changed", G_CALLBACK (on_user_settings_profile_changed) },
/* Main dialog callbacks, users tab */
{ "user_new", "clicked", G_CALLBACK (on_user_new_clicked) },
@@ -70,8 +68,6 @@ const gchar *policy_widgets [] = {
"profile_new",
"profile_delete",
"profile_settings",
- "user_settings_name",
- "user_settings_profile_menu",
"user_passwd_no_check",
"user_privileges",
"user_settings_home",
diff --git a/src/users/user-settings.c b/src/users/user-settings.c
index 8492080..29dea79 100644
--- a/src/users/user-settings.c
+++ b/src/users/user-settings.c
@@ -18,7 +18,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
- * Authors: Carlos Garnacho Parro <garparr teleline es>.
+ * Authors: Carlos Garnacho Parro <garparr teleline es>,
+ * Milan Bouchet-Valat <nalimilan club fr>.
*/
#include <config.h>
@@ -398,25 +399,6 @@ set_login_length (GtkWidget *entry)
gtk_entry_set_max_length (GTK_ENTRY (entry), max_len);
}
-static void
-setup_profiles_visibility (GstTool *tool,
- gboolean is_new)
-{
- GList *names;
- GtkWidget *combo, *label;
- gboolean show;
-
- names = gst_user_profiles_get_names (GST_USERS_TOOL (tool)->profiles);
- combo = gst_dialog_get_widget (tool->main_dialog, "user_settings_profile_menu");
- label = gst_dialog_get_widget (tool->main_dialog, "user_settings_profile_label");
-
- show = (is_new && g_list_length (names) > 1);
-
- g_object_set (combo, "visible", show, NULL);
- g_object_set (label, "visible", show, NULL);
- g_list_free (names);
-}
-
GdkPixbuf *
user_settings_get_user_face (OobsUser *user, int size)
{
@@ -465,8 +447,6 @@ user_settings_set (OobsUser *user)
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), uid);
gst_dialog_try_set_sensitive (tool->main_dialog, widget, TRUE);
gtk_widget_hide (notice);
-
- setup_profiles_visibility (tool, TRUE);
} else {
login = oobs_user_get_login_name (user);
@@ -490,20 +470,13 @@ user_settings_set (OobsUser *user)
gst_dialog_try_set_sensitive (tool->main_dialog, widget, TRUE);
gtk_widget_hide (notice);
}
-
- setup_profiles_visibility (tool, FALSE);
}
privileges_table_set_from_user (user);
select_main_group (user);
- widget = gst_dialog_get_widget (tool->main_dialog, "user_settings_name");
- set_entry_text (widget, login);
- set_login_length (widget);
- gtk_widget_set_sensitive (widget, (login == NULL));
-
widget = gst_dialog_get_widget (tool->main_dialog, "user_settings_real_name");
- set_entry_text (widget, (user) ? oobs_user_get_full_name (user) : NULL);
+ gtk_label_set_text (GTK_LABEL (widget), oobs_user_get_full_name (user));
widget = gst_dialog_get_widget (tool->main_dialog, "user_settings_face");
face = user_settings_get_user_face (user, 60);
@@ -530,29 +503,6 @@ user_settings_set (OobsUser *user)
widget = gst_dialog_get_widget (tool->main_dialog, "user_settings_notebook");
gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 0);
- /* set manual password */
- widget = gst_dialog_get_widget (tool->main_dialog, "user_passwd_manual");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
-
- /* set option to skip password check at login */
- widget = gst_dialog_get_widget (tool->main_dialog, "user_passwd_no_check");
- no_passwd_login_group = get_no_passwd_login_group ();
- /* root should not be allowed to login without password,
- * and we disable the feature if the group does not exist */
- if (is_user_root (user) || no_passwd_login_group == NULL) {
- gtk_widget_set_sensitive (widget, FALSE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
- }
- else {
- gst_dialog_try_set_sensitive (tool->main_dialog, widget, TRUE);
- if (is_user_in_group (user, no_passwd_login_group))
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
- else
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
- }
- if (no_passwd_login_group)
- g_object_unref (no_passwd_login_group);
-
if (!login)
table_set_default_profile (GST_USERS_TOOL (tool));
@@ -635,8 +585,8 @@ check_login (gchar **primary_text, gchar **secondary_text, gpointer data)
} else if (!is_valid_name (login)) {
*primary_text = g_strdup (_("User name has invalid characters"));
*secondary_text = g_strdup (_("Please set a valid user name consisting of "
- "a lower case letter followed by lower case "
- "letters and numbers."));
+ "a lower case letter followed by lower case "
+ "letters and numbers."));
} else if (!user && login_exists (login)) {
*primary_text = g_strdup_printf (_("User name \"%s\" already exists"), login);
*secondary_text = g_strdup (_("Please choose a different user name."));
@@ -779,7 +729,6 @@ user_settings_dialog_run (GtkWidget *dialog)
gint response;
gboolean valid;
TestBattery battery[] = {
- check_login,
check_comments,
check_home,
check_uid,
@@ -849,32 +798,6 @@ user_settings_dialog_get_data (GtkWidget *dialog)
widget = gst_dialog_get_widget (tool->main_dialog, "user_settings_uid");
oobs_user_set_uid (user, gtk_spin_button_get_value (GTK_SPIN_BUTTON (widget)));
- widget = gst_dialog_get_widget (tool->main_dialog, "user_passwd_manual");
-
- /* manual password? */
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
- widget = gst_dialog_get_widget (tool->main_dialog, "user_settings_passwd1");
- password_changed = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "changed"));
-
- if (password_changed)
- oobs_user_set_password (user, gtk_entry_get_text (GTK_ENTRY (widget)));
- } else {
- widget = gst_dialog_get_widget (tool->main_dialog, "user_settings_random_passwd");
- oobs_user_set_password (user, gtk_entry_get_text (GTK_ENTRY (widget)));
- }
-
- /* allowed to login without password? */
- widget = gst_dialog_get_widget (tool->main_dialog, "user_passwd_no_check");
- no_passwd_login_group = get_no_passwd_login_group ();
- if (!is_user_root (user) && no_passwd_login_group != NULL) {
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
- oobs_group_add_user (no_passwd_login_group, user);
- else
- oobs_group_remove_user (no_passwd_login_group, user);
- }
- if (no_passwd_login_group)
- g_object_unref (no_passwd_login_group);
-
/* If FALSE, group could not be found or created, which means
* we won't be able to create the new user anyway, so stop here */
if (!set_main_group (user))
@@ -917,3 +840,205 @@ user_settings_apply_profile (GstUsersTool *users_tool,
/* default groups */
privileges_table_set_from_profile (profile);
}
+
+
+/*
+ * Common to all modular edit dialogs: run the dialog after filling
+ * the user's name and face and handling window settings.
+ */
+static int
+run_edit_dialog (GtkDialog *dialog, GtkImage *face_image2, GtkLabel *name_label)
+{
+ OobsUser *user;
+ GtkWidget *face_image1;
+ GdkPixbuf *face;
+ const char *name;
+ int response;
+
+ /* Set user face from the main dialog image */
+ face_image1 = gst_dialog_get_widget (tool->main_dialog, "user_settings_face");
+ face = gtk_image_get_pixbuf (GTK_IMAGE (face_image1));
+ gtk_image_set_from_pixbuf (face_image2, face);
+
+ /* Set user name */
+ user = users_table_get_current ();
+ name = oobs_user_get_full_name (user);
+ gtk_label_set_text (name_label, name);
+ g_object_unref (user);
+
+ /* Run dialog with correct settings */
+ gtk_window_set_transient_for (GTK_WINDOW (dialog),
+ GTK_WINDOW (tool->main_dialog));
+ gst_dialog_add_edit_dialog (tool->main_dialog, GTK_WIDGET (dialog));
+ response = gtk_dialog_run (dialog);
+ gst_dialog_remove_edit_dialog (tool->main_dialog, GTK_WIDGET (dialog));
+ gtk_widget_hide (GTK_WIDGET (dialog));
+
+ return response;
+}
+
+/*
+ * Callback for edit_user_name_button: run the dialog to change the user's
+ * real name and apply changes if needed.
+ */
+void
+on_edit_user_name (GtkButton *button, gpointer user_data)
+{
+ int response;
+ GtkWidget *user_name_dialog;
+ GtkWidget *user_name_entry;
+ GtkWidget *face_image;
+ GtkWidget *name_label;
+ OobsUser *user;
+ const char *fullname;
+
+ user_name_dialog = gst_dialog_get_widget (tool->main_dialog, "user_name_dialog");
+ user_name_entry = gst_dialog_get_widget (tool->main_dialog, "user_name_entry");
+ face_image = gst_dialog_get_widget (tool->main_dialog, "user_name_face");
+ name_label = gst_dialog_get_widget (tool->main_dialog, "user_name_name");
+
+ user = users_table_get_current ();
+ fullname = oobs_user_get_full_name (user);
+ gtk_entry_set_text (GTK_ENTRY (user_name_entry), fullname);
+ gtk_editable_select_region (GTK_EDITABLE (user_name_entry), 0, -1);
+
+ response = run_edit_dialog (GTK_DIALOG (user_name_dialog),
+ GTK_IMAGE (face_image), GTK_LABEL (name_label));
+
+ if (response == GTK_RESPONSE_OK) {
+ user_name_entry = gst_dialog_get_widget (tool->main_dialog,
+ "user_name_entry");
+
+ fullname = gtk_entry_get_text (GTK_ENTRY (user_name_entry));
+ oobs_user_set_full_name (user, fullname);
+ gst_tool_commit (tool, GST_USERS_TOOL (tool)->users_config);
+ }
+
+ g_object_unref (user);
+}
+
+/*
+ * Callback for edit_user_name_button: run the dialog to change the user's
+ * password and apply changes if needed.
+ */
+void
+on_edit_user_passwd (GtkButton *button, gpointer user_data)
+{
+ int response;
+ GtkWidget *user_passwd_dialog;
+ GtkWidget *face_image;
+ GtkWidget *name_label;
+ GtkWidget *manual_toggle;
+ GtkWidget *passwd_entry;
+ GtkWidget *nocheck_toggle;
+ gboolean passwd_changed;
+ OobsUser *user;
+ OobsGroup *no_passwd_login_group;
+
+ user_passwd_dialog = gst_dialog_get_widget (tool->main_dialog, "user_passwd_dialog");
+ face_image = gst_dialog_get_widget (tool->main_dialog, "user_passwd_face");
+ name_label = gst_dialog_get_widget (tool->main_dialog, "user_passwd_name");
+
+ user = users_table_get_current ();
+
+ /* set manual password */
+ manual_toggle = gst_dialog_get_widget (tool->main_dialog, "user_passwd_manual");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (manual_toggle), TRUE);
+
+ /* set option to skip password check at login */
+ nocheck_toggle = gst_dialog_get_widget (tool->main_dialog, "user_passwd_no_check");
+ no_passwd_login_group = get_no_passwd_login_group ();
+ /* root should not be allowed to login without password,
+ * and we disable the feature if the group does not exist */
+ if (is_user_root (user) || no_passwd_login_group == NULL) {
+ gtk_widget_set_sensitive (nocheck_toggle, FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (nocheck_toggle),
+ FALSE);
+ }
+ else {
+ gst_dialog_try_set_sensitive (tool->main_dialog, nocheck_toggle, TRUE);
+ if (is_user_in_group (user, no_passwd_login_group))
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (nocheck_toggle),
+ TRUE);
+ else
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (nocheck_toggle),
+ FALSE);
+ }
+ if (no_passwd_login_group)
+ g_object_unref (no_passwd_login_group);
+
+
+ response = run_edit_dialog (GTK_DIALOG (user_passwd_dialog),
+ GTK_IMAGE (face_image), GTK_LABEL (name_label));
+
+ if (response != GTK_RESPONSE_OK){
+ g_object_unref (user);
+ return;
+ }
+
+ /* set manual or random password if needed */
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (manual_toggle))) {
+ passwd_entry = gst_dialog_get_widget (tool->main_dialog,
+ "user_settings_passwd1");
+ passwd_changed =
+ GPOINTER_TO_INT (g_object_get_data (G_OBJECT (passwd_entry),
+ "changed"));
+
+ if (passwd_changed)
+ oobs_user_set_password (user,
+ gtk_entry_get_text (GTK_ENTRY (passwd_entry)));
+ } else {
+ passwd_entry = gst_dialog_get_widget (tool->main_dialog,
+ "user_settings_random_passwd");
+ oobs_user_set_password (user,
+ gtk_entry_get_text (GTK_ENTRY (passwd_entry)));
+ }
+
+ /* check whether user is allowed to login without password */
+ no_passwd_login_group = get_no_passwd_login_group ();
+ if (!is_user_root (user) && no_passwd_login_group != NULL) {
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (nocheck_toggle)))
+ oobs_group_add_user (no_passwd_login_group, user);
+ else
+ oobs_group_remove_user (no_passwd_login_group, user);
+ }
+ if (no_passwd_login_group)
+ g_object_unref (no_passwd_login_group);
+
+ /* commit both user and groups config
+ * because of the no_passwd_login_group membership */
+ if (gst_tool_commit (tool, GST_USERS_TOOL (tool)->users_config) == OOBS_RESULT_OK)
+ gst_tool_commit (tool, GST_USERS_TOOL (tool)->groups_config);
+
+ g_object_unref (user);
+}
+
+/*
+ * Callback for edit_user_profile_button: run the dialog to change the user's
+ * account type and apply changes if needed.
+ */
+void
+on_edit_user_profile (GtkButton *button, gpointer user_data)
+{
+ int response;
+ GtkWidget *user_profile_dialog;
+ GtkWidget *user_profile_entry;
+ GtkWidget *face_image;
+ GtkWidget *name_label;
+ OobsUser *user;
+
+ user_profile_dialog = gst_dialog_get_widget (tool->main_dialog, "user_profile_dialog");
+ face_image = gst_dialog_get_widget (tool->main_dialog, "user_profile_face");
+ name_label = gst_dialog_get_widget (tool->main_dialog, "user_profile_name");
+
+ user = users_table_get_current ();
+
+ response = run_edit_dialog (GTK_DIALOG (user_profile_dialog),
+ GTK_IMAGE (face_image), GTK_LABEL (name_label));
+
+ if (response == GTK_RESPONSE_OK) {
+ gst_tool_commit (tool, GST_USERS_TOOL (tool)->users_config);
+ }
+
+ g_object_unref (user);
+}
diff --git a/src/users/users-tool.c b/src/users/users-tool.c
index 3efa5cb..ca3c166 100644
--- a/src/users/users-tool.c
+++ b/src/users/users-tool.c
@@ -177,9 +177,30 @@ static void
update_profiles (GstUsersTool *tool)
{
GList *names = NULL;
+ GtkWidget *label1, *label2, *button;
names = gst_user_profiles_get_names (tool->profiles);
table_populate_profiles (tool, names);
+
+ /* Hide profiles line in main dialog if only one profile is available */
+ label1 = gst_dialog_get_widget (GST_TOOL (tool)->main_dialog,
+ "user_settings_profile");
+ label2 = gst_dialog_get_widget (GST_TOOL (tool)->main_dialog,
+ "user_settings_profile_label");
+ button = gst_dialog_get_widget (GST_TOOL (tool)->main_dialog,
+ "edit_user_profile_button");
+
+ if (g_list_length (names) > 1) {
+ gtk_widget_show (label1);
+ gtk_widget_show (label2);
+ gtk_widget_show (button);
+ }
+ else {
+ gtk_widget_hide (label1);
+ gtk_widget_hide (label2);
+ gtk_widget_hide (button);
+ }
+
g_list_free (names);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]