make-sx-from-real-transaction dialog. bug fixes

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5237 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Robert Graham Merkel 2001-08-30 06:24:55 +00:00
parent 7b94857966
commit 83a1e7de54
16 changed files with 1609 additions and 223 deletions

View File

@ -1,3 +1,28 @@
2001-08-30 Robert Graham Merkel <rgmerk@mira.net>
* src/gnome/dialog-sx-from-trans.{ch}: New files, providing easy way
to turn existing transactions into SX's.
* src/engine/SX-ttinfo.{ch}: provide data structure for easy building
of template transactions for SX.
* src/engine/GNCId.h: changed include guards to fix in with policy.
* src/engine/SchedXaction.{ch}: added function to turn structures in
SX-ttinfo.c into real template trans, fixed bugs.
* src/engine/kvp-doc.txt: updated docs.
* src/gnome/glade/sched-xact.glade: added dialog for SX-from-trans
* src/gnome/dialog-commodity.h: fixed include guards (previously, name
started with underscore).
* src/gnome/window-register.c: added code to let user activate
SX-from-trans dialog
2001-08-25 Christian Stimming <stimming@tuhh.de>
* src/gnome/gnc-html-guppi.c: activate the [xy]_axis_label

View File

@ -22,7 +22,7 @@
\********************************************************************/
#ifndef GNC_ID_H
#define GNC_ID_H 1
#define GNC_ID_H
/* This file defines an API for using gnucash entity identifiers.
*

View File

@ -15,6 +15,7 @@ libgncmod_engine_la_SOURCES = \
Group.c \
Query.c \
SchedXaction.c \
SX-ttinfo.c \
Scrub.c \
TransLog.c \
Transaction.c \
@ -47,6 +48,7 @@ noinst_HEADERS = \
Group.h \
GroupP.h \
SchedXaction.h \
SX-ttinfo.h \
Query.h \
Scrub.h \
TransLog.h \

328
src/engine/SX-ttinfo.c Normal file
View File

@ -0,0 +1,328 @@
/********************************************************************\
* SX-ttinfo.c -- Template Transaction manipulation functions *
* for scheduled transactions *
* Copyright (C) 2001 Robert Merkel <rgmerk@mira.net> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
* *
\********************************************************************/
#include "config.h"
#include "SX-ttinfo.h"
TTInfo *
gnc_ttinfo_malloc(void)
{
TTInfo *tti = g_malloc(sizeof(TTInfo));
tti->description = NULL;
tti->num = NULL;
tti->common_currency = NULL;
tti->splits = NULL;
return tti;
}
static void
delete_splitinfo(gpointer data, gpointer user_data)
{
gnc_ttsplitinfo_free( (TTSplitInfo *) data);
return;
}
void gnc_ttinfo_free(TTInfo *info)
{
g_return_if_fail(info);
g_free(info->description);
g_free(info->num);
g_list_foreach(info->splits,
delete_splitinfo,
NULL);
g_list_free(info->splits);
g_free(info);
return;
}
void
gnc_ttinfo_set_description(TTInfo *tti, const char *description)
{
g_return_if_fail(tti);
if(tti->description)
{
g_free(tti->description);
}
tti->description = g_strdup(description);
return;
}
const char *
gnc_ttinfo_get_description(TTInfo *tti)
{
g_return_val_if_fail(tti, NULL);
return tti->description;
}
void
gnc_ttinfo_set_num(TTInfo *tti, const char *num)
{
g_return_if_fail(tti);
if(tti->num)
{
g_free(tti->num);
}
tti->num = g_strdup(num);
return;
}
const char
*gnc_ttinfo_get_num(TTInfo *tti)
{
g_return_val_if_fail(tti, NULL);
return tti->num;
}
void
gnc_ttinfo_set_currency(TTInfo *tti, gnc_commodity *common_currency)
{
g_return_if_fail(tti);
tti->common_currency = common_currency;
return;
}
gnc_commodity *
gnc_ttinfo_get_currency(TTInfo *tti)
{
g_return_val_if_fail(tti, NULL);
return tti->common_currency;
}
void gnc_ttinfo_set_template_splits(TTInfo *tti, GList *splits)
{
g_return_if_fail(tti);
tti->splits = splits;
return;
}
void gnc_ttinfo_append_template_split(TTInfo *tti, TTSplitInfo *split_i)
{
g_return_if_fail(tti && split_i);
tti->splits = g_list_append(tti->splits, split_i);
return;
}
GList *
gnc_ttinfo_get_template_splits(TTInfo *tti)
{
g_return_val_if_fail(tti, NULL);
return tti->splits;
}
TTSplitInfo *
gnc_ttsplitinfo_malloc(void)
{
TTSplitInfo *ttsi = g_malloc(sizeof(TTSplitInfo));
ttsi->action = NULL;
ttsi->memo = NULL;
ttsi->credit_formula = NULL;
ttsi->debit_formula = NULL;
ttsi->acc = NULL;
return ttsi;
}
void
gnc_ttsplitinfo_free(TTSplitInfo *ttsi)
{
g_free(ttsi->action);
g_free(ttsi->memo);
g_free(ttsi->credit_formula);
g_free(ttsi->debit_formula);
g_free(ttsi);
return;
}
void
gnc_ttsplitinfo_set_action(TTSplitInfo *ttsi, const char *action)
{
g_return_if_fail(ttsi);
if (ttsi->action)
g_free(ttsi->action);
ttsi->action = g_strdup(action);
return;
}
const char *
gnc_ttsplitinfo_get_action(TTSplitInfo *ttsi)
{
g_return_val_if_fail(ttsi, NULL);
return ttsi->action;
}
void
gnc_ttsplitinfo_set_memo(TTSplitInfo *ttsi, const char *memo)
{
g_return_if_fail(ttsi);
if (ttsi->memo)
g_free(ttsi->memo);
ttsi->memo = g_strdup(memo);
return;
}
const char *
gnc_ttsplitinfo_get_memo(TTSplitInfo *ttsi)
{
g_return_val_if_fail(ttsi, NULL);
return ttsi->memo;
}
void
gnc_ttsplitinfo_set_credit_formula_numeric(TTSplitInfo *ttsi, gnc_numeric credit)
{
g_return_if_fail(ttsi);
if(ttsi->credit_formula)
g_free(ttsi->credit_formula);
ttsi->credit_formula = gnc_numeric_to_string(credit);
if(ttsi->debit_formula)
{
g_free(ttsi->debit_formula);
ttsi->debit_formula = NULL;
}
}
void
gnc_ttsplitinfo_set_credit_formula(TTSplitInfo *ttsi, const char *credit_formula)
{
g_return_if_fail(ttsi);
if (ttsi->credit_formula)
g_free(ttsi->credit_formula);
ttsi->credit_formula = g_strdup(credit_formula);
if(ttsi->debit_formula)
{
g_free(ttsi->debit_formula);
ttsi->debit_formula = NULL;
}
return;
}
const char *
gnc_ttsplitinfo_get_credit_formula(TTSplitInfo *ttsi)
{
g_return_val_if_fail(ttsi, NULL);
return ttsi->credit_formula;
}
const char *
gnc_ttsplitinfo_get_debit_formula(TTSplitInfo *ttsi)
{
g_return_val_if_fail(ttsi, NULL);
if (ttsi->debit_formula)
g_free(ttsi->credit_formula);
return ttsi->debit_formula;
}
void
gnc_ttsplitinfo_set_debit_formula_numeric(TTSplitInfo *ttsi, gnc_numeric debit)
{
g_return_if_fail(ttsi);
if (ttsi->debit_formula)
{
g_free(ttsi->debit_formula);
}
ttsi->debit_formula = gnc_numeric_to_string(debit);
if (ttsi->credit_formula)
{
g_free(ttsi->credit_formula);
ttsi->credit_formula = NULL;
}
return;
}
void
gnc_ttsplitinfo_set_debit_formula(TTSplitInfo *ttsi, const char *debit_formula)
{
g_return_if_fail(ttsi);
if (ttsi->debit_formula)
g_free(ttsi->debit_formula);
ttsi->debit_formula = g_strdup(debit_formula);
if (ttsi->credit_formula)
{
g_free(ttsi->credit_formula);
ttsi->credit_formula = NULL;
}
return;
}
void
gnc_ttsplitinfo_set_account(TTSplitInfo *ttsi, Account *acc)
{
g_return_if_fail(ttsi && acc);
ttsi->acc = acc;
return;
}
Account *
gnc_ttsplitinfo_get_account(TTSplitInfo *ttsi)
{
g_return_val_if_fail(ttsi, NULL);
return ttsi->acc;
}

101
src/engine/SX-ttinfo.h Normal file
View File

@ -0,0 +1,101 @@
/********************************************************************\
* SX-ttinfo.h -- Template Transaction manipulation functions *
* for scheduled transactions *
* Copyright (C) 2001 Robert Merkel <rgmerk@mira.net> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
* *
\********************************************************************/
#ifndef GNC_SX_TTINFO_H
#define GNC_SX_TTINFO_H
#include "config.h"
#include <glib.h>
#include "SchedXaction.h"
#include "Account.h"
#include "gnc-numeric.h"
#include "gnc-commodity.h"
/* kvp_frame policy? */
typedef struct
{
char *description; /* owned by us */
char *num; /* owned by us */
gnc_commodity *common_currency; /* not freed? */
GList *splits; /* list of template splits, owned by us */
} TTInfo;
typedef struct
{
char *action; /* owned by us */
/* FIXME: What about the split's kvp_frame */
char *memo; /* owned by us */
char *credit_formula, *debit_formula; /* owned by us */
Account *acc;
} TTSplitInfo;
TTInfo *gnc_ttinfo_malloc(void);
void gnc_ttinfo_free(TTInfo *info);
/* these two deep-copy their arguments */
void gnc_ttinfo_set_description(TTInfo *tti, const char *description);
void gnc_ttinfo_set_num(TTInfo *tti, const char *num);
/* this one points to a persistent pointer so ownership isn't relevant */
void gnc_ttinfo_set_currency(TTInfo *tti, gnc_commodity *common_currency);
/* no deep copy occurs - if you want a deep copy make one yourself ! */
void gnc_ttinfo_set_template_splits(TTInfo *tti, GList *splits);
const char * gnc_ttinfo_get_description(TTInfo *tti);
const char * gnc_ttinfo_get_num(TTInfo *tti);
gnc_commodity * gnc_ttinfo_get_currency(TTInfo *tti);
GList * gnc_ttinfo_get_template_splits(TTInfo *tti);
/* split_i IS NOT deep copied and becomes owned by TTI */
void gnc_ttinfo_append_template_split(TTInfo *tti, TTSplitInfo *split_i);
TTSplitInfo * gnc_ttsplitinfo_malloc(void);
void gnc_ttsplitinfo_free(TTSplitInfo *split_i);
void gnc_ttsplitinfo_set_action(TTSplitInfo *split_i, const char *action);
const char * gnc_ttsplitinfo_get_action(TTSplitInfo *split_i);
void gnc_ttsplitinfo_set_memo(TTSplitInfo *split_i, const char *memo);
const char *gnc_ttsplitinfo_get_memo(TTSplitInfo *split_i);
void gnc_ttsplitinfo_set_credit_formula(TTSplitInfo *split_i, const char *credit_formula);
void gnc_ttsplitinfo_set_credit_formula_numeric(TTSplitInfo *split_i, gnc_numeric credit_formula);
const char *gnc_ttsplitinfo_get_credit_formula(TTSplitInfo *split_i);
void gnc_ttsplitinfo_set_debit_formula(TTSplitInfo *split_i, const char *debit_formula);
void gnc_ttsplitinfo_set_debit_formula_numeric(TTSplitInfo *split_i, gnc_numeric debit_formula);
const char *gnc_ttsplitinfo_get_debit_formula(TTSplitInfo *split_i);
void gnc_ttsplitinfo_set_account(TTSplitInfo *split_i, Account *acc);
Account *gnc_ttsplitinfo_get_account(TTSplitInfo *split_i);
#endif

View File

@ -40,6 +40,7 @@
#include "guid.h"
#include "gnc-book.h"
#include "FileDialog.h"
#include "SX-ttinfo.h"
static short module = MOD_SX;
@ -93,15 +94,7 @@ xaccSchedXactionMalloc( GNCBook *book )
return sx;
}
void
sxprivtransactionListMapDelete( gpointer data, gpointer user_data )
{
Transaction *t = (Transaction*)data;
xaccTransBeginEdit( t );
xaccTransDestroy( t );
xaccTransCommitEdit( t );
return;
}
static void
sxprivTransMapDelete( gpointer data, gpointer user_data )
@ -113,61 +106,70 @@ sxprivTransMapDelete( gpointer data, gpointer user_data )
return;
}
static void
delete_template_trans(SchedXaction *sx)
{
GList *templ_acct_splits, *curr_split_listref;
Split *curr_split;
Transaction *split_trans;
GList *templ_acct_transactions = NULL;
templ_acct_splits
= xaccAccountGetSplitList(sx->template_acct);
for(curr_split_listref = templ_acct_splits;
curr_split_listref;
curr_split_listref = curr_split_listref->next)
{
curr_split = (Split *) curr_split_listref->data;
split_trans = xaccSplitGetParent(curr_split);
if(! (g_list_find(templ_acct_transactions, split_trans)))
{
templ_acct_transactions
= g_list_prepend(templ_acct_transactions, split_trans);
}
}
g_list_foreach(templ_acct_transactions,
sxprivTransMapDelete,
NULL);
return;
}
void
xaccSchedXactionFree( SchedXaction *sx )
{
AccountGroup *group;
GList *templ_acct_splits, *curr_split_listref;
GList *templ_acct_transactions=NULL;
Split *curr_split;
Transaction *split_trans;
if ( sx == NULL ) return;
xaccFreqSpecFree( sx->freq );
gnc_engine_generate_event( &sx->guid, GNC_EVENT_DESTROY );
xaccRemoveEntity( &sx->guid );
if ( sx->name )
g_free( sx->name );
/*
* we have to delete the transactions in the
* template account ourselves
*/
templ_acct_splits
= xaccAccountGetSplitList(sx->template_acct);
for(curr_split_listref = templ_acct_splits;
curr_split_listref;
curr_split_listref = curr_split_listref->next)
{
curr_split = (Split *) curr_split_listref->data;
split_trans = xaccSplitGetParent(curr_split);
if(! (g_list_find(templ_acct_transactions, split_trans)))
{
templ_acct_transactions
= g_list_prepend(templ_acct_transactions, split_trans);
}
}
g_list_foreach(templ_acct_transactions,
sxprivTransMapDelete,
NULL);
/*
* xaccAccountDestroy removes the account from
* its group for us AFAICT
*/
xaccAccountBeginEdit(sx->template_acct);
xaccAccountDestroy(sx->template_acct);
g_free( sx );
return;
if ( sx == NULL ) return;
xaccFreqSpecFree( sx->freq );
gnc_engine_generate_event( &sx->guid, GNC_EVENT_DESTROY );
xaccRemoveEntity( &sx->guid );
if ( sx->name )
g_free( sx->name );
/*
* we have to delete the transactions in the
* template account ourselves
*/
delete_template_trans( sx );
/*
* xaccAccountDestroy removes the account from
* its group for us AFAICT
*/
xaccAccountBeginEdit(sx->template_acct);
xaccAccountDestroy(sx->template_acct);
g_free( sx );
return;
}
@ -477,10 +479,6 @@ GDate xaccSchedXactionGetInstanceAfter( SchedXaction *sx, GDate *date )
return next_occur;
}
/*
* XXX: This does what you want, I think <rgmerk>
*/
GList *
xaccSchedXactionGetSplits( SchedXaction *sx )
{
@ -500,3 +498,103 @@ xaccSchedXactionIsDirty(SchedXaction *sx)
{
return sx->dirty;
}
static Split *
pack_split_info(TTSplitInfo *s_info, Account *parent_acct)
{
Split *split;
kvp_frame *split_frame, *sx_frame;
kvp_value *tmp_value;
const GUID *acc_guid;
split = xaccMallocSplit();
xaccSplitSetMemo(split,
gnc_ttsplitinfo_get_memo(s_info));
xaccSplitSetAction(split,
gnc_ttsplitinfo_get_action(s_info));
xaccSplitSetAccount(split,
parent_acct);
split_frame = xaccSplitGetSlots(split);
tmp_value
= kvp_value_new_string(gnc_ttsplitinfo_get_credit_formula(s_info));
kvp_frame_set_slot_path(split_frame,
tmp_value,
"sched-xaction",
"credit-formula");
kvp_value_delete(tmp_value);
tmp_value
= kvp_value_new_string(gnc_ttsplitinfo_get_debit_formula(s_info));
kvp_frame_set_slot_path(split_frame,
tmp_value,
"sched-xaction",
"debit-formula");
kvp_value_delete(tmp_value);
acc_guid = xaccAccountGetGUID(gnc_ttsplitinfo_get_account(s_info));
tmp_value = kvp_value_new_guid(acc_guid);
kvp_frame_set_slot_path(split_frame,
tmp_value,
"sched-xaction",
"xfrm");
kvp_value_delete(tmp_value);
return split;
}
void xaccSchedXactionSetTemplateTrans(SchedXaction *sx, GList *t_t_list)
{
Transaction *new_trans;
TTInfo *tti;
TTSplitInfo *s_info;
Split *new_split;
/* delete any old transactions, if there are any */
GList *split_list;
delete_template_trans( sx );
for(;t_t_list != NULL; t_t_list = t_t_list->next)
{
tti = t_t_list->data;
new_trans = xaccMallocTransaction();
xaccTransBeginEdit(new_trans);
xaccTransSetDescription(new_trans,
gnc_ttinfo_get_description(tti));
xaccTransSetNum(new_trans,
gnc_ttinfo_get_num(tti));
for(split_list = gnc_ttinfo_get_template_splits(tti);
split_list;
split_list = split_list->next)
{
s_info = split_list->data;
new_split = pack_split_info(s_info, sx->template_acct);
xaccTransAppendSplit(new_trans, new_split);
}
xaccTransCommitEdit(new_trans);
}
return;
}

View File

@ -211,4 +211,12 @@ void xaccSchedXactionSetGUID( SchedXaction *sx, GUID g );
GDate xaccSchedXactionGetNextInstance( SchedXaction *sx );
GDate xaccSchedXactionGetInstanceAfter( SchedXaction *sx, GDate *date );
/*
* Set the schedxaction's template transaction. t_t_list is a glist
* of TTInfo's as defined in SX-ttinfo.h
* the edit dialog doesn't use this mechanism. Maybe it should
*/
void xaccSchedXactionSetTemplateTrans(SchedXaction *sx, GList *t_t_list);
#endif /* XACC_SCHEDXACTION_H */

View File

@ -156,11 +156,18 @@ Type: GUID
Entities: Split associated with a SchedXaction
Use: The GUID of this Split's xfrm account.
Name: sched-xaction/amnt
Name: sched-xaction/credit-formula
Type: string
Entities: Split associated with a SchedXaction
Use: The amount field of a SchedXaction might be a formula, which we
store here.
Use: Store the formula for the credit side of the split
Name: sched-xaction/debit-formula
Type: string
Entities: Split associated with a SchedXaction
Use: Formula for the debit. Either the credit or the
debit formula must be empty.
Name: from-sched-xaction
Type: GUID

View File

@ -20,6 +20,7 @@ libgncgnome_a_SOURCES = \
dialog-print-check.c \
dialog-progress.c \
dialog-style-sheet.c \
dialog-sx-from-trans.c \
dialog-tax-info.c \
dialog-totd.c \
dialog-transfer.c \

View File

@ -21,8 +21,8 @@
* Boston, MA 02111-1307, USA gnu@gnu.org *
********************************************************************/
#ifndef __DIALOG_COMMODITY_H_
#define __DIALOG_COMMODITY_H_
#ifndef GNC_DIALOG_COMMODITY_H_
#define GNC_DIALOG_COMMODITY_H_
#include "gnc-commodity.h"
#include "gnc-engine.h"

View File

@ -0,0 +1,424 @@
/********************************************************************
* 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> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
********************************************************************/
#include "config.h"
#include <gnome.h>
#include "dialog-utils.h"
#include "SchedXaction.h"
#include "dialog-sx-from-trans.h"
#include "dialog-scheduledxaction.h"
#include "SX-ttinfo.h"
#include "gnc-book.h"
#include "gnc-engine-util.h"
#include "FileDialog.h"
#define SX_GLADE_FILE "sched-xact.glade"
#define SXFTD_DIALOG_GLADE_NAME "sx_from_real_trans"
#define SXFTD_OK_BUTTON "ok_button"
#define SXFTD_ADVANCED_BUTTON "advanced_button"
#define SXFTD_CANCEL_BUTTON "cancel_button"
#define SXFTD_NEVER_END_BUTTON "never_end_button"
#define SXFTD_END_ON_DATE_BUTTON "end_on_date_button"
#define SXFTD_N_OCCURRENCES_BUTTON "n_occurrences_button"
#define SXFTD_NAME_ENTRY "name_entry"
#define SXFTD_N_OCCURRENCES_ENTRY "n_occurrences_entry"
#define SXFTD_FREQ_OPTION_MENU "freq_option_menu"
#define SXFTD_END_DATE_EDIT "end_date_edit"
static short module = MOD_SX;
static void sxftd_ok_clicked(GtkWidget *w, gpointer user_data);
static void sxftd_advanced_clicked(GtkWidget *w, gpointer user_data);
static void sxftd_cancel_clicked(GtkWidget *w, gpointer user_data);
typedef enum {NEVER_END, END_ON_DATE, END_AFTER_N_OCCS, BAD_END} endType;
typedef enum {FREQ_DAILY = 0, /* I know the =0 is redundant, but I'm using
* the numeric equivalences explicitly here
*/
FREQ_WEEKLY,
FREQ_MONTHLY,
FREQ_QUARTERLY,
FREQ_ANNUALLY} SxftiFreqType;
typedef struct
{
GladeXML *gxml;
GtkWidget *dialog;
Transaction *trans;
SchedXaction *sx;
} SXFromTransInfo;
typedef struct
{
endType type;
GDate end_date;
guint n_occurrences;
} getEndTuple;
/* Stolen from jsled - nice and neat, actually (if a little light on
* for typechecking, but we'll be careful) . . .
*/
typedef struct
{
gchar *name;
gchar *signal;
void (*handlerFn)();
} widgetSignalHandlerTuple;
static void
sxfti_attach_callbacks(SXFromTransInfo *sxfti)
{
widgetSignalHandlerTuple callbacks[] =
{
{SXFTD_OK_BUTTON, "clicked", sxftd_ok_clicked},
{SXFTD_ADVANCED_BUTTON, "clicked", sxftd_advanced_clicked},
{SXFTD_CANCEL_BUTTON, "clicked", sxftd_cancel_clicked},
{NULL, NULL, NULL}
};
int i;
GtkWidget *w;
for(i = 0; callbacks[i].name != NULL; i++)
{
w = glade_xml_get_widget(sxfti->gxml, callbacks[i].name);
gtk_signal_connect( GTK_OBJECT(w), callbacks[i].signal,
GTK_SIGNAL_FUNC(callbacks[i].handlerFn),
sxfti);
}
return;
}
static getEndTuple
sxftd_get_end_info(SXFromTransInfo *sxfti)
{
getEndTuple retval;
GtkWidget *w;
w = glade_xml_get_widget(sxfti->gxml, SXFTD_NEVER_END_BUTTON);
if(gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(w)))
{
retval.type = NEVER_END;
return retval;
}
w = glade_xml_get_widget(sxfti->gxml, SXFTD_END_ON_DATE_BUTTON);
if(gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(w)))
{
time_t end_t_jul;
retval.type = END_ON_DATE;
g_date_clear( &(retval.end_date), 1 );
w = glade_xml_get_widget(sxfti->gxml, SXFTD_END_DATE_EDIT);
end_t_jul = gnome_date_edit_get_date(GNOME_DATE_EDIT(w));
g_date_set_julian( &(retval.end_date), end_t_jul);
return retval;
}
w = glade_xml_get_widget(sxfti->gxml, SXFTD_N_OCCURRENCES_BUTTON);
if(gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(w) ))
{
gchar *text, *endptr;
guint n_occs;
w = glade_xml_get_widget(sxfti->gxml, SXFTD_N_OCCURRENCES_ENTRY);
text = gtk_editable_get_chars(GTK_EDITABLE(w), 0, -1);
n_occs = strtoul(text, &endptr, 10);
free(text);
if(!endptr && n_occs > 0)
{
retval.type = END_AFTER_N_OCCS;
retval.n_occurrences = n_occs;
return retval;
}
}
retval.type = BAD_END;
return retval;
}
static guint
sxftd_add_template_trans(SXFromTransInfo *sxfti)
{
Transaction *tr = sxfti->trans;
GList *tt_list= NULL;
GList *splits, *template_splits = NULL;
TTInfo *tti = gnc_ttinfo_malloc();
TTSplitInfo *ttsi;
Split *sp;
gnc_numeric split_value;
gnc_ttinfo_set_description(tti, xaccTransGetDescription(tr));
gnc_ttinfo_set_num(tti, xaccTransGetNum(tr));
gnc_ttinfo_set_currency(tti, xaccTransGetCurrency(tr));
for(splits = xaccTransGetSplitList(tr); splits; splits = splits->next)
{
sp = splits->data;
ttsi = gnc_ttsplitinfo_malloc();
gnc_ttsplitinfo_set_action(ttsi, xaccSplitGetAction(sp));
split_value = xaccSplitGetValue(sp);
gnc_ttsplitinfo_set_memo(ttsi, xaccSplitGetMemo(sp));
if(gnc_numeric_positive_p(split_value)) /* FIXME:I still can't remember which one is stored positive :) */
{
gnc_ttsplitinfo_set_debit_formula_numeric(ttsi, split_value);
}
else
{
gnc_ttsplitinfo_set_credit_formula_numeric(ttsi, split_value);
}
template_splits = g_list_append(template_splits, ttsi);
}
gnc_ttinfo_set_template_splits(tti, template_splits);
tt_list = g_list_append(tt_list, tti);
xaccSchedXactionSetTemplateTrans(sxfti->sx, tt_list);
return 0;
}
static guint
sxftd_compute_sx(SXFromTransInfo *sxfti)
{
GtkWidget *w;
gchar *name;
GDate date;
time_t trans_t;
int index;
getEndTuple end_info;
guint sxftd_errno = 0; /* 0 == OK, > 0 means dialog needs to be run again */
FreqSpec *fs;
SchedXaction *sx = sxfti->sx;
/* get the name */
w = glade_xml_get_widget(sxfti->gxml, SXFTD_NAME_ENTRY);
name = gtk_editable_get_chars(GTK_EDITABLE(w), 0, -1);
xaccSchedXactionSetName(sx, name);
g_free(name);
/* get the date (basis for start date */
trans_t = xaccTransGetDate(sxfti->trans);
g_date_set_julian(&date, trans_t);
fs = xaccFreqSpecMalloc();
/* 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
*/
switch(index)
{
case FREQ_DAILY:
g_date_add_days(&date, 1);
xaccFreqSpecSetDaily(fs, &date, 1);
break;
case FREQ_WEEKLY:
g_date_add_days(&date, 7);
xaccFreqSpecSetWeekly(fs, &date, 1);
break;
case FREQ_MONTHLY:
g_date_add_months(&date, 1);
xaccFreqSpecSetMonthly(fs, &date, 1);
break;
case FREQ_QUARTERLY:
g_date_add_months(&date, 3);
xaccFreqSpecSetMonthly(fs, &date, 3);
break;
case FREQ_ANNUALLY:
g_date_add_years(&date, 1);
xaccFreqSpecSetMonthly(fs, &date, 12);
break;
default:
PWARN("Nonexistent frequency selected. This is a bug.");
/* report fsckup */
sxftd_errno = 1;
break;
}
end_info = sxftd_get_end_info(sxfti);
switch(end_info.type)
{
case NEVER_END:
break;
case END_ON_DATE:
xaccSchedXactionSetEndDate(sx, &(end_info.end_date));
break;
case END_AFTER_N_OCCS:
xaccSchedXactionSetNumOccur(sx, end_info.n_occurrences);
break;
default:
sxftd_errno = 2;
break;
}
sxftd_add_template_trans( sxfti);
return sxftd_errno;
}
static void
sxftd_delete(SXFromTransInfo *sxfti, gboolean delete_sx)
{
/* FIXME: do we need to clean up the GladeXML pointer ?*/
gnome_dialog_close( GNOME_DIALOG(sxfti->dialog));
if(sxfti->sx && delete_sx)
{
xaccSchedXactionFree(sxfti->sx);
}
g_free(sxfti);
return;
}
static void
sxftd_ok_clicked(GtkWidget *w, gpointer user_data)
{
SXFromTransInfo *sxfti = user_data;
GNCBook *book;
GList *sx_list;
guint sx_error = sxftd_compute_sx(sxfti);
if (sx_error == 0)
{
book = gncGetCurrentBook();
sx_list = gnc_book_get_schedxactions(book);
sx_list = g_list_append(sx_list, sxfti->sx);
gnc_book_set_schedxactions(book, sx_list);
}
sxftd_delete(sxfti, FALSE);
return;
}
static void
sxftd_cancel_clicked(GtkWidget *w, gpointer user_data)
{
SXFromTransInfo *sxfti = user_data;
sxftd_delete(sxfti, TRUE);
}
static void
sxftd_advanced_clicked(GtkWidget *w, gpointer user_data)
{
SXFromTransInfo *sxfti = user_data;
GNCBook *book;
GList *sx_list;
guint sx_error = sxftd_compute_sx(sxfti);
SchedXactionDialog *adv_dlg;
SchedXactionEditorDialog *adv_edit_dlg;
if (sx_error == 0)
{
adv_dlg = gnc_ui_scheduled_xaction_dialog_create();
adv_edit_dlg = gnc_ui_scheduled_xaction_editor_dialog_create(adv_dlg,
sxfti->sx);
}
else
{
PWARN("something bad happened in sxftd_compute_sx");
}
return;
}
void
gnc_sx_create_from_trans(Transaction *trans)
{
GtkWidget *w;
SXFromTransInfo *sxfti = g_malloc(sizeof(SXFromTransInfo));
sxfti->gxml = gnc_glade_xml_new(SX_GLADE_FILE,
SXFTD_DIALOG_GLADE_NAME);
sxfti->dialog = glade_xml_get_widget(sxfti->gxml,
SXFTD_DIALOG_GLADE_NAME);
sxfti->trans = trans;
sxfti->sx = xaccSchedXactionMalloc(gncGetCurrentBook());
sxfti_attach_callbacks(sxfti);
w = glade_xml_get_widget(sxfti->gxml,
SXFTD_FREQ_OPTION_MENU);
gnc_option_menu_init(w);
gtk_widget_show_all(sxfti->dialog);
return;
}

View File

@ -0,0 +1,33 @@
/********************************************************************
* dialog-sx-from-trans.h -- a simple dialog for creating a *
* scheduled transaction for a "real *
* one *
* (GnuCash) *
* Copyright (C) 2000 Robert Merkel <rgmerk@mira.net> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
********************************************************************/
#ifndef GNC_DIALOG_SX_FROM_TRANS_H
#define GNC_DIALOG_SX_FROM_TRANS_H
#include "Transaction.h"
void gnc_sx_create_from_trans(Transaction *trans);
#endif

View File

@ -375,155 +375,6 @@
</widget>
</widget>
</widget>
<widget>
<class>GtkFrame</class>
<name>frame47</name>
<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>
<border_width>2</border_width>
<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>GtkRadioButton</class>
<name>rb_enddate</name>
<can_focus>True</can_focus>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>sx_end_opt</group>
<child>
<padding>2</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkHBox</class>
<name>hbox152</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkLabel</class>
<name>label847812</name>
<label>End 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>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>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>rb_num_occur</name>
<can_focus>True</can_focus>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>sx_end_opt</group>
<child>
<padding>2</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkVBox</class>
<name>vbox134</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkLabel</class>
<name>label847811</name>
<label>Number of Occurances:</label>
<justify>GTK_JUSTIFY_LEFT</justify>
<wrap>False</wrap>
<xalign>7.45058e-09</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>GnomeNumberEntry</class>
<name>end_nentry</name>
<max_saved>10</max_saved>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</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>
</widget>
</widget>
</widget>
</widget>
</widget>
</widget>
<widget>
@ -542,6 +393,155 @@
<class>Placeholder</class>
</widget>
</widget>
<widget>
<class>GtkFrame</class>
<name>frame77</name>
<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>vbox144</name>
<border_width>2</border_width>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkRadioButton</class>
<name>radiobutton1</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>GtkRadioButton</class>
<name>radiobutton2</name>
<can_focus>True</can_focus>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>sx_end_opt</group>
<child>
<padding>2</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkHBox</class>
<name>hbox160</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkLabel</class>
<name>label847840</name>
<label>End 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>False</fill>
</child>
</widget>
<widget>
<class>GnomeDateEdit</class>
<name>dateedit1</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>False</fill>
</child>
</widget>
</widget>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>radiobutton3</name>
<can_focus>True</can_focus>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>sx_end_opt</group>
<child>
<padding>2</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkVBox</class>
<name>vbox145</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkLabel</class>
<name>label847841</name>
<label>Number of Occurrences:</label>
<justify>GTK_JUSTIFY_LEFT</justify>
<wrap>False</wrap>
<xalign>7.45058e-09</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>GnomeNumberEntry</class>
<name>numberentry1</name>
<max_saved>10</max_saved>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GnomeEntry:entry</child_name>
<name>entry3</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
</widget>
</widget>
</widget>
</widget>
</widget>
<widget>
@ -4279,4 +4279,303 @@ Select those you wish to delete.</label>
</widget>
</widget>
<widget>
<class>GnomeDialog</class>
<name>sx_from_real_trans</name>
<title>Make Scheduled transaction</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>False</allow_grow>
<auto_shrink>False</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-vbox23</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_area23</name>
<layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style>
<spacing>8</spacing>
<child_min_width>0</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>ok_button</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>advanced_button</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<label>Advanced...</label>
</widget>
<widget>
<class>GtkButton</class>
<name>cancel_button</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>vbox146</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkHBox</class>
<name>hbox161</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label847842</name>
<label>Name:</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>GtkEntry</class>
<name>name_entry</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>44</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
<widget>
<class>GtkHBox</class>
<name>hbox162</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label847843</name>
<label>Frequency:</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>GtkOptionMenu</class>
<name>freq_option_menu</name>
<can_focus>True</can_focus>
<items>Daily
Weekly
Monthly
Quarterly
Anually
</items>
<initial_choice>2</initial_choice>
<child>
<padding>22</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
<widget>
<class>GtkFrame</class>
<name>frame78</name>
<label>End </label>
<label_xalign>0</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>vbox147</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkRadioButton</class>
<name>never_end_button</name>
<can_focus>True</can_focus>
<label>Never End</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>end_group</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkHBox</class>
<name>hbox163</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkRadioButton</class>
<name>end_on_date_button</name>
<can_focus>True</can_focus>
<label>End Date:</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>end_group</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GnomeDateEdit</class>
<name>end_date_edit</name>
<show_time>False</show_time>
<use_24_format>True</use_24_format>
<week_start_monday>False</week_start_monday>
<lower_hour>0</lower_hour>
<upper_hour>23</upper_hour>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
<widget>
<class>GtkHBox</class>
<name>hbox164</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkRadioButton</class>
<name>n_occurrences_button</name>
<can_focus>True</can_focus>
<label>Number Of Occurrences:</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>end_group</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GnomeEntry</class>
<name>entry5</name>
<width>152</width>
<max_saved>10</max_saved>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GnomeEntry:entry</child_name>
<name>n_occurrences_entry</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
</widget>
</widget>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface>

View File

@ -14,11 +14,11 @@ gchar *s = N_("Create ");
gchar *s = N_(" days in advance");
gchar *s = N_("Remind me ");
gchar *s = N_(" days in advance");
gchar *s = N_("Recurrence Frequency");
gchar *s = N_("End");
gchar *s = N_("No End");
gchar *s = N_("End Date: ");
gchar *s = N_("Number of Occurances:");
gchar *s = N_("Recurrence Frequency");
gchar *s = N_("Number of Occurrences:");
gchar *s = N_("Template Transaction");
gchar *s = N_("Record");
gchar *s = N_("REPLACEME with the Register control box");
@ -400,3 +400,16 @@ gchar *s = N_("The following scheduled transactions have expired.\n"
gchar *s = N_("Name");
gchar *s = N_("Frequency");
gchar *s = N_("Ended On");
gchar *s = N_("Make Scheduled transaction");
gchar *s = N_("Advanced...");
gchar *s = N_("Name:");
gchar *s = N_("Frequency:");
gchar *s = N_("Daily");
gchar *s = N_("Weekly");
gchar *s = N_("Monthly");
gchar *s = N_("Quarterly");
gchar *s = N_("Anually");
gchar *s = N_("End ");
gchar *s = N_("Never End");
gchar *s = N_("End Date:");
gchar *s = N_("Number Of Occurrences:");

View File

@ -40,6 +40,7 @@
#include "dialog-find-transactions.h"
#include "dialog-transfer.h"
#include "dialog-utils.h"
#include "dialog-sx-from-trans.h"
#include "global-options.h"
#include "gnc-component-manager.h"
#include "gnc-dateedit.h"
@ -139,6 +140,7 @@ static void helpCB(GtkWidget *w, gpointer data);
static void newAccountCB(GtkWidget * w, gpointer data);
static void deleteCB(GtkWidget *w, gpointer data);
static void duplicateCB(GtkWidget *w, gpointer data);
static void recurCB(GtkWidget *w, gpointer data);
static void recordCB(GtkWidget *w, gpointer data);
static void cancelCB(GtkWidget *w, gpointer data);
static void closeCB(GtkWidget *w, gpointer data);
@ -867,6 +869,14 @@ gnc_register_create_tool_bar (RegWindow *regData)
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_COPY,
0, 0, NULL
},
{
GNOME_APP_UI_ITEM,
N_("Recur"),
N_("Make a scheduled transaction using this one as a template"),
recurCB, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_LINE_IN,
0, 0, NULL
},
GNOMEUIINFO_SEPARATOR,
{
GNOME_APP_UI_TOGGLEITEM,
@ -1498,6 +1508,14 @@ gnc_register_create_menu_bar(RegWindow *regData, GtkWidget *statusbar)
GNOME_APP_PIXMAP_NONE, NULL,
0, 0, NULL
},
{
GNOME_APP_UI_ITEM,
N_("_Recur"),
N_("Create a scheduled transaction using this one as a template"),
recurCB, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, 0, NULL
},
GNOMEUIINFO_SEPARATOR,
{
GNOME_APP_UI_TOGGLEITEM,
@ -1688,6 +1706,14 @@ gnc_register_create_popup_menu (RegWindow *regData)
GNOME_APP_PIXMAP_NONE, NULL,
0, 0, NULL
},
{
GNOME_APP_UI_ITEM,
N_("_Recur"),
N_("Make a scheduled transaction using this one as a template"),
recurCB, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, 0, NULL
},
GNOMEUIINFO_SEPARATOR,
{
GNOME_APP_UI_TOGGLEITEM,
@ -3114,6 +3140,24 @@ static void duplicateCB(GtkWidget *w, gpointer data)
}
/********************************************************************\
* recurCB *
* *
* Args: widget - the widget that called us *
* data - the data struct for this register *
* Return: none *
\********************************************************************/
static void recurCB(GtkWidget *w, gpointer data)
{
RegWindow *regData = data;
Transaction *pending_trans = xaccSRGetCurrentTrans(xaccLedgerDisplayGetSR (regData->ledger));
gnc_sx_create_from_trans(pending_trans);
return;
}
/********************************************************************\
* cancelCB *
* *

View File

@ -201,11 +201,14 @@ CellIOFlags xaccSRTemplateGetIOFlagsHandler (VirtualLocation virt_loc,
gboolean xaccSRTemplateConfirmHandler (VirtualLocation virt_loc,
gpointer user_data);
// jsled-added 2001.05.19 for export to dialog-nextrun.c [which will
// change its name at some point]
/*
* jsled-added 2001.05.19 for export to dialog-nextrun.c [which will
* change its name at some point]
*/
void gnc_copy_trans_onto_trans(Transaction *from, Transaction *to,
gboolean use_cut_semantics,
gboolean do_commit);
#endif