Re: [PATCH] keyfile-connection: correctly send "update" signal



On Fri, 2010-07-09 at 21:04 -0400, Daniel Gnoutcheff wrote:
> For exported connections, nm_settings_connection_interface_update() is
> supposed to cause the emission of a
> NM_SETTINGS_CONNECTION_INTERFACE_UPDATED signal.  This is usually done
> by chaining up to the NMExportedConnection implementation of this
> method, which actually emits the signal.  However, the
> NMKeyfileConnection implementation usually forgot to do this.  Rewrite
> so that we always chain up after successfully saving settings.

Pushed, thanks!

Dan

>  .../plugins/keyfile/nm-keyfile-connection.c        |   25 +++++++++++--------
>  1 files changed, 14 insertions(+), 11 deletions(-)
> 
> diff --git a/system-settings/plugins/keyfile/nm-keyfile-connection.c b/system-settings/plugins/keyfile/nm-keyfile-connection.c
> index ed56d69..cb876a9 100644
> --- a/system-settings/plugins/keyfile/nm-keyfile-connection.c
> +++ b/system-settings/plugins/keyfile/nm-keyfile-connection.c
> @@ -78,22 +78,25 @@ update (NMSettingsConnectionInterface *connection,
>  	NMKeyfileConnectionPrivate *priv = NM_KEYFILE_CONNECTION_GET_PRIVATE (connection);
>  	char *filename = NULL;
>  	GError *error = NULL;
> -	gboolean success;
> -
> -	success = write_connection (NM_CONNECTION (connection), KEYFILE_DIR, 0, 0, &filename, &error);
> -	if (success && filename && strcmp (priv->filename, filename)) {
> -		/* Update the filename if it changed */
> -		g_free (priv->filename);
> -		priv->filename = filename;
> -		success = parent_settings_connection_iface->update (connection, callback, user_data);
> -	} else {
> +
> +	if (!write_connection (NM_CONNECTION (connection), KEYFILE_DIR, 0, 0, &filename, &error)) {
>  		callback (connection, error, user_data);
>  		if (error)
>  			g_error_free (error);
> -		g_free (filename);
> +		return FALSE;
> +	}
> +
> +	if (filename) {
> +		if (strcmp (priv->filename, filename)) {
> +			/* Update the filename if it changed */
> +			g_free (priv->filename);
> +			priv->filename = filename;
> +		} else {
> +			g_free (filename);
> +		}
>  	}
>  
> -	return success;
> +	return parent_settings_connection_iface->update (connection, callback, user_data);
>  }
>  
>  static gboolean 




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