[gnome-builder/gnome-builder-3-20] tab-strip: focus child when pane is selected



commit 7c56a57a0fee3c8761411caccb66a365b7bcbb1e
Author: Christian Hergert <chergert redhat com>
Date:   Tue May 10 13:49:38 2016 +0300

    tab-strip: focus child when pane is selected

 contrib/pnl/pnl-tab-strip.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/contrib/pnl/pnl-tab-strip.c b/contrib/pnl/pnl-tab-strip.c
index 6a738eb..aacd468 100644
--- a/contrib/pnl/pnl-tab-strip.c
+++ b/contrib/pnl/pnl-tab-strip.c
@@ -301,6 +301,22 @@ pnl_tab_strip_stack_notify_visible_child (PnlTabStrip *self,
 }
 
 static void
+pnl_tab_strip_tab_clicked (PnlTabStrip *self,
+                           PnlTab      *tab)
+{
+  GtkWidget *widget;
+
+  g_assert (PNL_IS_TAB_STRIP (self));
+  g_assert (PNL_IS_TAB (tab));
+
+  if (NULL != (widget = pnl_tab_get_widget (tab)))
+    {
+      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tab)))
+        gtk_widget_grab_focus (widget);
+    }
+}
+
+static void
 pnl_tab_strip_stack_add (PnlTabStrip *self,
                          GtkWidget   *widget,
                          GtkStack    *stack)
@@ -329,6 +345,12 @@ pnl_tab_strip_stack_add (PnlTabStrip *self,
 
   g_object_set_data (G_OBJECT (widget), "PNL_TAB", tab);
 
+  g_signal_connect_object (tab,
+                           "clicked",
+                           G_CALLBACK (pnl_tab_strip_tab_clicked),
+                           self,
+                           G_CONNECT_SWAPPED | G_CONNECT_AFTER);
+
   g_signal_connect_object (widget,
                            "child-notify::position",
                            G_CALLBACK (pnl_tab_strip_child_position_changed),


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