libnm/remote-connection: add filename property

This commit is contained in:
Lubomir Rintel 2018-05-28 09:23:58 +02:00
parent 87f5ff6927
commit bd6fe17815
3 changed files with 42 additions and 0 deletions

View file

@ -1351,6 +1351,7 @@ global:
nm_connection_get_setting_tc_config;
nm_device_ip_tunnel_get_flags;
nm_ip_tunnel_flags_get_type;
nm_remote_connection_get_filename;
nm_remote_connection_get_flags;
nm_setting_connection_get_mdns;
nm_setting_connection_mdns_get_type;

View file

@ -51,6 +51,7 @@ enum {
PROP_0,
PROP_UNSAVED,
PROP_FLAGS,
PROP_FILENAME,
PROP_VISIBLE,
LAST_PROP
@ -61,6 +62,7 @@ typedef struct {
gboolean unsaved;
guint32 flags;
const char *filename;
gboolean visible;
} NMRemoteConnectionPrivate;
@ -669,6 +671,22 @@ nm_remote_connection_get_flags (NMRemoteConnection *connection)
return (NMSettingsConnectionFlags) NM_REMOTE_CONNECTION_GET_PRIVATE (connection)->flags;
}
/**
* nm_remote_connection_get_filename:
* @connection: the #NMRemoteConnection
*
* Returns: file that stores the connection in case the connection is file-backed.
*
* Since: 1.12
**/
const char *
nm_remote_connection_get_filename (NMRemoteConnection *connection)
{
g_return_val_if_fail (NM_IS_REMOTE_CONNECTION (connection), NULL);
return NM_REMOTE_CONNECTION_GET_PRIVATE (connection)->filename;
}
/**
* nm_remote_connection_get_visible:
* @connection: the #NMRemoteConnection
@ -760,6 +778,7 @@ init_dbus (NMObject *object)
const NMPropertiesInfo property_info[] = {
{ NM_REMOTE_CONNECTION_UNSAVED, &priv->unsaved },
{ NM_REMOTE_CONNECTION_FLAGS, &priv->flags },
{ NM_REMOTE_CONNECTION_FILENAME, &priv->filename },
{ NULL },
};
@ -893,6 +912,9 @@ get_property (GObject *object, guint prop_id,
case PROP_FLAGS:
g_value_set_boolean (value, NM_REMOTE_CONNECTION_GET_PRIVATE (object)->flags);
break;
case PROP_FILENAME:
g_value_set_string (value, NM_REMOTE_CONNECTION_GET_PRIVATE (object)->filename);
break;
case PROP_VISIBLE:
g_value_set_boolean (value, NM_REMOTE_CONNECTION_GET_PRIVATE (object)->visible);
break;
@ -965,6 +987,21 @@ nm_remote_connection_class_init (NMRemoteConnectionClass *remote_class)
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
/**
* NMRemoteConnection:filename:
*
* File that stores the connection in case the connection is
* file-backed.
*
* Since: 1.12
**/
g_object_class_install_property
(object_class, PROP_FILENAME,
g_param_spec_string (NM_REMOTE_CONNECTION_FILENAME, "", "",
NULL,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
/**
* NMRemoteConnection:visible:
*

View file

@ -42,6 +42,7 @@ G_BEGIN_DECLS
#define NM_REMOTE_CONNECTION_PATH "path"
#define NM_REMOTE_CONNECTION_UNSAVED "unsaved"
#define NM_REMOTE_CONNECTION_FLAGS "flags"
#define NM_REMOTE_CONNECTION_FILENAME "filename"
#define NM_REMOTE_CONNECTION_VISIBLE "visible"
/**
@ -126,6 +127,9 @@ gboolean nm_remote_connection_get_unsaved (NMRemoteConnection *connection);
NM_AVAILABLE_IN_1_12
NMSettingsConnectionFlags nm_remote_connection_get_flags (NMRemoteConnection *connection);
NM_AVAILABLE_IN_1_12
const char *nm_remote_connection_get_filename (NMRemoteConnection *connection);
gboolean nm_remote_connection_get_visible (NMRemoteConnection *connection);
G_END_DECLS