summaryrefslogtreecommitdiff
path: root/src/nm-config-data.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-01-07 14:30:14 +0100
committerThomas Haller <thaller@redhat.com>2015-02-03 13:01:53 +0100
commit045a576a7ab8dac3f7aa9302532fa94e790c1f05 (patch)
treee444d9ef8bbeb7fc8655f72b978bed5490028872 /src/nm-config-data.c
parent56f5fba72353e55db554c359af00376d3959009d (diff)
config: add new function nm_config_data_diff()
Diffstat (limited to 'src/nm-config-data.c')
-rw-r--r--src/nm-config-data.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/nm-config-data.c b/src/nm-config-data.c
index 03d381106..8683696e8 100644
--- a/src/nm-config-data.c
+++ b/src/nm-config-data.c
@@ -21,6 +21,8 @@
#include "nm-config-data.h"
+#include "nm-config.h"
+
typedef struct {
char *config_main_file;
char *config_description;
@@ -93,6 +95,34 @@ nm_config_data_get_connectivity_response (const NMConfigData *self)
/************************************************************************/
+GHashTable *
+nm_config_data_diff (NMConfigData *old_data, NMConfigData *new_data)
+{
+ GHashTable *changes;
+
+ g_return_val_if_fail (NM_IS_CONFIG_DATA (old_data), NULL);
+ g_return_val_if_fail (NM_IS_CONFIG_DATA (new_data), NULL);
+
+ changes = g_hash_table_new (g_str_hash, g_str_equal);
+
+ if ( g_strcmp0 (nm_config_data_get_config_main_file (old_data), nm_config_data_get_config_main_file (new_data)) != 0
+ || g_strcmp0 (nm_config_data_get_config_description (old_data), nm_config_data_get_config_description (new_data)) != 0)
+ g_hash_table_insert (changes, NM_CONFIG_CHANGES_CONFIG_FILES, NULL);
+
+ if ( nm_config_data_get_connectivity_interval (old_data) != nm_config_data_get_connectivity_interval (new_data)
+ || g_strcmp0 (nm_config_data_get_connectivity_uri (old_data), nm_config_data_get_connectivity_uri (new_data))
+ || g_strcmp0 (nm_config_data_get_connectivity_response (old_data), nm_config_data_get_connectivity_response (new_data)))
+ g_hash_table_insert (changes, NM_CONFIG_CHANGES_CONNECTIVITY, NULL);
+
+ if (!g_hash_table_size (changes)) {
+ g_hash_table_destroy (changes);
+ return NULL;
+ }
+ return changes;
+}
+
+/************************************************************************/
+
static void
get_property (GObject *object,
guint prop_id,