Unify AgChart API, so ag_chart_get_*() that return strings are const
This commit is contained in:
parent
b7cb2410cf
commit
3f14387018
@ -403,12 +403,12 @@ ag_chart_set_name(AgChart *chart, const gchar *name)
|
|||||||
g_object_notify_by_pspec(G_OBJECT(chart), properties[PROP_NAME]);
|
g_object_notify_by_pspec(G_OBJECT(chart), properties[PROP_NAME]);
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar *
|
const gchar *
|
||||||
ag_chart_get_name(AgChart *chart)
|
ag_chart_get_name(AgChart *chart)
|
||||||
{
|
{
|
||||||
AgChartPrivate *priv = ag_chart_get_instance_private(chart);
|
AgChartPrivate *priv = ag_chart_get_instance_private(chart);
|
||||||
|
|
||||||
return g_strdup(priv->name);
|
return priv->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -425,12 +425,12 @@ ag_chart_set_country(AgChart *chart, const gchar *country)
|
|||||||
g_object_notify_by_pspec(G_OBJECT(chart), properties[PROP_COUNTRY]);
|
g_object_notify_by_pspec(G_OBJECT(chart), properties[PROP_COUNTRY]);
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar *
|
const gchar *
|
||||||
ag_chart_get_country(AgChart *chart)
|
ag_chart_get_country(AgChart *chart)
|
||||||
{
|
{
|
||||||
AgChartPrivate *priv = ag_chart_get_instance_private(chart);
|
AgChartPrivate *priv = ag_chart_get_instance_private(chart);
|
||||||
|
|
||||||
return g_strdup(priv->country);
|
return priv->country;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -447,12 +447,12 @@ ag_chart_set_city(AgChart *chart, const gchar *city)
|
|||||||
g_object_notify_by_pspec(G_OBJECT(chart), properties[PROP_CITY]);
|
g_object_notify_by_pspec(G_OBJECT(chart), properties[PROP_CITY]);
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar *
|
const gchar *
|
||||||
ag_chart_get_city(AgChart *chart)
|
ag_chart_get_city(AgChart *chart)
|
||||||
{
|
{
|
||||||
AgChartPrivate *priv = ag_chart_get_instance_private(chart);
|
AgChartPrivate *priv = ag_chart_get_instance_private(chart);
|
||||||
|
|
||||||
return g_strdup(priv->city);
|
return priv->city;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1353,6 +1353,7 @@ create_save_doc(AgChart *chart)
|
|||||||
GsweTimestamp *timestamp;
|
GsweTimestamp *timestamp;
|
||||||
GEnumClass *house_system_class;
|
GEnumClass *house_system_class;
|
||||||
GEnumValue *enum_value;
|
GEnumValue *enum_value;
|
||||||
|
AgChartPrivate *priv = ag_chart_get_instance_private(chart);
|
||||||
|
|
||||||
doc = xmlNewDoc(BAD_CAST "1.0");
|
doc = xmlNewDoc(BAD_CAST "1.0");
|
||||||
root_node = xmlNewNode(NULL, BAD_CAST "chartinfo");
|
root_node = xmlNewNode(NULL, BAD_CAST "chartinfo");
|
||||||
@ -1361,20 +1362,14 @@ create_save_doc(AgChart *chart)
|
|||||||
// Begin <data> node
|
// Begin <data> node
|
||||||
data_node = xmlNewChild(root_node, NULL, BAD_CAST "data", NULL);
|
data_node = xmlNewChild(root_node, NULL, BAD_CAST "data", NULL);
|
||||||
|
|
||||||
value = ag_chart_get_name(chart);
|
xmlNewChild(data_node, NULL, BAD_CAST "name", BAD_CAST priv->name);
|
||||||
xmlNewChild(data_node, NULL, BAD_CAST "name", BAD_CAST value);
|
|
||||||
g_free(value);
|
|
||||||
|
|
||||||
// Begin <place> node
|
// Begin <place> node
|
||||||
place_node = xmlNewChild(data_node, NULL, BAD_CAST "place", NULL);
|
place_node = xmlNewChild(data_node, NULL, BAD_CAST "place", NULL);
|
||||||
|
|
||||||
value = ag_chart_get_country(chart);
|
xmlNewChild(place_node, NULL, BAD_CAST "country", BAD_CAST priv->country);
|
||||||
xmlNewChild(place_node, NULL, BAD_CAST "country", BAD_CAST value);
|
|
||||||
g_free(value);
|
|
||||||
|
|
||||||
value = ag_chart_get_city(chart);
|
xmlNewChild(place_node, NULL, BAD_CAST "city", BAD_CAST priv->city);
|
||||||
xmlNewChild(place_node, NULL, BAD_CAST "city", BAD_CAST value);
|
|
||||||
g_free(value);
|
|
||||||
|
|
||||||
coordinates = gswe_moment_get_coordinates(GSWE_MOMENT(chart));
|
coordinates = gswe_moment_get_coordinates(GSWE_MOMENT(chart));
|
||||||
|
|
||||||
@ -1895,7 +1890,8 @@ ag_chart_set_note(AgChart *chart, const gchar *note)
|
|||||||
g_object_notify_by_pspec(G_OBJECT(chart), properties[PROP_NOTE]);
|
g_object_notify_by_pspec(G_OBJECT(chart), properties[PROP_NOTE]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const gchar *ag_chart_get_note(AgChart *chart)
|
const gchar *
|
||||||
|
ag_chart_get_note(AgChart *chart)
|
||||||
{
|
{
|
||||||
AgChartPrivate *priv = ag_chart_get_instance_private(chart);
|
AgChartPrivate *priv = ag_chart_get_instance_private(chart);
|
||||||
|
|
||||||
|
@ -70,17 +70,17 @@ void ag_chart_export_svg_to_file(AgChart *chart,
|
|||||||
void ag_chart_set_name(AgChart *chart,
|
void ag_chart_set_name(AgChart *chart,
|
||||||
const gchar *name);
|
const gchar *name);
|
||||||
|
|
||||||
gchar *ag_chart_get_name(AgChart *chart);
|
const gchar *ag_chart_get_name(AgChart *chart);
|
||||||
|
|
||||||
void ag_chart_set_country(AgChart *chart,
|
void ag_chart_set_country(AgChart *chart,
|
||||||
const gchar *country);
|
const gchar *country);
|
||||||
|
|
||||||
gchar *ag_chart_get_country(AgChart *chart);
|
const gchar *ag_chart_get_country(AgChart *chart);
|
||||||
|
|
||||||
void ag_chart_set_city(AgChart *chart,
|
void ag_chart_set_city(AgChart *chart,
|
||||||
const gchar *city);
|
const gchar *city);
|
||||||
|
|
||||||
gchar *ag_chart_get_city(AgChart *chart);
|
const gchar *ag_chart_get_city(AgChart *chart);
|
||||||
|
|
||||||
gchar *ag_chart_create_svg(AgChart *chart,
|
gchar *ag_chart_create_svg(AgChart *chart,
|
||||||
gsize *length,
|
gsize *length,
|
||||||
|
@ -720,8 +720,6 @@ ag_window_export_svg(AgWindow *window, GError **err)
|
|||||||
name = ag_chart_get_name(priv->chart);
|
name = ag_chart_get_name(priv->chart);
|
||||||
|
|
||||||
if ((name == NULL) || (*name == 0)) {
|
if ((name == NULL) || (*name == 0)) {
|
||||||
g_free(name);
|
|
||||||
|
|
||||||
ag_app_message_dialog(
|
ag_app_message_dialog(
|
||||||
GTK_WIDGET(window),
|
GTK_WIDGET(window),
|
||||||
GTK_MESSAGE_ERROR,
|
GTK_MESSAGE_ERROR,
|
||||||
@ -737,7 +735,6 @@ ag_window_export_svg(AgWindow *window, GError **err)
|
|||||||
}
|
}
|
||||||
|
|
||||||
file_name = g_strdup_printf("%s.svg", name);
|
file_name = g_strdup_printf("%s.svg", name);
|
||||||
g_free(name);
|
|
||||||
|
|
||||||
fs = gtk_file_chooser_dialog_new(_("Export Chart as SVG"),
|
fs = gtk_file_chooser_dialog_new(_("Export Chart as SVG"),
|
||||||
GTK_WINDOW(window),
|
GTK_WINDOW(window),
|
||||||
@ -813,8 +810,6 @@ ag_window_export(AgWindow *window, GError **err)
|
|||||||
name = ag_chart_get_name(priv->chart);
|
name = ag_chart_get_name(priv->chart);
|
||||||
|
|
||||||
if ((name == NULL) || (*name == 0)) {
|
if ((name == NULL) || (*name == 0)) {
|
||||||
g_free(name);
|
|
||||||
|
|
||||||
ag_app_message_dialog(
|
ag_app_message_dialog(
|
||||||
GTK_WIDGET(window),
|
GTK_WIDGET(window),
|
||||||
GTK_MESSAGE_ERROR,
|
GTK_MESSAGE_ERROR,
|
||||||
@ -830,7 +825,6 @@ ag_window_export(AgWindow *window, GError **err)
|
|||||||
}
|
}
|
||||||
|
|
||||||
file_name = g_strdup_printf("%s.agc", name);
|
file_name = g_strdup_printf("%s.agc", name);
|
||||||
g_free(name);
|
|
||||||
|
|
||||||
fs = gtk_file_chooser_dialog_new(_("Export Chart"),
|
fs = gtk_file_chooser_dialog_new(_("Export Chart"),
|
||||||
GTK_WINDOW(window),
|
GTK_WINDOW(window),
|
||||||
|
Loading…
Reference in New Issue
Block a user