diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2015-08-24 17:16:33 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2015-09-01 14:11:22 +0200 |
commit | 6265f3ee0c0bf084fe6d56c7cb4c274e73f11678 (patch) | |
tree | bca26978d3bf9b0259364521b68db3dad4532a91 | |
parent | 37d2f0fb85f171bf77d45f161a0bd5dd88356548 (diff) |
properties: use the NM error types & quarks
-rw-r--r-- | properties/nm-iodine.c | 45 | ||||
-rw-r--r-- | 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)) |