network-manager-applet r756 - in trunk: . src/connection-editor src/gconf-helpers src/vpn-properties
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: network-manager-applet r756 - in trunk: . src/connection-editor src/gconf-helpers src/vpn-properties
- Date: Fri, 13 Jun 2008 00:02:46 +0000 (UTC)
Author: dcbw
Date: Fri Jun 13 00:02:46 2008
New Revision: 756
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=756&view=rev
Log:
2008-06-11 Dan Williams <dcbw redhat com>
Fix up for addition of GError argument to nm_connection_verify() and
nm_setting_verify().
Modified:
trunk/ChangeLog
trunk/src/connection-editor/ce-page.c
trunk/src/connection-editor/ce-page.h
trunk/src/connection-editor/nm-connection-editor.c
trunk/src/connection-editor/nm-connection-list.c
trunk/src/connection-editor/page-dsl.c
trunk/src/connection-editor/page-ip4.c
trunk/src/connection-editor/page-mobile.c
trunk/src/connection-editor/page-ppp.c
trunk/src/connection-editor/page-wired-security.c
trunk/src/connection-editor/page-wired.c
trunk/src/connection-editor/page-wireless-security.c
trunk/src/connection-editor/page-wireless.c
trunk/src/gconf-helpers/nma-gconf-connection.c
trunk/src/vpn-properties/nm-vpn-properties.c
Modified: trunk/src/connection-editor/ce-page.c
==============================================================================
--- trunk/src/connection-editor/ce-page.c (original)
+++ trunk/src/connection-editor/ce-page.c Fri Jun 13 00:02:46 2008
@@ -39,10 +39,10 @@
static guint signals[LAST_SIGNAL] = { 0 };
gboolean
-ce_page_validate (CEPage *self)
+ce_page_validate (CEPage *self, GError **error)
{
if (CE_PAGE_GET_CLASS (self)->validate)
- return CE_PAGE_GET_CLASS (self)->validate (self);
+ return CE_PAGE_GET_CLASS (self)->validate (self, error);
return TRUE;
}
Modified: trunk/src/connection-editor/ce-page.h
==============================================================================
--- trunk/src/connection-editor/ce-page.h (original)
+++ trunk/src/connection-editor/ce-page.h Fri Jun 13 00:02:46 2008
@@ -53,7 +53,7 @@
GObjectClass parent;
/* Virtual functions */
- gboolean (*validate) (CEPage *self);
+ gboolean (*validate) (CEPage *self, GError **error);
void (*update_connection) (CEPage *self, NMConnection *connection);
/* Signals */
@@ -66,7 +66,7 @@
const char * ce_page_get_title (CEPage *self);
-gboolean ce_page_validate (CEPage *self);
+gboolean ce_page_validate (CEPage *self, GError **error);
void ce_page_update_connection (CEPage *self, NMConnection *connection);
Modified: trunk/src/connection-editor/nm-connection-editor.c
==============================================================================
--- trunk/src/connection-editor/nm-connection-editor.c (original)
+++ trunk/src/connection-editor/nm-connection-editor.c Fri Jun 13 00:02:46 2008
@@ -144,8 +144,13 @@
goto done;
for (iter = editor->pages; iter; iter = g_slist_next (iter)) {
- if (!ce_page_validate (CE_PAGE (iter->data)))
+ GError *error = NULL;
+
+ if (!ce_page_validate (CE_PAGE (iter->data), &error)) {
+ /* FIXME: use the error to indicate which UI widgets are invalid */
+ g_error_free (error);
goto done;
+ }
}
valid = TRUE;
Modified: trunk/src/connection-editor/nm-connection-list.c
==============================================================================
--- trunk/src/connection-editor/nm-connection-list.c (original)
+++ trunk/src/connection-editor/nm-connection-list.c Fri Jun 13 00:02:46 2008
@@ -733,10 +733,11 @@
if (response == GTK_RESPONSE_OK) {
NMConnection *connection;
gboolean success;
+ GError *error = NULL;
connection = nm_exported_connection_get_connection (info->initial_connection);
utils_fill_connection_certs (connection);
- success = nm_connection_verify (connection);
+ success = nm_connection_verify (connection, &error);
utils_clear_filled_connection_certs (connection);
if (success) {
@@ -753,8 +754,14 @@
NM_MODIFY_CONNECTION_ADD,
connection_update_add_done, info);
}
- } else
- g_warning ("%s: connection invalid after update; bug in the connection editor.", __func__);
+ } else {
+ g_warning ("%s: invalid connection after update: bug in the "
+ "'%s' / '%s' invalid: %d",
+ __func__,
+ g_type_name (nm_connection_lookup_setting_type_by_quark (error->domain)),
+ error->message, error->code);
+ g_error_free (error);
+ }
}
}
Modified: trunk/src/connection-editor/page-dsl.c
==============================================================================
--- trunk/src/connection-editor/page-dsl.c (original)
+++ trunk/src/connection-editor/page-dsl.c Fri Jun 13 00:02:46 2008
@@ -194,7 +194,7 @@
}
static gboolean
-validate (CEPage *page)
+validate (CEPage *page, GError **error)
{
CEPageDsl *self = CE_PAGE_DSL (page);
CEPageDslPrivate *priv = CE_PAGE_DSL_GET_PRIVATE (self);
@@ -204,7 +204,7 @@
ui_to_setting (self);
foo = g_slist_append (NULL, nm_connection_get_setting (priv->connection, NM_TYPE_SETTING_PPP));
- valid = nm_setting_verify (NM_SETTING (priv->setting), foo);
+ valid = nm_setting_verify (NM_SETTING (priv->setting), foo, error);
g_slist_free (foo);
return valid;
Modified: trunk/src/connection-editor/page-ip4.c
==============================================================================
--- trunk/src/connection-editor/page-ip4.c (original)
+++ trunk/src/connection-editor/page-ip4.c Fri Jun 13 00:02:46 2008
@@ -675,13 +675,13 @@
}
static gboolean
-validate (CEPage *page)
+validate (CEPage *page, GError **error)
{
CEPageIP4 *self = CE_PAGE_IP4 (page);
CEPageIP4Private *priv = CE_PAGE_IP4_GET_PRIVATE (self);
ui_to_setting (self);
- return nm_setting_verify (NM_SETTING (priv->setting), NULL);
+ return nm_setting_verify (NM_SETTING (priv->setting), NULL, error);
}
static void
Modified: trunk/src/connection-editor/page-mobile.c
==============================================================================
--- trunk/src/connection-editor/page-mobile.c (original)
+++ trunk/src/connection-editor/page-mobile.c Fri Jun 13 00:02:46 2008
@@ -376,13 +376,13 @@
}
static gboolean
-validate (CEPage *page)
+validate (CEPage *page, GError **error)
{
CEPageMobile *self = CE_PAGE_MOBILE (page);
CEPageMobilePrivate *priv = CE_PAGE_MOBILE_GET_PRIVATE (self);
ui_to_setting (self);
- return nm_setting_verify (priv->setting, NULL);
+ return nm_setting_verify (priv->setting, NULL, error);
}
static void
Modified: trunk/src/connection-editor/page-ppp.c
==============================================================================
--- trunk/src/connection-editor/page-ppp.c (original)
+++ trunk/src/connection-editor/page-ppp.c Fri Jun 13 00:02:46 2008
@@ -326,13 +326,13 @@
}
static gboolean
-validate (CEPage *page)
+validate (CEPage *page, GError **error)
{
CEPagePpp *self = CE_PAGE_PPP (page);
CEPagePppPrivate *priv = CE_PAGE_PPP_GET_PRIVATE (self);
ui_to_setting (self);
- return nm_setting_verify (NM_SETTING (priv->setting), NULL);
+ return nm_setting_verify (NM_SETTING (priv->setting), NULL, error);
}
static void
Modified: trunk/src/connection-editor/page-wired-security.c
==============================================================================
--- trunk/src/connection-editor/page-wired-security.c (original)
+++ trunk/src/connection-editor/page-wired-security.c Fri Jun 13 00:02:46 2008
@@ -106,13 +106,17 @@
}
static gboolean
-validate (CEPage *page)
+validate (CEPage *page, GError **error)
{
CEPageWiredSecurityPrivate *priv = CE_PAGE_WIRED_SECURITY_GET_PRIVATE (page);
gboolean valid = TRUE;
- if (gtk_toggle_button_get_active (priv->enabled))
+ if (gtk_toggle_button_get_active (priv->enabled)) {
+ /* FIXME: get failed property and error out of wireless security objects */
valid = wireless_security_validate (priv->security, NULL);
+ if (!valid)
+ g_set_error (error, 0, 0, "Invalid 802.1x security");
+ }
return valid;
}
Modified: trunk/src/connection-editor/page-wired.c
==============================================================================
--- trunk/src/connection-editor/page-wired.c (original)
+++ trunk/src/connection-editor/page-wired.c Fri Jun 13 00:02:46 2008
@@ -274,7 +274,7 @@
}
static gboolean
-validate (CEPage *page)
+validate (CEPage *page, GError **error)
{
CEPageWired *self = CE_PAGE_WIRED (page);
CEPageWiredPrivate *priv = CE_PAGE_WIRED_GET_PRIVATE (self);
@@ -286,7 +286,7 @@
return FALSE;
ui_to_setting (self);
- return nm_setting_verify (NM_SETTING (priv->setting), NULL);
+ return nm_setting_verify (NM_SETTING (priv->setting), NULL, error);
}
static void
Modified: trunk/src/connection-editor/page-wireless-security.c
==============================================================================
--- trunk/src/connection-editor/page-wireless-security.c (original)
+++ trunk/src/connection-editor/page-wireless-security.c Fri Jun 13 00:02:46 2008
@@ -377,7 +377,7 @@
}
static gboolean
-validate (CEPage *page)
+validate (CEPage *page, GError **error)
{
CEPageWirelessSecurity *self = CE_PAGE_WIRELESS_SECURITY (page);
GByteArray *ssid;
@@ -390,9 +390,13 @@
ssid = ce_page_wireless_get_ssid (self->wireless_page);
if (ssid) {
+ /* FIXME: get failed property and error out of wireless security objects */
valid = wireless_security_validate (sec, ssid);
+ if (!valid)
+ g_set_error (error, 0, 0, "Invalid wireless security");
g_byte_array_free (ssid, TRUE);
- }
+ } else
+ g_set_error (error, 0, 0, "Missing SSID");
return valid;
}
Modified: trunk/src/connection-editor/page-wireless.c
==============================================================================
--- trunk/src/connection-editor/page-wireless.c (original)
+++ trunk/src/connection-editor/page-wireless.c Fri Jun 13 00:02:46 2008
@@ -428,7 +428,7 @@
}
static gboolean
-validate (CEPage *page)
+validate (CEPage *page, GError **error)
{
CEPageWireless *self = CE_PAGE_WIRELESS (page);
CEPageWirelessPrivate *priv = CE_PAGE_WIRELESS_GET_PRIVATE (self);
@@ -451,7 +451,7 @@
security = priv->setting->security;
priv->setting->security = NULL;
- success = nm_setting_verify (NM_SETTING (priv->setting), NULL);
+ success = nm_setting_verify (NM_SETTING (priv->setting), NULL, error);
priv->setting->security = security;
return success;
Modified: trunk/src/gconf-helpers/nma-gconf-connection.c
==============================================================================
--- trunk/src/gconf-helpers/nma-gconf-connection.c (original)
+++ trunk/src/gconf-helpers/nma-gconf-connection.c Fri Jun 13 00:02:46 2008
@@ -127,6 +127,7 @@
NMConnection *wrapped_connection;
NMConnection *gconf_connection;
GHashTable *new_settings;
+ GError *error = NULL;
g_return_val_if_fail (NMA_IS_GCONF_CONNECTION (self), FALSE);
@@ -140,9 +141,13 @@
}
utils_fill_connection_certs (gconf_connection);
- if (!nm_connection_verify (gconf_connection)) {
+ if (!nm_connection_verify (gconf_connection, &error)) {
utils_clear_filled_connection_certs (gconf_connection);
- g_warning ("Invalid connection read from GConf at %s.", priv->dir);
+ g_warning ("%s: Invalid connection %s: '%s' / '%s' invalid: %d",
+ __func__, priv->dir,
+ g_type_name (nm_connection_lookup_setting_type_by_quark (error->domain)),
+ error->message, error->code);
+ g_error_free (error);
goto invalid;
}
utils_clear_filled_connection_certs (gconf_connection);
@@ -288,22 +293,31 @@
}
static gboolean
-update (NMExportedConnection *exported, GHashTable *new_settings, GError **err)
+update (NMExportedConnection *exported, GHashTable *new_settings, GError **error)
{
NMAGConfConnectionPrivate *priv = NMA_GCONF_CONNECTION_GET_PRIVATE (exported);
NMConnection *tmp;
+ gboolean success = FALSE;
- tmp = nm_connection_new_from_hash (new_settings);
- nm_gconf_write_connection (tmp,
- priv->client,
- priv->dir,
- priv->id);
- g_object_unref (tmp);
-
- gconf_client_notify (priv->client, priv->dir);
- gconf_client_suggest_sync (priv->client, NULL);
+ tmp = nm_connection_new_from_hash (new_settings, error);
+ if (!tmp) {
+ nm_warning ("%s: Invalid connection: '%s' / '%s' invalid: %d",
+ __func__,
+ g_type_name (nm_connection_lookup_setting_type_by_quark ((*error)->domain)),
+ (*error)->message, (*error)->code);
+ } else {
+ nm_gconf_write_connection (tmp,
+ priv->client,
+ priv->dir,
+ priv->id);
+ g_object_unref (tmp);
+
+ gconf_client_notify (priv->client, priv->dir);
+ gconf_client_suggest_sync (priv->client, NULL);
+ success = TRUE;
+ }
- return TRUE;
+ return success;
}
static gboolean
@@ -334,7 +348,7 @@
NMAGConfConnectionPrivate *priv;
NMConnection *connection;
DBusGConnection *bus;
- GError *err = NULL;
+ GError *error = NULL;
object = G_OBJECT_CLASS (nma_gconf_connection_parent_class)->constructor (type, n_construct_params, construct_params);
@@ -359,19 +373,22 @@
g_object_set_data (G_OBJECT (connection), NMA_CONNECTION_ID_TAG, priv->id);
utils_fill_connection_certs (connection);
- if (!nm_connection_verify (connection)) {
+ if (!nm_connection_verify (connection, &error)) {
utils_clear_filled_connection_certs (connection);
- nm_warning ("Invalid connection read from GConf at %s.", priv->dir);
+ g_warning ("Invalid connection: '%s' / '%s' invalid: %d",
+ g_type_name (nm_connection_lookup_setting_type_by_quark (error->domain)),
+ error->message, error->code);
+ g_error_free (error);
goto err;
}
utils_clear_filled_connection_certs (connection);
fill_vpn_user_name (connection);
- bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &err);
+ bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
if (!bus) {
- nm_warning ("Could not get the system bus: %s", err->message);
- g_error_free (err);
+ nm_warning ("Could not get the system bus: %s", error->message);
+ g_error_free (error);
goto err;
}
Modified: trunk/src/vpn-properties/nm-vpn-properties.c
==============================================================================
--- trunk/src/vpn-properties/nm-vpn-properties.c (original)
+++ trunk/src/vpn-properties/nm-vpn-properties.c Fri Jun 13 00:02:46 2008
@@ -432,6 +432,7 @@
NMSettingConnection *s_con;
NMSettingVPN *s_vpn;
const char *svc_name;
+ GError *error = NULL;
g_return_val_if_fail (connection != NULL, FALSE);
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
@@ -460,8 +461,12 @@
g_free (s_vpn->service_type);
s_vpn->service_type = g_strdup (svc_name);
- if (!nm_connection_verify (connection)) {
- g_warning ("%s: connection returned from plugin was invalid!", __func__);
+ if (!nm_connection_verify (connection, &error)) {
+ g_warning ("%s: invalid connection returned from plugin: '%s' / '%s' invalid: %d",
+ __func__,
+ g_type_name (nm_connection_lookup_setting_type_by_quark (error->domain)),
+ error->message, error->code);
+ g_error_free (error);
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]