[gnome-builder] close views



commit 2fd42f63923fd6cecf2205a056217911eb4fce3d
Author: Christian Hergert <christian hergert me>
Date:   Wed Mar 18 19:18:42 2015 -0700

    close views

 data/ui/gb-view-stack.ui          |    1 +
 src/views/gb-view-stack-actions.c |    7 +++++++
 2 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/data/ui/gb-view-stack.ui b/data/ui/gb-view-stack.ui
index a8a21a0..4c013e7 100644
--- a/data/ui/gb-view-stack.ui
+++ b/data/ui/gb-view-stack.ui
@@ -83,6 +83,7 @@
                 </child>
                 <child>
                   <object class="GtkButton">
+                    <property name="action-name">view.close</property>
                     <property name="visible">true</property>
                     <style>
                       <class name="dim-label"/>
diff --git a/src/views/gb-view-stack-actions.c b/src/views/gb-view-stack-actions.c
index 7a11f0d..3b464df 100644
--- a/src/views/gb-view-stack-actions.c
+++ b/src/views/gb-view-stack-actions.c
@@ -30,8 +30,15 @@ gb_view_stack_actions_close (GSimpleAction *action,
                              gpointer       user_data)
 {
   GbViewStack *self = user_data;
+  GtkWidget *active_view;
 
   g_assert (GB_IS_VIEW_STACK (self));
+
+  active_view = gb_view_stack_get_active_view (self);
+  if (active_view == NULL || !GB_IS_VIEW (active_view))
+    return;
+
+  gb_view_stack_remove (self, GB_VIEW (active_view));
 }
 
 static void


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