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



commit 43ede9cf3c240f0b304883b3b4e9b3e30a1fbc48
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Thu Jul 16 15:53:24 2015 +0200

    properties: use the NM error types & quarks

 properties/nm-openconnect.c |   40 ++++++----------------------------------
 properties/nm-openconnect.h |   14 --------------
 2 files changed, 6 insertions(+), 48 deletions(-)
---
diff --git a/properties/nm-openconnect.c b/properties/nm-openconnect.c
index f84b701..6b6b3dc 100644
--- a/properties/nm-openconnect.c
+++ b/properties/nm-openconnect.c
@@ -61,12 +61,18 @@
 #define OPENCONNECT_PLUGIN_NAME    _("Cisco AnyConnect Compatible VPN (openconnect)")
 #define OPENCONNECT_PLUGIN_DESC    _("Compatible with Cisco AnyConnect SSL VPN.")
 
+#define OPENCONNECT_PLUGIN_UI_ERROR                   NM_SETTING_VPN_ERROR
+#define OPENCONNECT_PLUGIN_UI_ERROR_INVALID_PROPERTY  NM_SETTING_VPN_ERROR_INVALID_PROPERTY
+
 #else /* !NM_OPENCONNECT_OLD */
 
 #include <NetworkManager.h>
 
 #define OPENCONNECT_PLUGIN_NAME    _("openconnect")
 #define OPENCONNECT_PLUGIN_DESC    _("Cisco AnyConnect SSL Compatible VPN")
+
+#define OPENCONNECT_PLUGIN_UI_ERROR                   NM_CONNECTION_ERROR
+#define OPENCONNECT_PLUGIN_UI_ERROR_INVALID_PROPERTY  NM_CONNECTION_ERROR_INVALID_PROPERTY
 #endif
 
 #include "nm-openconnect-service-defines.h"
@@ -354,40 +360,6 @@ done:
        return success;
 }
 
-GQuark
-openconnect_plugin_ui_error_quark (void)
-{
-       static GQuark error_quark = 0;
-
-       if (G_UNLIKELY (error_quark == 0))
-               error_quark = g_quark_from_static_string ("openconnect-plugin-ui-error-quark");
-
-       return error_quark;
-}
-
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-openconnect_plugin_ui_error_get_type (void)
-{
-       static GType etype = 0;
-
-       if (etype == 0) {
-               static const GEnumValue values[] = {
-                       /* Unknown error. */
-                       ENUM_ENTRY (OPENCONNECT_PLUGIN_UI_ERROR_UNKNOWN, "UnknownError"),
-                       /* The specified property was invalid. */
-                       ENUM_ENTRY (OPENCONNECT_PLUGIN_UI_ERROR_INVALID_PROPERTY, "InvalidProperty"),
-                       /* The specified property was missing and is required. */
-                       ENUM_ENTRY (OPENCONNECT_PLUGIN_UI_ERROR_MISSING_PROPERTY, "MissingProperty"),
-                       { 0, 0, 0 }
-               };
-               etype = g_enum_register_static ("OpenconnectPluginUiError", values);
-       }
-       return etype;
-}
-
 static gboolean
 check_validity (OpenconnectPluginUiWidget *self, GError **error)
 {
diff --git a/properties/nm-openconnect.h b/properties/nm-openconnect.h
index 325c1f4..f655151 100644
--- a/properties/nm-openconnect.h
+++ b/properties/nm-openconnect.h
@@ -25,20 +25,6 @@
 
 #include <glib-object.h>
 
-typedef enum
-{
-       OPENCONNECT_PLUGIN_UI_ERROR_UNKNOWN = 0,
-       OPENCONNECT_PLUGIN_UI_ERROR_INVALID_PROPERTY,
-       OPENCONNECT_PLUGIN_UI_ERROR_MISSING_PROPERTY
-} OpenconnectPluginUiError;
-
-
-GQuark openconnect_plugin_ui_error_quark (void);
-#define OPENCONNECT_PLUGIN_UI_ERROR openconnect_plugin_ui_error_quark ()
-
-#define OPENCONNECT_TYPE_PLUGIN_UI_ERROR (openconnect_plugin_ui_error_get_type ()) 
-GType openconnect_plugin_ui_error_get_type (void);
-
 #define OPENCONNECT_TYPE_PLUGIN_UI            (openconnect_plugin_ui_get_type ())
 #define OPENCONNECT_PLUGIN_UI(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
OPENCONNECT_TYPE_PLUGIN_UI, OpenconnectPluginUi))
 #define OPENCONNECT_PLUGIN_UI_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), OPENCONNECT_TYPE_PLUGIN_UI, 
OpenconnectPluginUiClass))


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