diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2018-03-26 22:08:16 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2018-03-28 09:00:44 +0200 |
commit | 0232c93cd2361db281b745690afe3423097bacfc (patch) | |
tree | e0f1784184a66755a70e1a22fa69cebd1960c974 | |
parent | b40d53bc0394c69db01b0d15f765372bf9cd67fd (diff) | |
download | network-manager-applet-0232c93cd2361db281b745690afe3423097bacfc.tar.gz |
editor: support the connection.metered property
https://bugzilla.gnome.org/show_bug.cgi?id=794674
-rw-r--r-- | src/connection-editor/ce-page-general.ui | 48 | ||||
-rw-r--r-- | 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 af524251..37fd8fcc 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 6eb55ad4..665f1164 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 |