Add a "book saved" hook. Use this to update the window titles after a

file is saved.  Fixes 334789.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13660 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton 2006-03-17 22:59:28 +00:00
parent 199281f415
commit 2cd27a1b6e
5 changed files with 22 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2006-03-17 David Hampton <hampton@employees.org>
* src/gnome-utils/gnc-file.c:
* src/gnome-utils/gnc-main-window.c:
* src/engine/gnc-hooks.[ch]: Add a "book saved" hook. Use this to
update the window titles after a file is saved. Fixes 334789.
2006-03-17 Andreas Köhler <andi5.py@gmx.net> 2006-03-17 Andreas Köhler <andi5.py@gmx.net>
* src/engine/Split.c: Fix return value of get_corr_account_split * src/engine/Split.c: Fix return value of get_corr_account_split

View File

@ -323,6 +323,8 @@ gnc_hooks_init(void)
"Run after book open. Hook args: <gnc:Session*>."); "Run after book open. Hook args: <gnc:Session*>.");
gnc_hook_create(HOOK_BOOK_CLOSED, 1, gnc_hook_create(HOOK_BOOK_CLOSED, 1,
"Run before file close. Hook args: <gnc:Session*>"); "Run before file close. Hook args: <gnc:Session*>");
gnc_hook_create(HOOK_BOOK_SAVED, 1,
"Run after file saved. Hook args: <gnc:Session*>");
LEAVE(""); LEAVE("");
} }

View File

@ -70,5 +70,6 @@ void gnc_hooks_init(void);
/* Common session hook names */ /* Common session hook names */
#define HOOK_BOOK_OPENED "hook_book_opened" #define HOOK_BOOK_OPENED "hook_book_opened"
#define HOOK_BOOK_CLOSED "hook_book_closed" #define HOOK_BOOK_CLOSED "hook_book_closed"
#define HOOK_BOOK_SAVED "hook_book_saved"
#endif /* GNC_HOOKS_H */ #endif /* GNC_HOOKS_H */

View File

@ -965,6 +965,7 @@ gnc_file_save (void)
} }
gnc_add_history (session); gnc_add_history (session);
gnc_hook_run(HOOK_BOOK_SAVED, session);
LEAVE (" "); LEAVE (" ");
} }
@ -1095,6 +1096,7 @@ gnc_file_save_as (void)
save_in_progress--; save_in_progress--;
g_free (newfile); g_free (newfile);
gnc_hook_run(HOOK_BOOK_SAVED, new_session);
LEAVE (" "); LEAVE (" ");
} }

View File

@ -1166,6 +1166,14 @@ gnc_main_window_update_title (GncMainWindow *window)
g_free(title); g_free(title);
} }
static void
gnc_main_window_update_all_titles (void)
{
g_list_foreach(active_windows,
(GFunc)gnc_main_window_update_title,
NULL);
}
/** This data structure is used to describe the requested state of a /** This data structure is used to describe the requested state of a
* GtkRadioAction, and us used to pass data among several * GtkRadioAction, and us used to pass data among several
@ -1669,6 +1677,8 @@ gnc_main_window_class_init (GncMainWindowClass *klass)
gnc_gconf_general_register_cb (KEY_SHOW_CLOSE_BUTTON, gnc_gconf_general_register_cb (KEY_SHOW_CLOSE_BUTTON,
gnc_main_window_update_tabs, gnc_main_window_update_tabs,
NULL); NULL);
gnc_hook_add_dangler(HOOK_BOOK_SAVED,
(GFunc)gnc_main_window_update_all_titles, NULL);
} }