[goffice] Graph editing: allow editing as dates and times.
- From: Morten Welinder <mortenw src gnome org>
- To: svn-commits-list gnome org
- Subject: [goffice] Graph editing: allow editing as dates and times.
- Date: Thu, 21 May 2009 11:30:15 -0400 (EDT)
commit aa8fccdcf00a37ca26b1968c7f32e005082f3e9b
Author: Morten Welinder <terra gnome org>
Date: Thu May 21 10:39:34 2009 -0400
Graph editing: allow editing as dates and times.
---
ChangeLog | 19 ++++++
NEWS | 2 +
goffice/graph/goffice-graph.h | 1 +
goffice/graph/gog-axis-line.c | 44 +++++++------
goffice/graph/gog-axis.c | 121 ++++++++++++++++++++++++++++--------
goffice/graph/gog-data-allocator.c | 52 +++++++++++++++-
goffice/graph/gog-data-allocator.h | 37 ++++++++++--
goffice/graph/gog-label.c | 8 ++-
goffice/graph/gog-series.c | 3 +-
9 files changed, 230 insertions(+), 57 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4c52054..d643ae9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2009-05-21 Morten Welinder <terra gnome org>
+
+ * goffice/graph/gog-axis.c (map_time_get_dim_format): New
+ functions. Use an elapsed-time format for all dimensions.
+ (map_date_get_dim_format): New function. Use a date format for
+ minimum and maximum only.
+ (map_linear_subclass): Hook up map_time_get_dim_format and
+ map_date_get_dim_format.
+ (struct _GogAxisMapDesc): Add new get_dim_format method.
+ (set_to_auto_value): Use new gog_data_editor_set_value_double.
+ (make_dim_editor): Use format on editor.
+
+ * goffice/graph/gog-data-allocator.h (GogDataEditor): new
+ interface for the editor returned by
+ GogDataAllocatorClass::editor.
+ (GogDataAllocatorClass): use GogDataEditor* as return type for
+ editor.
+ (gog_data_allocator_editor): Ditto. All caller changed.
+
2009-05-19 Morten Welinder <terra gnome org>
* goffice/utils/go-format.c (go_format_ref, go_format_unref):
diff --git a/NEWS b/NEWS
index 1779d0e..fe87ef2 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ Andreas:
Morten:
* Add "pristine" as GODoc property.
* Properly handle date conventions in graphs.
+ * Support formatted editing of graph limits that are dates and
+ times. [#574681]
--------------------------------------------------------------------------
goffice 0.7.6:
diff --git a/goffice/graph/goffice-graph.h b/goffice/graph/goffice-graph.h
index 41dd7fc..f4ab9de 100644
--- a/goffice/graph/goffice-graph.h
+++ b/goffice/graph/goffice-graph.h
@@ -64,6 +64,7 @@ typedef struct _GogTheme GogTheme;
typedef GSList GogSeriesElementStyleList;
/* Data */
+typedef struct _GogDataEditor GogDataEditor;
typedef struct _GogDataAllocator GogDataAllocator;
typedef struct _GogDataset GogDataset;
diff --git a/goffice/graph/gog-axis-line.c b/goffice/graph/gog-axis-line.c
index 9aac5c7..a880713 100644
--- a/goffice/graph/gog-axis-line.c
+++ b/goffice/graph/gog-axis-line.c
@@ -494,26 +494,17 @@ gog_axis_base_populate_editor (GogObject *gobj,
GogDataAllocator *dalloc,
GOCmdContext *cc)
{
- static char const *toggle_props[] = {
+ static char const * const toggle_props[] = {
"major-tick-labeled",
"major-tick-out",
"major-tick-in",
"minor-tick-out",
"minor-tick-in"
};
- GogAxis *crossed_axis;
GogAxisBase *axis_base;
GladeXML *gui;
- GtkListStore *store;
- GtkTreeIter iter;
- GtkWidget *combo, *data_editor, *container, *w;
- GtkCellRenderer *cell;
- GSList *axes, *ptr;
- AxisBasePrefs *state;
GogAxisType crossed_axis_type, axis_type;
static guint axis_base_pref_page = 0;
- unsigned axis_count;
- unsigned crossed_axis_id;
unsigned i;
gboolean hide_position_box = TRUE;
@@ -539,6 +530,14 @@ gog_axis_base_populate_editor (GogObject *gobj,
crossed_axis_type = gog_axis_base_get_crossed_axis_type (axis_base);
if (crossed_axis_type != GOG_AXIS_UNKNOWN &&
axis_type != GOG_AXIS_CIRCULAR) {
+ GtkListStore *store;
+ GogDataEditor *deditor;
+ GtkWidget *combo, *container, *w;
+ GSList *axes, *ptr;
+ unsigned axis_count;
+ GtkCellRenderer *cell;
+ AxisBasePrefs *state;
+
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_UINT);
combo = glade_xml_get_widget (gui, "cross_axis_combo");
gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (store));
@@ -552,6 +551,10 @@ gog_axis_base_populate_editor (GogObject *gobj,
axes = gog_chart_get_axes (axis_base->chart, crossed_axis_type);
axis_count = 0;
for (ptr = axes; ptr != NULL; ptr = ptr->next) {
+ GtkTreeIter iter;
+ GogAxis *crossed_axis;
+ unsigned crossed_axis_id;
+
crossed_axis = GOG_AXIS (ptr->data);
crossed_axis_id = gog_object_get_id (GOG_OBJECT (crossed_axis));
gtk_list_store_prepend (store, &iter);
@@ -567,10 +570,12 @@ gog_axis_base_populate_editor (GogObject *gobj,
gtk_widget_set_sensitive (GTK_WIDGET (combo), FALSE);
g_slist_free (axes);
- data_editor = gog_data_allocator_editor (dalloc, GOG_DATASET (axis_base),
- GOG_AXIS_ELEM_CROSS_POINT, GOG_DATA_SCALAR);
+ deditor = gog_data_allocator_editor
+ (dalloc, GOG_DATASET (axis_base),
+ GOG_AXIS_ELEM_CROSS_POINT, GOG_DATA_SCALAR);
container = glade_xml_get_widget (gui, "cross_location_alignment");
- gtk_container_add (GTK_CONTAINER (container), data_editor);
+ gtk_container_add (GTK_CONTAINER (container),
+ GTK_WIDGET (deditor));
gtk_widget_show_all (container);
state = g_new (AxisBasePrefs, 1);
@@ -578,7 +583,7 @@ gog_axis_base_populate_editor (GogObject *gobj,
state->gui = gui;
g_signal_connect (G_OBJECT (combo), "changed",
G_CALLBACK (cb_cross_axis_changed), state);
- g_signal_connect (G_OBJECT (data_editor), "changed",
+ g_signal_connect (G_OBJECT (deditor), "changed",
G_CALLBACK (cb_cross_location_changed), state);
g_object_set_data_full (G_OBJECT (combo),
"state", state, (GDestroyNotify) axis_base_pref_free);
@@ -601,7 +606,7 @@ gog_axis_base_populate_editor (GogObject *gobj,
hide_position_box = FALSE;
} else {
- w = glade_xml_get_widget (gui, "cross_box");
+ GtkWidget *w = glade_xml_get_widget (gui, "cross_box");
gtk_widget_hide (w);
}
@@ -609,26 +614,25 @@ gog_axis_base_populate_editor (GogObject *gobj,
axis_type == GOG_AXIS_Y ||
axis_type == GOG_AXIS_Z ||
axis_type == GOG_AXIS_RADIAL) {
- w = glade_xml_get_widget (gui, "padding_spinbutton");
+ GtkWidget *w = glade_xml_get_widget (gui, "padding_spinbutton");
gtk_spin_button_set_value (GTK_SPIN_BUTTON (w), axis_base->padding);
g_signal_connect (G_CALLBACK (w), "value-changed",
G_CALLBACK (cb_padding_changed), axis_base);
gtk_widget_set_sensitive (w, axis_base->position != GOG_AXIS_CROSS);
hide_position_box = FALSE;
} else {
- w = glade_xml_get_widget (gui, "padding_box");
+ GtkWidget *w = glade_xml_get_widget (gui, "padding_box");
gtk_widget_hide (w);
}
if (hide_position_box) {
- w = glade_xml_get_widget (gui, "position_box");
+ GtkWidget *w = glade_xml_get_widget (gui, "position_box");
gtk_widget_hide (w);
}
for (i = 0; i < G_N_ELEMENTS (toggle_props) ; i++) {
gboolean cur_val;
-
- w = glade_xml_get_widget (gui, toggle_props[i]);
+ GtkWidget *w = glade_xml_get_widget (gui, toggle_props[i]);
g_object_get (G_OBJECT (gobj), toggle_props[i], &cur_val, NULL);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), cur_val);
g_signal_connect_object (G_OBJECT (w),
diff --git a/goffice/graph/gog-axis.c b/goffice/graph/gog-axis.c
index 1977ab2..606a1e0 100644
--- a/goffice/graph/gog-axis.c
+++ b/goffice/graph/gog-axis.c
@@ -89,7 +89,7 @@ struct _GogAxis {
double min_val, max_val;
double logical_min_val, logical_max_val;
- gpointer min_contrib, max_contrib; /* NULL means use the manual sources */
+ GogObject *min_contrib, *max_contrib; /* NULL means use the manual sources */
gboolean is_discrete;
gboolean center_on_ticks;
GOData *labels;
@@ -182,17 +182,23 @@ struct _GogAxisMapDesc {
gboolean (*init) (GogAxisMap *map, double offset, double length);
void (*destroy) (GogAxisMap *map);
- /* Refine the description, for example by picking a new auto_bound method
- based on format. */
+ /*
+ * Refine the description, for example by picking a new auto_bound
+ * method based on format.
+ */
const GogAxisMapDesc* (*subclass) (GogAxis *axis, const GogAxisMapDesc *desc);
- /* Calculate graph bounds and tick sizes based on data minimum and maximum. */
+ /*
+ * Calculate graph bounds and tick sizes based on data minimum and
+ * maximum.
+ */
void (*auto_bound) (GogAxis *axis,
double minimum, double maximum,
double *bound);
void (*calc_ticks) (GogAxis *axis);
+ GOFormat * (*get_dim_format)(GogAxis *axis, unsigned dim);
char const *name;
char const *description;
@@ -904,6 +910,37 @@ map_date_calc_ticks (GogAxis *axis)
gog_axis_set_ticks (axis, t, ticks);
}
+static GOFormat *
+map_time_get_dim_format (GogAxis *axis, unsigned dim)
+{
+ switch (dim) {
+ case GOG_AXIS_ELEM_MIN:
+ case GOG_AXIS_ELEM_MAX:
+ case GOG_AXIS_ELEM_MAJOR_TICK:
+ case GOG_AXIS_ELEM_MINOR_TICK:
+ return go_format_new_from_XL ("[hh]:mm:ss");
+
+ default:
+ return NULL;
+ }
+}
+
+static GOFormat *
+map_date_get_dim_format (GogAxis *axis, unsigned dim)
+{
+ switch (dim) {
+ case GOG_AXIS_ELEM_MIN:
+ case GOG_AXIS_ELEM_MAX:
+ return go_format_new_magic (GO_FORMAT_MAGIC_MEDIUM_DATE);
+
+ case GOG_AXIS_ELEM_MAJOR_TICK:
+ case GOG_AXIS_ELEM_MINOR_TICK:
+ /* In units of days, so default is fine. */
+ default:
+ return NULL;
+ }
+}
+
static const GogAxisMapDesc *
map_linear_subclass (GogAxis *axis, const GogAxisMapDesc *desc)
{
@@ -928,6 +965,7 @@ map_linear_subclass (GogAxis *axis, const GogAxisMapDesc *desc)
if (!map_desc_time.auto_bound) {
map_desc_time = *desc;
map_desc_time.auto_bound = map_time_auto_bound;
+ map_desc_time.get_dim_format = map_time_get_dim_format;
map_desc_time.subclass = NULL;
}
@@ -941,6 +979,7 @@ map_linear_subclass (GogAxis *axis, const GogAxisMapDesc *desc)
map_desc_date = *desc;
map_desc_date.auto_bound = map_date_auto_bound;
map_desc_date.calc_ticks = map_date_calc_ticks;
+ map_desc_date.get_dim_format = map_date_get_dim_format;
map_desc_date.subclass = NULL;
}
@@ -1216,6 +1255,7 @@ static const GogAxisMapDesc map_desc_discrete =
map_discrete_init, NULL,
NULL,
map_discrete_auto_bound, map_discrete_calc_ticks,
+ NULL,
N_("Discrete"), N_("Discrete mapping")
};
@@ -1227,6 +1267,7 @@ static const GogAxisMapDesc map_desc_linear =
map_linear_init, NULL,
map_linear_subclass,
map_linear_auto_bound, map_linear_calc_ticks,
+ NULL,
N_("Linear"), N_("Linear mapping")
};
@@ -1238,6 +1279,7 @@ static const GogAxisMapDesc map_desc_log =
map_log_init, NULL,
NULL,
map_log_auto_bound, map_log_calc_ticks,
+ NULL,
N_("Log"), N_("Logarithm mapping")
};
@@ -1609,6 +1651,17 @@ gog_axis_calc_ticks (GogAxis *axis)
}
}
+static GOFormat *
+gog_axis_get_dim_format (GogAxis *axis, unsigned dim)
+{
+ g_return_val_if_fail (GOG_IS_AXIS (axis), NULL);
+
+ if (!axis->actual_map_desc->get_dim_format)
+ return NULL;
+
+ return axis->actual_map_desc->get_dim_format (axis, dim);
+}
+
/************************************************************************/
typedef GogAxisBaseClass GogAxisClass;
@@ -1936,7 +1989,6 @@ gog_axis_update (GogObject *obj)
GogAxis *axis = GOG_AXIS (obj);
double old_min = axis->auto_bound[GOG_AXIS_ELEM_MIN];
double old_max = axis->auto_bound[GOG_AXIS_ELEM_MAX];
- GOData *labels;
GogPlotBoundInfo bounds;
gog_debug (0, g_warning ("axis::update"););
@@ -1958,8 +2010,11 @@ gog_axis_update (GogObject *obj)
bounds.fmt = NULL;
for (ptr = axis->contributors ; ptr != NULL ; ptr = ptr->next) {
- labels = gog_plot_get_axis_bounds (GOG_PLOT (ptr->data),
- axis->type, &bounds);
+ GogPlot *plot = GOG_PLOT (ptr->data);
+ GogObject *ploto = GOG_OBJECT (plot);
+ GOData *labels;
+
+ labels = gog_plot_get_axis_bounds (plot, axis->type, &bounds);
if (bounds.date_conv)
axis->date_conv = bounds.date_conv;
@@ -1970,15 +2025,15 @@ gog_axis_update (GogObject *obj)
else if (axis->labels == NULL && labels != NULL) {
g_object_ref (labels);
axis->labels = labels;
- axis->plot_that_supplied_labels = GOG_PLOT (ptr->data);
+ axis->plot_that_supplied_labels = plot;
}
axis->center_on_ticks = bounds.center_on_ticks;
if (axis->min_val > bounds.val.minima) {
axis->min_val = bounds.val.minima;
axis->logical_min_val = bounds.logical.minima;
- axis->min_contrib = ptr->data;
- } else if (axis->min_contrib == ptr->data) {
+ axis->min_contrib = ploto;
+ } else if (axis->min_contrib == ploto) {
axis->min_contrib = NULL;
axis->min_val = bounds.val.minima;
}
@@ -1986,8 +2041,8 @@ gog_axis_update (GogObject *obj)
if (axis->max_val < bounds.val.maxima) {
axis->max_val = bounds.val.maxima;
axis->logical_max_val = bounds.logical.maxima;
- axis->max_contrib = ptr->data;
- } else if (axis->max_contrib == ptr->data) {
+ axis->max_contrib = ploto;
+ } else if (axis->max_contrib == ploto) {
axis->max_contrib = NULL;
axis->max_val = bounds.val.maxima;
}
@@ -2058,15 +2113,12 @@ elem_toggle_data_free (ElemToggleData *data)
static void
set_to_auto_value (ElemToggleData *closure)
{
- double bound = GOG_AXIS (closure->set)->auto_bound[closure->dim];
-
- if (go_finite (bound) && DBL_MAX > bound && bound > -DBL_MAX) {
- char *str = g_strdup_printf ("%g", bound);
- g_object_set (closure->editor, "text", str, NULL);
- g_free (str);
- } else
- g_object_set (closure->editor, "text", "", NULL);
+ GogAxis *axis = GOG_AXIS (closure->set);
+ double bound = axis->auto_bound[closure->dim];
+ GODateConventions const *date_conv = axis->date_conv;
+ gog_data_editor_set_value_double (GOG_DATA_EDITOR (closure->editor),
+ bound, date_conv);
}
static void
@@ -2105,11 +2157,21 @@ make_dim_editor (GogDataset *set, GtkTable *table, unsigned dim,
GogDataAllocator *dalloc, char const *dim_name)
{
ElemToggleData *info;
- GtkWidget *editor = gog_data_allocator_editor (dalloc, set, dim, GOG_DATA_SCALAR);
- char *txt = g_strconcat (dim_name, ":", NULL);
- GtkWidget *toggle = gtk_check_button_new_with_mnemonic (txt);
+ GogDataEditor *deditor = gog_data_allocator_editor (dalloc, set, dim, GOG_DATA_SCALAR);
+ GtkWidget *editor = GTK_WIDGET (deditor);
+ char *txt;
+ GtkWidget *toggle;
+ GogAxis *axis = GOG_AXIS (set);
+ GOFormat const *fmt;
+
+ txt = g_strconcat (dim_name, ":", NULL);
+ toggle = gtk_check_button_new_with_mnemonic (txt);
g_free (txt);
+ fmt = gog_axis_get_dim_format (axis, dim);
+ gog_data_editor_set_format (deditor, fmt);
+ go_format_unref (fmt);
+
info = g_new0 (ElemToggleData, 1);
info->editor = editor;
info->set = set;
@@ -2544,13 +2606,22 @@ gog_axis_set_bounds (GogAxis *axis, double minimum, double maximum)
{
g_return_if_fail (GOG_IS_AXIS (axis));
+ /*
+ * ???????
+ * This sets a new dim instead of using the one embedded in the
+ * axis. Is that really right?
+ * --MW 20090515
+ */
+
if (go_finite (minimum)) {
+ GOData *data = GO_DATA (go_data_scalar_val_new (minimum));
gog_dataset_set_dim (GOG_DATASET (axis), GOG_AXIS_ELEM_MIN,
- GO_DATA (go_data_scalar_val_new (minimum)), NULL);
+ data, NULL);
}
if (go_finite (maximum)) {
+ GOData *data = GO_DATA (go_data_scalar_val_new (maximum));
gog_dataset_set_dim (GOG_DATASET (axis), GOG_AXIS_ELEM_MAX,
- GO_DATA (go_data_scalar_val_new (maximum)), NULL);
+ data, NULL);
}
}
diff --git a/goffice/graph/gog-data-allocator.c b/goffice/graph/gog-data-allocator.c
index 5b0ef17..197a7a9 100644
--- a/goffice/graph/gog-data-allocator.c
+++ b/goffice/graph/gog-data-allocator.c
@@ -68,11 +68,57 @@ gog_data_allocator_allocate (GogDataAllocator *dalloc, GogPlot *plot)
* returns: a #GtkWidget.
**/
-gpointer
+GogDataEditor *
gog_data_allocator_editor (GogDataAllocator *dalloc, GogDataset *set,
int dim_i, GogDataType data_type)
{
+ GogDataAllocatorClass *klass;
g_return_val_if_fail (GOG_IS_DATA_ALLOCATOR (dalloc), NULL);
- return GOG_DATA_ALLOCATOR_GET_CLASS (dalloc)->editor (dalloc, set,
- dim_i, data_type);
+
+ klass = GOG_DATA_ALLOCATOR_GET_CLASS (dalloc);
+ /* Extra type checks not really needed. */
+ return GOG_DATA_EDITOR
+ (GTK_WIDGET
+ (klass->editor (dalloc, set, dim_i, data_type)));
+}
+
+GType
+gog_data_editor_get_type (void)
+{
+ static GType gog_data_editor_type = 0;
+
+ if (!gog_data_editor_type) {
+ static GTypeInfo const gog_data_editor_info = {
+ sizeof (GogDataEditorClass), /* class_size */
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ };
+
+ gog_data_editor_type = g_type_register_static (G_TYPE_INTERFACE,
+ "GogDataEditor", &gog_data_editor_info, 0);
+ }
+
+ return gog_data_editor_type;
+}
+
+void
+gog_data_editor_set_format (GogDataEditor *editor, GOFormat const *fmt)
+{
+ GogDataEditorClass *klass;
+ g_return_if_fail (GOG_IS_DATA_EDITOR (editor));
+
+ klass = GOG_DATA_EDITOR_GET_CLASS (editor);
+ if (klass->set_format)
+ klass->set_format (editor, fmt);
+}
+
+void
+gog_data_editor_set_value_double (GogDataEditor *editor, double val,
+ GODateConventions const *date_conv)
+{
+ GogDataEditorClass *klass;
+ g_return_if_fail (GOG_IS_DATA_EDITOR (editor));
+
+ klass = GOG_DATA_EDITOR_GET_CLASS (editor);
+ klass->set_value_double (editor, val, date_conv);
}
diff --git a/goffice/graph/gog-data-allocator.h b/goffice/graph/gog-data-allocator.h
index 45e216d..61972b7 100644
--- a/goffice/graph/gog-data-allocator.h
+++ b/goffice/graph/gog-data-allocator.h
@@ -23,16 +23,42 @@
#define GOG_DATA_ALLOCATOR_H
#include <goffice/graph/goffice-graph.h>
+#include <goffice/utils/go-format.h>
#include <glib-object.h>
G_BEGIN_DECLS
+#define GOG_TYPE_DATA_EDITOR (gog_data_editor_get_type ())
+#define GOG_DATA_EDITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOG_TYPE_DATA_EDITOR, GogDataEditor))
+#define GOG_IS_DATA_EDITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOG_TYPE_DATA_EDITOR))
+#define GOG_DATA_EDITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GOG_TYPE_DATA_EDITOR, GogDataEditorClass))
+#define GOG_IS_DATA_EDITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOG_TYPE_DATA_EDITOR))
+#define GOG_DATA_EDITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), GOG_TYPE_DATA_EDITOR, GogDataEditorClass))
+
+GType gog_data_editor_get_type (void);
+
+typedef struct {
+ GTypeInterface base;
+
+ void (*set_format) (GogDataEditor *editor,
+ GOFormat const *fmt);
+ void (*set_value_double) (GogDataEditor *editor, double val,
+ GODateConventions const *date_conv);
+} GogDataEditorClass;
+
+void gog_data_editor_set_format (GogDataEditor *editor,
+ GOFormat const *fmt);
+void gog_data_editor_set_value_double (GogDataEditor *editor, double val,
+ GODateConventions const *date_conv);
+
+
+
typedef struct {
GTypeInterface base;
- void (*allocate) (GogDataAllocator *a, GogPlot *plot);
- gpointer (*editor) (GogDataAllocator *a, GogDataset *set,
- int dim_i, GogDataType data_type);
+ void (*allocate) (GogDataAllocator *a, GogPlot *plot);
+ GogDataEditor * (*editor) (GogDataAllocator *a, GogDataset *set,
+ int dim_i, GogDataType data_type);
} GogDataAllocatorClass;
#define GOG_TYPE_DATA_ALLOCATOR (gog_data_allocator_get_type ())
@@ -45,8 +71,9 @@ typedef struct {
GType gog_data_allocator_get_type (void);
void gog_data_allocator_allocate (GogDataAllocator *dalloc, GogPlot *plot);
-gpointer gog_data_allocator_editor (GogDataAllocator *dalloc, GogDataset *set,
- int dim_i, GogDataType data_type);
+GogDataEditor *gog_data_allocator_editor (GogDataAllocator *dalloc,
+ GogDataset *set,
+ int dim_i, GogDataType data_type);
G_END_DECLS
diff --git a/goffice/graph/gog-label.c b/goffice/graph/gog-label.c
index 7b9f256..53b8c4a 100644
--- a/goffice/graph/gog-label.c
+++ b/goffice/graph/gog-label.c
@@ -195,13 +195,15 @@ gog_label_populate_editor (GogObject *gobj,
static guint label_pref_page = 0;
GtkWidget *hbox = gtk_hbox_new (FALSE, 12);
GtkWidget *alignment = gtk_alignment_new (0, 0, 1, 0);
+ GtkWidget *editor_widget =
+ GTK_WIDGET
+ (gog_data_allocator_editor (dalloc, GOG_DATASET (gobj),
+ 0, GOG_DATA_SCALAR));
gtk_container_set_border_width (GTK_CONTAINER (alignment), 12);
gtk_box_pack_start (GTK_BOX (hbox),
gtk_label_new_with_mnemonic (_("_Text:")), FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (hbox),
- gog_data_allocator_editor (dalloc, GOG_DATASET (gobj), 0, GOG_DATA_SCALAR),
- TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), editor_widget, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (alignment), hbox);
gtk_widget_show_all (alignment);
diff --git a/goffice/graph/gog-series.c b/goffice/graph/gog-series.c
index c4bd4a6..7f4c76a 100644
--- a/goffice/graph/gog-series.c
+++ b/goffice/graph/gog-series.c
@@ -386,9 +386,10 @@ gog_series_get_property (GObject *obj, guint param_id,
#ifdef GOFFICE_WITH_GTK
static unsigned
-make_dim_editor (GtkTable *table, unsigned row, GtkWidget *editor,
+make_dim_editor (GtkTable *table, unsigned row, GogDataEditor *deditor,
char const *name, GogSeriesPriority priority, gboolean is_shared)
{
+ GtkWidget *editor = GTK_WIDGET (deditor);
char *txt = g_strdup_printf (
((priority != GOG_SERIES_REQUIRED) ? "(_%s):" : "_%s:"), _(name));
GtkWidget *label = gtk_label_new_with_mnemonic (txt);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]