[network-manager-applet/jk/editor-vlan-flags] editor: allow editing VLAN flags
- From: Jiří Klimeš <jklimes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/jk/editor-vlan-flags] editor: allow editing VLAN flags
- Date: Mon, 31 Aug 2015 10:07:38 +0000 (UTC)
commit d695af2d9ea6fc6d33f9c7cd083805896bc739e5
Author: Jiří Klimeš <jklimes redhat com>
Date: Mon Aug 31 10:51:48 2015 +0200
editor: allow editing VLAN flags
src/connection-editor/ce-page-vlan.ui | 75 ++++++++++++++++++++++++++++++++-
src/connection-editor/page-vlan.c | 24 ++++++++++
2 files changed, 98 insertions(+), 1 deletions(-)
---
diff --git a/src/connection-editor/ce-page-vlan.ui b/src/connection-editor/ce-page-vlan.ui
index 2ea15e2..9542716 100644
--- a/src/connection-editor/ce-page-vlan.ui
+++ b/src/connection-editor/ce-page-vlan.ui
@@ -15,7 +15,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
- <property name="n_rows">5</property>
+ <property name="n_rows">6</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
@@ -199,6 +199,79 @@
<property name="y_options">GTK_FILL</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="vlan_flags_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Flags:</property>
+ </object>
+ <packing>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="resize_mode">immediate</property>
+ <property name="column_spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="reorder_hdr_flag">
+ <property name="label" translatable="yes">_Reorder headers</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="gvrp_flag">
+ <property name="label" translatable="yes">_GVRP</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="loose_binding_flag">
+ <property name="label" translatable="yes">_Loose binding</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
</object>
<object class="GtkListStore" id="vlan_name_type_model">
<columns>
diff --git a/src/connection-editor/page-vlan.c b/src/connection-editor/page-vlan.c
index b7d6364..9a0cc86 100644
--- a/src/connection-editor/page-vlan.c
+++ b/src/connection-editor/page-vlan.c
@@ -57,6 +57,7 @@ typedef struct {
GtkEntry *name_entry;
GtkEntry *cloned_mac;
GtkSpinButton *mtu;
+ GtkToggleButton *flag_reorder_hdr, *flag_gvrp, *flag_loose_binding;
char *last_parent;
int last_id;
@@ -88,6 +89,9 @@ vlan_private_init (CEPageVlan *self)
priv->name_entry = GTK_ENTRY (gtk_builder_get_object (builder, "vlan_name_entry"));
priv->cloned_mac = GTK_ENTRY (gtk_builder_get_object (builder, "vlan_cloned_mac_entry"));
priv->mtu = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "vlan_mtu"));
+ priv->flag_reorder_hdr = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "reorder_hdr_flag"));
+ priv->flag_gvrp = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "gvrp_flag"));
+ priv->flag_loose_binding = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "loose_binding_flag"));
priv->toplevel = GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (priv->mtu),
GTK_TYPE_WINDOW));
@@ -444,6 +448,7 @@ populate_ui (CEPageVlan *self)
NMDevice *device, *parent_device = NULL;
const char *parent, *iface, *current_parent;
int i, mtu_def, mtu_val;
+ guint32 flags;
devices = get_vlan_devices (self);
@@ -544,6 +549,15 @@ populate_ui (CEPageVlan *self)
gtk_spin_button_set_value (priv->mtu, (gdouble) mtu_val);
g_signal_connect (priv->mtu, "value-changed", G_CALLBACK (stuff_changed), self);
+ /* Flags */
+ flags = nm_setting_vlan_get_flags (priv->setting);
+ if (flags & NM_VLAN_FLAG_REORDER_HEADERS)
+ gtk_toggle_button_set_active (priv->flag_reorder_hdr, TRUE);
+ if (flags & NM_VLAN_FLAG_GVRP)
+ gtk_toggle_button_set_active (priv->flag_gvrp, TRUE);
+ if (flags & NM_VLAN_FLAG_LOOSE_BINDING)
+ gtk_toggle_button_set_active (priv->flag_loose_binding, TRUE);
+
g_slist_free (devices);
}
@@ -609,6 +623,7 @@ ui_to_setting (CEPageVlan *self)
GType hwtype;
gboolean mtu_set;
int mtu;
+ guint32 flags = 0;
active_id = gtk_combo_box_get_active (GTK_COMBO_BOX (priv->parent));
parent_id = get_parents_index (priv->parents_len, GTK_COMBO_BOX (priv->parent), active_id);
@@ -656,10 +671,19 @@ ui_to_setting (CEPageVlan *self)
iface = gtk_entry_get_text (priv->name_entry);
vid = gtk_spin_button_get_value_as_int (priv->id_entry);
+ /* Flags */
+ if (gtk_toggle_button_get_active (priv->flag_reorder_hdr))
+ flags |= NM_VLAN_FLAG_REORDER_HEADERS;
+ if (gtk_toggle_button_get_active (priv->flag_gvrp))
+ flags |= NM_VLAN_FLAG_GVRP;
+ if (gtk_toggle_button_get_active (priv->flag_loose_binding))
+ flags |= NM_VLAN_FLAG_LOOSE_BINDING;
+
g_object_set (s_con, NM_SETTING_CONNECTION_INTERFACE_NAME, *iface ? iface : NULL, NULL);
g_object_set (priv->setting,
NM_SETTING_VLAN_PARENT, parent_uuid ? parent_uuid : parent_iface,
NM_SETTING_VLAN_ID, vid,
+ NM_SETTING_VLAN_FLAGS, flags,
NULL);
if (hwtype != G_TYPE_NONE) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]