mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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:
parent
da8a309104
commit
dd7cd65a2c
@ -1,7 +1,6 @@
|
|||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* MainWindow.c -- the main window, and associated helper functions *
|
* MainWindow.c -- the main window, and associated helper functions *
|
||||||
* and callback functions for xacc (X-Accountant) *
|
* and callback functions for xacc (X-Accountant) *
|
||||||
* Copyright (C) 1997 Robin D. Clark *
|
|
||||||
* Copyright (C) 1998 Jeremy Collins *
|
* Copyright (C) 1998 Jeremy Collins *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or *
|
* This program is free software; you can redistribute it and/or *
|
||||||
@ -25,15 +24,15 @@
|
|||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
#include "messages.h"
|
||||||
|
|
||||||
//#include "main_window.h"
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
gchar *clist_titles[] =
|
gchar *clist_titles[] =
|
||||||
{
|
{
|
||||||
" Account Name ",
|
ACC_NAME_STR,
|
||||||
" Type ",
|
ACC_TYPE_STR,
|
||||||
" Balance "
|
BALN_STR
|
||||||
};
|
};
|
||||||
|
|
||||||
struct main_window {
|
struct main_window {
|
||||||
@ -43,94 +42,100 @@ struct main_window {
|
|||||||
void main_window_init()
|
void main_window_init()
|
||||||
{
|
{
|
||||||
|
|
||||||
GtkWidget *window;
|
GtkWidget *window;
|
||||||
GtkWidget *toolBar[5];
|
GtkWidget *toolBar[5];
|
||||||
|
|
||||||
GtkTooltips *tooltip;
|
GtkTooltips *tooltip;
|
||||||
|
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
GtkWidget *main_vbox;
|
GtkWidget *main_vbox;
|
||||||
GtkWidget *button_bar;
|
GtkWidget *button_bar;
|
||||||
|
|
||||||
GtkWidget *menubar;
|
GtkWidget *menubar;
|
||||||
|
|
||||||
GtkWidget *clist;
|
GtkWidget *clist;
|
||||||
GtkWidget *list_item;
|
GtkWidget *list_item;
|
||||||
|
|
||||||
|
|
||||||
GtkAcceleratorTable *accel;
|
GtkAcceleratorTable *accel;
|
||||||
|
|
||||||
clist = gtk_clist_new_with_titles(3, clist_titles);
|
clist = gtk_clist_new_with_titles(3, clist_titles);
|
||||||
|
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
/* Fix the column widths */
|
||||||
gtk_window_set_title(GTK_WINDOW(window), "GnoMoney");
|
gtk_clist_set_column_width ( GTK_CLIST(clist), 1, 85 );
|
||||||
|
gtk_clist_set_column_width ( GTK_CLIST(clist), 0, 85 );
|
||||||
|
|
||||||
main_vbox = gtk_vbox_new(FALSE, 1);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_container_border_width(GTK_CONTAINER(main_vbox), 1);
|
gtk_window_set_title(GTK_WINDOW(window), "GnoMoney");
|
||||||
gtk_container_add(GTK_CONTAINER(window), main_vbox);
|
|
||||||
|
|
||||||
get_main_menu(&menubar, &accel);
|
main_vbox = gtk_vbox_new(FALSE, 1);
|
||||||
gtk_window_add_accelerator_table(GTK_WINDOW(window), accel);
|
gtk_container_border_width(GTK_CONTAINER(main_vbox), 1);
|
||||||
gtk_box_pack_start(GTK_BOX(main_vbox), menubar, FALSE, TRUE, 0);
|
gtk_container_add(GTK_CONTAINER(window), main_vbox);
|
||||||
gtk_widget_show(menubar);
|
|
||||||
|
get_main_menu(&menubar, &accel);
|
||||||
|
gtk_window_add_accelerator_table(GTK_WINDOW(window), accel);
|
||||||
|
gtk_box_pack_start(GTK_BOX(main_vbox), menubar, FALSE, TRUE, 0);
|
||||||
|
gtk_widget_show(menubar);
|
||||||
|
|
||||||
/* create a bunch of buttons */
|
/* create a bunch of buttons */
|
||||||
|
|
||||||
button_bar = gtk_hbox_new(FALSE, 1);
|
button_bar = gtk_hbox_new(FALSE, 1);
|
||||||
toolBar[0] = gtk_button_new_with_label (" Open ");
|
toolBar[0] = gtk_button_new_with_label ( OPEN_STR );
|
||||||
toolBar[1] = gtk_button_new_with_label (" New ");
|
toolBar[1] = gtk_button_new_with_label ( NEW_STR );
|
||||||
toolBar[2] = gtk_button_new_with_label (" Edit ");
|
toolBar[2] = gtk_button_new_with_label ( EDIT_STR );
|
||||||
toolBar[3] = gtk_button_new_with_label (" Delete ");
|
toolBar[3] = gtk_button_new_with_label ( DELETE_STR );
|
||||||
toolBar[4] = gtk_button_new_with_label (" Exit ");
|
toolBar[4] = gtk_button_new_with_label (" Exit ");
|
||||||
|
|
||||||
/* Initilize ToolTips */
|
/* Initilize ToolTips */
|
||||||
|
|
||||||
|
|
||||||
tooltip = gtk_tooltips_new ();
|
tooltip = gtk_tooltips_new ();
|
||||||
gtk_tooltips_set_tip (tooltip, toolBar[open], "Open an account.", NULL);
|
gtk_tooltips_set_tip (tooltip, toolBar[open], TOOLTIP_OPEN, NULL);
|
||||||
gtk_tooltips_set_tip (tooltip, toolBar[close], "Create a new account.", NULL);
|
gtk_tooltips_set_tip (tooltip, toolBar[close], TOOLTIP_NEW , NULL);
|
||||||
gtk_tooltips_set_tip (tooltip, toolBar[button3], "Edit selected account", NULL);
|
gtk_tooltips_set_tip (tooltip, toolBar[button3], TOOLTIP_EDIT, NULL);
|
||||||
gtk_tooltips_set_tip (tooltip, toolBar[button4], "Delete selected account", NULL);
|
gtk_tooltips_set_tip (tooltip, toolBar[button4], TOOLTIP_DELETE, NULL);
|
||||||
gtk_tooltips_set_tip (tooltip, toolBar[exit], "Exit GnoMoney.", NULL);
|
gtk_tooltips_set_tip (tooltip, toolBar[exit], TOOLTIP_EDIT, NULL);
|
||||||
|
|
||||||
|
|
||||||
/* Pack the buttons into the toolbar */
|
/* Pack the buttons into the toolbar */
|
||||||
gtk_box_pack_start(GTK_BOX(button_bar), toolBar[0], FALSE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(button_bar), toolBar[0], FALSE, FALSE, 0);
|
||||||
gtk_box_pack_start(GTK_BOX(button_bar), toolBar[1], FALSE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(button_bar), toolBar[1], FALSE, FALSE, 0);
|
||||||
gtk_box_pack_start(GTK_BOX(button_bar), toolBar[2], FALSE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(button_bar), toolBar[2], FALSE, FALSE, 0);
|
||||||
gtk_box_pack_start(GTK_BOX(button_bar), toolBar[3], FALSE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(button_bar), toolBar[3], FALSE, FALSE, 0);
|
||||||
gtk_box_pack_start(GTK_BOX(button_bar), toolBar[4], FALSE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(button_bar), toolBar[4], FALSE, FALSE, 0);
|
||||||
gtk_box_pack_start(GTK_BOX(main_vbox), clist, FALSE, FALSE, 1);
|
gtk_box_pack_start(GTK_BOX(main_vbox), clist, FALSE, FALSE, 1);
|
||||||
gtk_box_pack_start(GTK_BOX(main_vbox), button_bar, FALSE, TRUE, 1);
|
gtk_box_pack_start(GTK_BOX(main_vbox), button_bar, FALSE, TRUE, 1);
|
||||||
|
|
||||||
|
|
||||||
gtk_widget_show(toolBar[open]);
|
gtk_widget_show(toolBar[open]);
|
||||||
gtk_widget_show(toolBar[close]);
|
gtk_widget_show(toolBar[close]);
|
||||||
gtk_widget_show(toolBar[button3]);
|
gtk_widget_show(toolBar[button3]);
|
||||||
gtk_widget_show(toolBar[button4]);
|
gtk_widget_show(toolBar[button4]);
|
||||||
gtk_widget_show(toolBar[exit]);
|
gtk_widget_show(toolBar[exit]);
|
||||||
gtk_widget_show(button_bar);
|
gtk_widget_show(button_bar);
|
||||||
gtk_widget_show(clist);
|
gtk_widget_show(clist);
|
||||||
|
|
||||||
gtk_widget_set_usize (window, 400, 400 );
|
gtk_widget_set_usize (window, 400, 400 );
|
||||||
gtk_widget_set_usize ( clist, 400, 300 );
|
gtk_widget_set_usize ( clist, 400, 300 );
|
||||||
|
|
||||||
/* Setup some callbacks */
|
/* Setup some callbacks */
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT(window), "destroy",
|
gtk_signal_connect (GTK_OBJECT(window), "destroy",
|
||||||
GTK_SIGNAL_FUNC (destroy), NULL);
|
GTK_SIGNAL_FUNC (destroy), NULL);
|
||||||
|
|
||||||
//gtk_signal_connect(GTK_OBJECT(window), "destroy",
|
//gtk_signal_connect(GTK_OBJECT(window), "destroy",
|
||||||
// GTK_SIGNAL_FUNC(file_quit_cmd_callback),
|
// GTK_SIGNAL_FUNC(file_quit_cmd_callback),
|
||||||
// "WM destroy");
|
// "WM destroy");
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||||
GTK_SIGNAL_FUNC (gtk_exit), NULL);
|
GTK_SIGNAL_FUNC (gtk_exit), NULL);
|
||||||
|
|
||||||
/* Show everything now that it is created */
|
/* Show everything now that it is created */
|
||||||
gtk_widget_show(main_vbox);
|
gtk_widget_show(main_vbox);
|
||||||
gtk_container_border_width (GTK_CONTAINER (window), 2);
|
gtk_container_border_width (GTK_CONTAINER (window), 2);
|
||||||
gtk_widget_show(window);
|
gtk_widget_show(window);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,8 +74,12 @@ void file_ok_sel (GtkWidget *w, GtkFileSelection *fs)
|
|||||||
{
|
{
|
||||||
/* load the accounts data from datafile*/
|
/* load the accounts data from datafile*/
|
||||||
topgroup = xaccReadAccountGroup (datafile);
|
topgroup = xaccReadAccountGroup (datafile);
|
||||||
|
|
||||||
/* Close the filebox */
|
/* Close the filebox */
|
||||||
gtk_widget_destroy(filebox);
|
gtk_widget_destroy(filebox);
|
||||||
|
|
||||||
|
/* Create main window */
|
||||||
|
main_window_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL == topgroup )
|
if( NULL == topgroup )
|
||||||
@ -117,8 +121,6 @@ main( int argc, char *argv[] )
|
|||||||
DEBUG("Done initializing memory");
|
DEBUG("Done initializing memory");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
gtk_init (&argc, &argv);
|
gtk_init (&argc, &argv);
|
||||||
|
|
||||||
filebox = gtk_file_selection_new ("File selection");
|
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
|
/* read in the filename (should be the first arg after all
|
||||||
* the X11 stuff */
|
* the X11 stuff */
|
||||||
if( argc > 1 )
|
if( argc > 1 )
|
||||||
|
{
|
||||||
datafile = argv[1];
|
datafile = argv[1];
|
||||||
|
|
||||||
|
/* Create main window */
|
||||||
|
main_window_init();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_file_selection_set_filename (GTK_FILE_SELECTION(filebox), "*");
|
gtk_file_selection_set_filename (GTK_FILE_SELECTION(filebox), "*");
|
||||||
@ -149,11 +156,6 @@ main( int argc, char *argv[] )
|
|||||||
"clicked", (GtkSignalFunc) gtk_widget_destroy,
|
"clicked", (GtkSignalFunc) gtk_widget_destroy,
|
||||||
GTK_OBJECT (filebox));
|
GTK_OBJECT (filebox));
|
||||||
|
|
||||||
/* Make main window */
|
|
||||||
main_window_init();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Enter event loop */
|
/* Enter event loop */
|
||||||
gtk_main();
|
gtk_main();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user