[tepl] Tab: add simpler new() constructor
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tepl] Tab: add simpler new() constructor
- Date: Fri, 23 Jun 2017 11:41:42 +0000 (UTC)
commit eda46d73c2930d7e9d25a955fa993ca5c850c4f6
Author: Sébastien Wilmet <swilmet gnome org>
Date: Fri Jun 23 13:27:01 2017 +0200
Tab: add simpler new() constructor
docs/reference/api-breaks.xml | 8 +++++---
docs/reference/tepl-3.0-sections.txt | 1 +
tepl/tepl-tab.c | 21 +++++++++++++++++++++
tepl/tepl-tab.h | 2 ++
tests/test-tab.c | 2 +-
5 files changed, 30 insertions(+), 4 deletions(-)
---
diff --git a/docs/reference/api-breaks.xml b/docs/reference/api-breaks.xml
index 914adbd..92708f4 100644
--- a/docs/reference/api-breaks.xml
+++ b/docs/reference/api-breaks.xml
@@ -46,9 +46,11 @@
</listitem>
<listitem>
<para>
- The <link linkend="tepl-tab-new">tepl_tab_new()</link> function now
- takes a <link linkend="TeplView">TeplView</link> parameter instead of
- the main <link linkend="GtkWidget">GtkWidget</link> of the tab.
+ The <link linkend="TeplTab">TeplTab</link> class has been revamped.
+ The <link linkend="tepl-tab-new">tepl_tab_new()</link> function
+ doesn't take a <link linkend="GtkWidget">GtkWidget</link> parameter
+ anymore, a <link linkend="TeplView">TeplView</link> is created
+ instead.
</para>
</listitem>
</itemizedlist>
diff --git a/docs/reference/tepl-3.0-sections.txt b/docs/reference/tepl-3.0-sections.txt
index cd3136a..ea63224 100644
--- a/docs/reference/tepl-3.0-sections.txt
+++ b/docs/reference/tepl-3.0-sections.txt
@@ -345,6 +345,7 @@ tepl_metadata_manager_shutdown
<FILE>tab</FILE>
TeplTab
TeplTabClass
+tepl_tab_new
tepl_tab_new_with_view
tepl_tab_get_view
tepl_tab_get_buffer
diff --git a/tepl/tepl-tab.c b/tepl/tepl-tab.c
index caa6c73..0c787f6 100644
--- a/tepl/tepl-tab.c
+++ b/tepl/tepl-tab.c
@@ -137,6 +137,12 @@ static void
set_view (TeplTab *tab,
TeplView *view)
{
+ if (view == NULL)
+ {
+ /* For tepl_tab_new(). */
+ view = TEPL_VIEW (tepl_view_new ());
+ }
+
g_return_if_fail (TEPL_IS_VIEW (view));
g_assert (tab->priv->view == NULL);
@@ -238,6 +244,21 @@ tepl_tab_init (TeplTab *tab)
}
/**
+ * tepl_tab_new:
+ *
+ * Creates a new #TeplTab with a new #TeplView. The new #TeplView can be
+ * retrieved afterwards with tepl_tab_get_view().
+ *
+ * Returns: a new #TeplTab.
+ * Since: 3.0
+ */
+TeplTab *
+tepl_tab_new (void)
+{
+ return g_object_new (TEPL_TYPE_TAB, NULL);
+}
+
+/**
* tepl_tab_new_with_view:
* @view: the #TeplView that will be contained in the tab.
*
diff --git a/tepl/tepl-tab.h b/tepl/tepl-tab.h
index 153e382..3f7c0ef 100644
--- a/tepl/tepl-tab.h
+++ b/tepl/tepl-tab.h
@@ -76,6 +76,8 @@ struct _TeplTabClass
GType tepl_tab_get_type (void);
+TeplTab * tepl_tab_new (void);
+
TeplTab * tepl_tab_new_with_view (TeplView *view);
TeplView * tepl_tab_get_view (TeplTab *tab);
diff --git a/tests/test-tab.c b/tests/test-tab.c
index 31fd595..a7deef6 100644
--- a/tests/test-tab.c
+++ b/tests/test-tab.c
@@ -207,7 +207,7 @@ create_window_content (void)
"margin", 6,
NULL);
- tab = tepl_tab_new_with_view (TEPL_VIEW (tepl_view_new ()));
+ tab = tepl_tab_new ();
side_panel = create_side_panel (tab);
gtk_container_add (GTK_CONTAINER (hgrid), side_panel);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]