]> Pileus Git - ~andy/gtk/commitdiff
add align_set field to keep track whether the align property was set by
authorKristian Rietveld <kris@imendio.com>
Wed, 19 Jul 2006 16:27:10 +0000 (16:27 +0000)
committerKristian Rietveld <kristian@src.gnome.org>
Wed, 19 Jul 2006 16:27:10 +0000 (16:27 +0000)
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)

ChangeLog
ChangeLog.pre-2-10
gtk/gtkcellrenderertext.c

index aebf705c6e3d695df62a3a68d896b6bc12863308..4a7303bdddfd11207f938da7db8b9b0014494434 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+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)
+
 2006-07-19  Matthias Clasen  <mclasen@redhat.com>
 
        * modules/printbackends/file/gtkprintbackendfile.c 
index aebf705c6e3d695df62a3a68d896b6bc12863308..4a7303bdddfd11207f938da7db8b9b0014494434 100644 (file)
@@ -1,3 +1,11 @@
+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)
+
 2006-07-19  Matthias Clasen  <mclasen@redhat.com>
 
        * modules/printbackends/file/gtkprintbackendfile.c 
index f5998eb3397ec1cefa37124daa2d9f4533d79a8a..4bbcc52d23c09dde5e14921b67aa062587516a4f 100644 (file)
@@ -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);