[glide] Constrain box to be centered in stage with some padding
- From: Robert Carr <racarr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glide] Constrain box to be centered in stage with some padding
- Date: Sat, 5 Jun 2010 22:30:41 +0000 (UTC)
commit 4737dc979025bada61c1ff09b800f7c7c1939fbb
Author: Robert Carr <racarr Valentine localdomain>
Date: Sat Jun 5 18:02:11 2010 -0400
Constrain box to be centered in stage with some padding
libglide/glide-theme-chooser.c | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/libglide/glide-theme-chooser.c b/libglide/glide-theme-chooser.c
index bf8fe51..8ea833e 100644
--- a/libglide/glide-theme-chooser.c
+++ b/libglide/glide-theme-chooser.c
@@ -99,7 +99,7 @@ glide_theme_chooser_make_layout (GlideThemeChooser *chooser)
ClutterLayoutManager *layout = clutter_flow_layout_new (CLUTTER_FLOW_HORIZONTAL);
clutter_flow_layout_set_homogeneous (CLUTTER_FLOW_LAYOUT (layout),
- TRUE);
+ FALSE);
clutter_flow_layout_set_column_spacing (CLUTTER_FLOW_LAYOUT (layout), 10);
clutter_flow_layout_set_row_spacing (CLUTTER_FLOW_LAYOUT (layout),
10);
@@ -126,6 +126,18 @@ glide_theme_chooser_populate_theme_box (GlideThemeChooser *chooser)
}
}
+static void
+glide_theme_chooser_constrain_box (GlideThemeChooser *chooser)
+{
+ ClutterConstraint *x = clutter_align_constraint_new (chooser->priv->stage, CLUTTER_ALIGN_X_AXIS,
+ .5);
+ ClutterConstraint *y = clutter_align_constraint_new (chooser->priv->stage, CLUTTER_ALIGN_Y_AXIS,
+ .5);
+
+ clutter_actor_add_constraint (chooser->priv->theme_box, x);
+ clutter_actor_add_constraint (chooser->priv->theme_box, y);
+}
+
static ClutterActor *
glide_theme_chooser_make_theme_box (GlideThemeChooser *chooser)
{
@@ -133,10 +145,12 @@ glide_theme_chooser_make_theme_box (GlideThemeChooser *chooser)
ClutterLayoutManager *layout = glide_theme_chooser_make_layout (chooser);
box = clutter_box_new (layout);
- clutter_actor_set_size (CLUTTER_ACTOR (box), 600, 400);
+ clutter_actor_set_size (CLUTTER_ACTOR (box), 580, 380);
chooser->priv->theme_box = box;
+ glide_theme_chooser_constrain_box (chooser);
+
glide_theme_chooser_populate_theme_box (chooser);
return box;
@@ -151,7 +165,7 @@ glide_theme_chooser_stage_allocation_changed (ClutterActor *stage,
gfloat width, height;
clutter_actor_box_get_size (allocation, &width, &height);
- clutter_actor_set_size (box, width, height);
+ clutter_actor_set_size (box, width-20, height-20);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]