/************************************************************** * custom_report_list_view_row_activated_cb * * this is the double-click signal. No need to call * get_custom_report_selection as the double-click implies the * selection. **************************************************************/ void custom_report_list_view_row_activated_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer data) { CustomReportDialog *crd = data; GtkTreeModel *model; GtkTreeIter iter; model = gtk_tree_view_get_model(view); if (gtk_tree_model_get_iter(model, &iter, path)) { if (column == crd->namecol) { GncGUID *guid = guid_malloc (); gchar *guid_str; gtk_tree_model_get(model, &iter, COL_NUM, &guid, -1); guid_str = g_new0 (gchar, GUID_ENCODING_LENGTH+1 ); guid_to_string_buff (guid, guid_str); custom_report_run_report(scm_from_utf8_string (guid_str), crd); } } }
/************************************************************** * 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); } } }