[gnome-builder/document-manager] GbDocumentStack: emit view-closed signal when a view is closed
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/document-manager] GbDocumentStack: emit view-closed signal when a view is closed
- Date: Mon, 8 Dec 2014 22:52:48 +0000 (UTC)
commit 6f552252e52e919a9a2ddb9f42ab1639ca11e86d
Author: Christian Hergert <christian hergert me>
Date: Mon Dec 8 14:52:07 2014 -0800
GbDocumentStack: emit view-closed signal when a view is closed
src/documents/gb-document-stack.c | 19 +++++++++++++++++++
src/documents/gb-document-stack.h | 2 ++
2 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/documents/gb-document-stack.c b/src/documents/gb-document-stack.c
index d4e4e22..b0503de 100644
--- a/src/documents/gb-document-stack.c
+++ b/src/documents/gb-document-stack.c
@@ -53,6 +53,7 @@ enum {
CREATE_VIEW,
EMPTY,
FOCUS_NEIGHBOR,
+ VIEW_CLOSED,
LAST_SIGNAL
};
@@ -81,6 +82,8 @@ gb_document_stack_remove_view (GbDocumentStack *stack,
if (view == stack->priv->active_view)
gb_clear_weak_pointer (&stack->priv->active_view);
+ g_object_ref (view);
+
/* Notify the document view it is being closed */
gb_document_view_close (view);
@@ -90,6 +93,11 @@ gb_document_stack_remove_view (GbDocumentStack *stack,
gtk_container_remove (GTK_CONTAINER (stack->priv->controls), controls);
gtk_container_remove (GTK_CONTAINER (stack->priv->stack), GTK_WIDGET (view));
+ /* Notify document grid of view closure */
+ g_signal_emit (stack, gSignals [VIEW_CLOSED], 0, view);
+
+ g_object_unref (view);
+
/*
* Set the visible child to the first document view. We probably want to
* be more intelligent about this in the future. visible_child may be
@@ -688,6 +696,17 @@ gb_document_stack_class_init (GbDocumentStackClass *klass)
1,
GTK_TYPE_TEXT_DIRECTION);
+ gSignals [VIEW_CLOSED] =
+ g_signal_new ("view-closed",
+ GB_TYPE_DOCUMENT_STACK,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GbDocumentStackClass, view_closed),
+ NULL, NULL,
+ g_cclosure_marshal_generic,
+ G_TYPE_NONE,
+ 1,
+ GB_TYPE_DOCUMENT_VIEW);
+
g_type_ensure (GB_TYPE_DOCUMENT_MENU_BUTTON);
}
diff --git a/src/documents/gb-document-stack.h b/src/documents/gb-document-stack.h
index 420557f..bbfed8c 100644
--- a/src/documents/gb-document-stack.h
+++ b/src/documents/gb-document-stack.h
@@ -55,6 +55,8 @@ struct _GbDocumentStackClass
GbDocument *document,
GbDocumentSplit split);
void (*empty) (GbDocumentStack *stack);
+ void (*view_closed) (GbDocumentStack *stack,
+ GbDocumentView *view);
};
GType gb_document_stack_get_type (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]