[gnome-builder] merge history on workbench unload
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] merge history on workbench unload
- Date: Tue, 24 Mar 2015 00:32:09 +0000 (UTC)
commit a2ca30b19f38cf4072dbd2842a0ba941480f5b90
Author: Christian Hergert <christian hergert me>
Date: Sat Mar 21 00:55:52 2015 -0700
merge history on workbench unload
src/views/gb-view-stack.c | 40 ++++++++++++++++++++++++++++++++++++++++
src/workbench/gb-workbench.c | 18 ++++++++++++++++++
2 files changed, 58 insertions(+), 0 deletions(-)
---
diff --git a/src/views/gb-view-stack.c b/src/views/gb-view-stack.c
index c96b1c0..1c10289 100644
--- a/src/views/gb-view-stack.c
+++ b/src/views/gb-view-stack.c
@@ -25,6 +25,7 @@
#include "gb-view-stack-actions.h"
#include "gb-view-stack-private.h"
#include "gb-widget.h"
+#include "gb-workbench.h"
G_DEFINE_TYPE (GbViewStack, gb_view_stack, GTK_TYPE_BIN)
@@ -220,6 +221,44 @@ gb_view_stack_context_handler (GtkWidget *widget,
}
static void
+gb_view_stack_on_workbench_unload (GbWorkbench *workbench,
+ IdeContext *context,
+ GbViewStack *self)
+{
+ IdeBackForwardList *back_forward_list;
+
+ g_assert (GB_IS_WORKBENCH (workbench));
+ g_assert (IDE_IS_CONTEXT (context));
+ g_assert (GB_IS_VIEW_STACK (self));
+
+ if (self->back_forward_list)
+ {
+ back_forward_list = ide_context_get_back_forward_list (context);
+ ide_back_forward_list_merge (back_forward_list, self->back_forward_list);
+ }
+}
+
+static void
+gb_view_stack_hierarchy_changed (GtkWidget *widget,
+ GtkWidget *old_toplevel)
+{
+ GbViewStack *self = (GbViewStack *)widget;
+ GtkWidget *toplevel;
+
+ g_assert (GB_IS_VIEW_STACK (self));
+
+ toplevel = gtk_widget_get_toplevel (widget);
+
+ if (GB_IS_WORKBENCH (toplevel))
+ {
+ g_signal_connect (toplevel,
+ "unload",
+ G_CALLBACK (gb_view_stack_on_workbench_unload),
+ self);
+ }
+}
+
+static void
gb_view_stack_constructed (GObject *object)
{
GbViewStack *self = (GbViewStack *)object;
@@ -294,6 +333,7 @@ gb_view_stack_class_init (GbViewStackClass *klass)
object_class->set_property = gb_view_stack_set_property;
widget_class->grab_focus = gb_view_stack_grab_focus;
+ widget_class->hierarchy_changed = gb_view_stack_hierarchy_changed;
container_class->add = gb_view_stack_add;
container_class->remove = gb_view_stack_real_remove;
diff --git a/src/workbench/gb-workbench.c b/src/workbench/gb-workbench.c
index 2e084f5..5f25c5c 100644
--- a/src/workbench/gb-workbench.c
+++ b/src/workbench/gb-workbench.c
@@ -41,10 +41,16 @@ enum {
};
enum {
+ UNLOAD,
+ LAST_SIGNAL
+};
+
+enum {
TARGET_URI_LIST = 100
};
static GParamSpec *gParamSpecs [LAST_PROP];
+static guint gSignals [LAST_SIGNAL];
static const GtkTargetEntry gDropTypes[] = {
{ "text/uri-list", 0, TARGET_URI_LIST}
};
@@ -101,6 +107,7 @@ gb_workbench_delete_event (GtkWidget *widget,
self->unloading = TRUE;
self->unload_cancellable = g_cancellable_new ();
+ g_signal_emit (self, gSignals [UNLOAD], 0, self->context);
ide_context_unload_async (self->context,
self->unload_cancellable,
gb_workbench__unload_cb,
@@ -374,6 +381,17 @@ gb_workbench_class_init (GbWorkbenchClass *klass)
(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class, PROP_CONTEXT, gParamSpecs [PROP_CONTEXT]);
+ gSignals [UNLOAD] =
+ g_signal_new ("unload",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1,
+ IDE_TYPE_CONTEXT);
+
GB_WIDGET_CLASS_TEMPLATE (klass, "gb-workbench.ui");
GB_WIDGET_CLASS_BIND (klass, GbWorkbench, command_bar);
GB_WIDGET_CLASS_BIND (klass, GbWorkbench, editor_workspace);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]