[network-manager-openvpn/th/ui-init-cleanup: 7/11] properties: refactor initialization of spinbutton for "ping"
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-openvpn/th/ui-init-cleanup: 7/11] properties: refactor initialization of spinbutton for "ping"
- Date: Mon, 15 Aug 2016 12:49:18 +0000 (UTC)
commit c27f75594cf8e4c96de1f370f38cd2be431f15ba
Author: Thomas Haller <thaller redhat com>
Date: Mon Aug 15 14:16:25 2016 +0200
properties: refactor initialization of spinbutton for "ping"
properties/auth-helpers.c | 25 +++----------------------
1 files changed, 3 insertions(+), 22 deletions(-)
---
diff --git a/properties/auth-helpers.c b/properties/auth-helpers.c
index 4f32fa3..4128800 100644
--- a/properties/auth-helpers.c
+++ b/properties/auth-helpers.c
@@ -1746,30 +1746,11 @@ advanced_dialog_new (GHashTable *hash, const char *contype)
gtk_notebook_remove_page (GTK_NOTEBOOK (widget), 2);
}
- /* ping */
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "ping_checkbutton"));
- spin = GTK_WIDGET (gtk_builder_get_object (builder, "ping_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_PING);
- if (value && *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);
-
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "ping_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);
+ value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_PING);
+ _builder_init_optional_spinbutton (builder, "ping_checkbutton", "ping_spinbutton", !!value,
+ _nm_utils_ascii_str_to_int64 (value, 10, 1, 65535, 30));
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "ping_spinbutton"));
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), 30.0);
- gtk_widget_set_sensitive (widget, FALSE);
- }
/* ping-exit / ping-restart */
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ping_exit_restart_checkbutton"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]