Branch: refs/heads/master Author: Matthew Brush matt@geany.org Committer: Matthew Brush matt@geany.org Date: Thu, 01 Sep 2016 04:02:24 UTC Commit: ce6c0fad9481549c62c308a42ccfe774bacf3b55 https://github.com/geany/geany/commit/ce6c0fad9481549c62c308a42ccfe774bacf3b...
Log Message: ----------- Add support for Keyed Data Lists for documents
Modified Paths: -------------- src/document.c src/document.h src/documentprivate.h
Modified: src/document.c 23 lines changed, 23 insertions(+), 0 deletions(-) =================================================================== @@ -657,6 +657,8 @@ static GeanyDocument *document_create(const gchar *utf8_filename) doc->priv->last_check = time(NULL); #endif
+ g_datalist_init(&doc->priv->data); + sidebar_openfiles_add(doc); /* sets doc->iter */
notebook_new_tab(doc); @@ -712,6 +714,8 @@ static gboolean remove_page(guint page_num) if (! main_status.closing_all && doc->real_path != NULL) ui_add_recent_document(doc);
+ g_datalist_clear(&doc->priv->data); + doc->is_valid = FALSE; doc->id = 0;
@@ -3839,3 +3843,22 @@ GEANY_API_SYMBOL GType document_get_type (void);
G_DEFINE_BOXED_TYPE(GeanyDocument, document, copy_, free_); + + +gpointer document_get_data(const GeanyDocument *doc, const gchar *key) +{ + return g_datalist_get_data(&doc->priv->data, key); +} + + +void document_set_data(GeanyDocument *doc, const gchar *key, gpointer data) +{ + g_datalist_set_data(&doc->priv->data, key, data); +} + + +void document_set_data_full(GeanyDocument *doc, const gchar *key, + gpointer data, GDestroyNotify free_func) +{ + g_datalist_set_data_full(&doc->priv->data, key, data, free_func); +}
Modified: src/document.h 7 lines changed, 7 insertions(+), 0 deletions(-) =================================================================== @@ -316,6 +316,13 @@ void document_grab_focus(GeanyDocument *doc);
GeanyDocument *document_clone(GeanyDocument *old_doc);
+gpointer document_get_data(const GeanyDocument *doc, const gchar *key); + +void document_set_data(GeanyDocument *doc, const gchar *key, gpointer data); + +void document_set_data_full(GeanyDocument *doc, const gchar *key, + gpointer data, GDestroyNotify free_func); + #endif /* GEANY_PRIVATE */
G_END_DECLS
Modified: src/documentprivate.h 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -111,6 +111,8 @@ typedef struct GeanyDocumentPrivate gint protected; /* Save pointer to info bars allowing to cancel them programatically (to avoid multiple ones) */ GtkWidget *info_bars[NUM_MSG_TYPES]; + /* Keyed Data List to attach arbitrary data to the document */ + GData *data; } GeanyDocumentPrivate;
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).