summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tab.c11
-rw-r--r--src/tab.h18
2 files changed, 16 insertions, 13 deletions
diff --git a/src/tab.c b/src/tab.c
index b580b41..b24315e 100644
--- a/src/tab.c
+++ b/src/tab.c
@@ -140,10 +140,11 @@ mq_tab_populate_tab(MqTab *tab)
{
GtkWidget *box;
+ tab->title = "New tab";
tab->tab_image = gtk_image_new_from_icon_name("text-x-generic",
GTK_ICON_SIZE_BUTTON);
- tab->tab_label = gtk_label_new("New tab");
+ tab->tab_label = gtk_label_new(NULL);
gtk_label_set_ellipsize(GTK_LABEL(tab->tab_label),
PANGO_ELLIPSIZE_END);
gtk_widget_set_hexpand(tab->tab_label, TRUE);
@@ -167,22 +168,21 @@ mq_tab_populate_tab(MqTab *tab)
static void
update_tab_image(MqTab *tab)
{
- gtk_image_set_from_surface(GTK_IMAGE(tab->tab_image),
- webkit_web_view_get_favicon(tab->web_view));
+ gtk_image_set_from_surface(GTK_IMAGE(tab->tab_image), tab->favicon);
}
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)));
+ g_strdup_printf("%d. %s", tab->tab_position + 1, tab->title));
}
static void
favicon_cb(WebKitWebView __attribute__((unused)) *web_view,
GParamSpec __attribute__((unused)) *paramspec, MqTab *tab)
{
+ tab->favicon = webkit_web_view_get_favicon(tab->web_view);
update_tab_image(tab);
}
@@ -190,6 +190,7 @@ static void
title_cb(WebKitWebView __attribute__((unused)) *web_view,
GParamSpec __attribute__((unused)) *paramspec, MqTab *tab)
{
+ tab->title = webkit_web_view_get_title(tab->web_view);
update_tab_label(tab);
}
diff --git a/src/tab.h b/src/tab.h
index b125cd9..3361acc 100644
--- a/src/tab.h
+++ b/src/tab.h
@@ -28,14 +28,16 @@
#include "tab-body.h"
typedef struct {
- GtkWidget *container;
- MqTabChrome *chrome;
- MqTabBody *body;
- GtkWidget *tab;
- GtkWidget *tab_image;
- GtkWidget *tab_label;
- guint tab_position;
- WebKitWebView *web_view;
+ GtkWidget *container;
+ MqTabChrome *chrome;
+ MqTabBody *body;
+ GtkWidget *tab;
+ GtkWidget *tab_image;
+ GtkWidget *tab_label;
+ cairo_surface_t *favicon;
+ const gchar *title;
+ guint tab_position;
+ WebKitWebView *web_view;
} MqTab;
MqTab *