[network-manager-openswan/lr/libnm: 3/10] properties: use the NM error types & quarks



commit 25677c8d05b771dda6204457a8fc64cfbf17a415
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Wed Jul 15 18:52:53 2015 +0200

    properties: use the NM error types & quarks

 properties/nm-openswan.c |   44 +++++---------------------------------------
 properties/nm-openswan.h |   11 -----------
 2 files changed, 5 insertions(+), 50 deletions(-)
---
diff --git a/properties/nm-openswan.c b/properties/nm-openswan.c
index 92cbbd2..7ec753f 100644
--- a/properties/nm-openswan.c
+++ b/properties/nm-openswan.c
@@ -41,10 +41,15 @@
 #include <nm-setting-connection.h>
 #include <nm-setting-ip4-config.h>
 
+#define OPENSWAN_PLUGIN_UI_ERROR                  NM_SETTING_VPN_ERROR
+#define OPENSWAN_PLUGIN_UI_ERROR_INVALID_PROPERTY NM_SETTING_VPN_ERROR_INVALID_PROPERTY
+
 #else /* !NM_OPENSWAN_OLD */
 
 #include <NetworkManager.h>
 
+#define OPENSWAN_PLUGIN_UI_ERROR                  NM_CONNECTION_ERROR
+#define OPENSWAN_PLUGIN_UI_ERROR_INVALID_PROPERTY NM_CONNECTION_ERROR_INVALID_PROPERTY
 #endif
 
 #include "nm-openswan-service.h"
@@ -93,45 +98,6 @@ typedef struct {
 } OpenswanPluginUiWidgetPrivate;
 
 
-#define OPENSWAN_PLUGIN_UI_ERROR openswan_plugin_ui_error_quark ()
-
-static GQuark
-openswan_plugin_ui_error_quark (void)
-{
-       static GQuark error_quark = 0;
-
-       if (G_UNLIKELY (error_quark == 0))
-               error_quark = g_quark_from_static_string ("openswan-plugin-ui-error-quark");
-
-       return error_quark;
-}
-
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-openswan_plugin_ui_error_get_type (void)
-{
-       static GType etype = 0;
-
-       if (etype == 0) {
-               static const GEnumValue values[] = {
-                       /* Unknown error. */
-                       ENUM_ENTRY (OPENSWAN_PLUGIN_UI_ERROR_UNKNOWN, "UnknownError"),
-                       /* The specified property was invalid. */
-                       ENUM_ENTRY (OPENSWAN_PLUGIN_UI_ERROR_INVALID_PROPERTY, "InvalidProperty"),
-                       /* The specified property was missing and is required. */
-                       ENUM_ENTRY (OPENSWAN_PLUGIN_UI_ERROR_MISSING_PROPERTY, "MissingProperty"),
-                       /* The connection was missing invalid. */
-                       ENUM_ENTRY (OPENSWAN_PLUGIN_UI_ERROR_INVALID_CONNECTION, "InvalidConnection"),
-                       { 0, 0, 0 }
-               };
-               etype = g_enum_register_static ("OpenswanPluginUiError", values);
-       }
-       return etype;
-}
-
-
 static gboolean
 check_validity (OpenswanPluginUiWidget *self, GError **error)
 {
diff --git a/properties/nm-openswan.h b/properties/nm-openswan.h
index 6ad0fae..d39798a 100644
--- a/properties/nm-openswan.h
+++ b/properties/nm-openswan.h
@@ -26,17 +26,6 @@
 
 #include <glib-object.h>
 
-typedef enum
-{
-       OPENSWAN_PLUGIN_UI_ERROR_UNKNOWN = 0,
-       OPENSWAN_PLUGIN_UI_ERROR_INVALID_PROPERTY,
-       OPENSWAN_PLUGIN_UI_ERROR_MISSING_PROPERTY,
-       OPENSWAN_PLUGIN_UI_ERROR_INVALID_CONNECTION
-} OpenswanPluginUiError;
-
-#define OPENSWAN_TYPE_PLUGIN_UI_ERROR (openswan_plugin_ui_error_get_type ()) 
-GType openswan_plugin_ui_error_get_type (void);
-
 #define OPENSWAN_TYPE_PLUGIN_UI            (openswan_plugin_ui_get_type ())
 #define OPENSWAN_PLUGIN_UI(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), OPENSWAN_TYPE_PLUGIN_UI, 
OpenswanPluginUi))
 #define OPENSWAN_PLUGIN_UI_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), OPENSWAN_TYPE_PLUGIN_UI, 
OpenswanPluginUiClass))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]