aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormutantturkey <crazycal00@gmail.com>2010-06-12 20:47:18 -0400
committermutantturkey <crazycal00@gmail.com>2010-06-12 20:47:18 -0400
commit4723f3387119587816a81e1bb0ca7c2b47bde73f (patch)
tree8169a63273ccf26442e628a8040e757d7acd9385
parente24d3aa30433033b4a396b831ed5d636b20c9a87 (diff)
now the title is only updated if the its on the right tab
-rw-r--r--sb.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/sb.c b/sb.c
index 02b05ca..18f01d7 100644
--- a/sb.c
+++ b/sb.c
@@ -96,16 +96,19 @@ else { gtk_statusbar_push(GTK_STATUSBAR(w.status), 0, ""); }
static void title_change_cb(WebKitWebView *v, WebKitWebFrame *f, const char *title, tab *t) {
gchar *tabtitle;
-if(strlen(title) < settings.tab_length) { tabtitle = g_strdup(title); }
+
+if (gtk_notebook_get_current_page(GTK_NOTEBOOK(w.notebook)) == gtk_notebook_page_num(GTK_NOTEBOOK(w.notebook), t->scroll)) {
+gtk_window_set_title(GTK_WINDOW(w.win), title);
+}
+
+if(strlen(title) < settings.tab_length ) { tabtitle = g_strdup(title); }
else {
tabtitle = g_strndup(title, settings.tab_length);
strcat(tabtitle, "...");
-
- }
-
-gtk_window_set_title(GTK_WINDOW(w.win), title);
gtk_label_set_label(GTK_LABEL(t->label), tabtitle);
}
+}
+
static void load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data) {
const gchar* uri = webkit_web_frame_get_uri(frame);
@@ -192,9 +195,13 @@ webkit_web_view_reload(t->view);
static void tab_new() {
tab *t;
t = g_new0(tab, 1);
+
t->scroll = gtk_scrolled_window_new(NULL, NULL);
t->view = WEBKIT_WEB_VIEW(webkit_web_view_new ());
t->label = gtk_label_new("new tab");
+
+
+/*reset status bar*/
gtk_statusbar_push(GTK_STATUSBAR(w.status), 0, "");
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(t->scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
@@ -244,7 +251,6 @@ static void tab_focus(GtkNotebook *notebook, GtkNotebookPage *page, guint page_n
gtk_statusbar_push(GTK_STATUSBAR(w.status), 0, "");
struct tab *t = get_tab(NULL, page_num);
const char *url = webkit_web_view_get_uri(t->view);
-
const char *title = webkit_web_view_get_title(t->view);
if (title == NULL && url == NULL) {
title = "sb";