[tepl] Tab: add ::close-request signal



commit 13b6e6e766024a9f0c0382a35ed718119d8b5bb9
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Aug 6 11:56:39 2017 +0200

    Tab: add ::close-request signal

 tepl/tepl-tab.c |   25 +++++++++++++++++++++++++
 tepl/tepl-tab.h |    7 +++++++
 2 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/tepl/tepl-tab.c b/tepl/tepl-tab.c
index 4614de8..6c443e4 100644
--- a/tepl/tepl-tab.c
+++ b/tepl/tepl-tab.c
@@ -72,6 +72,14 @@ enum
        PROP_ACTIVE_BUFFER,
 };
 
+enum
+{
+       SIGNAL_CLOSE_REQUEST,
+       N_SIGNALS
+};
+
+static guint signals[N_SIGNALS];
+
 static void tepl_tab_group_interface_init (gpointer g_iface,
                                           gpointer iface_data);
 
@@ -294,6 +302,23 @@ tepl_tab_class_init (TeplTabClass *klass)
        g_object_class_override_property (object_class, PROP_ACTIVE_TAB, "active-tab");
        g_object_class_override_property (object_class, PROP_ACTIVE_VIEW, "active-view");
        g_object_class_override_property (object_class, PROP_ACTIVE_BUFFER, "active-buffer");
+
+       /**
+        * TeplTab::close-request:
+        * @tab: the #TeplTab emitting the signal.
+        *
+        * The ::close-request signal is emitted when there is a request to
+        * close the #TeplTab, for example if the user clicks on a close button.
+        *
+        * Since: 3.0
+        */
+       signals[SIGNAL_CLOSE_REQUEST] =
+               g_signal_new ("close-request",
+                             G_TYPE_FROM_CLASS (klass),
+                             G_SIGNAL_RUN_LAST,
+                             G_STRUCT_OFFSET (TeplTabClass, close_request),
+                             NULL, NULL, NULL,
+                             G_TYPE_NONE, 0);
 }
 
 static GList *
diff --git a/tepl/tepl-tab.h b/tepl/tepl-tab.h
index 3f7c0ef..762338e 100644
--- a/tepl/tepl-tab.h
+++ b/tepl/tepl-tab.h
@@ -59,17 +59,24 @@ struct _TeplTab
  *   non-#GtkInfoBar child widget of #TeplTab (so by default it is inserted
  *   below other #GtkInfoBar's, but above the #GtkScrolledWindow containing the
  *   #TeplView).
+ * @close_request: For the #TeplTab::close-request signal.
  */
 struct _TeplTabClass
 {
        GtkGridClass parent_class;
 
+       /* Vfuncs */
+
        void    (* pack_view)           (TeplTab  *tab,
                                         TeplView *view);
 
        void    (* pack_info_bar)       (TeplTab    *tab,
                                         GtkInfoBar *info_bar);
 
+       /* Signals */
+
+       void    (* close_request)       (TeplTab *tab);
+
        /*< private >*/
        gpointer padding[12];
 };


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