[network-manager-applet/bond: 6/6] applet: don't show bond slaves in the menu



commit fbf66d93a95b0b940de8cee8c323dcd597dc0b8f
Author: Dan Winship <danw gnome org>
Date:   Mon Aug 13 10:37:08 2012 -0400

    applet: don't show bond slaves in the menu
    
    Slave connections shouldn't be listed in the applet menu, since they
    should only be used via their master.

 src/applet.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/src/applet.c b/src/applet.c
index f404b0a..07b7a4f 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -396,7 +396,23 @@ applet_get_settings (NMApplet *applet)
 GSList *
 applet_get_all_connections (NMApplet *applet)
 {
-	return nm_remote_settings_list_connections (applet->settings);
+	GSList *connections, *iter, *next;
+	NMConnection *connection;
+	NMSettingConnection *s_con;
+
+	connections = nm_remote_settings_list_connections (applet->settings);
+
+	/* Ignore slave connections */
+	for (iter = connections; iter; iter = next) {
+		connection = iter->data;
+		next = iter->next;
+
+		s_con = nm_connection_get_setting_connection (connection);
+		if (s_con && nm_setting_connection_get_master (s_con))
+			connections = g_slist_delete_link (connections, iter);
+	}
+
+	return connections;
 }
 
 static NMConnection *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]