* libnm-util/libnm-util.ver
libnm-util/nm-setting-connection.c
libnm-util/nm-setting-connection.h
- Add a 'read-only' property that indicates the connection cannot be
modified
* system-settings/plugins/ifcfg-fedora/reader.c
system-settings/plugins/ifcfg-suse/parser.c
system-settings/plugins/ifupdown/parser.c
- These plugins are read-only at the moment
* system-settings/plugins/keyfile/reader.c
system-settings/plugins/keyfile/writer.c
- Read-only shouldn't get saved out to files or read in from them
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4227
4912f4e0-d625-0410-9fb7-
b9a5a253dbdc
+2008-10-27 Dan Williams <dcbw@redhat.com>
+
+ * libnm-util/libnm-util.ver
+ libnm-util/nm-setting-connection.c
+ libnm-util/nm-setting-connection.h
+ - Add a 'read-only' property that indicates the connection cannot be
+ modified
+
+ * system-settings/plugins/ifcfg-fedora/reader.c
+ system-settings/plugins/ifcfg-suse/parser.c
+ system-settings/plugins/ifupdown/parser.c
+ - These plugins are read-only at the moment
+
+ * system-settings/plugins/keyfile/reader.c
+ system-settings/plugins/keyfile/writer.c
+ - Read-only shouldn't get saved out to files or read in from them
+
2008-10-27 Tambet Ingo <tambet@gmail.com>
* src/nm-device-ethernet.c (nm_device_ethernet_get_speed): Implement
nm_setting_connection_get_connection_type;
nm_setting_connection_get_autoconnect;
nm_setting_connection_get_timestamp;
+ nm_setting_connection_get_read_only;
nm_setting_duplicate;
nm_setting_enumerate_values;
nm_setting_from_hash;
char *type;
gboolean autoconnect;
guint64 timestamp;
+ gboolean read_only;
} NMSettingConnectionPrivate;
enum {
PROP_TYPE,
PROP_AUTOCONNECT,
PROP_TIMESTAMP,
+ PROP_READ_ONLY,
LAST_PROP
};
return NM_SETTING_CONNECTION_GET_PRIVATE (setting)->timestamp;
}
+gboolean
+nm_setting_connection_get_read_only (NMSettingConnection *setting)
+{
+ g_return_val_if_fail (NM_IS_SETTING_CONNECTION (setting), TRUE);
+
+ return NM_SETTING_CONNECTION_GET_PRIVATE (setting)->read_only;
+}
+
static gint
find_setting_by_name (gconstpointer a, gconstpointer b)
{
case PROP_TIMESTAMP:
priv->timestamp = g_value_get_uint64 (value);
break;
+ case PROP_READ_ONLY:
+ priv->read_only = g_value_get_boolean (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case PROP_TIMESTAMP:
g_value_set_uint64 (value, nm_setting_connection_get_timestamp (setting));
break;
+ case PROP_READ_ONLY:
+ g_value_set_boolean (value, nm_setting_connection_get_read_only (setting));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
"Connection timestamp",
0, G_MAXUINT64, 0,
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE | NM_SETTING_PARAM_FUZZY_IGNORE));
+
+ g_object_class_install_property
+ (object_class, PROP_READ_ONLY,
+ g_param_spec_boolean (NM_SETTING_CONNECTION_READ_ONLY,
+ "Read-Only",
+ "Read-Only",
+ FALSE,
+ G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE | NM_SETTING_PARAM_FUZZY_IGNORE));
}
#define NM_SETTING_CONNECTION_TYPE "type"
#define NM_SETTING_CONNECTION_AUTOCONNECT "autoconnect"
#define NM_SETTING_CONNECTION_TIMESTAMP "timestamp"
+#define NM_SETTING_CONNECTION_READ_ONLY "read-only"
typedef struct {
NMSetting parent;
GType nm_setting_connection_get_type (void);
-NMSetting *nm_setting_connection_new (void);
+NMSetting * nm_setting_connection_new (void);
const char *nm_setting_connection_get_id (NMSettingConnection *setting);
const char *nm_setting_connection_get_uuid (NMSettingConnection *setting);
const char *nm_setting_connection_get_connection_type (NMSettingConnection *setting);
gboolean nm_setting_connection_get_autoconnect (NMSettingConnection *setting);
guint64 nm_setting_connection_get_timestamp (NMSettingConnection *setting);
+gboolean nm_setting_connection_get_read_only (NMSettingConnection *setting);
G_END_DECLS
GError **error)
{
NMConnection *connection = NULL;
+ NMSettingConnection *s_con;
shvarFile *parsed;
char *type;
char *nmc = NULL;
g_free (type);
+ /* We don't write connections yet */
+ if (connection) {
+ s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
+ if (s_con)
+ g_object_set (s_con, NM_SETTING_CONNECTION_READ_ONLY, TRUE, NULL);
+ }
+
/* Don't bother reading the connection fully if it's unmanaged */
if (!connection || *ignored)
goto done;
g_object_set (s_con,
NM_SETTING_CONNECTION_ID, str,
NM_SETTING_CONNECTION_TYPE, type,
+ NM_SETTING_CONNECTION_READ_ONLY, TRUE,
NULL);
g_free (str);
NM_SETTING_CONNECTION_TYPE, type,
NM_SETTING_CONNECTION_ID, idstr,
NM_SETTING_CONNECTION_UUID, uuid,
+ NM_SETTING_CONNECTION_READ_ONLY, TRUE,
NULL);
g_free (uuid);
#include <nm-setting.h>
#include <nm-setting-ip4-config.h>
#include <nm-setting-vpn.h>
+#include <nm-setting-connection.h>
#include <arpa/inet.h>
#include <string.h>
if (secret && !info->secrets)
return;
+ /* Don't read the NMSettingConnection object's 'read-only' property */
+ if ( NM_IS_SETTING_CONNECTION (setting)
+ && !strcmp (key, NM_SETTING_CONNECTION_READ_ONLY))
+ return;
+
/* IPv4 addresses and VPN properties don't have the exact key name */
if (NM_IS_SETTING_IP4_CONFIG (setting) && !strcmp (key, NM_SETTING_IP4_CONFIG_ADDRESSES))
check_for_key = FALSE;
if (!strcmp (key, NM_SETTING_NAME))
return;
+ /* Don't write the NMSettingConnection object's 'read-only' property */
+ if ( NM_IS_SETTING_CONNECTION (setting)
+ && !strcmp (key, NM_SETTING_CONNECTION_READ_ONLY))
+ return;
+
if (type == G_TYPE_STRING) {
const char *str;