static gboolean button_tablabel(GtkWidget *, GdkEvent *, gpointer);
static void client_destroy(GtkWidget *, gpointer);
-static WebKitWebView *client_new(const gchar *, WebKitWebView *, gboolean);
+static WebKitWebView *client_new(const gchar *, WebKitWebView *, gboolean,
+ gboolean);
static WebKitWebView *client_new_request(WebKitWebView *, WebKitNavigationAction *,
gpointer);
static void cooperation_setup(void);
GtkWidget *tablabel;
GtkWidget *vbox;
GtkWidget *web_view;
+ gboolean focus_new_tab;
};
struct MainWindow
}
WebKitWebView *
-client_new(const gchar *uri, WebKitWebView *related_wv, gboolean show)
+client_new(const gchar *uri, WebKitWebView *related_wv, gboolean show,
+ gboolean focus_tab)
{
struct Client *c;
WebKitWebContext *wc;
exit(EXIT_FAILURE);
}
+ c->focus_new_tab = focus_tab;
+
if (related_wv == NULL)
c->web_view = webkit_web_view_new();
else
* not part of the normal "widget tree" (IIUC). */
gtk_widget_show_all(evbox);
- gtk_notebook_append_page(GTK_NOTEBOOK(mw.notebook), c->vbox, evbox);
+ gtk_notebook_insert_page(GTK_NOTEBOOK(mw.notebook), c->vbox, evbox,
+ gtk_notebook_get_current_page(GTK_NOTEBOOK(mw.notebook)) + 1);
gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(mw.notebook), c->vbox, TRUE);
if (show)
client_new_request(WebKitWebView *web_view,
WebKitNavigationAction *navigation_action, gpointer data)
{
- return client_new(NULL, web_view, FALSE);
+ return client_new(NULL, web_view, FALSE, FALSE);
}
void
return TRUE;
case GDK_KEY_e: /* new tab (left hand) */
f = ensure_uri_scheme(home_uri);
- client_new(f, NULL, TRUE);
+ client_new(f, NULL, TRUE, TRUE);
g_free(f);
return TRUE;
case GDK_KEY_r: /* reload (left hand) */
case 2:
if (c->hover_uri != NULL)
{
- client_new(c->hover_uri, NULL, TRUE);
+ client_new(c->hover_uri, NULL, TRUE, FALSE);
return TRUE;
}
break;
if (uri)
{
g_strstrip(uri);
- client_new(uri, NULL, TRUE);
+ client_new(uri, NULL, TRUE, FALSE);
g_free(uri);
}
return TRUE;
gtk_widget_show_all(mw.win);
- idx = gtk_notebook_page_num(GTK_NOTEBOOK(mw.notebook), c->vbox);
- if (idx != -1)
- gtk_notebook_set_current_page(GTK_NOTEBOOK(mw.notebook), idx);
+ if (c->focus_new_tab)
+ {
+ idx = gtk_notebook_page_num(GTK_NOTEBOOK(mw.notebook), c->vbox);
+ if (idx != -1)
+ gtk_notebook_set_current_page(GTK_NOTEBOOK(mw.notebook), idx);
- gtk_widget_grab_focus(c->web_view);
+ gtk_widget_grab_focus(c->web_view);
+ }
}
void
}
if (optind >= argc)
- client_new(home_uri, NULL, TRUE);
+ client_new(home_uri, NULL, TRUE, TRUE);
else
{
for (i = optind; i < argc; i++)
- client_new(argv[i], NULL, TRUE);
+ client_new(argv[i], NULL, TRUE, TRUE);
}
if (!cooperative_instances || cooperative_alone)