2001-11-04 Joshua Sled <jsled@asynchronous.org>

* src/gnome-utils/gnc-frequency.c: saving state and updating the
	calendar markings no longer force so much of a
	component-manager/UI refresh.

	* src/guile/gw-gnc-spec.scm: Changed sx-since-last return type to
	gboolean [bool]; added better sx-since-last-run-wrapper param name
	[s/foo/bookfile/].

	* src/gnome/dialog-scheduledxaction.c (new_button_clicked): Better
	initial-FreqSpec setup to prevent error from GNCFrequency.

	* src/engine/SchedXaction.c (xaccSchedXactionSetTemplateTrans):
	Added support for setting template-transaction currency from the
	TTinfo structure.

	* src/gnome/dialog-sxsincelast.c: Correct support for "nothing
	to do": if this is the case, don't load/create the UI.  Required
	much re-working due to my bad design. :(
	Added component-manager freeze/thaw [equivalents] around engine
	interaction to minimize program-wide GUI refresh during
	Transaction creation.
	(finish_finish): Added support for 'finish' button.
	(cancel_check): Initial support for cancel button, checking with
	user regarding.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5769 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Joshua Sled committed 2001-11-05 07:39:10 +00:00
1 parent 662fa126d3
commit 213639c861
12 files changed
+537 -277

No files matched your search

+27
View File
@@ -1,3 +1,30 @@
2001-11-04 Joshua Sled <jsled@asynchronous.org>
* src/gnome-utils/gnc-frequency.c: saving state and updating the
calendar markings no longer force so much of a
component-manager/UI refresh.
* src/guile/gw-gnc-spec.scm: Changed sx-since-last return type to
gboolean [bool]; added better sx-since-last-run-wrapper param name
[s/foo/bookfile/].
* src/gnome/dialog-scheduledxaction.c (new_button_clicked): Better
initial-FreqSpec setup to prevent error from GNCFrequency.
* src/engine/SchedXaction.c (xaccSchedXactionSetTemplateTrans):
Added support for setting template-transaction currency from the
TTinfo structure.
* src/gnome/dialog-sxsincelast.c: Correct support for "nothing
to do": if this is the case, don't load/create the UI. Required
much re-working due to my bad design. :(
Added component-manager freeze/thaw [equivalents] around engine
interaction to minimize program-wide GUI refresh during
Transaction creation.
(finish_finish): Added support for 'finish' button.
(cancel_check): Initial support for cancel button, checking with
user regarding.
2001-10-29 Joshua Sled <jsled@asynchronous.org> 2001-10-29 Joshua Sled <jsled@asynchronous.org>
* src/gnome/dialog-sxsincelast.c: Unused pages are skipped, * src/gnome/dialog-sxsincelast.c: Unused pages are skipped,
+24 -10
View File
@@ -19,7 +19,9 @@ X would like "don't even tell me you instantiated it, just fscking do
################################################## ##################################################
### To-Do ### To-Do
###
### '.' = to-do, 'X' = done, '?' = jsled verify ### '.' = to-do, 'X' = done, '?' = jsled verify
###
################################################## ##################################################
@@ -116,12 +118,14 @@ X create a template register
X Is it sufficient to look at the next instance of ea. transaction only? X Is it sufficient to look at the next instance of ea. transaction only?
I think not... we probably want to look out until the transaction is I think not... we probably want to look out until the transaction is
outside the reminder range. outside the reminder range.
. support sorting in clists
. tab-order . tab-order
. need some configuration for constantly-running GnuCash users of when to . need some configuration for constantly-running GnuCash users of when to
pop up the 'new scheduled transactions' dialog [option, time-of-day] pop up the 'new scheduled transactions' dialog [option, time-of-day]
. Should deal with "nothing-to-do" better [not even show up in the worst X Should deal with "nothing-to-do" better [not even show up in the worst
[read: no auto-notify/to-create/reminders] case]. [read: no auto-notify/to-create/reminders] case].
. this is different between the auto-invoked since-last-run dialog [show X don't load/init/create the GUI if we're not about to use it.
X this is different between the auto-invoked since-last-run dialog [show
nothing] and the menu-invoked since-last-run [show a dialog to the user nothing] and the menu-invoked since-last-run [show a dialog to the user
stating there's nothing to do]. stating there's nothing to do].
. Double-clicking on auto-create list should jump to transaction . Double-clicking on auto-create list should jump to transaction
@@ -131,7 +135,7 @@ X create a template register
X Easy UI way of moving through the SXes which need variable bindings. X Easy UI way of moving through the SXes which need variable bindings.
[This presently is: click "Ok" and the next clist row which needs [This presently is: click "Ok" and the next clist row which needs
bindings is selected.] bindings is selected.]
. Need some way to defer to-create SXes. . Need some way to defer to-create SXes?
. register mods . register mods
. to see upcoming xactions, modifying future balance . to see upcoming xactions, modifying future balance
@@ -216,21 +220,28 @@ X General
X Date l10n. X Date l10n.
. GNCFreqency . GNCFreqency
X why does the accounts window go crazy when we change the FreqSpec parameters?
X probably component-manager related... yup; FreqSpec Malloc/Free
generates events, which cause GUI refreshes.
. transitioning to a new tab doesn't correctly setup the agreement between . transitioning to a new tab doesn't correctly setup the agreement between
the startdate and the page elements. the startdate and the page elements.
. Example calendar month change isn't handled correctly/doesn't refresh the X Example calendar month change isn't handled correctly/doesn't refresh the
marks. marks.
. "Inappropriate FreqSpec type" on new-SX editing. X fixed by removing any ability to change the example calendar.
. "new; weekly: click on day, click off day: GLib-CRITICAL **: file gdate.c: line 1236 (g_date_to_struct_tm): assertion `g_date_valid (d)' failed." X "Inappropriate FreqSpec type" on new-SX editing.
X "new; weekly: click on day, click off day: GLib-CRITICAL **: file gdate.c: line 1236 (g_date_to_struct_tm): assertion `g_date_valid (d)' failed."
. no longer reproducable
. Scheduled Transaction Editor . Scheduled Transaction Editor
. Can't click-out of the register . Can't click-out of the register
. 'ESC' while editing template register causes window to go away [badly].
. attempting to create a Weekly SX with no days selected causes a segfault.
. the user should be prevented from doing this.
X composite SX shouldn't segfault when asked to getFreqSpecStr for this
X Size/space issues [?]
X auto-shrink on window create [the register is too wide, leading to too X auto-shrink on window create [the register is too wide, leading to too
much whitespace on the two top panels -- sometimes]. much whitespace on the two top panels -- sometimes].
. Size/space issues. X Un-selecting "End Date" leaves calendar widget sensitive
. Un-selecting "End Date" leaves calendar widget sensitive
. 'ESC' while editing template register causes window to go away [badly].
. why does the accounts window go crazy when we change the FreqSpec parameters?
. Scheduled Transaction List . Scheduled Transaction List
@@ -249,6 +260,9 @@ X General
. SX-from-trans . SX-from-trans
. you can delete a freshly-from-trans'd SX from the list with the . you can delete a freshly-from-trans'd SX from the list with the
from-trans dlg still open, then 'ok' the dlg to get a segfault. from-trans dlg still open, then 'ok' the dlg to get a segfault.
. creating a SX from trans with the SX list open does not update it.
. general: there's going to be all sorts of interaction issues like these
between these things [SX-from-trans, SX list, SX editor] that should be handled.
################################################## ##################################################
### Enhancements ### Enhancements
+4 -3
View File
@@ -786,8 +786,9 @@ xaccFreqSpecGetFreqStr( FreqSpec *fs, GString *str )
tmpStr[i] = '-'; tmpStr[i] = '-';
} }
list = xaccFreqSpecCompositeGet( fs );
do { for ( list = xaccFreqSpecCompositeGet( fs );
list; list = list->next ) {
int dowIdx; int dowIdx;
tmpFS = (FreqSpec*)list->data; tmpFS = (FreqSpec*)list->data;
@@ -803,7 +804,7 @@ xaccFreqSpecGetFreqStr( FreqSpec *fs, GString *str )
the appropriate position. */ the appropriate position. */
dowIdx = tmpFS->s.weekly.offset_from_epoch; dowIdx = tmpFS->s.weekly.offset_from_epoch;
tmpStr[dowIdx] = *(get_wday_name(dowIdx)); tmpStr[dowIdx] = *(get_wday_name(dowIdx));
} while ( (list = g_list_next(list)) ); }
if ( tmpInt > 1 ) { if ( tmpInt > 1 ) {
g_string_sprintf( str, _( "Weekly (x%d): %s"), tmpInt, tmpStr ); g_string_sprintf( str, _( "Weekly (x%d): %s"), tmpInt, tmpStr );
+2
View File
@@ -617,6 +617,8 @@ xaccSchedXactionSetTemplateTrans(SchedXaction *sx, GList *t_t_list,
xaccTransSetNum(new_trans, xaccTransSetNum(new_trans,
gnc_ttinfo_get_num(tti)); gnc_ttinfo_get_num(tti));
xaccTransSetCurrency( new_trans,
gnc_ttinfo_get_currency(tti) );
for(split_list = gnc_ttinfo_get_template_splits(tti); for(split_list = gnc_ttinfo_get_template_splits(tti);
split_list; split_list;
-12
View File
@@ -130,16 +130,6 @@ void xaccSchedXactionSetAdvanceCreation( SchedXaction *sx, gint createDays );
gint xaccSchedXactionGetAdvanceReminder( SchedXaction *sx ); gint xaccSchedXactionGetAdvanceReminder( SchedXaction *sx );
void xaccSchedXactionSetAdvanceReminder( SchedXaction *sx, gint reminderDays ); void xaccSchedXactionSetAdvanceReminder( SchedXaction *sx, gint reminderDays );
#if 0
#error vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
GList *xaccSchedXactionGetXactions( SchedXaction *sx );
void xaccSchedXactionClearXactions( SchedXaction *sx );
void xaccSchedXactionAddXaction( SchedXaction *sx,
Transaction *t );
#error ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#endif /* 0 */
/* /*
* The following function is slightly risky. If you change * The following function is slightly risky. If you change
* the retrieved kvp_frame you must mark the SchedXaction * the retrieved kvp_frame you must mark the SchedXaction
@@ -153,7 +143,6 @@ kvp_frame *xaccSchedXactionGetSlots( SchedXaction *sx );
void xaccSchedXactionSetSlots( SchedXaction *sx, void xaccSchedXactionSetSlots( SchedXaction *sx,
kvp_frame *frm ); kvp_frame *frm );
/** /**
* Use the following two functions in preference to * Use the following two functions in preference to
* the above two . . . * the above two . . .
@@ -207,7 +196,6 @@ GDate xaccSchedXactionGetInstanceAfter( SchedXaction *sx,
* of TTInfo's as defined in SX-ttinfo.h * of TTInfo's as defined in SX-ttinfo.h
* the edit dialog doesn't use this mechanism. Maybe it should * the edit dialog doesn't use this mechanism. Maybe it should
*/ */
void xaccSchedXactionSetTemplateTrans(SchedXaction *sx, GList *t_t_list, void xaccSchedXactionSetTemplateTrans(SchedXaction *sx, GList *t_t_list,
GNCSession *session); GNCSession *session);
+21 -7
View File
@@ -29,6 +29,7 @@
#include "FreqSpec.h" #include "FreqSpec.h"
#include "dialog-utils.h" #include "dialog-utils.h"
#include "gnc-component-manager.h"
#include "gnc-engine-util.h" #include "gnc-engine-util.h"
#include "gnc-frequency.h" #include "gnc-frequency.h"
#include "gnc-ui-util.h" #include "gnc-ui-util.h"
@@ -377,15 +378,17 @@ gnc_frequency_setup( GNCFrequency *gf, FreqSpec *fs, GDate *startDate )
int dayOfWeek; int dayOfWeek;
int count = 0; int count = 0;
list = xaccFreqSpecCompositeGet( fs ); for ( list = xaccFreqSpecCompositeGet( fs );
do { list; list = g_list_next(list) ) {
subFS = (FreqSpec*)(list->data); subFS = (FreqSpec*)(list->data);
if ( weeklyMult == -1 ) { if ( weeklyMult == -1 ) {
if ( subFS == NULL ) { if ( subFS == NULL ) {
PERR( "subFS is null\n" ); PERR( "subFS is null\n" );
return; return;
} }
if ( xaccFreqSpecGetWeekly( subFS, &weeklyMult, &dayOfWeek ) < 0 ) { if ( xaccFreqSpecGetWeekly( subFS,
&weeklyMult,
&dayOfWeek ) < 0 ) {
PERR( "Inappropriate FreqSpec type " PERR( "Inappropriate FreqSpec type "
"[gnc-frequency: %d, FreqSpec: %d]\n", "[gnc-frequency: %d, FreqSpec: %d]\n",
uift, xaccFreqSpecGetUIType( fs ) ); uift, xaccFreqSpecGetUIType( fs ) );
@@ -398,14 +401,18 @@ gnc_frequency_setup( GNCFrequency *gf, FreqSpec *fs, GDate *startDate )
PERR( "subFS is null\n" ); PERR( "subFS is null\n" );
return; return;
} }
if ( xaccFreqSpecGetWeekly( subFS, &otherWeeklyMult, &dayOfWeek ) < 0 ) { if ( xaccFreqSpecGetWeekly( subFS,
&otherWeeklyMult,
&dayOfWeek ) < 0 ) {
PERR( "Inappropriate FreqSpec type " PERR( "Inappropriate FreqSpec type "
"[gnc-frequency: %d, FreqSpec: %d]\n", "[gnc-frequency: %d, FreqSpec: %d]\n",
uift, xaccFreqSpecGetUIType( fs ) ); uift, xaccFreqSpecGetUIType( fs ) );
return; return;
} }
if ( weeklyMult != otherWeeklyMult ) { if ( weeklyMult != otherWeeklyMult ) {
PERR( "Inconsistent weekly FreqSpec multipliers seen [first: %d vs. other: %d]\n", PERR( "Inconsistent weekly FreqSpec "
"multipliers seen "
"[first: %d vs. other: %d]\n",
weeklyMult, otherWeeklyMult ); weeklyMult, otherWeeklyMult );
return; return;
} }
@@ -417,7 +424,7 @@ gnc_frequency_setup( GNCFrequency *gf, FreqSpec *fs, GDate *startDate )
str = CHECKBOX_NAMES[dayOfWeek]; str = CHECKBOX_NAMES[dayOfWeek];
o = glade_xml_get_widget( gf->gxml, str ); o = glade_xml_get_widget( gf->gxml, str );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(o), TRUE ); 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" ); o = glade_xml_get_widget( gf->gxml, "weekly_spin" );
gtk_spin_button_set_value( GTK_SPIN_BUTTON(o), weeklyMult ); gtk_spin_button_set_value( GTK_SPIN_BUTTON(o), weeklyMult );
} }
@@ -588,13 +595,17 @@ gnc_frequency_save_state( GNCFrequency *gf, FreqSpec *fs, GDate *outStartDate )
page = gtk_notebook_get_current_page( gf->nb ); page = gtk_notebook_get_current_page( gf->nb );
/* save into UIFreqSpec */ /* save into UIFreqSpec */
/* We're going to be creating/destroying FreqSpecs, which will cause GUI
refreshes. :( */
gnc_suspend_gui_refresh();
tmpTimeT = gnome_date_edit_get_date( gf->startDate ); tmpTimeT = gnome_date_edit_get_date( gf->startDate );
gd = g_date_new(); gd = g_date_new();
g_date_set_time( gd, tmpTimeT ); g_date_set_time( gd, tmpTimeT );
if ( outStartDate != NULL ) { if ( outStartDate != NULL ) {
g_date_set_time( outStartDate, tmpTimeT ); g_date_set_time( outStartDate, tmpTimeT );
} }
//uift = xaccFreqSpecGetUIType( fs ); /*uift = xaccFreqSpecGetUIType( fs );*/
uift = PAGES[page].uiFTVal; uift = PAGES[page].uiFTVal;
/* based on value, parse widget values into FreqSpec */ /* based on value, parse widget values into FreqSpec */
@@ -774,6 +785,7 @@ gnc_frequency_save_state( GNCFrequency *gf, FreqSpec *fs, GDate *outStartDate )
uift, __LINE__, __FILE__ ); uift, __LINE__, __FILE__ );
break; break;
} }
gnc_resume_gui_refresh();
} }
static void static void
@@ -825,10 +837,12 @@ update_cal( GNCFrequency *gf, GtkCalendar *cal )
{ {
FreqSpec *fs; FreqSpec *fs;
gnc_suspend_gui_refresh();
fs = xaccFreqSpecMalloc(gnc_get_current_session ()); fs = xaccFreqSpecMalloc(gnc_get_current_session ());
gnc_frequency_save_state( gf, fs, NULL ); gnc_frequency_save_state( gf, fs, NULL );
mark_calendar( cal, fs ); mark_calendar( cal, fs );
xaccFreqSpecFree( fs ); xaccFreqSpecFree( fs );
gnc_resume_gui_refresh();
} }
static void static void
+106 -20
View File
@@ -46,6 +46,9 @@
#include "window-help.h" #include "window-help.h"
#include "window-register.h" #include "window-register.h"
/* FIXME: temp until variable-related-stuff settled. */
#include "dialog-sxsincelast.h"
static short module = MOD_SX; static short module = MOD_SX;
#define DIALOG_SCHEDXACTION_CM_CLASS "dialog-scheduledtransactions" #define DIALOG_SCHEDXACTION_CM_CLASS "dialog-scheduledtransactions"
@@ -60,11 +63,13 @@ static short module = MOD_SX;
#define ADVANCE_DAYS_SPIN "advance_days" #define ADVANCE_DAYS_SPIN "advance_days"
#define REMIND_OPT "remind_opt" #define REMIND_OPT "remind_opt"
#define REMIND_DAYS_SPIN "remind_days" #define REMIND_DAYS_SPIN "remind_days"
#define END_DATE_DATEENTRY "sxe_end_date"
#define END_GNOME_NUMENTRY "end_gnome_nentry" #define END_GNOME_NUMENTRY "end_gnome_nentry"
#define REMAIN_GNOME_NUMENTRY "remain_gnome_nentry" #define REMAIN_GNOME_NUMENTRY "remain_gnome_nentry"
#define END_OPTION 0 #define END_NEVER_OPTION 0
#define NUM_OCCUR_OPTION 1 #define END_DATE_OPTION 1
#define NUM_OCCUR_OPTION 2
/** Datatypes ***********************************************************/ /** Datatypes ***********************************************************/
@@ -77,7 +82,7 @@ typedef enum
} DeleteType; } DeleteType;
typedef enum _EndTypeEnum { typedef enum _EndTypeEnum {
END_NONE, END_NEVER,
END_DATE, END_DATE,
END_OCCUR, END_OCCUR,
} EndType; } EndType;
@@ -210,6 +215,12 @@ editor_help_button_clicked(GtkButton *b, SchedXactionEditorDialog *sxed)
return; return;
} }
static void
local_print_helper( gpointer key, gpointer value, gpointer ud )
{
printf( "var: \"%s\"\n", (char*)key );
}
static static
void void
editor_ok_button_clicked( GtkButton *b, SchedXactionEditorDialog *sxed ) editor_ok_button_clicked( GtkButton *b, SchedXactionEditorDialog *sxed )
@@ -222,8 +233,64 @@ editor_ok_button_clicked( GtkButton *b, SchedXactionEditorDialog *sxed )
time_t tmpDate; time_t tmpDate;
GDate *gdate; GDate *gdate;
gdate = g_date_new(); /* FIXME: Do checks on validity and such, interrupting the user if
* things aren't right.
*
* . "weekly" FS has some days set.
* . "once" with reasonable start/end dates.
*
* . creating a "not scheduled" SX is probably not right...
*
* . balancing the SX if contain numeric-only formula data.
*/
gnc_split_register_save ( gnc_ledger_display_get_split_register(sxed->ledger),
FALSE );
#if 0
/* FIXME: leave for now; will use for numeric-formulas-get-balanced
* determination later. */
{
GHashTable *ht;
GList *splitList = NULL;
char *str;
kvp_frame *f;
kvp_value *v;
Split *s;
ht = g_hash_table_new( NULL, NULL );
splitList = xaccSchedXactionGetSplits( sxed->sx );
for ( ; splitList; splitList = splitList->next ) {
s = (Split*)splitList->data;
f = xaccSplitGetSlots( s );
v = kvp_frame_get_slot_path( f,
GNC_SX_ID,
GNC_SX_CREDIT_FORMULA,
NULL );
if ( v
&& (str = kvp_value_get_string(v))
&& strlen( str ) != 0 ) {
parse_vars_from_formula( str, ht );
}
v = kvp_frame_get_slot_path( f,
GNC_SX_ID,
GNC_SX_DEBIT_FORMULA,
NULL );
if ( v
&& (str = kvp_value_get_string(v))
&& strlen(str) != 0 ) {
parse_vars_from_formula( str, ht );
}
g_hash_table_foreach( ht, local_print_helper, NULL );
}
if ( g_hash_table_size( ht ) == 0 ) {
}
g_hash_table_destroy( ht );
}
#endif /* 0 */
gdate = g_date_new();
/* read out data back into SchedXaction object. */ /* read out data back into SchedXaction object. */
w = glade_xml_get_widget( sxed->gxml, "sxe_name" ); w = glade_xml_get_widget( sxed->gxml, "sxe_name" );
xaccSchedXactionSetName( sxed->sx, gtk_entry_get_text( GTK_ENTRY(w) ) ); xaccSchedXactionSetName( sxed->sx, gtk_entry_get_text( GTK_ENTRY(w) ) );
@@ -233,7 +300,7 @@ editor_ok_button_clicked( GtkButton *b, SchedXactionEditorDialog *sxed )
optNumOccur = glade_xml_get_widget( sxed->gxml, "rb_num_occur" ); optNumOccur = glade_xml_get_widget( sxed->gxml, "rb_num_occur" );
if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(optEndDate)) ) { if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(optEndDate)) ) {
/* get the end date data */ /* get the end date data */
w = glade_xml_get_widget( sxed->gxml, "sxe_end_date" ); w = glade_xml_get_widget( sxed->gxml, END_DATE_DATEENTRY );
g_date_set_time( gdate, gnome_date_edit_get_date( GNOME_DATE_EDIT(w) ) ); g_date_set_time( gdate, gnome_date_edit_get_date( GNOME_DATE_EDIT(w) ) );
xaccSchedXactionSetEndDate( sxed->sx, gdate ); xaccSchedXactionSetEndDate( sxed->sx, gdate );
/* set the num occurances data */ /* set the num occurances data */
@@ -368,8 +435,6 @@ scheduledxaction_editor_dialog_destroy(GtkObject *object, gpointer data)
{ {
SchedXactionEditorDialog *sxed = data; SchedXactionEditorDialog *sxed = data;
DEBUG( "editor_dialog_destroy" );
if (sxed == NULL) if (sxed == NULL)
return; return;
@@ -379,7 +444,6 @@ scheduledxaction_editor_dialog_destroy(GtkObject *object, gpointer data)
return; return;
} }
#endif /* 0 */ #endif /* 0 */
DEBUG( "foo" );
gnc_unregister_gui_component_by_data gnc_unregister_gui_component_by_data
(DIALOG_SCHEDXACTION_EDITOR_CM_CLASS, sxed); (DIALOG_SCHEDXACTION_EDITOR_CM_CLASS, sxed);
@@ -478,6 +542,8 @@ row_select_handler( GtkCList *clist,
sxd = (SchedXactionDialog*)d; sxd = (SchedXactionDialog*)d;
g_return_if_fail( event );
switch ( event->type ) { switch ( event->type ) {
case GDK_2BUTTON_PRESS: case GDK_2BUTTON_PRESS:
sx = (SchedXaction*)gtk_clist_get_row_data( clist, row ); sx = (SchedXaction*)gtk_clist_get_row_data( clist, row );
@@ -556,7 +622,8 @@ gnc_ui_scheduled_xaction_editor_dialog_create( SchedXactionDialog *sxd,
{ "cancel_button", "clicked", editor_cancel_button_clicked, NULL }, { "cancel_button", "clicked", editor_cancel_button_clicked, NULL },
{ "help_button", "clicked", editor_help_button_clicked, NULL}, { "help_button", "clicked", editor_help_button_clicked, NULL},
{ "rb_enddate", "toggled", endgroup_rb_toggled, GINT_TO_POINTER(END_OPTION) }, { "rb_noend", "toggled", endgroup_rb_toggled, GINT_TO_POINTER(END_NEVER_OPTION) },
{ "rb_enddate", "toggled", endgroup_rb_toggled, GINT_TO_POINTER(END_DATE_OPTION) },
{ "rb_num_occur", "toggled", endgroup_rb_toggled, GINT_TO_POINTER(NUM_OCCUR_OPTION) }, { "rb_num_occur", "toggled", endgroup_rb_toggled, GINT_TO_POINTER(NUM_OCCUR_OPTION) },
{ "autocreate_opt", "toggled", autocreate_toggled, NULL }, { "autocreate_opt", "toggled", autocreate_toggled, NULL },
@@ -902,6 +969,16 @@ schedXact_editor_create_freq_sel( SchedXactionEditorDialog *sxed )
gtk_container_add( GTK_CONTAINER(f), GTK_WIDGET(sxed->gncfreq) ); gtk_container_add( GTK_CONTAINER(f), GTK_WIDGET(sxed->gncfreq) );
} }
static void
sxe_ledger_destroy( GNCLedgerDisplay *ld )
{
SchedXactionEditorDialog *sxed;
sxed =(SchedXactionEditorDialog*)
gnc_ledger_display_get_user_data( ld );
DEBUG( "ledger's being destroyed... we probably want "
"to clean up in some appropriate way." );
}
static static
void void
schedXact_editor_create_ledger( SchedXactionEditorDialog *sxed ) schedXact_editor_create_ledger( SchedXactionEditorDialog *sxed )
@@ -919,7 +996,8 @@ schedXact_editor_create_ledger( SchedXactionEditorDialog *sxed )
sxed->ledger = gnc_ledger_display_template_gl( sxed->sxGUIDstr ); sxed->ledger = gnc_ledger_display_template_gl( sxed->sxGUIDstr );
gnc_ledger_display_set_handlers( sxed->ledger, gnc_ledger_display_set_handlers( sxed->ledger,
NULL, sxe_ledger_get_parent ); sxe_ledger_destroy,
sxe_ledger_get_parent );
gnc_ledger_display_set_user_data( sxed->ledger, (gpointer)sxed ); gnc_ledger_display_set_user_data( sxed->ledger, (gpointer)sxed );
splitreg = gnc_ledger_display_get_split_register( sxed->ledger ); splitreg = gnc_ledger_display_get_split_register( sxed->ledger );
@@ -942,7 +1020,7 @@ schedXact_editor_create_ledger( SchedXactionEditorDialog *sxed )
gnucash_register_attach_popup( sxed->reg, popup, sxed ); gnucash_register_attach_popup( sxed->reg, popup, sxed );
toolbar = schedXaction_editor_create_reg_tool_bar( sxed ); toolbar = schedXaction_editor_create_reg_tool_bar( sxed );
//gtk_container_set_border_width( GTK_CONTAINER(toolbar), 2 ); /*gtk_container_set_border_width( GTK_CONTAINER(toolbar), 2 );*/
gtk_box_pack_start( GTK_BOX(vbox), toolbar, FALSE, FALSE, 2 ); gtk_box_pack_start( GTK_BOX(vbox), toolbar, FALSE, FALSE, 2 );
gtk_box_pack_end( GTK_BOX(vbox), regWidget, TRUE, TRUE, 2 ); gtk_box_pack_end( GTK_BOX(vbox), regWidget, TRUE, TRUE, 2 );
@@ -997,12 +1075,13 @@ schedXact_editor_populate( SchedXactionEditorDialog *sxed )
w = glade_xml_get_widget( sxed->gxml, "rb_enddate" ); w = glade_xml_get_widget( sxed->gxml, "rb_enddate" );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(w), TRUE ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(w), TRUE );
/* fill in date data. */ /* fill in date data. */
w = glade_xml_get_widget( sxed->gxml, "sxe_end_date" ); w = glade_xml_get_widget( sxed->gxml, END_DATE_DATEENTRY );
tmpTm = g_new0( struct tm, 1 ); tmpTm = g_new0( struct tm, 1 );
g_date_to_struct_tm( gd, tmpTm ); g_date_to_struct_tm( gd, tmpTm );
tmpDate = mktime( tmpTm ); tmpDate = mktime( tmpTm );
g_free( tmpTm ); g_free( tmpTm );
gnome_date_edit_set_time( GNOME_DATE_EDIT(w), tmpDate ); gnome_date_edit_set_time( GNOME_DATE_EDIT(w), tmpDate );
set_endgroup_toggle_states( sxed, END_DATE ); set_endgroup_toggle_states( sxed, END_DATE );
} else if ( xaccSchedXactionHasOccurDef( sxed->sx ) ) { } else if ( xaccSchedXactionHasOccurDef( sxed->sx ) ) {
gint numOccur = xaccSchedXactionGetNumOccur( sxed->sx ); gint numOccur = xaccSchedXactionGetNumOccur( sxed->sx );
@@ -1029,7 +1108,7 @@ schedXact_editor_populate( SchedXactionEditorDialog *sxed )
} else { } else {
w = glade_xml_get_widget( sxed->gxml, "rb_noend" ); w = glade_xml_get_widget( sxed->gxml, "rb_noend" );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(w), TRUE ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(w), TRUE );
set_endgroup_toggle_states( sxed, END_NONE ); set_endgroup_toggle_states( sxed, END_NEVER );
} }
/* Do auto-create/notify setup */ /* Do auto-create/notify setup */
@@ -1112,7 +1191,7 @@ set_endgroup_toggle_states( SchedXactionEditorDialog *sxed, EndType type )
{ {
GtkWidget *dateCtl, *occurCtl; GtkWidget *dateCtl, *occurCtl;
dateCtl = glade_xml_get_widget( sxed->gxml, "sxe_end_date" ); dateCtl = glade_xml_get_widget( sxed->gxml, END_DATE_DATEENTRY );
gtk_widget_set_sensitive( GTK_WIDGET(dateCtl), (type == END_DATE) ); gtk_widget_set_sensitive( GTK_WIDGET(dateCtl), (type == END_DATE) );
occurCtl = glade_xml_get_widget( sxed->gxml, END_GNOME_NUMENTRY ); occurCtl = glade_xml_get_widget( sxed->gxml, END_GNOME_NUMENTRY );
@@ -1127,10 +1206,19 @@ void
new_button_clicked( GtkButton *b, gpointer d ) new_button_clicked( GtkButton *b, gpointer d )
{ {
SchedXactionDialog *sxd; SchedXactionDialog *sxd;
FreqSpec *fs;
GDate *gd;
SchedXaction *tmpSX = SchedXaction *tmpSX =
xaccSchedXactionMalloc( gnc_get_current_session ()); xaccSchedXactionMalloc( gnc_get_current_session ());
SchedXactionEditorDialog *sxed; SchedXactionEditorDialog *sxed;
/* Give decent initial FreqSpec for SX */
fs = xaccSchedXactionGetFreqSpec( tmpSX );
gd = g_date_new();
g_date_set_time( gd, time(NULL) );
xaccFreqSpecSetOnceDate( fs, gd );
g_date_free( gd );
sxd = (SchedXactionDialog*)d; sxd = (SchedXactionDialog*)d;
sxed = gnc_ui_scheduled_xaction_editor_dialog_create( sxd, tmpSX, 1 ); sxed = gnc_ui_scheduled_xaction_editor_dialog_create( sxd, tmpSX, 1 );
} }
@@ -1243,10 +1331,11 @@ endgroup_rb_toggled( GtkButton *b, gpointer d )
id = GPOINTER_TO_INT(gtk_object_get_data( GTK_OBJECT(b), id = GPOINTER_TO_INT(gtk_object_get_data( GTK_OBJECT(b),
"whichOneAmI" )); "whichOneAmI" ));
/* FIXME: this can now be cleaned up with the help of
set_endgroup_toggle_states(...) */
switch (id) { switch (id) {
case END_OPTION: case END_NEVER_OPTION:
set_endgroup_toggle_states( sxed, END_NEVER );
break;
case END_DATE_OPTION:
set_endgroup_toggle_states( sxed, END_DATE ); set_endgroup_toggle_states( sxed, END_DATE );
break; break;
case NUM_OCCUR_OPTION: case NUM_OCCUR_OPTION:
@@ -1323,9 +1412,6 @@ sxe_ledger_get_parent( GNCLedgerDisplay *ld )
SchedXactionEditorDialog *sxed; SchedXactionEditorDialog *sxed;
sxed = gnc_ledger_display_get_user_data( ld ); sxed = gnc_ledger_display_get_user_data( ld );
/* FIXME: is this the direct parent?
doesn't look like it from window-register.c:gnc_register_get_parent
*/
return sxed->dialog; return sxed->dialog;
} }
+4 -2
View File
@@ -204,14 +204,16 @@ sxftd_add_template_trans(SXFromTransInfo *sxfti)
{ {
tmpStr = xaccPrintAmount( split_value, tmpStr = xaccPrintAmount( split_value,
gnc_default_print_info(FALSE) ); gnc_default_print_info(FALSE) );
gnc_ttsplitinfo_set_debit_formula( ttsi, tmpStr ); /*gnc_ttsplitinfo_set_debit_formula( ttsi, tmpStr );*/
gnc_ttsplitinfo_set_credit_formula( ttsi, tmpStr );
} }
else else
{ {
/* Negate the numeric so it prints w/o the sign at the front. */ /* Negate the numeric so it prints w/o the sign at the front. */
tmpStr = xaccPrintAmount( gnc_numeric_neg( split_value ), tmpStr = xaccPrintAmount( gnc_numeric_neg( split_value ),
gnc_default_print_info(FALSE) ); gnc_default_print_info(FALSE) );
gnc_ttsplitinfo_set_credit_formula( ttsi, tmpStr ); /*gnc_ttsplitinfo_set_credit_formula( ttsi, tmpStr );*/
gnc_ttsplitinfo_set_debit_formula( ttsi, tmpStr );
} }
/* Copy over per-split account info */ /* Copy over per-split account info */
File diff suppressed because it is too large. Load diff
+16 -2
View File
@@ -23,7 +23,21 @@
#ifndef DIALOG_SXSINCELAST_H #ifndef DIALOG_SXSINCELAST_H
#define DIALOG_SXSINCELAST_H #define DIALOG_SXSINCELAST_H
void gnc_ui_sxsincelast_dialog_create( void ); gboolean gnc_ui_sxsincelast_dialog_create( void );
void gnc_ui_sxsincelast_guile_wrapper( char* ); gboolean gnc_ui_sxsincelast_guile_wrapper( char* );
/**
* Returns the varaibles from the Splits of the given SchedXaction as the
* keys of the given GHashTable.
**/
void sxsl_get_sx_vars( SchedXaction *sx, GHashTable *varHash );
/**
* Returns the variables from the given formula [free-form non-numeric
* character strings] as the keys of the given GHashTable.
**/
int parse_vars_from_formula( const char *formula, GHashTable *varHash );
void print_vars_helper( gpointer key, gpointer value, gpointer user_data );
#endif // !defined(DIALOG_SXSINCELAST_H) #endif // !defined(DIALOG_SXSINCELAST_H)
+4 -4
View File
@@ -948,7 +948,7 @@ Yearly
<can_focus>True</can_focus> <can_focus>True</can_focus>
<show_heading>True</show_heading> <show_heading>True</show_heading>
<show_day_names>True</show_day_names> <show_day_names>True</show_day_names>
<no_month_change>False</no_month_change> <no_month_change>True</no_month_change>
<show_week_numbers>False</show_week_numbers> <show_week_numbers>False</show_week_numbers>
<week_start_monday>False</week_start_monday> <week_start_monday>False</week_start_monday>
</widget> </widget>
@@ -1061,7 +1061,7 @@ Yearly
<sensitive>False</sensitive> <sensitive>False</sensitive>
<can_focus>True</can_focus> <can_focus>True</can_focus>
<show_heading>True</show_heading> <show_heading>True</show_heading>
<show_day_names>True</show_day_names> <show_day_names>False</show_day_names>
<no_month_change>False</no_month_change> <no_month_change>False</no_month_change>
<show_week_numbers>False</show_week_numbers> <show_week_numbers>False</show_week_numbers>
<week_start_monday>False</week_start_monday> <week_start_monday>False</week_start_monday>
@@ -1331,7 +1331,7 @@ Yearly
<can_focus>True</can_focus> <can_focus>True</can_focus>
<show_heading>True</show_heading> <show_heading>True</show_heading>
<show_day_names>True</show_day_names> <show_day_names>True</show_day_names>
<no_month_change>False</no_month_change> <no_month_change>True</no_month_change>
<show_week_numbers>False</show_week_numbers> <show_week_numbers>False</show_week_numbers>
<week_start_monday>False</week_start_monday> <week_start_monday>False</week_start_monday>
</widget> </widget>
@@ -1644,7 +1644,7 @@ Yearly
<can_focus>True</can_focus> <can_focus>True</can_focus>
<show_heading>True</show_heading> <show_heading>True</show_heading>
<show_day_names>True</show_day_names> <show_day_names>True</show_day_names>
<no_month_change>False</no_month_change> <no_month_change>True</no_month_change>
<show_week_numbers>False</show_week_numbers> <show_week_numbers>False</show_week_numbers>
<week_start_monday>False</week_start_monday> <week_start_monday>False</week_start_monday>
</widget> </widget>
+5 -1
View File
@@ -476,7 +476,11 @@ gnc_main_window_sched_xaction_cb (GtkWidget *widget, gpointer data) {
static void static void
gnc_main_window_sched_xaction_slr_cb (GtkWidget *widget, gpointer data) { gnc_main_window_sched_xaction_slr_cb (GtkWidget *widget, gpointer data) {
gnc_ui_sxsincelast_dialog_create(); const char *nothing_to_do_msg =
_( "There are no Scheduled Transactions to deal with." );
if ( ! gnc_ui_sxsincelast_dialog_create() ) {
gnc_info_dialog( nothing_to_do_msg );
}
} }
static void static void