[network-manager-openvpn/lr/libnm: 3/4] properties: use the NM error types & quarks
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-openvpn/lr/libnm: 3/4] properties: use the NM error types & quarks
- Date: Thu, 16 Jul 2015 14:03:00 +0000 (UTC)
commit 3495d0c63d6914e8b9d2931750bb06c2a0ee40e1
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Thu Jul 16 16:01:23 2015 +0200
properties: use the NM error types & quarks
properties/auth-helpers.c | 6 +++++
properties/import-export.c | 6 +++++
properties/nm-openvpn.c | 52 ++++++++++---------------------------------
properties/nm-openvpn.h | 17 --------------
4 files changed, 24 insertions(+), 57 deletions(-)
---
diff --git a/properties/auth-helpers.c b/properties/auth-helpers.c
index c3de1e9..18bb300 100644
--- a/properties/auth-helpers.c
+++ b/properties/auth-helpers.c
@@ -42,11 +42,17 @@
#include <nm-ui-utils.h>
#define NMSettingVpn NMSettingVPN
+
+#define OPENVPN_PLUGIN_UI_ERROR NM_SETTING_VPN_ERROR
+#define OPENVPN_PLUGIN_UI_ERROR_INVALID_PROPERTY NM_SETTING_VPN_ERROR_INVALID_PROPERTY
#endif
#ifdef NM_OPENVPN_NEW
#include <NetworkManager.h>
#include <nma-ui-utils.h>
+
+#define OPENVPN_PLUGIN_UI_ERROR NM_CONNECTION_ERROR
+#define OPENVPN_PLUGIN_UI_ERROR_INVALID_PROPERTY NM_CONNECTION_ERROR_INVALID_PROPERTY
#endif
#include "auth-helpers.h"
diff --git a/properties/import-export.c b/properties/import-export.c
index dfa48fc..fd573e8 100644
--- a/properties/import-export.c
+++ b/properties/import-export.c
@@ -42,10 +42,16 @@
#define NMSettingVpn NMSettingVPN
#define nm_simple_connection_new nm_connection_new
+
+#define OPENVPN_PLUGIN_UI_ERROR NM_SETTING_VPN_ERROR
+#define OPENVPN_PLUGIN_UI_ERROR_FILE_NOT_OPENVPN NM_SETTING_VPN_ERROR_UNKNOWN
#endif
#ifdef NM_OPENVPN_NEW
#include <NetworkManager.h>
+
+#define OPENVPN_PLUGIN_UI_ERROR NM_CONNECTION_ERROR
+#define OPENVPN_PLUGIN_UI_ERROR_FILE_NOT_OPENVPN NM_CONNECTION_ERROR_FAILED
#endif
#include "import-export.h"
diff --git a/properties/nm-openvpn.c b/properties/nm-openvpn.c
index 9cca952..55ec7b4 100644
--- a/properties/nm-openvpn.c
+++ b/properties/nm-openvpn.c
@@ -63,10 +63,22 @@
#define get_editor ui_factory
#define get_suggested_filename get_suggested_name
#define nm_vpn_editor_plugin_factory nm_vpn_plugin_ui_factory
+
+#define OPENVPN_PLUGIN_UI_ERROR NM_SETTING_VPN_ERROR
+#define OPENVPN_PLUGIN_UI_ERROR_INVALID_PROPERTY NM_SETTING_VPN_ERROR_INVALID_PROPERTY
+#define OPENVPN_PLUGIN_UI_ERROR_MISSING_PROPERTY NM_SETTING_VPN_ERROR_MISSING_PROPERTY
+#define OPENVPN_PLUGIN_UI_ERROR_FILE_NOT_OPENVPN NM_SETTING_VPN_ERROR_UNKNOWN
+#define OPENVPN_PLUGIN_UI_ERROR_FILE_NOT_READABLE NM_SETTING_VPN_ERROR_UNKNOWN
#endif
#ifdef NM_OPENVPN_NEW
#include <NetworkManager.h>
+
+#define OPENVPN_PLUGIN_UI_ERROR NM_CONNECTION_ERROR
+#define OPENVPN_PLUGIN_UI_ERROR_INVALID_PROPERTY NM_CONNECTION_ERROR_INVALID_PROPERTY
+#define OPENVPN_PLUGIN_UI_ERROR_MISSING_PROPERTY NM_CONNECTION_ERROR_MISSING_PROPERTY
+#define OPENVPN_PLUGIN_UI_ERROR_FILE_NOT_OPENVPN NM_CONNECTION_ERROR_FAILED
+#define OPENVPN_PLUGIN_UI_ERROR_FILE_NOT_READABLE NM_CONNECTION_ERROR_FAILED
#endif
#include "src/nm-openvpn-service-defines.h"
@@ -121,46 +133,6 @@ typedef struct {
#define COL_AUTH_PAGE 1
#define COL_AUTH_TYPE 2
-GQuark
-openvpn_plugin_ui_error_quark (void)
-{
- static GQuark error_quark = 0;
-
- if (G_UNLIKELY (error_quark == 0))
- error_quark = g_quark_from_static_string ("openvpn-plugin-ui-error-quark");
-
- return error_quark;
-}
-
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-openvpn_plugin_ui_error_get_type (void)
-{
- static GType etype = 0;
-
- if (etype == 0) {
- static const GEnumValue values[] = {
- /* Unknown error. */
- ENUM_ENTRY (OPENVPN_PLUGIN_UI_ERROR_UNKNOWN, "UnknownError"),
- /* The connection was missing invalid. */
- ENUM_ENTRY (OPENVPN_PLUGIN_UI_ERROR_INVALID_CONNECTION, "InvalidConnection"),
- /* The specified property was invalid. */
- ENUM_ENTRY (OPENVPN_PLUGIN_UI_ERROR_INVALID_PROPERTY, "InvalidProperty"),
- /* The specified property was missing and is required. */
- ENUM_ENTRY (OPENVPN_PLUGIN_UI_ERROR_MISSING_PROPERTY, "MissingProperty"),
- /* The file to import could not be read. */
- ENUM_ENTRY (OPENVPN_PLUGIN_UI_ERROR_FILE_NOT_READABLE, "FileNotReadable"),
- /* The file to import could was not an OpenVPN client file. */
- ENUM_ENTRY (OPENVPN_PLUGIN_UI_ERROR_FILE_NOT_OPENVPN, "FileNotOpenVPN"),
- { 0, 0, 0 }
- };
- etype = g_enum_register_static ("OpenvpnPluginUiError", values);
- }
- return etype;
-}
-
/* Example: abc.com:1234:udp, ovpnserver.company.com:443, vpn.example.com::tcp */
static gboolean
check_gateway_entry (const char *str)
diff --git a/properties/nm-openvpn.h b/properties/nm-openvpn.h
index 98e5d6e..4aa3826 100644
--- a/properties/nm-openvpn.h
+++ b/properties/nm-openvpn.h
@@ -25,23 +25,6 @@
#include <glib-object.h>
-typedef enum
-{
- OPENVPN_PLUGIN_UI_ERROR_UNKNOWN = 0,
- OPENVPN_PLUGIN_UI_ERROR_INVALID_CONNECTION,
- OPENVPN_PLUGIN_UI_ERROR_INVALID_PROPERTY,
- OPENVPN_PLUGIN_UI_ERROR_MISSING_PROPERTY,
- OPENVPN_PLUGIN_UI_ERROR_FILE_NOT_READABLE,
- OPENVPN_PLUGIN_UI_ERROR_FILE_NOT_OPENVPN
-} OpenvpnPluginUiError;
-
-#define OPENVPN_TYPE_PLUGIN_UI_ERROR (openvpn_plugin_ui_error_get_type ())
-GType openvpn_plugin_ui_error_get_type (void);
-
-#define OPENVPN_PLUGIN_UI_ERROR (openvpn_plugin_ui_error_quark ())
-GQuark openvpn_plugin_ui_error_quark (void);
-
-
#define OPENVPN_TYPE_PLUGIN_UI (openvpn_plugin_ui_get_type ())
#define OPENVPN_PLUGIN_UI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OPENVPN_TYPE_PLUGIN_UI,
OpenvpnPluginUi))
#define OPENVPN_PLUGIN_UI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), OPENVPN_TYPE_PLUGIN_UI,
OpenvpnPluginUiClass))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]