[tepl] Tab: implement the TeplTabList interface
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tepl] Tab: implement the TeplTabList interface
- Date: Sat, 24 Jun 2017 08:25:50 +0000 (UTC)
commit 0c6bd7cb217ad8548bfb8dcf53958c3701a6bd73
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Jun 24 10:23:13 2017 +0200
Tab: implement the TeplTabList interface
tepl/tepl-tab.c | 36 +++++++++++++++++++++++++++++++++++-
1 files changed, 35 insertions(+), 1 deletions(-)
---
diff --git a/tepl/tepl-tab.c b/tepl/tepl-tab.c
index 662dcc9..185a8de 100644
--- a/tepl/tepl-tab.c
+++ b/tepl/tepl-tab.c
@@ -21,6 +21,7 @@
#include "tepl-view.h"
#include "tepl-buffer.h"
#include "tepl-info-bar.h"
+#include "tepl-tab-list.h"
/**
* SECTION:tab
@@ -40,6 +41,9 @@
* The way that the #TeplView is packed into the #TeplTab is customizable with
* the ::pack_view virtual function. Similarly, the way that #GtkInfoBar's are
* added can be customized with ::pack_info_bar.
+ *
+ * #TeplTab implements the #TeplTabList interface, for a list of only one tab.
+ * It is useful for text editors that open each file in a separate window.
*/
struct _TeplTabPrivate
@@ -56,7 +60,15 @@ enum
static GParamSpec *properties[N_PROPERTIES];
-G_DEFINE_TYPE_WITH_PRIVATE (TeplTab, tepl_tab, GTK_TYPE_GRID)
+static void tepl_tab_list_interface_init (gpointer g_iface,
+ gpointer iface_data);
+
+G_DEFINE_TYPE_WITH_CODE (TeplTab,
+ tepl_tab,
+ GTK_TYPE_GRID,
+ G_ADD_PRIVATE (TeplTab)
+ G_IMPLEMENT_INTERFACE (TEPL_TYPE_TAB_LIST,
+ tepl_tab_list_interface_init))
static GtkScrolledWindow *
create_scrolled_window (void)
@@ -237,6 +249,28 @@ tepl_tab_class_init (TeplTabClass *klass)
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
}
+static GList *
+tepl_tab_get_tabs (TeplTabList *tab_list)
+{
+ return g_list_append (NULL, TEPL_TAB (tab_list));
+}
+
+static TeplTab *
+tepl_tab_get_active_tab (TeplTabList *tab_list)
+{
+ return TEPL_TAB (tab_list);
+}
+
+static void
+tepl_tab_list_interface_init (gpointer g_iface,
+ gpointer iface_data)
+{
+ TeplTabListInterface *interface = g_iface;
+
+ interface->get_tabs = tepl_tab_get_tabs;
+ interface->get_active_tab = tepl_tab_get_active_tab;
+}
+
static void
tepl_tab_init (TeplTab *tab)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]