[gnome-builder] tab: add GbTab::close signal



commit a4d21e79dfce69ad87871b678d09a27811ece35c
Author: Christian Hergert <christian hergert me>
Date:   Mon Sep 8 21:05:07 2014 -0700

    tab: add GbTab::close signal

 src/tabs/gb-tab.c |   64 +++++++++++++++++++++++++++++++++++-----------------
 src/tabs/gb-tab.h |    4 +-
 2 files changed, 45 insertions(+), 23 deletions(-)
---
diff --git a/src/tabs/gb-tab.c b/src/tabs/gb-tab.c
index 0962bfe..8703b34 100644
--- a/src/tabs/gb-tab.c
+++ b/src/tabs/gb-tab.c
@@ -34,6 +34,7 @@ enum {
 };
 
 enum {
+  CLOSE,
   FREEZE_DRAG,
   THAW_DRAG,
   LAST_SIGNAL
@@ -41,8 +42,16 @@ enum {
 
 G_DEFINE_TYPE_WITH_PRIVATE (GbTab, gb_tab, GTK_TYPE_BOX)
 
-static GParamSpec * gParamSpecs[LAST_PROP];
-static guint gSignals[LAST_SIGNAL];
+static GParamSpec *gParamSpecs [LAST_PROP];
+static guint       gSignals [LAST_SIGNAL];
+
+void
+gb_tab_close (GbTab *tab)
+{
+  g_return_if_fail (GB_IS_TAB (tab));
+
+  g_signal_emit (tab, gSignals [CLOSE], 0);
+}
 
 const gchar *
 gb_tab_get_icon_name (GbTab *tab)
@@ -187,25 +196,38 @@ gb_tab_class_init (GbTabClass *klass)
   g_object_class_install_property (object_class, PROP_TITLE,
                                    gParamSpecs[PROP_TITLE]);
 
-  gSignals[FREEZE_DRAG] = g_signal_new ("freeze-drag",
-                                        GB_TYPE_TAB,
-                                        G_SIGNAL_RUN_LAST,
-                                        G_STRUCT_OFFSET (GbTabClass, freeze_drag),
-                                        NULL,
-                                        NULL,
-                                        g_cclosure_marshal_VOID__VOID,
-                                        G_TYPE_NONE,
-                                        0);
-
-  gSignals[THAW_DRAG] = g_signal_new ("thaw-drag",
-                                      GB_TYPE_TAB,
-                                      G_SIGNAL_RUN_LAST,
-                                      G_STRUCT_OFFSET (GbTabClass, thaw_drag),
-                                      NULL,
-                                      NULL,
-                                      g_cclosure_marshal_VOID__VOID,
-                                      G_TYPE_NONE,
-                                      0);
+  gSignals [CLOSE] =
+    g_signal_new ("close",
+                  GB_TYPE_TAB,
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (GbTabClass, close),
+                  NULL,
+                  NULL,
+                  g_cclosure_marshal_VOID__VOID,
+                  G_TYPE_NONE,
+                  0);
+
+  gSignals [FREEZE_DRAG] =
+    g_signal_new ("freeze-drag",
+                  GB_TYPE_TAB,
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (GbTabClass, freeze_drag),
+                  NULL,
+                  NULL,
+                  g_cclosure_marshal_VOID__VOID,
+                  G_TYPE_NONE,
+                  0);
+
+  gSignals [THAW_DRAG] =
+    g_signal_new ("thaw-drag",
+                  GB_TYPE_TAB,
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (GbTabClass, thaw_drag),
+                  NULL,
+                  NULL,
+                  g_cclosure_marshal_VOID__VOID,
+                  G_TYPE_NONE,
+                  0);
 }
 
 static void
diff --git a/src/tabs/gb-tab.h b/src/tabs/gb-tab.h
index eddf7cf..a8c0376 100644
--- a/src/tabs/gb-tab.h
+++ b/src/tabs/gb-tab.h
@@ -49,8 +49,7 @@ struct _GbTabClass
 
   void (*freeze_drag) (GbTab *tab);
   void (*thaw_drag)   (GbTab *tab);
-
-  gpointer padding[8];
+  void (*close)       (GbTab *tab);
 };
 
 GType        gb_tab_get_type      (void) G_GNUC_CONST;
@@ -63,6 +62,7 @@ void         gb_tab_set_icon_name (GbTab       *tab,
 
 void         gb_tab_freeze_drag   (GbTab       *tab);
 void         gb_tab_thaw_drag     (GbTab       *tab);
+void         gb_tab_close         (GbTab       *tab);
 
 G_END_DECLS
 


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