[tepl] TabGroup: by default, print a warning about append_tab() not supported



commit 100a9a6277560e83a474d187dff6df38bae48645
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Jul 23 16:02:23 2017 +0200

    TabGroup: by default, print a warning about append_tab() not supported
    
    At first I wanted to remove completely the TeplTabGroup implementation
    in TeplTab. Because one file per window anyway sucks. But there are
    maybe some use-cases where the application anyway doesn't need to open
    more than one file, and would benefit from some Tepl GActions or
    high-level API.

 tepl/tepl-tab-group.c |    2 ++
 tepl/tepl-tab-group.h |    5 +++--
 tepl/tepl-tab.c       |    9 ++++++++-
 3 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/tepl/tepl-tab-group.c b/tepl/tepl-tab-group.c
index fac0e53..1d22bc4 100644
--- a/tepl/tepl-tab-group.c
+++ b/tepl/tepl-tab-group.c
@@ -59,6 +59,8 @@ static void
 tepl_tab_group_append_tab_default (TeplTabGroup *tab_group,
                                   TeplTab      *tab)
 {
+       g_warning ("Appending a TeplTab to this TeplTabGroup is not supported. "
+                  "Use for example TeplNotebook.");
 }
 
 static void
diff --git a/tepl/tepl-tab-group.h b/tepl/tepl-tab-group.h
index 168fadc..e91f690 100644
--- a/tepl/tepl-tab-group.h
+++ b/tepl/tepl-tab-group.h
@@ -48,8 +48,9 @@ typedef struct _TeplTabGroupInterface TeplTabGroupInterface;
  *   By default, %NULL is returned.
  * @set_active_tab: Virtual function pointer for
  *   tepl_tab_group_set_active_tab(). Does nothing by default.
- * @append_tab: Virtual function pointer for tepl_tab_group_append_tab(). Does
- *   nothing by default. The @jump_to parameter is already implemented with
+ * @append_tab: Virtual function pointer for tepl_tab_group_append_tab(). The
+ *   default implementation prints a warning about the operation not being
+ *   supported. The @jump_to parameter is already implemented with
  *   tepl_tab_group_set_active_tab().
  *
  * The virtual function table for #TeplTabGroup. When implementing one of the
diff --git a/tepl/tepl-tab.c b/tepl/tepl-tab.c
index 7ba757d..1ee430f 100644
--- a/tepl/tepl-tab.c
+++ b/tepl/tepl-tab.c
@@ -42,8 +42,15 @@
  * the ::pack_view virtual function. Similarly, the way that #GtkInfoBar's are
  * added can be customized with ::pack_info_bar.
  *
+ * # TeplTabGroup implementation
+ *
  * #TeplTab implements the #TeplTabGroup interface, for a group of only one tab.
- * It is useful for text editors that open each file in a separate window.
+ * It is useful for text editors that open each file in a separate window, or
+ * for applications that don't require to open more than one file. But the
+ * tepl_tab_group_append_tab() operation is not supported, so some higher-level
+ * features of Tepl don't work with #TeplTab as the #TeplTabGroup of the window.
+ * This will maybe be improved in the future by creating automatically a new
+ * window.
  */
 
 struct _TeplTabPrivate


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