diff options
author | portix <portix@gmx.net> | 2014-03-24 14:43:38 +0100 |
---|---|---|
committer | portix <portix@gmx.net> | 2014-03-24 14:43:38 +0100 |
commit | d2d53a5ac33c46c98c9c10831f439a5058c2baab (patch) | |
tree | 4151bb837d9c798702fba17103f320cec788ed2c | |
parent | 2abd6311e28ca90091b8f029f954ddaa0bf91998 (diff) | |
download | dwb-d2d53a5ac33c46c98c9c10831f439a5058c2baab.zip |
Adding favicon-size, tabbar-height and statusbar-height
-rw-r--r-- | doc/dwb.1 | 21 | ||||
-rw-r--r-- | doc/dwb.1.txt | 10 | ||||
-rw-r--r-- | m4/settings.m4 | 4 | ||||
-rw-r--r-- | src/adblock.c | 6 | ||||
-rw-r--r-- | src/application.c | 39 | ||||
-rw-r--r-- | src/config.h | 6 | ||||
-rw-r--r-- | src/dwb.c | 35 | ||||
-rw-r--r-- | src/dwb.h | 6 | ||||
-rw-r--r-- | src/scripts.c | 4 | ||||
-rw-r--r-- | src/view.c | 6 |
10 files changed, 116 insertions, 21 deletions
@@ -1,13 +1,13 @@ '\" t .\" Title: dwb .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] -.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/> -.\" Date: 01/09/2014 +.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> +.\" Date: 03/24/2014 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "DWB" "1" "01/09/2014" "\ \&" "\ \&" +.TH "DWB" "1" "03/24/2014" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -3052,6 +3052,11 @@ The color for prompt\-messages\&. Possible values: an rgb color\-string, default \fI#00ff00\fR\&. .RE .PP +\fBfavicon\-size\fR +.RS 4 +The size of the favicon, if set to 0 tabbar\-height will be used +.RE +.PP \fBfile\-sync\-interval\fR .RS 4 Interval in seconds to save history, cookies or session to hdd or 0 to immediately save, see also @@ -3408,6 +3413,11 @@ The default startpage\&. Possible values: an url or "about:blank" for an empty s \fIabout:blank\fR\&. .RE .PP +\fBstatusbar\-height\fR +.RS 4 +Height of the statusbar, if set to 0 it will be computed automatically\&. +.RE +.PP \fBsync\-files\fR .RS 4 Type of files to sync, see also @@ -3418,6 +3428,11 @@ Type of files to sync, see also \fIsession\fR or a combination, default value: \fIall\fR\&. +.PP +\fBtabbar\-height\fR +.RS 4 +Height of the tabbar, if favicon\-size is set the favicon\-size will be the minimum height, if set to 0 it will be computed automatically\&. +.RE .RE .PP \fBtab\-orientation (GTK2 only)\fR diff --git a/doc/dwb.1.txt b/doc/dwb.1.txt index d1e51a2d..9ea4fa9e 100644 --- a/doc/dwb.1.txt +++ b/doc/dwb.1.txt @@ -1388,6 +1388,9 @@ default value: '#ff0000'. The color for prompt-messages. Possible values: an rgb color-string, default value: '#00ff00'. +*favicon-size*:: +The size of the favicon, if set to 0 tabbar-height will be used + *file-sync-interval*:: Interval in seconds to save history, cookies or session to hdd or 0 to immediately save, see also *sync-files*, @@ -1622,11 +1625,18 @@ certificate. default value: '#ff0000'. The default startpage. Possible values: an url or "about:blank" for an empty startpage, default value: 'about:blank'. +*statusbar-height*:: +Height of the statusbar, if set to 0 it will be computed automatically. + *sync-files*:: Type of files to sync, see also *file-sync-interval*. Possible values are 'all', 'cookies', 'history', 'session' or a combination, default value: 'all'. +*tabbar-height*;; +Height of the tabbar, if favicon-size is set the favicon-size will be the +minimum height, if set to 0 it will be computed automatically. + *tab-orientation (GTK2 only)*:: Orientation of tabs, possible values are 'horizontal', 'vertical-left' and 'vertical-right', if set to vertical-left or vertical-right t and T in diff --git a/m4/settings.m4 b/m4/settings.m4 index e24a3082..cbb5b59a 100644 --- a/m4/settings.m4 +++ b/m4/settings.m4 @@ -92,15 +92,19 @@ html_input(default-width, text, Default width of the window) html_input(enable-favicon, checkbox, Whether to enable favicons in the tabbar) html_input(enable-frame-flattening, checkbox, Whether to enable frame flattening) html_input(enforce-96-dpi, checkbox, Enforce a resolution of 96 dpi) +html_input(favicon-size, text, Size of the favicon) html_input(maximum-tabs, text, ``Limits the number of visible tabs, 0 means no limit'') html_input(message-delay, text, ``Time messages are shown, in seconds'') html_select(new-tab-position-policy, html_options(right, left, rightmost, leftmost), Controls the position of newly created tabs) html_select(progress-bar-style, html_options(default, simple), The progress bar style) html_input(show-single-tab, checkbox, Whether to show the tabbar if only one tab is open) html_input(scrollbars, checkbox, Whether scrollbars should be enabled) +html_input(statusbar-height, text, Height of the statusbar) ifdef(`WITH_GTK3', ,html_select(tab-orientation, html_options(horizontal, vertical-left, vertical-right)', ``Orientation of tabs; if set to vertical-left or -right t and T in widget-packing is ignored'')) ifdef(`WITH_GTK3', ,html_input(tab-width, text, ``Width of vertical tabs; will be ignored for horizontal tabs'')) +html_input(tabbar-height, text, Height of the tabbar) html_input(tabbar-visible, text, Number of seconds a hidden tabbar is visible when switching between tabs) + html_input(tabbed-browsing, checkbox, Whether to enable tabbed browsing) html_input(user-stylesheet-uri, text, The uri of a stylesheet applied to every page) html_input(widget-packing, text, ``Packing of the main widgets; t (T)=tabbar (hidden), w=webview, s (S)=statusbar (hidden), d=downloadbar'') diff --git a/src/adblock.c b/src/adblock.c index 685fcf2f..f1c1b3c0 100644 --- a/src/adblock.c +++ b/src/adblock.c @@ -479,6 +479,9 @@ adblock_resource_request_cb(WebKitWebView *wv, WebKitWebFrame *frame, if (uri == NULL) return; + if (strcmp(uri, "about:blank") == 0) + return; + SoupMessage *msg = webkit_network_request_get_message(request); if (msg == NULL) return; @@ -508,8 +511,9 @@ adblock_resource_request_cb(WebKitWebView *wv, WebKitWebFrame *frame, if (!adblock_match(s_simple_exceptions, uri, host, domain, firsthost, firstdomain, attribute, thirdparty)) { - if (adblock_match(s_simple_rules, uri, host, domain, firsthost, firstdomain, attribute, thirdparty)) + if (adblock_match(s_simple_rules, uri, host, domain, firsthost, firstdomain, attribute, thirdparty)) { webkit_network_request_set_uri(request, "about:blank"); + } } }/*}}}*/ diff --git a/src/application.c b/src/application.c index 77e74129..759cfc00 100644 --- a/src/application.c +++ b/src/application.c @@ -166,7 +166,7 @@ dwb_application_local_command_line(GApplication *app, gchar ***argv, gint *exit_ FILE *ff = NULL; gchar *path, *unififo = NULL; char *appid; - GDBusConnection *bus; + GDBusConnection *bus = NULL; GOptionContext *c = application_get_option_context(); if (!g_option_context_parse(c, &argc, argv, &error)) @@ -175,9 +175,11 @@ dwb_application_local_command_line(GApplication *app, gchar ***argv, gint *exit_ *exit_status = 1; return true; } - appid = g_strconcat("org.bitbucket.dwb.", dwb.misc.profile, NULL); - g_application_set_application_id(app, appid); - g_free(appid); + if (!s_opt_fallback) { + appid = g_strconcat("org.bitbucket.dwb.", dwb.misc.profile, NULL); + g_application_set_application_id(app, appid); + g_free(appid); + } argc_remain = g_strv_length(*argv); @@ -225,11 +227,13 @@ dwb_application_local_command_line(GApplication *app, gchar ***argv, gint *exit_ dwb_init_settings(); single_instance = GET_BOOL("single-instance"); - if (s_opt_single || !single_instance) - g_application_set_flags(app, G_APPLICATION_NON_UNIQUE); + if (!s_opt_fallback) { + if (s_opt_single || !single_instance) + g_application_set_flags(app, G_APPLICATION_NON_UNIQUE); - bus = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL); - if (!s_opt_fallback && bus != NULL && g_application_register(app, NULL, &error)) + bus = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL); + } + if (bus != NULL && g_application_register(app, NULL, &error)) { g_object_unref(bus); remote = g_application_get_is_remote(app); @@ -418,16 +422,29 @@ application_start(GApplication *app, char **argv) application_execute_args(argv); /* Compute bar height */ + gint bar_height; gint w = 0, h = 0; PangoContext *pctx = gtk_widget_get_pango_context(VIEW(dwb.state.fview)->tablabel); PangoLayout *layout = pango_layout_new(pctx); pango_layout_set_text(layout, "a", -1); pango_layout_set_font_description(layout, dwb.font.fd_active); pango_layout_get_size(layout, &w, &h); - dwb.misc.bar_height = h/PANGO_SCALE; - - gtk_widget_set_size_request(dwb.gui.entry, -1, dwb.misc.bar_height); + bar_height = h/PANGO_SCALE; g_object_unref(layout); + if (dwb.misc.statusbar_height <= 0) { + dwb.misc.statusbar_height = bar_height; + } + if (dwb.misc.tabbar_height <= 0) { + dwb.misc.tabbar_height = bar_height; + } + else if (dwb.misc.favicon_size > 0) { + dwb.misc.tabbar_height = MAX(dwb.misc.tabbar_height, dwb.misc.favicon_size); + } + gtk_widget_set_size_request(dwb.gui.entry, -1, bar_height); + + if (dwb.misc.favicon_size == 0) { + dwb.misc.favicon_size = dwb.misc.tabbar_height; + } dwb_init_signals(); diff --git a/src/config.h b/src/config.h index 97fa216b..5f066420 100644 --- a/src/config.h +++ b/src/config.h @@ -1049,6 +1049,12 @@ static WebSettings DWB_SETTINGS[] = { SETTING_GLOBAL, BOOLEAN, { .b = true }, NULL, { 0 }, }, { { "enable-favicon", "Whether to show favicons", }, SETTING_GLOBAL, BOOLEAN, { .b = true }, (S_Func)dwb_set_favicon, { 0 }, }, + { { "favicon-size", "Size of the favicon", }, + SETTING_GLOBAL|SETTING_ONINIT, INTEGER, { .i = 0 }, (S_Func)dwb_set_favicon_size, { 0 }, }, + { { "tabbar-height", "Height of the tabbar", }, + SETTING_GLOBAL|SETTING_ONINIT, INTEGER, { .i = 0 }, (S_Func)dwb_set_tabbar_height, { 0 }, }, + { { "statusbar-height", "Height of the statusbar", }, + SETTING_GLOBAL|SETTING_ONINIT, INTEGER, { .i = 0 }, (S_Func)dwb_set_statusbar_height, { 0 }, }, { { "file-sync-interval", "Interval to save files to hdd or 0 to directly write to hdd", }, SETTING_GLOBAL|SETTING_ONINIT, INTEGER, { .i = 120 }, (S_Func) dwb_set_sync_interval, { 0 }, }, { { "sync-files", "Files to sync", }, @@ -81,6 +81,9 @@ static DwbStatus dwb_set_cookies(GList *, WebSettings *); static DwbStatus dwb_set_widget_packing(GList *, WebSettings *); static DwbStatus dwb_set_cookie_accept_policy(GList *, WebSettings *); static DwbStatus dwb_set_favicon(GList *, WebSettings *); +static DwbStatus dwb_set_favicon_size(GList *gl, WebSettings *s); +static DwbStatus dwb_set_tabbar_height(GList *gl, WebSettings *s); +static DwbStatus dwb_set_statusbar_height(GList *gl, WebSettings *s); static DwbStatus dwb_set_auto_insert_mode(GList *, WebSettings *); static DwbStatus dwb_set_tabbar_delay(GList *, WebSettings *); static DwbStatus dwb_set_max_tabs(GList *, WebSettings *); @@ -607,6 +610,21 @@ dwb_set_favicon(GList *l, WebSettings *s) } return STATUS_OK; }/*}}}*/ +static DwbStatus +dwb_set_favicon_size(GList *l, WebSettings *s) { + dwb.misc.favicon_size = s->arg_local.i; + return STATUS_OK; +} +static DwbStatus +dwb_set_tabbar_height(GList *l, WebSettings *s) { + dwb.misc.tabbar_height = s->arg_local.i; + return STATUS_OK; +} +static DwbStatus +dwb_set_statusbar_height(GList *l, WebSettings *s) { + dwb.misc.statusbar_height = s->arg_local.i; + return STATUS_OK; +} /* dwb_set_proxy{{{*/ DwbStatus @@ -4699,6 +4717,10 @@ dwb_init_gui() #else dwb.gui.vbox = gtk_vbox_new(false, 0); dwb.gui.tabcontainer = gtk_hbox_new(true, 1); + + if (dwb.misc.tabbar_height > 0 || dwb.misc.favicon_size > 0) { + gtk_widget_set_size_request(dwb.gui.tabcontainer, -1, MAX(dwb.misc.tabbar_height, dwb.misc.favicon_size)); + } dwb.gui.mainbox = gtk_hbox_new(true, 1); dwb.gui.tabwrapperbox = gtk_hbox_new(false, 0); @@ -4713,6 +4735,9 @@ dwb_init_gui() gtk_box_pack_start(GTK_BOX(dwb.gui.tabbox), dwb.gui.tabcontainer, false, false, 0); gtk_widget_show(dwb.gui.tabcontainer); #endif + if (dwb.misc.tabbar_height != 0) { + gtk_widget_set_size_request(dwb.gui.tabbox, -1, dwb.misc.tabbar_height); + } /* Downloadbar */ #if _HAS_GTK3 @@ -4755,6 +4780,10 @@ dwb_init_gui() #else dwb.gui.status_hbox = gtk_hbox_new(false, 2); #endif + if (dwb.misc.statusbar_height > 0) { + printf("%d\n", dwb.misc.statusbar_height); + gtk_widget_set_size_request(dwb.gui.status_hbox, -1, dwb.misc.statusbar_height); + } dwb.gui.alignment = gtk_alignment_new(0.5, 0.5, 1, 1); int padding = GET_INT("bars-padding"); gtk_alignment_set_padding(GTK_ALIGNMENT(dwb.gui.alignment), padding, padding, padding, padding); @@ -5049,7 +5078,7 @@ dwb_get_stock_item_base64_encoded(const char *name) GdkPixbuf *pb; char *ret = NULL; #if _HAS_GTK3 - pb = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(), name, dwb.misc.bar_height, 0, NULL); + pb = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(), name, dwb.misc.tabbar_height, 0, NULL); #else pb = gtk_widget_render_icon(dwb.gui.window, name, -1, NULL); #endif @@ -5162,7 +5191,9 @@ dwb_init_vars(void) dwb.misc.https_quark = g_quark_from_static_string("dwb_is_https"); - dwb.misc.bar_height = 0; + dwb.misc.tabbar_height = 0; + dwb.misc.statusbar_height = 0; + dwb.misc.favicon_size = 0; dwb.state.last_tab = 0; dwb.state.last_com_history = NULL; @@ -712,6 +712,7 @@ struct _ViewStatus { gboolean deferred; char *deferred_uri; double marks[MARK_LENGTH]; + WebKitWebNavigationReason reason; }; struct _View { GtkWidget *web; @@ -836,7 +837,9 @@ struct _Misc { int synctimer; int sync_interval; int sync_files; - int bar_height; + int statusbar_height; + int tabbar_height; + int favicon_size; TabPosition tab_position; char *hint_style; uint64_t script_signals; @@ -1068,6 +1071,7 @@ void dwb_limit_tabs(gint max); KeyMap * dwb_add_key(char *, char *, char *, Func, int, Arg *); void dwb_mark(GdkEventKey *e); DwbStatus dwb_eval_mark(guint val, gint mode); +void dwb_set_nummod(GdkEventKey *e); #if 0 void dwb_hide_tab(GList *gl); void dwb_show_tab(GList *gl); diff --git a/src/scripts.c b/src/scripts.c index faa53a0c..9e0a1c3d 100644 --- a/src/scripts.c +++ b/src/scripts.c @@ -5879,13 +5879,13 @@ gui_get_status_label(JSContextRef ctx, JSObjectRef object, JSStringRef property, * */ static JSValueRef gui_get_tabbar_height(JSContextRef ctx, JSObjectRef object, JSStringRef property, JSValueRef* exception) { - return JSValueMakeNumber(ctx, dwb.misc.bar_height); + return JSValueMakeNumber(ctx, dwb.misc.tabbar_height); } static bool gui_set_tabbar_height(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) { double bar_height = JSValueToNumber(ctx, value, exception); if (!isnan(bar_height)) { - dwb.misc.bar_height = (int) bar_height; + dwb.misc.tabbar_height = (int) bar_height; return true; } return false; @@ -682,6 +682,7 @@ view_navigation_policy_cb(WebKitWebView *web, WebKitWebFrame *frame, WebKitNetwo gboolean ret = false; WebKitWebNavigationReason reason = webkit_web_navigation_action_get_reason(action); gint button = webkit_web_navigation_action_get_button(action); + VIEW(gl)->status->reason = reason; IPC_SEND_HOOK(navigation, "%d %s %s", g_list_position(dwb.state.views, gl) + 1, frame == webkit_web_view_get_main_frame(web) ? "true" : "false", @@ -1476,7 +1477,7 @@ view_set_favicon(GList *gl, gboolean web) pb = webkit_web_view_get_icon_pixbuf(WEBVIEW(gl)); if (pb) { - new = gdk_pixbuf_scale_simple(pb, dwb.misc.bar_height, dwb.misc.bar_height, GDK_INTERP_BILINEAR); + new = gdk_pixbuf_scale_simple(pb, dwb.misc.favicon_size, dwb.misc.favicon_size, GDK_INTERP_BILINEAR); g_object_unref(pb); } } @@ -1686,6 +1687,9 @@ view_create_web_view() #endif v->tablabel = gtk_label_new(NULL); + if (dwb.misc.tabbar_height > 0 || dwb.misc.favicon_size > 0) { + gtk_widget_set_size_request(v->tablabel, -1, MAX(dwb.misc.tabbar_height, dwb.misc.favicon_size)); + } gtk_label_set_use_markup(GTK_LABEL(v->tablabel), true); gtk_label_set_width_chars(GTK_LABEL(v->tablabel), 1); |