mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-07-29 23:58:03 -05:00
Added support for saving/restoring state for most/all frequency-specificaiton options.
Added start-date/frequency-specific-widget agreement. Bug fixing in since-last-run dialog and scheduled-transaction editor. Added new scheduled-transaction-related dialog [first cut, glade-only]. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4838 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
+21
-18
@@ -212,25 +212,28 @@ nr_next_clicked( GtkButton *b, gpointer ud )
|
||||
do {
|
||||
sx = (SchedXaction*)sxList->data;
|
||||
g_date_set_time( &gd, time(NULL) );
|
||||
while ( g_date_compare( &gd, endDate ) <= 0 ) {
|
||||
g_date_strftime( buf, 1023, "%c", &gd );
|
||||
/* add to clist [ahem... register... ahem] */
|
||||
rowText[0] = xaccSchedXactionGetName( sx );
|
||||
rowText[1] = malloc( sizeof(char) * 256 ); /* FIXME */
|
||||
g_date_strftime( rowText[1], 255, "%c", &gd );
|
||||
|
||||
tct = g_new0( toCreateTransaction, 1 );
|
||||
tct->sx = sx;
|
||||
tct->date = g_date_new();
|
||||
*tct->date = gd;
|
||||
tct->clistRow = row;
|
||||
sxsld->transList = g_list_append( sxsld->transList, tct );
|
||||
|
||||
gtk_clist_insert( cl, row, rowText );
|
||||
row += 1;
|
||||
|
||||
do {
|
||||
gd = xaccSchedXactionGetInstanceAfter( sx, &gd );
|
||||
}
|
||||
if ( g_date_valid( &gd ) ) {
|
||||
|
||||
g_date_strftime( buf, 1023, "%c", &gd );
|
||||
/* add to clist [ahem... register... ahem] */
|
||||
rowText[0] = xaccSchedXactionGetName( sx );
|
||||
rowText[1] = malloc( sizeof(char) * 256 ); /* FIXME */
|
||||
g_date_strftime( rowText[1], 255, "%c", &gd );
|
||||
|
||||
tct = g_new0( toCreateTransaction, 1 );
|
||||
tct->sx = sx;
|
||||
tct->date = g_date_new();
|
||||
*tct->date = gd;
|
||||
tct->clistRow = row;
|
||||
sxsld->transList = g_list_append( sxsld->transList, tct );
|
||||
|
||||
gtk_clist_insert( cl, row, rowText );
|
||||
row += 1;
|
||||
}
|
||||
} while ( g_date_compare( &gd, endDate ) <= 0
|
||||
&& g_date_valid( &gd ) );
|
||||
} while ( (sxList = sxList->next) );
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -138,7 +138,7 @@ void
|
||||
sxd_close_handler ( gpointer user_data )
|
||||
{
|
||||
SchedXactionDialog *sxd = user_data;
|
||||
DEBUG( "In sxd_close_handler\n" );
|
||||
/* FIXME: is this all we have to do? */
|
||||
gnome_dialog_close( GNOME_DIALOG( sxd->dialog ) );
|
||||
}
|
||||
|
||||
@@ -148,7 +148,6 @@ sxed_close_handler ( gpointer user_data )
|
||||
{
|
||||
SchedXactionEditorDialog *sxed = user_data;
|
||||
|
||||
DEBUG( "In sxed_close_handler\n" );
|
||||
/* FIXME: destroy, too... the ledger, especially. */
|
||||
xaccLedgerDisplayClose( sxed->ledger );
|
||||
free(sxed->sxGUIDstr);
|
||||
@@ -212,7 +211,6 @@ editor_ok_button_clicked( GtkButton *b, SchedXactionEditorDialog *sxed )
|
||||
o = glade_xml_get_widget( sxed->gxml, "end_nentry" );
|
||||
xaccSchedXactionSetNumOccur( sxed->sx,
|
||||
(gint)gnome_number_entry_get_number( GNOME_NUMBER_ENTRY(o) ) );
|
||||
/* set the end date data */
|
||||
g_date_clear( gdate, 1 );
|
||||
xaccSchedXactionSetEndDate( sxed->sx, gdate );
|
||||
} else if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(o2) ) ) {
|
||||
@@ -277,7 +275,7 @@ static void
|
||||
scheduledxaction_dialog_destroy(GtkObject *object, gpointer data)
|
||||
{
|
||||
SchedXactionDialog *sxd = data;
|
||||
DEBUG( "In scheduledxaction_dialog_destroy\n" );
|
||||
// FIXME: apporpriate destruction, here?
|
||||
if (sxd == NULL) {
|
||||
return;
|
||||
}
|
||||
@@ -294,7 +292,6 @@ scheduledxaction_editor_dialog_destroy(GtkObject *object, gpointer data)
|
||||
{
|
||||
SchedXactionEditorDialog *sxed = data;
|
||||
|
||||
DEBUG( "In scheduledxaction_editor_dialog_destroy\n" );
|
||||
if (sxed == NULL)
|
||||
return;
|
||||
|
||||
@@ -319,9 +316,10 @@ scheduledxaction_editor_dialog_destroy(GtkObject *object, gpointer data)
|
||||
SchedXactionDialog*
|
||||
gnc_ui_scheduled_xaction_dialog_create(void)
|
||||
{
|
||||
SchedXactionDialog *sxd;
|
||||
GtkObject *sxdo;
|
||||
GtkWidget *button;
|
||||
SchedXactionDialog *sxd;
|
||||
GtkObject *sxdo;
|
||||
GtkWidget *button;
|
||||
GtkWidget *clist;
|
||||
|
||||
sxd = g_new0( SchedXactionDialog, 1 );
|
||||
|
||||
@@ -358,6 +356,8 @@ gnc_ui_scheduled_xaction_dialog_create(void)
|
||||
/* turn off the cancel button, for now, as we have no way to cancel. */
|
||||
gtk_widget_set_sensitive( GTK_WIDGET(button), FALSE );
|
||||
|
||||
/* Set the clist columns to auto-resize. */
|
||||
|
||||
schedXact_populate( sxd );
|
||||
|
||||
gtk_widget_show(sxd->dialog);
|
||||
@@ -368,7 +368,7 @@ gnc_ui_scheduled_xaction_dialog_create(void)
|
||||
void
|
||||
gnc_ui_scheduled_xaction_dialog_destroy(SchedXactionDialog *sxd)
|
||||
{
|
||||
DEBUG( "In gnc_ui_scheduled_xaction_dialog_destroy\n" );
|
||||
// FIXME: appropriate destruction?
|
||||
if (sxd == NULL)
|
||||
return;
|
||||
gnc_close_gui_component_by_data (DIALOG_SCHEDXACTION_CM_CLASS, sxd);
|
||||
@@ -377,7 +377,7 @@ gnc_ui_scheduled_xaction_dialog_destroy(SchedXactionDialog *sxd)
|
||||
void
|
||||
gnc_ui_scheduled_xaction_editor_dialog_destroy(SchedXactionEditorDialog *sxed)
|
||||
{
|
||||
DEBUG( "In gnc_ui_scheduled_xaction_editor_dialog_destroy\n" );
|
||||
// FIXME: appropriate destruction?
|
||||
if (sxed == NULL)
|
||||
return;
|
||||
gnc_close_gui_component_by_data (DIALOG_SCHEDXACTION_EDITOR_CM_CLASS, sxed);
|
||||
@@ -412,12 +412,13 @@ static
|
||||
void
|
||||
schedXact_populate( SchedXactionDialog *sxd )
|
||||
{
|
||||
GNCBook *book;
|
||||
GList *sxList;
|
||||
GtkCList *sx_clist;
|
||||
FreqSpec *tmpFS;
|
||||
struct tm tmpTm;
|
||||
time_t tmpTime;
|
||||
GNCBook *book;
|
||||
GList *sxList;
|
||||
GtkCList *sx_clist;
|
||||
FreqSpec *tmpFS;
|
||||
struct tm tmpTm;
|
||||
time_t tmpTime;
|
||||
int i;
|
||||
|
||||
book = gncGetCurrentBook();
|
||||
sxList = gnc_book_get_schedxactions( book );
|
||||
@@ -425,9 +426,11 @@ schedXact_populate( SchedXactionDialog *sxd )
|
||||
g_list_foreach( sxList, putSchedXactionInClist, sxd );
|
||||
|
||||
sx_clist = GTK_CLIST( glade_xml_get_widget( sxd->gxml, "sched_xact_list" ) );
|
||||
for ( i=0; i<3; i++ ) {
|
||||
gtk_clist_set_column_auto_resize( sx_clist, i, TRUE );
|
||||
}
|
||||
gtk_signal_connect(GTK_OBJECT(sx_clist), "select-row",
|
||||
GTK_SIGNAL_FUNC(row_select_handler), sxd );
|
||||
|
||||
}
|
||||
|
||||
SchedXactionEditorDialog *
|
||||
@@ -597,8 +600,10 @@ schedXact_editor_create_freq_sel( SchedXactionEditorDialog *sxed )
|
||||
|
||||
f = GTK_FRAME( glade_xml_get_widget( sxed->gxml,
|
||||
"recur_frame" ) );
|
||||
|
||||
sxed->gncfreq =
|
||||
GNC_FREQUENCY( gnc_frequency_new( xaccSchedXactionGetFreqSpec(sxed->sx) ) );
|
||||
GNC_FREQUENCY( gnc_frequency_new( xaccSchedXactionGetFreqSpec(sxed->sx),
|
||||
xaccSchedXactionGetStartDate(sxed->sx) ) );
|
||||
if ( sxed->gncfreq == NULL ) {
|
||||
PERR( "gnc_frequency_new returned 0\n" );
|
||||
return;
|
||||
@@ -618,9 +623,7 @@ schedXact_editor_create_ledger( SchedXactionEditorDialog *sxed )
|
||||
tempxaction_frame =
|
||||
GTK_FRAME( glade_xml_get_widget( sxed->gxml,
|
||||
"tempxaction_frame" ) );
|
||||
/* FIXME: load the sxed->sx's TSplits */
|
||||
sxed->sxGUIDstr = guid_to_string( xaccSchedXactionGetGUID(sxed->sx) );
|
||||
DEBUG( "setting template gl with tag \"%s\"\n", sxed->sxGUIDstr );
|
||||
sxed->ledger = xaccLedgerDisplayTemplateGL( sxed->sxGUIDstr );
|
||||
|
||||
xaccLedgerDisplaySetHandlers( sxed->ledger,
|
||||
@@ -895,19 +898,19 @@ static
|
||||
void
|
||||
putSchedXactionInClist( gpointer data, gpointer user_data )
|
||||
{
|
||||
SchedXaction *sx;
|
||||
SchedXaction *sx;
|
||||
SchedXactionDialog *sxd;
|
||||
GtkCList *clist;
|
||||
char *text[3];
|
||||
char *tmpStr;
|
||||
GString *freqStr;
|
||||
time_t nextTime;
|
||||
GString *nextDate;
|
||||
time_t now;
|
||||
struct tm *nowTm;
|
||||
gint row;
|
||||
int i;
|
||||
GDate gd;
|
||||
GtkCList *clist;
|
||||
char *text[3];
|
||||
char *tmpStr;
|
||||
GString *freqStr;
|
||||
time_t nextTime;
|
||||
GString *nextDate;
|
||||
time_t now;
|
||||
struct tm *nowTm;
|
||||
gint row;
|
||||
int i;
|
||||
GDate gd;
|
||||
|
||||
sx = (SchedXaction*)data;
|
||||
sxd = (SchedXactionDialog*)user_data;
|
||||
@@ -915,21 +918,24 @@ putSchedXactionInClist( gpointer data, gpointer user_data )
|
||||
freqStr = g_string_new( "" );
|
||||
nextDate = g_string_new( "" );
|
||||
|
||||
xaccFreqSpecGetFreqStr( xaccSchedXactionGetFreqSpec(sx),
|
||||
freqStr );
|
||||
xaccFreqSpecGetFreqStr( xaccSchedXactionGetFreqSpec(sx), freqStr );
|
||||
|
||||
gd = xaccSchedXactionGetNextInstance( sx );
|
||||
nowTm = g_new0( struct tm, 1 );
|
||||
g_date_to_struct_tm( &gd, nowTm );
|
||||
nextTime = mktime( nowTm );
|
||||
g_free( nowTm );
|
||||
if ( nextTime == 0 ) {
|
||||
if ( ! g_date_valid( &gd ) ) {
|
||||
g_string_sprintf( nextDate, "not scheduled" );
|
||||
} else {
|
||||
tmpStr = g_new0( char, 25 );
|
||||
strftime( tmpStr, 25, "%a, %b %e, %Y", localtime(&nextTime) );
|
||||
g_string_sprintf( nextDate, "%s", tmpStr );
|
||||
g_free( tmpStr );
|
||||
g_date_to_struct_tm( &gd, nowTm );
|
||||
nextTime = mktime( nowTm );
|
||||
g_free( nowTm );
|
||||
if ( nextTime == 0 ) {
|
||||
g_string_sprintf( nextDate, "not scheduled" );
|
||||
} else {
|
||||
tmpStr = g_new0( char, 25 );
|
||||
strftime( tmpStr, 25, "%a, %b %e, %Y", localtime(&nextTime) );
|
||||
g_string_sprintf( nextDate, "%s", tmpStr );
|
||||
g_free( tmpStr );
|
||||
}
|
||||
}
|
||||
|
||||
text[0] = xaccSchedXactionGetName( sx );
|
||||
|
||||
+503
-239
@@ -27,7 +27,7 @@
|
||||
<modal>False</modal>
|
||||
<allow_shrink>False</allow_shrink>
|
||||
<allow_grow>True</allow_grow>
|
||||
<auto_shrink>False</auto_shrink>
|
||||
<auto_shrink>True</auto_shrink>
|
||||
<auto_close>False</auto_close>
|
||||
<hide_on_close>False</hide_on_close>
|
||||
|
||||
@@ -84,8 +84,8 @@
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
@@ -101,7 +101,8 @@
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox116</name>
|
||||
<name>vbox106</name>
|
||||
<border_width>5</border_width>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
@@ -111,11 +112,55 @@
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox106</name>
|
||||
<border_width>5</border_width>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox96</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label847707</name>
|
||||
<label>Name:</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>5</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<name>sxe_name</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame66</name>
|
||||
<label>Creation Options</label>
|
||||
<label_xalign>0.05</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
@@ -123,122 +168,169 @@
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox96</name>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox127</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label847707</name>
|
||||
<label>Name:</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>5</xpad>
|
||||
<ypad>0</ypad>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>manual_conf</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>. Create automatically.</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<padding>2</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<name>sxe_name</name>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>auto_create_notify</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
<label>. Notify me when created.</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<child>
|
||||
<padding>2</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>checkbutton1</name>
|
||||
<can_focus>True</can_focus>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox144</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label847789</name>
|
||||
<label>. Remind me </label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkSpinButton</class>
|
||||
<name>spinbutton1</name>
|
||||
<can_focus>True</can_focus>
|
||||
<climb_rate>1</climb_rate>
|
||||
<digits>0</digits>
|
||||
<numeric>True</numeric>
|
||||
<update_policy>GTK_UPDATE_ALWAYS</update_policy>
|
||||
<snap>True</snap>
|
||||
<wrap>True</wrap>
|
||||
<value>1</value>
|
||||
<lower>0</lower>
|
||||
<upper>100</upper>
|
||||
<step>1</step>
|
||||
<page>10</page>
|
||||
<page_size>10</page_size>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label847790</name>
|
||||
<label> days in advance.</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame47</name>
|
||||
<border_width>1</border_width>
|
||||
<label>End</label>
|
||||
<label_xalign>0.05</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox107</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>rb_noend</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>No End</label>
|
||||
<active>True</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>sx_end_opt</group>
|
||||
<child>
|
||||
<padding>2</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox98</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>2</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame66</name>
|
||||
<label>Creation Options</label>
|
||||
<label_xalign>0.05</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox127</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>manual_conf</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>Create automatically.</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>auto_create_notify</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>Notify me when created.</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame47</name>
|
||||
<border_width>1</border_width>
|
||||
<label>End</label>
|
||||
<label_xalign>0.05</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox107</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>rb_noend</name>
|
||||
<name>rb_enddate</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>No End</label>
|
||||
<active>True</active>
|
||||
<label>End Date:</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>sx_end_opt</group>
|
||||
<child>
|
||||
@@ -249,93 +341,66 @@
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox98</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<class>GnomeDateEdit</class>
|
||||
<name>sxe_end_date</name>
|
||||
<show_time>False</show_time>
|
||||
<use_24_format>True</use_24_format>
|
||||
<week_start_monday>False</week_start_monday>
|
||||
<lower_hour>7</lower_hour>
|
||||
<upper_hour>19</upper_hour>
|
||||
<child>
|
||||
<padding>2</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox99</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>2</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>rb_num_occur</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>Number of Occurances:</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>sx_end_opt</group>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>rb_enddate</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>End Date:</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>sx_end_opt</group>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GnomeDateEdit</class>
|
||||
<name>sxe_end_date</name>
|
||||
<show_time>False</show_time>
|
||||
<use_24_format>True</use_24_format>
|
||||
<week_start_monday>False</week_start_monday>
|
||||
<lower_hour>7</lower_hour>
|
||||
<upper_hour>19</upper_hour>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox99</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<class>GnomeNumberEntry</class>
|
||||
<name>end_nentry</name>
|
||||
<max_saved>10</max_saved>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
<padding>2</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>rb_num_occur</name>
|
||||
<class>GtkEntry</class>
|
||||
<child_name>GnomeEntry:entry</child_name>
|
||||
<name>combo-entry1</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>Number of Occurances:</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>sx_end_opt</group>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GnomeNumberEntry</class>
|
||||
<name>end_nentry</name>
|
||||
<max_saved>10</max_saved>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<child_name>GnomeEntry:entry</child_name>
|
||||
<name>combo-entry1</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
</widget>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
@@ -475,8 +540,8 @@
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox140</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<name>hbox145</name>
|
||||
<homogeneous>True</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
@@ -485,27 +550,38 @@
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label847774</name>
|
||||
<label>Frequency:</label>
|
||||
<justify>GTK_JUSTIFY_RIGHT</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>5</xpad>
|
||||
<ypad>0</ypad>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox140</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>freq_option</name>
|
||||
<can_focus>True</can_focus>
|
||||
<items>None
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label847774</name>
|
||||
<label>Frequency:</label>
|
||||
<justify>GTK_JUSTIFY_RIGHT</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>5</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>freq_option</name>
|
||||
<can_focus>True</can_focus>
|
||||
<items>None
|
||||
Once
|
||||
Daily
|
||||
Daily [M-F]
|
||||
@@ -518,57 +594,58 @@ Tri-Anually
|
||||
Semi-Yearly
|
||||
Yearly
|
||||
</items>
|
||||
<initial_choice>0</initial_choice>
|
||||
<initial_choice>0</initial_choice>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox141</name>
|
||||
<border_width>2</border_width>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox141</name>
|
||||
<border_width>2</border_width>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label847775</name>
|
||||
<label>Start Date:</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>5</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label847775</name>
|
||||
<label>Start Date:</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>5</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GnomeDateEdit</class>
|
||||
<name>sxe_start_date</name>
|
||||
<show_time>False</show_time>
|
||||
<use_24_format>True</use_24_format>
|
||||
<week_start_monday>False</week_start_monday>
|
||||
<lower_hour>7</lower_hour>
|
||||
<upper_hour>19</upper_hour>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
<widget>
|
||||
<class>GnomeDateEdit</class>
|
||||
<name>sxe_start_date</name>
|
||||
<show_time>False</show_time>
|
||||
<use_24_format>True</use_24_format>
|
||||
<week_start_monday>False</week_start_monday>
|
||||
<lower_hour>7</lower_hour>
|
||||
<upper_hour>19</upper_hour>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@@ -2787,4 +2864,191 @@ December
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GnomeDialog</class>
|
||||
<name>real since-last-run dialog</name>
|
||||
<title>Since Last Run...</title>
|
||||
<type>GTK_WINDOW_TOPLEVEL</type>
|
||||
<position>GTK_WIN_POS_CENTER</position>
|
||||
<modal>False</modal>
|
||||
<allow_shrink>True</allow_shrink>
|
||||
<allow_grow>True</allow_grow>
|
||||
<auto_shrink>True</auto_shrink>
|
||||
<auto_close>False</auto_close>
|
||||
<hide_on_close>False</hide_on_close>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<child_name>GnomeDialog:vbox</child_name>
|
||||
<name>dialog-vbox20</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>8</spacing>
|
||||
<child>
|
||||
<padding>4</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHButtonBox</class>
|
||||
<child_name>GnomeDialog:action_area</child_name>
|
||||
<name>dialog-action_area20</name>
|
||||
<layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style>
|
||||
<spacing>8</spacing>
|
||||
<child_min_width>85</child_min_width>
|
||||
<child_min_height>27</child_min_height>
|
||||
<child_ipad_x>7</child_ipad_x>
|
||||
<child_ipad_y>0</child_ipad_y>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
<pack>GTK_PACK_END</pack>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>button1</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>button2</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<stock_button>GNOME_STOCK_BUTTON_APPLY</stock_button>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>button3</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox129</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame67</name>
|
||||
<label>Auto-created, notification requested...</label>
|
||||
<label_xalign>0.1</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkScrolledWindow</class>
|
||||
<name>scrolledwindow4</name>
|
||||
<hscrollbar_policy>GTK_POLICY_ALWAYS</hscrollbar_policy>
|
||||
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
|
||||
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
|
||||
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
|
||||
|
||||
<widget>
|
||||
<class>GtkCList</class>
|
||||
<name>clist1</name>
|
||||
<can_focus>True</can_focus>
|
||||
<columns>3</columns>
|
||||
<column_widths>80,80,80</column_widths>
|
||||
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
|
||||
<show_titles>True</show_titles>
|
||||
<shadow_type>GTK_SHADOW_IN</shadow_type>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<child_name>CList:title</child_name>
|
||||
<name>label847791</name>
|
||||
<label>label847791</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<child_name>CList:title</child_name>
|
||||
<name>label847792</name>
|
||||
<label>label847792</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<child_name>CList:title</child_name>
|
||||
<name>label847793</name>
|
||||
<label>label847793</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame68</name>
|
||||
<label>To-create...</label>
|
||||
<label_xalign>0.1</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>Placeholder</class>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame69</name>
|
||||
<label>Reminders</label>
|
||||
<label_xalign>0.1</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>Placeholder</class>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
</GTK-Interface>
|
||||
|
||||
@@ -7,8 +7,10 @@
|
||||
gchar *s = N_("Edit Scheduled Transaction");
|
||||
gchar *s = N_("Name:");
|
||||
gchar *s = N_("Creation Options");
|
||||
gchar *s = N_("Create automatically.");
|
||||
gchar *s = N_("Notify me when created.");
|
||||
gchar *s = N_(". Create automatically.");
|
||||
gchar *s = N_(". Notify me when created.");
|
||||
gchar *s = N_(". Remind me ");
|
||||
gchar *s = N_(" days in advance.");
|
||||
gchar *s = N_("End");
|
||||
gchar *s = N_("No End");
|
||||
gchar *s = N_("End Date:");
|
||||
@@ -347,3 +349,10 @@ gchar *s = N_("Date");
|
||||
gchar *s = N_("Variable");
|
||||
gchar *s = N_("Value");
|
||||
gchar *s = N_("What should this be?");
|
||||
gchar *s = N_("Since Last Run...");
|
||||
gchar *s = N_("Auto-created, notification requested...");
|
||||
gchar *s = N_("label847791");
|
||||
gchar *s = N_("label847792");
|
||||
gchar *s = N_("label847793");
|
||||
gchar *s = N_("To-create...");
|
||||
gchar *s = N_("Reminders");
|
||||
|
||||
+423
-276
@@ -21,6 +21,7 @@
|
||||
* *
|
||||
\********************************************************************/
|
||||
|
||||
#include <math.h>
|
||||
#include "config.h"
|
||||
|
||||
#include <time.h>
|
||||
@@ -54,13 +55,25 @@ static void free_resources( GtkObject *o, gpointer d );
|
||||
|
||||
static void freq_option_value_changed( GtkMenuShell *b, gpointer d );
|
||||
static void start_date_changed( GnomeDateEdit *gde, gpointer d );
|
||||
|
||||
static void spin_changed_helper( GtkAdjustment *adj, gpointer d );
|
||||
|
||||
static void weekly_days_changed( GtkButton *b, gpointer d );
|
||||
|
||||
static void monthly_sel_changed( GtkButton *b, gpointer d );
|
||||
static void semimonthly_sel_changed( GtkButton *b, gpointer d );
|
||||
static void yearly_sel_changed( GtkButton *b, gpointer d );
|
||||
static void quarterly_sel_changed( GtkButton *b, gpointer d );
|
||||
static void triyearly_sel_changed( GtkButton *b, gpointer d );
|
||||
static void semiyearly_sel_changed( GtkButton *b, gpointer d );
|
||||
|
||||
static void year_range_sels_changed( GNCFrequency *gf,
|
||||
int monthsInRange,
|
||||
GtkWidget *occurW,
|
||||
GtkWidget *dayOfMonthW );
|
||||
static void year_range_menu_helper( GtkWidget *dayOptMenu,
|
||||
GtkWidget *occurOptMenu,
|
||||
gint monthsInRange,
|
||||
time_t startDate );
|
||||
|
||||
/** Static Inits ********************/
|
||||
|
||||
@@ -140,6 +153,7 @@ gnc_frequency_init( GNCFrequency *gf )
|
||||
GtkVBox *vb;
|
||||
GtkWidget *o, *win;
|
||||
GtkAdjustment *adj;
|
||||
struct tm *tmpTm;
|
||||
|
||||
static char *cals[] = {
|
||||
"daily_cal",
|
||||
@@ -158,12 +172,12 @@ gnc_frequency_init( GNCFrequency *gf )
|
||||
{ "semimonthly_first", semimonthly_sel_changed },
|
||||
{ "semimonthly_second", semimonthly_sel_changed },
|
||||
{ "monthly_day", monthly_sel_changed },
|
||||
{ "quarterly_occur", NULL },
|
||||
{ "quarterly_day", NULL },
|
||||
{ "triyearly_occur", NULL },
|
||||
{ "triyearly_day", NULL },
|
||||
{ "semiyearly_occur", NULL },
|
||||
{ "semiyearly_day", NULL },
|
||||
{ "quarterly_occur", quarterly_sel_changed },
|
||||
{ "quarterly_day", quarterly_sel_changed },
|
||||
{ "triyearly_occur", triyearly_sel_changed },
|
||||
{ "triyearly_day", triyearly_sel_changed },
|
||||
{ "semiyearly_occur", semiyearly_sel_changed },
|
||||
{ "semiyearly_day", semiyearly_sel_changed },
|
||||
{ "yearly_month", yearly_sel_changed },
|
||||
{ "yearly_day", yearly_sel_changed },
|
||||
{ NULL, NULL }
|
||||
@@ -227,6 +241,13 @@ gnc_frequency_init( GNCFrequency *gf )
|
||||
}
|
||||
}
|
||||
|
||||
/* initialize the weekly::day-of-week checkbox-selection hooks */
|
||||
for ( i=0; i<7; i++ ) {
|
||||
o = glade_xml_get_widget( gf->gxml, CHECKBOX_NAMES[i] );
|
||||
gtk_signal_connect( GTK_OBJECT(o), "clicked",
|
||||
GTK_SIGNAL_FUNC(weekly_days_changed), gf );
|
||||
}
|
||||
|
||||
gtk_widget_show_all( GTK_WIDGET(&gf->widget) );
|
||||
|
||||
/* respond to start date changes */
|
||||
@@ -236,28 +257,28 @@ gnc_frequency_init( GNCFrequency *gf )
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gnc_frequency_new( FreqSpec *fs )
|
||||
gnc_frequency_new( FreqSpec *fs, GDate *startDate )
|
||||
{
|
||||
GNCFrequency *toRet;
|
||||
toRet = gtk_type_new( gnc_frequency_get_type() );
|
||||
gnc_frequency_setup( toRet, fs );
|
||||
gnc_frequency_setup( toRet, fs, startDate );
|
||||
return GTK_WIDGET(toRet);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_frequency_setup( GNCFrequency *gf, FreqSpec *fs )
|
||||
gnc_frequency_setup( GNCFrequency *gf, FreqSpec *fs, GDate *startDate )
|
||||
{
|
||||
UIFreqType uift;
|
||||
int page;
|
||||
time_t tmpTT;
|
||||
struct tm *tmpTm;
|
||||
GtkWidget *o;
|
||||
FreqSpec *subFS;
|
||||
GList *list;
|
||||
int tmpInt;
|
||||
int i;
|
||||
int idx;
|
||||
char *str;
|
||||
UIFreqType uift;
|
||||
int page;
|
||||
time_t tmpTT;
|
||||
struct tm *tmpTm = NULL;
|
||||
GtkWidget *o;
|
||||
FreqSpec *subFS;
|
||||
GList *list;
|
||||
int tmpInt;
|
||||
int i;
|
||||
int idx;
|
||||
char *str;
|
||||
|
||||
page = 0;
|
||||
if ( fs != NULL ) {
|
||||
@@ -283,159 +304,242 @@ gnc_frequency_setup( GNCFrequency *gf, FreqSpec *fs )
|
||||
return;
|
||||
}
|
||||
|
||||
// setup the start date
|
||||
if ( ! g_date_valid(startDate) ) {
|
||||
tmpTT = time(NULL);
|
||||
} else {
|
||||
tmpTm = g_new0( struct tm, 1 );
|
||||
g_date_to_struct_tm( startDate, tmpTm );
|
||||
tmpTT = mktime( tmpTm );
|
||||
g_free( tmpTm );
|
||||
}
|
||||
gnome_date_edit_set_time( gf->startDate, tmpTT );
|
||||
|
||||
switch ( uift ) {
|
||||
case UIFREQ_NONE:
|
||||
break;
|
||||
case UIFREQ_ONCE:
|
||||
/* set the date */
|
||||
|
||||
#if 0
|
||||
tmpTT = fs->specData.dateAnchor[0];
|
||||
#endif /* 0 */
|
||||
tmpTT = 0;
|
||||
if ( tmpTT == 0 ) {
|
||||
tmpTT = time(NULL);
|
||||
}
|
||||
tmpTm = gmtime( &tmpTT );
|
||||
o = glade_xml_get_widget( gf->gxml, "once_cal" );
|
||||
gtk_calendar_select_month( GTK_CALENDAR(o),
|
||||
tmpTm->tm_year+1900,
|
||||
tmpTm->tm_mon );
|
||||
gtk_calendar_select_day( GTK_CALENDAR(o),
|
||||
tmpTm->tm_mday );
|
||||
break;
|
||||
{
|
||||
GDate theDate;
|
||||
tmpTm = g_new0( struct tm, 1 );
|
||||
/* set the date */
|
||||
if ( xaccFreqSpecGetOnce( fs, &theDate ) < 0 ) {
|
||||
PERR( "Inappropriate FreqSpec type\n" );
|
||||
return;
|
||||
}
|
||||
g_date_to_struct_tm( &theDate, tmpTm );
|
||||
gnome_date_edit_set_time( gf->startDate, mktime(tmpTm) );
|
||||
g_free( tmpTm );
|
||||
}
|
||||
break;
|
||||
case UIFREQ_DAILY:
|
||||
/* set the mult */
|
||||
o = glade_xml_get_widget( gf->gxml, "daily_spin" );
|
||||
#if 0
|
||||
gtk_spin_button_set_value( GTK_SPIN_BUTTON( o ),
|
||||
fs->specData.dateAnchor[0] );
|
||||
#endif /* 0 */
|
||||
|
||||
o = glade_xml_get_widget( gf->gxml, "daily_cal" );
|
||||
update_cal( gf, GTK_CALENDAR(o) );
|
||||
break;
|
||||
{
|
||||
int dailyMult = -1;
|
||||
if ( xaccFreqSpecGetDaily( fs, &dailyMult ) < 0 ) {
|
||||
PERR( "Inappropriate FreqSpec type\n" );
|
||||
return;
|
||||
}
|
||||
o = glade_xml_get_widget( gf->gxml, "daily_spin" );
|
||||
gtk_spin_button_set_value( GTK_SPIN_BUTTON( o ), dailyMult );
|
||||
}
|
||||
break;
|
||||
case UIFREQ_DAILY_MF:
|
||||
/* FIXME */
|
||||
/* set the mult */
|
||||
break;
|
||||
case UIFREQ_WEEKLY:
|
||||
tmpInt = -1;
|
||||
list = xaccFreqSpecCompositeGet( fs );
|
||||
do {
|
||||
subFS = (FreqSpec*)(list->data);
|
||||
if ( tmpInt == -1 ) {
|
||||
#if 0
|
||||
tmpInt = subFS->specData.dateAnchor[0];
|
||||
#endif /* 0 */
|
||||
}
|
||||
#if 0
|
||||
str = CHECKBOX_NAMES[subFS->specData.dateAnchor[1]];
|
||||
#endif /* 0 */
|
||||
str = "Monday";
|
||||
o = glade_xml_get_widget( gf->gxml, str );
|
||||
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(o), TRUE );
|
||||
} while ( (list = g_list_next(list)) );
|
||||
o = glade_xml_get_widget( gf->gxml, "weekly_spin" );
|
||||
gtk_spin_button_set_value( GTK_SPIN_BUTTON(o), tmpInt );
|
||||
o = glade_xml_get_widget( gf->gxml, "weekly_cal" );
|
||||
update_cal( gf, GTK_CALENDAR(o) );
|
||||
break;
|
||||
case UIFREQ_BI_WEEKLY:
|
||||
/* set the initial date...? */
|
||||
break;
|
||||
case UIFREQ_SEMI_MONTHLY:
|
||||
list = xaccFreqSpecCompositeGet( fs );
|
||||
/* mult */
|
||||
o = glade_xml_get_widget( gf->gxml, "semimonthly_spin" );
|
||||
subFS = (FreqSpec*)(g_list_nth( list, 0 )->data);
|
||||
#if 0
|
||||
gtk_spin_button_set_value( GTK_SPIN_BUTTON(o),
|
||||
subFS->specData.dateAnchor[0] );
|
||||
#endif /* 0 */
|
||||
/* first date */
|
||||
o = glade_xml_get_widget( gf->gxml, "semimonthly_first" );
|
||||
#if 0
|
||||
gtk_option_menu_set_history( GTK_OPTION_MENU(o),
|
||||
subFS->specData.dateAnchor[1]-1 );
|
||||
#endif /* 0 */
|
||||
/* second date */
|
||||
subFS = (FreqSpec*)(g_list_nth( list, 1 )->data);
|
||||
o = glade_xml_get_widget( gf->gxml, "semimonthly_second" );
|
||||
#if 0
|
||||
gtk_option_menu_set_history( GTK_OPTION_MENU(o),
|
||||
subFS->specData.dateAnchor[1]-1 );
|
||||
#endif /* 0 */
|
||||
{
|
||||
GList *fsList;
|
||||
FreqSpec *subFS;
|
||||
int weekMult, dayOfWeek;
|
||||
|
||||
o = glade_xml_get_widget( gf->gxml, "semimonthly_cal" );
|
||||
update_cal( gf, GTK_CALENDAR(o) );
|
||||
break;
|
||||
/* set the mult */
|
||||
fsList = xaccFreqSpecCompositeGet( fs );
|
||||
if ( g_list_length( fsList ) != 5 ) {
|
||||
PERR( "Invalid Daily[M-F] FreqSpec" );
|
||||
return;
|
||||
}
|
||||
subFS = (FreqSpec*)fsList->data;
|
||||
if ( xaccFreqSpecGetWeekly( subFS, &weekMult, &dayOfWeek ) < 0 ) {
|
||||
PERR( "Invalid FreqSpec type" );
|
||||
return;
|
||||
}
|
||||
o = glade_xml_get_widget( gf->gxml, "dailymf_spin" );
|
||||
gtk_spin_button_set_value( GTK_SPIN_BUTTON(o), weekMult );
|
||||
}
|
||||
break;
|
||||
case UIFREQ_WEEKLY:
|
||||
{
|
||||
int weeklyMult = -1;
|
||||
int dayOfWeek;
|
||||
int count = 0;
|
||||
|
||||
list = xaccFreqSpecCompositeGet( fs );
|
||||
do {
|
||||
subFS = (FreqSpec*)(list->data);
|
||||
if ( weeklyMult == -1 ) {
|
||||
if ( subFS == NULL ) {
|
||||
PERR( "subFS is null\n" );
|
||||
return;
|
||||
}
|
||||
if ( xaccFreqSpecGetWeekly( subFS, &weeklyMult, &dayOfWeek ) < 0 ) {
|
||||
PERR( "Inappropriate FreqSpec type\n" );
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
int otherWeeklyMult = -1;
|
||||
|
||||
if ( subFS == NULL ) {
|
||||
PERR( "subFS is null\n" );
|
||||
return;
|
||||
}
|
||||
if ( xaccFreqSpecGetWeekly( subFS, &otherWeeklyMult, &dayOfWeek ) < 0 ) {
|
||||
PERR( "Inappropriate FreqSpec type\n" );
|
||||
return;
|
||||
}
|
||||
if ( weeklyMult != otherWeeklyMult ) {
|
||||
PERR( "Inconsistent weekly FreqSpec multipliers seen [first: %d vs. other: %d]\n",
|
||||
weeklyMult, otherWeeklyMult );
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ( dayOfWeek > 6 ) {
|
||||
PERR( "dayOfWeek > 6 [%d]", dayOfWeek );
|
||||
return;
|
||||
}
|
||||
str = CHECKBOX_NAMES[dayOfWeek];
|
||||
o = glade_xml_get_widget( gf->gxml, str );
|
||||
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(o), TRUE );
|
||||
} while ( (list = g_list_next(list)) );
|
||||
o = glade_xml_get_widget( gf->gxml, "weekly_spin" );
|
||||
gtk_spin_button_set_value( GTK_SPIN_BUTTON(o), weeklyMult );
|
||||
}
|
||||
break;
|
||||
case UIFREQ_BI_WEEKLY:
|
||||
/* set the initial date...? */
|
||||
break;
|
||||
case UIFREQ_SEMI_MONTHLY:
|
||||
{
|
||||
int monthlyMult;
|
||||
int firstDayOfMonth, secondDayOfMonth, monthOffset;
|
||||
list = xaccFreqSpecCompositeGet( fs );
|
||||
/* mult */
|
||||
o = glade_xml_get_widget( gf->gxml, "semimonthly_spin" );
|
||||
subFS = (FreqSpec*)(g_list_nth( list, 0 )->data);
|
||||
if ( xaccFreqSpecGetMonthly( subFS, &monthlyMult,
|
||||
&firstDayOfMonth, &monthOffset ) < 0 ) {
|
||||
PERR( "Inappropriate FreqSpec type\n" );
|
||||
return;
|
||||
}
|
||||
gtk_spin_button_set_value( GTK_SPIN_BUTTON(o), monthlyMult );
|
||||
/* first date */
|
||||
o = glade_xml_get_widget( gf->gxml, "semimonthly_first" );
|
||||
gtk_option_menu_set_history( GTK_OPTION_MENU(o), firstDayOfMonth-1 );
|
||||
/* second date */
|
||||
subFS = (FreqSpec*)(g_list_nth( list, 1 )->data);
|
||||
o = glade_xml_get_widget( gf->gxml, "semimonthly_second" );
|
||||
if ( xaccFreqSpecGetMonthly( subFS, &monthlyMult,
|
||||
&secondDayOfMonth, &monthOffset ) < 0 ) {
|
||||
PERR( "Inappropriate FreqSpec type\n" );
|
||||
return;
|
||||
}
|
||||
gtk_option_menu_set_history( GTK_OPTION_MENU(o), secondDayOfMonth-1 );
|
||||
}
|
||||
break;
|
||||
case UIFREQ_MONTHLY:
|
||||
/* set the mult */
|
||||
o = glade_xml_get_widget( gf->gxml, "monthly_spin" );
|
||||
|
||||
#if 0
|
||||
gtk_spin_button_set_value( GTK_SPIN_BUTTON(o),
|
||||
fs->specData.dateAnchor[0] );
|
||||
#endif /* 0 */
|
||||
o = glade_xml_get_widget( gf->gxml, "monthly_day" );
|
||||
#if 0
|
||||
gtk_option_menu_set_history( GTK_OPTION_MENU(o),
|
||||
fs->specData.dateAnchor[1]-1 );
|
||||
#endif /* 0 */
|
||||
/* set the day-of-month */
|
||||
update_cal( gf, GTK_CALENDAR(o) );
|
||||
break;
|
||||
{
|
||||
int monthlyMult, dayOfMonth, monthOffset;
|
||||
if ( xaccFreqSpecGetMonthly( fs, &monthlyMult,
|
||||
&dayOfMonth, &monthOffset ) < 0 ) {
|
||||
PERR( "Inappropriate FreqSpec type" );
|
||||
return;
|
||||
}
|
||||
o = glade_xml_get_widget( gf->gxml, "monthly_spin" );
|
||||
gtk_spin_button_set_value( GTK_SPIN_BUTTON(o), monthlyMult );
|
||||
o = glade_xml_get_widget( gf->gxml, "monthly_day" );
|
||||
gtk_option_menu_set_history( GTK_OPTION_MENU(o), dayOfMonth-1 );
|
||||
/* set the day-of-month */
|
||||
}
|
||||
break;
|
||||
case UIFREQ_QUARTERLY:
|
||||
o = glade_xml_get_widget( gf->gxml, "quarterly_occur" );
|
||||
/* FIXME: based off the start date? */
|
||||
o = glade_xml_get_widget( gf->gxml, "quarterly_day" );
|
||||
#if 0
|
||||
gtk_option_menu_set_history( GTK_OPTION_MENU(o),
|
||||
fs->specData.dateAnchor[1]-1 );
|
||||
#endif /* 0 */
|
||||
break;
|
||||
{
|
||||
int monthlyMult, month, dayOfMonth, monthOffset;
|
||||
|
||||
if ( xaccFreqSpecGetMonthly( fs, &monthlyMult,
|
||||
&dayOfMonth, &monthOffset ) < 0 ) {
|
||||
PERR( "Inappropriate FreqSpec type" );
|
||||
return;
|
||||
}
|
||||
if ( monthlyMult != 3 ) {
|
||||
PERR( "monthly multiplier != 3 [=%d]", monthlyMult );
|
||||
return;
|
||||
}
|
||||
year_range_menu_helper( glade_xml_get_widget( gf->gxml, "quarterly_day" ),
|
||||
glade_xml_get_widget( gf->gxml, "quarterly_occur" ),
|
||||
3, gnome_date_edit_get_date( gf->startDate ) );
|
||||
}
|
||||
break;
|
||||
case UIFREQ_TRI_ANUALLY:
|
||||
o = glade_xml_get_widget( gf->gxml, "triyearly_occur" );
|
||||
/* FIXME: based off the start date */
|
||||
o = glade_xml_get_widget( gf->gxml, "triyearly_day" );
|
||||
#if 0
|
||||
gtk_option_menu_set_history( GTK_OPTION_MENU(o),
|
||||
fs->specData.dateAnchor[1]-1 );
|
||||
#endif /* 0 */
|
||||
break;
|
||||
{
|
||||
int monthlyMult, dayOfMonth, monthOffset;
|
||||
|
||||
if ( xaccFreqSpecGetMonthly( fs, &monthlyMult,
|
||||
&dayOfMonth, &monthOffset ) < 0 ) {
|
||||
PERR( "Inappropriate FreqSpec type" );
|
||||
return;
|
||||
}
|
||||
if ( monthlyMult != 4 ) {
|
||||
PERR( "Month-multiplier != 4 [=%d]", monthlyMult );
|
||||
return;
|
||||
}
|
||||
year_range_menu_helper( glade_xml_get_widget( gf->gxml, "triyearly_day" ),
|
||||
glade_xml_get_widget( gf->gxml, "triyearly_occur" ),
|
||||
4, gnome_date_edit_get_date( gf->startDate ) );
|
||||
}
|
||||
break;
|
||||
case UIFREQ_SEMI_YEARLY:
|
||||
o = glade_xml_get_widget( gf->gxml, "semiyearly_occur" );
|
||||
/* FIXME: based off the start date */
|
||||
o = glade_xml_get_widget( gf->gxml, "semiyearly_day" );
|
||||
#if 0
|
||||
gtk_option_menu_set_history( GTK_OPTION_MENU(o),
|
||||
fs->specData.dateAnchor[1]-1 );
|
||||
#endif /* 0 */
|
||||
break;
|
||||
{
|
||||
int monthlyMult, dayOfMonth, monthOffset;
|
||||
|
||||
if ( xaccFreqSpecGetMonthly( fs, &monthlyMult,
|
||||
&dayOfMonth, &monthOffset ) < 0 ) {
|
||||
PERR( "Inappropriate FreqSpec type" );
|
||||
return;
|
||||
}
|
||||
if ( monthlyMult != 6 ) {
|
||||
PERR( "month-mult != 6 [=%d]", monthlyMult );
|
||||
return;
|
||||
}
|
||||
year_range_menu_helper( glade_xml_get_widget( gf->gxml, "semiyearly_day" ),
|
||||
glade_xml_get_widget( gf->gxml, "semiyearly_occur" ),
|
||||
6, gnome_date_edit_get_date( gf->startDate ) );
|
||||
}
|
||||
break;
|
||||
case UIFREQ_YEARLY:
|
||||
/* set the mult */
|
||||
o = glade_xml_get_widget( gf->gxml, "yearly_spin" );
|
||||
#if 0
|
||||
gtk_spin_button_set_value( GTK_SPIN_BUTTON(o),
|
||||
fs->specData.dateAnchor[0]/12 );
|
||||
#endif /* 0 */
|
||||
/* month: wrongly done, natch. */
|
||||
o = glade_xml_get_widget( gf->gxml, "yearly_month" );
|
||||
#if 0
|
||||
gtk_option_menu_set_history( GTK_OPTION_MENU(o),
|
||||
fs->specData.dateAnchor[2]-1 );
|
||||
#endif /* 0 */
|
||||
/* mday */
|
||||
o = glade_xml_get_widget( gf->gxml, "yearly_day" );
|
||||
#if 0
|
||||
gtk_option_menu_set_history( GTK_OPTION_MENU(o),
|
||||
fs->specData.dateAnchor[1]-1 );
|
||||
#endif /* 0 */
|
||||
break;
|
||||
{
|
||||
int monthlyMult, dayOfMonth, monthOffset;
|
||||
|
||||
if ( xaccFreqSpecGetMonthly( fs, &monthlyMult,
|
||||
&dayOfMonth, &monthOffset ) < 0 ) {
|
||||
PERR( "Inappropriate FreqSpec type" );
|
||||
return;
|
||||
}
|
||||
if ( (monthlyMult % 12) != 0) {
|
||||
PERR( "monthly-mult %% 12 != 0 [=%d]", ( monthlyMult % 12 ) );
|
||||
return;
|
||||
}
|
||||
|
||||
/* set the mult */
|
||||
o = glade_xml_get_widget( gf->gxml, "yearly_spin" );
|
||||
gtk_spin_button_set_value( GTK_SPIN_BUTTON(o),
|
||||
(int)rint(floor(monthlyMult / 12)) );
|
||||
tmpTT = gnome_date_edit_get_date( gf->startDate );
|
||||
tmpTm = localtime( &tmpTT );
|
||||
o = glade_xml_get_widget( gf->gxml, "yearly_month" );
|
||||
gtk_option_menu_set_history( GTK_OPTION_MENU(o), monthOffset );
|
||||
o = glade_xml_get_widget( gf->gxml, "yearly_day" );
|
||||
gtk_option_menu_set_history( GTK_OPTION_MENU(o), dayOfMonth-1 );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
PERR( "unknown ui freq type [%d, %s]\n", __LINE__, __FILE__ );
|
||||
break;
|
||||
PERR( "unknown ui freq type [%d, %s]\n", __LINE__, __FILE__ );
|
||||
break;
|
||||
}
|
||||
update_appropriate_cal( gf );
|
||||
}
|
||||
@@ -443,30 +547,31 @@ gnc_frequency_setup( GNCFrequency *gf, FreqSpec *fs )
|
||||
void
|
||||
gnc_frequency_save_state( GNCFrequency *gf, FreqSpec *fs, GDate *outStartDate )
|
||||
{
|
||||
gint page;
|
||||
struct tm *tmpTm;
|
||||
guint day, month, year;
|
||||
GtkWidget *o;
|
||||
UIFreqType uift;
|
||||
FreqSpec *tmpFS;
|
||||
gint tmpInt;
|
||||
char *str;
|
||||
int i;
|
||||
GDate *gd;
|
||||
GDate *gd2;
|
||||
time_t tmpTimeT;
|
||||
gint page;
|
||||
struct tm *tmpTm;
|
||||
guint day, month, year;
|
||||
GtkWidget *o;
|
||||
UIFreqType uift;
|
||||
FreqSpec *tmpFS;
|
||||
gint tmpInt;
|
||||
char *str;
|
||||
int i;
|
||||
GDate *gd;
|
||||
GDate *gd2;
|
||||
time_t tmpTimeT;
|
||||
|
||||
/* get the current tab */
|
||||
page = gtk_notebook_get_current_page( gf->nb );
|
||||
/* save into UIFreqSpec */
|
||||
uift = PAGES[page].uiFTVal;
|
||||
|
||||
tmpTimeT = gnome_date_edit_get_date( gf->startDate );
|
||||
gd = g_date_new();
|
||||
g_date_set_time( gd, tmpTimeT );
|
||||
if ( outStartDate != NULL ) {
|
||||
*outStartDate = *gd;
|
||||
g_date_set_time( outStartDate, tmpTimeT );
|
||||
}
|
||||
//uift = xaccFreqSpecGetUIType( fs );
|
||||
uift = PAGES[page].uiFTVal;
|
||||
|
||||
/* based on value, parse widget values into FreqSpec */
|
||||
switch ( uift ) {
|
||||
@@ -487,69 +592,66 @@ gnc_frequency_save_state( GNCFrequency *gf, FreqSpec *fs, GDate *outStartDate )
|
||||
g_date_free( gd );
|
||||
break;
|
||||
case UIFREQ_DAILY_MF:
|
||||
/* xaccFreqSpecSetTypes( fs, COMPOSITE, uift ); */
|
||||
xaccFreqSpecSetComposite( fs );
|
||||
xaccFreqSpecSetUIType( fs, uift );
|
||||
gd2 = g_date_new();
|
||||
o = glade_xml_get_widget( gf->gxml, "dailymf_spin" );
|
||||
tmpInt = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(o) );
|
||||
/* Okay. Assume that the calendar is upgraded to
|
||||
support selecting weeks, returning the Sunday selected. */
|
||||
xaccFreqSpecSetComposite( fs );
|
||||
xaccFreqSpecSetUIType( fs, uift );
|
||||
gd2 = g_date_new();
|
||||
o = glade_xml_get_widget( gf->gxml, "dailymf_spin" );
|
||||
tmpInt = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(o) );
|
||||
/* Okay. Assume that the calendar is upgraded to */
|
||||
/* support selecting weeks, returning the Sunday selected. */
|
||||
/* Normalize to sunday. */
|
||||
tmpTm = g_new0( struct tm, 1 );
|
||||
g_date_to_struct_tm( gd, tmpTm );
|
||||
/* month-day += (week-day - current-week-day ) % 7 */
|
||||
/* week-day <- 0 */
|
||||
tmpTm->tm_mday -= ( tmpTm->tm_wday ) % 7;
|
||||
g_date_set_time( gd, mktime( tmpTm ) );
|
||||
|
||||
/* Normalize to sunday. */
|
||||
tmpTm = g_new0( struct tm, 1 );
|
||||
g_date_to_struct_tm( gd, tmpTm );
|
||||
/* month-day += (week-day - current-week-day ) % 7
|
||||
week-day <- 0 */
|
||||
tmpTm->tm_mday -= ( tmpTm->tm_wday ) % 7;
|
||||
g_date_set_time( gd, mktime( tmpTm ) );
|
||||
|
||||
/* 1 == "mon", 5 == "fri" */
|
||||
for ( i=1; i<6; i++ ) {
|
||||
*gd2 = *gd;
|
||||
g_date_add_days( gd2, i );
|
||||
tmpFS = xaccFreqSpecMalloc();
|
||||
xaccFreqSpecSetWeekly( tmpFS, gd2, tmpInt );
|
||||
xaccFreqSpecCompositeAdd( fs, tmpFS );
|
||||
}
|
||||
g_date_free( gd );
|
||||
g_date_free( gd2 );
|
||||
g_free( tmpTm );
|
||||
break;
|
||||
/* 1 == "mon", 5 == "fri" */
|
||||
for ( i=1; i<6; i++ ) {
|
||||
*gd2 = *gd;
|
||||
g_date_add_days( gd2, i );
|
||||
tmpFS = xaccFreqSpecMalloc();
|
||||
xaccFreqSpecSetWeekly( tmpFS, gd2, tmpInt );
|
||||
xaccFreqSpecCompositeAdd( fs, tmpFS );
|
||||
}
|
||||
g_date_free( gd );
|
||||
g_date_free( gd2 );
|
||||
g_free( tmpTm );
|
||||
break;
|
||||
case UIFREQ_WEEKLY:
|
||||
/* xaccFreqSpecSetTypes( fs, COMPOSITE, uift ); */
|
||||
xaccFreqSpecSetComposite( fs );
|
||||
o = glade_xml_get_widget( gf->gxml, "weekly_spin" );
|
||||
tmpInt = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(o) );
|
||||
xaccFreqSpecSetComposite( fs );
|
||||
xaccFreqSpecSetUIType( fs, uift );
|
||||
o = glade_xml_get_widget( gf->gxml, "weekly_spin" );
|
||||
tmpInt = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(o) );
|
||||
|
||||
/* assume we have a good calendar that allows week selection. */
|
||||
|
||||
/* for-now hack: normalize to Sunday. */
|
||||
tmpTm = g_new0( struct tm, 1 );
|
||||
g_date_to_struct_tm( gd, tmpTm );
|
||||
tmpTm->tm_mday -= tmpTm->tm_wday % 7;
|
||||
g_date_set_time( gd, mktime( tmpTm ) );
|
||||
/* assume we have a good calendar that allows week selection. */
|
||||
/* for-now hack: normalize to Sunday. */
|
||||
tmpTm = g_new0( struct tm, 1 );
|
||||
g_date_to_struct_tm( gd, tmpTm );
|
||||
tmpTm->tm_mday -= tmpTm->tm_wday % 7;
|
||||
g_date_set_time( gd, mktime( tmpTm ) );
|
||||
|
||||
/* now, go through the check boxes and add composites based on
|
||||
that date. */
|
||||
for ( i=0; CHECKBOX_NAMES[i]!=NULL; i++ ) {
|
||||
str = CHECKBOX_NAMES[i];
|
||||
o = glade_xml_get_widget( gf->gxml, str );
|
||||
if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(o) ) ) {
|
||||
tmpFS = xaccFreqSpecMalloc();
|
||||
/* struct-copy is expected to work, here
|
||||
[wish we didn't have to know about the GDate implementation...] */
|
||||
gd2 = g_date_new();
|
||||
*gd2 = *gd;
|
||||
/* Add 'i' days off of Sunday */
|
||||
g_date_add_days( gd2, i );
|
||||
xaccFreqSpecSetWeekly( tmpFS, gd2, tmpInt );
|
||||
g_date_free( gd2 );
|
||||
xaccFreqSpecCompositeAdd( fs, tmpFS );
|
||||
}
|
||||
}
|
||||
g_date_free( gd );
|
||||
g_free( tmpTm );
|
||||
/* now, go through the check boxes and add composites based on that date. */
|
||||
for ( i=0; CHECKBOX_NAMES[i]!=NULL; i++ ) {
|
||||
str = CHECKBOX_NAMES[i];
|
||||
o = glade_xml_get_widget( gf->gxml, str );
|
||||
if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(o) ) ) {
|
||||
tmpFS = xaccFreqSpecMalloc();
|
||||
xaccFreqSpecSetUIType( tmpFS, uift );
|
||||
/* struct-copy is expected to work, here */
|
||||
/* [wish we didn't have to know about the GDate implementation...] */
|
||||
gd2 = g_date_new();
|
||||
*gd2 = *gd;
|
||||
/* Add 'i' days off of Sunday... */
|
||||
g_date_add_days( gd2, i );
|
||||
xaccFreqSpecSetWeekly( tmpFS, gd2, tmpInt );
|
||||
g_date_free( gd2 );
|
||||
xaccFreqSpecCompositeAdd( fs, tmpFS );
|
||||
}
|
||||
}
|
||||
g_date_free( gd );
|
||||
g_free( tmpTm );
|
||||
break;
|
||||
case UIFREQ_BI_WEEKLY:
|
||||
xaccFreqSpecSetUIType( fs, uift );
|
||||
@@ -559,8 +661,6 @@ gnc_frequency_save_state( GNCFrequency *gf, FreqSpec *fs, GDate *outStartDate )
|
||||
break;
|
||||
case UIFREQ_SEMI_MONTHLY:
|
||||
/* FIXME: this is b0rken date calculation for mday>28 */
|
||||
|
||||
/* xaccFreqSpecSetTypes( fs, COMPOSITE, uift ); */
|
||||
xaccFreqSpecSetComposite( fs );
|
||||
xaccFreqSpecSetUIType( fs, uift );
|
||||
|
||||
@@ -606,7 +706,6 @@ gnc_frequency_save_state( GNCFrequency *gf, FreqSpec *fs, GDate *outStartDate )
|
||||
|
||||
break;
|
||||
case UIFREQ_MONTHLY:
|
||||
/* xaccFreqSpecSetTypes( fs, MONTHLY, uift ); */
|
||||
o = glade_xml_get_widget( gf->gxml, "monthly_spin" );
|
||||
tmpInt = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(o));
|
||||
tmpTm = g_new0( struct tm, 1 );
|
||||
@@ -623,35 +722,21 @@ gnc_frequency_save_state( GNCFrequency *gf, FreqSpec *fs, GDate *outStartDate )
|
||||
g_date_free( gd );
|
||||
break;
|
||||
case UIFREQ_QUARTERLY:
|
||||
/* xaccFreqSpecSetTypes( fs, MONTHLY, uift ); */
|
||||
|
||||
/* o = glade_xml_get_widget( gf->gxml, "quarterly_day" ); */
|
||||
/* tmpInt = gnc_option_menu_get_active( GTK_WIDGET(o) ); */
|
||||
xaccFreqSpecSetMonthly( fs, gd, 3 );
|
||||
xaccFreqSpecSetUIType( fs, uift );
|
||||
g_date_free( gd );
|
||||
|
||||
break;
|
||||
case UIFREQ_TRI_ANUALLY:
|
||||
/* xaccFreqSpecSetTypes( fs, MONTHLY, uift ); */
|
||||
/* o = glade_xml_get_widget( gf->gxml, "triyearly_day" ); */
|
||||
/* tmpInt = gnc_option_menu_get_active( GTK_WIDGET(o) ); */
|
||||
xaccFreqSpecSetMonthly( fs, gd, 4 );
|
||||
xaccFreqSpecSetUIType( fs, uift );
|
||||
g_date_free( gd );
|
||||
break;
|
||||
case UIFREQ_SEMI_YEARLY:
|
||||
/* xaccFreqSpecSetTypes( fs, MONTHLY, uift ); */
|
||||
/* o = glade_xml_get_widget( gf->gxml, "semiyearly_day" ); */
|
||||
/* tmpInt = gnc_option_menu_get_active( GTK_WIDGET(o) ); */
|
||||
xaccFreqSpecSetMonthly( fs, gd, 6 );
|
||||
xaccFreqSpecSetUIType( fs, uift );
|
||||
g_date_free( gd );
|
||||
break;
|
||||
case UIFREQ_YEARLY:
|
||||
/* xaccFreqSpecSetTypes( fs, MONTHLY, uift ); */
|
||||
/* get the multiplier */
|
||||
/* monthly:12*mult,start date + mday */
|
||||
o = glade_xml_get_widget( gf->gxml, "yearly_spin" );
|
||||
tmpInt = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(o) );
|
||||
xaccFreqSpecSetMonthly( fs, gd, tmpInt * 12 );
|
||||
@@ -690,11 +775,13 @@ mark_calendar( GtkCalendar *cal, FreqSpec *fs )
|
||||
|
||||
xaccFreqSpecGetNextInstance( fs, gdNow, gdNext );
|
||||
g_date_to_struct_tm( gdNext, tmpTm );
|
||||
while ( tmpTm->tm_mon == month ) {
|
||||
while ( tmpTm->tm_mon == month && g_date_valid(gdNext) ) {
|
||||
gtk_calendar_mark_day( cal, tmpTm->tm_mday );
|
||||
*gdNow = *gdNext;
|
||||
xaccFreqSpecGetNextInstance( fs, gdNow, gdNext );
|
||||
g_date_to_struct_tm( gdNext, tmpTm );
|
||||
if ( g_date_valid( gdNow ) ) {
|
||||
g_date_to_struct_tm( gdNext, tmpTm );
|
||||
}
|
||||
}
|
||||
gtk_calendar_thaw( cal );
|
||||
|
||||
@@ -725,13 +812,13 @@ update_appropriate_cal( GNCFrequency *gf )
|
||||
/* save into UIFreqSpec */
|
||||
uift = PAGES[page].uiFTVal;
|
||||
/* based on value, parse widget values into FreqSpec */
|
||||
switch ( uift ) {
|
||||
switch ( uift ) {
|
||||
case UIFREQ_NONE:
|
||||
case UIFREQ_DAILY:
|
||||
o = glade_xml_get_widget( gf->gxml, "daily_cal" );
|
||||
break;
|
||||
case UIFREQ_DAILY_MF:
|
||||
o = glade_xml_get_widget( gf->gxml, "daily_mf_cal" );
|
||||
o = glade_xml_get_widget( gf->gxml, "dailymf_cal" );
|
||||
break;
|
||||
case UIFREQ_WEEKLY:
|
||||
o = glade_xml_get_widget( gf->gxml, "weekly_cal" );
|
||||
@@ -761,10 +848,11 @@ static void
|
||||
free_resources( GtkObject *o, gpointer d )
|
||||
{
|
||||
GNCFrequency *gf = (GNCFrequency*)d;
|
||||
DEBUG( "In GNCFrequency::free_resources\n" );
|
||||
|
||||
// FIXME: destroy an appropriate widget
|
||||
#if 0
|
||||
gtk_widget_destroy( glade_xml_get_widget( gf->gxml,
|
||||
"GNCFrequency widget" ) );
|
||||
#endif // 0
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -804,6 +892,17 @@ weekly_spin_value_changed( GtkAdjustment *adj, gpointer d )
|
||||
update_cal( d, cal );
|
||||
}
|
||||
|
||||
static void
|
||||
weekly_days_changed( GtkButton *b, gpointer d )
|
||||
{
|
||||
GNCFrequency *gf;
|
||||
GtkWidget *wcal;
|
||||
|
||||
gf = (GNCFrequency*)d;
|
||||
wcal = glade_xml_get_widget( gf->gxml, "weekly_cal" );
|
||||
update_cal( gf, GTK_CALENDAR(wcal) );
|
||||
}
|
||||
|
||||
static void
|
||||
monthly_sel_changed( GtkButton *b, gpointer d )
|
||||
{
|
||||
@@ -832,21 +931,18 @@ monthly_sel_changed( GtkButton *b, gpointer d )
|
||||
gnome_date_edit_set_time( gf->startDate, tmptt );
|
||||
|
||||
update_appropriate_cal( (GNCFrequency*)d );
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
monthly_spin_value_changed( GtkAdjustment *adj, gpointer d )
|
||||
{
|
||||
update_appropriate_cal( (GNCFrequency*)d );
|
||||
/* monthly_sel_changed( NULL, d ); */
|
||||
}
|
||||
|
||||
static void
|
||||
semimonthly_spin_value_changed( GtkAdjustment *adj, gpointer d )
|
||||
{
|
||||
update_appropriate_cal( (GNCFrequency*)d );
|
||||
/* semimonthly_sel_changed( NULL, d ); */
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -882,6 +978,59 @@ semimonthly_sel_changed( GtkButton *b, gpointer d )
|
||||
update_appropriate_cal( gf );
|
||||
}
|
||||
|
||||
static void
|
||||
quarterly_sel_changed( GtkButton *b, gpointer d )
|
||||
{
|
||||
GNCFrequency *gf;
|
||||
gf = (GNCFrequency*)d;
|
||||
year_range_sels_changed( gf, 3,
|
||||
glade_xml_get_widget( gf->gxml, "quarterly_occur" ),
|
||||
glade_xml_get_widget( gf->gxml, "quarterly_day" ) );
|
||||
}
|
||||
|
||||
static void
|
||||
triyearly_sel_changed( GtkButton *b, gpointer d )
|
||||
{
|
||||
GNCFrequency *gf;
|
||||
gf = (GNCFrequency*)d;
|
||||
year_range_sels_changed( gf, 4,
|
||||
glade_xml_get_widget( gf->gxml, "triyearly_occur" ),
|
||||
glade_xml_get_widget( gf->gxml, "triyearly_day" ) );
|
||||
}
|
||||
|
||||
static void
|
||||
semiyearly_sel_changed( GtkButton *b, gpointer d )
|
||||
{
|
||||
GNCFrequency *gf;
|
||||
gf = (GNCFrequency*)d;
|
||||
year_range_sels_changed( gf, 6,
|
||||
glade_xml_get_widget( gf->gxml, "semiyearly_occur" ),
|
||||
glade_xml_get_widget( gf->gxml, "semiyearly_day" ) );
|
||||
}
|
||||
|
||||
static void
|
||||
year_range_sels_changed( GNCFrequency *gf,
|
||||
int monthsInRange,
|
||||
GtkWidget *occurW,
|
||||
GtkWidget *dayOfMonthW )
|
||||
{
|
||||
int occur, day;
|
||||
time_t tmpTT;
|
||||
struct tm *tmpTm;
|
||||
|
||||
occur = gnc_option_menu_get_active( occurW );
|
||||
day = gnc_option_menu_get_active( dayOfMonthW ) + 1;
|
||||
|
||||
tmpTT = gnome_date_edit_get_date( gf->startDate );
|
||||
tmpTm = localtime( &tmpTT );
|
||||
tmpTm->tm_mday = day;
|
||||
// jump the month to the closest appropriate month.
|
||||
// FIXME: this could probably be made more "appropriate".
|
||||
tmpTm->tm_mon += occur - (tmpTm->tm_mon % monthsInRange);
|
||||
tmpTT = mktime( tmpTm );
|
||||
gnome_date_edit_set_time( gf->startDate, tmpTT );
|
||||
}
|
||||
|
||||
static void
|
||||
yearly_sel_changed( GtkButton *b, gpointer d )
|
||||
{
|
||||
@@ -901,7 +1050,7 @@ yearly_sel_changed( GtkButton *b, gpointer d )
|
||||
o = glade_xml_get_widget( gf->gxml, "yearly_day" );
|
||||
tmptm->tm_mday = gnc_option_menu_get_active( GTK_WIDGET(o) )+1;
|
||||
|
||||
/* correct for
|
||||
/* FIXME: correct for
|
||||
option_menu_selected_day > min(31,correct_days_in_month)
|
||||
problem */
|
||||
while ( ! g_date_valid_dmy( tmptm->tm_mday,
|
||||
@@ -916,7 +1065,7 @@ yearly_sel_changed( GtkButton *b, gpointer d )
|
||||
update_appropriate_cal( gf );
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
freq_option_value_changed( GtkMenuShell *b, gpointer d )
|
||||
{
|
||||
GtkObject *o;
|
||||
@@ -955,27 +1104,19 @@ start_date_changed( GnomeDateEdit *gde, gpointer d )
|
||||
|
||||
dateFromGDE = gnome_date_edit_get_date( gde );
|
||||
|
||||
/* FIXME: update...
|
||||
X monthly: day of month
|
||||
X semi-monthly: lowest day
|
||||
{quarterly, tri-yearly, semi-yearly, X yearly}: day of month
|
||||
*/
|
||||
|
||||
page = gtk_notebook_get_current_page( gf->nb );
|
||||
uift = PAGES[page].uiFTVal;
|
||||
|
||||
o = NULL;
|
||||
|
||||
switch (uift) {
|
||||
case UIFREQ_MONTHLY:
|
||||
o = glade_xml_get_widget( gf->gxml, "monthly_day" );
|
||||
tmpTm = localtime( &dateFromGDE );
|
||||
gtk_option_menu_set_history( GTK_OPTION_MENU(o),
|
||||
(tmpTm->tm_mday-1) );
|
||||
break;
|
||||
case UIFREQ_DAILY: /* FALLTHROUGH */
|
||||
case UIFREQ_DAILY_MF: /* FALLTHROUGH */
|
||||
case UIFREQ_WEEKLY: /* FALLTHROUGH */
|
||||
case UIFREQ_BI_WEEKLY:
|
||||
break;
|
||||
|
||||
case UIFREQ_SEMI_MONTHLY:
|
||||
/* if first < second, update first
|
||||
else, update second. */
|
||||
o = glade_xml_get_widget( gf->gxml, "semimonthly_first" );
|
||||
tmpint = gnc_option_menu_get_active( GTK_WIDGET(o) )+1;
|
||||
o = glade_xml_get_widget( gf->gxml, "semimonthly_second" );
|
||||
@@ -986,6 +1127,12 @@ start_date_changed( GnomeDateEdit *gde, gpointer d )
|
||||
tmpTm = localtime( &dateFromGDE );
|
||||
gtk_option_menu_set_history( GTK_OPTION_MENU(o), tmpTm->tm_mday-1 );
|
||||
break;
|
||||
case UIFREQ_MONTHLY:
|
||||
o = glade_xml_get_widget( gf->gxml, "monthly_day" );
|
||||
tmpTm = localtime( &dateFromGDE );
|
||||
gtk_option_menu_set_history( GTK_OPTION_MENU(o),
|
||||
(tmpTm->tm_mday-1) );
|
||||
break;
|
||||
case UIFREQ_QUARTERLY:
|
||||
year_range_menu_helper( glade_xml_get_widget( gf->gxml, "quarterly_day" ),
|
||||
glade_xml_get_widget( gf->gxml, "quarterly_occur" ),
|
||||
|
||||
@@ -41,13 +41,13 @@ BEGIN_GNOME_DECLS
|
||||
* FreqSpec object in the process.
|
||||
**/
|
||||
typedef struct _GNCFrequency {
|
||||
GtkVBox widget;
|
||||
GtkVBox widget;
|
||||
|
||||
GtkVBox *vb;
|
||||
GtkNotebook *nb;
|
||||
GtkOptionMenu *freqOpt;
|
||||
GnomeDateEdit *startDate;
|
||||
GladeXML *gxml;
|
||||
GtkVBox *vb;
|
||||
GtkNotebook *nb;
|
||||
GtkOptionMenu *freqOpt;
|
||||
GnomeDateEdit *startDate;
|
||||
GladeXML *gxml;
|
||||
} GNCFrequency;
|
||||
|
||||
typedef struct _GNCFrequencyClass {
|
||||
@@ -66,7 +66,7 @@ guint gnc_frequency_get_type( void );
|
||||
/**
|
||||
* For the default freq spec widget, use 'NULL'.
|
||||
**/
|
||||
GtkWidget * gnc_frequency_new( FreqSpec *fs );
|
||||
GtkWidget * gnc_frequency_new( FreqSpec *fs, GDate *startDate );
|
||||
void gnc_frequency_init( GNCFrequency *gf );
|
||||
/**
|
||||
* Sets up the given GNCFrequency with the given FreqSpec and
|
||||
@@ -75,7 +75,7 @@ void gnc_frequency_init( GNCFrequency *gf );
|
||||
* default. If the FreqSpec is non-NULL, then it really should agree
|
||||
* with the UIFreqSpec; this is considered a 'critical' error.
|
||||
**/
|
||||
void gnc_frequency_setup( GNCFrequency *gf, FreqSpec *fs );
|
||||
void gnc_frequency_setup( GNCFrequency *gf, FreqSpec *fs, GDate *startDate );
|
||||
|
||||
/**
|
||||
* Saves the state of the GNCFrequenecy widget into the given FreqSpec
|
||||
|
||||
Reference in New Issue
Block a user