[gnome-builder/document-manager: 4/4] GbDocumentManager: add helper to get singleton instance.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/document-manager: 4/4] GbDocumentManager: add helper to get singleton instance.
- Date: Wed, 3 Dec 2014 04:34:04 +0000 (UTC)
commit cbf097487373c19db1c5fc1685b401a2e3d4d7ab
Author: Christian Hergert <christian hergert me>
Date: Tue Dec 2 18:38:06 2014 -0800
GbDocumentManager: add helper to get singleton instance.
src/documents/gb-document-manager.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/documents/gb-document-manager.c b/src/documents/gb-document-manager.c
index 118865e..9f27042 100644
--- a/src/documents/gb-document-manager.c
+++ b/src/documents/gb-document-manager.c
@@ -34,6 +34,24 @@ gb_document_manager_new (void)
}
/**
+ * gb_document_manager_get_default:
+ *
+ * Retrieves the singleton instance of #GbDocumentManager.
+ *
+ * Returns: (transfer none): A #GbDocumentManager.
+ */
+GbDocumentManager *
+gb_document_manager_get_default (void)
+{
+ static GbDocumentManager *instance;
+
+ if (!instance)
+ instance = gb_document_manager_new ();
+
+ return instance;
+}
+
+/**
* gb_document_manager_find_by_file:
* @manager: A #GbDocumentManager.
* @file: A #GFile.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]