#define FEATURE_HISTORY_INDICATOR
/* show wget style progressbar in status bar */
#define FEATURE_WGET_PROGRESS_BAR
+/* show load progress in window title */
+#define FEATURE_TITLE_PROGRESS
+/* show page title in url completions */
+#define FEATURE_TITLE_IN_COMPLETION
+
#ifdef FEATURE_WGET_PROGRESS_BAR
/* chars to use for the progressbar */
-#define PROGRESS_BAR "=> "
+#define PROGRESS_BAR "=> "
#define PROGRESS_BAR_LEN 20
#endif
-/* show page title in url completions */
-#define FEATURE_TITLE_IN_COMPLETION
/* time in seconds after that message will be removed from inputbox if the
* message where only temporary */
static void on_window_destroy(GtkWidget *window, Client *c);
static gboolean quit(Client *c);
static void register_cleanup(Client *c);
+static void update_title(Client *c);
static void update_urlbar(Client *c);
static void set_statusbar_style(Client *c, StatusType type);
static void set_title(Client *c, const char *title);
*/
static void set_title(Client *c, const char *title)
{
- gtk_window_set_title(GTK_WINDOW(c->window), title);
+ OVERWRITE_STRING(c->state.title, title);
+ update_title(c);
+ g_setenv("VIMB_TITLE", title ? title : "", true);
}
/**
{
c->state.progress = webkit_web_view_get_estimated_load_progress(webview) * 100;
vb_statusbar_update(c);
+ update_title(c);
}
/**
}
}
+static void update_title(Client *c)
+{
+#ifdef FEATURE_TITLE_PROGRESS
+ /* Show load status of page or the downloads. */
+ if (c->state.progress != 100) {
+ char *title = g_strdup_printf(
+ "[%i%%] %s",
+ c->state.progress,
+ c->state.title ? c->state.title : "");
+ gtk_window_set_title(GTK_WINDOW(c->window), title);
+ g_free(title);
+
+ return;
+ }
+#endif
+ if (c->state.title) {
+ gtk_window_set_title(GTK_WINDOW(c->window), c->state.title);
+ }
+}
+
/**
* Update the contents of the url bar on the left of the statu bar according
* to current opened url and position in back forward history.
StatusType status_type;
glong scroll_max; /* Maxmimum scrollable height of the document. */
guint scroll_percent; /* Current position of the viewport in document. */
+ char *title; /* Window title of the client. */
char *reg[REG_SIZE]; /* holds the yank buffers */
/* TODO rename to reg_{enabled,current} */