GnuCash c935c2f+
Loading...
Searching...
No Matches
Files | Functions
Reports

Files

file  dialog-custom-report.h
 This file contains the functions to present a GUI to manage custom reports.
 

Functions

void gnc_ui_custom_report (GncMainWindow *window)
 
void gnc_ui_custom_report_edit_name (GncMainWindow *window, SCM scm_guid)
 

Detailed Description

Function Documentation

◆ gnc_ui_custom_report()

void gnc_ui_custom_report ( GncMainWindow *  window)

Definition at line 623 of file dialog-custom-report.c.

624{
625 gnc_ui_custom_report_internal (window);
626}

◆ gnc_ui_custom_report_edit_name()

void gnc_ui_custom_report_edit_name ( GncMainWindow *  window,
SCM  scm_guid 
)

Definition at line 635 of file dialog-custom-report.c.

636{
637 SCM is_custom_report;
638 CustomReportDialog *crd = gnc_ui_custom_report_internal (window);
639 GtkTreeModel *model;
640 GtkTreeIter iter;
641 GncGUID *guid;
642 gchar *guid_str;
643 gboolean valid_iter;
644
645 is_custom_report = scm_c_eval_string ("gnc:report-template-is-custom/template-guid?");
646 if (scm_is_false (scm_call_1 (is_custom_report, scm_guid)))
647 return;
648
649 guid = guid_malloc ();
650 guid_str = scm_to_utf8_string (scm_guid);
651 if (!string_to_guid (guid_str, guid))
652 goto cleanup;
653
654 /* Look up the row for the requested guid */
655 model = gtk_tree_view_get_model (GTK_TREE_VIEW (crd->reportview));
656 valid_iter = gtk_tree_model_get_iter_first (model, &iter);
657
658 while (valid_iter)
659 {
660 GncGUID *row_guid;
661 gtk_tree_model_get (model, &iter, COL_NUM, &row_guid, -1);
662
663 if (guid_equal (guid, row_guid))
664 {
665 /* We found the row for the requested guid
666 * Now let's set the report's name cell in edit mode
667 * so the user can edit the name.
668 */
669 GtkTreePath *path;
670 GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (crd->reportview));
671 gtk_tree_selection_select_iter (selection, &iter);
672 path = gtk_tree_model_get_path (model, &iter);
673 g_object_set(G_OBJECT(crd->namerenderer), "editable", TRUE, NULL);
674 gtk_tree_view_set_cursor_on_cell (GTK_TREE_VIEW (crd->reportview),
675 path, crd->namecol,
676 crd->namerenderer, TRUE);
677 gtk_tree_path_free (path);
678 break;
679 }
680
681 valid_iter = gtk_tree_model_iter_next (model, &iter);
682 }
683
684cleanup:
685 guid_free (guid);
686 g_free (guid_str);
687}
gboolean guid_equal(const GncGUID *guid_1, const GncGUID *guid_2)
Given two GUIDs, return TRUE if they are non-NULL and equal.
Definition guid.cpp:237
GncGUID * guid_malloc(void)
Allocate memory for a GUID.
Definition guid.cpp:139
The type used to store guids in C.
Definition guid.h:75