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



commit 748910ab3d839732b0f355e4cc8a33c29dc14ca2
Author: Dan Winship <danw gnome org>
Date:   Tue Feb 26 14:44:46 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 |  425 -------------------------------------
 auth-dialog/vpn-password-dialog.h |   78 -------
 configure.ac                      |    4 +
 5 files changed, 22 insertions(+), 521 deletions(-)
---
diff --git a/auth-dialog/Makefile.am b/auth-dialog/Makefile.am
index b2296d1..ab2321b 100644
--- a/auth-dialog/Makefile.am
+++ b/auth-dialog/Makefile.am
@@ -6,6 +6,7 @@ nm_openswan_auth_dialog_CPPFLAGS = \
        $(GLIB_CFLAGS) \
        $(NM_CFLAGS) \
        $(GTK_CFLAGS) \
+       $(NMGTK_CFLAGS) \
        $(GNOMEKEYRING_CFLAGS) \
        -DICONDIR=\""$(datadir)/pixmaps"\" \
        -DBINDIR=\""$(bindir)"\" \
@@ -14,13 +15,12 @@ nm_openswan_auth_dialog_CPPFLAGS = \
        -DVERSION=\"$(VERSION)\"
 
 nm_openswan_auth_dialog_SOURCES = \
-       main.c \
-       vpn-password-dialog.c \
-       vpn-password-dialog.h
+       main.c
 
 nm_openswan_auth_dialog_LDADD = \
        $(NM_LIBS) \
        $(GTK_LIBS) \
+       $(NMGTK_LIBS) \
        $(GNOMEKEYRING_LIBS)
 
 CLEANFILES = *~
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index eebb522..f569e7b 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -35,9 +35,9 @@
 #include <nm-setting-vpn.h>
 #include <nm-setting-connection.h>
 #include <nm-vpn-plugin-utils.h>
+#include <nm-vpn-password-dialog.h>
 
 #include "src/nm-openswan-service.h"
-#include "vpn-password-dialog.h"
 
 #define KEYRING_UUID_TAG "connection-uuid"
 #define KEYRING_SN_TAG "setting-name"
@@ -114,7 +114,7 @@ get_secrets (const char *vpn_uuid,
              char **out_gpw,
              NMSettingSecretFlags gpw_flags)
 {
-       VpnPasswordDialog *dialog;
+       NMAVpnPasswordDialog *dialog;
        char *upw = NULL, *gpw = NULL;
        char *prompt;
        gboolean success = FALSE;
@@ -204,45 +204,45 @@ get_secrets (const char *vpn_uuid,
                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));
 
-       vpn_password_dialog_set_password_secondary_label (dialog, _("_Group Password:"));
+       nma_vpn_password_dialog_set_password_secondary_label (dialog, _("_Group Password:"));
 
        /* Don't show the user password entry if the user password isn't required,
         * or if we don't need new secrets and the user password is saved.
         */
        if (upw_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED)
-               vpn_password_dialog_set_show_password (dialog, FALSE);
+               nma_vpn_password_dialog_set_show_password (dialog, FALSE);
        else if (!retry && upw && !(upw_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED))
-               vpn_password_dialog_set_show_password (dialog, FALSE);
+               nma_vpn_password_dialog_set_show_password (dialog, FALSE);
 
        if (gpw_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED)
-               vpn_password_dialog_set_show_password_secondary (dialog, FALSE);
+               nma_vpn_password_dialog_set_show_password_secondary (dialog, FALSE);
        else if (!retry && gpw && !(gpw_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED))
-               vpn_password_dialog_set_show_password_secondary (dialog, FALSE);
+               nma_vpn_password_dialog_set_show_password_secondary (dialog, FALSE);
 
        /* On reprompt the first entry of type 'ask' gets the focus */
        if (retry) {
                if (upw_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED)
-                       vpn_password_dialog_focus_password (dialog);
+                       nma_vpn_password_dialog_focus_password (dialog);
                else if (gpw_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED)
-                       vpn_password_dialog_focus_password_secondary (dialog);
+                       nma_vpn_password_dialog_focus_password_secondary (dialog);
        }
 
        /* if retrying, pre-fill dialog with the password */
        if (upw)
-               vpn_password_dialog_set_password (dialog, upw);
+               nma_vpn_password_dialog_set_password (dialog, upw);
 
        if (gpw)
-               vpn_password_dialog_set_password_secondary (dialog, gpw);
+               nma_vpn_password_dialog_set_password_secondary (dialog, gpw);
 
        gtk_widget_show (GTK_WIDGET (dialog));
 
        /* Show the dialog */
-       success = vpn_password_dialog_run_and_block (dialog);
+       success = nma_vpn_password_dialog_run_and_block (dialog);
        if (success) {
-               *out_upw = gnome_keyring_memory_strdup (vpn_password_dialog_get_password (dialog));
-               *out_gpw = gnome_keyring_memory_strdup (vpn_password_dialog_get_password_secondary (dialog));
+               *out_upw = gnome_keyring_memory_strdup (nma_vpn_password_dialog_get_password (dialog));
+               *out_gpw = gnome_keyring_memory_strdup (nma_vpn_password_dialog_get_password_secondary 
(dialog));
        }
 
        gtk_widget_hide (GTK_WIDGET (dialog));
diff --git a/configure.ac b/configure.ac
index 6fdaac6..fe57f12 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]