[gtk/ebassi/secure-buffer: 5/5] Use GtkPasswordEntryBuffer in GtkPasswordEntry
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/ebassi/secure-buffer: 5/5] Use GtkPasswordEntryBuffer in GtkPasswordEntry
- Date: Tue, 8 Sep 2020 17:19:14 +0000 (UTC)
commit 2b4f1959b019b632b2dbfe2f878099b39a4a1d9d
Author: Emmanuele Bassi <ebassi gnome org>
Date: Fri Sep 4 12:52:03 2020 +0100
Use GtkPasswordEntryBuffer in GtkPasswordEntry
Now that we have a secure buffer, we should start using it.
Fixed: #3119
gtk/gtkpasswordentry.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkpasswordentry.c b/gtk/gtkpasswordentry.c
index 252b8be0f2..dfef768135 100644
--- a/gtk/gtkpasswordentry.c
+++ b/gtk/gtkpasswordentry.c
@@ -24,15 +24,16 @@
#include "gtktextprivate.h"
#include "gtkeditable.h"
+#include "gtkeventcontrollerkey.h"
#include "gtkgestureclick.h"
#include "gtkbox.h"
#include "gtkimage.h"
#include "gtkintl.h"
-#include "gtkprivate.h"
-#include "gtkwidgetprivate.h"
#include "gtkmarshalers.h"
+#include "gtkpasswordentrybufferprivate.h"
+#include "gtkprivate.h"
#include "gtkstylecontext.h"
-#include "gtkeventcontrollerkey.h"
+#include "gtkwidgetprivate.h"
/**
* SECTION:gtkpasswordentry
@@ -159,8 +160,10 @@ static void
gtk_password_entry_init (GtkPasswordEntry *entry)
{
GtkPasswordEntryPrivate *priv = gtk_password_entry_get_instance_private (entry);
+ GtkEntryBuffer *buffer = gtk_password_entry_buffer_new ();
priv->entry = gtk_text_new ();
+ gtk_text_set_buffer (GTK_TEXT (priv->entry), buffer);
gtk_text_set_visibility (GTK_TEXT (priv->entry), FALSE);
gtk_widget_set_parent (priv->entry, GTK_WIDGET (entry));
gtk_editable_init_delegate (GTK_EDITABLE (entry));
@@ -175,6 +178,9 @@ gtk_password_entry_init (GtkPasswordEntry *entry)
gtk_widget_add_css_class (GTK_WIDGET (entry), I_("password"));
gtk_password_entry_set_extra_menu (entry, NULL);
+
+ /* Transfer ownership to the GtkText widget */
+ g_object_unref (buffer);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]