diff options
-rw-r--r-- | settings.c | 26 | ||||
-rw-r--r-- | xombrero.1 | 5 | ||||
-rw-r--r-- | xombrero.c | 33 | ||||
-rw-r--r-- | xombrero.conf | 2 | ||||
-rw-r--r-- | xombrero.css | 6 | ||||
-rw-r--r-- | xombrero.h | 3 |
6 files changed, 73 insertions, 2 deletions
diff --git a/settings.c b/settings.c index aeffa91..65acd9e 100644 --- a/settings.c +++ b/settings.c @@ -64,6 +64,7 @@ int show_tabs = XT_DS_SHOW_TABS; /* show tabs on notebook */ int tab_style = XT_DS_TAB_STYLE; /* tab bar style */ int statusbar_style = XT_DS_STATUSBAR_STYLE; /* status bar style */ int show_url = XT_DS_SHOW_URL; /* show url toolbar on notebook */ +int show_scrollbars = XT_DS_SHOW_SCROLLBARS; int show_statusbar = XT_DS_SHOW_STATUSBAR; /* vimperator style status bar */ int ctrl_click_focus = XT_DS_CTRL_CLICK_FOCUS; /* ctrl click gets focus */ int cookies_enabled = XT_DS_COOKIES_ENABLED; /* enable cookies */ @@ -186,6 +187,7 @@ int set_refresh_interval(char *); int set_search_string(char *s); int set_session_autosave(char *); int set_session_timeout(char *); +int set_show_scrollbars(char *); int set_show_statusbar(char *); int set_show_tabs(char *); int set_show_url(char *); @@ -446,6 +448,7 @@ struct settings rs[] = { { "search_string", XT_S_STR, 0, NULL, &search_string, NULL, NULL, set_search_string }, { "session_autosave", XT_S_INT, 0, &session_autosave, NULL, NULL, NULL, set_session_autosave }, { "session_timeout", XT_S_INT, 0, &session_timeout, NULL, NULL, NULL, set_session_timeout }, + { "show_scrollbars", XT_S_INT, 0, &show_scrollbars, NULL, NULL, NULL, set_show_scrollbars }, { "show_statusbar", XT_S_INT, 0, &show_statusbar, NULL, NULL, NULL, set_show_statusbar }, { "show_tabs", XT_S_INT, 0, &show_tabs, NULL, NULL, NULL, set_show_tabs }, { "show_url", XT_S_INT, 0, &show_url, NULL, NULL, NULL, set_show_url }, @@ -803,12 +806,14 @@ set_gui_mode(struct settings *s, char *val) tab_style = XT_TABS_NORMAL; show_url = 1; show_statusbar = 0; + show_scrollbars = 1; } else if (!strcmp(val, "minimal")) { fancy_bar = 0; show_tabs = 1; tab_style = XT_TABS_COMPACT; show_url = 0; show_statusbar = 1; + show_scrollbars = 0; } else return (1); @@ -2029,6 +2034,27 @@ set_session_timeout(char *value) } int +set_show_scrollbars(char *value) +{ + struct tab *t; + int tmp; + const char *errstr; + + if (value == NULL || strlen(value) == 0) + tmp = XT_DS_SHOW_SCROLLBARS; + else { + tmp = strtonum(value, 0, 1, &errstr); + if (errstr) + return (-1); + } + show_scrollbars = tmp; + TAILQ_FOREACH(t, &tabs, entry) + if (set_scrollbar_visibility(t, show_scrollbars)) + return (-1); + return (0); +} + +int set_show_statusbar(char *value) { int tmp; diff --git a/xombrero.1 b/xombrero.1 index d80b5e9..d208972 100644 --- a/xombrero.1 +++ b/xombrero.1 @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: July 02 2012 $ +.Dd $Mdocdate: July 11 2012 $ .Dt XOMBRERO 1 .Os .Sh NAME @@ -1408,6 +1408,9 @@ This value is the time that is added in seconds to a session cookie. Enable or disable showing tabs. .It Cm show_url Enable or disable showing the url and toolbar. +.It Cm show_scrollbars +Enable or disable the showing of the horizontal and vertical scrollbars. +Disabling this setting requires GTK3. .It Cm show_statusbar Enable or disable showing the status bar. .It Cm single_instance diff --git a/xombrero.c b/xombrero.c index b5a61e8..0f8ea5a 100644 --- a/xombrero.c +++ b/xombrero.c @@ -124,6 +124,7 @@ TAILQ_HEAD(command_list, command_entry); #define XT_CSS_YELLOW "yellow" #define XT_CSS_GREEN "green" #define XT_CSS_BLUE "blue" +#define XT_CSS_HIDDEN "hidden" #define XT_PROTO_DELIM "://" @@ -582,6 +583,31 @@ buffers(struct tab *t, struct karg *args) return (0); } +int +set_scrollbar_visibility(struct tab *t, int visible) +{ +#if GTK_CHECK_VERSION(3, 0, 0) + GtkWidget *h_scrollbar, *v_scrollbar; + + h_scrollbar = gtk_scrolled_window_get_hscrollbar( + GTK_SCROLLED_WINDOW(t->browser_win)); + v_scrollbar = gtk_scrolled_window_get_vscrollbar( + GTK_SCROLLED_WINDOW(t->browser_win)); + + if (visible == 0) { + gtk_widget_set_name(h_scrollbar, XT_CSS_HIDDEN); + gtk_widget_set_name(v_scrollbar, XT_CSS_HIDDEN); + } else { + gtk_widget_set_name(h_scrollbar, ""); + gtk_widget_set_name(v_scrollbar, ""); + } + + return (0); +#else + return (visible == 0); +#endif +} + void hide_oops(struct tab *t) { @@ -6851,8 +6877,12 @@ create_browser(struct tab *t) GTK_SCROLLED_WINDOW(w)); t->adjust_v = gtk_scrolled_window_get_vadjustment( GTK_SCROLLED_WINDOW(w)); +#if GTK_CHECK_VERSION(3, 0, 0) +#else gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(w), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); /* XXX not needed in gtk3? */ + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); +#endif + t->wv = WEBKIT_WEB_VIEW(webkit_web_view_new()); gtk_container_add(GTK_CONTAINER(w), GTK_WIDGET(t->wv)); @@ -7546,6 +7576,7 @@ create_new_tab(char *title, struct undo *u, int focus, int position) /* browser */ t->browser_win = create_browser(t); + set_scrollbar_visibility(t, show_scrollbars); gtk_box_pack_start(GTK_BOX(t->vbox), t->browser_win, TRUE, TRUE, 0); /* oops message for user feedback */ diff --git a/xombrero.conf b/xombrero.conf index 175df7c..e3c03e0 100644 --- a/xombrero.conf +++ b/xombrero.conf @@ -200,6 +200,7 @@ # userstyle_global = 0 # show_url = 1 # show_statusbar = 0 +# show_scrollbars = 1 # The settings for "gui_mode = minimal" are as follows: @@ -208,6 +209,7 @@ # tab_style = compact # show_url = 0 # show_statusbar = 1 +# show_scrollbars = 0 # The following are settings shared between "classic" and "minimal" # "gui_mode": diff --git a/xombrero.css b/xombrero.css index 2cddbe9..de97a71 100644 --- a/xombrero.css +++ b/xombrero.css @@ -104,3 +104,9 @@ .notebook tab:active { background-color: @bg_color; } + +GtkScrollbar#hidden { + border-width: 0px; + -GtkRange-slider-width: 0px; + -GtkRange-trough-border: 0px; +} diff --git a/xombrero.h b/xombrero.h index 6bf7799..7218dcd 100644 --- a/xombrero.h +++ b/xombrero.h @@ -607,6 +607,7 @@ int command_mode(struct tab *, struct karg *); #define XT_DS_TAB_STYLE XT_TABS_NORMAL #define XT_DS_STATUSBAR_STYLE XT_STATUSBAR_URL #define XT_DS_SHOW_URL (1) +#define XT_DS_SHOW_SCROLLBARS (1) #define XT_DS_SHOW_STATUSBAR (0) #define XT_DS_CTRL_CLICK_FOCUS (0) #define XT_DS_COOKIES_ENABLED (1) @@ -742,6 +743,7 @@ int resizetab(struct tab *, struct karg *); int cert_cmd(struct tab *, struct karg *); void focus_webview(struct tab *); int is_g_object_setting(GObject *, char *); +int set_scrollbar_visibility(struct tab *, int); #define XT_DL_START (0) #define XT_DL_RESTART (1) @@ -760,6 +762,7 @@ extern int show_tabs; extern int tab_style; extern int statusbar_style; extern int show_url; +extern int show_scrollbars; extern int show_statusbar; extern int ctrl_click_focus; extern int cookies_enabled; |