mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
2001-06-17 Dave Peticolas <dave@krondo.com>
* src/FileDialog.c (gncFileSave): save the window state on a save (gncFileQuerySave): don't provide cancel option when the ui can't * src/scm/main-window.scm (gnc:main-window-save-state): new func don't save state when the ui can't * src/gnome/window-main.c (gnc_main_window_can_cancel_exit): new func (gnc_main_window_can_save): new func (gnc_main_window_has_apps): new func * src/gnc-ui.h: add new api * src/gnome/top-level.c (gnc_ui_can_cancel_exit): new func git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4711 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
e516792199
commit
8f858dced6
17
ChangeLog
17
ChangeLog
@ -1,3 +1,20 @@
|
|||||||
|
2001-06-17 Dave Peticolas <dave@krondo.com>
|
||||||
|
|
||||||
|
* src/FileDialog.c (gncFileSave): save the window state on a save
|
||||||
|
(gncFileQuerySave): don't provide cancel option when the ui can't
|
||||||
|
|
||||||
|
* src/scm/main-window.scm (gnc:main-window-save-state): new func
|
||||||
|
don't save state when the ui can't
|
||||||
|
|
||||||
|
* src/gnome/window-main.c
|
||||||
|
(gnc_main_window_can_cancel_exit): new func
|
||||||
|
(gnc_main_window_can_save): new func
|
||||||
|
(gnc_main_window_has_apps): new func
|
||||||
|
|
||||||
|
* src/gnc-ui.h: add new api
|
||||||
|
|
||||||
|
* src/gnome/top-level.c (gnc_ui_can_cancel_exit): new func
|
||||||
|
|
||||||
2001-06-16 Dave Peticolas <dave@krondo.com>
|
2001-06-16 Dave Peticolas <dave@krondo.com>
|
||||||
|
|
||||||
* src/guile/gnc.gwp: update for api change
|
* src/guile/gnc.gwp: update for api change
|
||||||
|
@ -298,8 +298,15 @@ gncFileQuerySave (void)
|
|||||||
const char *message = _("Changes have been made since the last "
|
const char *message = _("Changes have been made since the last "
|
||||||
"Save. Save the data to file?");
|
"Save. Save the data to file?");
|
||||||
|
|
||||||
result = gnc_verify_cancel_dialog (message, GNC_VERIFY_YES);
|
if (gnc_ui_can_cancel_save ())
|
||||||
|
result = gnc_verify_cancel_dialog (message, GNC_VERIFY_YES);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gboolean do_save = gnc_verify_dialog (message, TRUE);
|
||||||
|
|
||||||
|
result = do_save ? GNC_VERIFY_YES : GNC_VERIFY_NO;
|
||||||
|
}
|
||||||
|
|
||||||
if (result == GNC_VERIFY_CANCEL)
|
if (result == GNC_VERIFY_CANCEL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -543,6 +550,11 @@ gncFileSave (void)
|
|||||||
gncAddHistory (book);
|
gncAddHistory (book);
|
||||||
|
|
||||||
gnc_book_mark_saved(book);
|
gnc_book_mark_saved(book);
|
||||||
|
|
||||||
|
/* save the main window state */
|
||||||
|
gh_call1(gh_eval_str("gnc:main-window-save-state"),
|
||||||
|
gh_str02scm(gnc_book_get_url(current_book)));
|
||||||
|
|
||||||
LEAVE (" ");
|
LEAVE (" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,6 +112,8 @@ void gnc_ui_shutdown (void);
|
|||||||
void gnc_ui_destroy_all_subwindows (void);
|
void gnc_ui_destroy_all_subwindows (void);
|
||||||
gncUIWidget gnc_ui_get_toplevel(void);
|
gncUIWidget gnc_ui_get_toplevel(void);
|
||||||
|
|
||||||
|
gboolean gnc_ui_can_cancel_save (void);
|
||||||
|
|
||||||
/* Changing the GUI Cursor ******************************************/
|
/* Changing the GUI Cursor ******************************************/
|
||||||
|
|
||||||
void gnc_set_busy_cursor(gncUIWidget w, gboolean update_now);
|
void gnc_set_busy_cursor(gncUIWidget w, gboolean update_now);
|
||||||
|
@ -150,7 +150,13 @@ gnc_ui_get_toplevel(void) {
|
|||||||
/* FIXME */
|
/* FIXME */
|
||||||
return gnc_main_window_get_toplevel(app);
|
return gnc_main_window_get_toplevel(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gnc_ui_can_cancel_save (void)
|
||||||
|
{
|
||||||
|
return gnc_main_window_can_cancel_save (app);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static const char* gnc_scheme_remaining_var = "gnc:*command-line-remaining*";
|
static const char* gnc_scheme_remaining_var = "gnc:*command-line-remaining*";
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ static void gnc_main_window_create_menus(GNCMainInfo * maininfo);
|
|||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_main_window_destroy_cb(GtkObject * w) {
|
gnc_main_window_destroy_cb(GtkObject * w, gpointer data) {
|
||||||
gnc_shutdown (0);
|
gnc_shutdown (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +116,6 @@ gnc_main_window_app_destroyed_cb(GnomeApp * app, gpointer user_data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* gnc_main_window_app_created_cb()
|
* gnc_main_window_app_created_cb()
|
||||||
* called when a new top-level GnomeApp is created.
|
* called when a new top-level GnomeApp is created.
|
||||||
@ -451,6 +450,45 @@ gnc_main_window_child_save_func(GnomeMDIChild * child, gpointer user_data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/********************************************************************
|
||||||
|
* gnc_main_window_can_*()
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gnc_main_window_has_apps (GNCMainInfo * wind)
|
||||||
|
{
|
||||||
|
GList *toplevels;
|
||||||
|
|
||||||
|
toplevels = gtk_container_get_toplevels ();
|
||||||
|
while (toplevels)
|
||||||
|
{
|
||||||
|
if (GNOME_IS_APP (toplevels->data) &&
|
||||||
|
!GTK_OBJECT_DESTROYED (toplevels->data))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
toplevels = toplevels->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gnc_main_window_can_save (GNCMainInfo * wind)
|
||||||
|
{
|
||||||
|
if (!wind) return FALSE;
|
||||||
|
|
||||||
|
return gnc_main_window_has_apps (wind);
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gnc_main_window_can_cancel_save (GNCMainInfo *wind)
|
||||||
|
{
|
||||||
|
if (!wind) return FALSE;
|
||||||
|
|
||||||
|
return gnc_main_window_has_apps (wind);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* gnc_main_window_save()
|
* gnc_main_window_save()
|
||||||
* save the status of the MDI session
|
* save the status of the MDI session
|
||||||
@ -469,6 +507,7 @@ gnc_main_window_save(GNCMainInfo * wind, char * filename) {
|
|||||||
if(filename && *filename != '\0') {
|
if(filename && *filename != '\0') {
|
||||||
gnome_mdi_save_state(GNOME_MDI(wind->mdi), session_name);
|
gnome_mdi_save_state(GNOME_MDI(wind->mdi), session_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free(session_name);
|
g_free(session_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +53,8 @@ typedef struct {
|
|||||||
|
|
||||||
GNCMainInfo * gnc_main_window_new(void);
|
GNCMainInfo * gnc_main_window_new(void);
|
||||||
void gnc_main_window_destroy(GNCMainInfo * wind);
|
void gnc_main_window_destroy(GNCMainInfo * wind);
|
||||||
|
gboolean gnc_main_window_can_save(GNCMainInfo * wind);
|
||||||
|
gboolean gnc_main_window_can_cancel_save (GNCMainInfo *wind);
|
||||||
void gnc_main_window_save(GNCMainInfo * wind, char * session);
|
void gnc_main_window_save(GNCMainInfo * wind, char * session);
|
||||||
void gnc_main_window_restore(GNCMainInfo * wind,
|
void gnc_main_window_restore(GNCMainInfo * wind,
|
||||||
const char * session);
|
const char * session);
|
||||||
|
@ -118,20 +118,20 @@ the account instead of opening a register.") #f))
|
|||||||
;; book close.
|
;; book close.
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(define (gnc:main-window-book-close-handler book-url)
|
(define (gnc:main-window-save-state book-url)
|
||||||
(let* ((conf-file-name (gnc:html-encode-string book-url))
|
(let* ((conf-file-name (gnc:html-encode-string book-url))
|
||||||
(dotgnucash-dir (build-path (getenv "HOME") ".gnucash"))
|
(dotgnucash-dir (build-path (getenv "HOME") ".gnucash"))
|
||||||
(file-dir (build-path dotgnucash-dir "books"))
|
(file-dir (build-path dotgnucash-dir "books"))
|
||||||
(book-path #f))
|
(book-path #f))
|
||||||
|
|
||||||
;; make sure ~/.gnucash is there
|
;; make sure ~/.gnucash is there
|
||||||
(if (not (access? dotgnucash-dir X_OK)) (mkdir dotgnucash-dir #o700))
|
(if (not (access? dotgnucash-dir X_OK)) (mkdir dotgnucash-dir #o700))
|
||||||
|
|
||||||
;; make sure the books directory is there
|
;; make sure the books directory is there
|
||||||
|
|
||||||
(if (not (access? file-dir X_OK)) (mkdir file-dir #o700))
|
(if (not (access? file-dir X_OK)) (mkdir file-dir #o700))
|
||||||
|
|
||||||
(if conf-file-name
|
(if (and conf-file-name (gnc:main-window-can-save? (gnc:get-ui-data)))
|
||||||
(let ((book-path (build-path (getenv "HOME") ".gnucash" "books"
|
(let ((book-path (build-path (getenv "HOME") ".gnucash" "books"
|
||||||
conf-file-name)))
|
conf-file-name)))
|
||||||
(with-output-to-port (open-output-file book-path)
|
(with-output-to-port (open-output-file book-path)
|
||||||
@ -149,7 +149,10 @@ the account instead of opening a register.") #f))
|
|||||||
#t gnc:*acct-tree-options*)
|
#t gnc:*acct-tree-options*)
|
||||||
|
|
||||||
(force-output)))
|
(force-output)))
|
||||||
(gnc:main-window-save (gnc:get-ui-data) book-url)))
|
(gnc:main-window-save (gnc:get-ui-data) book-url)))))
|
||||||
|
|
||||||
|
(define (gnc:main-window-book-close-handler book-url)
|
||||||
|
(gnc:main-window-save-state book-url)
|
||||||
|
|
||||||
(let ((dead-reports '()))
|
(let ((dead-reports '()))
|
||||||
;; get a list of the reports we'll be needing to nuke
|
;; get a list of the reports we'll be needing to nuke
|
||||||
@ -163,8 +166,8 @@ the account instead of opening a register.") #f))
|
|||||||
(for-each
|
(for-each
|
||||||
(lambda (dr)
|
(lambda (dr)
|
||||||
(hash-remove! *gnc:_reports_* dr))
|
(hash-remove! *gnc:_reports_* dr))
|
||||||
dead-reports))))
|
dead-reports)))
|
||||||
|
|
||||||
(define (gnc:main-window-book-open-handler book-url)
|
(define (gnc:main-window-book-open-handler book-url)
|
||||||
(define (try-load file-suffix)
|
(define (try-load file-suffix)
|
||||||
(let ((file (build-path (getenv "HOME") ".gnucash" "books" file-suffix)))
|
(let ((file (build-path (getenv "HOME") ".gnucash" "books" file-suffix)))
|
||||||
|
Loading…
Reference in New Issue
Block a user