diff options
author | portix <portix@gmx.net> | 2011-02-08 17:57:55 +0100 |
---|---|---|
committer | portix <portix@gmx.net> | 2011-02-08 17:57:55 +0100 |
commit | 06f034bc7c32a08b02670f844390da3c487ae01d (patch) | |
tree | 11b88272a3e56407349d4a5a19b8d580697f9445 /src | |
parent | 5c21ffc44deb591f250c3fe008b0f757ea0acdf0 (diff) | |
download | dwb-06f034bc7c32a08b02670f844390da3c487ae01d.zip |
new property: background-tabs
Diffstat (limited to 'src')
-rw-r--r-- | src/dwb.c | 9 | ||||
-rw-r--r-- | src/session.c | 2 | ||||
-rw-r--r-- | src/view.c | 40 |
3 files changed, 13 insertions, 38 deletions
@@ -661,7 +661,6 @@ dwb_history_back() { if (g_str_has_prefix(uri, "file://")) { Arg a = { .p = uri, .b = false }; webkit_web_back_forward_list_go_to_item(bf_list, item); - // TODO background dwb_load_uri(NULL, &a); } else { @@ -681,7 +680,6 @@ dwb_history_forward() { if (g_str_has_prefix(uri, "file://")) { Arg a = { .p = uri, .b = false }; webkit_web_back_forward_list_go_to_item(bf_list, item); - // TODO background dwb_load_uri(NULL, &a); } else { @@ -1250,7 +1248,6 @@ dwb_open_quickmark(const char *key) { Quickmark *q = l->data; if (!strcmp(key, q->key)) { Arg a = { .p = q->nav->first, .b = true }; - // TODO background dwb_load_uri(NULL, &a); dwb_set_normal_message(dwb.state.fview, true, "Loading quickmark %s: %s", key, q->nav->first); dwb_normal_mode(false); @@ -1366,7 +1363,6 @@ dwb_load_uri(GList *gl, Arg *arg) { /* new tab ? */ else if (dwb.state.nv == OPEN_NEW_VIEW) { dwb.state.nv = OPEN_NORMAL; - // TODO dwb_add_view background dwb_add_view(arg, false); return; } @@ -1793,7 +1789,7 @@ dwb_get_scripts() { GList *gl = NULL; Navigation *n = NULL; - // TODO get saved shorcuts + // TODO get saved shortcuts if ( (dir = g_dir_open(dwb.files.userscripts, 0, NULL)) ) { while ( (filename = (char*)g_dir_read_name(dir)) ) { char *path = g_build_filename(dwb.files.userscripts, filename, NULL); @@ -2484,6 +2480,7 @@ dwb_init_vars() { dwb.state.complete_searchengines = GET_BOOL("complete-searchengines"); dwb.state.complete_commands = GET_BOOL("complete-commands"); dwb.state.complete_userscripts = GET_BOOL("complete-userscripts"); + dwb.state.background_tabs = GET_BOOL("background-tabs"); dwb.state.size = GET_INT("size"); dwb.state.layout = dwb_layout_from_char(GET_CHAR("layout")); @@ -2540,12 +2537,10 @@ dwb_init() { else if (dwb.misc.argc > 0) { for (int i=0; i<dwb.misc.argc; i++) { Arg a = { .p = dwb.misc.argv[i] }; - // TODO dwb_add_view background dwb_add_view(&a, false); } } else { - // TODO dwb_add_view background dwb_add_view(NULL, false); } dwb_toggle_tabbar(); diff --git a/src/session.c b/src/session.c index b5ee2994..b9ee71c2 100644 --- a/src/session.c +++ b/src/session.c @@ -101,7 +101,6 @@ dwb_session_restore(const char *name) { if (line[0] && line[1] && line[2]) { int current = strtol(line[0], NULL, 10); if (current <= last) { - // TODO dwb_add_view background dwb_add_view(NULL, false); web = CURRENT_WEBVIEW(); bf_list = webkit_web_back_forward_list_new_with_web_view(web); @@ -124,7 +123,6 @@ dwb_session_restore(const char *name) { gtk_widget_show_all(dwb.gui.window); if (!dwb.state.views) - // TODO dwb_add_view background dwb_add_view(NULL, false); if (dwb.state.layout & MAXIMIZED && dwb.state.views) { @@ -68,13 +68,11 @@ dwb_web_view_button_press_cb(WebKitWebView *web, GdkEventButton *e, GList *gl) { g_strstrip(clipboard); Arg a = { .p = clipboard, .b = true }; if (e->button == 3) { - // TODO background dwb_load_uri(NULL, &a); ret = true; } else if (e->button == 2) { - // TODO background - dwb_add_view(&a, false); + dwb_add_view(&a, dwb.state.background_tabs); ret = true; } FREE(clipboard); @@ -125,14 +123,13 @@ static WebKitWebView * dwb_web_view_create_web_view_cb(WebKitWebView *web, WebKitWebFrame *frame, GList *gl) { if (dwb.misc.tabbed_browsing) { // TODO background - dwb_add_view(NULL, false); - return CURRENT_WEBVIEW(); + GList *gl = dwb_add_view(NULL, dwb.state.background_tabs); + return WEBVIEW(gl); } else { dwb.state.nv = OPEN_NEW_WINDOW; return web; } - // return ((View*)dwb.state.fview->data)->web; }/*}}}*/ /* dwb_web_view_plugin_blocker_button_cb (GtkWidget *, GdkEventButton, char *uri) {{{*/ @@ -249,8 +246,7 @@ dwb_web_view_navigation_policy_cb(WebKitWebView *web, WebKitWebFrame *frame, Web if (button != -1) { if (button == 2) { - // TODO background - dwb_add_view(&a, false); + dwb_add_view(&a, dwb.state.background_tabs); webkit_web_policy_decision_ignore(policy); return true; } @@ -258,8 +254,7 @@ dwb_web_view_navigation_policy_cb(WebKitWebView *web, WebKitWebFrame *frame, Web if (dwb.state.nv == OPEN_NEW_VIEW || dwb.state.nv == OPEN_NEW_WINDOW) { if (dwb.state.nv == OPEN_NEW_VIEW) { dwb.state.nv = OPEN_NORMAL; - // TODO background - dwb_add_view(&a, false); + dwb_add_view(&a, dwb.state.background_tabs); } else { dwb_new_window(&a); @@ -271,7 +266,6 @@ dwb_web_view_navigation_policy_cb(WebKitWebView *web, WebKitWebFrame *frame, Web const char *path; if (reason == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED && (path = dwb_check_directory(uri))) { - // TODO background dwb_load_uri(NULL, &a); webkit_web_policy_decision_ignore(policy); return true; @@ -512,7 +506,6 @@ dwb_view_entry_activate_cb(GtkEntry* entry) { } else { Arg a = { .n = 0, .p = (char*)GET_TEXT(), .b = true }; - // TODO background dwb_load_uri(NULL, &a); dwb_prepend_navigation_with_argument(&dwb.fc.commands, a.p, NULL); dwb_normal_mode(true); @@ -805,7 +798,6 @@ dwb_view_push_master(Arg *arg) { gtk_widget_hide(old->vbox); } gtk_box_reorder_child(GTK_BOX(dwb.gui.topbox), new->tabevent, -1); - // TODO background dwb_update_layout(false); return true; }/*}}}*/ @@ -873,7 +865,6 @@ dwb_view_remove() { gtk_widget_hide(dwb.gui.left); } } - // TODO background dwb_update_layout(false); }/*}}}*/ @@ -899,19 +890,12 @@ dwb_view_new_reorder(gboolean background) { /* dwb_add_view(Arg *arg) return: View *{{{*/ GList * dwb_add_view(Arg *arg, gboolean background) { - GList *tmp = NULL; + GList *ret = NULL; - // TODO echter check - background = dwb.state.background_tabs; dwb_view_new_reorder(background); - // TODO dwb_add_view background - dwb.state.views = dwb_view_create_web_view(dwb.state.views, background); + dwb.state.views = ret = dwb_view_create_web_view(dwb.state.views, background); if (background) { - // TODO entry bekommt keinen fokus - // Schrift ist komisch klein - // Uebergabe von Argumenten an das neue view. - //tmp = g_list_last()<++> - + ret = g_list_last(dwb.state.views); } else { dwb_focus(dwb.state.views); @@ -920,15 +904,13 @@ dwb_add_view(Arg *arg, gboolean background) { dwb_update_layout(background); if (arg && arg->p) { arg->b = true; - // TODO background - dwb_load_uri(NULL, arg); + dwb_load_uri(ret, arg); } else if (strcmp("about:blank", dwb.misc.startpage)) { Arg a = { .p = dwb.misc.startpage, .b = true }; - // TODO background - dwb_load_uri(NULL, &a); + dwb_load_uri(ret, &a); } - return dwb.state.views; + return ret; } /*}}}*/ |