From 0280d70745f2fcf3b839b9e2262ea93002efff36 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Thu, 14 Nov 2013 21:08:00 +0100 Subject: [PATCH] prefs: Replace scrollbar policy combo with checkbox The combo was a leftover from when it contained more options, and from the remaining three choices, the "Visible only when necessary" option was unimplemented. Replace the combo box with a simple checkbox. https://bugzilla.gnome.org/show_bug.cgi?id=712331 --- src/profile-editor.c | 29 ++++++++++++++++++--- src/profile-preferences.ui | 64 ++++++++++++---------------------------------- 2 files changed, 41 insertions(+), 52 deletions(-) diff --git a/src/profile-editor.c b/src/profile-editor.c index ca820b0..0489212 100644 --- a/src/profile-editor.c +++ b/src/profile-editor.c @@ -648,6 +648,27 @@ enum_to_string (const GValue *value, return variant; } +static gboolean +scrollbar_policy_to_bool (GValue *value, + GVariant *variant, + gpointer user_data) +{ + const char *str; + + g_variant_get (variant, "&s", &str); + g_value_set_boolean (value, g_str_equal (str, "always")); + + return TRUE; +} + +static GVariant * +bool_to_scrollbar_policy (const GValue *value, + const GVariantType *expected_type, + gpointer user_data) +{ + return g_variant_new_string (g_value_get_boolean (value) ? "always" : "never"); +} + /** * terminal_profile_edit: * @profile: a #GSettings @@ -907,12 +928,12 @@ terminal_profile_edit (GSettings *profile, g_settings_bind_with_mapping (profile, TERMINAL_PROFILE_SCROLLBAR_POLICY_KEY, gtk_builder_get_object (builder, - "scrollbar-policy-combobox"), + "scrollbar-checkbutton"), "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET, - (GSettingsBindGetMapping) string_to_enum, - (GSettingsBindSetMapping) enum_to_string, - gtk_policy_type_get_type, NULL); + (GSettingsBindGetMapping) scrollbar_policy_to_bool, + (GSettingsBindSetMapping) bool_to_scrollbar_policy, + NULL, NULL); g_settings_bind (profile, TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE_KEY, gtk_builder_get_object (builder, "scroll-on-keystroke-checkbutton"), diff --git a/src/profile-preferences.ui b/src/profile-preferences.ui index db1b6fb..21e4e9a 100644 --- a/src/profile-preferences.ui +++ b/src/profile-preferences.ui @@ -99,23 +99,6 @@ - - - - - - - - Always visible - - - Visible only when necessary - - - Hidden - - - @@ -1637,21 +1620,6 @@ - - True - False - 0 - _Scrollbar is: - True - center - scrollbar-policy-combobox - - - GTK_FILL - GTK_FILL - - - True False @@ -1725,22 +1693,7 @@ True False - - True - False - model5 - - - - 0 - - - - - False - True - 0 - + @@ -1792,6 +1745,21 @@ GTK_FILL + + + _Show scrollbar + True + True + False + True + 0 + True + + + 2 + GTK_FILL + + 4 -- 1.8.4.2