[gnome-control-center] network: Split the wired device from the .c and .ui file
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: Split the wired device from the .c and .ui file
- Date: Fri, 20 Jul 2012 08:33:21 +0000 (UTC)
commit a808633484695fbe245f5797108123c749985e5a
Author: Richard Hughes <richard hughsie com>
Date: Wed Jul 18 15:08:07 2012 +0100
network: Split the wired device from the .c and .ui file
panels/network/Makefile.am | 3 +
panels/network/cc-network-panel.c | 165 +++--------------
panels/network/net-device-wired.c | 271 +++++++++++++++++++++++++++
panels/network/net-device-wired.h | 58 ++++++
panels/network/network-wired.ui | 366 +++++++++++++++++++++++++++++++++++++
panels/network/network.ui | 360 ------------------------------------
6 files changed, 726 insertions(+), 497 deletions(-)
---
diff --git a/panels/network/Makefile.am b/panels/network/Makefile.am
index 6225378..b9f64be 100644
--- a/panels/network/Makefile.am
+++ b/panels/network/Makefile.am
@@ -20,6 +20,8 @@ libnetwork_la_SOURCES = \
net-object.h \
net-device.c \
net-device.h \
+ net-device-wired.c \
+ net-device-wired.h \
net-vpn.c \
net-vpn.h \
net-proxy.c \
@@ -42,6 +44,7 @@ uidir = $(pkgdatadir)/ui
dist_ui_DATA = \
network-proxy.ui \
network-vpn.ui \
+ network-wired.ui \
network.ui
@INTLTOOL_DESKTOP_RULE@
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index ff64d69..ef64a2a 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -45,6 +45,7 @@
#include "net-object.h"
#include "net-device.h"
+#include "net-device-wired.h"
#include "net-proxy.h"
#include "net-vpn.h"
@@ -533,6 +534,9 @@ panel_add_device (CcNetworkPanel *panel, NMDevice *device)
NMDeviceType type;
NetDevice *net_device;
CcNetworkPanelPrivate *priv = panel->priv;
+ GtkNotebook *notebook;
+ GtkSizeGroup *size_group;
+ GType device_g_type;
/* do we have an existing object with this id? */
if (find_in_model_by_id (panel, nm_device_get_udi (device)) != NULL)
@@ -571,9 +575,19 @@ panel_add_device (CcNetworkPanel *panel, NMDevice *device)
device);
}
+ /* map the NMDeviceType to the GType */
+ switch (type) {
+ case NM_DEVICE_TYPE_ETHERNET:
+ device_g_type = NET_TYPE_DEVICE_WIRED;
+ break;
+ default:
+ device_g_type = NET_TYPE_DEVICE;
+ break;
+ }
+
/* create device */
title = panel_device_to_localized_string (device);
- net_device = g_object_new (NET_TYPE_DEVICE,
+ net_device = g_object_new (device_g_type,
"removable", FALSE,
"cancellable", panel->priv->cancellable,
"client", panel->priv->client,
@@ -583,6 +597,17 @@ panel_add_device (CcNetworkPanel *panel, NMDevice *device)
"title", title,
NULL);
+ /* add as a panel */
+ if (device_g_type != NET_TYPE_DEVICE) {
+ notebook = GTK_NOTEBOOK (gtk_builder_get_object (panel->priv->builder,
+ "notebook_types"));
+ size_group = GTK_SIZE_GROUP (gtk_builder_get_object (panel->priv->builder,
+ "sizegroup1"));
+ net_object_add_to_notebook (NET_OBJECT (net_device),
+ notebook,
+ size_group);
+ }
+
liststore_devices = GTK_LIST_STORE (gtk_builder_get_object (priv->builder,
"liststore_devices"));
register_object_interest (panel, NET_OBJECT (net_device));
@@ -861,81 +886,6 @@ add_access_point_other (CcNetworkPanel *panel)
-1);
}
-#if 0
-static gchar *
-ip4_address_as_string (guint32 ip)
-{
- char buf[INET_ADDRSTRLEN+1];
- struct in_addr tmp_addr;
-
- memset (&buf, '\0', sizeof (buf));
- tmp_addr.s_addr = ip;
-
- if (inet_ntop (AF_INET, &tmp_addr, buf, INET_ADDRSTRLEN)) {
- return g_strdup (buf);
- } else {
- g_warning ("error converting IP4 address 0x%X",
- ntohl (tmp_addr.s_addr));
- return NULL;
- }
-}
-
-static void
-panel_show_ip4_config (NMIP4Config *cfg)
-{
- gchar *tmp;
- const GArray *array;
- const GPtrArray *ptr_array;
- GSList *iter;
- int i;
-
- for (iter = (GSList *) nm_ip4_config_get_addresses (cfg); iter; iter = g_slist_next (iter)) {
- NMIP4Address *addr = iter->data;
- guint32 u;
-
- tmp = ip4_address_as_string (nm_ip4_address_get_address (addr));
- g_debug ("IP4 address: %s", tmp);
- g_free (tmp);
-
- u = nm_ip4_address_get_prefix (addr);
- tmp = ip4_address_as_string (nm_utils_ip4_prefix_to_netmask (u));
- g_debug ("IP4 prefix: %d (%s)", u, tmp);
- g_free (tmp);
-
- tmp = ip4_address_as_string (nm_ip4_address_get_gateway (addr));
- g_debug ("IP4 gateway: %s", tmp);
- g_free (tmp);
- }
-
- array = nm_ip4_config_get_nameservers (cfg);
- if (array) {
- g_debug ("IP4 DNS:");
- for (i = 0; i < array->len; i++) {
- tmp = ip4_address_as_string (g_array_index (array, guint32, i));
- g_debug ("\t%s", tmp);
- g_free (tmp);
- }
- }
-
- ptr_array = nm_ip4_config_get_domains (cfg);
- if (ptr_array) {
- g_debug ("IP4 domains:");
- for (i = 0; i < ptr_array->len; i++)
- g_debug ("\t%s", (const char *) g_ptr_array_index (ptr_array, i));
- }
-
- array = nm_ip4_config_get_wins_servers (cfg);
- if (array) {
- g_debug ("IP4 WINS:");
- for (i = 0; i < array->len; i++) {
- tmp = ip4_address_as_string (g_array_index (array, guint32, i));
- g_debug ("\t%s", tmp);
- g_free (tmp);
- }
- }
-}
-#endif
-
static GPtrArray *
panel_get_strongest_unique_aps (const GPtrArray *aps)
{
@@ -1277,25 +1227,6 @@ mobilebb_enabled_toggled (NMClient *client,
panel->priv->updating_device = FALSE;
}
-static void
-update_off_switch_from_device_state (GtkSwitch *sw, NMDeviceState state, CcNetworkPanel *panel)
-{
- panel->priv->updating_device = TRUE;
- switch (state) {
- case NM_DEVICE_STATE_UNMANAGED:
- case NM_DEVICE_STATE_UNAVAILABLE:
- case NM_DEVICE_STATE_DISCONNECTED:
- case NM_DEVICE_STATE_DEACTIVATING:
- case NM_DEVICE_STATE_FAILED:
- gtk_switch_set_active (sw, FALSE);
- break;
- default:
- gtk_switch_set_active (sw, TRUE);
- break;
- }
- panel->priv->updating_device = FALSE;
-}
-
static gboolean
device_is_hotspot (CcNetworkPanel *panel,
NMDevice *device)
@@ -1453,12 +1384,6 @@ refresh_header_ui (CcNetworkPanel *panel, NMDevice *device, const char *page_nam
/* keep this in sync with the signal handler setup in cc_network_panel_init */
switch (type) {
case NM_DEVICE_TYPE_ETHERNET:
- gtk_widget_set_visible (widget,
- state != NM_DEVICE_STATE_UNAVAILABLE
- && state != NM_DEVICE_STATE_UNMANAGED);
- update_off_switch_from_device_state (GTK_SWITCH (widget), state, panel);
- if (state != NM_DEVICE_STATE_UNAVAILABLE)
- speed = nm_device_ethernet_get_speed (NM_DEVICE_ETHERNET (device));
break;
case NM_DEVICE_TYPE_WIFI:
gtk_widget_show (widget);
@@ -1505,9 +1430,6 @@ refresh_header_ui (CcNetworkPanel *panel, NMDevice *device, const char *page_nam
g_free (wid_name);
if (widget != NULL) {
switch (type) {
- case NM_DEVICE_TYPE_ETHERNET:
- gtk_widget_set_sensitive (widget, TRUE);
- break;
default:
is_connected = find_connection_for_device (panel, device) != NULL;
gtk_widget_set_sensitive (widget, is_connected);
@@ -1518,25 +1440,6 @@ refresh_header_ui (CcNetworkPanel *panel, NMDevice *device, const char *page_nam
}
static void
-device_refresh_ethernet_ui (CcNetworkPanel *panel, NetDevice *device)
-{
- const char *str;
- NMDevice *nm_device;
-
- nm_device = net_device_get_nm_device (device);
-
- refresh_header_ui (panel, nm_device, "wired");
-
- /* device MAC */
- str = nm_device_ethernet_get_hw_address (NM_DEVICE_ETHERNET (nm_device));
- panel_set_widget_data (panel,
- "wired",
- "mac",
- str);
-
-}
-
-static void
device_refresh_wifi_ui (CcNetworkPanel *panel, NetDevice *device)
{
GtkWidget *widget;
@@ -1793,12 +1696,9 @@ nm_device_refresh_device_ui (CcNetworkPanel *panel, NetDevice *device)
switch (type) {
case NM_DEVICE_TYPE_ETHERNET:
- gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 0);
- sub_pane = "wired";
- device_refresh_ethernet_ui (panel, device);
break;
case NM_DEVICE_TYPE_WIFI:
- gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 1);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 0);
sub_pane = "wireless";
device_refresh_wifi_ui (panel, device);
break;
@@ -1810,7 +1710,7 @@ nm_device_refresh_device_ui (CcNetworkPanel *panel, NetDevice *device)
NMDeviceModemCapabilities caps = nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM (nm_device));
if ((caps & NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS) ||
(caps & NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO)) {
- gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 2);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 1);
sub_pane = "mobilebb";
device_refresh_modem_ui (panel, device);
} else {
@@ -3332,10 +3232,6 @@ cc_network_panel_init (CcNetworkPanel *panel)
G_CALLBACK (device_removed_cb), panel);
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
- "device_wired_off_switch"));
- g_signal_connect (widget, "notify::active",
- G_CALLBACK (device_off_toggled), panel);
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"device_wireless_off_switch"));
g_signal_connect (widget, "notify::active",
G_CALLBACK (device_off_toggled), panel);
@@ -3361,11 +3257,6 @@ cc_network_panel_init (CcNetworkPanel *panel)
G_CALLBACK (stop_hotspot), panel);
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
- "button_wired_options"));
- g_signal_connect (widget, "clicked",
- G_CALLBACK (edit_connection), panel);
-
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"button_wireless_options"));
g_signal_connect (widget, "clicked",
G_CALLBACK (edit_connection), panel);
diff --git a/panels/network/net-device-wired.c b/panels/network/net-device-wired.c
new file mode 100644
index 0000000..f2bd65e
--- /dev/null
+++ b/panels/network/net-device-wired.c
@@ -0,0 +1,271 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011-2012 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "config.h"
+
+#include <glib-object.h>
+#include <glib/gi18n.h>
+
+#include <nm-client.h>
+#include <nm-device.h>
+#include <nm-device-ethernet.h>
+#include <nm-remote-connection.h>
+
+#include "panel-common.h"
+
+#include "net-device-wired.h"
+
+#define NET_DEVICE_WIRED_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NET_TYPE_DEVICE_WIRED, NetDeviceWiredPrivate))
+
+struct _NetDeviceWiredPrivate
+{
+ GtkBuilder *builder;
+ gboolean updating_device;
+};
+
+G_DEFINE_TYPE (NetDeviceWired, net_device_wired, NET_TYPE_DEVICE)
+
+static GtkWidget *
+device_wired_proxy_add_to_notebook (NetObject *object,
+ GtkNotebook *notebook,
+ GtkSizeGroup *heading_size_group)
+{
+ GtkWidget *widget;
+ GtkWindow *window;
+ NetDeviceWired *device_wired = NET_DEVICE_WIRED (object);
+
+ /* add widgets to size group */
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wired->priv->builder,
+ "heading_ipv4"));
+ gtk_size_group_add_widget (heading_size_group, widget);
+
+ /* reparent */
+ window = GTK_WINDOW (gtk_builder_get_object (device_wired->priv->builder,
+ "window_tmp"));
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wired->priv->builder,
+ "vbox6"));
+ g_object_ref (widget);
+ gtk_container_remove (GTK_CONTAINER (window), widget);
+ gtk_notebook_append_page (notebook, widget, NULL);
+ g_object_unref (widget);
+ return widget;
+}
+
+static void
+update_off_switch_from_device_state (GtkSwitch *sw,
+ NMDeviceState state,
+ NetDeviceWired *device_wired)
+{
+ device_wired->priv->updating_device = TRUE;
+ switch (state) {
+ case NM_DEVICE_STATE_UNMANAGED:
+ case NM_DEVICE_STATE_UNAVAILABLE:
+ case NM_DEVICE_STATE_DISCONNECTED:
+ case NM_DEVICE_STATE_DEACTIVATING:
+ case NM_DEVICE_STATE_FAILED:
+ gtk_switch_set_active (sw, FALSE);
+ break;
+ default:
+ gtk_switch_set_active (sw, TRUE);
+ break;
+ }
+ device_wired->priv->updating_device = FALSE;
+}
+
+static void
+nm_device_wired_refresh_ui (NetDeviceWired *device_wired)
+{
+ const char *str;
+ GString *status;
+ GtkWidget *widget;
+ guint speed = 0;
+ NMDevice *nm_device;
+ NMDeviceState state;
+ NetDeviceWiredPrivate *priv = device_wired->priv;
+
+ /* set device kind */
+ nm_device = net_device_get_nm_device (NET_DEVICE (device_wired));
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "label_device"));
+ gtk_label_set_label (GTK_LABEL (widget),
+ panel_device_to_localized_string (nm_device));
+
+ /* set up the device on/off switch */
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "device_off_switch"));
+ state = nm_device_get_state (nm_device);
+ gtk_widget_set_visible (widget,
+ state != NM_DEVICE_STATE_UNAVAILABLE
+ && state != NM_DEVICE_STATE_UNMANAGED);
+ update_off_switch_from_device_state (GTK_SWITCH (widget), state, device_wired);
+
+ /* set device state, with status and optionally speed */
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "label_status"));
+ status = g_string_new (panel_device_state_to_localized_string (nm_device));
+ if (state != NM_DEVICE_STATE_UNAVAILABLE)
+ speed = nm_device_ethernet_get_speed (NM_DEVICE_ETHERNET (nm_device));
+ if (speed > 0) {
+ g_string_append (status, " - ");
+ /* Translators: network device speed */
+ g_string_append_printf (status, _("%d Mb/s"), speed);
+ }
+ gtk_label_set_label (GTK_LABEL (widget), status->str);
+ g_string_free (status, TRUE);
+ gtk_widget_set_tooltip_text (widget,
+ panel_device_state_reason_to_localized_string (nm_device));
+
+ /* device MAC */
+ str = nm_device_ethernet_get_hw_address (NM_DEVICE_ETHERNET (nm_device));
+ panel_set_device_widget_details (priv->builder, "mac", str);
+
+ /* set IP entries */
+ panel_set_device_widgets (priv->builder, nm_device);
+}
+
+static void
+device_wired_refresh (NetObject *object)
+{
+ NetDeviceWired *device_wired = NET_DEVICE_WIRED (object);
+ nm_device_wired_refresh_ui (device_wired);
+}
+
+static void
+device_off_toggled (GtkSwitch *sw,
+ GParamSpec *pspec,
+ NetDeviceWired *device_wired)
+{
+ const gchar *path;
+ const GPtrArray *acs;
+ gboolean active;
+ gint i;
+ NMActiveConnection *a;
+ NMConnection *connection;
+ NMClient *client;
+
+ if (device_wired->priv->updating_device)
+ return;
+
+ active = gtk_switch_get_active (sw);
+ if (active) {
+ client = net_object_get_client (NET_OBJECT (device_wired));
+ connection = net_device_get_find_connection (NET_DEVICE (device_wired));
+ if (connection == NULL)
+ return;
+ nm_client_activate_connection (client,
+ connection, NULL, NULL,
+ NULL, NULL);
+ } else {
+ connection = net_device_get_find_connection (NET_DEVICE (device_wired));
+ if (connection == NULL)
+ return;
+ path = nm_connection_get_path (connection);
+ client = net_object_get_client (NET_OBJECT (device_wired));
+ acs = nm_client_get_active_connections (client);
+ for (i = 0; i < acs->len; i++) {
+ a = (NMActiveConnection*)acs->pdata[i];
+ if (strcmp (nm_active_connection_get_connection (a), path) == 0) {
+ nm_client_deactivate_connection (client, a);
+ break;
+ }
+ }
+ }
+}
+
+static void
+edit_connection (GtkButton *button, NetDeviceWired *device_wired)
+{
+ const gchar *uuid;
+ gchar *cmdline;
+ GError *error = NULL;
+ NMConnection *connection;
+
+ connection = net_device_get_find_connection (NET_DEVICE (device_wired));
+ uuid = nm_connection_get_uuid (connection);
+ cmdline = g_strdup_printf ("nm-connection-editor --edit %s", uuid);
+ g_debug ("Launching '%s'\n", cmdline);
+ if (!g_spawn_command_line_async (cmdline, &error)) {
+ g_warning ("Failed to launch nm-connection-editor: %s", error->message);
+ g_error_free (error);
+ }
+ g_free (cmdline);
+}
+
+static void
+net_device_wired_constructed (GObject *object)
+{
+ NetDeviceWired *device_wired = NET_DEVICE_WIRED (object);
+
+ G_OBJECT_CLASS (net_device_wired_parent_class)->constructed (object);
+
+ nm_device_wired_refresh_ui (device_wired);
+}
+
+static void
+net_device_wired_finalize (GObject *object)
+{
+ NetDeviceWired *device_wired = NET_DEVICE_WIRED (object);
+ NetDeviceWiredPrivate *priv = device_wired->priv;
+
+ g_object_unref (priv->builder);
+
+ G_OBJECT_CLASS (net_device_wired_parent_class)->finalize (object);
+}
+
+static void
+net_device_wired_class_init (NetDeviceWiredClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ NetObjectClass *parent_class = NET_OBJECT_CLASS (klass);
+
+ object_class->finalize = net_device_wired_finalize;
+ object_class->constructed = net_device_wired_constructed;
+ parent_class->add_to_notebook = device_wired_proxy_add_to_notebook;
+ parent_class->refresh = device_wired_refresh;
+ g_type_class_add_private (klass, sizeof (NetDeviceWiredPrivate));
+}
+
+static void
+net_device_wired_init (NetDeviceWired *device_wired)
+{
+ GError *error = NULL;
+ GtkWidget *widget;
+
+ device_wired->priv = NET_DEVICE_WIRED_GET_PRIVATE (device_wired);
+
+ device_wired->priv->builder = gtk_builder_new ();
+ gtk_builder_add_from_file (device_wired->priv->builder,
+ GNOMECC_UI_DIR "/network-wired.ui",
+ &error);
+ if (error != NULL) {
+ g_warning ("Could not load interface file: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ /* setup wired combobox model */
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wired->priv->builder,
+ "device_off_switch"));
+ g_signal_connect (widget, "notify::active",
+ G_CALLBACK (device_off_toggled), device_wired);
+
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wired->priv->builder,
+ "button_options"));
+ g_signal_connect (widget, "clicked",
+ G_CALLBACK (edit_connection), device_wired);
+}
diff --git a/panels/network/net-device-wired.h b/panels/network/net-device-wired.h
new file mode 100644
index 0000000..b4d4b50
--- /dev/null
+++ b/panels/network/net-device-wired.h
@@ -0,0 +1,58 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011-2012 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __NET_DEVICE_WIRED_H
+#define __NET_DEVICE_WIRED_H
+
+#include <glib-object.h>
+
+#include "net-device.h"
+
+G_BEGIN_DECLS
+
+#define NET_TYPE_DEVICE_WIRED (net_device_wired_get_type ())
+#define NET_DEVICE_WIRED(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NET_TYPE_DEVICE_WIRED, NetDeviceWired))
+#define NET_DEVICE_WIRED_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NET_TYPE_DEVICE_WIRED, NetDeviceWiredClass))
+#define NET_IS_DEVICE_WIRED(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NET_TYPE_DEVICE_WIRED))
+#define NET_IS_DEVICE_WIRED_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NET_TYPE_DEVICE_WIRED))
+#define NET_DEVICE_WIRED_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NET_TYPE_DEVICE_WIRED, NetDeviceWiredClass))
+
+typedef struct _NetDeviceWiredPrivate NetDeviceWiredPrivate;
+typedef struct _NetDeviceWired NetDeviceWired;
+typedef struct _NetDeviceWiredClass NetDeviceWiredClass;
+
+struct _NetDeviceWired
+{
+ NetDevice parent;
+ NetDeviceWiredPrivate *priv;
+};
+
+struct _NetDeviceWiredClass
+{
+ NetDeviceClass parent_class;
+};
+
+GType net_device_wired_get_type (void);
+
+G_END_DECLS
+
+#endif /* __NET_DEVICE_WIRED_H */
+
diff --git a/panels/network/network-wired.ui b/panels/network/network-wired.ui
new file mode 100644
index 0000000..ab211a9
--- /dev/null
+++ b/panels/network/network-wired.ui
@@ -0,0 +1,366 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkWindow" id="window_tmp">
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkVBox" id="vbox6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">12</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">start</property>
+ <property name="row_spacing">10</property>
+ <property name="column_spacing">6</property>
+ <child>
+ <object class="GtkImage" id="image_device">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">end</property>
+ <property name="valign">start</property>
+ <property name="xalign">1</property>
+ <property name="pixel_size">48</property>
+ <property name="icon_name">network-wired</property>
+ <property name="icon-size">6</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">start</property>
+ <property name="hexpand">True</property>
+ <property name="spacing">3</property>
+ <child>
+ <object class="GtkLabel" id="label_device">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label">Wired</property>
+ <property name="ellipsize">end</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ <attribute name="scale" value="1.2"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_status">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label">Cable unplugged</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="heading_mac">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Hardware Address</property>
+ <property name="mnemonic_widget">label_mac</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="heading_ipv4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">IPv4 Address</property>
+ <property name="mnemonic_widget">label_ipv4</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="heading_ipv6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">IPv6 Address</property>
+ <property name="mnemonic_widget">label_ipv6</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="heading_subnet">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Subnet Mask</property>
+ <property name="mnemonic_widget">label_subnet</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">5</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="heading_route">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Default Route</property>
+ <property name="mnemonic_widget">label_route</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">6</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="heading_dns">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">DNS</property>
+ <property name="mnemonic_widget">label_dns</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">7</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_mac">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label">AA:BB:CC:DD:55:66:77:88</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_ipv4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label">127.0.0.1</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_ipv6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label">::1</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_subnet">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label">127.0.0.1</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">5</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_route">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label">127.0.0.1</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">6</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_dns">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label">127.0.0.1</property>
+ <property name="wrap">True</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">7</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="alignment_switch">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">end</property>
+ <property name="valign">start</property>
+ <child>
+ <object class="GtkSwitch" id="device_off_switch">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="halign">end</property>
+ <property name="valign">start</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_top">12</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkButton" id="button_options">
+ <property name="label" translatable="yes">_Options...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="halign">end</property>
+ <property name="valign">end</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkSizeGroup" id="sizegroup1">
+ <widgets>
+ <widget name="heading_mac"/>
+ <widget name="heading_ipv4"/>
+ <widget name="heading_ipv6"/>
+ <widget name="heading_subnet"/>
+ <widget name="heading_route"/>
+ <widget name="heading_dns"/>
+ </widgets>
+ </object>
+</interface>
diff --git a/panels/network/network.ui b/panels/network/network.ui
index bf86cb9..2b435f0 100644
--- a/panels/network/network.ui
+++ b/panels/network/network.ui
@@ -344,365 +344,6 @@
<property name="can_focus">True</property>
<property name="show_border">False</property>
<child>
- <object class="GtkVBox" id="vbox6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">12</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkGrid" id="grid1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">start</property>
- <property name="row_spacing">10</property>
- <property name="column_spacing">6</property>
- <child>
- <object class="GtkImage" id="image_wired_device">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">end</property>
- <property name="valign">start</property>
- <property name="xalign">1</property>
- <property name="pixel_size">48</property>
- <property name="icon_name">network-wired</property>
- <property name="icon-size">6</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="vbox4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">start</property>
- <property name="hexpand">True</property>
- <property name="spacing">3</property>
- <child>
- <object class="GtkLabel" id="label_wired_device">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label">Wired</property>
- <property name="ellipsize">end</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- <attribute name="scale" value="1.2"/>
- </attributes>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_wired_status">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label">Cable unplugged</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="heading_wired_mac">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">Hardware Address</property>
- <property name="mnemonic_widget">label_wired_mac</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="heading_wired_ipv4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">IPv4 Address</property>
- <property name="mnemonic_widget">label_wired_ipv4</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="heading_wired_ipv6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">IPv6 Address</property>
- <property name="mnemonic_widget">label_wired_ipv6</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">4</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="heading_wired_subnet">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">Subnet Mask</property>
- <property name="mnemonic_widget">label_wired_subnet</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">5</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="heading_wired_route">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">Default Route</property>
- <property name="mnemonic_widget">label_wired_route</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">6</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="heading_wired_dns">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">1</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes">DNS</property>
- <property name="mnemonic_widget">label_wired_dns</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">7</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_wired_mac">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label">AA:BB:CC:DD:55:66:77:88</property>
- <property name="selectable">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- <property name="width">2</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_wired_ipv4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label">127.0.0.1</property>
- <property name="selectable">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">3</property>
- <property name="width">2</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_wired_ipv6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label">::1</property>
- <property name="selectable">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">4</property>
- <property name="width">2</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_wired_subnet">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label">127.0.0.1</property>
- <property name="selectable">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">5</property>
- <property name="width">2</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_wired_route">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label">127.0.0.1</property>
- <property name="selectable">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">6</property>
- <property name="width">2</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_wired_dns">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label">127.0.0.1</property>
- <property name="wrap">True</property>
- <property name="selectable">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">7</property>
- <property name="width">2</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="alignment_wired_switch">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">end</property>
- <property name="valign">start</property>
- <child>
- <object class="GtkSwitch" id="device_wired_off_switch">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="halign">end</property>
- <property name="valign">start</property>
- <property name="use_action_appearance">False</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="wired_off_a11y">
- <property name="accessible-name" translatable="yes">Device Off</property>
- </object>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="box1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_top">12</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkButton" id="button_wired_options">
- <property name="label" translatable="yes">_Options...</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="halign">end</property>
- <property name="valign">end</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="use_action_appearance">False</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- <child type="tab">
- <object class="GtkLabel" id="label5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label">wired</property>
- </object>
- <packing>
- <property name="tab_fill">False</property>
- </packing>
- </child>
- <child>
<object class="GtkVBox" id="vbox5">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -1667,7 +1308,6 @@
</object>
<object class="GtkSizeGroup" id="sizegroup1">
<widgets>
- <widget name="heading_wired_mac"/>
<widget name="heading_wireless_mac"/>
<widget name="heading_mobilebb_imei"/>
</widgets>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]