[network-manager-applet/lr/team: 3/4] f



commit 9507f77f403d0e191ec4f80e28c5cb807aef966b
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Mon Jul 11 11:58:48 2016 +0200

    f

 src/connection-editor/ce-page-team.ui |   48 +++++++++----------
 src/connection-editor/page-team.c     |   82 +++++++++++++++++++++++++++++++--
 2 files changed, 100 insertions(+), 30 deletions(-)
---
diff --git a/src/connection-editor/ce-page-team.ui b/src/connection-editor/ce-page-team.ui
index 55e5e55..081112a 100644
--- a/src/connection-editor/ce-page-team.ui
+++ b/src/connection-editor/ce-page-team.ui
@@ -122,7 +122,6 @@
     <property name="border_width">12</property>
     <property name="row_spacing">8</property>
     <property name="column_spacing">12</property>
-    <property name="column_homogeneous">True</property>
     <child>
       <object class="GtkLabel" id="master_connections_label">
         <property name="visible">True</property>
@@ -133,7 +132,7 @@
       </object>
       <packing>
         <property name="left_attach">0</property>
-        <property name="top_attach">1</property>
+        <property name="top_attach">2</property>
         <property name="width">2</property>
       </packing>
     </child>
@@ -235,7 +234,7 @@
       </object>
       <packing>
         <property name="left_attach">0</property>
-        <property name="top_attach">2</property>
+        <property name="top_attach">3</property>
         <property name="width">2</property>
       </packing>
     </child>
@@ -265,14 +264,30 @@
       </packing>
     </child>
     <child>
+      <object class="GtkLabel" id="team_mtu_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="halign">start</property>
+        <property name="label" translatable="yes">_MTU:</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">team_mtu</property>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">1</property>
+      </packing>
+    </child>
+    <child>
       <object class="GtkHBox" id="team_mtu_box">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
         <property name="spacing">4</property>
         <child>
           <object class="GtkSpinButton" id="team_mtu">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <property name="hexpand">True</property>
             <property name="adjustment">team_mtu_adjustment</property>
             <property name="climb_rate">1</property>
           </object>
@@ -286,6 +301,7 @@
           <object class="GtkLabel" id="label29">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="halign">start</property>
             <property name="label" translatable="yes">bytes</property>
             <property name="xalign">0</property>
           </object>
@@ -298,21 +314,7 @@
       </object>
       <packing>
         <property name="left_attach">1</property>
-        <property name="top_attach">3</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkLabel" id="team_mtu_label">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="halign">start</property>
-        <property name="label" translatable="yes">_MTU:</property>
-        <property name="use_underline">True</property>
-        <property name="mnemonic_widget">team_mtu</property>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">3</property>
+        <property name="top_attach">1</property>
       </packing>
     </child>
     <child>
@@ -322,6 +324,7 @@
         <property name="receives_default">True</property>
         <property name="halign">end</property>
         <property name="valign">end</property>
+        <property name="vexpand">True</property>
         <property name="use_underline">True</property>
         <child>
           <object class="GtkBox">
@@ -358,16 +361,10 @@
       </object>
       <packing>
         <property name="left_attach">0</property>
-        <property name="top_attach">5</property>
+        <property name="top_attach">4</property>
         <property name="width">2</property>
       </packing>
     </child>
-    <child>
-      <placeholder/>
-    </child>
-    <child>
-      <placeholder/>
-    </child>
   </object>
   <object class="GtkListStore" id="team_runner_model">
     <columns>
@@ -475,6 +472,7 @@
   </object>
   <object class="GtkDialog" id="advanced_dialog">
     <property name="can_focus">False</property>
+    <property name="title" translatable="yes">Team Advanced Options</property>
     <property name="type_hint">dialog</property>
     <child internal-child="vbox">
       <object class="GtkBox" id="advanced_dialog_box">
diff --git a/src/connection-editor/page-team.c b/src/connection-editor/page-team.c
index cc14533..5091ba5 100644
--- a/src/connection-editor/page-team.c
+++ b/src/connection-editor/page-team.c
@@ -41,11 +41,14 @@ typedef struct {
 
        GtkWindow *toplevel;
 
-       GtkTextView *json_config_widget;
-       GtkWidget *import_config_button;
+//     GtkTextView *json_config_widget;
+//     GtkWidget *import_config_button;
        GtkSpinButton *mtu;
+       GtkButton *advanced_button;
+       GtkDialog *advanced_dialog;
 } CEPageTeamPrivate;
 
+#if 0
 static void
 widget_realized_cb (GtkWidget *widget, gpointer user_data)
 {
@@ -56,6 +59,7 @@ widget_realized_cb (GtkWidget *widget, gpointer user_data)
                priv->toplevel = NULL;
        g_signal_handlers_disconnect_by_func (widget, widget_realized_cb, user_data);
 }
+#endif
 
 static void
 team_private_init (CEPageTeam *self)
@@ -65,12 +69,16 @@ team_private_init (CEPageTeam *self)
 
        builder = CE_PAGE (self)->builder;
 
-       priv->json_config_widget = GTK_TEXT_VIEW (gtk_builder_get_object (builder, "team_json_config"));
-       priv->import_config_button = GTK_WIDGET (gtk_builder_get_object (builder, "import_config_button"));
+//     priv->json_config_widget = GTK_TEXT_VIEW (gtk_builder_get_object (builder, "team_json_config"));
+//     priv->import_config_button = GTK_WIDGET (gtk_builder_get_object (builder, "import_config_button"));
        priv->mtu = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "team_mtu"));
 
+       priv->advanced_button = GTK_BUTTON (gtk_builder_get_object (builder, "advanced_button"));
+       priv->advanced_dialog = GTK_DIALOG (gtk_builder_get_object (builder, "advanced_dialog"));
+       gtk_window_set_modal (GTK_WINDOW (priv->advanced_dialog), TRUE);
+
        /* Wait for widget to be realized to get toplevel window */
-       g_signal_connect (priv->json_config_widget, "realize", G_CALLBACK (widget_realized_cb), self);
+//     g_signal_connect (priv->json_config_widget, "realize", G_CALLBACK (widget_realized_cb), self);
 }
 
 static void
@@ -79,6 +87,30 @@ stuff_changed (GtkWidget *w, gpointer user_data)
        ce_page_changed (CE_PAGE (user_data));
 }
 
+
+
+#if 0
+GtkWidget *
+advanced_dialog_new ()
+{
+       dialog = GTK_WIDGET (gtk_builder_get_object (builder, "openvpn-advanced-dialog"))
+}
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#if 0
 static void
 json_config_changed (GObject *object, CEPageTeam *self)
 {
@@ -128,22 +160,53 @@ import_button_clicked_cb (GtkWidget *widget, CEPageTeam *self)
 out:
        gtk_widget_destroy (dialog);
 }
+#endif
+
+
+
+
+
+
+
+static void
+advanced_button_clicked_cb (GtkWidget *button, gpointer user_data)
+{
+       CEPageTeam *self = CE_PAGE_TEAM (user_data);
+       CEPageTeamPrivate *priv = CE_PAGE_TEAM_GET_PRIVATE (self);
+        GtkWidget *toplevel;
+
+        toplevel = gtk_widget_get_toplevel (CE_PAGE (self)->page);
+        g_return_if_fail (gtk_widget_is_toplevel (toplevel));
+
+        gtk_window_set_transient_for (GTK_WINDOW (priv->advanced_dialog), GTK_WINDOW (toplevel));
+
+       if (gtk_dialog_run (GTK_DIALOG (priv->advanced_dialog)) == GTK_RESPONSE_ACCEPT) {
+               g_printerr ("YOLO\n");
+       }
+}
+
+
+
 
 static void
 populate_ui (CEPageTeam *self)
 {
        CEPageTeamPrivate *priv = CE_PAGE_TEAM_GET_PRIVATE (self);
+#if 0
        NMSettingTeam *s_team = priv->setting;
        GtkTextBuffer *buffer;
        const char *json_config;
+#endif
        guint32 mtu_def, mtu_val;
 
+#if 0
        buffer = gtk_text_view_get_buffer (priv->json_config_widget);
        json_config = nm_setting_team_get_config (s_team);
        gtk_text_buffer_set_text (buffer, json_config ? json_config : "", -1);
 
        g_signal_connect (buffer, "changed", G_CALLBACK (json_config_changed), self);
        g_signal_connect (priv->import_config_button, "clicked", G_CALLBACK (import_button_clicked_cb), self);
+#endif
 
        /* MTU */
        if (priv->wired) {
@@ -156,6 +219,10 @@ populate_ui (CEPageTeam *self)
                          G_CALLBACK (ce_spin_output_with_automatic),
                          GINT_TO_POINTER (mtu_def));
        gtk_spin_button_set_value (priv->mtu, (gdouble) mtu_val);
+
+
+//////////////
+       g_signal_connect (priv->advanced_button, "clicked", G_CALLBACK (advanced_button_clicked_cb), self);
 }
 
 static void
@@ -291,14 +358,18 @@ ui_to_setting (CEPageTeam *self)
 {
        CEPageTeamPrivate *priv = CE_PAGE_TEAM_GET_PRIVATE (self);
        NMConnection *connection = CE_PAGE (self)->connection;
+#if 0
        GtkTextBuffer *buffer;
        GtkTextIter start, end;
        char *json_config;
+#endif
        guint32 mtu;
 
+#if 0
        buffer = gtk_text_view_get_buffer (priv->json_config_widget);
        gtk_text_buffer_get_iter_at_offset (buffer, &start, 0);
        gtk_text_buffer_get_iter_at_offset (buffer, &end, -1);
+
        json_config = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
 
        if (g_strcmp0 (json_config, "") == 0)
@@ -307,6 +378,7 @@ ui_to_setting (CEPageTeam *self)
                      NM_SETTING_TEAM_CONFIG, json_config,
                      NULL);
        g_free (json_config);
+#endif
 
        mtu = gtk_spin_button_get_value_as_int (priv->mtu);
        if (mtu && !priv->wired) {


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