network-manager-applet r459 - in trunk: . src
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: network-manager-applet r459 - in trunk: . src
- Date: Thu, 17 Jan 2008 22:58:05 +0000 (GMT)
Author: dcbw
Date: Thu Jan 17 22:58:05 2008
New Revision: 459
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=459&view=rev
Log:
2008-01-17 Dan Williams <dcbw redhat com>
* src/applet-dbus-settings.c
src/applet-dbus-settings.h
- (update_user_connections): new function; factor out common code to
update user connections
- (applet_dbus_settings_list_connections): use update_user_connections()
- (applet_dbus_settings_get_all_connections): new function; return a
a GSList of all connections (both system and user)
Modified:
trunk/ChangeLog
trunk/src/applet-dbus-settings.c
trunk/src/applet-dbus-settings.h
Modified: trunk/src/applet-dbus-settings.c
==============================================================================
--- trunk/src/applet-dbus-settings.c (original)
+++ trunk/src/applet-dbus-settings.c Thu Jan 17 22:58:05 2008
@@ -609,20 +609,59 @@
return cnc_list;
}
+static void
+update_user_connections (AppletDbusSettings *applet_settings)
+{
+ g_return_if_fail (APPLET_IS_DBUS_SETTINGS (applet_settings));
+
+ if (applet_settings->connections)
+ return;
+
+ applet_settings->connections = get_connections (applet_settings);
+ if (!applet_settings->connections)
+ g_warning ("No networks found in the configuration database");
+}
+
GSList *
applet_dbus_settings_list_connections (AppletDbusSettings *applet_settings)
{
g_return_val_if_fail (APPLET_IS_DBUS_SETTINGS (applet_settings), NULL);
- if (!applet_settings->connections) {
- applet_settings->connections = get_connections (applet_settings);
- if (!applet_settings->connections)
- g_warning ("No networks found in the configuration database");
- }
+ update_user_connections (applet_settings);
return applet_settings->connections;
}
+static void
+add_system_connection (gpointer key, gpointer value, gpointer user_data)
+{
+ GSList **list = (GSList **) user_data;
+
+ *list = g_slist_append (*list, NM_CONNECTION (value));
+}
+
+GSList *
+applet_dbus_settings_get_all_connections (AppletDbusSettings *applet_settings)
+{
+ GSList *connections = NULL, *iter;
+
+ g_return_val_if_fail (APPLET_IS_DBUS_SETTINGS (applet_settings), NULL);
+
+ g_hash_table_foreach (applet_settings->system_connections,
+ add_system_connection,
+ &connections);
+
+ update_user_connections (applet_settings);
+ for (iter = applet_settings->connections; iter; iter = g_slist_next (iter)) {
+ NMConnectionSettings *cs = NM_CONNECTION_SETTINGS (iter->data);
+ NMConnection *con = applet_dbus_connection_settings_get_connection (cs);
+
+ connections = g_slist_append (connections, con);
+ }
+
+ return connections;
+}
+
static GPtrArray *
list_connections (NMSettings *settings)
{
Modified: trunk/src/applet-dbus-settings.h
==============================================================================
--- trunk/src/applet-dbus-settings.h (original)
+++ trunk/src/applet-dbus-settings.h Thu Jan 17 22:58:05 2008
@@ -101,6 +101,10 @@
AppletDbusConnectionSettings * applet_dbus_settings_get_by_connection (AppletDbusSettings *settings,
NMConnection *connection);
+/* Returns a list of NMConnectionSettings objects */
GSList * applet_dbus_settings_list_connections (AppletDbusSettings *settings);
+/* Returns a list of both user and system NMConnection objects */
+GSList * applet_dbus_settings_get_all_connections (AppletDbusSettings *settings);
+
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]