patches from Jeremy Collins

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@838 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 1998-04-24 03:54:20 +00:00
parent eb90a95b9d
commit ecf90d2ec6
6 changed files with 285 additions and 28 deletions

View File

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

162
src/gnome/Dialogs.c Normal file
View File

@ -0,0 +1,162 @@
// Dialogs.c
#include <gnome.h>
#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;
}

30
src/gnome/Dialogs.h Normal file
View File

@ -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 );

View File

@ -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)
{"<Main>/File/Save as", NULL, NULL, NULL},
{"<Main>/File/<separator>", NULL, NULL, NULL},
{"<Main>/File/Quit", "<control>Q", file_cmd_quit, NULL },
{"<Main>/Options/General..", "<control>A", NULL, NULL},
{"<Main>/Help/Help", NULL, NULL, NULL},
{"<Main>/Options/Preferences..", "<control>A", options_cb, NULL},
{"<Main>/Help/Help", NULL, help_cb, NULL},
{"<Main>/Help/<separator>", NULL, NULL, NULL},
{"<Main>/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 **********************************/
/*

View File

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

5
src/gnome/version.h Normal file
View File

@ -0,0 +1,5 @@
// Contains the version of GnuCash
#include <glib.h>
gchar *VERSION = "1.1.10";