[devhelp/wip/swilmet/misc: 10/17] window: remove redundant code with find_library_equivalent()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp/wip/swilmet/misc: 10/17] window: remove redundant code with find_library_equivalent()
- Date: Sat, 19 Dec 2015 11:22:14 +0000 (UTC)
commit 56f8c619d631752b0b6cc7915593bdf693096497
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sun Nov 15 16:51:11 2015 +0100
window: remove redundant code with find_library_equivalent()
find_library_equivalent() returns NULL in case the URI doesn't has one
of the 4 prefixes.
https://bugzilla.gnome.org/show_bug.cgi?id=758141
src/dh-window.c | 18 +++++++-----------
1 files changed, 7 insertions(+), 11 deletions(-)
---
diff --git a/src/dh-window.c b/src/dh-window.c
index da5b92b..51625d1 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -906,6 +906,7 @@ window_web_view_decide_policy_cb (WebKitWebView *web_view,
const char *uri;
WebKitNavigationPolicyDecision *navigation_decision;
WebKitNavigationAction *navigation_action;
+ gchar *local_uri;
if (type != WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION)
return GDK_EVENT_PROPAGATE;
@@ -928,17 +929,12 @@ window_web_view_decide_policy_cb (WebKitWebView *web_view,
return GDK_EVENT_PROPAGATE;
}
- if (g_str_has_prefix (uri, "http://library.gnome.org/devel/") ||
- g_str_has_prefix (uri, "https://library.gnome.org/devel/") ||
- g_str_has_prefix (uri, "http://developer.gnome.org/") ||
- g_str_has_prefix (uri, "https://developer.gnome.org/")) {
- gchar *local_uri = find_library_equivalent (window, uri);
- if (local_uri != NULL) {
- webkit_policy_decision_ignore (policy_decision);
- _dh_window_display_uri (window, local_uri);
- g_free (local_uri);
- return GDK_EVENT_STOP;
- }
+ local_uri = find_library_equivalent (window, uri);
+ if (local_uri != NULL) {
+ webkit_policy_decision_ignore (policy_decision);
+ _dh_window_display_uri (window, local_uri);
+ g_free (local_uri);
+ return GDK_EVENT_STOP;
}
if (!g_str_has_prefix (uri, "file://")) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]