X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fchart-item.c;h=3b3761372e185af855992f5c5d3a3b162e497722;hb=28e907dd4809de2c44feb9f402ab7f19660d6459;hp=227994dd219060676f218ae0ee57e565adc379d1;hpb=dfd1972f7bcb550a4fc3b05dbe7e71d12334b0a7;p=pspp diff --git a/src/output/chart-item.c b/src/output/chart-item.c index 227994dd21..3b3761372e 100644 --- a/src/output/chart-item.c +++ b/src/output/chart-item.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2004, 2009 Free Software Foundation, Inc. + Copyright (C) 2004, 2009, 2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,19 +16,22 @@ #include -#include -#include +#include "output/chart-item.h" +#include "output/chart-item-provider.h" #include #include -#include -#include -#include -#include +#include "libpspp/cast.h" +#include "libpspp/compiler.h" +#include "output/driver.h" +#include "output/output-item-provider.h" #include "gl/xalloc.h" +#include "gettext.h" +#define _(msgid) gettext (msgid) + /* Initializes ITEM as a chart item of the specified CLASS. The new chart item initially has the specified TITLE, which may be NULL if no title is yet available. The caller retains ownership of TITLE. @@ -40,9 +43,11 @@ void chart_item_init (struct chart_item *item, const struct chart_item_class *class, const char *title) { - output_item_init (&item->output_item, &chart_item_class); - item->class = class; - item->title = title != NULL ? xstrdup (title) : NULL; + *item = (struct chart_item) { + .output_item = OUTPUT_ITEM_INITIALIZER (&chart_item_class), + .class = class, + .title = title ? xstrdup (title) : NULL + }; } /* Returns ITEM's title, which is a null pointer if no title has been set. */ @@ -73,6 +78,13 @@ chart_item_submit (struct chart_item *item) output_submit (&item->output_item); } +static const char * +chart_item_get_label (const struct output_item *output_item) +{ + const struct chart_item *item = to_chart_item (output_item); + return item->title ? item->title : _("Chart"); +} + static void chart_item_destroy (struct output_item *output_item) { @@ -84,5 +96,6 @@ chart_item_destroy (struct output_item *output_item) const struct output_item_class chart_item_class = { + chart_item_get_label, chart_item_destroy, };