start work on druid for setting up accounting periods.

Also some other misc cleanup


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8853 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 2003-07-12 19:47:34 +00:00
parent f6768d4705
commit a4a47577aa
8 changed files with 236 additions and 1 deletions

View File

@ -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 \

View File

@ -0,0 +1,141 @@
/********************************************************************\
* druid-acct-period.c -- accouting period druid for GnuCash *
* Copyright (C) 2001 Gnumatic, Inc. *
* Copyright (C) 2001 Dave Peticolas <dave@krondo.com> *
* Copyright (C) 2003 Linas Vepstas <linas@linas.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 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/
#include "config.h"
#include <gnome.h>
#include <libgnomeui/gnome-window-icon.h>
#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));
}

View File

@ -0,0 +1,35 @@
/********************************************************************\
* druid-acct-period.h -- accounting period druid for GnuCash *
* Copyright (C) 2003 Linas Vepstas <linas@linas.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 *
* 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

View File

@ -1,7 +1,7 @@
/********************************************************************\
* druid-stock-split.c -- stock split druid for GnuCash *
* Copyright (C) 2001 Gnumatic, Inc. *
* Author: Dave Peticolas <dave@krondo.com> *
* Copyright (c) 2001 Dave Peticolas <dave@krondo.com> *
* *
* 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"

View File

@ -0,0 +1,39 @@
/********************************************************************\
* druid-stock-split.h -- stock split druid for GnuCash *
* Copyright (C) 2001 Gnumatic, Inc. *
* Copyright (C) 2001 Dave Peticolas <dave@krondo.com> *
* Copyright (C) 2003 Linas Vepstas <linas@linas.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 *
* 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

View File

@ -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"

View File

@ -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[] =

View File

@ -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"