[gnome-builder] GbDocumentStack: use action for close
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] GbDocumentStack: use action for close
- Date: Thu, 11 Dec 2014 00:10:28 +0000 (UTC)
commit 601beaea1fe82d729a61a8913e0d686adc33b8a7
Author: Christian Hergert <christian hergert me>
Date: Mon Dec 8 02:54:54 2014 -0800
GbDocumentStack: use action for close
src/documents/gb-document-stack.c | 21 +++++++--------------
src/resources/gtk/menus.ui | 6 ++++++
src/resources/ui/gb-document-stack.ui | 1 +
3 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/src/documents/gb-document-stack.c b/src/documents/gb-document-stack.c
index 2d0601b..8cfdf40 100644
--- a/src/documents/gb-document-stack.c
+++ b/src/documents/gb-document-stack.c
@@ -357,18 +357,16 @@ gb_document_stack_document_selected (GbDocumentStack *stack,
}
static void
-gb_document_stack_close_clicked (GbDocumentStack *stack,
- GtkButton *button)
+gb_document_stack_close (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- GbDocumentStackPrivate *priv;
+ GbDocumentStack *stack = user_data;
g_return_if_fail (GB_IS_DOCUMENT_STACK (stack));
- g_return_if_fail (GTK_IS_BUTTON (button));
-
- priv = stack->priv;
- if (priv->active_view)
- gb_document_stack_remove_view (stack, priv->active_view);
+ if (stack->priv->active_view)
+ gb_document_stack_remove_view (stack, stack->priv->active_view);
}
static void
@@ -411,12 +409,6 @@ gb_document_stack_constructed (GObject *object)
G_CALLBACK (gb_document_stack_document_selected),
stack,
G_CONNECT_SWAPPED);
-
- g_signal_connect_object (stack->priv->close,
- "clicked",
- G_CALLBACK (gb_document_stack_close_clicked),
- stack,
- G_CONNECT_SWAPPED);
}
static void
@@ -649,6 +641,7 @@ gb_document_stack_init (GbDocumentStack *self)
{ "move-document-right", gb_document_stack_move_document_right },
{ "split-document-left", gb_document_stack_split_document_left },
{ "split-document-right", gb_document_stack_split_document_right },
+ { "close", gb_document_stack_close },
};
GSimpleActionGroup *actions;
diff --git a/src/resources/gtk/menus.ui b/src/resources/gtk/menus.ui
index 4adfa9e..28ac026 100644
--- a/src/resources/gtk/menus.ui
+++ b/src/resources/gtk/menus.ui
@@ -124,5 +124,11 @@
<attribute name="action">stack.split-document-right</attribute>
</item>
</section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">Close Document</attribute>
+ <attribute name="action">stack.close</attribute>
+ </item>
+ </section>
</menu>
</interface>
diff --git a/src/resources/ui/gb-document-stack.ui b/src/resources/ui/gb-document-stack.ui
index 794db83..edfc859 100644
--- a/src/resources/ui/gb-document-stack.ui
+++ b/src/resources/ui/gb-document-stack.ui
@@ -44,6 +44,7 @@
<child>
<object class="GtkButton" id="close">
<property name="visible">false</property>
+ <property name="action-name">stack.close</property>
<property name="tooltip_text">Close the current document</property>
<style>
<class name="image-button"/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]