summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-09-17 02:21:54 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-09-17 02:21:54 (EDT)
commitaee614a8e32325e217970c81cc0e9a3dcd6a4b83 (patch)
tree9047ae2f2cbb14575499577639d388568ddf930e
parent55c42fbcaf1c054db61da503aa6fe773cbd0f28a (diff)
downloadmarquee-aee614a8e32325e217970c81cc0e9a3dcd6a4b83.zip
marquee-aee614a8e32325e217970c81cc0e9a3dcd6a4b83.tar.gz
marquee-aee614a8e32325e217970c81cc0e9a3dcd6a4b83.tar.bz2
Revert add_tab() and pass label widgets instead
-rw-r--r--src/tab-chrome.c19
-rw-r--r--src/tab-chrome.h2
-rw-r--r--src/tab.c7
-rw-r--r--src/tab.h2
-rw-r--r--src/window.c17
5 files changed, 21 insertions, 26 deletions
diff --git a/src/tab-chrome.c b/src/tab-chrome.c
index e137ed9..ac48c1a 100644
--- a/src/tab-chrome.c
+++ b/src/tab-chrome.c
@@ -68,12 +68,9 @@ navigation_toolbar_new(MqTabChrome *chrome, gchar *uri)
}
MqTabChrome *
-mq_tab_chrome_new(gchar *uri, GtkNotebook *notebook, GtkWidget *notebook_child)
+mq_tab_chrome_new(gchar *uri, GtkWidget *tab_image, GtkWidget *tab_label)
{
MqTabChrome *chrome;
- GtkWidget *tab_label;
- GtkWidget *tab_label_image;
- GtkWidget *tab_label_label;
chrome = malloc(sizeof(*chrome));
@@ -81,20 +78,6 @@ 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/tab-chrome.h b/src/tab-chrome.h
index 2dec778..cea26d9 100644
--- a/src/tab-chrome.h
+++ b/src/tab-chrome.h
@@ -32,7 +32,7 @@ typedef struct {
} MqTabChrome;
MqTabChrome *
-mq_tab_chrome_new(gchar *uri, GtkNotebook *notebook, GtkWidget *notebook_child);
+mq_tab_chrome_new(gchar *uri, GtkWidget *tab_image, GtkWidget *tab_label);
GtkWidget *
mq_tab_chrome_get_container(MqTabChrome *chrome);
diff --git a/src/tab.c b/src/tab.c
index 52e0c2c..0f8d298 100644
--- a/src/tab.c
+++ b/src/tab.c
@@ -28,18 +28,17 @@
#include "tab-body.h"
MqTab *
-mq_tab_new(gchar *uri, GtkNotebook *notebook)
+mq_tab_new(gchar *uri, GtkWidget *tab_image, GtkWidget *tab_label)
{
MqTab *tab;
tab = malloc(sizeof(*tab));
- tab->container = gtk_grid_new();
-
- tab->chrome = mq_tab_chrome_new(uri, notebook, tab->container);
+ tab->chrome = mq_tab_chrome_new(uri, tab_image, tab_label);
tab->body = mq_tab_body_new(uri);
mq_tab_chrome_set_web_view(tab->chrome,
mq_tab_body_get_web_view(tab->body));
+ tab->container = gtk_grid_new();
gtk_grid_attach(GTK_GRID(tab->container),
mq_tab_chrome_get_container(tab->chrome),
0, 0, 1, 1);
diff --git a/src/tab.h b/src/tab.h
index 469fb38..5eeda0d 100644
--- a/src/tab.h
+++ b/src/tab.h
@@ -34,7 +34,7 @@ typedef struct {
} MqTab;
MqTab *
-mq_tab_new(gchar *uri, GtkNotebook *notebook);
+mq_tab_new(gchar *uri, GtkWidget *tab_image, GtkWidget *tab_label);
GtkWidget *
mq_tab_get_container(MqTab *tab);
diff --git a/src/window.c b/src/window.c
index 2cecc0d..770d59d 100644
--- a/src/window.c
+++ b/src/window.c
@@ -29,14 +29,27 @@
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 = mq_tab_new(uri, GTK_NOTEBOOK(window->notebook));
+ 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, tab_label_image, tab_label_label);
tab_widget = mq_tab_get_container(tab);
position = gtk_notebook_insert_page(GTK_NOTEBOOK(window->notebook),
- tab_widget, NULL, position);
+ tab_widget, tab_label, position);
gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(window->notebook),
tab_widget, TRUE);
gtk_notebook_set_tab_detachable(GTK_NOTEBOOK(window->notebook),