Merge branch 'upstream-unstable'
This commit is contained in:
commit
9b1cba045f
64 changed files with 17008 additions and 10282 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,5 +1,20 @@
|
||||||
This file is licensed under the terms of the expat license, see the file EXPAT.
|
This file is licensed under the terms of the expat license, see the file EXPAT.
|
||||||
|
|
||||||
|
v0.4.6:
|
||||||
|
+ Fix crasher in geolocation infobar
|
||||||
|
+ Fix crasher in about:version on some systems
|
||||||
|
+ Fix crasher opening bookmarks from Unity global menu
|
||||||
|
+ Use WebKitFaviconDatabase as of WebKit 1.8.0
|
||||||
|
+ Use midori-prefixed temp folder in midori_view_save_source
|
||||||
|
+ Fix cancelling downloads with SteadyFlow or Aria2
|
||||||
|
+ Fix crash dialog instead of opening tab in a running window
|
||||||
|
+ Fix page icons in multi-frame sites (gmail, tumbler)
|
||||||
|
+ Distinguish Simplified and Traditional Chinese
|
||||||
|
+ Support go-jump-symbolic
|
||||||
|
+ Handle empty tabs due to download links with a target
|
||||||
|
+ Handle frame load interrupted in the unholy trinity
|
||||||
|
+ Fix libsoup version check and wrong SSL status in location
|
||||||
|
|
||||||
v0.4.5:
|
v0.4.5:
|
||||||
+ Work around black border around widgets on Win32
|
+ Work around black border around widgets on Win32
|
||||||
+ Whitelist direct/ re-directed navigation requests in adblock
|
+ Whitelist direct/ re-directed navigation requests in adblock
|
||||||
|
|
4
INSTALL
4
INSTALL
|
@ -67,6 +67,10 @@ If you want to "dry run" without WebKitGTK+ rendering, try this:
|
||||||
|
|
||||||
'MIDORI_UNARMED=1 _build/default/midori/midori'
|
'MIDORI_UNARMED=1 _build/default/midori/midori'
|
||||||
|
|
||||||
|
If you want to test bookmarks, you can enable database tracing:
|
||||||
|
|
||||||
|
'MIDORI_BOOKMARKS_DEBUG=1 _build/default/midori/midori'
|
||||||
|
|
||||||
To disable Netscape plugins, use MOZ_PLUGIN_PATH=/.
|
To disable Netscape plugins, use MOZ_PLUGIN_PATH=/.
|
||||||
|
|
||||||
To debug extensions you can specify the path:
|
To debug extensions you can specify the path:
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<title>midori:faq</title>
|
<title>midori:faq</title>
|
||||||
<meta name="generator" content="DokuWiki"/>
|
<meta name="generator" content="DokuWiki"/>
|
||||||
<meta name="robots" content="noindex,nofollow"/>
|
<meta name="robots" content="noindex,nofollow"/>
|
||||||
<meta name="date" content="2012-03-18T00:07:24+0100"/>
|
<meta name="date" content="2012-05-11T19:02:21+0200"/>
|
||||||
<meta name="keywords" content="midori,faq"/>
|
<meta name="keywords" content="midori,faq"/>
|
||||||
<link rel="search" type="application/opensearchdescription+xml" href="/lib/exe/opensearch.php" title="Xfce Wiki"/>
|
<link rel="search" type="application/opensearchdescription+xml" href="/lib/exe/opensearch.php" title="Xfce Wiki"/>
|
||||||
<link rel="start" href="/"/>
|
<link rel="start" href="/"/>
|
||||||
|
@ -17,11 +17,13 @@
|
||||||
<link rel="alternate" type="text/html" title="Plain HTML" href="/_export/xhtml/midori/faq"/>
|
<link rel="alternate" type="text/html" title="Plain HTML" href="/_export/xhtml/midori/faq"/>
|
||||||
<link rel="alternate" type="text/plain" title="Wiki Markup" href="/_export/raw/midori/faq"/>
|
<link rel="alternate" type="text/plain" title="Wiki Markup" href="/_export/raw/midori/faq"/>
|
||||||
<link rel="canonical" href="http://wiki.xfce.org/midori/faq"/>
|
<link rel="canonical" href="http://wiki.xfce.org/midori/faq"/>
|
||||||
<link rel="stylesheet" type="text/css" href="faq.css" />
|
<link rel="stylesheet" href="faq.css" />
|
||||||
|
<link rel="stylesheet" href="faq.css" />
|
||||||
|
<link rel="stylesheet" href="faq.css" />
|
||||||
<script type="text/javascript"><!--//--><![CDATA[//><!--
|
<script type="text/javascript"><!--//--><![CDATA[//><!--
|
||||||
var NS='midori';var JSINFO = {"id":"midori:faq","namespace":"midori"};
|
var NS='midori';var JSINFO = {"id":"midori:faq","namespace":"midori"};
|
||||||
//--><!]]></script>
|
//--><!]]></script>
|
||||||
<script type="text/javascript" charset="utf-8" src="/lib/exe/js.php?tseed=1330500193"></script>
|
<script type="text/javascript" charset="utf-8" src="/lib/exe/js.php?tseed=1334991875"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="dokuwiki export">
|
<div class="dokuwiki export">
|
||||||
|
@ -73,20 +75,12 @@ var NS='midori';var JSINFO = {"id":"midori:faq","namespace":"midori"};
|
||||||
<p>
|
<p>
|
||||||
This is a list of frequently asked questions about the Midori Web Browser. Anyone feel free to improve and/ or extend this page, but keep it clean and easy to read for other Xfce users.
|
This is a list of frequently asked questions about the Midori Web Browser. Anyone feel free to improve and/ or extend this page, but keep it clean and easy to read for other Xfce users.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
|
||||||
This is a snapshot of Frequently Asked Questions designated for offline viewing. The most recent version of this document can be found <a href="http://wiki.xfce.org/midori/faq">in the Xfce wiki</a>.
|
|
||||||
<p/>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- EDIT1 SECTION "Midori - Frequently asked questions" [1-289] -->
|
<!-- EDIT1 SECTION "Midori - Frequently asked questions" [1-289] -->
|
||||||
<h1 class="sectionedit2"><a name="getting_started" id="getting_started">Getting started</a></h1>
|
<h1 class="sectionedit2"><a name="getting_started" id="getting_started">Getting started</a></h1>
|
||||||
<div class="level1">
|
<div class="level1">
|
||||||
|
|
||||||
</div>
|
|
||||||
<!-- EDIT2 SECTION "Getting started" [290-319] -->
|
|
||||||
<h2 class="sectionedit3"><a name="about_midori" id="about_midori">About Midori</a></h2>
|
|
||||||
<div class="level2">
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h4><a name="what_is_midori_and_why_should_i_use_it" id="what_is_midori_and_why_should_i_use_it">What is "Midori" and why should I use it?</a></h4>
|
<h4><a name="what_is_midori_and_why_should_i_use_it" id="what_is_midori_and_why_should_i_use_it">What is "Midori" and why should I use it?</a></h4>
|
||||||
|
@ -133,7 +127,7 @@ Midori and all delivered artwork are licensed under the LGPL2.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- EDIT2 SECTION "Getting started" [290-1188] -->
|
||||||
<h1 class="sectionedit3"><a name="common_problems" id="common_problems">Common problems</a></h1>
|
<h1 class="sectionedit3"><a name="common_problems" id="common_problems">Common problems</a></h1>
|
||||||
<div class="level1">
|
<div class="level1">
|
||||||
|
|
||||||
|
@ -229,7 +223,7 @@ export XDG_CACHE_HOME=/dev/shm
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- EDIT3 SECTION "Common problems" [1189-3299] -->
|
||||||
<h2 class="sectionedit4"><a name="flash_doesn_t_work" id="flash_doesn_t_work">Flash doesn't work</a></h2>
|
<h2 class="sectionedit4"><a name="flash_doesn_t_work" id="flash_doesn_t_work">Flash doesn't work</a></h2>
|
||||||
<div class="level2">
|
<div class="level2">
|
||||||
|
|
||||||
|
@ -281,13 +275,18 @@ That's a problem with WebKit. You can work around it to some extent if you
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h4><a name="scroll_with_middle_mouse_button" id="scroll_with_middle_mouse_button">Scroll with middle mouse button</a></h4>
|
<h4><a name="scroll_with_middle_mouse_buttonpan-scrolling" id="scroll_with_middle_mouse_buttonpan-scrolling">Scroll with middle mouse button/ pan-scrolling</a></h4>
|
||||||
<div class="level4">
|
<div class="level4">
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a href="http://ubuntuforums.org/showthread.php?t=478418" class="urlextern" title="http://ubuntuforums.org/showthread.php?t=478418" rel="nofollow">http://ubuntuforums.org/showthread.php?t=478418</a>
|
<a href="http://ubuntuforums.org/showthread.php?t=478418" class="urlextern" title="http://ubuntuforums.org/showthread.php?t=478418" rel="nofollow">http://ubuntuforums.org/showthread.php?t=478418</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Bug: <a href="https://bugs.launchpad.net/webkit/+bug/871425" class="urlextern" title="https://bugs.launchpad.net/webkit/+bug/871425" rel="nofollow">https://bugs.launchpad.net/webkit/+bug/871425</a>
|
||||||
|
Upstream Bug: <a href="https://bugs.webkit.org/show_bug.cgi?id=50561" class="urlextern" title="https://bugs.webkit.org/show_bug.cgi?id=50561" rel="nofollow">https://bugs.webkit.org/show_bug.cgi?id=50561</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h4><a name="html5_video_doesn_t_play" id="html5_video_doesn_t_play">HTML5 Video doesn't play</a></h4>
|
<h4><a name="html5_video_doesn_t_play" id="html5_video_doesn_t_play">HTML5 Video doesn't play</a></h4>
|
||||||
|
@ -460,12 +459,12 @@ Now while typing any errors should get underlined in red. To get suggestions, hi
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- EDIT4 SECTION "Flash doesn't work" [3300-8989] -->
|
||||||
<h1 class="sectionedit5"><a name="privacy" id="privacy">Privacy</a></h1>
|
<h1 class="sectionedit5"><a name="privacy" id="privacy">Privacy</a></h1>
|
||||||
<div class="level1">
|
<div class="level1">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- EDIT5 SECTION "Privacy" [8990-9012] -->
|
||||||
<h2 class="sectionedit6"><a name="blacklist_cookies" id="blacklist_cookies">Blacklist cookies</a></h2>
|
<h2 class="sectionedit6"><a name="blacklist_cookies" id="blacklist_cookies">Blacklist cookies</a></h2>
|
||||||
<div class="level2">
|
<div class="level2">
|
||||||
|
|
||||||
|
@ -491,7 +490,7 @@ The feature is currently experimental and will change in future versions.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- EDIT6 SECTION "Blacklist cookies" [9013-9549] -->
|
||||||
<h2 class="sectionedit7"><a name="adblock" id="adblock">Adblock</a></h2>
|
<h2 class="sectionedit7"><a name="adblock" id="adblock">Adblock</a></h2>
|
||||||
<div class="level2">
|
<div class="level2">
|
||||||
|
|
||||||
|
@ -500,12 +499,12 @@ The Advertisement Blocker can be activated under Extensions. It uses the same li
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- EDIT7 SECTION "Adblock" [9550-9805] -->
|
||||||
<h1 class="sectionedit8"><a name="modes" id="modes">Modes</a></h1>
|
<h1 class="sectionedit8"><a name="modes" id="modes">Modes</a></h1>
|
||||||
<div class="level1">
|
<div class="level1">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- EDIT8 SECTION "Modes" [9806-9826] -->
|
||||||
<h2 class="sectionedit9"><a name="web_applications" id="web_applications">Web Applications</a></h2>
|
<h2 class="sectionedit9"><a name="web_applications" id="web_applications">Web Applications</a></h2>
|
||||||
<div class="level2">
|
<div class="level2">
|
||||||
|
|
||||||
|
@ -526,7 +525,7 @@ There are two closely related features to open websites as dedicated windows of
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- EDIT9 SECTION "Web Applications" [9827-10343] -->
|
||||||
<h2 class="sectionedit10"><a name="private_browsing" id="private_browsing">Private Browsing</a></h2>
|
<h2 class="sectionedit10"><a name="private_browsing" id="private_browsing">Private Browsing</a></h2>
|
||||||
<div class="level2">
|
<div class="level2">
|
||||||
|
|
||||||
|
@ -552,7 +551,7 @@ The same options available to -a/ –app can be used for private browsing mode.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- EDIT10 SECTION "Private Browsing" [10344-11263] -->
|
||||||
<h2 class="sectionedit11"><a name="kiosk_mode" id="kiosk_mode">Kiosk mode</a></h2>
|
<h2 class="sectionedit11"><a name="kiosk_mode" id="kiosk_mode">Kiosk mode</a></h2>
|
||||||
<div class="level2">
|
<div class="level2">
|
||||||
|
|
||||||
|
@ -584,7 +583,7 @@ Any links outside end up in an error page. All images and other files won't
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- EDIT11 SECTION "Kiosk mode" [11264-12301] -->
|
||||||
<h1 class="sectionedit12"><a name="proxy_servers" id="proxy_servers">Proxy servers</a></h1>
|
<h1 class="sectionedit12"><a name="proxy_servers" id="proxy_servers">Proxy servers</a></h1>
|
||||||
<div class="level1">
|
<div class="level1">
|
||||||
|
|
||||||
|
@ -664,7 +663,7 @@ server_port = 5555</pre>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- EDIT12 SECTION "Proxy servers" [12302-13990] -->
|
||||||
<h1 class="sectionedit13"><a name="keyboard_hotkeys" id="keyboard_hotkeys">Keyboard Hotkeys</a></h1>
|
<h1 class="sectionedit13"><a name="keyboard_hotkeys" id="keyboard_hotkeys">Keyboard Hotkeys</a></h1>
|
||||||
<div class="level1">
|
<div class="level1">
|
||||||
|
|
||||||
|
@ -746,7 +745,7 @@ When using Ctrl+f to bring up Find, use Ctrl+f again or ESC. When using ”/”
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- EDIT13 SECTION "Keyboard Hotkeys" [13991-15328] -->
|
||||||
<h1 class="sectionedit14"><a name="mouse_gestures" id="mouse_gestures">Mouse Gestures</a></h1>
|
<h1 class="sectionedit14"><a name="mouse_gestures" id="mouse_gestures">Mouse Gestures</a></h1>
|
||||||
<div class="level1">
|
<div class="level1">
|
||||||
|
|
||||||
|
@ -776,7 +775,7 @@ Additionally, there are programs allowing mouse gestures system-wide, for exampl
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- EDIT14 SECTION "Mouse Gestures" [15329-16004] -->
|
||||||
<h1 class="sectionedit15"><a name="user_scripts_and_styles" id="user_scripts_and_styles">User scripts and styles</a></h1>
|
<h1 class="sectionedit15"><a name="user_scripts_and_styles" id="user_scripts_and_styles">User scripts and styles</a></h1>
|
||||||
<div class="level1">
|
<div class="level1">
|
||||||
|
|
||||||
|
@ -837,7 +836,7 @@ You can also use <a href="http://rightfootin.blogspot.com/2009/04/flashblock-wan
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- EDIT15 SECTION "User scripts and styles" [16005-18559] -->
|
||||||
<h2 class="sectionedit16"><a name="user_styles" id="user_styles">User styles</a></h2>
|
<h2 class="sectionedit16"><a name="user_styles" id="user_styles">User styles</a></h2>
|
||||||
<div class="level2">
|
<div class="level2">
|
||||||
|
|
||||||
|
@ -899,6 +898,6 @@ Customize as needed:
|
||||||
}</pre>
|
}</pre>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- EDIT18 SECTION "User styles" [16105-] --></div>
|
<!-- EDIT16 SECTION "User styles" [18560-] --></div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -808,7 +808,7 @@ adblock_resource_request_starting_cb (WebKitWebView* web_view,
|
||||||
WebKitWebResource* web_resource,
|
WebKitWebResource* web_resource,
|
||||||
WebKitNetworkRequest* request,
|
WebKitNetworkRequest* request,
|
||||||
WebKitNetworkResponse* response,
|
WebKitNetworkResponse* response,
|
||||||
GtkWidget* image)
|
MidoriView* view)
|
||||||
{
|
{
|
||||||
SoupMessage* msg;
|
SoupMessage* msg;
|
||||||
GList* blocked_uris;
|
GList* blocked_uris;
|
||||||
|
@ -1012,7 +1012,6 @@ adblock_add_tab_cb (MidoriBrowser* browser,
|
||||||
MidoriExtension* extension)
|
MidoriExtension* extension)
|
||||||
{
|
{
|
||||||
GtkWidget* web_view = midori_view_get_web_view (view);
|
GtkWidget* web_view = midori_view_get_web_view (view);
|
||||||
GtkWidget* image = g_object_get_data (G_OBJECT (browser), "status-image");
|
|
||||||
|
|
||||||
g_signal_connect (web_view, "window-object-cleared",
|
g_signal_connect (web_view, "window-object-cleared",
|
||||||
G_CALLBACK (adblock_window_object_cleared_cb), 0);
|
G_CALLBACK (adblock_window_object_cleared_cb), 0);
|
||||||
|
@ -1022,9 +1021,9 @@ adblock_add_tab_cb (MidoriBrowser* browser,
|
||||||
g_signal_connect (web_view, "navigation-policy-decision-requested",
|
g_signal_connect (web_view, "navigation-policy-decision-requested",
|
||||||
G_CALLBACK (adblock_navigation_policy_decision_requested_cb), view);
|
G_CALLBACK (adblock_navigation_policy_decision_requested_cb), view);
|
||||||
g_signal_connect (web_view, "resource-request-starting",
|
g_signal_connect (web_view, "resource-request-starting",
|
||||||
G_CALLBACK (adblock_resource_request_starting_cb), image);
|
G_CALLBACK (adblock_resource_request_starting_cb), view);
|
||||||
g_signal_connect (web_view, "load-finished",
|
g_signal_connect (web_view, "load-finished",
|
||||||
G_CALLBACK (adblock_load_finished_cb), image);
|
G_CALLBACK (adblock_load_finished_cb), view);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1501,16 +1500,15 @@ adblock_deactivate_tabs (MidoriView* view,
|
||||||
MidoriExtension* extension)
|
MidoriExtension* extension)
|
||||||
{
|
{
|
||||||
GtkWidget* web_view = midori_view_get_web_view (view);
|
GtkWidget* web_view = midori_view_get_web_view (view);
|
||||||
GtkWidget* image = g_object_get_data (G_OBJECT (browser), "status-image");
|
|
||||||
|
|
||||||
g_signal_handlers_disconnect_by_func (
|
g_signal_handlers_disconnect_by_func (
|
||||||
web_view, adblock_window_object_cleared_cb, 0);
|
web_view, adblock_window_object_cleared_cb, 0);
|
||||||
g_signal_handlers_disconnect_by_func (
|
g_signal_handlers_disconnect_by_func (
|
||||||
web_view, adblock_populate_popup_cb, extension);
|
web_view, adblock_populate_popup_cb, extension);
|
||||||
g_signal_handlers_disconnect_by_func (
|
g_signal_handlers_disconnect_by_func (
|
||||||
web_view, adblock_resource_request_starting_cb, image);
|
web_view, adblock_resource_request_starting_cb, view);
|
||||||
g_signal_handlers_disconnect_by_func (
|
g_signal_handlers_disconnect_by_func (
|
||||||
web_view, adblock_load_finished_cb, image);
|
web_view, adblock_load_finished_cb, view);
|
||||||
g_signal_handlers_disconnect_by_func (
|
g_signal_handlers_disconnect_by_func (
|
||||||
web_view, adblock_navigation_policy_decision_requested_cb, view);
|
web_view, adblock_navigation_policy_decision_requested_cb, view);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,8 @@ namespace EDM {
|
||||||
|
|
||||||
public bool download_requested (Midori.View view, WebKit.Download download) {
|
public bool download_requested (Midori.View view, WebKit.Download download) {
|
||||||
if (download.get_data<void*> ("save-as-download") == null
|
if (download.get_data<void*> ("save-as-download") == null
|
||||||
&& download.get_data<void*> ("open-download") == null) {
|
&& download.get_data<void*> ("open-download") == null
|
||||||
|
&& download.get_data<void*> ("cancel-download") == null) {
|
||||||
var dlReq = new DownloadRequest ();
|
var dlReq = new DownloadRequest ();
|
||||||
dlReq.uri = download.get_uri ();
|
dlReq.uri = download.get_uri ();
|
||||||
|
|
||||||
|
|
|
@ -406,7 +406,7 @@ static TBEditorWidget *tb_editor_create_dialog(MidoriBrowser *parent)
|
||||||
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
|
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
|
||||||
|
|
||||||
label = gtk_label_new(
|
label = gtk_label_new(
|
||||||
_("Select items to be displayed on the toolbar. Items can be reodered by drag and drop."));
|
_("Select items to be displayed on the toolbar. Items can be reordered by drag and drop."));
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
|
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
|
||||||
|
|
||||||
tree_available = gtk_tree_view_new();
|
tree_available = gtk_tree_view_new();
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
|
|
||||||
|
#include <webkit/webkit.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:katze-item
|
* SECTION:katze-item
|
||||||
* @short_description: A useful item
|
* @short_description: A useful item
|
||||||
|
@ -421,6 +423,40 @@ katze_item_set_icon (KatzeItem* item,
|
||||||
g_object_notify (G_OBJECT (item), "icon");
|
g_object_notify (G_OBJECT (item), "icon");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* katze_item_get_pixbuf:
|
||||||
|
* @item: a #KatzeItem
|
||||||
|
* @widget: a #GtkWidget, or %NULL
|
||||||
|
*
|
||||||
|
* Retrieves a #GdkPixbuf fit to display @item.
|
||||||
|
*
|
||||||
|
* Return value: the icon of the item
|
||||||
|
*
|
||||||
|
* Since: 0.4.6
|
||||||
|
**/
|
||||||
|
GdkPixbuf*
|
||||||
|
katze_item_get_pixbuf (KatzeItem* item,
|
||||||
|
GtkWidget* widget)
|
||||||
|
{
|
||||||
|
GdkPixbuf* pixbuf;
|
||||||
|
|
||||||
|
g_return_val_if_fail (KATZE_IS_ITEM (item), NULL);
|
||||||
|
|
||||||
|
if (item->uri == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
#if WEBKIT_CHECK_VERSION (1, 8, 0)
|
||||||
|
/* FIXME: Don't hard-code icon size */
|
||||||
|
if ((pixbuf = webkit_favicon_database_try_get_favicon_pixbuf (
|
||||||
|
webkit_get_favicon_database (), item->uri, 16, 16)))
|
||||||
|
return pixbuf;
|
||||||
|
#else
|
||||||
|
if ((pixbuf = g_object_get_data (G_OBJECT (item), "pixbuf")))
|
||||||
|
return pixbuf;
|
||||||
|
#endif
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* katze_item_get_image:
|
* katze_item_get_image:
|
||||||
* @item: a #KatzeItem
|
* @item: a #KatzeItem
|
||||||
|
@ -442,7 +478,8 @@ katze_item_get_image (KatzeItem* item)
|
||||||
|
|
||||||
if (KATZE_ITEM_IS_FOLDER (item))
|
if (KATZE_ITEM_IS_FOLDER (item))
|
||||||
image = gtk_image_new_from_stock (GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_MENU);
|
image = gtk_image_new_from_stock (GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_MENU);
|
||||||
else if ((pixbuf = g_object_get_data (G_OBJECT (item), "pixbuf")))
|
/* FIXME: Pass widget for icon size */
|
||||||
|
else if ((pixbuf = katze_item_get_pixbuf (item, NULL)))
|
||||||
image = gtk_image_new_from_pixbuf (pixbuf);
|
image = gtk_image_new_from_pixbuf (pixbuf);
|
||||||
else if ((icon = katze_item_get_icon (item)) && !strchr (icon, '/'))
|
else if ((icon = katze_item_get_icon (item)) && !strchr (icon, '/'))
|
||||||
image = gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_MENU);
|
image = gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_MENU);
|
||||||
|
|
|
@ -91,6 +91,10 @@ void
|
||||||
katze_item_set_icon (KatzeItem* item,
|
katze_item_set_icon (KatzeItem* item,
|
||||||
const gchar* icon);
|
const gchar* icon);
|
||||||
|
|
||||||
|
GdkPixbuf*
|
||||||
|
katze_item_get_pixbuf (KatzeItem* item,
|
||||||
|
GtkWidget* widget);
|
||||||
|
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
katze_item_get_image (KatzeItem* item);
|
katze_item_get_image (KatzeItem* item);
|
||||||
|
|
||||||
|
|
111
midori/main.c
111
midori/main.c
|
@ -13,6 +13,7 @@
|
||||||
#include "midori-app.h"
|
#include "midori-app.h"
|
||||||
#include "midori-array.h"
|
#include "midori-array.h"
|
||||||
#include "midori-bookmarks.h"
|
#include "midori-bookmarks.h"
|
||||||
|
#include "panels/midori-bookmarks.h"
|
||||||
#include "midori-extension.h"
|
#include "midori-extension.h"
|
||||||
#include "midori-extensions.h"
|
#include "midori-extensions.h"
|
||||||
#include "midori-history.h"
|
#include "midori-history.h"
|
||||||
|
@ -528,93 +529,6 @@ midori_history_terminate (KatzeArray* array,
|
||||||
sqlite3_close (db);
|
sqlite3_close (db);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
midori_bookmarks_add_item_cb (KatzeArray* array,
|
|
||||||
KatzeItem* item,
|
|
||||||
sqlite3* db)
|
|
||||||
{
|
|
||||||
midori_bookmarks_insert_item_db (db, item,
|
|
||||||
katze_item_get_meta_string (item, "folder"));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
midori_bookmarks_remove_item_cb (KatzeArray* array,
|
|
||||||
KatzeItem* item,
|
|
||||||
sqlite3* db)
|
|
||||||
{
|
|
||||||
gchar* sqlcmd;
|
|
||||||
char* errmsg = NULL;
|
|
||||||
|
|
||||||
if (KATZE_ITEM_IS_BOOKMARK (item))
|
|
||||||
sqlcmd = sqlite3_mprintf (
|
|
||||||
"DELETE FROM bookmarks WHERE uri = '%q' "
|
|
||||||
" AND folder = '%q'",
|
|
||||||
katze_item_get_uri (item),
|
|
||||||
katze_str_non_null (katze_item_get_meta_string (item, "folder")));
|
|
||||||
|
|
||||||
else
|
|
||||||
sqlcmd = sqlite3_mprintf (
|
|
||||||
"DELETE FROM bookmarks WHERE title = '%q'"
|
|
||||||
" AND folder = '%q'",
|
|
||||||
katze_item_get_name (item),
|
|
||||||
katze_str_non_null (katze_item_get_meta_string (item, "folder")));
|
|
||||||
|
|
||||||
if (sqlite3_exec (db, sqlcmd, NULL, NULL, &errmsg) != SQLITE_OK)
|
|
||||||
{
|
|
||||||
g_printerr (_("Failed to remove history item: %s\n"), errmsg);
|
|
||||||
sqlite3_free (errmsg);
|
|
||||||
}
|
|
||||||
|
|
||||||
sqlite3_free (sqlcmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
static sqlite3*
|
|
||||||
midori_bookmarks_initialize (KatzeArray* array,
|
|
||||||
const gchar* filename,
|
|
||||||
char** errmsg)
|
|
||||||
{
|
|
||||||
sqlite3* db;
|
|
||||||
|
|
||||||
if (sqlite3_open (filename, &db) != SQLITE_OK)
|
|
||||||
{
|
|
||||||
if (errmsg)
|
|
||||||
*errmsg = g_strdup_printf (_("Failed to open database: %s\n"),
|
|
||||||
sqlite3_errmsg (db));
|
|
||||||
sqlite3_close (db);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sqlite3_exec (db,
|
|
||||||
"CREATE TABLE IF NOT EXISTS "
|
|
||||||
"bookmarks (uri text, title text, folder text, "
|
|
||||||
"desc text, app integer, toolbar integer);",
|
|
||||||
NULL, NULL, errmsg) != SQLITE_OK)
|
|
||||||
return NULL;
|
|
||||||
g_signal_connect (array, "add-item",
|
|
||||||
G_CALLBACK (midori_bookmarks_add_item_cb), db);
|
|
||||||
g_signal_connect (array, "remove-item",
|
|
||||||
G_CALLBACK (midori_bookmarks_remove_item_cb), db);
|
|
||||||
return db;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
midori_bookmarks_import (const gchar* filename,
|
|
||||||
sqlite3* db)
|
|
||||||
{
|
|
||||||
KatzeArray* bookmarks;
|
|
||||||
GError* error = NULL;
|
|
||||||
|
|
||||||
bookmarks = katze_array_new (KATZE_TYPE_ARRAY);
|
|
||||||
|
|
||||||
if (!midori_array_from_file (bookmarks, filename, "xbel", &error))
|
|
||||||
{
|
|
||||||
g_warning (_("The bookmarks couldn't be saved. %s"), error->message);
|
|
||||||
g_error_free (error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
midori_bookmarks_import_array_db (db, bookmarks, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
settings_notify_cb (MidoriWebSettings* settings,
|
settings_notify_cb (MidoriWebSettings* settings,
|
||||||
GParamSpec* pspec,
|
GParamSpec* pspec,
|
||||||
|
@ -1067,6 +981,13 @@ midori_load_soup_session (gpointer settings)
|
||||||
G_CALLBACK (soup_session_settings_notify_first_party_cb), session);
|
G_CALLBACK (soup_session_settings_notify_first_party_cb), session);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if WEBKIT_CHECK_VERSION (1, 8, 0)
|
||||||
|
gchar* cache = g_build_filename (g_get_user_data_dir (),
|
||||||
|
"webkit", "icondatabase", NULL);
|
||||||
|
webkit_favicon_database_set_path (webkit_get_favicon_database (), cache);
|
||||||
|
g_free (cache);
|
||||||
|
#endif
|
||||||
|
|
||||||
g_signal_connect (session, "request-queued",
|
g_signal_connect (session, "request-queued",
|
||||||
G_CALLBACK (midori_soup_session_settings_accept_language_cb), settings);
|
G_CALLBACK (midori_soup_session_settings_accept_language_cb), settings);
|
||||||
|
|
||||||
|
@ -1880,6 +1801,9 @@ midori_clear_page_icons_cb (void)
|
||||||
"webkit", "icondatabase", NULL);
|
"webkit", "icondatabase", NULL);
|
||||||
sokoke_remove_path (cache, TRUE);
|
sokoke_remove_path (cache, TRUE);
|
||||||
g_free (cache);
|
g_free (cache);
|
||||||
|
#if WEBKIT_CHECK_VERSION (1, 8, 0)
|
||||||
|
webkit_favicon_database_clear (webkit_get_favicon_database ());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2096,11 +2020,21 @@ main (int argc,
|
||||||
MidoriBrowser* browser = midori_browser_new ();
|
MidoriBrowser* browser = midori_browser_new ();
|
||||||
GtkActionGroup* action_group = midori_browser_get_action_group (browser);
|
GtkActionGroup* action_group = midori_browser_get_action_group (browser);
|
||||||
GList* actions = gtk_action_group_list_actions (action_group);
|
GList* actions = gtk_action_group_list_actions (action_group);
|
||||||
|
GList* temp = actions;
|
||||||
|
guint length = 1;
|
||||||
|
gchar* space;
|
||||||
|
|
||||||
|
for (; temp; temp = g_list_next (temp))
|
||||||
|
{
|
||||||
|
GtkAction* action = temp->data;
|
||||||
|
length = MAX (length, 1 + strlen (gtk_action_get_name (action)));
|
||||||
|
}
|
||||||
|
|
||||||
|
space = g_strnfill (length, ' ');
|
||||||
for (; actions; actions = g_list_next (actions))
|
for (; actions; actions = g_list_next (actions))
|
||||||
{
|
{
|
||||||
GtkAction* action = actions->data;
|
GtkAction* action = actions->data;
|
||||||
const gchar* name = gtk_action_get_name (action);
|
const gchar* name = gtk_action_get_name (action);
|
||||||
const gchar* space = " ";
|
|
||||||
gchar* padding = g_strndup (space, strlen (space) - strlen (name));
|
gchar* padding = g_strndup (space, strlen (space) - strlen (name));
|
||||||
gchar* label = katze_object_get_string (action, "label");
|
gchar* label = katze_object_get_string (action, "label");
|
||||||
gchar* stripped = katze_strip_mnemonics (label);
|
gchar* stripped = katze_strip_mnemonics (label);
|
||||||
|
@ -2112,6 +2046,7 @@ main (int argc,
|
||||||
g_free (label);
|
g_free (label);
|
||||||
g_free (stripped);
|
g_free (stripped);
|
||||||
}
|
}
|
||||||
|
g_free (space);
|
||||||
g_list_free (actions);
|
g_list_free (actions);
|
||||||
gtk_widget_destroy (GTK_WIDGET (browser));
|
gtk_widget_destroy (GTK_WIDGET (browser));
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -734,7 +734,12 @@ midori_app_create_instance (MidoriApp* app)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef GDK_WINDOWING_X11
|
||||||
|
/* On X11: :0 or :0.0 which is equivalent */
|
||||||
|
display_name = g_strndup (gdk_display_get_name (display), 2);
|
||||||
|
#else
|
||||||
display_name = g_strdup (gdk_display_get_name (display));
|
display_name = g_strdup (gdk_display_get_name (display));
|
||||||
|
#endif
|
||||||
n = strlen (display_name);
|
n = strlen (display_name);
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
if (strchr (":.\\/", display_name[i]))
|
if (strchr (":.\\/", display_name[i]))
|
||||||
|
|
116
midori/midori-bookmarks.c
Normal file
116
midori/midori-bookmarks.c
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2010 Christian Dywan <christian@twotoasts.de>
|
||||||
|
Copyright (C) 2010 Alexander Butenko <a.butenka@gmail.com>
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
See the file COPYING for the full license text.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "midori-bookmarks.h"
|
||||||
|
#include "panels/midori-bookmarks.h"
|
||||||
|
#include "midori-array.h"
|
||||||
|
|
||||||
|
#include <glib/gi18n.h>
|
||||||
|
|
||||||
|
#ifdef G_ENABLE_DEBUG
|
||||||
|
void midori_bookmarks_dbtracer(void* dummy, const char* query)
|
||||||
|
{
|
||||||
|
g_printerr ("%s\n", query);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void
|
||||||
|
midori_bookmarks_add_item_cb (KatzeArray* array,
|
||||||
|
KatzeItem* item,
|
||||||
|
sqlite3* db)
|
||||||
|
{
|
||||||
|
midori_bookmarks_insert_item_db (db, item,
|
||||||
|
katze_item_get_meta_string (item, "folder"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
midori_bookmarks_remove_item_cb (KatzeArray* array,
|
||||||
|
KatzeItem* item,
|
||||||
|
sqlite3* db)
|
||||||
|
{
|
||||||
|
gchar* sqlcmd;
|
||||||
|
char* errmsg = NULL;
|
||||||
|
|
||||||
|
if (KATZE_ITEM_IS_BOOKMARK (item))
|
||||||
|
sqlcmd = sqlite3_mprintf (
|
||||||
|
"DELETE FROM bookmarks WHERE uri = '%q' "
|
||||||
|
" AND folder = '%q'",
|
||||||
|
katze_item_get_uri (item),
|
||||||
|
katze_str_non_null (katze_item_get_meta_string (item, "folder")));
|
||||||
|
|
||||||
|
else
|
||||||
|
sqlcmd = sqlite3_mprintf (
|
||||||
|
"DELETE FROM bookmarks WHERE title = '%q'"
|
||||||
|
" AND folder = '%q'",
|
||||||
|
katze_item_get_name (item),
|
||||||
|
katze_str_non_null (katze_item_get_meta_string (item, "folder")));
|
||||||
|
|
||||||
|
if (sqlite3_exec (db, sqlcmd, NULL, NULL, &errmsg) != SQLITE_OK)
|
||||||
|
{
|
||||||
|
g_printerr (_("Failed to remove history item: %s\n"), errmsg);
|
||||||
|
sqlite3_free (errmsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
sqlite3_free (sqlcmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
sqlite3*
|
||||||
|
midori_bookmarks_initialize (KatzeArray* array,
|
||||||
|
const gchar* filename,
|
||||||
|
char** errmsg)
|
||||||
|
{
|
||||||
|
sqlite3* db;
|
||||||
|
|
||||||
|
if (sqlite3_open (filename, &db) != SQLITE_OK)
|
||||||
|
{
|
||||||
|
if (errmsg)
|
||||||
|
*errmsg = g_strdup_printf (_("Failed to open database: %s\n"),
|
||||||
|
sqlite3_errmsg (db));
|
||||||
|
sqlite3_close (db);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef G_ENABLE_DEBUG
|
||||||
|
if (g_getenv ("MIDORI_BOOKMARKS_DEBUG"))
|
||||||
|
sqlite3_trace (db, midori_bookmarks_dbtracer, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (sqlite3_exec (db,
|
||||||
|
"CREATE TABLE IF NOT EXISTS "
|
||||||
|
"bookmarks (uri text, title text, folder text, "
|
||||||
|
"desc text, app integer, toolbar integer);",
|
||||||
|
NULL, NULL, errmsg) != SQLITE_OK)
|
||||||
|
return NULL;
|
||||||
|
g_signal_connect (array, "add-item",
|
||||||
|
G_CALLBACK (midori_bookmarks_add_item_cb), db);
|
||||||
|
g_signal_connect (array, "remove-item",
|
||||||
|
G_CALLBACK (midori_bookmarks_remove_item_cb), db);
|
||||||
|
return db;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
midori_bookmarks_import (const gchar* filename,
|
||||||
|
sqlite3* db)
|
||||||
|
{
|
||||||
|
KatzeArray* bookmarks;
|
||||||
|
GError* error = NULL;
|
||||||
|
|
||||||
|
bookmarks = katze_array_new (KATZE_TYPE_ARRAY);
|
||||||
|
|
||||||
|
if (!midori_array_from_file (bookmarks, filename, "xbel", &error))
|
||||||
|
{
|
||||||
|
g_warning (_("The bookmarks couldn't be saved. %s"), error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
midori_bookmarks_import_array_db (db, bookmarks, "");
|
||||||
|
}
|
33
midori/midori-bookmarks.h
Normal file
33
midori/midori-bookmarks.h
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2010 Christian Dywan <christian@twotoasts.de>
|
||||||
|
Copyright (C) 2010 Alexander Butenko <a.butenka@gmail.com>
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
See the file COPYING for the full license text.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sqlite3.h>
|
||||||
|
#include <katze/katze.h>
|
||||||
|
|
||||||
|
void
|
||||||
|
midori_bookmarks_add_item_cb (KatzeArray* array,
|
||||||
|
KatzeItem* item,
|
||||||
|
sqlite3* db);
|
||||||
|
|
||||||
|
void
|
||||||
|
midori_bookmarks_remove_item_cb (KatzeArray* array,
|
||||||
|
KatzeItem* item,
|
||||||
|
sqlite3* db);
|
||||||
|
|
||||||
|
sqlite3*
|
||||||
|
midori_bookmarks_initialize (KatzeArray* array,
|
||||||
|
const gchar* filename,
|
||||||
|
char** errmsg);
|
||||||
|
|
||||||
|
void
|
||||||
|
midori_bookmarks_import (const gchar* filename,
|
||||||
|
sqlite3* db);
|
|
@ -284,6 +284,25 @@ _midori_browser_update_actions (MidoriBrowser* browser)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
midori_browser_update_secondary_icon (MidoriBrowser* browser,
|
||||||
|
MidoriView* view,
|
||||||
|
GtkAction* action)
|
||||||
|
{
|
||||||
|
if (g_object_get_data (G_OBJECT (view), "news-feeds"))
|
||||||
|
{
|
||||||
|
midori_location_action_set_secondary_icon (
|
||||||
|
MIDORI_LOCATION_ACTION (action), STOCK_NEWS_FEED);
|
||||||
|
_action_set_sensitive (browser, "AddNewsFeed", TRUE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
midori_location_action_set_secondary_icon (
|
||||||
|
MIDORI_LOCATION_ACTION (action), NULL);
|
||||||
|
_action_set_sensitive (browser, "AddNewsFeed", FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_midori_browser_update_interface (MidoriBrowser* browser)
|
_midori_browser_update_interface (MidoriBrowser* browser)
|
||||||
{
|
{
|
||||||
|
@ -350,20 +369,9 @@ _midori_browser_update_interface (MidoriBrowser* browser)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
action = _action_by_name (browser, "Location");
|
action = _action_by_name (browser, "Location");
|
||||||
if (g_object_get_data (G_OBJECT (view), "news-feeds"))
|
|
||||||
{
|
|
||||||
midori_location_action_set_secondary_icon (
|
|
||||||
MIDORI_LOCATION_ACTION (action), STOCK_NEWS_FEED);
|
|
||||||
_action_set_sensitive (browser, "AddNewsFeed", TRUE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
midori_location_action_set_secondary_icon (
|
|
||||||
MIDORI_LOCATION_ACTION (action), GTK_STOCK_JUMP_TO);
|
|
||||||
_action_set_sensitive (browser, "AddNewsFeed", FALSE);
|
|
||||||
}
|
|
||||||
midori_location_action_set_security_hint (
|
midori_location_action_set_security_hint (
|
||||||
MIDORI_LOCATION_ACTION (action), midori_view_get_security (view));
|
MIDORI_LOCATION_ACTION (action), midori_view_get_security (view));
|
||||||
|
midori_browser_update_secondary_icon (browser, MIDORI_VIEW (view), action);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -392,7 +400,6 @@ _midori_browser_set_statusbar_text (MidoriBrowser* browser,
|
||||||
GtkAction* action = _action_by_name (browser, "Location");
|
GtkAction* action = _action_by_name (browser, "Location");
|
||||||
MidoriLocationAction* location_action = MIDORI_LOCATION_ACTION (action);
|
MidoriLocationAction* location_action = MIDORI_LOCATION_ACTION (action);
|
||||||
midori_location_action_set_text (location_action, browser->statusbar_text);
|
midori_location_action_set_text (location_action, browser->statusbar_text);
|
||||||
midori_location_action_set_icon (location_action, NULL);
|
|
||||||
midori_location_action_set_secondary_icon (location_action, NULL);
|
midori_location_action_set_secondary_icon (location_action, NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -403,16 +410,9 @@ _midori_browser_set_statusbar_text (MidoriBrowser* browser,
|
||||||
#else
|
#else
|
||||||
GtkAction* action = _action_by_name (browser, "Location");
|
GtkAction* action = _action_by_name (browser, "Location");
|
||||||
MidoriLocationAction* location_action = MIDORI_LOCATION_ACTION (action);
|
MidoriLocationAction* location_action = MIDORI_LOCATION_ACTION (action);
|
||||||
if (g_object_get_data (G_OBJECT (view), "news-feeds"))
|
midori_browser_update_secondary_icon (browser, view, action);
|
||||||
midori_location_action_set_secondary_icon (
|
|
||||||
location_action, STOCK_NEWS_FEED);
|
|
||||||
else
|
|
||||||
midori_location_action_set_secondary_icon (
|
|
||||||
location_action, GTK_STOCK_JUMP_TO);
|
|
||||||
midori_location_action_set_text (location_action,
|
midori_location_action_set_text (location_action,
|
||||||
midori_view_get_display_uri (MIDORI_VIEW (view)));
|
midori_view_get_display_uri (MIDORI_VIEW (view)));
|
||||||
midori_location_action_set_icon (location_action,
|
|
||||||
midori_view_get_icon (MIDORI_VIEW (view)));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -494,14 +494,9 @@ midori_view_notify_icon_cb (MidoriView* view,
|
||||||
GParamSpec* pspec,
|
GParamSpec* pspec,
|
||||||
MidoriBrowser* browser)
|
MidoriBrowser* browser)
|
||||||
{
|
{
|
||||||
GtkAction* action;
|
|
||||||
|
|
||||||
if (midori_browser_get_current_tab (browser) != (GtkWidget*)view)
|
if (midori_browser_get_current_tab (browser) != (GtkWidget*)view)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
action = _action_by_name (browser, "Location");
|
|
||||||
midori_location_action_set_icon (MIDORI_LOCATION_ACTION (action),
|
|
||||||
midori_view_get_icon (view));
|
|
||||||
if (sokoke_is_app_or_private ())
|
if (sokoke_is_app_or_private ())
|
||||||
gtk_window_set_icon (GTK_WINDOW (browser), midori_view_get_icon (view));
|
gtk_window_set_icon (GTK_WINDOW (browser), midori_view_get_icon (view));
|
||||||
}
|
}
|
||||||
|
@ -519,17 +514,12 @@ midori_view_notify_load_status_cb (GtkWidget* widget,
|
||||||
uri = midori_view_get_display_uri (view);
|
uri = midori_view_get_display_uri (view);
|
||||||
action = _action_by_name (browser, "Location");
|
action = _action_by_name (browser, "Location");
|
||||||
|
|
||||||
if (load_status == MIDORI_LOAD_COMMITTED)
|
|
||||||
midori_location_action_add_uri (MIDORI_LOCATION_ACTION (action), uri);
|
|
||||||
|
|
||||||
if (widget == midori_browser_get_current_tab (browser))
|
if (widget == midori_browser_get_current_tab (browser))
|
||||||
{
|
{
|
||||||
if (load_status == MIDORI_LOAD_COMMITTED)
|
if (load_status == MIDORI_LOAD_COMMITTED)
|
||||||
{
|
{
|
||||||
midori_location_action_set_text (
|
midori_location_action_set_text (
|
||||||
MIDORI_LOCATION_ACTION (action), uri);
|
MIDORI_LOCATION_ACTION (action), uri);
|
||||||
midori_location_action_set_secondary_icon (
|
|
||||||
MIDORI_LOCATION_ACTION (action), GTK_STOCK_JUMP_TO);
|
|
||||||
g_object_notify (G_OBJECT (browser), "uri");
|
g_object_notify (G_OBJECT (browser), "uri");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -796,7 +786,7 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (browser),
|
dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (browser),
|
||||||
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, NULL);
|
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, NULL, NULL);
|
||||||
}
|
}
|
||||||
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
|
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
|
@ -1453,19 +1443,40 @@ midori_browser_download_prepare_destination_uri (WebKitDownload* download,
|
||||||
return destination_uri;
|
return destination_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
midori_browser_remove_tab_idle (gpointer view)
|
||||||
|
{
|
||||||
|
MidoriBrowser* browser;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GTK_IS_WIDGET (view), FALSE);
|
||||||
|
browser = midori_browser_get_for_widget (GTK_WIDGET (view));
|
||||||
|
midori_browser_remove_tab (browser, GTK_WIDGET (view));
|
||||||
|
return G_SOURCE_REMOVE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
midori_view_download_requested_cb (GtkWidget* view,
|
midori_view_download_requested_cb (GtkWidget* view,
|
||||||
WebKitDownload* download,
|
WebKitDownload* download,
|
||||||
MidoriBrowser* browser)
|
MidoriBrowser* browser)
|
||||||
{
|
{
|
||||||
if (g_object_get_data (G_OBJECT (download), "open-in-viewer"))
|
GtkWidget* web_view;
|
||||||
|
WebKitWebFrame* web_frame;
|
||||||
|
WebKitWebDataSource* datasource;
|
||||||
|
gboolean handled;
|
||||||
|
|
||||||
|
g_return_val_if_fail (MIDORI_IS_VIEW (view), FALSE);
|
||||||
|
handled = TRUE;
|
||||||
|
if (g_object_get_data (G_OBJECT (download), "cancel-download"))
|
||||||
|
{
|
||||||
|
handled = FALSE;
|
||||||
|
}
|
||||||
|
else if (g_object_get_data (G_OBJECT (download), "open-in-viewer"))
|
||||||
{
|
{
|
||||||
gchar* destination_uri =
|
gchar* destination_uri =
|
||||||
midori_browser_download_prepare_destination_uri (download, NULL);
|
midori_browser_download_prepare_destination_uri (download, NULL);
|
||||||
midori_browser_prepare_download (browser, download, destination_uri);
|
midori_browser_prepare_download (browser, download, destination_uri);
|
||||||
g_signal_connect (download, "notify::status",
|
g_signal_connect (download, "notify::status",
|
||||||
G_CALLBACK (midori_browser_download_status_cb), GTK_WIDGET (browser));
|
G_CALLBACK (midori_browser_download_status_cb), GTK_WIDGET (browser));
|
||||||
webkit_download_start (download);
|
|
||||||
g_free (destination_uri);
|
g_free (destination_uri);
|
||||||
}
|
}
|
||||||
else if (!webkit_download_get_destination_uri (download))
|
else if (!webkit_download_get_destination_uri (download))
|
||||||
|
@ -1507,7 +1518,14 @@ midori_view_download_requested_cb (GtkWidget* view,
|
||||||
g_free (destination_uri);
|
g_free (destination_uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
|
||||||
|
/* Close empty tabs due to download links with a target */
|
||||||
|
web_view = midori_view_get_web_view (MIDORI_VIEW (view));
|
||||||
|
web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (web_view));
|
||||||
|
datasource = webkit_web_frame_get_data_source (web_frame);
|
||||||
|
if (midori_view_is_blank (MIDORI_VIEW (view)) && webkit_web_data_source_get_data (datasource) == NULL)
|
||||||
|
g_idle_add (midori_browser_remove_tab_idle, view);
|
||||||
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -3389,6 +3407,8 @@ _action_view_encoding_activate (GtkAction* action,
|
||||||
const gchar* encoding;
|
const gchar* encoding;
|
||||||
if (!strcmp (name, "EncodingChinese"))
|
if (!strcmp (name, "EncodingChinese"))
|
||||||
encoding = "BIG5";
|
encoding = "BIG5";
|
||||||
|
else if (!strcmp (name, "EncodingChineseSimplified"))
|
||||||
|
encoding = "GB18030";
|
||||||
else if (!strcmp (name, "EncodingJapanese"))
|
else if (!strcmp (name, "EncodingJapanese"))
|
||||||
encoding = "SHIFT_JIS";
|
encoding = "SHIFT_JIS";
|
||||||
else if (!strcmp (name, "EncodingKorean"))
|
else if (!strcmp (name, "EncodingKorean"))
|
||||||
|
@ -3672,6 +3692,12 @@ static void
|
||||||
_action_location_focus_in (GtkAction* action,
|
_action_location_focus_in (GtkAction* action,
|
||||||
MidoriBrowser* browser)
|
MidoriBrowser* browser)
|
||||||
{
|
{
|
||||||
|
GdkScreen* screen = gtk_widget_get_screen (browser->notebook);
|
||||||
|
GtkIconTheme* icon_theme = gtk_icon_theme_get_for_screen (screen);
|
||||||
|
if (gtk_icon_theme_has_icon (icon_theme, "go-jump-symbolic"))
|
||||||
|
midori_location_action_set_secondary_icon (
|
||||||
|
MIDORI_LOCATION_ACTION (action), "go-jump-symbolic");
|
||||||
|
else
|
||||||
midori_location_action_set_secondary_icon (
|
midori_location_action_set_secondary_icon (
|
||||||
MIDORI_LOCATION_ACTION (action), GTK_STOCK_JUMP_TO);
|
MIDORI_LOCATION_ACTION (action), GTK_STOCK_JUMP_TO);
|
||||||
}
|
}
|
||||||
|
@ -3685,12 +3711,7 @@ _action_location_focus_out (GtkAction* action,
|
||||||
if (!browser->show_navigationbar || midori_browser_is_fullscreen (browser))
|
if (!browser->show_navigationbar || midori_browser_is_fullscreen (browser))
|
||||||
gtk_widget_hide (browser->navigationbar);
|
gtk_widget_hide (browser->navigationbar);
|
||||||
|
|
||||||
if (g_object_get_data (G_OBJECT (view), "news-feeds"))
|
midori_browser_update_secondary_icon (browser, MIDORI_VIEW (view), action);
|
||||||
midori_location_action_set_secondary_icon (
|
|
||||||
MIDORI_LOCATION_ACTION (action), STOCK_NEWS_FEED);
|
|
||||||
else
|
|
||||||
midori_location_action_set_secondary_icon (
|
|
||||||
MIDORI_LOCATION_ACTION (action), GTK_STOCK_JUMP_TO);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -3702,8 +3723,6 @@ _action_location_reset_uri (GtkAction* action,
|
||||||
{
|
{
|
||||||
midori_location_action_set_text (MIDORI_LOCATION_ACTION (action),
|
midori_location_action_set_text (MIDORI_LOCATION_ACTION (action),
|
||||||
midori_view_get_display_uri (MIDORI_VIEW (view)));
|
midori_view_get_display_uri (MIDORI_VIEW (view)));
|
||||||
midori_location_action_set_icon (MIDORI_LOCATION_ACTION (action),
|
|
||||||
midori_view_get_icon (MIDORI_VIEW (view)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3891,7 +3910,10 @@ _action_search_submit (GtkAction* action,
|
||||||
search = midori_uri_for_search (url, keywords);
|
search = midori_uri_for_search (url, keywords);
|
||||||
|
|
||||||
if (new_tab)
|
if (new_tab)
|
||||||
midori_browser_add_uri (browser, search);
|
{
|
||||||
|
int n = midori_browser_add_uri (browser, search);
|
||||||
|
midori_browser_set_current_page_smartly (browser, n);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
midori_browser_set_current_uri (browser, search);
|
midori_browser_set_current_uri (browser, search);
|
||||||
|
|
||||||
|
@ -5022,8 +5044,6 @@ midori_browser_notebook_switch_page_after_cb (GtkWidget* notebook,
|
||||||
midori_browser_set_title (browser, midori_view_get_display_title (view));
|
midori_browser_set_title (browser, midori_view_get_display_title (view));
|
||||||
action = _action_by_name (browser, "Location");
|
action = _action_by_name (browser, "Location");
|
||||||
midori_location_action_set_text (MIDORI_LOCATION_ACTION (action), uri);
|
midori_location_action_set_text (MIDORI_LOCATION_ACTION (action), uri);
|
||||||
midori_location_action_set_icon (MIDORI_LOCATION_ACTION (action),
|
|
||||||
midori_view_get_icon (view));
|
|
||||||
if (sokoke_is_app_or_private ())
|
if (sokoke_is_app_or_private ())
|
||||||
gtk_window_set_icon (GTK_WINDOW (browser), midori_view_get_icon (view));
|
gtk_window_set_icon (GTK_WINDOW (browser), midori_view_get_icon (view));
|
||||||
|
|
||||||
|
@ -5440,7 +5460,10 @@ static const GtkRadioActionEntry encoding_entries[] =
|
||||||
N_("_Automatic"), "",
|
N_("_Automatic"), "",
|
||||||
NULL, 1 },
|
NULL, 1 },
|
||||||
{ "EncodingChinese", NULL,
|
{ "EncodingChinese", NULL,
|
||||||
N_("Chinese (BIG5)"), "",
|
N_("Chinese Traditional (BIG5)"), "",
|
||||||
|
NULL, 1 },
|
||||||
|
{ "EncodingChineseSimplified", NULL,
|
||||||
|
N_("Chinese Simplified (GB18030)"), "",
|
||||||
NULL, 1 },
|
NULL, 1 },
|
||||||
{ "EncodingJapanese", NULL,
|
{ "EncodingJapanese", NULL,
|
||||||
/* i18n: A double underscore "__" is used to prevent the mnemonic */
|
/* i18n: A double underscore "__" is used to prevent the mnemonic */
|
||||||
|
@ -5612,6 +5635,7 @@ static const gchar* ui_markup =
|
||||||
"<menu action='Encoding'>"
|
"<menu action='Encoding'>"
|
||||||
"<menuitem action='EncodingAutomatic'/>"
|
"<menuitem action='EncodingAutomatic'/>"
|
||||||
"<menuitem action='EncodingChinese'/>"
|
"<menuitem action='EncodingChinese'/>"
|
||||||
|
"<menuitem action='EncodingChineseSimplified'/>"
|
||||||
"<menuitem action='EncodingJapanese'/>"
|
"<menuitem action='EncodingJapanese'/>"
|
||||||
"<menuitem action='EncodingKorean'/>"
|
"<menuitem action='EncodingKorean'/>"
|
||||||
"<menuitem action='EncodingRussian'/>"
|
"<menuitem action='EncodingRussian'/>"
|
||||||
|
|
|
@ -838,8 +838,6 @@ midori_location_action_create_tool_item (GtkAction* action)
|
||||||
hildon_gtk_entry_set_input_mode (GTK_ENTRY (entry), mode);
|
hildon_gtk_entry_set_input_mode (GTK_ENTRY (entry), mode);
|
||||||
#else
|
#else
|
||||||
entry = gtk_icon_entry_new ();
|
entry = gtk_icon_entry_new ();
|
||||||
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry),
|
|
||||||
GTK_ICON_ENTRY_PRIMARY, GTK_STOCK_FILE);
|
|
||||||
/* Work-around icon being activatable by default */
|
/* Work-around icon being activatable by default */
|
||||||
gtk_icon_entry_set_icon_highlight (GTK_ICON_ENTRY (entry),
|
gtk_icon_entry_set_icon_highlight (GTK_ICON_ENTRY (entry),
|
||||||
GTK_ICON_ENTRY_PRIMARY, FALSE);
|
GTK_ICON_ENTRY_PRIMARY, FALSE);
|
||||||
|
@ -1508,7 +1506,7 @@ midori_location_action_get_text (MidoriLocationAction* location_action)
|
||||||
* @location_action: a #MidoriLocationAction
|
* @location_action: a #MidoriLocationAction
|
||||||
* @text: a string
|
* @text: a string
|
||||||
*
|
*
|
||||||
* Sets the entry text to @text and, if applicable, updates the icon.
|
* Sets the entry text to @text.
|
||||||
*
|
*
|
||||||
* Since: 0.2.0
|
* Since: 0.2.0
|
||||||
**/
|
**/
|
||||||
|
@ -1517,7 +1515,6 @@ midori_location_action_set_text (MidoriLocationAction* location_action,
|
||||||
const gchar* text)
|
const gchar* text)
|
||||||
{
|
{
|
||||||
GSList* proxies;
|
GSList* proxies;
|
||||||
GdkPixbuf* icon;
|
|
||||||
|
|
||||||
g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action));
|
g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action));
|
||||||
g_return_if_fail (text != NULL);
|
g_return_if_fail (text != NULL);
|
||||||
|
@ -1530,21 +1527,12 @@ midori_location_action_set_text (MidoriLocationAction* location_action,
|
||||||
if (!(proxies = gtk_action_get_proxies (GTK_ACTION (location_action))))
|
if (!(proxies = gtk_action_get_proxies (GTK_ACTION (location_action))))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(icon = katze_load_cached_icon (location_action->uri, NULL)))
|
|
||||||
icon = g_object_ref (location_action->default_icon);
|
|
||||||
|
|
||||||
for (; proxies != NULL; proxies = g_slist_next (proxies))
|
for (; proxies != NULL; proxies = g_slist_next (proxies))
|
||||||
if (GTK_IS_TOOL_ITEM (proxies->data))
|
if (GTK_IS_TOOL_ITEM (proxies->data))
|
||||||
{
|
{
|
||||||
GtkWidget* entry = midori_location_action_entry_for_proxy (proxies->data);
|
GtkWidget* entry = midori_location_action_entry_for_proxy (proxies->data);
|
||||||
gtk_entry_set_text (GTK_ENTRY (entry), text);
|
gtk_entry_set_text (GTK_ENTRY (entry), text);
|
||||||
#if !HAVE_HILDON
|
|
||||||
gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (entry),
|
|
||||||
GTK_ICON_ENTRY_PRIMARY, icon);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (icon);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1554,33 +1542,12 @@ midori_location_action_set_text (MidoriLocationAction* location_action,
|
||||||
*
|
*
|
||||||
* Sets the icon shown on the left hand side.
|
* Sets the icon shown on the left hand side.
|
||||||
*
|
*
|
||||||
* Note: Since 0.1.8 %NULL can be passed to indicate that the
|
* Deprecated: 0.4.6: The left hand icon only shows security status.
|
||||||
* visible URI refers to a target, not the current location.
|
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
midori_location_action_set_icon (MidoriLocationAction* location_action,
|
midori_location_action_set_icon (MidoriLocationAction* location_action,
|
||||||
GdkPixbuf* icon)
|
GdkPixbuf* icon)
|
||||||
{
|
{
|
||||||
#if !HAVE_HILDON
|
|
||||||
GSList* proxies;
|
|
||||||
|
|
||||||
g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action));
|
|
||||||
g_return_if_fail (!icon || GDK_IS_PIXBUF (icon));
|
|
||||||
|
|
||||||
proxies = gtk_action_get_proxies (GTK_ACTION (location_action));
|
|
||||||
|
|
||||||
for (; proxies != NULL; proxies = g_slist_next (proxies))
|
|
||||||
if (GTK_IS_TOOL_ITEM (proxies->data))
|
|
||||||
{
|
|
||||||
GtkWidget* entry = midori_location_action_entry_for_proxy (proxies->data);
|
|
||||||
if (icon)
|
|
||||||
gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (entry),
|
|
||||||
GTK_ICON_ENTRY_PRIMARY, icon);
|
|
||||||
else
|
|
||||||
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry),
|
|
||||||
GTK_ICON_ENTRY_PRIMARY, GTK_STOCK_JUMP_TO);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1593,32 +1560,24 @@ midori_location_action_add_uri (MidoriLocationAction* location_action,
|
||||||
katze_assign (location_action->uri, g_strdup (uri));
|
katze_assign (location_action->uri, g_strdup (uri));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* midori_location_action_add_item:
|
||||||
|
* @location_action: a #MidoriLocationAction
|
||||||
|
* @icon: a #GdkPixbuf or %NULL
|
||||||
|
* @title: a string
|
||||||
|
*
|
||||||
|
* Adds the item to the location, historically this added it to
|
||||||
|
* completion suggestions and updated the left side icon.
|
||||||
|
*
|
||||||
|
* Deprecated: 0.4.6: The left hand icon only shows security status.
|
||||||
|
**/
|
||||||
|
|
||||||
void
|
void
|
||||||
midori_location_action_add_item (MidoriLocationAction* location_action,
|
midori_location_action_add_item (MidoriLocationAction* location_action,
|
||||||
const gchar* uri,
|
const gchar* uri,
|
||||||
GdkPixbuf* icon,
|
GdkPixbuf* icon,
|
||||||
const gchar* title)
|
const gchar* title)
|
||||||
{
|
{
|
||||||
#if !HAVE_HILDON
|
|
||||||
GSList* proxies;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action));
|
|
||||||
g_return_if_fail (uri != NULL);
|
|
||||||
g_return_if_fail (title != NULL);
|
|
||||||
g_return_if_fail (!icon || GDK_IS_PIXBUF (icon));
|
|
||||||
|
|
||||||
#if !HAVE_HILDON
|
|
||||||
proxies = gtk_action_get_proxies (GTK_ACTION (location_action));
|
|
||||||
|
|
||||||
for (; proxies != NULL; proxies = g_slist_next (proxies))
|
|
||||||
if (GTK_IS_TOOL_ITEM (proxies->data))
|
|
||||||
{
|
|
||||||
GtkWidget* entry = midori_location_action_entry_for_proxy (proxies->data);
|
|
||||||
gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (entry),
|
|
||||||
GTK_ICON_ENTRY_PRIMARY, icon);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1690,6 +1649,15 @@ midori_location_action_set_progress (MidoriLocationAction* location_action,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* midori_location_action_set_security_hint:
|
||||||
|
* @location_action: a #MidoriLocationAction
|
||||||
|
* @icon: a stock ID, or an icon name
|
||||||
|
*
|
||||||
|
* Sets the secondary, ie right hand side icon.
|
||||||
|
*
|
||||||
|
* Since 0.4.6 @icon can be a stock ID or an icon name.
|
||||||
|
**/
|
||||||
void
|
void
|
||||||
midori_location_action_set_secondary_icon (MidoriLocationAction* location_action,
|
midori_location_action_set_secondary_icon (MidoriLocationAction* location_action,
|
||||||
const gchar* stock_id)
|
const gchar* stock_id)
|
||||||
|
@ -1700,7 +1668,6 @@ midori_location_action_set_secondary_icon (MidoriLocationAction* location_action
|
||||||
GtkStockItem stock_item;
|
GtkStockItem stock_item;
|
||||||
|
|
||||||
g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action));
|
g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action));
|
||||||
g_return_if_fail (!stock_id || gtk_stock_lookup (stock_id, &stock_item));
|
|
||||||
|
|
||||||
katze_assign (location_action->secondary_icon, g_strdup (stock_id));
|
katze_assign (location_action->secondary_icon, g_strdup (stock_id));
|
||||||
|
|
||||||
|
@ -1711,8 +1678,12 @@ midori_location_action_set_secondary_icon (MidoriLocationAction* location_action
|
||||||
if (GTK_IS_TOOL_ITEM (proxies->data))
|
if (GTK_IS_TOOL_ITEM (proxies->data))
|
||||||
{
|
{
|
||||||
GtkWidget* entry = midori_location_action_entry_for_proxy (proxies->data);
|
GtkWidget* entry = midori_location_action_entry_for_proxy (proxies->data);
|
||||||
|
if (stock_id && gtk_stock_lookup (stock_id, &stock_item))
|
||||||
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry),
|
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry),
|
||||||
GTK_ICON_ENTRY_SECONDARY, stock_id);
|
GTK_ICON_ENTRY_SECONDARY, stock_id);
|
||||||
|
else
|
||||||
|
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (entry),
|
||||||
|
GTK_ICON_ENTRY_SECONDARY, stock_id);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1757,15 +1728,15 @@ midori_location_action_set_security_hint (MidoriLocationAction* location_action,
|
||||||
#if !HAVE_HILDON
|
#if !HAVE_HILDON
|
||||||
if (gtk_icon_theme_has_icon (icon_theme, "channel-insecure-symbolic"))
|
if (gtk_icon_theme_has_icon (icon_theme, "channel-insecure-symbolic"))
|
||||||
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (entry),
|
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (entry),
|
||||||
GTK_ICON_ENTRY_SECONDARY, "channel-insecure-symbolic");
|
GTK_ICON_ENTRY_PRIMARY, "channel-insecure-symbolic");
|
||||||
else if (gtk_icon_theme_has_icon (icon_theme, "lock-insecure"))
|
else if (gtk_icon_theme_has_icon (icon_theme, "lock-insecure"))
|
||||||
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (entry),
|
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (entry),
|
||||||
GTK_ICON_ENTRY_SECONDARY, "lock-insecure");
|
GTK_ICON_ENTRY_PRIMARY, "lock-insecure");
|
||||||
else
|
else
|
||||||
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry),
|
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry),
|
||||||
GTK_ICON_ENTRY_SECONDARY, GTK_STOCK_INFO);
|
GTK_ICON_ENTRY_PRIMARY, GTK_STOCK_INFO);
|
||||||
gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (entry),
|
gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (entry),
|
||||||
GTK_ICON_ENTRY_SECONDARY, _("Not verified"));
|
GTK_ICON_ENTRY_PRIMARY, _("Not verified"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (hint == MIDORI_SECURITY_TRUSTED)
|
else if (hint == MIDORI_SECURITY_TRUSTED)
|
||||||
|
@ -1777,20 +1748,28 @@ midori_location_action_set_security_hint (MidoriLocationAction* location_action,
|
||||||
#if !HAVE_HILDON
|
#if !HAVE_HILDON
|
||||||
if (gtk_icon_theme_has_icon (icon_theme, "channel-secure-symbolic"))
|
if (gtk_icon_theme_has_icon (icon_theme, "channel-secure-symbolic"))
|
||||||
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (entry),
|
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (entry),
|
||||||
GTK_ICON_ENTRY_SECONDARY, "channel-secure-symbolic");
|
GTK_ICON_ENTRY_PRIMARY, "channel-secure-symbolic");
|
||||||
else if (gtk_icon_theme_has_icon (icon_theme, "lock-secure"))
|
else if (gtk_icon_theme_has_icon (icon_theme, "lock-secure"))
|
||||||
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (entry),
|
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (entry),
|
||||||
GTK_ICON_ENTRY_SECONDARY, "lock-secure");
|
GTK_ICON_ENTRY_PRIMARY, "lock-secure");
|
||||||
else
|
else
|
||||||
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry),
|
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry),
|
||||||
GTK_ICON_ENTRY_SECONDARY, GTK_STOCK_DIALOG_AUTHENTICATION);
|
GTK_ICON_ENTRY_PRIMARY, GTK_STOCK_DIALOG_AUTHENTICATION);
|
||||||
gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (entry),
|
gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (entry),
|
||||||
GTK_ICON_ENTRY_SECONDARY, _("Verified and encrypted connection"));
|
GTK_ICON_ENTRY_PRIMARY, _("Verified and encrypted connection"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (hint == MIDORI_SECURITY_NONE)
|
else if (hint == MIDORI_SECURITY_NONE)
|
||||||
|
{
|
||||||
|
if (gtk_icon_theme_has_icon (icon_theme, "text-html-symbolic"))
|
||||||
|
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (entry),
|
||||||
|
GTK_ICON_ENTRY_PRIMARY, "text-html-symbolic");
|
||||||
|
else
|
||||||
|
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (entry),
|
||||||
|
GTK_ICON_ENTRY_PRIMARY, "text-html");
|
||||||
gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (entry),
|
gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (entry),
|
||||||
GTK_ICON_ENTRY_SECONDARY, NULL);
|
GTK_ICON_ENTRY_PRIMARY, _("Open, unencrypted connection"));
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
#if GTK_CHECK_VERSION (3, 0, 0)
|
#if GTK_CHECK_VERSION (3, 0, 0)
|
||||||
|
|
|
@ -33,9 +33,10 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MIDORI_EVENT_NEW_TAB(evt) \
|
#define MIDORI_EVENT_NEW_TAB(evt) \
|
||||||
((((GdkEventButton*)evt)->button == 1 \
|
(evt != NULL \
|
||||||
|
&& ((((GdkEventButton*)evt)->button == 1 \
|
||||||
&& MIDORI_MOD_NEW_TAB(((GdkEventButton*)evt)->state)) \
|
&& MIDORI_MOD_NEW_TAB(((GdkEventButton*)evt)->state)) \
|
||||||
|| (((GdkEventButton*)evt)->button == 2))
|
|| (((GdkEventButton*)evt)->button == 2)))
|
||||||
|
|
||||||
#ifndef G_OS_WIN32
|
#ifndef G_OS_WIN32
|
||||||
#define MIDORI_MODULE_PREFIX "lib"
|
#define MIDORI_MODULE_PREFIX "lib"
|
||||||
|
|
|
@ -200,6 +200,13 @@ enum {
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
DOWNLOAD_SAVE = 1,
|
||||||
|
DOWNLOAD_SAVE_AS,
|
||||||
|
DOWNLOAD_CANCEL,
|
||||||
|
DOWNLOAD_OPEN,
|
||||||
|
};
|
||||||
|
|
||||||
static guint signals[LAST_SIGNAL];
|
static guint signals[LAST_SIGNAL];
|
||||||
|
|
||||||
static gchar* speeddial_markup = NULL;
|
static gchar* speeddial_markup = NULL;
|
||||||
|
@ -795,6 +802,7 @@ free_parts:
|
||||||
g_strfreev (parts);
|
g_strfreev (parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !WEBKIT_CHECK_VERSION (1, 8, 0)
|
||||||
static gboolean
|
static gboolean
|
||||||
katze_net_icon_status_cb (KatzeNetRequest* request,
|
katze_net_icon_status_cb (KatzeNetRequest* request,
|
||||||
MidoriView* view)
|
MidoriView* view)
|
||||||
|
@ -862,15 +870,25 @@ katze_net_icon_transfer_cb (KatzeNetRequest* request,
|
||||||
pixbuf_scaled = gdk_pixbuf_scale_simple (pixbuf, icon_width, icon_height, GDK_INTERP_BILINEAR);
|
pixbuf_scaled = gdk_pixbuf_scale_simple (pixbuf, icon_width, icon_height, GDK_INTERP_BILINEAR);
|
||||||
midori_view_apply_icon (view, pixbuf_scaled, view->icon_uri);
|
midori_view_apply_icon (view, pixbuf_scaled, view->icon_uri);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_midori_web_view_load_icon (MidoriView* view)
|
_midori_web_view_load_icon (MidoriView* view)
|
||||||
{
|
{
|
||||||
GdkPixbuf* pixbuf = NULL;
|
GdkPixbuf* pixbuf = NULL;
|
||||||
gint icon_width, icon_height;
|
gint icon_width, icon_height;
|
||||||
GdkPixbuf* pixbuf_scaled;
|
|
||||||
GtkSettings* settings;
|
GtkSettings* settings;
|
||||||
|
|
||||||
|
#if WEBKIT_CHECK_VERSION (1, 8, 0)
|
||||||
|
settings = gtk_widget_get_settings (view->web_view);
|
||||||
|
gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU,
|
||||||
|
&icon_width, &icon_height);
|
||||||
|
if ((pixbuf = webkit_web_view_try_get_favicon_pixbuf (
|
||||||
|
WEBKIT_WEB_VIEW (view->web_view), 16, 16)))
|
||||||
|
midori_view_apply_icon (view, pixbuf, view->icon_uri);
|
||||||
|
#else
|
||||||
|
GdkPixbuf* pixbuf_scaled;
|
||||||
|
|
||||||
if (!midori_uri_is_http (view->icon_uri))
|
if (!midori_uri_is_http (view->icon_uri))
|
||||||
katze_assign (view->icon_uri, NULL);
|
katze_assign (view->icon_uri, NULL);
|
||||||
|
|
||||||
|
@ -925,6 +943,7 @@ _midori_web_view_load_icon (MidoriView* view)
|
||||||
pixbuf = pixbuf_scaled;
|
pixbuf = pixbuf_scaled;
|
||||||
midori_view_apply_icon (view, pixbuf, view->icon_uri);
|
midori_view_apply_icon (view, pixbuf, view->icon_uri);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1025,6 +1044,9 @@ webkit_web_view_load_committed_cb (WebKitWebView* web_view,
|
||||||
const gchar* uri;
|
const gchar* uri;
|
||||||
GList* children;
|
GList* children;
|
||||||
|
|
||||||
|
if (web_frame != webkit_web_view_get_main_frame (web_view))
|
||||||
|
return;
|
||||||
|
|
||||||
g_object_freeze_notify (G_OBJECT (view));
|
g_object_freeze_notify (G_OBJECT (view));
|
||||||
|
|
||||||
uri = webkit_web_frame_get_uri (web_frame);
|
uri = webkit_web_frame_get_uri (web_frame);
|
||||||
|
@ -1372,6 +1394,7 @@ midori_view_location_response_cb (GtkWidget* infobar,
|
||||||
webkit_geolocation_policy_allow (decision);
|
webkit_geolocation_policy_allow (decision);
|
||||||
else
|
else
|
||||||
webkit_geolocation_policy_deny (decision);
|
webkit_geolocation_policy_deny (decision);
|
||||||
|
g_object_unref (decision);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -1384,8 +1407,9 @@ midori_view_web_view_geolocation_decision_cb (WebKitWebView* w
|
||||||
gchar* hostname = midori_uri_parse_hostname (uri, NULL);
|
gchar* hostname = midori_uri_parse_hostname (uri, NULL);
|
||||||
gchar* message = g_strdup_printf (_("%s wants to know your location."),
|
gchar* message = g_strdup_printf (_("%s wants to know your location."),
|
||||||
hostname && *hostname ? hostname : uri);
|
hostname && *hostname ? hostname : uri);
|
||||||
|
/* FIXME: decision should be released even if neither buttons's pressed */
|
||||||
midori_view_add_info_bar (view, GTK_MESSAGE_QUESTION,
|
midori_view_add_info_bar (view, GTK_MESSAGE_QUESTION,
|
||||||
message, G_CALLBACK (midori_view_location_response_cb), decision,
|
message, G_CALLBACK (midori_view_location_response_cb), g_object_ref (decision),
|
||||||
_("_Deny"), GTK_RESPONSE_REJECT, _("_Allow"), GTK_RESPONSE_ACCEPT,
|
_("_Deny"), GTK_RESPONSE_REJECT, _("_Allow"), GTK_RESPONSE_ACCEPT,
|
||||||
NULL);
|
NULL);
|
||||||
g_free (hostname);
|
g_free (hostname);
|
||||||
|
@ -1463,13 +1487,15 @@ webkit_web_view_load_error_cb (WebKitWebView* web_view,
|
||||||
gchar* message;
|
gchar* message;
|
||||||
gboolean result;
|
gboolean result;
|
||||||
|
|
||||||
|
/* The unholy trinity; also ignored in Webkit's default error handler */
|
||||||
switch (error->code)
|
switch (error->code)
|
||||||
{
|
{
|
||||||
case WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD:
|
case WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD:
|
||||||
/* A plugin will take over. That's expected, it's not fatal. */
|
/* A plugin will take over. That's expected, it's not fatal. */
|
||||||
return FALSE;
|
|
||||||
case WEBKIT_NETWORK_ERROR_CANCELLED:
|
case WEBKIT_NETWORK_ERROR_CANCELLED:
|
||||||
/* Mostly initiated by JS redirects. */
|
/* Mostly initiated by JS redirects. */
|
||||||
|
case WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE:
|
||||||
|
/* A frame load is cancelled because of a download. */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1520,6 +1546,7 @@ webkit_web_view_load_finished_cb (WebKitWebView* web_view,
|
||||||
g_object_notify (G_OBJECT (view), "progress");
|
g_object_notify (G_OBJECT (view), "progress");
|
||||||
midori_view_update_load_status (view, MIDORI_LOAD_FINISHED);
|
midori_view_update_load_status (view, MIDORI_LOAD_FINISHED);
|
||||||
|
|
||||||
|
if (web_frame == webkit_web_view_get_main_frame (web_view))
|
||||||
{
|
{
|
||||||
JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
|
JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
|
||||||
/* Icon: URI, News Feed: $URI|title, Search: :URI|title */
|
/* Icon: URI, News Feed: $URI|title, Search: :URI|title */
|
||||||
|
@ -1603,11 +1630,11 @@ webkit_web_view_load_finished_cb (WebKitWebView* web_view,
|
||||||
g_free (value);
|
g_free (value);
|
||||||
/* Ensure load-status is notified again, whether it changed or not */
|
/* Ensure load-status is notified again, whether it changed or not */
|
||||||
g_object_notify (G_OBJECT (view), "load-status");
|
g_object_notify (G_OBJECT (view), "load-status");
|
||||||
}
|
|
||||||
|
|
||||||
#if !WEBKIT_CHECK_VERSION (1, 4, 3)
|
#if !WEBKIT_CHECK_VERSION (1, 4, 3)
|
||||||
_midori_web_view_load_icon (view);
|
_midori_web_view_load_icon (view);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
g_object_thaw_notify (G_OBJECT (view));
|
g_object_thaw_notify (G_OBJECT (view));
|
||||||
}
|
}
|
||||||
|
@ -2262,6 +2289,15 @@ midori_view_tab_label_menu_window_new_cb (GtkWidget* menuitem,
|
||||||
midori_view_get_display_uri (MIDORI_VIEW (view)));
|
midori_view_get_display_uri (MIDORI_VIEW (view)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
midori_web_view_open_frame_in_new_tab_cb (GtkWidget* widget,
|
||||||
|
MidoriView* view)
|
||||||
|
{
|
||||||
|
WebKitWebFrame* web_frame = webkit_web_view_get_focused_frame (WEBKIT_WEB_VIEW (view->web_view));
|
||||||
|
g_signal_emit (view, signals[NEW_TAB], 0,
|
||||||
|
webkit_web_frame_get_uri (web_frame), view->open_tabs_in_the_background);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
midori_web_view_menu_inspect_element_activate_cb (GtkWidget* widget,
|
midori_web_view_menu_inspect_element_activate_cb (GtkWidget* widget,
|
||||||
MidoriView* view)
|
MidoriView* view)
|
||||||
|
@ -2644,6 +2680,12 @@ midori_view_populate_popup (MidoriView* view,
|
||||||
menuitem = sokoke_action_create_popup_menu_item (
|
menuitem = sokoke_action_create_popup_menu_item (
|
||||||
gtk_action_group_get_action (actions, "UndoTabClose"));
|
gtk_action_group_get_action (actions, "UndoTabClose"));
|
||||||
gtk_menu_shell_append (menu_shell, menuitem);
|
gtk_menu_shell_append (menu_shell, menuitem);
|
||||||
|
|
||||||
|
if (webkit_web_view_get_focused_frame (web_view) != webkit_web_view_get_main_frame (web_view))
|
||||||
|
menuitem = midori_view_insert_menu_item (menu_shell, -1,
|
||||||
|
_("Open _Frame in New Tab"), NULL,
|
||||||
|
G_CALLBACK (midori_web_view_open_frame_in_new_tab_cb), widget);
|
||||||
|
|
||||||
menuitem = gtk_image_menu_item_new_from_stock (STOCK_WINDOW_NEW, NULL);
|
menuitem = gtk_image_menu_item_new_from_stock (STOCK_WINDOW_NEW, NULL);
|
||||||
gtk_menu_item_set_label (GTK_MENU_ITEM (menuitem), _("Open in New _Window"));
|
gtk_menu_item_set_label (GTK_MENU_ITEM (menuitem), _("Open in New _Window"));
|
||||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||||
|
@ -2668,6 +2710,7 @@ midori_view_populate_popup (MidoriView* view,
|
||||||
static const GtkActionEntry encodings[] = {
|
static const GtkActionEntry encodings[] = {
|
||||||
{ "EncodingAutomatic" },
|
{ "EncodingAutomatic" },
|
||||||
{ "EncodingChinese" },
|
{ "EncodingChinese" },
|
||||||
|
{ "EncodingChineseSimplified" },
|
||||||
{ "EncodingJapanese" },
|
{ "EncodingJapanese" },
|
||||||
{ "EncodingKorean" },
|
{ "EncodingKorean" },
|
||||||
{ "EncodingRussian" },
|
{ "EncodingRussian" },
|
||||||
|
@ -2841,27 +2884,6 @@ webkit_web_view_mime_type_decision_cb (GtkWidget* web_view,
|
||||||
WebKitWebPolicyDecision* decision,
|
WebKitWebPolicyDecision* decision,
|
||||||
MidoriView* view)
|
MidoriView* view)
|
||||||
{
|
{
|
||||||
GtkWidget* dialog;
|
|
||||||
gchar* content_type;
|
|
||||||
gchar* description;
|
|
||||||
gchar* file_type;
|
|
||||||
gchar* name;
|
|
||||||
gchar* file_name;
|
|
||||||
WebKitDownload *download;
|
|
||||||
WebKitWebDataSource* datasource;
|
|
||||||
WebKitNetworkRequest* original_request;
|
|
||||||
const gchar* original_uri;
|
|
||||||
gchar* fingerprint;
|
|
||||||
gchar* fplabel;
|
|
||||||
#if GTK_CHECK_VERSION (2, 14, 0)
|
|
||||||
GIcon* icon;
|
|
||||||
GtkWidget* image;
|
|
||||||
#endif
|
|
||||||
gchar* title;
|
|
||||||
GdkScreen* screen;
|
|
||||||
GtkIconTheme* icon_theme;
|
|
||||||
gint response;
|
|
||||||
|
|
||||||
if (webkit_web_view_can_show_mime_type (WEBKIT_WEB_VIEW (web_view), mime_type))
|
if (webkit_web_view_can_show_mime_type (WEBKIT_WEB_VIEW (web_view), mime_type))
|
||||||
{
|
{
|
||||||
gboolean view_source = FALSE;
|
gboolean view_source = FALSE;
|
||||||
|
@ -2875,16 +2897,54 @@ webkit_web_view_mime_type_decision_cb (GtkWidget* web_view,
|
||||||
view_source = TRUE;
|
view_source = TRUE;
|
||||||
webkit_web_view_set_view_source_mode (WEBKIT_WEB_VIEW (web_view), view_source);
|
webkit_web_view_set_view_source_mode (WEBKIT_WEB_VIEW (web_view), view_source);
|
||||||
|
|
||||||
|
if (web_frame == webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (web_view)))
|
||||||
|
{
|
||||||
katze_assign (view->mime_type, g_strdup (mime_type));
|
katze_assign (view->mime_type, g_strdup (mime_type));
|
||||||
midori_view_unset_icon (view);
|
midori_view_unset_icon (view);
|
||||||
g_object_notify (G_OBJECT (view), "mime-type");
|
g_object_notify (G_OBJECT (view), "mime-type");
|
||||||
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
g_object_set_data(G_OBJECT (view), "download-mime-type", (gpointer)mime_type);
|
||||||
|
webkit_web_policy_decision_download (decision);
|
||||||
|
g_object_set_data(G_OBJECT (view), "download-mime-type", NULL);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
webkit_web_view_download_requested_cb (GtkWidget* web_view,
|
||||||
|
WebKitDownload* download,
|
||||||
|
MidoriView* view)
|
||||||
|
{
|
||||||
|
GtkWidget* dialog;
|
||||||
|
gchar* content_type;
|
||||||
|
gchar* description;
|
||||||
|
gchar* file_type;
|
||||||
|
gchar* name;
|
||||||
|
gchar* file_name;
|
||||||
|
WebKitWebFrame* web_frame;
|
||||||
|
const gchar* mime_type;
|
||||||
|
WebKitWebDataSource* datasource;
|
||||||
|
WebKitNetworkRequest* request;
|
||||||
|
WebKitNetworkRequest* original_request;
|
||||||
|
const gchar* original_uri;
|
||||||
|
gchar* fingerprint;
|
||||||
|
gchar* fplabel;
|
||||||
|
#if GTK_CHECK_VERSION (2, 14, 0)
|
||||||
|
GIcon* icon;
|
||||||
|
GtkWidget* image;
|
||||||
|
#endif
|
||||||
|
gchar* title;
|
||||||
|
GdkScreen* screen;
|
||||||
|
GtkIconTheme* icon_theme;
|
||||||
|
gint response;
|
||||||
|
gboolean handled;
|
||||||
|
|
||||||
dialog = gtk_message_dialog_new (
|
dialog = gtk_message_dialog_new (
|
||||||
NULL, 0, GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE,
|
NULL, 0, GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE,
|
||||||
_("Open or download file"));
|
_("Open or download file"));
|
||||||
|
mime_type = g_object_get_data(G_OBJECT (view), "download-mime-type");
|
||||||
content_type = g_content_type_from_mime_type (mime_type);
|
content_type = g_content_type_from_mime_type (mime_type);
|
||||||
if (!content_type)
|
if (!content_type)
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
|
@ -2908,18 +2968,24 @@ webkit_web_view_mime_type_decision_cb (GtkWidget* web_view,
|
||||||
file_type = g_strdup_printf (_("File Type: %s ('%s')"), description, mime_type);
|
file_type = g_strdup_printf (_("File Type: %s ('%s')"), description, mime_type);
|
||||||
g_free (description);
|
g_free (description);
|
||||||
|
|
||||||
download = webkit_download_new (request);
|
|
||||||
name = sokoke_get_download_filename (download);
|
name = sokoke_get_download_filename (download);
|
||||||
file_name = g_strdup_printf (_("File Name: %s"), name);
|
file_name = g_strdup_printf (_("File Name: %s"), name);
|
||||||
g_free (name);
|
g_free (name);
|
||||||
g_object_unref (download);
|
|
||||||
|
|
||||||
/* Link Fingerprint */
|
/* Link Fingerprint */
|
||||||
/* We look at the original URI because redirection would lose the fragment */
|
/* We look at the original URI because redirection would lose the fragment */
|
||||||
|
web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (web_view));
|
||||||
datasource = webkit_web_frame_get_provisional_data_source (web_frame);
|
datasource = webkit_web_frame_get_provisional_data_source (web_frame);
|
||||||
|
if (datasource)
|
||||||
|
{
|
||||||
original_request = webkit_web_data_source_get_initial_request (datasource);
|
original_request = webkit_web_data_source_get_initial_request (datasource);
|
||||||
original_uri = webkit_network_request_get_uri (original_request);
|
original_uri = webkit_network_request_get_uri (original_request);
|
||||||
midori_uri_get_fingerprint (original_uri, &fingerprint, &fplabel);
|
midori_uri_get_fingerprint (original_uri, &fingerprint, &fplabel);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fingerprint = fplabel = NULL;
|
||||||
|
}
|
||||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
|
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
|
||||||
"%s\n%s\n%s %s", file_name, file_type, fplabel ? fplabel : "", fingerprint ? fingerprint : "");
|
"%s\n%s\n%s %s", file_name, file_type, fplabel ? fplabel : "", fingerprint ? fingerprint : "");
|
||||||
g_free (fingerprint);
|
g_free (fingerprint);
|
||||||
|
@ -2929,6 +2995,7 @@ webkit_web_view_mime_type_decision_cb (GtkWidget* web_view,
|
||||||
|
|
||||||
gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dialog), FALSE);
|
gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dialog), FALSE);
|
||||||
/* i18n: A file open dialog title, ie. "Open http://fila.com/manual.tgz" */
|
/* i18n: A file open dialog title, ie. "Open http://fila.com/manual.tgz" */
|
||||||
|
request = webkit_download_get_network_request (download);
|
||||||
title = g_strdup_printf (_("Open %s"),
|
title = g_strdup_printf (_("Open %s"),
|
||||||
webkit_network_request_get_uri (request));
|
webkit_network_request_get_uri (request));
|
||||||
gtk_window_set_title (GTK_WINDOW (dialog), title);
|
gtk_window_set_title (GTK_WINDOW (dialog), title);
|
||||||
|
@ -2943,59 +3010,36 @@ webkit_web_view_mime_type_decision_cb (GtkWidget* web_view,
|
||||||
gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_OPEN);
|
gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_OPEN);
|
||||||
}
|
}
|
||||||
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
|
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
|
||||||
GTK_STOCK_SAVE, 1,
|
GTK_STOCK_SAVE, DOWNLOAD_SAVE,
|
||||||
GTK_STOCK_SAVE_AS, 4,
|
GTK_STOCK_SAVE_AS, DOWNLOAD_SAVE_AS,
|
||||||
GTK_STOCK_CANCEL, 2,
|
GTK_STOCK_CANCEL, DOWNLOAD_CANCEL,
|
||||||
GTK_STOCK_OPEN, 3,
|
GTK_STOCK_OPEN, DOWNLOAD_OPEN,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
response = gtk_dialog_run (GTK_DIALOG (dialog));
|
response = gtk_dialog_run (GTK_DIALOG (dialog));
|
||||||
|
|
||||||
gtk_widget_destroy (dialog);
|
gtk_widget_destroy (dialog);
|
||||||
g_object_set_data (G_OBJECT (view), "open-download", (gpointer)0);
|
|
||||||
switch (response)
|
switch (response)
|
||||||
{
|
{
|
||||||
case 4:
|
case DOWNLOAD_SAVE_AS:
|
||||||
g_object_set_data (G_OBJECT (view), "save-as-download", (gpointer)1);
|
g_object_set_data (G_OBJECT (download), "save-as-download", (gpointer)1);
|
||||||
webkit_web_policy_decision_download (decision);
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case DOWNLOAD_OPEN:
|
||||||
g_object_set_data (G_OBJECT (view), "open-download", (gpointer)1);
|
g_object_set_data (G_OBJECT (download), "open-download", (gpointer)1);
|
||||||
case 1:
|
case DOWNLOAD_SAVE:
|
||||||
webkit_web_policy_decision_download (decision);
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case DOWNLOAD_CANCEL:
|
||||||
case GTK_RESPONSE_DELETE_EVENT:
|
case GTK_RESPONSE_DELETE_EVENT:
|
||||||
webkit_web_policy_decision_ignore (decision);
|
g_object_set_data (G_OBJECT (download), "cancel-download", (gpointer)1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_warn_if_reached ();
|
g_warn_if_reached ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Apparently WebKit will continue loading which ends in an error.
|
|
||||||
It's unclear whether it's a bug or we are doing something wrong. */
|
|
||||||
webkit_web_view_stop_loading (WEBKIT_WEB_VIEW (view->web_view));
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
webkit_web_view_download_requested_cb (GtkWidget* web_view,
|
|
||||||
WebKitDownload* download,
|
|
||||||
MidoriView* view)
|
|
||||||
{
|
|
||||||
gboolean handled;
|
|
||||||
/* Propagate original URI to make it available when the download finishes */
|
/* Propagate original URI to make it available when the download finishes */
|
||||||
WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (web_view));
|
|
||||||
WebKitWebDataSource* datasource = webkit_web_frame_get_provisional_data_source (web_frame);
|
|
||||||
WebKitNetworkRequest* original_request = webkit_web_data_source_get_initial_request (datasource);
|
|
||||||
const gchar* original_uri = webkit_network_request_get_uri (original_request);
|
|
||||||
WebKitNetworkRequest* request = webkit_download_get_network_request (download);
|
|
||||||
g_object_set_data_full (G_OBJECT (request), "midori-original-uri",
|
g_object_set_data_full (G_OBJECT (request), "midori-original-uri",
|
||||||
g_strdup (original_uri), g_free);
|
g_strdup (original_uri), g_free);
|
||||||
g_object_set_data (G_OBJECT (download), "open-download",
|
|
||||||
g_object_get_data (G_OBJECT (view), "open-download"));
|
|
||||||
g_object_set_data (G_OBJECT (download), "save-as-download",
|
|
||||||
g_object_get_data (G_OBJECT (view), "save-as-download"));
|
|
||||||
g_object_set_data (G_OBJECT (view), "open-download", (gpointer)0);
|
|
||||||
g_object_set_data (G_OBJECT (view), "save-as-download", (gpointer)0);
|
|
||||||
g_signal_emit (view, signals[DOWNLOAD_REQUESTED], 0, download, &handled);
|
g_signal_emit (view, signals[DOWNLOAD_REQUESTED], 0, download, &handled);
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
@ -4193,45 +4237,19 @@ midori_view_set_uri (MidoriView* view,
|
||||||
WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view->web_view));
|
WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view->web_view));
|
||||||
JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
|
JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
|
||||||
gchar* video_formats = list_video_formats (js_context);
|
gchar* video_formats = list_video_formats (js_context);
|
||||||
GString* more = g_string_new ("");
|
|
||||||
list_netscape_plugins (more, js_context);
|
|
||||||
list_about_uris (more);
|
|
||||||
|
|
||||||
katze_assign (view->uri, g_strdup (uri));
|
/* FIXME: This is for workarounding a crash deeper down the callstack on some systems. */
|
||||||
data = g_strdup_printf (
|
static char const * const version_format_strings[] = {
|
||||||
"<html><head><title>about:version</title></head>"
|
" libsoup %s</td></tr>",
|
||||||
"<body><h1>about:version</h1>"
|
"<tr><td>cairo</td><td>%s ", "(%s)</td></tr>",
|
||||||
"<p>%s</p>"
|
"<tr><td>granite</td><td>%s</td></tr>",
|
||||||
"<img src=\"res://logo-shade.png\" "
|
"<tr><td>libnotify</td><td>%s</td></tr>",
|
||||||
"style=\"position: absolute; right: 15px; bottom: 15px; z-index: -9;\">"
|
"<tr><td>single instance</td><td>%s</td></tr>",
|
||||||
"<table>"
|
"<tr><td>Platform</td><td>%s ", "%s ", "%s</td></tr>",
|
||||||
"<tr><td>Command line</td><td>%s</td></tr>"
|
"<tr><td>Identification</td><td>%s</td></tr>",
|
||||||
"<tr><td>Midori</td><td>%s (%s)</td></tr>"
|
"<tr><td>Video Formats</td><td>%s</td></tr>",
|
||||||
"<tr><td>WebKitGTK+</td><td>%d.%d.%d (%d.%d.%d)</td></tr>"
|
};
|
||||||
"<tr><td>GTK+</td><td>%d.%d.%d (%d.%d.%d)</td></tr>"
|
char const * version_strings[] = {
|
||||||
"<tr><td>Glib</td><td>%d.%d.%d (%d.%d.%d)</td></tr>"
|
|
||||||
"<tr><td>libsoup</td><td>%s</td></tr>"
|
|
||||||
"<tr><td>cairo</td><td>%s (%s)</td></tr>"
|
|
||||||
"<tr><td>granite</td><td>%s</td></tr>"
|
|
||||||
"<tr><td>libnotify</td><td>%s</td></tr>"
|
|
||||||
"<tr><td>single instance</td><td>%s</td></tr>"
|
|
||||||
"<tr><td>Platform</td><td>%s %s %s</td></tr>"
|
|
||||||
"<tr><td>Identification</td><td>%s</td></tr>"
|
|
||||||
"<tr><td>Video Formats</td><td>%s</td></tr>"
|
|
||||||
"</table>"
|
|
||||||
"%s"
|
|
||||||
"</body></html>",
|
|
||||||
_("Version numbers in brackets show the version used at runtime."),
|
|
||||||
command_line,
|
|
||||||
PACKAGE_VERSION, midori_app_get_name (NULL),
|
|
||||||
WEBKIT_MAJOR_VERSION, WEBKIT_MINOR_VERSION, WEBKIT_MICRO_VERSION,
|
|
||||||
webkit_major_version (),
|
|
||||||
webkit_minor_version (),
|
|
||||||
webkit_micro_version (),
|
|
||||||
GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION,
|
|
||||||
gtk_major_version, gtk_minor_version, gtk_micro_version,
|
|
||||||
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION,
|
|
||||||
glib_major_version, glib_minor_version, glib_micro_version,
|
|
||||||
LIBSOUP_VERSION,
|
LIBSOUP_VERSION,
|
||||||
CAIRO_VERSION_STRING, cairo_version_string (),
|
CAIRO_VERSION_STRING, cairo_version_string (),
|
||||||
GRANITE_VERSION,
|
GRANITE_VERSION,
|
||||||
|
@ -4246,7 +4264,48 @@ midori_view_set_uri (MidoriView* view,
|
||||||
"Sockets",
|
"Sockets",
|
||||||
#endif
|
#endif
|
||||||
platform, sys_name, architecture ? architecture : "", ident,
|
platform, sys_name, architecture ? architecture : "", ident,
|
||||||
video_formats, (gchar*)(more->str));
|
video_formats,
|
||||||
|
};
|
||||||
|
int i = 0;
|
||||||
|
GString * tmp = g_string_new("");;
|
||||||
|
|
||||||
|
GString* more = g_string_new ("");
|
||||||
|
list_netscape_plugins (more, js_context);
|
||||||
|
list_about_uris (more);
|
||||||
|
|
||||||
|
katze_assign (view->uri, g_strdup (uri));
|
||||||
|
g_string_append_printf (tmp,
|
||||||
|
"<html><head><title>about:version</title></head>"
|
||||||
|
"<body><h1>about:version</h1>"
|
||||||
|
"<p>%s</p>"
|
||||||
|
"<img src=\"res://logo-shade.png\" "
|
||||||
|
"style=\"position: absolute; right: 15px; bottom: 15px; z-index: -9;\">"
|
||||||
|
"<table>"
|
||||||
|
"<tr><td>Command line</td><td>%s</td></tr>"
|
||||||
|
"<tr><td>Midori</td><td>%s (%s)</td></tr>"
|
||||||
|
"<tr><td>GTK+</td><td>%d.%d.%d (%d.%d.%d)"
|
||||||
|
" Glib %d.%d.%d (%d.%d.%d)</td></tr>"
|
||||||
|
"<tr><td>WebKitGTK+</td><td>%d.%d.%d (%d.%d.%d)",
|
||||||
|
_("Version numbers in brackets show the version used at runtime."),
|
||||||
|
command_line,
|
||||||
|
PACKAGE_VERSION, midori_app_get_name (NULL),
|
||||||
|
GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION,
|
||||||
|
gtk_major_version, gtk_minor_version, gtk_micro_version,
|
||||||
|
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION,
|
||||||
|
glib_major_version, glib_minor_version, glib_micro_version,
|
||||||
|
WEBKIT_MAJOR_VERSION, WEBKIT_MINOR_VERSION, WEBKIT_MICRO_VERSION,
|
||||||
|
webkit_major_version (), webkit_minor_version (), webkit_micro_version ());
|
||||||
|
|
||||||
|
for (i = 0;
|
||||||
|
i < sizeof (version_format_strings) / sizeof (version_format_strings[0]);
|
||||||
|
++i)
|
||||||
|
g_string_append_printf (tmp, version_format_strings[i], version_strings[i]);
|
||||||
|
|
||||||
|
g_string_append_printf (
|
||||||
|
tmp, "</table>%s</body></html>", (gchar*)(more->str));
|
||||||
|
|
||||||
|
data = g_string_free (tmp, FALSE);
|
||||||
|
|
||||||
g_free (command_line);
|
g_free (command_line);
|
||||||
g_free (arguments);
|
g_free (arguments);
|
||||||
g_free (ident);
|
g_free (ident);
|
||||||
|
@ -5293,11 +5352,11 @@ midori_view_save_source (MidoriView* view,
|
||||||
if (!outfile)
|
if (!outfile)
|
||||||
{
|
{
|
||||||
gchar* extension = midori_view_get_uri_extension (uri);
|
gchar* extension = midori_view_get_uri_extension (uri);
|
||||||
gchar* filename = g_strdup_printf ("%uXXXXXX%s",
|
unique_filename = g_strdup_printf ("%s/midori-%s/%uXXXXXX%s",
|
||||||
|
g_get_tmp_dir (), g_get_user_name (),
|
||||||
g_str_hash (uri), midori_view_fallback_extension (view, extension));
|
g_str_hash (uri), midori_view_fallback_extension (view, extension));
|
||||||
g_free (extension);
|
g_free (extension);
|
||||||
fd = g_file_open_tmp (filename, &unique_filename, NULL);
|
fd = g_mkstemp (unique_filename);
|
||||||
g_free (filename);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -233,7 +233,8 @@ midori_preferred_encoding_get_type (void)
|
||||||
if (!type)
|
if (!type)
|
||||||
{
|
{
|
||||||
static const GEnumValue values[] = {
|
static const GEnumValue values[] = {
|
||||||
{ MIDORI_ENCODING_CHINESE, "MIDORI_ENCODING_CHINESE", N_("Chinese (BIG5)") },
|
{ MIDORI_ENCODING_CHINESE, "MIDORI_ENCODING_CHINESE", N_("Chinese Traditional (BIG5)") },
|
||||||
|
{ MIDORI_ENCODING_CHINESE_SIMPLIFIED, "MIDORI_ENCODING_CHINESE_SIMPLIFIED", N_("Chinese Simplified (GB18030)") },
|
||||||
{ MIDORI_ENCODING_JAPANESE, "MIDORI_ENCODING_JAPANESE", N_("Japanese (SHIFT_JIS)") },
|
{ MIDORI_ENCODING_JAPANESE, "MIDORI_ENCODING_JAPANESE", N_("Japanese (SHIFT_JIS)") },
|
||||||
{ MIDORI_ENCODING_KOREAN, "MIDORI_ENCODING_KOREAN", N_("Korean (EUC-KR)") },
|
{ MIDORI_ENCODING_KOREAN, "MIDORI_ENCODING_KOREAN", N_("Korean (EUC-KR)") },
|
||||||
{ MIDORI_ENCODING_RUSSIAN, "MIDORI_ENCODING_RUSSIAN", N_("Russian (KOI8-R)") },
|
{ MIDORI_ENCODING_RUSSIAN, "MIDORI_ENCODING_RUSSIAN", N_("Russian (KOI8-R)") },
|
||||||
|
@ -1188,6 +1189,8 @@ notify_default_encoding_cb (GObject* object,
|
||||||
encoding = string ? string : "";
|
encoding = string ? string : "";
|
||||||
if (!strcmp (encoding, "BIG5"))
|
if (!strcmp (encoding, "BIG5"))
|
||||||
web_settings->preferred_encoding = MIDORI_ENCODING_CHINESE;
|
web_settings->preferred_encoding = MIDORI_ENCODING_CHINESE;
|
||||||
|
else if (!strcmp (encoding, "GB18030"))
|
||||||
|
web_settings->preferred_encoding = MIDORI_ENCODING_CHINESE_SIMPLIFIED;
|
||||||
else if (!strcmp (encoding, "SHIFT_JIS"))
|
else if (!strcmp (encoding, "SHIFT_JIS"))
|
||||||
web_settings->preferred_encoding = MIDORI_ENCODING_JAPANESE;
|
web_settings->preferred_encoding = MIDORI_ENCODING_JAPANESE;
|
||||||
else if (!strcmp (encoding, "EUC-KR"))
|
else if (!strcmp (encoding, "EUC-KR"))
|
||||||
|
@ -1552,6 +1555,9 @@ midori_web_settings_set_property (GObject* object,
|
||||||
case MIDORI_ENCODING_CHINESE:
|
case MIDORI_ENCODING_CHINESE:
|
||||||
g_object_set (object, "default-encoding", "BIG5", NULL);
|
g_object_set (object, "default-encoding", "BIG5", NULL);
|
||||||
break;
|
break;
|
||||||
|
case MIDORI_ENCODING_CHINESE_SIMPLIFIED:
|
||||||
|
g_object_set (object, "default-encoding", "GB18030", NULL);
|
||||||
|
break;
|
||||||
case MIDORI_ENCODING_JAPANESE:
|
case MIDORI_ENCODING_JAPANESE:
|
||||||
g_object_set (object, "default-encoding", "SHIFT_JIS", NULL);
|
g_object_set (object, "default-encoding", "SHIFT_JIS", NULL);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -80,7 +80,8 @@ midori_startup_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
MIDORI_ENCODING_CHINESE,
|
MIDORI_ENCODING_CHINESE /* Traditional */,
|
||||||
|
MIDORI_ENCODING_CHINESE_SIMPLIFIED,
|
||||||
MIDORI_ENCODING_JAPANESE,
|
MIDORI_ENCODING_JAPANESE,
|
||||||
MIDORI_ENCODING_KOREAN,
|
MIDORI_ENCODING_KOREAN,
|
||||||
MIDORI_ENCODING_RUSSIAN,
|
MIDORI_ENCODING_RUSSIAN,
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#include "midori-app.h"
|
#include "midori-app.h"
|
||||||
#include "midori-array.h"
|
#include "midori-array.h"
|
||||||
|
#include "midori-bookmarks.h"
|
||||||
#include "midori-browser.h"
|
#include "midori-browser.h"
|
||||||
#include "midori-extension.h"
|
#include "midori-extension.h"
|
||||||
#include "midori-locationaction.h"
|
#include "midori-locationaction.h"
|
||||||
|
|
|
@ -563,6 +563,8 @@ midori_bookmarks_treeview_render_icon_cb (GtkTreeViewColumn* column,
|
||||||
if (KATZE_ITEM_IS_FOLDER (item))
|
if (KATZE_ITEM_IS_FOLDER (item))
|
||||||
pixbuf = gtk_widget_render_icon (treeview, GTK_STOCK_DIRECTORY,
|
pixbuf = gtk_widget_render_icon (treeview, GTK_STOCK_DIRECTORY,
|
||||||
GTK_ICON_SIZE_MENU, NULL);
|
GTK_ICON_SIZE_MENU, NULL);
|
||||||
|
else if ((pixbuf = katze_item_get_pixbuf (item, treeview)))
|
||||||
|
;
|
||||||
else if (KATZE_ITEM_IS_BOOKMARK (item))
|
else if (KATZE_ITEM_IS_BOOKMARK (item))
|
||||||
pixbuf = katze_load_cached_icon (katze_item_get_uri (item), treeview);
|
pixbuf = katze_load_cached_icon (katze_item_get_uri (item), treeview);
|
||||||
g_object_set (renderer, "pixbuf", pixbuf, NULL);
|
g_object_set (renderer, "pixbuf", pixbuf, NULL);
|
||||||
|
|
|
@ -594,6 +594,8 @@ midori_history_treeview_render_icon_cb (GtkTreeViewColumn* column,
|
||||||
|
|
||||||
if (!item)
|
if (!item)
|
||||||
pixbuf = NULL;
|
pixbuf = NULL;
|
||||||
|
else if ((pixbuf = katze_item_get_pixbuf (item, treeview)))
|
||||||
|
;
|
||||||
else if (katze_item_get_uri (item))
|
else if (katze_item_get_uri (item))
|
||||||
pixbuf = katze_load_cached_icon (katze_item_get_uri (item), treeview);
|
pixbuf = katze_load_cached_icon (katze_item_get_uri (item), treeview);
|
||||||
else
|
else
|
||||||
|
|
2
po/ar.po
2
po/ar.po
|
@ -2794,7 +2794,7 @@ msgstr "تخصيص شريط الأدوات"
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:413
|
#: ../extensions/toolbar-editor.c:413
|
||||||
msgid ""
|
msgid ""
|
||||||
"Select items to be displayed on the toolbar. Items can be reodered by drag "
|
"Select items to be displayed on the toolbar. Items can be reordered by drag "
|
||||||
"and drop."
|
"and drop."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"تحديد عناصر ليتم عرضها على شريط الأدوات. يمكن ترتيب العناصر عن طريق السحب "
|
"تحديد عناصر ليتم عرضها على شريط الأدوات. يمكن ترتيب العناصر عن طريق السحب "
|
||||||
|
|
|
@ -2221,7 +2221,7 @@ msgid "Customize Toolbar"
|
||||||
msgstr "Personalizar la barra de xeres"
|
msgstr "Personalizar la barra de xeres"
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:407
|
#: ../extensions/toolbar-editor.c:407
|
||||||
msgid "Select items to be displayed on the toolbar. Items can be reodered by drag and drop."
|
msgid "Select items to be displayed on the toolbar. Items can be reordered by drag and drop."
|
||||||
msgstr "Escueyi los elementos que s'amosarán na barra de ferramientes. Los elementos pueden reordenase arrastrando y soltando."
|
msgstr "Escueyi los elementos que s'amosarán na barra de ferramientes. Los elementos pueden reordenase arrastrando y soltando."
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:423
|
#: ../extensions/toolbar-editor.c:423
|
||||||
|
|
2739
po/en_GB.po
2739
po/en_GB.po
File diff suppressed because it is too large
Load diff
2
po/eo.po
2
po/eo.po
|
@ -2760,7 +2760,7 @@ msgstr ""
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:409
|
#: ../extensions/toolbar-editor.c:409
|
||||||
msgid ""
|
msgid ""
|
||||||
"Select items to be displayed on the toolbar. Items can be reodered by drag "
|
"Select items to be displayed on the toolbar. Items can be reordered by drag "
|
||||||
"and drop."
|
"and drop."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
2
po/fi.po
2
po/fi.po
|
@ -2853,7 +2853,7 @@ msgstr "Mukauta työkalupalkkia"
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:403
|
#: ../extensions/toolbar-editor.c:403
|
||||||
msgid ""
|
msgid ""
|
||||||
"Select items to be displayed on the toolbar. Items can be reodered by drag "
|
"Select items to be displayed on the toolbar. Items can be reordered by drag "
|
||||||
"and drop."
|
"and drop."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Valitse työkalupalkissa näkyvät kohteet. Voit järjestää kohteita raahaamalla "
|
"Valitse työkalupalkissa näkyvät kohteet. Voit järjestää kohteita raahaamalla "
|
||||||
|
|
2
po/fr.po
2
po/fr.po
|
@ -2848,7 +2848,7 @@ msgid "Customize Toolbar"
|
||||||
msgstr "Personnaliser la barre d'outils"
|
msgstr "Personnaliser la barre d'outils"
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:409
|
#: ../extensions/toolbar-editor.c:409
|
||||||
msgid "Select items to be displayed on the toolbar. Items can be reodered by drag and drop."
|
msgid "Select items to be displayed on the toolbar. Items can be reordered by drag and drop."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Sélectionnez les éléments à afficher sur la barre d'outils.\n"
|
"Sélectionnez les éléments à afficher sur la barre d'outils.\n"
|
||||||
"Ils peuvent être réorganisés par glisser-déposer."
|
"Ils peuvent être réorganisés par glisser-déposer."
|
||||||
|
|
2
po/he.po
2
po/he.po
|
@ -2790,7 +2790,7 @@ msgstr "התאמת סרגל הכלים"
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:409
|
#: ../extensions/toolbar-editor.c:409
|
||||||
msgid ""
|
msgid ""
|
||||||
"Select items to be displayed on the toolbar. Items can be reodered by drag "
|
"Select items to be displayed on the toolbar. Items can be reordered by drag "
|
||||||
"and drop."
|
"and drop."
|
||||||
msgstr "בחר פריטים להצגה בסרגל הכלים. ניתן לסדר פריטים מחדש על ידי גרירתם."
|
msgstr "בחר פריטים להצגה בסרגל הכלים. ניתן לסדר פריטים מחדש על ידי גרירתם."
|
||||||
|
|
||||||
|
|
2
po/id.po
2
po/id.po
|
@ -2810,7 +2810,7 @@ msgstr "Sesuaikan Batang Alat"
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:409
|
#: ../extensions/toolbar-editor.c:409
|
||||||
msgid ""
|
msgid ""
|
||||||
"Select items to be displayed on the toolbar. Items can be reodered by drag "
|
"Select items to be displayed on the toolbar. Items can be reordered by drag "
|
||||||
"and drop."
|
"and drop."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Pilih item yang akan ditampilkan di batang alat. Item dapat diubah urutannya "
|
"Pilih item yang akan ditampilkan di batang alat. Item dapat diubah urutannya "
|
||||||
|
|
2
po/no.po
2
po/no.po
|
@ -2225,7 +2225,7 @@ msgid "Customize Toolbar"
|
||||||
msgstr "Tilpass verktøylinje"
|
msgstr "Tilpass verktøylinje"
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:407
|
#: ../extensions/toolbar-editor.c:407
|
||||||
msgid "Select items to be displayed on the toolbar. Items can be reodered by drag and drop."
|
msgid "Select items to be displayed on the toolbar. Items can be reordered by drag and drop."
|
||||||
msgstr "Velg elementer som skal vises på verktøylinjen. Elementer kan flyttes ved å dra og slippe."
|
msgstr "Velg elementer som skal vises på verktøylinjen. Elementer kan flyttes ved å dra og slippe."
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:423
|
#: ../extensions/toolbar-editor.c:423
|
||||||
|
|
2
po/pa.po
2
po/pa.po
|
@ -2547,7 +2547,7 @@ msgstr ""
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:405
|
#: ../extensions/toolbar-editor.c:405
|
||||||
msgid ""
|
msgid ""
|
||||||
"Select items to be displayed on the toolbar. Items can be reodered by drag "
|
"Select items to be displayed on the toolbar. Items can be reordered by drag "
|
||||||
"and drop."
|
"and drop."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
2
po/pl.po
2
po/pl.po
|
@ -2850,7 +2850,7 @@ msgstr "Modyfikowanie paska narzędziowego"
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:409
|
#: ../extensions/toolbar-editor.c:409
|
||||||
msgid ""
|
msgid ""
|
||||||
"Select items to be displayed on the toolbar. Items can be reodered by drag "
|
"Select items to be displayed on the toolbar. Items can be reordered by drag "
|
||||||
"and drop."
|
"and drop."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Proszę wybrać elementy, które mają być wyświetlane na pasku narzędziowym.\n"
|
"Proszę wybrać elementy, które mają być wyświetlane na pasku narzędziowym.\n"
|
||||||
|
|
|
@ -2820,7 +2820,7 @@ msgstr "Personalizar barra de ferramentas"
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:409
|
#: ../extensions/toolbar-editor.c:409
|
||||||
msgid ""
|
msgid ""
|
||||||
"Select items to be displayed on the toolbar. Items can be reodered by drag "
|
"Select items to be displayed on the toolbar. Items can be reordered by drag "
|
||||||
"and drop."
|
"and drop."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Selecione os itens a serem exibidos na barra de ferramentas. Os itens podem "
|
"Selecione os itens a serem exibidos na barra de ferramentas. Os itens podem "
|
||||||
|
|
2
po/ro.po
2
po/ro.po
|
@ -2835,7 +2835,7 @@ msgstr "Personalizați bara cu unelte"
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:409
|
#: ../extensions/toolbar-editor.c:409
|
||||||
msgid ""
|
msgid ""
|
||||||
"Select items to be displayed on the toolbar. Items can be reodered by drag "
|
"Select items to be displayed on the toolbar. Items can be reordered by drag "
|
||||||
"and drop."
|
"and drop."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Selectați elementele de afișat în bara cu unelte. Ele pot fi reordonate prin "
|
"Selectați elementele de afișat în bara cu unelte. Ele pot fi reordonate prin "
|
||||||
|
|
2
po/ru.po
2
po/ru.po
|
@ -2821,7 +2821,7 @@ msgstr "Настройка панели инструментов"
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:409
|
#: ../extensions/toolbar-editor.c:409
|
||||||
msgid ""
|
msgid ""
|
||||||
"Select items to be displayed on the toolbar. Items can be reodered by drag "
|
"Select items to be displayed on the toolbar. Items can be reordered by drag "
|
||||||
"and drop."
|
"and drop."
|
||||||
msgstr "Выбрать и изменить порядок элементов можно с помощью мыши."
|
msgstr "Выбрать и изменить порядок элементов можно с помощью мыши."
|
||||||
|
|
||||||
|
|
2
po/sr.po
2
po/sr.po
|
@ -2991,7 +2991,7 @@ msgid "Customize Toolbar"
|
||||||
msgstr "Прилагођавање траке са алаткама"
|
msgstr "Прилагођавање траке са алаткама"
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:407
|
#: ../extensions/toolbar-editor.c:407
|
||||||
msgid "Select items to be displayed on the toolbar. Items can be reodered by drag and drop."
|
msgid "Select items to be displayed on the toolbar. Items can be reordered by drag and drop."
|
||||||
msgstr "Изаберите ставке да буду приказане на траци са алаткама. Ставке могу бити аранжиране превлачењем и увацивањем."
|
msgstr "Изаберите ставке да буду приказане на траци са алаткама. Ставке могу бити аранжиране превлачењем и увацивањем."
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:423
|
#: ../extensions/toolbar-editor.c:423
|
||||||
|
|
2
po/sv.po
2
po/sv.po
|
@ -2224,7 +2224,7 @@ msgid "Customize Toolbar"
|
||||||
msgstr "Redigera verktygsrad"
|
msgstr "Redigera verktygsrad"
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:407
|
#: ../extensions/toolbar-editor.c:407
|
||||||
msgid "Select items to be displayed on the toolbar. Items can be reodered by drag and drop."
|
msgid "Select items to be displayed on the toolbar. Items can be reordered by drag and drop."
|
||||||
msgstr "Välj föremål att visa i verktygsraden. Föremål kan omarrangeras genom att dra och släppa."
|
msgstr "Välj föremål att visa i verktygsraden. Föremål kan omarrangeras genom att dra och släppa."
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:423
|
#: ../extensions/toolbar-editor.c:423
|
||||||
|
|
2
po/tr.po
2
po/tr.po
|
@ -2846,7 +2846,7 @@ msgstr "Araç Çubuğunu Özelleştir"
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:409
|
#: ../extensions/toolbar-editor.c:409
|
||||||
msgid ""
|
msgid ""
|
||||||
"Select items to be displayed on the toolbar. Items can be reodered by drag "
|
"Select items to be displayed on the toolbar. Items can be reordered by drag "
|
||||||
"and drop."
|
"and drop."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Araç çubuğunda görüntülenecek ögeleri seç. Ögeler sürükle bırak yöntemiyle "
|
"Araç çubuğunda görüntülenecek ögeleri seç. Ögeler sürükle bırak yöntemiyle "
|
||||||
|
|
2
po/ug.po
2
po/ug.po
|
@ -2814,7 +2814,7 @@ msgstr "قورال ئىستونىنى ئۆزى بەلگىلەش"
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:405
|
#: ../extensions/toolbar-editor.c:405
|
||||||
msgid ""
|
msgid ""
|
||||||
"Select items to be displayed on the toolbar. Items can be reodered by drag "
|
"Select items to be displayed on the toolbar. Items can be reordered by drag "
|
||||||
"and drop."
|
"and drop."
|
||||||
msgstr "قورال بالدىقىدا كۆرسىتىلىدىغان تۈرلەرنى تاللا. ئۇلارنى ئۇنىڭ تەرتىپىنى تۇتۇپ تاشلاپ ئۆزگەرتىشكە بولىدۇ"
|
msgstr "قورال بالدىقىدا كۆرسىتىلىدىغان تۈرلەرنى تاللا. ئۇلارنى ئۇنىڭ تەرتىپىنى تۇتۇپ تاشلاپ ئۆزگەرتىشكە بولىدۇ"
|
||||||
|
|
||||||
|
|
1018
po/zh_CN.po
1018
po/zh_CN.po
File diff suppressed because it is too large
Load diff
|
@ -2835,7 +2835,7 @@ msgid "Customize Toolbar"
|
||||||
msgstr "自訂工具列"
|
msgstr "自訂工具列"
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:409
|
#: ../extensions/toolbar-editor.c:409
|
||||||
msgid "Select items to be displayed on the toolbar. Items can be reodered by drag and drop."
|
msgid "Select items to be displayed on the toolbar. Items can be reordered by drag and drop."
|
||||||
msgstr "選取工具列上要顯示的項目。這些項目可以利用拖曳方式來重新調整位置。"
|
msgstr "選取工具列上要顯示的項目。這些項目可以利用拖曳方式來重新調整位置。"
|
||||||
|
|
||||||
#: ../extensions/toolbar-editor.c:425
|
#: ../extensions/toolbar-editor.c:425
|
||||||
|
|
209
tests/bookmarks.c
Normal file
209
tests/bookmarks.c
Normal file
|
@ -0,0 +1,209 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2012 Vincent Cappe <vcappe@gmail.com>
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
See the file COPYING for the full license text.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "midori.h"
|
||||||
|
#include "panels/midori-bookmarks.h"
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
KatzeArray* db_bookmarks;
|
||||||
|
KatzeArray* test_bookmarks;
|
||||||
|
} BookmarksFixture;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
char *dbfile; /* usually ":memory:" */
|
||||||
|
gboolean verbose; /* print debug stuff if TRUE */
|
||||||
|
char* infile; /* (e.g. to test import), usually NULL */
|
||||||
|
char* outfile; /* (e.g. to test export), if it can be avoided it's
|
||||||
|
better to not write anything to disk, though */
|
||||||
|
} TestParameters;
|
||||||
|
|
||||||
|
typedef void (*FixtureFunc)(BookmarksFixture*, const void*);
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
fixture_setup (BookmarksFixture* fixture,
|
||||||
|
const TestParameters* params)
|
||||||
|
{
|
||||||
|
KatzeItem* item;
|
||||||
|
KatzeArray* folder;
|
||||||
|
sqlite3* db;
|
||||||
|
gchar *errmsg = NULL;
|
||||||
|
|
||||||
|
fixture->db_bookmarks = katze_array_new (KATZE_TYPE_ARRAY);
|
||||||
|
db = midori_bookmarks_initialize (fixture->db_bookmarks, params->dbfile, &errmsg);
|
||||||
|
if (db == NULL)
|
||||||
|
g_error ("Bookmarks couldn't be loaded: %s\n", errmsg);
|
||||||
|
g_assert (errmsg == NULL);
|
||||||
|
g_object_set_data ( G_OBJECT (fixture->db_bookmarks), "db", db);
|
||||||
|
|
||||||
|
|
||||||
|
fixture->test_bookmarks = katze_array_new (KATZE_TYPE_ARRAY);
|
||||||
|
|
||||||
|
item = (KatzeItem*)katze_array_new (KATZE_TYPE_ARRAY);
|
||||||
|
item->name = "i am a folder";
|
||||||
|
katze_array_add_item (fixture->test_bookmarks, item);
|
||||||
|
folder = (KatzeArray *) item;
|
||||||
|
|
||||||
|
item = (KatzeItem*)katze_array_new (KATZE_TYPE_ARRAY);
|
||||||
|
item->name = "i am a folder inside a folder";
|
||||||
|
katze_array_add_item (folder, item);
|
||||||
|
folder = (KatzeArray *) item;
|
||||||
|
|
||||||
|
item = g_object_new (KATZE_TYPE_ITEM,
|
||||||
|
"uri", "http://xyzzy.invalid",
|
||||||
|
"name", "xyzzy", NULL);
|
||||||
|
katze_item_set_meta_integer (item, "app", TRUE);
|
||||||
|
katze_array_add_item (folder, item);
|
||||||
|
|
||||||
|
/* level up */
|
||||||
|
folder = katze_item_get_parent ((KatzeItem*)folder);
|
||||||
|
|
||||||
|
item = g_object_new (KATZE_TYPE_ITEM,
|
||||||
|
"uri", "http://zyxxy.invalid",
|
||||||
|
"name", "zyxxy",
|
||||||
|
"text", "i have a description and am in a folder", NULL);
|
||||||
|
katze_item_set_meta_integer(item, "toolbar", TRUE);
|
||||||
|
katze_array_add_item (folder, item);
|
||||||
|
|
||||||
|
folder = katze_item_get_parent ((KatzeItem*)folder);
|
||||||
|
/* we should be at toplevel, now */
|
||||||
|
g_assert (folder == fixture->test_bookmarks);
|
||||||
|
|
||||||
|
item = g_object_new (KATZE_TYPE_ITEM,
|
||||||
|
"uri", "http://foobarbaz.invalid",
|
||||||
|
"name", "i am in the toplevel folder", NULL);
|
||||||
|
katze_array_add_item (folder, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fixture_teardown (BookmarksFixture* fixture,
|
||||||
|
const TestParameters *params)
|
||||||
|
{
|
||||||
|
sqlite3* db = g_object_get_data (G_OBJECT (fixture->db_bookmarks), "db");
|
||||||
|
sqlite3_close (db);
|
||||||
|
g_object_unref (fixture->db_bookmarks);
|
||||||
|
g_object_unref (fixture->test_bookmarks);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_bookmark (KatzeItem *bookmark)
|
||||||
|
{
|
||||||
|
g_print ("title : '%s'\n", katze_item_get_name (bookmark));
|
||||||
|
g_print ("uri : '%s'\n", katze_item_get_uri (bookmark));
|
||||||
|
g_print ("desc : '%s'\n", katze_item_get_text (bookmark));
|
||||||
|
g_print ("app : %d\n", katze_item_get_meta_boolean (bookmark, "app"));
|
||||||
|
g_print ("toolbar: %d\n", katze_item_get_meta_boolean (bookmark, "toolbar"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
compare_items (KatzeItem *a, KatzeItem *b)
|
||||||
|
{
|
||||||
|
g_assert_cmpstr ( katze_item_get_uri (a), ==, katze_item_get_uri (b));
|
||||||
|
g_assert_cmpstr ( katze_item_get_name (a), ==, katze_item_get_name (b));
|
||||||
|
g_assert_cmpstr ( katze_str_non_null (katze_item_get_text (a)), ==, katze_str_non_null (katze_item_get_text (b)));
|
||||||
|
g_assert_cmpint ( katze_item_get_meta_boolean (a, "app"), ==, katze_item_get_meta_boolean (b, "app"));
|
||||||
|
g_assert_cmpint ( katze_item_get_meta_boolean (a, "toolbar"), ==, katze_item_get_meta_boolean (b, "toolbar"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* NB: assumes "title" is unique in a set */
|
||||||
|
static void
|
||||||
|
compare_test_and_db (KatzeArray* test_bookmarks,
|
||||||
|
KatzeArray* db_bookmarks,
|
||||||
|
gboolean verbose)
|
||||||
|
{
|
||||||
|
KatzeArray* db_items;
|
||||||
|
KatzeItem *test_item, *db_item;
|
||||||
|
GList* list;
|
||||||
|
|
||||||
|
KATZE_ARRAY_FOREACH_ITEM_L (test_item, test_bookmarks, list)
|
||||||
|
{
|
||||||
|
if (verbose)
|
||||||
|
{
|
||||||
|
print_bookmark (test_item);
|
||||||
|
g_print ("----------\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
db_items = midori_array_query_recursive (db_bookmarks,
|
||||||
|
"*", "title='%q'", katze_item_get_name (test_item), FALSE);
|
||||||
|
|
||||||
|
g_assert_cmpint (katze_array_get_length (db_items), ==, 1);
|
||||||
|
db_item = katze_array_get_nth_item (db_items, 0);
|
||||||
|
|
||||||
|
compare_items (db_item, test_item);
|
||||||
|
|
||||||
|
if (KATZE_ITEM_IS_FOLDER(test_item))
|
||||||
|
compare_test_and_db ( KATZE_ARRAY (test_item), db_bookmarks, verbose);
|
||||||
|
}
|
||||||
|
g_list_free (list);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
insert_bookmarks (KatzeArray* test_bookmarks,
|
||||||
|
KatzeArray* db_bookmarks,
|
||||||
|
gboolean verbose)
|
||||||
|
{
|
||||||
|
KatzeItem* item;
|
||||||
|
GList* list;
|
||||||
|
sqlite3 *db = g_object_get_data (G_OBJECT (db_bookmarks), "db");
|
||||||
|
|
||||||
|
KATZE_ARRAY_FOREACH_ITEM_L (item, test_bookmarks, list)
|
||||||
|
{
|
||||||
|
if (verbose)
|
||||||
|
{
|
||||||
|
print_bookmark (item);
|
||||||
|
g_print ("----------\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
midori_bookmarks_insert_item_db (db, item, 0);
|
||||||
|
|
||||||
|
if (KATZE_ITEM_IS_FOLDER(item))
|
||||||
|
insert_bookmarks (KATZE_ARRAY (item), db_bookmarks, verbose);
|
||||||
|
}
|
||||||
|
g_list_free (list);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
simple_test (BookmarksFixture* fixture,
|
||||||
|
const TestParameters* params)
|
||||||
|
{
|
||||||
|
if (params->verbose)
|
||||||
|
g_print ("\n===== inserting items in the database =====\n");
|
||||||
|
insert_bookmarks (fixture->test_bookmarks, fixture->db_bookmarks, params->verbose);
|
||||||
|
|
||||||
|
if (params->verbose)
|
||||||
|
g_print ("===== comparing database with the original =====\n");
|
||||||
|
compare_test_and_db (fixture->test_bookmarks, fixture->db_bookmarks, params->verbose);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc,
|
||||||
|
char** argv)
|
||||||
|
{
|
||||||
|
//TestParameters default_params = {"/a/path/unlikely/to/exists/bookmarks.db", TRUE, NULL, NULL};
|
||||||
|
//TestParameters default_params = {"/tmp/bookmarks.db", TRUE, NULL, NULL};
|
||||||
|
//TestParameters default_params = {":memory:", TRUE, NULL, NULL};
|
||||||
|
TestParameters default_params = {":memory:", FALSE, NULL, NULL};
|
||||||
|
|
||||||
|
midori_app_setup (argv);
|
||||||
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
gtk_init_check (&argc, &argv);
|
||||||
|
|
||||||
|
g_test_add ("/bookmarks/simple test",
|
||||||
|
BookmarksFixture, &default_params,
|
||||||
|
(FixtureFunc) fixture_setup,
|
||||||
|
(FixtureFunc) simple_test,
|
||||||
|
(FixtureFunc) fixture_teardown);
|
||||||
|
|
||||||
|
return g_test_run ();
|
||||||
|
}
|
|
@ -10,7 +10,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "midori.h"
|
#include "midori.h"
|
||||||
#include "midori-bookmarks.h"
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -103,6 +103,7 @@ pushd $root_dir/bin > /dev/null
|
||||||
dll_recursive midori*.exe gspawn-*-helper*.exe libhunspell*.dll > $temp_dir/midori.exe.lst
|
dll_recursive midori*.exe gspawn-*-helper*.exe libhunspell*.dll > $temp_dir/midori.exe.lst
|
||||||
dll_recursive ../lib/gio/modules/*.dll >> $temp_dir/midori.exe.lst
|
dll_recursive ../lib/gio/modules/*.dll >> $temp_dir/midori.exe.lst
|
||||||
dll_recursive iconv.dll >> $temp_dir/midori.exe.lst
|
dll_recursive iconv.dll >> $temp_dir/midori.exe.lst
|
||||||
|
dll_recursive ../lib/gstreamer-0.10/*.dll >> $temp_dir/midori.exe.lst
|
||||||
|
|
||||||
if [ "$DEBUG_BUILD" != "" ]; then
|
if [ "$DEBUG_BUILD" != "" ]; then
|
||||||
dll_recursive gdb.exe GtkLauncher.exe >> $temp_dir/midori.exe.lst
|
dll_recursive gdb.exe GtkLauncher.exe >> $temp_dir/midori.exe.lst
|
||||||
|
@ -146,6 +147,8 @@ grab_files lib gio
|
||||||
# Fedora ships on-demand pango modules, check just in case
|
# Fedora ships on-demand pango modules, check just in case
|
||||||
grab_files lib pango
|
grab_files lib pango
|
||||||
|
|
||||||
|
grab_files lib gstreamer-0.10
|
||||||
|
|
||||||
echo -n .
|
echo -n .
|
||||||
|
|
||||||
# copy share
|
# copy share
|
||||||
|
|
10
wscript
10
wscript
|
@ -29,7 +29,7 @@ from Configure import find_program_impl
|
||||||
|
|
||||||
major = 0
|
major = 0
|
||||||
minor = 4
|
minor = 4
|
||||||
micro = 5
|
micro = 6
|
||||||
|
|
||||||
APPNAME = 'midori'
|
APPNAME = 'midori'
|
||||||
VERSION = VERSION_FULL = str (major) + '.' + str (minor) + '.' + str (micro)
|
VERSION = VERSION_FULL = str (major) + '.' + str (minor) + '.' + str (micro)
|
||||||
|
@ -260,11 +260,13 @@ def configure (conf):
|
||||||
check_pkg ('libsoup-2.4', '2.27.90')
|
check_pkg ('libsoup-2.4', '2.27.90')
|
||||||
conf.define ('LIBSOUP_VERSION', conf.check_cfg (modversion='libsoup-2.4'))
|
conf.define ('LIBSOUP_VERSION', conf.check_cfg (modversion='libsoup-2.4'))
|
||||||
if check_version (conf.env['LIBSOUP_VERSION'], 2, 29, 3):
|
if check_version (conf.env['LIBSOUP_VERSION'], 2, 29, 3):
|
||||||
conf.define ('LIBSOUP_2_29_3', 1)
|
conf.define ('HAVE_LIBSOUP_2_29_3', 1)
|
||||||
if check_version (conf.env['LIBSOUP_VERSION'], 2, 29, 91):
|
if check_version (conf.env['LIBSOUP_VERSION'], 2, 29, 91):
|
||||||
conf.define ('LIBSOUP_2_29_91', 1)
|
conf.define ('HAVE_LIBSOUP_2_29_91', 1)
|
||||||
|
if check_version (conf.env['LIBSOUP_VERSION'], 2, 33, 4):
|
||||||
|
conf.define ('HAVE_LIBSOUP_2_33_4', 1)
|
||||||
if check_version (conf.env['LIBSOUP_VERSION'], 2, 37, 1):
|
if check_version (conf.env['LIBSOUP_VERSION'], 2, 37, 1):
|
||||||
conf.define ('LIBSOUP_2_37_1', 1)
|
conf.define ('HAVE_LIBSOUP_2_37_1', 1)
|
||||||
check_pkg ('libxml-2.0', '2.6')
|
check_pkg ('libxml-2.0', '2.6')
|
||||||
check_pkg ('sqlite3', '3.0', True, var='SQLITE')
|
check_pkg ('sqlite3', '3.0', True, var='SQLITE')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue