secure-shell-page: Port to AdwDialog

This commit is contained in:
Automeris naranja 2024-04-08 23:26:58 -03:00 committed by Felipe Borges
parent 535404bba2
commit 788c3bacfb
4 changed files with 14 additions and 33 deletions

View file

@ -46,7 +46,7 @@ struct _CcSystemPanel
AdwActionRow *remote_desktop_row;
AdwActionRow *users_row;
GtkWidget *remote_login_dialog;
CcSecureShellPage *secure_shell_dialog;
AdwNavigationPage *software_updates_group;
};
@ -122,16 +122,14 @@ cc_system_page_open_software_update (CcSystemPanel *self)
static void
on_secure_shell_row_clicked (CcSystemPanel *self)
{
if (self->remote_login_dialog == NULL) {
GtkWidget *parent = cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (self)));
if (self->secure_shell_dialog == NULL)
{
self->secure_shell_dialog = g_object_new (CC_TYPE_SECURE_SHELL_PAGE, NULL);
g_object_add_weak_pointer (G_OBJECT (self->secure_shell_dialog),
(gpointer *) &self->secure_shell_dialog);
}
self->remote_login_dialog = g_object_new (CC_TYPE_SECURE_SHELL_PAGE, NULL);
gtk_window_set_transient_for (GTK_WINDOW (self->remote_login_dialog),
GTK_WINDOW (parent));
}
gtk_window_present (GTK_WINDOW (self->remote_login_dialog));
adw_dialog_present (ADW_DIALOG (self->secure_shell_dialog), GTK_WIDGET (self));
}
static void

View file

@ -33,7 +33,7 @@
#endif
struct _CcSecureShellPage {
AdwWindow parent_instance;
AdwDialog parent_instance;
AdwActionRow *hostname_row;
AdwSwitchRow *secure_shell_row;
@ -42,7 +42,7 @@ struct _CcSecureShellPage {
GCancellable *cancellable;
};
G_DEFINE_TYPE (CcSecureShellPage, cc_secure_shell_page, ADW_TYPE_WINDOW)
G_DEFINE_TYPE (CcSecureShellPage, cc_secure_shell_page, ADW_TYPE_DIALOG)
static void
on_copy_ssh_command_button_clicked (CcSecureShellPage *self)

View file

@ -25,6 +25,6 @@ G_BEGIN_DECLS
#define CC_TYPE_SECURE_SHELL_PAGE (cc_secure_shell_page_get_type ())
G_DECLARE_FINAL_TYPE (CcSecureShellPage, cc_secure_shell_page, CC, CC_TYPE_SECURE_SHELL_PAGE, AdwWindow)
G_DECLARE_FINAL_TYPE (CcSecureShellPage, cc_secure_shell_page, CC, CC_TYPE_SECURE_SHELL_PAGE, AdwDialog)
G_END_DECLS

View file

@ -1,26 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="CcSecureShellPage" parent="AdwWindow">
<template class="CcSecureShellPage" parent="AdwDialog">
<property name="title" translatable="yes">Secure Shell</property>
<property name="hide-on-close">True</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="destroy-with-parent">True</property>
<property name="width-request">360</property>
<property name="height-request">294</property>
<child>
<object class="GtkShortcutController">
<property name="scope">managed</property>
<child>
<object class="GtkShortcut">
<property name="trigger">Escape</property>
<property name="action">action(window.close)</property>
</object>
</child>
</object>
</child>
<property name="content">
<property name="content-width">360</property>
<property name="child">
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar"/>