[Xfce4-commits] [panel-plugins/xfce4-hardware-monitor-plugin] 13/29: Move advanced network interfaces setup

noreply at xfce.org noreply at xfce.org
Mon Dec 18 12:45:44 CET 2017


This is an automated email from the git hooks/post-receive script.

o   m   e   g   a   p   h   i   l       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository panel-plugins/xfce4-hardware-monitor-plugin.

commit 3378279d4732b60ae3792de30cab9a9f64ea788d
Author: OmegaPhil <OmegaPhil at startmail.com>
Date:   Sat Nov 25 11:42:24 2017 +0000

    Move advanced network interfaces setup
    
    Move the advanced network interfaces setup into the choose monitor
    dialog instantiation, so that its ready immediately when someone
    wants to configure their network monitor
---
 src/choose-monitor-window.cpp | 68 +++++++++++++++++++++++--------------------
 1 file changed, 36 insertions(+), 32 deletions(-)

diff --git a/src/choose-monitor-window.cpp b/src/choose-monitor-window.cpp
index 4c925cf..5a76bb6 100644
--- a/src/choose-monitor-window.cpp
+++ b/src/choose-monitor-window.cpp
@@ -383,6 +383,40 @@ ChooseMonitorWindow::ChooseMonitorWindow(XfcePanelPlugin* xfce_plugin,
           interface_type_to_string(interface_type, false);
   }
 
+  /* Populate interface type interface names advanced settings - interface
+   * name column needs to be editable + trigger validation on entry - note
+   * that append_column returns the number of columns present rather than
+   * the genuine ordinal to the last column, hence -1
+   * Advanced interface-naming is per-plugin and saved in the global plugin
+   * settings - its not reliant on a network monitor being selected and/or
+   * saved etc, and should be available when the user is browsing through
+   * the monitor types */
+  network_interfaces_names_store = Gtk::ListStore::create(nc);
+  network_interfaces_treeview->set_model(network_interfaces_names_store);
+  network_interfaces_treeview->append_column(_("Interface Type"),
+                                             nc.interface_type);
+  int column_num = network_interfaces_treeview
+      ->append_column(_("Interface Name"), nc.interface_name) - 1;
+
+  // Documentation asks for dynamic_cast here
+  Gtk::CellRendererText *cell_renderer = dynamic_cast<Gtk::CellRendererText*>(network_interfaces_treeview
+                                  ->get_column_cell_renderer(column_num));
+  cell_renderer->property_editable() = true;
+  cell_renderer->signal_edited().connect(
+        sigc::mem_fun(*this, &ChooseMonitorWindow::
+                      on_network_interface_name_edited));
+
+  for (int i = 0; i < NetworkLoadMonitor::NUM_INTERFACE_TYPES; ++i)
+  {
+      NetworkLoadMonitor::InterfaceType interface_type =
+          static_cast<NetworkLoadMonitor::InterfaceType>(i);
+      store_iter iter = network_interfaces_names_store->append();
+      (*iter)[nc.interface_type] = NetworkLoadMonitor::
+          interface_type_to_string(interface_type, false);
+      (*iter)[nc.interface_name] = NetworkLoadMonitor::
+          get_interface_name(interface_type, xfce_plugin);
+  }
+
   // Setup network direction combobox
   static NetworkDirectionCols ndc;
   network_direction_store = Gtk::ListStore::create(ndc);
@@ -743,38 +777,8 @@ Monitor *ChooseMonitorWindow::run(const Glib::ustring &mon_dir)
             break;
         }
 
-        /* Populate interface type interface names advanced settings - interface
-         * name column needs to be editable + trigger validation on entry - note
-         * that append_column returns the number of columns present rather than
-         * the genuine ordinal to the last column, hence -1
-         * This is here as it is independent of monitors but dependent on a settings
-         * file being available, and needs to run both when a monitor does and doesn't
-         * exist */
-        network_interfaces_names_store = Gtk::ListStore::create(nc);
-        network_interfaces_treeview->set_model(network_interfaces_names_store);
-        network_interfaces_treeview->append_column(_("Interface Type"),
-                                                   nc.interface_type);
-        int column_num = network_interfaces_treeview
-            ->append_column(_("Interface Name"), nc.interface_name) - 1;
-
-        // Documentation asks for dynamic_cast here
-        Gtk::CellRendererText *cell_renderer = dynamic_cast<Gtk::CellRendererText*>(network_interfaces_treeview
-                                        ->get_column_cell_renderer(column_num));
-        cell_renderer->property_editable() = true;
-        cell_renderer->signal_edited().connect(
-              sigc::mem_fun(*this, &ChooseMonitorWindow::
-                            on_network_interface_name_edited));
-
-        for (int i = 0; i < NetworkLoadMonitor::NUM_INTERFACE_TYPES; ++i)
-        {
-            NetworkLoadMonitor::InterfaceType interface_type =
-                static_cast<NetworkLoadMonitor::InterfaceType>(i);
-            store_iter iter = network_interfaces_names_store->append();
-            (*iter)[nc.interface_type] = NetworkLoadMonitor::
-                interface_type_to_string(interface_type, false);
-            (*iter)[nc.interface_name] = NetworkLoadMonitor::
-                get_interface_name(interface_type, xfce_plugin);
-        }
+        /* Interface type interface names advanced settings are already
+         * populated when this form is instantiated */
 
         network_load_tag->set_text(tag);
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list