summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-09-22 01:51:34 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-09-22 01:51:34 (EDT)
commit1322d264cc0949fe99abf30e94807940926320b3 (patch)
treea96eb4683dec7a76710341303aff2132f38e2850
parent49d13c03c084678329f5aa4411d9775b01a70fd1 (diff)
downloadmarquee-1322d264cc0949fe99abf30e94807940926320b3.zip
marquee-1322d264cc0949fe99abf30e94807940926320b3.tar.gz
marquee-1322d264cc0949fe99abf30e94807940926320b3.tar.bz2
MqTab: Make tab list scrollable
-rw-r--r--src/tab.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/tab.c b/src/tab.c
index 8667b22..978d0d5 100644
--- a/src/tab.c
+++ b/src/tab.c
@@ -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;
}