diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2015-03-24 17:11:38 +0100 |
---|---|---|
committer | Dan Winship <danw@redhat.com> | 2015-03-25 12:51:36 -0400 |
commit | 7348889a774ee1db9d65fbb43a208e35ec698a79 (patch) | |
tree | 216139bc209f0007bdc887860bd3f14ec347ec46 /properties | |
parent | 11fe8c16a2fbbcbce304ef023454206e053d8ae3 (diff) |
properties: use a real GError domain instead of 0
GLib complains about domain being 0.
Diffstat (limited to 'properties')
-rw-r--r-- | properties/nm-iodine.c | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/properties/nm-iodine.c b/properties/nm-iodine.c index 61d8d1b..be32b62 100644 --- a/properties/nm-iodine.c +++ b/properties/nm-iodine.c @@ -76,6 +76,24 @@ typedef struct { gboolean window_added; } IodinePluginUiWidgetPrivate; +typedef enum { + NM_IODINE_IMPORT_EXPORT_ERROR_UNKNOWN = 0, + NM_IODINE_IMPORT_EXPORT_ERROR_NOT_IODINE, + NM_IODINE_IMPORT_EXPORT_ERROR_BAD_DATA, +} NMIodineImportError; + +#define NM_IODINE_IMPORT_EXPORT_ERROR nm_iodine_import_export_error_quark () + +static GQuark +nm_iodine_import_export_error_quark (void) +{ + static GQuark quark = 0; + + if (G_UNLIKELY (quark == 0)) + quark = g_quark_from_static_string ("nm-iodine-import-export-error-quark"); + return quark; +} + static NMConnection * import (NMVpnPluginUiInterface *iface, const char *path, GError **error) { @@ -92,8 +110,8 @@ import (NMVpnPluginUiInterface *iface, const char *path, GError **error) if (!g_key_file_load_from_file (keyfile, path, flags, error)) { g_set_error (error, - 0, - 0, + NM_IODINE_IMPORT_EXPORT_ERROR, + NM_IODINE_IMPORT_EXPORT_ERROR_NOT_IODINE, "does not look like a %s VPN connection (parse failed)", IODINE_PLUGIN_NAME); return NULL; @@ -119,8 +137,8 @@ import (NMVpnPluginUiInterface *iface, const char *path, GError **error) nm_setting_vpn_add_data_item (s_vpn, NM_IODINE_KEY_TOPDOMAIN, buf); } else { g_set_error (error, - 0, - 0, + NM_IODINE_IMPORT_EXPORT_ERROR, + NM_IODINE_IMPORT_EXPORT_ERROR_NOT_IODINE, "does not look like a %s VPN connection " "(no top level domain)", IODINE_PLUGIN_NAME); @@ -163,7 +181,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 (error, + NM_IODINE_IMPORT_EXPORT_ERROR, + NM_IODINE_IMPORT_EXPORT_ERROR_UNKNOWN, + "could not open file for writing"); return FALSE; } @@ -173,8 +194,10 @@ export (NMVpnPluginUiInterface *iface, if (value && strlen (value)) topdomain = value; else { - g_set_error (error, 0, 0, - "connection was incomplete (missing top level domain)"); + g_set_error (error, + NM_IODINE_IMPORT_EXPORT_ERROR, + NM_IODINE_IMPORT_EXPORT_ERROR_UNKNOWN, + "connection was incomplete (missing top level domain)"); goto done; } |