[tepl] AbstractFactory: add create_main_window()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tepl] AbstractFactory: add create_main_window()
- Date: Tue, 10 Oct 2017 14:53:39 +0000 (UTC)
commit 31e5175acc6a352f2efdc14e78ce02691999cb17
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sun Oct 8 16:04:10 2017 +0200
AbstractFactory: add create_main_window()
docs/reference/tepl-3.0-sections.txt | 1 +
tepl/tepl-abstract-factory.c | 27 +++++++++++++++++++++++++++
tepl/tepl-abstract-factory.h | 23 ++++++++++++++++++-----
3 files changed, 46 insertions(+), 5 deletions(-)
---
diff --git a/docs/reference/tepl-3.0-sections.txt b/docs/reference/tepl-3.0-sections.txt
index fe85a80..e3f6884 100644
--- a/docs/reference/tepl-3.0-sections.txt
+++ b/docs/reference/tepl-3.0-sections.txt
@@ -174,6 +174,7 @@ TeplAbstractFactory
TeplAbstractFactoryClass
tepl_abstract_factory_set_singleton
tepl_abstract_factory_get_singleton
+tepl_abstract_factory_create_main_window
tepl_abstract_factory_create_tab
tepl_abstract_factory_create_tab_label
tepl_abstract_factory_create_file
diff --git a/tepl/tepl-abstract-factory.c b/tepl/tepl-abstract-factory.c
index e5efd2f..1fe40db 100644
--- a/tepl/tepl-abstract-factory.c
+++ b/tepl/tepl-abstract-factory.c
@@ -165,6 +165,33 @@ _tepl_abstract_factory_unref_singleton (void)
}
/**
+ * tepl_abstract_factory_create_main_window:
+ * @factory: the #TeplAbstractFactory.
+ * @app: a #GtkApplication.
+ *
+ * Creates a main #GtkApplicationWindow in the sense of
+ * tepl_application_window_is_main_window().
+ *
+ * Returns: (transfer floating) (nullable): a new main application window, or
+ * %NULL if the vfunc is not implemented.
+ */
+GtkApplicationWindow *
+tepl_abstract_factory_create_main_window (TeplAbstractFactory *factory,
+ GtkApplication *app)
+{
+ g_return_val_if_fail (TEPL_IS_ABSTRACT_FACTORY (factory), NULL);
+ g_return_val_if_fail (GTK_IS_APPLICATION (app), NULL);
+
+ if (TEPL_ABSTRACT_FACTORY_GET_CLASS (factory)->create_main_window != NULL)
+ {
+ return TEPL_ABSTRACT_FACTORY_GET_CLASS (factory)->create_main_window (factory, app);
+ }
+
+ g_warning ("The TeplAbstractFactory::create_main_window vfunc is not implemented.");
+ return NULL;
+}
+
+/**
* tepl_abstract_factory_create_tab:
* @factory: the #TeplAbstractFactory.
*
diff --git a/tepl/tepl-abstract-factory.h b/tepl/tepl-abstract-factory.h
index 6693045..58711d8 100644
--- a/tepl/tepl-abstract-factory.h
+++ b/tepl/tepl-abstract-factory.h
@@ -54,20 +54,30 @@ struct _TeplAbstractFactory
* @create_file: Virtual function pointer for
* tepl_abstract_factory_create_file(). By default the #TeplFile is created
* with tepl_file_new().
+ * @create_main_window: Virtual function pointer for
+ * tepl_abstract_factory_create_main_window(). It is not implemented by
+ * default.
+ */
+/* TODO move create_main_window on top, to have a more logical order, for next
+ * API break. Keyword: "deprecated" (to find this TODO when it needs to be
+ * done).
*/
struct _TeplAbstractFactoryClass
{
GObjectClass parent_class;
- TeplTab * (* create_tab) (TeplAbstractFactory *factory);
+ TeplTab * (* create_tab) (TeplAbstractFactory *factory);
+
+ GtkWidget * (* create_tab_label) (TeplAbstractFactory *factory,
+ TeplTab *tab);
- GtkWidget * (* create_tab_label) (TeplAbstractFactory *factory,
- TeplTab *tab);
+ TeplFile * (* create_file) (TeplAbstractFactory *factory);
- TeplFile * (* create_file) (TeplAbstractFactory *factory);
+ GtkApplicationWindow * (* create_main_window) (TeplAbstractFactory *factory,
+ GtkApplication *app);
/*< private >*/
- gpointer padding[11];
+ gpointer padding[10];
};
GType tepl_abstract_factory_get_type (void);
@@ -76,6 +86,9 @@ void tepl_abstract_factory_set_singleton (TeplAbstractFactory
*factory);
TeplAbstractFactory * tepl_abstract_factory_get_singleton (void);
+GtkApplicationWindow * tepl_abstract_factory_create_main_window (TeplAbstractFactory *factory,
+ GtkApplication *app);
+
TeplTab * tepl_abstract_factory_create_tab (TeplAbstractFactory *factory);
GtkWidget * tepl_abstract_factory_create_tab_label (TeplAbstractFactory *factory,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]