[gnome-initial-setup/wip/port-to-gtk4: 14/23] account: Port to GTK4
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup/wip/port-to-gtk4: 14/23] account: Port to GTK4
- Date: Mon, 25 Jul 2022 15:52:56 +0000 (UTC)
commit 66319484c93ac82babd77f35ae1b42352b07e0ec
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Jul 7 12:49:15 2022 -0300
account: Port to GTK4
Boy what a pain this one was.
A lot needed to be updated, but most of the complexity of this
page was in the GtkGrid updates, which requires switching the
UI files from <packing> to <layout>.
Use GtkEventControllerFocus to track focus out events.
Switch a password entries to GtkPasswordEntry, and port a ton of
GtkEntry calls to new GtkEditable API.
gnome-initial-setup/gnome-initial-setup.c | 4 +-
gnome-initial-setup/meson.build | 6 +-
.../pages/account/account.gresource.xml | 1 -
.../pages/account/gis-account-avatar-chooser.ui | 24 +-
.../pages/account/gis-account-page-enterprise.c | 54 ++--
.../pages/account/gis-account-page-enterprise.h | 6 +-
.../pages/account/gis-account-page-enterprise.ui | 321 +++++----------------
.../pages/account/gis-account-page-local.c | 75 ++---
.../pages/account/gis-account-page-local.h | 6 +-
.../pages/account/gis-account-page-local.ui | 103 +++----
.../pages/account/gis-account-page-style.css | 6 -
.../pages/account/gis-account-page.ui | 80 +++--
.../pages/account/um-photo-dialog.c | 43 +--
.../pages/account/um-photo-dialog.h | 3 +-
gnome-initial-setup/pages/account/um-utils.c | 110 +------
gnome-initial-setup/pages/account/um-utils.h | 13 -
gnome-initial-setup/pages/meson.build | 2 +-
17 files changed, 250 insertions(+), 607 deletions(-)
---
diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c
index 5a2c21a5..816e3163 100644
--- a/gnome-initial-setup/gnome-initial-setup.c
+++ b/gnome-initial-setup/gnome-initial-setup.c
@@ -37,7 +37,7 @@
#include "pages/privacy/gis-privacy-page.h"
#include "pages/software/gis-software-page.h"
#include "pages/goa/gis-goa-page.h"
-//#include "pages/account/gis-account-pages.h"
+#include "pages/account/gis-account-pages.h"
//#include "pages/parental-controls/gis-parental-controls-page.h"
//#include "pages/password/gis-password-page.h"
#include "pages/summary/gis-summary-page.h"
@@ -70,7 +70,7 @@ static PageData page_table[] = {
PAGE (timezone, TRUE),
PAGE (software, TRUE),
PAGE (goa, FALSE),
- //PAGE (account, TRUE),
+ PAGE (account, TRUE),
//PAGE (password, TRUE),
#ifdef HAVE_PARENTAL_CONTROLS
//PAGE (parental_controls, TRUE),
diff --git a/gnome-initial-setup/meson.build b/gnome-initial-setup/meson.build
index 9e5dbbf9..a7a0d2a5 100644
--- a/gnome-initial-setup/meson.build
+++ b/gnome-initial-setup/meson.build
@@ -63,11 +63,11 @@ dependencies = [
dependency ('libgeoclue-2.0', version: '>= 2.3.1'),
cc.find_library('m', required: false),
dependency ('pango', version: '>= 1.32.5'),
- #dependency ('json-glib-1.0'),
- #dependency ('krb5'),
+ dependency ('json-glib-1.0'),
+ dependency ('krb5'),
dependency ('libsecret-1', version: '>= 0.18.8'),
#dependency ('pwquality'),
- #dependency ('rest-1.0'),
+ dependency ('rest-1.0'),
dependency ('webkit2gtk-5.0'),
ibus_dep,
#libmalcontent_dep,
diff --git a/gnome-initial-setup/pages/account/account.gresource.xml
b/gnome-initial-setup/pages/account/account.gresource.xml
index 9822e02d..d698ba9b 100644
--- a/gnome-initial-setup/pages/account/account.gresource.xml
+++ b/gnome-initial-setup/pages/account/account.gresource.xml
@@ -5,6 +5,5 @@
<file preprocess="xml-stripblanks" alias="gis-account-page.ui">gis-account-page.ui</file>
<file preprocess="xml-stripblanks" alias="gis-account-page-local.ui">gis-account-page-local.ui</file>
<file preprocess="xml-stripblanks"
alias="gis-account-page-enterprise.ui">gis-account-page-enterprise.ui</file>
- <file alias="gis-account-page-style.css">gis-account-page-style.css</file>
</gresource>
</gresources>
diff --git a/gnome-initial-setup/pages/account/gis-account-avatar-chooser.ui
b/gnome-initial-setup/pages/account/gis-account-avatar-chooser.ui
index c6679b86..dff58a1d 100644
--- a/gnome-initial-setup/pages/account/gis-account-avatar-chooser.ui
+++ b/gnome-initial-setup/pages/account/gis-account-avatar-chooser.ui
@@ -1,35 +1,38 @@
<?xml version="1.0"?>
<interface>
- <!-- interface-requires gtk+ 3.8 -->
<template class="UmPhotoDialog" parent="GtkPopover">
<property name="height-request">360</property>
<property name="width-request">480</property>
<child>
<object class="GtkBox">
- <property name="visible">True</property>
<property name="orientation">GTK_ORIENTATION_VERTICAL</property>
<child>
<object class="GtkFlowBox" id="recent_pictures">
- <property name="visible">True</property>
<property name="halign">start</property>
- <property name="margin">20</property>
+ <property name="margin-top">20</property>
+ <property name="margin-start">20</property>
+ <property name="margin-end">20</property>
<property name="margin-bottom">0</property>
<property name="selection-mode">none</property>
</object>
</child>
<child>
<object class="GtkFlowBox" id="flowbox">
- <property name="visible">True</property>
- <property name="border-width">20</property>
+ <property name="margin-top">12</property>
+ <property name="margin-bottom">12</property>
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
<property name="selection-mode">none</property>
</object>
</child>
<child>
<object class="GtkBox">
- <property name="visible">True</property>
<property name="halign">GTK_ALIGN_CENTER</property>
- <property name="border-width">10</property>
- <property name="spacing">10</property>
+ <property name="margin-top">12</property>
+ <property name="margin-bottom">12</property>
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="spacing">12</property>
<child>
<object class="GtkButton" id="take_picture_button">
<property name="visible">False</property>
@@ -41,9 +44,6 @@
</object>
</child>
</object>
- <packing>
- <property name="pack-type">GTK_PACK_END</property>
- </packing>
</child>
</object>
</child>
diff --git a/gnome-initial-setup/pages/account/gis-account-page-enterprise.c
b/gnome-initial-setup/pages/account/gis-account-page-enterprise.c
index 52df9a3a..e21fd5d4 100644
--- a/gnome-initial-setup/pages/account/gis-account-page-enterprise.c
+++ b/gnome-initial-setup/pages/account/gis-account-page-enterprise.c
@@ -77,7 +77,7 @@ struct _GisAccountPageEnterprisePrivate
};
typedef struct _GisAccountPageEnterprisePrivate GisAccountPageEnterprisePrivate;
-G_DEFINE_TYPE_WITH_PRIVATE (GisAccountPageEnterprise, gis_account_page_enterprise, GTK_TYPE_BIN);
+G_DEFINE_TYPE_WITH_PRIVATE (GisAccountPageEnterprise, gis_account_page_enterprise, ADW_TYPE_BIN);
enum {
VALIDATION_CHANGED,
@@ -111,7 +111,7 @@ show_error_dialog (GisAccountPageEnterprise *page,
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
return;
- dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (page))),
+ dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (page))),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
@@ -123,7 +123,6 @@ show_error_dialog (GisAccountPageEnterprise *page,
"%s", error->message);
}
- g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
gtk_window_present (GTK_WINDOW (dialog));
}
@@ -136,14 +135,14 @@ gis_account_page_enterprise_validate (GisAccountPageEnterprise *page)
GtkTreeIter iter;
GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
- name = gtk_entry_get_text (GTK_ENTRY (priv->login));
+ name = gtk_editable_get_text (GTK_EDITABLE (priv->login));
valid_name = is_valid_name (name);
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->domain), &iter)) {
gtk_tree_model_get (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->domain)),
&iter, 0, &name, -1);
} else {
- name = gtk_entry_get_text (GTK_ENTRY (priv->domain_entry));
+ name = gtk_editable_get_text (GTK_EDITABLE (priv->domain_entry));
}
valid_domain = is_valid_name (name);
@@ -170,14 +169,14 @@ on_permit_user_login (GObject *source,
* should also lookup information about this via the realm and make
* sure all that is functional.
*/
- login = um_realm_calculate_login (common, gtk_entry_get_text (GTK_ENTRY (priv->login)));
+ login = um_realm_calculate_login (common, gtk_editable_get_text (GTK_EDITABLE (priv->login)));
g_return_if_fail (login != NULL);
g_debug ("Caching remote user: %s", login);
priv->act_user = act_user_manager_cache_user (priv->act_client, login, NULL);
act_user_set_account_type (priv->act_user, ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR);
- g_signal_emit (page, signals[USER_CACHED], 0, priv->act_user, gtk_entry_get_text (GTK_ENTRY
(priv->password)));
+ g_signal_emit (page, signals[USER_CACHED], 0, priv->act_user, gtk_editable_get_text (GTK_EDITABLE
(priv->password)));
apply_complete (page, TRUE);
g_free (login);
@@ -201,7 +200,7 @@ enterprise_permit_user_login (GisAccountPageEnterprise *page, UmRealmObject *rea
common = um_realm_object_get_common (realm);
- login = um_realm_calculate_login (common, gtk_entry_get_text (GTK_ENTRY (priv->login)));
+ login = um_realm_calculate_login (common, gtk_editable_get_text (GTK_EDITABLE (priv->login)));
g_return_if_fail (login != NULL);
add[0] = login;
@@ -242,8 +241,8 @@ on_set_static_hostname (GObject *source,
/* Prompted for some admin credentials, try to use them to log in */
um_realm_login (priv->realm,
- gtk_entry_get_text (GTK_ENTRY (priv->join_name)),
- gtk_entry_get_text (GTK_ENTRY (priv->join_password)),
+ gtk_editable_get_text (GTK_EDITABLE (priv->join_name)),
+ gtk_editable_get_text (GTK_EDITABLE (priv->join_password)),
priv->cancellable, on_join_login, page);
}
@@ -265,7 +264,7 @@ on_join_response (GtkDialog *dialog,
return;
}
- name = gtk_entry_get_text (GTK_ENTRY (priv->join_computer));
+ name = gtk_editable_get_text (GTK_EDITABLE (priv->join_computer));
if (gethostname (hostname, sizeof (hostname)) == 0 &&
!g_str_equal (name, hostname)) {
g_debug ("Setting StaticHostname to '%s'", name);
@@ -287,12 +286,12 @@ on_join_response (GtkDialog *dialog,
G_MAXINT, NULL, on_set_static_hostname, page);
} else {
- name = gtk_entry_get_text (GTK_ENTRY (priv->join_name));
+ name = gtk_editable_get_text (GTK_EDITABLE (priv->join_name));
g_debug ("Logging in as admin user: %s", name);
/* Prompted for some admin credentials, try to use them to log in */
um_realm_login (priv->realm, name,
- gtk_entry_get_text (GTK_ENTRY (priv->join_password)),
+ gtk_editable_get_text (GTK_EDITABLE (priv->join_password)),
NULL, on_join_login, page);
}
}
@@ -307,7 +306,7 @@ join_show_prompt (GisAccountPageEnterprise *page,
gchar hostname[128];
const gchar *name;
- gtk_entry_set_text (GTK_ENTRY (priv->join_password), "");
+ gtk_editable_set_text (GTK_EDITABLE (priv->join_password), "");
gtk_widget_grab_focus (GTK_WIDGET (priv->join_password));
kerberos = um_realm_object_get_kerberos (priv->realm);
@@ -317,7 +316,7 @@ join_show_prompt (GisAccountPageEnterprise *page,
um_realm_kerberos_get_domain_name (kerberos));
if (gethostname (hostname, sizeof (hostname)) == 0)
- gtk_entry_set_text (GTK_ENTRY (priv->join_computer), hostname);
+ gtk_editable_set_text (GTK_EDITABLE (priv->join_computer), hostname);
clear_entry_validation_error (GTK_ENTRY (priv->join_name));
clear_entry_validation_error (GTK_ENTRY (priv->join_password));
@@ -326,7 +325,7 @@ join_show_prompt (GisAccountPageEnterprise *page,
name = um_realm_kerberos_membership_get_suggested_administrator (membership);
if (name && !g_str_equal (name, "")) {
g_debug ("Suggesting admin user: %s", name);
- gtk_entry_set_text (GTK_ENTRY (priv->join_name), name);
+ gtk_editable_set_text (GTK_EDITABLE (priv->join_name), name);
} else {
gtk_widget_grab_focus (GTK_WIDGET (priv->join_name));
}
@@ -347,7 +346,7 @@ join_show_prompt (GisAccountPageEnterprise *page,
g_debug ("Showing admin password dialog");
gtk_window_set_transient_for (GTK_WINDOW (priv->join_dialog),
- GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (page))));
+ GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (page))));
gtk_window_set_modal (GTK_WINDOW (priv->join_dialog), TRUE);
gtk_window_present (GTK_WINDOW (priv->join_dialog));
@@ -373,8 +372,8 @@ on_join_login (GObject *source,
/* Logged in as admin successfully, use creds to join domain */
if (error == NULL) {
if (!um_realm_join_as_admin (priv->realm,
- gtk_entry_get_text (GTK_ENTRY (priv->join_name)),
- gtk_entry_get_text (GTK_ENTRY (priv->join_password)),
+ gtk_editable_get_text (GTK_EDITABLE (priv->join_name)),
+ gtk_editable_get_text (GTK_EDITABLE (priv->join_password)),
creds, NULL, on_realm_joined, page)) {
show_error_dialog (page, _("No supported way to authenticate with this domain"), NULL);
g_message ("Authenticating as admin is not supported by the realm");
@@ -455,8 +454,8 @@ on_realm_login (GObject *source,
/* Join the domain, try using the user's creds */
} else if (creds == NULL ||
!um_realm_join_as_user (priv->realm,
- gtk_entry_get_text (GTK_ENTRY (priv->login)),
- gtk_entry_get_text (GTK_ENTRY (priv->password)),
+ gtk_editable_get_text (GTK_EDITABLE (priv->login)),
+ gtk_editable_get_text (GTK_EDITABLE (priv->password)),
creds, priv->cancellable,
on_realm_joined,
page)) {
@@ -500,8 +499,8 @@ enterprise_check_login (GisAccountPageEnterprise *page)
g_assert (priv->realm);
um_realm_login (priv->realm,
- gtk_entry_get_text (GTK_ENTRY (priv->login)),
- gtk_entry_get_text (GTK_ENTRY (priv->password)),
+ gtk_editable_get_text (GTK_EDITABLE (priv->login)),
+ gtk_editable_get_text (GTK_EDITABLE (priv->password)),
priv->cancellable,
on_realm_login,
page);
@@ -556,7 +555,7 @@ enterprise_add_user (GisAccountPageEnterprise *page)
/* Something the user typed, we need to discover realm */
} else {
um_realm_manager_discover (priv->realm_manager,
- gtk_entry_get_text (GTK_ENTRY (priv->domain_entry)),
+ gtk_editable_get_text (GTK_EDITABLE (priv->domain_entry)),
priv->cancellable,
on_realm_discover_input,
page);
@@ -736,7 +735,7 @@ on_domain_changed (GtkComboBox *widget,
priv->domain_chosen = TRUE;
validation_changed (page);
- clear_entry_validation_error (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (widget))));
+ clear_entry_validation_error (GTK_ENTRY (adw_bin_get_child (ADW_BIN (widget))));
}
static void
@@ -822,7 +821,6 @@ gis_account_page_enterprise_class_init (GisAccountPageEnterpriseClass *klass)
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise, login);
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise,
password);
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise, domain);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise,
domain_entry);
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise,
realms_model);
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise, header);
@@ -843,8 +841,12 @@ gis_account_page_enterprise_class_init (GisAccountPageEnterpriseClass *klass)
static void
gis_account_page_enterprise_init (GisAccountPageEnterprise *page)
{
+ GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
+
g_type_ensure (GIS_TYPE_PAGE_HEADER);
gtk_widget_init_template (GTK_WIDGET (page));
+
+ priv->domain_entry = gtk_combo_box_get_child (GTK_COMBO_BOX (priv->domain));
}
void
diff --git a/gnome-initial-setup/pages/account/gis-account-page-enterprise.h
b/gnome-initial-setup/pages/account/gis-account-page-enterprise.h
index 55f0bb2b..2ba334ee 100644
--- a/gnome-initial-setup/pages/account/gis-account-page-enterprise.h
+++ b/gnome-initial-setup/pages/account/gis-account-page-enterprise.h
@@ -22,7 +22,7 @@
#ifndef __GIS_ACCOUNT_PAGE_ENTERPRISE_H__
#define __GIS_ACCOUNT_PAGE_ENTERPRISE_H__
-#include <gtk/gtk.h>
+#include <adwaita.h>
/* For GisPageApplyCallback */
#include "gis-page.h"
@@ -41,12 +41,12 @@ typedef struct _GisAccountPageEnterpriseClass GisAccountPageEnterpriseClass;
struct _GisAccountPageEnterprise
{
- GtkBin parent;
+ AdwBin parent;
};
struct _GisAccountPageEnterpriseClass
{
- GtkBinClass parent_class;
+ AdwBinClass parent_class;
};
GType gis_account_page_enterprise_get_type (void);
diff --git a/gnome-initial-setup/pages/account/gis-account-page-enterprise.ui
b/gnome-initial-setup/pages/account/gis-account-page-enterprise.ui
index 5432e551..aca904a4 100644
--- a/gnome-initial-setup/pages/account/gis-account-page-enterprise.ui
+++ b/gnome-initial-setup/pages/account/gis-account-page-enterprise.ui
@@ -1,17 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <!-- interface-requires gtk+ 3.0 -->
- <template class="GisAccountPageEnterprise" parent="GtkBin">
+ <template class="GisAccountPageEnterprise" parent="AdwBin">
<child>
<object class="GtkBox" id="area">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="orientation">vertical</property>
- <property name="halign">center</property>
<property name="valign">fill</property>
<child>
<object class="GisPageHeader" id="header">
- <property name="visible">True</property>
<property name="margin_bottom">26</property>
<property name="margin_top">24</property>
<property name="title" translatable="yes">Enterprise Login</property>
@@ -22,150 +17,102 @@
</child>
<child>
<object class="GtkGrid" id="form">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="row_spacing">12</property>
<property name="column_spacing">12</property>
<property name="margin_bottom">32</property>
<child>
<object class="GtkLabel" id="label4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="halign">end</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Domain</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">domain</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">1</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="label8">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="halign">end</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Username</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">login</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">3</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="label9">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="halign">end</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Password</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">password</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">4</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">4</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
<object class="GtkEntry" id="login">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="hexpand">True</property>
- <property name="invisible_char">●</property>
- <property name="invisible_char_set">True</property>
<property name="max-length">255</property>
<property name="width-chars">25</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">3</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">3</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
- <object class="GtkEntry" id="password">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
+ <object class="GtkPasswordEntry" id="password">
<property name="hexpand">True</property>
- <property name="visibility">False</property>
- <property name="invisible_char">●</property>
- <property name="activates_default">True</property>
- <property name="invisible_char_set">True</property>
- <property name="max-length">255</property>
<property name="width-chars">25</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">4</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">4</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
<object class="GtkComboBox" id="domain">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="model">realms_model</property>
<property name="has_entry">True</property>
<property name="entry_text_column">0</property>
- <child internal-child="entry">
- <object class="GtkEntry" id="domain_entry">
- <property name="can_focus">True</property>
- <property name="max-length">255</property>
- <property name="width-chars">25</property>
- </object>
- </child>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">1</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="label10">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="margin_bottom">12</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Enterprise domain or realm name</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">2</property>
+ </layout>
<attributes>
<attribute name="scale" value="0.8"/>
</attributes>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="filler">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <layout>
+ <property name="column">2</property>
+ <property name="row">4</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">2</property>
- <property name="top_attach">4</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
</object>
</child>
@@ -173,267 +120,157 @@
</child>
</template>
<object class="GtkDialog" id="join_dialog">
- <property name="can_focus">False</property>
- <property name="border_width">10</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="destroy_with_parent">True</property>
- <property name="type_hint">dialog</property>
<property name="title"></property>
- <child internal-child="vbox">
+ <child>
<object class="GtkBox" id="dialog-vbox1">
- <property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area1">
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="button1">
- <property name="label">gtk-cancel</property>
- <property name="use_action_appearance">False</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="use_action_appearance">False</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button2">
- <property name="label" translatable="yes">C_ontinue</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
<child>
<object class="GtkBox" id="box2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
<object class="GtkLabel" id="label71">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="label" translatable="yes">Domain Administrator Login</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="1.2"/>
</attributes>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="label12">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0</property>
<property name="wrap">True</property>
<property name="max-width-chars">60</property>
<property name="label" translatable="yes">In order to use enterprise logins, this computer
needs to be enrolled in a domain. Please have your network administrator type the domain password here, and
choose a unique computer name for your computer.</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
<child>
<object class="GtkGrid" id="grid1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_left">12</property>
+ <property name="margin-start">12</property>
<property name="hexpand">True</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="label13">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Domain</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">join_domain</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">0</property>
+ </layout>
<style>
<class name="dim-label"/>
</style>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="join_domain">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="xalign">0</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">0</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="label18">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Computer</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">join_computer</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">1</property>
+ </layout>
<style>
<class name="dim-label"/>
</style>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
<object class="GtkEntry" id="join_computer">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="hexpand">True</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">1</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="label14">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Administrator _Name</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">join_name</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">2</property>
+ </layout>
<style>
<class name="dim-label"/>
</style>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
<object class="GtkEntry" id="join_name">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="hexpand">True</property>
- <property name="invisible_char">●</property>
- <property name="invisible_char_set">True</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">2</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="label15">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Administrator Password</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">join_password</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">3</property>
+ </layout>
<style>
<class name="dim-label"/>
</style>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
- <object class="GtkEntry" id="join_password">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
+ <object class="GtkPasswordEntry" id="join_password">
<property name="hexpand">True</property>
- <property name="visibility">False</property>
- <property name="invisible_char">●</property>
- <property name="activates_default">True</property>
- <property name="invisible_char_set">True</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">3</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">3</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
</child>
+ <child type="action">
+ <object class="GtkButton" id="button_cancel"/>
+ </child>
+ <child type="action">
+ <object class="GtkButton" id="button_ok">
+ <property name="label" translatable="yes">C_ontinue</property>
+ </object>
+ </child>
<action-widgets>
- <action-widget response="-6">button1</action-widget>
- <action-widget response="-5">button2</action-widget>
+ <action-widget response="-5">button_cancel</action-widget>
+ <action-widget response="-6" default="true">button_ok</action-widget>
</action-widgets>
</object>
<object class="GtkListStore" id="realms_model">
diff --git a/gnome-initial-setup/pages/account/gis-account-page-local.c
b/gnome-initial-setup/pages/account/gis-account-page-local.c
index bca57ee9..1b2f498c 100644
--- a/gnome-initial-setup/pages/account/gis-account-page-local.c
+++ b/gnome-initial-setup/pages/account/gis-account-page-local.c
@@ -71,7 +71,7 @@ struct _GisAccountPageLocalPrivate
};
typedef struct _GisAccountPageLocalPrivate GisAccountPageLocalPrivate;
-G_DEFINE_TYPE_WITH_PRIVATE (GisAccountPageLocal, gis_account_page_local, GTK_TYPE_BIN);
+G_DEFINE_TYPE_WITH_PRIVATE (GisAccountPageLocal, gis_account_page_local, ADW_TYPE_BIN);
enum {
VALIDATION_CHANGED,
@@ -205,7 +205,7 @@ prepopulate_account_page (GisAccountPageLocal *page)
if (name) {
g_object_set (priv->header, "subtitle", _("Please check the name and username. You can choose a picture
too."), NULL);
- gtk_entry_set_text (GTK_ENTRY (priv->fullname_entry), name);
+ gtk_editable_set_text (GTK_EDITABLE (priv->fullname_entry), name);
}
if (picture) {
@@ -258,12 +258,12 @@ validate (GisAccountPageLocal *page)
g_clear_handle_id (&priv->timeout_id, g_source_remove);
- entry = gtk_bin_get_child (GTK_BIN (priv->username_combo));
+ entry = gtk_combo_box_get_child (GTK_COMBO_BOX (priv->username_combo));
- name = gtk_entry_get_text (GTK_ENTRY (priv->fullname_entry));
+ name = gtk_editable_get_text (GTK_EDITABLE (priv->fullname_entry));
username = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (priv->username_combo));
#ifdef HAVE_PARENTAL_CONTROLS
- parental_controls_enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(priv->enable_parental_controls_check_button));
+ parental_controls_enabled = gtk_check_button_get_active (GTK_CHECK_BUTTON
(priv->enable_parental_controls_check_button));
#else
parental_controls_enabled = FALSE;
#endif
@@ -304,15 +304,15 @@ fullname_changed (GtkWidget *w,
GtkTreeModel *model;
const char *name;
- name = gtk_entry_get_text (GTK_ENTRY (w));
+ name = gtk_editable_get_text (GTK_EDITABLE (w));
- entry = gtk_bin_get_child (GTK_BIN (priv->username_combo));
+ entry = gtk_combo_box_get_child (GTK_COMBO_BOX (priv->username_combo));
model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->username_combo));
gtk_list_store_clear (GTK_LIST_STORE (model));
if ((name == NULL || strlen (name) == 0) && !priv->has_custom_username) {
- gtk_entry_set_text (GTK_ENTRY (entry), "");
+ gtk_editable_set_text (GTK_EDITABLE (entry), "");
}
else if (name != NULL && strlen (name) != 0) {
generate_username_choices (name, GTK_LIST_STORE (model));
@@ -335,8 +335,8 @@ username_changed (GtkComboBoxText *combo,
GtkWidget *entry;
const gchar *username;
- entry = gtk_bin_get_child (GTK_BIN (combo));
- username = gtk_entry_get_text (GTK_ENTRY (entry));
+ entry = gtk_combo_box_get_child (GTK_COMBO_BOX (combo));
+ username = gtk_editable_get_text (GTK_EDITABLE (entry));
if (*username == '\0')
priv->has_custom_username = FALSE;
else if (gtk_widget_has_focus (entry) ||
@@ -384,7 +384,7 @@ avatar_callback (GdkPixbuf *pixbuf,
else {
/* Fallback. */
gtk_image_set_pixel_size (GTK_IMAGE (priv->avatar_image), 96);
- gtk_image_set_from_icon_name (GTK_IMAGE (priv->avatar_image), "avatar-default-symbolic", 1);
+ gtk_image_set_from_icon_name (GTK_IMAGE (priv->avatar_image), "avatar-default-symbolic");
}
}
@@ -396,12 +396,12 @@ confirm (GisAccountPageLocal *page)
}
static void
-enable_parental_controls_check_button_toggled_cb (GtkToggleButton *toggle_button,
- gpointer user_data)
+enable_parental_controls_check_button_toggled_cb (GtkCheckButton *check_button,
+ gpointer user_data)
{
GisAccountPageLocal *page = GIS_ACCOUNT_PAGE_LOCAL (user_data);
GisAccountPageLocalPrivate *priv = gis_account_page_local_get_instance_private (page);
- gboolean parental_controls_enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(priv->enable_parental_controls_check_button));
+ gboolean parental_controls_enabled = gtk_check_button_get_active (GTK_CHECK_BUTTON
(priv->enable_parental_controls_check_button));
/* This sets the account type of the main user. When we save_data(), we create
* two users if parental controls are enabled: the first user is always an
@@ -411,12 +411,24 @@ enable_parental_controls_check_button_toggled_cb (GtkToggleButton *toggle_button
validate (page);
}
+static void
+track_focus_out (GisAccountPageLocal *page,
+ GtkWidget *widget)
+{
+ GtkEventController *focus_controller;
+
+ focus_controller = gtk_event_controller_focus_new ();
+ gtk_widget_add_controller (widget, focus_controller);
+
+ g_signal_connect_swapped (focus_controller, "leave", G_CALLBACK (on_focusout), page);
+}
+
+
static void
gis_account_page_local_constructed (GObject *object)
{
GisAccountPageLocal *page = GIS_ACCOUNT_PAGE_LOCAL (object);
GisAccountPageLocalPrivate *priv = gis_account_page_local_get_instance_private (page);
- GtkCssProvider *provider;
G_OBJECT_CLASS (gis_account_page_local_parent_class)->constructed (object);
@@ -424,15 +436,15 @@ gis_account_page_local_constructed (GObject *object)
g_signal_connect (priv->fullname_entry, "notify::text",
G_CALLBACK (fullname_changed), page);
- g_signal_connect_swapped (priv->fullname_entry, "focus-out-event",
- G_CALLBACK (on_focusout), page);
+ track_focus_out (page, priv->fullname_entry);
+
g_signal_connect_swapped (priv->fullname_entry, "activate",
G_CALLBACK (validate), page);
g_signal_connect (priv->username_combo, "changed",
G_CALLBACK (username_changed), page);
- g_signal_connect_swapped (priv->username_combo, "focus-out-event",
- G_CALLBACK (on_focusout), page);
- g_signal_connect_swapped (gtk_bin_get_child (GTK_BIN (priv->username_combo)),
+ track_focus_out (page, priv->username_combo);
+
+ g_signal_connect_swapped (gtk_combo_box_get_child (GTK_COMBO_BOX (priv->username_combo)),
"activate", G_CALLBACK (confirm), page);
g_signal_connect_swapped (priv->fullname_entry, "activate",
G_CALLBACK (confirm), page);
@@ -451,12 +463,12 @@ gis_account_page_local_constructed (GObject *object)
priv->account_type = ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR;
g_object_set (priv->header, "subtitle", _("We need a few details to complete setup."), NULL);
- gtk_entry_set_text (GTK_ENTRY (priv->fullname_entry), "");
+ gtk_editable_set_text (GTK_EDITABLE (priv->fullname_entry), "");
gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->username_combo))));
priv->has_custom_username = FALSE;
gtk_image_set_pixel_size (GTK_IMAGE (priv->avatar_image), 96);
- gtk_image_set_from_icon_name (GTK_IMAGE (priv->avatar_image), "avatar-default-symbolic", 1);
+ gtk_image_set_from_icon_name (GTK_IMAGE (priv->avatar_image), "avatar-default-symbolic");
priv->goa_client = goa_client_new_sync (NULL, NULL);
if (priv->goa_client) {
@@ -467,19 +479,12 @@ gis_account_page_local_constructed (GObject *object)
prepopulate_account_page (page);
}
- priv->photo_dialog = um_photo_dialog_new (priv->avatar_button,
- avatar_callback,
- page);
+ priv->photo_dialog = um_photo_dialog_new (avatar_callback, page);
um_photo_dialog_generate_avatar (priv->photo_dialog, "");
+ gtk_menu_button_set_popover (GTK_MENU_BUTTON (priv->avatar_button),
+ GTK_WIDGET (priv->photo_dialog));
validate (page);
-
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_resource (provider, "/org/gnome/initial-setup/gis-account-page-style.css");
- gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
- GTK_STYLE_PROVIDER (provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
- g_object_unref (provider);
}
static void
@@ -547,7 +552,7 @@ local_create_user (GisAccountPageLocal *local,
g_autoptr(ActUser) parent_user = NULL;
username = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (priv->username_combo));
- fullname = gtk_entry_get_text (GTK_ENTRY (priv->fullname_entry));
+ fullname = gtk_editable_get_text (GTK_EDITABLE (priv->fullname_entry));
parental_controls_enabled = gis_driver_get_parental_controls_enabled (page->driver);
/* Always create the admin user first, in case of failure part-way through
@@ -688,7 +693,7 @@ gis_account_page_local_apply (GisAccountPageLocal *local, GisPage *page)
username = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (priv->username_combo));
gis_driver_set_username (GIS_PAGE (page)->driver, username);
- full_name = gtk_entry_get_text (GTK_ENTRY (priv->fullname_entry));
+ full_name = gtk_editable_get_text (GTK_EDITABLE (priv->fullname_entry));
gis_driver_set_full_name (GIS_PAGE (page)->driver, full_name);
if (priv->avatar_pixbuf != NULL)
@@ -704,7 +709,7 @@ gis_account_page_local_apply (GisAccountPageLocal *local, GisPage *page)
}
#ifdef HAVE_PARENTAL_CONTROLS
- parental_controls_enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(priv->enable_parental_controls_check_button));
+ parental_controls_enabled = gtk_check_button_get_active (GTK_CHECK_BUTTON
(priv->enable_parental_controls_check_button));
#else
parental_controls_enabled = FALSE;
#endif
diff --git a/gnome-initial-setup/pages/account/gis-account-page-local.h
b/gnome-initial-setup/pages/account/gis-account-page-local.h
index 1674ad88..91e543c4 100644
--- a/gnome-initial-setup/pages/account/gis-account-page-local.h
+++ b/gnome-initial-setup/pages/account/gis-account-page-local.h
@@ -22,7 +22,7 @@
#ifndef __GIS_ACCOUNT_PAGE_LOCAL_H__
#define __GIS_ACCOUNT_PAGE_LOCAL_H__
-#include <gtk/gtk.h>
+#include <adwaita.h>
G_BEGIN_DECLS
@@ -38,12 +38,12 @@ typedef struct _GisAccountPageLocalClass GisAccountPageLocalClass;
struct _GisAccountPageLocal
{
- GtkBin parent;
+ AdwBin parent;
};
struct _GisAccountPageLocalClass
{
- GtkBinClass parent_class;
+ AdwBinClass parent_class;
};
GType gis_account_page_local_get_type (void);
diff --git a/gnome-initial-setup/pages/account/gis-account-page-local.ui
b/gnome-initial-setup/pages/account/gis-account-page-local.ui
index ccfd7e14..67aaf9af 100644
--- a/gnome-initial-setup/pages/account/gis-account-page-local.ui
+++ b/gnome-initial-setup/pages/account/gis-account-page-local.ui
@@ -1,39 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <!-- interface-requires gtk+ 3.0 -->
- <template class="GisAccountPageLocal" parent="GtkBin">
+ <template class="GisAccountPageLocal" parent="AdwBin">
<child>
<object class="GtkBox" id="area">
- <property name="visible">True</property>
<property name="halign">center</property>
<property name="valign">fill</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkToggleButton" id="avatar_button">
- <property name="visible">True</property>
+ <object class="GtkMenuButton" id="avatar_button">
<property name="margin_top">24</property>
<property name="halign">center</property>
<style>
- <class name="avatar-button"/>
+ <class name="flat"/>
</style>
- <child internal-child="accessible">
- <object class="AtkObject" id="avatar_button_accessible">
- <property name="accessible-name" translatable="yes">Avatar image</property>
- </object>
- </child>
+ <accessibility>
+ <property name="description" translatable="yes">Avatar image</property>
+ </accessibility>
<child>
<object class="GtkImage" id="avatar_image">
- <property name="visible">True</property>
<property name="pixel_size">96</property>
<property name="icon_name">avatar-default-symbolic</property>
- <property name="icon_size">1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GisPageHeader" id="header">
- <property name="visible">True</property>
+ <property name="show-icon">False</property>
<property name="margin_top">18</property>
<property name="title" translatable="yes">About You</property>
<property name="subtitle" translatable="yes">Please provide a name and username. You can choose
a picture too.</property>
@@ -41,83 +34,60 @@
</child>
<child>
<object class="GtkGrid" id="form">
- <property name="visible">True</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<property name="margin_top">42</property>
<child>
<object class="GtkLabel" id="fullname_label">
- <property name="visible">True</property>
<property name="halign">end</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Full Name</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">fullname_entry</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">3</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
<object class="GtkEntry" id="fullname_entry">
<property name="max_length">255</property>
<property name="width-chars">25</property>
- <property name="visible">True</property>
- <property name="invisible_char">●</property>
- <property name="invisible_char_set">True</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">3</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">3</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="username_label">
- <property name="visible">True</property>
<property name="halign">end</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Username</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">comboboxtext-entry</property>
+ <property name="mnemonic_widget">username_combo</property>
<property name="margin_top">6</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">4</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">4</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
<object class="GtkComboBoxText" id="username_combo">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="has_entry">True</property>
<property name="entry_text_column">0</property>
<property name="id_column">1</property>
<property name="margin_top">6</property>
- <child internal-child="entry">
- <object class="GtkEntry" id="comboboxtext-entry">
- <property name="can_focus">True</property>
- <property name="width-chars">25</property>
- </object>
- </child>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">4</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">4</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="username_explanation">
- <property name="visible">True</property>
<property name="yalign">0</property>
<property name="xalign">0</property>
<property name="width-chars">35</property>
@@ -125,6 +95,10 @@
<property name="height-request">50</property>
<property name="wrap">True</property>
<property name="wrap_mode">word-char</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">5</property>
+ </layout>
<style>
<class name="dim-label"/>
</style>
@@ -132,31 +106,26 @@
<attribute name="scale" value="0.8"/>
</attributes>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">5</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
<object class="GtkBox" id="enable_parental_controls_box">
- <property name="visible">True</property>
<property name="orientation">vertical</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">6</property>
+ </layout>
<child>
<object class="GtkCheckButton" id="enable_parental_controls_check_button">
- <property name="visible">True</property>
<property name="label" translatable="yes">Set up _parental controls for this
user</property>
<property name="use-underline">True</property>
</object>
</child>
<child>
<object class="GtkLabel">
- <property name="visible">True</property>
<property name="label" translatable="yes">For use by a parent or supervisor, who must
set up their own password.</property>
<property name="yalign">0</property>
<property name="xalign">0</property>
- <property name="margin-left">24</property>
+ <property name="margin-start">24</property>
<style>
<class name="dim-label"/>
</style>
@@ -166,12 +135,6 @@
</object>
</child>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">6</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
</object>
</child>
diff --git a/gnome-initial-setup/pages/account/gis-account-page.ui
b/gnome-initial-setup/pages/account/gis-account-page.ui
index f2cd51f0..782e4bd3 100644
--- a/gnome-initial-setup/pages/account/gis-account-page.ui
+++ b/gnome-initial-setup/pages/account/gis-account-page.ui
@@ -1,64 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <!-- interface-requires gtk+ 3.0 -->
<template class="GisAccountPage" parent="GisPage">
<child>
- <object class="GtkBox" id="page">
- <property name="visible">True</property>
- <property name="halign">center</property>
- <property name="valign">fill</property>
- <property name="orientation">vertical</property>
+ <object class="AdwPreferencesPage">
+
<child>
- <object class="GtkStack" id="stack">
- <property name="visible">True</property>
- <property name="valign">start</property>
- <property name="vexpand">True</property>
+ <object class="AdwPreferencesGroup">
<child>
- <object class="GisAccountPageLocal" id="page_local">
- <property name="visible">True</property>
- </object>
- </child>
- <child>
- <object class="GisAccountPageEnterprise" id="page_enterprise">
- <property name="visible">True</property>
+ <object class="GtkStack" id="stack">
+ <property name="valign">start</property>
+ <property name="vexpand">True</property>
+ <child>
+ <object class="GisAccountPageLocal" id="page_local" />
+ </child>
+ <child>
+ <object class="GisAccountPageEnterprise" id="page_enterprise" />
+ </child>
</object>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
+
<child>
- <object class="GtkStack" id="offline_stack">
- <property name="visible">True</property>
- <property name="halign">center</property>
- <property name="valign">end</property>
- <property name="margin_bottom">18</property>
- <child>
- <object class="GtkToggleButton" id="page_toggle">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="label" translatable="yes">_Enterprise Login</property>
- <property name="halign">center</property>
- <property name="valign">center</property>
- </object>
- </child>
+ <object class="AdwPreferencesGroup">
<child>
- <object class="GtkLabel" id="offline_label">
- <property name="visible">True</property>
- <property name="halign">center</property>
- <property name="valign">center</property>
- <property name="label" translatable="yes">Go online to set up Enterprise Login.</property>
- <style>
- <class name="dim-label"/>
- </style>
+ <object class="GtkStack" id="offline_stack">
+ <property name="valign">end</property>
+ <child>
+ <object class="GtkToggleButton" id="page_toggle">
+ <property name="use_underline">True</property>
+ <property name="label" translatable="yes">_Enterprise Login</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="offline_label">
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="label" translatable="yes">Go online to set up Enterprise
Login.</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
</object>
</child>
</object>
</child>
+
</object>
</child>
+
</template>
</interface>
diff --git a/gnome-initial-setup/pages/account/um-photo-dialog.c
b/gnome-initial-setup/pages/account/um-photo-dialog.c
index 9f0a6183..383101df 100644
--- a/gnome-initial-setup/pages/account/um-photo-dialog.c
+++ b/gnome-initial-setup/pages/account/um-photo-dialog.c
@@ -37,7 +37,6 @@
struct _UmPhotoDialog {
GtkPopover parent;
- GtkWidget *popup_button;
GtkWidget *take_picture_button;
GtkWidget *flowbox;
GtkWidget *recent_pictures;
@@ -68,7 +67,7 @@ face_widget_activated (GtkFlowBox *flowbox,
const char *filename;
GtkWidget *image;
- image = gtk_bin_get_child (GTK_BIN (child));
+ image = gtk_flow_box_child_get_child (child);
filename = g_object_get_data (G_OBJECT (image), "filename");
um->callback (NULL, filename, um->data);
@@ -243,32 +242,6 @@ setup_photo_popup (UmPhotoDialog *um)
}
}
-static void
-popup_icon_menu (GtkToggleButton *button, UmPhotoDialog *um)
-{
- gtk_popover_popup (GTK_POPOVER (um));
-}
-
-static gboolean
-on_popup_button_button_pressed (GtkToggleButton *button,
- GdkEventButton *event,
- UmPhotoDialog *um)
-{
- if (event->button == 1) {
- if (!gtk_widget_get_visible (GTK_WIDGET (um))) {
- popup_icon_menu (button, um);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
- } else {
- gtk_popover_popdown (GTK_POPOVER (um));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE);
- }
-
- return TRUE;
- }
-
- return FALSE;
-}
-
void
um_photo_dialog_generate_avatar (UmPhotoDialog *um,
const gchar *name)
@@ -290,7 +263,6 @@ um_photo_dialog_generate_avatar (UmPhotoDialog *um,
g_list_store_insert (um->recent_faces, 0,
um->generated_avatar);
- gtk_widget_show_all (um->recent_pictures);
if (!um->custom_avatar_was_chosen) {
um->callback (NULL, g_file_get_path (um->generated_avatar), um->data);
@@ -298,23 +270,14 @@ um_photo_dialog_generate_avatar (UmPhotoDialog *um,
}
UmPhotoDialog *
-um_photo_dialog_new (GtkWidget *button,
- SelectAvatarCallback callback,
+um_photo_dialog_new (SelectAvatarCallback callback,
gpointer data)
{
UmPhotoDialog *um;
- um = g_object_new (UM_TYPE_PHOTO_DIALOG,
- "relative-to", button,
- NULL);
+ um = g_object_new (UM_TYPE_PHOTO_DIALOG, NULL);
- /* Set up the popup */
- um->popup_button = button;
setup_photo_popup (um);
- g_signal_connect (button, "toggled",
- G_CALLBACK (popup_icon_menu), um);
- g_signal_connect (button, "button-press-event",
- G_CALLBACK (on_popup_button_button_pressed), um);
um->callback = callback;
um->data = data;
diff --git a/gnome-initial-setup/pages/account/um-photo-dialog.h
b/gnome-initial-setup/pages/account/um-photo-dialog.h
index 20a1e7d3..75061ff5 100644
--- a/gnome-initial-setup/pages/account/um-photo-dialog.h
+++ b/gnome-initial-setup/pages/account/um-photo-dialog.h
@@ -36,8 +36,7 @@ typedef void (SelectAvatarCallback) (GdkPixbuf *pixbuf,
const gchar *filename,
gpointer data);
-UmPhotoDialog *um_photo_dialog_new (GtkWidget *button,
- SelectAvatarCallback callback,
+UmPhotoDialog *um_photo_dialog_new (SelectAvatarCallback callback,
gpointer data);
void um_photo_dialog_free (UmPhotoDialog *dialog);
diff --git a/gnome-initial-setup/pages/account/um-utils.c b/gnome-initial-setup/pages/account/um-utils.c
index c7cbad10..39887498 100644
--- a/gnome-initial-setup/pages/account/um-utils.c
+++ b/gnome-initial-setup/pages/account/um-utils.c
@@ -36,7 +36,6 @@
void
set_entry_validation_checkmark (GtkEntry *entry)
{
- g_object_set (entry, "caps-lock-warning", FALSE, NULL);
gtk_entry_set_icon_from_icon_name (entry,
GTK_ENTRY_ICON_SECONDARY,
"object-select-symbolic");
@@ -46,10 +45,9 @@ void
set_entry_validation_error (GtkEntry *entry,
const gchar *text)
{
- g_object_set (entry, "caps-lock-warning", FALSE, NULL);
- gtk_entry_set_icon_from_stock (entry,
- GTK_ENTRY_ICON_SECONDARY,
- GTK_STOCK_CAPS_LOCK_WARNING);
+ gtk_entry_set_icon_from_icon_name (entry,
+ GTK_ENTRY_ICON_SECONDARY,
+ "dialog-warning-symbolic");
gtk_entry_set_icon_tooltip_text (entry,
GTK_ENTRY_ICON_SECONDARY,
text);
@@ -58,105 +56,9 @@ set_entry_validation_error (GtkEntry *entry,
void
clear_entry_validation_error (GtkEntry *entry)
{
- gboolean warning;
-
- g_object_get (entry, "caps-lock-warning", &warning, NULL);
-
- if (warning)
- return;
-
- gtk_entry_set_icon_from_pixbuf (entry,
- GTK_ENTRY_ICON_SECONDARY,
- NULL);
- g_object_set (entry, "caps-lock-warning", TRUE, NULL);
-}
-
-void
-popup_menu_below_button (GtkMenu *menu,
- gint *x,
- gint *y,
- gboolean *push_in,
- GtkWidget *button)
-{
- GtkRequisition menu_req;
- GtkTextDirection direction;
- GtkAllocation allocation;
-
- gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &menu_req);
-
- direction = gtk_widget_get_direction (button);
-
- gdk_window_get_origin (gtk_widget_get_window (button), x, y);
- gtk_widget_get_allocation (button, &allocation);
- *x += allocation.x;
- *y += allocation.y + allocation.height;
-
- if (direction == GTK_TEXT_DIR_LTR)
- *x += MAX (allocation.width - menu_req.width, 0);
- else if (menu_req.width > allocation.width)
- *x -= menu_req.width - allocation.width;
-
- *push_in = TRUE;
-}
-
-void
-down_arrow (GtkStyleContext *context,
- cairo_t *cr,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GtkStateFlags flags;
- GdkRGBA fg_color;
- GdkRGBA outline_color;
- gdouble vertical_overshoot;
- gint diameter;
- gdouble radius;
- gdouble x_double, y_double;
- gdouble angle;
- gint line_width;
-
- flags = gtk_style_context_get_state (context);
-
- gtk_style_context_get_color (context, flags, &fg_color);
- gtk_style_context_get_border_color (context, flags, &outline_color);
-
- line_width = 1;
- angle = G_PI / 2;
- vertical_overshoot = line_width / 2.0 * (1. / tan (G_PI / 8));
- if (line_width % 2 == 1)
- vertical_overshoot = ceil (0.5 + vertical_overshoot) - 0.5;
- else
- vertical_overshoot = ceil (vertical_overshoot);
- diameter = (gint) MAX (3, width - 2 * vertical_overshoot);
- diameter -= (1 - (diameter + line_width) % 2);
- radius = diameter / 2.;
- x_double = floor ((x + width / 2) - (radius + line_width) / 2.) + (radius + line_width) / 2.;
-
- y_double = (y + height / 2) - 0.5;
-
- cairo_save (cr);
-
- cairo_translate (cr, x_double, y_double);
- cairo_rotate (cr, angle);
-
- cairo_move_to (cr, - radius / 2., - radius);
- cairo_line_to (cr, radius / 2., 0);
- cairo_line_to (cr, - radius / 2., radius);
-
- cairo_close_path (cr);
-
- cairo_set_line_width (cr, line_width);
-
- gdk_cairo_set_source_rgba (cr, &fg_color);
-
- cairo_fill_preserve (cr);
-
- gdk_cairo_set_source_rgba (cr, &outline_color);
- cairo_stroke (cr);
-
- cairo_restore (cr);
+ gtk_entry_set_icon_from_paintable (entry,
+ GTK_ENTRY_ICON_SECONDARY,
+ NULL);
}
#define MAXNAMELEN (UT_NAMESIZE - 1)
diff --git a/gnome-initial-setup/pages/account/um-utils.h b/gnome-initial-setup/pages/account/um-utils.h
index b0bb905b..8a8c7cd7 100644
--- a/gnome-initial-setup/pages/account/um-utils.h
+++ b/gnome-initial-setup/pages/account/um-utils.h
@@ -32,19 +32,6 @@ void set_entry_validation_error (GtkEntry *entry,
void set_entry_validation_checkmark (GtkEntry *entry);
void clear_entry_validation_error (GtkEntry *entry);
-void popup_menu_below_button (GtkMenu *menu,
- gint *x,
- gint *y,
- gboolean *push_in,
- GtkWidget *button);
-
-void down_arrow (GtkStyleContext *context,
- cairo_t *cr,
- gint x,
- gint y,
- gint width,
- gint height);
-
gboolean is_valid_name (const gchar *name);
gboolean is_valid_username (const gchar *name,
gboolean parental_controls_enabled,
diff --git a/gnome-initial-setup/pages/meson.build b/gnome-initial-setup/pages/meson.build
index 93c1646a..f657b945 100644
--- a/gnome-initial-setup/pages/meson.build
+++ b/gnome-initial-setup/pages/meson.build
@@ -1,5 +1,5 @@
pages = [
- #'account',
+ 'account',
'language',
'keyboard',
'network',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]