summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/window.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/window.c b/src/window.c
index 0b1b634..c1b3db7 100644
--- a/src/window.c
+++ b/src/window.c
@@ -37,6 +37,17 @@ tab_list_button_clicked_cb(GtkButton __attribute__((unused)) *button,
gtk_widget_hide(gtk_stack_get_child_by_name(stack, "buttons"));
}
+static void
+tab_list_back_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, "buttons"));
+ gtk_widget_hide(gtk_stack_get_child_by_name(stack, "tab_list"));
+}
+
#define NEW_BUTTON(BOX, I, NAME, TOOLTIP) \
do { \
buttons[I] = gtk_button_new_from_icon_name(NAME, \
@@ -53,8 +64,9 @@ tab_label_button_press_cb(GtkWidget *widget, GdkEvent *event, MqTab *tab)
{
GtkWidget *current_tab_button_box;
GtkWidget *all_tabs_button_box;
- GtkWidget *buttons[7];
+ GtkWidget *buttons[8];
GtkWidget *button_rows_box;
+ GtkWidget *tab_list_box;
GtkWidget *stack;
GtkWidget *popover; /* TODO: Add to MqWindow */
@@ -85,14 +97,29 @@ tab_label_button_press_cb(GtkWidget *widget, GdkEvent *event, MqTab *tab)
gtk_box_pack_start(GTK_BOX(button_rows_box), all_tabs_button_box,
TRUE, FALSE, 0);
+ /* Set up tab list box. */
+ tab_list_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+
+ /* Set up tab list back button. */
+ buttons[7] = gtk_button_new_from_icon_name("go-previous-symbolic",
+ GTK_ICON_SIZE_BUTTON);
+ gtk_widget_set_tooltip_text(buttons[7], "Back");
+ gtk_widget_set_can_focus(buttons[7], FALSE);
+ gtk_widget_set_halign(buttons[7], GTK_ALIGN_START);
+ gtk_box_pack_start(GTK_BOX(tab_list_box), buttons[7], TRUE, FALSE, 0);
+
+ gtk_box_pack_start(GTK_BOX(tab_list_box), gtk_label_new("Tab list"),
+ TRUE, FALSE, 0);
+
/* Set up the stack. */
stack = gtk_stack_new();
gtk_stack_add_named(GTK_STACK(stack), button_rows_box, "buttons");
- gtk_stack_add_named(GTK_STACK(stack), gtk_label_new("Tab list"),
- "tab_list");
+ gtk_stack_add_named(GTK_STACK(stack), tab_list_box, "tab_list");
g_signal_connect(buttons[6], "clicked",
G_CALLBACK(tab_list_button_clicked_cb), GTK_STACK(stack));
+ g_signal_connect(buttons[7], "clicked",
+ G_CALLBACK(tab_list_back_button_clicked_cb), GTK_STACK(stack));
/* Set up the popover. */
popover = gtk_popover_new(widget);