r21606 - gnucash/trunk - Dissolve dialog-tax-table module by moving its only object into
Geert Janssens
gjanssens at code.gnucash.org
Mon Nov 21 05:40:32 EST 2011
Author: gjanssens
Date: 2011-11-21 05:40:31 -0500 (Mon, 21 Nov 2011)
New Revision: 21606
Trac: http://svn.gnucash.org/trac/changeset/21606
Added:
gnucash/trunk/src/gnome-utils/dialog-tax-table.c
gnucash/trunk/src/gnome-utils/dialog-tax-table.h
gnucash/trunk/src/gnome-utils/glade/tax-tables.glade
Removed:
gnucash/trunk/src/business/dialog-tax-table/Makefile.am
gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.c
gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.h
gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.i
gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.scm
gnucash/trunk/src/business/dialog-tax-table/gncmod-dialog-tax-table.c
gnucash/trunk/src/business/dialog-tax-table/tax-tables.glade
Modified:
gnucash/trunk/configure.ac
gnucash/trunk/src/business/Makefile.am
gnucash/trunk/src/business/business-gnome/Makefile.am
gnucash/trunk/src/business/business-gnome/business-gnome.scm
gnucash/trunk/src/business/business-ledger/Makefile.am
gnucash/trunk/src/gnome-utils/Makefile.am
gnucash/trunk/src/gnome-utils/glade/Makefile.am
gnucash/trunk/src/gnome-utils/gnome-utils.i
Log:
Dissolve dialog-tax-table module by moving its only object into
gnome-utils.
Modified: gnucash/trunk/configure.ac
===================================================================
--- gnucash/trunk/configure.ac 2011-11-21 10:40:17 UTC (rev 21605)
+++ gnucash/trunk/configure.ac 2011-11-21 10:40:31 UTC (rev 21606)
@@ -1337,7 +1337,6 @@
src/test-core/Makefile
src/business/Makefile
src/business/business-utils/Makefile
- src/business/dialog-tax-table/Makefile
src/business/business-gnome/Makefile
src/business/business-gnome/glade/Makefile
src/business/business-gnome/gtkbuilder/Makefile
Modified: gnucash/trunk/src/business/Makefile.am
===================================================================
--- gnucash/trunk/src/business/Makefile.am 2011-11-21 10:40:17 UTC (rev 21605)
+++ gnucash/trunk/src/business/Makefile.am 2011-11-21 10:40:31 UTC (rev 21606)
@@ -1,5 +1,4 @@
SUBDIRS = \
business-utils \
- dialog-tax-table \
business-ledger \
business-gnome
\ No newline at end of file
Modified: gnucash/trunk/src/business/business-gnome/Makefile.am
===================================================================
--- gnucash/trunk/src/business/business-gnome/Makefile.am 2011-11-21 10:40:17 UTC (rev 21605)
+++ gnucash/trunk/src/business/business-gnome/Makefile.am 2011-11-21 10:40:31 UTC (rev 21606)
@@ -15,7 +15,6 @@
-I${top_srcdir}/src/html \
-I${top_srcdir}/src/report/report-gnome \
-I${top_srcdir}/src/business/business-ledger \
- -I${top_srcdir}/src/business/dialog-tax-table \
-I${top_srcdir}/src/register/register-core \
-I${top_srcdir}/src/register/register-gnome \
-I${top_srcdir}/src/register/ledger-core \
@@ -69,7 +68,6 @@
libgncmod_business_gnome_la_LIBADD = \
${top_builddir}/src/gnome/libgnc-gnome.la \
${top_builddir}/src/business/business-ledger/libgnc-business-ledger.la \
- ${top_builddir}/src/business/dialog-tax-table/libgncmod-dialog-tax-table.la \
${top_builddir}/src/register/register-core/libgncmod-register-core.la \
${top_builddir}/src/register/register-gnome/libgncmod-register-gnome.la \
${top_builddir}/src/report/report-gnome/libgncmod-report-gnome.la \
Modified: gnucash/trunk/src/business/business-gnome/business-gnome.scm
===================================================================
--- gnucash/trunk/src/business/business-gnome/business-gnome.scm 2011-11-21 10:40:17 UTC (rev 21605)
+++ gnucash/trunk/src/business/business-gnome/business-gnome.scm 2011-11-21 10:40:31 UTC (rev 21606)
@@ -4,7 +4,6 @@
(gnc:module-load "gnucash/gnome-utils" 0)
(gnc:module-load "gnucash/business-utils" 0)
(gnc:module-load "gnucash/gnome-search" 0)
-(gnc:module-load "gnucash/dialog-tax-table" 0)
(gnc:module-load "gnucash/report/report-gnome" 0)
Modified: gnucash/trunk/src/business/business-ledger/Makefile.am
===================================================================
--- gnucash/trunk/src/business/business-ledger/Makefile.am 2011-11-21 10:40:17 UTC (rev 21605)
+++ gnucash/trunk/src/business/business-ledger/Makefile.am 2011-11-21 10:40:31 UTC (rev 21606)
@@ -19,7 +19,6 @@
libgnc_business_ledger_la_LIBADD = \
${top_builddir}/src/business/business-utils/libgncmod-business-utils.la \
- ${top_builddir}/src/business/dialog-tax-table/libgncmod-dialog-tax-table.la \
${top_builddir}/src/register/register-core/libgncmod-register-core.la \
${top_builddir}/src/register/register-gnome/libgncmod-register-gnome.la \
${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
@@ -33,7 +32,6 @@
AM_CPPFLAGS = \
-I${top_srcdir}/src/business/business-utils \
- -I${top_srcdir}/src/business/dialog-tax-table \
-I${top_srcdir}/src \
-I${top_srcdir}/src/engine \
-I${top_srcdir}/src/core-utils \
Deleted: gnucash/trunk/src/business/dialog-tax-table/Makefile.am
===================================================================
--- gnucash/trunk/src/business/dialog-tax-table/Makefile.am 2011-11-21 10:40:17 UTC (rev 21605)
+++ gnucash/trunk/src/business/dialog-tax-table/Makefile.am 2011-11-21 10:40:31 UTC (rev 21606)
@@ -1,82 +0,0 @@
-pkglib_LTLIBRARIES = libgncmod-dialog-tax-table.la
-
-AM_CPPFLAGS = \
- -I${top_srcdir}/src \
- -I${top_srcdir}/src/core-utils \
- -I${top_srcdir}/src/engine \
- -I${top_srcdir}/src/gnc-module \
- -I${top_srcdir}/src/gnome-utils \
- -I${top_srcdir}/src/app-utils \
- -I${top_srcdir}/src/libqof/qof \
- ${GNOME_CFLAGS} \
- ${GLADE_CFLAGS} \
- ${GLIB_CFLAGS} \
- ${GUILE_INCS}
-
-libgncmod_dialog_tax_table_la_SOURCES = \
- swig-dialog-tax-table.c \
- gncmod-dialog-tax-table.c \
- dialog-tax-table.c
-
-noinst_HEADERS = \
- dialog-tax-table.h
-
-libgncmod_dialog_tax_table_la_LDFLAGS = -avoid-version
-
-libgncmod_dialog_tax_table_la_LIBADD = \
- ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
- ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
- ${top_builddir}/src/engine/libgncmod-engine.la \
- ${top_builddir}/src/gnc-module/libgnc-module.la \
- ${top_builddir}/src/libqof/qof/libgnc-qof.la \
- ${GLADE_LIBS} \
- ${GUILE_LIBS} \
- ${GNOME_LIBS} \
- ${GLIB_LIBS} \
- ${EFENCE_LIBS}
-
-if BUILDING_FROM_SVN
-swig-dialog-tax-table.c: dialog-tax-table.i ${top_srcdir}/src/base-typemaps.i
- $(SWIG) -guile $(SWIG_ARGS) -Linkage module \
- -I${top_srcdir}/src -o $@ $<
-endif
-
-gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash
-gncmod_DATA = dialog-tax-table.scm
-
-gladedir = $(GNC_GLADE_DIR)
-glade_DATA = tax-tables.glade
-
-EXTRA_DIST = \
- dialog-tax-table.i \
- ${glade_DATA} \
- ${gncmod_DATA}
-
-if GNUCASH_SEPARATE_BUILDDIR
-#Only needed when srcdir and builddir are different
-# for running
-SCM_FILE_LINKS = ${gncmod_DATA}
-endif
-
-.scm-links:
- $(RM) -rf gnucash
- mkdir -p gnucash
-if GNUCASH_SEPARATE_BUILDDIR
- for X in ${SCM_FILE_LINKS} ; do \
- $(LN_S) -f ${srcdir}/$$X . ; \
- done
-endif
- ( cd gnucash; for A in $(gncmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
- touch .scm-links
-endif
-
-noinst_DATA = .scm-links
-clean-local:
- rm -rf gnucash
-
-CLEANFILES = .scm-links ${SCM_FILE_LINKS}
-MAINTAINERCLEANFILES = swig-dialog-tax-table.c
-
-INCLUDES = -DG_LOG_DOMAIN=\"gnc.business.tax\"
Deleted: gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.c
===================================================================
--- gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.c 2011-11-21 10:40:17 UTC (rev 21605)
+++ gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.c 2011-11-21 10:40:31 UTC (rev 21606)
@@ -1,794 +0,0 @@
-/*
- * dialog-tax-table.c -- Dialog to create and edit tax-tables
- * Copyright (C) 2002 Derek Atkins
- * Author: Derek Atkins <warlord at MIT.EDU>
- *
- * Copyright (c) 2006 David Hampton <hampton at employees.org>
- *
- * 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
- * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
- * Boston, MA 02110-1301, USA gnu at gnu.org
- */
-
-#include "config.h"
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-
-#include "dialog-utils.h"
-#include "gnc-component-manager.h"
-#include "gnc-ui.h"
-#include "gnc-gui-query.h"
-#include "gnc-gtk-utils.h"
-#include "gnc-ui-util.h"
-#include "qof.h"
-#include "gnc-amount-edit.h"
-#include "gnc-tree-view-account.h"
-
-#include "gncTaxTable.h"
-#include "dialog-tax-table.h"
-
-#define DIALOG_TAX_TABLE_CM_CLASS "tax-table-dialog"
-#define GCONF_SECTION "dialogs/business/tax_tables"
-
-enum tax_table_cols
-{
- TAX_TABLE_COL_NAME = 0,
- TAX_TABLE_COL_POINTER,
- NUM_TAX_TABLE_COLS
-};
-
-enum tax_entry_cols
-{
- TAX_ENTRY_COL_NAME = 0,
- TAX_ENTRY_COL_POINTER,
- TAX_ENTRY_COL_AMOUNT,
- NUM_TAX_ENTRY_COLS
-};
-
-void tax_table_new_table_cb (GtkButton *button, TaxTableWindow *ttw);
-void tax_table_delete_table_cb (GtkButton *button, TaxTableWindow *ttw);
-void tax_table_new_entry_cb (GtkButton *button, TaxTableWindow *ttw);
-void tax_table_edit_entry_cb (GtkButton *button, TaxTableWindow *ttw);
-void tax_table_delete_entry_cb (GtkButton *button, TaxTableWindow *ttw);
-void tax_table_window_close (GtkWidget *widget, gpointer data);
-void tax_table_window_destroy_cb (GtkWidget *widget, gpointer data);
-
-
-struct _taxtable_window
-{
- GtkWidget * dialog;
- GtkWidget * names_view;
- GtkWidget * entries_view;
-
- GncTaxTable * current_table;
- GncTaxTableEntry * current_entry;
- QofBook * book;
- gint component_id;
-};
-
-typedef struct _new_taxtable
-{
- GtkWidget * dialog;
- GtkWidget * name_entry;
- GtkWidget * amount_entry;
- GtkWidget * acct_tree;
-
- GncTaxTable * created_table;
- TaxTableWindow * ttw;
- GncTaxTableEntry * entry;
- gint type;
- gboolean new_table;
-} NewTaxTable;
-
-
-static gboolean
-new_tax_table_ok_cb (NewTaxTable *ntt)
-{
- TaxTableWindow *ttw;
- const char *name = NULL;
- char *message;
- Account *acc;
- gnc_numeric amount;
-
- g_return_val_if_fail (ntt, FALSE);
- ttw = ntt->ttw;
-
- /* Verify that we've got real, valid data */
-
- /* verify the name, maybe */
- if (ntt->new_table)
- {
- name = gtk_entry_get_text (GTK_ENTRY (ntt->name_entry));
- if (name == NULL || *name == '\0')
- {
- message = _("You must provide a name for this Tax Table.");
- gnc_error_dialog (ntt->dialog, "%s", message);
- return FALSE;
- }
- if (gncTaxTableLookupByName (ttw->book, name))
- {
- message = g_strdup_printf(_(
- "You must provide a unique name for this Tax Table. "
- "Your choice \"%s\" is already in use."), name);
- gnc_error_dialog (ntt->dialog, "%s", message);
- g_free (message);
- return FALSE;
- }
- }
-
- /* verify the amount. Note that negative values are allowed (required for European tax rules) */
- amount = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (ntt->amount_entry));
- if (ntt->type == GNC_AMT_TYPE_PERCENT &&
- gnc_numeric_compare (gnc_numeric_abs (amount),
- gnc_numeric_create (100, 1)) > 0)
- {
- message = _("Percentage amount must be between -100 and 100.");
- gnc_error_dialog (ntt->dialog, "%s", message);
- return FALSE;
- }
-
- /* verify the account */
- acc = gnc_tree_view_account_get_selected_account (GNC_TREE_VIEW_ACCOUNT(ntt->acct_tree));
- if (acc == NULL)
- {
- message = _("You must choose a Tax Account.");
- gnc_error_dialog (ntt->dialog, "%s", message);
- return FALSE;
- }
-
- gnc_suspend_gui_refresh ();
-
- /* Ok, it's all valid, now either change to add this thing */
- if (ntt->new_table)
- {
- GncTaxTable *table = gncTaxTableCreate (ttw->book);
- gncTaxTableBeginEdit (table);
- gncTaxTableSetName (table, name);
- /* Reset the current table */
- ttw->current_table = table;
- ntt->created_table = table;
- }
- else
- gncTaxTableBeginEdit (ttw->current_table);
-
- /* Create/edit the entry */
- {
- GncTaxTableEntry *entry;
-
- if (ntt->entry)
- {
- entry = ntt->entry;
- }
- else
- {
- entry = gncTaxTableEntryCreate ();
- gncTaxTableAddEntry (ttw->current_table, entry);
- ttw->current_entry = entry;
- }
-
- gncTaxTableEntrySetAccount (entry, acc);
- gncTaxTableEntrySetType (entry, ntt->type);
- gncTaxTableEntrySetAmount (entry, amount);
- }
-
- /* Mark the table as changed and commit it */
- gncTaxTableChanged (ttw->current_table);
- gncTaxTableCommitEdit (ttw->current_table);
-
- gnc_resume_gui_refresh();
- return TRUE;
-}
-
-static void
-combo_changed (GtkWidget *widget, NewTaxTable *ntt)
-{
- gint index;
-
- g_return_if_fail(GTK_IS_COMBO_BOX(widget));
- g_return_if_fail(ntt);
-
- index = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
- ntt->type = index + 1;
-}
-
-static GncTaxTable *
-new_tax_table_dialog (TaxTableWindow *ttw, gboolean new_table,
- GncTaxTableEntry *entry, const char *name)
-{
- GncTaxTable *created_table = NULL;
- NewTaxTable *ntt;
- GladeXML *xml;
- GtkWidget *box, *widget, *combo;
- gboolean done;
- gint response, index;
-
- if (!ttw) return NULL;
- if (new_table && entry) return NULL;
-
- ntt = g_new0 (NewTaxTable, 1);
- ntt->ttw = ttw;
- ntt->entry = entry;
- ntt->new_table = new_table;
-
- if (entry)
- ntt->type = gncTaxTableEntryGetType (entry);
- else
- ntt->type = GNC_AMT_TYPE_PERCENT;
-
- /* Open and read the XML */
- xml = gnc_glade_xml_new ("tax-tables.glade", "New Tax Table Dialog");
- ntt->dialog = glade_xml_get_widget (xml, "New Tax Table Dialog");
- ntt->name_entry = glade_xml_get_widget (xml, "name_entry");
- if (name)
- gtk_entry_set_text (GTK_ENTRY (ntt->name_entry), name);
-
- /* Create the menu */
- combo = glade_xml_get_widget (xml, "type_combobox");
- index = ntt->type ? ntt->type : GNC_AMT_TYPE_VALUE;
- gtk_combo_box_set_active(GTK_COMBO_BOX(combo), index - 1);
- g_signal_connect (combo, "changed", G_CALLBACK (combo_changed), ntt);
-
- /* Attach our own widgets */
- box = glade_xml_get_widget (xml, "amount_box");
- ntt->amount_entry = widget = gnc_amount_edit_new ();
- gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (widget), TRUE);
- gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (widget), 100000);
- gtk_box_pack_start (GTK_BOX (box), widget, TRUE, TRUE, 0);
-
- box = glade_xml_get_widget (xml, "acct_window");
- ntt->acct_tree = GTK_WIDGET(gnc_tree_view_account_new (FALSE));
- gtk_container_add (GTK_CONTAINER (box), ntt->acct_tree);
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(ntt->acct_tree), FALSE);
-
- /* Make 'enter' do the right thing */
- gtk_entry_set_activates_default(GTK_ENTRY (gnc_amount_edit_gtk_entry
- (GNC_AMOUNT_EDIT (ntt->amount_entry))),
- TRUE);
-
- /* Fix mnemonics for generated target widgets */
- widget = glade_xml_get_widget (xml, "value_label");
- gtk_label_set_mnemonic_widget (GTK_LABEL (widget), ntt->amount_entry);
- widget = glade_xml_get_widget (xml, "account_label");
- gtk_label_set_mnemonic_widget (GTK_LABEL (widget), ntt->acct_tree);
-
- /* Fill in the widgets appropriately */
- if (entry)
- {
- gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (ntt->amount_entry),
- gncTaxTableEntryGetAmount (entry));
- gnc_tree_view_account_set_selected_account (GNC_TREE_VIEW_ACCOUNT (ntt->acct_tree),
- gncTaxTableEntryGetAccount (entry));
- }
-
- /* Set our parent */
- gtk_window_set_transient_for (GTK_WINDOW(ntt->dialog), GTK_WINDOW(ttw->dialog));
-
- /* Setup signals */
- glade_xml_signal_autoconnect_full( xml,
- gnc_glade_autoconnect_full_func,
- ntt);
-
- /* Show what we should */
- gtk_widget_show_all (ntt->dialog);
- if (new_table == FALSE)
- {
- gtk_widget_hide (glade_xml_get_widget (xml, "table_title"));
- gtk_widget_hide (glade_xml_get_widget (xml, "table_name"));
- gtk_widget_hide (glade_xml_get_widget (xml, "spacer"));
- gtk_widget_hide (ntt->name_entry);
- /* Tables are great for layout, but a pain when you hide widgets */
- widget = glade_xml_get_widget (xml, "ttd_table");
- gtk_table_set_row_spacing (GTK_TABLE(widget), 0, 0);
- gtk_table_set_row_spacing (GTK_TABLE(widget), 1, 0);
- gtk_table_set_row_spacing (GTK_TABLE(widget), 2, 0);
- gtk_widget_grab_focus (gnc_amount_edit_gtk_entry
- (GNC_AMOUNT_EDIT (ntt->amount_entry)));
- }
- else
- gtk_widget_grab_focus (ntt->name_entry);
-
- /* Display the dialog now that we're done manipulating it */
- gtk_widget_show (ntt->dialog);
-
- done = FALSE;
- while (!done)
- {
- response = gtk_dialog_run (GTK_DIALOG (ntt->dialog));
- switch (response)
- {
- case GTK_RESPONSE_OK:
- if (new_tax_table_ok_cb (ntt))
- {
- created_table = ntt->created_table;
- done = TRUE;
- }
- break;
- default:
- done = TRUE;
- break;
- }
- }
-
- gtk_widget_destroy(ntt->dialog);
- g_free(ntt);
-
- return created_table;
-}
-
-/***********************************************************************/
-
-static void
-tax_table_entries_refresh (TaxTableWindow *ttw)
-{
- GList *list, *node;
- GtkTreeView *view;
- GtkListStore *store;
- GtkTreeIter iter;
- GtkTreePath *path;
- GtkTreeSelection *selection;
- GtkTreeRowReference *reference = NULL;
- GncTaxTableEntry *selected_entry;
-
- g_return_if_fail (ttw);
-
- view = GTK_TREE_VIEW (ttw->entries_view);
- store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
-
- /* Clear the list */
- selected_entry = ttw->current_entry;
- gtk_list_store_clear (store);
- if (ttw->current_table == NULL)
- return;
-
- /* Add the items to the list */
- list = gncTaxTableGetEntries (ttw->current_table);
- if (list)
- list = g_list_reverse (g_list_copy (list));
-
- for (node = list ; node; node = node->next)
- {
- char *row_text[3];
- GncTaxTableEntry *entry = node->data;
- Account *acc = gncTaxTableEntryGetAccount (entry);
- gnc_numeric amount = gncTaxTableEntryGetAmount (entry);
-
- row_text[0] = gnc_account_get_full_name (acc);
- switch (gncTaxTableEntryGetType (entry))
- {
- case GNC_AMT_TYPE_PERCENT:
- row_text[1] =
- g_strdup_printf ("%s%%",
- xaccPrintAmount (amount,
- gnc_default_print_info (FALSE)));
- break;
- default:
- row_text[1] =
- g_strdup_printf ("%s",
- xaccPrintAmount (amount,
- gnc_default_print_info (TRUE)));
- break;
- }
-
- gtk_list_store_prepend(store, &iter);
- gtk_list_store_set(store, &iter,
- TAX_ENTRY_COL_NAME, row_text[0],
- TAX_ENTRY_COL_POINTER, entry,
- TAX_ENTRY_COL_AMOUNT, row_text[1],
- -1);
- if (entry == selected_entry)
- {
- path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
- reference = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), path);
- gtk_tree_path_free(path);
- }
-
- g_free (row_text[0]);
- g_free (row_text[1]);
- }
-
- if (reference)
- {
- path = gtk_tree_row_reference_get_path(reference);
- gtk_tree_row_reference_free(reference);
- if (path)
- {
- selection = gtk_tree_view_get_selection(view);
- gtk_tree_selection_select_path(selection, path);
- gtk_tree_view_scroll_to_cell(view, path, NULL, TRUE, 0.5, 0.0);
- gtk_tree_path_free(path);
- }
- }
-}
-
-static void
-tax_table_window_refresh (TaxTableWindow *ttw)
-{
- GList *list, *node;
- GtkTreeView *view;
- GtkListStore *store;
- GtkTreeIter iter;
- GtkTreePath *path;
- GtkTreeSelection *selection;
- GtkTreeRowReference *reference = NULL;
-
- g_return_if_fail (ttw);
- view = GTK_TREE_VIEW (ttw->names_view);
- store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
-
- /* Clear the list */
- gtk_list_store_clear(store);
-
- gnc_gui_component_clear_watches (ttw->component_id);
-
- /* Add the items to the list */
- list = gncTaxTableGetTables (ttw->book);
- if (list)
- list = g_list_reverse (g_list_copy (list));
-
- for (node = list; node; node = node->next)
- {
- GncTaxTable *table = node->data;
-
- gnc_gui_component_watch_entity (ttw->component_id,
- gncTaxTableGetGUID (table),
- QOF_EVENT_MODIFY);
-
- gtk_list_store_prepend(store, &iter);
- gtk_list_store_set(store, &iter,
- TAX_TABLE_COL_NAME, gncTaxTableGetName (table),
- TAX_TABLE_COL_POINTER, table,
- -1);
- if (table == ttw->current_table)
- {
- path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
- reference = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), path);
- gtk_tree_path_free(path);
- }
- }
-
- if (list)
- g_list_free (list);
-
- gnc_gui_component_watch_entity_type (ttw->component_id,
- GNC_TAXTABLE_MODULE_NAME,
- QOF_EVENT_CREATE | QOF_EVENT_DESTROY);
-
- if (reference)
- {
- path = gtk_tree_row_reference_get_path(reference);
- gtk_tree_row_reference_free(reference);
- if (path)
- {
- selection = gtk_tree_view_get_selection(view);
- gtk_tree_selection_select_path(selection, path);
- gtk_tree_view_scroll_to_cell(view, path, NULL, TRUE, 0.5, 0.0);
- gtk_tree_path_free(path);
- }
- }
- ;;
- tax_table_entries_refresh (ttw);
- /* select_row() above will refresh the entries window */
-}
-
-static void
-tax_table_selection_changed (GtkTreeSelection *selection,
- gpointer user_data)
-{
- TaxTableWindow *ttw = user_data;
- GncTaxTable *table;
- GtkTreeModel *model;
- GtkTreeIter iter;
-
- g_return_if_fail (ttw);
-
- if (!gtk_tree_selection_get_selected(selection, &model, &iter))
- return;
-
- gtk_tree_model_get(model, &iter, TAX_TABLE_COL_POINTER, &table, -1);
- g_return_if_fail (table);
-
- /* If we've changed, then reset the entry list */
- if (table != ttw->current_table)
- {
- ttw->current_table = table;
- ttw->current_entry = NULL;
- }
- /* And force a refresh of the entries */
- tax_table_entries_refresh (ttw);
-}
-
-static void
-tax_table_entry_selection_changed (GtkTreeSelection *selection,
- gpointer user_data)
-{
- TaxTableWindow *ttw = user_data;
- GtkTreeModel *model;
- GtkTreeIter iter;
-
- g_return_if_fail (ttw);
-
- if (!gtk_tree_selection_get_selected(selection, &model, &iter))
- {
- ttw->current_entry = NULL;
- return;
- }
-
- gtk_tree_model_get(model, &iter, TAX_ENTRY_COL_POINTER, &ttw->current_entry, -1);
-}
-
-static void
-tax_table_entry_row_activated (GtkTreeView *tree_view,
- GtkTreePath *path,
- GtkTreeViewColumn *column,
- gpointer user_data)
-{
- TaxTableWindow *ttw = user_data;
-
- new_tax_table_dialog (ttw, FALSE, ttw->current_entry, NULL);
-}
-
-void
-tax_table_new_table_cb (GtkButton *button, TaxTableWindow *ttw)
-{
- g_return_if_fail (ttw);
- new_tax_table_dialog (ttw, TRUE, NULL, NULL);
-}
-
-void
-tax_table_delete_table_cb (GtkButton *button, TaxTableWindow *ttw)
-{
- g_return_if_fail (ttw);
-
- if (!ttw->current_table)
- return;
-
- if (gncTaxTableGetRefcount (ttw->current_table) > 0)
- {
- char *message =
- g_strdup_printf (_("Tax table \"%s\" is in use. You cannot delete it."),
- gncTaxTableGetName (ttw->current_table));
- gnc_error_dialog (ttw->dialog, "%s", message);
- g_free (message);
- return;
- }
-
- if (gnc_verify_dialog (ttw->dialog, FALSE,
- _("Are you sure you want to delete \"%s\"?"),
- gncTaxTableGetName (ttw->current_table)))
- {
- /* Ok, let's remove it */
- gnc_suspend_gui_refresh ();
- gncTaxTableBeginEdit (ttw->current_table);
- gncTaxTableDestroy (ttw->current_table);
- ttw->current_table = NULL;
- ttw->current_entry = NULL;
- gnc_resume_gui_refresh ();
- }
-}
-
-void
-tax_table_new_entry_cb (GtkButton *button, TaxTableWindow *ttw)
-{
- g_return_if_fail (ttw);
- if (!ttw->current_table)
- return;
- new_tax_table_dialog (ttw, FALSE, NULL, NULL);
-}
-
-void
-tax_table_edit_entry_cb (GtkButton *button, TaxTableWindow *ttw)
-{
- g_return_if_fail (ttw);
- if (!ttw->current_entry)
- return;
- new_tax_table_dialog (ttw, FALSE, ttw->current_entry, NULL);
-}
-
-void
-tax_table_delete_entry_cb (GtkButton *button, TaxTableWindow *ttw)
-{
- g_return_if_fail (ttw);
- if (!ttw->current_table || !ttw->current_entry)
- return;
-
- if (g_list_length (gncTaxTableGetEntries (ttw->current_table)) <= 1)
- {
- char *message = _("You cannot remove the last entry from the tax table. "
- "Try deleting the tax table if you want to do that.");
- gnc_error_dialog (ttw->dialog, "%s", message);
- return;
- }
-
- if (gnc_verify_dialog (ttw->dialog, FALSE, "%s",
- _("Are you sure you want to delete this entry?")))
- {
- /* Ok, let's remove it */
- gnc_suspend_gui_refresh ();
- gncTaxTableBeginEdit (ttw->current_table);
- gncTaxTableRemoveEntry (ttw->current_table, ttw->current_entry);
- gncTaxTableEntryDestroy (ttw->current_entry);
- gncTaxTableChanged (ttw->current_table);
- gncTaxTableCommitEdit (ttw->current_table);
- ttw->current_entry = NULL;
- gnc_resume_gui_refresh ();
- }
-}
-
-static void
-tax_table_window_refresh_handler (GHashTable *changes, gpointer data)
-{
- TaxTableWindow *ttw = data;
-
- g_return_if_fail (data);
- tax_table_window_refresh (ttw);
-}
-
-static void
-tax_table_window_close_handler (gpointer data)
-{
- TaxTableWindow *ttw = data;
- g_return_if_fail (ttw);
-
- gtk_widget_destroy (ttw->dialog);
-}
-
-void
-tax_table_window_close (GtkWidget *widget, gpointer data)
-{
- TaxTableWindow *ttw = data;
-
- gnc_save_window_size (GCONF_SECTION, GTK_WINDOW (ttw->dialog));
- gnc_ui_tax_table_window_destroy (ttw);
-}
-
-void
-tax_table_window_destroy_cb (GtkWidget *widget, gpointer data)
-{
- TaxTableWindow *ttw = data;
-
- if (!ttw) return;
-
- gnc_unregister_gui_component (ttw->component_id);
-
- g_free (ttw);
-}
-
-static gboolean
-find_handler (gpointer find_data, gpointer user_data)
-{
- TaxTableWindow *ttw = user_data;
- QofBook *book = find_data;
-
- return (ttw != NULL && ttw->book == book);
-}
-
-/* Create a tax-table window */
-TaxTableWindow *
-gnc_ui_tax_table_window_new (QofBook *book)
-{
- TaxTableWindow *ttw;
- GladeXML *xml;
- GtkTreeView *view;
- GtkTreeViewColumn *column;
- GtkCellRenderer *renderer;
- GtkListStore *store;
- GtkTreeSelection *selection;
-
- if (!book) return NULL;
-
- /*
- * Find an existing tax-table window. If found, bring it to
- * the front. If we have an actual owner, then set it in
- * the window.
- */
- ttw = gnc_find_first_gui_component (DIALOG_TAX_TABLE_CM_CLASS, find_handler,
- book);
- if (ttw)
- {
- gtk_window_present (GTK_WINDOW(ttw->dialog));
- return ttw;
- }
-
- /* Didn't find one -- create a new window */
- ttw = g_new0 (TaxTableWindow, 1);
- ttw->book = book;
-
- /* Open and read the XML */
- xml = gnc_glade_xml_new ("tax-tables.glade", "Tax Table Window");
- ttw->dialog = glade_xml_get_widget (xml, "Tax Table Window");
- ttw->names_view = glade_xml_get_widget (xml, "tax_tables_view");
- ttw->entries_view = glade_xml_get_widget (xml, "tax_table_entries");
-
- /* Create the tax tables view */
- view = GTK_TREE_VIEW(ttw->names_view);
- store = gtk_list_store_new (NUM_TAX_TABLE_COLS, G_TYPE_STRING,
- G_TYPE_POINTER);
- gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
- g_object_unref(store);
-
- renderer = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes("", renderer,
- "text", TAX_TABLE_COL_NAME,
- NULL);
- gtk_tree_view_append_column(view, column);
-
- selection = gtk_tree_view_get_selection(view);
- g_signal_connect(selection, "changed",
- G_CALLBACK(tax_table_selection_changed), ttw);
-
-
- /* Create the tax table entries view */
- view = GTK_TREE_VIEW(ttw->entries_view);
- store = gtk_list_store_new (NUM_TAX_ENTRY_COLS, G_TYPE_STRING,
- G_TYPE_POINTER, G_TYPE_STRING);
- gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
- g_object_unref(store);
-
- renderer = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes("", renderer,
- "text", TAX_ENTRY_COL_NAME,
- NULL);
- gtk_tree_view_append_column(view, column);
-
- selection = gtk_tree_view_get_selection(view);
- g_signal_connect(selection, "changed",
- G_CALLBACK(tax_table_entry_selection_changed), ttw);
- g_signal_connect(view, "row-activated",
- G_CALLBACK(tax_table_entry_row_activated), ttw);
-
-
- /* Setup signals */
- glade_xml_signal_autoconnect_full( xml,
- gnc_glade_autoconnect_full_func,
- ttw);
-
- /* register with component manager */
- ttw->component_id =
- gnc_register_gui_component (DIALOG_TAX_TABLE_CM_CLASS,
- tax_table_window_refresh_handler,
- tax_table_window_close_handler,
- ttw);
-
- tax_table_window_refresh (ttw);
- gnc_restore_window_size (GCONF_SECTION, GTK_WINDOW (ttw->dialog));
- gtk_widget_show_all (ttw->dialog);
- return ttw;
-}
-
-/* Destroy a tax-table window */
-void
-gnc_ui_tax_table_window_destroy (TaxTableWindow *ttw)
-{
- if (!ttw)
- return;
-
- gnc_close_gui_component (ttw->component_id);
-}
-
-/* Create a new tax-table by name */
-GncTaxTable *
-gnc_ui_tax_table_new_from_name (QofBook *book, const char *name)
-{
- TaxTableWindow *ttw;
-
- if (!book) return NULL;
-
- ttw = gnc_ui_tax_table_window_new (book);
- if (!ttw) return NULL;
-
- return new_tax_table_dialog (ttw, TRUE, NULL, name);
-}
Deleted: gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.h
===================================================================
--- gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.h 2011-11-21 10:40:17 UTC (rev 21605)
+++ gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.h 2011-11-21 10:40:31 UTC (rev 21606)
@@ -1,40 +0,0 @@
-/*
- * dialog-tax-table.h -- Dialog to create and edit tax-tables
- * Copyright (C) 2002 Derek Atkins
- * Author: Derek Atkins <warlord at MIT.EDU>
- *
- * 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
- * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
- * Boston, MA 02110-1301, USA gnu at gnu.org
- */
-
-#ifndef _DIALOG_TAX_TABLE_H
-#define _DIALOG_TAX_TABLE_H
-
-typedef struct _taxtable_window TaxTableWindow;
-
-#include "gncTaxTable.h"
-
-/* Create a new tax-table by name */
-GncTaxTable * gnc_ui_tax_table_new_from_name (QofBook *book, const char *name);
-
-/* Create a tax-table window */
-TaxTableWindow * gnc_ui_tax_table_window_new (QofBook *book);
-
-/* Destroy a tax-table window */
-void gnc_ui_tax_table_window_destroy (TaxTableWindow *ttw);
-
-#endif /* _DIALOG_TAX-TABLE_H */
Deleted: gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.i
===================================================================
--- gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.i 2011-11-21 10:40:17 UTC (rev 21605)
+++ gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.i 2011-11-21 10:40:31 UTC (rev 21606)
@@ -1,12 +0,0 @@
-%module sw_dialog_tax_table
-%{
-/* Includes the header in the wrapper code */
-#include <config.h>
-#include <dialog-tax-table.h>
-
-SCM scm_init_sw_dialog_tax_table_module (void);
-%}
-
-%import "base-typemaps.i"
-
-TaxTableWindow * gnc_ui_tax_table_window_new (QofBook *book);
Deleted: gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.scm
===================================================================
--- gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.scm 2011-11-21 10:40:17 UTC (rev 21605)
+++ gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.scm 2011-11-21 10:40:31 UTC (rev 21606)
@@ -1 +0,0 @@
-(define-module (gnucash dialog-tax-table))
Deleted: gnucash/trunk/src/business/dialog-tax-table/gncmod-dialog-tax-table.c
===================================================================
--- gnucash/trunk/src/business/dialog-tax-table/gncmod-dialog-tax-table.c 2011-11-21 10:40:17 UTC (rev 21605)
+++ gnucash/trunk/src/business/dialog-tax-table/gncmod-dialog-tax-table.c 2011-11-21 10:40:31 UTC (rev 21606)
@@ -1,80 +0,0 @@
-/*********************************************************************
- * gncmod-dialog-tax-table.c
- * module definition/initialization for the Business Tax Table Dialog module
- *
- * Copyright (c) 2002 Derek Atkins <warlord at MIT.EDU>
- *
- * 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
- * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
- * Boston, MA 02110-1301, USA gnu at gnu.org
- *********************************************************************/
-
-#include "config.h"
-#include <gmodule.h>
-#include <libguile.h>
-
-#include "gnc-module.h"
-#include "gnc-module-api.h"
-
-GNC_MODULE_API_DECL(libgncmod_dialog_tax_table)
-
-extern SCM scm_init_sw_dialog_tax_table_module(void);
-/* version of the gnc module system interface we require */
-int libgncmod_dialog_tax_table_gnc_module_system_interface = 0;
-
-/* module versioning uses libtool semantics. */
-int libgncmod_dialog_tax_table_gnc_module_current = 0;
-int libgncmod_dialog_tax_table_gnc_module_revision = 0;
-int libgncmod_dialog_tax_table_gnc_module_age = 0;
-
-
-char *
-libgncmod_dialog_tax_table_gnc_module_path(void)
-{
- return g_strdup("gnucash/dialog-tax-table");
-}
-
-char *
-libgncmod_dialog_tax_table_gnc_module_description(void)
-{
- return g_strdup("The GnuCash tax-table GNOME UI module");
-}
-
-int
-libgncmod_dialog_tax_table_gnc_module_init(int refcount)
-{
- /* load app-utils: we depend on it -- and it depends on the engine */
- if (!gnc_module_load ("gnucash/app-utils", 0))
- {
- return FALSE;
- }
- /* We also depend on the gnome-utils module */
- if (!gnc_module_load ("gnucash/gnome-utils", 0))
- {
- return FALSE;
- }
-
- scm_init_sw_dialog_tax_table_module();
- scm_c_eval_string("(use-modules (sw_dialog_tax_table))");
-
- return TRUE;
-}
-
-int
-libgncmod_dialog_tax_table_gnc_module_end(int refcount)
-{
- return TRUE;
-}
Deleted: gnucash/trunk/src/business/dialog-tax-table/tax-tables.glade
===================================================================
--- gnucash/trunk/src/business/dialog-tax-table/tax-tables.glade 2011-11-21 10:40:17 UTC (rev 21605)
+++ gnucash/trunk/src/business/dialog-tax-table/tax-tables.glade 2011-11-21 10:40:31 UTC (rev 21606)
@@ -1,522 +0,0 @@
-<?xml version="1.0"?>
-<glade-interface>
- <!-- interface-requires gtk+ 2.10 -->
- <!-- interface-naming-policy toplevel-contextual -->
- <widget class="GtkDialog" id="Tax Table Window">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Tax Tables</property>
- <property name="type_hint">normal</property>
- <signal name="destroy" handler="tax_table_window_destroy_cb"/>
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox1">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">8</property>
- <child>
- <widget class="GtkHBox" id="hbox4">
- <property name="visible">True</property>
- <property name="spacing">12</property>
- <child>
- <widget class="GtkVBox" id="vbox1">
- <property name="visible">True</property>
- <property name="border_width">6</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <widget class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes"><b>Tax Tables</b></property>
- <property name="use_markup">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkAlignment" id="alignment5">
- <property name="visible">True</property>
- <property name="left_padding">12</property>
- <child>
- <widget class="GtkScrolledWindow" id="scrolledwindow1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hscrollbar_policy">automatic</property>
- <property name="vscrollbar_policy">automatic</property>
- <property name="shadow_type">in</property>
- <child>
- <widget class="GtkTreeView" id="tax_tables_view">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="headers_visible">False</property>
- <property name="rules_hint">True</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkAlignment" id="alignment6">
- <property name="visible">True</property>
- <property name="left_padding">12</property>
- <child>
- <widget class="GtkHButtonBox" id="hbox2">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <property name="layout_style">spread</property>
- <child>
- <widget class="GtkButton" id="delete_table_button">
- <property name="label">gtk-delete</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- <signal name="clicked" handler="tax_table_delete_table_cb"/>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton" id="new_table_button">
- <property name="label">gtk-new</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- <signal name="clicked" handler="tax_table_new_table_cb"/>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVBox" id="vbox2">
- <property name="visible">True</property>
- <property name="border_width">6</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <widget class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes"><b>Tax Table Entries</b></property>
- <property name="use_markup">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkAlignment" id="alignment7">
- <property name="visible">True</property>
- <property name="left_padding">12</property>
- <child>
- <widget class="GtkScrolledWindow" id="scrolledwindow2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hscrollbar_policy">automatic</property>
- <property name="vscrollbar_policy">automatic</property>
- <property name="shadow_type">in</property>
- <child>
- <widget class="GtkTreeView" id="tax_table_entries">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="headers_visible">False</property>
- <property name="rules_hint">True</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkAlignment" id="alignment8">
- <property name="visible">True</property>
- <property name="left_padding">12</property>
- <child>
- <widget class="GtkHButtonBox" id="hbox3">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <property name="layout_style">spread</property>
- <child>
- <widget class="GtkButton" id="edit_entry_button">
- <property name="label" translatable="yes">_Edit</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- <signal name="clicked" handler="tax_table_edit_entry_cb"/>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton" id="delete_entry_button">
- <property name="label">gtk-delete</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- <signal name="clicked" handler="tax_table_delete_entry_cb"/>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton" id="new_entry_button">
- <property name="label">gtk-new</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- <signal name="clicked" handler="tax_table_new_entry_cb"/>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area1">
- <property name="visible">True</property>
- <property name="layout_style">end</property>
- <child>
- <widget class="GtkButton" id="close_button">
- <property name="label">gtk-close</property>
- <property name="response_id">-6</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- <signal name="clicked" handler="tax_table_window_close"/>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- <widget class="GtkDialog" id="New Tax Table Dialog">
- <property name="border_width">6</property>
- <property name="modal">True</property>
- <property name="type_hint">dialog</property>
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox2">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">8</property>
- <child>
- <widget class="GtkTable" id="ttd_table">
- <property name="visible">True</property>
- <property name="n_rows">7</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">12</property>
- <property name="row_spacing">6</property>
- <child>
- <widget class="GtkEntry" id="name_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="activates_default">True</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="spacer">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- </widget>
- <packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label11">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes"><b>Tax Table Entry</b></property>
- <property name="use_markup">True</property>
- </widget>
- <packing>
- <property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="table_title">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes"><b>Tax Table</b></property>
- <property name="use_markup">True</property>
- </widget>
- <packing>
- <property name="right_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <widget class="GtkAlignment" id="alignment4">
- <property name="visible">True</property>
- <property name="left_padding">12</property>
- <child>
- <widget class="GtkLabel" id="account_label">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes">_Account:</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <widget class="GtkAlignment" id="alignment3">
- <property name="visible">True</property>
- <property name="left_padding">12</property>
- <child>
- <widget class="GtkLabel" id="value_label">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">_Value: </property>
- <property name="use_underline">True</property>
- <property name="justify">right</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <widget class="GtkAlignment" id="alignment2">
- <property name="visible">True</property>
- <property name="left_padding">12</property>
- <child>
- <widget class="GtkLabel" id="label6">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">_Type: </property>
- <property name="use_underline">True</property>
- <property name="justify">right</property>
- <property name="mnemonic_widget">type_combobox</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <widget class="GtkScrolledWindow" id="acct_window">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hscrollbar_policy">never</property>
- <property name="vscrollbar_policy">automatic</property>
- <child>
- <placeholder/>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
- </packing>
- </child>
- <child>
- <widget class="GtkHBox" id="amount_box">
- <property name="visible">True</property>
- <child>
- <placeholder/>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
- <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <widget class="GtkAlignment" id="alignment1">
- <property name="visible">True</property>
- <property name="left_padding">12</property>
- <child>
- <widget class="GtkLabel" id="table_name">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">_Name: </property>
- <property name="use_underline">True</property>
- <property name="justify">right</property>
- <property name="mnemonic_widget">name_entry</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <widget class="GtkComboBox" id="type_combobox">
- <property name="visible">True</property>
- <property name="items" translatable="yes">Value $
-Percent %</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- </widget>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area2">
- <property name="visible">True</property>
- <property name="layout_style">end</property>
- <child>
- <widget class="GtkButton" id="cancel_button">
- <property name="label">gtk-cancel</property>
- <property name="response_id">-6</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton" id="ok_button">
- <property name="label">gtk-ok</property>
- <property name="response_id">-5</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
-</glade-interface>
Modified: gnucash/trunk/src/gnome-utils/Makefile.am
===================================================================
--- gnucash/trunk/src/gnome-utils/Makefile.am 2011-11-21 10:40:17 UTC (rev 21605)
+++ gnucash/trunk/src/gnome-utils/Makefile.am 2011-11-21 10:40:31 UTC (rev 21606)
@@ -38,6 +38,7 @@
dialog-preferences.c \
dialog-query-list.c \
dialog-reset-warnings.c \
+ dialog-tax-table.c \
dialog-totd.c \
dialog-transfer.c \
dialog-userpass.c \
@@ -177,6 +178,7 @@
window-main-summarybar.h
noinst_HEADERS = \
+ dialog-tax-table.h \
gnc-autosave.h \
gnc-druid-gnome.h \
gnc-druid-provider-edge-gnome.h \
Copied: gnucash/trunk/src/gnome-utils/dialog-tax-table.c (from rev 21605, gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.c)
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-tax-table.c (rev 0)
+++ gnucash/trunk/src/gnome-utils/dialog-tax-table.c 2011-11-21 10:40:31 UTC (rev 21606)
@@ -0,0 +1,794 @@
+/*
+ * dialog-tax-table.c -- Dialog to create and edit tax-tables
+ * Copyright (C) 2002 Derek Atkins
+ * Author: Derek Atkins <warlord at MIT.EDU>
+ *
+ * Copyright (c) 2006 David Hampton <hampton at employees.org>
+ *
+ * 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
+ * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
+ * Boston, MA 02110-1301, USA gnu at gnu.org
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+#include "dialog-utils.h"
+#include "gnc-component-manager.h"
+#include "gnc-ui.h"
+#include "gnc-gui-query.h"
+#include "gnc-gtk-utils.h"
+#include "gnc-ui-util.h"
+#include "qof.h"
+#include "gnc-amount-edit.h"
+#include "gnc-tree-view-account.h"
+
+#include "gncTaxTable.h"
+#include "dialog-tax-table.h"
+
+#define DIALOG_TAX_TABLE_CM_CLASS "tax-table-dialog"
+#define GCONF_SECTION "dialogs/business/tax_tables"
+
+enum tax_table_cols
+{
+ TAX_TABLE_COL_NAME = 0,
+ TAX_TABLE_COL_POINTER,
+ NUM_TAX_TABLE_COLS
+};
+
+enum tax_entry_cols
+{
+ TAX_ENTRY_COL_NAME = 0,
+ TAX_ENTRY_COL_POINTER,
+ TAX_ENTRY_COL_AMOUNT,
+ NUM_TAX_ENTRY_COLS
+};
+
+void tax_table_new_table_cb (GtkButton *button, TaxTableWindow *ttw);
+void tax_table_delete_table_cb (GtkButton *button, TaxTableWindow *ttw);
+void tax_table_new_entry_cb (GtkButton *button, TaxTableWindow *ttw);
+void tax_table_edit_entry_cb (GtkButton *button, TaxTableWindow *ttw);
+void tax_table_delete_entry_cb (GtkButton *button, TaxTableWindow *ttw);
+void tax_table_window_close (GtkWidget *widget, gpointer data);
+void tax_table_window_destroy_cb (GtkWidget *widget, gpointer data);
+
+
+struct _taxtable_window
+{
+ GtkWidget * dialog;
+ GtkWidget * names_view;
+ GtkWidget * entries_view;
+
+ GncTaxTable * current_table;
+ GncTaxTableEntry * current_entry;
+ QofBook * book;
+ gint component_id;
+};
+
+typedef struct _new_taxtable
+{
+ GtkWidget * dialog;
+ GtkWidget * name_entry;
+ GtkWidget * amount_entry;
+ GtkWidget * acct_tree;
+
+ GncTaxTable * created_table;
+ TaxTableWindow * ttw;
+ GncTaxTableEntry * entry;
+ gint type;
+ gboolean new_table;
+} NewTaxTable;
+
+
+static gboolean
+new_tax_table_ok_cb (NewTaxTable *ntt)
+{
+ TaxTableWindow *ttw;
+ const char *name = NULL;
+ char *message;
+ Account *acc;
+ gnc_numeric amount;
+
+ g_return_val_if_fail (ntt, FALSE);
+ ttw = ntt->ttw;
+
+ /* Verify that we've got real, valid data */
+
+ /* verify the name, maybe */
+ if (ntt->new_table)
+ {
+ name = gtk_entry_get_text (GTK_ENTRY (ntt->name_entry));
+ if (name == NULL || *name == '\0')
+ {
+ message = _("You must provide a name for this Tax Table.");
+ gnc_error_dialog (ntt->dialog, "%s", message);
+ return FALSE;
+ }
+ if (gncTaxTableLookupByName (ttw->book, name))
+ {
+ message = g_strdup_printf(_(
+ "You must provide a unique name for this Tax Table. "
+ "Your choice \"%s\" is already in use."), name);
+ gnc_error_dialog (ntt->dialog, "%s", message);
+ g_free (message);
+ return FALSE;
+ }
+ }
+
+ /* verify the amount. Note that negative values are allowed (required for European tax rules) */
+ amount = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (ntt->amount_entry));
+ if (ntt->type == GNC_AMT_TYPE_PERCENT &&
+ gnc_numeric_compare (gnc_numeric_abs (amount),
+ gnc_numeric_create (100, 1)) > 0)
+ {
+ message = _("Percentage amount must be between -100 and 100.");
+ gnc_error_dialog (ntt->dialog, "%s", message);
+ return FALSE;
+ }
+
+ /* verify the account */
+ acc = gnc_tree_view_account_get_selected_account (GNC_TREE_VIEW_ACCOUNT(ntt->acct_tree));
+ if (acc == NULL)
+ {
+ message = _("You must choose a Tax Account.");
+ gnc_error_dialog (ntt->dialog, "%s", message);
+ return FALSE;
+ }
+
+ gnc_suspend_gui_refresh ();
+
+ /* Ok, it's all valid, now either change to add this thing */
+ if (ntt->new_table)
+ {
+ GncTaxTable *table = gncTaxTableCreate (ttw->book);
+ gncTaxTableBeginEdit (table);
+ gncTaxTableSetName (table, name);
+ /* Reset the current table */
+ ttw->current_table = table;
+ ntt->created_table = table;
+ }
+ else
+ gncTaxTableBeginEdit (ttw->current_table);
+
+ /* Create/edit the entry */
+ {
+ GncTaxTableEntry *entry;
+
+ if (ntt->entry)
+ {
+ entry = ntt->entry;
+ }
+ else
+ {
+ entry = gncTaxTableEntryCreate ();
+ gncTaxTableAddEntry (ttw->current_table, entry);
+ ttw->current_entry = entry;
+ }
+
+ gncTaxTableEntrySetAccount (entry, acc);
+ gncTaxTableEntrySetType (entry, ntt->type);
+ gncTaxTableEntrySetAmount (entry, amount);
+ }
+
+ /* Mark the table as changed and commit it */
+ gncTaxTableChanged (ttw->current_table);
+ gncTaxTableCommitEdit (ttw->current_table);
+
+ gnc_resume_gui_refresh();
+ return TRUE;
+}
+
+static void
+combo_changed (GtkWidget *widget, NewTaxTable *ntt)
+{
+ gint index;
+
+ g_return_if_fail(GTK_IS_COMBO_BOX(widget));
+ g_return_if_fail(ntt);
+
+ index = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
+ ntt->type = index + 1;
+}
+
+static GncTaxTable *
+new_tax_table_dialog (TaxTableWindow *ttw, gboolean new_table,
+ GncTaxTableEntry *entry, const char *name)
+{
+ GncTaxTable *created_table = NULL;
+ NewTaxTable *ntt;
+ GladeXML *xml;
+ GtkWidget *box, *widget, *combo;
+ gboolean done;
+ gint response, index;
+
+ if (!ttw) return NULL;
+ if (new_table && entry) return NULL;
+
+ ntt = g_new0 (NewTaxTable, 1);
+ ntt->ttw = ttw;
+ ntt->entry = entry;
+ ntt->new_table = new_table;
+
+ if (entry)
+ ntt->type = gncTaxTableEntryGetType (entry);
+ else
+ ntt->type = GNC_AMT_TYPE_PERCENT;
+
+ /* Open and read the XML */
+ xml = gnc_glade_xml_new ("tax-tables.glade", "New Tax Table Dialog");
+ ntt->dialog = glade_xml_get_widget (xml, "New Tax Table Dialog");
+ ntt->name_entry = glade_xml_get_widget (xml, "name_entry");
+ if (name)
+ gtk_entry_set_text (GTK_ENTRY (ntt->name_entry), name);
+
+ /* Create the menu */
+ combo = glade_xml_get_widget (xml, "type_combobox");
+ index = ntt->type ? ntt->type : GNC_AMT_TYPE_VALUE;
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combo), index - 1);
+ g_signal_connect (combo, "changed", G_CALLBACK (combo_changed), ntt);
+
+ /* Attach our own widgets */
+ box = glade_xml_get_widget (xml, "amount_box");
+ ntt->amount_entry = widget = gnc_amount_edit_new ();
+ gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (widget), TRUE);
+ gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (widget), 100000);
+ gtk_box_pack_start (GTK_BOX (box), widget, TRUE, TRUE, 0);
+
+ box = glade_xml_get_widget (xml, "acct_window");
+ ntt->acct_tree = GTK_WIDGET(gnc_tree_view_account_new (FALSE));
+ gtk_container_add (GTK_CONTAINER (box), ntt->acct_tree);
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(ntt->acct_tree), FALSE);
+
+ /* Make 'enter' do the right thing */
+ gtk_entry_set_activates_default(GTK_ENTRY (gnc_amount_edit_gtk_entry
+ (GNC_AMOUNT_EDIT (ntt->amount_entry))),
+ TRUE);
+
+ /* Fix mnemonics for generated target widgets */
+ widget = glade_xml_get_widget (xml, "value_label");
+ gtk_label_set_mnemonic_widget (GTK_LABEL (widget), ntt->amount_entry);
+ widget = glade_xml_get_widget (xml, "account_label");
+ gtk_label_set_mnemonic_widget (GTK_LABEL (widget), ntt->acct_tree);
+
+ /* Fill in the widgets appropriately */
+ if (entry)
+ {
+ gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (ntt->amount_entry),
+ gncTaxTableEntryGetAmount (entry));
+ gnc_tree_view_account_set_selected_account (GNC_TREE_VIEW_ACCOUNT (ntt->acct_tree),
+ gncTaxTableEntryGetAccount (entry));
+ }
+
+ /* Set our parent */
+ gtk_window_set_transient_for (GTK_WINDOW(ntt->dialog), GTK_WINDOW(ttw->dialog));
+
+ /* Setup signals */
+ glade_xml_signal_autoconnect_full( xml,
+ gnc_glade_autoconnect_full_func,
+ ntt);
+
+ /* Show what we should */
+ gtk_widget_show_all (ntt->dialog);
+ if (new_table == FALSE)
+ {
+ gtk_widget_hide (glade_xml_get_widget (xml, "table_title"));
+ gtk_widget_hide (glade_xml_get_widget (xml, "table_name"));
+ gtk_widget_hide (glade_xml_get_widget (xml, "spacer"));
+ gtk_widget_hide (ntt->name_entry);
+ /* Tables are great for layout, but a pain when you hide widgets */
+ widget = glade_xml_get_widget (xml, "ttd_table");
+ gtk_table_set_row_spacing (GTK_TABLE(widget), 0, 0);
+ gtk_table_set_row_spacing (GTK_TABLE(widget), 1, 0);
+ gtk_table_set_row_spacing (GTK_TABLE(widget), 2, 0);
+ gtk_widget_grab_focus (gnc_amount_edit_gtk_entry
+ (GNC_AMOUNT_EDIT (ntt->amount_entry)));
+ }
+ else
+ gtk_widget_grab_focus (ntt->name_entry);
+
+ /* Display the dialog now that we're done manipulating it */
+ gtk_widget_show (ntt->dialog);
+
+ done = FALSE;
+ while (!done)
+ {
+ response = gtk_dialog_run (GTK_DIALOG (ntt->dialog));
+ switch (response)
+ {
+ case GTK_RESPONSE_OK:
+ if (new_tax_table_ok_cb (ntt))
+ {
+ created_table = ntt->created_table;
+ done = TRUE;
+ }
+ break;
+ default:
+ done = TRUE;
+ break;
+ }
+ }
+
+ gtk_widget_destroy(ntt->dialog);
+ g_free(ntt);
+
+ return created_table;
+}
+
+/***********************************************************************/
+
+static void
+tax_table_entries_refresh (TaxTableWindow *ttw)
+{
+ GList *list, *node;
+ GtkTreeView *view;
+ GtkListStore *store;
+ GtkTreeIter iter;
+ GtkTreePath *path;
+ GtkTreeSelection *selection;
+ GtkTreeRowReference *reference = NULL;
+ GncTaxTableEntry *selected_entry;
+
+ g_return_if_fail (ttw);
+
+ view = GTK_TREE_VIEW (ttw->entries_view);
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
+
+ /* Clear the list */
+ selected_entry = ttw->current_entry;
+ gtk_list_store_clear (store);
+ if (ttw->current_table == NULL)
+ return;
+
+ /* Add the items to the list */
+ list = gncTaxTableGetEntries (ttw->current_table);
+ if (list)
+ list = g_list_reverse (g_list_copy (list));
+
+ for (node = list ; node; node = node->next)
+ {
+ char *row_text[3];
+ GncTaxTableEntry *entry = node->data;
+ Account *acc = gncTaxTableEntryGetAccount (entry);
+ gnc_numeric amount = gncTaxTableEntryGetAmount (entry);
+
+ row_text[0] = gnc_account_get_full_name (acc);
+ switch (gncTaxTableEntryGetType (entry))
+ {
+ case GNC_AMT_TYPE_PERCENT:
+ row_text[1] =
+ g_strdup_printf ("%s%%",
+ xaccPrintAmount (amount,
+ gnc_default_print_info (FALSE)));
+ break;
+ default:
+ row_text[1] =
+ g_strdup_printf ("%s",
+ xaccPrintAmount (amount,
+ gnc_default_print_info (TRUE)));
+ break;
+ }
+
+ gtk_list_store_prepend(store, &iter);
+ gtk_list_store_set(store, &iter,
+ TAX_ENTRY_COL_NAME, row_text[0],
+ TAX_ENTRY_COL_POINTER, entry,
+ TAX_ENTRY_COL_AMOUNT, row_text[1],
+ -1);
+ if (entry == selected_entry)
+ {
+ path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
+ reference = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), path);
+ gtk_tree_path_free(path);
+ }
+
+ g_free (row_text[0]);
+ g_free (row_text[1]);
+ }
+
+ if (reference)
+ {
+ path = gtk_tree_row_reference_get_path(reference);
+ gtk_tree_row_reference_free(reference);
+ if (path)
+ {
+ selection = gtk_tree_view_get_selection(view);
+ gtk_tree_selection_select_path(selection, path);
+ gtk_tree_view_scroll_to_cell(view, path, NULL, TRUE, 0.5, 0.0);
+ gtk_tree_path_free(path);
+ }
+ }
+}
+
+static void
+tax_table_window_refresh (TaxTableWindow *ttw)
+{
+ GList *list, *node;
+ GtkTreeView *view;
+ GtkListStore *store;
+ GtkTreeIter iter;
+ GtkTreePath *path;
+ GtkTreeSelection *selection;
+ GtkTreeRowReference *reference = NULL;
+
+ g_return_if_fail (ttw);
+ view = GTK_TREE_VIEW (ttw->names_view);
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
+
+ /* Clear the list */
+ gtk_list_store_clear(store);
+
+ gnc_gui_component_clear_watches (ttw->component_id);
+
+ /* Add the items to the list */
+ list = gncTaxTableGetTables (ttw->book);
+ if (list)
+ list = g_list_reverse (g_list_copy (list));
+
+ for (node = list; node; node = node->next)
+ {
+ GncTaxTable *table = node->data;
+
+ gnc_gui_component_watch_entity (ttw->component_id,
+ gncTaxTableGetGUID (table),
+ QOF_EVENT_MODIFY);
+
+ gtk_list_store_prepend(store, &iter);
+ gtk_list_store_set(store, &iter,
+ TAX_TABLE_COL_NAME, gncTaxTableGetName (table),
+ TAX_TABLE_COL_POINTER, table,
+ -1);
+ if (table == ttw->current_table)
+ {
+ path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
+ reference = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), path);
+ gtk_tree_path_free(path);
+ }
+ }
+
+ if (list)
+ g_list_free (list);
+
+ gnc_gui_component_watch_entity_type (ttw->component_id,
+ GNC_TAXTABLE_MODULE_NAME,
+ QOF_EVENT_CREATE | QOF_EVENT_DESTROY);
+
+ if (reference)
+ {
+ path = gtk_tree_row_reference_get_path(reference);
+ gtk_tree_row_reference_free(reference);
+ if (path)
+ {
+ selection = gtk_tree_view_get_selection(view);
+ gtk_tree_selection_select_path(selection, path);
+ gtk_tree_view_scroll_to_cell(view, path, NULL, TRUE, 0.5, 0.0);
+ gtk_tree_path_free(path);
+ }
+ }
+ ;;
+ tax_table_entries_refresh (ttw);
+ /* select_row() above will refresh the entries window */
+}
+
+static void
+tax_table_selection_changed (GtkTreeSelection *selection,
+ gpointer user_data)
+{
+ TaxTableWindow *ttw = user_data;
+ GncTaxTable *table;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ g_return_if_fail (ttw);
+
+ if (!gtk_tree_selection_get_selected(selection, &model, &iter))
+ return;
+
+ gtk_tree_model_get(model, &iter, TAX_TABLE_COL_POINTER, &table, -1);
+ g_return_if_fail (table);
+
+ /* If we've changed, then reset the entry list */
+ if (table != ttw->current_table)
+ {
+ ttw->current_table = table;
+ ttw->current_entry = NULL;
+ }
+ /* And force a refresh of the entries */
+ tax_table_entries_refresh (ttw);
+}
+
+static void
+tax_table_entry_selection_changed (GtkTreeSelection *selection,
+ gpointer user_data)
+{
+ TaxTableWindow *ttw = user_data;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ g_return_if_fail (ttw);
+
+ if (!gtk_tree_selection_get_selected(selection, &model, &iter))
+ {
+ ttw->current_entry = NULL;
+ return;
+ }
+
+ gtk_tree_model_get(model, &iter, TAX_ENTRY_COL_POINTER, &ttw->current_entry, -1);
+}
+
+static void
+tax_table_entry_row_activated (GtkTreeView *tree_view,
+ GtkTreePath *path,
+ GtkTreeViewColumn *column,
+ gpointer user_data)
+{
+ TaxTableWindow *ttw = user_data;
+
+ new_tax_table_dialog (ttw, FALSE, ttw->current_entry, NULL);
+}
+
+void
+tax_table_new_table_cb (GtkButton *button, TaxTableWindow *ttw)
+{
+ g_return_if_fail (ttw);
+ new_tax_table_dialog (ttw, TRUE, NULL, NULL);
+}
+
+void
+tax_table_delete_table_cb (GtkButton *button, TaxTableWindow *ttw)
+{
+ g_return_if_fail (ttw);
+
+ if (!ttw->current_table)
+ return;
+
+ if (gncTaxTableGetRefcount (ttw->current_table) > 0)
+ {
+ char *message =
+ g_strdup_printf (_("Tax table \"%s\" is in use. You cannot delete it."),
+ gncTaxTableGetName (ttw->current_table));
+ gnc_error_dialog (ttw->dialog, "%s", message);
+ g_free (message);
+ return;
+ }
+
+ if (gnc_verify_dialog (ttw->dialog, FALSE,
+ _("Are you sure you want to delete \"%s\"?"),
+ gncTaxTableGetName (ttw->current_table)))
+ {
+ /* Ok, let's remove it */
+ gnc_suspend_gui_refresh ();
+ gncTaxTableBeginEdit (ttw->current_table);
+ gncTaxTableDestroy (ttw->current_table);
+ ttw->current_table = NULL;
+ ttw->current_entry = NULL;
+ gnc_resume_gui_refresh ();
+ }
+}
+
+void
+tax_table_new_entry_cb (GtkButton *button, TaxTableWindow *ttw)
+{
+ g_return_if_fail (ttw);
+ if (!ttw->current_table)
+ return;
+ new_tax_table_dialog (ttw, FALSE, NULL, NULL);
+}
+
+void
+tax_table_edit_entry_cb (GtkButton *button, TaxTableWindow *ttw)
+{
+ g_return_if_fail (ttw);
+ if (!ttw->current_entry)
+ return;
+ new_tax_table_dialog (ttw, FALSE, ttw->current_entry, NULL);
+}
+
+void
+tax_table_delete_entry_cb (GtkButton *button, TaxTableWindow *ttw)
+{
+ g_return_if_fail (ttw);
+ if (!ttw->current_table || !ttw->current_entry)
+ return;
+
+ if (g_list_length (gncTaxTableGetEntries (ttw->current_table)) <= 1)
+ {
+ char *message = _("You cannot remove the last entry from the tax table. "
+ "Try deleting the tax table if you want to do that.");
+ gnc_error_dialog (ttw->dialog, "%s", message);
+ return;
+ }
+
+ if (gnc_verify_dialog (ttw->dialog, FALSE, "%s",
+ _("Are you sure you want to delete this entry?")))
+ {
+ /* Ok, let's remove it */
+ gnc_suspend_gui_refresh ();
+ gncTaxTableBeginEdit (ttw->current_table);
+ gncTaxTableRemoveEntry (ttw->current_table, ttw->current_entry);
+ gncTaxTableEntryDestroy (ttw->current_entry);
+ gncTaxTableChanged (ttw->current_table);
+ gncTaxTableCommitEdit (ttw->current_table);
+ ttw->current_entry = NULL;
+ gnc_resume_gui_refresh ();
+ }
+}
+
+static void
+tax_table_window_refresh_handler (GHashTable *changes, gpointer data)
+{
+ TaxTableWindow *ttw = data;
+
+ g_return_if_fail (data);
+ tax_table_window_refresh (ttw);
+}
+
+static void
+tax_table_window_close_handler (gpointer data)
+{
+ TaxTableWindow *ttw = data;
+ g_return_if_fail (ttw);
+
+ gtk_widget_destroy (ttw->dialog);
+}
+
+void
+tax_table_window_close (GtkWidget *widget, gpointer data)
+{
+ TaxTableWindow *ttw = data;
+
+ gnc_save_window_size (GCONF_SECTION, GTK_WINDOW (ttw->dialog));
+ gnc_ui_tax_table_window_destroy (ttw);
+}
+
+void
+tax_table_window_destroy_cb (GtkWidget *widget, gpointer data)
+{
+ TaxTableWindow *ttw = data;
+
+ if (!ttw) return;
+
+ gnc_unregister_gui_component (ttw->component_id);
+
+ g_free (ttw);
+}
+
+static gboolean
+find_handler (gpointer find_data, gpointer user_data)
+{
+ TaxTableWindow *ttw = user_data;
+ QofBook *book = find_data;
+
+ return (ttw != NULL && ttw->book == book);
+}
+
+/* Create a tax-table window */
+TaxTableWindow *
+gnc_ui_tax_table_window_new (QofBook *book)
+{
+ TaxTableWindow *ttw;
+ GladeXML *xml;
+ GtkTreeView *view;
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *renderer;
+ GtkListStore *store;
+ GtkTreeSelection *selection;
+
+ if (!book) return NULL;
+
+ /*
+ * Find an existing tax-table window. If found, bring it to
+ * the front. If we have an actual owner, then set it in
+ * the window.
+ */
+ ttw = gnc_find_first_gui_component (DIALOG_TAX_TABLE_CM_CLASS, find_handler,
+ book);
+ if (ttw)
+ {
+ gtk_window_present (GTK_WINDOW(ttw->dialog));
+ return ttw;
+ }
+
+ /* Didn't find one -- create a new window */
+ ttw = g_new0 (TaxTableWindow, 1);
+ ttw->book = book;
+
+ /* Open and read the XML */
+ xml = gnc_glade_xml_new ("tax-tables.glade", "Tax Table Window");
+ ttw->dialog = glade_xml_get_widget (xml, "Tax Table Window");
+ ttw->names_view = glade_xml_get_widget (xml, "tax_tables_view");
+ ttw->entries_view = glade_xml_get_widget (xml, "tax_table_entries");
+
+ /* Create the tax tables view */
+ view = GTK_TREE_VIEW(ttw->names_view);
+ store = gtk_list_store_new (NUM_TAX_TABLE_COLS, G_TYPE_STRING,
+ G_TYPE_POINTER);
+ gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
+ g_object_unref(store);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes("", renderer,
+ "text", TAX_TABLE_COL_NAME,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+
+ selection = gtk_tree_view_get_selection(view);
+ g_signal_connect(selection, "changed",
+ G_CALLBACK(tax_table_selection_changed), ttw);
+
+
+ /* Create the tax table entries view */
+ view = GTK_TREE_VIEW(ttw->entries_view);
+ store = gtk_list_store_new (NUM_TAX_ENTRY_COLS, G_TYPE_STRING,
+ G_TYPE_POINTER, G_TYPE_STRING);
+ gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
+ g_object_unref(store);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes("", renderer,
+ "text", TAX_ENTRY_COL_NAME,
+ NULL);
+ gtk_tree_view_append_column(view, column);
+
+ selection = gtk_tree_view_get_selection(view);
+ g_signal_connect(selection, "changed",
+ G_CALLBACK(tax_table_entry_selection_changed), ttw);
+ g_signal_connect(view, "row-activated",
+ G_CALLBACK(tax_table_entry_row_activated), ttw);
+
+
+ /* Setup signals */
+ glade_xml_signal_autoconnect_full( xml,
+ gnc_glade_autoconnect_full_func,
+ ttw);
+
+ /* register with component manager */
+ ttw->component_id =
+ gnc_register_gui_component (DIALOG_TAX_TABLE_CM_CLASS,
+ tax_table_window_refresh_handler,
+ tax_table_window_close_handler,
+ ttw);
+
+ tax_table_window_refresh (ttw);
+ gnc_restore_window_size (GCONF_SECTION, GTK_WINDOW (ttw->dialog));
+ gtk_widget_show_all (ttw->dialog);
+ return ttw;
+}
+
+/* Destroy a tax-table window */
+void
+gnc_ui_tax_table_window_destroy (TaxTableWindow *ttw)
+{
+ if (!ttw)
+ return;
+
+ gnc_close_gui_component (ttw->component_id);
+}
+
+/* Create a new tax-table by name */
+GncTaxTable *
+gnc_ui_tax_table_new_from_name (QofBook *book, const char *name)
+{
+ TaxTableWindow *ttw;
+
+ if (!book) return NULL;
+
+ ttw = gnc_ui_tax_table_window_new (book);
+ if (!ttw) return NULL;
+
+ return new_tax_table_dialog (ttw, TRUE, NULL, name);
+}
Copied: gnucash/trunk/src/gnome-utils/dialog-tax-table.h (from rev 21605, gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.h)
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-tax-table.h (rev 0)
+++ gnucash/trunk/src/gnome-utils/dialog-tax-table.h 2011-11-21 10:40:31 UTC (rev 21606)
@@ -0,0 +1,40 @@
+/*
+ * dialog-tax-table.h -- Dialog to create and edit tax-tables
+ * Copyright (C) 2002 Derek Atkins
+ * Author: Derek Atkins <warlord at MIT.EDU>
+ *
+ * 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
+ * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
+ * Boston, MA 02110-1301, USA gnu at gnu.org
+ */
+
+#ifndef _DIALOG_TAX_TABLE_H
+#define _DIALOG_TAX_TABLE_H
+
+typedef struct _taxtable_window TaxTableWindow;
+
+#include "gncTaxTable.h"
+
+/* Create a new tax-table by name */
+GncTaxTable * gnc_ui_tax_table_new_from_name (QofBook *book, const char *name);
+
+/* Create a tax-table window */
+TaxTableWindow * gnc_ui_tax_table_window_new (QofBook *book);
+
+/* Destroy a tax-table window */
+void gnc_ui_tax_table_window_destroy (TaxTableWindow *ttw);
+
+#endif /* _DIALOG_TAX-TABLE_H */
Modified: gnucash/trunk/src/gnome-utils/glade/Makefile.am
===================================================================
--- gnucash/trunk/src/gnome-utils/glade/Makefile.am 2011-11-21 10:40:17 UTC (rev 21605)
+++ gnucash/trunk/src/gnome-utils/glade/Makefile.am 2011-11-21 10:40:31 UTC (rev 21606)
@@ -1,5 +1,6 @@
gladedir = $(GNC_GLADE_DIR)
glade_DATA = \
+ tax-tables.glade \
druid-provider-multifile.glade \
druid-gnc-xml-import.glade
Copied: gnucash/trunk/src/gnome-utils/glade/tax-tables.glade (from rev 21605, gnucash/trunk/src/business/dialog-tax-table/tax-tables.glade)
===================================================================
--- gnucash/trunk/src/gnome-utils/glade/tax-tables.glade (rev 0)
+++ gnucash/trunk/src/gnome-utils/glade/tax-tables.glade 2011-11-21 10:40:31 UTC (rev 21606)
@@ -0,0 +1,522 @@
+<?xml version="1.0"?>
+<glade-interface>
+ <!-- interface-requires gtk+ 2.10 -->
+ <!-- interface-naming-policy toplevel-contextual -->
+ <widget class="GtkDialog" id="Tax Table Window">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Tax Tables</property>
+ <property name="type_hint">normal</property>
+ <signal name="destroy" handler="tax_table_window_destroy_cb"/>
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">8</property>
+ <child>
+ <widget class="GtkHBox" id="hbox4">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="border_width">6</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Tax Tables</b></property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkAlignment" id="alignment5">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <widget class="GtkTreeView" id="tax_tables_view">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <property name="rules_hint">True</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkAlignment" id="alignment6">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <widget class="GtkHButtonBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <property name="layout_style">spread</property>
+ <child>
+ <widget class="GtkButton" id="delete_table_button">
+ <property name="label">gtk-delete</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="tax_table_delete_table_cb"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="new_table_button">
+ <property name="label">gtk-new</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="tax_table_new_table_cb"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <property name="border_width">6</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Tax Table Entries</b></property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkAlignment" id="alignment7">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <widget class="GtkTreeView" id="tax_table_entries">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <property name="rules_hint">True</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkAlignment" id="alignment8">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <widget class="GtkHButtonBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <property name="layout_style">spread</property>
+ <child>
+ <widget class="GtkButton" id="edit_entry_button">
+ <property name="label" translatable="yes">_Edit</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="tax_table_edit_entry_cb"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="delete_entry_button">
+ <property name="label">gtk-delete</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="tax_table_delete_entry_cb"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="new_entry_button">
+ <property name="label">gtk-new</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="tax_table_new_entry_cb"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <widget class="GtkButton" id="close_button">
+ <property name="label">gtk-close</property>
+ <property name="response_id">-6</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="tax_table_window_close"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <widget class="GtkDialog" id="New Tax Table Dialog">
+ <property name="border_width">6</property>
+ <property name="modal">True</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox2">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">8</property>
+ <child>
+ <widget class="GtkTable" id="ttd_table">
+ <property name="visible">True</property>
+ <property name="n_rows">7</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <widget class="GtkEntry" id="name_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="activates_default">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="spacer">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </widget>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label11">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Tax Table Entry</b></property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="table_title">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Tax Table</b></property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkAlignment" id="alignment4">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <widget class="GtkLabel" id="account_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">_Account:</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkAlignment" id="alignment3">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <widget class="GtkLabel" id="value_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Value: </property>
+ <property name="use_underline">True</property>
+ <property name="justify">right</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <widget class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Type: </property>
+ <property name="use_underline">True</property>
+ <property name="justify">right</property>
+ <property name="mnemonic_widget">type_combobox</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkScrolledWindow" id="acct_window">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="amount_box">
+ <property name="visible">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <widget class="GtkLabel" id="table_name">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Name: </property>
+ <property name="use_underline">True</property>
+ <property name="justify">right</property>
+ <property name="mnemonic_widget">name_entry</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkComboBox" id="type_combobox">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Value $
+Percent %</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area2">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <widget class="GtkButton" id="cancel_button">
+ <property name="label">gtk-cancel</property>
+ <property name="response_id">-6</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="ok_button">
+ <property name="label">gtk-ok</property>
+ <property name="response_id">-5</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+</glade-interface>
Modified: gnucash/trunk/src/gnome-utils/gnome-utils.i
===================================================================
--- gnucash/trunk/src/gnome-utils/gnome-utils.i 2011-11-21 10:40:17 UTC (rev 21605)
+++ gnucash/trunk/src/gnome-utils/gnome-utils.i 2011-11-21 10:40:31 UTC (rev 21606)
@@ -18,6 +18,7 @@
#include <gnc-plugin-file-history.h>
#include <gnc-ui.h>
#include <gnc-splash.h>
+#include <dialog-tax-table.h>
SCM scm_init_sw_gnome_utils_module (void);
%}
@@ -52,3 +53,5 @@
void gnc_window_show_progress (const char *message, double percentage);
gboolean gnucash_ui_is_running(void);
+
+TaxTableWindow * gnc_ui_tax_table_window_new (QofBook *book);
More information about the gnucash-changes
mailing list