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



commit 78bb5611e2938bbe9228a29eaee5260a45fb46db
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 |   41 +++++------------------------------------
 properties/nm-openconnect.h |   14 --------------
 2 files changed, 5 insertions(+), 50 deletions(-)
---
diff --git a/properties/nm-openconnect.c b/properties/nm-openconnect.c
index f7bd51b..90e6422 100644
--- a/properties/nm-openconnect.c
+++ b/properties/nm-openconnect.c
@@ -61,12 +61,15 @@
 #define OPENCONNECT_EDITOR_PLUGIN_ERROR                   NM_SETTING_VPN_ERROR
 #define OPENCONNECT_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY  NM_SETTING_VPN_ERROR_INVALID_PROPERTY
 
+#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_EDITOR_PLUGIN_ERROR                   NM_CONNECTION_ERROR
-#define OPENCONNECT_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY  NM_CONNECTION_ERROR_INVALID_PROPERTY
+#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"
@@ -356,40 +359,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]