[network-manager-applet/dcbw/dcb: 4/5] editor: add DCB page



commit 33716c801f10201647b2df878351bee84c0df386
Author: Dan Williams <dcbw redhat com>
Date:   Wed Oct 9 10:35:44 2013 -0500

    editor: add DCB page

 src/connection-editor/Makefile.am               |   11 +-
 src/connection-editor/ce-page-dcb.ui            |  877 +++++++++++++++++++++++
 src/connection-editor/nm-cell-button.c          |  116 +++
 src/connection-editor/nm-cell-button.h          |   46 ++
 src/connection-editor/nm-cell-renderer-button.c |  134 ++++
 src/connection-editor/nm-cell-renderer-button.h |   48 ++
 src/connection-editor/nm-connection-editor.c    |    3 +
 src/connection-editor/page-dcb.c                |  503 +++++++++++++
 src/connection-editor/page-dcb.h                |   59 ++
 9 files changed, 1795 insertions(+), 2 deletions(-)
---
diff --git a/src/connection-editor/Makefile.am b/src/connection-editor/Makefile.am
index 09d1719..5740e44 100644
--- a/src/connection-editor/Makefile.am
+++ b/src/connection-editor/Makefile.am
@@ -65,6 +65,8 @@ nm_connection_editor_SOURCES = \
        page-bridge-port.c \
        page-vlan.h \
        page-vlan.c \
+       page-dcb.c \
+       page-dcb.h \
        vpn-helpers.h \
        vpn-helpers.c \
        ip4-routes-dialog.h \
@@ -76,7 +78,11 @@ nm_connection_editor_SOURCES = \
        ce-polkit-button.c \
        ce-polkit-button.h \
        new-connection.c \
-       new-connection.h
+       new-connection.h \
+       nm-cell-renderer-button.c \
+       nm-cell-renderer-button.h \
+       nm-cell-button.c \
+       nm-cell-button.h
 
 nm-connection-editor-service-glue.h: $(top_srcdir)/src/connection-editor/nm-connection-editor-service.xml
        $(AM_V_GEN) dbus-binding-tool --prefix=nm_connection_editor_service --mode=glib-server --output=$@ $<
@@ -113,7 +119,8 @@ ui_DATA = \
        ce-page-mobile.ui \
        ce-page-ppp.ui \
        ce-ppp-auth-methods.ui \
-       ce-page-vlan.ui
+       ce-page-vlan.ui \
+       ce-page-dcb.ui
 
 BUILT_SOURCES = nm-connection-editor-service-glue.h
 
diff --git a/src/connection-editor/ce-page-dcb.ui b/src/connection-editor/ce-page-dcb.ui
new file mode 100644
index 0000000..4a840ae
--- /dev/null
+++ b/src/connection-editor/ce-page-dcb.ui
@@ -0,0 +1,877 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkTable" id="DcbPage">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="border_width">12</property>
+    <property name="n_rows">2</property>
+    <property name="n_columns">2</property>
+    <property name="column_spacing">12</property>
+    <property name="row_spacing">6</property>
+    <child>
+      <object class="GtkCheckButton" id="dcb_enabled_checkbutton">
+        <property name="label" translatable="yes">Use Data Center Bridging (DCB) for this 
connection</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>
+      </object>
+      <packing>
+        <property name="right_attach">2</property>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkAlignment" id="alignment1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="valign">start</property>
+        <property name="left_padding">6</property>
+        <child>
+          <object class="GtkBox" id="dcb_box">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="valign">start</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">12</property>
+            <child>
+              <object class="GtkTreeView" id="dcb_feature_treeview">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="valign">start</property>
+                <property name="model">feature_liststore</property>
+                <property name="enable_search">False</property>
+                <property name="show_expanders">False</property>
+                <property name="enable_grid_lines">horizontal</property>
+                <child internal-child="selection">
+                  <object class="GtkTreeSelection" id="treeview-selection1"/>
+                </child>
+                <child>
+                  <object class="GtkTreeViewColumn" id="dcb_feature_column">
+                    <property name="sizing">autosize</property>
+                    <property name="title" translatable="yes">Feature</property>
+                    <child>
+                      <object class="GtkCellRendererText" id="dcb_feature_cell"/>
+                      <attributes>
+                        <attribute name="text">0</attribute>
+                      </attributes>
+                    </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkTreeViewColumn" id="dcb_enable_column">
+                    <property name="sizing">autosize</property>
+                    <property name="title" translatable="yes">Enable</property>
+                    <child>
+                      <object class="GtkCellRendererToggle" id="dcb_enable_cell"/>
+                      <attributes>
+                        <attribute name="active">1</attribute>
+                      </attributes>
+                    </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkTreeViewColumn" id="dcb_advertise_column">
+                    <property name="sizing">autosize</property>
+                    <property name="title" translatable="yes">Advertise</property>
+                    <child>
+                      <object class="GtkCellRendererToggle" id="dcb_advertise_cell"/>
+                      <attributes>
+                        <attribute name="sensitive">1</attribute>
+                        <attribute name="active">2</attribute>
+                      </attributes>
+                    </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkTreeViewColumn" id="dcb_willing_column">
+                    <property name="sizing">autosize</property>
+                    <property name="title" translatable="yes">Willing</property>
+                    <child>
+                      <object class="GtkCellRendererToggle" id="dcb_willing_cell"/>
+                      <attributes>
+                        <attribute name="sensitive">1</attribute>
+                        <attribute name="active">3</attribute>
+                      </attributes>
+                    </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkTreeViewColumn" id="dcb_priority_column">
+                    <property name="sizing">autosize</property>
+                    <property name="title" translatable="yes">Priority</property>
+                    <child>
+                      <object class="GtkCellRendererSpin" id="dcb_priority_cell">
+                        <property name="editable">True</property>
+                        <property name="adjustment">prio_adjustment</property>
+                        <property name="climb_rate">1</property>
+                        <property name="placeholder_text">default</property>
+                      </object>
+                      <attributes>
+                        <attribute name="sensitive">1</attribute>
+                        <attribute name="visible">6</attribute>
+                        <attribute name="text">4</attribute>
+                      </attributes>
+                    </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkTreeViewColumn" id="dcb_options_column">
+                    <property name="sizing">autosize</property>
+                    <property name="title" translatable="yes">Options</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox" id="pfc_box">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <object class="GtkLabel" id="label1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Priority Flow Control</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</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>
+                    <child>
+                      <object class="GtkBox" id="box2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkLabel" id="label2">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">0:</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkCheckButton" id="pfc_0_checkbutton">
+                            <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>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="padding">6</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox" id="box3">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkLabel" id="label3">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">1:</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkCheckButton" id="pfc_1_checkbutton">
+                            <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>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="padding">6</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox" id="box4">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkLabel" id="label4">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">2:</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkCheckButton" id="pfc_2_checkbutton">
+                            <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>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="padding">6</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox" id="box5">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkLabel" id="label5">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">3:</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkCheckButton" id="pfc_3_checkbutton">
+                            <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>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="padding">6</property>
+                        <property name="position">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox" id="box6">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkLabel" id="label6">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">4:</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkCheckButton" id="pfc_4_checkbutton">
+                            <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>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="padding">6</property>
+                        <property name="position">4</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox" id="box7">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkLabel" id="label7">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">5:</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkCheckButton" id="pfc_5_checkbutton">
+                            <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>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="padding">6</property>
+                        <property name="position">5</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox" id="box8">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkLabel" id="label8">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">6:</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkCheckButton" id="pfc_6_checkbutton">
+                            <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>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="padding">6</property>
+                        <property name="position">6</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox" id="box9">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkLabel" id="label9">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">7:</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkCheckButton" id="pfc_7_checkbutton">
+                            <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>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="padding">6</property>
+                        <property name="position">7</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox" id="pgid_box">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <object class="GtkLabel" id="label10">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Priority Group IDs</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkBox" id="box10">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <child>
+                      <object class="GtkBox" id="box11">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkLabel" id="label11">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">0:</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkEntry" id="pgid_0_entry">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="halign">start</property>
+                            <property name="max_length">2</property>
+                            <property name="invisible_char">●</property>
+                            <property name="width_chars">2</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="padding">6</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox" id="box12">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkLabel" id="label12">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">1:</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkEntry" id="pgid_1_entry">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="halign">start</property>
+                            <property name="max_length">2</property>
+                            <property name="invisible_char">●</property>
+                            <property name="width_chars">2</property>
+                            <property name="invisible_char_set">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="padding">6</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox" id="box13">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkLabel" id="label13">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">2:</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkEntry" id="pgid_2_entry">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="halign">start</property>
+                            <property name="max_length">2</property>
+                            <property name="invisible_char">●</property>
+                            <property name="width_chars">2</property>
+                            <property name="invisible_char_set">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="padding">6</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox" id="box14">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkLabel" id="label14">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">3:</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkEntry" id="pgid_3_entry">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="halign">start</property>
+                            <property name="max_length">2</property>
+                            <property name="invisible_char">●</property>
+                            <property name="width_chars">2</property>
+                            <property name="invisible_char_set">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="padding">6</property>
+                        <property name="position">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox" id="box15">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkLabel" id="label15">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">4:</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkEntry" id="pgid_4_entry">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="halign">start</property>
+                            <property name="max_length">2</property>
+                            <property name="invisible_char">●</property>
+                            <property name="width_chars">2</property>
+                            <property name="invisible_char_set">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="padding">6</property>
+                        <property name="position">4</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox" id="box16">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkLabel" id="label16">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">5:</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkEntry" id="pgid_5_entry">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="halign">start</property>
+                            <property name="max_length">2</property>
+                            <property name="invisible_char">●</property>
+                            <property name="width_chars">2</property>
+                            <property name="invisible_char_set">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="padding">6</property>
+                        <property name="position">5</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox" id="box17">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkLabel" id="label17">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">6:</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkEntry" id="pgid_6_entry">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="halign">start</property>
+                            <property name="max_length">2</property>
+                            <property name="invisible_char">●</property>
+                            <property name="width_chars">2</property>
+                            <property name="invisible_char_set">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="padding">6</property>
+                        <property name="position">6</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox" id="box18">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkLabel" id="label18">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">7:</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkEntry" id="pgid_1_entry6">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="halign">start</property>
+                            <property name="max_length">2</property>
+                            <property name="invisible_char">●</property>
+                            <property name="width_chars">2</property>
+                            <property name="invisible_char_set">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="padding">6</property>
+                        <property name="position">7</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="right_attach">2</property>
+        <property name="top_attach">1</property>
+        <property name="bottom_attach">2</property>
+        <property name="y_options"/>
+      </packing>
+    </child>
+  </object>
+  <object class="GtkListStore" id="feature_liststore">
+    <columns>
+      <!-- column-name Feature -->
+      <column type="gchararray"/>
+      <!-- column-name Enable -->
+      <column type="gboolean"/>
+      <!-- column-name Advertise -->
+      <column type="gboolean"/>
+      <!-- column-name Willing -->
+      <column type="gboolean"/>
+      <!-- column-name Priority -->
+      <column type="gint"/>
+      <!-- column-name Options -->
+      <column type="gchararray"/>
+      <!-- column-name PriorityVisible -->
+      <column type="gboolean"/>
+      <!-- column-name OptionsVisible -->
+      <column type="gboolean"/>
+    </columns>
+  </object>
+  <object class="GtkListStore" id="mode_liststore">
+    <columns>
+      <!-- column-name Name -->
+      <column type="gchararray"/>
+      <!-- column-name Value -->
+      <column type="gint"/>
+    </columns>
+  </object>
+  <object class="GtkAdjustment" id="prio_adjustment">
+    <property name="lower">-1</property>
+    <property name="upper">7</property>
+    <property name="value">-1</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">1</property>
+  </object>
+</interface>
diff --git a/src/connection-editor/nm-cell-button.c b/src/connection-editor/nm-cell-button.c
new file mode 100644
index 0000000..331f949
--- /dev/null
+++ b/src/connection-editor/nm-cell-button.c
@@ -0,0 +1,116 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager Connection editor -- Connection editor for NetworkManager
+ *
+ * Dan Williams <dcbw redhat com>
+ *
+ * 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.
+ *
+ * (C) Copyright 2013 Red Hat, Inc.
+ */
+
+#include "nm-cell-button.h"
+
+static void cell_editable_init (GtkCellEditableIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (NMCellButton, nm_cell_button, GTK_TYPE_BUTTON,
+                         G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_EDITABLE,
+                                                cell_editable_init))
+
+#define NM_CELL_BUTTON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_CELL_BUTTON, 
NMCellButtonPrivate))
+
+typedef struct {
+       gboolean editing_canceled;
+} NMCellButtonPrivate;
+
+enum {
+       PROP_0,
+       PROP_EDITING_CANCELED,
+};
+
+/************************************************************/
+
+static void
+button_clicked (GtkButton *button, gpointer data)
+{
+       gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (button));
+       gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (button));
+}
+
+static void
+start_editing (GtkCellEditable *cell_editable, GdkEvent *event)
+{
+       g_signal_connect (cell_editable, "clicked", G_CALLBACK (button_clicked), NULL);
+}
+
+/****************************************************************/
+
+GtkWidget *
+nm_cell_button_new_with_label (const char *label)
+{
+       return g_object_new (NM_TYPE_CELL_BUTTON, "label", label, NULL);
+}
+
+static void
+nm_cell_button_init (NMCellButton *self)
+{
+}
+
+static void
+cell_editable_init (GtkCellEditableIface *iface)
+{
+       iface->start_editing = start_editing;
+}
+
+static void
+get_property (GObject *object, guint prop_id,
+                         GValue *value, GParamSpec *pspec)
+{
+       switch (prop_id) {
+       case PROP_EDITING_CANCELED:
+               g_value_set_boolean (value, NM_CELL_BUTTON_GET_PRIVATE (object)->editing_canceled);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static void
+set_property (GObject *object, guint prop_id,
+                         const GValue *value, GParamSpec *pspec)
+{
+       switch (prop_id) {
+       case PROP_EDITING_CANCELED:
+               NM_CELL_BUTTON_GET_PRIVATE (object)->editing_canceled = g_value_get_boolean (value);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static void
+nm_cell_button_class_init (NMCellButtonClass *class)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+       g_type_class_add_private (object_class, sizeof (NMCellButtonPrivate));
+
+       object_class->get_property = get_property;
+       object_class->set_property = set_property;
+
+       g_object_class_override_property (object_class, PROP_EDITING_CANCELED, "editing-canceled");
+}
+
diff --git a/src/connection-editor/nm-cell-button.h b/src/connection-editor/nm-cell-button.h
new file mode 100644
index 0000000..966746c
--- /dev/null
+++ b/src/connection-editor/nm-cell-button.h
@@ -0,0 +1,46 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager Connection editor -- Connection editor for NetworkManager
+ *
+ * Dan Williams <dcbw redhat com>
+ *
+ * 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.
+ *
+ * (C) Copyright 2013 Red Hat, Inc.
+ */
+
+#ifndef __NM_CELL_BUTTON_H__
+#define __NM_CELL_BUTTON_H__
+
+#include <gtk/gtk.h>
+
+#define NM_TYPE_CELL_BUTTON            (nm_cell_button_get_type ())
+#define NM_CELL_BUTTON(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_CELL_BUTTON, 
NMCellButton))
+#define NM_CELL_BUTTON_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_CELL_BUTTON, 
NMCellButtonClass))
+#define NM_IS_CELL_BUTTON(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_CELL_BUTTON))
+#define NM_IS_CELL_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_CELL_BUTTON))
+#define NM_CELL_BUTTON_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_CELL_BUTTON, 
NMCellButtonClass))
+
+typedef struct {
+  GtkButton parent;
+} NMCellButton;
+
+typedef struct {
+  GtkButtonClass parent_class;
+} NMCellButtonClass;
+
+GType      nm_cell_button_get_type       (void) G_GNUC_CONST;
+GtkWidget *nm_cell_button_new_with_label (const char *label);
+
+#endif /* __NM_CELL_BUTTON_H__ */
diff --git a/src/connection-editor/nm-cell-renderer-button.c b/src/connection-editor/nm-cell-renderer-button.c
new file mode 100644
index 0000000..25f426d
--- /dev/null
+++ b/src/connection-editor/nm-cell-renderer-button.c
@@ -0,0 +1,134 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager Connection editor -- Connection editor for NetworkManager
+ *
+ * Dan Williams <dcbw redhat com>
+ *
+ * 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.
+ *
+ * (C) Copyright 2013 Red Hat, Inc.
+ */
+
+#include "nm-cell-renderer-button.h"
+#include "nm-cell-button.h"
+
+G_DEFINE_TYPE (NMCellRendererButton, nm_cell_renderer_button, GTK_TYPE_CELL_RENDERER_TEXT)
+
+#define NM_CELL_RENDERER_BUTTON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), 
NM_TYPE_CELL_RENDERER_BUTTON, NMCellRendererButtonPrivate))
+
+#define TAG_PATH "nm-cell-renderer-button-path"
+
+enum {
+  CLICKED,
+  LAST_SIGNAL
+};
+static guint signals[LAST_SIGNAL] = { 0 };
+
+typedef struct {
+  GtkWidget *button;
+} NMCellRendererButtonPrivate;
+
+/************************************************************/
+
+static void
+button_clicked (GtkButton *button, gpointer user_data)
+{
+       NMCellRendererButton *self = NM_CELL_RENDERER_BUTTON (user_data);
+       const char *path;
+
+       path = g_object_get_data (G_OBJECT (button), TAG_PATH);
+       g_signal_emit (self, signals[CLICKED], 0, path);
+}
+
+static void
+editing_done (GtkCellEditable *button, gpointer user_data)
+{
+       NMCellRendererButton *self = NM_CELL_RENDERER_BUTTON (user_data);
+       NMCellRendererButtonPrivate *priv = NM_CELL_RENDERER_BUTTON_GET_PRIVATE (self);
+       gboolean canceled;
+
+       g_signal_handlers_disconnect_by_func (button, G_CALLBACK (editing_done), self);
+       g_signal_handlers_disconnect_by_func (button, G_CALLBACK (button_clicked), self);
+
+       g_object_get (button, "editing-canceled", &canceled, NULL);
+       gtk_cell_renderer_stop_editing (GTK_CELL_RENDERER (self), canceled);
+       priv->button = NULL;
+}
+
+static GtkCellEditable *
+start_editing (GtkCellRenderer     *cell,
+               GdkEvent            *event,
+               GtkWidget           *widget,
+               const gchar         *path,
+               const GdkRectangle  *background_area,
+               const GdkRectangle  *cell_area,
+               GtkCellRendererState flags)
+{
+       NMCellRendererButton *self = NM_CELL_RENDERER_BUTTON (cell);
+       NMCellRendererButtonPrivate *priv = NM_CELL_RENDERER_BUTTON_GET_PRIVATE (self);
+       GtkCellRendererText *cell_text;
+       GtkWidget *button;
+       gboolean editable;
+       char *text;
+
+       cell_text = GTK_CELL_RENDERER_TEXT (cell);
+       g_object_get (cell_text, "editable", &editable, NULL);
+       if (editable == FALSE)
+               return NULL;
+
+       g_object_get (cell_text, "text", &text, NULL);
+       button = nm_cell_button_new_with_label (text ? text : "");
+       g_free (text);
+
+       g_object_set_data_full (G_OBJECT (button), TAG_PATH, g_strdup (path), g_free);
+       gtk_widget_show (button);
+
+       g_signal_connect (GTK_CELL_EDITABLE (button), "editing-done", G_CALLBACK (editing_done), self);
+       g_signal_connect (GTK_CELL_EDITABLE (button), "clicked", G_CALLBACK (button_clicked), self);
+
+       priv->button = button;
+       return GTK_CELL_EDITABLE (button);
+}
+
+/****************************************************************/
+
+GtkCellRenderer *
+nm_cell_renderer_button_new (void)
+{
+       return g_object_new (NM_TYPE_CELL_RENDERER_BUTTON, NULL);
+}
+
+static void
+nm_cell_renderer_button_init (NMCellRendererButton *self)
+{
+}
+
+static void
+nm_cell_renderer_button_class_init (NMCellRendererButtonClass *class)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (class);
+       GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (class);
+
+       g_type_class_add_private (object_class, sizeof (NMCellRendererButtonPrivate));
+
+       cell_class->start_editing = start_editing;
+
+       signals[CLICKED] = g_signal_new ("clicked",
+                                        G_OBJECT_CLASS_TYPE (object_class),
+                                        G_SIGNAL_RUN_LAST,
+                                        G_STRUCT_OFFSET (NMCellRendererButtonClass, clicked),
+                                        NULL, NULL, NULL,
+                                        G_TYPE_NONE, 1, G_TYPE_STRING);
+}
+
diff --git a/src/connection-editor/nm-cell-renderer-button.h b/src/connection-editor/nm-cell-renderer-button.h
new file mode 100644
index 0000000..036fbc8
--- /dev/null
+++ b/src/connection-editor/nm-cell-renderer-button.h
@@ -0,0 +1,48 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager Connection editor -- Connection editor for NetworkManager
+ *
+ * Dan Williams <dcbw redhat com>
+ *
+ * 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.
+ *
+ * (C) Copyright 2013 Red Hat, Inc.
+ */
+
+#ifndef __NM_CELL_RENDERER_BUTTON_H__
+#define __NM_CELL_RENDERER_BUTTON_H__
+
+#include <gtk/gtk.h>
+
+#define NM_TYPE_CELL_RENDERER_BUTTON            (nm_cell_renderer_button_get_type ())
+#define NM_CELL_RENDERER_BUTTON(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
NM_TYPE_CELL_RENDERER_BUTTON, NMCellRendererButton))
+#define NM_CELL_RENDERER_BUTTON_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), 
NM_TYPE_CELL_RENDERER_BUTTON, NMCellRendererButtonClass))
+#define NM_IS_CELL_RENDERER_BUTTON(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
NM_TYPE_CELL_RENDERER_BUTTON))
+#define NM_IS_CELL_RENDERER_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 
NM_TYPE_CELL_RENDERER_BUTTON))
+#define NM_CELL_RENDERER_BUTTON_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), 
NM_TYPE_CELL_RENDERER_BUTTON, NMCellRendererButtonClass))
+
+typedef struct {
+  GtkCellRendererText parent;
+} NMCellRendererButton;
+
+typedef struct {
+  GtkCellRendererTextClass parent_class;
+
+  void (*clicked) (NMCellRendererButton *self, const char *path);
+} NMCellRendererButtonClass;
+
+GType            nm_cell_renderer_button_get_type       (void) G_GNUC_CONST;
+GtkCellRenderer *nm_cell_renderer_button_new            (void);
+
+#endif /* __NM_CELL_RENDERER_BUTTON_H__ */
diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c
index 2752b00..8fb1e4f 100644
--- a/src/connection-editor/nm-connection-editor.c
+++ b/src/connection-editor/nm-connection-editor.c
@@ -77,6 +77,7 @@
 #include "page-bridge.h"
 #include "page-bridge-port.h"
 #include "page-vlan.h"
+#include "page-dcb.h"
 #include "ce-polkit-button.h"
 #include "vpn-helpers.h"
 #include "eap-method.h"
@@ -791,6 +792,8 @@ nm_connection_editor_set_connection (NMConnectionEditor *editor,
                        goto out;
                if (!add_page (editor, ce_page_8021x_security_new, editor->connection, error))
                        goto out;
+               if (!add_page (editor, ce_page_dcb_new, editor->connection, error))
+                       goto out;
        } else if (!strcmp (connection_type, NM_SETTING_WIRELESS_SETTING_NAME)) {
                if (!add_page (editor, ce_page_wifi_new, editor->connection, error))
                        goto out;
diff --git a/src/connection-editor/page-dcb.c b/src/connection-editor/page-dcb.c
new file mode 100644
index 0000000..ee7865e
--- /dev/null
+++ b/src/connection-editor/page-dcb.c
@@ -0,0 +1,503 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager Connection editor -- Connection editor for NetworkManager
+ *
+ * Dan Williams <dcbw redhat com>
+ *
+ * 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.
+ *
+ * (C) Copyright 2013 Red Hat, Inc.
+ */
+
+#include "config.h"
+
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+#include <NetworkManager.h>
+#include <nm-setting-connection.h>
+#include <nm-setting-dcb.h>
+#include <nm-utils.h>
+
+#include "page-dcb.h"
+#include "nm-cell-renderer-button.h"
+
+G_DEFINE_TYPE (CEPageDcb, ce_page_dcb, CE_TYPE_PAGE)
+
+#define CE_PAGE_DCB_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CE_TYPE_PAGE_DCB, CEPageDcbPrivate))
+
+#define COL_FEATURE          0
+#define COL_ENABLE           1
+#define COL_ADVERTISE        2
+#define COL_WILLING          3
+#define COL_PRIORITY         4
+#define COL_OPTIONS          5
+#define COL_PRIORITY_VISIBLE 6
+#define COL_OPTIONS_VISIBLE  7
+
+typedef struct {
+       GtkToggleButton *enabled;
+       GtkBox *box;
+       GtkTreeView *feat_view;
+
+       gboolean initial_have_dcb;
+} CEPageDcbPrivate;
+
+static void
+enable_toggled (GtkToggleButton *button, gpointer user_data)
+{
+       CEPageDcbPrivate *priv = CE_PAGE_DCB_GET_PRIVATE (user_data);
+
+       gtk_widget_set_sensitive (GTK_WIDGET (priv->box), gtk_toggle_button_get_active (button));
+       ce_page_changed (CE_PAGE (user_data));
+}
+
+static void
+priority_editing_started (GtkCellRenderer *cell,
+                          GtkCellEditable *editable,
+                          const gchar     *path,
+                          gpointer         data)
+{
+       /* Print "default" whenever the value is the default value (-1) */
+       if (GTK_IS_SPIN_BUTTON (editable)) {
+               g_signal_connect (editable, "output",
+                                 G_CALLBACK (ce_spin_output_with_default),
+                                 GINT_TO_POINTER (-1));
+       }
+}
+
+static void
+priority_edited (GtkCellRendererText *cell,
+                 const gchar *path_string,
+                 const gchar *new_text,
+                 gpointer user_data)
+{
+       CEPageDcb *self = CE_PAGE_DCB (user_data);
+       CEPageDcbPrivate *priv = CE_PAGE_DCB_GET_PRIVATE (self);
+       GtkListStore *store = GTK_LIST_STORE (gtk_tree_view_get_model (priv->feat_view));
+       GtkTreeIter iter;
+       long int tmp = -1;
+
+       /* default = -1; convert other values */
+       if (g_strcmp0 (new_text, _("default")) != 0) {
+               errno = 0;
+               tmp = strtol (new_text, NULL, 10);
+               if (errno != 0 || tmp < -1 || tmp > 7)
+                       tmp = -1;
+       }
+
+       g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (store), &iter, path_string));
+       gtk_list_store_set (store, &iter, COL_PRIORITY, (gint) tmp, -1);
+}
+
+static void
+flag_toggled (GtkCellRendererToggle *cell,
+              const gchar *path_string,
+              gpointer user_data)
+{
+       CEPageDcb *self = CE_PAGE_DCB (user_data);
+       CEPageDcbPrivate *priv = CE_PAGE_DCB_GET_PRIVATE (self);
+       GtkListStore *store = GTK_LIST_STORE (gtk_tree_view_get_model (priv->feat_view));
+       GtkTreeIter iter;
+       guint column;
+       gboolean val;
+
+       g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (store), &iter, path_string));
+       column = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (cell), "column"));
+       gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, column, &val, -1);
+       val = !val;
+       gtk_list_store_set (store, &iter, column, val, -1);
+
+       /* If the Enable flag was toggled, reset other columns to defaults */
+       if (column == COL_ENABLE && val == FALSE) {
+               gtk_list_store_set (store, &iter,
+                                   COL_ADVERTISE, FALSE,
+                                   COL_WILLING, FALSE,
+                                   COL_PRIORITY, -1,
+                                   -1);
+       }
+}
+
+static void
+options_clicked (NMCellRendererButton *cell,
+                 const gchar *path_string,
+                 gpointer user_data)
+{
+       CEPageDcb *self = CE_PAGE_DCB (user_data);
+       CEPageDcbPrivate *priv = CE_PAGE_DCB_GET_PRIVATE (self);
+       GtkListStore *store = GTK_LIST_STORE (gtk_tree_view_get_model (priv->feat_view));
+       GtkTreeIter iter;
+       char *feature;
+
+       g_assert (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (store), &iter, path_string));
+       gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, COL_FEATURE, &feature, -1);
+       g_message ("CLICKED for %s", feature);
+       g_free (feature);
+}
+
+static void
+prio_cell_data_func (GtkTreeViewColumn *tree_column,
+                     GtkCellRenderer *cell,
+                     GtkTreeModel *tree_model,
+                     GtkTreeIter *iter,
+                     gpointer data)
+{
+       int val;
+       char *buf;
+
+       gtk_tree_model_get (tree_model, iter, COL_PRIORITY, &val, -1);
+       if (val == -1)
+               buf = g_strdup (_("default"));
+       else
+               buf = g_strdup_printf ("%d", val);
+
+       g_object_set (G_OBJECT (cell), "text", buf, NULL);
+       g_free (buf);
+}
+
+static GtkCellRenderer *
+get_renderer (GtkTreeView *view, guint idx, GtkTreeViewColumn **out_col)
+{
+       GtkTreeViewColumn *col;
+       GList *renderers;
+       GtkCellRenderer *renderer;
+
+       /* Set up the Priority spinner */
+       col = gtk_tree_view_get_column (view, idx);
+       g_assert (col);
+       renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (col));
+       g_assert (renderers);
+
+       /* The renderer we care about should be first item in the list */
+       renderer = GTK_CELL_RENDERER (renderers->data);
+       g_list_free (renderers);
+
+       if (out_col)
+               *out_col = col;
+       return renderer;
+}
+
+static void
+finish_setup (CEPageDcb *self, gpointer unused, GError *error, gpointer user_data)
+{
+       CEPage *parent = CE_PAGE (self);
+       CEPageDcbPrivate *priv = CE_PAGE_DCB_GET_PRIVATE (self);
+       GtkTreeViewColumn *col;
+       GtkCellRenderer *renderer;
+       GtkListStore *model;
+       GtkTreeIter iter;
+       gboolean app_fcoe_enable = FALSE, app_fcoe_adv = FALSE, app_fcoe_will = FALSE;
+       gboolean app_iscsi_enable = FALSE, app_iscsi_adv = FALSE, app_iscsi_will = FALSE;
+       gboolean app_fip_enable = FALSE, app_fip_adv = FALSE, app_fip_will = FALSE;
+       gboolean pfc_enable = FALSE, pfc_adv = FALSE, pfc_will = FALSE;
+       gboolean pg_enable = FALSE, pg_adv = FALSE, pg_will = FALSE;
+       int app_fcoe_prio = -1, app_iscsi_prio = -1, app_fip_prio = -1;
+       guint i;
+
+       if (error)
+               return;
+
+       gtk_toggle_button_set_active (priv->enabled, priv->initial_have_dcb);
+       g_signal_connect (priv->enabled, "toggled", G_CALLBACK (enable_toggled), self);
+       gtk_widget_set_sensitive (GTK_WIDGET (priv->box), priv->initial_have_dcb);
+
+       if (priv->initial_have_dcb) {
+               NMSettingDcb *s_dcb = nm_connection_get_setting_dcb (parent->connection);
+               NMSettingDcbFlags flags;
+
+               /* FCoE */
+               flags = nm_setting_dcb_get_app_fcoe_flags (s_dcb);
+               app_fcoe_enable = flags & NM_SETTING_DCB_FLAG_ENABLE;
+               app_fcoe_adv = flags & NM_SETTING_DCB_FLAG_ADVERTISE;
+               app_fcoe_will = flags & NM_SETTING_DCB_FLAG_WILLING;
+               app_fcoe_prio = nm_setting_dcb_get_app_fcoe_priority (s_dcb);
+
+               /* iSCSI */
+               flags = nm_setting_dcb_get_app_iscsi_flags (s_dcb);
+               app_iscsi_enable = flags & NM_SETTING_DCB_FLAG_ENABLE;
+               app_iscsi_adv = flags & NM_SETTING_DCB_FLAG_ADVERTISE;
+               app_iscsi_will = flags & NM_SETTING_DCB_FLAG_WILLING;
+               app_iscsi_prio = nm_setting_dcb_get_app_iscsi_priority (s_dcb);
+
+               /* FIP */
+               flags = nm_setting_dcb_get_app_fip_flags (s_dcb);
+               app_fip_enable = flags & NM_SETTING_DCB_FLAG_ENABLE;
+               app_fip_adv = flags & NM_SETTING_DCB_FLAG_ADVERTISE;
+               app_fip_will = flags & NM_SETTING_DCB_FLAG_WILLING;
+               app_fip_prio = nm_setting_dcb_get_app_fip_priority (s_dcb);
+
+               /* Priority Flow Control */
+               flags = nm_setting_dcb_get_priority_flow_control_flags (s_dcb);
+               pfc_enable = flags & NM_SETTING_DCB_FLAG_ENABLE;
+               pfc_adv = flags & NM_SETTING_DCB_FLAG_ADVERTISE;
+               pfc_will = flags & NM_SETTING_DCB_FLAG_WILLING;
+
+               /* Priority Groups */
+               flags = nm_setting_dcb_get_priority_group_flags (s_dcb);
+               pg_enable = flags & NM_SETTING_DCB_FLAG_ENABLE;
+               pg_adv = flags & NM_SETTING_DCB_FLAG_ADVERTISE;
+               pg_will = flags & NM_SETTING_DCB_FLAG_WILLING;
+       }
+
+       /* Flags renderers */
+       for (i = COL_ENABLE; i <= COL_WILLING; i++) {
+               renderer = get_renderer (priv->feat_view, i, &col);
+               g_assert (GTK_IS_CELL_RENDERER_TOGGLE (renderer));
+               g_object_set_data (G_OBJECT (renderer), "column", GUINT_TO_POINTER (i));
+               g_signal_connect (renderer, "toggled", G_CALLBACK (flag_toggled), self);
+       }
+
+       /* Priority renderer */
+       renderer = get_renderer (priv->feat_view, COL_PRIORITY, &col);
+       g_assert (GTK_IS_CELL_RENDERER_SPIN (renderer));
+       g_signal_connect (renderer, "editing-started", G_CALLBACK (priority_editing_started), NULL);
+       g_signal_connect (renderer, "edited", G_CALLBACK (priority_edited), self);
+       gtk_tree_view_column_set_cell_data_func (col, renderer, prio_cell_data_func, NULL, NULL);
+
+       /* Options renderer */
+       col = gtk_tree_view_get_column (priv->feat_view, COL_OPTIONS);
+       g_assert (col);
+       renderer = nm_cell_renderer_button_new ();
+       g_object_set (renderer, "editable", TRUE, NULL);
+       g_signal_connect (renderer, "clicked", G_CALLBACK (options_clicked), self);
+       gtk_tree_view_column_pack_start (col, renderer, FALSE);
+       gtk_tree_view_column_set_attributes (col, renderer,
+                                            "sensitive", COL_ENABLE,
+                                            "text", COL_OPTIONS,
+                                            "visible", COL_OPTIONS_VISIBLE,
+                                            NULL);
+//     gtk_tree_view_column_set_cell_data_func (col, renderer, options_cell_data_func, NULL, NULL);
+
+       /* Set up the Apps treeview model */
+       model = GTK_LIST_STORE (gtk_tree_view_get_model (priv->feat_view));
+       gtk_list_store_append (model, &iter);
+       gtk_list_store_set (model, &iter,
+                           COL_FEATURE, _("FCoE"),
+                           COL_ENABLE, app_fcoe_enable,
+                           COL_ADVERTISE, app_fcoe_adv,
+                           COL_WILLING, app_fcoe_will,
+                           COL_PRIORITY, app_fcoe_prio,
+                           COL_OPTIONS, _("Options..."),
+                           COL_PRIORITY_VISIBLE, TRUE,
+                           COL_OPTIONS_VISIBLE, TRUE,
+                           -1);
+
+       gtk_list_store_append (model, &iter);
+       gtk_list_store_set (model, &iter,
+                           COL_FEATURE, _("iSCSI"),
+                           COL_ENABLE, app_iscsi_enable,
+                           COL_ADVERTISE, app_iscsi_adv,
+                           COL_WILLING, app_iscsi_will,
+                           COL_PRIORITY, app_iscsi_prio,
+                           COL_PRIORITY_VISIBLE, TRUE,
+                           COL_OPTIONS_VISIBLE, FALSE,
+                           -1);
+
+       gtk_list_store_append (model, &iter);
+       gtk_list_store_set (model, &iter,
+                           COL_FEATURE, _("FIP"),
+                           COL_ENABLE, app_fip_enable,
+                           COL_ADVERTISE, app_fip_adv,
+                           COL_WILLING, app_fip_will,
+                           COL_PRIORITY, app_fip_prio,
+                           COL_PRIORITY_VISIBLE, TRUE,
+                           COL_OPTIONS_VISIBLE, FALSE,
+                           -1);
+
+       gtk_list_store_append (model, &iter);
+       gtk_list_store_set (model, &iter,
+                           COL_FEATURE, _("Flow Control"),
+                           COL_ENABLE, pfc_enable,
+                           COL_ADVERTISE, pfc_adv,
+                           COL_WILLING, pfc_will,
+                           COL_PRIORITY, -1,
+                           COL_OPTIONS, _("Options..."),
+                           COL_PRIORITY_VISIBLE, FALSE,
+                           COL_OPTIONS_VISIBLE, TRUE,
+                           -1);
+
+       gtk_list_store_append (model, &iter);
+       gtk_list_store_set (model, &iter,
+                           COL_FEATURE, _("Priority Groups"),
+                           COL_ENABLE, pg_enable,
+                           COL_ADVERTISE, pg_adv,
+                           COL_WILLING, pg_will,
+                           COL_PRIORITY, -1,
+                           COL_OPTIONS, _("Options..."),
+                           COL_PRIORITY_VISIBLE, FALSE,
+                           COL_OPTIONS_VISIBLE, TRUE,
+                           -1);
+}
+
+static void
+dcb_private_init (CEPageDcb *self)
+{
+       CEPageDcbPrivate *priv = CE_PAGE_DCB_GET_PRIVATE (self);
+       GtkBuilder *builder = CE_PAGE (self)->builder;
+
+       priv->enabled = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "dcb_enabled_checkbutton"));
+       priv->box = GTK_BOX (gtk_builder_get_object (builder, "dcb_box"));
+       priv->feat_view = GTK_TREE_VIEW (gtk_builder_get_object (builder, "dcb_feature_treeview"));
+}
+
+CEPage *
+ce_page_dcb_new (NMConnection *connection,
+                 GtkWindow *parent_window,
+                 NMClient *client,
+                 NMRemoteSettings *settings,
+                 const char **out_secrets_setting_name,
+                 GError **error)
+{
+       CEPageDcb *self;
+
+       self = CE_PAGE_DCB (ce_page_new (CE_TYPE_PAGE_DCB,
+                                        connection,
+                                        parent_window,
+                                        client,
+                                        settings,
+                                        UIDIR "/ce-page-dcb.ui",
+                                        "DcbPage",
+                                        _("DCB")));
+       if (!self) {
+               g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load DCB user 
interface."));
+               return NULL;
+       }
+
+       dcb_private_init (self);
+
+       if (nm_connection_get_setting_dcb (connection))
+               CE_PAGE_DCB_GET_PRIVATE (self)->initial_have_dcb = TRUE;
+
+       g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+
+       return CE_PAGE (self);
+}
+
+typedef struct {
+       const char *flags_prop;
+       const char *prio_prop;
+} Feature;
+
+static const Feature features[] = {
+       { NM_SETTING_DCB_APP_FCOE_FLAGS,              NM_SETTING_DCB_APP_FCOE_PRIORITY },
+       { NM_SETTING_DCB_APP_ISCSI_FLAGS,             NM_SETTING_DCB_APP_ISCSI_PRIORITY },
+       { NM_SETTING_DCB_APP_FIP_FLAGS,               NM_SETTING_DCB_APP_FIP_PRIORITY },
+       { NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS, NULL },
+       { NM_SETTING_DCB_PRIORITY_GROUP_FLAGS,        NULL },
+};
+
+static void
+ui_to_setting (CEPageDcb *self, NMSettingDcb *s_dcb)
+{
+       CEPageDcbPrivate *priv = CE_PAGE_DCB_GET_PRIVATE (self);
+       GtkTreeModel *model;
+       GtkTreeIter tree_iter;
+       gboolean iter_valid;
+       guint i = 0;
+
+       model = gtk_tree_view_get_model (priv->feat_view);
+       iter_valid = gtk_tree_model_get_iter_first (model, &tree_iter);
+       while (iter_valid) {
+               const Feature *feature = &features[i++];
+               gboolean bval;
+               gint priority = -1;
+               NMSettingDcbFlags flags = NM_SETTING_DCB_FLAG_NONE;
+
+               /* Flags */
+               gtk_tree_model_get (model, &tree_iter, COL_ENABLE, &bval, -1);
+               if (bval) {
+                       flags |= NM_SETTING_DCB_FLAG_ENABLE;
+                       gtk_tree_model_get (model, &tree_iter, COL_ADVERTISE, &bval, -1);
+                       if (bval)
+                               flags |= NM_SETTING_DCB_FLAG_ADVERTISE;
+                       gtk_tree_model_get (model, &tree_iter, COL_WILLING, &bval, -1);
+                       if (bval)
+                               flags |= NM_SETTING_DCB_FLAG_WILLING;
+               }
+               g_object_set (G_OBJECT (s_dcb), feature->flags_prop, flags, NULL);
+
+               /* Priority */
+               gtk_tree_model_get (model, &tree_iter, COL_PRIORITY_VISIBLE, &bval, -1);
+               if (bval)
+                       g_object_set (G_OBJECT (s_dcb), feature->prio_prop, priority, NULL);
+
+#if 0
+               /* FCoE mode */
+               gtk_tree_model_get (model, &tree_iter, COL_MODE, &modeval, COL_MODE_VISIBLE, &bval, -1);
+               if (bval) {
+                       g_object_set (G_OBJECT (s_dcb),
+                                     NM_SETTING_DCB_APP_FCOE_MODE,
+                                        modeval == 0 ? NM_SETTING_DCB_FCOE_MODE_FABRIC : 
NM_SETTING_DCB_FCOE_MODE_VN2VN,
+                                     NULL);
+               }
+#endif
+
+               iter_valid = gtk_tree_model_iter_next (model, &tree_iter);
+       }
+
+}
+
+static gboolean
+validate (CEPage *page, NMConnection *connection, GError **error)
+{
+       CEPageDcb *self = CE_PAGE_DCB (page);
+       CEPageDcbPrivate *priv = CE_PAGE_DCB_GET_PRIVATE (self);
+       gboolean new_setting = FALSE;
+       NMSettingDcb *s_dcb;
+
+       if (!gtk_toggle_button_get_active (priv->enabled)) {
+               nm_connection_remove_setting (connection, NM_TYPE_SETTING_DCB);
+               return TRUE;
+       }
+
+       s_dcb = nm_connection_get_setting_dcb (page->connection);
+       if (!s_dcb) {
+               s_dcb = (NMSettingDcb *) nm_setting_dcb_new ();
+               nm_connection_add_setting (page->connection, NM_SETTING (s_dcb));
+               new_setting = TRUE;
+       }
+       ui_to_setting (self, s_dcb);
+       return nm_setting_verify (NM_SETTING (s_dcb), NULL, error);
+}
+
+static void
+ce_page_dcb_init (CEPageDcb *self)
+{
+}
+
+static void
+dispose (GObject *object)
+{
+//     CEPageDcbPrivate *priv = CE_PAGE_DCB_GET_PRIVATE (object);
+
+       G_OBJECT_CLASS (ce_page_dcb_parent_class)->dispose (object);
+}
+
+static void
+ce_page_dcb_class_init (CEPageDcbClass *security_class)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (security_class);
+       CEPageClass *parent_class = CE_PAGE_CLASS (security_class);
+
+       g_type_class_add_private (object_class, sizeof (CEPageDcbPrivate));
+
+       /* virtual methods */
+       object_class->dispose = dispose;
+
+       parent_class->validate = validate;
+}
diff --git a/src/connection-editor/page-dcb.h b/src/connection-editor/page-dcb.h
new file mode 100644
index 0000000..2420b26
--- /dev/null
+++ b/src/connection-editor/page-dcb.h
@@ -0,0 +1,59 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager Connection editor -- Connection editor for NetworkManager
+ *
+ * Dan Williams <dcbw redhat com>
+ *
+ * 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.
+ *
+ * (C) Copyright 2013 Red Hat, Inc.
+ */
+
+#ifndef __PAGE_DCB_H__
+#define __PAGE_DCB_H__
+
+#include "nm-connection-editor.h"
+
+#include <nm-connection.h>
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include "ce-page.h"
+
+#define CE_TYPE_PAGE_DCB            (ce_page_dcb_get_type ())
+#define CE_PAGE_DCB(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), CE_TYPE_PAGE_DCB, CEPageDcb))
+#define CE_PAGE_DCB_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), CE_TYPE_PAGE_DCB, CEPageDcbClass))
+#define CE_IS_PAGE_DCB(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CE_TYPE_PAGE_DCB))
+#define CE_IS_PAGE_DCB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CE_TYPE_PAGE_DCB))
+#define CE_PAGE_DCB_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), CE_TYPE_PAGE_DCB, CEPageDcbClass))
+
+typedef struct {
+       CEPage parent;
+} CEPageDcb;
+
+typedef struct {
+       CEPageClass parent;
+} CEPageDcbClass;
+
+GType ce_page_dcb_get_type (void);
+
+CEPage *ce_page_dcb_new (NMConnection *connection,
+                         GtkWindow *parent,
+                         NMClient *client,
+                         NMRemoteSettings *settings,
+                         const char **out_secrets_setting_name,
+                         GError **error);
+
+#endif  /* __PAGE_DCB_H__ */


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