Make the HBCI Transfer dialog work again using a GtkListStore.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@12272 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton 2006-01-06 15:49:45 +00:00
parent 4048f595e1
commit af6eef2ccf
5 changed files with 515 additions and 289 deletions

View File

@ -1,3 +1,10 @@
2006-01-06 David Hampton <hampton@employees.org>
* src/import-export/hbci/dialog-hbcitrans.[ch]:
* src/import-export/hbci/glade/hbci.glade:
* src/import-export/hbci/gnc-hbci-transfer.c: Make the HBCI
Transfer dialog work again using a GtkListStore.
2006-01-04 David Hampton <hampton@employees.org>
* src/gnome-utils/ui/gnc-main-window-ui.xml:

View File

@ -56,6 +56,12 @@
#define TEMPLATE_LABEL "template"
typedef enum {
TEMPLATE_NAME,
TEMPLATE_POINTER,
TEMPLATE_NUM_COLUMNS
} TemplateListColumns;
/* -------------------------------------- */
/* Data structure */
/* -------------------------------------- */
@ -85,14 +91,9 @@ struct _trans_data
/* Recipient's bank name (may be filled in automatically sometime later) */
GtkWidget *recp_bankname_label;
/* The template choosing GtkList */
GtkWidget *template_gtktreeview;
/* The selected template in the list */
GtkWidget *selected_template;
/* GList of GNCTransTempl */
GList *templ;
/* The template choosing GtkTreeView/GtkListStore */
GtkTreeView *template_gtktreeview;
GtkListStore *template_list_store;
/* Flag, if template list has been changed */
gboolean templ_changed;
@ -122,8 +123,6 @@ void gnc_hbci_dialog_delete(HBCITransDialog *td)
if (td->hbci_trans)
AB_Transaction_free (td->hbci_trans);
td->selected_template = NULL;
if (td->dialog)
gtk_widget_destroy (GTK_WIDGET (td->dialog));
#if HAVE_KTOBLZCHECK_H
@ -131,10 +130,30 @@ void gnc_hbci_dialog_delete(HBCITransDialog *td)
#endif
}
static gboolean
get_templ_helper (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
gpointer data)
{
GList **list = data;
GNCTransTempl *templ;
gtk_tree_model_get (model, iter,
TEMPLATE_POINTER, &templ,
-1);
*list = g_list_append(*list, templ);
return FALSE; /* continue */
}
GList *gnc_hbci_dialog_get_templ(const HBCITransDialog *td)
{
GList *list = NULL;
g_assert(td);
return td->templ;
gtk_tree_model_foreach(GTK_TREE_MODEL(td->template_list_store),
get_templ_helper, &list);
return list;
}
GtkWidget *gnc_hbci_dialog_get_parent(const HBCITransDialog *td)
{
@ -178,9 +197,7 @@ gboolean
check_ktoblzcheck(GtkWidget *parent, const HBCITransDialog *td,
const AB_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 on_template_list_selection_changed(GtkTreeSelection *selection, gpointer user_data);
void template_selection_cb(GtkButton *b, gpointer user_data);
void add_template_cb(GtkButton *b, gpointer user_data);
@ -206,17 +223,17 @@ void blz_changed_cb(GtkEditable *e, gpointer user_data);
static void fill_template_list_func(gpointer data, gpointer user_data)
{
GNCTransTempl *templ = data;
GtkTreeView *list = user_data;
GtkWidget *item;
GtkListStore *list_store = user_data;
GtkTreeIter iter;
g_assert(templ);
g_assert(list);
g_assert(list_store);
item = gtk_list_item_new_with_label(gnc_trans_templ_get_name(templ));
g_assert(item);
g_object_set_data(G_OBJECT(item), TEMPLATE_LABEL, templ);
gtk_container_add(GTK_CONTAINER(list), item );
gtk_list_store_append(list_store, &iter);
gtk_list_store_set(list_store, &iter,
TEMPLATE_NAME, gnc_trans_templ_get_name(templ),
TEMPLATE_POINTER, templ,
-1);
}
HBCITransDialog *
@ -229,11 +246,13 @@ gnc_hbci_dialog_new (GtkWidget *parent,
GladeXML *xml;
const char *hbci_bankid, *hbci_bankname;
HBCITransDialog *td;
GtkTreeSelection *selection;
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
td = g_new0(HBCITransDialog, 1);
td->parent = parent;
td->templ = templates;
td->trans_type = trans_type;
g_assert (h_acc);
hbci_bankid = AB_Account_GetBankCode(h_acc);
@ -316,7 +335,7 @@ gnc_hbci_dialog_new (GtkWidget *parent,
g_assert
((exec_later_button = glade_xml_get_widget (xml, "exec_later_button")) != NULL);
g_assert
((td->template_gtktreeview = glade_xml_get_widget (xml, "template_list")) != NULL);
((td->template_gtktreeview = GTK_TREE_VIEW(glade_xml_get_widget (xml, "template_list"))) != NULL);
g_assert
((add_templ_button = glade_xml_get_widget (xml, "add_templ_button")) != NULL);
g_assert
@ -335,16 +354,6 @@ gnc_hbci_dialog_new (GtkWidget *parent,
gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (td->amount_edit),
xaccAccountGetCommoditySCU (gnc_acc));
/* FIXME: Greyed out the template widgets because they are not yet
implemented -- need to change the GTK_LIST code to
GTK_TREE_VIEW */
gtk_widget_set_sensitive (td->template_gtktreeview, FALSE);
gtk_widget_set_sensitive (add_templ_button, FALSE);
gtk_widget_set_sensitive (moveup_templ_button, FALSE);
gtk_widget_set_sensitive (movedown_templ_button, FALSE);
gtk_widget_set_sensitive (sort_templ_button, FALSE);
gtk_widget_set_sensitive (del_templ_button, FALSE);
/* Check for what kind of transaction this should be, and change
the labels accordingly. */
switch (trans_type) {
@ -381,7 +390,7 @@ gnc_hbci_dialog_new (GtkWidget *parent,
}
/* Make this button insensitive since it's still unimplemented. */
gtk_widget_set_sensitive (GTK_WIDGET (exec_later_button), FALSE);
gtk_widget_destroy (exec_later_button);
/* Fill in the values from the objects */
gtk_label_set_text (GTK_LABEL (orig_name_label),
@ -396,26 +405,31 @@ gnc_hbci_dialog_new (GtkWidget *parent,
hbci_bankid);
/* fill list for choosing a transaction template */
/* g_list_foreach(td->templ, fill_template_list_func,
GTK_TREE_VIEW (td->template_gtktreeview)); */
/* FIXME: commented out until the GTK_TREE_VIEW is implemented! */
gtk_tree_view_set_headers_visible(td->template_gtktreeview, FALSE);
td->template_list_store = gtk_list_store_new(TEMPLATE_NUM_COLUMNS,
G_TYPE_STRING,
G_TYPE_POINTER);
gtk_tree_view_set_model(td->template_gtktreeview,
GTK_TREE_MODEL(td->template_list_store));
g_list_foreach(templates, fill_template_list_func, td->template_list_store);
renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes ("Template Name",
renderer,
"text", TEMPLATE_NAME,
NULL);
gtk_tree_view_append_column(td->template_gtktreeview, column);
td->selected_template = NULL;
td->templ_changed = FALSE;
/* Connect signals */
/* gnc_option_menu_init_w_signal (td->template_option,
G_CALLBACK(template_selection_cb),
td); */
/* FIXME: commented out until the GTK_TREE_VIEW is implemented! */
/*
g_signal_connect (td->template_gtktreeview, "select_child",
G_CALLBACK (on_template_list_select_child),
selection = gtk_tree_view_get_selection(td->template_gtktreeview);
g_signal_connect (selection, "changed",
G_CALLBACK (on_template_list_selection_changed),
td);
g_signal_connect (add_templ_button, "clicked",
G_CALLBACK(add_template_cb), td);
g_signal_connect (moveup_templ_button, "clicked",
G_CALLBACK (moveup_template_cb),
td);
@ -431,14 +445,10 @@ gnc_hbci_dialog_new (GtkWidget *parent,
g_signal_connect (del_templ_button, "clicked",
G_CALLBACK (del_template_cb),
td);
*/
g_signal_connect (td->recp_bankcode_entry, "changed",
G_CALLBACK(blz_changed_cb), td);
/* Default button */
gtk_dialog_set_default_response (GTK_DIALOG (td->dialog), GTK_RESPONSE_OK);
} /* GtkWidget declarations/definitions */
return td;
@ -460,7 +470,7 @@ int gnc_hbci_dialog_run_until_ok(HBCITransDialog *td,
AB_JOB *job = AB_JobSingleTransfer_new((AB_ACCOUNT *)h_acc);
if (AB_Job_CheckAvailability(job)) {
printf("gnc_hbci_trans_dialog_enqueue: Oops, job not available. Aborting.\n");
return -1;
return GTK_RESPONSE_CANCEL;
}
#if ((AQBANKING_VERSION_MAJOR > 1) || \
((AQBANKING_VERSION_MAJOR == 1) && \
@ -497,12 +507,15 @@ int gnc_hbci_dialog_run_until_ok(HBCITransDialog *td,
/* The dialog gets hidden anyway as soon as any button is pressed. */
gtk_widget_hide_all (td->dialog);
/* Was cancel pressed or dialog closed? 1 == execute now, 3 ==
scheduled for later execution (currently unimplemented); 2 == cancel */
if (result != 1 ) { /* <- currently hard-coded response-id from glade */
/* Was cancel pressed or dialog closed?
* GNC_RESPONSE_NOW == execute now
* GNC_RESPONSE_LATER == scheduled for later execution (currently unimplemented)
* GTK_RESPONSE_CANCEL == cancel
* GTK_RESPONSE_DELETE_EVENT == window destroyed */
if ((result != GNC_RESPONSE_NOW) && (result != GNC_RESPONSE_LATER)) {
gtk_widget_destroy (GTK_WIDGET (td->dialog));
td->dialog = NULL;
return -1;
return GTK_RESPONSE_CANCEL;
}
/* Now fill in the values from the entry fields into a new
@ -527,7 +540,7 @@ int gnc_hbci_dialog_run_until_ok(HBCITransDialog *td,
if (values_ok) {
AB_Transaction_free (td->hbci_trans);
td->hbci_trans = NULL;
return -1;
return GTK_RESPONSE_CANCEL;
}
continue;
} /* check Transaction_value */
@ -547,7 +560,7 @@ int gnc_hbci_dialog_run_until_ok(HBCITransDialog *td,
if (values_ok) {
AB_Transaction_free (td->hbci_trans);
td->hbci_trans = NULL;
return -1;
return GTK_RESPONSE_CANCEL;
}
continue;
} /* check Transaction_purpose */
@ -811,16 +824,19 @@ static void fill_entry(const char *str, GtkWidget *entry) {
void
on_template_list_select_child (GtkList *list,
GtkWidget *widget,
gpointer user_data)
on_template_list_selection_changed (GtkTreeSelection *selection,
gpointer user_data)
{
HBCITransDialog *td = user_data;
GNCTransTempl *templ = g_object_get_data (G_OBJECT(widget), TEMPLATE_LABEL);
GNCTransTempl *templ;
GtkTreeModel *model;
GtkTreeIter iter;
g_assert(td);
td->selected_template = widget;
if (!gtk_tree_selection_get_selected(selection, &model, &iter))
return;
gtk_tree_model_get(model, &iter, TEMPLATE_POINTER, &templ, -1);
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);
@ -834,28 +850,6 @@ on_template_list_select_child (GtkList *list,
}
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)
{
#if HAVE_KTOBLZCHECK_H
@ -898,68 +892,62 @@ void blz_changed_cb(GtkEditable *e, gpointer user_data)
/* -------------------------------------- */
/* -------------------------------------- */
/* Copied from window-help.c */
static void
goto_string_cb(char * string, gpointer data)
{
if(!data) return;
if(!string) {
*(char **)data = NULL;
}
else {
*(char **)data = g_strdup(string);
}
}
void add_template_cb(GtkButton *b,
gpointer user_data)
{
HBCITransDialog *td = user_data;
GtkWidget *dlg;
char *name;
const gchar *name;
int retval = -1;
GNCTransTempl *t;
gint index;
GladeXML *xml;
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter cur_iter, new_iter;
GtkWidget *entry;
g_assert(td);
dlg = gnome_request_dialog(FALSE,
_("Enter name for new template:"), "", 250,
&goto_string_cb, &name, GTK_WINDOW(td->parent));
retval = gnome_dialog_run_and_close(GNOME_DIALOG(dlg));
xml = gnc_glade_xml_new ("hbci.glade", "HBCI_template_name_dialog");
if ((retval == 0) && name && (strlen(name) > 0)) {
GNCTransTempl *r;
/*printf("add_template_cb: adding template '%s'\n", name);*/
r = gnc_trans_templ_new_full
(name,
gtk_entry_get_text (GTK_ENTRY (td->recp_name_entry)),
gtk_entry_get_text (GTK_ENTRY (td->recp_account_entry)),
gtk_entry_get_text (GTK_ENTRY (td->recp_bankcode_entry)),
gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (td->amount_edit)),
gtk_entry_get_text (GTK_ENTRY (td->purpose_entry)),
gtk_entry_get_text (GTK_ENTRY (td->purpose_cont_entry)));
dlg = glade_xml_get_widget (xml, "HBCI_template_name_dialog");
entry = glade_xml_get_widget (xml, "template_name");
gtk_entry_set_text(GTK_ENTRY(entry),
gtk_entry_get_text(GTK_ENTRY(td->recp_name_entry)));
if (td->selected_template) {
t = g_object_get_data(G_OBJECT(td->selected_template), TEMPLATE_LABEL);
retval = gtk_dialog_run(GTK_DIALOG(dlg));
index = 1+gtk_list_child_position(GTK_LIST(td->template_gtktreeview), td->selected_template);
if (retval == GTK_RESPONSE_OK) {
name = gtk_entry_get_text(GTK_ENTRY(entry));
if (name && (strlen(name) > 0)) {
GNCTransTempl *r;
/*printf("add_template_cb: adding template '%s'\n", name);*/
r = gnc_trans_templ_new_full
(name,
gtk_entry_get_text (GTK_ENTRY (td->recp_name_entry)),
gtk_entry_get_text (GTK_ENTRY (td->recp_account_entry)),
gtk_entry_get_text (GTK_ENTRY (td->recp_bankcode_entry)),
gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (td->amount_edit)),
gtk_entry_get_text (GTK_ENTRY (td->purpose_entry)),
gtk_entry_get_text (GTK_ENTRY (td->purpose_cont_entry)));
selection = gtk_tree_view_get_selection(td->template_gtktreeview);
if (gtk_tree_selection_get_selected(selection, &model, &cur_iter)) {
gtk_list_store_insert_after(td->template_list_store,
&new_iter, &cur_iter);
} else {
gtk_list_store_append(GTK_LIST_STORE(model), &new_iter);
}
gtk_list_store_set(td->template_list_store, &new_iter,
TEMPLATE_NAME, name,
TEMPLATE_POINTER, r,
-1);
td->templ_changed = TRUE;
}
else index = 0;
td->templ = g_list_insert(td->templ, r, index);
td->templ_changed = TRUE;
gtk_list_clear_items(GTK_LIST(td->template_gtktreeview), 0, -1);
/* fill list for choosing a transaction template */
g_list_foreach(td->templ, fill_template_list_func,
GTK_TREE_VIEW (td->template_gtktreeview));
gtk_list_select_item(GTK_LIST(td->template_gtktreeview), index);
/* the show_all is necessary since otherwise the new item doesn't show up */
gtk_widget_show_all (GTK_WIDGET ( GTK_LIST (td->template_gtktreeview)));
}
gtk_widget_destroy(dlg);
// g_object_unref(xml);
}
@ -968,31 +956,26 @@ moveup_template_cb(GtkButton *button,
gpointer user_data)
{
HBCITransDialog *td = user_data;
GNCTransTempl *t;
gint index;
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter, prev_iter;
GtkTreePath *prev_path;
g_assert(td);
if (td->selected_template) {
t = g_object_get_data(G_OBJECT(td->selected_template), TEMPLATE_LABEL);
index = gtk_list_child_position(GTK_LIST(td->template_gtktreeview), td->selected_template);
if (index > 0) {
td->templ = g_list_remove( td->templ, t);
td->templ = g_list_insert( td->templ, t, index-1);
selection = gtk_tree_view_get_selection(td->template_gtktreeview);
if (!gtk_tree_selection_get_selected (selection, &model, &iter))
return;
prev_path = gtk_tree_model_get_path(model, &iter);
if (gtk_tree_path_prev(prev_path)) {
if (gtk_tree_model_get_iter(model, &prev_iter, prev_path)) {
gtk_list_store_move_before(GTK_LIST_STORE(model), &iter, &prev_iter);
td->templ_changed = TRUE;
gtk_list_clear_items(GTK_LIST(td->template_gtktreeview), 0, -1);
/* fill list for choosing a transaction template */
g_list_foreach(td->templ, fill_template_list_func,
GTK_TREE_VIEW (td->template_gtktreeview));
gtk_list_select_item(GTK_LIST(td->template_gtktreeview), index-1);
gtk_widget_show_all (GTK_WIDGET ( GTK_LIST (td->template_gtktreeview)));
}
}
}
gtk_tree_path_free(prev_path);
}
@ -1001,41 +984,23 @@ movedown_template_cb(GtkButton *button,
gpointer user_data)
{
HBCITransDialog *td = user_data;
GNCTransTempl *t;
gint index;
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter, next_iter;
g_assert(td);
if (td->selected_template) {
t = g_object_get_data(G_OBJECT(td->selected_template), TEMPLATE_LABEL);
selection = gtk_tree_view_get_selection(td->template_gtktreeview);
if (!gtk_tree_selection_get_selected (selection, &model, &iter))
return;
index = gtk_list_child_position(GTK_LIST(td->template_gtktreeview), 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_gtktreeview), 0, -1);
/* fill list for choosing a transaction template */
g_list_foreach(td->templ, fill_template_list_func,
GTK_TREE_VIEW (td->template_gtktreeview));
gtk_list_select_item(GTK_LIST(td->template_gtktreeview), index+1);
gtk_widget_show_all (GTK_WIDGET ( GTK_LIST (td->template_gtktreeview)));
}
}
next_iter = iter;
if (gtk_tree_model_iter_next(model, &next_iter)) {
gtk_list_store_move_after(GTK_LIST_STORE(model), &iter, &next_iter);
td->templ_changed = TRUE;
}
}
static gint comparefunc(const gconstpointer e1,
const gconstpointer e2)
{
return strcmp(gnc_trans_templ_get_name_key((GNCTransTempl*)e1),
gnc_trans_templ_get_name_key((GNCTransTempl*)e2));
}
void
sort_template_cb(GtkButton *button,
gpointer user_data)
@ -1043,23 +1008,14 @@ sort_template_cb(GtkButton *button,
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_gtktreeview), 0, -1);
/* fill list for choosing a transaction template */
g_list_foreach(td->templ, fill_template_list_func,
GTK_TREE_VIEW (td->template_gtktreeview));
gtk_list_unselect_all ( GTK_LIST (td->template_gtktreeview) );
gtk_widget_show_all (GTK_WIDGET ( GTK_LIST (td->template_gtktreeview)));
}
gtk_tree_sortable_set_sort_column_id
(GTK_TREE_SORTABLE(td->template_list_store),
TEMPLATE_NAME, GTK_SORT_ASCENDING);
gtk_tree_sortable_set_sort_column_id
(GTK_TREE_SORTABLE(td->template_list_store),
GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID,
GTK_SORT_ASCENDING);
td->templ_changed = TRUE;
}
@ -1069,32 +1025,18 @@ del_template_cb(GtkButton *button,
gpointer user_data)
{
HBCITransDialog *td = user_data;
GNCTransTempl *t;
gint index;
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
g_assert(td);
if (td->selected_template) {
selection = gtk_tree_view_get_selection(td->template_gtktreeview);
if (!gtk_tree_selection_get_selected (selection, &model, &iter))
return;
t = g_object_get_data(G_OBJECT(td->selected_template), TEMPLATE_LABEL);
index = gtk_list_child_position(GTK_LIST(td->template_gtktreeview), 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_gtktreeview), 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_gtktreeview) );
gtk_widget_show_all (GTK_WIDGET ( GTK_LIST (td->template_gtktreeview)));
}
}
gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
td->templ_changed = TRUE;
}
@ -1118,4 +1060,3 @@ void gnc_hbci_dialog_xfer_cb(Transaction *trans, gpointer user_data)
}
return;
}

View File

@ -41,6 +41,8 @@ typedef enum GNC_HBCI_Transtype {
SINGLE_INTERNAL_TRANSFER
} GNC_HBCI_Transtype;
#define GNC_RESPONSE_NOW GTK_RESPONSE_YES
#define GNC_RESPONSE_LATER 3
/*AB_TRANSACTION *
gnc_hbci_trans (GtkWidget *parent,

View File

@ -431,29 +431,16 @@ Press &quot;Apply&quot; now.</property>
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="exec_now_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Execute Now</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">1</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="exec_later_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Execute Later (unimpl.)</property>
<property name="label" translatable="yes">Execute later (unimpl.)</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">3</property>
<property name="response_id">-9</property>
</widget>
</child>
@ -466,7 +453,79 @@ Press &quot;Apply&quot; now.</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">2</property>
<property name="response_id">-6</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="exec_now_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-8</property>
<child>
<widget class="GtkAlignment" id="alignment6">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox122">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image4">
<property name="visible">True</property>
<property name="stock">gtk-execute</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label8877454">
<property name="visible">True</property>
<property name="label">Execute Now</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
@ -1024,9 +1083,9 @@ Press &quot;Apply&quot; now.</property>
<property name="spacing">4</property>
<child>
<widget class="GtkVBox" id="vbox158">
<widget class="GtkVButtonBox" id="vbutonbox158">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
<property name="spacing">0</property>
<child>
@ -1034,17 +1093,70 @@ Press &quot;Apply&quot; now.</property>
<property name="border_width">2</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Add current</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="add_template_cb"/>
<child>
<widget class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox119">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label8877451">
<property name="visible">True</property>
<property name="label" translatable="yes">Add current</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
@ -1058,11 +1170,6 @@ Press &quot;Apply&quot; now.</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="moveup_templ_cb"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
@ -1076,11 +1183,6 @@ Press &quot;Apply&quot; now.</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="movedown_templ_cb"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
@ -1088,17 +1190,70 @@ Press &quot;Apply&quot; now.</property>
<property name="border_width">2</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Sort</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="sort_templ_cb"/>
<child>
<widget class="GtkAlignment" id="alignment4">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox120">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="stock">gtk-sort-ascending</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label8877452">
<property name="visible">True</property>
<property name="label" translatable="yes">Sort</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">10</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
@ -1106,17 +1261,12 @@ Press &quot;Apply&quot; now.</property>
<property name="border_width">2</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Delete</property>
<property name="use_underline">True</property>
<property name="label">gtk-delete</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="del_template_cb"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
@ -1143,7 +1293,7 @@ Press &quot;Apply&quot; now.</property>
<child>
<widget class="GtkTreeView" id="template_list">
<property name="headers_visible">True</property>
<property name="rules_hint">False</property>
<property name="rules_hint">True</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
<property name="fixed_height_mode">False</property>
@ -1159,8 +1309,8 @@ Press &quot;Apply&quot; now.</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
@ -1183,7 +1333,6 @@ Press &quot;Apply&quot; now.</property>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
@ -2199,4 +2348,121 @@ Press &quot;Apply&quot; now.</property>
</child>
</widget>
<widget class="GtkDialog" id="HBCI_template_name_dialog">
<property name="visible">True</property>
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox6">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area6">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="cancelbutton1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-6</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="okbutton1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-5</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox159">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="label8877450">
<property name="visible">True</property>
<property name="label" translatable="yes">Enter name for new template:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="template_name">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">250</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@ -88,6 +88,11 @@ gnc_hbci_maketrans (GtkWidget *parent, Account *gnc_acc,
/* Create new HBCIDialogTrans */
td = gnc_hbci_dialog_new(parent, h_acc, gnc_acc,
trans_type, template_list);
/* Delete the list. The data is still pointed to by the
* GtkListStore in the dialog. */
g_list_free(template_list);
template_list = NULL;
/* Repeat until HBCI action was successful or user pressed cancel */
do {
@ -96,12 +101,16 @@ gnc_hbci_maketrans (GtkWidget *parent, Account *gnc_acc,
result = gnc_hbci_dialog_run_until_ok(td, h_acc);
/* Set the template list in case it got modified. */
if (template_list)
g_list_free(template_list);
template_list = gnc_hbci_dialog_get_templ(td);
/* templates changed? If yes, store them */
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 == GNC_RESPONSE_NOW));
if (result < 0) {
if ((result != GNC_RESPONSE_NOW) && (result != GNC_RESPONSE_LATER)) {
break;
}
@ -146,10 +155,12 @@ gnc_hbci_maketrans (GtkWidget *parent, Account *gnc_acc,
continue;
}
/* Result of run_until_ok: 1 == execute now, 3 == scheduled
for later execution (currently unimplemented); 2 ==
cancel */
if (result == 1) {
/* Result of run_until_ok:
* GNC_RESPONSE_NOW == execute now
* GNC_RESPONSE_LATER == scheduled for later execution (currently unimplemented)
* GTK_RESPONSE_CANCEL == cancel
* GTK_RESPONSE_DELETE_EVENT == window destroyed */
if (result == GNC_RESPONSE_NOW) {
/* If the user pressed "execute now", then execute this job
now. This function already delete()s the job. */
@ -165,12 +176,11 @@ gnc_hbci_maketrans (GtkWidget *parent, Account *gnc_acc,
}
gnc_hbci_cleanup_job(api, job);
} /* result == 1 */
} /* result == GNC_RESPONSE_NOW */
else {
/* huh? Only result == 0 should be possible. Simply ignore
this case. */
/* Simply ignore any other case. */
break;
} /* result == 1 */
} /* result == GNC_RESPONSE_NOW */
} /* Create a do-transaction (transfer) job */