[network-manager-openvpn/th/ui-init-cleanup: 5/11] properties: refactor initialization of spinbutton for "fragment"
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-openvpn/th/ui-init-cleanup: 5/11] properties: refactor initialization of spinbutton for "fragment"
- Date: Mon, 15 Aug 2016 12:49:08 +0000 (UTC)
commit 801703e17e9605cd11e21af3468eb4c8689802ec
Author: Thomas Haller <thaller redhat com>
Date: Mon Aug 15 14:10:53 2016 +0200
properties: refactor initialization of spinbutton for "fragment"
properties/auth-helpers.c | 24 ++----------------------
1 files changed, 2 insertions(+), 22 deletions(-)
---
diff --git a/properties/auth-helpers.c b/properties/auth-helpers.c
index dde6bdb..c4f8cfb 100644
--- a/properties/auth-helpers.c
+++ b/properties/auth-helpers.c
@@ -1574,30 +1574,10 @@ advanced_dialog_new (GHashTable *hash, const char *contype)
_nm_utils_ascii_str_to_int64 (value, 10, 1, 65535, 1500));
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "fragment_checkbutton"));
- spin = GTK_WIDGET (gtk_builder_get_object (builder, "fragment_spinbutton"));
- g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (checkbox_toggled_update_widget_cb), spin);
-
value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_FRAGMENT_SIZE);
- if (value && strlen (value)) {
- long int tmp;
-
- errno = 0;
- tmp = strtol (value, NULL, 10);
- if (errno == 0 && tmp >= 0 && tmp < 65536) {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+ _builder_init_optional_spinbutton (builder, "fragment_checkbutton", "fragment_spinbutton", !!value,
+ _nm_utils_ascii_str_to_int64 (value, 10, 0, 65535, 1300));
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "fragment_spinbutton"));
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), (gdouble) tmp);
- gtk_widget_set_sensitive (widget, TRUE);
- }
- } else {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
-
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "fragment_spinbutton"));
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), 1300.0);
- gtk_widget_set_sensitive (widget, FALSE);
- }
value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_COMP_LZO);
if (NM_IN_STRSET (value, "yes", "adaptive")) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]