network: Convert CEPage widgets to GtkTemplate
This commit is contained in:
parent
9759121e7f
commit
eb0bac874c
27 changed files with 245 additions and 445 deletions
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<object class="GtkGrid" id="grid">
|
||||
<template class="CEPage8021xSecurity" parent="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_start">50</property>
|
||||
|
@ -58,5 +58,5 @@
|
|||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</template>
|
||||
</interface>
|
||||
|
|
|
@ -22,25 +22,21 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include <NetworkManager.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ws-wpa-eap.h"
|
||||
#include "wireless-security.h"
|
||||
#include "ce-page.h"
|
||||
#include "ce-page-ethernet.h"
|
||||
#include "ce-page-8021x-security.h"
|
||||
|
||||
struct _CEPage8021xSecurity {
|
||||
GObject parent;
|
||||
GtkGrid parent;
|
||||
|
||||
GtkBuilder *builder;
|
||||
GtkBox *box;
|
||||
GtkSwitch *enable_8021x_switch;
|
||||
GtkGrid *grid;
|
||||
GtkLabel *security_label;
|
||||
|
||||
NMConnection *connection;
|
||||
|
@ -52,7 +48,7 @@ struct _CEPage8021xSecurity {
|
|||
|
||||
static void ce_page_iface_init (CEPageInterface *);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (CEPage8021xSecurity, ce_page_8021x_security, G_TYPE_OBJECT,
|
||||
G_DEFINE_TYPE_WITH_CODE (CEPage8021xSecurity, ce_page_8021x_security, GTK_TYPE_GRID,
|
||||
G_IMPLEMENT_INTERFACE (ce_page_get_type (), ce_page_iface_init))
|
||||
|
||||
static void
|
||||
|
@ -112,13 +108,6 @@ ce_page_8021x_security_get_security_setting (CEPage *page)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
ce_page_8021x_security_get_widget (CEPage *page)
|
||||
{
|
||||
CEPage8021xSecurity *self = CE_PAGE_8021X_SECURITY (page);
|
||||
return GTK_WIDGET (self->grid);
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
ce_page_8021x_security_get_title (CEPage *page)
|
||||
{
|
||||
|
@ -166,6 +155,7 @@ ce_page_8021x_security_validate (CEPage *cepage, NMConnection *connection, GErro
|
|||
static void
|
||||
ce_page_8021x_security_init (CEPage8021xSecurity *self)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -173,7 +163,6 @@ ce_page_8021x_security_dispose (GObject *object)
|
|||
{
|
||||
CEPage8021xSecurity *self = CE_PAGE_8021X_SECURITY (object);
|
||||
|
||||
g_clear_object (&self->builder);
|
||||
g_clear_object (&self->connection);
|
||||
g_clear_pointer (&self->security, wireless_security_unref);
|
||||
g_clear_object (&self->group);
|
||||
|
@ -182,41 +171,35 @@ ce_page_8021x_security_dispose (GObject *object)
|
|||
}
|
||||
|
||||
static void
|
||||
ce_page_8021x_security_class_init (CEPage8021xSecurityClass *security_class)
|
||||
ce_page_8021x_security_class_init (CEPage8021xSecurityClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (security_class);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
object_class->dispose = ce_page_8021x_security_dispose;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/network/8021x-security-page.ui");
|
||||
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPage8021xSecurity, box);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPage8021xSecurity, enable_8021x_switch);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPage8021xSecurity, security_label);
|
||||
}
|
||||
|
||||
static void
|
||||
ce_page_iface_init (CEPageInterface *iface)
|
||||
{
|
||||
iface->get_security_setting = ce_page_8021x_security_get_security_setting;
|
||||
iface->get_widget = ce_page_8021x_security_get_widget;
|
||||
iface->get_title = ce_page_8021x_security_get_title;
|
||||
iface->validate = ce_page_8021x_security_validate;
|
||||
}
|
||||
|
||||
CEPage *
|
||||
CEPage8021xSecurity *
|
||||
ce_page_8021x_security_new (NMConnection *connection)
|
||||
{
|
||||
CEPage8021xSecurity *self;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
self = CE_PAGE_8021X_SECURITY (g_object_new (ce_page_8021x_security_get_type (), NULL));
|
||||
|
||||
self->builder = gtk_builder_new ();
|
||||
if (!gtk_builder_add_from_resource (self->builder, "/org/gnome/control-center/network/8021x-security-page.ui", &error)) {
|
||||
g_warning ("Couldn't load builder file: %s", error->message);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
self->box = GTK_BOX (gtk_builder_get_object (self->builder, "box"));
|
||||
self->enable_8021x_switch = GTK_SWITCH (gtk_builder_get_object (self->builder, "enable_8021x_switch"));
|
||||
self->grid = GTK_GRID (gtk_builder_get_object (self->builder, "grid"));
|
||||
self->security_label = GTK_LABEL (gtk_builder_get_object (self->builder, "security_label"));
|
||||
|
||||
self->connection = g_object_ref (connection);
|
||||
|
||||
if (nm_connection_get_setting_802_1x (connection))
|
||||
|
@ -224,5 +207,5 @@ ce_page_8021x_security_new (NMConnection *connection)
|
|||
|
||||
g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
|
||||
|
||||
return CE_PAGE (self);
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -22,15 +22,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <NetworkManager.h>
|
||||
|
||||
#include "ce-page.h"
|
||||
#include "wireless-security.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE (CEPage8021xSecurity, ce_page_8021x_security, CE, PAGE_8021X_SECURITY, GObject)
|
||||
G_DECLARE_FINAL_TYPE (CEPage8021xSecurity, ce_page_8021x_security, CE, PAGE_8021X_SECURITY, GtkGrid)
|
||||
|
||||
CEPage *ce_page_8021x_security_new (NMConnection *connection);
|
||||
CEPage8021xSecurity *ce_page_8021x_security_new (NMConnection *connection);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -21,24 +21,22 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include <NetworkManager.h>
|
||||
|
||||
#include "ce-page.h"
|
||||
#include "ce-page-details.h"
|
||||
|
||||
struct _CEPageDetails
|
||||
{
|
||||
GObject parent;
|
||||
GtkGrid parent;
|
||||
|
||||
GtkBuilder *builder;
|
||||
GtkCheckButton *all_user_check;
|
||||
GtkCheckButton *auto_connect_check;
|
||||
GtkLabel *dns_heading_label;
|
||||
GtkLabel *dns_label;
|
||||
GtkButton *forget_button;
|
||||
GtkGrid *grid;
|
||||
GtkLabel *ipv4_heading_label;
|
||||
GtkLabel *ipv4_label;
|
||||
GtkLabel *ipv6_heading_label;
|
||||
|
@ -65,7 +63,7 @@ struct _CEPageDetails
|
|||
|
||||
static void ce_page_iface_init (CEPageInterface *);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (CEPageDetails, ce_page_details, G_TYPE_OBJECT,
|
||||
G_DEFINE_TYPE_WITH_CODE (CEPageDetails, ce_page_details, GTK_TYPE_GRID,
|
||||
G_IMPLEMENT_INTERFACE (ce_page_get_type (), ce_page_iface_init))
|
||||
|
||||
static void
|
||||
|
@ -404,19 +402,11 @@ ce_page_details_dispose (GObject *object)
|
|||
{
|
||||
CEPageDetails *self = CE_PAGE_DETAILS (object);
|
||||
|
||||
g_clear_object (&self->builder);
|
||||
g_clear_object (&self->connection);
|
||||
|
||||
G_OBJECT_CLASS (ce_page_details_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
ce_page_details_get_widget (CEPage *page)
|
||||
{
|
||||
CEPageDetails *self = CE_PAGE_DETAILS (page);
|
||||
return GTK_WIDGET (self->grid);
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
ce_page_details_get_title (CEPage *page)
|
||||
{
|
||||
|
@ -426,64 +416,59 @@ ce_page_details_get_title (CEPage *page)
|
|||
static void
|
||||
ce_page_details_init (CEPageDetails *self)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static void
|
||||
ce_page_details_class_init (CEPageDetailsClass *class)
|
||||
ce_page_details_class_init (CEPageDetailsClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
object_class->dispose = ce_page_details_dispose;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/network/details-page.ui");
|
||||
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageDetails, all_user_check);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageDetails, auto_connect_check);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageDetails, dns_heading_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageDetails, dns_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageDetails, forget_button);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageDetails, ipv4_heading_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageDetails, ipv4_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageDetails, ipv6_heading_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageDetails, ipv6_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageDetails, last_used_heading_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageDetails, last_used_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageDetails, mac_heading_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageDetails, mac_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageDetails, restrict_data_check);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageDetails, route_heading_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageDetails, route_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageDetails, security_heading_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageDetails, security_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageDetails, speed_heading_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageDetails, speed_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageDetails, strength_heading_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageDetails, strength_label);
|
||||
}
|
||||
|
||||
static void
|
||||
ce_page_iface_init (CEPageInterface *iface)
|
||||
{
|
||||
iface->get_widget = ce_page_details_get_widget;
|
||||
iface->get_title = ce_page_details_get_title;
|
||||
}
|
||||
|
||||
CEPage *
|
||||
CEPageDetails *
|
||||
ce_page_details_new (NMConnection *connection,
|
||||
NMDevice *device,
|
||||
NMAccessPoint *ap,
|
||||
NetConnectionEditor *editor)
|
||||
{
|
||||
CEPageDetails *self;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
self = CE_PAGE_DETAILS (g_object_new (ce_page_details_get_type (), NULL));
|
||||
|
||||
self->builder = gtk_builder_new ();
|
||||
if (!gtk_builder_add_from_resource (self->builder, "/org/gnome/control-center/network/details-page.ui", &error)) {
|
||||
g_warning ("Couldn't load builder file: %s", error->message);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
self->all_user_check = GTK_CHECK_BUTTON (gtk_builder_get_object (self->builder, "all_user_check"));
|
||||
self->auto_connect_check = GTK_CHECK_BUTTON (gtk_builder_get_object (self->builder, "auto_connect_check"));
|
||||
self->dns_heading_label = GTK_LABEL (gtk_builder_get_object (self->builder, "dns_heading_label"));
|
||||
self->dns_label = GTK_LABEL (gtk_builder_get_object (self->builder, "dns_label"));
|
||||
self->forget_button = GTK_BUTTON (gtk_builder_get_object (self->builder, "forget_button"));
|
||||
self->grid = GTK_GRID (gtk_builder_get_object (self->builder, "grid"));
|
||||
self->ipv4_heading_label = GTK_LABEL (gtk_builder_get_object (self->builder, "ipv4_heading_label"));
|
||||
self->ipv4_label = GTK_LABEL (gtk_builder_get_object (self->builder, "ipv4_label"));
|
||||
self->ipv6_heading_label = GTK_LABEL (gtk_builder_get_object (self->builder, "ipv6_heading_label"));
|
||||
self->ipv6_label = GTK_LABEL (gtk_builder_get_object (self->builder, "ipv6_label"));
|
||||
self->last_used_heading_label = GTK_LABEL (gtk_builder_get_object (self->builder, "last_used_heading_label"));
|
||||
self->last_used_label = GTK_LABEL (gtk_builder_get_object (self->builder, "last_used_label"));
|
||||
self->mac_heading_label = GTK_LABEL (gtk_builder_get_object (self->builder, "mac_heading_label"));
|
||||
self->mac_label = GTK_LABEL (gtk_builder_get_object (self->builder, "mac_label"));
|
||||
self->restrict_data_check = GTK_CHECK_BUTTON (gtk_builder_get_object (self->builder, "restrict_data_check"));
|
||||
self->route_heading_label = GTK_LABEL (gtk_builder_get_object (self->builder, "route_heading_label"));
|
||||
self->route_label = GTK_LABEL (gtk_builder_get_object (self->builder, "route_label"));
|
||||
self->security_heading_label = GTK_LABEL (gtk_builder_get_object (self->builder, "security_heading_label"));
|
||||
self->security_label = GTK_LABEL (gtk_builder_get_object (self->builder, "security_label"));
|
||||
self->speed_heading_label = GTK_LABEL (gtk_builder_get_object (self->builder, "speed_heading_label"));
|
||||
self->speed_label = GTK_LABEL (gtk_builder_get_object (self->builder, "speed_label"));
|
||||
self->strength_heading_label = GTK_LABEL (gtk_builder_get_object (self->builder, "strength_heading_label"));
|
||||
self->strength_label = GTK_LABEL (gtk_builder_get_object (self->builder, "strength_label"));
|
||||
|
||||
self->connection = g_object_ref (connection);
|
||||
self->editor = editor;
|
||||
self->device = device;
|
||||
|
@ -491,5 +476,5 @@ ce_page_details_new (NMConnection *connection,
|
|||
|
||||
connect_details_page (self);
|
||||
|
||||
return CE_PAGE (self);
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -21,16 +21,16 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <NetworkManager.h>
|
||||
|
||||
#include "ce-page.h"
|
||||
#include "net-connection-editor.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE (CEPageDetails, ce_page_details, CE, PAGE_DETAILS, GObject)
|
||||
G_DECLARE_FINAL_TYPE (CEPageDetails, ce_page_details, CE, PAGE_DETAILS, GtkGrid)
|
||||
|
||||
CEPage *ce_page_details_new (NMConnection *connection,
|
||||
CEPageDetails *ce_page_details_new (NMConnection *connection,
|
||||
NMDevice *device,
|
||||
NMAccessPoint *ap,
|
||||
NetConnectionEditor *editor);
|
||||
|
|
|
@ -21,27 +21,23 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <net/if_arp.h>
|
||||
|
||||
#include <NetworkManager.h>
|
||||
|
||||
|
||||
#include "ce-page.h"
|
||||
#include "ce-page-ethernet.h"
|
||||
#include "ui-helpers.h"
|
||||
|
||||
struct _CEPageEthernet
|
||||
{
|
||||
GObject parent;
|
||||
GtkGrid parent;
|
||||
|
||||
GtkBuilder *builder;
|
||||
GtkComboBoxText *cloned_mac;
|
||||
GtkComboBoxText *device_mac;
|
||||
GtkGrid *grid;
|
||||
GtkSpinButton *mtu;
|
||||
GtkComboBoxText *cloned_mac_combo;
|
||||
GtkComboBoxText *mac_combo;
|
||||
GtkSpinButton *mtu_spin;
|
||||
GtkWidget *mtu_label;
|
||||
GtkEntry *name;
|
||||
GtkEntry *name_entry;
|
||||
|
||||
NMClient *client;
|
||||
NMSettingConnection *setting_connection;
|
||||
|
@ -50,13 +46,13 @@ struct _CEPageEthernet
|
|||
|
||||
static void ce_page_iface_init (CEPageInterface *);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (CEPageEthernet, ce_page_ethernet, G_TYPE_OBJECT,
|
||||
G_DEFINE_TYPE_WITH_CODE (CEPageEthernet, ce_page_ethernet, GTK_TYPE_GRID,
|
||||
G_IMPLEMENT_INTERFACE (ce_page_get_type (), ce_page_iface_init))
|
||||
|
||||
static void
|
||||
mtu_changed (CEPageEthernet *self)
|
||||
{
|
||||
if (gtk_spin_button_get_value_as_int (self->mtu) == 0)
|
||||
if (gtk_spin_button_get_value_as_int (self->mtu_spin) == 0)
|
||||
gtk_widget_hide (self->mtu_label);
|
||||
else
|
||||
gtk_widget_show (self->mtu_label);
|
||||
|
@ -69,15 +65,15 @@ mtu_output_cb (CEPageEthernet *self)
|
|||
gint val;
|
||||
g_autofree gchar *buf = NULL;
|
||||
|
||||
val = gtk_spin_button_get_value_as_int (self->mtu);
|
||||
val = gtk_spin_button_get_value_as_int (self->mtu_spin);
|
||||
defvalue = ce_get_property_default (NM_SETTING (self->setting_wired), NM_SETTING_WIRED_MTU);
|
||||
if (val == defvalue)
|
||||
buf = g_strdup (_("automatic"));
|
||||
else
|
||||
buf = g_strdup_printf ("%d", val);
|
||||
|
||||
if (strcmp (buf, gtk_entry_get_text (GTK_ENTRY (self->mtu))))
|
||||
gtk_entry_set_text (GTK_ENTRY (self->mtu), buf);
|
||||
if (strcmp (buf, gtk_entry_get_text (GTK_ENTRY (self->mtu_spin))))
|
||||
gtk_entry_set_text (GTK_ENTRY (self->mtu_spin), buf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -90,29 +86,29 @@ connect_ethernet_page (CEPageEthernet *self)
|
|||
const gchar *cloned_mac;
|
||||
|
||||
name = nm_setting_connection_get_id (self->setting_connection);
|
||||
gtk_entry_set_text (self->name, name);
|
||||
gtk_entry_set_text (self->name_entry, name);
|
||||
|
||||
/* Device MAC address */
|
||||
mac_list = ce_page_get_mac_list (self->client, NM_TYPE_DEVICE_ETHERNET,
|
||||
NM_DEVICE_ETHERNET_PERMANENT_HW_ADDRESS);
|
||||
s_mac_str = nm_setting_wired_get_mac_address (setting);
|
||||
ce_page_setup_mac_combo (self->device_mac, s_mac_str, mac_list);
|
||||
ce_page_setup_mac_combo (self->mac_combo, s_mac_str, mac_list);
|
||||
g_strfreev (mac_list);
|
||||
g_signal_connect_swapped (self->device_mac, "changed", G_CALLBACK (ce_page_changed), self);
|
||||
g_signal_connect_swapped (self->mac_combo, "changed", G_CALLBACK (ce_page_changed), self);
|
||||
|
||||
/* Cloned MAC address */
|
||||
cloned_mac = nm_setting_wired_get_cloned_mac_address (setting);
|
||||
ce_page_setup_cloned_mac_combo (self->cloned_mac, cloned_mac);
|
||||
g_signal_connect_swapped (self->cloned_mac, "changed", G_CALLBACK (ce_page_changed), self);
|
||||
ce_page_setup_cloned_mac_combo (self->cloned_mac_combo, cloned_mac);
|
||||
g_signal_connect_swapped (self->cloned_mac_combo, "changed", G_CALLBACK (ce_page_changed), self);
|
||||
|
||||
/* MTU */
|
||||
g_signal_connect_swapped (self->mtu, "output", G_CALLBACK (mtu_output_cb), self);
|
||||
gtk_spin_button_set_value (self->mtu, (gdouble) nm_setting_wired_get_mtu (setting));
|
||||
g_signal_connect_swapped (self->mtu, "value-changed", G_CALLBACK (mtu_changed), self);
|
||||
g_signal_connect_swapped (self->mtu_spin, "output", G_CALLBACK (mtu_output_cb), self);
|
||||
gtk_spin_button_set_value (self->mtu_spin, (gdouble) nm_setting_wired_get_mtu (setting));
|
||||
g_signal_connect_swapped (self->mtu_spin, "value-changed", G_CALLBACK (mtu_changed), self);
|
||||
mtu_changed (self);
|
||||
|
||||
g_signal_connect_swapped (self->name, "changed", G_CALLBACK (ce_page_changed), self);
|
||||
g_signal_connect_swapped (self->mtu, "value-changed", G_CALLBACK (ce_page_changed), self);
|
||||
g_signal_connect_swapped (self->name_entry, "changed", G_CALLBACK (ce_page_changed), self);
|
||||
g_signal_connect_swapped (self->mtu_spin, "value-changed", G_CALLBACK (ce_page_changed), self);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -122,45 +118,26 @@ ui_to_setting (CEPageEthernet *self)
|
|||
g_autofree gchar *cloned_mac = NULL;
|
||||
const gchar *text;
|
||||
GtkWidget *entry;
|
||||
GtkComboBoxText *combo;
|
||||
|
||||
entry = gtk_bin_get_child (GTK_BIN (self->device_mac));
|
||||
entry = gtk_bin_get_child (GTK_BIN (self->mac_combo));
|
||||
if (entry) {
|
||||
text = gtk_entry_get_text (GTK_ENTRY (entry));
|
||||
device_mac = ce_page_trim_address (text);
|
||||
}
|
||||
|
||||
combo = self->cloned_mac;
|
||||
cloned_mac = ce_page_cloned_mac_get (combo);
|
||||
cloned_mac = ce_page_cloned_mac_get (self->cloned_mac_combo);
|
||||
|
||||
g_object_set (self->setting_wired,
|
||||
NM_SETTING_WIRED_MAC_ADDRESS, device_mac,
|
||||
NM_SETTING_WIRED_CLONED_MAC_ADDRESS, cloned_mac,
|
||||
NM_SETTING_WIRED_MTU, (guint32) gtk_spin_button_get_value_as_int (self->mtu),
|
||||
NM_SETTING_WIRED_MTU, (guint32) gtk_spin_button_get_value_as_int (self->mtu_spin),
|
||||
NULL);
|
||||
|
||||
g_object_set (self->setting_connection,
|
||||
NM_SETTING_CONNECTION_ID, gtk_entry_get_text (self->name),
|
||||
NM_SETTING_CONNECTION_ID, gtk_entry_get_text (self->name_entry),
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
ce_page_ethernet_dispose (GObject *object)
|
||||
{
|
||||
CEPageEthernet *self = CE_PAGE_ETHERNET (object);
|
||||
|
||||
g_clear_object (&self->builder);
|
||||
|
||||
G_OBJECT_CLASS (ce_page_ethernet_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
ce_page_ethernet_get_widget (CEPage *page)
|
||||
{
|
||||
CEPageEthernet *self = CE_PAGE_ETHERNET (page);
|
||||
return GTK_WIDGET (self->grid);
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
ce_page_ethernet_get_title (CEPage *page)
|
||||
{
|
||||
|
@ -174,10 +151,9 @@ ce_page_ethernet_validate (CEPage *page,
|
|||
{
|
||||
CEPageEthernet *self = CE_PAGE_ETHERNET (page);
|
||||
GtkWidget *entry;
|
||||
GtkComboBoxText *combo;
|
||||
gboolean ret = TRUE;
|
||||
|
||||
entry = gtk_bin_get_child (GTK_BIN (self->device_mac));
|
||||
entry = gtk_bin_get_child (GTK_BIN (self->mac_combo));
|
||||
if (entry) {
|
||||
if (!ce_page_address_is_valid (gtk_entry_get_text (GTK_ENTRY (entry)))) {
|
||||
widget_set_error (entry);
|
||||
|
@ -187,12 +163,11 @@ ce_page_ethernet_validate (CEPage *page,
|
|||
}
|
||||
}
|
||||
|
||||
combo = self->cloned_mac;
|
||||
if (!ce_page_cloned_mac_combo_valid (combo)) {
|
||||
widget_set_error (gtk_bin_get_child (GTK_BIN (combo)));
|
||||
if (!ce_page_cloned_mac_combo_valid (self->cloned_mac_combo)) {
|
||||
widget_set_error (gtk_bin_get_child (GTK_BIN (self->cloned_mac_combo)));
|
||||
ret = FALSE;
|
||||
} else {
|
||||
widget_unset_error (gtk_bin_get_child (GTK_BIN (combo)));
|
||||
widget_unset_error (gtk_bin_get_child (GTK_BIN (self->cloned_mac_combo)));
|
||||
}
|
||||
|
||||
if (!ret)
|
||||
|
@ -207,51 +182,43 @@ ce_page_ethernet_validate (CEPage *page,
|
|||
static void
|
||||
ce_page_ethernet_init (CEPageEthernet *self)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static void
|
||||
ce_page_ethernet_class_init (CEPageEthernetClass *class)
|
||||
ce_page_ethernet_class_init (CEPageEthernetClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
object_class->dispose = ce_page_ethernet_dispose;
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/network/ethernet-page.ui");
|
||||
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageEthernet, cloned_mac_combo);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageEthernet, mac_combo);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageEthernet, mtu_spin);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageEthernet, mtu_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageEthernet, name_entry);
|
||||
}
|
||||
|
||||
static void
|
||||
ce_page_iface_init (CEPageInterface *iface)
|
||||
{
|
||||
iface->get_widget = ce_page_ethernet_get_widget;
|
||||
iface->get_title = ce_page_ethernet_get_title;
|
||||
iface->validate = ce_page_ethernet_validate;
|
||||
}
|
||||
|
||||
CEPage *
|
||||
CEPageEthernet *
|
||||
ce_page_ethernet_new (NMConnection *connection,
|
||||
NMClient *client)
|
||||
{
|
||||
CEPageEthernet *self;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
self = CE_PAGE_ETHERNET (g_object_new (ce_page_ethernet_get_type (), NULL));
|
||||
|
||||
self->builder = gtk_builder_new ();
|
||||
if (!gtk_builder_add_from_resource (self->builder, "/org/gnome/control-center/network/ethernet-page.ui", &error)) {
|
||||
g_warning ("Couldn't load builder file: %s", error->message);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
self->cloned_mac = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (self->builder, "cloned_mac_combo"));
|
||||
self->device_mac = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (self->builder, "mac_combo"));
|
||||
self->grid = GTK_GRID (gtk_builder_get_object (self->builder, "grid"));
|
||||
self->mtu = GTK_SPIN_BUTTON (gtk_builder_get_object (self->builder, "mtu_spin"));
|
||||
self->mtu_label = GTK_WIDGET (gtk_builder_get_object (self->builder, "mtu_label"));
|
||||
self->name = GTK_ENTRY (gtk_builder_get_object (self->builder, "name_entry"));
|
||||
|
||||
self->client = client;
|
||||
self->setting_connection = nm_connection_get_setting_connection (connection);
|
||||
self->setting_wired = nm_connection_get_setting_wired (connection);
|
||||
|
||||
connect_ethernet_page (self);
|
||||
|
||||
return CE_PAGE (self);
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -21,15 +21,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <NetworkManager.h>
|
||||
|
||||
#include "ce-page.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE (CEPageEthernet, ce_page_ethernet, CE, PAGE_ETHERNET, GObject)
|
||||
G_DECLARE_FINAL_TYPE (CEPageEthernet, ce_page_ethernet, CE, PAGE_ETHERNET, GtkGrid)
|
||||
|
||||
CEPage *ce_page_ethernet_new (NMConnection *connection,
|
||||
CEPageEthernet *ce_page_ethernet_new (NMConnection *connection,
|
||||
NMClient *client);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <glib-object.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <NetworkManager.h>
|
||||
|
||||
#include "list-box-helper.h"
|
||||
#include "ce-page.h"
|
||||
#include "ce-page-ip4.h"
|
||||
#include "ui-helpers.h"
|
||||
|
||||
|
@ -37,9 +37,8 @@ static void ensure_empty_routes_row (CEPageIP4 *self);
|
|||
|
||||
struct _CEPageIP4
|
||||
{
|
||||
GObject parent;
|
||||
GtkScrolledWindow parent;
|
||||
|
||||
GtkBuilder *builder;
|
||||
GtkBox *address_box;
|
||||
GtkSizeGroup *address_sizegroup;
|
||||
GtkSwitch *auto_dns_switch;
|
||||
|
@ -54,7 +53,6 @@ struct _CEPageIP4
|
|||
GtkBox *routes_box;
|
||||
GtkSizeGroup *routes_metric_sizegroup;
|
||||
GtkSizeGroup *routes_sizegroup;
|
||||
GtkScrolledWindow *scrolled_window;
|
||||
|
||||
NMSettingIPConfig *setting;
|
||||
|
||||
|
@ -64,7 +62,7 @@ struct _CEPageIP4
|
|||
|
||||
static void ce_page_iface_init (CEPageInterface *);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (CEPageIP4, ce_page_ip4, G_TYPE_OBJECT,
|
||||
G_DEFINE_TYPE_WITH_CODE (CEPageIP4, ce_page_ip4, GTK_TYPE_SCROLLED_WINDOW,
|
||||
G_IMPLEMENT_INTERFACE (ce_page_get_type (), ce_page_iface_init))
|
||||
|
||||
enum {
|
||||
|
@ -158,7 +156,7 @@ remove_row (CEPageIP4 *self)
|
|||
GtkWidget *row;
|
||||
GtkWidget *row_box;
|
||||
|
||||
row_box = gtk_widget_get_parent (GTK_WIDGET (self->scrolled_window));
|
||||
row_box = gtk_widget_get_parent (GTK_WIDGET (self));
|
||||
row = gtk_widget_get_parent (row_box);
|
||||
list = gtk_widget_get_parent (row);
|
||||
|
||||
|
@ -850,23 +848,6 @@ out:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
ce_page_ip4_dispose (GObject *object)
|
||||
{
|
||||
CEPageIP4 *self = CE_PAGE_IP4 (object);
|
||||
|
||||
g_clear_object (&self->builder);
|
||||
|
||||
G_OBJECT_CLASS (ce_page_ip4_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
ce_page_ip4_get_widget (CEPage *page)
|
||||
{
|
||||
CEPageIP4 *self = CE_PAGE_IP4 (page);
|
||||
return GTK_WIDGET (self->scrolled_window);
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
ce_page_ip4_get_title (CEPage *page)
|
||||
{
|
||||
|
@ -887,55 +868,47 @@ ce_page_ip4_validate (CEPage *self,
|
|||
static void
|
||||
ce_page_ip4_init (CEPageIP4 *self)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static void
|
||||
ce_page_ip4_class_init (CEPageIP4Class *class)
|
||||
ce_page_ip4_class_init (CEPageIP4Class *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
object_class->dispose = ce_page_ip4_dispose;
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/network/ip4-page.ui");
|
||||
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, address_box);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, address_sizegroup);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, auto_dns_switch);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, auto_routes_switch);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, automatic_radio);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, content_box);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, disabled_radio);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, dns_entry);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, local_radio);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, manual_radio);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, never_default_check);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, routes_box);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, routes_metric_sizegroup);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, routes_sizegroup);
|
||||
}
|
||||
|
||||
static void
|
||||
ce_page_iface_init (CEPageInterface *iface)
|
||||
{
|
||||
iface->get_widget = ce_page_ip4_get_widget;
|
||||
iface->get_title = ce_page_ip4_get_title;
|
||||
iface->validate = ce_page_ip4_validate;
|
||||
}
|
||||
|
||||
CEPage *
|
||||
CEPageIP4 *
|
||||
ce_page_ip4_new (NMConnection *connection,
|
||||
NMClient *client)
|
||||
{
|
||||
CEPageIP4 *self;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
self = CE_PAGE_IP4 (g_object_new (ce_page_ip4_get_type (), NULL));
|
||||
|
||||
self->builder = gtk_builder_new ();
|
||||
if (!gtk_builder_add_from_resource (self->builder, "/org/gnome/control-center/network/ip4-page.ui", &error)) {
|
||||
g_warning ("Couldn't load builder file: %s", error->message);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
self->address_box = GTK_BOX (gtk_builder_get_object (self->builder, "address_box"));
|
||||
self->address_sizegroup = GTK_SIZE_GROUP (gtk_builder_get_object (self->builder, "address_sizegroup"));
|
||||
self->auto_dns_switch = GTK_SWITCH (gtk_builder_get_object (self->builder, "auto_dns_switch"));
|
||||
self->auto_routes_switch = GTK_SWITCH (gtk_builder_get_object (self->builder, "auto_routes_switch"));
|
||||
self->automatic_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (self->builder, "automatic_radio"));
|
||||
self->content_box = GTK_BOX (gtk_builder_get_object (self->builder, "content_box"));
|
||||
self->disabled_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (self->builder, "disabled_radio"));
|
||||
self->dns_entry = GTK_ENTRY (gtk_builder_get_object (self->builder, "dns_entry"));
|
||||
self->local_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (self->builder, "local_radio"));
|
||||
self->manual_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (self->builder, "manual_radio"));
|
||||
self->never_default_check = GTK_CHECK_BUTTON (gtk_builder_get_object (self->builder, "never_default_check"));
|
||||
self->routes_box = GTK_BOX (gtk_builder_get_object (self->builder, "routes_box"));
|
||||
self->routes_metric_sizegroup = GTK_SIZE_GROUP (gtk_builder_get_object (self->builder, "routes_metric_sizegroup"));
|
||||
self->routes_sizegroup = GTK_SIZE_GROUP (gtk_builder_get_object (self->builder, "routes_sizegroup"));
|
||||
self->scrolled_window = GTK_SCROLLED_WINDOW (gtk_builder_get_object (self->builder, "scrolled_window"));
|
||||
|
||||
self->setting = nm_connection_get_setting_ip4_config (connection);
|
||||
if (!self->setting) {
|
||||
self->setting = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
|
||||
|
@ -944,5 +917,5 @@ ce_page_ip4_new (NMConnection *connection,
|
|||
|
||||
connect_ip4_page (self);
|
||||
|
||||
return CE_PAGE (self);
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -21,15 +21,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <NetworkManager.h>
|
||||
|
||||
#include "ce-page.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE (CEPageIP4, ce_page_ip4, CE, PAGE_IP4, GObject)
|
||||
G_DECLARE_FINAL_TYPE (CEPageIP4, ce_page_ip4, CE, PAGE_IP4, GtkScrolledWindow)
|
||||
|
||||
CEPage *ce_page_ip4_new (NMConnection *connection,
|
||||
CEPageIP4 *ce_page_ip4_new (NMConnection *connection,
|
||||
NMClient *client);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <glib-object.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <NetworkManager.h>
|
||||
|
||||
#include "list-box-helper.h"
|
||||
#include "ce-page.h"
|
||||
#include "ce-page-ip6.h"
|
||||
#include "ui-helpers.h"
|
||||
|
||||
|
@ -38,9 +38,8 @@ static void ensure_empty_routes_row (CEPageIP6 *self);
|
|||
|
||||
struct _CEPageIP6
|
||||
{
|
||||
GObject parent;
|
||||
GtkScrolledWindow parent;
|
||||
|
||||
GtkBuilder *builder;
|
||||
GtkBox *address_box;
|
||||
GtkSizeGroup *address_sizegroup;
|
||||
GtkSwitch *auto_dns_switch;
|
||||
|
@ -56,7 +55,6 @@ struct _CEPageIP6
|
|||
GtkBox *routes_box;
|
||||
GtkSizeGroup *routes_metric_sizegroup;
|
||||
GtkSizeGroup *routes_sizegroup;
|
||||
GtkScrolledWindow *scrolled_window;
|
||||
|
||||
NMSettingIPConfig *setting;
|
||||
|
||||
|
@ -66,7 +64,7 @@ struct _CEPageIP6
|
|||
|
||||
static void ce_page_iface_init (CEPageInterface *);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (CEPageIP6, ce_page_ip6, G_TYPE_OBJECT,
|
||||
G_DEFINE_TYPE_WITH_CODE (CEPageIP6, ce_page_ip6, GTK_TYPE_SCROLLED_WINDOW,
|
||||
G_IMPLEMENT_INTERFACE (ce_page_get_type (), ce_page_iface_init))
|
||||
|
||||
enum {
|
||||
|
@ -141,7 +139,7 @@ remove_row (CEPageIP6 *self)
|
|||
GtkWidget *row_box;
|
||||
GtkWidget *list;
|
||||
|
||||
row_box = gtk_widget_get_parent (GTK_WIDGET (self->scrolled_window));
|
||||
row_box = gtk_widget_get_parent (GTK_WIDGET (self));
|
||||
row = gtk_widget_get_parent (row_box);
|
||||
list = gtk_widget_get_parent (row);
|
||||
|
||||
|
@ -773,23 +771,6 @@ out:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
ce_page_ip6_dispose (GObject *object)
|
||||
{
|
||||
CEPageIP6 *self = CE_PAGE_IP6 (object);
|
||||
|
||||
g_clear_object (&self->builder);
|
||||
|
||||
G_OBJECT_CLASS (ce_page_ip6_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
ce_page_ip6_get_widget (CEPage *page)
|
||||
{
|
||||
CEPageIP6 *self = CE_PAGE_IP6 (page);
|
||||
return GTK_WIDGET (self->scrolled_window);
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
ce_page_ip6_get_title (CEPage *page)
|
||||
{
|
||||
|
@ -810,56 +791,48 @@ ce_page_ip6_validate (CEPage *self,
|
|||
static void
|
||||
ce_page_ip6_init (CEPageIP6 *self)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static void
|
||||
ce_page_ip6_class_init (CEPageIP6Class *class)
|
||||
ce_page_ip6_class_init (CEPageIP6Class *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
object_class->dispose = ce_page_ip6_dispose;
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/network/ip6-page.ui");
|
||||
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, address_box);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, address_sizegroup);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, auto_dns_switch);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, auto_routes_switch);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, automatic_radio);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, content_box);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, dhcp_radio);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, disabled_radio);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, dns_entry);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, local_radio);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, manual_radio);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, never_default_check);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, routes_box);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, routes_metric_sizegroup);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, routes_sizegroup);
|
||||
}
|
||||
|
||||
static void
|
||||
ce_page_iface_init (CEPageInterface *iface)
|
||||
{
|
||||
iface->get_widget = ce_page_ip6_get_widget;
|
||||
iface->get_title = ce_page_ip6_get_title;
|
||||
iface->validate = ce_page_ip6_validate;
|
||||
}
|
||||
|
||||
CEPage *
|
||||
CEPageIP6 *
|
||||
ce_page_ip6_new (NMConnection *connection,
|
||||
NMClient *client)
|
||||
{
|
||||
CEPageIP6 *self;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
self = CE_PAGE_IP6 (g_object_new (ce_page_ip6_get_type (), NULL));
|
||||
|
||||
self->builder = gtk_builder_new ();
|
||||
if (!gtk_builder_add_from_resource (self->builder, "/org/gnome/control-center/network/ip6-page.ui", &error)) {
|
||||
g_warning ("Couldn't load builder file: %s", error->message);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
self->address_box = GTK_BOX (gtk_builder_get_object (self->builder, "address_box"));
|
||||
self->address_sizegroup = GTK_SIZE_GROUP (gtk_builder_get_object (self->builder, "address_sizegroup"));
|
||||
self->auto_dns_switch = GTK_SWITCH (gtk_builder_get_object (self->builder, "auto_dns_switch"));
|
||||
self->auto_routes_switch = GTK_SWITCH (gtk_builder_get_object (self->builder, "auto_routes_switch"));
|
||||
self->automatic_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (self->builder, "automatic_radio"));
|
||||
self->content_box = GTK_BOX (gtk_builder_get_object (self->builder, "content_box"));
|
||||
self->dhcp_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (self->builder, "dhcp_radio"));
|
||||
self->disabled_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (self->builder, "disabled_radio"));
|
||||
self->dns_entry = GTK_ENTRY (gtk_builder_get_object (self->builder, "dns_entry"));
|
||||
self->local_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (self->builder, "local_radio"));
|
||||
self->manual_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (self->builder, "manual_radio"));
|
||||
self->never_default_check = GTK_CHECK_BUTTON (gtk_builder_get_object (self->builder, "never_default_check"));
|
||||
self->routes_box = GTK_BOX (gtk_builder_get_object (self->builder, "routes_box"));
|
||||
self->routes_metric_sizegroup = GTK_SIZE_GROUP (gtk_builder_get_object (self->builder, "routes_metric_sizegroup"));
|
||||
self->routes_sizegroup = GTK_SIZE_GROUP (gtk_builder_get_object (self->builder, "routes_sizegroup"));
|
||||
self->scrolled_window = GTK_SCROLLED_WINDOW (gtk_builder_get_object (self->builder, "scrolled_window"));
|
||||
|
||||
self->setting = nm_connection_get_setting_ip6_config (connection);
|
||||
if (!self->setting) {
|
||||
self->setting = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new ());
|
||||
|
@ -868,5 +841,5 @@ ce_page_ip6_new (NMConnection *connection,
|
|||
|
||||
connect_ip6_page (self);
|
||||
|
||||
return CE_PAGE (self);
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -21,15 +21,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <NetworkManager.h>
|
||||
|
||||
#include "ce-page.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE (CEPageIP6, ce_page_ip6, CE, PAGE_IP6, GObject)
|
||||
G_DECLARE_FINAL_TYPE (CEPageIP6, ce_page_ip6, CE, PAGE_IP6, GtkScrolledWindow)
|
||||
|
||||
CEPage *ce_page_ip6_new (NMConnection *connection,
|
||||
CEPageIP6 *ce_page_ip6_new (NMConnection *connection,
|
||||
NMClient *client);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -21,13 +21,13 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include <NetworkManager.h>
|
||||
|
||||
#include "wireless-security.h"
|
||||
#include "ce-page.h"
|
||||
#include "ce-page-security.h"
|
||||
#include "wireless-security.h"
|
||||
#include "ws-dynamic-wep.h"
|
||||
#include "ws-leap.h"
|
||||
#include "ws-wep-key.h"
|
||||
|
@ -36,11 +36,9 @@
|
|||
|
||||
struct _CEPageSecurity
|
||||
{
|
||||
GObject parent;
|
||||
GtkGrid parent;
|
||||
|
||||
GtkBuilder *builder;
|
||||
GtkBox *box;
|
||||
GtkGrid *grid;
|
||||
GtkComboBox *security_combo;
|
||||
GtkLabel *security_label;
|
||||
|
||||
|
@ -52,7 +50,7 @@ struct _CEPageSecurity
|
|||
|
||||
static void ce_page_iface_init (CEPageInterface *);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (CEPageSecurity, ce_page_security, G_TYPE_OBJECT,
|
||||
G_DEFINE_TYPE_WITH_CODE (CEPageSecurity, ce_page_security, GTK_TYPE_GRID,
|
||||
G_IMPLEMENT_INTERFACE (ce_page_get_type (), ce_page_iface_init))
|
||||
|
||||
enum {
|
||||
|
@ -370,7 +368,6 @@ ce_page_security_dispose (GObject *object)
|
|||
{
|
||||
CEPageSecurity *self = CE_PAGE_SECURITY (object);
|
||||
|
||||
g_clear_object (&self->builder);
|
||||
g_clear_object (&self->connection);
|
||||
g_clear_object (&self->group);
|
||||
|
||||
|
@ -383,13 +380,6 @@ ce_page_security_get_security_setting (CEPage *page)
|
|||
return CE_PAGE_SECURITY (page)->security_setting;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
ce_page_security_get_widget (CEPage *page)
|
||||
{
|
||||
CEPageSecurity *self = CE_PAGE_SECURITY (page);
|
||||
return GTK_WIDGET (self->grid);
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
ce_page_security_get_title (CEPage *page)
|
||||
{
|
||||
|
@ -449,46 +439,41 @@ ce_page_security_validate (CEPage *page,
|
|||
static void
|
||||
ce_page_security_init (CEPageSecurity *self)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static void
|
||||
ce_page_security_class_init (CEPageSecurityClass *class)
|
||||
ce_page_security_class_init (CEPageSecurityClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
object_class->dispose = ce_page_security_dispose;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/network/security-page.ui");
|
||||
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageSecurity, box);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageSecurity, security_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageSecurity, security_combo);
|
||||
}
|
||||
|
||||
static void
|
||||
ce_page_iface_init (CEPageInterface *iface)
|
||||
{
|
||||
iface->get_security_setting = ce_page_security_get_security_setting;
|
||||
iface->get_widget = ce_page_security_get_widget;
|
||||
iface->get_title = ce_page_security_get_title;
|
||||
iface->validate = ce_page_security_validate;
|
||||
}
|
||||
|
||||
CEPage *
|
||||
CEPageSecurity *
|
||||
ce_page_security_new (NMConnection *connection)
|
||||
{
|
||||
CEPageSecurity *self;
|
||||
NMUtilsSecurityType default_type = NMU_SEC_NONE;
|
||||
NMSettingWirelessSecurity *sws;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
self = CE_PAGE_SECURITY (g_object_new (ce_page_security_get_type (), NULL));
|
||||
|
||||
self->builder = gtk_builder_new ();
|
||||
if (!gtk_builder_add_from_resource (self->builder, "/org/gnome/control-center/network/security-page.ui", &error)) {
|
||||
g_warning ("Couldn't load builder file: %s", error->message);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
self->box = GTK_BOX (gtk_builder_get_object (self->builder, "box"));
|
||||
self->grid = GTK_GRID (gtk_builder_get_object (self->builder, "grid"));
|
||||
self->security_label = GTK_LABEL (gtk_builder_get_object (self->builder, "security_label"));
|
||||
self->security_combo = GTK_COMBO_BOX (gtk_builder_get_object (self->builder, "security_combo"));
|
||||
|
||||
self->connection = g_object_ref (connection);
|
||||
|
||||
sws = nm_connection_get_setting_wireless_security (connection);
|
||||
|
@ -510,5 +495,5 @@ ce_page_security_new (NMConnection *connection)
|
|||
|
||||
g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
|
||||
|
||||
return CE_PAGE (self);
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -21,14 +21,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <NetworkManager.h>
|
||||
|
||||
#include "ce-page.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE (CEPageSecurity, ce_page_security, CE, PAGE_SECURITY, GObject)
|
||||
G_DECLARE_FINAL_TYPE (CEPageSecurity, ce_page_security, CE, PAGE_SECURITY, GtkGrid)
|
||||
|
||||
CEPage *ce_page_security_new (NMConnection *connection);
|
||||
CEPageSecurity *ce_page_security_new (NMConnection *connection);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -21,20 +21,18 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include <NetworkManager.h>
|
||||
|
||||
#include "ce-page.h"
|
||||
#include "ce-page-vpn.h"
|
||||
#include "vpn-helpers.h"
|
||||
|
||||
struct _CEPageVpn
|
||||
{
|
||||
GObject parent;
|
||||
GtkBox parent;
|
||||
|
||||
GtkBuilder *builder;
|
||||
GtkBox *box;
|
||||
GtkLabel *failure_label;
|
||||
GtkEntry *name_entry;
|
||||
|
||||
|
@ -48,7 +46,7 @@ struct _CEPageVpn
|
|||
|
||||
static void ce_page_iface_init (CEPageInterface *);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (CEPageVpn, ce_page_vpn, G_TYPE_OBJECT,
|
||||
G_DEFINE_TYPE_WITH_CODE (CEPageVpn, ce_page_vpn, GTK_TYPE_BOX,
|
||||
G_IMPLEMENT_INTERFACE (ce_page_get_type (), ce_page_iface_init))
|
||||
|
||||
/* Hack to make the plugin-provided editor widget fit in better with
|
||||
|
@ -113,7 +111,7 @@ load_vpn_plugin (CEPageVpn *self)
|
|||
|
||||
gtk_widget_destroy (GTK_WIDGET (self->failure_label));
|
||||
|
||||
gtk_box_pack_start (self->box, ui_widget, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (self), ui_widget, TRUE, TRUE, 0);
|
||||
gtk_widget_show_all (ui_widget);
|
||||
|
||||
g_signal_connect_swapped (self->editor, "changed", G_CALLBACK (ce_page_changed), self);
|
||||
|
@ -134,7 +132,6 @@ ce_page_vpn_dispose (GObject *object)
|
|||
{
|
||||
CEPageVpn *self = CE_PAGE_VPN (object);
|
||||
|
||||
g_clear_object (&self->builder);
|
||||
g_clear_object (&self->connection);
|
||||
g_clear_object (&self->editor);
|
||||
|
||||
|
@ -147,13 +144,6 @@ ce_page_vpn_get_security_setting (CEPage *page)
|
|||
return NM_SETTING_VPN_SETTING_NAME;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
ce_page_vpn_get_widget (CEPage *page)
|
||||
{
|
||||
CEPageVpn *self = CE_PAGE_VPN (page);
|
||||
return GTK_WIDGET (self->box);
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
ce_page_vpn_get_title (CEPage *page)
|
||||
{
|
||||
|
@ -183,21 +173,27 @@ ce_page_vpn_validate (CEPage *page,
|
|||
static void
|
||||
ce_page_vpn_init (CEPageVpn *self)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static void
|
||||
ce_page_vpn_class_init (CEPageVpnClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
|
||||
object_class->dispose = ce_page_vpn_dispose;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/network/vpn-page.ui");
|
||||
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageVpn, failure_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageVpn, name_entry);
|
||||
}
|
||||
|
||||
static void
|
||||
ce_page_iface_init (CEPageInterface *iface)
|
||||
{
|
||||
iface->get_security_setting = ce_page_vpn_get_security_setting;
|
||||
iface->get_widget = ce_page_vpn_get_widget;
|
||||
iface->get_title = ce_page_vpn_get_title;
|
||||
iface->validate = ce_page_vpn_validate;
|
||||
}
|
||||
|
@ -218,27 +214,16 @@ finish_setup (CEPageVpn *self, gpointer unused, GError *error, gpointer user_dat
|
|||
connect_vpn_page (self);
|
||||
}
|
||||
|
||||
CEPage *
|
||||
CEPageVpn *
|
||||
ce_page_vpn_new (NMConnection *connection)
|
||||
{
|
||||
CEPageVpn *self;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
self = CE_PAGE_VPN (g_object_new (ce_page_vpn_get_type (), NULL));
|
||||
|
||||
self->builder = gtk_builder_new ();
|
||||
if (!gtk_builder_add_from_resource (self->builder, "/org/gnome/control-center/network/vpn-page.ui", &error)) {
|
||||
g_warning ("Couldn't load builder file: %s", error->message);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
self->box = GTK_BOX (gtk_builder_get_object (self->builder, "box"));
|
||||
self->failure_label = GTK_LABEL (gtk_builder_get_object (self->builder, "failure_label"));
|
||||
self->name_entry = GTK_ENTRY (gtk_builder_get_object (self->builder, "name_entry"));
|
||||
|
||||
self->connection = g_object_ref (connection);
|
||||
|
||||
g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
|
||||
|
||||
return CE_PAGE (self);
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -21,14 +21,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <NetworkManager.h>
|
||||
|
||||
#include "ce-page.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE (CEPageVpn, ce_page_vpn, CE, PAGE_VPN, GObject)
|
||||
G_DECLARE_FINAL_TYPE (CEPageVpn, ce_page_vpn, CE, PAGE_VPN, GtkBox)
|
||||
|
||||
CEPage *ce_page_vpn_new (NMConnection *connection);
|
||||
CEPageVpn *ce_page_vpn_new (NMConnection *connection);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -21,24 +21,20 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include <NetworkManager.h>
|
||||
|
||||
#include <net/if_arp.h>
|
||||
|
||||
#include "ce-page.h"
|
||||
#include "ce-page-wifi.h"
|
||||
#include "ui-helpers.h"
|
||||
|
||||
struct _CEPageWifi
|
||||
{
|
||||
GObject parent;
|
||||
GtkGrid parent;
|
||||
|
||||
GtkBuilder *builder;
|
||||
GtkComboBoxText *bssid_combo;
|
||||
GtkComboBoxText *cloned_mac_combo;
|
||||
GtkGrid *grid;
|
||||
GtkComboBoxText *mac_combo;
|
||||
GtkEntry *ssid_entry;
|
||||
|
||||
|
@ -48,7 +44,7 @@ struct _CEPageWifi
|
|||
|
||||
static void ce_page_iface_init (CEPageInterface *);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (CEPageWifi, ce_page_wifi, G_TYPE_OBJECT,
|
||||
G_DEFINE_TYPE_WITH_CODE (CEPageWifi, ce_page_wifi, GTK_TYPE_GRID,
|
||||
G_IMPLEMENT_INTERFACE (ce_page_get_type (), ce_page_iface_init))
|
||||
|
||||
static void
|
||||
|
@ -127,23 +123,6 @@ ui_to_setting (CEPageWifi *self)
|
|||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
ce_page_wifi_dispose (GObject *object)
|
||||
{
|
||||
CEPageWifi *self = CE_PAGE_WIFI (object);
|
||||
|
||||
g_clear_object (&self->builder);
|
||||
|
||||
G_OBJECT_CLASS (ce_page_wifi_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
ce_page_wifi_get_widget (CEPage *page)
|
||||
{
|
||||
CEPageWifi *self = CE_PAGE_WIFI (page);
|
||||
return GTK_WIDGET (self->grid);
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
ce_page_wifi_get_title (CEPage *page)
|
||||
{
|
||||
|
@ -193,49 +172,41 @@ ce_page_wifi_class_validate (CEPage *parent,
|
|||
static void
|
||||
ce_page_wifi_init (CEPageWifi *self)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static void
|
||||
ce_page_wifi_class_init (CEPageWifiClass *class)
|
||||
ce_page_wifi_class_init (CEPageWifiClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
object_class->dispose = ce_page_wifi_dispose;
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/network/wifi-page.ui");
|
||||
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageWifi, bssid_combo);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageWifi, cloned_mac_combo);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageWifi, mac_combo);
|
||||
gtk_widget_class_bind_template_child (widget_class, CEPageWifi, ssid_entry);
|
||||
}
|
||||
|
||||
static void
|
||||
ce_page_iface_init (CEPageInterface *iface)
|
||||
{
|
||||
iface->get_widget = ce_page_wifi_get_widget;
|
||||
iface->get_title = ce_page_wifi_get_title;
|
||||
iface->validate = ce_page_wifi_class_validate;
|
||||
}
|
||||
|
||||
CEPage *
|
||||
CEPageWifi *
|
||||
ce_page_wifi_new (NMConnection *connection,
|
||||
NMClient *client)
|
||||
{
|
||||
CEPageWifi *self;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
self = CE_PAGE_WIFI (g_object_new (ce_page_wifi_get_type (), NULL));
|
||||
|
||||
self->builder = gtk_builder_new ();
|
||||
if (!gtk_builder_add_from_resource (self->builder, "/org/gnome/control-center/network/wifi-page.ui", &error)) {
|
||||
g_warning ("Couldn't load builder file: %s", error->message);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
self->bssid_combo = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (self->builder, "bssid_combo"));
|
||||
self->cloned_mac_combo = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (self->builder, "cloned_mac_combo"));
|
||||
self->grid = GTK_GRID (gtk_builder_get_object (self->builder, "grid"));
|
||||
self->mac_combo = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (self->builder, "mac_combo"));
|
||||
self->ssid_entry = GTK_ENTRY (gtk_builder_get_object (self->builder, "ssid_entry"));
|
||||
|
||||
self->client = client;
|
||||
self->setting = nm_connection_get_setting_wireless (connection);
|
||||
|
||||
connect_wifi_page (self);
|
||||
|
||||
return CE_PAGE (self);
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -21,13 +21,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <NetworkManager.h>
|
||||
|
||||
#include "ce-page.h"
|
||||
G_DECLARE_FINAL_TYPE (CEPageWifi, ce_page_wifi, CE, PAGE_WIFI, GtkGrid)
|
||||
|
||||
G_DECLARE_FINAL_TYPE (CEPageWifi, ce_page_wifi, CE, PAGE_WIFI, GObject)
|
||||
|
||||
CEPage *ce_page_wifi_new (NMConnection *connection,
|
||||
CEPageWifi *ce_page_wifi_new (NMConnection *connection,
|
||||
NMClient *client);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -55,14 +55,6 @@ ce_page_validate (CEPage *self, NMConnection *connection, GError **error)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
ce_page_get_widget (CEPage *self)
|
||||
{
|
||||
g_return_val_if_fail (CE_IS_PAGE (self), NULL);
|
||||
|
||||
return CE_PAGE_GET_IFACE (self)->get_widget (self);
|
||||
}
|
||||
|
||||
const char *
|
||||
ce_page_get_title (CEPage *self)
|
||||
{
|
||||
|
|
|
@ -36,12 +36,10 @@ struct _CEPageInterface
|
|||
GTypeInterface g_iface;
|
||||
|
||||
gboolean (*validate) (CEPage *page, NMConnection *connection, GError **error);
|
||||
GtkWidget *(*get_widget) (CEPage *page);
|
||||
const gchar *(*get_title) (CEPage *page);
|
||||
const gchar *(*get_security_setting) (CEPage *page);
|
||||
};
|
||||
|
||||
GtkWidget *ce_page_get_widget (CEPage *page);
|
||||
const gchar *ce_page_get_title (CEPage *page);
|
||||
const gchar *ce_page_get_security_setting (CEPage *page);
|
||||
gboolean ce_page_validate (CEPage *page,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<object class="GtkGrid" id="grid">
|
||||
<template class="CEPageDetails" parent="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_start">24</property>
|
||||
|
@ -445,5 +445,5 @@
|
|||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</template>
|
||||
</interface>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkGrid" id="grid">
|
||||
<template class="CEPageEthernet" parent="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_start">50</property>
|
||||
|
@ -173,5 +173,5 @@
|
|||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</template>
|
||||
</interface>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<object class="GtkScrolledWindow" id="scrolled_window">
|
||||
<template class="CEPageIP4" parent="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">never</property>
|
||||
|
@ -406,7 +406,7 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</template>
|
||||
<object class="GtkSizeGroup" id="routes_metric_sizegroup">
|
||||
<property name="mode">horizontal</property>
|
||||
<widgets>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<object class="GtkScrolledWindow" id="scrolled_window">
|
||||
<template class="CEPageIP6" parent="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">never</property>
|
||||
|
@ -420,7 +420,7 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</template>
|
||||
<object class="GtkSizeGroup" id="routes_metric_sizegroup">
|
||||
<property name="mode">horizontal</property>
|
||||
<widgets>
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "list-box-helper.h"
|
||||
#include "net-connection-editor.h"
|
||||
#include "net-connection-editor-resources.h"
|
||||
#include "ce-page.h"
|
||||
#include "ce-page-details.h"
|
||||
#include "ce-page-wifi.h"
|
||||
#include "ce-page-ip4.h"
|
||||
|
@ -333,7 +334,6 @@ update_sensitivity (NetConnectionEditor *self)
|
|||
{
|
||||
NMSettingConnection *sc;
|
||||
gboolean sensitive;
|
||||
GtkWidget *widget;
|
||||
GSList *l;
|
||||
|
||||
if (!editor_is_initialized (self))
|
||||
|
@ -347,10 +347,8 @@ update_sensitivity (NetConnectionEditor *self)
|
|||
sensitive = self->can_modify;
|
||||
}
|
||||
|
||||
for (l = self->pages; l; l = l->next) {
|
||||
widget = ce_page_get_widget (CE_PAGE (l->data));
|
||||
gtk_widget_set_sensitive (widget, sensitive);
|
||||
}
|
||||
for (l = self->pages; l; l = l->next)
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (l->data), sensitive);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -414,15 +412,13 @@ recheck_initialization (NetConnectionEditor *self)
|
|||
static void
|
||||
page_initialized (NetConnectionEditor *self, GError *error, CEPage *page)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkWidget *label;
|
||||
gint position;
|
||||
GList *children, *l;
|
||||
gint i;
|
||||
|
||||
widget = ce_page_get_widget (page);
|
||||
position = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (page), "position"));
|
||||
g_object_set_data (G_OBJECT (widget), "position", GINT_TO_POINTER (position));
|
||||
g_object_set_data (G_OBJECT (page), "position", GINT_TO_POINTER (position));
|
||||
children = gtk_container_get_children (GTK_CONTAINER (self->notebook));
|
||||
for (l = children, i = 0; l; l = l->next, i++) {
|
||||
gint pos = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (l->data), "position"));
|
||||
|
@ -433,7 +429,7 @@ page_initialized (NetConnectionEditor *self, GError *error, CEPage *page)
|
|||
|
||||
label = gtk_label_new (ce_page_get_title (page));
|
||||
|
||||
gtk_notebook_insert_page (self->notebook, widget, label, i);
|
||||
gtk_notebook_insert_page (self->notebook, GTK_WIDGET (page), label, i);
|
||||
|
||||
self->initializing_pages = g_slist_remove (self->initializing_pages, page);
|
||||
self->pages = g_slist_append (self->pages, page);
|
||||
|
@ -533,27 +529,27 @@ net_connection_editor_set_connection (NetConnectionEditor *self,
|
|||
is_vpn = g_str_equal (type, NM_SETTING_VPN_SETTING_NAME);
|
||||
|
||||
if (!self->is_new_connection)
|
||||
add_page (self, ce_page_details_new (self->connection, self->device, self->ap, self));
|
||||
add_page (self, CE_PAGE (ce_page_details_new (self->connection, self->device, self->ap, self)));
|
||||
|
||||
if (is_wifi)
|
||||
add_page (self, ce_page_wifi_new (self->connection, self->client));
|
||||
add_page (self, CE_PAGE (ce_page_wifi_new (self->connection, self->client)));
|
||||
else if (is_wired)
|
||||
add_page (self, ce_page_ethernet_new (self->connection, self->client));
|
||||
add_page (self, CE_PAGE (ce_page_ethernet_new (self->connection, self->client)));
|
||||
else if (is_vpn)
|
||||
add_page (self, ce_page_vpn_new (self->connection));
|
||||
add_page (self, CE_PAGE (ce_page_vpn_new (self->connection)));
|
||||
else {
|
||||
/* Unsupported type */
|
||||
net_connection_editor_do_fallback (self, type);
|
||||
return;
|
||||
}
|
||||
|
||||
add_page (self, ce_page_ip4_new (self->connection, self->client));
|
||||
add_page (self, ce_page_ip6_new (self->connection, self->client));
|
||||
add_page (self, CE_PAGE (ce_page_ip4_new (self->connection, self->client)));
|
||||
add_page (self, CE_PAGE (ce_page_ip6_new (self->connection, self->client)));
|
||||
|
||||
if (is_wifi)
|
||||
add_page (self, ce_page_security_new (self->connection));
|
||||
add_page (self, CE_PAGE (ce_page_security_new (self->connection)));
|
||||
else if (is_wired)
|
||||
add_page (self, ce_page_8021x_security_new (self->connection));
|
||||
add_page (self, CE_PAGE (ce_page_8021x_security_new (self->connection)));
|
||||
|
||||
pages = g_slist_copy (self->initializing_pages);
|
||||
for (l = pages; l; l = l->next) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<object class="GtkGrid" id="grid">
|
||||
<template class="CEPageSecurity" parent="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_start">50</property>
|
||||
|
@ -57,5 +57,5 @@
|
|||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</template>
|
||||
</interface>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<object class="GtkBox" id="box">
|
||||
<template class="CEPageVpn" parent="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_start">50</property>
|
||||
|
@ -66,5 +66,5 @@
|
|||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</template>
|
||||
</interface>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<object class="GtkGrid" id="grid">
|
||||
<template class="CEPageWifi" parent="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_start">50</property>
|
||||
|
@ -140,5 +140,5 @@
|
|||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</template>
|
||||
</interface>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue