2008-04-03 Dan Williams <dcbw@redhat.com>

* libnm-glib/nm-settings.c
	  libnm-glib/nm-settings.h
	    - (nm_exported_connection_get_id): new function
		- (impl_exported_connection_get_id): use nm_exported_connection_get_id()



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3528 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams 2008-04-03 18:19:19 +00:00
parent 85eb6bd5c3
commit f934f0b1f7
3 changed files with 34 additions and 18 deletions

View file

@ -1,3 +1,10 @@
2008-04-03 Dan Williams <dcbw@redhat.com>
* libnm-glib/nm-settings.c
libnm-glib/nm-settings.h
- (nm_exported_connection_get_id): new function
- (impl_exported_connection_get_id): use nm_exported_connection_get_id()
2008-04-02 Dan Williams <dcbw@redhat.com>
* src/nm-device-interface.c

View file

@ -143,31 +143,38 @@ typedef struct {
NM_TYPE_EXPORTED_CONNECTION, \
NMExportedConnectionPrivate))
const char *
nm_exported_connection_get_id (NMExportedConnection *connection)
{
NMExportedConnectionPrivate *priv;
NMSettingConnection *s_con;
g_return_val_if_fail (NM_IS_EXPORTED_CONNECTION (connection), NULL);
priv = NM_EXPORTED_CONNECTION_GET_PRIVATE (connection);
if (EXPORTED_CONNECTION_CLASS (connection)->get_id)
return EXPORTED_CONNECTION_CLASS (connection)->get_id (connection);
s_con = (NMSettingConnection *) nm_connection_get_setting (priv->wrapped, NM_TYPE_SETTING_CONNECTION);
if (NM_IS_SETTING_CONNECTION (s_con))
return s_con->id;
return NULL;
}
static gboolean
impl_exported_connection_get_id (NMExportedConnection *connection,
gchar **id,
GError **error)
{
NMExportedConnectionPrivate *priv;
g_return_val_if_fail (NM_IS_EXPORTED_CONNECTION (connection), FALSE);
priv = NM_EXPORTED_CONNECTION_GET_PRIVATE (connection);
if (!EXPORTED_CONNECTION_CLASS (connection)->get_id) {
NMSettingConnection *s_con;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (priv->wrapped, NM_TYPE_SETTING_CONNECTION));
if (!s_con || !s_con->id) {
g_set_error (error, NM_SETTINGS_ERROR, 1,
"%s.%d - Invalid connection.",
__FILE__, __LINE__);
return FALSE;
}
*id = g_strdup (s_con->id);
} else {
*id = EXPORTED_CONNECTION_CLASS (connection)->get_id (connection);
*id = (gchar *) nm_exported_connection_get_id (connection);
if (!*id) {
g_set_error (error, NM_SETTINGS_ERROR, 1,
"%s.%d - Could not get connection ID.",
__FILE__, __LINE__);
return FALSE;
}
return TRUE;

View file

@ -27,7 +27,7 @@ typedef struct {
GObjectClass parent_class;
/* virtual methods */
gchar * (* get_id) (NMExportedConnection *connection);
const gchar *(* get_id) (NMExportedConnection *connection);
GHashTable * (* get_settings) (NMExportedConnection *connection);
void (* get_secrets) (NMExportedConnection *connection,
const gchar *setting_name,
@ -48,6 +48,8 @@ void nm_exported_connection_register_object (NMExportedConnection *connection,
NMConnection *nm_exported_connection_get_connection (NMExportedConnection *connection);
const char *nm_exported_connection_get_id (NMExportedConnection *connection);
void nm_exported_connection_signal_updated (NMExportedConnection *connection, GHashTable *settings);
void nm_exported_connection_signal_removed (NMExportedConnection *connection);