Migrated NM frontend plugin to NetworkManager 0.9
Use GtkBuilder, drop gconf dependency.
This commit is contained in:
@@ -7,11 +7,7 @@ nm_strongswan_auth_dialog_CPPFLAGS = \
|
||||
$(GNOMEKEYRING_CFLAGS) \
|
||||
$(NETWORK_MANAGER_CFLAGS) \
|
||||
$(NM_UTILS_CFLAGS) \
|
||||
-DICONDIR=\""$(datadir)/pixmaps"\" \
|
||||
-DGLADEDIR=\""$(gladedir)"\" \
|
||||
-DBINDIR=\""$(bindir)"\" \
|
||||
-DG_DISABLE_DEPRECATED \
|
||||
-DGDK_DISABLE_DEPRECATED \
|
||||
-DGNOME_DISABLE_DEPRECATED \
|
||||
-DGNOMELOCALEDIR=\"$(datadir)/locale\" \
|
||||
-DVERSION=\"$(VERSION)\"
|
||||
@@ -22,5 +18,6 @@ nm_strongswan_auth_dialog_SOURCES = \
|
||||
nm_strongswan_auth_dialog_LDADD = \
|
||||
$(GTK_LIBS) \
|
||||
$(LIBGNOMEUI_LIBS) \
|
||||
$(GNOMEKEYRING_LIBS)
|
||||
$(GNOMEKEYRING_LIBS) \
|
||||
$(NM_UTILS_LIBS)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Martin Willi
|
||||
* Copyright (C) 2008-2011 Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
* Copyright (C) 2004 Dan Williams
|
||||
* Red Hat, Inc.
|
||||
@@ -24,10 +24,10 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <gnome-keyring.h>
|
||||
#include <libgnomeui/libgnomeui.h>
|
||||
#include <gconf/gconf-client.h>
|
||||
#include <nm-vpn-plugin.h>
|
||||
#include <nm-setting-vpn.h>
|
||||
#include <nm-setting-connection.h>
|
||||
#include <nm-vpn-plugin-utils.h>
|
||||
|
||||
#define NM_DBUS_SERVICE_STRONGSWAN "org.freedesktop.NetworkManager.strongswan"
|
||||
|
||||
@@ -60,63 +60,64 @@ static char *lookup_password(char *name, char *service)
|
||||
return pass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for quit input
|
||||
*/
|
||||
static void wait_for_quit (void)
|
||||
{
|
||||
GString *str;
|
||||
char c;
|
||||
ssize_t n;
|
||||
time_t start;
|
||||
|
||||
str = g_string_sized_new (10);
|
||||
start = time (NULL);
|
||||
do {
|
||||
errno = 0;
|
||||
n = read (0, &c, 1);
|
||||
if (n == 0 || (n < 0 && errno == EAGAIN))
|
||||
g_usleep (G_USEC_PER_SEC / 10);
|
||||
else if (n == 1) {
|
||||
g_string_append_c (str, c);
|
||||
if (strstr (str->str, "QUIT") || (str->len > 10))
|
||||
break;
|
||||
} else
|
||||
break;
|
||||
} while (time (NULL) < start + 20);
|
||||
g_string_free (str, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the connection type
|
||||
*/
|
||||
static char* get_connection_type(char *uuid)
|
||||
{
|
||||
GConfClient *client = NULL;
|
||||
GSList *list;
|
||||
GSList *iter;
|
||||
char *key, *str, *path, *found = NULL, *method = NULL;
|
||||
GHashTable *data = NULL, *secrets = NULL;
|
||||
char *method;
|
||||
|
||||
client = gconf_client_get_default();
|
||||
|
||||
list = gconf_client_all_dirs(client, "/system/networking/connections", NULL);
|
||||
g_return_val_if_fail(list, NULL);
|
||||
|
||||
for (iter = list; iter; iter = iter->next)
|
||||
{
|
||||
path = (char *) iter->data;
|
||||
|
||||
key = g_strdup_printf("%s/%s/%s", path,
|
||||
NM_SETTING_CONNECTION_SETTING_NAME,
|
||||
NM_SETTING_CONNECTION_UUID);
|
||||
str = gconf_client_get_string(client, key, NULL);
|
||||
g_free (key);
|
||||
|
||||
if (str && !strcmp(str, uuid))
|
||||
{
|
||||
found = g_strdup(path);
|
||||
}
|
||||
g_free (str);
|
||||
if (found)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (!nm_vpn_plugin_utils_read_vpn_details (0, &data, &secrets)) {
|
||||
fprintf (stderr, "Failed to read data and secrets from stdin.\n");
|
||||
return NULL;
|
||||
}
|
||||
g_slist_foreach(list, (GFunc)g_free, NULL);
|
||||
g_slist_free(list);
|
||||
|
||||
method = g_hash_table_lookup (data, "method");
|
||||
if (method)
|
||||
method = g_strdup(method);
|
||||
|
||||
if (data)
|
||||
g_hash_table_unref (data);
|
||||
if (secrets)
|
||||
g_hash_table_unref (secrets);
|
||||
|
||||
if (found)
|
||||
{
|
||||
key = g_strdup_printf ("%s/%s/%s", found,
|
||||
NM_SETTING_VPN_SETTING_NAME, "method");
|
||||
method = gconf_client_get_string(client, key, NULL);
|
||||
g_free(found);
|
||||
g_free(key);
|
||||
}
|
||||
g_object_unref(client);
|
||||
return method;
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
gboolean retry = FALSE;
|
||||
gboolean retry = FALSE, allow_interaction = FALSE;
|
||||
gchar *name = NULL, *uuid = NULL, *service = NULL, *keyring = NULL, *pass;
|
||||
GOptionContext *context;
|
||||
GnomeProgram *program = NULL;
|
||||
char buf, *agent, *type;
|
||||
char *agent, *type;
|
||||
guint32 itemid;
|
||||
GtkWidget *dialog;
|
||||
GOptionEntry entries[] = {
|
||||
@@ -124,6 +125,7 @@ int main (int argc, char *argv[])
|
||||
{ "uuid", 'u', 0, G_OPTION_ARG_STRING, &uuid, "UUID of VPN connection", NULL},
|
||||
{ "name", 'n', 0, G_OPTION_ARG_STRING, &name, "Name of VPN connection", NULL},
|
||||
{ "service", 's', 0, G_OPTION_ARG_STRING, &service, "VPN service type", NULL},
|
||||
{ "allow-interaction", 'i', 0, G_OPTION_ARG_NONE, &allow_interaction, "Allow user interaction", NULL},
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@@ -131,19 +133,16 @@ int main (int argc, char *argv[])
|
||||
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
|
||||
textdomain(GETTEXT_PACKAGE);
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
context = g_option_context_new ("- strongswan auth dialog");
|
||||
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
|
||||
|
||||
program = gnome_program_init ("nm-strongswan-auth-dialog", VERSION,
|
||||
LIBGNOMEUI_MODULE,
|
||||
argc, argv,
|
||||
GNOME_PARAM_GOPTION_CONTEXT, context,
|
||||
GNOME_PARAM_NONE);
|
||||
g_option_context_parse (context, &argc, &argv, NULL);
|
||||
g_option_context_free (context);
|
||||
|
||||
if (uuid == NULL || name == NULL || service == NULL)
|
||||
{
|
||||
fprintf (stderr, "Have to supply UUID, name, and service\n");
|
||||
g_object_unref (program);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -151,7 +150,6 @@ int main (int argc, char *argv[])
|
||||
{
|
||||
fprintf(stderr, "This dialog only works with the '%s' service\n",
|
||||
NM_DBUS_SERVICE_STRONGSWAN);
|
||||
g_object_unref (program);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -159,13 +157,12 @@ int main (int argc, char *argv[])
|
||||
if (!type)
|
||||
{
|
||||
fprintf(stderr, "Connection lookup failed\n");
|
||||
g_object_unref (program);
|
||||
return 1;
|
||||
}
|
||||
if (!strcmp(type, "eap") || !strcmp(type, "key") || !strcmp(type, "smartcard"))
|
||||
{
|
||||
pass = lookup_password(name, service);
|
||||
if (!pass || retry)
|
||||
if ((!pass || retry) && allow_interaction)
|
||||
{
|
||||
if (!strcmp(type, "eap"))
|
||||
{
|
||||
@@ -195,7 +192,6 @@ int main (int argc, char *argv[])
|
||||
}
|
||||
if (!gnome_password_dialog_run_and_block(GNOME_PASSWORD_DIALOG(dialog)))
|
||||
{
|
||||
g_object_unref (program);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -217,7 +213,10 @@ int main (int argc, char *argv[])
|
||||
break;
|
||||
}
|
||||
}
|
||||
printf("password\n%s\n", pass);
|
||||
if (pass)
|
||||
{
|
||||
printf("password\n%s\n", pass);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -228,20 +227,21 @@ int main (int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_OK,
|
||||
_("Configuration uses ssh-agent for authentication, "
|
||||
"but ssh-agent is not running!"));
|
||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
return 1;
|
||||
if (allow_interaction)
|
||||
{
|
||||
dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_OK,
|
||||
_("Configuration uses ssh-agent for authentication, "
|
||||
"but ssh-agent is not running!"));
|
||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("\n\n");
|
||||
/* flush output, wait for input */
|
||||
fflush(stdout);
|
||||
if (fread(&buf, 1, sizeof(buf), stdin));
|
||||
g_object_unref(program);
|
||||
wait_for_quit ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
AC_PREREQ(2.52)
|
||||
|
||||
AC_INIT(NetworkManager-strongswan, 1.2.0, [email protected], NetworkManager-strongswan)
|
||||
AC_INIT(NetworkManager-strongswan, 1.3.0, [email protected], NetworkManager-strongswan)
|
||||
AM_INIT_AUTOMAKE([subdir-objects])
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
@@ -50,35 +50,21 @@ PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.30)
|
||||
AC_SUBST(DBUS_CFLAGS)
|
||||
AC_SUBST(DBUS_LIBS)
|
||||
|
||||
if test x"$with_gnome" != xno; then
|
||||
PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6)
|
||||
AC_SUBST(GTK_CFLAGS)
|
||||
AC_SUBST(GTK_LIBS)
|
||||
PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6)
|
||||
AC_SUBST(GTK_CFLAGS)
|
||||
AC_SUBST(GTK_LIBS)
|
||||
|
||||
PKG_CHECK_MODULES(GDK_PIXBUF, gdk-pixbuf-2.0)
|
||||
AC_SUBST(GDK_PIXBUF_CFLAGS)
|
||||
AC_SUBST(GDK_PIXBUF_LIBS)
|
||||
PKG_CHECK_MODULES(LIBGNOMEUI, libgnomeui-2.0)
|
||||
AC_SUBST(LIBGNOMEUI_CFLAGS)
|
||||
AC_SUBST(LIBGNOMEUI_LIBS)
|
||||
|
||||
PKG_CHECK_MODULES(GLADE, libglade-2.0)
|
||||
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)
|
||||
|
||||
PKG_CHECK_MODULES(GNOMEKEYRING, gnome-keyring-1)
|
||||
AC_SUBST(GNOMEKEYRING_CFLAGS)
|
||||
AC_SUBST(GNOMEKEYRING_LIBS)
|
||||
fi
|
||||
PKG_CHECK_MODULES(GNOMEKEYRING, gnome-keyring-1)
|
||||
AC_SUBST(GNOMEKEYRING_CFLAGS)
|
||||
AC_SUBST(GNOMEKEYRING_LIBS)
|
||||
|
||||
PKG_CHECK_EXISTS([libnm-glib],
|
||||
[PKG_CHECK_MODULES(NM_UTILS, NetworkManager >= 0.7.0 libnm-util libnm-glib libnm-glib-vpn)],
|
||||
[PKG_CHECK_MODULES(NM_UTILS, NetworkManager >= 0.7.0 libnm-util libnm_glib libnm_glib_vpn)]
|
||||
[PKG_CHECK_MODULES(NM_UTILS, NetworkManager >= 0.9.0 libnm-util libnm-glib libnm-glib-vpn)],
|
||||
[PKG_CHECK_MODULES(NM_UTILS, NetworkManager >= 0.9.0 libnm-util libnm_glib libnm_glib_vpn)]
|
||||
)
|
||||
AC_SUBST(NM_UTILS_CFLAGS)
|
||||
AC_SUBST(NM_UTILS_LIBS)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# List of source files containing translatable strings.
|
||||
# Please keep this file sorted alphabetically.
|
||||
properties/nm-strongswan.c
|
||||
properties/nm-strongswan-dialog.glade
|
||||
properties/nm-strongswan-dialog.ui
|
||||
auth-dialog/main.c
|
||||
|
||||
@@ -2,36 +2,25 @@ plugindir = $(libdir)/NetworkManager
|
||||
plugin_LTLIBRARIES = libnm-strongswan-properties.la
|
||||
|
||||
libnm_strongswan_properties_la_SOURCES = \
|
||||
nm-strongswan.c \
|
||||
nm-strongswan.h
|
||||
nm-strongswan.c \
|
||||
nm-strongswan.h
|
||||
|
||||
gladedir = $(datadir)/gnome-vpn-properties/strongswan
|
||||
glade_DATA = nm-strongswan-dialog.glade
|
||||
uidir = $(datadir)/gnome-vpn-properties/strongswan
|
||||
ui_DATA = nm-strongswan-dialog.ui
|
||||
|
||||
libnm_strongswan_properties_la_CFLAGS = \
|
||||
$(GLADE_CFLAGS) \
|
||||
$(GTK_CFLAGS) \
|
||||
$(GCONF_CFLAGS) \
|
||||
$(LIBGNOMEUI_CFLAGS) \
|
||||
$(NM_UTILS_CFLAGS) \
|
||||
-DICONDIR=\""$(datadir)/pixmaps"\" \
|
||||
-DGLADEDIR=\""$(gladedir)"\" \
|
||||
-DG_DISABLE_DEPRECATED \
|
||||
-DGDK_DISABLE_DEPRECATED \
|
||||
-DGNOME_DISABLE_DEPRECATED \
|
||||
-DGNOMELOCALEDIR=\"$(datadir)/locale\" \
|
||||
-DVERSION=\"$(VERSION)\"
|
||||
libnm_strongswan_properties_la_CFLAGS = \
|
||||
$(GTK_CFLAGS) \
|
||||
$(NM_UTILS_CFLAGS) \
|
||||
-DUIDIR=\""$(uidir)"\" \
|
||||
-DG_DISABLE_DEPRECATED \
|
||||
-DGDK_DISABLE_DEPRECATED \
|
||||
-DVERSION=\"$(VERSION)\"
|
||||
|
||||
libnm_strongswan_properties_la_LIBADD = \
|
||||
$(GLADE_LIBS) \
|
||||
$(GTK_LIBS) \
|
||||
$(GCONF_LIBS) \
|
||||
$(LIBGNOMEUI_LIBS) \
|
||||
$(NM_UTILS_LIBS)
|
||||
$(GTK_LIBS) \
|
||||
$(NM_UTILS_LIBS)
|
||||
|
||||
libnm_strongswan_properties_la_LDFLAGS = \
|
||||
-avoid-version
|
||||
-avoid-version
|
||||
|
||||
CLEANFILES = *.bak *.gladep *~
|
||||
|
||||
EXTRA_DIST = $(glade_DATA)
|
||||
EXTRA_DIST = $(ui_DATA)
|
||||
|
||||
+119
-86
@@ -1,27 +1,29 @@
|
||||
<?xml version="1.0"?>
|
||||
<glade-interface>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 2.12 -->
|
||||
<!-- interface-naming-policy project-wide -->
|
||||
<widget class="GtkWindow" id="strongswan-widget">
|
||||
<object class="GtkWindow" id="strongswan-widget">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes">window1</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="strongswan-vbox">
|
||||
<object class="GtkVBox" id="strongswan-vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="border_width">12</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">16</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="gateway-vbox">
|
||||
<object class="GtkVBox" id="gateway-vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="gateway-label">
|
||||
<object class="GtkLabel" id="gateway-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes"><b>Gateway</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
@@ -29,36 +31,39 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="gateway-alignement">
|
||||
<object class="GtkAlignment" id="gateway-alignement">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<widget class="GtkTable" id="gateway-table">
|
||||
<object class="GtkTable" id="gateway-table">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="n_rows">2</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="column_spacing">6</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="address-label">
|
||||
<object class="GtkLabel" id="address-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Address:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">address-entry</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="address-entry">
|
||||
<object class="GtkEntry" id="address-entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip" translatable="yes">An IP address or hostname the Gateway can be contacted.</property>
|
||||
</widget>
|
||||
<property name="tooltip_text" translatable="yes">An IP address or hostname the Gateway can be contacted.</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
@@ -66,13 +71,14 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="certificate-label">
|
||||
<object class="GtkLabel" id="certificate-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">C_ertificate:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">certificate-button</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
@@ -81,10 +87,11 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkFileChooserButton" id="certificate-button">
|
||||
<object class="GtkFileChooserButton" id="certificate-button">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Gateway or CA certificate to use for gateway authentication. If none is specified, pre-installed CA certificates are used.</property>
|
||||
</widget>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Gateway or CA certificate to use for gateway authentication. If none is specified, pre-installed CA certificates are used.</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
@@ -92,31 +99,35 @@
|
||||
<property name="bottom_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</object>
|
||||
</child>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="client-vbox">
|
||||
<object class="GtkVBox" id="client-vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="client-label">
|
||||
<object class="GtkLabel" id="client-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes"><b>Client</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
@@ -124,21 +135,24 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="client-aligement">
|
||||
<object class="GtkAlignment" id="client-aligement">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<widget class="GtkTable" id="client-table">
|
||||
<object class="GtkTable" id="client-table">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="n_rows">4</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="column_spacing">6</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<child>
|
||||
<widget class="GtkFileChooserButton" id="userkey-button">
|
||||
<object class="GtkFileChooserButton" id="userkey-button">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Private key to use for client authentication. This key has to match the certificates public key and may be encrypted.</property>
|
||||
</widget>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Private key to use for client authentication. This key has to match the certificates public key and may be encrypted.</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
@@ -147,13 +161,14 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="userkey-label">
|
||||
<object class="GtkLabel" id="userkey-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Private _key:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">userkey-button</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
@@ -162,38 +177,27 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="method-combo">
|
||||
<property name="visible">True</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip" translatable="yes">Authentication Method to use for authentication against the Gateway. </property>
|
||||
<property name="items"></property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="method-label">
|
||||
<object class="GtkLabel" id="method-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Au_thentication:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">method-combo</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="user-label">
|
||||
<object class="GtkLabel" id="user-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Username:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">user-entry</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
@@ -202,12 +206,12 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="user-entry">
|
||||
<object class="GtkEntry" id="user-entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip" translatable="yes">The username (identity) to use for authentication against the gateway.</property>
|
||||
</widget>
|
||||
<property name="tooltip_text" translatable="yes">The username (identity) to use for authentication against the gateway.</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
@@ -217,13 +221,14 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="usercert-label">
|
||||
<object class="GtkLabel" id="usercert-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Ce_rtificate:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">usercert-button</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
@@ -232,10 +237,11 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkFileChooserButton" id="usercert-button">
|
||||
<object class="GtkFileChooserButton" id="usercert-button">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Client certificate to use for client authentication.</property>
|
||||
</widget>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Client certificate to use for client authentication.</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
@@ -243,31 +249,45 @@
|
||||
<property name="bottom_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="method-combo">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="options-vbox">
|
||||
<object class="GtkVBox" id="options-vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="options-label">
|
||||
<object class="GtkLabel" id="options-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes"><b>Options</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
@@ -275,72 +295,85 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="options-alignement">
|
||||
<object class="GtkAlignment" id="options-alignement">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="options-inner-vbox">
|
||||
<object class="GtkVBox" id="options-inner-vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="virtual-check">
|
||||
<object class="GtkCheckButton" id="virtual-check">
|
||||
<property name="label" translatable="yes">Request an _inner IP address</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip" translatable="yes">The Gateway may provide addresses from a pool to use for communication in the Gateways network. Check to request such an address.</property>
|
||||
<property name="tooltip_text" translatable="yes">The Gateway may provide addresses from a pool to use for communication in the Gateways network. Check to request such an address.</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="encap-check">
|
||||
<object class="GtkCheckButton" id="encap-check">
|
||||
<property name="label" translatable="yes">En_force UDP encapsulation</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip" translatable="yes">Some firewalls block ESP traffic. Enforcing UDP capsulation even if no NAT situation is detected might help in such cases.</property>
|
||||
<property name="tooltip_text" translatable="yes">Some firewalls block ESP traffic. Enforcing UDP capsulation even if no NAT situation is detected might help in such cases.</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="ipcomp-check">
|
||||
<object class="GtkCheckButton" id="ipcomp-check">
|
||||
<property name="label" translatable="yes">Use IP c_ompression</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip" translatable="yes">IPComp compresses raw IP packets before they get encrypted. This saves some bandwidth, but uses more processing power.</property>
|
||||
<property name="tooltip_text" translatable="yes">IPComp compresses raw IP packets before they get encrypted. This saves some bandwidth, but uses more processing power.</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</object>
|
||||
</child>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</object>
|
||||
</child>
|
||||
</widget>
|
||||
</glade-interface>
|
||||
</object>
|
||||
</interface>
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <glade/glade.h>
|
||||
|
||||
#define NM_VPN_API_SUBJECT_TO_CHANGE
|
||||
|
||||
@@ -59,7 +58,7 @@ G_DEFINE_TYPE_EXTENDED (StrongswanPluginUiWidget, strongswan_plugin_ui_widget, G
|
||||
#define STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), STRONGSWAN_TYPE_PLUGIN_UI_WIDGET, StrongswanPluginUiWidgetPrivate))
|
||||
|
||||
typedef struct {
|
||||
GladeXML *xml;
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *widget;
|
||||
} StrongswanPluginUiWidgetPrivate;
|
||||
|
||||
@@ -106,7 +105,7 @@ check_validity (StrongswanPluginUiWidget *self, GError **error)
|
||||
GtkWidget *widget;
|
||||
char *str;
|
||||
|
||||
widget = glade_xml_get_widget (priv->xml, "address-entry");
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "address-entry"));
|
||||
str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
|
||||
if (!str || !strlen (str)) {
|
||||
g_set_error (error,
|
||||
@@ -126,36 +125,36 @@ static void update_layout (GtkWidget *widget, StrongswanPluginUiWidgetPrivate *p
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
|
||||
/* FALL */
|
||||
case 0:
|
||||
gtk_widget_show (glade_xml_get_widget (priv->xml, "usercert-label"));
|
||||
gtk_widget_show (glade_xml_get_widget (priv->xml, "usercert-button"));
|
||||
gtk_widget_show (glade_xml_get_widget (priv->xml, "userkey-label"));
|
||||
gtk_widget_show (glade_xml_get_widget (priv->xml, "userkey-button"));
|
||||
gtk_widget_hide (glade_xml_get_widget (priv->xml, "user-label"));
|
||||
gtk_widget_hide (glade_xml_get_widget (priv->xml, "user-entry"));
|
||||
gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (priv->builder, "usercert-label")));
|
||||
gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (priv->builder, "usercert-button")));
|
||||
gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (priv->builder, "userkey-label")));
|
||||
gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (priv->builder, "userkey-button")));
|
||||
gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->builder, "user-label")));
|
||||
gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->builder, "user-entry")));
|
||||
break;
|
||||
case 1:
|
||||
gtk_widget_show (glade_xml_get_widget (priv->xml, "usercert-label"));
|
||||
gtk_widget_show (glade_xml_get_widget (priv->xml, "usercert-button"));
|
||||
gtk_widget_hide (glade_xml_get_widget (priv->xml, "user-label"));
|
||||
gtk_widget_hide (glade_xml_get_widget (priv->xml, "user-entry"));
|
||||
gtk_widget_hide (glade_xml_get_widget (priv->xml, "userkey-label"));
|
||||
gtk_widget_hide (glade_xml_get_widget (priv->xml, "userkey-button"));
|
||||
gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (priv->builder, "usercert-label")));
|
||||
gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (priv->builder, "usercert-button")));
|
||||
gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->builder, "user-label")));
|
||||
gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->builder, "user-entry")));
|
||||
gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->builder, "userkey-label")));
|
||||
gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->builder, "userkey-button")));
|
||||
break;
|
||||
case 2:
|
||||
gtk_widget_hide (glade_xml_get_widget (priv->xml, "usercert-label"));
|
||||
gtk_widget_hide (glade_xml_get_widget (priv->xml, "usercert-button"));
|
||||
gtk_widget_hide (glade_xml_get_widget (priv->xml, "user-label"));
|
||||
gtk_widget_hide (glade_xml_get_widget (priv->xml, "user-entry"));
|
||||
gtk_widget_hide (glade_xml_get_widget (priv->xml, "userkey-label"));
|
||||
gtk_widget_hide (glade_xml_get_widget (priv->xml, "userkey-button"));
|
||||
gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->builder, "usercert-label")));
|
||||
gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->builder, "usercert-button")));
|
||||
gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->builder, "user-label")));
|
||||
gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->builder, "user-entry")));
|
||||
gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->builder, "userkey-label")));
|
||||
gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->builder, "userkey-button")));
|
||||
break;
|
||||
case 3:
|
||||
gtk_widget_show (glade_xml_get_widget (priv->xml, "user-label"));
|
||||
gtk_widget_show (glade_xml_get_widget (priv->xml, "user-entry"));
|
||||
gtk_widget_hide (glade_xml_get_widget (priv->xml, "usercert-label"));
|
||||
gtk_widget_hide (glade_xml_get_widget (priv->xml, "usercert-button"));
|
||||
gtk_widget_hide (glade_xml_get_widget (priv->xml, "userkey-label"));
|
||||
gtk_widget_hide (glade_xml_get_widget (priv->xml, "userkey-button"));
|
||||
gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (priv->builder, "user-label")));
|
||||
gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (priv->builder, "user-entry")));
|
||||
gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->builder, "usercert-label")));
|
||||
gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->builder, "usercert-button")));
|
||||
gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->builder, "userkey-label")));
|
||||
gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->builder, "userkey-button")));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -167,9 +166,9 @@ settings_changed_cb (GtkWidget *widget, gpointer user_data)
|
||||
StrongswanPluginUiWidget *self = STRONGSWAN_PLUGIN_UI_WIDGET (user_data);
|
||||
StrongswanPluginUiWidgetPrivate *priv = STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (self);
|
||||
|
||||
if (widget == glade_xml_get_widget (priv->xml, "method-combo"))
|
||||
if (widget == GTK_WIDGET (gtk_builder_get_object (priv->builder, "method-combo")))
|
||||
{
|
||||
update_layout(glade_xml_get_widget (priv->xml, "method-combo"), priv);
|
||||
update_layout(GTK_WIDGET (gtk_builder_get_object (priv->builder, "method-combo")), priv);
|
||||
}
|
||||
g_signal_emit_by_name (STRONGSWAN_PLUGIN_UI_WIDGET (user_data), "changed");
|
||||
}
|
||||
@@ -183,32 +182,32 @@ init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError
|
||||
const char *value;
|
||||
|
||||
settings = NM_SETTING_VPN(nm_connection_get_setting(connection, NM_TYPE_SETTING_VPN));
|
||||
widget = glade_xml_get_widget (priv->xml, "address-entry");
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "address-entry"));
|
||||
value = nm_setting_vpn_get_data_item (settings, "address");
|
||||
if (value)
|
||||
gtk_entry_set_text (GTK_ENTRY (widget), value);
|
||||
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self);
|
||||
|
||||
widget = glade_xml_get_widget (priv->xml, "certificate-button");
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "certificate-button"));
|
||||
value = nm_setting_vpn_get_data_item (settings, "certificate");
|
||||
if (value)
|
||||
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
|
||||
g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (settings_changed_cb), self);
|
||||
|
||||
widget = glade_xml_get_widget (priv->xml, "user-label");
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user-label"));
|
||||
gtk_widget_set_no_show_all (widget, TRUE);
|
||||
widget = glade_xml_get_widget (priv->xml, "user-entry");
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user-entry"));
|
||||
gtk_widget_set_no_show_all (widget, TRUE);
|
||||
value = nm_setting_vpn_get_data_item (settings, "user");
|
||||
if (value)
|
||||
gtk_entry_set_text (GTK_ENTRY (widget), value);
|
||||
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self);
|
||||
|
||||
widget = glade_xml_get_widget (priv->xml, "method-combo");
|
||||
gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Certificate/private key"));
|
||||
gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Certificate/ssh-agent"));
|
||||
gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Smartcard"));
|
||||
gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("EAP"));
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "method-combo"));
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), _("Certificate/private key"));
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), _("Certificate/ssh-agent"));
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), _("Smartcard"));
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), _("EAP"));
|
||||
value = nm_setting_vpn_get_data_item (settings, "method");
|
||||
if (value) {
|
||||
if (g_strcmp0 (value, "key") == 0) {
|
||||
@@ -231,25 +230,25 @@ init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError
|
||||
update_layout (widget, priv);
|
||||
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self);
|
||||
|
||||
widget = glade_xml_get_widget (priv->xml, "usercert-label");
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "usercert-label"));
|
||||
gtk_widget_set_no_show_all (widget, TRUE);
|
||||
widget = glade_xml_get_widget (priv->xml, "usercert-button");
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "usercert-button"));
|
||||
gtk_widget_set_no_show_all (widget, TRUE);
|
||||
value = nm_setting_vpn_get_data_item (settings, "usercert");
|
||||
if (value)
|
||||
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
|
||||
g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (settings_changed_cb), self);
|
||||
|
||||
widget = glade_xml_get_widget (priv->xml, "userkey-label");
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "userkey-label"));
|
||||
gtk_widget_set_no_show_all (widget, TRUE);
|
||||
widget = glade_xml_get_widget (priv->xml, "userkey-button");
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "userkey-button"));
|
||||
gtk_widget_set_no_show_all (widget, TRUE);
|
||||
value = nm_setting_vpn_get_data_item (settings, "userkey");
|
||||
if (value)
|
||||
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
|
||||
g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (settings_changed_cb), self);
|
||||
|
||||
widget = glade_xml_get_widget (priv->xml, "virtual-check");
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "virtual-check"));
|
||||
value = nm_setting_vpn_get_data_item (settings, "virtual");
|
||||
if (value && strcmp(value, "yes") == 0)
|
||||
{
|
||||
@@ -257,7 +256,7 @@ init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError
|
||||
}
|
||||
g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (settings_changed_cb), self);
|
||||
|
||||
widget = glade_xml_get_widget (priv->xml, "encap-check");
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "encap-check"));
|
||||
value = nm_setting_vpn_get_data_item (settings, "encap");
|
||||
if (value && strcmp(value, "yes") == 0)
|
||||
{
|
||||
@@ -265,7 +264,7 @@ init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError
|
||||
}
|
||||
g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (settings_changed_cb), self);
|
||||
|
||||
widget = glade_xml_get_widget (priv->xml, "ipcomp-check");
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "ipcomp-check"));
|
||||
value = nm_setting_vpn_get_data_item (settings, "ipcomp");
|
||||
if (value && strcmp(value, "yes") == 0)
|
||||
{
|
||||
@@ -304,29 +303,29 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
|
||||
g_object_set (settings, NM_SETTING_VPN_SERVICE_TYPE,
|
||||
NM_DBUS_SERVICE_STRONGSWAN, NULL);
|
||||
|
||||
widget = glade_xml_get_widget (priv->xml, "address-entry");
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "address-entry"));
|
||||
str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
|
||||
if (str && strlen (str)) {
|
||||
nm_setting_vpn_add_data_item (settings, "address", str);
|
||||
}
|
||||
|
||||
widget = glade_xml_get_widget (priv->xml, "certificate-button");
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "certificate-button"));
|
||||
str = (char *) gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
|
||||
if (str) {
|
||||
nm_setting_vpn_add_data_item (settings, "certificate", str);
|
||||
}
|
||||
|
||||
widget = glade_xml_get_widget (priv->xml, "method-combo");
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "method-combo"));
|
||||
switch (gtk_combo_box_get_active (GTK_COMBO_BOX (widget)))
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
widget = glade_xml_get_widget (priv->xml, "userkey-button");
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "userkey-button"));
|
||||
str = (char *) gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
|
||||
if (str) {
|
||||
nm_setting_vpn_add_data_item (settings, "userkey", str);
|
||||
}
|
||||
widget = glade_xml_get_widget (priv->xml, "usercert-button");
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "usercert-button"));
|
||||
str = (char *) gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
|
||||
if (str) {
|
||||
nm_setting_vpn_add_data_item (settings, "usercert", str);
|
||||
@@ -334,7 +333,7 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
|
||||
str = "key";
|
||||
break;
|
||||
case 1:
|
||||
widget = glade_xml_get_widget (priv->xml, "usercert-button");
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "usercert-button"));
|
||||
str = (char *) gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
|
||||
if (str) {
|
||||
nm_setting_vpn_add_data_item (settings, "usercert", str);
|
||||
@@ -345,7 +344,7 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
|
||||
str = "smartcard";
|
||||
break;
|
||||
case 3:
|
||||
widget = glade_xml_get_widget (priv->xml, "user-entry");
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user-entry"));
|
||||
str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
|
||||
if (str && strlen (str)) {
|
||||
nm_setting_vpn_add_data_item (settings, "user", str);
|
||||
@@ -355,27 +354,30 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
|
||||
}
|
||||
nm_setting_vpn_add_data_item (settings, "method", str);
|
||||
|
||||
widget = glade_xml_get_widget (priv->xml, "virtual-check");
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "virtual-check"));
|
||||
active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
||||
nm_setting_vpn_add_data_item (settings, "virtual", active ? "yes" : "no");
|
||||
|
||||
widget = glade_xml_get_widget (priv->xml, "encap-check");
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "encap-check"));
|
||||
active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
||||
nm_setting_vpn_add_data_item (settings, "encap", active ? "yes" : "no");
|
||||
|
||||
widget = glade_xml_get_widget (priv->xml, "ipcomp-check");
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "ipcomp-check"));
|
||||
active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
||||
nm_setting_vpn_add_data_item (settings, "ipcomp", active ? "yes" : "no");
|
||||
|
||||
nm_connection_add_setting (connection, NM_SETTING (settings));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
save_secrets (NMVpnPluginUiWidgetInterface *iface,
|
||||
NMConnection *connection, GError **error)
|
||||
{
|
||||
/* no secrets to save */
|
||||
if (!nm_setting_set_secret_flags (NM_SETTING (settings),
|
||||
"password", NM_SETTING_SECRET_FLAG_AGENT_OWNED, NULL))
|
||||
{
|
||||
fprintf(stderr, "no\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "yes\n");
|
||||
}
|
||||
|
||||
nm_connection_add_setting (connection, NM_SETTING (settings));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -384,7 +386,7 @@ nm_vpn_plugin_ui_widget_interface_new (NMConnection *connection, GError **error)
|
||||
{
|
||||
NMVpnPluginUiWidgetInterface *object;
|
||||
StrongswanPluginUiWidgetPrivate *priv;
|
||||
char *glade_file;
|
||||
char *ui_file;
|
||||
|
||||
if (error)
|
||||
g_return_val_if_fail (*error == NULL, NULL);
|
||||
@@ -396,19 +398,24 @@ nm_vpn_plugin_ui_widget_interface_new (NMConnection *connection, GError **error)
|
||||
}
|
||||
|
||||
priv = STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (object);
|
||||
ui_file = g_strdup_printf ("%s/%s", UIDIR, "nm-strongswan-dialog.ui");
|
||||
priv->builder = gtk_builder_new ();
|
||||
|
||||
glade_file = g_strdup_printf ("%s/%s", GLADEDIR, "nm-strongswan-dialog.glade");
|
||||
priv->xml = glade_xml_new (glade_file, "strongswan-vbox", GETTEXT_PACKAGE);
|
||||
if (priv->xml == NULL) {
|
||||
gtk_builder_set_translation_domain (priv->builder, GETTEXT_PACKAGE);
|
||||
|
||||
if (!gtk_builder_add_from_file (priv->builder, ui_file, error)) {
|
||||
g_warning ("Couldn't load builder file: %s",
|
||||
error && *error ? (*error)->message : "(unknown)");
|
||||
g_clear_error (error);
|
||||
g_set_error (error, STRONGSWAN_PLUGIN_UI_ERROR, 0,
|
||||
"could not load required resources at %s", glade_file);
|
||||
g_free (glade_file);
|
||||
"could not load required resources at %s", ui_file);
|
||||
g_free (ui_file);
|
||||
g_object_unref (object);
|
||||
return NULL;
|
||||
}
|
||||
g_free (glade_file);
|
||||
g_free (ui_file);
|
||||
|
||||
priv->widget = glade_xml_get_widget (priv->xml, "strongswan-vbox");
|
||||
priv->widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "strongswan-vbox") );
|
||||
if (!priv->widget) {
|
||||
g_set_error (error, STRONGSWAN_PLUGIN_UI_ERROR, 0, "could not load UI widget");
|
||||
g_object_unref (object);
|
||||
@@ -433,8 +440,8 @@ dispose (GObject *object)
|
||||
if (priv->widget)
|
||||
g_object_unref (priv->widget);
|
||||
|
||||
if (priv->xml)
|
||||
g_object_unref (priv->xml);
|
||||
if (priv->builder)
|
||||
g_object_unref (priv->builder);
|
||||
|
||||
G_OBJECT_CLASS (strongswan_plugin_ui_widget_parent_class)->dispose (object);
|
||||
}
|
||||
@@ -460,7 +467,6 @@ strongswan_plugin_ui_widget_interface_init (NMVpnPluginUiWidgetInterface *iface_
|
||||
/* interface implementation */
|
||||
iface_class->get_widget = get_widget;
|
||||
iface_class->update_connection = update_connection;
|
||||
iface_class->save_secrets = save_secrets;
|
||||
}
|
||||
|
||||
static guint32
|
||||
|
||||
Reference in New Issue
Block a user