[network-manager-applet/lr/libnma-gtk-builder: 3/3] nma-vpn-password-dialog: turn into a templated GtkWidget



commit e611cbb164d211cb18c6207590fa19d6da2af6d5
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Tue Feb 6 12:59:44 2018 +0100

    nma-vpn-password-dialog: turn into a templated GtkWidget
    
    Construct the dialog's widget hierarchy in a declarative manner as
    opposed to procedural C.
    
    This also redoes the layout with GtkGrid and simplifies the logic a bit.

 src/libnma/nma-vpn-password-dialog.c  |  308 +++++++--------------------------
 src/libnma/nma-vpn-password-dialog.ui |  226 ++++++++++++++++++++++++
 src/libnma/nma.gresource.xml          |    1 +
 3 files changed, 292 insertions(+), 243 deletions(-)
---
diff --git a/src/libnma/nma-vpn-password-dialog.c b/src/libnma/nma-vpn-password-dialog.c
index 8b1d33c..278db5c 100644
--- a/src/libnma/nma-vpn-password-dialog.c
+++ b/src/libnma/nma-vpn-password-dialog.c
@@ -16,42 +16,35 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
  * Copyright (C) 1999, 2000 Eazel, Inc.
- * Copyright (C) 2011, 2017 Red Hat, Inc.
+ * Copyright (C) 2011 - 2018 Red Hat, Inc.
  *
  * Authors: Ramiro Estrugo <ramiro eazel com>
  *          Dan Williams <dcbw redhat com>
+ *          Lubomir Rintel <lkundrak v3 sk>
  */
 
 #include "nm-default.h"
 
 #include "nma-vpn-password-dialog.h"
 
-G_DEFINE_TYPE (NMAVpnPasswordDialog, nma_vpn_password_dialog, GTK_TYPE_DIALOG)
-
-#define NMA_VPN_PASSWORD_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
-                                                NMA_VPN_TYPE_PASSWORD_DIALOG, \
-                                                NMAVpnPasswordDialogPrivate))
-
 typedef struct {
-       /* Attributes */
-       gboolean show_password;
-       gboolean show_password_secondary;
-       gboolean show_password_ternary;
-
-       /* Internal widgetry and flags */
+       GtkWidget *message_label;
+       GtkWidget *password_label;
+       GtkWidget *password_label_secondary;
+       GtkWidget *password_label_tertiary;
        GtkWidget *password_entry;
        GtkWidget *password_entry_secondary;
-       GtkWidget *password_entry_ternary;
+       GtkWidget *password_entry_tertiary;
        GtkWidget *show_passwords_checkbox;
+} NMAVpnPasswordDialogPrivate;
 
-       GtkWidget *grid_alignment;
-       GtkWidget *grid;
-       GtkSizeGroup *group;
+G_DEFINE_TYPE_WITH_CODE (NMAVpnPasswordDialog, nma_vpn_password_dialog, GTK_TYPE_DIALOG,
+                         G_ADD_PRIVATE (NMAVpnPasswordDialog))
 
-       char *primary_password_label;
-       char *secondary_password_label;
-       char *ternary_password_label;
-} NMAVpnPasswordDialogPrivate;
+
+#define NMA_VPN_PASSWORD_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
+                                                NMA_VPN_TYPE_PASSWORD_DIALOG, \
+                                                NMAVpnPasswordDialogPrivate))
 
 /* NMAVpnPasswordDialogClass methods */
 static void nma_vpn_password_dialog_class_init (NMAVpnPasswordDialogClass *password_dialog_class);
@@ -62,44 +55,47 @@ static void dialog_show_callback (GtkWidget *widget, gpointer callback_data);
 static void dialog_close_callback (GtkWidget *widget, gpointer callback_data);
 
 static void
-finalize (GObject *object)
+show_passwords_toggled_cb (GtkWidget *widget, gpointer user_data)
 {
-       NMAVpnPasswordDialogPrivate *priv = NMA_VPN_PASSWORD_DIALOG_GET_PRIVATE (object);
-       
-       g_object_unref (priv->password_entry);
-       g_object_unref (priv->password_entry_secondary);
-       g_object_unref (priv->password_entry_ternary);
-       g_object_unref (priv->group);
+       NMAVpnPasswordDialog *dialog = NMA_VPN_PASSWORD_DIALOG (user_data);
+       NMAVpnPasswordDialogPrivate *priv = NMA_VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
+       gboolean visible;
 
-       g_free (priv->primary_password_label);
-       g_free (priv->secondary_password_label);
-       g_free (priv->ternary_password_label);
+       visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
 
-       G_OBJECT_CLASS (nma_vpn_password_dialog_parent_class)->finalize (object);
+       gtk_entry_set_visibility (GTK_ENTRY (priv->password_entry), visible);
+       gtk_entry_set_visibility (GTK_ENTRY (priv->password_entry_secondary), visible);
+       gtk_entry_set_visibility (GTK_ENTRY (priv->password_entry_tertiary), visible);
 }
 
 static void
 nma_vpn_password_dialog_class_init (NMAVpnPasswordDialogClass *klass)
 {
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-       g_type_class_add_private (object_class, sizeof (NMAVpnPasswordDialogPrivate));
-
-       object_class->finalize = finalize;
+       GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+       g_type_ensure (NM_TYPE_DEVICE);
+       gtk_widget_class_set_template_from_resource (widget_class,
+                                                    
"/org/freedesktop/network-manager-applet/nma-vpn-password-dialog.ui");
+
+       gtk_widget_class_bind_template_child_private (widget_class, NMAVpnPasswordDialog, message_label);
+       gtk_widget_class_bind_template_child_private (widget_class, NMAVpnPasswordDialog, password_label);
+       gtk_widget_class_bind_template_child_private (widget_class, NMAVpnPasswordDialog, 
password_label_secondary);
+       gtk_widget_class_bind_template_child_private (widget_class, NMAVpnPasswordDialog, 
password_label_tertiary);
+       gtk_widget_class_bind_template_child_private (widget_class, NMAVpnPasswordDialog, password_entry);
+       gtk_widget_class_bind_template_child_private (widget_class, NMAVpnPasswordDialog, 
password_entry_secondary);
+       gtk_widget_class_bind_template_child_private (widget_class, NMAVpnPasswordDialog, 
password_entry_tertiary);
+       gtk_widget_class_bind_template_child_private (widget_class, NMAVpnPasswordDialog, 
show_passwords_checkbox);
+
+       gtk_widget_class_bind_template_callback (widget_class, dialog_close_callback);
+       gtk_widget_class_bind_template_callback (widget_class, dialog_show_callback);
+       gtk_widget_class_bind_template_callback (widget_class, gtk_window_activate_default);
+       gtk_widget_class_bind_template_callback (widget_class, show_passwords_toggled_cb);
 }
 
 static void
 nma_vpn_password_dialog_init (NMAVpnPasswordDialog *dialog)
 {
-       NMAVpnPasswordDialogPrivate *priv = NMA_VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
-
-       priv->show_password = TRUE;
-       priv->primary_password_label = g_strdup ( _("_Password:") );
-       priv->show_password_secondary = TRUE;
-       priv->secondary_password_label = g_strdup ( _("_Secondary Password:") );
-       /* Make ternary password entry hidden by default */
-       priv->show_password_ternary = FALSE;
-       priv->ternary_password_label = g_strdup ( _("_Tertiary Password:") );
+       gtk_widget_init_template (GTK_WIDGET (dialog));
 }
 
 /* GtkDialog callbacks */
@@ -113,8 +109,8 @@ dialog_show_callback (GtkWidget *widget, gpointer callback_data)
                gtk_widget_grab_focus (priv->password_entry);
        else if (gtk_widget_get_visible (priv->password_entry_secondary))
                gtk_widget_grab_focus (priv->password_entry_secondary);
-       else if (gtk_widget_get_visible (priv->password_entry_ternary))
-               gtk_widget_grab_focus (priv->password_entry_ternary);
+       else if (gtk_widget_get_visible (priv->password_entry_tertiary))
+               gtk_widget_grab_focus (priv->password_entry_tertiary);
 }
 
 static void
@@ -123,65 +119,6 @@ dialog_close_callback (GtkWidget *widget, gpointer callback_data)
        gtk_widget_hide (widget);
 }
 
-static void
-add_row (GtkWidget *grid, int row, const char *label_text, GtkWidget *entry)
-{
-       GtkWidget *label;
-
-       label = gtk_label_new_with_mnemonic (label_text);
-       gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-
-       gtk_grid_attach (GTK_GRID (grid), label, 0, row, 1, 1);
-       gtk_grid_attach (GTK_GRID (grid), entry, 1, row, 1, 1);
-
-       gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
-}
-
-static void
-remove_child (GtkWidget *child, GtkWidget *grid)
-{
-       gtk_container_remove (GTK_CONTAINER (grid), child);
-}
-
-static void
-add_grid_rows (NMAVpnPasswordDialog *dialog)
-{
-       NMAVpnPasswordDialogPrivate *priv = NMA_VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
-       int row;
-       int offset = 0;
-
-       gtk_alignment_set_padding (GTK_ALIGNMENT (priv->grid_alignment), 0, 0, offset, 0);
-
-       /* This will not kill the entries, since they are ref:ed */
-       gtk_container_foreach (GTK_CONTAINER (priv->grid), (GtkCallback) remove_child, priv->grid);
-       
-       row = 0;
-       if (priv->show_password)
-               add_row (priv->grid, row++, priv->primary_password_label, priv->password_entry);
-       if (priv->show_password_secondary)
-               add_row (priv->grid, row++, priv->secondary_password_label,  priv->password_entry_secondary);
-       if (priv->show_password_ternary)
-               add_row (priv->grid, row++, priv->ternary_password_label,  priv->password_entry_ternary);
-
-       gtk_grid_attach (GTK_GRID (priv->grid), priv->show_passwords_checkbox, 1, row, 1, 1);
-
-       gtk_widget_show_all (priv->grid);
-}
-
-static void
-show_passwords_toggled_cb (GtkWidget *widget, gpointer user_data)
-{
-       NMAVpnPasswordDialog *dialog = NMA_VPN_PASSWORD_DIALOG (user_data);
-       NMAVpnPasswordDialogPrivate *priv = NMA_VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
-       gboolean visible;
-
-       visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
-
-       gtk_entry_set_visibility (GTK_ENTRY (priv->password_entry), visible);
-       gtk_entry_set_visibility (GTK_ENTRY (priv->password_entry_secondary), visible);
-       gtk_entry_set_visibility (GTK_ENTRY (priv->password_entry_ternary), visible);
-}
-
 /* Public NMAVpnPasswordDialog methods */
 GtkWidget *
 nma_vpn_password_dialog_new (const char *title,
@@ -190,108 +127,17 @@ nma_vpn_password_dialog_new (const char *title,
 {
        GtkWidget *dialog;
        NMAVpnPasswordDialogPrivate *priv;
-       GtkLabel *message_label;
-       GtkWidget *hbox;
-       GtkWidget *vbox;
-       GtkWidget *main_vbox;
-       GtkWidget *dialog_icon;
-       GtkBox *content;
-
-       dialog = gtk_widget_new (NMA_VPN_TYPE_PASSWORD_DIALOG, NULL);
+
+       dialog = gtk_widget_new (NMA_VPN_TYPE_PASSWORD_DIALOG, "title", title, NULL);
        if (!dialog)
                return NULL;
        priv = NMA_VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
 
-       gtk_window_set_title (GTK_WINDOW (dialog), title);
-       gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
-
-       gtk_dialog_add_buttons (GTK_DIALOG (dialog),
-                               _("_Cancel"), GTK_RESPONSE_CANCEL,
-                               _("_OK"), GTK_RESPONSE_OK,
-                               NULL);
-       gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
-
-       gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
-       gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
-
-       g_signal_connect (dialog, "show",
-                         G_CALLBACK (dialog_show_callback),
-                         dialog);
-       g_signal_connect (dialog, "close",
-                         G_CALLBACK (dialog_close_callback),
-                         dialog);
-
-       /* The grid that holds the captions */
-       priv->grid_alignment = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
-
-       priv->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-
-       priv->grid = gtk_grid_new ();
-       gtk_grid_set_column_spacing (GTK_GRID (priv->grid), 12);
-       gtk_grid_set_row_spacing (GTK_GRID (priv->grid), 6);
-       gtk_container_add (GTK_CONTAINER (priv->grid_alignment), priv->grid);
-
-       priv->password_entry = gtk_entry_new ();
-       priv->password_entry_secondary = gtk_entry_new ();
-       priv->password_entry_ternary = gtk_entry_new ();
-
-       priv->show_passwords_checkbox = gtk_check_button_new_with_mnemonic (_("Sh_ow passwords"));
-
-       /* We want to hold on to these during the grid rearrangement */
-       g_object_ref_sink (priv->password_entry);
-       g_object_ref_sink (priv->password_entry_secondary);
-       g_object_ref_sink (priv->password_entry_ternary);
-       g_object_ref_sink (priv->show_passwords_checkbox);
-       
-       gtk_entry_set_visibility (GTK_ENTRY (priv->password_entry), FALSE);
-       gtk_entry_set_visibility (GTK_ENTRY (priv->password_entry_secondary), FALSE);
-       gtk_entry_set_visibility (GTK_ENTRY (priv->password_entry_ternary), FALSE);
-
-       g_signal_connect_swapped (priv->password_entry, "activate",
-                                 G_CALLBACK (gtk_window_activate_default),
-                                 dialog);
-       g_signal_connect_swapped (priv->password_entry_secondary, "activate",
-                                 G_CALLBACK (gtk_window_activate_default),
-                                 dialog);
-       g_signal_connect_swapped (priv->password_entry_ternary, "activate",
-                                 G_CALLBACK (gtk_window_activate_default),
-                                 dialog);
-
-       g_signal_connect (priv->show_passwords_checkbox, "toggled",
-                         G_CALLBACK (show_passwords_toggled_cb),
-                         dialog);
-
-       add_grid_rows (NMA_VPN_PASSWORD_DIALOG (dialog));
-
-       /* Adds some eye-candy to the dialog */
-       hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
-       gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
-       dialog_icon = gtk_image_new_from_icon_name ("dialog-password", GTK_ICON_SIZE_DIALOG);
-       gtk_misc_set_alignment (GTK_MISC (dialog_icon), 0.5, 0.0);
-       gtk_box_pack_start (GTK_BOX (hbox), dialog_icon, FALSE, FALSE, 0);
-
-       /* Fills the vbox */
-       main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
-
        if (message) {
-               message_label = GTK_LABEL (gtk_label_new (message));
-               gtk_label_set_justify (message_label, GTK_JUSTIFY_LEFT);
-               gtk_label_set_line_wrap (message_label, TRUE);
-               gtk_label_set_max_width_chars (message_label, 35);
-               gtk_size_group_add_widget (priv->group, GTK_WIDGET (message_label));
-               gtk_box_pack_start (GTK_BOX (main_vbox), GTK_WIDGET (message_label), FALSE, FALSE, 0);
-               gtk_size_group_add_widget (priv->group, priv->grid_alignment);
+               gtk_label_set_text (GTK_LABEL (priv->message_label), message);
+               gtk_widget_show (priv->message_label);
        }
 
-       vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-       gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (vbox), priv->grid_alignment, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (hbox), main_vbox, FALSE, FALSE, 0);
-
-       content = GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));
-       gtk_box_pack_start (content, hbox, FALSE, FALSE, 0);
-       gtk_widget_show_all (GTK_WIDGET (content));
-
        nma_vpn_password_dialog_set_password (NMA_VPN_PASSWORD_DIALOG (dialog), password);
        
        return GTK_WIDGET (dialog);
@@ -338,15 +184,15 @@ nma_vpn_password_dialog_set_password_secondary (NMAVpnPasswordDialog *dialog,
 
 void
 nma_vpn_password_dialog_set_password_ternary (NMAVpnPasswordDialog *dialog,
-                                              const char *password_ternary)
+                                              const char *password_tertiary)
 {
        NMAVpnPasswordDialogPrivate *priv;
 
        g_return_if_fail (NMA_VPN_IS_PASSWORD_DIALOG (dialog));
 
        priv = NMA_VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
-       gtk_entry_set_text (GTK_ENTRY (priv->password_entry_ternary),
-                           password_ternary ? password_ternary : "");
+       gtk_entry_set_text (GTK_ENTRY (priv->password_entry_tertiary),
+                           password_tertiary ? password_tertiary : "");
 }
 
 void
@@ -358,12 +204,8 @@ nma_vpn_password_dialog_set_show_password (NMAVpnPasswordDialog *dialog, gboolea
        g_return_if_fail (NMA_VPN_IS_PASSWORD_DIALOG (dialog));
 
        priv = NMA_VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
-
-       show = !!show;
-       if (priv->show_password != show) {
-               priv->show_password = show;
-               add_grid_rows (dialog);
-       }
+       gtk_widget_set_visible (priv->password_label, show);
+       gtk_widget_set_visible (priv->password_entry, show);
 }
 
 void
@@ -376,12 +218,8 @@ nma_vpn_password_dialog_set_show_password_secondary (NMAVpnPasswordDialog *dialo
        g_return_if_fail (NMA_VPN_IS_PASSWORD_DIALOG (dialog));
 
        priv = NMA_VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
-
-       show = !!show;
-       if (priv->show_password_secondary != show) {
-               priv->show_password_secondary = show;
-               add_grid_rows (dialog);
-       }
+       gtk_widget_set_visible (priv->password_label_secondary, show);
+       gtk_widget_set_visible (priv->password_entry_secondary, show);
 }
 
 void
@@ -394,12 +232,8 @@ nma_vpn_password_dialog_set_show_password_ternary (NMAVpnPasswordDialog *dialog,
        g_return_if_fail (NMA_VPN_IS_PASSWORD_DIALOG (dialog));
 
        priv = NMA_VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
-
-       show = !!show;
-       if (priv->show_password_ternary != show) {
-               priv->show_password_ternary = show;
-               add_grid_rows (dialog);
-       }
+       gtk_widget_set_visible (priv->password_label_tertiary, show);
+       gtk_widget_set_visible (priv->password_entry_tertiary, show);
 }
 
 void
@@ -411,7 +245,7 @@ nma_vpn_password_dialog_focus_password (NMAVpnPasswordDialog *dialog)
        g_return_if_fail (NMA_VPN_IS_PASSWORD_DIALOG (dialog));
 
        priv = NMA_VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
-       if (priv->show_password)
+       if (gtk_widget_get_visible (priv->password_entry))
                gtk_widget_grab_focus (priv->password_entry);
 }
 
@@ -424,7 +258,7 @@ nma_vpn_password_dialog_focus_password_secondary (NMAVpnPasswordDialog *dialog)
        g_return_if_fail (NMA_VPN_IS_PASSWORD_DIALOG (dialog));
 
        priv = NMA_VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
-       if (priv->show_password_secondary)
+       if (gtk_widget_get_visible (priv->password_entry_secondary))
                gtk_widget_grab_focus (priv->password_entry_secondary);
 }
 
@@ -437,8 +271,8 @@ nma_vpn_password_dialog_focus_password_ternary (NMAVpnPasswordDialog *dialog)
        g_return_if_fail (NMA_VPN_IS_PASSWORD_DIALOG (dialog));
 
        priv = NMA_VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
-       if (priv->show_password_ternary)
-               gtk_widget_grab_focus (priv->password_entry_ternary);
+       if (gtk_widget_get_visible (priv->password_entry_tertiary))
+               gtk_widget_grab_focus (priv->password_entry_tertiary);
 }
 
 const char *
@@ -471,7 +305,7 @@ nma_vpn_password_dialog_get_password_ternary (NMAVpnPasswordDialog *dialog)
        g_return_val_if_fail (NMA_VPN_IS_PASSWORD_DIALOG (dialog), NULL);
 
        priv = NMA_VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
-       return gtk_entry_get_text (GTK_ENTRY (priv->password_entry_ternary));
+       return gtk_entry_get_text (GTK_ENTRY (priv->password_entry_tertiary));
 }
 
 void nma_vpn_password_dialog_set_password_label (NMAVpnPasswordDialog *dialog,
@@ -484,11 +318,7 @@ void nma_vpn_password_dialog_set_password_label (NMAVpnPasswordDialog *dialog,
 
        priv = NMA_VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
 
-       g_free (priv->primary_password_label);
-       priv->primary_password_label = g_strdup (label);
-
-       if (priv->show_password)
-               add_grid_rows (dialog);
+       gtk_label_set_text (GTK_LABEL (priv->password_label), label);
 }
 
 void nma_vpn_password_dialog_set_password_secondary_label (NMAVpnPasswordDialog *dialog,
@@ -501,11 +331,7 @@ void nma_vpn_password_dialog_set_password_secondary_label (NMAVpnPasswordDialog
 
        priv = NMA_VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
 
-       g_free (priv->secondary_password_label);
-       priv->secondary_password_label = g_strdup (label);
-
-       if (priv->show_password_secondary)
-               add_grid_rows (dialog);
+       gtk_label_set_text (GTK_LABEL (priv->password_label_secondary), label);
 }
 
 void
@@ -519,10 +345,6 @@ nma_vpn_password_dialog_set_password_ternary_label (NMAVpnPasswordDialog *dialog
 
        priv = NMA_VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
 
-       g_free (priv->ternary_password_label);
-       priv->ternary_password_label = g_strdup (label);
-
-       if (priv->show_password_ternary)
-               add_grid_rows (dialog);
+       gtk_label_set_text (GTK_LABEL (priv->password_label_tertiary), label);
 }
 
diff --git a/src/libnma/nma-vpn-password-dialog.ui b/src/libnma/nma-vpn-password-dialog.ui
new file mode 100644
index 0000000..9b63dcc
--- /dev/null
+++ b/src/libnma/nma-vpn-password-dialog.ui
@@ -0,0 +1,226 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.2 -->
+<interface>
+  <requires lib="gtk+" version="3.20"/>
+  <template class="NMAVpnPasswordDialog" parent="GtkDialog">
+    <property name="can_focus">False</property>
+    <property name="resizable">False</property>
+    <property name="modal">True</property>
+    <property name="window_position">center</property>
+    <property name="type_hint">dialog</property>
+    <signal name="close" handler="dialog_close_callback" swapped="no"/>
+    <signal name="show" handler="dialog_show_callback" swapped="no"/>
+    <child internal-child="vbox">
+      <object class="GtkBox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox">
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkButton" id="cancel_button">
+                <property name="label" translatable="yes">_Cancel</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="valign">baseline</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="ok_button">
+                <property name="label" translatable="yes">_OK</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="valign">baseline</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkGrid">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="margin_left">12</property>
+            <property name="margin_right">12</property>
+            <property name="margin_top">12</property>
+            <property name="margin_bottom">12</property>
+            <property name="row_spacing">6</property>
+            <property name="column_spacing">12</property>
+            <child>
+              <object class="GtkCheckButton" id="show_passwords_checkbox">
+                <property name="label" translatable="yes">Sh_ow passwords</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_underline">True</property>
+                <property name="xalign">0</property>
+                <property name="draw_indicator">True</property>
+                <signal name="toggled" handler="show_passwords_toggled_cb" swapped="no"/>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="top_attach">4</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="password_entry_tertiary">
+                <property name="can_focus">True</property>
+                <property name="no_show_all">True</property>
+                <property name="visibility">False</property>
+                <property name="width_chars">20</property>
+                <signal name="activate" handler="gtk_window_activate_default" swapped="yes"/>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="top_attach">3</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="password_entry_secondary">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="no_show_all">True</property>
+                <property name="visibility">False</property>
+                <property name="width_chars">20</property>
+                <signal name="activate" handler="gtk_window_activate_default" swapped="yes"/>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="top_attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="password_entry">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="no_show_all">True</property>
+                <property name="visibility">False</property>
+                <property name="width_chars">20</property>
+                <signal name="activate" handler="gtk_window_activate_default" swapped="yes"/>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="password_label_tertiary">
+                <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
+                <property name="label" translatable="yes">_Tertiary Password:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">password_entry_tertiary</property>
+                <property name="xalign">0</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">3</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="password_label_secondary">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
+                <property name="label" translatable="yes">_Secondary Password:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">password_entry_secondary</property>
+                <property name="xalign">0</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="password_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
+                <property name="label" translatable="yes">_Password:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">password_entry</property>
+                <property name="xalign">0</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="message_label">
+                <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
+                <property name="halign">start</property>
+                <property name="margin_bottom">12</property>
+                <property name="hexpand">True</property>
+                <property name="wrap">True</property>
+                <property name="max_width_chars">35</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">0</property>
+                <property name="width">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkImage">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_left">6</property>
+                <property name="margin_right">12</property>
+                <property name="margin_top">6</property>
+                <property name="margin_bottom">6</property>
+                <property name="yalign">0</property>
+                <property name="icon_name">dialog-password</property>
+                <property name="icon_size">6</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+                <property name="height">5</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">cancel_button</action-widget>
+      <action-widget response="-5">ok_button</action-widget>
+    </action-widgets>
+    <child>
+      <placeholder/>
+    </child>
+  </template>
+</interface>
diff --git a/src/libnma/nma.gresource.xml b/src/libnma/nma.gresource.xml
index edda420..e5f803e 100644
--- a/src/libnma/nma.gresource.xml
+++ b/src/libnma/nma.gresource.xml
@@ -5,5 +5,6 @@
                <file preprocess="xml-stripblanks">nma-pkcs11-token-login-dialog.ui</file>
                <file preprocess="xml-stripblanks">nma-pkcs11-cert-chooser-dialog.ui</file>
                <file preprocess="xml-stripblanks">nma-mobile-wizard.ui</file>
+               <file preprocess="xml-stripblanks">nma-vpn-password-dialog.ui</file>
        </gresource>
 </gresources>


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