[StTable] fix x-align/y-align properties to be StAlign, not double

This puts it in sync with StBin and StBoxLayout

https://bugzilla.gnome.org/show_bug.cgi?id=609848
This commit is contained in:
Dan Winship 2010-02-15 12:08:45 -05:00
parent 4749393ab5
commit f52744cfbc
6 changed files with 32 additions and 66 deletions

View File

@ -89,7 +89,7 @@ Calendar.prototype = {
this.actor.add(new St.Label({ text: iter.toLocaleFormat("%a") }), this.actor.add(new St.Label({ text: iter.toLocaleFormat("%a") }),
{ row: 1, { row: 1,
col: (7 + iter.getDay() - this._weekStart) % 7, col: (7 + iter.getDay() - this._weekStart) % 7,
x_fill: false, x_align: 1.0 }); x_fill: false, x_align: St.Align.END });
iter.setTime(iter.getTime() + MSECS_IN_DAY); iter.setTime(iter.getTime() + MSECS_IN_DAY);
} }
@ -168,7 +168,7 @@ Calendar.prototype = {
label.style_class = "calendar-day"; label.style_class = "calendar-day";
this.actor.add(label, this.actor.add(label,
{ row: row, col: (7 + iter.getDay() - this._weekStart) % 7, { row: row, col: (7 + iter.getDay() - this._weekStart) % 7,
x_fill: false, x_align: 1.0 }); x_fill: false, x_align: St.Align.END });
iter.setTime(iter.getTime() + MSECS_IN_DAY); iter.setTime(iter.getTime() + MSECS_IN_DAY);
if (iter.getDay() == this._weekStart) { if (iter.getDay() == this._weekStart) {

View File

@ -220,7 +220,7 @@ Notification.prototype = {
let box = new St.BoxLayout({ name: 'notification-actions' }); let box = new St.BoxLayout({ name: 'notification-actions' });
this.addActor(box, { x_expand: false, this.addActor(box, { x_expand: false,
x_fill: false, x_fill: false,
x_align: 1.0 }); x_align: St.Align.END });
this._actionBox = box; this._actionBox = box;
} }

View File

@ -25,6 +25,7 @@
#include "st-private.h" #include "st-private.h"
#include "st-table-child.h" #include "st-table-child.h"
#include "st-table-private.h" #include "st-table-private.h"
#include "st-enum-types.h"
#include <st/st-widget.h> #include <st/st-widget.h>
#include <st/st-table.h> #include <st/st-table.h>
@ -96,11 +97,11 @@ table_child_set_property (GObject *gobject,
clutter_actor_queue_relayout (CLUTTER_ACTOR (table)); clutter_actor_queue_relayout (CLUTTER_ACTOR (table));
break; break;
case CHILD_PROP_X_ALIGN: case CHILD_PROP_X_ALIGN:
child->x_align = g_value_get_double (value); child->x_align = g_value_get_enum (value);
clutter_actor_queue_relayout (CLUTTER_ACTOR (table)); clutter_actor_queue_relayout (CLUTTER_ACTOR (table));
break; break;
case CHILD_PROP_Y_ALIGN: case CHILD_PROP_Y_ALIGN:
child->y_align = g_value_get_double (value); child->y_align = g_value_get_enum (value);
clutter_actor_queue_relayout (CLUTTER_ACTOR (table)); clutter_actor_queue_relayout (CLUTTER_ACTOR (table));
break; break;
case CHILD_PROP_X_FILL: case CHILD_PROP_X_FILL:
@ -151,10 +152,10 @@ table_child_get_property (GObject *gobject,
g_value_set_boolean (value, child->y_expand); g_value_set_boolean (value, child->y_expand);
break; break;
case CHILD_PROP_X_ALIGN: case CHILD_PROP_X_ALIGN:
g_value_set_double (value, child->x_align); g_value_set_enum (value, child->x_align);
break; break;
case CHILD_PROP_Y_ALIGN: case CHILD_PROP_Y_ALIGN:
g_value_set_double (value, child->y_align); g_value_set_enum (value, child->y_align);
break; break;
case CHILD_PROP_X_FILL: case CHILD_PROP_X_FILL:
g_value_set_boolean (value, child->x_fill); g_value_set_boolean (value, child->x_fill);
@ -237,21 +238,21 @@ st_table_child_class_init (StTableChildClass *klass)
g_object_class_install_property (gobject_class, CHILD_PROP_Y_EXPAND, pspec); g_object_class_install_property (gobject_class, CHILD_PROP_Y_EXPAND, pspec);
pspec = g_param_spec_double ("x-align", pspec = g_param_spec_enum ("x-align",
"X Alignment", "X Alignment",
"X alignment of the widget within the cell", "X alignment of the widget within the cell",
0, 1, ST_TYPE_ALIGN,
0.5, ST_ALIGN_MIDDLE,
ST_PARAM_READWRITE); ST_PARAM_READWRITE);
g_object_class_install_property (gobject_class, CHILD_PROP_X_ALIGN, pspec); g_object_class_install_property (gobject_class, CHILD_PROP_X_ALIGN, pspec);
pspec = g_param_spec_double ("y-align", pspec = g_param_spec_enum ("y-align",
"Y Alignment", "Y Alignment",
"Y alignment of the widget within the cell", "Y alignment of the widget within the cell",
0, 1, ST_TYPE_ALIGN,
0.5, ST_ALIGN_MIDDLE,
ST_PARAM_READWRITE); ST_PARAM_READWRITE);
g_object_class_install_property (gobject_class, CHILD_PROP_Y_ALIGN, pspec); g_object_class_install_property (gobject_class, CHILD_PROP_Y_ALIGN, pspec);
@ -291,8 +292,8 @@ st_table_child_init (StTableChild *self)
self->col_span = 1; self->col_span = 1;
self->row_span = 1; self->row_span = 1;
self->x_align = 0.5; self->x_align = ST_ALIGN_MIDDLE;
self->y_align = 0.5; self->y_align = ST_ALIGN_MIDDLE;
self->x_expand = TRUE; self->x_expand = TRUE;
self->y_expand = TRUE; self->y_expand = TRUE;
@ -637,12 +638,7 @@ st_table_child_get_x_align (StTable *table,
meta = get_child_meta (table, child); meta = get_child_meta (table, child);
if (meta->x_align == 0.0) return meta->x_align;
return ST_ALIGN_START;
else if (meta->x_align == 1.0)
return ST_ALIGN_END;
else
return ST_ALIGN_MIDDLE;
} }
@ -668,19 +664,7 @@ st_table_child_set_x_align (StTable *table,
meta = get_child_meta (table, child); meta = get_child_meta (table, child);
switch (align) meta->x_align = align;
{
case ST_ALIGN_START:
meta->x_align = 0.0;
break;
case ST_ALIGN_MIDDLE:
meta->x_align = 0.5;
break;
case ST_ALIGN_END:
meta->x_align = 1.0;
break;
}
clutter_actor_queue_relayout (child); clutter_actor_queue_relayout (child);
} }
@ -704,13 +688,7 @@ st_table_child_get_y_align (StTable *table,
meta = get_child_meta (table, child); meta = get_child_meta (table, child);
if (meta->y_align == 0.0) return meta->y_align;
return ST_ALIGN_START;
else if (meta->y_align == 1.0)
return ST_ALIGN_END;
else
return ST_ALIGN_MIDDLE;
} }
/** /**
@ -735,19 +713,7 @@ st_table_child_set_y_align (StTable *table,
meta = get_child_meta (table, child); meta = get_child_meta (table, child);
switch (align) meta->y_align = align;
{
case ST_ALIGN_START:
meta->y_align = 0.0;
break;
case ST_ALIGN_MIDDLE:
meta->y_align = 0.5;
break;
case ST_ALIGN_END:
meta->y_align = 1.0;
break;
}
clutter_actor_queue_relayout (child); clutter_actor_queue_relayout (child);
} }

View File

@ -61,8 +61,8 @@ struct _StTableChild
gint row; gint row;
gint col_span; gint col_span;
gint row_span; gint row_span;
gdouble x_align; StAlign x_align;
gdouble y_align; StAlign y_align;
guint allocate_hidden : 1; guint allocate_hidden : 1;
guint x_expand : 1; guint x_expand : 1;
guint y_expand : 1; guint y_expand : 1;

View File

@ -419,7 +419,7 @@ st_table_homogeneous_allocate (ClutterActor *self,
StTableChild *meta; StTableChild *meta;
ClutterActor *child; ClutterActor *child;
ClutterActorBox childbox; ClutterActorBox childbox;
gdouble x_align, y_align; StAlign x_align, y_align;
gboolean x_fill, y_fill; gboolean x_fill, y_fill;
child = CLUTTER_ACTOR (list->data); child = CLUTTER_ACTOR (list->data);
@ -779,7 +779,7 @@ st_table_preferred_allocate (ClutterActor *self,
ClutterActor *child; ClutterActor *child;
ClutterActorBox childbox; ClutterActorBox childbox;
gint child_x, child_y; gint child_x, child_y;
gdouble x_align, y_align; StAlign x_align, y_align;
gboolean x_fill, y_fill; gboolean x_fill, y_fill;
child = CLUTTER_ACTOR (list->data); child = CLUTTER_ACTOR (list->data);

View File

@ -47,8 +47,8 @@ table.add(L("5", "#ff00ff"),
{ row: 2, col: 1, x_expand: 0 }); { row: 2, col: 1, x_expand: 0 });
table.add(L("6", "#00ffff"), table.add(L("6", "#00ffff"),
{ row: 2, col: 2, { row: 2, col: 2,
x_expand: 0, x_fill: 0, x_align: 1.0, x_expand: 0, x_fill: 0, x_align: St.Align.END,
y_expand: 0, y_fill: 0, y_align: 1.0 }); y_expand: 0, y_fill: 0, y_align: St.Align.END });
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////