2004-03-08 Christian Stimming <stimming@tuhh.de>

* src/import-export/hbci/dialog-hbcitrans.c, dialog-hbcitrans.h,
	glade/hbci.glade, gnc-hbci-transfer.c: Transfer template management
	GUI added by Bernd Wagner <F.J.Bernd.Wagner@t-online.de>


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@9856 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2004-03-09 17:39:46 +00:00
parent e60485652d
commit c967d17c4e
5 changed files with 462 additions and 82 deletions

View File

@ -1,3 +1,9 @@
2004-03-08 Christian Stimming <stimming@tuhh.de>
* src/import-export/hbci/dialog-hbcitrans.c, dialog-hbcitrans.h,
glade/hbci.glade, gnc-hbci-transfer.c: Transfer template management
GUI added by Bernd Wagner <F.J.Bernd.Wagner@t-online.de>
2004-03-03 Derek Atkins <derek@ihtfp.com> 2004-03-03 Derek Atkins <derek@ihtfp.com>
* src/register/ledger-core/split-register-load.c: make the code a * src/register/ledger-core/split-register-load.c: make the code a

View File

@ -1,6 +1,8 @@
/********************************************************************\ /********************************************************************\
* dialog-hbcitrans.c -- dialog for hbci transaction * * dialog-hbcitrans.c -- dialog for hbci transaction *
* Copyright (C) 2002 Christian Stimming * * Copyright (C) 2002 Christian Stimming *
* Copyright (C) 2004 Bernd Wagner (changes for *
* online transaction templates) *
* * * *
* This program is free software; you can redistribute it and/or * * This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as * * modify it under the terms of the GNU General Public License as *
@ -67,12 +69,18 @@ struct _trans_data
/* Recipient's bank name (may be filled in automatically sometime later) */ /* Recipient's bank name (may be filled in automatically sometime later) */
GtkWidget *recp_bankname_label; GtkWidget *recp_bankname_label;
/* The template choosing option menu */ /* The template choosing GtkList */
GtkWidget *template_option; GtkWidget *template_gtk_list;
/* The selected template in the list */
GtkWidget *selected_template;
/* GList of GNCTransTempl */ /* GList of GNCTransTempl */
GList *templ; GList *templ;
/* Flag, if template list has been changed */
gboolean templ_changed;
/* The HBCI transaction that got created here */ /* The HBCI transaction that got created here */
HBCI_Transaction *hbci_trans; HBCI_Transaction *hbci_trans;
@ -98,6 +106,8 @@ void gnc_hbci_dialog_delete(HBCITransDialog *td)
if (td->hbci_trans) if (td->hbci_trans)
HBCI_Transaction_delete (td->hbci_trans); HBCI_Transaction_delete (td->hbci_trans);
td->selected_template = NULL;
gtk_widget_destroy (GTK_WIDGET (td->dialog)); gtk_widget_destroy (GTK_WIDGET (td->dialog));
#if HAVE_KTOBLZCHECK_H #if HAVE_KTOBLZCHECK_H
AccountNumberCheck_delete(td->blzcheck); AccountNumberCheck_delete(td->blzcheck);
@ -124,6 +134,11 @@ Transaction *gnc_hbci_dialog_get_gtrans(const HBCITransDialog *td)
g_assert(td); g_assert(td);
return td->gnc_trans; return td->gnc_trans;
} }
gboolean gnc_hbci_dialog_get_templ_changed(const HBCITransDialog *td)
{
g_assert(td);
return td->templ_changed;
}
void gnc_hbci_dialog_hide(HBCITransDialog *td) void gnc_hbci_dialog_hide(HBCITransDialog *td)
{ {
g_assert(td); g_assert(td);
@ -146,8 +161,17 @@ gboolean
check_ktoblzcheck(GtkWidget *parent, const HBCITransDialog *td, check_ktoblzcheck(GtkWidget *parent, const HBCITransDialog *td,
const HBCI_Transaction *trans); const HBCI_Transaction *trans);
void on_template_list_select_child(GtkList *list, GtkWidget *widget, gpointer user_data);
void on_template_list_selection_changed(GtkList *list, gpointer user_data);
void on_template_list_unselect_child(GtkList *list, GtkWidget *widget, gpointer user_data);
void template_selection_cb(GtkButton *b, gpointer user_data); void template_selection_cb(GtkButton *b, gpointer user_data);
void add_template_cb(GtkButton *b, gpointer user_data); void add_template_cb(GtkButton *b, gpointer user_data);
void moveup_template_cb(GtkButton *button, gpointer user_data);
void movedown_template_cb(GtkButton *button, gpointer user_data);
void sort_template_cb(GtkButton *button, gpointer user_data);
void del_template_cb(GtkButton *button, gpointer user_data);
void blz_changed_cb(GtkEditable *e, gpointer user_data); void blz_changed_cb(GtkEditable *e, gpointer user_data);
@ -162,20 +186,20 @@ void blz_changed_cb(GtkEditable *e, gpointer user_data);
* constructor * constructor
*/ */
static void fill_template_menu_func(gpointer data, gpointer user_data) static void fill_template_list_func(gpointer data, gpointer user_data)
{ {
GNCTransTempl *templ = data; GNCTransTempl *templ = data;
GtkMenu *menu = user_data; GtkList *list = user_data;
GtkWidget *item; GtkWidget *item;
g_assert(templ); g_assert(templ);
g_assert(menu); g_assert(list);
item = gtk_menu_item_new_with_label(gnc_trans_templ_get_name(templ)); item = gtk_list_item_new_with_label(gnc_trans_templ_get_name(templ));
g_assert(item); g_assert(item);
gtk_object_set_user_data(GTK_OBJECT(item), templ); gtk_object_set_user_data(GTK_OBJECT(item), templ);
gtk_menu_append(menu, item); gtk_container_add(GTK_CONTAINER(list), item );
} }
HBCITransDialog * HBCITransDialog *
@ -226,6 +250,10 @@ gnc_hbci_dialog_new (GtkWidget *parent,
GtkWidget *orig_bankcode_heading; GtkWidget *orig_bankcode_heading;
GtkWidget *exec_later_button; GtkWidget *exec_later_button;
GtkWidget *add_templ_button; GtkWidget *add_templ_button;
GtkWidget *moveup_templ_button;
GtkWidget *movedown_templ_button;
GtkWidget *sort_templ_button;
GtkWidget *del_templ_button;
g_assert g_assert
(heading_label = glade_xml_get_widget (xml, "heading_label")); (heading_label = glade_xml_get_widget (xml, "heading_label"));
@ -268,9 +296,17 @@ gnc_hbci_dialog_new (GtkWidget *parent,
g_assert g_assert
(exec_later_button = glade_xml_get_widget (xml, "exec_later_button")); (exec_later_button = glade_xml_get_widget (xml, "exec_later_button"));
g_assert g_assert
(td->template_option = glade_xml_get_widget (xml, "template_optionmenu")); (td->template_gtk_list = glade_xml_get_widget (xml, "template_list"));
g_assert g_assert
(add_templ_button = glade_xml_get_widget (xml, "add_templ_button")); (add_templ_button = glade_xml_get_widget (xml, "add_templ_button"));
g_assert
(moveup_templ_button = glade_xml_get_widget (xml, "moveup_templ_button"));
g_assert
(movedown_templ_button = glade_xml_get_widget (xml, "movedown_templ_button"));
g_assert
(sort_templ_button = glade_xml_get_widget (xml, "sort_templ_button"));
g_assert
(del_templ_button = glade_xml_get_widget (xml, "del_templ_button"));
td->amount_edit = gnc_amount_edit_new(); td->amount_edit = gnc_amount_edit_new();
gtk_box_pack_start_defaults(GTK_BOX(amount_hbox), td->amount_edit); gtk_box_pack_start_defaults(GTK_BOX(amount_hbox), td->amount_edit);
@ -330,17 +366,41 @@ gnc_hbci_dialog_new (GtkWidget *parent,
gtk_label_set_text (GTK_LABEL (orig_bankcode_label), gtk_label_set_text (GTK_LABEL (orig_bankcode_label),
HBCI_Bank_bankCode (bank)); HBCI_Bank_bankCode (bank));
/* fill OptionMenu for choosing a transaction template */ /* fill list for choosing a transaction template */
g_list_foreach(td->templ, fill_template_menu_func, g_list_foreach(td->templ, fill_template_list_func,
gtk_option_menu_get_menu GTK_LIST (td->template_gtk_list));
( GTK_OPTION_MENU (td->template_option)));
td->selected_template = NULL;
td->templ_changed = FALSE;
/* Connect signals */ /* Connect signals */
gnc_option_menu_init_w_signal (td->template_option, /* gnc_option_menu_init_w_signal (td->template_option,
GTK_SIGNAL_FUNC(template_selection_cb), GTK_SIGNAL_FUNC(template_selection_cb),
td); */
gtk_signal_connect (GTK_OBJECT (td->template_gtk_list), "select_child",
GTK_SIGNAL_FUNC (on_template_list_select_child),
td); td);
gtk_signal_connect(GTK_OBJECT (add_templ_button), "clicked", gtk_signal_connect(GTK_OBJECT (add_templ_button), "clicked",
GTK_SIGNAL_FUNC(add_template_cb), td); GTK_SIGNAL_FUNC(add_template_cb), td);
gtk_signal_connect (GTK_OBJECT (moveup_templ_button), "clicked",
GTK_SIGNAL_FUNC (moveup_template_cb),
td);
gtk_signal_connect (GTK_OBJECT (movedown_templ_button), "clicked",
GTK_SIGNAL_FUNC (movedown_template_cb),
td);
gtk_signal_connect (GTK_OBJECT (sort_templ_button), "clicked",
GTK_SIGNAL_FUNC (sort_template_cb),
td);
gtk_signal_connect (GTK_OBJECT (del_templ_button), "clicked",
GTK_SIGNAL_FUNC (del_template_cb),
td);
gtk_signal_connect(GTK_OBJECT (td->recp_bankcode_entry), "changed", gtk_signal_connect(GTK_OBJECT (td->recp_bankcode_entry), "changed",
GTK_SIGNAL_FUNC(blz_changed_cb), td); GTK_SIGNAL_FUNC(blz_changed_cb), td);
@ -619,19 +679,18 @@ static void fill_entry(const char *str, GtkWidget *entry) {
gtk_entry_set_text (GTK_ENTRY (entry), str ? str : ""); gtk_entry_set_text (GTK_ENTRY (entry), str ? str : "");
} }
void template_selection_cb(GtkButton *b,
void
on_template_list_select_child (GtkList *list,
GtkWidget *widget,
gpointer user_data) gpointer user_data)
{ {
HBCITransDialog *td = user_data; HBCITransDialog *td = user_data;
unsigned index;
g_assert(td); g_assert(td);
index = gnc_option_menu_get_active (td->template_option);
/*printf("template_selection_cd: %d is active \n", index);*/ td->selected_template = widget;
if ((index > 0) && (index <= g_list_length(td->templ)))
{ GNCTransTempl *templ = gtk_object_get_user_data (GTK_OBJECT(widget)) ;
GNCTransTempl *templ = g_list_nth_data(td->templ, index-1);
/*printf("template_selection_cd: using template %s \n",
gnc_trans_templ_get_name(templ));*/
fill_entry(gnc_trans_templ_get_recp_name(templ), td->recp_name_entry); fill_entry(gnc_trans_templ_get_recp_name(templ), td->recp_name_entry);
fill_entry(gnc_trans_templ_get_recp_account(templ), td->recp_account_entry); fill_entry(gnc_trans_templ_get_recp_account(templ), td->recp_account_entry);
@ -641,9 +700,32 @@ void template_selection_cb(GtkButton *b,
gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (td->amount_edit), gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (td->amount_edit),
gnc_trans_templ_get_amount (templ)); gnc_trans_templ_get_amount (templ));
}
} }
void
on_template_list_selection_changed (GtkList *list,
gpointer user_data)
{
}
void
on_template_list_unselect_child (GtkList *list,
GtkWidget *widget,
gpointer user_data)
{
HBCITransDialog *td = user_data;
g_assert(td);
td->selected_template = NULL;
}
void blz_changed_cb(GtkEditable *e, gpointer user_data) void blz_changed_cb(GtkEditable *e, gpointer user_data)
{ {
#if HAVE_KTOBLZCHECK_H #if HAVE_KTOBLZCHECK_H
@ -694,6 +776,8 @@ void add_template_cb(GtkButton *b,
GtkWidget *dlg; GtkWidget *dlg;
char *name; char *name;
int retval = -1; int retval = -1;
GNCTransTempl *t;
gint index;
g_assert(td); g_assert(td);
dlg = gnome_request_dialog(FALSE, dlg = gnome_request_dialog(FALSE,
@ -713,22 +797,167 @@ void add_template_cb(GtkButton *b,
gtk_entry_get_text (GTK_ENTRY (td->purpose_entry)), gtk_entry_get_text (GTK_ENTRY (td->purpose_entry)),
gtk_entry_get_text (GTK_ENTRY (td->purpose_cont_entry))); gtk_entry_get_text (GTK_ENTRY (td->purpose_cont_entry)));
/* Append new template to the list. */ if (td->selected_template) {
td->templ = g_list_append(td->templ, r); t = gtk_object_get_user_data(GTK_OBJECT(td->selected_template));
index = 1+gtk_list_child_position(GTK_LIST(td->template_gtk_list), td->selected_template);
}
else index = 0;
td->templ = g_list_insert(td->templ, r, index);
td->templ_changed = TRUE;
gtk_list_clear_items(GTK_LIST(td->template_gtk_list), 0, -1);
/* fill list for choosing a transaction template */
g_list_foreach(td->templ, fill_template_list_func,
GTK_LIST (td->template_gtk_list));
gtk_list_select_item(GTK_LIST(td->template_gtk_list), index);
/* Also append that template to the OptionMenu */
fill_template_menu_func(r,
gtk_option_menu_get_menu
( GTK_OPTION_MENU (td->template_option)));
/* the show_all is necessary since otherwise the new item doesn't show up */ /* the show_all is necessary since otherwise the new item doesn't show up */
gtk_widget_show_all (GTK_WIDGET (gtk_option_menu_get_menu gtk_widget_show_all (GTK_WIDGET ( GTK_LIST (td->template_gtk_list)));
( GTK_OPTION_MENU (td->template_option))));
gnc_option_menu_init_w_signal (td->template_option,
GTK_SIGNAL_FUNC(template_selection_cb),
td);
} }
} }
void
moveup_template_cb(GtkButton *button,
gpointer user_data)
{
HBCITransDialog *td = user_data;
GNCTransTempl *t;
gint index;
g_assert(td);
if (td->selected_template) {
t = gtk_object_get_user_data(GTK_OBJECT(td->selected_template));
index = gtk_list_child_position(GTK_LIST(td->template_gtk_list), td->selected_template);
if (index > 0) {
td->templ = g_list_remove( td->templ, t);
td->templ = g_list_insert( td->templ, t, index-1);
td->templ_changed = TRUE;
gtk_list_clear_items(GTK_LIST(td->template_gtk_list), 0, -1);
/* fill list for choosing a transaction template */
g_list_foreach(td->templ, fill_template_list_func,
GTK_LIST (td->template_gtk_list));
gtk_list_select_item(GTK_LIST(td->template_gtk_list), index-1);
gtk_widget_show_all (GTK_WIDGET ( GTK_LIST (td->template_gtk_list)));
}
}
}
void
movedown_template_cb(GtkButton *button,
gpointer user_data)
{
HBCITransDialog *td = user_data;
GNCTransTempl *t;
gint index;
g_assert(td);
if (td->selected_template) {
t = gtk_object_get_user_data(GTK_OBJECT(td->selected_template));
index = gtk_list_child_position(GTK_LIST(td->template_gtk_list), td->selected_template);
if (index < g_list_length(td->templ)-1) {
td->templ = g_list_remove( td->templ, t);
td->templ = g_list_insert( td->templ, t, index+1);
td->templ_changed = TRUE;
gtk_list_clear_items(GTK_LIST(td->template_gtk_list), 0, -1);
/* fill list for choosing a transaction template */
g_list_foreach(td->templ, fill_template_list_func,
GTK_LIST (td->template_gtk_list));
gtk_list_select_item(GTK_LIST(td->template_gtk_list), index+1);
gtk_widget_show_all (GTK_WIDGET ( GTK_LIST (td->template_gtk_list)));
}
}
}
static gint comparefunc(const gconstpointer e1,
const gconstpointer e2)
{
return g_strcasecmp(gnc_trans_templ_get_name((GNCTransTempl*)e1),
gnc_trans_templ_get_name((GNCTransTempl*)e2));
}
void
sort_template_cb(GtkButton *button,
gpointer user_data)
{
HBCITransDialog *td = user_data;
g_assert(td);
if (gnc_verify_dialog (td->parent,
FALSE, "%s", _("Do you really want to sort the list of templates?"))) {
td->templ = g_list_sort( td->templ, comparefunc);
td->templ_changed = TRUE;
gtk_list_clear_items(GTK_LIST(td->template_gtk_list), 0, -1);
/* fill list for choosing a transaction template */
g_list_foreach(td->templ, fill_template_list_func,
GTK_LIST (td->template_gtk_list));
gtk_list_unselect_all ( GTK_LIST (td->template_gtk_list) );
gtk_widget_show_all (GTK_WIDGET ( GTK_LIST (td->template_gtk_list)));
}
}
void
del_template_cb(GtkButton *button,
gpointer user_data)
{
HBCITransDialog *td = user_data;
GNCTransTempl *t;
gint index;
g_assert(td);
if (td->selected_template) {
t = gtk_object_get_user_data(GTK_OBJECT(td->selected_template));
index = gtk_list_child_position(GTK_LIST(td->template_gtk_list), td->selected_template);
if (gnc_verify_dialog (td->parent,
FALSE, _("Do you really want to delete the template '%s'?"),
gnc_trans_templ_get_name(g_list_nth_data(td->templ, index)))) {
gtk_list_clear_items(GTK_LIST(td->template_gtk_list), index, index+1);
td->templ = g_list_remove( td->templ, t);
td->templ_changed = TRUE;
gnc_trans_templ_delete(t);
gtk_list_unselect_all ( GTK_LIST (td->template_gtk_list) );
gtk_widget_show_all (GTK_WIDGET ( GTK_LIST (td->template_gtk_list)));
}
}
}
void gnc_hbci_dialog_xfer_cb(Transaction *trans, gpointer user_data) void gnc_hbci_dialog_xfer_cb(Transaction *trans, gpointer user_data)
{ {
HBCITransDialog *td = user_data; HBCITransDialog *td = user_data;

View File

@ -1,6 +1,8 @@
/********************************************************************\ /********************************************************************\
* dialog-hbcitrans.h -- dialog for HBCI transaction data * * dialog-hbcitrans.h -- dialog for HBCI transaction data *
* Copyright (C) 2002 Christian Stimming * * Copyright (C) 2002 Christian Stimming *
* Copyright (C) 2004 Bernd Wagner (changes for *
* online transaction templates) *
* * * *
* This program is free software; you can redistribute it and/or * * This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as * * modify it under the terms of the GNU General Public License as *
@ -68,6 +70,8 @@ void gnc_hbci_dialog_delete(HBCITransDialog *td);
GtkWidget *gnc_hbci_dialog_get_parent(const HBCITransDialog *td); GtkWidget *gnc_hbci_dialog_get_parent(const HBCITransDialog *td);
/** Return the GList of transaction templates. */ /** Return the GList of transaction templates. */
GList *gnc_hbci_dialog_get_templ(const HBCITransDialog *td); GList *gnc_hbci_dialog_get_templ(const HBCITransDialog *td);
/** Return the change status of the template list */
gboolean gnc_hbci_dialog_get_templ_changed(const HBCITransDialog *td) ;
/** Return the HBCI_Transaction. */ /** Return the HBCI_Transaction. */
const HBCI_Transaction *gnc_hbci_dialog_get_htrans(const HBCITransDialog *td); const HBCI_Transaction *gnc_hbci_dialog_get_htrans(const HBCITransDialog *td);
/** Return the gnucash Transaction. */ /** Return the gnucash Transaction. */

View File

@ -1746,7 +1746,7 @@ Press 'Finish' now.</text>
<widget> <widget>
<class>GtkTable</class> <class>GtkTable</class>
<name>table6</name> <name>table6</name>
<rows>20</rows> <rows>21</rows>
<columns>3</columns> <columns>3</columns>
<homogeneous>False</homogeneous> <homogeneous>False</homogeneous>
<row_spacing>0</row_spacing> <row_spacing>0</row_spacing>
@ -1907,25 +1907,6 @@ Press 'Finish' now.</text>
</child> </child>
</widget> </widget>
<widget>
<class>GtkHSeparator</class>
<name>hseparator5</name>
<child>
<left_attach>0</left_attach>
<right_attach>3</right_attach>
<top_attach>6</top_attach>
<bottom_attach>7</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>True</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget> <widget>
<class>GtkLabel</class> <class>GtkLabel</class>
<name>recp_bankname_heading</name> <name>recp_bankname_heading</name>
@ -2384,8 +2365,8 @@ Press 'Finish' now.</text>
<child> <child>
<left_attach>0</left_attach> <left_attach>0</left_attach>
<right_attach>3</right_attach> <right_attach>3</right_attach>
<top_attach>19</top_attach> <top_attach>20</top_attach>
<bottom_attach>20</bottom_attach> <bottom_attach>21</bottom_attach>
<xpad>0</xpad> <xpad>0</xpad>
<ypad>0</ypad> <ypad>0</ypad>
<xexpand>False</xexpand> <xexpand>False</xexpand>
@ -2396,34 +2377,157 @@ Press 'Finish' now.</text>
<yfill>True</yfill> <yfill>True</yfill>
</child> </child>
<widget>
<class>GtkVBox</class>
<name>vbox158</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget> <widget>
<class>GtkButton</class> <class>GtkButton</class>
<name>add_templ_button</name> <name>add_templ_button</name>
<border_width>2</border_width> <border_width>2</border_width>
<can_focus>True</can_focus> <can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>add_template_cb</handler>
<last_modification_time>Sun, 19 Oct 2003 19:52:26 GMT</last_modification_time>
</signal>
<label>Add current</label> <label>Add current</label>
<relief>GTK_RELIEF_NORMAL</relief> <relief>GTK_RELIEF_NORMAL</relief>
<child> <child>
<padding>0</padding> <padding>0</padding>
<expand>False</expand> <expand>False</expand>
<fill>False</fill> <fill>False</fill>
<pack>GTK_PACK_END</pack>
</child> </child>
</widget> </widget>
<widget> <widget>
<class>GtkOptionMenu</class> <class>GtkButton</class>
<name>template_optionmenu</name> <name>moveup_templ_button</name>
<border_width>2</border_width>
<can_focus>True</can_focus> <can_focus>True</can_focus>
<items>-- No Template -- <signal>
</items> <name>clicked</name>
<initial_choice>0</initial_choice> <handler>moveup_templ_cb</handler>
<last_modification_time>Sun, 08 Feb 2004 17:48:19 GMT</last_modification_time>
</signal>
<stock_button>GNOME_STOCK_BUTTON_UP</stock_button>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkButton</class>
<name>movedown_templ_button</name>
<border_width>2</border_width>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>movedown_templ_cb</handler>
<last_modification_time>Sun, 08 Feb 2004 17:48:35 GMT</last_modification_time>
</signal>
<stock_button>GNOME_STOCK_BUTTON_DOWN</stock_button>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkButton</class>
<name>sort_templ_button</name>
<border_width>2</border_width>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>sort_templ_cb</handler>
<last_modification_time>Sun, 08 Feb 2004 17:48:52 GMT</last_modification_time>
</signal>
<label>Sort</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>10</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkButton</class>
<name>del_templ_button</name>
<border_width>2</border_width>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>del_template_cb</handler>
<last_modification_time>Sun, 19 Oct 2003 19:55:28 GMT</last_modification_time>
</signal>
<label>Delete</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
<widget>
<class>GtkScrolledWindow</class>
<name>template_scrolledwindow</name>
<width>350</width>
<height>142</height>
<hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<child> <child>
<padding>0</padding> <padding>0</padding>
<expand>False</expand> <expand>False</expand>
<fill>False</fill> <fill>False</fill>
<pack>GTK_PACK_END</pack> <pack>GTK_PACK_END</pack>
</child> </child>
<widget>
<class>GtkViewport</class>
<name>viewport1</name>
<shadow_type>GTK_SHADOW_IN</shadow_type>
<widget>
<class>GtkList</class>
<name>template_list</name>
<visible>False</visible>
<signal>
<name>select_child</name>
<handler>on_template_list_select_child</handler>
<last_modification_time>Sun, 19 Oct 2003 20:56:25 GMT</last_modification_time>
</signal>
<signal>
<name>selection_changed</name>
<handler>on_template_list_selection_changed</handler>
<last_modification_time>Sun, 19 Oct 2003 20:57:16 GMT</last_modification_time>
</signal>
<signal>
<name>unselect_child</name>
<handler>on_template_list_unselect_child</handler>
<last_modification_time>Sun, 19 Oct 2003 20:57:22 GMT</last_modification_time>
</signal>
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
</widget>
</widget>
</widget> </widget>
<widget> <widget>
@ -2444,6 +2548,44 @@ Press 'Finish' now.</text>
</child> </child>
</widget> </widget>
</widget> </widget>
<widget>
<class>GtkHSeparator</class>
<name>hseparator8</name>
<child>
<left_attach>0</left_attach>
<right_attach>3</right_attach>
<top_attach>19</top_attach>
<bottom_attach>20</bottom_attach>
<xpad>0</xpad>
<ypad>1</ypad>
<xexpand>False</xexpand>
<yexpand>True</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkHSeparator</class>
<name>hseparator5</name>
<child>
<left_attach>0</left_attach>
<right_attach>3</right_attach>
<top_attach>6</top_attach>
<bottom_attach>7</bottom_attach>
<xpad>0</xpad>
<ypad>1</ypad>
<xexpand>False</xexpand>
<yexpand>True</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
</widget> </widget>
</widget> </widget>
</widget> </widget>

View File

@ -1,6 +1,8 @@
/********************************************************************\ /********************************************************************\
* gnc-hbci-transfer.c -- hbci transfer functions * * gnc-hbci-transfer.c -- hbci transfer functions *
* Copyright (C) 2002 Christian Stimming * * Copyright (C) 2002 Christian Stimming *
* Copyright (C) 2004 Bernd Wagner (minor changes for *
* online transaction templates) *
* * * *
* This program is free software; you can redistribute it and/or * * This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as * * modify it under the terms of the GNU General Public License as *
@ -84,7 +86,6 @@ gnc_hbci_maketrans (GtkWidget *parent, Account *gnc_acc,
gnc_trans_templ_glist_from_kvp_glist gnc_trans_templ_glist_from_kvp_glist
( gnc_hbci_get_book_template_list ( gnc_hbci_get_book_template_list
( xaccAccountGetBook(gnc_acc))); ( xaccAccountGetBook(gnc_acc)));
unsigned nr_templates;
int result; int result;
gboolean successful; gboolean successful;
HBCITransDialog *td; HBCITransDialog *td;
@ -99,15 +100,13 @@ gnc_hbci_maketrans (GtkWidget *parent, Account *gnc_acc,
/* Repeat until HBCI action was successful or user pressed cancel */ /* Repeat until HBCI action was successful or user pressed cancel */
do { do {
nr_templates = g_list_length(template_list);
/* Let the user enter the values. If cancel is pressed, -1 is returned. */ /* Let the user enter the values. If cancel is pressed, -1 is returned. */
result = gnc_hbci_dialog_run_until_ok(td, h_acc); result = gnc_hbci_dialog_run_until_ok(td, h_acc);
/* Set the template list in case it got modified. */ /* Set the template list in case it got modified. */
template_list = gnc_hbci_dialog_get_templ(td); template_list = gnc_hbci_dialog_get_templ(td);
/* New templates? If yes, store them */ /* templates changed? If yes, store them */
if (nr_templates < g_list_length(template_list)) if (gnc_hbci_dialog_get_templ_changed(td) )
maketrans_save_templates(parent, gnc_acc, template_list, (result >= 0)); maketrans_save_templates(parent, gnc_acc, template_list, (result >= 0));
if (result < 0) { if (result < 0) {
@ -184,9 +183,9 @@ void maketrans_save_templates(GtkWidget *parent, Account *gnc_acc,
(parent, (parent,
FALSE, FALSE,
"%s", "%s",
_("You have created a new online transfer template, but \n" _("You have changed the list of online transfer templates,\n"
"you cancelled the transfer dialog. Do you nevertheless \n" "but you cancelled the transfer dialog.\n"
"want to store the new online transfer template?"))) { "Do you nevertheless want to store the changes?"))) {
GList *kvp_list = gnc_trans_templ_kvp_glist_from_glist (template_list); GList *kvp_list = gnc_trans_templ_kvp_glist_from_glist (template_list);
/*printf ("Now having %d templates. List: '%s'\n", /*printf ("Now having %d templates. List: '%s'\n",
g_list_length(template_list), g_list_length(template_list),