[goffice] Never redefine GtkJustfication, use GoJustification instead. [#709007]



commit a7b8520188ad06bb56be94df65b6ce6181cf2a22
Author: Jean Brefort <jean brefort normalesup org>
Date:   Tue Oct 1 13:57:04 2013 +0200

    Never redefine GtkJustfication, use GoJustification instead. [#709007]

 ChangeLog                                |   16 ++++++++++++++++
 NEWS                                     |    1 +
 docs/reference/goffice-0.10-sections.txt |    1 +
 goffice/graph/gog-axis-line.c            |    4 ++--
 goffice/graph/gog-color-scale.c          |    4 ++--
 goffice/graph/gog-label.c                |   24 ++++++++++++------------
 goffice/graph/gog-legend.c               |    4 ++--
 goffice/graph/gog-renderer.c             |   26 ++++++++++++++++++--------
 goffice/graph/gog-renderer.h             |   16 +++++++---------
 plugins/plot_distrib/gog-histogram.c     |   14 +++++++-------
 10 files changed, 68 insertions(+), 42 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index da7127f..8e9dd19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2013-10-01  Jean Brefort  <jean brefort normalesup org>
+
+       * docs/reference/goffice-0.10-sections.txt: never redefine GtkJustfication,
+       use GoJustification instead. [#709007]
+       * goffice/graph/gog-axis-line.c (axis_line_render),
+       (axis_circle_render): ditto.
+       * goffice/graph/gog-color-scale.c (gog_color_scale_view_render): ditto.
+       * goffice/graph/gog-label.c (gog_label_set_property),
+       (gog_label_get_property), (gog_label_init), (gog_text_view_render): ditto.
+       * goffice/graph/gog-legend.c (cb_render_elements): ditto.
+       * goffice/graph/gog-renderer.c (gog_renderer_draw_gostring),
+       (gog_renderer_draw_text): ditto.
+       * goffice/graph/gog-renderer.h: ditto.
+       * plugins/plot_distrib/gog-histogram.c
+       (gog_histogram_plot_view_render): ditto.
+
 2013-09-26  Morten Welinder  <terra gnome org>
 
        * goffice/goffice.h: Don't check glib version when macro check
diff --git a/NEWS b/NEWS
index 04db75a..027059b 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ Jean:
        * Do not destroy axes after adding a plot using a restricted set. [#708292]
        * Don't crash when there are no x values for a moving average smoothing.
        [#708562]
+       * Never redefine GtkJustfication, use GoJustification instead. [#709007]
 
 --------------------------------------------------------------------------
 goffice 0.10.7:
diff --git a/docs/reference/goffice-0.10-sections.txt b/docs/reference/goffice-0.10-sections.txt
index 7dc78d2..ac5737f 100644
--- a/docs/reference/goffice-0.10-sections.txt
+++ b/docs/reference/goffice-0.10-sections.txt
@@ -3332,6 +3332,7 @@ gog_reg_curve_get_type
 <SECTION>
 <FILE>gog-renderer</FILE>
 <TITLE>GogRenderer</TITLE>
+GoJustification
 GOG_RENDERER_GRIP_SIZE
 GOG_RENDERER_HAIRLINE_WIDTH_PTS
 gog_renderer_draw_circle
diff --git a/goffice/graph/gog-axis-line.c b/goffice/graph/gog-axis-line.c
index 1863320..1f5ff60 100644
--- a/goffice/graph/gog-axis-line.c
+++ b/goffice/graph/gog-axis-line.c
@@ -1279,7 +1279,7 @@ axis_line_render (GogAxisBase *axis_base,
                        label_pos.y = obrs[j].y;
                        gog_renderer_draw_gostring (renderer, ticks[j].str,
                                                    &label_pos, GO_ANCHOR_CENTER,
-                                                   GTK_JUSTIFY_CENTER, -1.);
+                                                   GO_JUSTIFY_CENTER, -1.);
                }
        }
        g_free (obrs);
@@ -1485,7 +1485,7 @@ axis_circle_render (GogAxisBase *axis_base, GogRenderer *renderer,
                                gog_renderer_draw_gostring
                                        (renderer, ticks[i].str,
                                         &label_pos, GO_ANCHOR_CENTER,
-                                        GTK_JUSTIFY_CENTER, -1.);
+                                        GO_JUSTIFY_CENTER, -1.);
                                txt_obr_old = txt_obr;
                        }
                        if (!first_label_done) {
diff --git a/goffice/graph/gog-color-scale.c b/goffice/graph/gog-color-scale.c
index caaed21..deb700e 100644
--- a/goffice/graph/gog-color-scale.c
+++ b/goffice/graph/gog-color-scale.c
@@ -734,7 +734,7 @@ gog_color_scale_view_render (GogView *view, GogViewAllocation const *bbox)
                                if (j == 0 || !go_geometry_test_OBR_overlap (obrs + j, obrs + l)) {
                                        gog_renderer_draw_gostring (view->renderer, ticks[i].str,
                                                                        &label_pos, anchor,
-                                                                           GTK_JUSTIFY_CENTER, -1.);
+                                                                           GO_JUSTIFY_CENTER, -1.);
                                        l = j;
                                }
                                j++;
@@ -772,7 +772,7 @@ gog_color_scale_view_render (GogView *view, GogViewAllocation const *bbox)
                                if (j == 0 || !go_geometry_test_OBR_overlap (obrs + j, obrs + l)) {
                                        gog_renderer_draw_gostring (view->renderer, ticks[i].str,
                                                                        &label_pos, anchor,
-                                                                           GTK_JUSTIFY_CENTER, -1.);
+                                                                           GO_JUSTIFY_CENTER, -1.);
                                        l = j;
                                }
                                j++;
diff --git a/goffice/graph/gog-label.c b/goffice/graph/gog-label.c
index 469c1cc..5292cda 100644
--- a/goffice/graph/gog-label.c
+++ b/goffice/graph/gog-label.c
@@ -225,7 +225,7 @@ struct _GogLabel {
        GogText base;
 
        GogDatasetElement text;
-       GtkJustification justification;
+       GoJustification justification;
 };
 enum {
        LABEL_PROP_0,
@@ -350,13 +350,13 @@ gog_label_set_property (GObject *obj, guint param_id,
        case LABEL_PROP_JUSTIFICATION: {
                char const *str = g_value_get_string (value);
                if (!strcmp (str, "left"))
-                       label->justification = GTK_JUSTIFY_LEFT;
+                       label->justification = GO_JUSTIFY_LEFT;
                else if (!strcmp (str, "right"))
-                       label->justification = GTK_JUSTIFY_RIGHT;
+                       label->justification = GO_JUSTIFY_RIGHT;
                else if (!strcmp (str, "fill"))
-                       label->justification = GTK_JUSTIFY_FILL;
+                       label->justification = GO_JUSTIFY_FILL;
                else
-                       label->justification = GTK_JUSTIFY_CENTER;
+                       label->justification = GO_JUSTIFY_CENTER;
                break;
        }
 
@@ -375,16 +375,16 @@ gog_label_get_property (GObject *obj, guint param_id,
        switch (param_id) {
        case LABEL_PROP_JUSTIFICATION:
                switch (label->justification) {
-               case GTK_JUSTIFY_CENTER:
+               case GO_JUSTIFY_CENTER:
                        g_value_set_string (value, "center");
                        break;
-               case GTK_JUSTIFY_LEFT:
+               case GO_JUSTIFY_LEFT:
                        g_value_set_string (value, "left");
                        break;
-               case GTK_JUSTIFY_RIGHT:
+               case GO_JUSTIFY_RIGHT:
                        g_value_set_string (value, "right");
                        break;
-               case GTK_JUSTIFY_FILL:
+               case GO_JUSTIFY_FILL:
                        g_value_set_string (value, "fill");
                        break;
                }
@@ -429,7 +429,7 @@ gog_label_class_init (GogLabelClass *klass)
 static void
 gog_label_init (GogLabel *label)
 {
-       label->justification = GTK_JUSTIFY_CENTER;
+       label->justification = GO_JUSTIFY_CENTER;
 }
 
 static void
@@ -792,14 +792,14 @@ gog_text_view_render (GogView *view, GogViewAllocation const *bbox)
                if (gostr) {
                        gog_renderer_draw_gostring (view->renderer, gostr,
                                                    &view->residual, GO_ANCHOR_NW,
-                                                   (GOG_IS_LABEL (text)? GOG_LABEL (text)->justification: 
GTK_JUSTIFY_LEFT),
+                                                   (GOG_IS_LABEL (text)? GOG_LABEL (text)->justification: 
GO_JUSTIFY_LEFT),
                                                    w);
                        go_string_unref (gostr);
                } else
                        gog_renderer_draw_text (view->renderer, str,
                                                &view->residual, GO_ANCHOR_NW,
                                                text->allow_markup,
-                                               (GOG_IS_LABEL (text)? GOG_LABEL (text)->justification: 
GTK_JUSTIFY_LEFT),
+                                               (GOG_IS_LABEL (text)? GOG_LABEL (text)->justification: 
GO_JUSTIFY_LEFT),
                                                w);
                g_free (str);
        }
diff --git a/goffice/graph/gog-legend.c b/goffice/graph/gog-legend.c
index 060cf86..f234300 100644
--- a/goffice/graph/gog-legend.c
+++ b/goffice/graph/gog-legend.c
@@ -524,11 +524,11 @@ cb_render_elements (unsigned index, GOStyle const *base_style, char const *name,
        if (l) {
                GOString *str = go_string_new_rich (name, -1, l, NULL);
                gog_renderer_draw_gostring (view->renderer, str, &pos,
-                                           GO_ANCHOR_W, GTK_JUSTIFY_LEFT, -1.);
+                                           GO_ANCHOR_W, GO_JUSTIFY_LEFT, -1.);
                go_string_unref (str);
        } else
                gog_renderer_draw_text (renderer, name, &pos,
-                                       GO_ANCHOR_W, FALSE, GTK_JUSTIFY_LEFT, -1.);
+                                       GO_ANCHOR_W, FALSE, GO_JUSTIFY_LEFT, -1.);
 
        if (style != base_style && style != NULL)
                g_object_unref (style);
diff --git a/goffice/graph/gog-renderer.c b/goffice/graph/gog-renderer.c
index b5c2532..99bb13b 100644
--- a/goffice/graph/gog-renderer.c
+++ b/goffice/graph/gog-renderer.c
@@ -826,12 +826,22 @@ gog_renderer_draw_marker (GogRenderer *rend, double x, double y)
 }
 
 /**
+ * GoJustification:
+ * @GO_JUSTIFY_LEFT: The text is placed at the left edge of the label.
+ * @GO_JUSTIFY_RIGHT: The text is placed at the right edge of the label.
+ * @GO_JUSTIFY_CENTER: The text is placed in the center of the label.
+ * @GO_JUSTIFY_FILL: The text is placed is distributed across the label.
+ *
+ * Used for justifying the text inside multiline label.
+ */
+
+/**
  * gog_renderer_draw_gostring:
  * @rend: #GogRenderer
  * @str: the #GOString to draw
  * @pos: #GogViewAllocation
  * @anchor: #GOAnchorType how to draw relative to @pos
- * @justification: #GtkJustification for multiline string.
+ * @justification: #GoJustification for multiline string.
  * @width: if positive, the maximum width to get a multiline string if needed.
  *
  * Have @rend draw @layout in the at @pos.{x,y} anchored by the @anchor corner.
@@ -841,7 +851,7 @@ gog_renderer_draw_marker (GogRenderer *rend, double x, double y)
 void
 gog_renderer_draw_gostring (GogRenderer *rend, GOString *str,
                            GogViewAllocation const *pos, GOAnchorType anchor,
-                            GtkJustification justification, double width)
+                            GoJustification justification, double width)
 {
        PangoLayout *layout;
        PangoContext *context;
@@ -866,16 +876,16 @@ gog_renderer_draw_gostring (GogRenderer *rend, GOString *str,
        if (width > 0)
                pango_layout_set_width (layout, width * PANGO_SCALE / rend->scale);
        switch (justification) {
-       case GTK_JUSTIFY_CENTER:
+       case GO_JUSTIFY_CENTER:
                pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
                break;
-       case GTK_JUSTIFY_LEFT:
+       case GO_JUSTIFY_LEFT:
                pango_layout_set_alignment (layout, PANGO_ALIGN_LEFT);
                break;
-       case GTK_JUSTIFY_RIGHT:
+       case GO_JUSTIFY_RIGHT:
                pango_layout_set_alignment (layout, PANGO_ALIGN_RIGHT);
                break;
-       case GTK_JUSTIFY_FILL:
+       case GO_JUSTIFY_FILL:
                pango_layout_set_justify (layout, TRUE);
                break;
        }
@@ -938,7 +948,7 @@ gog_renderer_draw_gostring (GogRenderer *rend, GOString *str,
  * @pos: #GogViewAllocation
  * @anchor: #GOAnchorType how to draw relative to @pos
  * @use_markup: wether to use pango markup
- * @justification: #GtkJustification for multiline text.
+ * @justification: #GoJustification for multiline text.
  * @width: if positive, the maximum width to get a multiline text if needed.
  *
  * Have @rend draw @text in the at @pos.{x,y} anchored by the @anchor corner.
@@ -948,7 +958,7 @@ gog_renderer_draw_gostring (GogRenderer *rend, GOString *str,
 void
 gog_renderer_draw_text (GogRenderer *rend, char const *text,
                        GogViewAllocation const *pos, GOAnchorType anchor,
-                       gboolean use_markup, GtkJustification justification,
+                       gboolean use_markup, GoJustification justification,
                         double width)
 {
        GOString *str;
diff --git a/goffice/graph/gog-renderer.h b/goffice/graph/gog-renderer.h
index ce8d5ec..542782c 100644
--- a/goffice/graph/gog-renderer.h
+++ b/goffice/graph/gog-renderer.h
@@ -79,21 +79,19 @@ void  gog_renderer_draw_selection_rectangle (GogRenderer *renderer, GogViewAlloc
 
 void  gog_renderer_draw_marker   (GogRenderer *rend, double x, double y);
 
-#ifndef GOFFICE_WITH_GTK
 typedef enum
 {
-  GTK_JUSTIFY_LEFT,
-  GTK_JUSTIFY_RIGHT,
-  GTK_JUSTIFY_CENTER,
-  GTK_JUSTIFY_FILL
-} GtkJustification;
-#endif
+  GO_JUSTIFY_LEFT,
+  GO_JUSTIFY_RIGHT,
+  GO_JUSTIFY_CENTER,
+  GO_JUSTIFY_FILL
+} GoJustification;
 
 void  gog_renderer_draw_text     (GogRenderer *rend, char const *text,
                                   GogViewAllocation const *pos,
                                   GOAnchorType anchor,
                                   gboolean use_markup,
-                                   GtkJustification justification, double width);
+                                   GoJustification justification, double width);
 
 void  gog_renderer_draw_data_label (GogRenderer *rend, GogSeriesLabelElt const *elt,
                                     GogViewAllocation const *pos, GOAnchorType anchor,
@@ -103,7 +101,7 @@ void  gog_renderer_draw_gostring  (GogRenderer *rend,
                                   GOString *str,
                                   GogViewAllocation const *pos,
                                   GOAnchorType anchor,
-                                   GtkJustification justification, double width);
+                                   GoJustification justification, double width);
 
 void  gog_renderer_get_gostring_OBR   (GogRenderer *rend, GOString *str,
                                       GOGeometryOBR *obr, double max_width);
diff --git a/plugins/plot_distrib/gog-histogram.c b/plugins/plot_distrib/gog-histogram.c
index 3b1bfd0..5730ca7 100644
--- a/plugins/plot_distrib/gog-histogram.c
+++ b/plugins/plot_distrib/gog-histogram.c
@@ -759,41 +759,41 @@ gog_histogram_plot_view_render (GogView *view, GogViewAllocation const *bbox)
                                        alloc.y = area->y + 2;
                                        gog_renderer_draw_text (view->renderer, text, &alloc,
                                                                GO_ANCHOR_NORTH_WEST, FALSE,
-                                                               GTK_JUSTIFY_LEFT, -1.);
+                                                               GO_JUSTIFY_LEFT, -1.);
                                        text = (text2)? text2: _("Second values");
                                        alloc.y = area->y + area->h - 2;
                                        gog_renderer_draw_text (view->renderer, text, &alloc,
                                                                GO_ANCHOR_SOUTH_WEST, FALSE,
-                                                               GTK_JUSTIFY_LEFT, -1.);
+                                                               GO_JUSTIFY_LEFT, -1.);
                                } else {
                                        alloc.x = area->x + area->w - 2; /* FIXME: replace 2 by something 
configurable */
                                        alloc.y = area->y + area->h - 2;
                                        gog_renderer_draw_text (view->renderer, text, &alloc,
                                                                GO_ANCHOR_SOUTH_EAST, FALSE,
-                                                               GTK_JUSTIFY_LEFT, -1.);
+                                                               GO_JUSTIFY_LEFT, -1.);
                                        text = (text2)? text2: _("Second values");
                                        alloc.x = area->x + 2;
                                        gog_renderer_draw_text (view->renderer, text, &alloc,
                                                                GO_ANCHOR_SOUTH_WEST, FALSE,
-                                                               GTK_JUSTIFY_LEFT, -1.);
+                                                               GO_JUSTIFY_LEFT, -1.);
                                }
                        } else {
                                alloc.x = area->x + area->w - 2; /* FIXME: replace 2 by something 
configurable */
                                alloc.y = area->y + 2;
                                gog_renderer_draw_text (view->renderer, text, &alloc,
                                                        GO_ANCHOR_NORTH_EAST, FALSE,
-                                                       GTK_JUSTIFY_LEFT, -1.);
+                                                       GO_JUSTIFY_LEFT, -1.);
                                text = (text2)? text2: _("Second values");
                                if (model->vertical) {
                                        alloc.y = area->y + area->h - 2;
                                        gog_renderer_draw_text (view->renderer, text, &alloc,
                                                                GO_ANCHOR_SOUTH_EAST, FALSE,
-                                                               GTK_JUSTIFY_LEFT, -1.);
+                                                               GO_JUSTIFY_LEFT, -1.);
                                } else {
                                        alloc.x = area->x + 2;
                                        gog_renderer_draw_text (view->renderer, text, &alloc,
                                                                GO_ANCHOR_NORTH_WEST, FALSE,
-                                                               GTK_JUSTIFY_LEFT, -1.);
+                                                               GO_JUSTIFY_LEFT, -1.);
                                }
                        }
                        g_free (text1);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]