Revision: 2740 http://geany.svn.sourceforge.net/geany/?rev=2740&view=rev Author: ntrel Date: 2008-07-01 07:20:16 -0700 (Tue, 01 Jul 2008)
Log Message: ----------- Add function document_close().
Modified Paths: -------------- trunk/ChangeLog trunk/src/callbacks.c trunk/src/document.c trunk/src/document.h trunk/src/treeviews.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-06-30 16:29:12 UTC (rev 2739) +++ trunk/ChangeLog 2008-07-01 14:20:16 UTC (rev 2740) @@ -1,3 +1,9 @@ +2008-07-01 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> + + * src/treeviews.c, src/callbacks.c, src/document.c, src/document.h: + Add function document_close(). + + 2008-06-30 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* waf, wscript:
Modified: trunk/src/callbacks.c =================================================================== --- trunk/src/callbacks.c 2008-06-30 16:29:12 UTC (rev 2739) +++ trunk/src/callbacks.c 2008-07-01 14:20:16 UTC (rev 2740) @@ -2194,13 +2194,11 @@ for (i = 0; i < documents_array->len; i++) { GeanyDocument *doc = documents[i]; - gint page;
if (doc == cur_doc || ! doc->is_valid) continue;
- page = document_get_notebook_page(doc); - if (! document_remove_page(page)) + if (! document_close(doc)) break; } }
Modified: trunk/src/document.c =================================================================== --- trunk/src/document.c 2008-06-30 16:29:12 UTC (rev 2739) +++ trunk/src/document.c 2008-07-01 14:20:16 UTC (rev 2740) @@ -446,6 +446,21 @@
/** + * Close the given document. + * + * @param doc The document to remove. + * + * @return @a TRUE if the document was actually removed or @a FALSE otherwise. + **/ +gboolean document_close(GeanyDocument *doc) +{ + g_return_val_if_fail(doc, FALSE); + + return document_remove_page(document_get_notebook_page(doc)); +} + + +/** * Remove the given notebook tab at @a page_num and clear all related information * in the document list. * @@ -498,14 +513,10 @@ ui_document_buttons_update(); build_menu_update(NULL); } + return TRUE; } - else - { - geany_debug("Error: page_num: %d", page_num); - return FALSE; - } - - return TRUE; + geany_debug("Error: page_num: %d", page_num); + return FALSE; }
Modified: trunk/src/document.h =================================================================== --- trunk/src/document.h 2008-06-30 16:29:12 UTC (rev 2739) +++ trunk/src/document.h 2008-07-01 14:20:16 UTC (rev 2740) @@ -184,6 +184,8 @@
gboolean document_remove_page(guint page_num);
+gboolean document_close(GeanyDocument *doc); + gboolean document_account_for_unsaved(void);
gboolean document_close_all(void);
Modified: trunk/src/treeviews.c =================================================================== --- trunk/src/treeviews.c 2008-06-30 16:29:12 UTC (rev 2739) +++ trunk/src/treeviews.c 2008-07-01 14:20:16 UTC (rev 2740) @@ -543,8 +543,7 @@ { case OPENFILES_ACTION_REMOVE: { - document_remove_page(gtk_notebook_page_num( - GTK_NOTEBOOK(main_widgets.notebook), GTK_WIDGET(doc->sci))); + document_close(doc); break; } case OPENFILES_ACTION_SAVE:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.