[Xfce4-commits] <midori:master> Resolve minor warnings for being() and errors
Christian Dywan
noreply at xfce.org
Sun Nov 4 18:30:02 CET 2012
Updating branch refs/heads/master
to 44ccee3023e8a3c081ffadfc0c4b1a6dbff6dbf2 (commit)
from 3386f0bad7b8d0593af7f246bf442b9a862f717a (commit)
commit 44ccee3023e8a3c081ffadfc0c4b1a6dbff6dbf2
Author: Christian Dywan <christian at twotoasts.de>
Date: Sat Nov 3 18:48:08 2012 +0100
Resolve minor warnings for being() and errors
katze/midori-hsts.vala | 6 +++---
katze/midori-paths.vala | 2 +-
katze/midori-uri.vala | 2 ++
midori/midori-download.vala | 2 +-
midori/midori-tab.vala | 15 ++++++++++-----
5 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/katze/midori-hsts.vala b/katze/midori-hsts.vala
index 4ceb174..92c7b61 100644
--- a/katze/midori-hsts.vala
+++ b/katze/midori-hsts.vala
@@ -44,8 +44,8 @@ namespace Midori {
public HSTS () {
whitelist = new HashTable<string, Directive> (str_hash, str_equal);
- read_cache (File.new_for_path (Paths.get_preset_filename (null, "hsts")));
- read_cache (File.new_for_path (Paths.get_config_filename_for_reading ("hsts")));
+ read_cache.begin (File.new_for_path (Paths.get_preset_filename (null, "hsts")));
+ read_cache.begin (File.new_for_path (Paths.get_config_filename_for_reading ("hsts")));
if (strcmp (Environment.get_variable ("MIDORI_DEBUG"), "hsts") == 0)
debug = true;
}
@@ -132,7 +132,7 @@ namespace Midori {
var directive = new Directive.from_header (hsts);
if (directive.is_valid ()) {
append_to_whitelist (message.uri.host, directive);
- append_to_cache (message.uri.host, hsts);
+ append_to_cache.begin (message.uri.host, hsts);
}
if (debug)
stdout.printf ("HSTS: '%s' sets '%s' valid? %s\n",
diff --git a/katze/midori-paths.vala b/katze/midori-paths.vala
index e13fc93..585067c 100644
--- a/katze/midori-paths.vala
+++ b/katze/midori-paths.vala
@@ -185,7 +185,7 @@ namespace Midori {
public static string get_command_line_str () {
assert (command_line != null);
- return "".joinv (" ", command_line).replace (Environment.get_home_dir (), "~");
+ return string.joinv (" ", command_line).replace (Environment.get_home_dir (), "~");
}
public static string get_lib_path (string package) {
diff --git a/katze/midori-uri.vala b/katze/midori-uri.vala
index c47a6a0..88e3027 100644
--- a/katze/midori-uri.vala
+++ b/katze/midori-uri.vala
@@ -18,6 +18,8 @@ namespace Midori {
public class URI : Object {
public static string? parse_hostname (string? uri, out string path) {
/* path may be null. */
+ if (&path != null)
+ path = null;
if (uri == null)
return uri;
unowned string? hostname = uri.chr (-1, '/');
diff --git a/midori/midori-download.vala b/midori/midori-download.vala
index 72f52f1..448b87e 100644
--- a/midori/midori-download.vala
+++ b/midori/midori-download.vala
@@ -225,7 +225,7 @@ namespace Midori {
}
public string get_filename_suggestion_for_uri (string mime_type, string uri) {
- return_if_fail (Midori.URI.is_location (uri));
+ return_val_if_fail (Midori.URI.is_location (uri), uri);
string filename = File.new_for_uri (uri).get_basename ();
if (uri.index_of_char ('.') == -1)
return Path.build_filename (filename, fallback_extension (null, mime_type));
diff --git a/midori/midori-tab.vala b/midori/midori-tab.vala
index db6e6a8..c8994b3 100644
--- a/midori/midori-tab.vala
+++ b/midori/midori-tab.vala
@@ -106,11 +106,16 @@ namespace Midori {
public void inject_stylesheet (string stylesheet) {
#if HAVE_DOM
var dom = web_view.get_dom_document ();
- var style = dom.create_element ("style");
- style.set_attribute ("type", "text/css");
- style.append_child (dom.create_text_node (stylesheet));
- return_if_fail (dom.head != null);
- dom.head.append_child (style);
+ try {
+ var style = dom.create_element ("style");
+ style.set_attribute ("type", "text/css");
+ style.append_child (dom.create_text_node (stylesheet));
+ return_if_fail (dom.head != null);
+ dom.head.append_child (style);
+ }
+ catch (Error error) {
+ critical (_("Failed to injet stylesheet: %s"), error.message);
+ }
#else
web_view.execute_script ("""
(function () {
More information about the Xfce4-commits
mailing list