[network-manager-vpnc] properties: use a real GError domain instead of 0 in export()



commit f7d92ba277a59fab61361d231c360e497d756b3a
Author: Jiří Klimeš <jklimes redhat com>
Date:   Fri May 30 11:23:07 2014 +0200

    properties: use a real GError domain instead of 0 in export()

 properties/nm-vpnc.c |   35 ++++++++++++++++++++++-------------
 1 files changed, 22 insertions(+), 13 deletions(-)
---
diff --git a/properties/nm-vpnc.c b/properties/nm-vpnc.c
index 909c61b..7e7dcb3 100644
--- a/properties/nm-vpnc.c
+++ b/properties/nm-vpnc.c
@@ -1297,20 +1297,20 @@ decrypt_cisco_key (const char* enc_key)
 }
 
 typedef enum {
-       NM_VPNC_IMPORT_ERROR_UNKNOWN = 0,
-       NM_VPNC_IMPORT_ERROR_NOT_VPNC,
-       NM_VPNC_IMPORT_ERROR_BAD_DATA,
+       NM_VPNC_IMPORT_EXPORT_ERROR_UNKNOWN = 0,
+       NM_VPNC_IMPORT_EXPORT_ERROR_NOT_VPNC,
+       NM_VPNC_IMPORT_EXPORT_ERROR_BAD_DATA,
 } NMVpncImportError;
 
-#define NM_VPNC_IMPORT_ERROR nm_vpnc_import_error_quark ()
+#define NM_VPNC_IMPORT_EXPORT_ERROR nm_vpnc_import_export_error_quark ()
 
 static GQuark
-nm_vpnc_import_error_quark (void)
+nm_vpnc_import_export_error_quark (void)
 {
        static GQuark quark = 0;
 
        if (G_UNLIKELY (quark == 0))
-               quark = g_quark_from_static_string ("nm-vpnc-import-error-quark");
+               quark = g_quark_from_static_string ("nm-vpnc-import-export-error-quark");
        return quark;
 }
 
@@ -1350,8 +1350,8 @@ import (NMVpnPluginUiInterface *iface, const char *path, GError **error)
                g_free (buf);
        } else {
                g_set_error (error,
-                            NM_VPNC_IMPORT_ERROR,
-                            NM_VPNC_IMPORT_ERROR_NOT_VPNC,
+                            NM_VPNC_IMPORT_EXPORT_ERROR,
+                            NM_VPNC_IMPORT_EXPORT_ERROR_NOT_VPNC,
                             "does not look like a %s VPN connection (no Host)",
                             VPNC_PLUGIN_NAME);
                goto error;
@@ -1364,8 +1364,8 @@ import (NMVpnPluginUiInterface *iface, const char *path, GError **error)
                g_free (buf);
        } else {
                g_set_error (error,
-                            NM_VPNC_IMPORT_ERROR,
-                            NM_VPNC_IMPORT_ERROR_BAD_DATA,
+                            NM_VPNC_IMPORT_EXPORT_ERROR,
+                            NM_VPNC_IMPORT_EXPORT_ERROR_BAD_DATA,
                             "does not look like a %s VPN connection (no GroupName)",
                             VPNC_PLUGIN_NAME);
                goto error;
@@ -1607,7 +1607,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_VPNC_IMPORT_EXPORT_ERROR,
+                                    NM_VPNC_IMPORT_EXPORT_ERROR_UNKNOWN,
+                                    "could not open file for writing");
                return FALSE;
        }
 
@@ -1615,7 +1618,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_VPNC_IMPORT_EXPORT_ERROR,
+                                    NM_VPNC_IMPORT_EXPORT_ERROR_BAD_DATA,
+                                    "connection was incomplete (missing gateway)");
                goto done;
        }
 
@@ -1623,7 +1629,10 @@ export (NMVpnPluginUiInterface *iface,
        if (value && strlen (value))
                groupname = value;
        else {
-               g_set_error (error, 0, 0, "connection was incomplete (missing group)");
+               g_set_error_literal (error,
+                                    NM_VPNC_IMPORT_EXPORT_ERROR,
+                                    NM_VPNC_IMPORT_EXPORT_ERROR_BAD_DATA,
+                                    "connection was incomplete (missing group)");
                goto done;
        }
 


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