-static void ui_reptime_detail(GtkWidget *widget, gpointer user_data)
-{
-struct ui_reptime_data *data;
-guint active = GPOINTER_TO_INT(user_data);
-guint tmpfor, tmpslice;
-gboolean showall;
-guint32 from;
-guint i;
-GList *list;
-GtkTreeModel *model;
-GtkTreeIter iter;
-guint32 selkey;
-
- data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
-
- DB( g_print("\n[reptime] detail\n") );
-
- tmpfor = gtk_combo_box_get_active(GTK_COMBO_BOX(data->CY_for));
- tmpslice = gtk_combo_box_get_active(GTK_COMBO_BOX(data->CY_view));
- showall = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_all));
- selkey = 0;
-
- switch(tmpfor)
- {
- case FOR_REPTIME_ACCOUNT:
- selkey = ui_acc_comboboxentry_get_key(GTK_COMBO_BOX(data->PO_acc));
- break;
- case FOR_REPTIME_CATEGORY:
- selkey = ui_cat_comboboxentry_get_key(GTK_COMBO_BOX(data->PO_cat));
- break;
- case FOR_REPTIME_PAYEE:
- selkey = ui_pay_comboboxentry_get_key(GTK_COMBO_BOX(data->PO_pay));
- break;
- }
-
- //DB( g_print(" for=%d, view by=%d :: key=%d\n", tmpfor, tmpslice, selkey) );
-
- //get our min max date
- from = data->filter->mindate;
- //to = data->filter->maxdate;
-
- /* clear and detach our model */
- model = gtk_tree_view_get_model(GTK_TREE_VIEW(data->LV_detail));
- gtk_list_store_clear (GTK_LIST_STORE(model));
-
- if(data->detail)
- {
- g_object_ref(model); /* Make sure the model stays with us after the tree view unrefs it */
- gtk_tree_view_set_model(GTK_TREE_VIEW(data->LV_detail), NULL); /* Detach model from view */
-
- /* fill in the model */
- list = g_queue_peek_head_link(data->txn_queue);
- while (list != NULL)
- {
- Transaction *ope = list->data;
- guint32 pos = 0;
- gboolean include = FALSE;
-
- //DB( g_print(" get %s\n", ope->ope_Word) );
-
- switch(tmpfor)
- {
- case FOR_REPTIME_ACCOUNT:
- if( selkey == ope->kacc )
- include = TRUE;
- break;
- case FOR_REPTIME_CATEGORY:
- {
- Category *catentry;
-
- if( ope->flags & OF_SPLIT )
- {
- guint nbsplit = da_splits_count(ope->splits);
- Split *split;
-
- for(i=0;i<nbsplit;i++)
- {
- split = ope->splits[i];
- catentry = da_cat_get(split->kcat);
- if(catentry != NULL) //#1340142
- {
- if( selkey == catentry->parent || selkey == catentry->key )
- include = TRUE;
-
- }
- }
- }
- else
- {
- catentry = da_cat_get(ope->kcat);
- if(catentry != NULL) //#1340142
- {
- if( selkey == catentry->parent || selkey == catentry->key )
- include = TRUE;
-
- }
- }
- }
- break;
- case FOR_REPTIME_PAYEE:
- if( selkey == ope->kpay )
- include = TRUE;
- break;
- }
-
- if( include == TRUE || showall == TRUE )
- {
-
- switch(tmpslice)
- {
- case GROUPBY_REPTIME_DAY:
- pos = ope->date - from;
- break;
-
- case GROUPBY_REPTIME_WEEK:
- pos = (ope->date - from)/7;
- break;
-
- case GROUPBY_REPTIME_MONTH:
- pos = DateInMonth(from, ope->date);
- break;
-
- case GROUPBY_REPTIME_QUARTER:
- pos = DateInQuarter(from, ope->date);
- break;
-
- case GROUPBY_REPTIME_YEAR:
- pos = DateInYear(from, ope->date);
- break;
- }
-
- DB( g_print("** pos=%d\n", pos) );
-
- //insert
- if( pos == active )
- {
-
- gtk_list_store_append (GTK_LIST_STORE(model), &iter);
- gtk_list_store_set (GTK_LIST_STORE(model), &iter,
- LST_DSPOPE_DATAS, ope,
- -1);
- }
-
-
- }
-
- list = g_list_next(list);
- }
-
- /* Re-attach model to view */
- gtk_tree_view_set_model(GTK_TREE_VIEW(data->LV_detail), model);
- g_object_unref(model);
-
- gtk_tree_view_columns_autosize( GTK_TREE_VIEW(data->LV_detail) );
- }
-
-}