From 0878fd992630b11f82a16a6561541fdb4b2bd387 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Tue, 24 Nov 1998 07:15:06 +0000 Subject: [PATCH] patch from Jeremy (with robs help ???) git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@1415 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/gnome/Add_Dialog.c | 2 +- src/gnome/MainWindow.c | 127 +++++++++++++++++++-------------------- src/gnome/MainWindow.h | 19 ++++-- src/gnome/Makefile.in | 12 ++-- src/gnome/graph/Makefile | 8 --- 5 files changed, 86 insertions(+), 82 deletions(-) diff --git a/src/gnome/Add_Dialog.c b/src/gnome/Add_Dialog.c index a52baa1e88..c25780ac35 100644 --- a/src/gnome/Add_Dialog.c +++ b/src/gnome/Add_Dialog.c @@ -114,7 +114,7 @@ add_account_dialog_okclicked_cb(GtkWidget * dialog, gpointer data) } xaccAccountCommitEdit (account); - refresh_tree(); + gnc_ui_refresh_tree(); gnome_dialog_close ( GNOME_DIALOG(info->dialog) ); diff --git a/src/gnome/MainWindow.c b/src/gnome/MainWindow.c index cdf68a6416..4ef9823eb3 100644 --- a/src/gnome/MainWindow.c +++ b/src/gnome/MainWindow.c @@ -63,6 +63,13 @@ acct_tree_select(GtkWidget *widget, GdkEventButton *event, GtkWidget *child) } +void +refreshMainWindow() +{ + +} + + /********************************************************************\ * refresh_tree * * refreshes the main window * @@ -71,7 +78,7 @@ acct_tree_select(GtkWidget *widget, GdkEventButton *event, GtkWidget *child) * Returns: nothing * \********************************************************************/ void -refresh_tree() +gnc_ui_refresh_tree() { /** This is ugly... how do we do this nicer? */ GList *items; @@ -84,7 +91,7 @@ refresh_tree() mwindow->root_item = mwindow->maintree; - acct_tree_fill(GTK_TREE_ITEM(mwindow->root_item), topgroup, -1); + gnc_ui_acct_tree_fill(GTK_TREE_ITEM(mwindow->root_item), topgroup, -1); } @@ -100,7 +107,7 @@ refresh_tree() * Returns: nothing * \********************************************************************/ void -acct_tree_fill(GtkWidget *item, AccountGroup *accts, int subtree) +gnc_ui_acct_tree_fill(GtkWidget *item, AccountGroup *accts, int subtree) { int accounts_in_group = xaccGroupGetNumAccounts(accts); int current_account; @@ -150,7 +157,7 @@ acct_tree_fill(GtkWidget *item, AccountGroup *accts, int subtree) acc_children = xaccAccountGetChildren(acc); if ( acc_children ) { - acct_tree_fill ( GTK_TREE(tree_item), acc_children, 1 ); + gnc_ui_acct_tree_fill ( GTK_TREE(tree_item), acc_children, 1 ); } gtk_widget_show ( tree_item ); @@ -167,7 +174,7 @@ acct_tree_fill(GtkWidget *item, AccountGroup *accts, int subtree) /* Standard Gnome About Dialog, need I say more? */ /* hack alert -- should display about.html documentation page instead */ static void -about_cb (GtkWidget *widget, gpointer data) +gnc_ui_about_cb (GtkWidget *widget, gpointer data) { GtkWidget *about; gchar *authors[] = { @@ -191,7 +198,7 @@ about_cb (GtkWidget *widget, gpointer data) /* Help system callback */ static void -help_cb ( GtkWidget *widget, gpointer data ) +gnc_ui_help_cb ( GtkWidget *widget, gpointer data ) { /* hack alert -- We need some config menus to setup were the docs are located */ @@ -209,7 +216,7 @@ help_cb ( GtkWidget *widget, gpointer data ) /* We might want to move these to there own file =\ */ static void -file_new_cb ( GtkWidget *widget, gpointer data ) +gnc_ui_file_new_cb ( GtkWidget *widget, gpointer data ) { } @@ -217,7 +224,7 @@ file_new_cb ( GtkWidget *widget, gpointer data ) /* Options dialog... this should house all of the config options */ /* like where the docs reside, and whatever else is deemed necessary */ static void -options_cb ( GtkWidget *widget, gpointer data ) +gnc_ui_options_cb ( GtkWidget *widget, gpointer data ) { GnomePropertyBox *box; GtkWidget *w, *label, *box2; @@ -250,7 +257,7 @@ options_cb ( GtkWidget *widget, gpointer data ) } static void -add_account ( GtkWidget *widget, gpointer data ) +gnc_ui_add_account ( GtkWidget *widget, gpointer data ) { GtkWidget *tree = data; GList *selection; @@ -273,7 +280,7 @@ add_account ( GtkWidget *widget, gpointer data ) } static void -delete_account_finish_cb ( GtkWidget *widget, gpointer data ) +gnc_ui_delete_account_finish_cb ( GtkWidget *widget, gpointer data ) { Account *account = data; @@ -281,12 +288,12 @@ delete_account_finish_cb ( GtkWidget *widget, gpointer data ) xaccRemoveAccount ( account ); xaccFreeAccount ( account ); - refresh_tree (); + gnc_ui_refresh_tree (); } static void -delete_account_cb ( GtkWidget *widget, gpointer data ) +gnc_ui_delete_account_cb ( GtkWidget *widget, gpointer data ) { GtkWidget *tree = data; GList *selection; @@ -304,7 +311,7 @@ delete_account_cb ( GtkWidget *widget, gpointer data ) GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL ); gnome_dialog_button_connect (GNOME_DIALOG (msgbox), 0, - GTK_SIGNAL_FUNC (delete_account_finish_cb), + GTK_SIGNAL_FUNC (gnc_ui_delete_account_finish_cb), acc); gtk_widget_show ( msgbox ); } @@ -319,7 +326,7 @@ delete_account_cb ( GtkWidget *widget, gpointer data ) } static void -gnucash_mainwindow_toolbar_open ( GtkWidget *widget, gpointer data ) +gnc_ui_mainWindow_toolbar_open ( GtkWidget *widget, gpointer data ) { GtkWidget *tree = data; GList *selection; @@ -344,13 +351,13 @@ gnucash_mainwindow_toolbar_open ( GtkWidget *widget, gpointer data ) } void -main_window_init(AccountGroup *accts) +gnc_ui_mainWindow(AccountGroup *accts) { GtkWidget *scrolled_win; GtkWidget *main_vbox; GtkWidget *clist_vbox; - GtkWidget *menubar; + GtkWidget *menubar; GtkWidget *clist; GtkWidget *notebook; int nmenu_items; @@ -373,10 +380,10 @@ main_window_init(AccountGroup *accts) {"
/File/Save as", NULL, NULL, NULL}, {"
/File/", NULL, NULL, NULL}, {"
/File/Quit", "Q", gnucash_shutdown, NULL }, - {"
/Options/Preferences..", "A", options_cb, NULL}, - {"
/Help/Help", NULL, help_cb, NULL}, + {"
/Options/Preferences..", "A", gnc_ui_options_cb, NULL}, + {"
/Help/Help", NULL, gnc_ui_help_cb, NULL}, {"
/Help/", NULL, NULL, NULL}, - {"
/Help/About..", NULL, about_cb, NULL} + {"
/Help/About..", NULL, gnc_ui_about_cb, NULL} }; MenuBar *main_menu_bar; @@ -392,17 +399,17 @@ main_window_init(AccountGroup *accts) { GNOMEUIINFO_ITEM_DATA(N_("Open"), N_("Open selected account."), - gnucash_mainwindow_toolbar_open, + gnc_ui_mainWindow_toolbar_open, mwindow->root_item, GNOME_APP_PIXMAP_NONE), GNOMEUIINFO_ITEM_DATA(N_("New"), N_("Create a new account."), - add_account, mwindow->root_item, GNOME_APP_PIXMAP_NONE), + gnc_ui_add_account, mwindow->root_item, GNOME_APP_PIXMAP_NONE), GNOMEUIINFO_ITEM_DATA(N_("Edit"), N_("Edit account information."), NULL, NULL, GNOME_APP_PIXMAP_NONE), GNOMEUIINFO_ITEM_DATA(N_("Delete"), N_("Delete selected account."), - delete_account_cb, mwindow->root_item, GNOME_APP_PIXMAP_NONE), + gnc_ui_delete_account_cb, mwindow->root_item, GNOME_APP_PIXMAP_NONE), GNOMEUIINFO_ITEM(N_("Exit"), N_("Exit GnuCash."), gnucash_shutdown, GNOME_APP_PIXMAP_NONE), GNOMEUIINFO_END @@ -415,7 +422,7 @@ main_window_init(AccountGroup *accts) } /* Cram accounts into the tree widget */ - acct_tree_fill(GTK_TREE(mwindow->root_item), accts, -1); + gnc_ui_acct_tree_fill(GTK_TREE(mwindow->root_item), accts, -1); /* Create the notebook */ notebook = gtk_notebook_new (); @@ -455,48 +462,6 @@ main_window_init(AccountGroup *accts) menubar = main_menu_bar->widget; /*accel = main_menu_bar->table;*/ -#if 0 - - { - /* Here's how to use the new MenuBar stuff to create multiple menu - bars */ - - GtkWidget *test_win = gtk_window_new (GTK_WINDOW_TOPLEVEL); - GtkWidget *test_vbox = gtk_vbox_new(FALSE, 1); - MenuBarGroup *mbg = menuBarGroupCreate(); - MenuBar *mb1; - MenuBar *mb2; - GtkMenuEntry items[] = - { - {"/Eat/Grubs", "N", NULL, NULL}, - {"/Eat/Gravel", "O", NULL, NULL}, - {"/So/Scary", "S", NULL, NULL}, - {"/Eat-2/Grubs", "N", NULL, NULL}, - {"/Eat-2/Gravel", "O", NULL, NULL}, - {"/So-2/Scary/Err/Umm", "S", NULL, NULL} - }; - int nitems = sizeof(items) / sizeof(items[0]); - - mb1 = menuBarCreate(mbg, ""); - mb2 = menuBarCreate(mbg, ""); - - menuBarGroupAddItems(mbg, items, nitems); - - gtk_window_set_title(GTK_WINDOW(test_win), "Stumpy"); - gtk_container_add(GTK_CONTAINER(test_win), test_vbox); - gtk_box_pack_start(GTK_BOX(test_vbox), menuBarGetWidget(mb1), - FALSE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(test_vbox), menuBarGetWidget(mb2), - FALSE, TRUE, 0); - - gtk_widget_show(menuBarGetWidget(mb1)); - gtk_widget_show(menuBarGetWidget(mb2)); - gtk_widget_show(test_vbox); - gtk_widget_show(test_win); - - } -#endif - //gtk_window_add_accelerator_table(GTK_WINDOW(window), accel); gnome_app_set_menus ( GNOME_APP (app), GTK_MENU_BAR (menubar)); gtk_container_add( GTK_CONTAINER( main_vbox ), notebook ); @@ -532,6 +497,38 @@ main_window_init(AccountGroup *accts) } + + +/* OLD_GNOME_CODE */ + +void +gnucash_shutdown (GtkWidget *widget, gpointer *data) +{ + if ( xaccAccountGroupNotSaved(topgroup) ) + { + GtkWidget *msgbox; + msgbox = gnome_message_box_new ( FMB_SAVE_MSG, + GNOME_MESSAGE_BOX_ERROR, + GNOME_STOCK_BUTTON_OK, + GNOME_STOCK_BUTTON_CANCEL, NULL ); + gnome_dialog_button_connect (GNOME_DIALOG (msgbox), 0, + GTK_SIGNAL_FUNC (file_cmd_save), + NULL); + gnome_dialog_button_connect (GNOME_DIALOG (msgbox), 0, + GTK_SIGNAL_FUNC (file_cmd_quit), + NULL); + gnome_dialog_button_connect (GNOME_DIALOG (msgbox), 1, + GTK_SIGNAL_FUNC (file_cmd_quit), + NULL); + gtk_widget_show ( msgbox ); + } + else + { + gtk_main_quit (); + } + +} + /********************* END OF FILE **********************************/ /* diff --git a/src/gnome/MainWindow.h b/src/gnome/MainWindow.h index bf920639c2..a56758e6b2 100644 --- a/src/gnome/MainWindow.h +++ b/src/gnome/MainWindow.h @@ -31,6 +31,17 @@ #include "Account.h" #include "config.h" +/** HELP STUFF: *****************************************************/ +#define HELP_VAR "XACC_HELP" +#define HH_ABOUT "xacc-about.html" +#define HH_ACC "xacc-accwin.html" +#define HH_REGWIN "xacc-regwin.html" +#define HH_RECNWIN "xacc-recnwin.html" +#define HH_ADJBWIN "xacc-adjbwin.html" +#define HH_MAIN "xacc-main.html" +#define HH_GPL "xacc-gpl.html" + + /** STRUCTURES ******************************************************/ struct _main_window { @@ -41,11 +52,11 @@ struct _main_window typedef struct _main_window main_window; /** PROTOTYPES ******************************************************/ -void refreshMainWindow( void ); -void main_window_init(AccountGroup *); +void gnc_ui_refreshMainWindow( void ); +void gnc_ui_mainWindow(AccountGroup *); void xaccMainWindowAddAccount ( GtkWidget * ); -void refresh_tree ( void ); -void acct_tree_fill ( GtkWidget *, AccountGroup *, int ); +void gnc_ui_refresh_tree ( void ); +void gnc_ui_acct_tree_fill ( GtkWidget *, AccountGroup *, int ); /** GLOBALS *********************************************************/ enum { diff --git a/src/gnome/Makefile.in b/src/gnome/Makefile.in index 92d39ac039..d3c8a16bff 100644 --- a/src/gnome/Makefile.in +++ b/src/gnome/Makefile.in @@ -29,6 +29,7 @@ INCLPATH = -I.. \ -I../engine \ -I../register \ -I../swig \ + -I../guile \ -I@srcdir@/../../include \ -I$(includedir) @@ -38,20 +39,23 @@ LDFLAGS = @LDFLAGS@ GUILELIBS = @GUILELIBS@ LIBS = -L$(prefix)/lib @LIBS@ @X_PRE_LIBS@ @X_LIBS@ \ $(shell @GTK_CONFIG_BIN@ --libs) @X_EXTRA_LIBS@ -lgnomeui \ - -lgnome -lgnomesupport -lgdk_imlib -ltiff \ + $(shell @GNOME_CONFIG_BIN@ --libs gnome gnomeui ) \ $(GUILELIBS) -lintl +GNOMELIBS = @GNOMELIBS@ +GTKLIBS = @GTKLIBS@ TARGET = ../../gnucash.gnome STATIC = ../../gnucash.gnome.static OTHER_OBJS := ../obj/gnome/*.o ../engine/obj/*.o ../register/obj/gnome/*.o \ - ../guile/obj/*.o ../swig/guile/gnucash-all-guile_wrap.o + ../guile/obj/*.o ../swig/guile/gnucash-all-guile_wrap.o \ + ../swig/obj/*.o ###################################################################### # See Makefile.common for information about these variables. -GNOME_SRCS := main.c MainWindow.c MenuBar.c RegWindow.c Add_Dialog.c xtutil.c \ - RecnWindow.c +GNOME_SRCS := top-level.c MainWindow.c MenuBar.c RegWindow.c Add_Dialog.c xtutil.c \ + RecnWindow.c MenuCommands.c FileBox.c ###################################################################### default: $(TARGET) diff --git a/src/gnome/graph/Makefile b/src/gnome/graph/Makefile index 6df649ac6d..e69de29bb2 100644 --- a/src/gnome/graph/Makefile +++ b/src/gnome/graph/Makefile @@ -1,8 +0,0 @@ -### Makefile - -CFLAGS := -Wall -O2 -g -I../../engine -I ../../../ - -GTK_LIBS := -lgtk -lgdk -lglib -LOADLIBES := -lplot -L/usr/X11R6/lib ${GTK_LIBS} -lXaw -lXt -lXext -lX11 -lm - -plot-test: ../../libengine.a plot-test.o