[gnome-control-center] Migrate CcPasswordDialog from AdwPreferencesWindow to AdwWindow



commit 3194a1890f00eea260a77485a2db503f406f1d6b
Author: Nils Lück <nils luck outlook com>
Date:   Fri Aug 12 01:24:10 2022 +0000

    Migrate CcPasswordDialog from AdwPreferencesWindow to AdwWindow

 panels/user-accounts/cc-password-dialog.c  | 6 ++++--
 panels/user-accounts/cc-password-dialog.h  | 2 +-
 panels/user-accounts/cc-password-dialog.ui | 8 +++++---
 3 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/panels/user-accounts/cc-password-dialog.c b/panels/user-accounts/cc-password-dialog.c
index a65b4549e..1f7182535 100644
--- a/panels/user-accounts/cc-password-dialog.c
+++ b/panels/user-accounts/cc-password-dialog.c
@@ -41,7 +41,7 @@
 
 struct _CcPasswordDialog
 {
-        AdwPreferencesWindow parent_instance;
+        AdwWindow parent_instance;
 
         GtkCheckButton    *action_login_radio;
         GtkCheckButton    *action_now_radio;
@@ -67,7 +67,7 @@ struct _CcPasswordDialog
         PasswdHandler      *passwd_handler;
 };
 
-G_DEFINE_TYPE (CcPasswordDialog, cc_password_dialog, ADW_TYPE_PREFERENCES_WINDOW)
+G_DEFINE_TYPE (CcPasswordDialog, cc_password_dialog, ADW_TYPE_WINDOW)
 
 static gint
 update_password_strength (CcPasswordDialog *self)
@@ -449,6 +449,8 @@ cc_password_dialog_class_init (CcPasswordDialogClass *klass)
 
         object_class->dispose = cc_password_dialog_dispose;
 
+        gtk_widget_class_add_binding_action (widget_class, GDK_KEY_Escape, 0, "window.close", NULL);
+
         gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/control-center/user-accounts/cc-password-dialog.ui");
 
         gtk_widget_class_bind_template_child (widget_class, CcPasswordDialog, action_login_radio);
diff --git a/panels/user-accounts/cc-password-dialog.h b/panels/user-accounts/cc-password-dialog.h
index 39c40ecc5..3820d6dd2 100644
--- a/panels/user-accounts/cc-password-dialog.h
+++ b/panels/user-accounts/cc-password-dialog.h
@@ -27,7 +27,7 @@
 G_BEGIN_DECLS
 
 #define CC_TYPE_PASSWORD_DIALOG (cc_password_dialog_get_type ())
-G_DECLARE_FINAL_TYPE (CcPasswordDialog, cc_password_dialog, CC, PASSWORD_DIALOG, AdwPreferencesWindow)
+G_DECLARE_FINAL_TYPE (CcPasswordDialog, cc_password_dialog, CC, PASSWORD_DIALOG, AdwWindow)
 
 CcPasswordDialog *cc_password_dialog_new (ActUser *user);
 
diff --git a/panels/user-accounts/cc-password-dialog.ui b/panels/user-accounts/cc-password-dialog.ui
index c0b7a0ecb..84e145527 100644
--- a/panels/user-accounts/cc-password-dialog.ui
+++ b/panels/user-accounts/cc-password-dialog.ui
@@ -1,12 +1,14 @@
 <?xml version="1.0"?>
 <interface>
-  <template class="CcPasswordDialog" parent="AdwPreferencesWindow">
+  <template class="CcPasswordDialog" parent="AdwWindow">
     <property name="title" translatable="yes">Change Password</property>
     <property name="modal">True</property>
     <property name="hide-on-close">True</property>
+    <property name="destroy_with_parent">True</property>
     <property name="icon_name">system-users</property>
+    <property name="default-width">640</property>
     <property name="default-height">420</property>
-    <child>
+    <property name="content">
       <object class="GtkBox">
         <property name="orientation">vertical</property>
         <child>
@@ -177,6 +179,6 @@
           </object>
         </child>
       </object>
-    </child>
+    </property>
   </template>
 </interface>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]