patches from jeremy collins

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@636 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 1998-03-12 04:22:06 +00:00
parent da8a309104
commit dd7cd65a2c
2 changed files with 82 additions and 75 deletions

View File

@ -1,7 +1,6 @@
/********************************************************************\
* MainWindow.c -- the main window, and associated helper functions *
* and callback functions for xacc (X-Accountant) *
* Copyright (C) 1997 Robin D. Clark *
* Copyright (C) 1998 Jeremy Collins *
* *
* This program is free software; you can redistribute it and/or *
@ -25,15 +24,15 @@
\********************************************************************/
#include "MainWindow.h"
#include "messages.h"
//#include "main_window.h"
#include "main.h"
gchar *clist_titles[] =
{
" Account Name ",
" Type ",
" Balance "
ACC_NAME_STR,
ACC_TYPE_STR,
BALN_STR
};
struct main_window {
@ -62,6 +61,10 @@ void main_window_init()
clist = gtk_clist_new_with_titles(3, clist_titles);
/* Fix the column widths */
gtk_clist_set_column_width ( GTK_CLIST(clist), 1, 85 );
gtk_clist_set_column_width ( GTK_CLIST(clist), 0, 85 );
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "GnoMoney");
@ -77,21 +80,21 @@ void main_window_init()
/* create a bunch of buttons */
button_bar = gtk_hbox_new(FALSE, 1);
toolBar[0] = gtk_button_new_with_label (" Open ");
toolBar[1] = gtk_button_new_with_label (" New ");
toolBar[2] = gtk_button_new_with_label (" Edit ");
toolBar[3] = gtk_button_new_with_label (" Delete ");
toolBar[0] = gtk_button_new_with_label ( OPEN_STR );
toolBar[1] = gtk_button_new_with_label ( NEW_STR );
toolBar[2] = gtk_button_new_with_label ( EDIT_STR );
toolBar[3] = gtk_button_new_with_label ( DELETE_STR );
toolBar[4] = gtk_button_new_with_label (" Exit ");
/* Initilize ToolTips */
tooltip = gtk_tooltips_new ();
gtk_tooltips_set_tip (tooltip, toolBar[open], "Open an account.", NULL);
gtk_tooltips_set_tip (tooltip, toolBar[close], "Create a new account.", NULL);
gtk_tooltips_set_tip (tooltip, toolBar[button3], "Edit selected account", NULL);
gtk_tooltips_set_tip (tooltip, toolBar[button4], "Delete selected account", NULL);
gtk_tooltips_set_tip (tooltip, toolBar[exit], "Exit GnoMoney.", NULL);
gtk_tooltips_set_tip (tooltip, toolBar[open], TOOLTIP_OPEN, NULL);
gtk_tooltips_set_tip (tooltip, toolBar[close], TOOLTIP_NEW , NULL);
gtk_tooltips_set_tip (tooltip, toolBar[button3], TOOLTIP_EDIT, NULL);
gtk_tooltips_set_tip (tooltip, toolBar[button4], TOOLTIP_DELETE, NULL);
gtk_tooltips_set_tip (tooltip, toolBar[exit], TOOLTIP_EDIT, NULL);
/* Pack the buttons into the toolbar */
@ -132,6 +135,8 @@ void main_window_init()
gtk_container_border_width (GTK_CONTAINER (window), 2);
gtk_widget_show(window);
}

View File

@ -74,8 +74,12 @@ void file_ok_sel (GtkWidget *w, GtkFileSelection *fs)
{
/* load the accounts data from datafile*/
topgroup = xaccReadAccountGroup (datafile);
/* Close the filebox */
gtk_widget_destroy(filebox);
/* Create main window */
main_window_init();
}
if( NULL == topgroup )
@ -117,8 +121,6 @@ main( int argc, char *argv[] )
DEBUG("Done initializing memory");
#endif
gtk_init (&argc, &argv);
filebox = gtk_file_selection_new ("File selection");
@ -126,7 +128,12 @@ main( int argc, char *argv[] )
/* read in the filename (should be the first arg after all
* the X11 stuff */
if( argc > 1 )
{
datafile = argv[1];
/* Create main window */
main_window_init();
}
else
{
gtk_file_selection_set_filename (GTK_FILE_SELECTION(filebox), "*");
@ -149,11 +156,6 @@ main( int argc, char *argv[] )
"clicked", (GtkSignalFunc) gtk_widget_destroy,
GTK_OBJECT (filebox));
/* Make main window */
main_window_init();
/* Enter event loop */
gtk_main();