/************************************************************** * custom_report_list_view_clicked_cb * * this callback is called whenever a user clicked somewhere in * the treeview widget. If the click was on an edit or delete * pictogram, the corresponding action will be executed on the * selected row. **************************************************************/ void custom_report_list_view_clicked_cb(GtkTreeView *view, GdkEventButton *event, gpointer data) { CustomReportDialog *crd = data; GtkTreePath *path = NULL; GtkTreeViewColumn *column = NULL; gint cellx, celly; g_return_if_fail ( view != NULL ); if (gtk_tree_view_get_path_at_pos (view, event->x, event->y, &path, &column, &cellx, &celly)) { if (column == crd->runcol) { SCM guid = get_custom_report_selection(crd, _("You must select a report configuration to load.")); custom_report_run_report (guid, crd); } else if (column == crd->editcol) { g_object_set(G_OBJECT(crd->namerenderer), "editable", TRUE, NULL); gtk_tree_view_set_cursor_on_cell (view, path, crd->namecol, crd->namerenderer, TRUE); } else if (column == crd->delcol) { SCM guid = get_custom_report_selection(crd, _("You must select a report configuration to delete.")); custom_report_delete (guid, crd); } } }
void custom_report_name_edited_cb(GtkCellRendererText *renderer, gchar *path, gchar *new_text, gpointer data) { CustomReportDialog *crd = data; SCM guid = get_custom_report_selection(crd, _("Unable to change report configuration name.")); SCM unique_name_func = scm_c_eval_string("gnc:report-template-has-unique-name?"); SCM new_name_scm = scm_from_utf8_string(new_text); g_object_set(G_OBJECT(crd->namerenderer), "editable", FALSE, NULL); if (scm_is_null (guid)) return; if (scm_is_true (scm_call_2 (unique_name_func, guid, new_name_scm))) custom_report_edit_report_name (guid, crd, new_text); else gnc_error_dialog (GTK_WINDOW (crd->dialog), "%s", _("A saved report configuration with this name already exists, please choose another name.") ); }