summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/tab-chrome.c17
-rw-r--r--src/window.c15
2 files changed, 18 insertions, 14 deletions
diff --git a/src/tab-chrome.c b/src/tab-chrome.c
index 35e9426..e137ed9 100644
--- a/src/tab-chrome.c
+++ b/src/tab-chrome.c
@@ -71,6 +71,9 @@ MqTabChrome *
mq_tab_chrome_new(gchar *uri, GtkNotebook *notebook, GtkWidget *notebook_child)
{
MqTabChrome *chrome;
+ GtkWidget *tab_label;
+ GtkWidget *tab_label_image;
+ GtkWidget *tab_label_label;
chrome = malloc(sizeof(*chrome));
@@ -78,6 +81,20 @@ mq_tab_chrome_new(gchar *uri, GtkNotebook *notebook, GtkWidget *notebook_child)
gtk_grid_attach(GTK_GRID(chrome->container),
navigation_toolbar_new(chrome, uri), 0, 0, 1, 1);
+ /* FIXME: Doesn't work, because notebook_child hasn't been inserted into
+ * notebook yet at this point. */
+ tab_label = gtk_grid_new();
+ tab_label_image = gtk_image_new_from_icon_name("text-x-generic",
+ GTK_ICON_SIZE_BUTTON);
+ gtk_grid_attach(GTK_GRID(tab_label), tab_label_image,
+ 0, 0, 1, 1);
+ tab_label_label = gtk_label_new("New tab");
+ gtk_grid_attach(GTK_GRID(tab_label), tab_label_label,
+ 1, 0, 1, 1);
+ gtk_widget_show_all(tab_label);
+
+ gtk_notebook_set_tab_label(notebook, notebook_child, tab_label);
+
return chrome;
}
diff --git a/src/window.c b/src/window.c
index 609c32b..2cecc0d 100644
--- a/src/window.c
+++ b/src/window.c
@@ -29,27 +29,14 @@
static void
add_tab(MqWindow *window, gchar *uri, gint position)
{
- GtkWidget *tab_label;
- GtkWidget *tab_label_image;
- GtkWidget *tab_label_label;
MqTab *tab;
GtkWidget *tab_widget;
- tab_label = gtk_grid_new();
- tab_label_image = gtk_image_new_from_icon_name("text-x-generic",
- GTK_ICON_SIZE_BUTTON);
- gtk_grid_attach(GTK_GRID(tab_label), tab_label_image,
- 0, 0, 1, 1);
- tab_label_label = gtk_label_new("New tab");
- gtk_grid_attach(GTK_GRID(tab_label), tab_label_label,
- 1, 0, 1, 1);
- gtk_widget_show_all(tab_label);
-
tab = mq_tab_new(uri, GTK_NOTEBOOK(window->notebook));
tab_widget = mq_tab_get_container(tab);
position = gtk_notebook_insert_page(GTK_NOTEBOOK(window->notebook),
- tab_widget, tab_label, position);
+ tab_widget, NULL, position);
gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(window->notebook),
tab_widget, TRUE);
gtk_notebook_set_tab_detachable(GTK_NOTEBOOK(window->notebook),