[network-manager-fortisslvpn/th/gtk-split-and-log-bgo771544: 13/26] properties: split "nm-fortsslvpn-editor-plugin.c" out of "nm-fortsslvpn.c"
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-fortisslvpn/th/gtk-split-and-log-bgo771544: 13/26] properties: split "nm-fortsslvpn-editor-plugin.c" out of "nm-fortsslvpn.c"
- Date: Fri, 16 Sep 2016 16:35:06 +0000 (UTC)
commit 267854d59eff3fc6c1831e8b0a40ca98230fb7ae
Author: Thomas Haller <thaller redhat com>
Date: Fri Sep 16 08:37:34 2016 +0200
properties: split "nm-fortsslvpn-editor-plugin.c" out of "nm-fortsslvpn.c"
po/POTFILES.in | 1 +
properties/Makefile.am | 2 +
properties/nm-fortisslvpn-editor-plugin.c | 134 ++++++++++++++++++++++++++++
properties/nm-fortisslvpn-editor-plugin.h | 43 +++++++++
properties/nm-fortisslvpn.c | 137 ++++-------------------------
properties/nm-fortisslvpn.h | 24 +-----
6 files changed, 200 insertions(+), 141 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 3a93bce..f416ccd 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -2,6 +2,7 @@
# Please keep this file sorted alphabetically.
appdata/network-manager-fortisslvpn.metainfo.xml.in
auth-dialog/main.c
+properties/nm-fortisslvpn-editor-plugin.c
properties/nm-fortisslvpn.c
shared/nm-utils/nm-shared-utils.c
shared/nm-utils/nm-vpn-plugin-utils.c
diff --git a/properties/Makefile.am b/properties/Makefile.am
index d6c9269..13ee6e3 100644
--- a/properties/Makefile.am
+++ b/properties/Makefile.am
@@ -10,6 +10,8 @@ shared_sources = \
$(NULL)
plugin_sources = \
+ nm-fortisslvpn-editor-plugin.c \
+ nm-fortisslvpn-editor-plugin.h \
nm-fortisslvpn.c \
nm-fortisslvpn.h
diff --git a/properties/nm-fortisslvpn-editor-plugin.c b/properties/nm-fortisslvpn-editor-plugin.c
new file mode 100644
index 0000000..a212068
--- /dev/null
+++ b/properties/nm-fortisslvpn-editor-plugin.c
@@ -0,0 +1,134 @@
+/***************************************************************************
+ * Copyright (C) 2015 Lubomir Rintel <lkundrak v3 sk>
+ * Copyright (C) 2008 Dan Williams, <dcbw redhat com>
+ * Copyright (C) 2008 - 2011 Red Hat, Inc.
+ * Based on work by David Zeuthen, <davidz redhat com>
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ **************************************************************************/
+
+#include "nm-default.h"
+
+#include "nm-fortisslvpn-editor-plugin.h"
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "nm-fortisslvpn.h"
+
+#define FORTISSLVPN_PLUGIN_NAME _("Fortinet SSLVPN")
+#define FORTISSLVPN_PLUGIN_DESC _("Compatible with Fortinet SSLVPN servers.")
+#define FORTISSLVPN_PLUGIN_SERVICE NM_DBUS_SERVICE_FORTISSLVPN
+
+/*****************************************************************************/
+
+enum {
+ PROP_0,
+ PROP_NAME,
+ PROP_DESC,
+ PROP_SERVICE
+};
+
+static void fortisslvpn_editor_plugin_interface_init (NMVpnEditorPluginInterface *iface_class);
+
+G_DEFINE_TYPE_EXTENDED (FortisslvpnEditorPlugin, fortisslvpn_editor_plugin, G_TYPE_OBJECT, 0,
+ G_IMPLEMENT_INTERFACE (NM_TYPE_VPN_EDITOR_PLUGIN,
+ fortisslvpn_editor_plugin_interface_init))
+
+/*****************************************************************************/
+
+static guint32
+get_capabilities (NMVpnEditorPlugin *iface)
+{
+ return NM_VPN_EDITOR_PLUGIN_CAPABILITY_NONE;
+}
+
+static NMVpnEditor *
+get_editor (NMVpnEditorPlugin *iface, NMConnection *connection, GError **error)
+{
+ return nm_fortisslvpn_editor_new (connection, error);
+}
+
+static void
+get_property (GObject *object, guint prop_id,
+ GValue *value, GParamSpec *pspec)
+{
+ switch (prop_id) {
+ case PROP_NAME:
+ g_value_set_string (value, FORTISSLVPN_PLUGIN_NAME);
+ break;
+ case PROP_DESC:
+ g_value_set_string (value, FORTISSLVPN_PLUGIN_DESC);
+ break;
+ case PROP_SERVICE:
+ g_value_set_string (value, FORTISSLVPN_PLUGIN_SERVICE);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+fortisslvpn_editor_plugin_init (FortisslvpnEditorPlugin *plugin)
+{
+}
+
+static void
+fortisslvpn_editor_plugin_interface_init (NMVpnEditorPluginInterface *iface_class)
+{
+ /* interface implementation */
+ iface_class->get_editor = get_editor;
+ iface_class->get_capabilities = get_capabilities;
+ iface_class->import_from_file = NULL;
+ iface_class->export_to_file = NULL;
+ iface_class->get_suggested_filename = NULL;
+}
+
+static void
+fortisslvpn_editor_plugin_class_init (FortisslvpnEditorPluginClass *req_class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (req_class);
+
+ object_class->get_property = get_property;
+
+ g_object_class_override_property (object_class,
+ PROP_NAME,
+ NM_VPN_EDITOR_PLUGIN_NAME);
+
+ g_object_class_override_property (object_class,
+ PROP_DESC,
+ NM_VPN_EDITOR_PLUGIN_DESCRIPTION);
+
+ g_object_class_override_property (object_class,
+ PROP_SERVICE,
+ NM_VPN_EDITOR_PLUGIN_SERVICE);
+}
+
+G_MODULE_EXPORT NMVpnEditorPlugin *
+nm_vpn_editor_plugin_factory (GError **error)
+{
+ if (error)
+ g_return_val_if_fail (*error == NULL, NULL);
+
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+ return g_object_new (FORTISSLVPN_TYPE_EDITOR_PLUGIN, NULL);
+}
+
diff --git a/properties/nm-fortisslvpn-editor-plugin.h b/properties/nm-fortisslvpn-editor-plugin.h
new file mode 100644
index 0000000..36da55d
--- /dev/null
+++ b/properties/nm-fortisslvpn-editor-plugin.h
@@ -0,0 +1,43 @@
+/***************************************************************************
+ * Copyright (C) 2015 Lubomir Rintel <lkundrak v3 sk>
+ * Copyright (C) 2008 Dan Williams, <dcbw redhat com>
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ **************************************************************************/
+
+#ifndef __NM_FORTISSLVPN_EDITOR_PLUGIN_H__
+#define __NM_FORTISSLVPN_EDITOR_PLUGIN_H__
+
+#define FORTISSLVPN_TYPE_EDITOR_PLUGIN (fortisslvpn_editor_plugin_get_type ())
+#define FORTISSLVPN_EDITOR_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
FORTISSLVPN_TYPE_EDITOR_PLUGIN, FortisslvpnEditorPlugin))
+#define FORTISSLVPN_EDITOR_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
FORTISSLVPN_TYPE_EDITOR_PLUGIN, FortisslvpnEditorPluginClass))
+#define FORTISSLVPN_IS_EDITOR_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),
FORTISSLVPN_TYPE_EDITOR_PLUGIN))
+#define FORTISSLVPN_IS_EDITOR_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
FORTISSLVPN_TYPE_EDITOR_PLUGIN))
+#define FORTISSLVPN_EDITOR_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
FORTISSLVPN_TYPE_EDITOR_PLUGIN, FortisslvpnEditorPluginClass))
+
+typedef struct _FortisslvpnEditorPlugin FortisslvpnEditorPlugin;
+typedef struct _FortisslvpnEditorPluginClass FortisslvpnEditorPluginClass;
+
+struct _FortisslvpnEditorPlugin {
+ GObject parent;
+};
+
+struct _FortisslvpnEditorPluginClass {
+ GObjectClass parent;
+};
+
+GType fortisslvpn_editor_plugin_get_type (void);
+
+#endif /* __NM_FORTISSLVPN_EDITOR_PLUGIN_H__ */
diff --git a/properties/nm-fortisslvpn.c b/properties/nm-fortisslvpn.c
index 6dcf3c5..02380c7 100644
--- a/properties/nm-fortisslvpn.c
+++ b/properties/nm-fortisslvpn.c
@@ -33,36 +33,7 @@
#include <string.h>
#include <gtk/gtk.h>
-#define FORTISSLVPN_PLUGIN_NAME _("Fortinet SSLVPN")
-#define FORTISSLVPN_PLUGIN_DESC _("Compatible with Fortinet SSLVPN servers.")
-#define FORTISSLVPN_PLUGIN_SERVICE NM_DBUS_SERVICE_FORTISSLVPN
-
-typedef void (*ChangedCallback) (GtkWidget *widget, gpointer user_data);
-
-/************** plugin class **************/
-
-enum {
- PROP_0,
- PROP_NAME,
- PROP_DESC,
- PROP_SERVICE
-};
-
-static void fortisslvpn_editor_plugin_interface_init (NMVpnEditorPluginInterface *iface_class);
-
-G_DEFINE_TYPE_EXTENDED (FortisslvpnEditorPlugin, fortisslvpn_editor_plugin, G_TYPE_OBJECT, 0,
- G_IMPLEMENT_INTERFACE (NM_TYPE_VPN_EDITOR_PLUGIN,
- fortisslvpn_editor_plugin_interface_init))
-
-/************** UI widget class **************/
-
-static void fortisslvpn_editor_interface_init (NMVpnEditorInterface *iface_class);
-
-G_DEFINE_TYPE_EXTENDED (FortisslvpnEditor, fortisslvpn_editor, G_TYPE_OBJECT, 0,
- G_IMPLEMENT_INTERFACE (NM_TYPE_VPN_EDITOR,
- fortisslvpn_editor_interface_init))
-
-#define FORTISSLVPN_EDITOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), FORTISSLVPN_TYPE_EDITOR,
FortisslvpnEditorPrivate))
+/*****************************************************************************/
typedef struct {
GtkBuilder *builder;
@@ -74,6 +45,16 @@ typedef struct {
gchar *trusted_cert;
} FortisslvpnEditorPrivate;
+static void fortisslvpn_editor_interface_init (NMVpnEditorInterface *iface_class);
+
+G_DEFINE_TYPE_EXTENDED (FortisslvpnEditor, fortisslvpn_editor, G_TYPE_OBJECT, 0,
+ G_IMPLEMENT_INTERFACE (NM_TYPE_VPN_EDITOR,
+ fortisslvpn_editor_interface_init))
+
+#define FORTISSLVPN_EDITOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), FORTISSLVPN_TYPE_EDITOR,
FortisslvpnEditorPrivate))
+
+/*****************************************************************************/
+
static gboolean
check_validity (FortisslvpnEditor *self, GError **error)
{
@@ -455,8 +436,8 @@ is_new_func (const char *key, const char *value, gpointer user_data)
*is_new = FALSE;
}
-static NMVpnEditor *
-nm_vpn_editor_interface_new (NMConnection *connection, GError **error)
+NMVpnEditor *
+nm_fortisslvpn_editor_new (NMConnection *connection, GError **error)
{
NMVpnEditor *object;
FortisslvpnEditorPrivate *priv;
@@ -543,6 +524,11 @@ dispose (GObject *object)
}
static void
+fortisslvpn_editor_init (FortisslvpnEditor *plugin)
+{
+}
+
+static void
fortisslvpn_editor_class_init (FortisslvpnEditorClass *req_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (req_class);
@@ -553,96 +539,9 @@ fortisslvpn_editor_class_init (FortisslvpnEditorClass *req_class)
}
static void
-fortisslvpn_editor_init (FortisslvpnEditor *plugin)
-{
-}
-
-static void
fortisslvpn_editor_interface_init (NMVpnEditorInterface *iface_class)
{
/* interface implementation */
iface_class->get_widget = get_widget;
iface_class->update_connection = update_connection;
}
-
-static guint32
-get_capabilities (NMVpnEditorPlugin *iface)
-{
- return NM_VPN_EDITOR_PLUGIN_CAPABILITY_NONE;
-}
-
-static NMVpnEditor *
-get_editor (NMVpnEditorPlugin *iface, NMConnection *connection, GError **error)
-{
- return nm_vpn_editor_interface_new (connection, error);
-}
-
-static void
-get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec)
-{
- switch (prop_id) {
- case PROP_NAME:
- g_value_set_string (value, FORTISSLVPN_PLUGIN_NAME);
- break;
- case PROP_DESC:
- g_value_set_string (value, FORTISSLVPN_PLUGIN_DESC);
- break;
- case PROP_SERVICE:
- g_value_set_string (value, FORTISSLVPN_PLUGIN_SERVICE);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-fortisslvpn_editor_plugin_class_init (FortisslvpnEditorPluginClass *req_class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (req_class);
-
- object_class->get_property = get_property;
-
- g_object_class_override_property (object_class,
- PROP_NAME,
- NM_VPN_EDITOR_PLUGIN_NAME);
-
- g_object_class_override_property (object_class,
- PROP_DESC,
- NM_VPN_EDITOR_PLUGIN_DESCRIPTION);
-
- g_object_class_override_property (object_class,
- PROP_SERVICE,
- NM_VPN_EDITOR_PLUGIN_SERVICE);
-}
-
-static void
-fortisslvpn_editor_plugin_init (FortisslvpnEditorPlugin *plugin)
-{
-}
-
-static void
-fortisslvpn_editor_plugin_interface_init (NMVpnEditorPluginInterface *iface_class)
-{
- /* interface implementation */
- iface_class->get_editor = get_editor;
- iface_class->get_capabilities = get_capabilities;
- iface_class->import_from_file = NULL;
- iface_class->export_to_file = NULL;
- iface_class->get_suggested_filename = NULL;
-}
-
-
-G_MODULE_EXPORT NMVpnEditorPlugin *
-nm_vpn_editor_plugin_factory (GError **error)
-{
- if (error)
- g_return_val_if_fail (*error == NULL, NULL);
-
- bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-
- return g_object_new (FORTISSLVPN_TYPE_EDITOR_PLUGIN, NULL);
-}
-
diff --git a/properties/nm-fortisslvpn.h b/properties/nm-fortisslvpn.h
index 1b22657..508813d 100644
--- a/properties/nm-fortisslvpn.h
+++ b/properties/nm-fortisslvpn.h
@@ -23,27 +23,6 @@
#ifndef _NM_FORTISSLVPN_H_
#define _NM_FORTISSLVPN_H_
-#define FORTISSLVPN_TYPE_EDITOR_PLUGIN (fortisslvpn_editor_plugin_get_type ())
-#define FORTISSLVPN_EDITOR_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
FORTISSLVPN_TYPE_EDITOR_PLUGIN, FortisslvpnEditorPlugin))
-#define FORTISSLVPN_EDITOR_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
FORTISSLVPN_TYPE_EDITOR_PLUGIN, FortisslvpnEditorPluginClass))
-#define FORTISSLVPN_IS_EDITOR_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),
FORTISSLVPN_TYPE_EDITOR_PLUGIN))
-#define FORTISSLVPN_IS_EDITOR_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
FORTISSLVPN_TYPE_EDITOR_PLUGIN))
-#define FORTISSLVPN_EDITOR_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
FORTISSLVPN_TYPE_EDITOR_PLUGIN, FortisslvpnEditorPluginClass))
-
-typedef struct _FortisslvpnEditorPlugin FortisslvpnEditorPlugin;
-typedef struct _FortisslvpnEditorPluginClass FortisslvpnEditorPluginClass;
-
-struct _FortisslvpnEditorPlugin {
- GObject parent;
-};
-
-struct _FortisslvpnEditorPluginClass {
- GObjectClass parent;
-};
-
-GType fortisslvpn_editor_plugin_get_type (void);
-
-
#define FORTISSLVPN_TYPE_EDITOR (fortisslvpn_editor_get_type ())
#define FORTISSLVPN_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FORTISSLVPN_TYPE_EDITOR,
FortisslvpnEditor))
#define FORTISSLVPN_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FORTISSLVPN_TYPE_EDITOR,
FortisslvpnEditorClass))
@@ -64,5 +43,6 @@ struct _FortisslvpnEditorClass {
GType fortisslvpn_editor_get_type (void);
-#endif /* _NM_FORTISSLVPN_H_ */
+NMVpnEditor *nm_fortisslvpn_editor_new (NMConnection *connection, GError **error);
+#endif /* _NM_FORTISSLVPN_H_ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]