[gtk/password-entry-activate: 2/2] passwordentry: Add an ::activate signal
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/password-entry-activate: 2/2] passwordentry: Add an ::activate signal
- Date: Sat, 19 Sep 2020 17:25:58 +0000 (UTC)
commit dd0da0f3ccf7241c9289f13ef394a42f94eb34f5
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Sep 19 13:25:03 2020 -0400
passwordentry: Add an ::activate signal
GtkSearchEntry has one, no reason why GtkPasswordEntry
should not as well.
Fixes: #3174
gdk/wayland/gdkdisplay-wayland.c | 2 ++
gtk/gtkpasswordentry.c | 23 +++++++++++++++++++++++
2 files changed, 25 insertions(+)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index 461e0f0110..6ca4b8f152 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -388,8 +388,10 @@ gboolean
gdk_wayland_display_prefers_ssd (GdkDisplay *display)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
+
if (display_wayland->server_decoration_manager)
return display_wayland->server_decoration_mode == ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER;
+
return FALSE;
}
diff --git a/gtk/gtkpasswordentry.c b/gtk/gtkpasswordentry.c
index f49a85a56c..216ae2d915 100644
--- a/gtk/gtkpasswordentry.c
+++ b/gtk/gtkpasswordentry.c
@@ -87,6 +87,13 @@ struct _GtkPasswordEntryClass
GtkWidgetClass parent_class;
};
+enum {
+ ACTIVATE,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0, };
+
enum {
PROP_PLACEHOLDER_TEXT = 1,
PROP_ACTIVATES_DEFAULT,
@@ -156,6 +163,12 @@ visibility_toggled (GObject *object,
caps_lock_state_changed (entry->keyboard, NULL, GTK_WIDGET (entry));
}
+static void
+activate_cb (GtkPasswordEntry *entry)
+{
+ g_signal_emit (entry, signals[ACTIVATE], 0);
+}
+
static void
gtk_password_entry_init (GtkPasswordEntry *entry)
{
@@ -167,6 +180,7 @@ gtk_password_entry_init (GtkPasswordEntry *entry)
gtk_widget_set_parent (entry->entry, GTK_WIDGET (entry));
gtk_editable_init_delegate (GTK_EDITABLE (entry));
g_signal_connect_swapped (entry->entry, "notify::has-focus", G_CALLBACK (focus_changed), entry);
+ g_signal_connect_swapped (entry->entry, "activate", G_CALLBACK (activate_cb), entry);
entry->icon = gtk_image_new_from_icon_name ("caps-lock-symbolic");
gtk_widget_set_tooltip_text (entry->icon, _("Caps Lock is on"));
@@ -438,6 +452,15 @@ gtk_password_entry_class_init (GtkPasswordEntryClass *klass)
g_object_class_install_properties (object_class, NUM_PROPERTIES, props);
gtk_editable_install_properties (object_class, NUM_PROPERTIES);
+ signals[ACTIVATE] =
+ g_signal_new (I_("activate"),
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ 0,
+ NULL, NULL,
+ NULL,
+ G_TYPE_NONE, 0);
+
gtk_widget_class_set_css_name (widget_class, I_("entry"));
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_TEXT_BOX);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]