ifcfg-rh: emit "updated" signal when connection file is changed (rh #727501)

Chain up to parent's commit_changes() even if in-memory and on-disk data are the
same; they are the same when another process changes the on-disk file. Just make
sure not to write out the data needlessly when same.

This fixes a regression caused by 9cba854fa0.
It exhibits e.g. by not auto-activating connection when ONBOOT is changed from
"no" to "yes". Connection "updated" signal was not emitted and listeners like
NMPolicy was not prodded.
This commit is contained in:
Jiří Klimeš 2011-08-02 09:15:37 +02:00
parent 1a98391dc4
commit 312c7c952c

View file

@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright (C) 2008 - 2010 Red Hat, Inc.
* Copyright (C) 2008 - 2011 Red Hat, Inc.
*/
#include <string.h>
@ -181,7 +181,7 @@ nm_ifcfg_connection_get_unmanaged_spec (NMIfcfgConnection *self)
static void
commit_changes (NMSettingsConnection *connection,
NMSettingsConnectionCommitFunc callback,
gpointer user_data)
gpointer user_data)
{
NMIfcfgConnectionPrivate *priv = NM_IFCFG_CONNECTION_GET_PRIVATE (connection);
GError *error = NULL;
@ -208,9 +208,12 @@ commit_changes (NMSettingsConnection *connection,
NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS);
g_object_unref (reread);
/* Don't bother writing anything out if nothing really changed */
if (same == TRUE)
/* Don't bother writing anything out if in-memory and on-disk data are the same */
if (same) {
/* But chain up to parent to handle success - emits updated signal */
NM_SETTINGS_CONNECTION_CLASS (nm_ifcfg_connection_parent_class)->commit_changes (connection, callback, user_data);
return;
}
}
if (writer_update_connection (NM_CONNECTION (connection),
@ -227,7 +230,7 @@ commit_changes (NMSettingsConnection *connection,
}
}
static void
static void
do_delete (NMSettingsConnection *connection,
NMSettingsConnectionDeleteFunc callback,
gpointer user_data)