aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2010-06-04 14:41:45 +0200
committerTobias Brunner <tobias@strongswan.org>2010-10-14 17:36:17 +0200
commit59df6ff93c874d4d95cdde5c47e37e21ed8cbd85 (patch)
treee9784b7582b056773962218f9417196c63fa5d28 /src
parent41b2fbb29fb686cc6467f2de15cca65cf44fcd85 (diff)
downloadstrongswan-59df6ff93c874d4d95cdde5c47e37e21ed8cbd85.tar.bz2
strongswan-59df6ff93c874d4d95cdde5c47e37e21ed8cbd85.tar.xz
Enable dynamic registration of StrongswanConnection(s) type.
Because status menu plugins get loaded and unloaded dynamically by the Hildon Desktop, we have to register our Types dynamically.
Diffstat (limited to 'src')
-rw-r--r--src/frontends/maemo/src/strongswan-connection.c15
-rw-r--r--src/frontends/maemo/src/strongswan-connection.h4
-rw-r--r--src/frontends/maemo/src/strongswan-connections.c15
-rw-r--r--src/frontends/maemo/src/strongswan-connections.h4
4 files changed, 38 insertions, 0 deletions
diff --git a/src/frontends/maemo/src/strongswan-connection.c b/src/frontends/maemo/src/strongswan-connection.c
index a861dfabf..28c8f1366 100644
--- a/src/frontends/maemo/src/strongswan-connection.c
+++ b/src/frontends/maemo/src/strongswan-connection.c
@@ -42,7 +42,15 @@ enum
PROP_PASS,
};
+#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,
@@ -176,6 +184,13 @@ strongswan_connection_class_init (StrongswanConnectionClass *klass)
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,
diff --git a/src/frontends/maemo/src/strongswan-connection.h b/src/frontends/maemo/src/strongswan-connection.h
index e80a1623d..2e4fd45ec 100644
--- a/src/frontends/maemo/src/strongswan-connection.h
+++ b/src/frontends/maemo/src/strongswan-connection.h
@@ -51,6 +51,10 @@ 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
index 3f152c2b5..2686a620b 100644
--- a/src/frontends/maemo/src/strongswan-connections.c
+++ b/src/frontends/maemo/src/strongswan-connections.c
@@ -34,7 +34,15 @@ struct _StrongswanConnectionsPrivate
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)
@@ -218,6 +226,13 @@ strongswan_connections_class_init (StrongswanConnectionsClass *klass)
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)
{
diff --git a/src/frontends/maemo/src/strongswan-connections.h b/src/frontends/maemo/src/strongswan-connections.h
index ff753413c..f7a42acad 100644
--- a/src/frontends/maemo/src/strongswan-connections.h
+++ b/src/frontends/maemo/src/strongswan-connections.h
@@ -56,6 +56,10 @@ StrongswanConnection *strongswan_connections_get_connection (StrongswanConnectio
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__ */