summaryrefslogtreecommitdiff
path: root/src/connection-editor
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2012-03-02 11:23:23 -0500
committerDan Winship <danw@gnome.org>2012-03-12 20:24:32 -0400
commitfb6cd6e56eef01e77bc7e4e9ef0a7b7faad28271 (patch)
tree1e14e750f03122bdaa6c5f6f6fcf3843fb6eaf9d /src/connection-editor
parent32bcd021e2db759081bd135ce0810ded91d7bdcc (diff)
downloadnetwork-manager-applet-fb6cd6e56eef01e77bc7e4e9ef0a7b7faad28271.tar.gz
Fix use of GError
Using a domain of 0 with GError is invalid, and recent versions of GLib emit a warning if you do. Add an NMA_ERROR domain, with the single error NMA_ERROR_GENERIC, and use that instead.
Diffstat (limited to 'src/connection-editor')
-rw-r--r--src/connection-editor/Makefile.am1
-rw-r--r--src/connection-editor/ce-page.c2
-rw-r--r--src/connection-editor/ce-page.h1
-rw-r--r--src/connection-editor/nm-connection-editor.c2
-rw-r--r--src/connection-editor/nm-connection-editor.h1
-rw-r--r--src/connection-editor/page-dsl.c2
-rw-r--r--src/connection-editor/page-ip4.c2
-rw-r--r--src/connection-editor/page-ip6.c2
-rw-r--r--src/connection-editor/page-mobile.c4
-rw-r--r--src/connection-editor/page-ppp.c2
-rw-r--r--src/connection-editor/page-vpn.c4
-rw-r--r--src/connection-editor/page-wired-security.c4
-rw-r--r--src/connection-editor/page-wired.c2
-rw-r--r--src/connection-editor/page-wireless-security.c8
-rw-r--r--src/connection-editor/page-wireless.c2
-rw-r--r--src/connection-editor/vpn-helpers.c19
16 files changed, 31 insertions, 27 deletions
diff --git a/src/connection-editor/Makefile.am b/src/connection-editor/Makefile.am
index 59d2b509..d26b6743 100644
--- a/src/connection-editor/Makefile.am
+++ b/src/connection-editor/Makefile.am
@@ -3,6 +3,7 @@ bin_PROGRAMS = nm-connection-editor
nm_connection_editor_CPPFLAGS = \
$(GTK_CFLAGS) \
$(NMA_CFLAGS) \
+ $(GNOME_KEYRING_CFLAGS) \
-DICONDIR=\""$(datadir)/icons"\" \
-DUIDIR=\""$(uidir)"\" \
-DBINDIR=\""$(bindir)"\" \
diff --git a/src/connection-editor/ce-page.c b/src/connection-editor/ce-page.c
index 44fd952b..528757fb 100644
--- a/src/connection-editor/ce-page.c
+++ b/src/connection-editor/ce-page.c
@@ -306,7 +306,7 @@ ce_page_complete_init (CEPage *self,
}
if (!update_error) {
- g_set_error_literal (&update_error, 0, 0,
+ g_set_error_literal (&update_error, NMA_ERROR, NMA_ERROR_GENERIC,
_("Failed to update connection secrets due to an unknown error."));
}
diff --git a/src/connection-editor/ce-page.h b/src/connection-editor/ce-page.h
index 692790d8..fae65220 100644
--- a/src/connection-editor/ce-page.h
+++ b/src/connection-editor/ce-page.h
@@ -31,6 +31,7 @@
#include <dbus/dbus-glib.h>
#include <nm-connection.h>
#include <nm-client.h>
+#include "utils.h"
typedef void (*PageNewConnectionResultFunc) (NMConnection *connection,
gboolean canceled,
diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c
index 3e9a2141..26b59fed 100644
--- a/src/connection-editor/nm-connection-editor.c
+++ b/src/connection-editor/nm-connection-editor.c
@@ -388,7 +388,7 @@ nm_connection_editor_new (NMConnection *connection,
editor = g_object_new (NM_TYPE_CONNECTION_EDITOR, NULL);
if (!editor) {
- g_set_error (error, 0, 0, "%s", _("Error creating connection editor dialog."));
+ g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, "%s", _("Error creating connection editor dialog."));
return NULL;
}
diff --git a/src/connection-editor/nm-connection-editor.h b/src/connection-editor/nm-connection-editor.h
index a80814f4..3e66fe64 100644
--- a/src/connection-editor/nm-connection-editor.h
+++ b/src/connection-editor/nm-connection-editor.h
@@ -25,6 +25,7 @@
#include <glib-object.h>
#include <nm-client.h>
+#include "utils.h"
#define NM_TYPE_CONNECTION_EDITOR (nm_connection_editor_get_type ())
#define NM_IS_CONNECTION_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_CONNECTION_EDITOR))
diff --git a/src/connection-editor/page-dsl.c b/src/connection-editor/page-dsl.c
index 0c413b6e..5485a552 100644
--- a/src/connection-editor/page-dsl.c
+++ b/src/connection-editor/page-dsl.c
@@ -138,7 +138,7 @@ ce_page_dsl_new (NMConnection *connection,
"DslPage",
_("DSL")));
if (!self) {
- g_set_error_literal (error, 0, 0, _("Could not load DSL user interface."));
+ g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load DSL user interface."));
return NULL;
}
diff --git a/src/connection-editor/page-ip4.c b/src/connection-editor/page-ip4.c
index 4e50a02f..d397a103 100644
--- a/src/connection-editor/page-ip4.c
+++ b/src/connection-editor/page-ip4.c
@@ -980,7 +980,7 @@ ce_page_ip4_new (NMConnection *connection,
"IP4Page",
_("IPv4 Settings")));
if (!self) {
- g_set_error_literal (error, 0, 0, _("Could not load IPv4 user interface."));
+ g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load IPv4 user interface."));
return NULL;
}
diff --git a/src/connection-editor/page-ip6.c b/src/connection-editor/page-ip6.c
index c2e89e96..41b3a39d 100644
--- a/src/connection-editor/page-ip6.c
+++ b/src/connection-editor/page-ip6.c
@@ -944,7 +944,7 @@ ce_page_ip6_new (NMConnection *connection,
"IP6Page",
_("IPv6 Settings")));
if (!self) {
- g_set_error_literal (error, 0, 0, _("Could not load IPv6 user interface."));
+ g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load IPv6 user interface."));
return NULL;
}
diff --git a/src/connection-editor/page-mobile.c b/src/connection-editor/page-mobile.c
index 9ae7c652..517ebb97 100644
--- a/src/connection-editor/page-mobile.c
+++ b/src/connection-editor/page-mobile.c
@@ -378,7 +378,7 @@ ce_page_mobile_new (NMConnection *connection,
"MobilePage",
_("Mobile Broadband")));
if (!self) {
- g_set_error_literal (error, 0, 0, _("Could not load mobile broadband user interface."));
+ g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load mobile broadband user interface."));
return NULL;
}
@@ -395,7 +395,7 @@ ce_page_mobile_new (NMConnection *connection,
}
if (!priv->setting) {
- g_set_error (error, 0, 0, "%s", _("Unsupported mobile broadband connection type."));
+ g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, "%s", _("Unsupported mobile broadband connection type."));
g_object_unref (self);
return NULL;
}
diff --git a/src/connection-editor/page-ppp.c b/src/connection-editor/page-ppp.c
index b27bc4cb..db742450 100644
--- a/src/connection-editor/page-ppp.c
+++ b/src/connection-editor/page-ppp.c
@@ -281,7 +281,7 @@ ce_page_ppp_new (NMConnection *connection,
"PppPage",
_("PPP Settings")));
if (!self) {
- g_set_error_literal (error, 0, 0, _("Could not load PPP user interface."));
+ g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load PPP user interface."));
return NULL;
}
diff --git a/src/connection-editor/page-vpn.c b/src/connection-editor/page-vpn.c
index a66da9c5..70910eb6 100644
--- a/src/connection-editor/page-vpn.c
+++ b/src/connection-editor/page-vpn.c
@@ -108,7 +108,7 @@ ce_page_vpn_new (NMConnection *connection,
NULL,
_("VPN")));
if (!self) {
- g_set_error_literal (error, 0, 0, _("Could not load VPN user interface."));
+ g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load VPN user interface."));
return NULL;
}
@@ -123,7 +123,7 @@ ce_page_vpn_new (NMConnection *connection,
priv->plugin = vpn_get_plugin_by_service (service_type);
if (!priv->plugin) {
- g_set_error (error, 0, 0, _("Could not find VPN plugin service for '%s'."), service_type);
+ g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not find VPN plugin service for '%s'."), service_type);
g_object_unref (self);
return NULL;
}
diff --git a/src/connection-editor/page-wired-security.c b/src/connection-editor/page-wired-security.c
index a5ee2033..7bec62e1 100644
--- a/src/connection-editor/page-wired-security.c
+++ b/src/connection-editor/page-wired-security.c
@@ -115,7 +115,7 @@ ce_page_wired_security_new (NMConnection *connection,
NULL,
_("802.1x Security")));
if (!self) {
- g_set_error_literal (error, 0, 0, _("Could not load Wired Security security user interface."));
+ g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load Wired Security security user interface."));
return NULL;
}
@@ -175,7 +175,7 @@ validate (CEPage *page, NMConnection *connection, GError **error)
g_object_unref (tmp_connection);
} else
- g_set_error (error, 0, 0, "Invalid 802.1x security");
+ g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, "Invalid 802.1x security");
} else {
nm_connection_remove_setting (connection, NM_TYPE_SETTING_802_1X);
valid = TRUE;
diff --git a/src/connection-editor/page-wired.c b/src/connection-editor/page-wired.c
index 5de3cb23..2d1ad0f3 100644
--- a/src/connection-editor/page-wired.c
+++ b/src/connection-editor/page-wired.c
@@ -271,7 +271,7 @@ ce_page_wired_new (NMConnection *connection,
"WiredPage",
_("Wired")));
if (!self) {
- g_set_error_literal (error, 0, 0, _("Could not load wired user interface."));
+ g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load wired user interface."));
return NULL;
}
diff --git a/src/connection-editor/page-wireless-security.c b/src/connection-editor/page-wireless-security.c
index b51ab223..90426cfd 100644
--- a/src/connection-editor/page-wireless-security.c
+++ b/src/connection-editor/page-wireless-security.c
@@ -356,7 +356,7 @@ ce_page_wireless_security_new (NMConnection *connection,
s_wireless = nm_connection_get_setting_wireless (connection);
if (!s_wireless) {
- g_set_error_literal (error, 0, 0, _("Could not load WiFi security user interface; missing WiFi setting."));
+ g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load WiFi security user interface; missing WiFi setting."));
return NULL;
}
@@ -368,7 +368,7 @@ ce_page_wireless_security_new (NMConnection *connection,
"WirelessSecurityPage",
_("Wireless Security")));
if (!self) {
- g_set_error_literal (error, 0, 0, _("Could not load WiFi security user interface."));
+ g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load WiFi security user interface."));
return NULL;
}
@@ -445,9 +445,9 @@ validate (CEPage *page, NMConnection *connection, GError **error)
if (valid)
wireless_security_fill_connection (sec, connection);
else
- g_set_error (error, 0, 0, "Invalid wireless security");
+ g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, "Invalid wireless security");
} else
- g_set_error (error, 0, 0, "Missing SSID");
+ g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, "Missing SSID");
} else {
/* No security, unencrypted */
g_object_set (s_wireless, NM_SETTING_WIRELESS_SEC, NULL, NULL);
diff --git a/src/connection-editor/page-wireless.c b/src/connection-editor/page-wireless.c
index cc00e9e1..886f175c 100644
--- a/src/connection-editor/page-wireless.c
+++ b/src/connection-editor/page-wireless.c
@@ -456,7 +456,7 @@ ce_page_wireless_new (NMConnection *connection,
"WirelessPage",
_("Wireless")));
if (!self) {
- g_set_error_literal (error, 0, 0, _("Could not load WiFi user interface."));
+ g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load WiFi user interface."));
return NULL;
}
diff --git a/src/connection-editor/vpn-helpers.c b/src/connection-editor/vpn-helpers.c
index 943ee2cc..8b162074 100644
--- a/src/connection-editor/vpn-helpers.c
+++ b/src/connection-editor/vpn-helpers.c
@@ -33,6 +33,7 @@
#include <nm-setting-vpn.h>
#include "vpn-helpers.h"
+#include "utils.h"
#define NM_VPN_API_SUBJECT_TO_CHANGE
#include "nm-vpn-plugin-ui-interface.h"
@@ -63,7 +64,7 @@ vpn_get_plugins (GError **error)
dir = g_dir_open (VPN_NAME_FILES_DIR, 0, NULL);
if (!dir) {
- g_set_error (error, 0, 0, "Couldn't read VPN .name files directory " VPN_NAME_FILES_DIR ".");
+ g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, "Couldn't read VPN .name files directory " VPN_NAME_FILES_DIR ".");
return NULL;
}
@@ -104,7 +105,7 @@ vpn_get_plugins (GError **error)
module = g_module_open (so_path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
if (!module) {
- g_set_error (error, 0, 0, "Cannot load the VPN plugin which provides the "
+ g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, "Cannot load the VPN plugin which provides the "
"service '%s'.", service);
goto next;
}
@@ -124,10 +125,10 @@ vpn_get_plugins (GError **error)
NM_VPN_PLUGIN_UI_INTERFACE_SERVICE, &plug_service,
NULL);
if (!plug_name || !strlen (plug_name)) {
- g_set_error (error, 0, 0, "cannot load VPN plugin in '%s': missing plugin name",
+ g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, "cannot load VPN plugin in '%s': missing plugin name",
g_module_name (module));
} else if (!plug_service || strcmp (plug_service, service)) {
- g_set_error (error, 0, 0, "cannot load VPN plugin in '%s': invalid service name",
+ g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, "cannot load VPN plugin in '%s': invalid service name",
g_module_name (module));
} else {
/* Success! */
@@ -139,14 +140,14 @@ vpn_get_plugins (GError **error)
g_free (plug_name);
g_free (plug_service);
} else {
- g_set_error (error, 0, 0, "cannot load VPN plugin in '%s': %s",
+ g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, "cannot load VPN plugin in '%s': %s",
g_module_name (module), g_module_error ());
}
if (!success)
g_module_close (module);
} else {
- g_set_error (error, 0, 0, "cannot locate nm_vpn_plugin_ui_factory() in '%s': %s",
+ g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, "cannot locate nm_vpn_plugin_ui_factory() in '%s': %s",
g_module_name (module), g_module_error ());
g_module_close (module);
}
@@ -296,7 +297,7 @@ export_vpn_to_file_cb (GtkWidget *dialog, gint response, gpointer user_data)
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
if (!filename) {
- g_set_error (&error, 0, 0, "no filename");
+ g_set_error (&error, NMA_ERROR, NMA_ERROR_GENERIC, "no filename");
goto done;
}
@@ -325,7 +326,7 @@ export_vpn_to_file_cb (GtkWidget *dialog, gint response, gpointer user_data)
s_con = nm_connection_get_setting_connection (connection);
id = s_con ? nm_setting_connection_get_id (s_con) : NULL;
if (!id) {
- g_set_error (&error, 0, 0, "connection setting invalid");
+ g_set_error (&error, NMA_ERROR, NMA_ERROR_GENERIC, "connection setting invalid");
goto done;
}
@@ -333,7 +334,7 @@ export_vpn_to_file_cb (GtkWidget *dialog, gint response, gpointer user_data)
service_type = s_vpn ? nm_setting_vpn_get_service_type (s_vpn) : NULL;
if (!service_type) {
- g_set_error (&error, 0, 0, "VPN setting invalid");
+ g_set_error (&error, NMA_ERROR, NMA_ERROR_GENERIC, "VPN setting invalid");
goto done;
}