[tepl: 5/5] Tab: add get_buffer()



commit 1d3c500a742ec1e1a29fe9e4c841f049214875f7
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Jun 21 16:17:18 2017 +0200

    Tab: add get_buffer()

 docs/reference/tepl-3.0-sections.txt |    1 +
 tepl/tepl-tab.c                      |   19 +++++++++++++++++++
 tepl/tepl-tab.h                      |   12 +++++++-----
 3 files changed, 27 insertions(+), 5 deletions(-)
---
diff --git a/docs/reference/tepl-3.0-sections.txt b/docs/reference/tepl-3.0-sections.txt
index 573f379..b6332c2 100644
--- a/docs/reference/tepl-3.0-sections.txt
+++ b/docs/reference/tepl-3.0-sections.txt
@@ -347,6 +347,7 @@ TeplTab
 TeplTabClass
 tepl_tab_new
 tepl_tab_get_view
+tepl_tab_get_buffer
 tepl_tab_add_info_bar
 <SUBSECTION Standard>
 TEPL_IS_TAB
diff --git a/tepl/tepl-tab.c b/tepl/tepl-tab.c
index c47b380..e933bb3 100644
--- a/tepl/tepl-tab.c
+++ b/tepl/tepl-tab.c
@@ -19,6 +19,7 @@
 
 #include "tepl-tab.h"
 #include "tepl-view.h"
+#include "tepl-buffer.h"
 
 /**
  * SECTION:tab
@@ -269,6 +270,24 @@ tepl_tab_get_view (TeplTab *tab)
 }
 
 /**
+ * tepl_tab_get_buffer:
+ * @tab: a #TeplTab.
+ *
+ * A convenience function that calls gtk_text_view_get_buffer() on the
+ * #TeplTab:view associated with the @tab.
+ *
+ * Returns: (transfer none): the #TeplBuffer of the #TeplTab:view.
+ * Since: 3.0
+ */
+TeplBuffer *
+tepl_tab_get_buffer (TeplTab *tab)
+{
+       g_return_val_if_fail (TEPL_IS_TAB (tab), NULL);
+
+       return TEPL_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (tab->priv->view)));
+}
+
+/**
  * tepl_tab_add_info_bar:
  * @tab: a #TeplTab.
  * @info_bar: a #GtkInfoBar.
diff --git a/tepl/tepl-tab.h b/tepl/tepl-tab.h
index 55c83c2..029ea1f 100644
--- a/tepl/tepl-tab.h
+++ b/tepl/tepl-tab.h
@@ -74,14 +74,16 @@ struct _TeplTabClass
        gpointer padding[12];
 };
 
-GType                  tepl_tab_get_type                               (void);
+GType          tepl_tab_get_type               (void);
 
-TeplTab *              tepl_tab_new                                    (TeplView *view);
+TeplTab *      tepl_tab_new                    (TeplView *view);
 
-TeplView *             tepl_tab_get_view                               (TeplTab *tab);
+TeplView *     tepl_tab_get_view               (TeplTab *tab);
 
-void                   tepl_tab_add_info_bar                           (TeplTab    *tab,
-                                                                        GtkInfoBar *info_bar);
+TeplBuffer *   tepl_tab_get_buffer             (TeplTab *tab);
+
+void           tepl_tab_add_info_bar           (TeplTab    *tab,
+                                                GtkInfoBar *info_bar);
 
 G_END_DECLS
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]