[gnome-initial-setup] language: Keep language chooser labels centered



commit 3625566461bed0c18a2456739192b21c6051112a
Author: Rui Matos <tiagomatos gmail com>
Date:   Thu Apr 18 21:31:21 2013 +0200

    language: Keep language chooser labels centered
    
    In order to prevent the labels from moving around when hiding and
    showing the check mark we need to keep the check mark always visible
    and instead tweak its opacity.
    
    We also add an always transparent widget the same size as the check
    mark on the other side of the label to make sure that the label is
    globally centered.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=698329

 gnome-initial-setup/pages/language/cc-language-chooser.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/gnome-initial-setup/pages/language/cc-language-chooser.c 
b/gnome-initial-setup/pages/language/cc-language-chooser.c
index 32799ba..1c3e4fa 100644
--- a/gnome-initial-setup/pages/language/cc-language-chooser.c
+++ b/gnome-initial-setup/pages/language/cc-language-chooser.c
@@ -115,6 +115,7 @@ language_widget_new (const char *locale_id,
                      gboolean    is_extra)
 {
         gchar *locale_name, *locale_current_name, *locale_untranslated_name;
+        GtkWidget *checkmark;
         LanguageWidget *widget = g_new0 (LanguageWidget, 1);
 
         locale_name = gnome_get_language_from_locale (locale_id, locale_id);
@@ -128,6 +129,12 @@ language_widget_new (const char *locale_id,
         widget->locale_untranslated_name = locale_untranslated_name;
         widget->is_extra = is_extra;
 
+        /* We add a check on each side of the label to keep it centered. */
+        checkmark = gtk_image_new_from_icon_name ("object-select-symbolic", GTK_ICON_SIZE_MENU);
+        gtk_widget_set_opacity (checkmark, 0.0);
+        gtk_box_pack_start (GTK_BOX (widget->box), checkmark, FALSE, FALSE, 0);
+        gtk_box_reorder_child (GTK_BOX (widget->box), checkmark, 0);
+
         widget->checkmark = gtk_image_new_from_icon_name ("object-select-symbolic", GTK_ICON_SIZE_MENU);
         gtk_box_pack_start (GTK_BOX (widget->box), widget->checkmark,
                             FALSE, FALSE, 0);
@@ -151,7 +158,7 @@ sync_checkmark (GtkWidget *child,
 
         locale_id = user_data;
         should_be_visible = g_str_equal (widget->locale_id, locale_id);
-        gtk_widget_set_visible (widget->checkmark, should_be_visible);
+        gtk_widget_set_opacity (widget->checkmark, should_be_visible ? 1.0 : 0.0);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]