Remove documents_array global from plugin API

The global was never accessible to plugins on Windows and hasn't been
accessible to plugins on Linux and others since the linkage-cleanup
changes.

Move documentation from the global variable to the GeanyData member
of the same name.

Closes #964
This commit is contained in:
Matthew Brush 2016-03-14 14:11:56 -07:00
parent 24f91981c0
commit 76ede69ef4
3 changed files with 18 additions and 21 deletions

View File

@ -86,24 +86,6 @@
GeanyFilePrefs file_prefs;
/** Dynamic array of GeanyDocument pointers.
* Once a pointer is added to this, it is never freed. This means the same document pointer
* can represent a different document later on, or it may have been closed and become invalid.
* For this reason, you should use document_find_by_id() instead of storing
* document pointers over time if there is a chance the user can close the
* document.
*
* @warning You must check @c GeanyDocument::is_valid when iterating over this array.
* This is done automatically if you use the foreach_document() macro.
*
* @note
* Never assume that the order of document pointers is the same as the order of notebook tabs.
* One reason is that notebook tabs can be reordered.
* Use @c document_get_from_page() to lookup a document from a notebook tab number.
*
* @see documents. */
GPtrArray *documents_array = NULL;

View File

@ -118,8 +118,6 @@ typedef struct GeanyDocument
}
GeanyDocument;
extern GPtrArray *documents_array;
/** Wraps @ref documents_array so it can be used with C array syntax.
* @warning Always check the returned document is valid (@c doc->is_valid).
*
@ -231,6 +229,7 @@ GeanyDocument *document_find_by_id(guint id);
#endif
extern GeanyFilePrefs file_prefs;
extern GPtrArray *documents_array;
/* These functions will replace the older functions. For now they have a documents_ prefix. */

View File

@ -171,7 +171,23 @@ typedef struct GeanyData
{
struct GeanyApp *app; /**< Geany application data fields */
struct GeanyMainWidgets *main_widgets; /**< Important widgets in the main window */
GPtrArray *documents_array; /**< See document.h#documents_array. @elementtype{GeanyDocument} */
/** Dynamic array of GeanyDocument pointers.
* Once a pointer is added to this, it is never freed. This means the same document pointer
* can represent a different document later on, or it may have been closed and become invalid.
* For this reason, you should use document_find_by_id() instead of storing
* document pointers over time if there is a chance the user can close the
* document.
*
* @warning You must check @c GeanyDocument::is_valid when iterating over this array.
* This is done automatically if you use the foreach_document() macro.
*
* @note
* Never assume that the order of document pointers is the same as the order of notebook tabs.
* One reason is that notebook tabs can be reordered.
* Use @c document_get_from_page() to lookup a document from a notebook tab number.
*
* @see documents. */
GPtrArray *documents_array;
GPtrArray *filetypes_array; /**< Dynamic array of GeanyFiletype pointers. @elementtype{GeanyFiletype} */
struct GeanyPrefs *prefs; /**< General settings */
struct GeanyInterfacePrefs *interface_prefs; /**< Interface settings */