[gspell/wip/entry: 2/2] test-entry: add toggle button to turn the GtkEntry into password mode



commit 5c71feeff1b887a712fecd12873fea9af85fd839
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Dec 22 16:12:32 2016 +0100

    test-entry: add toggle button to turn the GtkEntry into password mode

 tests/test-entry.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/tests/test-entry.c b/tests/test-entry.c
index 77265d1..03a5ae7 100644
--- a/tests/test-entry.c
+++ b/tests/test-entry.c
@@ -88,6 +88,7 @@ create_sidebar (TestSpell *spell)
        GtkWidget *vgrid;
        GtkWidget *enable_toggle_button;
        GtkWidget *bold_toggle_button;
+       GtkWidget *password_toggle_button;
 
        vgrid = gtk_grid_new ();
        gtk_grid_set_row_spacing (GTK_GRID (vgrid), 6);
@@ -110,6 +111,15 @@ create_sidebar (TestSpell *spell)
                          G_CALLBACK (bold_toggled_cb),
                          spell);
 
+       password_toggle_button = gtk_toggle_button_new_with_label ("Password mode");
+       gtk_container_add (GTK_CONTAINER (vgrid), password_toggle_button);
+
+       g_object_bind_property (spell->entry, "visibility",
+                               password_toggle_button, "active",
+                               G_BINDING_BIDIRECTIONAL |
+                               G_BINDING_SYNC_CREATE |
+                               G_BINDING_INVERT_BOOLEAN);
+
        gtk_widget_show_all (vgrid);
 
        return vgrid;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]