mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-16 18:25:11 -06:00
Bug #664877 - Migrate Qif Import Druid to an Assistant
Patch by Robert Fewell git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21653 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
10fcc37d97
commit
b5e3f95511
@ -415,10 +415,10 @@ src/import-export/ofx/gnc-ofx-kvp.c
|
||||
src/import-export/ofx/gnc-plugin-ofx.c
|
||||
src/import-export/qif-import/dialog-account-picker.c
|
||||
src/import-export/qif-import/dialog-account-picker.glade
|
||||
src/import-export/qif-import/druid-qif-import.c
|
||||
src/import-export/qif-import/assistant-qif-import.c
|
||||
src/import-export/qif-import/gncmod-qif-import.c
|
||||
src/import-export/qif-import/gnc-plugin-qif-import.c
|
||||
src/import-export/qif-import/qif.glade
|
||||
src/import-export/qif-import/assistant-qif-import.glade
|
||||
src/import-export/qif-import/schemas/apps_gnucash_import_qif.schemas.in
|
||||
src/import-export/qif-io-core/gncmod-qifiocore.c
|
||||
src/import-export/qif/qif-context.c
|
||||
|
@ -44,16 +44,16 @@
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
static QofLogModule log_module = GNC_MOD_GUI;
|
||||
|
||||
/* function to open a qif import druid */
|
||||
static void (*qifImportDruidFcn)(void) = NULL;
|
||||
/* function to open a qif import assistant */
|
||||
static void (*qifImportAssistantFcn)(void) = NULL;
|
||||
|
||||
static void gnc_ui_new_user_cancel_dialog (void);
|
||||
|
||||
void
|
||||
gnc_new_user_dialog_register_qif_druid (void (*cb_fcn)(void))
|
||||
gnc_new_user_dialog_register_qif_assistant (void (*cb_fcn)(void))
|
||||
{
|
||||
g_return_if_fail (qifImportDruidFcn == NULL);
|
||||
qifImportDruidFcn = cb_fcn;
|
||||
g_return_if_fail (qifImportAssistantFcn == NULL);
|
||||
qifImportAssistantFcn = cb_fcn;
|
||||
}
|
||||
|
||||
void
|
||||
@ -95,9 +95,9 @@ gnc_ui_new_user_dialog (void)
|
||||
tutorial_button = GTK_WIDGET(gtk_builder_get_object (builder, "tutorial_button"));
|
||||
|
||||
/* Set the sensitivity of the qif-import button based on the availability
|
||||
* of the qif-import druid.
|
||||
* of the qif-import assistant.
|
||||
*/
|
||||
gtk_widget_set_sensitive (import_qif_button, (qifImportDruidFcn != NULL));
|
||||
gtk_widget_set_sensitive (import_qif_button, (qifImportAssistantFcn != NULL));
|
||||
|
||||
result = gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
switch (result)
|
||||
@ -112,10 +112,10 @@ gnc_ui_new_user_dialog (void)
|
||||
gnc_ui_hierarchy_assistant_with_callback(TRUE, after_hierarchy_assistant);
|
||||
break;
|
||||
}
|
||||
else if ((qifImportDruidFcn != NULL)
|
||||
else if ((qifImportAssistantFcn != NULL)
|
||||
&& gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (import_qif_button)))
|
||||
{
|
||||
qifImportDruidFcn();
|
||||
qifImportAssistantFcn();
|
||||
gncp_new_user_finish ();
|
||||
break;
|
||||
}
|
||||
|
@ -26,8 +26,8 @@
|
||||
void gnc_ui_new_user_dialog (void);
|
||||
void gnc_set_first_startup (gboolean first_startup);
|
||||
|
||||
/* Register the qif-import druid */
|
||||
void gnc_new_user_dialog_register_qif_druid (void (*cb_fcn)(void));
|
||||
/* Register the qif-import assistant */
|
||||
void gnc_new_user_dialog_register_qif_assistant (void (*cb_fcn)(void));
|
||||
|
||||
/* private */
|
||||
void gncp_new_user_finish (void);
|
||||
|
@ -4,14 +4,14 @@ pkglib_LTLIBRARIES=libgncmod-qif-import.la
|
||||
|
||||
libgncmod_qif_import_la_SOURCES = \
|
||||
dialog-account-picker.c \
|
||||
druid-qif-import.c \
|
||||
assistant-qif-import.c \
|
||||
gnc-plugin-qif-import.c \
|
||||
gnc-druid-test.c \
|
||||
gncmod-qif-import.c
|
||||
|
||||
noinst_HEADERS = \
|
||||
dialog-account-picker.h \
|
||||
druid-qif-import.h \
|
||||
assistant-qif-import.h \
|
||||
gnc-druid-test.h \
|
||||
gnc-plugin-qif-import.h
|
||||
|
||||
@ -48,11 +48,10 @@ gncscm_DATA = \
|
||||
qif-to-gnc.scm \
|
||||
qif-utils.scm
|
||||
|
||||
gladedir = ${GNC_GLADE_DIR}
|
||||
glade_DATA = qif.glade
|
||||
|
||||
gtkbuilderdir = ${GNC_GTKBUILDER_DIR}
|
||||
gtkbuilder_DATA = dialog-account-picker.glade
|
||||
gtkbuilder_DATA = \
|
||||
dialog-account-picker.glade \
|
||||
assistant-qif-import.glade
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I${top_srcdir}/src \
|
||||
@ -76,7 +75,6 @@ ui_DATA = \
|
||||
|
||||
EXTRA_DIST = \
|
||||
${gncscm_DATA} \
|
||||
${glade_DATA} \
|
||||
${gtkbuilder_DATA} \
|
||||
file-format.txt \
|
||||
$(ui_DATA)
|
||||
|
File diff suppressed because it is too large
Load Diff
1305
src/import-export/qif-import/assistant-qif-import.glade
Normal file
1305
src/import-export/qif-import/assistant-qif-import.glade
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,8 @@
|
||||
/********************************************************************\
|
||||
* dialog-qif-import.h -- window for controlling import of QIF data *
|
||||
* assistant-qif-import.h -- window for import of QIF data *
|
||||
* (GnuCash) *
|
||||
* Copyright (C) 2000 Bill Gribble <grib@billgribble.com> *
|
||||
* Copyright (c) 2011 Robert Fewell *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
@ -21,8 +22,8 @@
|
||||
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
||||
\********************************************************************/
|
||||
|
||||
#ifndef DIALOG_QIF_IMPORT_H
|
||||
#define DIALOG_QIF_IMPORT_H
|
||||
#ifndef ASSISTANT_QIF_IMPORT_H
|
||||
#define ASSISTANT_QIF_IMPORT_H
|
||||
|
||||
#include <libguile.h>
|
||||
#include <gtk/gtk.h>
|
||||
@ -31,13 +32,11 @@
|
||||
|
||||
typedef struct _qifimportwindow QIFImportWindow;
|
||||
|
||||
QIFImportWindow * gnc_ui_qif_import_druid_make(void);
|
||||
void gnc_ui_qif_import_druid_destroy (QIFImportWindow * window);
|
||||
SCM gnc_ui_qif_import_druid_get_mappings(QIFImportWindow * w);
|
||||
SCM gnc_ui_qif_import_assistant_get_mappings(QIFImportWindow * w);
|
||||
|
||||
/* The gnc_file_qif_import() routine will pop up a standard file
|
||||
* selection dialogue asking the user to pick a QIF file. If one
|
||||
* is selected the the QIF file is opened and read. It's contents
|
||||
* is selected then the QIF file is opened and read. It's contents
|
||||
* are merged into the existing session (if any). The current
|
||||
* session continues to remain open for editing. */
|
||||
void gnc_file_qif_import (void);
|
@ -31,7 +31,7 @@
|
||||
|
||||
#include "dialog-account-picker.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "druid-qif-import.h"
|
||||
#include "assistant-qif-import.h"
|
||||
#include "gnc-gui-query.h"
|
||||
#include "gnc-ui-util.h"
|
||||
#include "guile-mappings.h"
|
||||
@ -54,6 +54,7 @@ struct _accountpickerdialog
|
||||
gchar * selected_name;
|
||||
};
|
||||
|
||||
void gnc_ui_qif_account_picker_new_cb (GtkButton * w, gpointer user_data);
|
||||
|
||||
/****************************************************************
|
||||
* acct_tree_add_accts
|
||||
@ -64,7 +65,6 @@ struct _accountpickerdialog
|
||||
* name matches search_name, then a GtkTreeRowReference* will be
|
||||
* returned in the reference parameter.
|
||||
****************************************************************/
|
||||
|
||||
static void
|
||||
acct_tree_add_accts(SCM accts,
|
||||
GtkTreeStore *store,
|
||||
@ -160,7 +160,6 @@ acct_tree_add_accts(SCM accts,
|
||||
*
|
||||
* This function refreshes the contents of the account tree.
|
||||
****************************************************************/
|
||||
|
||||
static void
|
||||
build_acct_tree(QIFAccountPickerDialog * picker, QIFImportWindow * import)
|
||||
{
|
||||
@ -176,7 +175,7 @@ build_acct_tree(QIFAccountPickerDialog * picker, QIFImportWindow * import)
|
||||
|
||||
/* Get an account tree with all existing and to-be-imported accounts. */
|
||||
acct_tree = scm_call_1(get_accts,
|
||||
gnc_ui_qif_import_druid_get_mappings(import));
|
||||
gnc_ui_qif_import_assistant_get_mappings(import));
|
||||
|
||||
/* Rebuild the store.
|
||||
* NOTE: It is necessary to save a copy of the name to select, because
|
||||
@ -209,8 +208,7 @@ build_acct_tree(QIFAccountPickerDialog * picker, QIFImportWindow * import)
|
||||
* This handler is invoked when the user wishes to create a new
|
||||
* account.
|
||||
****************************************************************/
|
||||
|
||||
static void
|
||||
void
|
||||
gnc_ui_qif_account_picker_new_cb(GtkButton * w, gpointer user_data)
|
||||
{
|
||||
QIFAccountPickerDialog * wind = user_data;
|
||||
@ -260,6 +258,11 @@ gnc_ui_qif_account_picker_new_cb(GtkButton * w, gpointer user_data)
|
||||
gtk_widget_grab_focus(GTK_WIDGET(wind->treeview));
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************
|
||||
* gnc_ui_qif_account_picker_changed_cb
|
||||
*
|
||||
****************************************************************/
|
||||
static void
|
||||
gnc_ui_qif_account_picker_changed_cb(GtkTreeSelection *selection,
|
||||
gpointer user_data)
|
||||
@ -284,6 +287,11 @@ gnc_ui_qif_account_picker_changed_cb(GtkTreeSelection *selection,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************
|
||||
* gnc_ui_qif_account_picker_row_activated_cb
|
||||
*
|
||||
****************************************************************/
|
||||
static void
|
||||
gnc_ui_qif_account_picker_row_activated_cb(GtkTreeView *view,
|
||||
GtkTreePath *path,
|
||||
@ -296,6 +304,11 @@ gnc_ui_qif_account_picker_row_activated_cb(GtkTreeView *view,
|
||||
gtk_dialog_response(GTK_DIALOG(wind->dialog), GTK_RESPONSE_OK);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************
|
||||
* gnc_ui_qif_account_picker_map_cb
|
||||
*
|
||||
****************************************************************/
|
||||
static int
|
||||
gnc_ui_qif_account_picker_map_cb(GtkWidget * w, gpointer user_data)
|
||||
{
|
||||
@ -317,7 +330,6 @@ gnc_ui_qif_account_picker_map_cb(GtkWidget * w, gpointer user_data)
|
||||
* user clicks OK, map_entry is changed and TRUE is returned.
|
||||
* If the clicks Cancel instead, FALSE is returned. Modal.
|
||||
****************************************************************/
|
||||
|
||||
gboolean
|
||||
qif_account_picker_dialog(QIFImportWindow * qif_wind, SCM map_entry)
|
||||
{
|
||||
@ -326,7 +338,7 @@ qif_account_picker_dialog(QIFImportWindow * qif_wind, SCM map_entry)
|
||||
SCM set_gnc_name = scm_c_eval_string("qif-map-entry:set-gnc-name!");
|
||||
SCM orig_acct = scm_call_1(gnc_name, map_entry);
|
||||
int response;
|
||||
GladeXML *xml;
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *button;
|
||||
|
||||
wind = g_new0(QIFAccountPickerDialog, 1);
|
||||
@ -347,18 +359,16 @@ qif_account_picker_dialog(QIFImportWindow * qif_wind, SCM map_entry)
|
||||
scm_dynwind_end ();
|
||||
}
|
||||
|
||||
xml = gnc_glade_xml_new("qif.glade", "QIF Import Account Picker");
|
||||
builder = gtk_builder_new();
|
||||
gnc_builder_add_from_file (builder, "dialog-account-picker.glade", "QIF Import Account Picker");
|
||||
|
||||
glade_xml_signal_connect_data(xml,
|
||||
"gnc_ui_qif_account_picker_new_cb",
|
||||
G_CALLBACK(gnc_ui_qif_account_picker_new_cb),
|
||||
wind);
|
||||
/* Connect all the signals */
|
||||
gtk_builder_connect_signals (builder, wind);
|
||||
|
||||
wind->dialog = glade_xml_get_widget(xml, "QIF Import Account Picker");
|
||||
wind->treeview = GTK_TREE_VIEW(glade_xml_get_widget(xml, "account_tree"));
|
||||
wind->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "QIF Import Account Picker"));
|
||||
wind->treeview = GTK_TREE_VIEW(gtk_builder_get_object (builder, "account_tree"));
|
||||
wind->qif_wind = qif_wind;
|
||||
|
||||
|
||||
{
|
||||
GtkTreeStore *store;
|
||||
GtkCellRenderer *renderer;
|
||||
@ -400,7 +410,7 @@ qif_account_picker_dialog(QIFImportWindow * qif_wind, SCM map_entry)
|
||||
G_CALLBACK(gnc_ui_qif_account_picker_map_cb),
|
||||
wind);
|
||||
|
||||
button = glade_xml_get_widget(xml, "newbutton");
|
||||
button = GTK_WIDGET(gtk_builder_get_object (builder, "newbutton"));
|
||||
gtk_button_set_use_stock(GTK_BUTTON(button), TRUE);
|
||||
|
||||
/* this is to get the checkmarks set up right.. it will get called
|
||||
@ -413,6 +423,7 @@ qif_account_picker_dialog(QIFImportWindow * qif_wind, SCM map_entry)
|
||||
}
|
||||
while (response == GNC_RESPONSE_NEW);
|
||||
gtk_widget_destroy(wind->dialog);
|
||||
g_object_unref(G_OBJECT(builder));
|
||||
|
||||
scm_gc_unprotect_object(wind->map_entry);
|
||||
g_free(wind->selected_name);
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include <libguile.h>
|
||||
|
||||
#include "druid-qif-import.h"
|
||||
#include "assistant-qif-import.h"
|
||||
|
||||
gboolean qif_account_picker_dialog(QIFImportWindow * wind, SCM initial_sel);
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include "dialog-preferences.h"
|
||||
#include "druid-qif-import.h"
|
||||
#include "assistant-qif-import.h"
|
||||
#include "gnc-druid-test.h"
|
||||
#include "gnc-plugin-manager.h"
|
||||
#include "gnc-plugin-qif-import.h"
|
||||
@ -155,7 +155,7 @@ static void
|
||||
gnc_plugin_qif_import_cmd_new_qif_import (GtkAction *action,
|
||||
GncMainWindowActionData *data)
|
||||
{
|
||||
gnc_ui_qif_import_druid_make ();
|
||||
gnc_file_qif_import();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include "gnc-module.h"
|
||||
#include "gnc-module-api.h"
|
||||
#include "druid-qif-import.h"
|
||||
#include "assistant-qif-import.h"
|
||||
#include "dialog-new-user.h"
|
||||
|
||||
#include "gnc-plugin-qif-import.h"
|
||||
@ -57,13 +57,13 @@ libgncmod_qif_import_gnc_module_init(int refcount)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* If the recount == 0 then register the qif-import-druid for the new-user
|
||||
/* If the recount == 0 then register the qif-import-assistant for the new-user
|
||||
* dialog.
|
||||
*/
|
||||
if (refcount == 0)
|
||||
{
|
||||
gnc_new_user_dialog_register_qif_druid
|
||||
((void (*)())gnc_ui_qif_import_druid_make);
|
||||
gnc_new_user_dialog_register_qif_assistant
|
||||
((void (*)())gnc_file_qif_import);
|
||||
}
|
||||
|
||||
scm_c_eval_string("(use-modules (gnucash import-export qif-import))");
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user