NetworkManager r3340 - in trunk: . libnm-util
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: NetworkManager r3340 - in trunk: . libnm-util
- Date: Mon, 25 Feb 2008 03:32:43 +0000 (GMT)
Author: dcbw
Date: Mon Feb 25 03:32:43 2008
New Revision: 3340
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3340&view=rev
Log:
2008-02-24 Dan Williams <dcbw redhat com>
* libnm-util/nm-setting.c
libnm-util/nm-setting.h
- (nm_setting_compare): fix 'fuzzy' compare logic; add IGNORE_ID bits;
fix return value to match nm_connection_compare() meaning
Modified:
trunk/ChangeLog
trunk/libnm-util/nm-setting.c
trunk/libnm-util/nm-setting.h
Modified: trunk/libnm-util/nm-setting.c
==============================================================================
--- trunk/libnm-util/nm-setting.c (original)
+++ trunk/libnm-util/nm-setting.c Mon Feb 25 03:32:43 2008
@@ -1,6 +1,9 @@
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+#include <string.h>
+
#include "nm-setting.h"
+#include "nm-setting-connection.h"
#include "nm-utils.h"
G_DEFINE_ABSTRACT_TYPE (NMSetting, nm_setting, G_TYPE_OBJECT)
@@ -150,7 +153,7 @@
{
GParamSpec **property_specs;
guint n_property_specs;
- gboolean different;
+ gint different;
guint i;
g_return_val_if_fail (NM_IS_SETTING (setting), FALSE);
@@ -169,12 +172,17 @@
GValue value1 = { 0 };
GValue value2 = { 0 };
- /* Fuzzy compare ignores properties defined with the FUZZY_IGNORE flag */
+ /* Fuzzy compare ignores secrets and properties defined with the
+ * FUZZY_IGNORE flag
+ */
if ( (flags & COMPARE_FLAGS_FUZZY)
- && (prop_spec->flags & NM_SETTING_PARAM_FUZZY_IGNORE)) {
- different = TRUE;
+ && (prop_spec->flags & (NM_SETTING_PARAM_FUZZY_IGNORE | NM_SETTING_PARAM_SECRET)))
+ continue;
+
+ if ( (flags & COMPARE_FLAGS_IGNORE_ID)
+ && !strcmp (setting->name, NM_SETTING_CONNECTION_SETTING_NAME)
+ && !strcmp (prop_spec->name, NM_SETTING_CONNECTION_ID))
continue;
- }
g_value_init (&value1, prop_spec->value_type);
g_object_get_property (G_OBJECT (setting), prop_spec->name, &value1);
@@ -190,7 +198,7 @@
g_free (property_specs);
- return different;
+ return different == 0 ? TRUE : FALSE;
}
void
Modified: trunk/libnm-util/nm-setting.h
==============================================================================
--- trunk/libnm-util/nm-setting.h (original)
+++ trunk/libnm-util/nm-setting.h Mon Feb 25 03:32:43 2008
@@ -63,12 +63,16 @@
typedef enum {
/* Match all attributes exactly */
- COMPARE_FLAGS_EXACT = 0x00,
+ COMPARE_FLAGS_EXACT = 0x00000000,
/* Match only important attributes, like SSID, type, security settings, etc */
- COMPARE_FLAGS_FUZZY = 0x01,
+ COMPARE_FLAGS_FUZZY = 0x00000001,
+
+ /* Ignore the connection ID */
+ COMPARE_FLAGS_IGNORE_ID = 0x00000002,
} NMSettingCompareFlags;
+/* Returns TRUE if the connections are the same */
gboolean nm_setting_compare (NMSetting *setting,
NMSetting *other,
NMSettingCompareFlags flags);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]