libnm-glib: add 'connections-read' signal to settings interface

To let listeners know when all connections have been found.
This commit is contained in:
Witold Sowa 2009-09-22 23:44:45 -07:00 committed by Dan Williams
parent ac03cbce04
commit b20cef2e1b
3 changed files with 22 additions and 1 deletions

View file

@ -124,6 +124,10 @@ connection_init_result_cb (NMRemoteConnection *remote,
}
g_hash_table_remove (priv->pending, path);
/* Let listeners know that all connections have been found */
if (!g_hash_table_size (priv->pending))
g_signal_emit_by_name (self, NM_SETTINGS_INTERFACE_CONNECTIONS_READ);
}
static void
@ -171,6 +175,12 @@ fetch_connections_done (DBusGProxy *proxy,
return;
}
/* Let listeners know we are done getting connections */
if (connections->len == 0) {
g_signal_emit_by_name (self, NM_SETTINGS_INTERFACE_CONNECTIONS_READ);
return;
}
for (i = 0; connections && (i < connections->len); i++) {
char *path = g_ptr_array_index (connections, i);

View file

@ -162,6 +162,14 @@ nm_settings_interface_init (gpointer g_iface)
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, G_TYPE_OBJECT);
g_signal_new (NM_SETTINGS_INTERFACE_CONNECTIONS_READ,
iface_type,
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMSettingsInterface, connections_read),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
initialized = TRUE;
}

View file

@ -48,7 +48,8 @@ GType nm_settings_interface_error_get_type (void);
#define NM_IS_SETTINGS_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTINGS_INTERFACE))
#define NM_SETTINGS_INTERFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NM_TYPE_SETTINGS_INTERFACE, NMSettingsInterface))
#define NM_SETTINGS_INTERFACE_NEW_CONNECTION "new-connection"
#define NM_SETTINGS_INTERFACE_NEW_CONNECTION "new-connection"
#define NM_SETTINGS_INTERFACE_CONNECTIONS_READ "connections-read"
typedef struct _NMSettingsInterface NMSettingsInterface;
@ -74,6 +75,8 @@ struct _NMSettingsInterface {
/* Signals */
void (*new_connection) (NMSettingsInterface *settings,
NMSettingsConnectionInterface *connection);
void (*connections_read) (NMSettingsInterface *settings);
};
GType nm_settings_interface_get_type (void);