[network-manager-iodine/lr/libnm: 6/11] properties: use the NM error types & quarks



commit 893b82f9f181ec947fe7288210b30ad4732c6e2a
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Mon Aug 24 17:16:33 2015 +0200

    properties: use the NM error types & quarks

 properties/nm-iodine.c |   45 +++++++--------------------------------------
 properties/nm-iodine.h |   14 --------------
 2 files changed, 7 insertions(+), 52 deletions(-)
---
diff --git a/properties/nm-iodine.c b/properties/nm-iodine.c
index 1ee3e8e..701b76f 100644
--- a/properties/nm-iodine.c
+++ b/properties/nm-iodine.c
@@ -41,11 +41,17 @@
 #include <nm-setting-ip4-config.h>
 
 #define nm_simple_connection_new nm_connection_new
+
+#define IODINE_PLUGIN_UI_ERROR                     NM_SETTING_VPN_ERROR
+#define IODINE_PLUGIN_UI_ERROR_INVALID_PROPERTY    NM_SETTING_VPN_ERROR_INVALID_PROPERTY
  
-#else /* !NM_OPENVPN_OLD */
+#else /* !NM_IODINE_OLD */
 
 #include <NetworkManager.h>
 #include <nma-ui-utils.h>
+
+#define IODINE_PLUGIN_UI_ERROR                     NM_CONNECTION_ERROR
+#define IODINE_PLUGIN_UI_ERROR_INVALID_PROPERTY    NM_CONNECTION_ERROR_INVALID_PROPERTY
 #endif
 
 #include "nm-iodine-service-defines.h"
@@ -242,43 +248,6 @@ done:
        return success;
 }
 
-GQuark
-iodine_plugin_ui_error_quark (void)
-{
-       static GQuark error_quark = 0;
-
-       if (G_UNLIKELY (error_quark == 0))
-               error_quark = g_quark_from_static_string ("iodine-plugin-ui-error-quark");
-
-       return error_quark;
-}
-
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-iodine_plugin_ui_error_get_type (void)
-{
-       static GType etype = 0;
-
-       if (etype == 0) {
-               static const GEnumValue values[] = {
-                       /* Unknown error. */
-                       ENUM_ENTRY (IODINE_PLUGIN_UI_ERROR_UNKNOWN,
-                                               "UnknownError"),
-                       /* The specified property was invalid. */
-                       ENUM_ENTRY (IODINE_PLUGIN_UI_ERROR_INVALID_PROPERTY,
-                                               "InvalidProperty"),
-                       /* The specified property was missing and is required. */
-                       ENUM_ENTRY (IODINE_PLUGIN_UI_ERROR_MISSING_PROPERTY,
-                                               "MissingProperty"),
-                       { 0, 0, 0 }
-               };
-               etype = g_enum_register_static ("IodinePluginUiError", values);
-       }
-       return etype;
-}
-
 static gboolean
 check_validity (IodinePluginUiWidget *self, GError **error)
 {
diff --git a/properties/nm-iodine.h b/properties/nm-iodine.h
index ee38678..45c583f 100644
--- a/properties/nm-iodine.h
+++ b/properties/nm-iodine.h
@@ -24,20 +24,6 @@
 
 #include <glib-object.h>
 
-typedef enum
-{
-       IODINE_PLUGIN_UI_ERROR_UNKNOWN = 0,
-       IODINE_PLUGIN_UI_ERROR_INVALID_PROPERTY,
-       IODINE_PLUGIN_UI_ERROR_MISSING_PROPERTY
-} IodinePluginUiError;
-
-
-GQuark iodine_plugin_ui_error_quark (void);
-#define IODINE_PLUGIN_UI_ERROR iodine_plugin_ui_error_quark ()
-
-#define IODINE_TYPE_PLUGIN_UI_ERROR (iodine_plugin_ui_error_get_type ()) 
-GType iodine_plugin_ui_error_get_type (void);
-
 #define IODINE_TYPE_PLUGIN_UI            (iodine_plugin_ui_get_type ())
 #define IODINE_PLUGIN_UI(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), IODINE_TYPE_PLUGIN_UI, 
IodinePluginUi))
 #define IODINE_PLUGIN_UI_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), IODINE_TYPE_PLUGIN_UI, 
IodinePluginUiClass))


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