summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/window.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/window.c b/src/window.c
index e062ed3..0b1b634 100644
--- a/src/window.c
+++ b/src/window.c
@@ -26,6 +26,17 @@
#include "window.h"
#include "tab.h"
+static void
+tab_list_button_clicked_cb(GtkButton __attribute__((unused)) *button,
+ GtkStack *stack)
+{
+ /* Use gtk_widget_show() and gtk_widget_hide() instead of
+ * gtk_stack_set_visible_child() so that the stack fits the size of only
+ * the visible child. */
+ gtk_widget_show(gtk_stack_get_child_by_name(stack, "tab_list"));
+ gtk_widget_hide(gtk_stack_get_child_by_name(stack, "buttons"));
+}
+
#define NEW_BUTTON(BOX, I, NAME, TOOLTIP) \
do { \
buttons[I] = gtk_button_new_from_icon_name(NAME, \
@@ -80,6 +91,9 @@ tab_label_button_press_cb(GtkWidget *widget, GdkEvent *event, MqTab *tab)
gtk_stack_add_named(GTK_STACK(stack), gtk_label_new("Tab list"),
"tab_list");
+ g_signal_connect(buttons[6], "clicked",
+ G_CALLBACK(tab_list_button_clicked_cb), GTK_STACK(stack));
+
/* Set up the popover. */
popover = gtk_popover_new(widget);
gtk_container_add(GTK_CONTAINER(popover), stack);