r14570 - gnucash/branches/sx-cleanup/src - GncDenseCalTransientModel impl and use in sx-editor and sx-from-transaction dialog.
Joshua Sled
jsled at cvs.gnucash.org
Thu Jul 27 21:45:56 EDT 2006
Author: jsled
Date: 2006-07-27 21:45:55 -0400 (Thu, 27 Jul 2006)
New Revision: 14570
Trac: http://svn.gnucash.org/trac/changeset/14570
Modified:
gnucash/branches/sx-cleanup/src/doc/sx.rst
gnucash/branches/sx-cleanup/src/gnome-utils/gnc-dense-cal.c
gnucash/branches/sx-cleanup/src/gnome-utils/gnc-dense-cal.h
gnucash/branches/sx-cleanup/src/gnome/dialog-sx-editor.c
gnucash/branches/sx-cleanup/src/gnome/dialog-sx-from-trans.c
Log:
GncDenseCalTransientModel impl and use in sx-editor and sx-from-transaction dialog.
Modified: gnucash/branches/sx-cleanup/src/doc/sx.rst
===================================================================
--- gnucash/branches/sx-cleanup/src/doc/sx.rst 2006-07-28 01:18:03 UTC (rev 14569)
+++ gnucash/branches/sx-cleanup/src/doc/sx.rst 2006-07-28 01:45:55 UTC (rev 14570)
@@ -25,10 +25,13 @@
- gnc_dense_cal
- change number-month properties to display (width, length)
- x set_model(GncTemporalInstancesModel *mdl)
- - new interface creation.
- x register callbacks for signals
+ - [x] set_model(GncTemporalInstancesModel *mdl)
+ - [x] new interface creation.
+ - [x] register callbacks for signals
+- sx-from-trans
+ - [ ] convert to GObject, hookup destroy/finalize
+
- transaction creation
- verification routine
- variable binding/requirements.
Modified: gnucash/branches/sx-cleanup/src/gnome/dialog-sx-editor.c
===================================================================
--- gnucash/branches/sx-cleanup/src/gnome/dialog-sx-editor.c 2006-07-28 01:18:03 UTC (rev 14569)
+++ gnucash/branches/sx-cleanup/src/gnome/dialog-sx-editor.c 2006-07-28 01:45:55 UTC (rev 14570)
@@ -104,54 +104,43 @@
END_OCCUR,
} EndType;
-/* Runtime/dialog information about a particular SX. */
-typedef struct _SxRuntimeInfo
-{
- SchedXaction *sx;
- // the gnc-dense-cal mark-tag
- gint markTag;
- // which row in the GTK CList this SX is.
- gint row;
-} SxRuntimeInfo;
-
struct _GncSxEditorDialog
{
- GladeXML *gxml;
- GtkWidget *dialog;
- SchedXaction *sx;
- /* If this is a new scheduled transaction or not. */
- int newsxP;
+ GladeXML *gxml;
+ GtkWidget *dialog;
+ SchedXaction *sx;
+ /* If this is a new scheduled transaction or not. */
+ int newsxP;
- /* The various widgets in the dialog */
- GNCLedgerDisplay *ledger;
+ /* The various widgets in the dialog */
+ GNCLedgerDisplay *ledger;
- GNCFrequency *gncfreq;
- GncDenseCal *example_cal;
- GDate **cal_marks;
- gint markId;
+ GNCFrequency *gncfreq;
+ GncDenseCalTransientModel *dense_cal_model;
+ GncDenseCal *example_cal;
- GtkEditable *nameEntry;
+ GtkEditable *nameEntry;
- GtkLabel *lastOccurLabel;
+ GtkLabel *lastOccurLabel;
- GtkToggleButton *autocreateOpt;
- GtkToggleButton *notifyOpt;
- GtkToggleButton *advanceOpt;
- GtkSpinButton *advanceSpin;
- GtkToggleButton *remindOpt;
- GtkSpinButton *remindSpin;
+ GtkToggleButton *autocreateOpt;
+ GtkToggleButton *notifyOpt;
+ GtkToggleButton *advanceOpt;
+ GtkSpinButton *advanceSpin;
+ GtkToggleButton *remindOpt;
+ GtkSpinButton *remindSpin;
- GtkToggleButton *optEndDate;
- GtkToggleButton *optEndNone;
- GtkToggleButton *optEndCount;
- GtkEntry *endCountSpin;
- GtkEntry *endRemainSpin;
- GNCDateEdit *endDateEntry;
+ GtkToggleButton *optEndDate;
+ GtkToggleButton *optEndNone;
+ GtkToggleButton *optEndCount;
+ GtkEntry *endCountSpin;
+ GtkEntry *endRemainSpin;
+ GNCDateEdit *endDateEntry;
- char *sxGUIDstr;
+ char *sxGUIDstr;
- GncEmbeddedWindow *embed_window;
- GncPluginPage *plugin_page;
+ GncEmbeddedWindow *embed_window;
+ GncPluginPage *plugin_page;
};
/** Prototypes **********************************************************/
@@ -1032,7 +1021,6 @@
static void
scheduledxaction_editor_dialog_destroy(GtkObject *object, gpointer data)
{
- int i;
GncSxEditorDialog *sxed = data;
if (sxed == NULL)
@@ -1050,11 +1038,6 @@
g_free (sxed->sxGUIDstr);
sxed->sxGUIDstr = NULL;
- for ( i=0; i<(EX_CAL_NUM_MONTHS*31); i++ ) {
- g_free( sxed->cal_marks[i] );
- }
- g_free( sxed->cal_marks );
-
if ( sxed->newsxP ) {
/* FIXME: WTF???
*
@@ -1179,15 +1162,6 @@
sxed->sx = sx;
sxed->newsxP = newSX;
- /* Setup dense-cal local mark storage */
- {
- sxed->cal_marks = g_new0( GDate*, EX_CAL_NUM_MONTHS * 31 );
- for( i=0; i<(EX_CAL_NUM_MONTHS * 31); i++ ) {
- sxed->cal_marks[i] = g_date_new();
- }
- sxed->markId = -1;
- }
-
/* Setup the end-date GNC widget */
{
GtkWidget *endDateBox =
@@ -1289,8 +1263,9 @@
gtk_container_add( GTK_CONTAINER(b), GTK_WIDGET(sxed->gncfreq) );
b = GTK_BOX(glade_xml_get_widget( sxed->gxml, "example_cal_hbox" ));
- sxed->example_cal = GNC_DENSE_CAL(gnc_dense_cal_new());
- g_assert( sxed->example_cal );
+ sxed->dense_cal_model = gnc_dense_cal_transient_model_new(EX_CAL_NUM_MONTHS*31);
+ sxed->example_cal = GNC_DENSE_CAL(gnc_dense_cal_new_with_model(GNC_DENSE_CAL_MODEL(sxed->dense_cal_model)));
+ g_assert(sxed->example_cal);
gnc_dense_cal_set_num_months( sxed->example_cal, EX_CAL_NUM_MONTHS );
gnc_dense_cal_set_months_per_col( sxed->example_cal, EX_CAL_MO_PER_COL );
gtk_container_add( GTK_CONTAINER(b), GTK_WIDGET(sxed->example_cal) );
@@ -1469,8 +1444,8 @@
void
set_endgroup_toggle_states( GncSxEditorDialog *sxed, EndType type )
{
- gtk_widget_set_sensitive( GTK_WIDGET(sxed->endDateEntry), (type == END_DATE) );
- gtk_widget_set_sensitive( GTK_WIDGET(sxed->endCountSpin), (type == END_OCCUR) );
+ gtk_widget_set_sensitive( GTK_WIDGET(sxed->endDateEntry), (type == END_DATE) );
+ gtk_widget_set_sensitive( GTK_WIDGET(sxed->endCountSpin), (type == END_OCCUR) );
gtk_widget_set_sensitive( GTK_WIDGET(sxed->endRemainSpin), (type == END_OCCUR) );
}
@@ -1551,110 +1526,62 @@
void
gnc_sxed_update_cal( GncSxEditorDialog *sxed )
{
- int i;
FreqSpec *fs;
- GDate d;
- END_TYPE endType;
- GDate endDate;
- int numRemain;
+ GDate start_date;
- endType = NO_END;
- numRemain = -1;
- /* figure out the end restriction */
- if ( gtk_toggle_button_get_active( sxed->optEndDate ) ) {
- time_t tt;
- struct tm *tmpTm;
- endType = DATE_END;
- tt = gnc_date_edit_get_date( sxed->endDateEntry );
- tmpTm = g_new0( struct tm, 1 );
- *tmpTm = *(localtime( &tt ));
- g_date_set_day( &endDate, tmpTm->tm_mday );
- g_date_set_month( &endDate, tmpTm->tm_mon+1 );
- g_date_set_year( &endDate, tmpTm->tm_year + 1900 );
- g_free( tmpTm );
- } else if ( gtk_toggle_button_get_active( sxed->optEndNone ) ) {
- endType = NO_END;
- } else if ( gtk_toggle_button_get_active( sxed->optEndCount ) ) {
- endType = COUNT_END;
- numRemain =
- gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON(sxed->endRemainSpin) );
+ g_date_clear(&start_date, 1);
- } else {
- g_assert( FALSE );
- }
-
- if ( sxed->markId != -1 ) {
- // gnc_dense_cal_mark_remove( sxed->example_cal, sxed->markId );
- sxed->markId = -1;
- }
-
fs = xaccFreqSpecMalloc( gnc_get_current_book() );
- gnc_frequency_save_state( sxed->gncfreq, fs, &d );
- g_date_subtract_days( &d, 1 );
- xaccFreqSpecGetNextInstance( fs, &d, &d );
+ gnc_frequency_save_state( sxed->gncfreq, fs, &start_date );
+ g_date_subtract_days( &start_date, 1 );
+ xaccFreqSpecGetNextInstance( fs, &start_date, &start_date );
/* Deal with the fact that this SX may have been run before [the
* calendar should only show upcoming instances]... */
{
- GDate *lastInst;
+ GDate *lastInst;
- lastInst = xaccSchedXactionGetLastOccurDate( sxed->sx );
- if ( g_date_valid( lastInst )
- && g_date_valid( &d )
- && g_date_compare( lastInst, &d ) != 0 ) {
- d = *lastInst;
- xaccFreqSpecGetNextInstance( fs, &d, &d );
- }
+ lastInst = xaccSchedXactionGetLastOccurDate( sxed->sx );
+ if ( g_date_valid( lastInst )
+ && g_date_valid( &start_date )
+ && g_date_compare( lastInst, &start_date ) != 0 ) {
+ start_date = *lastInst;
+ xaccFreqSpecGetNextInstance(fs, &start_date, &start_date);
+ }
}
- if ( !g_date_valid( &d ) ) {
- /* Nothing to do. */
- xaccFreqSpecFree( fs );
- return;
+ if (!g_date_valid(&start_date))
+ {
+ /* Nothing to do. */
+ gnc_dense_cal_transient_model_clear(sxed->dense_cal_model);
+ xaccFreqSpecFree(fs);
+ return;
}
- i = 0;
- gnc_dense_cal_set_month( sxed->example_cal, g_date_get_month( &d ) );
- gnc_dense_cal_set_year( sxed->example_cal, g_date_get_year( &d ) );
- while ( (i < EX_CAL_NUM_MONTHS * 31)
- && g_date_valid( &d )
- /* Restrict based on end date */
- && ( endType == NO_END
- || ( endType == DATE_END
- && g_date_compare( &d, &endDate ) <= 0 )
- || ( endType == COUNT_END
- && i < numRemain ) ) ) {
- *(sxed->cal_marks[i++]) = d;
- xaccFreqSpecGetNextInstance( fs, &d, &d );
+ gnc_dense_cal_set_month(sxed->example_cal, g_date_get_month(&start_date));
+ gnc_dense_cal_set_year(sxed->example_cal, g_date_get_year(&start_date));
+
+ /* figure out the end restriction */
+ if (gtk_toggle_button_get_active(sxed->optEndDate))
+ {
+ GDate end_date;
+ g_date_set_time_t(&end_date, gnc_date_edit_get_date(sxed->endDateEntry));
+ gnc_dense_cal_transient_model_update_date_end(sxed->dense_cal_model, &start_date, fs, &end_date);
}
- if ( i <= 0 ) {
- xaccFreqSpecFree( fs );
- return;
+ else if (gtk_toggle_button_get_active(sxed->optEndNone))
+ {
+ gnc_dense_cal_transient_model_update_no_end(sxed->dense_cal_model, &start_date, fs);
}
-
- {
- gchar *name;
- GString *info;
-
- name = gtk_editable_get_chars( sxed->nameEntry, 0, -1 );
- if ( strlen( name ) == 0 ) {
- g_free(name);
- name = NULL;
- }
- info = g_string_sized_new( 16 );
- xaccFreqSpecGetFreqStr( fs, info );
- sxed->markId = -1;
- /*sxed->markId = gnc_dense_cal_mark( sxed->example_cal, i,
- sxed->cal_marks,
- name, info->str );*/
- gtk_widget_queue_draw( GTK_WIDGET( sxed->example_cal ) );
-
- g_string_free( info, TRUE );
- if ( name != NULL )
- {
- g_free( name );
- }
+ else if (gtk_toggle_button_get_active(sxed->optEndCount))
+ {
+ gint num_remain
+ = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sxed->endRemainSpin));
+ gnc_dense_cal_transient_model_update_count_end(sxed->dense_cal_model, &start_date, fs, num_remain);
}
+ else
+ {
+ g_assert( FALSE );
+ }
xaccFreqSpecFree( fs );
}
Modified: gnucash/branches/sx-cleanup/src/gnome/dialog-sx-from-trans.c
===================================================================
--- gnucash/branches/sx-cleanup/src/gnome/dialog-sx-from-trans.c 2006-07-28 01:18:03 UTC (rev 14569)
+++ gnucash/branches/sx-cleanup/src/gnome/dialog-sx-from-trans.c 2006-07-28 01:45:55 UTC (rev 14570)
@@ -75,8 +75,6 @@
static void sxftd_destroy( GtkWidget *w, gpointer user_data );
-typedef enum { NEVER_END, END_ON_DATE, END_AFTER_N_OCCS, BAD_END } endType;
-
typedef enum { FREQ_DAILY = 0, /* I know the =0 is redundant, but I'm using
* the numeric equivalences explicitly here
*/
@@ -94,11 +92,8 @@
Transaction *trans;
SchedXaction *sx;
+ GncDenseCalTransientModel *dense_cal_model;
GncDenseCal *example_cal;
- /** Storage for the maximum possible number of marks we could put on the
- * calendar. */
- GDate **cal_marks;
- gint mark_id;
GNCDateEdit *startDateGDE, *endDateGDE;
@@ -106,7 +101,7 @@
typedef struct
{
- endType type;
+ gdctm_end_type type;
GDate end_date;
guint n_occurrences;
} getEndTuple;
@@ -367,20 +362,16 @@
/* Setup the example calendar and related data structures. */
{
- int i;
+ int num_marks = SXFTD_EXCAL_NUM_MONTHS * 31;
w = GTK_WIDGET(glade_xml_get_widget( sxfti->gxml, SXFTD_EX_CAL_FRAME ));
- sxfti->example_cal = GNC_DENSE_CAL(gnc_dense_cal_new());
+ sxfti->dense_cal_model = gnc_dense_cal_transient_model_new(num_marks);
+ sxfti->example_cal = GNC_DENSE_CAL(gnc_dense_cal_new_with_model(GNC_DENSE_CAL_MODEL(sxfti->dense_cal_model)));
+
g_assert( sxfti->example_cal );
gnc_dense_cal_set_num_months( sxfti->example_cal, SXFTD_EXCAL_NUM_MONTHS );
gnc_dense_cal_set_months_per_col( sxfti->example_cal, SXFTD_EXCAL_MONTHS_PER_COL );
gtk_container_add( GTK_CONTAINER(w), GTK_WIDGET(sxfti->example_cal) );
-
- sxfti->mark_id = -1;
- sxfti->cal_marks = g_new0( GDate*, (SXFTD_EXCAL_NUM_MONTHS * 31) );
- for ( i=0; i < SXFTD_EXCAL_NUM_MONTHS * 31; i++ ) {
- sxfti->cal_marks[i] = g_date_new();
- }
}
/* Setup the start and end dates as GNCDateEdits */
@@ -634,14 +625,8 @@
static void
sxftd_destroy( GtkWidget *w, gpointer user_data )
{
- int i;
SXFromTransInfo *sxfti = (SXFromTransInfo*)user_data;
- for ( i=0; i<SXFTD_EXCAL_NUM_MONTHS*31; i++ ) {
- g_date_free( sxfti->cal_marks[i] );
- }
- g_free( sxfti->cal_marks );
-
if ( sxfti->sx ) {
xaccSchedXactionFree(sxfti->sx);
sxfti->sx = NULL;
@@ -694,11 +679,8 @@
struct tm *tmpTm;
time_t tmp_tt;
GDate date, startDate;
- unsigned int i;
FreqSpec *fs;
getEndTuple get;
- gchar *name;
- GString *info;
fs = xaccFreqSpecMalloc( gnc_get_current_book() );
get = sxftd_get_end_info( sxfti );
@@ -720,45 +702,27 @@
xaccFreqSpecGetNextInstance( fs, &date, &date );
startDate = date;
- i = 0;
- while ( (i < (SXFTD_EXCAL_NUM_MONTHS * 31))
- && g_date_valid( &date )
- /* Do checking against end restriction. */
- && ( ( get.type == NEVER_END )
- || ( get.type == END_ON_DATE
- && g_date_compare( &date, &(get.end_date) ) <= 0 )
- || ( get.type == END_AFTER_N_OCCS
- && i < get.n_occurrences ) ) ) {
-
- *sxfti->cal_marks[i++] = date;
- xaccFreqSpecGetNextInstance( fs, &date, &date );
+ switch (get.type)
+ {
+ case NEVER_END:
+ gnc_dense_cal_transient_model_update_no_end(sxfti->dense_cal_model, &startDate, fs);
+ break;
+ case END_ON_DATE:
+ gnc_dense_cal_transient_model_update_date_end(sxfti->dense_cal_model, &startDate, fs, &get.end_date);
+ break;
+ case END_AFTER_N_OCCS:
+ gnc_dense_cal_transient_model_update_count_end(sxfti->dense_cal_model, &startDate, fs, get.n_occurrences);
+ break;
+ default:
+ printf("unknown get.type [%d]\n", get.type);
+ break;
}
- /* remove old marks */
- if ( sxfti->mark_id != -1 ) {
- //gnc_dense_cal_mark_remove( sxfti->example_cal, sxfti->mark_id );
- sxfti->mark_id = -1;
- }
- if ( i > 0 ) {
- GtkWidget *w;
- gnc_dense_cal_set_month( sxfti->example_cal,
- g_date_get_month( &startDate ) );
- gnc_dense_cal_set_year( sxfti->example_cal,
- g_date_get_year( &startDate ) );
- w = glade_xml_get_widget( sxfti->gxml, SXFTD_NAME_ENTRY );
- name = gtk_editable_get_chars( GTK_EDITABLE(w), 0, -1 );
- info = g_string_sized_new( 16 );
- xaccFreqSpecGetFreqStr( fs, info );
- /*
- sxfti->mark_id =
- gnc_dense_cal_mark( sxfti->example_cal,
- i, sxfti->cal_marks,
- name, info->str );*/
- sxfti->mark_id = -1;
- gtk_widget_queue_draw( GTK_WIDGET(sxfti->example_cal) );
- g_free( name );
- g_string_free( info, TRUE );
- }
+ gnc_dense_cal_set_month( sxfti->example_cal,
+ g_date_get_month( &startDate ) );
+ gnc_dense_cal_set_year( sxfti->example_cal,
+ g_date_get_year( &startDate ) );
+
xaccFreqSpecFree( fs );
}
Modified: gnucash/branches/sx-cleanup/src/gnome-utils/gnc-dense-cal.c
===================================================================
--- gnucash/branches/sx-cleanup/src/gnome-utils/gnc-dense-cal.c 2006-07-28 01:18:03 UTC (rev 14569)
+++ gnucash/branches/sx-cleanup/src/gnome-utils/gnc-dense-cal.c 2006-07-28 01:45:55 UTC (rev 14570)
@@ -163,13 +163,13 @@
if (type == 0)
{
static const GTypeInfo info = {
- sizeof (GncDenseCalTransientModel),
+ sizeof (GncDenseCalTransientModelClass),
NULL, /* base_init */
NULL, /* base_finalize */
NULL, /* class_init */
NULL, /* class_finalize */
NULL, /* class_data */
- 0,
+ sizeof(GncDenseCalTransientModel),
0, /* n_preallocs */
NULL /* instance_init */
};
@@ -187,34 +187,109 @@
}
GncDenseCalTransientModel*
-gnc_dense_cal_transient_model_new(gchar *name, gchar *info, int num_marks)
+gnc_dense_cal_transient_model_new(int num_marks)
{
GncDenseCalTransientModel *model = g_object_new(GNC_TYPE_DENSE_CAL_TRANSIENT_MODEL, NULL);
- model->name = name;
- model->info = info;
model->num_marks = num_marks;
model->cal_marks = g_new0(GDate*, num_marks);
+ {
+ int i = 0;
+ for (i = 0; i < model->num_marks; i++)
+ {
+ model->cal_marks[i] = g_date_new();
+ }
+ }
+ model->num_real_marks = 0;
+ g_date_clear(&model->start_date, 1);
+ g_date_set_time_t(&model->start_date, time(NULL));
+ model->end_type = NEVER_END;
+ g_date_clear(&model->end_date, 1);
+ g_date_set_time_t(&model->end_date, time(NULL));
+ model->n_occurrences = 0;
return model;
}
void
-gnc_dense_cal_transient_model_update_no_end(GDate *start, FreqSpec *fs)
+gnc_dense_cal_transient_model_clear(GncDenseCalTransientModel *model)
{
- // emit_by_name("update");
+ model->num_real_marks = 0;
+ g_signal_emit_by_name(model, "update", GUINT_TO_POINTER(1));
}
void
-gnc_dense_cal_transient_model_update_count_end(GDate *start, FreqSpec *fs, int numOccur)
+gnc_dense_cal_transient_model_update_name(GncDenseCalTransientModel *model, gchar *name)
{
- // emit_by_name("update");
+ if (model->name != NULL)
+ {
+ g_free(model->name);
+ }
+ model->name = g_strdup(name);
+ g_signal_emit_by_name(model, "update", GUINT_TO_POINTER(1));
}
void
-gnc_dense_cal_transient_model_update_date_end(GDate *start, FreqSpec *fs, GDate *endDate)
+gnc_dense_cal_transient_model_update_info(GncDenseCalTransientModel *model, gchar *info)
{
- // emit_by_name("update");
+ if (model->info != NULL)
+ {
+ g_free(model->info);
+ }
+ model->info = g_strdup(info);
+ g_signal_emit_by_name(model, "update", GUINT_TO_POINTER(1));
}
+static void
+gdctm_generic_update(GncDenseCalTransientModel *trans, GDate *start, FreqSpec *fs)
+{
+ int i;
+ GDate date;
+
+ date = *start;
+ /* go one day before what's in the box so we can get the correct start
+ * date. */
+ g_date_subtract_days(&date, 1);
+ xaccFreqSpecGetNextInstance(fs, &date, &date);
+
+ i = 0;
+ while ((i < trans->num_marks)
+ && g_date_valid(&date)
+ /* Do checking against end restriction. */
+ && ((trans->end_type == NEVER_END)
+ || (trans->end_type == END_ON_DATE
+ && g_date_compare(&date, &trans->end_date) <= 0)
+ || (trans->end_type == END_AFTER_N_OCCS
+ && i < trans->n_occurrences)))
+ {
+ *trans->cal_marks[i++] = date;
+ xaccFreqSpecGetNextInstance(fs, &date, &date);
+ }
+ trans->num_real_marks = (i-1);
+ g_signal_emit_by_name(trans, "update", GUINT_TO_POINTER(1));
+}
+
+void
+gnc_dense_cal_transient_model_update_no_end(GncDenseCalTransientModel *model, GDate *start, FreqSpec *fs)
+{
+ model->end_type = NEVER_END;
+ gdctm_generic_update(model, start, fs);
+}
+
+void
+gnc_dense_cal_transient_model_update_count_end(GncDenseCalTransientModel *model, GDate *start, FreqSpec *fs, int num_occur)
+{
+ model->end_type = END_AFTER_N_OCCS;
+ model->n_occurrences = num_occur;
+ gdctm_generic_update(model, start, fs);
+}
+
+void
+gnc_dense_cal_transient_model_update_date_end(GncDenseCalTransientModel *model, GDate *start, FreqSpec *fs, GDate *end_date)
+{
+ model->end_type = END_ON_DATE;
+ model->end_date = *end_date;
+ gdctm_generic_update(model, start, fs);
+}
+
static GList*
gdctm_get_contained(GncDenseCalModel *model)
{
@@ -244,7 +319,7 @@
{
GncDenseCalTransientModel *mdl = GNC_DENSE_CAL_TRANSIENT_MODEL(model);
// assert(tag == 1)
- return mdl->num_marks;
+ return mdl->num_real_marks;
}
static void
Modified: gnucash/branches/sx-cleanup/src/gnome-utils/gnc-dense-cal.h
===================================================================
--- gnucash/branches/sx-cleanup/src/gnome-utils/gnc-dense-cal.h 2006-07-28 01:18:03 UTC (rev 14569)
+++ gnucash/branches/sx-cleanup/src/gnome-utils/gnc-dense-cal.h 2006-07-28 01:45:55 UTC (rev 14570)
@@ -73,25 +73,36 @@
#define GNC_IS_DENSE_CAL_TRANSIENT_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_DENSE_CAL_TRANSIENT_MODEL))
#define GNC_DENSE_CAL_TRANSIENT_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_DENSE_CAL_TRANSIENT_MODEL, GncDenseCalTransientModel))
+typedef enum { NEVER_END, END_ON_DATE, END_AFTER_N_OCCS, BAD_END } gdctm_end_type;
+
typedef struct _GncDenseCalTransientModel
{
- GObject parent;
- gchar *name;
- gchar *info;
- int num_marks;
- GDate **cal_marks;
+ GObject parent;
+
+ GDate start_date;
+ gdctm_end_type end_type;
+ GDate end_date;
+ gint n_occurrences;
+ gchar *name;
+ gchar *info;
+ int num_marks;
+ int num_real_marks;
+ GDate **cal_marks;
} GncDenseCalTransientModel;
typedef struct _GncDenseCalTransientModelClass
{
- GObjectClass parent_class;
+ GObjectClass parent_class;
} GncDenseCalTransientModelClass;
GType gnc_dense_cal_transient_model_get_type(void);
-GncDenseCalTransientModel* gnc_dense_cal_transient_model_new(gchar *name, gchar *info, int num_marks);
-void gnc_dense_cal_transient_model_update_no_end(GDate *start, FreqSpec *fs);
-void gnc_dense_cal_transient_model_update_count_end(GDate *start, FreqSpec *fs, int numOccur);
-void gnc_dense_cal_transient_model_update_date_end(GDate *start, FreqSpec *fs, GDate *endDate);
+GncDenseCalTransientModel* gnc_dense_cal_transient_model_new(int num_marks);
+void gnc_dense_cal_transient_model_clear(GncDenseCalTransientModel *model);
+void gnc_dense_cal_transient_model_update_name(GncDenseCalTransientModel *model, gchar* name);
+void gnc_dense_cal_transient_model_update_info(GncDenseCalTransientModel *model, gchar* info);
+void gnc_dense_cal_transient_model_update_no_end(GncDenseCalTransientModel *model, GDate *start, FreqSpec *fs);
+void gnc_dense_cal_transient_model_update_count_end(GncDenseCalTransientModel *model, GDate *start, FreqSpec *fs, int num_occur);
+void gnc_dense_cal_transient_model_update_date_end(GncDenseCalTransientModel *model, GDate *start, FreqSpec *fs, GDate *end_date);
/* ------------------------------------------------------------ */
More information about the gnucash-changes
mailing list