[gnome-initial-setup/wip/pwithnall/misc-fixes: 42/70] passwordPage: make latin kbd layout (en) available for password entries
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup/wip/pwithnall/misc-fixes: 42/70] passwordPage: make latin kbd layout (en) available for password entries
- Date: Fri, 11 Sep 2020 13:29:14 +0000 (UTC)
commit d7ee1f1d342320b09bf6e83b47bc21bdbe2c74d8
Author: Simon Schampijer <simon schampijer endlessm com>
Date: Tue Dec 5 23:16:09 2017 +0100
passwordPage: make latin kbd layout (en) available for password entries
If the current keyboard layout is not a latin one we will add the
fallback kbd layout 'en'. This calls out to gnome-shell where the
logic to detect the keyboard layout is kept. The layout will be
available in the popup switcher and the taskbar keyboard layout
switcher.
(Rebase 3.38: Fix minor rebase conflicts.)
https://phabricator.endlessm.com/T18598
.../pages/password/gis-password-page.c | 41 ++++++++++++++++++++++
1 file changed, 41 insertions(+)
---
diff --git a/gnome-initial-setup/pages/password/gis-password-page.c
b/gnome-initial-setup/pages/password/gis-password-page.c
index 610a4444..d12fba72 100644
--- a/gnome-initial-setup/pages/password/gis-password-page.c
+++ b/gnome-initial-setup/pages/password/gis-password-page.c
@@ -49,6 +49,8 @@ struct _GisPasswordPagePrivate
GtkWidget *reminder_entry;
GtkWidget *header;
+ GDBusProxy *input_source_manager;
+
gboolean valid_confirm;
gboolean valid_password;
guint timeout_id;
@@ -198,12 +200,36 @@ gis_password_page_save_data (GisPage *gis_page,
return TRUE;
}
+static void
+shell_enable_password_mode (GisPasswordPage *page, gboolean enable)
+{
+ GisPasswordPagePrivate *priv = gis_password_page_get_instance_private (page);
+ GError *error = NULL;
+
+ if (!priv->input_source_manager)
+ return;
+
+ g_dbus_proxy_call_sync (priv->input_source_manager,
+ "Set",
+ g_variant_new_parsed ("('org.gnome.Shell.InputSourceManager',
'PasswordModeEnabled', %v)",
+ g_variant_new_boolean (enable)),
+ G_DBUS_CALL_FLAGS_NONE, -1,
+ NULL, &error);
+
+ if (error != NULL) {
+ g_critical ("Unable to set PasswordMode: %s", error->message);
+ g_error_free (error);
+ }
+}
+
static void
gis_password_page_shown (GisPage *gis_page)
{
GisPasswordPage *page = GIS_PASSWORD_PAGE (gis_page);
GisPasswordPagePrivate *priv = gis_password_page_get_instance_private (page);
+ shell_enable_password_mode (page, TRUE);
+
gtk_widget_grab_focus (priv->password_entry);
}
@@ -388,6 +414,14 @@ gis_password_page_constructed (GObject *object)
validate (page);
update_header (page);
+ priv->input_source_manager = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ "org.gnome.Shell.InputSourceManager",
+ "/org/gnome/Shell/InputSourceManager",
+ "org.freedesktop.DBus.Properties",
+ NULL, NULL);
+
/* This callback shows the page widget conditionally on if it's needed */
username_or_passwordless_changed (page);
}
@@ -434,9 +468,16 @@ gis_password_page_set_property (GObject *object,
static void
gis_password_page_dispose (GObject *object)
{
+ GisPasswordPage *page = GIS_PASSWORD_PAGE (object);
+ GisPasswordPagePrivate *priv = gis_password_page_get_instance_private (page);
+
GtkSettings *settings = gtk_settings_get_default ();
g_object_set (G_OBJECT (settings), "gtk-entry-password-hint-timeout", 0, NULL);
+ shell_enable_password_mode (page, FALSE);
+
+ g_clear_object (&priv->input_source_manager);
+
if (GIS_PAGE (object)->driver) {
g_signal_handlers_disconnect_by_func (GIS_PAGE (object)->driver,
username_or_passwordless_changed, object);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]