NetworkManager r4322 - in trunk: . libnm-util system-settings/plugins/keyfile



Author: dcbw
Date: Thu Nov 20 21:23:55 2008
New Revision: 4322
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=4322&view=rev

Log:
2008-11-20  Dan Williams  <dcbw redhat com>

	Patch from Tambet Ingo <tambet gmail com>

	* libnm-util/nm-setting.c
	  libnm-util/nm-setting.h
		- (NMSettingValueIterFn): instead of just a gboolean for secrets, take
			all the GParamSpec flags of the property

	* system-settings/plugins/keyfile/nm-keyfile-connection.c
	  system-settings/plugins/keyfile/reader.c
	  system-settings/plugins/keyfile/writer.c
		- Update for NMSettingValueIterFn change



Modified:
   trunk/ChangeLog
   trunk/libnm-util/nm-setting.c
   trunk/libnm-util/nm-setting.h
   trunk/system-settings/plugins/keyfile/nm-keyfile-connection.c
   trunk/system-settings/plugins/keyfile/reader.c
   trunk/system-settings/plugins/keyfile/writer.c

Modified: trunk/libnm-util/nm-setting.c
==============================================================================
--- trunk/libnm-util/nm-setting.c	(original)
+++ trunk/libnm-util/nm-setting.c	Thu Nov 20 21:23:55 2008
@@ -230,14 +230,13 @@
 
 static void
 duplicate_setting (NMSetting *setting,
-			    const char *name,
-			    const GValue *value,
-			    gboolean secret,
-			    gpointer user_data)
+                   const char *name,
+                   const GValue *value,
+                   GParamFlags flags,
+                   gpointer user_data)
 {
-	GObject *dup = (GObject *) user_data;
-
-	g_object_set_property (dup, name, value);
+	if (flags & G_PARAM_WRITABLE)
+		g_object_set_property (G_OBJECT (user_data), name, value);
 }
 
 /**
@@ -407,9 +406,7 @@
 
 		g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (prop_spec));
 		g_object_get_property (G_OBJECT (setting), prop_spec->name, &value);
-		func (setting, prop_spec->name, &value,
-			 prop_spec->flags & NM_SETTING_PARAM_SECRET,
-			 user_data);
+		func (setting, prop_spec->name, &value, prop_spec->flags, user_data);
 		g_value_unset (&value);
 	}
 

Modified: trunk/libnm-util/nm-setting.h
==============================================================================
--- trunk/libnm-util/nm-setting.h	(original)
+++ trunk/libnm-util/nm-setting.h	Thu Nov 20 21:23:55 2008
@@ -80,10 +80,10 @@
 } NMSettingClass;
 
 typedef void (*NMSettingValueIterFn) (NMSetting *setting,
-							   const char *key,
-							   const GValue *value,
-							   gboolean secret,
-							   gpointer user_data);
+                                      const char *key,
+                                      const GValue *value,
+                                      GParamFlags flags,
+                                      gpointer user_data);
 
 
 GType nm_setting_get_type (void);

Modified: trunk/system-settings/plugins/keyfile/nm-keyfile-connection.c
==============================================================================
--- trunk/system-settings/plugins/keyfile/nm-keyfile-connection.c	(original)
+++ trunk/system-settings/plugins/keyfile/nm-keyfile-connection.c	Thu Nov 20 21:23:55 2008
@@ -97,12 +97,12 @@
 add_secrets (NMSetting *setting,
              const char *key,
              const GValue *value,
-             gboolean secret,
+             GParamFlags flags,
              gpointer user_data)
 {
 	GHashTable *secrets = user_data;
 
-	if (!secret)
+	if (!(flags & NM_SETTING_PARAM_SECRET))
 		return;
 
 	if (G_VALUE_HOLDS_STRING (value)) {

Modified: trunk/system-settings/plugins/keyfile/reader.c
==============================================================================
--- trunk/system-settings/plugins/keyfile/reader.c	(original)
+++ trunk/system-settings/plugins/keyfile/reader.c	Thu Nov 20 21:23:55 2008
@@ -344,10 +344,10 @@
 
 static void
 read_one_setting_value (NMSetting *setting,
-				    const char *key,
-				    const GValue *value,
-				    gboolean secret,
-				    gpointer user_data)
+                        const char *key,
+                        const GValue *value,
+                        GParamFlags flags,
+                        gpointer user_data)
 {
 	ReadSettingInfo *info = (ReadSettingInfo *) user_data;
 	GKeyFile *file = info->keyfile;
@@ -356,12 +356,16 @@
 	GError *err = NULL;
 	gboolean check_for_key = TRUE;
 
+	/* Property is not writable */
+	if (!(flags & G_PARAM_WRITABLE))
+		return;
+
 	/* Setting name gets picked up from the keyfile's section name instead */
 	if (!strcmp (key, NM_SETTING_NAME))
 		return;
 
 	/* Don't read in secrets unless we want to */
-	if (secret && !info->secrets)
+	if ((flags & NM_SETTING_PARAM_SECRET) && !info->secrets)
 		return;
 
 	/* Don't read the NMSettingConnection object's 'read-only' property */

Modified: trunk/system-settings/plugins/keyfile/writer.c
==============================================================================
--- trunk/system-settings/plugins/keyfile/writer.c	(original)
+++ trunk/system-settings/plugins/keyfile/writer.c	Thu Nov 20 21:23:55 2008
@@ -203,10 +203,10 @@
 
 static void
 write_setting_value (NMSetting *setting,
-				 const char *key,
-				 const GValue *value,
-				 gboolean secret,
-				 gpointer user_data)
+                     const char *key,
+                     const GValue *value,
+                     GParamFlags flag,
+                     gpointer user_data)
 {
 	GKeyFile *file = (GKeyFile *) user_data;
 	const char *setting_name;



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