diff --git a/src/gnome/Makefile.am b/src/gnome/Makefile.am index f476f13e7a..4615b2adcf 100644 --- a/src/gnome/Makefile.am +++ b/src/gnome/Makefile.am @@ -37,6 +37,7 @@ libgncgnome_la_SOURCES = \ dialog-totd.c \ dialog-userpass.c \ dialog-scheduledxaction.c \ + druid-acct-period.c \ druid-hierarchy.c \ druid-loan.c \ druid-stock-split.c \ @@ -73,8 +74,10 @@ noinst_HEADERS = \ dialog-sxsincelast.h \ dialog-totd.h \ dialog-scheduledxaction.h \ + druid-acct-period.h \ druid-hierarchy.h \ druid-loan.h \ + druid-stock-split.h \ gnc-network.h \ gnc-splash.h \ gnc-split-reg.h \ diff --git a/src/gnome/druid-acct-period.c b/src/gnome/druid-acct-period.c new file mode 100644 index 0000000000..797706f11f --- /dev/null +++ b/src/gnome/druid-acct-period.c @@ -0,0 +1,141 @@ +/********************************************************************\ + * druid-acct-period.c -- accouting period druid for GnuCash * + * Copyright (C) 2001 Gnumatic, Inc. * + * Copyright (C) 2001 Dave Peticolas * + * Copyright (C) 2003 Linas Vepstas * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License as * + * published by the Free Software Foundation; either version 2 of * + * the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License* + * along with this program; if not, contact: * + * * + * Free Software Foundation Voice: +1-617-542-5942 * + * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * + * Boston, MA 02111-1307, USA gnu@gnu.org * +\********************************************************************/ + +#include "config.h" + +#include +#include + +#include "dialog-utils.h" +#include "druid-acct-period.h" +#include "druid-utils.h" +#include "global-options.h" +#include "qofbook.h" +#include "gnc-component-manager.h" +// #include "gnc-ui.h" +// #include "gnc-ui-util.h" +#include "messages.h" + + +#define DRUID_ACCT_PERIOD_CM_CLASS "druid-acct-period" + + +/** structures *********************************************************/ +typedef struct +{ + GtkWidget * window; + GtkWidget * druid; + +} AcctPeriodInfo; + + +/** implementations ****************************************************/ +static void +ap_window_destroy_cb (GtkObject *object, gpointer data) +{ + AcctPeriodInfo *info = data; + + gnc_unregister_gui_component_by_data (DRUID_ACCT_PERIOD_CM_CLASS, info); + + g_free (info); +} + +static void +ap_finish (GnomeDruidPage *druidpage, + gpointer arg1, + gpointer user_data) +{ + // AcctPeriodInfo *info = user_data; + + printf ("finished with acct periods\n"); +} + +static void +ap_druid_cancel (GnomeDruid *druid, gpointer user_data) +{ + AcctPeriodInfo *info = user_data; + + gnc_close_gui_component_by_data (DRUID_ACCT_PERIOD_CM_CLASS, info); +} + +static void +ap_druid_create (AcctPeriodInfo *info) +{ + GtkWidget *page; + GladeXML *xml; + + xml = gnc_glade_xml_new ("acctperiod.glade", "Acct Period Druid"); + + info->window = glade_xml_get_widget (xml, "Acct Period Druid"); + + info->druid = glade_xml_get_widget (xml, "acct_period_druid"); + + gtk_signal_connect (GTK_OBJECT (info->window), "destroy", + GTK_SIGNAL_FUNC (ap_window_destroy_cb), info); + + gtk_signal_connect (GTK_OBJECT (info->druid), "cancel", + GTK_SIGNAL_FUNC (ap_druid_cancel), info); + + + page = glade_xml_get_widget (xml, "doit"); + + gtk_signal_connect (GTK_OBJECT (page), "finish", + GTK_SIGNAL_FUNC (ap_finish), info); +} + + +static void +ap_close_handler (gpointer user_data) +{ + AcctPeriodInfo *info = user_data; + + gtk_widget_destroy (info->window); +} + +/********************************************************************\ + * gnc_acct_period_dialog * + * opens up a druid to configure accounting periods * + * * + * Args: none * + * Return: nothing * +\********************************************************************/ +void +gnc_acct_period_dialog (void) +{ + AcctPeriodInfo *info; + gint component_id; + + info = g_new0 (AcctPeriodInfo, 1); + + ap_druid_create (info); + + component_id = gnc_register_gui_component (DRUID_ACCT_PERIOD_CM_CLASS, + NULL, ap_close_handler, + info); + + gnome_window_icon_set_from_default(GTK_WINDOW(info->window)); + gtk_widget_show_all (info->window); + + gnc_window_adjust_for_screen (GTK_WINDOW(info->window)); +} diff --git a/src/gnome/druid-acct-period.h b/src/gnome/druid-acct-period.h new file mode 100644 index 0000000000..ed2fb53341 --- /dev/null +++ b/src/gnome/druid-acct-period.h @@ -0,0 +1,35 @@ +/********************************************************************\ + * druid-acct-period.h -- accounting period druid for GnuCash * + * Copyright (C) 2003 Linas Vepstas * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License as * + * published by the Free Software Foundation; either version 2 of * + * the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License* + * along with this program; if not, contact: * + * * + * Free Software Foundation Voice: +1-617-542-5942 * + * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * + * Boston, MA 02111-1307, USA gnu@gnu.org * +\********************************************************************/ + +#ifndef GNC_DRUID_ACCT_PERIOD_H +#define GNC_DRUID_ACCT_PERIOD_H + +/********************************************************************\ + * gnc_acct_period_dialog * + * opens up a window to set up accounting period * + * * + * Args: none * + * Return: nothing * +\********************************************************************/ +void gnc_acct_period_dialog (void); + +#endif diff --git a/src/gnome/druid-stock-split.c b/src/gnome/druid-stock-split.c index 3eabe5a838..d3ef40ba11 100644 --- a/src/gnome/druid-stock-split.c +++ b/src/gnome/druid-stock-split.c @@ -1,7 +1,7 @@ /********************************************************************\ * druid-stock-split.c -- stock split druid for GnuCash * * Copyright (C) 2001 Gnumatic, Inc. * - * Author: Dave Peticolas * + * Copyright (c) 2001 Dave Peticolas * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * @@ -29,6 +29,7 @@ #include "Group.h" #include "Transaction.h" #include "dialog-utils.h" +#include "druid-stock-split.h" #include "druid-utils.h" #include "global-options.h" #include "gnc-account-tree.h" diff --git a/src/gnome/druid-stock-split.h b/src/gnome/druid-stock-split.h new file mode 100644 index 0000000000..0ef0a56b23 --- /dev/null +++ b/src/gnome/druid-stock-split.h @@ -0,0 +1,39 @@ +/********************************************************************\ + * druid-stock-split.h -- stock split druid for GnuCash * + * Copyright (C) 2001 Gnumatic, Inc. * + * Copyright (C) 2001 Dave Peticolas * + * Copyright (C) 2003 Linas Vepstas * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License as * + * published by the Free Software Foundation; either version 2 of * + * the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License* + * along with this program; if not, contact: * + * * + * Free Software Foundation Voice: +1-617-542-5942 * + * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * + * Boston, MA 02111-1307, USA gnu@gnu.org * +\********************************************************************/ + +#ifndef GNC_DRUID_STOCK_SPLIT_H +#define GNC_DRUID_STOCK_SPLIT_H + +#include "Account.h" + +/********************************************************************\ + * gnc_stock_split_dialog * + * opens up a window to record a stock split * + * * + * Args: initial - the initial account to use * + * Return: nothing * +\********************************************************************/ +void gnc_stock_split_dialog (Account * initial); + +#endif diff --git a/src/gnome/window-acct-tree.c b/src/gnome/window-acct-tree.c index 2a84ddc010..f1440e071c 100644 --- a/src/gnome/window-acct-tree.c +++ b/src/gnome/window-acct-tree.c @@ -36,6 +36,7 @@ #include "dialog-options.h" #include "dialog-transfer.h" #include "dialog-utils.h" +#include "druid-stock-split.h" #include "global-options.h" #include "gnc-account-tree.h" #include "gnc-book.h" diff --git a/src/gnome/window-main.c b/src/gnome/window-main.c index 8d29a1288b..f502bd4cb2 100644 --- a/src/gnome/window-main.c +++ b/src/gnome/window-main.c @@ -596,6 +596,12 @@ gnc_main_window_fincalc_cb(GtkWidget *widget, gpointer data) gnc_ui_fincalc_dialog_create(); } +static void +gnc_main_window_books_druid_cb(GtkWidget *widget, gpointer data) +{ + printf ("hello world\n"); +} + void gnc_main_window_gl_cb(GtkWidget *widget, gpointer data) { @@ -894,6 +900,14 @@ gnc_main_window_create_menus(GNCMDIInfo * maininfo) { GNOMEUIINFO_SUBTREE( N_("_Scheduled Transactions"), gnc_sched_xaction_tools_submenu_template ), + { + GNOME_APP_UI_ITEM, + N_("Close Books (Experimental/Borken)"), + N_("Configure accounting periods"), + gnc_main_window_books_druid_cb, NULL, NULL, + GNOME_APP_PIXMAP_NONE, NULL, + 0, 0, NULL + }, GNOMEUIINFO_END }; static GnomeUIInfo gnc_tools_menu_template[] = diff --git a/src/gnome/window-register.c b/src/gnome/window-register.c index 70157156ea..3cf4db48fb 100644 --- a/src/gnome/window-register.c +++ b/src/gnome/window-register.c @@ -39,6 +39,7 @@ #include "dialog-find-transactions.h" #include "dialog-transfer.h" #include "dialog-utils.h" +#include "druid-stock-split.h" #include "global-options.h" #include "gnc-component-manager.h" #include "gnc-date-edit.h"