Add spinner

This commit is contained in:
Stanislav Malishevskiy 2024-04-09 17:12:53 +03:00
parent c5065c398c
commit c1208379e6
2 changed files with 28 additions and 5 deletions

View file

@ -4,7 +4,7 @@
<template class="DinoUiChangePasswordDialog">
<property name="title" translatable="1">Change password</property>
<property name="default-width">350</property>
<property name="default-height">300</property>
<property name="default-height">280</property>
<property name="modal">True</property>
<child type="titlebar">
<object class="GtkHeaderBar">
@ -16,11 +16,34 @@
</child>
<child type="end">
<object class="GtkButton" id="change_password_button">
<property name="label" translatable="yes">Change</property>
<property name="sensitive">0</property>
<style>
<class name="suggested-action"/>
</style>
<child>
<object class="GtkStack" id="change_password_stack">
<child>
<object class="GtkStackPage">
<property name="name">label</property>
<property name="child">
<object class="GtkLabel" >
<property name="label" translatable="1">Change</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">spinner</property>
<property name="child">
<object class="GtkSpinner">
<property name="spinning">True</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>

View file

@ -11,7 +11,7 @@ namespace Dino.Ui{
public class ChangePasswordDialog : Gtk.Dialog {
[GtkChild] private unowned Button change_password_button;
/*[GtkChild] private unowned Stack change_password_stack; */
[GtkChild] private unowned Stack change_password_stack;
[GtkChild] private unowned Button cancel_button;
[GtkChild] private unowned Adw.PasswordEntryRow current_password_entry;
[GtkChild] private unowned Adw.PasswordEntryRow new_password_entry;
@ -74,10 +74,10 @@ namespace Dino.Ui{
if (pw_input != null && account.password == pw_input){
change_password_button.sensitive = false;
// change_password_stack.visible_child_name = "spinner";
change_password_stack.visible_child_name = "spinner";
string ret = yield stream_interactor.get_module(Register.IDENTITY).change_password(account, new_pw_input);
change_password_button.sensitive = true;
// change_password_stack.visible_child_name = "label";
change_password_stack.visible_child_name = "label";
if (ret == null) {
account.password = new_pw_input;
close();