[network-manager-applet] editor: support the connection.metered property
- From: Beniamino Galvani <bgalvani src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet] editor: support the connection.metered property
- Date: Wed, 28 Mar 2018 07:02:36 +0000 (UTC)
commit 0232c93cd2361db281b745690afe3423097bacfc
Author: Beniamino Galvani <bgalvani redhat com>
Date: Mon Mar 26 22:08:16 2018 +0200
editor: support the connection.metered property
https://bugzilla.gnome.org/show_bug.cgi?id=794674
src/connection-editor/ce-page-general.ui | 48 ++++++++++++++++++++++++++++++
src/connection-editor/page-general.c | 11 +++++++
2 files changed, 59 insertions(+), 0 deletions(-)
---
diff --git a/src/connection-editor/ce-page-general.ui b/src/connection-editor/ce-page-general.ui
index af52425..37fd8fc 100644
--- a/src/connection-editor/ce-page-general.ui
+++ b/src/connection-editor/ce-page-general.ui
@@ -16,6 +16,23 @@
<column type="gchararray"/>
</columns>
</object>
+ <object class="GtkListStore" id="metered_store">
+ <columns>
+ <!-- column-name Name -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">Automatic</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Yes</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">No</col>
+ </row>
+ </data>
+ </object>
<object class="GtkGrid" id="GeneralPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -94,6 +111,37 @@
</packing>
</child>
<child>
+ <object class="GtkLabel" id="metered_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">_Metered connection</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="metered_combo">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="tooltip_text" translatable="yes">NetworkManager indicates to applications whether
the connection is metered and therefore data usage should be restricted. Select which value ('Yes' or 'No')
to indicate to applications, or 'Automatic' to use a default value based on the connection type and other
heuristics.</property>
+ <property name="model">metered_store</property>
+ <child>
+ <object class="GtkCellRendererText" id="renderer2"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkCheckButton" id="connection_autoconnect">
<property name="label" translatable="yes">Connect _automatically with priority</property>
<property name="visible">True</property>
diff --git a/src/connection-editor/page-general.c b/src/connection-editor/page-general.c
index 6eb55ad..665f116 100644
--- a/src/connection-editor/page-general.c
+++ b/src/connection-editor/page-general.c
@@ -47,6 +47,8 @@ typedef struct {
GtkSpinButton *autoconnect_prio;
GtkWidget *all_checkbutton;
+ GtkComboBox *metered_combo;
+
gboolean setup_finished;
} CEPageGeneralPrivate;
@@ -168,6 +170,7 @@ general_private_init (CEPageGeneral *self)
priv->autoconnect_prio_label = GTK_WIDGET (gtk_builder_get_object (builder,
"autoconnect_prio_label"));
priv->autoconnect_prio = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "autoconnect_prio"));
priv->all_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "system_checkbutton"));
+ priv->metered_combo = GTK_COMBO_BOX (gtk_builder_get_object (builder, "metered_combo"));
}
static void
@@ -316,6 +319,9 @@ populate_ui (CEPageGeneral *self)
global_connection = FALSE;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->all_checkbutton), global_connection);
+ /* Metered */
+ gtk_combo_box_set_active (priv->metered_combo, nm_setting_connection_get_metered (priv->setting));
+
stuff_changed (NULL, self);
}
@@ -433,6 +439,11 @@ ui_to_setting (CEPageGeneral *self)
/* Only visible to this user */
nm_setting_connection_add_permission (priv->setting, "user", g_get_user_name (), NULL);
}
+
+ g_object_set (G_OBJECT (priv->setting),
+ NM_SETTING_CONNECTION_METERED,
+ gtk_combo_box_get_active (priv->metered_combo),
+ NULL);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]