mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
patches from rob browning
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@844 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
a558d202a9
commit
06d565d2f7
@ -114,7 +114,7 @@ main_window_init(AccountGroup *accts)
|
||||
{
|
||||
{"<Main>/File/New", "<control>N", NULL, NULL},
|
||||
{"<Main>/File/Open", "<control>O", file_cmd_open, NULL},
|
||||
{"<Main>/File/Save", "<control>S", NULL, NULL},
|
||||
{"<Main>/File/Save", "<control>S", file_cmd_save, NULL},
|
||||
{"<Main>/File/Save as", NULL, NULL, NULL},
|
||||
{"<Main>/File/<separator>", NULL, NULL, NULL},
|
||||
{"<Main>/File/Quit", "<control>Q", file_cmd_quit, NULL },
|
||||
|
@ -28,12 +28,12 @@
|
||||
srcdir = .
|
||||
|
||||
CC = gcc
|
||||
INCLPATH = -I.. -I../.. -I../engine -I../register -I./../../include
|
||||
INCLPATH = -I.. -I../.. -I../engine -I../register -I./../../include
|
||||
|
||||
CFLAGS = -O2 -Wall -g -Wall -I/usr/X11R6/include ${INCLPATH}
|
||||
LDFLAGS = -g -Wall
|
||||
LIBS = -lpng -ljpeg -lz -lm -lSM -lICE -lXpm -L/usr/X11R6/lib $(shell gtk-config --libs) \
|
||||
-lgnomeui -lgnome -lgnomesupport
|
||||
-lgnomeui -lgnome -lgnomesupport -lgdk_imlib -ltiff -ldl
|
||||
|
||||
TARGET = ../../xacc.gtk.bin
|
||||
STATIC = ../../xacc-static.gtk.bin
|
||||
@ -42,7 +42,7 @@ OTHER_OBJS := ../obj/gnome/*.o ../engine/obj/*.o ../register/obj/gnome/*.o
|
||||
|
||||
######################################################################
|
||||
# See Makefile.common for information about these variables.
|
||||
GNOME_SRCS := main.c MainWindow.c MenuBar.c RegWindow.c
|
||||
GNOME_SRCS := main.c MainWindow.c MenuBar.c RegWindow.c Dialogs.c
|
||||
# AccWindow.c AccountMenu.c AdjBWindow.c \
|
||||
# BuildMenu.c Destroy.c FileBox.c HelpWindow.c \
|
||||
# RecnWindow.c RegWindow.c Reports.c TextBox.c \
|
||||
|
@ -28,7 +28,7 @@ srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
CC = @CC@
|
||||
INCLPATH = -I.. -I../.. -I../engine -I../register -I@srcdir@/../../include -I/usr/lib/gnome-libs/include
|
||||
INCLPATH = -I.. -I../.. -I../engine -I../register -I@srcdir@/../../include
|
||||
|
||||
CFLAGS = @CFLAGS@ @X_CFLAGS@ ${INCLPATH}
|
||||
LDFLAGS = @LDFLAGS@
|
||||
|
@ -470,6 +470,7 @@ regWindowLedger(Account *lead_acc, Account **acclist, int ledger_type)
|
||||
|
||||
regData->dialog = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
|
||||
gtk_window_set_title(GTK_WINDOW(regData->dialog), windowname);
|
||||
|
||||
/* when the window is given the "delete_event" signal (this is given
|
||||
@ -486,6 +487,9 @@ regWindowLedger(Account *lead_acc, Account **acclist, int ledger_type)
|
||||
gtk_signal_connect (GTK_OBJECT (regData->dialog), "destroy",
|
||||
GTK_SIGNAL_FUNC (destroy), (gpointer) regData);
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
/* Create a PanedWindow Manager for the dialog box... the paned
|
||||
* window is the parent of the two forms which comprise the two
|
||||
* areas of the dialog box */
|
||||
@ -495,7 +499,6 @@ regWindowLedger(Account *lead_acc, Account **acclist, int ledger_type)
|
||||
* group. Put is another way: it is REALLY annoying to have to
|
||||
* put the mouse in the cell being edited. */
|
||||
|
||||
#if 0
|
||||
pane = XtVaCreateWidget( "pane",
|
||||
xmPanedWindowWidgetClass, regData->dialog,
|
||||
XmNsashWidth, 1,
|
||||
@ -1051,8 +1054,8 @@ cancelCB( GtkWidget * mw, XtPointer cd, XtPointer cb )
|
||||
Local Variables:
|
||||
tab-width: 2
|
||||
indent-tabs-mode: nil
|
||||
mode: c-mode
|
||||
mode: c
|
||||
c-indentation-style: gnu
|
||||
eval: (c-set-offset 'block-open '-)
|
||||
eval: (c-set-offset 'substatement-open 0)
|
||||
End:
|
||||
*/
|
||||
|
114
src/gnome/main.c
114
src/gnome/main.c
@ -61,8 +61,8 @@ gchar *accRes[] ={
|
||||
"equity"
|
||||
};
|
||||
|
||||
|
||||
void file_ok_sel (GtkWidget *w, GtkFileSelection *fs)
|
||||
void
|
||||
file_ok_sel (GtkWidget *w, GtkFileSelection *fs)
|
||||
{
|
||||
datafile = gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs));
|
||||
|
||||
@ -82,16 +82,30 @@ void file_ok_sel (GtkWidget *w, GtkFileSelection *fs)
|
||||
main_window_init(topgroup);
|
||||
}
|
||||
|
||||
void gnucash_shutdown (GtkWidget *widget, gpointer *data)
|
||||
void
|
||||
gnucash_shutdown (GtkWidget *widget, gpointer *data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
void file_cmd_open (GtkWidget *widget, gpointer data)
|
||||
void
|
||||
file_cmd_open (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
g_print ( "Menu Command: file open\n" );
|
||||
}
|
||||
|
||||
void
|
||||
file_cmd_save(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
/* hack alert -- Somehow make sure all in-progress edits get committed! */
|
||||
if (NULL == datafile) {
|
||||
fprintf(stderr, "Can't save file. No open file\n");
|
||||
return;
|
||||
}
|
||||
xaccWriteAccountGroup(datafile, topgroup);
|
||||
xaccAccountGroupMarkSaved(topgroup);
|
||||
}
|
||||
|
||||
void file_cmd_quit (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gtk_main_quit();
|
||||
@ -113,6 +127,14 @@ int
|
||||
main( int argc, char *argv[] )
|
||||
{
|
||||
// gtk_init ( &argc, &argv );
|
||||
|
||||
if(argc > 1) {
|
||||
/* Gnome is a pain about this if we don't handle it first
|
||||
We need real arg parsing here later */
|
||||
datafile = argv[1];
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
|
||||
gnome_init ("GnuCash", NULL, argc, argv,
|
||||
0, NULL);
|
||||
@ -130,55 +152,6 @@ main( int argc, char *argv[] )
|
||||
}
|
||||
|
||||
filebox = gtk_file_selection_new ( "Open..." );
|
||||
|
||||
/* read in the filename (should be the first arg after all
|
||||
* the X11 stuff */
|
||||
if( argc > 1 )
|
||||
{
|
||||
datafile = argv[1];
|
||||
|
||||
if( datafile != NULL )
|
||||
{
|
||||
|
||||
/* load the accounts data from datafile*/
|
||||
topgroup = xaccReadAccountGroup (datafile);
|
||||
|
||||
if ( topgroup == NULL )
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *button;
|
||||
GtkWidget *label;
|
||||
|
||||
dialog = gtk_dialog_new ();
|
||||
|
||||
button = gtk_button_new_with_label ( "Ok" );
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), button,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show ( button );
|
||||
|
||||
label = gtk_label_new (" \nInvalid filename \nNew file started.\n ");
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, TRUE,
|
||||
TRUE, 0);
|
||||
gtk_widget_show ( label );
|
||||
gtk_widget_show ( dialog );
|
||||
|
||||
topgroup = xaccMallocAccountGroup();
|
||||
}
|
||||
}
|
||||
/* Create main window */
|
||||
main_window_init(topgroup);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Filebox code here */
|
||||
gtk_widget_show ( filebox );
|
||||
}
|
||||
|
||||
/* Check to see if this is a valid datafile */
|
||||
if ( datafile != NULL )
|
||||
topgroup = xaccReadAccountGroup (datafile);
|
||||
|
||||
|
||||
/* Callbacks for File Box and Stuff */
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (filebox), "delete_event",
|
||||
@ -192,8 +165,41 @@ main( int argc, char *argv[] )
|
||||
/* Connect the cancel_button to also kill the app */
|
||||
gtk_signal_connect_object ( GTK_OBJECT (GTK_FILE_SELECTION (filebox)->cancel_button),
|
||||
"clicked", (GtkSignalFunc) gtk_exit, NULL );
|
||||
|
||||
|
||||
/* read in the filename (should be the first arg after all
|
||||
* the X11 stuff */
|
||||
if( datafile != NULL ) {
|
||||
|
||||
/* load the accounts data from datafile*/
|
||||
topgroup = xaccReadAccountGroup (datafile);
|
||||
|
||||
if ( topgroup == NULL )
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *button;
|
||||
GtkWidget *label;
|
||||
|
||||
dialog = gtk_dialog_new ();
|
||||
|
||||
button = gtk_button_new_with_label ( "Ok" );
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), button,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show ( button );
|
||||
|
||||
label = gtk_label_new (" \nInvalid filename \nNew file started.\n ");
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, TRUE,
|
||||
TRUE, 0);
|
||||
gtk_widget_show ( label );
|
||||
gtk_widget_show ( dialog );
|
||||
|
||||
topgroup = xaccMallocAccountGroup();
|
||||
}
|
||||
/* Create main window */
|
||||
main_window_init(topgroup);
|
||||
} else {
|
||||
/* Filebox code here */
|
||||
gtk_widget_show ( filebox );
|
||||
}
|
||||
|
||||
/* Enter event loop */
|
||||
gtk_main();
|
||||
|
@ -53,8 +53,10 @@
|
||||
void gnucash_shutdown (GtkWidget *widget, gpointer *data);
|
||||
void file_cmd_open (GtkWidget *widget, gpointer data);
|
||||
void file_cmd_quit (GtkWidget *widget, gpointer data);
|
||||
void file_cmd_save (GtkWidget *widget, gpointer data);
|
||||
void prepare_app ( void );
|
||||
|
||||
|
||||
/** GLOBALS *********************************************************/
|
||||
extern char *helpPath;
|
||||
extern GtkWidget *app;
|
||||
|
Loading…
Reference in New Issue
Block a user