summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorportix <none@none>2013-02-16 16:52:59 +0100
committerportix <none@none>2013-02-16 16:52:59 +0100
commita279f47012843a951f0d9058223049b437474402 (patch)
tree5ae908ff3a4112cc5af5838dde6ae1f5c9439357
parentcdfbcfe3c1bca9d69e2738cca2ac9f777df485bf (diff)
downloaddwb-a279f47012843a951f0d9058223049b437474402.zip
Adding isQuickmarked, isBookmarked and type to statusBarChange signal
-rw-r--r--api/dwb-js.744
-rw-r--r--api/jsapi.7.txt9
-rw-r--r--api/jsapi.txt9
-rw-r--r--src/dwb.c14
4 files changed, 55 insertions, 21 deletions
diff --git a/api/dwb-js.7 b/api/dwb-js.7
index 3a21e065..8b63a85c 100644
--- a/api/dwb-js.7
+++ b/api/dwb-js.7
@@ -2,12 +2,12 @@
.\" Title: dwb-js
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.78.0 <http://docbook.sf.net/>
-.\" Date: 02/13/2013
+.\" Date: 02/16/2013
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "DWB\-JS" "7" "02/13/2013" "\ \&" "\ \&"
+.TH "DWB\-JS" "7" "02/16/2013" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -2953,15 +2953,6 @@ Emitted before the status bar is updated, if the callback returns true dwb will
The focused webview
.RE
.PP
-\fIdata\&.ssl\fR
-.RS 4
-SSL\-State of the page, can either be
-\fItrusted\fR,
-\fIuntrusted\fR
-or
-\fInone\fR
-.RE
-.PP
\fIdata\&.canGoBack\fR
.RS 4
Whether it is possible to navigate back in the webview
@@ -2972,15 +2963,42 @@ Whether it is possible to navigate back in the webview
Whether it is possible to navigate forward in the webview
.RE
.PP
-\fIdata\&.scriptsBlocked\fR
+\fIdata\&.isBookmarked\fR
.RS 4
-Whether scripts are blocked
+Whether the site is bookmarked
+.RE
+.PP
+\fIdata\&.isQuickmarked\fR
+.RS 4
+Whether the site is quickmarked
.RE
.PP
\fIdata\&.pluginsBlocked\fR
.RS 4
Whether plugins are blocked
.RE
+.PP
+\fIdata\&.scriptsBlocked\fR
+.RS 4
+Whether scripts are blocked
+.RE
+.PP
+\fIdata\&.ssl\fR
+.RS 4
+SSL\-State of the page, can either be
+\fItrusted\fR,
+\fIuntrusted\fR
+or
+\fInone\fR
+.RE
+.PP
+\fIdata\&.type\fR
+.RS 4
+The type of the update, can be
+\fBstatus\fR
+and
+\fBuri\fR, status means that statusLabel und uriLabel need to be updated, uri means that only the uriLabel needs to be updated\&.
+.RE
.RE
.sp
.it 1 an-trap
diff --git a/api/jsapi.7.txt b/api/jsapi.7.txt
index 1b4a3d6f..848c903f 100644
--- a/api/jsapi.7.txt
+++ b/api/jsapi.7.txt
@@ -1429,11 +1429,16 @@ Emitted before the status bar is updated, if the callback returns true dwb will
not update the statusbar so it is possible to set the statusbar from the script.
_webview_;; The focused webview
-_data.ssl_;; SSL-State of the page, can either be 'trusted', 'untrusted' or 'none'
_data.canGoBack_;; Whether it is possible to navigate back in the webview
_data.canGoForward_;; Whether it is possible to navigate forward in the webview
-_data.scriptsBlocked_;; Whether scripts are blocked
+_data.isBookmarked_;; Whether the site is bookmarked
+_data.isQuickmarked_;; Whether the site is quickmarked
_data.pluginsBlocked_;; Whether plugins are blocked
+_data.scriptsBlocked_;; Whether scripts are blocked
+_data.ssl_;; SSL-State of the page, can either be 'trusted', 'untrusted' or 'none'
+_data.type_;; The type of the update, can be *status* and *uri*, status means
+that statusLabel und uriLabel need to be updated, uri means that only the
+uriLabel needs to be updated.
****
==== tabButtonPress
diff --git a/api/jsapi.txt b/api/jsapi.txt
index 347b3847..a2a870f2 100644
--- a/api/jsapi.txt
+++ b/api/jsapi.txt
@@ -2664,11 +2664,16 @@ Emitted before the status bar is updated, if the callback returns +true+ dwb wil
not update the statusbar so it is possible to set the statusbar from the script.
_webview_;; The focused webview
-_data.ssl_;; SSL-State of the page, can either be 'trusted', 'untrusted' or 'none'
_data.canGoBack_;; Whether it is possible to navigate back in the webview
_data.canGoForward_;; Whether it is possible to navigate forward in the webview
-_data.scriptsBlocked_;; Whether scripts are blocked
+_data.isBookmarked_;; Whether the site is bookmarked
+_data.isQuickmarked_;; Whether the site is quickmarked
_data.pluginsBlocked_;; Whether plugins are blocked
+_data.scriptsBlocked_;; Whether scripts are blocked
+_data.ssl_;; SSL-State of the page, can either be 'trusted', 'untrusted' or 'none'
+_data.type_;; The type of the update, can be *status* and *uri*, status means
+that statusLabel und uriLabel need to be updated, uri means that only the
+uriLabel needs to be updated.
****
****
diff --git a/src/dwb.c b/src/dwb.c
index 78815cdf..42e99347 100644
--- a/src/dwb.c
+++ b/src/dwb.c
@@ -665,7 +665,7 @@ dwb_set_error_message(GList *gl, const char *error, ...)
}/*}}}*/
static gboolean
-dwb_emit_status_signal(GList *gl)
+dwb_emit_status_signal(GList *gl, const char *type)
{
gboolean ret = false;
View *v = VIEW(gl);
@@ -673,12 +673,18 @@ dwb_emit_status_signal(GList *gl)
{
gboolean back = webkit_web_view_can_go_back(WEBKIT_WEB_VIEW(v->web));
gboolean forward = webkit_web_view_can_go_forward(WEBKIT_WEB_VIEW(v->web));
- char *json = util_create_json(5,
+ const char *uri = webkit_web_view_get_uri(WEBVIEW(gl));
+ gboolean has_quickmark = g_list_find_custom(dwb.fc.quickmarks, uri, (GCompareFunc)util_quickmark_compare_uri) != NULL;
+ gboolean has_bookmark = g_list_find_custom(dwb.fc.bookmarks, uri, (GCompareFunc)util_navigation_compare_uri) != NULL;
+ char *json = util_create_json(8,
CHAR, "ssl", v->status->ssl == SSL_TRUSTED
? "trusted" : v->status->ssl == SSL_UNTRUSTED
? "untrusted" : "none",
BOOLEAN, "canGoBack", back,
BOOLEAN, "canGoForward", forward,
+ BOOLEAN, "isBookmarked", has_bookmark,
+ BOOLEAN, "isQuickmarked", has_quickmark,
+ CHAR, "type", type,
BOOLEAN, "scriptsBlocked", (v->status->scripts & SCRIPTS_BLOCKED) != 0,
BOOLEAN, "pluginBlocked", (v->plugins->status & PLUGIN_STATUS_ENABLED) != 0 &&
(v->plugins->status & PLUGIN_STATUS_HAS_PLUGIN) != 0);
@@ -694,7 +700,7 @@ dwb_update_uri(GList *gl, gboolean emit_signal)
if (gl != dwb.state.fview)
return;
- if (dwb_emit_status_signal(gl))
+ if (emit_signal && dwb_emit_status_signal(gl, "uri"))
return;
View *v = VIEW(gl);
@@ -722,7 +728,7 @@ dwb_update_status_text(GList *gl, GtkAdjustment *a)
{
g_return_if_fail(gl == dwb.state.fview);
- if (dwb_emit_status_signal(gl))
+ if (dwb_emit_status_signal(gl, "status"))
return;
View *v = gl->data;