[gnome-control-center/gnome-3-8] region: Keep format chooser labels centered
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gnome-3-8] region: Keep format chooser labels centered
- Date: Mon, 18 Mar 2013 12:11:42 +0000 (UTC)
commit 1748a89fbf456ae85b88fb671537fd7316e2adeb
Author: Rui Matos <tiagomatos gmail com>
Date: Fri Mar 15 18:37:33 2013 +0100
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 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/panels/region/cc-format-chooser.c b/panels/region/cc-format-chooser.c
index 418d012..f7d4908 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]