From ecf90d2ec6c11fd0899a4c8d2ac0009d3d7e4d80 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Fri, 24 Apr 1998 03:54:20 +0000 Subject: [PATCH] patches from Jeremy Collins git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@838 57a11ea4-9604-0410-9ed3-97b8803252fd --- Makefile.in | 2 +- src/gnome/Dialogs.c | 162 +++++++++++++++++++++++++++++++++++++++++ src/gnome/Dialogs.h | 30 ++++++++ src/gnome/MainWindow.c | 110 +++++++++++++++++++++------- src/gnome/MainWindow.h | 4 + src/gnome/version.h | 5 ++ 6 files changed, 285 insertions(+), 28 deletions(-) create mode 100644 src/gnome/Dialogs.c create mode 100644 src/gnome/Dialogs.h create mode 100644 src/gnome/version.h diff --git a/Makefile.in b/Makefile.in index b72c26a159..4966de79ad 100644 --- a/Makefile.in +++ b/Makefile.in @@ -73,7 +73,7 @@ clean: @cd src; $(MAKE) clean distclean: clean - rm -f *~ *.o *.bak Makefile xacc + rm -f *~ *.o *.bak Makefile xacc xacc.gtk.bin rm -f config.cache config.log config.status config.h @cd lib; $(MAKE) distclean @cd src; $(MAKE) distclean diff --git a/src/gnome/Dialogs.c b/src/gnome/Dialogs.c new file mode 100644 index 0000000000..5d07950a81 --- /dev/null +++ b/src/gnome/Dialogs.c @@ -0,0 +1,162 @@ +// Dialogs.c + +#include +#include "Dialogs.h" + +gpointer *add_account_dialog_init ( ) +{ + return ( g_malloc ( sizeof ( add_account_dialog ) ) ); +} + +GtkWidget *create_add_account_dialog () +{ + //GnomeDialog *dialog; + GnomeDialog *add_account_dialog; + GtkWidget *main_vbox; + GtkWidget *box2; + GtkWidget *box3; + GtkWidget *box4; + GtkWidget *frame; + + GSList *group; + +// GList *parent_accounts; + + GtkWidget *label; + GtkWidget *textbox_name; + GtkWidget *textbox_description; + GtkWidget *button; + + + gchar *title = "Setup Account"; + + add_account_dialog = GNOME_DIALOG( + gnome_dialog_new ( title, "Ok", "Cancel", NULL)); + + gtk_window_set_title ( GTK_WINDOW ( add_account_dialog ), title ); + + gtk_window_position ( GTK_WINDOW ( add_account_dialog ), + GTK_WIN_POS_CENTER ); + + main_vbox = gtk_vbox_new ( FALSE, 2 ); + gtk_container_add ( GTK_CONTAINER ( add_account_dialog->vbox ), main_vbox ); + + frame = gtk_frame_new ( "Account Type" ); + gtk_container_border_width (GTK_CONTAINER (frame), 10); + gtk_box_pack_start ( GTK_BOX( main_vbox ), frame, FALSE, FALSE, 0 ); + gtk_widget_show ( frame ); + + box2 = gtk_hbox_new ( FALSE, 2 ); + gtk_container_add ( GTK_CONTAINER( frame ), box2 ); + gtk_widget_show ( box2 ); + + box3 = gtk_vbox_new ( FALSE, 2 ); + gtk_box_pack_start ( GTK_BOX( box2 ), box3, FALSE, FALSE, 0 ); + gtk_widget_show ( box3 ); + + box4 = gtk_vbox_new ( FALSE, 2 ); + gtk_box_pack_start ( GTK_BOX( box2 ), box4, FALSE, FALSE, 0 ); + gtk_widget_show ( box4 ); + + /* Create radio button group for Account Type */ + + button = gtk_radio_button_new_with_label (NULL, "Bank"); + gtk_box_pack_start (GTK_BOX (box3), button, TRUE, TRUE, 0 ); + gtk_widget_show (button); + + group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); + button = gtk_radio_button_new_with_label(group, "Cash"); + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE); + gtk_box_pack_start (GTK_BOX (box3), button, TRUE, TRUE, 0 ); + gtk_widget_show (button); + + group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); + button = gtk_radio_button_new_with_label(group, "Asset"); + gtk_box_pack_start (GTK_BOX (box3), button, TRUE, TRUE, 0 ); + gtk_widget_show (button); + + group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); + button = gtk_radio_button_new_with_label(group, "Credit Card"); + gtk_box_pack_start (GTK_BOX (box3), button, TRUE, TRUE, 0 ); + gtk_widget_show (button); + + group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); + button = gtk_radio_button_new_with_label(group, "Liability"); + gtk_box_pack_start (GTK_BOX (box3), button, TRUE, TRUE, 0 ); + gtk_widget_show (button); + + group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); + button = gtk_radio_button_new_with_label(group, "Stock"); + gtk_box_pack_start (GTK_BOX (box4), button, TRUE, TRUE, 0 ); + gtk_widget_show (button); + + group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); + button = gtk_radio_button_new_with_label(group, "Mutual Fund"); + gtk_box_pack_start (GTK_BOX (box4), button, TRUE, TRUE, 0 ); + gtk_widget_show (button); + + group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); + button = gtk_radio_button_new_with_label(group, "Income"); + gtk_box_pack_start (GTK_BOX (box4), button, TRUE, TRUE, 0 ); + gtk_widget_show (button); + + group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); + button = gtk_radio_button_new_with_label(group, "Expense"); + gtk_box_pack_start (GTK_BOX (box4), button, TRUE, TRUE, 0 ); + gtk_widget_show (button); + + group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); + button = gtk_radio_button_new_with_label(group, "Equity"); + gtk_box_pack_start (GTK_BOX (box4), button, TRUE, TRUE, 0 ); + gtk_widget_show (button); + + box2 = gtk_hbox_new ( FALSE, 2 ); + gtk_box_pack_start ( GTK_BOX( main_vbox ), box2, FALSE, FALSE, 0 ); + gtk_widget_show ( box2 ); + + textbox_name = gtk_entry_new_with_max_length ( 25 ); + gtk_box_pack_end ( GTK_BOX(box2), textbox_name, FALSE, FALSE, 10 ); + gtk_widget_show ( textbox_name ); + + { + label = gtk_label_new ( "Account Name: " ); + gtk_box_pack_end ( GTK_BOX(box2), label, FALSE, FALSE, 0 ); + gtk_widget_show ( label ); + } + + box2 = gtk_hbox_new ( FALSE, 2 ); + gtk_box_pack_start ( GTK_BOX( main_vbox ), box2, FALSE, FALSE, 0 ); + gtk_widget_show ( box2 ); + + textbox_description = gtk_entry_new_with_max_length ( 25 ); + gtk_box_pack_end ( GTK_BOX(box2), textbox_description, FALSE, FALSE, 10 ); + gtk_widget_show ( textbox_description ); + + { + label = gtk_label_new ( "Account Description: " ); + gtk_box_pack_end ( GTK_BOX(box2), label, FALSE, FALSE, 0 ); + gtk_widget_show ( label ); + } + + box2 = gtk_hbox_new ( FALSE, 2 ); + gtk_box_pack_start ( GTK_BOX( main_vbox ), box2, FALSE, FALSE, 0 ); + gtk_widget_show ( box2 ); + + { + label = gtk_label_new ( "Parent Account: " ); + gtk_box_pack_end ( GTK_BOX(box2), label, FALSE, FALSE, 0 ); + gtk_widget_show ( label ); + } + + + + box2 = gtk_hbox_new ( FALSE, 2 ); + gtk_box_pack_start ( GTK_BOX ( main_vbox ), box2, FALSE, FALSE, 0 ); + gtk_widget_show ( box2 ); + + gtk_widget_show ( main_vbox ); + gtk_widget_show ( add_account_dialog ); + + return add_account_dialog; + +} diff --git a/src/gnome/Dialogs.h b/src/gnome/Dialogs.h new file mode 100644 index 0000000000..17442ad977 --- /dev/null +++ b/src/gnome/Dialogs.h @@ -0,0 +1,30 @@ +// Dialogs.h + +struct _add_account_dialog +{ + GtkWidget *add_account_dialog; + GtkWidget *main_vbox; + GtkWidget *box2; + GtkWidget *box3; + GtkWidget *box4; + GtkWidget *frame; + + GSList *group; + + GList *parent_accounts; + + GtkWidget *label; + GtkWidget *textbox_name; + GtkWidget *textbox_description; + GtkWidget *button; + GtkWidget *okButton; + GtkWidget *cancelButton; + GtkWidget *separator; +}; + +typedef struct _add_account_dialog add_account_dialog; + +GtkWidget *create_add_account_dialog ( void ); +gpointer *add_account_dialog_init ( void ); + + diff --git a/src/gnome/MainWindow.c b/src/gnome/MainWindow.c index bdc993b736..0a4bdb1095 100644 --- a/src/gnome/MainWindow.c +++ b/src/gnome/MainWindow.c @@ -22,7 +22,9 @@ #include "MainWindow.h" #include "MenuBar.h" +#include "Dialogs.h" #include "messages.h" +#include "version.h" #include "RegWindow.h" #include "main.h" @@ -84,30 +86,6 @@ cram_accts_into_tree(GtkTree *maintree, AccountGroup *accts) { NULL); } -/* Function: add_account - * Arguments: AccountGroup *accts <- AccountGroup to add account to. - * Description: Opens a dialog box and excepts input for adding - * a new account. - * - * Stuff: A lot of work still needs to be done on the layout - * of this dialog. Also, a structure needs to be - * defined that will hold all info from the dialog that - * will be passed to the callback function of the "OK" - * button. - * - * Also the box2, box3, box4 should be renamed to be - * more descriptive of what their for. I even get - * confused and I wrote it! hehe =) - * - * TODO: A little routine to make a glist out of all of the parent - * accounts. This will be used for the combo box selection. - */ -static void -add_account ( AccountGroup *accts ) -{ - g_print ( "Add Account Button clicked\n" ); -} - void main_window_init(AccountGroup *accts) { @@ -140,8 +118,8 @@ main_window_init(AccountGroup *accts) {"
/File/Save as", NULL, NULL, NULL}, {"
/File/", NULL, NULL, NULL}, {"
/File/Quit", "Q", file_cmd_quit, NULL }, - {"
/Options/General..", "A", NULL, NULL}, - {"
/Help/Help", NULL, NULL, NULL}, + {"
/Options/Preferences..", "A", options_cb, NULL}, + {"
/Help/Help", NULL, help_cb, NULL}, {"
/Help/", NULL, NULL, NULL}, {"
/Help/About..", NULL, about_cb, NULL} }; @@ -328,7 +306,7 @@ about_cb (GtkWidget *widget, void *data) NULL }; - about = gnome_about_new ( "GnuCash", "1.1.9", + about = gnome_about_new ( "GnuCash", VERSION, "(C) 1998 The GnuCash Project", authors, "GnuCash: The GNU way to manage your money!", @@ -337,6 +315,84 @@ about_cb (GtkWidget *widget, void *data) } +/* Help system callback */ +void +help_cb ( GtkWidget *widget, void *data ) +{ + /* We need some config menus to setup were the docs are located */ + /* for now I just set it to be $HOME/xacc-docs/ */ + + gchar *docs_path = "xacc-docs/xacc-main.html"; + + docs_path = gnome_util_prepend_user_home( docs_path ); + + gnome_help_goto( NULL, docs_path ); + + g_free( docs_path ); + +} + +/* Some dialog stubs to be worked on */ +/* We might want to move these to there own file =\ */ + +void +file_new_cb ( GtkWidget *widget, void *data ) +{ + +} + +/* Options dialog... this should house all of the config options */ +/* like where the docs reside, and whatever else is deemed necessary */ +void +options_cb ( GtkWidget *widget, void *data ) +{ + GnomePropertyBox *box; + GtkWidget *w, *label, *box2; + + box = GNOME_PROPERTY_BOX(gnome_property_box_new()); + w = gtk_button_new_with_label("Click me (Page #1)"); + + box2 = gtk_vbox_new ( FALSE, 1 ); + gtk_box_pack_start(GTK_BOX(box2), w, FALSE, FALSE, 0); + + gtk_widget_show ( box2 ); + + gtk_widget_show(w); + label = gtk_label_new("Config Box 1"); + gtk_widget_show(label); + + gnome_property_box_append_page(box, box2, label); + w = gtk_button_new_with_label("Click me (Page #2)"); + gtk_widget_show(w); + + label = gtk_label_new("Config Box 2"); + gtk_widget_show(label); + + gnome_property_box_append_page(box, w, label); + + gtk_widget_set_usize ( box, 500, 400 ); + gtk_widget_set_usize ( box2, 225, 225 ); + + gtk_widget_show(GTK_WIDGET(box)); +} + +void +add_account ( AccountGroup *acct ) +{ + GtkWidget *add_dialog; + + add_dialog = create_add_account_dialog(); + + /* Callbacks */ + +// gtk_signal_connect (GTK_OBJECT (add_dialog->Ok), "clicked", +// GTK_SIGNAL_FUNC (add_account_finish), accts); + + g_print ("New Account\n"); +} + + + /********************* END OF FILE **********************************/ /* diff --git a/src/gnome/MainWindow.h b/src/gnome/MainWindow.h index 6f1dd85b3e..91519f92cb 100644 --- a/src/gnome/MainWindow.h +++ b/src/gnome/MainWindow.h @@ -37,6 +37,10 @@ void refreshMainWindow( void ); void main_window_init(AccountGroup *); void xaccMainWindowAddAccount ( GtkWidget * ); void about_cb (GtkWidget *widget, void *data); +void help_cb (GtkWidget *, void *); +void file_new_cb (GtkWidget *, void *); +void options_cb (GtkWidget *, void *); +void add_account ( AccountGroup * ); /** GLOBALS *********************************************************/ enum { diff --git a/src/gnome/version.h b/src/gnome/version.h new file mode 100644 index 0000000000..421e47f98f --- /dev/null +++ b/src/gnome/version.h @@ -0,0 +1,5 @@ +// Contains the version of GnuCash + +#include + +gchar *VERSION = "1.1.10";