[gnome-builder] devhelp: allow closing devhelp tabs
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] devhelp: allow closing devhelp tabs
- Date: Tue, 9 Sep 2014 08:47:24 +0000 (UTC)
commit f3cfd2a52c083ca0965f4b29cc73645f94d23b3f
Author: Christian Hergert <christian hergert me>
Date: Tue Sep 9 01:47:19 2014 -0700
devhelp: allow closing devhelp tabs
src/devhelp/gb-devhelp-tab.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/devhelp/gb-devhelp-tab.c b/src/devhelp/gb-devhelp-tab.c
index edf480f..910b796 100644
--- a/src/devhelp/gb-devhelp-tab.c
+++ b/src/devhelp/gb-devhelp-tab.c
@@ -21,6 +21,7 @@
#include <webkit2/webkit2.h>
#include "gb-devhelp-tab.h"
+#include "gb-multi-notebook.h"
#include "gd-tagged-entry.h"
struct _GbDevhelpTabPrivate
@@ -39,6 +40,25 @@ G_DEFINE_TYPE_WITH_PRIVATE (GbDevhelpTab, gb_devhelp_tab, GB_TYPE_TAB)
static GParamSpec *gParamSpecs[LAST_PROP];
static void
+gb_devhelp_tab_close (GbTab *tab)
+{
+ GtkWidget *parent = (GtkWidget *)tab;
+ GList *list;
+
+ g_return_if_fail (GB_IS_DEVHELP_TAB (tab));
+
+ while (!GB_IS_MULTI_NOTEBOOK (parent))
+ parent = gtk_widget_get_parent (parent);
+
+ list = gb_multi_notebook_get_all_tabs (GB_MULTI_NOTEBOOK (parent));
+
+ if (list->next)
+ gtk_widget_destroy (GTK_WIDGET (tab));
+
+ g_list_free (list);
+}
+
+static void
gb_devhelp_tab_freeze_drag (GbTab *tab)
{
GbDevhelpTabPrivate *priv = GB_DEVHELP_TAB (tab)->priv;
@@ -126,6 +146,7 @@ gb_devhelp_tab_class_init (GbDevhelpTabClass *klass)
object_class->finalize = gb_devhelp_tab_finalize;
object_class->set_property = gb_devhelp_tab_set_property;
+ tab_class->close = gb_devhelp_tab_close;
tab_class->freeze_drag = gb_devhelp_tab_freeze_drag;
tab_class->thaw_drag = gb_devhelp_tab_thaw_drag;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]