diff options
-rw-r--r-- | src/tab.c | 22 |
1 files changed, 19 insertions, 3 deletions
@@ -69,6 +69,7 @@ tab_label_button_press_cb(GtkWidget *widget, GdkEvent *event, MqTab *tab) GtkWidget *buttons[BUTTON_ROWS * BUTTON_COLS]; GtkWidget *box; GtkWidget *tab_list; + GtkWidget *tab_list_scrolled_window; GtkWidget *popover; /* TODO: Add to MqWindow */ /* Make sure this is a right mouse button press event. */ @@ -96,11 +97,26 @@ tab_label_button_press_cb(GtkWidget *widget, GdkEvent *event, MqTab *tab) /* Set up the tab list. */ tab_list = gtk_label_new("Tab list"); - gtk_box_pack_start(GTK_BOX(box), tab_list, + + /* Set up the tab list scrolled window. + * + * The following GtkScrolledWindow widget has a hardcoded minimum size, + * because there seems to be (in GTK+ versions before 3.22) no way to + * set the natural size of GtkScrolledWindow and its GtkViewport. + * + * See tab-chrome.c for more information. */ + tab_list_scrolled_window = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_min_content_width( + GTK_SCROLLED_WINDOW(tab_list_scrolled_window), 400); + gtk_scrolled_window_set_min_content_height( + GTK_SCROLLED_WINDOW(tab_list_scrolled_window), 200); + gtk_container_add(GTK_CONTAINER(tab_list_scrolled_window), tab_list); + gtk_box_pack_start(GTK_BOX(box), tab_list_scrolled_window, TRUE, FALSE, 0); g_signal_connect(buttons[1 * BUTTON_COLS + 3], "toggled", - G_CALLBACK(tab_list_button_toggled_cb), tab_list); + G_CALLBACK(tab_list_button_toggled_cb), + tab_list_scrolled_window); /* Set up the popover. */ popover = gtk_popover_new(widget); @@ -108,7 +124,7 @@ tab_label_button_press_cb(GtkWidget *widget, GdkEvent *event, MqTab *tab) /* NB: gtk_popover_popup() is new in GTK+ 3.22. */ gtk_widget_show_all(popover); - gtk_widget_hide(tab_list); + gtk_widget_hide(tab_list_scrolled_window); return FALSE; } |