[network-manager-vpnc] auth-dialog: use a simplified password request dialog



commit cc8305ee20f46c5fe050acbe15ad021f83ef1dd5
Author: Dan Williams <dcbw redhat com>
Date:   Thu Jul 14 10:50:22 2011 -0500

    auth-dialog: use a simplified password request dialog
    
    Strip out all the stuff we don't care about (mainly the keyring
    remember stuff).

 auth-dialog/Makefile.am                            |    4 +-
 auth-dialog/main.c                                 |    3 +-
 ...two-password-dialog.c => vpn-password-dialog.c} |  120 ++++----------------
 ...two-password-dialog.h => vpn-password-dialog.h} |   61 ++++------
 po/POTFILES.in                                     |    2 +-
 5 files changed, 51 insertions(+), 139 deletions(-)
---
diff --git a/auth-dialog/Makefile.am b/auth-dialog/Makefile.am
index 08b7a76..d761f7b 100644
--- a/auth-dialog/Makefile.am
+++ b/auth-dialog/Makefile.am
@@ -16,8 +16,8 @@ nm_vpnc_auth_dialog_CPPFLAGS = \
 
 nm_vpnc_auth_dialog_SOURCES = \
 	main.c \
-	gnome-two-password-dialog.c \
-	gnome-two-password-dialog.h
+	vpn-password-dialog.c \
+	vpn-password-dialog.h
 
 nm_vpnc_auth_dialog_LDADD = \
 	$(GTK_LIBS) \
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index 38eed17..522a887 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -37,7 +37,7 @@
 #include <nm-vpn-plugin-utils.h>
 
 #include "src/nm-vpnc-service.h"
-#include "gnome-two-password-dialog.h"
+#include "vpn-password-dialog.h"
 
 #define VPNC_USER_PASSWORD "password"
 #define VPNC_GROUP_PASSWORD "group-password"
@@ -153,7 +153,6 @@ get_secrets (const char *vpn_uuid,
 	dialog = VPN_PASSWORD_DIALOG (vpn_password_dialog_new (_("Authenticate VPN"), prompt, NULL));
 	g_free (prompt);
 
-	vpn_password_dialog_set_show_remember (dialog, FALSE);
 	vpn_password_dialog_set_password_secondary_label (dialog, _("_Group Password:"));
 
 	/* Don't show the user password entry if the user password isn't required,
diff --git a/auth-dialog/gnome-two-password-dialog.c b/auth-dialog/vpn-password-dialog.c
similarity index 79%
rename from auth-dialog/gnome-two-password-dialog.c
rename to auth-dialog/vpn-password-dialog.c
index 5ef26f4..2206c7a 100644
--- a/auth-dialog/gnome-two-password-dialog.c
+++ b/auth-dialog/vpn-password-dialog.c
@@ -1,28 +1,29 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* gnome-password-dialog.c - A use password prompting dialog widget.
-
-   Copyright (C) 1999, 2000 Eazel, Inc.
-
-   The Gnome Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the ree Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   The Gnome Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, write to the Free Software Foundation, Inc.,
-   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-   Authors: Ramiro Estrugo <ramiro eazel com>
-*/
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* vpn-password-dialog.c - A use password prompting dialog widget.
+ *
+ * The Gnome Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the ree Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * The Gnome Library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 1999, 2000 Eazel, Inc.
+ * Copyright (C) 2011 Red Hat, Inc.
+ *
+ * Authors: Ramiro Estrugo <ramiro eazel com>
+ *          Dan Williams <dcbw redhat com>
+ */
 
 #include <config.h>
-#include "gnome-two-password-dialog.h"
+#include "vpn-password-dialog.h"
 #include <gnome-keyring-memory.h>
 
 #include <glib/gi18n.h>
@@ -40,10 +41,6 @@ typedef struct {
 	/* Attributes */
 	gboolean show_password;
 	gboolean show_password_secondary;
-	
-	/* TODO: */
-	gboolean remember;
-	char *remember_label_text;
 
 	/* Internal widgetry and flags */
 	GtkWidget *password_entry;
@@ -53,9 +50,6 @@ typedef struct {
 	GtkWidget *table_alignment;
 	GtkWidget *table;
 	GtkSizeGroup *group;
-	
-	GtkWidget *remember_session_button;
-	GtkWidget *remember_forever_button;
 
 	char *secondary_password_label;
 } VpnPasswordDialogPrivate;
@@ -77,7 +71,6 @@ finalize (GObject *object)
 	g_object_unref (priv->password_entry_secondary);
 	g_object_unref (priv->group);
 
-	g_free (priv->remember_label_text);
 	g_free (priv->secondary_password_label);
 
 	G_OBJECT_CLASS (vpn_password_dialog_parent_class)->finalize (object);
@@ -303,12 +296,6 @@ vpn_password_dialog_new (const char *title,
 	gtk_box_pack_start (content, hbox, FALSE, FALSE, 0);
 	gtk_widget_show_all (GTK_WIDGET (content));
 
-	priv->remember_session_button = gtk_check_button_new_with_mnemonic (_("_Remember passwords for this session"));
-	priv->remember_forever_button = gtk_check_button_new_with_mnemonic (_("_Save passwords in keyring"));
-
-	gtk_box_pack_start (GTK_BOX (vbox), priv->remember_session_button, FALSE, FALSE, 0);
-	gtk_box_pack_start (GTK_BOX (vbox), priv->remember_forever_button, FALSE, FALSE, 0);
-
 	vpn_password_dialog_set_password (VPN_PASSWORD_DIALOG (dialog), password);
 	
 	return GTK_WIDGET (dialog);
@@ -436,65 +423,6 @@ vpn_password_dialog_get_password_secondary (VpnPasswordDialog *dialog)
 	return gtk_entry_get_text (GTK_ENTRY (priv->password_entry_secondary));
 }
 
-void
-vpn_password_dialog_set_show_remember (VpnPasswordDialog *dialog,
-                                       gboolean show_remember)
-{
-	VpnPasswordDialogPrivate *priv;
-
-	g_return_if_fail (VPN_IS_PASSWORD_DIALOG (dialog));
-
-	priv = VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
-	if (show_remember) {
-		gtk_widget_show (priv->remember_session_button);
-		gtk_widget_show (priv->remember_forever_button);
-	} else {
-		gtk_widget_hide (priv->remember_session_button);
-		gtk_widget_hide (priv->remember_forever_button);
-	}
-}
-
-void
-vpn_password_dialog_set_remember (VpnPasswordDialog *dialog,
-                                  VpnPasswordRemember remember)
-{
-	VpnPasswordDialogPrivate *priv;
-	gboolean session = FALSE, forever = FALSE;
-
-	g_return_if_fail (VPN_IS_PASSWORD_DIALOG (dialog));
-
-	priv = VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
-
-	if (remember == VPN_PASSWORD_REMEMBER_SESSION)
-		session = TRUE;
-	else if (remember == VPN_PASSWORD_REMEMBER_FOREVER)
-		forever = TRUE;
-
-	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->remember_session_button), session);
-	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->remember_forever_button), forever);
-}
-
-VpnPasswordRemember
-vpn_password_dialog_get_remember (VpnPasswordDialog *dialog)
-{
-	VpnPasswordDialogPrivate *priv;
-	gboolean session, forever;
-
-	g_return_val_if_fail (dialog != NULL, VPN_PASSWORD_REMEMBER_NOTHING);
-	g_return_val_if_fail (VPN_IS_PASSWORD_DIALOG (dialog), VPN_PASSWORD_REMEMBER_NOTHING);
-
-	priv = VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
-
-	session = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->remember_session_button));
-	forever = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->remember_forever_button));
-	if (forever)
-		return VPN_PASSWORD_REMEMBER_FOREVER;
-	else if (session)
-		return VPN_PASSWORD_REMEMBER_SESSION;
-
-	return VPN_PASSWORD_REMEMBER_NOTHING;
-}
-
 void vpn_password_dialog_set_password_secondary_label (VpnPasswordDialog *dialog,
                                                        const char *label)
 {
diff --git a/auth-dialog/gnome-two-password-dialog.h b/auth-dialog/vpn-password-dialog.h
similarity index 60%
rename from auth-dialog/gnome-two-password-dialog.h
rename to auth-dialog/vpn-password-dialog.h
index 28109fb..d4b4099 100644
--- a/auth-dialog/gnome-two-password-dialog.h
+++ b/auth-dialog/vpn-password-dialog.h
@@ -1,28 +1,26 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* gnome-two-password-dialog.h - A use password prompting dialog widget
-                                 asking for two passwords. Based of
-                                 gnome-password-dialog.[ch] from libgnomeui
-
-   Copyright (C) 1999, 2000 Eazel, Inc.
-   Copyright (C) 2005, Red Hat, Inc.
-
-   The Gnome Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   The Gnome Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, write to the Free Software Foundation, Inc.,
-   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-   Authors: Ramiro Estrugo <ramiro eazel com>
-*/
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* vpn-password-dialog.c - A use password prompting dialog widget.
+ *
+ * The Gnome Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the ree Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * The Gnome Library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 1999, 2000 Eazel, Inc.
+ * Copyright (C) 2011 Red Hat, Inc.
+ *
+ * Authors: Ramiro Estrugo <ramiro eazel com>
+ *          Dan Williams <dcbw redhat com>
+ */
 
 #ifndef VPN_PASSWORD_DIALOG_H
 #define VPN_PASSWORD_DIALOG_H
@@ -48,12 +46,6 @@ struct VpnPasswordDialogClass {
 	GtkDialogClass parent_class;
 };
 
-typedef enum {
-	VPN_PASSWORD_REMEMBER_NOTHING,
-	VPN_PASSWORD_REMEMBER_SESSION,
-	VPN_PASSWORD_REMEMBER_FOREVER
-} VpnPasswordRemember;
-
 
 GType      vpn_password_dialog_get_type              (void);
 GtkWidget* vpn_password_dialog_new                   (const char *title,
@@ -76,13 +68,6 @@ void vpn_password_dialog_set_password_secondary       (VpnPasswordDialog *dialog
                                                        const char *password_secondary);
 void vpn_password_dialog_set_password_secondary_label (VpnPasswordDialog *dialog,
                                                        const char *label);
-
-void vpn_password_dialog_set_show_remember            (VpnPasswordDialog *dialog,
-                                                       gboolean show_remember);
-void vpn_password_dialog_set_remember                 (VpnPasswordDialog *dialog,
-                                                       VpnPasswordRemember remember);
-VpnPasswordRemember vpn_password_dialog_get_remember  (VpnPasswordDialog *dialog);
-
 /* Attribute accessors */
 const char *vpn_password_dialog_get_password                (VpnPasswordDialog *dialog);
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index fe56c6a..10845b9 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,6 +1,6 @@
 # List of source files containing translatable strings.
 # Please keep this file sorted alphabetically.
-auth-dialog/gnome-two-password-dialog.c
+auth-dialog/vpn-password-dialog.c
 auth-dialog/main.c
 auth-dialog/nm-vpnc-auth-dialog.desktop.in.in
 nm-vpnc.desktop.in



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