summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-09-21 23:41:33 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-09-21 23:41:33 (EDT)
commit79fe0321de8239e6f7f366943e902df4c8394d21 (patch)
treea8b7e8301cbb062828eb913ef76785a87150d000 /src
parent6b7d8cab5abba7e15c69b94e14ed290e02d77e33 (diff)
downloadmarquee-79fe0321de8239e6f7f366943e902df4c8394d21.zip
marquee-79fe0321de8239e6f7f366943e902df4c8394d21.tar.gz
marquee-79fe0321de8239e6f7f366943e902df4c8394d21.tar.bz2
Move tab label callbacks from MqTabChrome to MqTab
Diffstat (limited to 'src')
-rw-r--r--src/tab-chrome.c24
-rw-r--r--src/tab.c19
2 files changed, 18 insertions, 25 deletions
diff --git a/src/tab-chrome.c b/src/tab-chrome.c
index 316c674..fda480f 100644
--- a/src/tab-chrome.c
+++ b/src/tab-chrome.c
@@ -480,21 +480,6 @@ update_tab_image(MqTabChrome *chrome)
}
static void
-update_tab_label(MqTabChrome *chrome)
-{
- gtk_label_set_text(GTK_LABEL(chrome->tab_label),
- g_strdup_printf("%d. %s", chrome->tab_position + 1,
- webkit_web_view_get_title(chrome->web_view)));
-}
-
-void
-mq_tab_chrome_update_tab_position(MqTabChrome *chrome, guint position)
-{
- chrome->tab_position = position;
- update_tab_label(chrome);
-}
-
-static void
load_changed_cb(WebKitWebView *web_view, WebKitLoadEvent load_event,
MqTabChrome *chrome)
{
@@ -600,13 +585,6 @@ favicon_cb(WebKitWebView __attribute__((unused)) *web_view,
}
static void
-title_cb(WebKitWebView __attribute__((unused)) *web_view,
- GParamSpec __attribute__((unused)) *paramspec, MqTabChrome *chrome)
-{
- update_tab_label(chrome);
-}
-
-static void
loading_cb(WebKitWebView *web_view,
GParamSpec __attribute__((unused)) *paramspec, MqTabChrome *chrome)
{
@@ -648,8 +626,6 @@ connect_web_view(MqTabChrome *chrome)
/* FIXME: Doesn't work? */
g_signal_connect(chrome->web_view, "notify::favicon",
G_CALLBACK(favicon_cb), chrome);
- g_signal_connect(chrome->web_view, "notify::title",
- G_CALLBACK(title_cb), chrome);
g_signal_connect(chrome->web_view, "notify::is-loading",
G_CALLBACK(loading_cb), chrome);
}
diff --git a/src/tab.c b/src/tab.c
index 12efad2..72de9e9 100644
--- a/src/tab.c
+++ b/src/tab.c
@@ -27,6 +27,21 @@
#include "tab-chrome.h"
#include "tab-body.h"
+static void
+update_tab_label(MqTab *tab)
+{
+ gtk_label_set_text(GTK_LABEL(tab->tab_label),
+ g_strdup_printf("%d. %s", tab->tab_position + 1,
+ webkit_web_view_get_title(tab->web_view)));
+}
+
+static void
+title_cb(WebKitWebView __attribute__((unused)) *web_view,
+ GParamSpec __attribute__((unused)) *paramspec, MqTab *tab)
+{
+ update_tab_label(tab);
+}
+
MqTab *
mq_tab_new(gchar *uri, GtkWidget *tab_image, GtkWidget *tab_label)
{
@@ -38,6 +53,8 @@ mq_tab_new(gchar *uri, GtkWidget *tab_image, GtkWidget *tab_label)
tab->chrome = mq_tab_chrome_new(uri, tab_image, tab_label);
tab->body = mq_tab_body_new(uri);
tab->web_view = mq_tab_body_get_web_view(tab->body);
+ g_signal_connect(tab->web_view, "notify::title", G_CALLBACK(title_cb),
+ tab);
mq_tab_chrome_set_web_view(tab->chrome, tab->web_view);
tab->container = gtk_grid_new();
@@ -61,5 +78,5 @@ void
mq_tab_update_position(MqTab *tab, guint position)
{
tab->tab_position = position;
- mq_tab_chrome_update_tab_position(tab->chrome, position);
+ update_tab_label(tab);
}