[PATCH] Remove libgnomeui dependency from NM-pptp



Reduce list of dependencies by porting auth_dialog to plain gtk/gconf.

Patch attached.
-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

From 1fdd75f4d0bd7fdc7b2b450d07620cd51dc609b9 Mon Sep 17 00:00:00 2001
From: Michael Biebl <biebl debian org>
Date: Thu, 18 Dec 2008 03:03:26 +0100
Subject: [PATCH] Remove libgnomeui dependency. Use plain gtk/gconf.

---
 auth-dialog/Makefile.am |    4 ++--
 auth-dialog/main.c      |   25 ++++++++++---------------
 configure.in            |    4 ----
 3 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/auth-dialog/Makefile.am b/auth-dialog/Makefile.am
index 28aaf7f..f1e5401 100644
--- a/auth-dialog/Makefile.am
+++ b/auth-dialog/Makefile.am
@@ -6,7 +6,7 @@ nm_pptp_auth_dialog_CPPFLAGS =			\
 	$(NM_UTILS_CFLAGS)			\
 	$(GTHREAD_CFLAGS)			\
 	$(GTK_CFLAGS)				\
-	$(LIBGNOMEUI_CFLAGS)			\
+	$(GCONF_CFLAGS)				\
 	$(GNOMEKEYRING_CFLAGS)			\
 	-DICONDIR=\""$(datadir)/pixmaps"\"	\
 	-DGLADEDIR=\""$(gladedir)"\"		\
@@ -27,7 +27,7 @@ nm_pptp_auth_dialog_SOURCES =			\
 
 nm_pptp_auth_dialog_LDADD =			\
 	$(GTK_LIBS)				\
-	$(LIBGNOMEUI_LIBS)			\
+	$(GCONF_LIBS)				\
 	$(top_builddir)/common-gnome/libnm-pptp-common-gnome.la  \
 	$(NULL)
 
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index 6662f24..7b4e9a9 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -25,9 +25,9 @@
 #endif
 
 #include <string.h>
+#include <stdlib.h>
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
-#include <libgnomeui/libgnomeui.h>
 
 #include <nm-setting-vpn.h>
 
@@ -128,9 +128,8 @@ main (int argc, char *argv[])
 	gchar *vpn_service = NULL;
 	char *password = NULL;
 	char buf[1];
-	int ret, exit_status = 1;
+	int ret;
 	GOptionContext *context;
-	GnomeProgram *program;
 	GOptionEntry entries[] = {
 			{ "reprompt", 'r', 0, G_OPTION_ARG_NONE, &retry, "Reprompt for passwords", NULL},
 			{ "uuid", 'u', 0, G_OPTION_ARG_STRING, &vpn_uuid, "UUID of VPN connection", NULL},
@@ -143,27 +142,26 @@ main (int argc, char *argv[])
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 	textdomain (GETTEXT_PACKAGE);
 
+	gtk_init (&argc, &argv);
+
 	context = g_option_context_new ("- pptp auth dialog");
 	g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
+	g_option_context_parse (context, &argc, &argv, NULL);
+	g_option_context_free (context);
 
-	program = gnome_program_init ("nm-pptp-auth-dialog", VERSION,
-				      LIBGNOMEUI_MODULE,
-				      argc, argv,
-				      GNOME_PARAM_GOPTION_CONTEXT, context,
-				      GNOME_PARAM_NONE);
 
 	if (vpn_uuid == NULL || vpn_name == NULL || vpn_service == NULL) {
 		fprintf (stderr, "Have to supply UUID, name, and service\n");
-		goto out;
+		return EXIT_FAILURE;
 	}
 
 	if (strcmp (vpn_service, NM_DBUS_SERVICE_PPTP) != 0) {
 		fprintf (stderr, "This dialog only works with the '%s' service\n", NM_DBUS_SERVICE_PPTP);
-		goto out;		
+		return EXIT_FAILURE;
 	}
 
 	if (!get_secrets (vpn_uuid, vpn_name, vpn_service, retry, &password))
-		goto out;
+		return EXIT_FAILURE;
 
 	/* dump the passwords to stdout */
 	printf ("%s\n%s\n", NM_PPTP_KEY_PASSWORD, password);
@@ -173,7 +171,6 @@ main (int argc, char *argv[])
 		memset (password, 0, strlen (password));
 		gnome_keyring_memory_free (password);
 	}
-	exit_status = 0;
 
 	/* for good measure, flush stdout since Kansas is going Bye-Bye */
 	fflush (stdout);
@@ -181,7 +178,5 @@ main (int argc, char *argv[])
 	/* wait for data on stdin  */
 	ret = fread (buf, sizeof (char), sizeof (buf), stdin);
 
-out:
-	g_object_unref (program);
-	return exit_status;
+	return EXIT_SUCCESS;
 }
diff --git a/configure.in b/configure.in
index 85719e4..174372e 100644
--- a/configure.in
+++ b/configure.in
@@ -85,10 +85,6 @@ if test x"$with_gnome" != xno; then
 	AC_SUBST(GLADE_CFLAGS)
 	AC_SUBST(GLADE_LIBS)
 
-	PKG_CHECK_MODULES(LIBGNOMEUI, libgnomeui-2.0)
-	AC_SUBST(LIBGNOMEUI_CFLAGS)
-	AC_SUBST(LIBGNOMEUI_LIBS)
-
 	PKG_CHECK_MODULES(GCONF, gconf-2.0)
 	AC_SUBST(GCONF_CFLAGS)
 	AC_SUBST(GCONF_LIBS)
-- 
1.6.0.4

Attachment: signature.asc
Description: OpenPGP digital signature



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