[network-manager-openconnect/nm-0-9-8] properties: use a real GError domain instead of 0 in export()



commit b5cbc8ca833353b8b712220c6cc7eab492d59835
Author: Jiří Klimeš <jklimes redhat com>
Date:   Fri May 30 12:06:52 2014 +0200

    properties: use a real GError domain instead of 0 in export()
    
    (cherry picked from commit d16e7d1ea954516d0a12a7b4b8ebf67c15a11746)

 properties/nm-openconnect.c |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/properties/nm-openconnect.c b/properties/nm-openconnect.c
index b638060..e00e757 100644
--- a/properties/nm-openconnect.c
+++ b/properties/nm-openconnect.c
@@ -98,20 +98,20 @@ typedef struct {
 /************** import/export **************/
 
 typedef enum {
-       NM_OPENCONNECT_IMPORT_ERROR_UNKNOWN = 0,
-       NM_OPENCONNECT_IMPORT_ERROR_NOT_OPENCONNECT,
-       NM_OPENCONNECT_IMPORT_ERROR_BAD_DATA,
+       NM_OPENCONNECT_IMPORT_EXPORT_ERROR_UNKNOWN = 0,
+       NM_OPENCONNECT_IMPORT_EXPORT_ERROR_NOT_OPENCONNECT,
+       NM_OPENCONNECT_IMPORT_EXPORT_ERROR_BAD_DATA,
 } NMOpenconnectImportError;
 
-#define NM_OPENCONNECT_IMPORT_ERROR nm_openconnect_import_error_quark ()
+#define NM_OPENCONNECT_IMPORT_EXPORT_ERROR nm_openconnect_import_export_error_quark ()
 
 static GQuark
-nm_openconnect_import_error_quark (void)
+nm_openconnect_import_export_error_quark (void)
 {
        static GQuark quark = 0;
 
        if (G_UNLIKELY (quark == 0))
-               quark = g_quark_from_static_string ("nm-openconnect-import-error-quark");
+               quark = g_quark_from_static_string ("nm-openconnect-import-export-error-quark");
        return quark;
 }
 
@@ -132,8 +132,8 @@ import (NMVpnPluginUiInterface *iface, const char *path, GError **error)
 
        if (!g_key_file_load_from_file (keyfile, path, flags, NULL)) {
                g_set_error (error,
-                            NM_OPENCONNECT_IMPORT_ERROR,
-                            NM_OPENCONNECT_IMPORT_ERROR_NOT_OPENCONNECT,
+                            NM_OPENCONNECT_IMPORT_EXPORT_ERROR,
+                            NM_OPENCONNECT_IMPORT_EXPORT_ERROR_NOT_OPENCONNECT,
                             "does not look like a %s VPN connection (parse failed)",
                             OPENCONNECT_PLUGIN_NAME);
                return NULL;
@@ -156,8 +156,8 @@ import (NMVpnPluginUiInterface *iface, const char *path, GError **error)
                nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_GATEWAY, buf);
        } else {
                g_set_error (error,
-                            NM_OPENCONNECT_IMPORT_ERROR,
-                            NM_OPENCONNECT_IMPORT_ERROR_BAD_DATA,
+                            NM_OPENCONNECT_IMPORT_EXPORT_ERROR,
+                            NM_OPENCONNECT_IMPORT_EXPORT_ERROR_BAD_DATA,
                             "does not look like a %s VPN connection (no Host)",
                             OPENCONNECT_PLUGIN_NAME);
                g_object_unref (connection);
@@ -243,7 +243,10 @@ export (NMVpnPluginUiInterface *iface,
 
        f = fopen (path, "w");
        if (!f) {
-               g_set_error (error, 0, 0, "could not open file for writing");
+               g_set_error_literal (error,
+                                    NM_OPENCONNECT_IMPORT_EXPORT_ERROR,
+                                    NM_OPENCONNECT_IMPORT_EXPORT_ERROR_UNKNOWN,
+                                    "could not open file for writing");
                return FALSE;
        }
 
@@ -255,7 +258,10 @@ export (NMVpnPluginUiInterface *iface,
        if (value && strlen (value))
                gateway = value;
        else {
-               g_set_error (error, 0, 0, "connection was incomplete (missing gateway)");
+               g_set_error_literal (error,
+                                    NM_OPENCONNECT_IMPORT_EXPORT_ERROR,
+                                    NM_OPENCONNECT_IMPORT_EXPORT_ERROR_BAD_DATA,
+                                    "connection was incomplete (missing gateway)");
                goto done;
        }
 


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