mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
2002-08-06 Joshua Sled <jsled@asynchronous.org>
* src/gnome/dialog-sxsincelast.c: Added support for saving the state of the ledger if a review-ledger is transitioned away from after a "simple" edit [Bug#90075]. * src/gnome/dialog-sx-from-trans.c (sxftd_ok_clicked): * src/gnome/dialog-sxsincelast.c (gnc_sxsld_finish): Now updates the SX List [if open] when an obsolete SX is removed [Bug#84685]. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7145 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -199,7 +199,6 @@ xaccFreqSpecMalloc(GNCBook *book)
|
||||
|
||||
fs = g_new0(FreqSpec, 1);
|
||||
xaccFreqSpecInit( fs, book );
|
||||
/* FIXME:event */
|
||||
gnc_engine_generate_event( &fs->guid, GNC_EVENT_CREATE );
|
||||
return fs;
|
||||
}
|
||||
|
||||
@@ -55,9 +55,6 @@
|
||||
|
||||
static short module = MOD_SX;
|
||||
|
||||
#define DIALOG_SCHEDXACTION_CM_CLASS "dialog-scheduledtransactions"
|
||||
#define DIALOG_SCHEDXACTION_EDITOR_CM_CLASS "dialog-scheduledtransaction-editor"
|
||||
|
||||
#define SX_LIST_WIN_PREFIX "sx_list_win"
|
||||
#define SX_LIST_GLADE_NAME "Scheduled Transaction List"
|
||||
#define SX_LIST "sched_xact_list"
|
||||
@@ -146,6 +143,8 @@ static void schedXact_editor_create_freq_sel( SchedXactionEditorDialog *sxed );
|
||||
static void schedXact_editor_create_ledger( SchedXactionEditorDialog *sxed );
|
||||
static void schedXact_editor_populate( SchedXactionEditorDialog * );
|
||||
|
||||
static void sxd_close_handler ( gpointer user_data );
|
||||
|
||||
static void new_button_clicked( GtkButton *b, gpointer d );
|
||||
static void edit_button_clicked( GtkButton *b, gpointer d );
|
||||
static void delete_button_clicked( GtkButton *b, gpointer d );
|
||||
@@ -184,6 +183,21 @@ sxd_close_handler ( gpointer user_data )
|
||||
gnome_dialog_close( GNOME_DIALOG( sxd->dialog ) );
|
||||
}
|
||||
|
||||
void
|
||||
gnc_sxd_list_refresh( SchedXactionDialog *sxd )
|
||||
{
|
||||
GList *sxList;
|
||||
GtkCList *cl;
|
||||
|
||||
/* Update the clist. */
|
||||
cl = GTK_CLIST( glade_xml_get_widget( sxd->gxml, SX_LIST ) );
|
||||
gtk_clist_freeze( cl );
|
||||
gtk_clist_clear( cl );
|
||||
sxList = gnc_book_get_schedxactions( gnc_get_current_book() );
|
||||
g_list_foreach( sxList, putSchedXactionInDialog, sxd );
|
||||
gtk_clist_thaw( cl );
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
sxed_close_handler ( gpointer user_data )
|
||||
@@ -919,17 +933,16 @@ gnc_ui_scheduled_xaction_dialog_create(void)
|
||||
GtkObject *sxdo;
|
||||
GtkWidget *button;
|
||||
GtkWidget *w;
|
||||
GList *alreadyExisting = NULL;
|
||||
SchedXactionDialog *alreadyExisting = NULL;
|
||||
|
||||
alreadyExisting =
|
||||
gnc_find_gui_components( DIALOG_SCHEDXACTION_CM_CLASS,
|
||||
NULL,
|
||||
(gpointer)sxd );
|
||||
(SchedXactionDialog*)
|
||||
gnc_find_first_gui_component( DIALOG_SCHEDXACTION_CM_CLASS,
|
||||
NULL,
|
||||
(gpointer)sxd );
|
||||
if ( alreadyExisting != NULL ) {
|
||||
sxd = (SchedXactionDialog*)alreadyExisting->data;
|
||||
gtk_window_present( GTK_WINDOW(sxd->dialog) );
|
||||
g_list_free( alreadyExisting );
|
||||
return sxd;
|
||||
gtk_window_present( GTK_WINDOW(alreadyExisting->dialog) );
|
||||
return alreadyExisting;
|
||||
}
|
||||
|
||||
sxd = g_new0( SchedXactionDialog, 1 );
|
||||
@@ -975,7 +988,7 @@ gnc_ui_scheduled_xaction_dialog_create(void)
|
||||
}
|
||||
|
||||
gnc_register_gui_component( DIALOG_SCHEDXACTION_CM_CLASS,
|
||||
NULL, /* no refresh handler */
|
||||
NULL, /* no refresh_handler */
|
||||
sxd_close_handler,
|
||||
sxd );
|
||||
|
||||
@@ -1046,14 +1059,11 @@ static
|
||||
void
|
||||
schedXact_populate( SchedXactionDialog *sxd )
|
||||
{
|
||||
GNCBook *book;
|
||||
GList *sxList;
|
||||
GtkCList *sx_clist;
|
||||
int i;
|
||||
|
||||
book = gnc_get_current_book ();
|
||||
sxList = gnc_book_get_schedxactions( book );
|
||||
|
||||
sxList = gnc_book_get_schedxactions( gnc_get_current_book() );
|
||||
g_list_foreach( sxList, putSchedXactionInDialog, sxd );
|
||||
|
||||
sx_clist = GTK_CLIST( glade_xml_get_widget( sxd->gxml,
|
||||
@@ -1116,7 +1126,7 @@ gnc_sxed_get_widgets( SchedXactionEditorDialog *sxed )
|
||||
SchedXactionEditorDialog *
|
||||
gnc_ui_scheduled_xaction_editor_dialog_create( SchedXactionDialog *sxd,
|
||||
SchedXaction *sx,
|
||||
int newP )
|
||||
gboolean newSX )
|
||||
{
|
||||
SchedXactionEditorDialog *sxed;
|
||||
GtkWidget *button;
|
||||
@@ -1161,7 +1171,7 @@ gnc_ui_scheduled_xaction_editor_dialog_create( SchedXactionDialog *sxd,
|
||||
|
||||
sxed->sxd = sxd;
|
||||
sxed->sx = sx;
|
||||
sxed->newsxP = newP;
|
||||
sxed->newsxP = newSX;
|
||||
|
||||
/* NOTE: this must occur before processing the widget list, above, so
|
||||
* the gpointers stored with the advance_ and remind_opts are
|
||||
@@ -1485,7 +1495,8 @@ new_button_clicked( GtkButton *b, gpointer d )
|
||||
g_date_free( gd );
|
||||
|
||||
sxd = (SchedXactionDialog*)d;
|
||||
sxed = gnc_ui_scheduled_xaction_editor_dialog_create( sxd, tmpSX, 1 );
|
||||
sxed = gnc_ui_scheduled_xaction_editor_dialog_create( sxd, tmpSX,
|
||||
TRUE /* newSX */ );
|
||||
}
|
||||
|
||||
static
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
#include <gnome.h>
|
||||
#include "SchedXaction.h"
|
||||
|
||||
#define DIALOG_SCHEDXACTION_CM_CLASS "dialog-scheduledtransactions"
|
||||
#define DIALOG_SCHEDXACTION_EDITOR_CM_CLASS "dialog-scheduledtransaction-editor"
|
||||
|
||||
struct _SchedXactionDialog;
|
||||
struct _SchedXactionEditorDialog;
|
||||
|
||||
@@ -35,13 +38,17 @@ typedef struct _SchedXactionEditorDialog SchedXactionEditorDialog;
|
||||
|
||||
SchedXactionDialog * gnc_ui_scheduled_xaction_dialog_create(void);
|
||||
void gnc_ui_scheduled_xaction_dialog_destroy(SchedXactionDialog *sxd);
|
||||
void row_select_handler( GtkCList *clist, gint row, gint col, GdkEventButton *event, gpointer d );
|
||||
void row_select_handler( GtkCList *clist, gint row, gint col,
|
||||
GdkEventButton *event, gpointer d );
|
||||
|
||||
void gnc_sxd_list_refresh( SchedXactionDialog *sxd );
|
||||
|
||||
SchedXactionEditorDialog *
|
||||
gnc_ui_scheduled_xaction_editor_dialog_create( SchedXactionDialog *sxd,
|
||||
SchedXaction *sx,
|
||||
int newP );
|
||||
void gnc_ui_scheduled_xaction_editor_dialog_destroy(SchedXactionEditorDialog *sxd);
|
||||
gboolean newSX );
|
||||
|
||||
void gnc_ui_scheduled_xaction_editor_dialog_destroy( SchedXactionEditorDialog *sxd );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
#include "SX-ttinfo.h"
|
||||
#include "SchedXaction.h"
|
||||
#include "gnc-component-manager.h"
|
||||
#include "dialog-scheduledxaction.h"
|
||||
#include "dialog-sx-from-trans.h"
|
||||
#include "dialog-utils.h"
|
||||
@@ -433,10 +434,17 @@ sxftd_ok_clicked(GtkWidget *w, gpointer user_data)
|
||||
}
|
||||
else
|
||||
{
|
||||
SchedXactionDialog *sxd;
|
||||
book = gnc_get_current_book ();
|
||||
sx_list = gnc_book_get_schedxactions(book);
|
||||
sx_list = g_list_append(sx_list, sxfti->sx);
|
||||
gnc_book_set_schedxactions(book, sx_list);
|
||||
sxd = (SchedXactionDialog*)
|
||||
gnc_find_first_gui_component(
|
||||
DIALOG_SCHEDXACTION_CM_CLASS, NULL, NULL );
|
||||
if ( sxd ) {
|
||||
gnc_sxd_list_refresh( sxd );
|
||||
}
|
||||
}
|
||||
|
||||
sxftd_delete(sxfti, FALSE);
|
||||
@@ -499,7 +507,8 @@ sxftd_advanced_clicked(GtkWidget *w, gpointer user_data)
|
||||
|
||||
adv_dlg = gnc_ui_scheduled_xaction_dialog_create();
|
||||
adv_edit_dlg = gnc_ui_scheduled_xaction_editor_dialog_create(adv_dlg,
|
||||
sxfti->sx, 1);
|
||||
sxfti->sx,
|
||||
TRUE /* newSX */);
|
||||
/* close ourself, since advanced editing entails us, and there are sync
|
||||
* issues otherwise. */
|
||||
sxftd_delete(sxfti, FALSE);
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
* . selected
|
||||
* . <standard policy>
|
||||
* . unselected
|
||||
* . QUESTION: how do we detect unselected?
|
||||
* . if auto-created : delete
|
||||
* . if to-create : remove
|
||||
* . auto-create : display
|
||||
@@ -76,6 +75,7 @@
|
||||
#include "gnc-regwidget.h"
|
||||
|
||||
#include "dialog-sxsincelast.h"
|
||||
#include "dialog-scheduledxaction.h"
|
||||
|
||||
#ifdef HAVE_LANGINFO_D_FMT
|
||||
#include <langinfo.h>
|
||||
@@ -242,6 +242,7 @@ static void sxsincelast_init( sxSinceLastData *sxsld );
|
||||
static void create_autoCreate_ledger( sxSinceLastData *sxsld );
|
||||
static void create_created_ledger( sxSinceLastData *sxsld );
|
||||
static gncUIWidget sxsld_ledger_get_parent( GNCLedgerDisplay *ld );
|
||||
static void gnc_sxlsd_commit_ledgers( sxSinceLastData *sxsld );
|
||||
|
||||
static gboolean sxsincelast_populate( sxSinceLastData *sxsld );
|
||||
static void sxsincelast_druid_cancelled( GnomeDruid *druid, gpointer ud );
|
||||
@@ -679,6 +680,34 @@ reminders_back( GnomeDruidPage *druid_page,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static
|
||||
gboolean
|
||||
created_back( GnomeDruidPage *druid_page,
|
||||
gpointer arg1, gpointer ud )
|
||||
{
|
||||
sxSinceLastData *sxsld;
|
||||
|
||||
sxsld = (sxSinceLastData*)ud;
|
||||
gnc_split_register_save(
|
||||
gnc_ledger_display_get_split_register(sxsld->created_ledger),
|
||||
TRUE );
|
||||
return gen_back( druid_page, arg1, ud );
|
||||
}
|
||||
|
||||
static
|
||||
gboolean
|
||||
created_next( GnomeDruidPage *druid_page,
|
||||
gpointer arg1, gpointer ud )
|
||||
{
|
||||
sxSinceLastData *sxsld;
|
||||
|
||||
sxsld = (sxSinceLastData*)ud;
|
||||
gnc_split_register_save(
|
||||
gnc_ledger_display_get_split_register(sxsld->created_ledger),
|
||||
TRUE );
|
||||
return gen_next( druid_page, arg1, ud );
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
created_prep( GnomeDruidPage *druid_page,
|
||||
@@ -757,6 +786,34 @@ obsolete_prep( GnomeDruidPage *druid_page,
|
||||
gnome_druid_set_show_finish( sxsld->sincelast_druid, TRUE );
|
||||
}
|
||||
|
||||
static
|
||||
gboolean
|
||||
auto_create_back( GnomeDruidPage *druid_page,
|
||||
gpointer arg1, gpointer ud )
|
||||
{
|
||||
sxSinceLastData *sxsld;
|
||||
|
||||
sxsld = (sxSinceLastData*)ud;
|
||||
gnc_split_register_save(
|
||||
gnc_ledger_display_get_split_register(sxsld->ac_ledger),
|
||||
TRUE );
|
||||
return gen_back( druid_page, arg1, ud );
|
||||
}
|
||||
|
||||
static
|
||||
gboolean
|
||||
auto_create_next( GnomeDruidPage *druid_page,
|
||||
gpointer arg1, gpointer ud )
|
||||
{
|
||||
sxSinceLastData *sxsld;
|
||||
|
||||
sxsld = (sxSinceLastData*)ud;
|
||||
gnc_split_register_save(
|
||||
gnc_ledger_display_get_split_register(sxsld->ac_ledger),
|
||||
TRUE );
|
||||
return gen_next( druid_page, arg1, ud );
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
auto_create_prep( GnomeDruidPage *druid_page,
|
||||
@@ -984,11 +1041,14 @@ gnc_sxsld_finish( GnomeDruidPage *druid_page,
|
||||
|
||||
gtk_widget_hide( sxsld->sincelast_window );
|
||||
|
||||
gnc_sxlsd_commit_ledgers( sxsld );
|
||||
|
||||
/* Deal with the selected obsolete list elts. */
|
||||
cl = GTK_CLIST( glade_xml_get_widget( sxsld->gxml,
|
||||
SX_OBSOLETE_CLIST ) );
|
||||
|
||||
if ( g_list_length( cl->selection ) > 0 ) {
|
||||
SchedXactionDialog *sxd;
|
||||
sxList = gnc_book_get_schedxactions( gnc_get_current_book() );
|
||||
|
||||
gnc_suspend_gui_refresh();
|
||||
@@ -1006,6 +1066,13 @@ gnc_sxsld_finish( GnomeDruidPage *druid_page,
|
||||
gnc_resume_gui_refresh();
|
||||
|
||||
gnc_book_set_schedxactions( gnc_get_current_book(), sxList );
|
||||
|
||||
sxd = (SchedXactionDialog*)
|
||||
gnc_find_first_gui_component(
|
||||
DIALOG_SCHEDXACTION_CM_CLASS, NULL, NULL );
|
||||
if ( sxd ) {
|
||||
gnc_sxd_list_refresh( sxd );
|
||||
}
|
||||
}
|
||||
|
||||
sxsincelast_close_handler( sxsld );
|
||||
@@ -1130,7 +1197,7 @@ sxsincelast_init( sxSinceLastData *sxsld )
|
||||
gnc_sxsld_finish, cancel_check },
|
||||
|
||||
{ AUTO_CREATE_NOTIFY_PG,
|
||||
auto_create_prep, gen_back, gen_next,
|
||||
auto_create_prep, auto_create_back, auto_create_next,
|
||||
gnc_sxsld_finish, cancel_check },
|
||||
|
||||
{ TO_CREATE_PG,
|
||||
@@ -1138,7 +1205,7 @@ sxsincelast_init( sxSinceLastData *sxsld )
|
||||
gnc_sxsld_finish, cancel_check },
|
||||
|
||||
{ CREATED_PG,
|
||||
created_prep, gen_back, gen_next,
|
||||
created_prep, created_back, created_next,
|
||||
gnc_sxsld_finish, cancel_check },
|
||||
|
||||
{ OBSOLETE_PG,
|
||||
@@ -2149,8 +2216,6 @@ create_transactions_on( SchedXaction *sx,
|
||||
AccountGroup *ag;
|
||||
Account *acct;
|
||||
char *id;
|
||||
toCreateTuple *tct;
|
||||
gboolean createdTCT;
|
||||
|
||||
if ( tci ) {
|
||||
g_assert( g_date_compare( gd, tci->date ) == 0 );
|
||||
@@ -3064,3 +3129,15 @@ gnc_sxsld_free_entry_numeric( GtkObject *o, gpointer ud )
|
||||
num = (gnc_numeric*)gtk_object_get_data( o, "numeric" );
|
||||
g_free( num );
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
gnc_sxlsd_commit_ledgers( sxSinceLastData *sxsld )
|
||||
{
|
||||
gnc_split_register_save(
|
||||
gnc_ledger_display_get_split_register(sxsld->created_ledger),
|
||||
TRUE );
|
||||
gnc_split_register_save(
|
||||
gnc_ledger_display_get_split_register(sxsld->ac_ledger),
|
||||
TRUE );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user