[network-manager-pptp/th/vpn-editor-split-bgo766623: 8/21] properties: replace pptp specific error codes by libnm/libnm-glib



commit 79cab64f7ab954eec66515b159d993424659b2de
Author: Thomas Haller <thaller redhat com>
Date:   Wed May 18 13:56:15 2016 +0200

    properties: replace pptp specific error codes by libnm/libnm-glib
    
    Same is done for other plugins.

 properties/import-export.c |    4 ++--
 properties/nm-pptp.c       |   11 -----------
 properties/nm-pptp.h       |   24 +++++++++++++++---------
 3 files changed, 17 insertions(+), 22 deletions(-)
---
diff --git a/properties/import-export.c b/properties/import-export.c
index 0bd35e7..dda2645 100644
--- a/properties/import-export.c
+++ b/properties/import-export.c
@@ -45,7 +45,7 @@ do_import (const char *path, char **lines, GError **error)
 {
        g_set_error_literal (error,
                             NMV_EDITOR_PLUGIN_ERROR,
-                            NMV_EDITOR_PLUGIN_ERROR_UNKNOWN,
+                            NMV_EDITOR_PLUGIN_ERROR_FAILED,
                             "PPTP import is not implemented");
        return NULL;
 }
@@ -55,7 +55,7 @@ do_export (const char *path, NMConnection *connection, GError **error)
 {
        g_set_error_literal (error,
                             NMV_EDITOR_PLUGIN_ERROR,
-                            NMV_EDITOR_PLUGIN_ERROR_UNKNOWN,
+                            NMV_EDITOR_PLUGIN_ERROR_FAILED,
                             "PPTP export is not implemented");
        return FALSE;
 }
diff --git a/properties/nm-pptp.c b/properties/nm-pptp.c
index 18fc7cf..41c06ea 100644
--- a/properties/nm-pptp.c
+++ b/properties/nm-pptp.c
@@ -95,17 +95,6 @@ enum {
        LAST_PROP
 };
 
-GQuark
-nmv_editor_plugin_error_quark (void)
-{
-       static GQuark error_quark = 0;
-
-       if (G_UNLIKELY (error_quark == 0))
-               error_quark = g_quark_from_static_string ("pptp-plugin-ui-error-quark");
-
-       return error_quark;
-}
-
 static gboolean
 check_validity (PptpPluginUiWidget *self, GError **error)
 {
diff --git a/properties/nm-pptp.h b/properties/nm-pptp.h
index b93641d..850e4b9 100644
--- a/properties/nm-pptp.h
+++ b/properties/nm-pptp.h
@@ -25,17 +25,23 @@
 
 #include <glib-object.h>
 
-typedef enum
-{
-       NMV_EDITOR_PLUGIN_ERROR_UNKNOWN = 0,
-       NMV_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY,
-       NMV_EDITOR_PLUGIN_ERROR_FILE_NOT_READABLE,
-       NMV_EDITOR_PLUGIN_ERROR_FILE_NOT_VPN,
-} PptpPluginUiError;
+#ifdef NM_VPN_OLD
 
-#define NMV_EDITOR_PLUGIN_ERROR (nmv_editor_plugin_error_quark ())
-GQuark nmv_editor_plugin_error_quark (void);
+#define NMV_EDITOR_PLUGIN_ERROR                     NM_SETTING_VPN_ERROR
+#define NMV_EDITOR_PLUGIN_ERROR_FAILED              NM_SETTING_VPN_ERROR_UNKNOWN
+#define NMV_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY    NM_SETTING_VPN_ERROR_INVALID_PROPERTY
+#define NMV_EDITOR_PLUGIN_ERROR_FILE_NOT_VPN        NM_SETTING_VPN_ERROR_UNKNOWN
+#define NMV_EDITOR_PLUGIN_ERROR_FILE_NOT_READABLE   NM_SETTING_VPN_ERROR_UNKNOWN
 
+#else
+
+#define NMV_EDITOR_PLUGIN_ERROR                   NM_CONNECTION_ERROR
+#define NMV_EDITOR_PLUGIN_ERROR_FAILED            NM_CONNECTION_ERROR_FAILED
+#define NMV_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY  NM_CONNECTION_ERROR_INVALID_PROPERTY
+#define NMV_EDITOR_PLUGIN_ERROR_FILE_NOT_VPN      NM_CONNECTION_ERROR_FAILED
+#define NMV_EDITOR_PLUGIN_ERROR_FILE_NOT_READABLE NM_CONNECTION_ERROR_FAILED
+
+#endif
 
 #define PPTP_TYPE_PLUGIN_UI            (pptp_plugin_ui_get_type ())
 #define PPTP_PLUGIN_UI(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), PPTP_TYPE_PLUGIN_UI, 
PptpPluginUi))


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