summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorportix <portix@gmx.net>2011-12-28 02:00:33 +0100
committerportix <portix@gmx.net>2011-12-28 02:00:33 +0100
commitb21be615c1aed463426ac6cb0d1356d70fa5d3c2 (patch)
treef6d59da018c83ce41df49fba7ca165113f026b3b /src
parentd1832eed7a58b43aeece4b9cb462b3c2fcdfe3bd (diff)
downloaddwb-b21be615c1aed463426ac6cb0d1356d70fa5d3c2.zip
Removing not needed dwb_false; new command 'visible'
--HG-- branch : experimental
Diffstat (limited to 'src')
-rw-r--r--src/commands.c5
-rw-r--r--src/config.h3
-rw-r--r--src/dwb.c9
-rw-r--r--src/dwb.h2
-rw-r--r--src/util.c5
-rw-r--r--src/util.h1
-rw-r--r--src/view.c3
7 files changed, 17 insertions, 11 deletions
diff --git a/src/commands.c b/src/commands.c
index ecb5913b..48a13046 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -869,8 +869,11 @@ commands_toggle_protected(KeyMap *km, Arg *arg) {
DwbStatus
commands_toggle_lock_protect(KeyMap *km, Arg *arg) {
GList *gl = dwb.state.nummod < 0 ? dwb.state.fview : g_list_nth(dwb.state.views, dwb.state.nummod-1);
- VIEW(gl)->status->lockprotect ^= arg->n;
+ View *v = VIEW(gl);
+ v->status->lockprotect ^= arg->n;
dwb_tab_label_set_text(gl, NULL);
+ if (arg->n & LP_VISIBLE && gl != dwb.state.fview)
+ gtk_widget_set_visible(v->scroll, LP_VISIBLE(v));
return STATUS_OK;
}
/*}}}*/
diff --git a/src/config.h b/src/config.h
index d5583f9a..522de8d0 100644
--- a/src/config.h
+++ b/src/config.h
@@ -161,6 +161,7 @@ static KeyValue KEYS[] = {
{ "lock_uri", { "xu", 0 }, },
{ "lock_domain", { "xd", 0 }, },
{ "back_new_tab", { "xb", 0 }, },
+ { "visible", { "xv", 0 }, },
};
/* FUNCTION_MAP{{{*/
@@ -181,6 +182,8 @@ static FunctionMap FMAP [] = {
(Func) commands_toggle_lock_protect, NULL, ALWAYS_SM, { .n = LP_LOCK_DOMAIN } },
{ { "lock_uri", "Lock/unlock uri for this tab" }, 1,
(Func) commands_toggle_lock_protect, NULL, ALWAYS_SM, { .n = LP_LOCK_URI } },
+ { { "visible", "Lock/unlock uri for this tab" }, 1,
+ (Func) commands_toggle_lock_protect, NULL, ALWAYS_SM, { .n = LP_VISIBLE } },
{ { "allow_cookie", "Cookie allowed", }, 1,
(Func)commands_allow_cookie, "No new domain in current context", POST_SM, },
{ { "bookmark", "Bookmark current page", }, 1,
diff --git a/src/dwb.c b/src/dwb.c
index 3ff39dc8..bb20782d 100644
--- a/src/dwb.c
+++ b/src/dwb.c
@@ -828,7 +828,8 @@ void
dwb_focus_view(GList *gl) {
if (gl != dwb.state.fview) {
gtk_widget_show(VIEW(gl)->scroll);
- gtk_widget_hide(VIEW(dwb.state.fview)->scroll);
+ if (! (CURRENT_VIEW()->status->lockprotect & LP_VISIBLE) )
+ gtk_widget_hide(VIEW(dwb.state.fview)->scroll);
dwb_unfocus();
dwb_focus(gl);
}
@@ -1522,7 +1523,7 @@ dwb_tab_label_set_text(GList *gl, const char *text) {
View *v = gl->data;
const char *uri = text ? text : webkit_web_view_get_title(WEBKIT_WEB_VIEW(v->web));
char progress[11] = { 0 };
- char buf[4] = { 0 };
+ char buf[45] = { 0 };
int i=0;
char sep1 = 0, sep2 = 0;
if (v->status->lockprotect != 0) {
@@ -1534,6 +1535,8 @@ dwb_tab_label_set_text(GList *gl, const char *text) {
buf[i++] = 'd';
if (LP_LOCKED_URI(v))
buf[i++] = 'u';
+ if (LP_VISIBLE(v))
+ buf[i++] = 'v';
buf[i++] = '\0';
}
if (v->status->progress != 0) {
@@ -2727,7 +2730,7 @@ dwb_init_gui() {
/* else
* dwb.gui.topbox = gtk_vbox_new(true, 1);
* */
- dwb.gui.mainbox = gtk_hbox_new(true, 0);
+ dwb.gui.mainbox = gtk_hbox_new(true, 1);
/* Downloadbar */
dwb.gui.downloadbar = gtk_hbox_new(false, 3);
diff --git a/src/dwb.h b/src/dwb.h
index 0df0fa07..610d7b8b 100644
--- a/src/dwb.h
+++ b/src/dwb.h
@@ -234,10 +234,12 @@ typedef enum {
LP_PROTECT = 1<<0,
LP_LOCK_DOMAIN = 1<<1,
LP_LOCK_URI = 1<<2,
+ LP_VISIBLE = 1<<3,
} LockProtect;
#define LP_PROTECTED(v) ((v)->status->lockprotect & LP_PROTECT)
#define LP_LOCKED_DOMAIN(v) ((v)->status->lockprotect & LP_LOCK_DOMAIN)
#define LP_LOCKED_URI(v) ((v)->status->lockprotect & LP_LOCK_URI)
+#define LP_VISIBLE(v) ((v)->status->lockprotect & LP_VISIBLE)
typedef enum {
HINT_T_ALL = 0,
diff --git a/src/util.c b/src/util.c
index cacee08e..71d5fad2 100644
--- a/src/util.c
+++ b/src/util.c
@@ -545,11 +545,6 @@ dwb_quickmark_free(Quickmark *q) {
/* dwb_true, dwb_false {{{*/
gboolean
-dwb_false() {
- return false;
-}
-
-gboolean
dwb_true() {
return true;
}/*}}}*/
diff --git a/src/util.h b/src/util.h
index a7ad24ca..f3680c12 100644
--- a/src/util.h
+++ b/src/util.h
@@ -73,7 +73,6 @@ int util_quickmark_compare(Quickmark *a, Quickmark *b);
// useless
gboolean dwb_true(void);
-gboolean dwb_false(void);
char * dwb_return(const char *);
void * dwb_malloc(size_t);
diff --git a/src/view.c b/src/view.c
index 2319d3d2..838e80f2 100644
--- a/src/view.c
+++ b/src/view.c
@@ -903,7 +903,8 @@ view_add(const char *uri, gboolean background) {
gtk_widget_hide(v->scroll);
}
else {
- gtk_widget_hide(VIEW(dwb.state.fview)->scroll);
+ if (! (CURRENT_VIEW()->status->lockprotect & LP_VISIBLE) )
+ gtk_widget_hide(VIEW(dwb.state.fview)->scroll);
dwb_unfocus();
dwb_focus(ret);
}