[accounts-dialog: 1/2] Simpler password dialog
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [accounts-dialog: 1/2] Simpler password dialog
- Date: Fri, 26 Feb 2010 13:59:16 +0000 (UTC)
commit 77addfb6d2417083ea2a06e908c5b23be5b8db6d
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Feb 25 23:10:31 2010 -0500
Simpler password dialog
data/account-dialog.ui | 38 ++-
data/names-dialog.ui | 25 +-
data/password-dialog.ui | 868 ++++++++++++++--------------------------------
src/main.c | 2 +
src/um-password-dialog.c | 276 ++++++++--------
src/um-password-dialog.h | 2 +
6 files changed, 460 insertions(+), 751 deletions(-)
---
diff --git a/data/account-dialog.ui b/data/account-dialog.ui
index 2f80350..5b04934 100644
--- a/data/account-dialog.ui
+++ b/data/account-dialog.ui
@@ -4,27 +4,39 @@
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkListStore" id="shortname-model">
<columns>
+ <!-- column-name gchararray -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="account-type-model">
<columns>
+ <!-- column-name gchararray -->
<column type="gchararray"/>
+ <!-- column-name gint -->
<column type="gint"/>
</columns>
<data>
- <row><col id="0" translatable="True" context="Account type">Standard</col><col id="1">0</col></row>
- <row><col id="0" translatable="True" context="Account type">Administrator</col><col id="1">1</col></row>
- <row><col id="0" translatable="True" context="Account type">Supervised</col><col id="1">2</col></row>
+ <row>
+ <col id="0" translatable="yes" context="Account type">Standard</col>
+ <col id="1">0</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes" context="Account type">Administrator</col>
+ <col id="1">1</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes" context="Account type">Supervised</col>
+ <col id="1">2</col>
+ </row>
</data>
</object>
<object class="GtkDialog" id="dialog">
<property name="border_width">5</property>
<property name="title"> </property>
- <property name="icon_name">system-config-users</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
+ <property name="icon_name">system-config-users</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
@@ -66,7 +78,9 @@
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="xalign">1</property>
- <property name="label" translatable="yes">Short name:</property>
+ <property name="label" translatable="yes">_Short name:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">shortname-combo</property>
<attributes>
<attribute name="foreground" value="#555555555555"/>
</attributes>
@@ -144,7 +158,9 @@
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="xalign">1</property>
- <property name="label" translatable="yes">Full name:</property>
+ <property name="label" translatable="yes">_Full name:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">name-entry</property>
<attributes>
<attribute name="foreground" value="#555555555555"/>
</attributes>
@@ -159,7 +175,9 @@
<object class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="xalign">1</property>
- <property name="label" translatable="yes">Account Type:</property>
+ <property name="label" translatable="yes">_Account Type:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">account-type-combo</property>
<attributes>
<attribute name="foreground" value="#555555555555"/>
</attributes>
@@ -207,10 +225,11 @@
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="cancel-button">
- <property name="label" translatable="yes">Cancel</property>
+ <property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
+ <property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -220,11 +239,12 @@
</child>
<child>
<object class="GtkButton" id="ok-button">
- <property name="label" translatable="yes">Create</property>
+ <property name="label" translatable="yes">Cr_eate</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
+ <property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
diff --git a/data/names-dialog.ui b/data/names-dialog.ui
index fef04e4..6874579 100644
--- a/data/names-dialog.ui
+++ b/data/names-dialog.ui
@@ -1,15 +1,17 @@
<?xml version="1.0"?>
<interface>
+ <!-- interface-requires gtk+ 2.12 -->
+ <!-- interface-naming-policy toplevel-contextual -->
<object class="GtkDialog" id="dialog">
<property name="border_width">5</property>
+ <property name="title"> </property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
+ <property name="icon_name">system-config-users</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
- <property name="title"> </property>
- <property name="icon_name">system-config-users</property>
<child internal-child="vbox">
<object class="GtkVBox" id="content-area">
<property name="visible">True</property>
@@ -111,7 +113,9 @@
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="xalign">1</property>
- <property name="label" translatable="yes">Full name:</property>
+ <property name="label" translatable="yes">_Full name:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">name-entry</property>
<attributes>
<attribute name="foreground" value="#555555555555"/>
</attributes>
@@ -125,7 +129,10 @@
<child>
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
- <property name="label" translatable="yes">Short name:</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Short name:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">shortname-entry</property>
<attributes>
<attribute name="foreground" value="#555555555555"/>
</attributes>
@@ -183,10 +190,11 @@
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="cancel-button">
- <property name="label" translatable="yes">Cancel</property>
+ <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>
@@ -196,11 +204,12 @@
</child>
<child>
<object class="GtkButton" id="ok-button">
- <property name="label" translatable="yes">Change</property>
+ <property name="label" translatable="yes">Ch_ange</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
+ <property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -217,5 +226,9 @@
</child>
</object>
</child>
+ <action-widgets>
+ <action-widget response="0">cancel-button</action-widget>
+ <action-widget response="0">ok-button</action-widget>
+ </action-widgets>
</object>
</interface>
diff --git a/data/password-dialog.ui b/data/password-dialog.ui
index 1930ac4..dbe4175 100644
--- a/data/password-dialog.ui
+++ b/data/password-dialog.ui
@@ -15,10 +15,6 @@
<col id="1">0</col>
</row>
<row>
- <col id="0" translatable="yes">Generate a password</col>
- <col id="1">0</col>
- </row>
- <row>
<col id="0" translatable="yes">Choose password at next login</col>
<col id="1">1</col>
</row>
@@ -35,6 +31,7 @@
<object class="GtkDialog" id="dialog">
<property name="border_width">5</property>
<property name="title"> </property>
+ <property name="resizable">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="icon_name">system-config-users</property>
@@ -44,34 +41,46 @@
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
- <property name="spacing">2</property>
+ <property name="spacing">12</property>
<child>
<object class="GtkVBox" id="vbox7">
<property name="visible">True</property>
- <property name="border_width">10</property>
+ <property name="border_width">6</property>
<property name="orientation">vertical</property>
- <property name="spacing">6</property>
+ <property name="spacing">16</property>
<child>
- <object class="GtkTable" id="table2">
+ <object class="GtkTable" id="table4">
<property name="visible">True</property>
- <property name="n_rows">3</property>
+ <property name="n_rows">8</property>
<property name="n_columns">2</property>
- <property name="column_spacing">6</property>
+ <property name="column_spacing">10</property>
<property name="row_spacing">6</property>
<child>
- <object class="GtkHBox" id="hbox3">
+ <object class="GtkHBox" id="hbox13">
<property name="visible">True</property>
+ <property name="spacing">9</property>
<child>
- <object class="GtkLabel" id="blablalabel23">
+ <object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">6</property>
+ <child>
+ <object class="UmStrengthBar" id="strength-indicator-progressbar">
+ <property name="visible">True</property>
+ </object>
+ </child>
</object>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkImage" id="user-icon">
+ <object class="GtkLabel" id="strength-indicator-label">
<property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Fair</property>
</object>
<packing>
<property name="position">1</property>
@@ -79,31 +88,66 @@
</child>
</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>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox14">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="password-normal-hint-label">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Hint:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">normal-hint-entry</property>
+ <attributes>
+ <attribute name="foreground" value="#555555555555"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label33">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="top_attach">7</property>
+ <property name="bottom_attach">8</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox6">
+ <object class="GtkVBox" id="vbox15">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkLabel" id="label8">
+ <object class="GtkEntry" id="normal-hint-entry">
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Changing password for:</property>
+ <property name="can_focus">True</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="user-name">
+ <object class="GtkLabel" id="password-normal-hint-description-label">
<property name="visible">True</property>
<property name="xalign">0</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- <attribute name="scale" value="1.200000"/>
- </attributes>
+ <property name="label" translatable="yes"><small>This hint may be displayed at the login screen. It will be visible to all users of this system. Do <b>not</b> include the password here.</small></property>
+ <property name="use_markup">True</property>
+ <property name="wrap">True</property>
</object>
<packing>
<property name="position">1</property>
@@ -112,699 +156,296 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="right_attach">3</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">7</property>
+ <property name="bottom_attach">8</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="password-main-type-label">
+ <object class="GtkLabel" id="password-normal-strength-label">
<property name="visible">True</property>
<property name="xalign">1</property>
- <property name="label" translatable="yes">Action:</property>
+ <property name="label" translatable="yes">Strength:</property>
<attributes>
<attribute name="foreground" value="#555555555555"/>
</attributes>
</object>
<packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkComboBox" id="action-combobox">
+ <object class="GtkEntry" id="verify-entry">
<property name="visible">True</property>
- <property name="model">action-model</property>
- <property name="active">0</property>
- <child>
- <object class="GtkCellRendererText" id="renderer2"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
+ <property name="can_focus">True</property>
+ <property name="visibility">False</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="top_attach">5</property>
+ <property name="bottom_attach">6</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="label14">
+ <object class="GtkLabel" id="password-normal-verify-label">
<property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">C_onfirm password:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">verify-entry</property>
+ <attributes>
+ <attribute name="foreground" value="#555555555555"/>
+ </attributes>
</object>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="label17">
- <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>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkNotebook" id="notebook">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="show_tabs">False</property>
- <property name="show_border">False</property>
- <property name="tab_vborder">0</property>
- <child>
- <object class="GtkTable" id="table4">
+ <object class="GtkVBox" id="vbox17">
<property name="visible">True</property>
- <property name="border_width">10</property>
- <property name="n_rows">5</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">10</property>
- <property name="row_spacing">6</property>
- <child>
- <object class="GtkHBox" id="hbox13">
- <property name="visible">True</property>
- <property name="spacing">9</property>
- <child>
- <object class="GtkAlignment" id="alignment1">
- <property name="visible">True</property>
- <property name="top_padding">6</property>
- <property name="bottom_padding">6</property>
- <child>
- <object class="UmStrengthBar" id="strength-indicator-progressbar">
- <property name="visible">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="strength-indicator-label">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Fair</property>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="password-normal-strength-hints-label">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="has_tooltip">True</property>
- <property name="label" translatable="yes"><a href="http://wolfram.org/writing/howto/password.html">How to make a strong password</a></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- </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>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="vbox14">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkLabel" id="password-normal-hint-label">
- <property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">Hint:</property>
- <attributes>
- <attribute name="foreground" value="#555555555555"/>
- </attributes>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label33">
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="vbox15">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkEntry" id="normal-hint-entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="password-normal-hint-description-label">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes"><small>This hint may be displayed at the login screen. It will be visible to all users of this system. Do <b>not</b> include the password here.</small></property>
- <property name="use_markup">True</property>
- <property name="wrap">True</property>
- </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="top_attach">3</property>
- <property name="bottom_attach">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="password-normal-strength-label">
- <property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">Strength:</property>
- <attributes>
- <attribute name="foreground" value="#555555555555"/>
- </attributes>
- </object>
- <packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="verify-entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="visibility">False</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>
- </packing>
- </child>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkLabel" id="password-normal-verify-label">
+ <object class="GtkLabel" id="password-normal-password-label">
<property name="visible">True</property>
<property name="xalign">1</property>
- <property name="label" translatable="yes">Confirm password:</property>
+ <property name="label" translatable="yes">_New password:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">password-combo</property>
<attributes>
<attribute name="foreground" value="#555555555555"/>
</attributes>
</object>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox17">
+ <object class="GtkLabel" id="label35">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkLabel" id="password-normal-password-label">
- <property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">New password:</property>
- <attributes>
- <attribute name="foreground" value="#555555555555"/>
- </attributes>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label35">
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
</object>
<packing>
- <property name="x_options">GTK_FILL</property>
+ <property name="position">1</property>
</packing>
</child>
+ </object>
+ <packing>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox16">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkVBox" id="vbox16">
+ <object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
- <object class="GtkEntry" id="password-entry">
+ <object class="GtkComboBoxEntry" id="password-combo">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="visibility">False</property>
+ <property name="text_column">0</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="show-password-checkbutton">
- <property name="label" translatable="yes">Show password</property>
+ <object class="GtkButton" id="generate-again-button">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
+ <property name="receives_default">True</property>
+ <child>
+ <object class="GtkImage" id="generate-again-image">
+ <property name="visible">True</property>
+ <property name="stock">gtk-refresh</property>
+ </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">1</property>
- <property name="right_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="old-password-label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Current password:</property>
- </object>
- <packing>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkEntry" id="old-password-entry">
+ <object class="GtkCheckButton" id="show-password-checkbutton">
+ <property name="label" translatable="yes">_Show password</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="visibility">False</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">2</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ </packing>
</child>
- <child type="tab">
- <object class="GtkLabel" id="label27">
+ <child>
+ <object class="GtkLabel" id="old-password-label">
<property name="visible">True</property>
- <property name="label" translatable="yes">Now</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Current _password:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">old-password-entry</property>
+ <attributes>
+ <attribute name="foreground" value="#555555555555"/>
+ </attributes>
</object>
<packing>
- <property name="tab_fill">False</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox12">
+ <object class="GtkEntry" id="old-password-entry">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkTable" id="table3">
- <property name="visible">True</property>
- <property name="border_width">10</property>
- <property name="n_rows">4</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">10</property>
- <property name="row_spacing">6</property>
- <child>
- <object class="GtkHBox" id="hbox16">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkRadioButton" id="length-short-radiobutton">
- <property name="label" translatable="yes">Short</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="length-medium-radiobutton">
- <property name="label" translatable="yes">Medium</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">length-short-radiobutton</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="length-long-radiobutton">
- <property name="label" translatable="yes">Long</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">length-short-radiobutton</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox14">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkComboBox" id="generate-combobox">
- <property name="visible">True</property>
- <child>
- <object class="GtkCellRendererText" id="renderer3"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="generate-again-button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <child>
- <object class="GtkLabel" id="label29">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Try again</property>
- </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">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>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="vbox20">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkLabel" id="password-memorable-hint-label">
- <property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">Hint:</property>
- <attributes>
- <attribute name="foreground" value="#555555555555"/>
- </attributes>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label32">
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="vbox13">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkEntry" id="generate-hint-entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="password-memorable-hint-description-label">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes"><small>This hint may be displayed at the login screen. It will be visible to all users of this system. Do <b>not</b> include the password here.</small></property>
- <property name="use_markup">True</property>
- <property name="wrap">True</property>
- </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="top_attach">2</property>
- <property name="bottom_attach">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="password-memorable-password-label">
- <property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">Password:</property>
- <attributes>
- <attribute name="foreground" value="#555555555555"/>
- </attributes>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="password-memorable-length-label">
- <property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">Length:</property>
- <attributes>
- <attribute name="foreground" value="#555555555555"/>
- </attributes>
- </object>
- <packing>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="old-password-label2">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Current password:</property>
- </object>
- <packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="old-password-entry2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="visibility">False</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>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="visibility">False</property>
</object>
<packing>
- <property name="position">1</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
</packing>
</child>
- <child type="tab">
- <object class="GtkLabel" id="label25">
+ <child>
+ <object class="GtkLabel" id="action-label">
<property name="visible">True</property>
- <property name="label" translatable="yes">Generate</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Action:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">action-combo</property>
+ <attributes>
+ <attribute name="foreground" value="#555555555555"/>
+ </attributes>
</object>
<packing>
- <property name="position">1</property>
- <property name="tab_fill">False</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox9">
+ <object class="GtkComboBox" id="action-combo">
<property name="visible">True</property>
- <property name="border_width">10</property>
- <property name="orientation">vertical</property>
+ <property name="model">action-model</property>
<child>
- <object class="GtkLabel" id="password-login-description-label">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes">This will ask the user to choose a password the next time he logs in.</property>
- <property name="wrap">True</property>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
+ <object class="GtkCellRendererText" id="renderer"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
</child>
</object>
<packing>
- <property name="position">2</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="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
</packing>
</child>
- <child type="tab">
- <object class="GtkLabel" id="label26">
+ <child>
+ <object class="GtkLabel" id="label2">
<property name="visible">True</property>
- <property name="label" translatable="yes">At Login</property>
</object>
<packing>
- <property name="position">2</property>
- <property name="tab_fill">False</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox18">
+ <object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
- <property name="border_width">10</property>
- <property name="orientation">vertical</property>
<child>
- <object class="GtkLabel" id="password-none-description-label">
+ <object class="GtkLabel" id="blablalabel23">
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes">This will remove the password protection from this account. Are you sure this is what you want to do ?</property>
- <property name="wrap">True</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
+ <child>
+ <object class="GtkImage" id="user-icon">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
- <property name="position">3</property>
- </packing>
- </child>
- <child type="tab">
- <object class="GtkLabel" id="label28">
- <property name="visible">True</property>
- <property name="label" translatable="yes">No Password</property>
- </object>
- <packing>
- <property name="position">3</property>
- <property name="tab_fill">False</property>
+ <property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox18i8">
+ <object class="GtkVBox" id="vbox6">
<property name="visible">True</property>
- <property name="border_width">10</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkLabel" id="password-disabled-description-label">
+ <object class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes">Disable this account so that it may not be used.</property>
- <property name="wrap">True</property>
+ <property name="label" translatable="yes">Changing password for:</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="user-name">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ <attribute name="scale" value="1.200000"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
- <property name="position">4</property>
- </packing>
- </child>
- <child type="tab">
- <object class="GtkLabel" id="label289">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Account Disabled</property>
- </object>
- <packing>
- <property name="position">3</property>
- <property name="tab_fill">False</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
</packing>
</child>
</object>
<packing>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
</object>
@@ -817,53 +458,82 @@
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
- <property name="layout_style">end</property>
+ <property name="layout_style">edge</property>
<child>
- <object class="GtkButton" id="cancel-button">
- <property name="label" translatable="yes">Cancel</property>
+ <object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
+ <property name="xalign">0</property>
+ <child>
+ <object class="GtkLabel" id="password-normal-strength-hints-label">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes"><a href="http://wolfram.org/writing/howto/password.html">How to choose a strong password</a></property>
+ <property name="use_markup">True</property>
+ <property name="track_visited_links">False</property>
+ </object>
+ </child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
<property name="position">0</property>
+ <property name="secondary">True</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="ok-button">
- <property name="label" translatable="yes">Change</property>
+ <object class="GtkHButtonBox" id="hbuttonbox1">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">True</property>
+ <property name="spacing">6</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="ok-button">
+ <property name="label" translatable="yes">Ch_ange</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="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="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
+ <property name="secondary">True</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="0">cancel-button</action-widget>
- <action-widget response="0">ok-button</action-widget>
- </action-widgets>
</object>
<object class="GtkSizeGroup" id="sizegroup">
<widgets>
- <widget name="password-memorable-hint-label"/>
- <widget name="password-memorable-password-label"/>
- <widget name="password-memorable-length-label"/>
<widget name="password-normal-hint-label"/>
<widget name="password-normal-strength-label"/>
<widget name="password-normal-verify-label"/>
diff --git a/src/main.c b/src/main.c
index 7da763b..d72ffbe 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1189,6 +1189,8 @@ lockbutton_changed (PolkitLockButton *button,
gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-password-notebook")), 0);
gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-fingerprint-notebook")), 0);
}
+
+ um_password_dialog_set_privileged (d->password_dialog, is_authorized);
}
static void
diff --git a/src/um-password-dialog.c b/src/um-password-dialog.c
index af2853d..b8851ac 100644
--- a/src/um-password-dialog.c
+++ b/src/um-password-dialog.c
@@ -42,26 +42,23 @@ struct _UmPasswordDialog {
GtkWidget *dialog;
GtkWidget *user_icon;
GtkWidget *user_name;
+ GtkWidget *action_label;
GtkWidget *action_combo;
- GtkWidget *notebook;
GtkWidget *password_entry;
GtkWidget *verify_entry;
GtkWidget *strength_indicator;
GtkWidget *strength_indicator_label;
GtkWidget *normal_hint_entry;
+ GtkWidget *normal_hint_label;
GtkWidget *generate_combo;
- GtkWidget *short_radio;
- GtkWidget *medium_radio;
- GtkWidget *long_radio;
- GtkWidget *generate_hint_entry;
+ GtkWidget *generate_button;
+ GtkWidget *show_password_button;
GtkWidget *ok_button;
UmUser *user;
GtkWidget *old_password_label;
GtkWidget *old_password_entry;
- GtkWidget *old_password_label2;
- GtkWidget *old_password_entry2;
gboolean old_password_ok;
PasswdHandler *passwd_handler;
@@ -79,18 +76,8 @@ generate_passwords (UmPasswordDialog *um)
GtkListStore *store;
GtkTreeIter iter;
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (um->short_radio))) {
- min_len = 6;
- max_len = 8;
- }
- else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (um->medium_radio))) {
- min_len = 8;
- max_len = 10;
- }
- else {
- min_len = 10;
- max_len = 12;
- }
+ min_len = 6;
+ max_len = 12;
store = gtk_list_store_new (1, G_TYPE_STRING);
@@ -110,7 +97,9 @@ generate_passwords (UmPasswordDialog *um)
continue;
gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, lines[i], -1);
+ gtk_list_store_set (store, &iter,
+ 0, lines[i],
+ -1);
}
g_strfreev (lines);
}
@@ -209,7 +198,6 @@ password_changed_cb (PasswdHandler *handler,
GtkWidget *dialog;
const gchar *primary_text;
const gchar *secondary_text;
- GtkWidget *entry;
gtk_widget_set_sensitive (um->dialog, TRUE);
gdk_window_set_cursor (gtk_widget_get_window (um->dialog), NULL);
@@ -232,12 +220,8 @@ password_changed_cb (PasswdHandler *handler,
primary_text = error->message;
secondary_text = _("Please type again your current password.");
- if (gtk_notebook_get_current_page (GTK_NOTEBOOK (um->notebook)) == 0)
- entry = um->old_password_entry;
- else
- entry = um->old_password_entry2;
- gtk_widget_grab_focus (entry);
- gtk_entry_set_text (GTK_ENTRY (entry), "");
+ gtk_entry_set_text (GTK_ENTRY (um->old_password_entry), "");
+ gtk_widget_grab_focus (um->old_password_entry);
}
else {
primary_text = _("Password could not be changed");
@@ -264,7 +248,6 @@ accept_password_dialog (GtkButton *button,
GtkTreeModel *model;
GtkTreeIter iter;
gint mode;
- gint active;
const gchar *hint;
const gchar *password;
@@ -272,21 +255,8 @@ accept_password_dialog (GtkButton *button,
gtk_combo_box_get_active_iter (GTK_COMBO_BOX (um->action_combo), &iter);
gtk_tree_model_get (model, &iter, 1, &mode, -1);
- active = gtk_combo_box_get_active (GTK_COMBO_BOX (um->action_combo));
- if (active == 0) {
- password = gtk_entry_get_text (GTK_ENTRY (um->password_entry));
- hint = gtk_entry_get_text (GTK_ENTRY (um->normal_hint_entry));
- }
- else if (active == 1) {
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (um->generate_combo));
- gtk_combo_box_get_active_iter (GTK_COMBO_BOX (um->generate_combo), &iter);
- gtk_tree_model_get (model, &iter, 0, &password, -1);
- hint = gtk_entry_get_text (GTK_ENTRY (um->generate_hint_entry));
- }
- else {
- password = NULL;
- hint = NULL;
- }
+ password = gtk_entry_get_text (GTK_ENTRY (um->password_entry));
+ hint = gtk_entry_get_text (GTK_ENTRY (um->normal_hint_entry));
if (mode == 0 && um_user_get_uid (um->user) == getuid ()) {
GdkDisplay *display;
@@ -313,35 +283,45 @@ accept_password_dialog (GtkButton *button,
static void
update_sensitivity (UmPasswordDialog *um)
{
- gint page;
const gchar *password, *verify;
+ const gchar *old_password;
+ const gchar *tooltip;
gboolean can_change;
- page = gtk_notebook_get_current_page (GTK_NOTEBOOK (um->notebook));
- switch (page) {
- case 0:
- password = gtk_entry_get_text (GTK_ENTRY (um->password_entry));
- verify = gtk_entry_get_text (GTK_ENTRY (um->verify_entry));
-
- /* TODO: configurable policies for acceptable passwords */
- if (strcmp (password, verify) != 0)
- can_change = FALSE;
- else if (strlen (password) < MIN_PASSWORD_LEN)
- can_change = FALSE;
- else if (!um->old_password_ok)
- can_change = FALSE;
- else
- can_change = TRUE;
- break;
- case 1:
- can_change = um->old_password_ok;
- break;
- default:
+ password = gtk_entry_get_text (GTK_ENTRY (um->password_entry));
+ verify = gtk_entry_get_text (GTK_ENTRY (um->verify_entry));
+ old_password = gtk_entry_get_text (GTK_ENTRY (um->old_password_entry));
+
+ /* TODO: configurable policies for acceptable passwords */
+ if (strlen (password) < MIN_PASSWORD_LEN) {
+ can_change = FALSE;
+ if (password[0] == '\0') {
+ tooltip = _("You need to enter a new password");
+ }
+ else {
+ tooltip = _("The new password is too short");
+ }
+ }
+ else if (strcmp (password, verify) != 0) {
+ can_change = FALSE;
+ tooltip = _("The passwords do not match");
+ }
+ else if (!um->old_password_ok) {
+ can_change = FALSE;
+ if (old_password[0] == '\0') {
+ tooltip = _("You need to enter your current password");
+ }
+ else {
+ tooltip = _("The current password is not correct");
+ }
+ }
+ else {
can_change = TRUE;
- break;
+ tooltip = NULL;
}
gtk_widget_set_sensitive (um->ok_button, can_change);
+ gtk_widget_set_tooltip_text (um->ok_button, tooltip);
}
static void
@@ -351,8 +331,29 @@ action_changed (GtkComboBox *combo,
gint active;
active = gtk_combo_box_get_active (combo);
- gtk_notebook_set_current_page (GTK_NOTEBOOK (um->notebook), active);
- update_sensitivity (um);
+ if (active == 0) {
+ gtk_widget_set_sensitive (um->generate_combo, TRUE);
+ gtk_widget_set_sensitive (um->generate_button, TRUE);
+ gtk_widget_set_sensitive (um->verify_entry, TRUE);
+ gtk_widget_set_sensitive (um->old_password_entry, TRUE);
+ gtk_widget_set_sensitive (um->normal_hint_entry, TRUE);
+ gtk_widget_set_sensitive (um->normal_hint_label, TRUE);
+ gtk_widget_set_sensitive (um->strength_indicator_label, TRUE);
+ gtk_widget_set_sensitive (um->show_password_button, TRUE);
+
+ update_sensitivity (um);
+ }
+ else {
+ gtk_widget_set_sensitive (um->generate_combo, FALSE);
+ gtk_widget_set_sensitive (um->generate_button, FALSE);
+ gtk_widget_set_sensitive (um->verify_entry, FALSE);
+ gtk_widget_set_sensitive (um->old_password_entry, FALSE);
+ gtk_widget_set_sensitive (um->normal_hint_entry, FALSE);
+ gtk_widget_set_sensitive (um->normal_hint_label, FALSE);
+ gtk_widget_set_sensitive (um->strength_indicator_label, FALSE);
+ gtk_widget_set_sensitive (um->show_password_button, FALSE);
+ gtk_widget_set_sensitive (um->ok_button, TRUE);
+ }
}
static void
@@ -363,6 +364,7 @@ show_password_toggled (GtkToggleButton *button,
active = gtk_toggle_button_get_active (button);
gtk_entry_set_visibility (GTK_ENTRY (um->password_entry), active);
+ gtk_entry_set_visibility (GTK_ENTRY (um->verify_entry), active);
gtk_widget_set_sensitive (GTK_WIDGET (um->verify_entry), !active);
}
@@ -404,22 +406,45 @@ password_entry_changed (GtkEntry *entry,
}
static void
-entry_size_changed (GtkWidget *entry,
- GtkAllocation *allocation,
- GtkWidget *label)
+verify_entry_changed (GtkEntry *entry,
+ GParamSpec *pspec,
+ UmPasswordDialog *um)
{
- gtk_widget_set_size_request (label, allocation->width, -1);
+ clear_entry_validation_error (GTK_ENTRY (entry));
+ update_password_strength (um);
+ update_sensitivity (um);
}
-static void
-parent_size_changed (GtkWidget *parent,
- GtkAllocation *allocation,
- GtkWidget *label)
+static gboolean
+verify_entry_focus_out (GtkWidget *entry,
+ GdkEventFocus *event,
+ UmPasswordDialog *um)
{
- gint borderwidth;
+ const char *password;
+ const char *verify;
+
+ password = gtk_entry_get_text (GTK_ENTRY (um->password_entry));
+ verify = gtk_entry_get_text (GTK_ENTRY (um->verify_entry));
+
+ if (strlen (password) > 0 && strlen (verify) > 0) {
+ if (strcmp (password, verify) != 0) {
+ set_entry_validation_error (GTK_ENTRY (um->verify_entry),
+ _("Passwords do not match"));
+ }
+ else {
+ clear_entry_validation_error (GTK_ENTRY (um->verify_entry));
+ }
+ }
- borderwidth = gtk_container_get_border_width (GTK_CONTAINER (parent));
- gtk_widget_set_size_request (label, allocation->width - 2 * borderwidth - 10, -1);
+ return FALSE;
+}
+
+static void
+entry_size_changed (GtkWidget *entry,
+ GtkAllocation *allocation,
+ GtkWidget *label)
+{
+ gtk_widget_set_size_request (label, allocation->width, -1);
}
static void
@@ -427,21 +452,14 @@ auth_cb (PasswdHandler *handler,
GError *error,
UmPasswordDialog *um)
{
- GtkWidget *entry;
-
- if (gtk_notebook_get_current_page (GTK_NOTEBOOK (um->notebook)) == 0)
- entry = um->old_password_entry;
- else
- entry = um->old_password_entry2;
-
if (error) {
um->old_password_ok = FALSE;
- set_entry_validation_error (GTK_ENTRY (entry),
+ set_entry_validation_error (GTK_ENTRY (um->old_password_entry),
_("Wrong password"));
}
else {
um->old_password_ok = TRUE;
- clear_entry_validation_error (GTK_ENTRY (entry));
+ clear_entry_validation_error (GTK_ENTRY (um->old_password_entry));
}
update_sensitivity (um);
@@ -487,6 +505,21 @@ old_password_entry_changed (GtkEntry *entry,
update_sensitivity (um);
}
+void
+um_password_dialog_set_privileged (UmPasswordDialog *um,
+ gboolean privileged)
+{
+ if (privileged) {
+ gtk_widget_set_visible (um->action_label, TRUE);
+ gtk_widget_set_visible (um->action_combo, TRUE);
+ }
+ else {
+ gtk_combo_box_set_active (GTK_COMBO_BOX (um->action_combo), 0);
+ gtk_widget_set_visible (um->action_label, FALSE);
+ gtk_widget_set_visible (um->action_combo, FALSE);
+ }
+}
+
UmPasswordDialog *
um_password_dialog_new (void)
{
@@ -511,6 +544,12 @@ um_password_dialog_new (void)
um = g_new0 (UmPasswordDialog, 1);
+ um->action_label = (GtkWidget *) gtk_builder_get_object (builder, "action-label");
+ widget = (GtkWidget *) gtk_builder_get_object (builder, "action-combo");
+ g_signal_connect (widget, "changed",
+ G_CALLBACK (action_changed), um);
+ um->action_combo = widget;
+
widget = (GtkWidget *) gtk_builder_get_object (builder, "dialog");
g_signal_connect (widget, "delete-event",
G_CALLBACK (gtk_widget_hide_on_delete), NULL);
@@ -529,18 +568,20 @@ um_password_dialog_new (void)
gtk_widget_grab_default (widget);
um->ok_button = widget;
- widget = (GtkWidget *) gtk_builder_get_object (builder, "action-combobox");
- g_signal_connect (widget, "changed",
- G_CALLBACK (action_changed), um);
- um->action_combo = widget;
-
widget = (GtkWidget *) gtk_builder_get_object (builder, "show-password-checkbutton");
g_signal_connect (widget, "toggled",
G_CALLBACK (show_password_toggled), um);
+ um->show_password_button = widget;
+
+ widget = (GtkWidget *) gtk_builder_get_object (builder, "password-combo");
+ um->generate_combo = widget;
+
+ widget = gtk_bin_get_child (GTK_BIN (widget));
- widget = (GtkWidget *) gtk_builder_get_object (builder, "password-entry");
g_signal_connect (widget, "notify::text",
G_CALLBACK (password_entry_changed), um);
+ gtk_entry_set_visibility (GTK_ENTRY (widget), FALSE);
+
um->password_entry = widget;
widget = (GtkWidget *) gtk_builder_get_object (builder, "old-password-entry");
@@ -553,19 +594,11 @@ um_password_dialog_new (void)
um->old_password_entry = widget;
um->old_password_label = (GtkWidget *) gtk_builder_get_object (builder, "old-password-label");
- widget = (GtkWidget *) gtk_builder_get_object (builder, "old-password-entry2");
- g_signal_connect (widget, "focus-out-event",
- G_CALLBACK (old_password_entry_focus_out), um);
- g_signal_connect (widget, "notify::text",
- G_CALLBACK (old_password_entry_changed), um);
- g_signal_connect (widget, "activate",
- G_CALLBACK (old_password_entry_activate), um);
- um->old_password_entry2 = widget;
- um->old_password_label2 = (GtkWidget *) gtk_builder_get_object (builder, "old-password-label2");
-
widget = (GtkWidget *) gtk_builder_get_object (builder, "verify-entry");
g_signal_connect (widget, "notify::text",
- G_CALLBACK (password_entry_changed), um);
+ G_CALLBACK (verify_entry_changed), um);
+ g_signal_connect (widget, "focus-out-event",
+ G_CALLBACK (verify_entry_focus_out), um);
um->verify_entry = widget;
len = 0;
@@ -579,12 +612,11 @@ um_password_dialog_new (void)
widget = (GtkWidget *) gtk_builder_get_object (builder, "strength-indicator-label");
gtk_label_set_width_chars (GTK_LABEL (widget), len);
- widget = (GtkWidget *) gtk_builder_get_object (builder, "length-medium-radiobutton");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
widget = (GtkWidget *) gtk_builder_get_object (builder, "generate-again-button");
g_signal_connect_swapped (widget, "clicked",
G_CALLBACK (generate_passwords), um);
+ um->generate_button = widget;
um->normal_hint_entry = (GtkWidget *) gtk_builder_get_object (builder, "normal-hint-entry");
@@ -594,36 +626,12 @@ um_password_dialog_new (void)
widget = (GtkWidget *)gtk_builder_get_object (builder, "password-normal-hint-description-label");
g_signal_connect (um->normal_hint_entry, "size-allocate",
G_CALLBACK (entry_size_changed), widget);
+ um->normal_hint_label = widget;
- um->generate_hint_entry = (GtkWidget *) gtk_builder_get_object (builder, "generate-hint-entry");
-
-
- /* Label size hack */
- widget = (GtkWidget *)gtk_builder_get_object (builder, "password-memorable-hint-description-label");
- g_signal_connect (um->normal_hint_entry, "size-allocate",
- G_CALLBACK (entry_size_changed), widget);
-
- um->notebook = (GtkWidget *) gtk_builder_get_object (builder, "notebook");
- um->generate_combo = (GtkWidget *) gtk_builder_get_object (builder, "generate-combobox");
- um->short_radio = (GtkWidget *) gtk_builder_get_object (builder, "length-short-radiobutton");
- um->medium_radio = (GtkWidget *) gtk_builder_get_object (builder, "length-medium-radiobutton");
- um->long_radio = (GtkWidget *) gtk_builder_get_object (builder, "length-long-radiobutton");
um->strength_indicator = (GtkWidget *) gtk_builder_get_object (builder, "strength-indicator-progressbar");
um->strength_indicator_label = (GtkWidget *) gtk_builder_get_object (builder, "strength-indicator-label");
- /* More label size hacks */
- widget = (GtkWidget *)gtk_builder_get_object (builder, "password-login-description-label");
- g_signal_connect (widget->parent, "size-allocate",
- G_CALLBACK (parent_size_changed), widget);
- widget = (GtkWidget *)gtk_builder_get_object (builder, "password-none-description-label");
- g_signal_connect (widget->parent, "size-allocate",
- G_CALLBACK (parent_size_changed), widget);
-
- g_signal_connect (widget->parent, "size-allocate",
- G_CALLBACK (parent_size_changed), widget);
-
-
g_object_unref (builder);
generate_passwords (um);
@@ -674,22 +682,16 @@ um_password_dialog_set_user (UmPasswordDialog *um,
gtk_entry_set_text (GTK_ENTRY (um->password_entry), "");
gtk_entry_set_text (GTK_ENTRY (um->verify_entry), "");
gtk_entry_set_text (GTK_ENTRY (um->normal_hint_entry), "");
- gtk_entry_set_text (GTK_ENTRY (um->generate_hint_entry), "");
gtk_entry_set_text (GTK_ENTRY (um->old_password_entry), "");
- gtk_entry_set_text (GTK_ENTRY (um->old_password_entry2), "");
if (um_user_get_uid (um->user) == getuid()) {
gtk_widget_show (um->old_password_label);
gtk_widget_show (um->old_password_entry);
- gtk_widget_show (um->old_password_label2);
- gtk_widget_show (um->old_password_entry2);
um->passwd_handler = passwd_init ();
um->old_password_ok = FALSE;
}
else {
gtk_widget_hide (um->old_password_label);
gtk_widget_hide (um->old_password_entry);
- gtk_widget_hide (um->old_password_label2);
- gtk_widget_hide (um->old_password_entry2);
um->old_password_ok = TRUE;
}
}
diff --git a/src/um-password-dialog.h b/src/um-password-dialog.h
index 03abf33..8354e7c 100644
--- a/src/um-password-dialog.h
+++ b/src/um-password-dialog.h
@@ -33,6 +33,8 @@ UmPasswordDialog *um_password_dialog_new (void);
void um_password_dialog_free (UmPasswordDialog *dialog);
void um_password_dialog_set_user (UmPasswordDialog *dialog,
UmUser *user);
+void um_password_dialog_set_privileged (UmPasswordDialog *dialog,
+ gboolean privileged);
void um_password_dialog_show (UmPasswordDialog *dialog,
GtkWindow *parent);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]