summaryrefslogtreecommitdiff
path: root/gtk/gtkcellrenderertext.c
diff options
context:
space:
mode:
authorKristian Rietveld <kris@imendio.com>2006-07-19 16:27:10 +0000
committerKristian Rietveld <kristian@src.gnome.org>2006-07-19 16:27:10 +0000
commite1d2805cc5b6aa1f4e0fedba12cf2635796d0ca8 (patch)
treeabff3fd161dc360695e3ffe772ce60da73945990 /gtk/gtkcellrenderertext.c
parentcb3669e1a1d2832b49a0c92fa9c8cb8645984bd6 (diff)
downloadgdk-pixbuf-e1d2805cc5b6aa1f4e0fedba12cf2635796d0ca8.tar.gz
add align_set field to keep track whether the align property was set by
2006-07-19 Kristian Rietveld <kris@imendio.com> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_init), (gtk_cell_renderer_text_[gs]et_property), (get_layout): add align_set field to keep track whether the align property was set by the user, if not we will use the alignment by looking at the direction of the widget. (#157439)
Diffstat (limited to 'gtk/gtkcellrenderertext.c')
-rw-r--r--gtk/gtkcellrenderertext.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gtk/gtkcellrenderertext.c b/gtk/gtkcellrenderertext.c
index f5998eb33..4bbcc52d2 100644
--- a/gtk/gtkcellrenderertext.c
+++ b/gtk/gtkcellrenderertext.c
@@ -131,6 +131,7 @@ struct _GtkCellRendererTextPrivate
guint language_set : 1;
guint markup_set : 1;
guint ellipsize_set : 1;
+ guint align_set : 1;
gulong focus_out_id;
PangoLanguage *language;
@@ -167,6 +168,7 @@ gtk_cell_renderer_text_init (GtkCellRendererText *celltext)
priv->width_chars = -1;
priv->wrap_width = -1;
priv->align = PANGO_ALIGN_LEFT;
+ priv->align_set = FALSE;
}
static void
@@ -1234,6 +1236,7 @@ gtk_cell_renderer_text_set_property (GObject *object,
case PROP_ALIGN:
priv->align = g_value_get_enum (value);
+ priv->align_set = TRUE;
break;
case PROP_BACKGROUND_SET:
@@ -1433,7 +1436,19 @@ get_layout (GtkCellRendererText *celltext,
pango_layout_set_wrap (layout, PANGO_WRAP_CHAR);
}
- pango_layout_set_alignment (layout, priv->align);
+ if (priv->align_set)
+ pango_layout_set_alignment (layout, priv->align);
+ else
+ {
+ PangoAlignment align;
+
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ align = PANGO_ALIGN_RIGHT;
+ else
+ align = PANGO_ALIGN_LEFT;
+
+ pango_layout_set_alignment (layout, align);
+ }
pango_layout_set_attributes (layout, attr_list);