From 5f564b94a0ed24562ca5eb150e2b60bc3a2d0000 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Tue, 6 Sep 2016 16:12:51 +0200 Subject: [PATCH] maemo: Remove obsolete status/settings applet --- src/frontends/maemo/.gitignore | 2 - src/frontends/maemo/AUTHORS | 0 src/frontends/maemo/ChangeLog | 0 src/frontends/maemo/Makefile.am | 3 - src/frontends/maemo/NEWS | 4 - src/frontends/maemo/README | 0 src/frontends/maemo/autogen.sh | 5 - src/frontends/maemo/configure.ac | 54 -- src/frontends/maemo/data/Makefile.am | 15 - .../icons/18x18/strongswan_lock_close.png | Bin 1024 -> 0 bytes .../data/icons/18x18/strongswan_lock_open.png | Bin 1032 -> 0 bytes .../icons/48x48/strongswan_lock_close.png | Bin 2652 -> 0 bytes .../data/icons/48x48/strongswan_lock_open.png | Bin 2682 -> 0 bytes .../maemo/data/strongswan-settings.desktop | 9 - .../maemo/data/strongswan-status.desktop | 9 - src/frontends/maemo/src/Makefile.am | 21 - .../maemo/src/strongswan-connection.c | 260 -------- .../maemo/src/strongswan-connection.h | 60 -- .../maemo/src/strongswan-connections.c | 318 --------- .../maemo/src/strongswan-connections.h | 65 -- src/frontends/maemo/src/strongswan-settings.c | 353 ---------- src/frontends/maemo/src/strongswan-status.c | 621 ------------------ src/frontends/maemo/src/strongswan-status.h | 51 -- 23 files changed, 1850 deletions(-) delete mode 100644 src/frontends/maemo/.gitignore delete mode 100644 src/frontends/maemo/AUTHORS delete mode 100644 src/frontends/maemo/ChangeLog delete mode 100644 src/frontends/maemo/Makefile.am delete mode 100644 src/frontends/maemo/NEWS delete mode 100644 src/frontends/maemo/README delete mode 100755 src/frontends/maemo/autogen.sh delete mode 100644 src/frontends/maemo/configure.ac delete mode 100644 src/frontends/maemo/data/Makefile.am delete mode 100644 src/frontends/maemo/data/icons/18x18/strongswan_lock_close.png delete mode 100644 src/frontends/maemo/data/icons/18x18/strongswan_lock_open.png delete mode 100644 src/frontends/maemo/data/icons/48x48/strongswan_lock_close.png delete mode 100644 src/frontends/maemo/data/icons/48x48/strongswan_lock_open.png delete mode 100644 src/frontends/maemo/data/strongswan-settings.desktop delete mode 100644 src/frontends/maemo/data/strongswan-status.desktop delete mode 100644 src/frontends/maemo/src/Makefile.am delete mode 100644 src/frontends/maemo/src/strongswan-connection.c delete mode 100644 src/frontends/maemo/src/strongswan-connection.h delete mode 100644 src/frontends/maemo/src/strongswan-connections.c delete mode 100644 src/frontends/maemo/src/strongswan-connections.h delete mode 100644 src/frontends/maemo/src/strongswan-settings.c delete mode 100644 src/frontends/maemo/src/strongswan-status.c delete mode 100644 src/frontends/maemo/src/strongswan-status.h diff --git a/src/frontends/maemo/.gitignore b/src/frontends/maemo/.gitignore deleted file mode 100644 index 5568822e5..000000000 --- a/src/frontends/maemo/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -build-arch-stamp -build-indep-stamp diff --git a/src/frontends/maemo/AUTHORS b/src/frontends/maemo/AUTHORS deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/frontends/maemo/ChangeLog b/src/frontends/maemo/ChangeLog deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/frontends/maemo/Makefile.am b/src/frontends/maemo/Makefile.am deleted file mode 100644 index f3e344fa4..000000000 --- a/src/frontends/maemo/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ - -SUBDIRS = src data - diff --git a/src/frontends/maemo/NEWS b/src/frontends/maemo/NEWS deleted file mode 100644 index ffacf7098..000000000 --- a/src/frontends/maemo/NEWS +++ /dev/null @@ -1,4 +0,0 @@ -strongswan-applet-1.0.0 ------------------------ - -- Initial release diff --git a/src/frontends/maemo/README b/src/frontends/maemo/README deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/frontends/maemo/autogen.sh b/src/frontends/maemo/autogen.sh deleted file mode 100755 index 6039708df..000000000 --- a/src/frontends/maemo/autogen.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -libtoolize --force && -aclocal && -automake -a && -autoconf diff --git a/src/frontends/maemo/configure.ac b/src/frontends/maemo/configure.ac deleted file mode 100644 index aae322fa2..000000000 --- a/src/frontends/maemo/configure.ac +++ /dev/null @@ -1,54 +0,0 @@ -AC_INIT(strongswan-applet, 1.0.1) -AM_INIT_AUTOMAKE - -# Programs -AC_PROG_CC -AC_PROG_INSTALL -AC_PROG_LIBTOOL - -# Headers -AC_HEADER_STDC - -# Library dependencies -PKG_CHECK_MODULES(HILDON, hildon-1 hildon-fm-2 hildon-control-panel libhildondesktop-1) -AC_SUBST(HILDON_CFLAGS) -AC_SUBST(HILDON_LIBS) - -PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.60) -AC_SUBST(DBUS_CFLAGS) -AC_SUBST(DBUS_LIBS) - -PKG_CHECK_MODULES(OSSO, osso-af-settings >= 0.8.5 libosso >= 0.9.17 gnome-vfs-2.0 >= 2.8.4.11 gnome-vfs-module-2.0 >= 2.8.4.11) -AC_SUBST(OSSO_CFLAGS) -AC_SUBST(OSSO_LIBS) - -# Application icon install directories -icon_18x18dir=$datadir/icons/hicolor/18x18/hildon -icon_24x24dir=$datadir/icons/hicolor/24x24/hildon -icon_32x32dir=$datadir/icons/hicolor/32x32/hildon -icon_48x48dir=$datadir/icons/hicolor/48x48/hildon -icon_scalabledir=$datadir/icons/hicolor/scalable/hildon - -# Hildon control panel plugin install directories -pluginlibdir=`$PKG_CONFIG hildon-control-panel --variable=pluginlibdir` -plugindesktopentrydir=`$PKG_CONFIG hildon-control-panel --variable=plugindesktopentrydir` - -# Hildon status widget install directories -statuslibdir=`$PKG_CONFIG libhildondesktop-1 --variable=hildondesktoplibdir` -statusdesktopentrydir=`$PKG_CONFIG libhildondesktop-1 --variable=hildonstatusmenudesktopentrydir` - -AC_SUBST(icon_18x18dir) -AC_SUBST(icon_24x24dir) -AC_SUBST(icon_32x32dir) -AC_SUBST(icon_48x48dir) -AC_SUBST(icon_scalabledir) -AC_SUBST(pluginlibdir) -AC_SUBST(plugindesktopentrydir) -AC_SUBST(statuslibdir) -AC_SUBST(statusdesktopentrydir) - -AC_OUTPUT( - Makefile \ - src/Makefile \ - data/Makefile -) diff --git a/src/frontends/maemo/data/Makefile.am b/src/frontends/maemo/data/Makefile.am deleted file mode 100644 index 69af067da..000000000 --- a/src/frontends/maemo/data/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -plugindesktopentry_DATA = strongswan-settings.desktop - -statusdesktopentry_DATA = strongswan-status.desktop - -icon_18x18_DATA = \ - icons/18x18/strongswan_lock_open.png \ - icons/18x18/strongswan_lock_close.png -icon_48x48_DATA = \ - icons/48x48/strongswan_lock_open.png \ - icons/48x48/strongswan_lock_close.png - -EXTRA_DIST = \ - $(plugindesktopentry_DATA) $(statusdesktopentry_DATA) \ - $(icon_18x18_DATA) $(icon_48x48_DATA) - diff --git a/src/frontends/maemo/data/icons/18x18/strongswan_lock_close.png b/src/frontends/maemo/data/icons/18x18/strongswan_lock_close.png deleted file mode 100644 index b193d0dc82c6c90d5df3e0951c49d98ef085061f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1024 zcmV+b1poVqP)EX>4Tx0C?K1k+Dj{P!xv08%4#TRtVzYa3@hvY}LVxNn45_SgS*ltw}?b(j?s6 zs(lDYw+=4uK7o^?;Gp;fzJcP@!68U+62Wi!&d=d+;0L2(*PVt@hC!@VyXi>R^X2Rl zGfV+MC(Kg2)j9x(lQ`lh0zO|60MDCt-D&VQ=EGEJU;=D+qbvkb0s0p@)gZ=z8T3;P z;tnv?NxKH(0Vwrye*sEC?r%UzxtNiGVzh(U`QbLO4P`&>^O1v8sz*~7Csoc|Bbc^=?@J9JpFp46zf zr@-@-`H_jS@fknxPCLh6Hn+C!U7ViYs3mnO^z?F92mqE}EKik=mLC7CR!g;{jwp&S zP%Q5Js8+8`mCG*=_IrmRvo~i8rzR&KB=!2q)pu)4>+9>YNuyDZb8$Hg{BuL&Bln*z zJe6JNtyC&gZ{Mu)+}x8j0Ks1U;iHH1uUA(1`Ql>v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9K-xniAgClUHlGzzn|{17Ao4Sio`MJ&`6N z&IDOu1W*G50UN@%9(^45|M17nItt6vzeP)A5^1f0J}OO0HPDKkLWI8o)E}d!vFPD-W2**R^M9J2!iGX9>P$Sz|Cw9T{q2*He zA_@>f9#A+&UOsia>8MUkXITyVYX)m0A3{VF>~uppu>LBf0DFN3y#S(+utXZ91%ilE z3gC!>@!AOCnzaF-A@rbtxa5qm=>QTz7c5e!5. - * - * This program 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 General Public License - * for more details. - */ - -#include - -#include "strongswan-connection.h" - -#define STRONGSWAN_CONNECTION_GET_PRIVATE(object) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((object), \ - STRONGSWAN_TYPE_CONNECTION, \ - StrongswanConnectionPrivate)) - -struct _StrongswanConnectionPrivate -{ - gchar *orig_name; - gchar *name; - gchar *host; - gchar *cert; - gchar *user; -}; - -enum -{ - PROP_0, - PROP_NAME, - PROP_HOST, - PROP_CERT, - PROP_USER, -}; - -#ifndef USE_DYNAMIC_TYPES -G_DEFINE_TYPE (StrongswanConnection, strongswan_connection, G_TYPE_OBJECT); -#else -G_DEFINE_DYNAMIC_TYPE (StrongswanConnection, strongswan_connection, G_TYPE_OBJECT); -void strongswan_connection_register (GTypeModule *type_module) -{ - strongswan_connection_register_type (type_module); -} -#endif - -static void -strongswan_connection_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - StrongswanConnectionPrivate *priv = STRONGSWAN_CONNECTION (object)->priv; - switch (prop_id) - { - case PROP_NAME: - g_value_set_string (value, priv->name); - break; - case PROP_HOST: - g_value_set_string (value, priv->host); - break; - case PROP_CERT: - g_value_set_string (value, priv->cert); - break; - case PROP_USER: - g_value_set_string (value, priv->user); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -strongswan_connection_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - StrongswanConnectionPrivate *priv = STRONGSWAN_CONNECTION (object)->priv; - switch (prop_id) - { - case PROP_NAME: - g_free (priv->name); - priv->name = g_value_dup_string (value); - case PROP_HOST: - g_free (priv->host); - priv->host = g_value_dup_string (value); - break; - case PROP_CERT: - g_free (priv->cert); - priv->cert = g_value_dup_string (value); - break; - case PROP_USER: - g_free (priv->user); - priv->user = g_value_dup_string (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -strongswan_connection_init (StrongswanConnection *connection) -{ - connection->priv = STRONGSWAN_CONNECTION_GET_PRIVATE (connection); -} - -static void -strongswan_connection_dispose (GObject *object) -{ - G_OBJECT_CLASS (strongswan_connection_parent_class)->dispose (object); -} - -static void -strongswan_connection_finalize (GObject *object) -{ - StrongswanConnectionPrivate *priv = STRONGSWAN_CONNECTION (object)->priv; - g_free (priv->orig_name); - g_free (priv->name); - g_free (priv->host); - g_free (priv->cert); - g_free (priv->user); - G_OBJECT_CLASS (strongswan_connection_parent_class)->finalize (object); -} - -static void -strongswan_connection_class_init (StrongswanConnectionClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->get_property = strongswan_connection_get_property; - object_class->set_property = strongswan_connection_set_property; - object_class->dispose = strongswan_connection_dispose; - object_class->finalize = strongswan_connection_finalize; - - g_object_class_install_property (object_class, PROP_NAME, - g_param_spec_string ("name", "Connection name", - "The unique name of a connection", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property (object_class, PROP_HOST, - g_param_spec_string ("host", "Hostname or IP address", - "The hostname or IP address of the Gateway", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property (object_class, PROP_CERT, - g_param_spec_string ("cert", "Gateway or CA certificate", - "The certificate of the gateway or the CA", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property (object_class, PROP_USER, - g_param_spec_string ("user", "Username", - "The username for EAP authentication", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_type_class_add_private (klass, sizeof (StrongswanConnectionPrivate)); -} - -#ifdef USE_DYNAMIC_TYPES -static void -strongswan_connection_class_finalize (StrongswanConnectionClass *klass) -{ -} -#endif - -static inline gchar * -get_string_from_key_file (GKeyFile *key_file, - const gchar *name, - const gchar *key) -{ - GError *error = NULL; - gchar *value; - value = g_key_file_get_string (key_file, name, key, &error); - if (error) - { - g_warning ("Failed to read %s/%s from key file: %s", - name, key, error->message); - g_error_free (error); - } - return value; -} - -static void -strongswan_connection_update_from_key_file (GKeyFile *key_file, - StrongswanConnection *connection) -{ - StrongswanConnectionPrivate *priv = connection->priv; - gchar *name = priv->name; - - priv->orig_name = g_strdup (name); - priv->host = get_string_from_key_file (key_file, name, "host"); - priv->cert = get_string_from_key_file (key_file, name, "cert"); - priv->user = get_string_from_key_file (key_file, name, "user"); -} - -StrongswanConnection * -strongswan_connection_new (const gchar *name) -{ - StrongswanConnection *conn; - conn = g_object_new (STRONGSWAN_TYPE_CONNECTION, - "name", name, - NULL); - g_return_val_if_fail (conn->priv != NULL, NULL); - return conn; -} - -StrongswanConnection * -strongswan_connection_new_from_key_file (GKeyFile *key_file, - const gchar *name) -{ - StrongswanConnection *conn = strongswan_connection_new (name); - g_return_val_if_fail (conn != NULL, NULL); - strongswan_connection_update_from_key_file (key_file, conn); - return conn; -} - -void -strongswan_connection_save_to_key_file (GKeyFile *key_file, - StrongswanConnection *connection) -{ - StrongswanConnectionPrivate *priv = connection->priv; - gchar *name = priv->name; - - if (priv->orig_name && strcmp (name, priv->orig_name)) - { - g_key_file_remove_group (key_file, priv->orig_name, NULL); - g_free (priv->orig_name); - priv->orig_name = g_strdup (name); - } - - if (priv->host) - { - g_key_file_set_string (key_file, name, "host", priv->host); - } - if (priv->cert) - { - g_key_file_set_string (key_file, name, "cert", priv->cert); - } - else - { - g_key_file_remove_key (key_file, name, "cert", NULL); - } - if (priv->user) - { - g_key_file_set_string (key_file, name, "user", priv->user); - } -} - diff --git a/src/frontends/maemo/src/strongswan-connection.h b/src/frontends/maemo/src/strongswan-connection.h deleted file mode 100644 index 2e4fd45ec..000000000 --- a/src/frontends/maemo/src/strongswan-connection.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2010 Tobias Brunner - * Hochschule fuer Technik Rapperswil - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. See . - * - * This program 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 General Public License - * for more details. - */ - -#ifndef __STRONGSWAN_CONNECTION_H__ -#define __STRONGSWAN_CONNECTION_H__ - -#include -#include - -G_BEGIN_DECLS - -#define STRONGSWAN_TYPE_CONNECTION (strongswan_connection_get_type ()) -#define STRONGSWAN_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STRONGSWAN_TYPE_CONNECTION, StrongswanConnection)) -#define STRONGSWAN_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STRONGSWAN_TYPE_CONNECTION, StrongswanConnectionClass)) -#define STRONGSWAN_IS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STRONGSWAN_TYPE_CONNECTION)) -#define STRONGSWAN_IS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), STRONGSWAN_TYPE_CONNECTION)) -#define STRONGSWAN_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STRONGSWAN_TYPE_CONNECTION, StrongswanConnectionClass)) - -typedef struct _StrongswanConnection StrongswanConnection; -typedef struct _StrongswanConnectionClass StrongswanConnectionClass; -typedef struct _StrongswanConnectionPrivate StrongswanConnectionPrivate; - -struct _StrongswanConnection -{ - GObject gobject; - - StrongswanConnectionPrivate *priv; -}; - -struct _StrongswanConnectionClass -{ - GObjectClass parent_class; -}; - -GType strongswan_connection_get_type (void); - -StrongswanConnection *strongswan_connection_new (const gchar *name); - -StrongswanConnection *strongswan_connection_new_from_key_file(GKeyFile *key_file, const gchar *name); -void strongswan_connection_save_to_key_file (GKeyFile *key_file, StrongswanConnection *connection); - -#ifdef USE_DYNAMIC_TYPES -void strongswan_connection_register (GTypeModule *type_module); -#endif - -G_END_DECLS - -#endif /* __STRONGSWAN_CONNECTION_H__ */ diff --git a/src/frontends/maemo/src/strongswan-connections.c b/src/frontends/maemo/src/strongswan-connections.c deleted file mode 100644 index f5ba55c84..000000000 --- a/src/frontends/maemo/src/strongswan-connections.c +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Copyright (C) 2010 Tobias Brunner - * Hochschule fuer Technik Rapperswil - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. See . - * - * This program 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 General Public License - * for more details. - */ - -#include -#include - -#include "strongswan-connections.h" - -/* connections are stored in ~/.config/strongswan/connections */ -#define CONFIG_DIR_NAME "strongswan" -#define CONFIG_FILE_NAME "connections" - -#define STRONGSWAN_CONNECTIONS_GET_PRIVATE(object) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((object), STRONGSWAN_TYPE_CONNECTIONS, StrongswanConnectionsPrivate)) - -struct _StrongswanConnectionsPrivate -{ - GKeyFile *key_file; - gchar *path; - GnomeVFSMonitorHandle *monitor; - GHashTable *connections; - GtkTreeModel *model; -}; - -#ifndef USE_DYNAMIC_TYPES -G_DEFINE_TYPE (StrongswanConnections, strongswan_connections, G_TYPE_OBJECT); -#else -G_DEFINE_DYNAMIC_TYPE (StrongswanConnections, strongswan_connections, G_TYPE_OBJECT); -void strongswan_connections_register (GTypeModule *type_module) -{ - strongswan_connections_register_type (type_module); -} -#endif - -static void -strongswan_connections_load_connections (StrongswanConnections *connections) -{ - StrongswanConnectionsPrivate *priv = connections->priv; - GHashTableIter iter; - gpointer key, value; - gchar **groups; - guint i; - - g_hash_table_remove_all (priv->connections); - groups = g_key_file_get_groups (priv->key_file, NULL); - for (i = 0; groups[i]; i++) - { - StrongswanConnection *conn; - conn = strongswan_connection_new_from_key_file(priv->key_file, - groups[i]); - if (conn != NULL) - { - g_hash_table_insert (priv->connections, - g_strdup(groups[i]), - conn); - } - } - g_strfreev (groups); - - gtk_list_store_clear (GTK_LIST_STORE (priv->model)); - g_hash_table_iter_init (&iter, priv->connections); - while (g_hash_table_iter_next (&iter, &key, &value)) - { - gtk_list_store_insert_with_values (GTK_LIST_STORE (priv->model), - NULL, - -1, - 0, key, - -1); - } -} - -static void -strongswan_connections_load_config (StrongswanConnections *connections) -{ - StrongswanConnectionsPrivate *priv = connections->priv; - GError *error = NULL; - - if (priv->key_file) - { - g_key_file_free (priv->key_file); - } - - priv->key_file = g_key_file_new (); - if (!g_key_file_load_from_file (priv->key_file, - priv->path, - G_KEY_FILE_KEEP_COMMENTS, - &error)) - { - if (g_error_matches (error, - G_KEY_FILE_ERROR, - G_KEY_FILE_ERROR_PARSE)) - { - g_debug ("Failed to parse config file '%s', treated as empty: %s", - priv->path, error->message); - g_error_free (error); - } - else - { - g_debug ("Could not read config file '%s': %s", - priv->path, error->message); - g_error_free (error); - } - } - - strongswan_connections_load_connections (connections); -} - -static void -strongswan_connections_file_changed (GnomeVFSMonitorHandle *handle, - const gchar *monitor_uri, - const gchar *info_uri, - GnomeVFSMonitorEventType event_type, - StrongswanConnections *connections) -{ - strongswan_connections_load_config (connections); -} - - -static void -strongswan_connections_init (StrongswanConnections *connections) -{ - StrongswanConnectionsPrivate *priv; - connections->priv = STRONGSWAN_CONNECTIONS_GET_PRIVATE (connections); - priv = connections->priv; - - priv->path = g_build_filename (g_get_user_config_dir (), - CONFIG_DIR_NAME, - CONFIG_FILE_NAME, - NULL); - /* ensure that the directory exists */ - gchar *dir = g_path_get_dirname (priv->path); - g_mkdir_with_parents (dir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); - g_free (dir); - - priv->connections = g_hash_table_new_full (g_str_hash, - g_str_equal, - g_free, - g_object_unref); - - priv->model = GTK_TREE_MODEL (gtk_list_store_new (2, - G_TYPE_STRING, - G_TYPE_STRING)); - gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (priv->model), - 0, - GTK_SORT_ASCENDING); -} - -static void -strongswan_connections_constructed (GObject *object) -{ - StrongswanConnectionsPrivate *priv; - GnomeVFSResult result; - - if (G_OBJECT_CLASS (strongswan_connections_parent_class)->constructed) - { - G_OBJECT_CLASS (strongswan_connections_parent_class)->constructed (object); - } - - g_return_if_fail (STRONGSWAN_IS_CONNECTIONS (object)); - priv = STRONGSWAN_CONNECTIONS (object)->priv; - - result = gnome_vfs_monitor_add (&priv->monitor, - priv->path, - GNOME_VFS_MONITOR_FILE, - (GnomeVFSMonitorCallback) strongswan_connections_file_changed, - object); - if (result != GNOME_VFS_OK) - { - g_warning ("Could not monitor '%s': %s", - priv->path, - gnome_vfs_result_to_string (result)); - } - - strongswan_connections_load_config (STRONGSWAN_CONNECTIONS (object)); -} - -static void -strongswan_connections_dispose (GObject *object) -{ - StrongswanConnectionsPrivate *priv; - - g_return_if_fail (STRONGSWAN_IS_CONNECTIONS (object)); - priv = STRONGSWAN_CONNECTIONS (object)->priv; - - if (priv->model) - { - priv->model = (g_object_unref (priv->model), NULL); - } - - G_OBJECT_CLASS (strongswan_connections_parent_class)->dispose (object); -} - -static void -strongswan_connections_finalize (GObject *object) -{ - StrongswanConnectionsPrivate *priv; - - g_return_if_fail (STRONGSWAN_IS_CONNECTIONS (object)); - priv = STRONGSWAN_CONNECTIONS (object)->priv; - - priv->path = (g_free (priv->path), NULL); - priv->monitor = (gnome_vfs_monitor_cancel (priv->monitor), NULL); - priv->key_file = (g_key_file_free (priv->key_file), NULL); - priv->connections = (g_hash_table_destroy (priv->connections), NULL); - - G_OBJECT_CLASS (strongswan_connections_parent_class)->finalize (object); -} - -static void -strongswan_connections_class_init (StrongswanConnectionsClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->constructed = strongswan_connections_constructed; - object_class->dispose = strongswan_connections_dispose; - object_class->finalize = strongswan_connections_finalize; - - g_type_class_add_private (klass, sizeof (StrongswanConnectionsPrivate)); -} - -#ifdef USE_DYNAMIC_TYPES -static void -strongswan_connections_class_finalize (StrongswanConnectionsClass *klass) -{ -} -#endif - -GtkTreeModel * -strongswan_connections_get_model (StrongswanConnections *self) -{ - StrongswanConnectionsPrivate *priv = self->priv; - return g_object_ref (priv->model); -} - -void -strongswan_connections_setup_column_renderers (StrongswanConnections *self, - GtkCellLayout *layout) -{ - GtkCellRenderer *renderer; - renderer = gtk_cell_renderer_text_new (); - gtk_cell_layout_pack_start (layout, - renderer, - TRUE); - gtk_cell_layout_add_attribute (layout, - renderer, - "text", 0); -} - -StrongswanConnections * -strongswan_connections_new (void) -{ - StrongswanConnections *connections; - connections = g_object_new (STRONGSWAN_TYPE_CONNECTIONS, - NULL); - return connections; -} - -StrongswanConnection * -strongswan_connections_get_connection (StrongswanConnections *self, - const gchar *name) -{ - StrongswanConnectionsPrivate *priv = self->priv; - g_return_val_if_fail (name != NULL, NULL); - return g_hash_table_lookup (priv->connections, name); -} - -static void -strongswan_connections_save_connections (StrongswanConnections *self) -{ - StrongswanConnectionsPrivate *priv = self->priv; - gchar *data; - gsize size; - GError *error = NULL; - - data = g_key_file_to_data (priv->key_file, &size, NULL); - if (!g_file_set_contents (priv->path, data, size, &error)) - { - g_warning ("Failed to save connections to '%s': %s", - priv->path, error->message); - g_error_free (error); - } - g_free (data); -} - -void -strongswan_connections_save_connection (StrongswanConnections *self, - StrongswanConnection *conn) -{ - StrongswanConnectionsPrivate *priv = self->priv; - - strongswan_connection_save_to_key_file (priv->key_file, conn); - - strongswan_connections_save_connections (self); -} - -void -strongswan_connections_remove_connection (StrongswanConnections *self, - const gchar *name) -{ - StrongswanConnectionsPrivate *priv = self->priv; - - g_key_file_remove_group (priv->key_file, name, NULL); - - strongswan_connections_save_connections (self); -} - diff --git a/src/frontends/maemo/src/strongswan-connections.h b/src/frontends/maemo/src/strongswan-connections.h deleted file mode 100644 index f7a42acad..000000000 --- a/src/frontends/maemo/src/strongswan-connections.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2010 Tobias Brunner - * Hochschule fuer Technik Rapperswil - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. See . - * - * This program 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 General Public License - * for more details. - */ - -#ifndef __STRONGSWAN_CONNECTIONS_H__ -#define __STRONGSWAN_CONNECTIONS_H__ - -#include - -#include "strongswan-connection.h" - -G_BEGIN_DECLS - -#define STRONGSWAN_TYPE_CONNECTIONS (strongswan_connections_get_type ()) -#define STRONGSWAN_CONNECTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STRONGSWAN_TYPE_CONNECTIONS, StrongswanConnections)) -#define STRONGSWAN_CONNECTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STRONGSWAN_TYPE_CONNECTIONS, StrongswanConnectionsClass)) -#define STRONGSWAN_IS_CONNECTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STRONGSWAN_TYPE_CONNECTIONS)) -#define STRONGSWAN_IS_CONNECTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), STRONGSWAN_TYPE_CONNECTIONS)) -#define STRONGSWAN_CONNECTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STRONGSWAN_TYPE_CONNECTIONS, StrongswanConnectionsClass)) - -typedef struct _StrongswanConnections StrongswanConnections; -typedef struct _StrongswanConnectionsClass StrongswanConnectionsClass; -typedef struct _StrongswanConnectionsPrivate StrongswanConnectionsPrivate; - -struct _StrongswanConnections -{ - GObject gobject; - - StrongswanConnectionsPrivate *priv; -}; - -struct _StrongswanConnectionsClass -{ - GObjectClass parent_class; -}; - -GType strongswan_connections_get_type (void); - -StrongswanConnections *strongswan_connections_new (void); - -GtkTreeModel *strongswan_connections_get_model (StrongswanConnections *connections); -void strongswan_connections_setup_column_renderers (StrongswanConnections *connections, GtkCellLayout *layout); - -StrongswanConnection *strongswan_connections_get_connection (StrongswanConnections *self, const gchar *name); -void strongswan_connections_save_connection (StrongswanConnections *self, StrongswanConnection *conn); -void strongswan_connections_remove_connection (StrongswanConnections *self, const gchar *name); - -#ifdef USE_DYNAMIC_TYPES -void strongswan_connections_register (GTypeModule *type_module); -#endif - -G_END_DECLS - -#endif /* __STRONGSWAN_CONNECTIONS_H__ */ diff --git a/src/frontends/maemo/src/strongswan-settings.c b/src/frontends/maemo/src/strongswan-settings.c deleted file mode 100644 index 9773590f6..000000000 --- a/src/frontends/maemo/src/strongswan-settings.c +++ /dev/null @@ -1,353 +0,0 @@ -/* - * Copyright (C) 2010 Tobias Brunner - * Hochschule fuer Technik Rapperswil - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. See . - * - * This program 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 General Public License - * for more details. - */ - -#include -#include -#include -#include - -#include - -#include "strongswan-connections.h" - -enum { - RESPONSE_NEW = 1, - RESPONSE_EDIT, - RESPONSE_DELETE -}; - -struct { - GtkWidget *dialog; - GtkWidget *list; - StrongswanConnections *conns; -} ListDialog = { 0, }; - -/** - * Callback if no certificate should be selected - */ -void no_certificate(HildonButton *button, gpointer user_data) -{ - gtk_dialog_response (GTK_DIALOG (user_data), GTK_RESPONSE_REJECT); -} - -/** - * Callback to select a certificate - */ -void select_cert(HildonButton *button, gpointer user_data) -{ - GtkWidget *selector = hildon_file_chooser_dialog_new (GTK_WINDOW (user_data), GTK_FILE_CHOOSER_ACTION_OPEN); - GtkWidget *nocert = hildon_button_new (HILDON_SIZE_FINGER_HEIGHT | - HILDON_SIZE_AUTO_WIDTH, - HILDON_BUTTON_ARRANGEMENT_VERTICAL); - hildon_button_set_text (HILDON_BUTTON (nocert), - "No certificate", - "Use system-wide CA certificates"); - hildon_button_set_alignment (HILDON_BUTTON (nocert), 0, 0.5, 1, 1); - g_signal_connect (nocert, "clicked", G_CALLBACK (no_certificate), selector); - hildon_file_chooser_dialog_add_extra (HILDON_FILE_CHOOSER_DIALOG (selector), - nocert); - gtk_widget_show_all (selector); - - switch (gtk_dialog_run (GTK_DIALOG (selector))) - { - case GTK_RESPONSE_OK: - { - gchar *file = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (selector)); - hildon_button_set_value (button, file); - g_free(file); - break; - } - case GTK_RESPONSE_REJECT: - { - hildon_button_set_value (button, "None"); - break; - } - default: - break; - } - gtk_widget_destroy (selector); -} - -/** - * Shows a dialog to edit the given connection (or create a new one, - * if conn is NULL) - */ -static void -edit_connection (gpointer *parent, StrongswanConnection *conn) -{ - GtkWidget *dialog; - dialog = gtk_dialog_new_with_buttons ( - conn ? "Edit Connection" : "New Connection", - GTK_WINDOW (parent), - GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR, - GTK_STOCK_CANCEL, - GTK_RESPONSE_CANCEL, - GTK_STOCK_SAVE, - GTK_RESPONSE_OK, - NULL); - GtkWidget *vbox = GTK_DIALOG (dialog)->vbox; - GtkSizeGroup *group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); - - GtkWidget *name = hildon_entry_new (HILDON_SIZE_AUTO); - hildon_gtk_entry_set_placeholder_text (GTK_ENTRY (name), "Connection Name"); - hildon_gtk_entry_set_input_mode (GTK_ENTRY (name), - HILDON_GTK_INPUT_MODE_AUTOCAP | - HILDON_GTK_INPUT_MODE_ALPHA | - HILDON_GTK_INPUT_MODE_NUMERIC); - GtkWidget *ncap = hildon_caption_new (group, - "Name", - name, - NULL, - HILDON_CAPTION_OPTIONAL); - gtk_box_pack_start (GTK_BOX (vbox), ncap, TRUE, TRUE, 0); - - GtkWidget *host = hildon_entry_new (HILDON_SIZE_AUTO); - hildon_gtk_entry_set_placeholder_text (GTK_ENTRY (host), "Hostname / IP"); - hildon_gtk_entry_set_input_mode (GTK_ENTRY (host), - HILDON_GTK_INPUT_MODE_FULL); - GtkWidget *hcap = hildon_caption_new (group, - "Host", - host, - NULL, - HILDON_CAPTION_OPTIONAL); - gtk_box_pack_start (GTK_BOX (vbox), hcap, TRUE, TRUE, 0); - - GtkWidget *cert = hildon_button_new (HILDON_SIZE_FINGER_HEIGHT | - HILDON_SIZE_AUTO_WIDTH, - HILDON_BUTTON_ARRANGEMENT_VERTICAL); - hildon_button_set_text (HILDON_BUTTON (cert), - "Host or CA Certificate", - "None"); - hildon_button_set_alignment (HILDON_BUTTON (cert), 0, 0.5, 1, 1); - g_signal_connect (cert, "clicked", G_CALLBACK (select_cert), dialog); - GtkWidget *ccap = hildon_caption_new (group, - "Certificate", - cert, - NULL, - HILDON_CAPTION_OPTIONAL); - gtk_box_pack_start (GTK_BOX (vbox), ccap, TRUE, TRUE, 0); - - GtkWidget *user = hildon_entry_new (HILDON_SIZE_AUTO); - hildon_gtk_entry_set_placeholder_text (GTK_ENTRY (user), "Username"); - hildon_gtk_entry_set_input_mode (GTK_ENTRY (user), - HILDON_GTK_INPUT_MODE_FULL); - GtkWidget *ucap = hildon_caption_new (group, - "Username", - user, - NULL, - HILDON_CAPTION_OPTIONAL); - gtk_box_pack_start (GTK_BOX (vbox), ucap, TRUE, TRUE, 0); - - if (conn) - { - gchar *c_name, *c_host, *c_cert, *c_user; - g_object_get (conn, - "name", &c_name, - "host", &c_host, - "cert", &c_cert, - "user", &c_user, - NULL); - gtk_entry_set_text (GTK_ENTRY (name), c_name); - gtk_entry_set_text (GTK_ENTRY (host), c_host); - hildon_button_set_value (HILDON_BUTTON (cert), - c_cert ? c_cert : "None"); - gtk_entry_set_text (GTK_ENTRY (user), c_user); - g_free (c_name); - g_free (c_host); - g_free (c_cert); - g_free (c_user); - } - - gtk_widget_show_all (dialog); - - gint retval = gtk_dialog_run (GTK_DIALOG (dialog)); - if (retval == GTK_RESPONSE_OK) - { - const gchar *c_name, *c_cert; - c_name = gtk_entry_get_text (GTK_ENTRY (name)); - if (!conn) - { - conn = strongswan_connection_new (c_name); - } - c_cert = hildon_button_get_value (HILDON_BUTTON (cert)); - c_cert = strcmp (c_cert, "None") ? c_cert : NULL; - g_object_set (conn, - "name", c_name, - "host", gtk_entry_get_text (GTK_ENTRY (host)), - "cert", c_cert, - "user", gtk_entry_get_text (GTK_ENTRY (user)), - NULL); - strongswan_connections_save_connection (ListDialog.conns, conn); - } - gtk_widget_destroy (dialog); -} - -/** - * Creates a dialog showing a list of all connections - */ -static void -create_list_dialog (gpointer *parent) -{ - GtkWidget *dialog = gtk_dialog_new_with_buttons ( - "strongSwan Connections", - GTK_WINDOW (parent), - GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR, - GTK_STOCK_NEW, - RESPONSE_NEW, - GTK_STOCK_EDIT, - RESPONSE_EDIT, - GTK_STOCK_DELETE, - RESPONSE_DELETE, - GTK_STOCK_CLOSE, - GTK_RESPONSE_OK, - NULL); - ListDialog.dialog = dialog; - GtkWidget *vbox = GTK_DIALOG (dialog)->vbox; - - ListDialog.conns = strongswan_connections_new (); - - GtkTreeModel *model = strongswan_connections_get_model (ListDialog.conns); - ListDialog.list = gtk_tree_view_new_with_model (model); - g_object_unref (model); - - GtkTreeSelection *selection; - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ListDialog.list)); - gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE); - - GtkTreeViewColumn *column = gtk_tree_view_column_new (); - strongswan_connections_setup_column_renderers (ListDialog.conns, - GTK_CELL_LAYOUT (column)); - gtk_tree_view_append_column (GTK_TREE_VIEW (ListDialog.list), column); - - gtk_box_pack_start (GTK_BOX (vbox), - ListDialog.list, - TRUE, - TRUE, - HILDON_MARGIN_DEFAULT); - gtk_widget_show_all (dialog); - gtk_widget_hide (dialog); -} - -/** - * Get the name fo the selected connection in the list (or NULL). - * The name has to be freed. - */ -static gchar * -get_selected (void) -{ - GtkTreeView *tree = GTK_TREE_VIEW(ListDialog.list); - GtkTreeSelection *selection; - GtkTreeModel *model; - GtkTreeIter iter; - gchar *name = NULL; - - selection = gtk_tree_view_get_selection (tree); - model = gtk_tree_view_get_model (tree); - if (gtk_tree_selection_get_selected (selection, &model, &iter)) - { - gtk_tree_model_get(model, &iter, 0, &name, -1); - } - return name; -} - -/** - * main callback for control panel plugins - */ -osso_return_t execute(osso_context_t *osso, gpointer data, - gboolean user_activated) -{ - gint response; - - create_list_dialog (data); - - if (!user_activated) - { - /* load state */ - } - - do - { - gchar *selected; - response = gtk_dialog_run (GTK_DIALOG (ListDialog.dialog)); - switch (response) - { - case RESPONSE_NEW: - { - edit_connection (data, NULL); - break; - } - case RESPONSE_EDIT: - { - StrongswanConnection *conn; - selected = get_selected (); - conn = strongswan_connections_get_connection (ListDialog.conns, - selected); - if (conn) - { - edit_connection (data, conn); - } - else - { - hildon_banner_show_information (NULL, NULL, - "Select a connection first"); - } - g_free (selected); - break; - } - case RESPONSE_DELETE: - { - GtkWidget *confirm; - gint retval; - gchar *msg; - selected = get_selected (); - if (!selected) - { - hildon_banner_show_information (NULL, NULL, - "Select a connection first"); - break; - } - msg = g_strdup_printf ("Delete connection?\n%s", selected); - confirm = hildon_note_new_confirmation (data, msg); - retval = gtk_dialog_run (GTK_DIALOG (confirm)); - if (retval == GTK_RESPONSE_OK) - { - strongswan_connections_remove_connection (ListDialog.conns, - selected); - } - gtk_widget_destroy (confirm); - g_free (msg); - g_free (selected); - break; - } - default: - break; - } - } - while (response > 0); - - gtk_widget_destroy (ListDialog.dialog); - g_object_unref (ListDialog.conns); - return OSSO_OK; -} - -/** - * callback called in case state has to be saved - */ -osso_return_t save_state(osso_context_t *osso, gpointer data) -{ - /* save state */ - return OSSO_OK; -} - diff --git a/src/frontends/maemo/src/strongswan-status.c b/src/frontends/maemo/src/strongswan-status.c deleted file mode 100644 index 278ca080d..000000000 --- a/src/frontends/maemo/src/strongswan-status.c +++ /dev/null @@ -1,621 +0,0 @@ -/* - * Copyright (C) 2010 Tobias Brunner - * Hochschule fuer Technik Rapperswil - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. See . - * - * This program 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 General Public License - * for more details. - */ - -#include -#include - -#include - -#include "strongswan-status.h" -#include "strongswan-connections.h" - -#define STRONGSWAN_STATUS_GET_PRIVATE(object) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((object), \ - STRONGSWAN_TYPE_STATUS, \ - StrongswanStatusPrivate)) - -#define OSSO_STATUS_NAME "status" -#define OSSO_STATUS_SERVICE "org.strongswan."OSSO_STATUS_NAME -#define OSSO_STATUS_OBJECT "/org/strongswan/"OSSO_STATUS_NAME -#define OSSO_STATUS_IFACE "org.strongswan."OSSO_STATUS_NAME - -#define OSSO_CHARON_NAME "charon" -#define OSSO_CHARON_SERVICE "org.strongswan."OSSO_CHARON_NAME -#define OSSO_CHARON_OBJECT "/org/strongswan/"OSSO_CHARON_NAME -#define OSSO_CHARON_IFACE "org.strongswan."OSSO_CHARON_NAME - -#define ICON_SIZE_STATUS 18 -#define ICON_SIZE_BUTTON 48 - -#define UNREF_IF(obj) do { \ - if (obj) { obj = (g_object_unref (obj), NULL); } \ -} while(0) - -typedef enum -{ - STATUS_DISCONNECTED, - STATUS_CONNECTING, - STATUS_CONNECTED, - STATUS_AUTH_FAILED, - STATUS_CONNECTION_FAILED, -} StrongswanConnectionStatus; - -struct _StrongswanStatusPrivate -{ - struct { - GdkPixbuf *status_open; - GdkPixbuf *status_close; - GdkPixbuf *button_open; - GdkPixbuf *button_close; - } icons; - - GtkWidget *dialog; - GtkWidget *button; - GtkWidget *image; - GtkWidget *selector; - GtkWidget *box; - - osso_context_t *context; - - StrongswanConnections *conns; - - StrongswanConnectionStatus status; - gchar *current; -}; - -HD_DEFINE_PLUGIN_MODULE_EXTENDED (StrongswanStatus, strongswan_status, \ - HD_TYPE_STATUS_MENU_ITEM, {}, { \ - strongswan_connection_register (G_TYPE_MODULE (plugin)); \ - strongswan_connections_register (G_TYPE_MODULE (plugin)); }, {}); - -static void -update_status_menu (StrongswanStatus *plugin) -{ - StrongswanStatusPrivate *priv = plugin->priv; - switch (priv->status) - { - default: - case STATUS_DISCONNECTED: - { - hildon_button_set_value (HILDON_BUTTON (priv->button), - "Not connected"); - hd_status_plugin_item_set_status_area_icon ( - HD_STATUS_PLUGIN_ITEM (plugin), - priv->icons.status_open); - gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), - priv->icons.button_open); - break; - } - case STATUS_CONNECTING: - { - gchar *msg = g_strdup_printf ("Connecting to %s...", priv->current); - hildon_button_set_value (HILDON_BUTTON (priv->button), msg); - g_free (msg); - break; - } - case STATUS_CONNECTED: - { - gchar *msg = g_strdup_printf ("Connected to %s", priv->current); - hildon_button_set_value (HILDON_BUTTON (priv->button), msg); - g_free (msg); - hd_status_plugin_item_set_status_area_icon ( - HD_STATUS_PLUGIN_ITEM (plugin), - priv->icons.status_close); - gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), - priv->icons.button_close); - break; - } - } -} - -static void -update_dialog_connecting (StrongswanStatus *plugin) -{ - StrongswanStatusPrivate *priv = plugin->priv; - - gtk_widget_set_sensitive (priv->box, FALSE); - hildon_gtk_window_set_progress_indicator (GTK_WINDOW (priv->dialog), 1); -} - -static void -update_dialog_default (StrongswanStatus *plugin) -{ - StrongswanStatusPrivate *priv = plugin->priv; - - gtk_widget_set_sensitive (priv->box, TRUE); - hildon_gtk_window_set_progress_indicator (GTK_WINDOW (priv->dialog), 0); -} - -static void -dialog_response (GtkDialog *dialog, gint response_id, StrongswanStatus *plugin) -{ - StrongswanStatusPrivate *priv = plugin->priv; - gtk_widget_destroy (priv->dialog); - priv->dialog = NULL; -} - -static void -handle_status_change (StrongswanStatus *plugin, - StrongswanConnectionStatus status, - gchar *message) -{ - StrongswanStatusPrivate *priv = plugin->priv; - gchar *msg = NULL; - - switch (status) - { - case STATUS_CONNECTION_FAILED: - { - if (priv->status == STATUS_CONNECTED) - { - msg = g_strdup_printf ("Lost connection to %s", priv->current); - } - else if (message) - { - msg = g_strdup_printf ("Failed to connect to %s: %s", - priv->current, message); - } - else - { - msg = g_strdup_printf ("Failed to connect to %s", - priv->current); - } - status = STATUS_DISCONNECTED; - break; - } - case STATUS_AUTH_FAILED: - { - msg = g_strdup_printf ("Failed to connect to %s: authentication " - "failed", priv->current); - status = STATUS_DISCONNECTED; - /* TODO: show password dialog again? */ - break; - } - case STATUS_CONNECTED: - { - msg = g_strdup_printf ("Successfully connected to %s", - priv->current); - break; - } - default: - case STATUS_DISCONNECTED: - { - msg = g_strdup_printf ("Disconnected from %s", priv->current); - break; - } - } - - priv->status = status; - - if (status == STATUS_DISCONNECTED) - { - priv->current = (g_free (priv->current), NULL); - } - - hildon_banner_show_information (NULL, NULL, msg); - g_free (msg); - - update_status_menu (plugin); - - if (priv->dialog) - { - update_dialog_default (plugin); - if (status == STATUS_CONNECTED) - { - gtk_dialog_response (GTK_DIALOG (priv->dialog), GTK_RESPONSE_OK); - } - } -} - -static gboolean -get_password (StrongswanStatus *plugin, gchar **password) -{ - StrongswanStatusPrivate *priv = plugin->priv; - gboolean result = FALSE; - - GtkWidget *dialog = gtk_dialog_new_with_buttons ( - "Connecting...", - GTK_WINDOW(priv->dialog), - GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR, - GTK_STOCK_CANCEL, - GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, - GTK_RESPONSE_OK, - NULL); - gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); - GtkWidget *vbox = GTK_DIALOG (dialog)->vbox; - GtkSizeGroup *group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); - - GtkWidget *pass = hildon_entry_new (HILDON_SIZE_AUTO); - hildon_gtk_entry_set_placeholder_text (GTK_ENTRY (pass), "Password"); - hildon_gtk_entry_set_input_mode (GTK_ENTRY (pass), - HILDON_GTK_INPUT_MODE_FULL | - HILDON_GTK_INPUT_MODE_INVISIBLE); - GtkWidget *pcap = hildon_caption_new (group, - "Password", - pass, - NULL, - HILDON_CAPTION_OPTIONAL); - gtk_box_pack_start (GTK_BOX (vbox), pcap, TRUE, TRUE, 0); - gtk_widget_show_all (dialog); - - gint retval = gtk_dialog_run (GTK_DIALOG (dialog)); - if (retval == GTK_RESPONSE_OK) - { - *password = g_strdup (gtk_entry_get_text (GTK_ENTRY (pass))); - result = TRUE; - } - gtk_widget_destroy (dialog); - return result; -} - -static void -connect_clicked (HildonButton *button, StrongswanStatus *plugin) -{ - StrongswanStatusPrivate *priv = plugin->priv; - osso_return_t result; - osso_rpc_t retval; - - priv->current = hildon_touch_selector_get_current_text ( - HILDON_TOUCH_SELECTOR (priv->selector)); - priv->status = STATUS_CONNECTING; - update_dialog_connecting (plugin); - update_status_menu (plugin); - - StrongswanConnection *conn = strongswan_connections_get_connection ( - priv->conns, - priv->current); - if (!conn) - { - handle_status_change (plugin, STATUS_CONNECTION_FAILED, "not found"); - return; - } - - /* this call on the system bus is only needed to start charon as root */ - result = osso_rpc_run_system (priv->context, - OSSO_CHARON_SERVICE, - OSSO_CHARON_OBJECT, - OSSO_CHARON_IFACE, - "Start", - &retval, - DBUS_TYPE_INVALID); - osso_rpc_free_val (&retval); - if (result != OSSO_OK) - { - handle_status_change (plugin, STATUS_CONNECTION_FAILED, - "couldn't connect to charon"); - return; - } - - gchar *c_host, *c_cert, *c_user, *c_pass; - - if (!get_password (plugin, &c_pass)) - { - update_dialog_default (plugin); - return; - } - - g_object_get (conn, - "host", &c_host, - "cert", &c_cert, - "user", &c_user, - NULL); - - result = osso_rpc_run (priv->context, - OSSO_CHARON_SERVICE, - OSSO_CHARON_OBJECT, - OSSO_CHARON_IFACE, - "Connect", - &retval, - DBUS_TYPE_STRING, priv->current, - DBUS_TYPE_STRING, c_host, - DBUS_TYPE_STRING, c_cert, - DBUS_TYPE_STRING, c_user, - DBUS_TYPE_STRING, c_pass, - DBUS_TYPE_INVALID); - - g_free (c_host); - g_free (c_cert); - g_free (c_user); - g_free (c_pass); - - if (result != OSSO_OK || !retval.value.b) - { - handle_status_change (plugin, STATUS_CONNECTION_FAILED, - "initiation failed"); - osso_rpc_free_val (&retval); - return; - } - osso_rpc_free_val (&retval); -} - -static void -disconnect_clicked (HildonButton *button, StrongswanStatus *plugin) -{ - osso_return_t result; - osso_rpc_t retval; - gchar *msg; - StrongswanStatusPrivate *priv = plugin->priv; - - gtk_widget_set_sensitive (priv->box, FALSE); - hildon_gtk_window_set_progress_indicator (GTK_WINDOW (priv->dialog), 1); - - result = osso_rpc_run_system (priv->context, - OSSO_CHARON_SERVICE, - OSSO_CHARON_OBJECT, - OSSO_CHARON_IFACE, - "Disconnect", - &retval, - DBUS_TYPE_INVALID); - - gtk_widget_set_sensitive (priv->box, TRUE); - hildon_gtk_window_set_progress_indicator (GTK_WINDOW (priv->dialog), 0); - - if (result == OSSO_OK) - { - msg = g_strdup_printf ("Successfully disconnected from %s", - priv->current); - } - else - { - msg = g_strdup_printf ("Failed to disconnect from %s", priv->current); - } - hildon_banner_show_information (NULL, NULL, msg); - g_free (msg); - - priv->current = (g_free (priv->current), NULL); - priv->status = STATUS_DISCONNECTED; - - update_status_menu (plugin); - - gtk_dialog_response (GTK_DIALOG (priv->dialog), GTK_RESPONSE_OK); -} - -static void -setup_dialog_disconnected (StrongswanStatus *plugin) -{ - StrongswanStatusPrivate *priv = plugin->priv; - - GtkWidget *vbox = GTK_DIALOG (priv->dialog)->vbox; - GtkWidget *hbox = gtk_hbox_new (FALSE, 0); - priv->box = hbox; - GtkWidget *button = hildon_picker_button_new ( - HILDON_SIZE_FINGER_HEIGHT | - HILDON_SIZE_AUTO_WIDTH, - HILDON_BUTTON_ARRANGEMENT_HORIZONTAL); - hildon_button_set_title (HILDON_BUTTON (button), "Connection:"); - gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); - - GtkWidget *selector = hildon_touch_selector_new (); - priv->selector = selector; - GtkTreeModel *model = strongswan_connections_get_model (priv->conns); - hildon_touch_selector_append_text_column ( - HILDON_TOUCH_SELECTOR (selector), - model, - TRUE); - hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (button), - HILDON_TOUCH_SELECTOR (selector)); - - button = hildon_button_new_with_text ( - HILDON_SIZE_FINGER_HEIGHT | - HILDON_SIZE_AUTO_WIDTH, - HILDON_BUTTON_ARRANGEMENT_HORIZONTAL, - "Connect", NULL); - gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); - g_signal_connect (button, "clicked", G_CALLBACK (connect_clicked), - plugin); -} - -static void -setup_dialog_connected (StrongswanStatus *plugin) -{ - StrongswanStatusPrivate *priv = plugin->priv; - - GtkWidget *vbox = GTK_DIALOG (priv->dialog)->vbox; - GtkWidget *hbox = gtk_hbox_new (FALSE, 0); - priv->box = hbox; - GtkWidget *button = hildon_button_new_with_text ( - HILDON_SIZE_FINGER_HEIGHT | - HILDON_SIZE_AUTO_WIDTH, - HILDON_BUTTON_ARRANGEMENT_HORIZONTAL, - "Disconnect", priv->current); - hildon_button_set_style (HILDON_BUTTON (button), - HILDON_BUTTON_STYLE_PICKER); - g_signal_connect (button, "clicked", G_CALLBACK (disconnect_clicked), - plugin); - gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); -} - -static void -button_clicked (HildonButton *button, StrongswanStatus *plugin) -{ - StrongswanStatusPrivate *priv = plugin->priv; - - priv->dialog = gtk_dialog_new (); - gtk_window_set_title (GTK_WINDOW (priv->dialog), "strongSwan VPN"); - g_signal_connect (priv->dialog, "response", - G_CALLBACK (dialog_response), plugin); - - switch (priv->status) - { - default: - case STATUS_DISCONNECTED: - setup_dialog_disconnected (plugin); - break; - case STATUS_CONNECTING: - setup_dialog_disconnected (plugin); - update_dialog_connecting (plugin); - break; - case STATUS_CONNECTED: - setup_dialog_connected (plugin); - break; - } - - gtk_widget_show_all (priv->dialog); -} - -static gint -dbus_req_handler(const gchar *interface, const gchar *method, - GArray *arguments, StrongswanStatus *plugin, - osso_rpc_t *retval) -{ - if (!strcmp (method, "StatusChanged") && arguments->len == 1) - { - int status = 0; - osso_rpc_t *arg = &g_array_index(arguments, osso_rpc_t, 0); - if (arg->type == DBUS_TYPE_INT32) - { - status = arg->value.i; - } - handle_status_change (plugin, status, NULL); - } - return OSSO_OK; -} - -static GdkPixbuf* -load_icon (GtkIconTheme *theme, const gchar *name, gint size) -{ - GdkPixbuf *icon = gtk_icon_theme_load_icon (theme, name, size, - GTK_ICON_LOOKUP_NO_SVG, NULL); - return icon; -} - -static void -load_icons (StrongswanStatusPrivate *priv) -{ - GtkIconTheme *theme = gtk_icon_theme_get_default (); - priv->icons.status_open = load_icon (theme, "strongswan_lock_open", - ICON_SIZE_STATUS); - priv->icons.status_close = load_icon (theme, "strongswan_lock_close", - ICON_SIZE_STATUS); - priv->icons.button_open = load_icon (theme, "strongswan_lock_open", - ICON_SIZE_BUTTON); - priv->icons.button_close = load_icon (theme, "strongswan_lock_close", - ICON_SIZE_BUTTON); -} - -static void -icon_theme_changed (GtkIconTheme *theme, StrongswanStatus *plugin) -{ - StrongswanStatusPrivate *priv = plugin->priv; - UNREF_IF(priv->icons.status_open); - UNREF_IF(priv->icons.status_close); - UNREF_IF(priv->icons.button_open); - UNREF_IF(priv->icons.button_close); - load_icons (priv); - update_status_menu (plugin); -} - -static void -strongswan_status_init (StrongswanStatus *plugin) -{ - StrongswanStatusPrivate *priv = STRONGSWAN_STATUS_GET_PRIVATE (plugin); - plugin->priv = priv; - - priv->context = osso_initialize (OSSO_STATUS_SERVICE, "0.0.1", TRUE, NULL); - if (!priv->context) - { - return; - } - osso_return_t result; - result = osso_rpc_set_cb_f (priv->context, - OSSO_STATUS_SERVICE, - OSSO_STATUS_OBJECT, - OSSO_STATUS_IFACE, - (osso_rpc_cb_f*)dbus_req_handler, - plugin); - if (result != OSSO_OK) - { - return; - } - - priv->conns = strongswan_connections_new (); - - load_icons(priv); - - hd_status_plugin_item_set_status_area_icon (HD_STATUS_PLUGIN_ITEM (plugin), - priv->icons.status_open); - - GtkWidget *button = hildon_button_new_with_text ( - HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, - HILDON_BUTTON_ARRANGEMENT_VERTICAL, - "strongSwan VPN", "Not connected"); - hildon_button_set_style (HILDON_BUTTON (button), - HILDON_BUTTON_STYLE_PICKER); - priv->button = button; - gtk_container_add (GTK_CONTAINER (plugin), button); - - GtkWidget *image = gtk_image_new_from_pixbuf (priv->icons.button_open); - priv->image = image; - hildon_button_set_image (HILDON_BUTTON (button), image); - - gtk_button_set_alignment (GTK_BUTTON (button), 0.0, 0.5); - - g_signal_connect (button, "clicked", G_CALLBACK (button_clicked), plugin); - - gtk_widget_show_all (GTK_WIDGET (plugin)); - - g_signal_connect (gtk_icon_theme_get_default (), "changed", - G_CALLBACK (icon_theme_changed), plugin); -} - -static void -strongswan_status_dispose (GObject *object) -{ - StrongswanStatusPrivate *priv = STRONGSWAN_STATUS (object)->priv; - if (priv->context) - { - osso_rpc_unset_cb_f (priv->context, - OSSO_STATUS_SERVICE, - OSSO_STATUS_OBJECT, - OSSO_STATUS_IFACE, - (osso_rpc_cb_f*)dbus_req_handler, - STRONGSWAN_STATUS (object)); - osso_deinitialize (priv->context); - priv->context = NULL; - } - UNREF_IF(priv->conns); - UNREF_IF(priv->icons.status_open); - UNREF_IF(priv->icons.status_close); - UNREF_IF(priv->icons.button_open); - UNREF_IF(priv->icons.button_close); - G_OBJECT_CLASS (strongswan_status_parent_class)->dispose (object); -} - -static void -strongswan_status_finalize (GObject *object) -{ - StrongswanStatusPrivate *priv = STRONGSWAN_STATUS (object)->priv; - priv->current = (g_free (priv->current), NULL); - G_OBJECT_CLASS (strongswan_status_parent_class)->finalize (object); -} - -static void -strongswan_status_class_finalize (StrongswanStatusClass *klass) -{ -} - -static void -strongswan_status_class_init (StrongswanStatusClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->dispose = strongswan_status_dispose; - object_class->finalize = strongswan_status_finalize; - - g_type_class_add_private (klass, sizeof (StrongswanStatusPrivate)); -} diff --git a/src/frontends/maemo/src/strongswan-status.h b/src/frontends/maemo/src/strongswan-status.h deleted file mode 100644 index 9daa8e59d..000000000 --- a/src/frontends/maemo/src/strongswan-status.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2010 Tobias Brunner - * Hochschule fuer Technik Rapperswil - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. See . - * - * This program 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 General Public License - * for more details. - */ - -#ifndef __STRONGSWAN_STATUS_H__ -#define __STRONGSWAN_STATUS_H__ - -#include - -G_BEGIN_DECLS - -#define STRONGSWAN_TYPE_STATUS (strongswan_status_get_type ()) -#define STRONGSWAN_STATUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STRONGSWAN_TYPE_STATUS, StrongswanStatus)) -#define STRONGSWAN_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STRONGSWAN_TYPE_STATUS, StrongswanStatusClass)) -#define STRONGSWAN_IS_STATUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STRONGSWAN_TYPE_STATUS)) -#define STRONGSWAN_IS_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), STRONGSWAN_TYPE_STATUS)) -#define STRONGSWAN_STATUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STRONGSWAN_TYPE_STATUSS, StrongswanStatusClass)) - -typedef struct _StrongswanStatus StrongswanStatus; -typedef struct _StrongswanStatusClass StrongswanStatusClass; -typedef struct _StrongswanStatusPrivate StrongswanStatusPrivate; - -struct _StrongswanStatus -{ - HDStatusMenuItem parent; - - StrongswanStatusPrivate *priv; -}; - -struct _StrongswanStatusClass -{ - HDStatusMenuItemClass parent; -}; - -GType strongswan_status_get_type (void); - -G_END_DECLS - -#endif /* __STRONGSWAN_STATUS_H__ */ -