[gnome-control-center] network: activate wired profiles when clicked



commit 539b5e0710e5b1b8136c23a54d7efd629a1848d4
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Aug 16 10:30:58 2013 -0400

    network: activate wired profiles when clicked
    
    This was always the intention of the design; we just
    didn't get around to it. It is becoming more important now
    that the shell system status does not show wired profiles
    anymore.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705935

 panels/network/net-device-ethernet.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/panels/network/net-device-ethernet.c b/panels/network/net-device-ethernet.c
index 368ea52..9f5c4e6 100644
--- a/panels/network/net-device-ethernet.c
+++ b/panels/network/net-device-ethernet.c
@@ -542,6 +542,28 @@ device_off_toggled (GtkSwitch         *sw,
 }
 
 static void
+connection_activated (GtkListBox *list, GtkListBoxRow *row, NetDeviceEthernet *device)
+{
+        NMClient *client;
+        NMDevice *nm_device;
+        NMConnection *connection;
+
+        client = net_object_get_client (NET_OBJECT (device));
+        nm_device = net_device_get_nm_device (NET_DEVICE (device));
+
+        if (!NM_IS_DEVICE_ETHERNET (nm_device) ||
+            !nm_device_ethernet_get_carrier (NM_DEVICE_ETHERNET (nm_device)))
+                return;
+
+        connection = NM_CONNECTION (g_object_get_data (G_OBJECT (gtk_bin_get_child (GTK_BIN (row))), 
"connection"));
+
+        nm_client_activate_connection (client,
+                                       connection,
+                                       nm_device,
+                                       NULL, NULL, NULL);
+}
+
+static void
 device_ethernet_constructed (GObject *object)
 {
         NetDeviceEthernet *device = NET_DEVICE_ETHERNET (object);
@@ -560,6 +582,8 @@ device_ethernet_constructed (GObject *object)
         gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
         gtk_list_box_set_header_func (GTK_LIST_BOX (list), update_header, NULL, NULL);
         gtk_container_add (GTK_CONTAINER (swin), list);
+        g_signal_connect (list, "row-activated",
+                          G_CALLBACK (connection_activated), device);
         gtk_widget_show (list);
 
         device->details = GTK_WIDGET (gtk_builder_get_object (NET_DEVICE_ETHERNET (object)->builder, 
"details"));


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