Commit 8711c015 authored by Julian Sparber's avatar Julian Sparber

accountsettings: add password change dialog

* Fix redraw bug on revealer toggle

https://gitlab.gnome.org/World/fractal/issues/21
parent 1d31eab7
......@@ -22,6 +22,7 @@
<file preprocess="xml-stripblanks">ui/room_menu.ui</file>
<file preprocess="xml-stripblanks">ui/user_menu.ui</file>
<file preprocess="xml-stripblanks">ui/account_settings.ui</file>
<file preprocess="xml-stripblanks">ui/password_dialog.ui</file>
<file preprocess="xml-stripblanks">ui/markdown_popover.ui</file>
<file preprocess="xml-stripblanks">ui/server_chooser_menu.ui</file>
<file preprocess="xml-stripblanks">ui/stickers_popover.ui</file>
......
......@@ -280,7 +280,7 @@
</object>
</child>
<child>
<object class="GtkBox">
<object class="GtkBox" id="account_settings_advanced_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
......@@ -432,7 +432,7 @@
</object>
</child>
<child>
<object class="GtkBox">
<object class="GtkBox" id="account_settings_delete_box">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="orientation">vertical</property>
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkDialog" id="password_dialog">
<property name="can_focus">False</property>
<property name="modal">True</property>
<property name="window_position">center</property>
<property name="default_width">440</property>
<property name="default_height">240</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<property name="deletable">False</property>
<property name="gravity">center</property>
<property name="transient_for">main_window</property>
<property name="attached_to">main_window</property>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkButton" id="password-dialog-cancel">
<property name="label" translatable="yes">_Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="valign">center</property>
<property name="use_underline">True</property>
<style>
<class name="text-button"/>
</style>
</object>
</child>
<child>
<object class="GtkButton" id="password-dialog-apply">
<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="valign">center</property>
<property name="use_underline">True</property>
<style>
<class name="text-button"/>
<class name="suggested-action"/>
</style>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<child internal-child="vbox">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkEntry" id="password-dialog-verify-entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="visibility">False</property>
<property name="activates_default">True</property>
<property name="input_purpose">password</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="password-dialog-hint">
<property name="height_request">50</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="wrap">True</property>
<property name="wrap_mode">word-char</property>
<property name="width_chars">35</property>
<property name="max_width_chars">35</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<attributes>
<attribute name="scale" value="0.82999999999999996"/>
</attributes>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="password-dialog-verify-hint">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="wrap">True</property>
<property name="wrap_mode">word-char</property>
<property name="width_chars">35</property>
<property name="max_width_chars">35</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<attributes>
<attribute name="scale" value="0.82999999999999996"/>
</attributes>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="password-dialog-verify-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_start">25</property>
<property name="label" translatable="yes">_Verify New Password</property>
<property name="use_underline">True</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="password-dialog-password-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_start">25</property>
<property name="label" translatable="yes">_New Password</property>
<property name="use_underline">True</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="password-dialog-entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="visibility">False</property>
<property name="activates_default">True</property>
<property name="input_purpose">password</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLevelBar" id="password-dialog-strength-indicator">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="max_value">5</property>
<property name="mode">discrete</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_start">25</property>
<property name="margin_bottom">12</property>
<property name="label" translatable="yes">Current _Password</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">password-dialog-old-entry</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="password-dialog-old-entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_bottom">12</property>
<property name="hexpand">True</property>
<property name="visibility">False</property>
<property name="activates_default">True</property>
<property name="input_purpose">password</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</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>
</packing>
</child>
</object>
</child>
</object>
</interface>
......@@ -28,7 +28,9 @@ impl App {
let avatar_btn = self.ui.builder
.get_object::<gtk::Button>("account_settings_avatar_button")
.expect("Can't find account_settings_avatar_button in ui file.");
let password_btn = self.ui.builder
.get_object::<gtk::Button>("account_settings_password")
.expect("Can't find account_settings_password in ui file.");
dialog.connect_delete_event(clone!(op => move |_, _| {
op.lock().unwrap().close_account_settings_dialog();
......@@ -62,6 +64,11 @@ impl App {
}
}));
/* Passsword dialog */
password_btn.connect_clicked(clone!(op, builder => move |_| {
op.lock().unwrap().show_password_dialog();
}));
advanced_toggle.connect_button_press_event(clone!(builder => move |this, _| {
let widget = builder
.get_object::<gtk::Revealer>("account_settings_advanced")
......
......@@ -25,6 +25,12 @@ impl AppOp {
let homeserver = self.ui.builder
.get_object::<gtk::Label>("account_settings_homeserver")
.expect("Can't find account_settings_homeserver in ui file.");
let advanced_box = self.ui.builder
.get_object::<gtk::Box>("account_settings_advanced_box")
.expect("Can't find account_settings_advanced_box in ui file.");
let delete_box = self.ui.builder
.get_object::<gtk::Box>("account_settings_delete_box")
.expect("Can't find account_settings_delete_box in ui file.");
/* remove all old avatar from the popover */
for w in avatar.get_children().iter() {
......@@ -41,6 +47,16 @@ impl AppOp {
avatar.add(&w);
avatar.show();
dialog.set_redraw_on_allocate(true);
advanced_box.set_redraw_on_allocate(true);
delete_box.set_redraw_on_allocate(true);
dialog.present();
}
pub fn show_password_dialog(&self) {
let dialog = self.ui.builder
.get_object::<gtk::Dialog>("password_dialog")
.expect("Can't find password_dialog in ui file.");
dialog.present();
}
......
......@@ -52,6 +52,8 @@ impl UI {
.expect("Can't load ui file: new_room.ui");
builder.add_from_resource("/org/gnome/Fractal/ui/room_config.ui")
.expect("Can't load ui file: room_config.ui");
builder.add_from_resource("/org/gnome/Fractal/ui/password_dialog.ui")
.expect("Can't load ui file: password_dialog.ui");
builder.add_from_resource("/org/gnome/Fractal/ui/account_settings.ui")
.expect("Can't load ui file: account_settings.ui");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment