[Gnucash-changes] r13660 - gnucash/trunk - Add a "book saved" hook. Use this to update the window titles after a

David Hampton hampton at cvs.gnucash.org
Fri Mar 17 17:59:28 EST 2006


Author: hampton
Date: 2006-03-17 17:59:28 -0500 (Fri, 17 Mar 2006)
New Revision: 13660
Trac: http://svn.gnucash.org/trac/changeset/13660

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/engine/gnc-hooks.c
   gnucash/trunk/src/engine/gnc-hooks.h
   gnucash/trunk/src/gnome-utils/gnc-file.c
   gnucash/trunk/src/gnome-utils/gnc-main-window.c
Log:
Add a "book saved" hook.  Use this to update the window titles after a
file is saved.  Fixes 334789.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-03-17 21:04:31 UTC (rev 13659)
+++ gnucash/trunk/ChangeLog	2006-03-17 22:59:28 UTC (rev 13660)
@@ -1,3 +1,10 @@
+2006-03-17  David Hampton  <hampton at 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 at gmx.net>
 
 	* src/engine/Split.c: Fix return value of get_corr_account_split

Modified: gnucash/trunk/src/engine/gnc-hooks.c
===================================================================
--- gnucash/trunk/src/engine/gnc-hooks.c	2006-03-17 21:04:31 UTC (rev 13659)
+++ gnucash/trunk/src/engine/gnc-hooks.c	2006-03-17 22:59:28 UTC (rev 13660)
@@ -323,6 +323,8 @@
 		  "Run after book open.  Hook args: <gnc:Session*>.");
   gnc_hook_create(HOOK_BOOK_CLOSED, 1,
 		  "Run before file close.  Hook args: <gnc:Session*>");
+  gnc_hook_create(HOOK_BOOK_SAVED, 1,
+		  "Run after file saved.  Hook args: <gnc:Session*>");
 
   LEAVE("");
 }

Modified: gnucash/trunk/src/engine/gnc-hooks.h
===================================================================
--- gnucash/trunk/src/engine/gnc-hooks.h	2006-03-17 21:04:31 UTC (rev 13659)
+++ gnucash/trunk/src/engine/gnc-hooks.h	2006-03-17 22:59:28 UTC (rev 13660)
@@ -70,5 +70,6 @@
 /* Common session hook names */
 #define HOOK_BOOK_OPENED	"hook_book_opened"
 #define HOOK_BOOK_CLOSED	"hook_book_closed"
+#define HOOK_BOOK_SAVED		"hook_book_saved"
 
 #endif /* GNC_HOOKS_H */

Modified: gnucash/trunk/src/gnome-utils/gnc-file.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-file.c	2006-03-17 21:04:31 UTC (rev 13659)
+++ gnucash/trunk/src/gnome-utils/gnc-file.c	2006-03-17 22:59:28 UTC (rev 13660)
@@ -965,6 +965,7 @@
   }
 
   gnc_add_history (session);
+  gnc_hook_run(HOOK_BOOK_SAVED, session);
   LEAVE (" ");
 }
 
@@ -1095,6 +1096,7 @@
   save_in_progress--;
 
   g_free (newfile);
+  gnc_hook_run(HOOK_BOOK_SAVED, new_session);
   LEAVE (" ");
 }
 

Modified: gnucash/trunk/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-main-window.c	2006-03-17 21:04:31 UTC (rev 13659)
+++ gnucash/trunk/src/gnome-utils/gnc-main-window.c	2006-03-17 22:59:28 UTC (rev 13660)
@@ -1166,7 +1166,15 @@
   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
  *  GtkRadioAction, and us used to pass data among several
  *  functions. */
@@ -1669,6 +1677,8 @@
 	gnc_gconf_general_register_cb (KEY_SHOW_CLOSE_BUTTON,
 				       gnc_main_window_update_tabs,
 				       NULL);
+	gnc_hook_add_dangler(HOOK_BOOK_SAVED,
+			     (GFunc)gnc_main_window_update_all_titles, NULL);
 }
 
 



More information about the gnucash-changes mailing list