mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[gnc-budget.c] gnc_budget_get_account_period_note to be freed by the caller
This commit is contained in:
parent
9ddb9e8215
commit
c55ab50349
@ -937,7 +937,7 @@ query_tooltip_tree_view_cb (GtkWidget *widget, gint x, gint y,
|
||||
GncBudgetViewPrivate *priv = GNC_BUDGET_VIEW_GET_PRIVATE(view);
|
||||
GtkTreePath *path = NULL;
|
||||
GtkTreeViewColumn *column = NULL;
|
||||
const gchar *note;
|
||||
gchar *note;
|
||||
guint period_num;
|
||||
Account *account;
|
||||
|
||||
@ -962,6 +962,7 @@ query_tooltip_tree_view_cb (GtkWidget *widget, gint x, gint y,
|
||||
gtk_tooltip_set_text (tooltip, note);
|
||||
gtk_tree_view_set_tooltip_cell (tree_view, tooltip, path, column, NULL);
|
||||
gtk_tree_path_free (path);
|
||||
g_free (note);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1219,7 +1219,7 @@ gnc_plugin_page_budget_cmd_budget_note(GtkAction *action,
|
||||
GtkWidget *dialog, *note;
|
||||
gint result;
|
||||
GtkBuilder *builder;
|
||||
const gchar *txt;
|
||||
gchar *txt;
|
||||
GtkTreeViewColumn *col = NULL;
|
||||
GtkTreePath *path = NULL;
|
||||
guint period_num = 0;
|
||||
@ -1268,6 +1268,7 @@ gnc_plugin_page_budget_cmd_budget_note(GtkAction *action,
|
||||
note = GTK_WIDGET(gtk_builder_get_object(builder, "BudgetNote"));
|
||||
txt = gnc_budget_get_account_period_note(priv->budget, acc, period_num);
|
||||
xxxgtk_textview_set_text(GTK_TEXT_VIEW(note), txt);
|
||||
g_free (txt);
|
||||
|
||||
gtk_widget_show_all(dialog);
|
||||
result = gtk_dialog_run(GTK_DIALOG(dialog));
|
||||
|
@ -631,20 +631,23 @@ gnc_budget_set_account_period_note(GncBudget *budget, const Account *account,
|
||||
|
||||
}
|
||||
|
||||
const gchar *
|
||||
gchar *
|
||||
gnc_budget_get_account_period_note(const GncBudget *budget,
|
||||
const Account *account, guint period_num)
|
||||
{
|
||||
gchar path_part_one [GUID_ENCODING_LENGTH + 1];
|
||||
gchar path_part_two [GNC_BUDGET_MAX_NUM_PERIODS_DIGITS];
|
||||
GValue v = G_VALUE_INIT;
|
||||
gchar *retval;
|
||||
|
||||
g_return_val_if_fail(GNC_IS_BUDGET(budget), NULL);
|
||||
g_return_val_if_fail(account, NULL);
|
||||
|
||||
make_period_path (account, period_num, path_part_one, path_part_two);
|
||||
qof_instance_get_kvp (QOF_INSTANCE (budget), &v, 3, GNC_BUDGET_NOTES_PATH, path_part_one, path_part_two);
|
||||
return (G_VALUE_HOLDS_STRING(&v)) ? g_value_get_string(&v) : NULL;
|
||||
retval = G_VALUE_HOLDS_STRING (&v) ? g_value_dup_string(&v) : NULL;
|
||||
g_value_unset (&v);
|
||||
return retval;
|
||||
}
|
||||
|
||||
time64
|
||||
|
@ -156,9 +156,11 @@ gnc_numeric gnc_budget_get_account_period_value(
|
||||
gnc_numeric gnc_budget_get_account_period_actual_value(
|
||||
const GncBudget *budget, Account *account, guint period_num);
|
||||
|
||||
/* get/set the budget account period's note, beware when retrieving
|
||||
the period note, the latter must be g_freed by the caller */
|
||||
void gnc_budget_set_account_period_note(GncBudget *budget,
|
||||
const Account *account, guint period_num, const gchar *note);
|
||||
const gchar *gnc_budget_get_account_period_note(const GncBudget *budget,
|
||||
gchar *gnc_budget_get_account_period_note (const GncBudget *budget,
|
||||
const Account *account, guint period_num);
|
||||
|
||||
/* Returns some budget in the book, or NULL. */
|
||||
|
Loading…
Reference in New Issue
Block a user