mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
2001-10-24 Joshua Sled <jsled@asynchronous.org>
* src/gnome/dialog-scheduledxaction.c (sxed_delete_event): Added. (gnc_ui_scheduled_xaction_editor_dialog_create): Added support for delete-event [WM window close]. (sxed_check_close): Added close-check, including register check. (editor_cancel_button_clicked): Renamed from editor_close_button_clicked; correctly handles a cancel WRT ledger changes. * src/gnome/glade/sched-xact.glade: Added as-yet-unused Start Date widgets to make-from-transaction dialog. * src/gnome/dialog-sx-from-trans.c (sxftd_add_template_trans): Use the user-friendly amount formating instead of a stringified gnc_numeric. Copies the account data over into the template transaction. (sxftd_init): Added; supports using the Description of the transaction as the initial name of the SX. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5715 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
285e76d882
commit
437935a838
20
ChangeLog
20
ChangeLog
@ -1,3 +1,23 @@
|
||||
2001-10-24 Joshua Sled <jsled@asynchronous.org>
|
||||
|
||||
* src/gnome/dialog-scheduledxaction.c (sxed_delete_event): Added.
|
||||
(gnc_ui_scheduled_xaction_editor_dialog_create): Added support for
|
||||
delete-event [WM window close].
|
||||
(sxed_check_close): Added close-check, including register check.
|
||||
(editor_cancel_button_clicked): Renamed from
|
||||
editor_close_button_clicked; correctly handles a cancel WRT ledger
|
||||
changes.
|
||||
|
||||
* src/gnome/glade/sched-xact.glade: Added as-yet-unused Start
|
||||
Date widgets to make-from-transaction dialog.
|
||||
|
||||
* src/gnome/dialog-sx-from-trans.c (sxftd_add_template_trans): Use
|
||||
the user-friendly amount formating instead of a stringified
|
||||
gnc_numeric. Copies the account data over into the template
|
||||
transaction.
|
||||
(sxftd_init): Added; supports using the Description of the
|
||||
transaction as the initial name of the SX.
|
||||
|
||||
2001-10-22 Joshua Sled <jsled@asynchronous.org>
|
||||
|
||||
* src/engine/SchedXaction.c (xaccSchedXactionInit): Fixed
|
||||
|
@ -35,11 +35,26 @@ X create a template register
|
||||
|
||||
? Hook into 'book data changed' save-on-exit decision
|
||||
|
||||
. add a big calendar [gnome-pim? evo?] to SXaction List/overview
|
||||
. SX list
|
||||
. add a big calendar [gnome-pim? evo?] to SXaction List/overview
|
||||
|
||||
. match existing transactions for long-time users
|
||||
. based off template-transaction data, some big existing-transaction
|
||||
scanning code.
|
||||
. SX editor
|
||||
. 'Cancel' button should auto-cancel ledger changes
|
||||
|
||||
. make-from-transaction
|
||||
X credit/debit pull-over issues
|
||||
X need to remove '-' from printed credit value.
|
||||
X pull accounts over.
|
||||
X pull initial SX name from the Transaction name?
|
||||
. need start-date on Make dialog
|
||||
. [initially starts as the next occurance after the created-from SX,
|
||||
which may not be the Right Thing]
|
||||
. better frequency guess?
|
||||
. non-trivial problem
|
||||
[related...]
|
||||
. match existing transactions for long-time users
|
||||
. based off template-transaction data, some big existing-transaction
|
||||
scanning code.
|
||||
|
||||
. need "since-last-run" UI for instanatiation.
|
||||
X Change from dialogs to druid
|
||||
@ -81,6 +96,7 @@ X create a template register
|
||||
. Context menus/sensitive toolbar button/menu item for creation of
|
||||
not-yet-created transactions.
|
||||
. The ability to turn a non-recurring transaction into a recurring one...
|
||||
X [see from-trans section]
|
||||
. inactive cells
|
||||
X date
|
||||
. recn?
|
||||
@ -98,6 +114,8 @@ X create a template register
|
||||
. PostgreSQL
|
||||
. others?
|
||||
|
||||
---------------
|
||||
|
||||
. SX Creation...
|
||||
. Creation occurs due to a variety of circumstances:
|
||||
X GnuCash starts and hasn't been run in some length of time; the
|
||||
|
@ -51,6 +51,8 @@ static short module = MOD_SX;
|
||||
#define DIALOG_SCHEDXACTION_CM_CLASS "dialog-scheduledtransactions"
|
||||
#define DIALOG_SCHEDXACTION_EDITOR_CM_CLASS "dialog-scheduledtransaction-editor"
|
||||
|
||||
#define SX_LIST_GLADE_NAME "Scheduled Transaction List"
|
||||
#define SX_EDITOR_GLADE_NAME "Scheduled Transaction Editor"
|
||||
#define SX_OPT_STR "Scheduled Transactions"
|
||||
#define AUTOCREATE_OPT "autocreate_opt"
|
||||
#define NOTIFY_OPT "notify_opt"
|
||||
@ -183,14 +185,20 @@ close_button_clicked( GtkButton *b, gpointer d )
|
||||
sxd_close_handler( d );
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
editor_close_button_clicked( GtkButton *b, SchedXactionEditorDialog *sxed )
|
||||
static void
|
||||
editor_cancel_button_clicked( GtkButton *b, SchedXactionEditorDialog *sxed )
|
||||
{
|
||||
gnc_close_gui_component_by_data( DIALOG_SCHEDXACTION_EDITOR_CM_CLASS,
|
||||
sxed );
|
||||
}
|
||||
SplitRegister *reg;
|
||||
|
||||
reg = gnc_ledger_display_get_split_register( sxed->ledger );
|
||||
/* cancel ledger changes */
|
||||
gnc_split_register_cancel_cursor_trans_changes( reg );
|
||||
/* FIXME: cancel other changes */
|
||||
|
||||
/* close */
|
||||
gnc_close_gui_component_by_data (DIALOG_SCHEDXACTION_EDITOR_CM_CLASS,
|
||||
sxed);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
@ -354,14 +362,18 @@ scheduledxaction_editor_dialog_destroy(GtkObject *object, gpointer data)
|
||||
{
|
||||
SchedXactionEditorDialog *sxed = data;
|
||||
|
||||
DEBUG( "editor_dialog_destroy" );
|
||||
|
||||
if (sxed == NULL)
|
||||
return;
|
||||
|
||||
#if 0
|
||||
if ( sxed->ledger ) {
|
||||
sxed_close_handler( sxed );
|
||||
return;
|
||||
}
|
||||
|
||||
#endif /* 0 */
|
||||
DEBUG( "foo" );
|
||||
gnc_unregister_gui_component_by_data
|
||||
(DIALOG_SCHEDXACTION_EDITOR_CM_CLASS, sxed);
|
||||
|
||||
@ -394,10 +406,8 @@ gnc_ui_scheduled_xaction_dialog_create(void)
|
||||
sxd = g_new0( SchedXactionDialog, 1 );
|
||||
|
||||
/* sxd->dialog = create_Scheduled_Transaction_List(); */
|
||||
sxd->gxml = gnc_glade_xml_new( "sched-xact.glade",
|
||||
"Scheduled Transaction List" );
|
||||
sxd->dialog = glade_xml_get_widget( sxd->gxml,
|
||||
"Scheduled Transaction List" );
|
||||
sxd->gxml = gnc_glade_xml_new( "sched-xact.glade", SX_LIST_GLADE_NAME );
|
||||
sxd->dialog = glade_xml_get_widget( sxd->gxml, SX_LIST_GLADE_NAME );
|
||||
|
||||
sxdo = GTK_OBJECT(sxd->dialog);
|
||||
|
||||
@ -499,6 +509,27 @@ schedXact_populate( SchedXactionDialog *sxd )
|
||||
GTK_SIGNAL_FUNC(row_select_handler), sxd );
|
||||
}
|
||||
|
||||
static void
|
||||
sxed_check_close( SchedXactionEditorDialog *sxed )
|
||||
{
|
||||
SplitRegister *reg;
|
||||
|
||||
reg = gnc_ledger_display_get_split_register( sxed->ledger );
|
||||
|
||||
/* Check for SX changes... how? */
|
||||
|
||||
/* Check the ledger for changes. */
|
||||
gnc_sxed_reg_check_close( sxed );
|
||||
}
|
||||
|
||||
static gboolean
|
||||
sxed_delete_event( GtkWidget *widget, GdkEvent *evt, gpointer ud )
|
||||
{
|
||||
DEBUG( "delete-event" );
|
||||
sxed_close_handler( (SchedXactionEditorDialog*)ud );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
SchedXactionEditorDialog *
|
||||
gnc_ui_scheduled_xaction_editor_dialog_create( SchedXactionDialog *sxd,
|
||||
SchedXaction *sx,
|
||||
@ -516,7 +547,7 @@ gnc_ui_scheduled_xaction_editor_dialog_create( SchedXactionDialog *sxd,
|
||||
gpointer objectData;
|
||||
} widgets[] = {
|
||||
{ "ok_button", "clicked", editor_ok_button_clicked, NULL },
|
||||
{ "cancel_button", "clicked", editor_close_button_clicked, NULL },
|
||||
{ "cancel_button", "clicked", editor_cancel_button_clicked, NULL },
|
||||
{ "help_button", "clicked", editor_help_button_clicked, NULL},
|
||||
|
||||
{ "rb_enddate", "toggled", endgroup_rb_toggled, GINT_TO_POINTER(END_OPTION) },
|
||||
@ -543,11 +574,10 @@ gnc_ui_scheduled_xaction_editor_dialog_create( SchedXactionDialog *sxd,
|
||||
sxed = g_new0( SchedXactionEditorDialog, 1 );
|
||||
|
||||
/* sxed->dialog = create_Scheduled_Transaction_Editor(); */
|
||||
sxed->gxml = gnc_glade_xml_new( "sched-xact.glade", "Scheduled Transaction Editor" );
|
||||
sxed->dialog = glade_xml_get_widget( sxed->gxml, "Scheduled Transaction Editor" );
|
||||
if ( sxed->dialog == NULL ) {
|
||||
PERR( "Damnit... sxed->dialog is null\n" );
|
||||
}
|
||||
sxed->gxml = gnc_glade_xml_new( "sched-xact.glade",
|
||||
SX_EDITOR_GLADE_NAME );
|
||||
sxed->dialog = glade_xml_get_widget( sxed->gxml, SX_EDITOR_GLADE_NAME );
|
||||
|
||||
sxed->sxd = sxd;
|
||||
sxed->sx = sx;
|
||||
sxed->new = newP;
|
||||
@ -558,6 +588,8 @@ gnc_ui_scheduled_xaction_editor_dialog_create( SchedXactionDialog *sxd,
|
||||
close handler */
|
||||
sxed );
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(sxed->dialog), "delete-event",
|
||||
GTK_SIGNAL_FUNC(sxed_delete_event), sxed );
|
||||
gtk_signal_connect(GTK_OBJECT(sxed->dialog), "destroy",
|
||||
GTK_SIGNAL_FUNC(scheduledxaction_editor_dialog_destroy),
|
||||
sxed);
|
||||
@ -1279,7 +1311,21 @@ static
|
||||
void
|
||||
sxe_register_record_cb( GnucashRegister *reg, gpointer d )
|
||||
{
|
||||
SchedXactionEditorDialog *sxed = (SchedXactionEditorDialog*)d;
|
||||
SplitRegister *splitreg;
|
||||
Transaction *t;
|
||||
|
||||
DEBUG( "FIXME: sxe_register_record_cb called\n" );
|
||||
|
||||
splitreg = gnc_ledger_display_get_split_register( sxed->ledger );
|
||||
t = gnc_split_register_get_current_trans( splitreg );
|
||||
if ( ! gnc_split_register_save( splitreg, TRUE ) )
|
||||
return;
|
||||
|
||||
/* clipped "if (t)
|
||||
* gnc_reg_incl_date( splitreg, trans_get_date(trans) )" */
|
||||
|
||||
gnc_split_register_redraw( splitreg );
|
||||
}
|
||||
|
||||
static
|
||||
@ -1611,8 +1657,9 @@ gnc_sxed_reg_check_close(SchedXactionEditorDialog *sxed)
|
||||
|
||||
pending_changes = gnc_split_register_changed (reg);
|
||||
if (pending_changes) {
|
||||
const char *message = _("The current transaction has been changed.\n"
|
||||
"Would you like to record it?");
|
||||
const char *message =
|
||||
_("The current template transaction has been changed.\n"
|
||||
"Would you like to record the changes?");
|
||||
if (gnc_verify_dialog_parented(sxed->dialog, message, TRUE)) {
|
||||
sxed_reg_recordCB(sxed->dialog, sxed);
|
||||
} else {
|
||||
|
@ -2,7 +2,8 @@
|
||||
* dialog-sx-from-trans.c -- a simple dialog for creating a *
|
||||
* scheduled transaction for a "real *
|
||||
* one *
|
||||
* Copyright (C) 2000 Robert Merkel <rgmerk@mira.net> *
|
||||
* Copyright (C) 2001 Robert Merkel <rgmerk@mira.net> *
|
||||
* Copyright (C) 2001 Joshua Sled <jsled@asynchronous.org> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
@ -47,6 +48,7 @@
|
||||
#define SXFTD_N_OCCURRENCES_ENTRY "n_occurrences_entry"
|
||||
#define SXFTD_FREQ_OPTION_MENU "freq_option_menu"
|
||||
#define SXFTD_END_DATE_EDIT "end_date_edit"
|
||||
#define SXFTD_START_DATE_EDIT "start_date_edit"
|
||||
|
||||
static short module = MOD_SX;
|
||||
|
||||
@ -183,6 +185,7 @@ sxftd_add_template_trans(SXFromTransInfo *sxfti)
|
||||
TTSplitInfo *ttsi;
|
||||
Split *sp;
|
||||
gnc_numeric split_value;
|
||||
const char *tmpStr;
|
||||
|
||||
gnc_ttinfo_set_description(tti, xaccTransGetDescription(tr));
|
||||
gnc_ttinfo_set_num(tti, xaccTransGetNum(tr));
|
||||
@ -198,15 +201,23 @@ sxftd_add_template_trans(SXFromTransInfo *sxfti)
|
||||
|
||||
if(gnc_numeric_positive_p(split_value))
|
||||
{
|
||||
gnc_ttsplitinfo_set_debit_formula_numeric(ttsi, split_value);
|
||||
tmpStr = xaccPrintAmount( split_value,
|
||||
gnc_default_print_info(FALSE) );
|
||||
gnc_ttsplitinfo_set_debit_formula( ttsi, tmpStr );
|
||||
}
|
||||
else
|
||||
{
|
||||
gnc_ttsplitinfo_set_credit_formula_numeric(ttsi, split_value);
|
||||
/* Negate the numeric so it prints w/o the sign at the front. */
|
||||
tmpStr = xaccPrintAmount( gnc_numeric_neg( split_value ),
|
||||
gnc_default_print_info(FALSE) );
|
||||
gnc_ttsplitinfo_set_credit_formula( ttsi, tmpStr );
|
||||
}
|
||||
|
||||
/* Copy over per-split account info */
|
||||
gnc_ttsplitinfo_set_account( ttsi, xaccSplitGetAccount( sp ) );
|
||||
|
||||
template_splits = g_list_append(template_splits, ttsi);
|
||||
}
|
||||
}
|
||||
|
||||
gnc_ttinfo_set_template_splits(tti, template_splits);
|
||||
|
||||
@ -218,6 +229,38 @@ sxftd_add_template_trans(SXFromTransInfo *sxfti)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static gint
|
||||
sxftd_init( SXFromTransInfo *sxfti )
|
||||
{
|
||||
GtkWidget *w;
|
||||
const char *transName;
|
||||
gint pos;
|
||||
|
||||
if ( ! sxfti->sx ) {
|
||||
return -1;
|
||||
}
|
||||
if ( ! sxfti->trans ) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
sxfti_attach_callbacks(sxfti);
|
||||
|
||||
/* Get the name from the transaction, try that as the initial SX name. */
|
||||
transName = xaccTransGetDescription( sxfti->trans );
|
||||
xaccSchedXactionSetName( sxfti->sx, transName );
|
||||
|
||||
w = glade_xml_get_widget( sxfti->gxml, SXFTD_NAME_ENTRY );
|
||||
pos = 0;
|
||||
gtk_editable_insert_text( GTK_EDITABLE(w), transName,
|
||||
(strlen(transName) * sizeof(char)), &pos );
|
||||
|
||||
w = glade_xml_get_widget(sxfti->gxml,
|
||||
SXFTD_FREQ_OPTION_MENU);
|
||||
gnc_option_menu_init(w);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static guint
|
||||
sxftd_compute_sx(SXFromTransInfo *sxfti)
|
||||
{
|
||||
@ -243,11 +286,9 @@ sxftd_compute_sx(SXFromTransInfo *sxfti)
|
||||
xaccSchedXactionSetName(sx, name);
|
||||
g_free(name);
|
||||
|
||||
/* get the date (basis for start date */
|
||||
|
||||
/* get the date (basis for start date) */
|
||||
trans_t = xaccTransGetDate(sxfti->trans);
|
||||
|
||||
|
||||
g_date_set_time(&date, trans_t);
|
||||
|
||||
fs = xaccFreqSpecMalloc(gnc_get_current_session ());
|
||||
@ -255,13 +296,13 @@ sxftd_compute_sx(SXFromTransInfo *sxfti)
|
||||
/* get the frequency */
|
||||
|
||||
w = glade_xml_get_widget(sxfti->gxml, SXFTD_FREQ_OPTION_MENU);
|
||||
|
||||
index = gnc_option_menu_get_active(w);
|
||||
|
||||
/* Note that we make the start date the *NEXT* instance, not the
|
||||
* present one
|
||||
*/
|
||||
|
||||
/* Methinks this should use the FreqSpec to do the calculation... --jsled */
|
||||
switch(index)
|
||||
{
|
||||
case FREQ_DAILY:
|
||||
@ -413,8 +454,8 @@ sxftd_advanced_clicked(GtkWidget *w, gpointer user_data)
|
||||
void
|
||||
gnc_sx_create_from_trans(Transaction *trans)
|
||||
{
|
||||
GtkWidget *w;
|
||||
SXFromTransInfo *sxfti = g_malloc(sizeof(SXFromTransInfo));
|
||||
int errno;
|
||||
SXFromTransInfo *sxfti = g_new0( SXFromTransInfo, 1);
|
||||
|
||||
sxfti->gxml = gnc_glade_xml_new(SX_GLADE_FILE,
|
||||
SXFTD_DIALOG_GLADE_NAME);
|
||||
@ -426,16 +467,11 @@ gnc_sx_create_from_trans(Transaction *trans)
|
||||
|
||||
sxfti->sx = xaccSchedXactionMalloc(gnc_get_current_session ());
|
||||
|
||||
sxfti_attach_callbacks(sxfti);
|
||||
if ( (errno = sxftd_init( sxfti )) < 0 ) {
|
||||
PERR( "Error in sxftd_init: %d", errno );
|
||||
}
|
||||
|
||||
w = glade_xml_get_widget(sxfti->gxml,
|
||||
SXFTD_FREQ_OPTION_MENU);
|
||||
|
||||
gnc_option_menu_init(w);
|
||||
|
||||
gtk_widget_show_all(sxfti->dialog);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -4382,6 +4382,50 @@ Anually
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox165</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label847875</name>
|
||||
<label>Start Date: </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>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GnomeDateEdit</class>
|
||||
<name>start_date_edit</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>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame78</name>
|
||||
|
Loading…
Reference in New Issue
Block a user