[network-manager-openvpn] auth-dialog: port to libnm-gtk's NMAVpnPasswordDialog



commit 5a48eaa9f4b7f4dbdbbd37efd22afe816e0853e2
Author: Dan Winship <danw gnome org>
Date:   Tue Feb 26 14:49:47 2013 +0100

    auth-dialog: port to libnm-gtk's NMAVpnPasswordDialog
    
    https://bugzilla.gnome.org/show_bug.cgi?id=697740

 auth-dialog/Makefile.am           |    6 +-
 auth-dialog/main.c                |   30 ++--
 auth-dialog/vpn-password-dialog.c |  446 -------------------------------------
 auth-dialog/vpn-password-dialog.h |   79 -------
 configure.ac                      |    4 +
 5 files changed, 22 insertions(+), 543 deletions(-)
---
diff --git a/auth-dialog/Makefile.am b/auth-dialog/Makefile.am
index a10ff34..fa3a3c2 100644
--- a/auth-dialog/Makefile.am
+++ b/auth-dialog/Makefile.am
@@ -4,6 +4,7 @@ nm_openvpn_auth_dialog_CPPFLAGS =                       \
        $(GLIB_CFLAGS)                  \
        $(GTK_CFLAGS)                           \
        $(NM_CFLAGS)            \
+       $(NMGTK_CFLAGS)         \
        $(GNOMEKEYRING_CFLAGS) \
        -I$(top_srcdir)/
        -DICONDIR=\""$(datadir)/pixmaps"\"      \
@@ -16,13 +17,12 @@ nm_openvpn_auth_dialog_CPPFLAGS =                   \
        -DVERSION=\"$(VERSION)\"
 
 nm_openvpn_auth_dialog_SOURCES = \
-       main.c \
-       vpn-password-dialog.c \
-       vpn-password-dialog.h
+       main.c
 
 nm_openvpn_auth_dialog_LDADD = \
        $(GTK_LIBS) \
        $(NM_LIBS) \
+       $(NMGTK_LIBS) \
        $(GNOMEKEYRING_LIBS) \
        $(top_builddir)/common/libnm-openvpn-common.la
 
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index d0fa110..77f8cc4 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -36,10 +36,10 @@
 #include <nm-setting-vpn.h>
 #include <nm-setting-connection.h>
 #include <nm-vpn-plugin-utils.h>
+#include <nm-vpn-password-dialog.h>
 
 #include "common/utils.h"
 #include "src/nm-openvpn-service.h"
-#include "vpn-password-dialog.h"
 
 #define KEYRING_UUID_TAG "connection-uuid"
 #define KEYRING_SN_TAG "setting-name"
@@ -118,7 +118,7 @@ get_secrets (const char *vpn_name,
              NMSettingSecretFlags cp_flags,
              char **out_certpass)
 {
-       VpnPasswordDialog *dialog;
+       NMAVpnPasswordDialog *dialog;
        char *prompt, *password = NULL, *certpass = NULL;
        gboolean success = FALSE, need_secret = FALSE;
 
@@ -184,42 +184,42 @@ get_secrets (const char *vpn_name,
                return TRUE;
        }
 
-       dialog = VPN_PASSWORD_DIALOG (vpn_password_dialog_new (_("Authenticate VPN"), prompt, NULL));
+       dialog = NMA_VPN_PASSWORD_DIALOG (nma_vpn_password_dialog_new (_("Authenticate VPN"), prompt, NULL));
 
        /* pre-fill dialog with the password */
        if (need_password && need_certpass) {
-               vpn_password_dialog_set_show_password_secondary (dialog, TRUE);
-               vpn_password_dialog_set_password_secondary_label (dialog, _("Certificate pass_word:") );
+               nma_vpn_password_dialog_set_show_password_secondary (dialog, TRUE);
+               nma_vpn_password_dialog_set_password_secondary_label (dialog, _("Certificate pass_word:") );
 
                /* if retrying, put in the passwords from the keyring */
                if (password)
-                       vpn_password_dialog_set_password (dialog, password);
+                       nma_vpn_password_dialog_set_password (dialog, password);
                if (certpass)
-                       vpn_password_dialog_set_password_secondary (dialog, certpass);
+                       nma_vpn_password_dialog_set_password_secondary (dialog, certpass);
        } else {
-               vpn_password_dialog_set_show_password_secondary (dialog, FALSE);
+               nma_vpn_password_dialog_set_show_password_secondary (dialog, FALSE);
                if (need_password) {
                        /* if retrying, put in the passwords from the keyring */
                        if (password)
-                               vpn_password_dialog_set_password (dialog, password);
+                               nma_vpn_password_dialog_set_password (dialog, password);
                } else if (need_certpass) {
-                       vpn_password_dialog_set_password_label (dialog, _("Certificate password:"));
+                       nma_vpn_password_dialog_set_password_label (dialog, _("Certificate password:"));
                        /* if retrying, put in the passwords from the keyring */
                        if (certpass)
-                               vpn_password_dialog_set_password (dialog, certpass);
+                               nma_vpn_password_dialog_set_password (dialog, certpass);
                }
        }
 
        gtk_widget_show (GTK_WIDGET (dialog));
 
-       if (vpn_password_dialog_run_and_block (dialog)) {
+       if (nma_vpn_password_dialog_run_and_block (dialog)) {
                if (need_password)
-                       *out_password = gnome_keyring_memory_strdup (vpn_password_dialog_get_password 
(dialog));
+                       *out_password = gnome_keyring_memory_strdup (nma_vpn_password_dialog_get_password 
(dialog));
                if (need_certpass) {
                        if (need_password)
-                               *out_certpass = gnome_keyring_memory_strdup 
(vpn_password_dialog_get_password_secondary (dialog));
+                               *out_certpass = gnome_keyring_memory_strdup 
(nma_vpn_password_dialog_get_password_secondary (dialog));
                        else
-                               *out_certpass = gnome_keyring_memory_strdup (vpn_password_dialog_get_password 
(dialog));
+                               *out_certpass = gnome_keyring_memory_strdup 
(nma_vpn_password_dialog_get_password (dialog));
                }
 
                success = TRUE;
diff --git a/configure.ac b/configure.ac
index b3494f8..e7ff28b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,6 +80,10 @@ if test x"$with_gnome" != xno; then
        AC_SUBST(GTK_LIBS)
        GTK_CFLAGS="$GTK_CFLAGS -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_4"
 
+       PKG_CHECK_MODULES(NMGTK, libnm-gtk >= 0.9.9.0)
+       AC_SUBST(NMGTK_CFLAGS)
+       AC_SUBST(NMGTK_LIBS)
+
        PKG_CHECK_MODULES(GNOMEKEYRING, gnome-keyring-1)
        AC_SUBST(GNOMEKEYRING_CFLAGS)
        AC_SUBST(GNOMEKEYRING_LIBS)


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