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



commit 0f5824e97a4ee67868665f0e691f9c01a11bb95f
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 4ef49a2..8e2dd7e 100644
--- a/properties/nm-openswan.c
+++ b/properties/nm-openswan.c
@@ -58,10 +58,15 @@
 #define get_editor ui_factory
 #define get_suggested_filename get_suggested_name
 #define nm_vpn_editor_plugin_factory nm_vpn_plugin_ui_factory
+
+#define OPENSWAN_PLUGIN_UI_ERROR                  NM_SETTING_VPN_ERROR
+#define OPENSWAN_PLUGIN_UI_ERROR_INVALID_PROPERTY NM_SETTING_VPN_ERROR_INVALID_PROPERTY
 #endif
 
 #ifdef NM_OPENSWAN_NEW
 #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"
@@ -113,45 +118,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]