From 24bb46eb44e01ecaf933e6753e55d92a11c26350 Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Fri, 15 Mar 2013 18:37:33 +0100 Subject: [PATCH] region: Keep format 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=695536 --- panels/region/cc-format-chooser.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/panels/region/cc-format-chooser.c b/panels/region/cc-format-chooser.c index 418d012c8..f7d4908fa 100644 --- a/panels/region/cc-format-chooser.c +++ b/panels/region/cc-format-chooser.c @@ -159,7 +159,7 @@ set_locale_id (GtkDialog *chooser, gboolean is_extra; /* mark as selected */ - gtk_widget_show (check); + gtk_widget_set_opacity (check, 1.0); /* make sure this row is shown */ is_extra = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (row), "is-extra")); @@ -170,7 +170,7 @@ set_locale_id (GtkDialog *chooser, } else { /* mark as unselected */ - gtk_widget_hide (check); + gtk_widget_set_opacity (check, 0.0); } } g_list_free (children); @@ -232,9 +232,17 @@ region_widget_new (const gchar *locale_id, widget = padded_label_new (locale_name, is_extra); + /* We add a check on each side of the label to keep it centered. */ check = gtk_image_new (); gtk_image_set_from_icon_name (GTK_IMAGE (check), "object-select-symbolic", GTK_ICON_SIZE_MENU); - gtk_widget_set_no_show_all (check, TRUE); + gtk_widget_set_opacity (check, 0.0); + g_object_set (check, "icon-size", GTK_ICON_SIZE_MENU, NULL); + gtk_box_pack_start (GTK_BOX (widget), check, FALSE, FALSE, 0); + gtk_box_reorder_child (GTK_BOX (widget), check, 0); + + check = gtk_image_new (); + gtk_image_set_from_icon_name (GTK_IMAGE (check), "object-select-symbolic", GTK_ICON_SIZE_MENU); + gtk_widget_set_opacity (check, 0.0); g_object_set (check, "icon-size", GTK_ICON_SIZE_MENU, NULL); gtk_box_pack_start (GTK_BOX (widget), check, FALSE, FALSE, 0);