[accounts-dialog/lockbutton: 3/4] In-place edit
- From: Matthias Clasen <matthiasc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [accounts-dialog/lockbutton: 3/4] In-place edit
- Date: Fri, 29 Jan 2010 13:38:39 +0000 (UTC)
commit 57f41f7c41b0316aeb73ad1149ba4e859dc1097d
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Jan 28 21:44:54 2010 -0500
In-place edit
data/language-chooser.ui | 4 +-
data/user-accounts-dialog.ui | 927 ++++++++++++++++++++----------------------
src/main.c | 582 ++++++++++++++++++++------
src/um-fingerprint-dialog.c | 58 +--
src/um-fingerprint-dialog.h | 11 +-
src/um-language-dialog.c | 110 +++---
src/um-language-dialog.h | 5 +
7 files changed, 990 insertions(+), 707 deletions(-)
---
diff --git a/data/language-chooser.ui b/data/language-chooser.ui
index e004652..e7e70cb 100644
--- a/data/language-chooser.ui
+++ b/data/language-chooser.ui
@@ -84,8 +84,8 @@
</object>
</child>
<action-widgets>
- <action-widget response="0">cancel-button</action-widget>
- <action-widget response="0">ok-button</action-widget>
+ <action-widget response="-6">cancel-button</action-widget>
+ <action-widget response="-5">ok-button</action-widget>
</action-widgets>
</object>
</interface>
diff --git a/data/user-accounts-dialog.ui b/data/user-accounts-dialog.ui
index e83422a..bc926ca 100644
--- a/data/user-accounts-dialog.ui
+++ b/data/user-accounts-dialog.ui
@@ -1,5 +1,43 @@
<?xml version="1.0"?>
<interface>
+ <!-- interface-requires gtk+ 2.12 -->
+ <!-- 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="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="GtkListStore" id="language-model">
+ <columns>
+ <!-- column-name gchararray -->
+ <column type="gchararray"/>
+ <!-- column-name gchararray1 -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkWindow" id="user-account-window">
<property name="border_width">10</property>
<property name="title" translatable="yes">Account Information</property>
@@ -15,27 +53,31 @@
<child>
<object class="GtkVBox" id="vbox3">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
<object class="GtkVBox" id="vbox34">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="list-treeview">
- <property name="name">userlist</property>
<property name="visible">True</property>
- <property name="headers-visible">False</property>
<property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
</object>
</child>
</object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
</child>
<child>
<object class="GtkHBox" id="add-delete-buttonbox">
@@ -43,87 +85,94 @@
<property name="homogeneous">True</property>
<child>
<object class="GtkButton" id="add-user-button">
+ <property name="label" translatable="yes">_Add</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="label" translatable="yes">_Add</property>
<property name="use_underline">True</property>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="delete-user-button">
+ <property name="label" translatable="yes">_Remove</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="label" translatable="yes">_Remove</property>
<property name="use_underline">True</property>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="login-options-button">
+ <property name="label" translatable="yes">_Login Options</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="label" translatable="yes">_Login Options</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
</child>
</object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
</child>
<child>
- <object class="GtkVBox" id="vbox4">
+ <object class="GtkNotebook" id="top-level-notebook">
<property name="visible">True</property>
+ <property name="show_tabs">False</property>
+ <property name="show_border">False</property>
<child>
- <object class="GtkNotebook" id="top-level-notebook">
+ <object class="GtkVBox" id="main-user-vbox">
<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="border_width">10</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkVBox" id="main-user-vbox">
+ <object class="GtkHBox" id="hbox2">
<property name="visible">True</property>
- <property name="border_width">10</property>
- <property name="spacing">6</property>
<child>
<object class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="n_rows">8</property>
- <property name="n_columns">3</property>
+ <property name="n_columns">2</property>
<property name="column_spacing">10</property>
<child>
<object class="GtkHBox" id="hbox20">
<property name="visible">True</property>
<child>
<object class="GtkButton" id="button11">
+ <property name="label" translatable="yes">Open</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="label" translatable="yes">Open</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="position">0</property>
</packing>
</child>
</object>
@@ -135,30 +184,19 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="label57">
- <property name="visible">True</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>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox2">
- <property name="visible">False</property>
+ <object class="GtkHBox" id="hbox3">
<child>
<object class="GtkButton" id="button10">
+ <property name="label" translatable="yes">Open</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="label" translatable="yes">Open</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="position">0</property>
</packing>
</child>
</object>
@@ -171,11 +209,10 @@
</child>
<child>
<object class="GtkLabel" id="account-parental-controls-label1">
- <property name="visible">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Address Book Card:</property>
<attributes>
- <attribute name="foreground" value="#555555"/>
+ <attribute name="foreground" value="#555555555555"/>
</attributes>
</object>
<packing>
@@ -185,223 +222,132 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="change-location-button">
+ <object class="GtkNotebook" id="account-location-notebook">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="relief">GTK_RELIEF_NONE</property>
+ <property name="show_tabs">False</property>
+ <property name="show_border">False</property>
<child>
- <object class="GtkLabel" id="label10">
+ <object class="GtkLabel" id="account-location-value-label">
<property name="visible">True</property>
- <property name="label" translatable="yes">Change...</property>
- <attributes>
- <attribute name="scale" value="0.83"/>
- <attribute name="style" value="italic"/>
- <attribute name="foreground" value="#555555"/>
- </attributes>
+ <property name="xalign">0</property>
</object>
</child>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
- <property name="x_options"/>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="change-fingerprint-button-enable">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="relief">GTK_RELIEF_NONE</property>
<child>
- <object class="GtkLabel" id="label12">
+ <object class="GtkButton" id="account-location-button">
<property name="visible">True</property>
- <property name="label" translatable="yes">Change...</property>
- <attributes>
- <attribute name="scale" value="0.83"/>
- <attribute name="style" value="italic"/>
- <attribute name="foreground" value="#555555"/>
- </attributes>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ <child>
+ <object class="GtkLabel" id="account-location-button-label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </object>
+ </child>
</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="top_attach">6</property>
- <property name="bottom_attach">7</property>
- <property name="x_options"/>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="change-fingerprint-button-disable">
- <property name="visible">False</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="relief">GTK_RELIEF_NONE</property>
<child>
- <object class="GtkLabel" id="label13">
+ <object class="GtkEntry" id="account-location-entry">
<property name="visible">True</property>
- <property name="label" translatable="yes">Change...</property>
- <attributes>
- <attribute name="scale" value="0.83"/>
- <attribute name="style" value="italic"/>
- <attribute name="foreground" value="#555555"/>
- </attributes>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
</object>
+ <packing>
+ <property name="position">2</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"/>
- <property name="y_options"/>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="change-language-button">
+ <object class="GtkNotebook" id="account-fingerprint-notebook">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="relief">GTK_RELIEF_NONE</property>
+ <property name="show_tabs">False</property>
+ <property name="show_border">False</property>
<child>
- <object class="GtkLabel" id="label9">
+ <object class="GtkLabel" id="account-fingerprint-value-label">
<property name="visible">True</property>
- <property name="label" translatable="yes">Change...</property>
- <attributes>
- <attribute name="scale" value="0.83"/>
- <attribute name="style" value="italic"/>
- <attribute name="foreground" value="#555555"/>
- </attributes>
+ <property name="xalign">0</property>
</object>
</child>
- </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"/>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="change-email-button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="relief">GTK_RELIEF_NONE</property>
<child>
- <object class="GtkLabel" id="label7">
+ <object class="GtkButton" id="account-fingerprint-button">
<property name="visible">True</property>
- <property name="label" translatable="yes">Change...</property>
- <attributes>
- <attribute name="scale" value="0.83"/>
- <attribute name="style" value="italic"/>
- <attribute name="foreground" value="#555555"/>
- </attributes>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ <child>
+ <object class="GtkLabel" id="account-fingerprint-button-label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </object>
+ </child>
</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="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options"/>
- <property name="y_options"/>
+ <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="GtkButton" id="change-password-button">
+ <object class="GtkNotebook" id="account-type-notebook">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="relief">GTK_RELIEF_NONE</property>
+ <property name="show_tabs">False</property>
+ <property name="show_border">False</property>
<child>
- <object class="GtkLabel" id="label6">
+ <object class="GtkLabel" id="account-type-value-label">
<property name="visible">True</property>
- <property name="label" translatable="yes">Change...</property>
- <attributes>
- <attribute name="scale" value="0.83"/>
- <attribute name="style" value="italic"/>
- <attribute name="foreground" value="#555555"/>
- </attributes>
+ <property name="xalign">0</property>
</object>
</child>
- </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 name="y_options"/>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="change-account-type-button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="relief">GTK_RELIEF_NONE</property>
<child>
- <object class="GtkLabel" id="label5">
+ <object class="GtkButton" id="account-type-button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ <child>
+ <object class="GtkLabel" id="account-type-button-label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="account-type-combo">
<property name="visible">True</property>
- <property name="label" translatable="yes">Change...</property>
- <attributes>
- <attribute name="scale" value="0.83"/>
- <attribute name="style" value="italic"/>
- <attribute name="foreground" value="#555555"/>
- </attributes>
+ <property name="model">account-type-model</property>
+ <child>
+ <object class="GtkCellRendererText" id="account-type-cell"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
</object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
</child>
</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>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="account-location-value-label">
- <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">5</property>
- <property name="bottom_attach">6</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="account-fingerprint-value-label">
- <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">6</property>
- <property name="bottom_attach">7</property>
- </packing>
- </child>
-
- <child>
- <object class="GtkLabel" id="account-type-value-label">
- <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">1</property>
@@ -412,10 +358,9 @@
<object class="GtkLabel" id="account-type-label">
<property name="visible">True</property>
<property name="xalign">1</property>
- <property name="yalign">0.5</property>
<property name="label" translatable="yes">Account type:</property>
<attributes>
- <attribute name="foreground" value="#555555"/>
+ <attribute name="foreground" value="#555555555555"/>
</attributes>
</object>
<packing>
@@ -427,67 +372,60 @@
<child>
<object class="GtkVBox" id="vbox10">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label20">
<property name="visible">True</property>
</object>
- </child>
- <child>
- <object class="GtkLabel" id="full-name-value-label">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- <attribute name="scale" value="1.2"/>
- </attributes>
- </object>
<packing>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="vbox11">
- <property name="visible">True</property>
<child>
- <object class="GtkLabel" id="label19">
+ <object class="GtkNotebook" id="full-name-notebook">
<property name="visible">True</property>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="change-name-button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="relief">GTK_RELIEF_NONE</property>
+ <property name="show_tabs">False</property>
+ <property name="show_border">False</property>
<child>
- <object class="GtkLabel" id="label21">
+ <object class="GtkLabel" id="full-name-value-label">
<property name="visible">True</property>
- <property name="label" translatable="yes">Change...</property>
+ <property name="xalign">0</property>
<attributes>
- <attribute name="scale" value="0.83"/>
- <attribute name="style" value="italic"/>
- <attribute name="foreground" value="#555555"/>
+ <attribute name="weight" value="bold"/>
+ <attribute name="scale" value="1.200000"/>
</attributes>
</object>
</child>
+ <child>
+ <object class="GtkButton" id="full-name-button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ <child>
+ <object class="GtkLabel" id="full-name-button-label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ <attribute name="scale" value="1.200000"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </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="x_options">GTK_FILL</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
</packing>
</child>
<child>
@@ -496,7 +434,7 @@
<property name="xalign">1</property>
<property name="label" translatable="yes">Password:</property>
<attributes>
- <attribute name="foreground" value="#555555"/>
+ <attribute name="foreground" value="#555555555555"/>
</attributes>
</object>
<packing>
@@ -506,9 +444,33 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="account-password-value-label">
+ <object class="GtkNotebook" id="account-password-notebook">
<property name="visible">True</property>
- <property name="xalign">0</property>
+ <property name="show_tabs">False</property>
+ <property name="show_border">False</property>
+ <child>
+ <object class="GtkLabel" id="account-password-value-label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="account-password-button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ <child>
+ <object class="GtkLabel" id="account-password-button-label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="left_attach">1</property>
@@ -523,7 +485,7 @@
<property name="xalign">1</property>
<property name="label" translatable="yes">E-mail address:</property>
<attributes>
- <attribute name="foreground" value="#555555"/>
+ <attribute name="foreground" value="#555555555555"/>
</attributes>
</object>
<packing>
@@ -533,9 +495,43 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="account-email-value-label">
+ <object class="GtkNotebook" id="account-email-notebook">
<property name="visible">True</property>
- <property name="xalign">0</property>
+ <property name="show_tabs">False</property>
+ <property name="show_border">False</property>
+ <child>
+ <object class="GtkLabel" id="account-email-value-label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="account-email-button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ <child>
+ <object class="GtkLabel" id="account-email-button-label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="account-email-entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="left_attach">1</property>
@@ -550,7 +546,7 @@
<property name="xalign">1</property>
<property name="label" translatable="yes">Language:</property>
<attributes>
- <attribute name="foreground" value="#555555"/>
+ <attribute name="foreground" value="#555555555555"/>
</attributes>
</object>
<packing>
@@ -560,24 +556,12 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="account-language-value-label">
- <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">4</property>
- <property name="bottom_attach">5</property>
- </packing>
- </child>
- <child>
<object class="GtkLabel" id="location-label">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Location:</property>
<attributes>
- <attribute name="foreground" value="#555555"/>
+ <attribute name="foreground" value="#555555555555"/>
</attributes>
</object>
<packing>
@@ -592,7 +576,7 @@
<property name="xalign">1</property>
<property name="label" translatable="yes">Fingerprint Login:</property>
<attributes>
- <attribute name="foreground" value="#555555"/>
+ <attribute name="foreground" value="#555555555555"/>
</attributes>
</object>
<packing>
@@ -607,7 +591,7 @@
<property name="xalign">1</property>
<property name="label" translatable="yes">Restrictions:</property>
<attributes>
- <attribute name="foreground" value="#555555"/>
+ <attribute name="foreground" value="#555555555555"/>
</attributes>
</object>
<packing>
@@ -623,23 +607,26 @@
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
</object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
</child>
<child>
<object class="GtkAlignment" id="user-icon-nonbutton">
- <property name="visible">False</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<object class="GtkImage" id="user-icon-image">
<property name="visible">True</property>
- <property name="icon_size">6</property>
<property name="icon_name">stock_person</property>
+ <property name="icon-size">6</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -647,18 +634,18 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="tooltip-text" translatable="yes">Select personal image</property>
<child>
<object class="GtkImage" id="user-icon-image2">
<property name="visible">True</property>
- <property name="icon_size">6</property>
<property name="icon_name">stock_person</property>
+ <property name="icon-size">6</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
@@ -666,237 +653,225 @@
<property name="x_options">GTK_FILL</property>
</packing>
</child>
- </object>
- <packing>
- <property name="expand">False</property>
- </packing>
- </child>
- </object>
- </child>
- <child type="tab">
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="label" translatable="yes">User</property>
- </object>
- <packing>
- <property name="tab_fill">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="main-group-vbox">
- <property name="visible">True</property>
- </object>
- </child>
- <child type="tab">
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Group</property>
- </object>
- <packing>
- <property name="position">1</property>
- <property name="tab_fill">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="main-login-window-vbox">
- <property name="visible">True</property>
- <property name="border_width">10</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkHBox" id="hbox6">
- <property name="visible">True</property>
- <property name="spacing">6</property>
<child>
- <object class="GtkLabel" id="dm-automatic-login-label">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Automatic Login:</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="dm-automatic-login-combobox">
+ <object class="GtkEventBox" id="eventbox1">
<property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK</property>
+ <property name="visible_window">False</property>
<child>
- <object class="GtkCellRendererText" id="renderer1"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
+ <object class="GtkNotebook" id="account-language-notebook">
+ <property name="visible">True</property>
+ <property name="show_tabs">False</property>
+ <property name="show_border">False</property>
+ <child>
+ <object class="GtkLabel" id="account-language-value-label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="account-language-button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ <child>
+ <object class="GtkLabel" id="account-language-button-label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="account-language-combo">
+ <property name="visible">True</property>
+ <property name="model">language-model</property>
+ <child>
+ <object class="GtkCellRendererText" id="account-language-cell"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
</child>
</object>
<packing>
- <property name="position">1</property>
+ <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="x_options">GTK_FILL</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="dm-show-user-list-checkbutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Show list of users</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="dm-show-power-buttons-checkbutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Show Shutdown, Suspend, and Restart actions</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="dm-show-password-hints-checkbutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Show password hints</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
- </packing>
+ <placeholder/>
</child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="tab">
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child type="tab">
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkVBox" id="main-login-window-vbox">
+ <property name="visible">True</property>
+ <property name="border_width">10</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkHBox" id="hbox6">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkCheckButton" id="dm-allow-guest-login-checkbutton">
+ <object class="GtkLabel" id="dm-automatic-login-label">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Enable Guest login</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Automatic Login:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">4</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkHBox" id="hhhboxxx">
+ <object class="GtkComboBox" id="dm-automatic-login-combobox">
<property name="visible">True</property>
<child>
- <object class="GtkLabel" id="labl2">
- <property name="visible">True</property>
- <property name="label"> </property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="labl3">
- <property name="visible">True</property>
- <property name="wrap">True</property>
- <property name="use_markup">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes"><span foreground="#555555">A guest account will allow anyone to temporarily log in to this computer without a password. For security, remote logins to this account are not allowed. When the guest user logs out, all files and data associated with the account will be deleted.</span></property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
+ <object class="GtkCellRendererText" id="renderer1"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
</child>
</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="fill">False</property>
+ <property name="position">0</property>
+ </packing>
</child>
- <child type="tab">
- <object class="GtkLabel" id="label3">
+ <child>
+ <object class="GtkCheckButton" id="dm-show-user-list-checkbutton">
+ <property name="label" translatable="yes">Show list of users</property>
<property name="visible">True</property>
- <property name="label" translatable="yes">Login Window</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
</object>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="dm-show-power-buttons-checkbutton">
+ <property name="label" translatable="yes">Show Shutdown, Suspend, and Restart actions</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>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">2</property>
- <property name="tab_fill">False</property>
</packing>
</child>
<child>
- <object class="GtkVBox" id="main-login-window-vbox1">
+ <object class="GtkCheckButton" id="dm-show-password-hints-checkbutton">
+ <property name="label" translatable="yes">Show password hints</property>
<property name="visible">True</property>
- <property name="border_width">10</property>
- <property name="spacing">10</property>
- <child>
- <object class="GtkLabel" id="label16">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes">A guest account will allow anyone to temporarily log in to this computer without a password. For security, remote logins to this account are not allowed.
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">A guest account will allow anyone to temporarily log in to this computer without a password. For security, remote logins to this account are not allowed.
<b>When the guest user logs out, all files and data associated with the account will be deleted.</b></property>
- <property name="use_markup">True</property>
- <property name="wrap">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="checkbutton1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Allow guests to log in to this computer</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button5">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="label" translatable="yes">Open Parental Controls...</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
+ <property name="use_markup">True</property>
+ <property name="wrap">True</property>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
</child>
- <child type="tab">
- <object class="GtkLabel" id="label15">
+ <child>
+ <object class="GtkCheckButton" id="dm-allow-guest-login-checkbutton">
+ <property name="label" translatable="yes">Allow guests to log in to this computer</property>
<property name="visible">True</property>
- <property name="label" translatable="yes">Guest</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
</object>
<packing>
- <property name="position">3</property>
- <property name="tab_fill">False</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">5</property>
</packing>
</child>
</object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child type="tab">
+ <placeholder/>
</child>
</object>
<packing>
@@ -904,43 +879,31 @@
</packing>
</child>
</object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
</child>
</object>
</child>
</object>
<object class="GtkSizeGroup" id="user-icon-sizegroup">
- <property name="mode">GTK_SIZE_GROUP_BOTH</property>
+ <property name="mode">both</property>
<widgets>
- <widget name="user-icon-nonbutton"/>
<widget name="user-icon-button"/>
+ <widget name="user-icon-nonbutton"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="button-height-sizegroup">
- <property name="mode">GTK_SIZE_GROUP_VERTICAL</property>
- <widgets>
- <widget name="change-name-button"/>
- <widget name="change-account-type-button"/>
- <widget name="change-password-button"/>
- <widget name="change-email-button"/>
- <widget name="change-language-button"/>
- <widget name="change-location-button"/>
- <widget name="account-type-label"/>
- <widget name="password-label"/>
- <widget name="email-label"/>
- <widget name="language-label"/>
- <widget name="location-label"/>
- <widget name="account-fingerprint-label"/>
- </widgets>
+ <property name="mode">vertical</property>
</object>
<object class="GtkSizeGroup" id="label-width-sizegroup">
- <property name="mode">GTK_SIZE_GROUP_HORIZONTAL</property>
<widgets>
- <widget name="account-type-label"/>
- <widget name="password-label"/>
- <widget name="email-label"/>
- <widget name="language-label"/>
- <widget name="location-label"/>
<widget name="account-fingerprint-label"/>
+ <widget name="location-label"/>
+ <widget name="language-label"/>
+ <widget name="email-label"/>
+ <widget name="password-label"/>
+ <widget name="account-type-label"/>
</widgets>
</object>
</interface>
diff --git a/src/main.c b/src/main.c
index 95ec374..925b1a8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -31,6 +31,7 @@
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
#include <unique/unique.h>
#include <polkit/polkit.h>
#include <polkitgtk/polkitgtk.h>
@@ -63,7 +64,8 @@ typedef struct {
GtkBuilder *builder;
GtkWidget *main_window;
- GtkWidget *lock_button;
+ GtkWidget *lock_button;
+ GtkWidget *language_chooser;
UmAccountDialog *account_dialog;
UmAccountTypeDialog *account_type_dialog;
@@ -447,18 +449,25 @@ delete_user (GtkButton *button, UserAccountDialog *d)
static const char *
nonempty (const char *str)
{
- return (str == NULL || str[0] == 0) ? "-" : str;
+ return (str == NULL || str[0] == 0) ? "\xe2\x80\x94" : str;
}
+static void language_changed (GtkComboBox *combo, UserAccountDialog *d);
+
static void
show_user (UmUser *user, UserAccountDialog *d)
{
GtkWidget *image;
GtkWidget *label;
- GtkWidget *enable, *disable;
+ GtkWidget *label2;
+ GtkWidget *label3;
GdkPixbuf *pixbuf;
const char *text;
char *language;
+ GtkWidget *combo;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkWidget *widget;
pixbuf = um_user_render_icon (user, FALSE, 48);
image = get_widget (d, "user-icon-image");
@@ -473,10 +482,26 @@ show_user (UmUser *user, UserAccountDialog *d)
gtk_label_set_text (GTK_LABEL (label), um_user_get_real_name (user));
gtk_widget_set_tooltip_text (label, um_user_get_user_name (user));
+ label = get_widget (d, "full-name-button-label");
+ gtk_label_set_text (GTK_LABEL (label), um_user_get_real_name (user));
+ widget = get_widget (d, "full-name-button");
+ gtk_widget_set_tooltip_text (label, um_user_get_user_name (user));
+
label = get_widget (d, "account-type-value-label");
gtk_label_set_text (GTK_LABEL (label), um_account_type_get_name (um_user_get_account_type (user)));
+ label = get_widget (d, "account-type-button-label");
+ gtk_label_set_text (GTK_LABEL (label), um_account_type_get_name (um_user_get_account_type (user)));
+ combo = get_widget (d, "account-type-combo");
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
+ gtk_tree_model_get_iter_first (model, &iter);
+ do {
+ gint t;
+ gtk_tree_model_get (model, &iter, 1, &t, -1);
+ if (t == um_user_get_account_type (user)) {
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo), &iter);
+ }
+ } while (gtk_tree_model_iter_next (model, &iter));
- label = get_widget (d, "account-password-value-label");
switch (um_user_get_password_mode (user)) {
case UM_PASSWORD_MODE_REGULAR:
text = "\xe2\x80\xa2\xe2\x80\xa2\xe2\x80\xa2\xe2\x80\xa2\xe2\x80\xa2";
@@ -493,56 +518,67 @@ show_user (UmUser *user, UserAccountDialog *d)
default:
g_assert_not_reached ();
}
+ label = get_widget (d, "account-password-value-label");
+ gtk_label_set_text (GTK_LABEL (label), text);
+ label = get_widget (d, "account-password-button-label");
gtk_label_set_text (GTK_LABEL (label), text);
- label = get_widget (d, "account-email-value-label");
text = um_user_get_email (user);
- gtk_label_set_text (GTK_LABEL (label), nonempty (text));
+ widget = get_widget (d, "account-email-value-label");
+ gtk_label_set_text (GTK_LABEL (widget), nonempty (text));
+ widget = get_widget (d, "account-email-button-label");
+ gtk_label_set_text (GTK_LABEL (widget), nonempty (text));
+ widget = get_widget (d, "account-email-entry");
+ gtk_entry_set_text (GTK_ENTRY (widget), text);
+
+ widget = get_widget (d, "account-language-combo");
+ g_signal_handlers_block_by_func (widget, language_changed, d);
+ um_add_user_languages (widget);
- label = get_widget (d, "account-language-value-label");
text = um_user_get_language (user);
if (text) {
+ um_select_language (widget, text);
language = gdm_get_language_from_name (text, NULL);
- gtk_label_set_text (GTK_LABEL (label), language);
- g_free (language);
}
else {
- const char *locale;
-
- locale = (const char *) setlocale(LC_MESSAGES, NULL);
+ const gchar *locale;
+ locale = (const gchar *) setlocale (LC_MESSAGES, NULL);
if (locale) {
- char *name;
-
+ gchar *name;
name = gdm_normalize_language_name (locale);
+ um_select_language (widget, name);
language = gdm_get_language_from_name (name, NULL);
g_free (name);
-
- gtk_label_set_text (GTK_LABEL (label), language);
- g_free (language);
} else {
- gtk_label_set_text (GTK_LABEL (label), "-");
+ language = g_strdup (nonempty (""));
}
}
+ label = get_widget (d, "account-language-value-label");
+ gtk_label_set_text (GTK_LABEL (label), language);
+ label = get_widget (d, "account-language-button-label");
+ gtk_label_set_text (GTK_LABEL (label), language);
+ g_free (language);
+ g_signal_handlers_unblock_by_func (widget, language_changed, d);
- label = get_widget (d, "account-location-value-label");
text = um_user_get_location (user);
+ label = get_widget (d, "account-location-value-label");
gtk_label_set_text (GTK_LABEL (label), nonempty (text));
-
- label = get_widget (d, "account-fingerprint-value-label");
- enable = get_widget (d, "change-fingerprint-button-enable");
- disable = get_widget (d, "change-fingerprint-button-disable");
- if (g_strcmp0 (g_get_user_name (), um_user_get_user_name (user)) != 0 ||
- set_fingerprint_label (label, enable, disable) == FALSE) {
- gtk_widget_hide (label);
- gtk_widget_hide (enable);
- gtk_widget_hide (disable);
-
- label = get_widget (d, "account-fingerprint-label");
+ label = get_widget (d, "account-location-button-label");
+ gtk_label_set_text (GTK_LABEL (label), nonempty (text));
+ label = get_widget (d, "account-location-entry");
+ gtk_entry_set_text (GTK_ENTRY (label), text);
+
+ widget = get_widget (d, "account-fingerprint-notebook");
+ label = get_widget (d, "account-fingerprint-label");
+ label2 = get_widget (d, "account-fingerprint-value-label");
+ label3 = get_widget (d, "account-fingerprint-button-label");
+ if (um_user_get_uid (user) != getuid() ||
+ !set_fingerprint_label (label2, label3)) {
gtk_widget_hide (label);
+ gtk_widget_hide (widget);
} else {
gtk_widget_show (label);
- label = get_widget (d, "account-fingerprint-label");
- gtk_widget_show (label);
+ gtk_widget_show (widget);
}
}
@@ -577,19 +613,10 @@ update_data_change_buttons (GObject *source,
gtk_widget_show (get_widget (d, "user-icon-button"));
gtk_widget_hide (get_widget (d, "user-icon-nonbutton"));
- gtk_widget_show (get_widget (d, "change-name-button"));
- gtk_widget_show (get_widget (d, "change-email-button"));
- gtk_widget_show (get_widget (d, "change-language-button"));
- gtk_widget_show (get_widget (d, "change-location-button"));
}
else {
gtk_widget_hide (get_widget (d, "user-icon-button"));
gtk_widget_show (get_widget (d, "user-icon-nonbutton"));
-
- gtk_widget_hide (get_widget (d, "change-name-button"));
- gtk_widget_hide (get_widget (d, "change-email-button"));
- gtk_widget_hide (get_widget (d, "change-language-button"));
- gtk_widget_hide (get_widget (d, "change-location-button"));
}
}
@@ -622,13 +649,6 @@ update_account_type_change_buttons (GObject *source,
g_object_unref (result);
}
- if (is_authorized) {
- gtk_widget_show (get_widget (d, "change-account-type-button"));
- }
- else {
- gtk_widget_hide (get_widget (d, "change-account-type-button"));
- }
-
user = get_selected_user (d);
if (um_user_get_uid (user) == geteuid ()) {
can_change_password = TRUE;
@@ -636,13 +656,6 @@ update_account_type_change_buttons (GObject *source,
else {
can_change_password = is_authorized;
}
-
- if (can_change_password) {
- gtk_widget_show (get_widget (d, "change-password-button"));
- }
- else {
- gtk_widget_hide (get_widget (d, "change-password-button"));
- }
}
static void
@@ -775,10 +788,8 @@ selected_user_changed (GtkTreeSelection *selection, UserAccountDialog *d)
widget = get_widget (d, "login-options-button");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
update_create_buttons (d);
-#if 0
- update_change_buttons (d, user);
-#endif
- lockbutton_changed (POLKIT_LOCK_BUTTON (d->lock_button), d);
+
+ lockbutton_changed (POLKIT_LOCK_BUTTON (d->lock_button), d);
g_object_unref (user);
}
@@ -799,17 +810,178 @@ change_name (GtkButton *button, UserAccountDialog *d)
}
static void
-change_account_type (GtkButton *button, UserAccountDialog *d)
+change_account_type_authorized_cb (GObject *source,
+ GAsyncResult *res,
+ UserAccountDialog *d)
{
+ GError *error;
+ PolkitAuthorizationResult *result;
+ gboolean is_authorized;
+
+ error = NULL;
+ is_authorized = FALSE;
+ result = polkit_authority_check_authorization_finish (d->authority,
+ res,
+ &error);
+ if (error) {
+ g_warning ("polkit check failed: %s", error->message);
+ g_error_free (error);
+ }
+ else {
+ if (polkit_authorization_result_get_is_authorized (result)) {
+ is_authorized = TRUE;
+ }
+
+ g_object_unref (result);
+ }
+
+ if (is_authorized) {
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-type-notebook")), 2);
+ }
+}
+
+static void
+change_account_type_start (GtkButton *button,
+ UserAccountDialog *d)
+{
+ PolkitSubject *subject;
+
+ subject = polkit_unix_process_new (getpid ());
+
+ polkit_authority_check_authorization (d->authority,
+ subject,
+ "org.freedesktop.accounts.user-administration",
+ NULL,
+ POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
+ NULL,
+ (GAsyncReadyCallback)change_account_type_authorized_cb,
+ d);
+
+ g_object_unref (subject);
+}
+
+static void
+account_type_changed (GtkComboBox *combo,
+ UserAccountDialog *d)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gint t;
UmUser *user;
user = get_selected_user (d);
+ model = gtk_combo_box_get_model (combo);
+ gtk_combo_box_get_active_iter (combo, &iter);
+ gtk_tree_model_get (model, &iter, 1, &t, -1);
- um_account_type_dialog_set_user (d->account_type_dialog, user);
- um_account_type_dialog_show (d->account_type_dialog,
- GTK_WINDOW (get_widget (d, "user-account-window")));
+ if (t != um_user_get_account_type (user)) {
+ um_user_set_account_type (user, t);
+ }
+}
- g_object_unref (user);
+static void
+language_response (GtkDialog *dialog,
+ gint response_id,
+ UserAccountDialog *d)
+{
+ GtkWidget *widget;
+ UmUser *user;
+ gchar *lang;
+ const gchar *text;
+ gchar *language;
+
+ user = get_selected_user (d);
+ widget = get_widget (d, "account-language-combo");
+ if (response_id == GTK_RESPONSE_OK) {
+ lang = um_language_chooser_get_language (GTK_WIDGET (dialog));
+ um_user_set_language (user, lang);
+ um_select_language (widget, lang);
+ language = g_strdup (nonempty (lang));
+ g_free (lang);
+ }
+ else {
+ text = um_user_get_language (user);
+ if (text) {
+ um_select_language (widget, text);
+ language = gdm_get_language_from_name (text, NULL);
+ }
+ else {
+ const gchar *locale;
+ locale = (const gchar *) setlocale (LC_MESSAGES, NULL);
+ if (locale) {
+ char *name;
+ name = gdm_normalize_language_name (locale);
+ um_select_language (widget, name);
+ language = gdm_get_language_from_name (name, NULL);
+ g_free (name);
+ } else {
+ language = g_strdup (nonempty (""));
+ }
+ }
+ }
+
+ gtk_label_set_text (GTK_LABEL (get_widget (d, "account-language-value-label")), language);
+ gtk_label_set_text (GTK_LABEL (get_widget (d, "account-language-button-label")), language);
+ g_free (language);
+
+ gtk_widget_hide (GTK_WIDGET (dialog));
+ gtk_widget_set_sensitive (widget, TRUE);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-language-notebook")), 1);
+}
+
+static void
+language_changed (GtkComboBox *combo,
+ UserAccountDialog *d)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gchar *lang;
+ UmUser *user;
+
+ if (!gtk_combo_box_get_active_iter (combo, &iter))
+ return;
+
+ user = get_selected_user (d);
+ model = gtk_combo_box_get_model (combo);
+
+ gtk_tree_model_get (model, &iter, 0, &lang, -1);
+ if (lang) {
+ if (g_strcmp0 (lang, um_user_get_language (user)) != 0) {
+ um_user_set_language (user, lang);
+ }
+ g_free (lang);
+ return;
+ }
+
+ if (!d->language_chooser) {
+ d->language_chooser = um_language_chooser_new ();
+ gtk_window_set_transient_for (GTK_WINDOW (d->language_chooser),
+ GTK_WINDOW (d->main_window));
+ g_signal_connect (d->language_chooser, "response",
+ G_CALLBACK (language_response), d);
+ g_signal_connect (d->language_chooser, "delete-event",
+ G_CALLBACK (gtk_widget_hide_on_delete), NULL);
+ }
+
+ gtk_window_present (GTK_WINDOW (d->language_chooser));
+ gtk_widget_set_sensitive (GTK_WIDGET (combo), FALSE);
+}
+
+static gboolean
+language_key_press (GtkWidget *combo,
+ GdkEventKey *event,
+ UserAccountDialog *d)
+{
+ GtkWidget *nb;
+
+ if (event->keyval == GDK_Escape) {
+ nb = get_widget (d, "account-language-notebook");
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (nb), 1);
+
+ return TRUE;
+ }
+
+ return FALSE;
}
static void
@@ -827,51 +999,162 @@ change_password (GtkButton *button, UserAccountDialog *d)
}
static void
-change_email (GtkButton *button, UserAccountDialog *d)
+change_email_start (GtkButton *button,
+ UserAccountDialog *d)
+{
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-email-notebook")), 2);
+}
+
+static void
+change_email_done (GtkWidget *entry,
+ UserAccountDialog *d)
{
+ const gchar *text;
UmUser *user;
user = get_selected_user (d);
- um_email_dialog_set_user (d->email_dialog, user);
- um_email_dialog_show (d->email_dialog,
- GTK_WINDOW (get_widget (d, "user-account-window")));
+ text = gtk_entry_get_text (GTK_ENTRY (entry));
+ if (g_strcmp0 (text, um_user_get_email (user)) != 0) {
+ um_user_set_email (user, text);
+ }
- g_object_unref (user);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-email-notebook")), 1);
}
static void
-change_language (GtkButton *button, UserAccountDialog *d)
+change_email_canceled (UserAccountDialog *d)
{
UmUser *user;
+ const gchar *text;
+ GtkWidget *widget;
user = get_selected_user (d);
+ text = um_user_get_email (user);
- um_language_dialog_set_user (d->language_dialog, user);
- um_language_dialog_show (d->language_dialog,
- GTK_WINDOW (get_widget (d, "user-account-window")));
+ widget = get_widget (d, "account-email-value-label");
+ gtk_label_set_text (GTK_LABEL (widget), nonempty (text));
+ widget = get_widget (d, "account-email-button-label");
+ gtk_label_set_text (GTK_LABEL (widget), nonempty (text));
+ widget = get_widget (d, "account-email-entry");
+ gtk_entry_set_text (GTK_ENTRY (widget), text);
- g_object_unref (user);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-email-notebook")), 1);
+}
+
+static void
+change_email_activate (GtkWidget *widget,
+ UserAccountDialog *d)
+{
+ change_email_done (widget, d);
+}
+
+static gboolean
+change_email_focus_out (GtkWidget *widget,
+ GdkEventFocus *event,
+ UserAccountDialog *d)
+{
+ change_email_done (widget, d);
+
+ return FALSE;
+}
+
+static gboolean
+change_email_key_press (GtkWidget *widget,
+ GdkEventKey *event,
+ UserAccountDialog *d)
+{
+ if (event->keyval == GDK_Escape) {
+ change_email_canceled (d);
+ }
+
+ return FALSE;
+}
+
+static void
+change_location_start (GtkButton *button,
+ UserAccountDialog *d)
+{
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-location-notebook")), 2);
}
static void
-change_location (GtkButton *button, UserAccountDialog *d)
+change_location_done (GtkWidget *entry,
+ UserAccountDialog *d)
{
+ const gchar *text;
UmUser *user;
user = get_selected_user (d);
- um_location_dialog_set_user (d->location_dialog, user);
- um_location_dialog_show (d->location_dialog,
- GTK_WINDOW (get_widget (d, "user-account-window")));
+ text = gtk_entry_get_text (GTK_ENTRY (entry));
+ if (g_strcmp0 (text, um_user_get_location (user)) != 0) {
+ um_user_set_location (user, text);
+ }
- g_object_unref (user);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-location-notebook")), 1);
+}
+
+static void
+change_location_canceled (UserAccountDialog *d)
+{
+ UmUser *user;
+ const gchar *text;
+ GtkWidget *widget;
+
+ user = get_selected_user (d);
+ text = um_user_get_location (user);
+
+ widget = get_widget (d, "account-location-value-label");
+ gtk_label_set_text (GTK_LABEL (widget), nonempty (text));
+ widget = get_widget (d, "account-location-button-label");
+ gtk_label_set_text (GTK_LABEL (widget), nonempty (text));
+ widget = get_widget (d, "account-location-entry");
+ gtk_entry_set_text (GTK_ENTRY (widget), text);
+
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-location-notebook")), 1);
+}
+
+static void
+change_location_activate (GtkWidget *widget,
+ UserAccountDialog *d)
+{
+ change_location_done (widget, d);
+}
+
+static gboolean
+change_location_focus_out (GtkWidget *widget,
+ GdkEventFocus *event,
+ UserAccountDialog *d)
+{
+ change_location_done (widget, d);
+
+ return FALSE;
+}
+
+static gboolean
+change_location_key_press (GtkWidget *widget,
+ GdkEventKey *event,
+ UserAccountDialog *d)
+{
+ if (event->keyval == GDK_Escape) {
+ change_location_canceled (d);
+ }
+
+ return FALSE;
+}
+
+static void
+change_language_start (GtkButton *button,
+ UserAccountDialog *d)
+{
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-language-notebook")), 2);
}
static void
change_fingerprint (GtkButton *button, UserAccountDialog *d)
{
- GtkWidget *label, *enable, *disable;
+ GtkWidget *label, *label2;
UmUser *user;
user = get_selected_user (d);
@@ -879,12 +1162,8 @@ change_fingerprint (GtkButton *button, UserAccountDialog *d)
g_object_unref (user);
label = get_widget (d, "account-fingerprint-value-label");
- enable = get_widget (d, "change-fingerprint-button-enable");
- disable = get_widget (d, "change-fingerprint-button-disable");
- fingerprint_button_clicked (GTK_WINDOW (d->main_window),
- label,
- enable,
- disable);
+ label2 = get_widget (d, "account-fingerprint-button-label");
+ fingerprint_button_clicked (GTK_WINDOW (d->main_window), label, label2);
}
static void
@@ -904,7 +1183,7 @@ toggle_login_options (GtkButton *button, UserAccountDialog *d)
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list));
model = gtk_tree_view_get_model (GTK_TREE_VIEW (list));
if (active) {
- gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 2);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 1);
gtk_tree_selection_unselect_all (selection);
}
else {
@@ -1016,45 +1295,72 @@ static void
lockbutton_changed (PolkitLockButton *button,
gpointer data)
{
- UserAccountDialog *d = data;
- gboolean is_authorized;
- UmUser *user;
+ UserAccountDialog *d = data;
+ gboolean is_authorized;
+ UmUser *user;
user = get_selected_user (d);
- if (!user) {
- return;
- }
+ if (!user) {
+ return;
+ }
if (um_user_get_uid (user) == geteuid ()) {
- gtk_widget_hide (GTK_WIDGET (button));
- is_authorized = TRUE;
- }
- else {
- gtk_widget_show (GTK_WIDGET (button));
- is_authorized = polkit_lock_button_get_is_authorized (button);
- }
+ gtk_widget_hide (GTK_WIDGET (button));
+ is_authorized = TRUE;
+ }
+ else {
+ gtk_widget_show (GTK_WIDGET (button));
+ is_authorized = polkit_lock_button_get_is_authorized (button);
+ }
if (is_authorized) {
gtk_widget_show (get_widget (d, "user-icon-button"));
gtk_widget_hide (get_widget (d, "user-icon-nonbutton"));
- gtk_widget_show (get_widget (d, "change-name-button"));
- gtk_widget_show (get_widget (d, "change-email-button"));
- gtk_widget_show (get_widget (d, "change-language-button"));
- gtk_widget_show (get_widget (d, "change-location-button"));
- gtk_widget_show (get_widget (d, "change-account-type-button"));
- gtk_widget_show (get_widget (d, "change-password-button"));
+ if (gtk_notebook_get_current_page (GTK_NOTEBOOK (get_widget (d, "account-type-notebook"))) == 0) {
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-type-notebook")), 1);
+ }
+
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "full-name-notebook")), 1);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-email-notebook")), 1);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-language-notebook")), 1);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-location-notebook")), 1);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-password-notebook")), 1);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-fingerprint-notebook")), 1);
}
else {
gtk_widget_hide (get_widget (d, "user-icon-button"));
gtk_widget_show (get_widget (d, "user-icon-nonbutton"));
- gtk_widget_hide (get_widget (d, "change-name-button"));
- gtk_widget_hide (get_widget (d, "change-email-button"));
- gtk_widget_hide (get_widget (d, "change-language-button"));
- gtk_widget_hide (get_widget (d, "change-location-button"));
- gtk_widget_hide (get_widget (d, "change-account-type-button"));
- gtk_widget_hide (get_widget (d, "change-password-button"));
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "full-name-notebook")), 0);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-email-notebook")), 0);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-language-notebook")), 0);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-location-notebook")), 0);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-type-notebook")), 0);
+ 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);
+ }
+}
+
+static void
+focus_moved (GtkWindow *window,
+ GtkWidget *widget,
+ UserAccountDialog *d)
+{
+ GtkWidget *nb;
+
+ nb = get_widget (d, "account-type-notebook");
+
+ if (gtk_notebook_get_current_page (GTK_NOTEBOOK (nb)) == 2 &&
+ (!widget || !gtk_widget_is_ancestor (widget, nb))) {
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (nb), 1);
+ }
+
+ nb = get_widget (d, "account-language-notebook");
+
+ if (gtk_notebook_get_current_page (GTK_NOTEBOOK (nb)) == 2 &&
+ (!widget || !gtk_widget_is_ancestor (widget, nb))) {
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (nb), 1);
}
}
@@ -1141,35 +1447,47 @@ setup_main_window (UserAccountDialog *d)
update_create_buttons (d);
- button = get_widget (d, "change-name-button");
+ button = get_widget (d, "full-name-button");
g_signal_connect (button, "clicked", G_CALLBACK (change_name), d);
- button = get_widget (d, "change-account-type-button");
- g_signal_connect (button, "clicked", G_CALLBACK (change_account_type), d);
+ button = get_widget (d, "account-type-button");
+ g_signal_connect (button, "clicked", G_CALLBACK (change_account_type_start), d);
+ button = get_widget (d, "account-type-combo");
+ g_signal_connect (button, "changed", G_CALLBACK (account_type_changed), d);
- button = get_widget (d, "change-password-button");
+ button = get_widget (d, "account-password-button");
g_signal_connect (button, "clicked", G_CALLBACK (change_password), d);
- button = get_widget (d, "change-email-button");
- g_signal_connect (button, "clicked", G_CALLBACK (change_email), d);
-
- button = get_widget (d, "change-language-button");
- g_signal_connect (button, "clicked", G_CALLBACK (change_language), d);
-
- button = get_widget (d, "change-location-button");
- g_signal_connect (button, "clicked", G_CALLBACK (change_location), d);
-
- button = get_widget (d, "change-fingerprint-button-enable");
- g_signal_connect (button, "clicked",
- G_CALLBACK (change_fingerprint), d);
-
- button = get_widget (d, "change-fingerprint-button-disable");
+ button = get_widget (d, "account-email-button");
+ g_signal_connect (button, "clicked", G_CALLBACK (change_email_start), d);
+ button = get_widget (d, "account-email-entry");
+ g_signal_connect (button, "activate", G_CALLBACK (change_email_activate), d);
+ g_signal_connect (button, "focus-out-event", G_CALLBACK (change_email_focus_out), d);
+ g_signal_connect (button, "key-press-event", G_CALLBACK (change_email_key_press), d);
+
+ button = get_widget (d, "account-language-button");
+ g_signal_connect (button, "clicked", G_CALLBACK (change_language_start), d);
+ button = get_widget (d, "account-language-combo");
+ g_signal_connect (button, "changed", G_CALLBACK (language_changed), d);
+ g_signal_connect (button, "key-press-event", G_CALLBACK (language_key_press), d);
+
+ /* ugly hack to catch the combo boxes losing focus */
+ g_signal_connect (window, "set-focus", G_CALLBACK (focus_moved), d);
+
+ button = get_widget (d, "account-location-button");
+ g_signal_connect (button, "clicked", G_CALLBACK (change_location_start), d);
+ button = get_widget (d, "account-location-entry");
+ g_signal_connect (button, "activate", G_CALLBACK (change_location_activate), d);
+ g_signal_connect (button, "focus-out-event", G_CALLBACK (change_location_focus_out), d);
+ g_signal_connect (button, "key-press-event", G_CALLBACK (change_location_key_press), d);
+
+ button = get_widget (d, "account-fingerprint-button");
g_signal_connect (button, "clicked",
G_CALLBACK (change_fingerprint), d);
- button = polkit_lock_button_new ("org.freedesktop.accounts.user-administration");
+ button = polkit_lock_button_new ("org.freedesktop.accounts.user-administration");
gtk_widget_show (button);
- box = get_widget (d, "main-user-vbox");
+ box = get_widget (d, "main-user-vbox");
gtk_box_pack_end (GTK_BOX (box), button, FALSE, FALSE, 0);
g_signal_connect (button, "changed",
G_CALLBACK (lockbutton_changed), d);
diff --git a/src/um-fingerprint-dialog.c b/src/um-fingerprint-dialog.c
index e34aeaa..e8996b7 100644
--- a/src/um-fingerprint-dialog.c
+++ b/src/um-fingerprint-dialog.c
@@ -45,9 +45,8 @@ enum {
};
typedef struct {
- GtkWidget *enable;
- GtkWidget *disable;
- GtkWidget *label;
+ GtkWidget *label1;
+ GtkWidget *label2;
GtkWidget *ass;
GtkBuilder *dialog;
@@ -143,17 +142,13 @@ get_error_dialog (const char *title,
}
gboolean
-set_fingerprint_label (GtkWidget *label,
- GtkWidget *enable,
- GtkWidget *disable)
+set_fingerprint_label (GtkWidget *label1,
+ GtkWidget *label2)
{
char **fingers;
DBusGProxy *device;
GError *error = NULL;
- gtk_widget_set_no_show_all (enable, TRUE);
- gtk_widget_set_no_show_all (disable, TRUE);
-
if (manager == NULL) {
create_manager ();
if (manager == NULL) {
@@ -175,15 +170,13 @@ set_fingerprint_label (GtkWidget *label,
}
if (fingers == NULL || g_strv_length (fingers) == 0) {
- gtk_widget_hide (disable);
- gtk_widget_show (enable);
is_disable = FALSE;
- gtk_label_set_text (GTK_LABEL (label), _("Disabled"));
+ gtk_label_set_text (GTK_LABEL (label1), _("Disabled"));
+ gtk_label_set_text (GTK_LABEL (label2), _("Disabled"));
} else {
- gtk_widget_hide (enable);
- gtk_widget_show (disable);
is_disable = TRUE;
- gtk_label_set_text (GTK_LABEL (label), _("Enabled"));
+ gtk_label_set_text (GTK_LABEL (label1), _("Enabled"));
+ gtk_label_set_text (GTK_LABEL (label2), _("Enabled"));
}
g_strfreev (fingers);
@@ -214,9 +207,8 @@ delete_fingerprints (void)
static void
delete_fingerprints_question (GtkWindow *parent,
- GtkWidget *label,
- GtkWidget *enable,
- GtkWidget *disable)
+ GtkWidget *label1,
+ GtkWidget *label2)
{
GtkWidget *question;
GtkWidget *button;
@@ -244,7 +236,7 @@ delete_fingerprints_question (GtkWindow *parent,
if (gtk_dialog_run (GTK_DIALOG (question)) == GTK_RESPONSE_OK) {
delete_fingerprints ();
- set_fingerprint_label (label, enable, disable);
+ set_fingerprint_label (label1, label2);
}
gtk_widget_destroy (question);
@@ -324,14 +316,13 @@ finger_combobox_changed (GtkComboBox *combobox, EnrollData *data)
static void
assistant_cancelled (GtkAssistant *ass, EnrollData *data)
{
- GtkWidget *enable, *disable, *label;
+ GtkWidget *label1, *label2;
- enable = data->enable;
- disable = data->disable;
- label = data->label;
+ label1 = data->label1;
+ label2 = data->label2;
enroll_data_destroy (data);
- set_fingerprint_label (label, enable, disable);
+ set_fingerprint_label (label1, label2);
}
static void
@@ -494,9 +485,8 @@ assistant_prepare (GtkAssistant *ass, GtkWidget *page, EnrollData *data)
static void
enroll_fingerprints (GtkWindow *parent,
- GtkWidget *label,
- GtkWidget *enable,
- GtkWidget *disable)
+ GtkWidget *label1,
+ GtkWidget *label2)
{
DBusGProxy *device, *p;
GHashTable *props;
@@ -530,9 +520,8 @@ enroll_fingerprints (GtkWindow *parent,
data = g_new0 (EnrollData, 1);
data->device = device;
- data->label = label;
- data->enable = enable;
- data->disable = disable;
+ data->label1 = label1;
+ data->label2 = label2;
/* Get some details about the device */
p = dbus_g_proxy_new_from_proxy (device, "org.freedesktop.DBus.Properties", NULL);
@@ -618,14 +607,13 @@ enroll_fingerprints (GtkWindow *parent,
void
fingerprint_button_clicked (GtkWindow *parent,
- GtkWidget *label,
- GtkWidget *enable,
- GtkWidget *disable)
+ GtkWidget *label1,
+ GtkWidget *label2)
{
if (is_disable != FALSE) {
- delete_fingerprints_question (parent, label, enable, disable);
+ delete_fingerprints_question (parent, label1, label2);
} else {
- enroll_fingerprints (parent, label, enable, disable);
+ enroll_fingerprints (parent, label1, label2);
}
}
diff --git a/src/um-fingerprint-dialog.h b/src/um-fingerprint-dialog.h
index 67ebeb1..c50ff34 100644
--- a/src/um-fingerprint-dialog.h
+++ b/src/um-fingerprint-dialog.h
@@ -19,11 +19,8 @@
#include <gtk/gtk.h>
-gboolean set_fingerprint_label (GtkWidget *label,
- GtkWidget *enable,
- GtkWidget *disable);
+gboolean set_fingerprint_label (GtkWidget *label1,
+ GtkWidget *label2);
void fingerprint_button_clicked (GtkWindow *parent,
- GtkWidget *label,
- GtkWidget *enable,
- GtkWidget *disable);
-
+ GtkWidget *label1,
+ GtkWidget *label2);
diff --git a/src/um-language-dialog.c b/src/um-language-dialog.c
index 0db603d..0b4a52f 100644
--- a/src/um-language-dialog.c
+++ b/src/um-language-dialog.c
@@ -74,6 +74,25 @@ accept_language_dialog (GtkButton *button,
um_language_dialog_set_user (um, NULL);
}
+gchar *
+um_language_chooser_get_language (GtkWidget *chooser)
+{
+ GtkTreeView *tv;
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gchar *lang;
+
+ tv = (GtkTreeView *) g_object_get_data (G_OBJECT (chooser), "list");
+ selection = gtk_tree_view_get_selection (tv);
+ if (gtk_tree_selection_get_selected (selection, &model, &iter))
+ gtk_tree_model_get (model, &iter, LOCALE_COL, &lang, -1);
+ else
+ lang = NULL;
+
+ return lang;
+}
+
static gint
sort_languages (GtkTreeModel *model,
GtkTreeIter *a,
@@ -102,22 +121,17 @@ sort_languages (GtkTreeModel *model,
return result;
}
-static void
-select_language (UmLanguageDialog *um,
- const gchar *lang)
+void
+um_select_language (GtkWidget *combo,
+ const gchar *lang)
{
- GtkWidget *combo;
GtkTreeModel *model;
GtkTreeIter iter;
char *l;
char *name;
char *language;
- combo = um->dialog_combo;
- model = GTK_TREE_MODEL (um->dialog_store);
-
- if (um->chooser)
- gtk_widget_hide (um->chooser);
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
gtk_widget_set_sensitive (combo, TRUE);
@@ -136,8 +150,8 @@ select_language (UmLanguageDialog *um,
if (name != NULL) {
language = gdm_get_language_from_name (name, NULL);
- gtk_list_store_append (um->dialog_store, &iter);
- gtk_list_store_set (um->dialog_store, &iter, LOCALE_COL, name, DISPLAY_LOCALE_COL, language, -1);
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter, LOCALE_COL, name, DISPLAY_LOCALE_COL, language, -1);
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo), &iter);
g_free (name);
@@ -146,6 +160,14 @@ select_language (UmLanguageDialog *um,
}
static void
+select_language (UmLanguageDialog *um,
+ const gchar *lang)
+{
+ if (um->chooser)
+ gtk_widget_hide (um->chooser);
+}
+
+static void
cancel_language_chooser (GtkButton *button,
UmLanguageDialog *um)
{
@@ -176,18 +198,9 @@ static void
row_activated (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeViewColumn *column,
- UmLanguageDialog *um)
+ GtkWidget *chooser)
{
- GtkTreeModel *model;
- GtkTreeIter iter;
- char *language;
-
- model = gtk_tree_view_get_model (tree_view);
- gtk_tree_model_get_iter (model, &iter, path);
-
- gtk_tree_model_get (model, &iter, LOCALE_COL, &language, -1);
- select_language (um, language);
- g_free (language);
+ gtk_dialog_response (GTK_DIALOG (chooser), GTK_RESPONSE_OK);
}
static gboolean
@@ -278,8 +291,8 @@ add_available_languages (GtkListStore *store)
g_strfreev (languages);
}
-static void
-add_user_languages (GtkListStore *store)
+void
+um_add_user_languages (GtkWidget *combo)
{
GHashTable *seen;
GSList *users, *l;
@@ -289,6 +302,11 @@ add_user_languages (GtkListStore *store)
char *language;
GtkTreeIter iter;
UmUserManager *manager;
+ GtkTreeModel *model;
+ GtkListStore *store;
+
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
+ store = GTK_LIST_STORE (model);
gtk_list_store_clear (store);
@@ -301,8 +319,9 @@ add_user_languages (GtkListStore *store)
for (l = users; l; l = l->next) {
user = l->data;
lang = um_user_get_language (user);
- if (!lang || !language_has_font (lang))
+ if (!lang || !language_has_font (lang)) {
continue;
+ }
name = gdm_normalize_language_name (lang);
@@ -321,31 +340,28 @@ add_user_languages (GtkListStore *store)
}
g_slist_free (users);
- g_hash_table_destroy (seen);
-
- /* Add the current locale if we cannot get it from the
- * user service */
- if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) < 1) {
- const char *locale;
- char *name;
- locale = (const char *) setlocale(LC_MESSAGES, NULL);
- name = gdm_normalize_language_name (locale);
+ /* Make sure the current locale is present */
+ lang = (const gchar *) setlocale (LC_MESSAGES, NULL);
+ name = gdm_normalize_language_name (lang);
+ if (!g_hash_table_lookup (seen, name)) {
language = gdm_get_language_from_name (name, NULL);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, LOCALE_COL, name, DISPLAY_LOCALE_COL, language, -1);
-
- g_free (name);
g_free (language);
}
+ g_free (name);
+
+ g_hash_table_destroy (seen);
+
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, LOCALE_COL, NULL, DISPLAY_LOCALE_COL, _("Other..."), -1);
}
-static void
-setup_language_chooser (UmLanguageDialog *um)
+GtkWidget *
+um_language_chooser_new (void)
{
GtkBuilder *builder;
const char *filename;
@@ -368,20 +384,14 @@ setup_language_chooser (UmLanguageDialog *um)
}
chooser = (GtkWidget *) gtk_builder_get_object (builder, "dialog");
- gtk_window_set_transient_for (GTK_WINDOW (chooser), GTK_WINDOW (um->dialog));
- um->chooser = chooser;
list = (GtkWidget *) gtk_builder_get_object (builder, "language-list");
+ g_object_set_data (chooser, "list", list);
g_signal_connect (list, "row-activated",
- G_CALLBACK (row_activated), um);
+ G_CALLBACK (row_activated), chooser);
button = (GtkWidget *) gtk_builder_get_object (builder, "cancel-button");
- g_signal_connect (button, "clicked",
- G_CALLBACK (cancel_language_chooser), um);
-
button = (GtkWidget *) gtk_builder_get_object (builder, "ok-button");
- g_signal_connect (button, "clicked",
- G_CALLBACK (accept_language_chooser), um);
gtk_widget_grab_default (button);
cell = gtk_cell_renderer_text_new ();
@@ -395,12 +405,12 @@ setup_language_chooser (UmLanguageDialog *um)
GTK_SORT_ASCENDING);
gtk_tree_view_set_model (GTK_TREE_VIEW (list), GTK_TREE_MODEL (store));
- um->chooser_list = list;
- um->chooser_store = store;
add_available_languages (store);
g_object_unref (builder);
+
+ return chooser;
}
static void
@@ -421,8 +431,10 @@ language_combo_changed (GtkComboBox *combo,
return;
}
+#if 0
if (!um->chooser)
setup_language_chooser (um);
+#endif
gtk_window_present (GTK_WINDOW (um->chooser));
gtk_widget_grab_focus (um->chooser_list);
@@ -531,7 +543,7 @@ um_language_dialog_set_user (UmLanguageDialog *um,
name = um_user_get_real_name (user);
gtk_label_set_label (GTK_LABEL (um->user_name), name);
- add_user_languages (um->dialog_store);
+ um_add_user_languages (um->dialog_combo);
language = um_user_get_language (user);
if (language) {
diff --git a/src/um-language-dialog.h b/src/um-language-dialog.h
index 62596ac..dc51cd1 100644
--- a/src/um-language-dialog.h
+++ b/src/um-language-dialog.h
@@ -35,6 +35,11 @@ void um_language_dialog_set_user (UmLanguageDialog *dialog,
UmUser *user);
void um_language_dialog_show (UmLanguageDialog *dialog,
GtkWindow *parent);
+void um_add_user_languages (GtkWidget *combo);
+void um_select_language (GtkWidget *combo,
+ const gchar *lang);
+GtkWidget *um_language_chooser_new (void);
+gchar *um_language_chooser_get_language (GtkWidget *chooser);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]