diff options
-rw-r--r-- | src/commands.c | 67 | ||||
-rw-r--r-- | src/config.h | 16 | ||||
-rw-r--r-- | src/dwb.c | 158 | ||||
-rw-r--r-- | src/dwb.h | 21 | ||||
-rw-r--r-- | src/session.c | 7 | ||||
-rw-r--r-- | src/view.c | 102 |
6 files changed, 27 insertions, 344 deletions
diff --git a/src/commands.c b/src/commands.c index 68120943..aa9680b2 100644 --- a/src/commands.c +++ b/src/commands.c @@ -167,20 +167,6 @@ commands_search(KeyMap *km, Arg *arg) { return ret; } -/*commands_resize_master {{{*/ -DwbStatus -commands_resize_master(KeyMap *km, Arg *arg) { - DwbStatus ret = STATUS_OK; - int inc = dwb.state.nummod < 0 ? arg->n : dwb.state.nummod * arg->n; - int size = dwb.state.size + inc; - if (size > 90 || size < 10) { - size = size > 90 ? 90 : 10; - ret = STATUS_ERROR; - } - dwb_resize(size); - return ret; -}/*}}}*/ - /* commands_show_hints {{{*/ DwbStatus commands_show_hints(KeyMap *km, Arg *arg) { @@ -370,6 +356,7 @@ commands_set_zoom_level(KeyMap *km, Arg *arg) { }/*}}}*/ /* commands_set_orientation(KeyMap *km, Arg *arg) {{{*/ +#if 0 DwbStatus commands_set_orientation(KeyMap *km, Arg *arg) { Layout l; @@ -385,6 +372,7 @@ commands_set_orientation(KeyMap *km, Arg *arg) { dwb_resize(dwb.state.size); return STATUS_OK; }/*}}}*/ +#endif /* History {{{*/ DwbStatus @@ -417,59 +405,12 @@ commands_open_startpage(KeyMap *km, Arg *arg) { return dwb_open_startpage(NULL); } /*}}}*/ -/* commands_toggle_maximized {{{*/ -void -commands_maximized_hide(View *v, View *no) { - if (dwb.misc.factor != 1.0) { - webkit_web_view_set_zoom_level(WEBKIT_WEB_VIEW(v->web), 1.0); - } - if (v != dwb.state.fview->data) { - gtk_widget_hide(v->vbox); - } -} -void -commands_maximized_show(View *v) { - if (dwb.misc.factor != 1.0 && v != dwb.state.views->data) { - webkit_web_view_set_zoom_level(WEBKIT_WEB_VIEW(v->web), dwb.misc.factor); - } - gtk_widget_show(v->vbox); -} - -void -commands_toggle_maximized(KeyMap *km, Arg *arg) { - dwb.state.layout ^= MAXIMIZED; - if (dwb.state.layout & MAXIMIZED) { - g_list_foreach(dwb.state.views, (GFunc)commands_maximized_hide, NULL); - if (dwb.state.views == dwb.state.fview) { - gtk_widget_hide(dwb.gui.right); - } - else if (dwb.state.views->next) { - gtk_widget_hide(dwb.gui.left); - } - } - else { - if (dwb.state.views->next) { - gtk_widget_show(dwb.gui.right); - } - gtk_widget_show(dwb.gui.left); - g_list_foreach(dwb.state.views, (GFunc)commands_maximized_show, NULL); - } - dwb_resize(dwb.state.size); - dwb_toggle_tabbar(); -}/*}}}*/ - /* commands_remove_view(KeyMap *km, Arg *arg) {{{*/ void commands_remove_view(KeyMap *km, Arg *arg) { view_remove(NULL); }/*}}}*/ -/* commands_push_master {{{*/ -DwbStatus -commands_push_master(KeyMap *km, Arg *arg) { - return view_push_master(arg); -}/*}}}*/ - static gboolean commands_hide_tabbar(int *running) { if (! (dwb.state.bar_visible & BAR_VIS_TOP)) { @@ -904,9 +845,7 @@ commands_only(KeyMap *km, Arg *arg) { DwbStatus commands_toggle_bars(KeyMap *km, Arg *arg) { dwb.state.bar_visible ^= arg->n; - if (dwb.state.tabbar_visible != HIDE_TB_ALWAYS && (dwb.state.tabbar_visible == HIDE_TB_NEVER || (HIDE_TB_TILED && (dwb.state.layout & MAXIMIZED)))) { - gtk_widget_set_visible(dwb.gui.topbox, dwb.state.bar_visible & BAR_VIS_TOP); - } + gtk_widget_set_visible(dwb.gui.topbox, dwb.state.bar_visible & BAR_VIS_TOP); for (GList *l = dwb.state.views; l; l=l->next) { gtk_widget_set_visible(VIEW(l)->statusbox, dwb.state.bar_visible & BAR_VIS_STATUS); } diff --git a/src/config.h b/src/config.h index f87c0828..42df21ee 100644 --- a/src/config.h +++ b/src/config.h @@ -51,8 +51,6 @@ static KeyValue KEYS[] = { { "history_back_nw", { "wh", 0, }, }, { "history_forward_nw", { "wl", 0, }, }, { "insert_mode", { "i", 0, }, }, - { "increase_master", { "gl", 0, }, }, - { "decrease_master", { "gh", 0, }, }, { "open", { "o", 0, }, }, { "Open", { "go", 0, }, }, { "open_nv", { "O", 0, }, }, @@ -63,7 +61,6 @@ static KeyValue KEYS[] = { { "open_quickmark", { "b", 0, }, }, { "open_quickmark_nv", { "B", 0, }, }, { "open_quickmark_nw", { "wb", 0, }, }, - { "push_master", { "gp", 0, }, }, { "reload", { "r", 0, }, }, { "reload_bypass_cache", { "R", 0, }, }, { "remove_view", { "d", 0, }, }, @@ -82,7 +79,6 @@ static KeyValue KEYS[] = { { "show_settings", { "Ss", 0, }, }, { "stop_loading", { "s", GDK_CONTROL_MASK, }, }, { "toggle_bottomstack", { "tb", 0, }, }, - { "toggle_maximized", { "gm", 0, }, }, { "view_source", { "gf", 0, }, }, { "zoom_in", { "+", 0, }, }, { "zoom_normal", { "=", 0, }, }, @@ -201,8 +197,6 @@ static FunctionMap FMAP [] = { (Func)commands_new_window_or_view, NULL, NEVER_SM, { .n = OPEN_NEW_WINDOW }, }, { { "command_mode", "Enter command mode", }, 0, (Func)commands_command_mode, NULL, POST_SM, }, - { { "decrease_master", "Decrease master area", }, 1, - (Func)commands_resize_master, "Cannot decrease further", ALWAYS_SM, { .n = 5 } }, { { "find_backward", "Find backward ", }, CP_COMMANDLINE|CP_HAS_MODE, (Func)commands_find, NO_URL, NEVER_SM, { .b = false }, }, { { "find_forward", "Find forward ", }, CP_COMMANDLINE | CP_HAS_MODE, @@ -255,8 +249,6 @@ static FunctionMap FMAP [] = { (Func)commands_history, "Beginning of History", ALWAYS_SM, { .n = OPEN_NEW_WINDOW, .i = -1 } }, { { "history_forward_nw", "Go Forward", }, 1, (Func)commands_history, "End of History", ALWAYS_SM, { .n = OPEN_NEW_WINDOW, .i = 1 } }, - { { "increase_master", "Increase master area", }, 1, - (Func)commands_resize_master, "Cannot increase further", ALWAYS_SM, { .n = -5 } }, { { "insert_mode", "Insert Mode", }, CP_COMMANDLINE | CP_HAS_MODE, (Func)commands_insert_mode, NULL, POST_SM, }, { { "load_html", "Load html", }, 1, @@ -283,8 +275,6 @@ static FunctionMap FMAP [] = { (Func)commands_quickmark, NULL, NEVER_SM, { .n = QUICK_MARK_OPEN, .i=OPEN_NEW_WINDOW }, }, { { "open_start_page", "Open startpage", }, 1, (Func)commands_open_startpage, "No startpage set", ALWAYS_SM, }, - { { "push_master", "Push to master area", }, 1, - (Func)commands_push_master, "No other view", ALWAYS_SM, }, { { "quit", "Quit dwb", }, 1, (Func)commands_quit, NULL, ALWAYS_SM, }, { { "reload", "Reload current page", }, 1, @@ -329,10 +319,6 @@ static FunctionMap FMAP [] = { (Func)commands_show_keys, NULL, ALWAYS_SM, }, { { "show_settings", "Settings configuration", }, 1, (Func)commands_show_settings, NULL, ALWAYS_SM, }, - { { "toggle_bottomstack", "Toggle bottomstack", }, 1, - (Func)commands_set_orientation, NULL, ALWAYS_SM, }, - { { "toggle_maximized", "Toggle maximized", }, 1, - (Func)commands_toggle_maximized, NULL, ALWAYS_SM, }, { { "view_source", "View source", }, 1, (Func)commands_view_source, NULL, ALWAYS_SM, }, { { "zoom_in", "Zoom in", }, 1, @@ -619,8 +605,6 @@ static WebSettings DWB_SETTINGS[] = { SETTING_GLOBAL, COLOR_CHAR, { .p = "#7ac5cd" }, (S_Func) dwb_reload_layout, }, { { "tab-protected-color", "Color of the number in the tab", }, SETTING_GLOBAL, COLOR_CHAR, { .p = "#ff0000" }, (S_Func) dwb_reload_layout, }, - { { "hide-tabbar", "Whether to hide the tabbar (never, always, tiled)", }, - SETTING_GLOBAL, CHAR, { .p = "never" }, (S_Func) dwb_set_hide_tabbar, }, { { "tabbed-browsing", "Whether to enable tabbed browsing", }, SETTING_GLOBAL, BOOLEAN, { .b = true }, NULL, }, { { "tabbar-position", "Position of the tabbar", }, @@ -52,7 +52,6 @@ static void dwb_set_startpage(GList *, WebSettings *); static void dwb_set_message_delay(GList *, WebSettings *); static void dwb_set_history_length(GList *, WebSettings *); static void dwb_set_plugin_blocker(GList *, WebSettings *); -static void dwb_set_hide_tabbar(GList *, WebSettings *); static void dwb_set_sync_interval(GList *, WebSettings *); static void dwb_set_private_browsing(GList *, WebSettings *); static DwbStatus dwb_set_cookie_accept_policy(GList *, WebSettings *); @@ -63,8 +62,6 @@ static Navigation * dwb_get_search_completion_from_navigation(Navigation *); static gboolean dwb_sync_history(gpointer); static void dwb_save_key_value(const char *file, const char *key, const char *value); -static TabBarVisible dwb_eval_tabbar_visible(const char *arg); - static void dwb_reload_layout(GList *, WebSettings *); static char * dwb_test_userscript(const char *); @@ -145,13 +142,6 @@ dwb_set_cookie_accept_policy(GList *gl, WebSettings *s) { return STATUS_OK; }/*}}}*/ -/* dwb_set_hide_tabbar{{{*/ -static void -dwb_set_hide_tabbar(GList *gl, WebSettings *s) { - dwb.state.tabbar_visible = dwb_eval_tabbar_visible(s->arg.p); - dwb_toggle_tabbar(); -}/*}}}*/ - /* dwb_set_sync_interval{{{*/ static void dwb_set_sync_interval(GList *gl, WebSettings *s) { @@ -914,18 +904,8 @@ dwb_get_host(WebKitWebView *web) { void dwb_focus_view(GList *gl) { if (gl != dwb.state.fview) { - if (dwb.state.layout & MAXIMIZED) { - if (gl == dwb.state.views) { - gtk_widget_hide(dwb.gui.right); - gtk_widget_show(dwb.gui.left); - } - else { - gtk_widget_hide(dwb.gui.left); - gtk_widget_show(dwb.gui.right); - } - gtk_widget_show(((View *)gl->data)->vbox); - gtk_widget_hide(((View *)dwb.state.fview->data)->vbox); - } + gtk_widget_show(VIEW(gl)->vbox); + gtk_widget_hide(VIEW(dwb.state.fview)->vbox); dwb_unfocus(); dwb_focus(gl); } @@ -1026,39 +1006,6 @@ dwb_history_forward() { return dwb_history(&a); }/*}}}*/ -/* dwb_eval_tabbar_visible (const char *) {{{*/ -static TabBarVisible -dwb_eval_tabbar_visible(const char *arg) { - if (!strcasecmp(arg, "never")) { - return HIDE_TB_NEVER; - } - else if (!strcasecmp(arg, "always")) { - return HIDE_TB_ALWAYS; - } - else if (!strcasecmp(arg, "tiled")) { - return HIDE_TB_TILED; - } - return 0; -}/*}}}*/ - -/* dwb_toggle_tabbar() {{{*/ -void -dwb_toggle_tabbar(void) { - if (! (dwb.state.bar_visible & BAR_VIS_TOP)) - return; - gboolean visible = gtk_widget_get_visible(dwb.gui.topbox); - if (visible) { - if (dwb.state.tabbar_visible != HIDE_TB_NEVER && - (dwb.state.tabbar_visible == HIDE_TB_ALWAYS || (HIDE_TB_TILED && !(dwb.state.layout & MAXIMIZED)))) { - gtk_widget_hide(dwb.gui.topbox); - } - } - else if (dwb.state.tabbar_visible != HIDE_TB_ALWAYS && - (dwb.state.tabbar_visible == HIDE_TB_NEVER || (HIDE_TB_TILED && (dwb.state.layout & MAXIMIZED)))) { - gtk_widget_show(dwb.gui.topbox); - } -}/*}}}*/ - /* dwb_eval_completion_type {{{*/ CompletionType dwb_eval_completion_type(void) { @@ -1082,6 +1029,7 @@ dwb_clean_load_begin(GList *gl) { dwb_change_mode(NORMAL_MODE, true); } }/*}}}*/ + /* dwb_clean_load_end(GList *) {{{*/ void dwb_clean_load_end(GList *gl) { @@ -1250,16 +1198,6 @@ dwb_spawn(GList *gl, const char *prop, const char *uri) { } }/*}}}*/ -/* dwb_resize(double size) {{{*/ -void -dwb_resize(double size) { - int fact = dwb.state.layout & BOTTOM_STACK; - - gtk_widget_set_size_request(dwb.gui.left, (100 - size) * (fact^1), (100 - size) * fact); - gtk_widget_set_size_request(dwb.gui.right, size * (fact^1), size * fact); - dwb.state.size = size; -}/*}}}*/ - /* dwb_reload_layout(GList *, WebSettings *s) {{{*/ static void dwb_reload_layout(GList *gl, WebSettings *s) { @@ -1373,31 +1311,6 @@ dwb_save_searchengine(void) { g_free(text); }/*}}}*/ -/* dwb_layout_from_char {{{*/ -static Layout -dwb_layout_from_char(const char *desc) { - char **token = g_strsplit(desc, " ", 0); - int i=0; - Layout layout = 0; - while (token[i]) { - if (!(layout & BOTTOM_STACK) && !g_ascii_strcasecmp(token[i], "normal")) { - layout |= NORMAL_LAYOUT; - } - else if (!(layout & NORMAL_LAYOUT) && !g_ascii_strcasecmp(token[i], "bottomstack")) { - layout |= BOTTOM_STACK; - } - else if (!g_ascii_strcasecmp(token[i], "maximized")) { - layout |= MAXIMIZED; - } - else { - layout = NORMAL_LAYOUT; - } - i++; - } - g_strfreev(token); - return layout; -}/*}}}*/ - /* dwb_evaluate_hints(const char *buffer) return DwbStatus {{{*/ DwbStatus dwb_evaluate_hints(const char *buffer) { @@ -1576,7 +1489,6 @@ dwb_confirm_snooper_cb(GtkWidget *w, GdkEventKey *e, int *state) { return true; }/*}}}*/ - /* dwb_confirm() return confirmed (gboolean) {{{ * yes / no confirmation * */ @@ -1866,40 +1778,6 @@ dwb_load_uri(GList *gl, const char *arg) { FREE(uri); }/*}}}*/ -/* dwb_update_layout() {{{*/ -void -dwb_update_layout(gboolean background) { - gboolean visible = gtk_widget_get_visible(dwb.gui.right); - WebKitWebView *w; - - if (! (dwb.state.layout & MAXIMIZED)) { - if (dwb.state.views->next) { - if (!visible) { - gtk_widget_show_all(dwb.gui.right); - gtk_widget_hide(((View*)dwb.state.views->next->data)->entry); - } - w = WEBVIEW(dwb.state.views->next); - if (dwb.misc.factor != 1.0) { - webkit_web_view_set_zoom_level(w, dwb.misc.factor); - webkit_web_view_set_full_content_zoom(w, GET_BOOL("full-content-zoom")); - } - } - else if (visible) { - gtk_widget_hide(dwb.gui.right); - } - - w = WEBVIEW(dwb.state.views); - webkit_web_view_set_zoom_level(w, 1.0); - dwb_resize(dwb.state.size); - } - /* update tab label */ - for (GList *gl = dwb.state.views; gl; gl = gl->next) { - View *v = gl->data; - const char *title = webkit_web_view_get_title(WEBKIT_WEB_VIEW(v->web)); - dwb_tab_label_set_text(gl, title); - } -}/*}}}*/ - /* dwb_eval_editing_key(GdkEventKey *) {{{*/ gboolean dwb_eval_editing_key(GdkEventKey *e) { @@ -2874,22 +2752,19 @@ dwb_init_gui() { /* else * dwb.gui.topbox = gtk_vbox_new(true, 1); * */ - dwb.gui.paned = gtk_hpaned_new(); - dwb.gui.left = gtk_vbox_new(true, 0); - dwb.gui.right = gtk_vbox_new(true, 1); + dwb.gui.mainbox = gtk_vbox_new(true, 0); /* Paned */ - GtkWidget *paned_event = gtk_event_box_new(); - DWB_WIDGET_OVERRIDE_BACKGROUND(paned_event, GTK_STATE_NORMAL, &dwb.color.normal_bg); - DWB_WIDGET_OVERRIDE_BACKGROUND(dwb.gui.paned, GTK_STATE_NORMAL, &dwb.color.normal_bg); - DWB_WIDGET_OVERRIDE_BACKGROUND(dwb.gui.paned, GTK_STATE_PRELIGHT, &dwb.color.active_bg); - gtk_container_add(GTK_CONTAINER(paned_event), dwb.gui.paned); + //DWB_WIDGET_OVERRIDE_BACKGROUND(paned_event, GTK_STATE_NORMAL, &dwb.color.normal_bg); + //DWB_WIDGET_OVERRIDE_BACKGROUND(dwb.gui.mainbox, GTK_STATE_NORMAL, &dwb.color.normal_bg); + //DWB_WIDGET_OVERRIDE_BACKGROUND(dwb.gui.paned, GTK_STATE_PRELIGHT, &dwb.color.active_bg); + //gtk_container_add(GTK_CONTAINER(paned_event), dwb.gui.paned); /* Downloadbar */ dwb.gui.downloadbar = gtk_hbox_new(false, 3); /* Pack */ - gtk_paned_pack1(GTK_PANED(dwb.gui.paned), dwb.gui.left, true, true); - gtk_paned_pack2(GTK_PANED(dwb.gui.paned), dwb.gui.right, true, true); + //gtk_paned_pack1(GTK_PANED(dwb.gui.paned), dwb.gui.left, true, true); + //gtk_paned_pack2(GTK_PANED(dwb.gui.paned), dwb.gui.right, true, true); gtk_box_pack_start(GTK_BOX(dwb.gui.vbox), dwb.gui.downloadbar, false, false, 0); if (dwb.gui.tbp == TBP_BOTTOM) @@ -2897,13 +2772,11 @@ dwb_init_gui() { else gtk_box_pack_start(GTK_BOX(dwb.gui.vbox), dwb.gui.topbox, false, false, 0); - gtk_box_pack_start(GTK_BOX(dwb.gui.vbox), paned_event, true, true, 0); + gtk_box_pack_start(GTK_BOX(dwb.gui.vbox), dwb.gui.mainbox, true, true, 0); gtk_container_add(GTK_CONTAINER(dwb.gui.window), dwb.gui.vbox); - gtk_widget_show(dwb.gui.left); - gtk_widget_show(dwb.gui.paned); - gtk_widget_show(paned_event); + gtk_widget_show(dwb.gui.mainbox); gtk_widget_show_all(dwb.gui.topbox); gtk_widget_show(dwb.gui.vbox); @@ -3035,7 +2908,6 @@ dwb_init_vars() { dwb.misc.top_statusbar = GET_BOOL("top-statusbar"); dwb.misc.scrollbars = GET_BOOL("scrollbars"); - dwb.state.tabbar_visible = dwb_eval_tabbar_visible(GET_CHAR("hide-tabbar")); dwb.state.cookies_allowed = GET_BOOL("cookies"); dwb.state.complete_history = GET_BOOL("complete-history"); @@ -3046,7 +2918,6 @@ dwb_init_vars() { dwb.state.background_tabs = GET_BOOL("background-tabs"); dwb.state.size = GET_INT("size"); - dwb.state.layout = dwb_layout_from_char(GET_CHAR("layout")); dwb.state.buffer = g_string_new(NULL); dwb.comps.autocompletion = GET_BOOL("auto-completion"); }/*}}}*/ @@ -3122,10 +2993,6 @@ dwb_init() { dwb_soup_init(); - if (dwb.state.layout & BOTTOM_STACK) { - Arg a = { .n = dwb.state.layout }; - commands_set_orientation(NULL, &a); - } gboolean restore_success = false; if (restore) restore_success = session_restore(restore); @@ -3138,7 +3005,6 @@ dwb_init() { view_add(NULL, false); } g_signal_connect(VIEW(dwb.state.fview)->tablabel, "size-allocate", G_CALLBACK(dwb_tab_size_cb), NULL); - dwb_toggle_tabbar(); } /*}}}*/ /*}}}*/ /* FIFO {{{*/ @@ -248,11 +248,7 @@ typedef enum { HINT_T_CLIPBOARD = 5, HINT_T_PRIMARY = 6, } HintType; -typedef enum { - HIDE_TB_NEVER = 0x02, - HIDE_TB_ALWAYS = 0x03, - HIDE_TB_TILED = 0x05, -} TabBarVisible; + typedef enum { BAR_VIS_TOP = 1<<0, BAR_VIS_STATUS = 1<<1, @@ -287,13 +283,6 @@ typedef enum { POST_SM = 0x02, } ShowMessage; - -typedef enum { - NORMAL_LAYOUT = 0, - BOTTOM_STACK = 1<<0 , - MAXIMIZED = 1<<1 , -} Layout; - typedef enum { CHAR = 0x01, INTEGER = 0x02, @@ -494,7 +483,6 @@ struct _State { gboolean hidden_files; gboolean view_in_background; - Layout layout; GList *last_com_history; GList *undo_list; @@ -508,7 +496,6 @@ struct _State { char *mimetype_request; int download_ref_count; - TabBarVisible tabbar_visible; gboolean fullscreen; BarVisibility bar_visible; }; @@ -610,9 +597,7 @@ struct _Gui { GtkWidget *window; GtkWidget *vbox; GtkWidget *topbox; - GtkWidget *paned; - GtkWidget *right; - GtkWidget *left; + GtkWidget *mainbox; GtkWidget *entry; GtkWidget *downloadbar; int width; @@ -743,7 +728,7 @@ void dwb_tab_label_set_text(GList *, const char *); void dwb_set_status_bar_text(GtkWidget *, const char *, DwbColor *, PangoFontDescription *, gboolean); void dwb_update_status_text(GList *gl, GtkAdjustment *); void dwb_update_status(GList *gl); -void dwb_update_layout(gboolean); +void dwb_update_layout(); void dwb_unfocus(void); DwbStatus dwb_prepend_navigation(GList *, GList **); diff --git a/src/session.c b/src/session.c index 54b3488c..0dc3692e 100644 --- a/src/session.c +++ b/src/session.c @@ -135,15 +135,8 @@ session_restore(const char *name) { if (!dwb.state.views) view_add(NULL, false); - if (dwb.state.layout & MAXIMIZED && dwb.state.views) { - gtk_widget_hide(dwb.gui.right); - for (GList *l = dwb.state.views->next; l; l=l->next) { - gtk_widget_hide(((View*)l->data)->vbox); - } - } dwb_unfocus(); dwb_focus(dwb.state.views); - dwb_update_layout(false); FREE(uri); return true; }/*}}}*/ @@ -761,15 +761,7 @@ view_entry_activate(GList *gl, GdkEventKey *e) { static gboolean view_tab_button_press_cb(GtkWidget *tabevent, GdkEventButton *e, GList *gl) { if (e->button == 1 && e->type == GDK_BUTTON_PRESS) { - Arg a = { .p = gl }; - if ((dwb.state.layout & MAXIMIZED) ) { - dwb_focus_view(gl); - } - else { - dwb_unfocus(); - dwb_focus(gl); - view_push_master(&a); - } + dwb_focus_view(gl); return true; } else if (e->button == 3 && e->type == GDK_BUTTON_PRESS) { @@ -1003,61 +995,6 @@ view_create_web_view() { return v; } /*}}}*/ -/* view_push_master (Arg *) {{{*/ -DwbStatus -view_push_master(Arg *arg) { - GList *gl = NULL, *l = NULL; - View *old = NULL, *new; - if (!dwb.state.views->next) { - return STATUS_ERROR; - } - if (arg && arg->p) { - gl = arg->p; - } - else if (dwb.state.nummod >= 0) { - gl = g_list_nth(dwb.state.views, dwb.state.nummod); - if (!gl) { - return STATUS_ERROR; - } - CLEAR_COMMAND_TEXT(dwb.state.views); - view_set_normal_style(CURRENT_VIEW()); - } - else { - gl = dwb.state.fview; - } - if (gl == dwb.state.views) { - old = gl->data; - l = dwb.state.views->next; - new = l->data; - gtk_widget_reparent(old->vbox, dwb.gui.right); - gtk_box_reorder_child(GTK_BOX(dwb.gui.right), old->vbox, 0); - gtk_widget_reparent(new->vbox, dwb.gui.left); - dwb.state.views = g_list_remove_link(dwb.state.views, l); - dwb.state.views = g_list_concat(l, dwb.state.views); - dwb_unfocus(); - dwb_focus(l); - } - else { - old = dwb.state.views->data; - new = gl->data; - gtk_widget_reparent(new->vbox, dwb.gui.left); - gtk_widget_reparent(old->vbox, dwb.gui.right); - gtk_box_reorder_child(GTK_BOX(dwb.gui.right), old->vbox, 0); - dwb.state.views = g_list_remove_link(dwb.state.views, gl); - dwb.state.views = g_list_concat(gl, dwb.state.views); - dwb_focus(dwb.state.views); - } - if (dwb.state.layout & MAXIMIZED) { - gtk_widget_show(dwb.gui.left); - gtk_widget_hide(dwb.gui.right); - gtk_widget_show(new->vbox); - gtk_widget_hide(old->vbox); - } - gtk_box_reorder_child(GTK_BOX(dwb.gui.topbox), new->tabevent, -1); - dwb_update_layout(false); - return STATUS_OK; -}/*}}}*/ - /* view_remove (void) {{{*/ void view_remove(GList *gl) { @@ -1082,11 +1019,13 @@ view_remove(GList *gl) { gtk_widget_show_all(dwb.gui.topbox); } } +#if 0 if (gl == dwb.state.views) { if (dwb.state.views->next) { gtk_widget_reparent(VIEW(dwb.state.views->next)->vbox, dwb.gui.left); } } +#endif /* Get History for the undo list */ WebKitWebBackForwardList *bflist = webkit_web_view_get_back_forward_list(WEBKIT_WEB_VIEW(v->web)); @@ -1125,19 +1064,7 @@ view_remove(GList *gl) { dwb.state.views = g_list_delete_link(dwb.state.views, gl); gl = NULL; - /* Update MAXIMIZED layout */ - if (dwb.state.layout & MAXIMIZED) { - gtk_widget_show(CURRENT_VIEW()->vbox); - if (dwb.state.fview == dwb.state.views) { - gtk_widget_hide(dwb.gui.right); - gtk_widget_show(dwb.gui.left); - } - else { - gtk_widget_show(dwb.gui.right); - gtk_widget_hide(dwb.gui.left); - } - } - dwb_update_layout(false); + gtk_widget_show(CURRENT_VIEW()->vbox); }/*}}}*/ /* view_ssl_state (GList *gl) {{{*/ @@ -1174,10 +1101,11 @@ view_add(const char *uri, gboolean background) { } View *v = view_create_web_view(); gtk_box_pack_end(GTK_BOX(dwb.gui.topbox), v->tabevent, true, true, 0); - if ((dwb.state.layout & MAXIMIZED || background) && dwb.state.fview) { + //if ((dwb.state.layout & MAXIMIZED || background) && dwb.state.fview) { + if (dwb.state.fview) { int p = g_list_position(dwb.state.views, dwb.state.fview) + 1; gtk_box_reorder_child(GTK_BOX(dwb.gui.topbox), v->tabevent, g_list_length(dwb.state.views) - p); - gtk_box_insert(GTK_BOX(dwb.gui.right), v->vbox, true, true, 0, p-1); + gtk_box_insert(GTK_BOX(dwb.gui.mainbox), v->vbox, true, true, 0, p); dwb.state.views = g_list_insert(dwb.state.views, v, p); ret = dwb.state.fview->next; @@ -1187,26 +1115,14 @@ view_add(const char *uri, gboolean background) { } else { gtk_widget_hide(VIEW(dwb.state.fview)->vbox); - if (dwb.state.views == dwb.state.fview) { - gtk_widget_hide(dwb.gui.left); - gtk_widget_show(dwb.gui.right); - } dwb_unfocus(); dwb_focus(ret); } } else { - /* reorder */ - if (dwb.state.views) { - View *views = dwb.state.views->data; - CLEAR_COMMAND_TEXT(dwb.state.views); - gtk_widget_reparent(views->vbox, dwb.gui.right); - gtk_box_reorder_child(GTK_BOX(dwb.gui.right), views->vbox, 0); - } - gtk_box_insert(GTK_BOX(dwb.gui.left), v->vbox, true, true, 0, 0); + gtk_box_pack_start(GTK_BOX(dwb.gui.mainbox), v->vbox, true, true, 0); dwb.state.views = g_list_prepend(dwb.state.views, v); ret = dwb.state.views; - dwb_unfocus(); dwb_focus(ret); } @@ -1217,7 +1133,7 @@ view_add(const char *uri, gboolean background) { adblock_connect(ret); #endif - dwb_update_layout(background); + //dwb_update_layout(background); if (uri != NULL) { dwb_load_uri(ret, uri); } |