Merge branch 'upstream-unstable'

This commit is contained in:
Yves-Alexis Perez 2011-05-02 07:58:23 +02:00
commit 07394c0337
85 changed files with 13937 additions and 11124 deletions

2
.gitignore vendored
View file

@ -12,3 +12,5 @@ po/stamp-it
po/*.gmo
midori.desktop
packages.version

View file

@ -1,5 +1,34 @@
This file is licensed under the terms of the expat license, see the file EXPAT.
v0.3.5:
+ Remove frame titles from preference dialogue
+ Show search engine icons in completion
+ Add Liferea news aggregator workaround
+ Support libSoup cache + size with WebKitGTK+ 1.3.11
+ No language, no encryption but Mozilla in user agent
+ Support F6, F7, Ctrl+(Shift)+Tab and Tab to complete
+ Strip scheme and www. in completion
+ Render filename as title of patch files
+ Turn location into a plain entry
+ Fix tab panel foreground colours
+ Mask timezone, language and plugins in private mode
+ Add 'Strip referrer details' preference
+ Embed extension list in preferences
+ Remove the Page Holder and Download Manager option
+ Disable prefetching and HTML5 storage in private mode
+ Handle 'Plugin will handle load' error
+ Show access keys next to numbers in link search
+ Introduce --private/ -p command line switch
+ Don't show toolbar preferences if running a DE
+ Show script alerts as infobars
+ Improve URI handling with addon installer
+ Change Ctrl+Q for Quit to Ctrl+Shift+Q
+ Make speed dial faster and mandatory
+ Load speed dial in private browsing mode
+ Show video formats in about:(version)
+ Move speed dial to key file instead of JSON
+ Add Offline Application Cache to Clear Private Data
v0.3.3:
+ Use 60 connections and 6 per host
+ Allow re-ordering of search engines

View file

@ -67,6 +67,10 @@ If you want to "dry run" without WebKitGTK+ rendering, try this:
'MIDORI_UNARMED=1 _build_/default/midori/midori'
To debug extensions you can specify the path:
'export MIDORI_EXTENSION_PATH=_build_/default/extensions'
For further information a tutorial for gdb and
reading up on how you can install debugging
symbols for libraries used by Midori are recommended.

53
TODO
View file

@ -5,58 +5,30 @@ TODO:
. Request network if not connected and re-open the url on success
. Make cookie manager horizontal if the window is wide
. Handle SSL like SSH: confirm any cert on first connection, warn about any change in subsequent connections
. Open on startup: Ask (Last open pages, Blank, Homepage, [x] Don't ask anymore)
. Support @run-at document-start: http://dev.chromium.org/developers/design-documents/user-scripts
. Add an 'install' button to addons
. Dragging a link onto the web view to open it
. Extension: Ask Google if an address cannot be found, ie. typo
. View source is not always equal to Save As
. Show New Window icon in statusbar for new-window links
. Validate search engine tokens
. Easily register stock items in extensions (mouse gestures, input-mouse)
. Show graphical error when a bookmarklet fails to run
. Unit test katze array action
. There is no way to reset the toolbar
. Estimate download speed
. Implement no_proxy, https_proxy
. Make it possible to use extra C or C++ libraries in extensions
. Add icon cache size preference
. Fix icons with white background to be transparent?
. Visually indicate that a tab is being opened even if outside the visible tabs
. gget/ eatmonkey/ Transmission dbus in Transfers
. Add Midori to autostart, and remove it if it's quit, optionally disabled
. Use @include and @exclude with userstyles
. Support -moz-document domain: http://userstyles.org/styles/22837
. Need a throbber with invisible menubar: make compact-menu throbb?
. Implement live bookmarks, see http://johnbokma.com/firefox/rss-and-live-bookmarks.html
. Add a dialog (right-cick) to Addons, to edit @include and @exclude
. Show URI in css overlay tooltips if statusbar is hidden
. "Menu" tool buttons aren't depressed while a menu is open
. Statusbar doesn't show right-click menu
. Statusbar/ transferbar doesn't show right-click menu
. Consider pango_layout_set_auto_dir
. Make it possible to change ident string for particular domains
. Support max-age for Flash cookies
. Update speed dial thumbnail when loading the according page from speed dial
. Implement "Open image" which opens an image with an external application
. Add custom actions extension; example Set Wallpaper
. Offer restoring session after crash, if session isn't opened at startup AND crash dialogue is enabled
. Vi extension, modelled after vimprobable
. Show loading tabs in the tab panel extension
. Let extensions add preferences
. Show syntax errors in userscripts/ styles
. Add HTTP_PRAGMA: no-cache when Ctrl+Shift+R
. Honor HTTP_PRAGMA: no-cache in web cache
. Switching browser window: Ctrl+Shift+PageUp/PageDown
. Switching panel: Ctrl+Alt+PageUp/PageDown
. Bookmark folder context menu, "Sort by Name"
. Adblock Block image: dialog to edit regex before adding
. KatzeArrayAction should support "activate" signal
. Remove extra inner panel border
. Move statusbar_contents below panel if statusbar is hidden
. Teplace "disable plugins" with showing a "load plugins automatically", where unchecking that keeps a placeholder that can be clicked to play
. Replace "disable plugins" with showing a "load plugins automatically", where unchecking that keeps a placeholder that can be clicked to play
. Show "Type an address or keywords to search" in empty location even when focussed
. Show "Search hostname" in (can't resolve) error page, www.heyarnold.twotoastsde == typo?
. Enable extensions in private (app) mode
. Allow -e Set setting or so
. Remember if inspector was attached or not
. Icon in empty entry to paste from clipboard
@ -64,16 +36,11 @@ TODO:
. Warn when closing tab with unsubmitted form
. Always allow popups, keep hidden, show icon to ask whether to show popups
. Make Shift + Click download the link
. Use an update timeout in KatzePropertyProxy instead of only focus-out
. Show a loading mouse pointer
. Export of the bookmarks file, or using one from a specific path
. Custom context menu actions, like in Thunar or Epiphany
. Analogus to blocked popups, blocked scripts moving layers on load (extension)
. Per-site blocking of individual elements on a page
. Statusbar icon 'cookies blocked', icon 'popups blocked'
. Per-site settings accessible via statusbar icons, ie. cookies, popups, plugins
. CookieSafe like, a list of cookies, with type, block, allow
. Automatic update checks (browser, extensions)?
. Auto-group tabs by opener, with colors?
. Mark (dogear) a selection so that it isn't cleared implicitly, multiply on one page
. Check specific bookmarks for updates automatically (extension)
@ -83,18 +50,16 @@ TODO:
. Honor design principle "no warnings but undo of backups"?
. Support widgets 1.0 spec in tool windows and standalone?
. Protected tabs prompt when attempting to close them
. Provide a 'sleep mode' after a crash where open documents are loaded manually
. Option to run plugins or scripts only on demand, like NoScript, per-site
. Optional http redirection manually or on timeout via SoupMessage::restarted
. Style: none, compatible (b/w), default, [styles], "media", ["media" styles]
. Mouse pointer coordinates in the status bar (extension)
. Draw rectangle with the mouse, x/y/x2/y2 in the statusbar (extension)
. Shared bookmarks and config
. Prevent dead tabs: download, aborted page
BOOKMARK ISSUES:
. Bookmark menu is not populated
. Bookmark toolbar is broken
. Import is broken
. Integration with locationbar search
. Remove separator from submenu before showing it
. In right to left pages the scroll bar should be on the left
. drag tab between windows
. zeitgeist extension to add history
. kiosk mode: http://www.twotoasts.de/bugs/index.php?do=details&task_id=605#comment2651
. Find Inline → <key> → Open selected hyperlink
. open selected addresses in tabs
. scrolling by just moving the mouse pointer to the edge of the window

View file

@ -6,8 +6,8 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>midori:faq</title>
<meta name="generator" content="DokuWiki" />
<meta name="robots" content="noindex,nofollow" />
<meta name="date" content="2011-03-08T14:48:25+0100" />
<meta name="robots" content="index,follow" />
<meta name="date" content="2011-04-25T16:56:20+0200" />
<meta name="keywords" content="midori,faq" />
<link rel="search" type="application/opensearchdescription+xml" href="/lib/exe/opensearch.php" title="Xfce Wiki" />
<link rel="start" href="/" />
@ -19,9 +19,9 @@
<link rel="canonical" href="http://wiki.xfce.org/midori/faq" />
<link rel="stylesheet" type="text/css" href="faq.css" />
<script type="text/javascript" ><!--//--><![CDATA[//><!--
var NS='midori';var JSINFO = {"id":"midori:faq","namespace":"midori"};
var NS='midori';var SIG=' --- //[[christian@twotoasts.de|Christian Dywan]] 2011/05/02 00:39//';var JSINFO = {"id":"midori:faq","namespace":"midori"};
//--><!]]></script>
<script type="text/javascript" charset="utf-8" src="/lib/exe/js.php?tseed=1299220652" ></script>
<script type="text/javascript" charset="utf-8" src="/lib/exe/js.php?tseed=1304238868" ></script>
</head>
<body>
<div class="dokuwiki export">
@ -40,11 +40,12 @@ var NS='midori';var JSINFO = {"id":"midori:faq","namespace":"midori"};
</li>
<li class="level1"><div class="li"><span class="li"><a href="#features" class="toc">Features</a></span></div>
<ul class="toc">
<li class="level2"><div class="li"><span class="li"><a href="#web_applicationsprivate_browsing" class="toc">Web Applications/ Private Browsing</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="#download_managers" class="toc">Download Managers</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="#web_applications" class="toc">Web Applications</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="#private_browsing" class="toc">Private Browsing</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="#proxy_servers" class="toc">Proxy servers</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="#using_the_keyboard" class="toc">Using the Keyboard</a></span></div>
<ul class="toc">
<li class="level3"><div class="li"><span class="li"><a href="#hjkl" class="toc">HJKL</a></span></div></li>
<li class="level3"><div class="li"><span class="li"><a href="#following_links" class="toc">Following Links</a></span></div></li>
<li class="level3"><div class="li"><span class="li"><a href="#toggling_between_pages" class="toc">Toggling between pages</a></span></div></li>
<li class="level3"><div class="li"><span class="li"><a href="#customizing_keyboard_shortcuts" class="toc">Customizing keyboard shortcuts</a></span></div></li>
@ -287,6 +288,8 @@ You need to have GStreamer plugins installed which implement the codecs.
</li>
<li class="level1"><div class="li"> For Youtube or Vimeo, you need WebKitGTK+ 1.1.20 or newer.</div>
</li>
<li class="level1"><div class="li"> You can <a href="http://ie.microsoft.com/testdrive/Graphics/VideoFormatSupport/Default.html" class="urlextern" title="http://ie.microsoft.com/testdrive/Graphics/VideoFormatSupport/Default.html" rel="nofollow">test your installed codecs here</a>..</div>
</li>
</ol>
</div>
@ -471,13 +474,13 @@ Note that incomplete .desktop files will silently fail and it will look as if it
</p>
</div>
<!-- EDIT4 SECTION "Common problems" [1213-8887] -->
<!-- EDIT4 SECTION "Common problems" [1213-9012] -->
<h1 class="sectionedit5"><a name="features" id="features">Features</a></h1>
<div class="level1">
</div>
<!-- EDIT5 SECTION "Features" [8888-8910] -->
<h2 class="sectionedit6"><a name="web_applicationsprivate_browsing" id="web_applicationsprivate_browsing">Web Applications/ Private Browsing</a></h2>
<!-- EDIT5 SECTION "Features" [9013-9035] -->
<h2 class="sectionedit6"><a name="web_applications" id="web_applications">Web Applications</a></h2>
<div class="level2">
<p>
@ -486,8 +489,6 @@ There are two closely related features to open websites as dedicated windows of
</p>
<ol>
<li class="level1"><div class="li"> File (or Globe button) → Private Browsing</div>
</li>
<li class="level1"><div class="li"> Right-click a hyperlink → Open as Web Application</div>
</li>
<li class="level1"><div class="li"> Add or Edit a bookmark → [x] Run as web application</div>
@ -500,65 +501,35 @@ There are two closely related features to open websites as dedicated windows of
You can also add options such as -e Fullscreen, -e Navigationbar or -e Statusbar (as of Midori 0.2.9 midori help-execute will list all available commands)
</p>
</div>
<!-- EDIT6 SECTION "Web Applications" [9036-9552] -->
<h2 class="sectionedit7"><a name="private_browsing" id="private_browsing">Private Browsing</a></h2>
<div class="level2">
<ol>
<li class="level1"><div class="li"> File menu/ App Menu button → Private Browsing</div>
</li>
</ol>
<p>
A window like this is always a separate process, so crashes don&#039;t affect the normal browser session. No sensitive data such as cookies, history or bookmarks are stored. No extensions are loaded. Panels are not available.
A private window is a separate process, so crashes don&#039;t affect the normal browser session. No sensitive data such as cookies, history or bookmarks are stored. No extensions are loaded. Panels are not available.
</p>
<p>
As of Midori 0.2.9 Private Browsing uses preferences, cookies, keyboard shortcuts and search engines from the normal session, but it won&#039;t save any changes. This behaviour can be emulated from the command line with ”-a” and ”-c”.
</p>
</div>
<!-- EDIT6 SECTION "Web Applications/ Private Browsing" [8911-9946] -->
<h2 class="sectionedit7"><a name="download_managers" id="download_managers">Download Managers</a></h2>
<div class="level2">
<p>
As of Midori 0.3.4 the private command line switch opens a private browsing instance with normal preferences, cookies, shortcuts and search engines. But no changes will be saved.
<acronym title="Domain Name System">DNS</acronym> prefetching is disabled in this mode, also referrers are stripped down to the hostname when navigating between different websites.
</p>
<p>
Midori can start downloads with an external download manager. To use that feature, open up the “Preferences” dialog, click the “Applications” tab, insert the name of a program executable or shell script in the “Download Manager” input box, right-click a link, and click “Download with Download Manager”. There is a list of download managers on <a href="http://en.wikipedia.org/wiki/Comparison_of_download_managers" class="urlextern" title="http://en.wikipedia.org/wiki/Comparison_of_download_managers" rel="nofollow">Wikipedia</a>.
The same options available to -a/ app can be used for private browsing mode.
</p>
</div>
<h4><a name="admiral" id="admiral">Admiral</a></h4>
<div class="level4">
<p>
<a href="http://bbs.archlinux.org/viewtopic.php?id=73504" class="urlextern" title="http://bbs.archlinux.org/viewtopic.php?id=73504" rel="nofollow">Admiral</a> is a shell script that utilizes <a href="http://aria2.sourceforge.net/" class="urlextern" title="http://aria2.sourceforge.net/" rel="nofollow">aria2</a>, <a href="http://freshmeat.net/projects/zenity" class="urlextern" title="http://freshmeat.net/projects/zenity" rel="nofollow">Zenity</a>, and <a href="http://linuxappfinder.com/package/libnotify-bin" class="urlextern" title="http://linuxappfinder.com/package/libnotify-bin" rel="nofollow">libnotify-bin</a>. Admiral allows you to choose the directory to which you wish download a file with a <acronym title="Graphical User Interface">GUI</acronym> dialog, sends a desktop notification if the download fails and when starting and finishing the download, and logs failures.
</p>
</div>
<h4><a name="aria2" id="aria2">Aria2</a></h4>
<div class="level4">
<p>
<a href="http://aria2.sourceforge.net/" class="urlextern" title="http://aria2.sourceforge.net/" rel="nofollow">aria2</a> is a lightweight multi-protocol &amp; multi-source, cross platform download utility operated in command-line. It supports <acronym title="Hyper Text Transfer Protocol">HTTP</acronym>/HTTPS, <acronym title="File Transfer Protocol">FTP</acronym>, BitTorrent and Metalink. aria2 has built-in <acronym title="Extensible Markup Language">XML</acronym>-<acronym title="Remote Procedure Call">RPC</acronym> interface. You can manipulate aria2 via <acronym title="Extensible Markup Language">XML</acronym>-<acronym title="Remote Procedure Call">RPC</acronym> interface.
</p>
</div>
<h4><a name="uget_former_urlgfe" id="uget_former_urlgfe">Uget (former Urlgfe)</a></h4>
<div class="level4">
<p>
<a href="http://urlget.sourceforge.net/" class="urlextern" title="http://urlget.sourceforge.net/" rel="nofollow">UGet</a> is a cross platform download manager. It can watch the clipboard to offer download dialogues automatically and it can be configured to pass through files, such as torrents, to the appropriate handler.
</p>
</div>
<h4><a name="gget" id="gget">GGet</a></h4>
<div class="level4">
<p>
<a href="http://live.gnome.org/GGet" class="urlextern" title="http://live.gnome.org/GGet" rel="nofollow">GGet</a> is a download manager primarily for the GNOME desktop, but it also works in other unix/ GTk+ environments.
</p>
</div>
<!-- EDIT7 SECTION "Download Managers" [9947-11615] -->
<!-- EDIT7 SECTION "Private Browsing" [9553-10476] -->
<h2 class="sectionedit8"><a name="proxy_servers" id="proxy_servers">Proxy servers</a></h2>
<div class="level2">
@ -572,12 +543,10 @@ To use Midori with a proxy server, there are two options:
</p>
<ol>
<li class="level1"><div class="li"> WebKit is built with libcurl. Define an environment variable http_proxy and set it to your proxy server like so:</div>
<li class="level1"><div class="li"> WebKit is built with libcurl. Define an environment variable http_proxy and set it to your proxy server like so:<pre class="code"> export http_proxy = 234.22.154.11:8000</pre>
</div>
</li>
</ol>
<pre class="code">export http_proxy = 234.22.154.11:8000</pre>
<ol>
<li class="level1"><div class="li"> 2. WebKit is built with libsoup. Midori &gt;= 0.1.2, is built with libsoup. Try to open some web page. Now open the preferences, and you should see a Network tab with a &#039;Proxy server&#039; field.</div>
<li class="level1"><div class="li"> WebKit is built with libsoup. Midori &gt;= 0.1.2, is built with libsoup. Try to open some web page. Now open the preferences, and you should see a Network tab with a &#039;Proxy server&#039; field.</div>
</li>
</ol>
@ -626,13 +595,32 @@ Mousehole is a scriptable proxy server written in Ruby.
</p>
</div>
<!-- EDIT8 SECTION "Proxy servers" [11616-12858] -->
<!-- EDIT8 SECTION "Proxy servers" [10477-11727] -->
<h2 class="sectionedit9"><a name="using_the_keyboard" id="using_the_keyboard">Using the Keyboard</a></h2>
<div class="level2">
</div>
<!-- EDIT9 SECTION "Using the Keyboard" [12859-12890] -->
<h3 class="sectionedit10"><a name="following_links" id="following_links">Following Links</a></h3>
<!-- EDIT9 SECTION "Using the Keyboard" [11728-11759] -->
<h3 class="sectionedit10"><a name="hjkl" id="hjkl">HJKL</a></h3>
<div class="level3">
<p>
You can use the Vim-like key bindings [hjkl] to navigate a page. h=left j=down k=up l=right In a picture:
</p>
<pre class="code"> k
h l
j</pre>
<p>
You can also use the arrow keys to do the same.
</p>
</div>
<!-- EDIT10 SECTION "HJKL" [11760-11967] -->
<h3 class="sectionedit11"><a name="following_links" id="following_links">Following Links</a></h3>
<div class="level3">
<p>
@ -645,8 +633,8 @@ With hints enabled, type the link number, and press Enter to open the link in th
</p>
</div>
<!-- EDIT10 SECTION "Following Links" [12891-13222] -->
<h3 class="sectionedit11"><a name="toggling_between_pages" id="toggling_between_pages">Toggling between pages</a></h3>
<!-- EDIT11 SECTION "Following Links" [11968-12299] -->
<h3 class="sectionedit12"><a name="toggling_between_pages" id="toggling_between_pages">Toggling between pages</a></h3>
<div class="level3">
<p>
@ -655,8 +643,8 @@ Enable the History List extension Tools → Extensions. Now you can conveniently
</p>
</div>
<!-- EDIT11 SECTION "Toggling between pages" [13223-13382] -->
<h3 class="sectionedit12"><a name="customizing_keyboard_shortcuts" id="customizing_keyboard_shortcuts">Customizing keyboard shortcuts</a></h3>
<!-- EDIT12 SECTION "Toggling between pages" [12300-12459] -->
<h3 class="sectionedit13"><a name="customizing_keyboard_shortcuts" id="customizing_keyboard_shortcuts">Customizing keyboard shortcuts</a></h3>
<div class="level3">
<p>
@ -666,8 +654,8 @@ Enable the Shortcuts extension Tools → Extensions. To edit a keybinding Tools
</p>
</div>
<!-- EDIT12 SECTION "Customizing keyboard shortcuts" [13383-13531] -->
<h2 class="sectionedit13"><a name="mouse_gestures" id="mouse_gestures">Mouse Gestures</a></h2>
<!-- EDIT13 SECTION "Customizing keyboard shortcuts" [12460-12608] -->
<h2 class="sectionedit14"><a name="mouse_gestures" id="mouse_gestures">Mouse Gestures</a></h2>
<div class="level2">
<p>
@ -703,8 +691,8 @@ Additionally, there are programs allowing mouse gestures system-wide, for exampl
</p>
</div>
<!-- EDIT13 SECTION "Mouse Gestures" [13532-14263] -->
<h2 class="sectionedit14"><a name="spell_check" id="spell_check">Spell check</a></h2>
<!-- EDIT14 SECTION "Mouse Gestures" [12609-13340] -->
<h2 class="sectionedit15"><a name="spell_check" id="spell_check">Spell check</a></h2>
<div class="level2">
<p>
@ -718,8 +706,8 @@ Now while typing any errors should get underlined in red. To get suggestions, hi
</p>
</div>
<!-- EDIT14 SECTION "Spell check" [14264-14557] -->
<h2 class="sectionedit15"><a name="user_scripts" id="user_scripts">User scripts</a></h2>
<!-- EDIT15 SECTION "Spell check" [13341-13634] -->
<h2 class="sectionedit16"><a name="user_scripts" id="user_scripts">User scripts</a></h2>
<div class="level2">
</div>
@ -739,15 +727,33 @@ UserScripts are scripts applied on some, or on all web pages. They can modify p
<p>
First, you need to find some scripts (or write your own). You can find some at <a href="http://userscripts.org/" class="urlextern" title="http://userscripts.org/" rel="nofollow">userscripts.org</a>. As explained previously, a lot of scripts work, while others do not work.
First enable the “User Addons” extension. It will show up as a “User Scripts” panel (and it also provides “User Styles”).
</p>
<p>
To install a userscript, you have to download the script as a file, and put it in the following directory <strong>~/.local/share/midori/scripts</strong> (you may need to create that directory if it does not exist). Midori will automatically see and use it, which you can also see in the user scripts panel.
Now you need to find some scripts. You can find some at <a href="http://userscripts.org/" class="urlextern" title="http://userscripts.org/" rel="nofollow">userscripts.org</a>. Most scripts work fine, some may be written specifically for other browsers.
</p>
<p>
Note, if the script is only shown as source code on the page, you first have to create a new text file in a text editor, copy the source code into the new file, and save it as my-user-script.js where ”.js” is the extension.
If you have Midori 0.3.0 or newer, you will be offered to install scripts as soon as you see them on the page.
</p>
<p>
To manually install a userscript, you have to download the script as a file, and put it in the folder <strong>~/.local/share/midori/scripts</strong>. You need to create that folder if it doesn&#039;t exist yet. Midori will automatically see and use it, which you can also see in the user scripts panel.
</p>
<p>
If the script is only shown as source code on the page, you first have to create a new text file in a text editor, copy the source code into the new file, and save it as my-user-script.js where ”.js” is the extension.
</p>
</div>
<h4><a name="compatibility_with_greasemonkey" id="compatibility_with_greasemonkey">Compatibility with GreaseMonkey</a></h4>
<div class="level4">
<p>
As previously mentioned, Midori can use most scripts you will find. Midori supports Greasemonkey&#039;s <em>@include</em> and <em>@exclude</em> metadata so that scripts are only loaded on appropriate pages. Midori doesn&#039;t support advanced metadata, such as @require and @resource, so user scripts can&#039;t define dependencies on other scripts - most of the time this isn&#039;t a problem. Midori also does not support <a href="http://wiki.greasespot.net/API_reference" class="urlextern" title="http://wiki.greasespot.net/API_reference" rel="nofollow">Greasemonkey API</a>. Scripts must also be compatible with Webkit, since Midori is based on WebKit. A Greasemonkey script that makes use of functionality of Gecko/ Firefox will not work in Midori.
</p>
</div>
@ -771,8 +777,8 @@ You can also use <a href="http://rightfootin.blogspot.com/2009/04/flashblock-wan
</p>
</div>
<!-- EDIT15 SECTION "User scripts" [14558-16243] -->
<h2 class="sectionedit16"><a name="user_styles" id="user_styles">User styles</a></h2>
<!-- EDIT16 SECTION "User scripts" [13635-16195] -->
<h2 class="sectionedit17"><a name="user_styles" id="user_styles">User styles</a></h2>
<div class="level2">
</div>
@ -842,6 +848,6 @@ Customize as needed:
}</pre>
</div>
<!-- EDIT16 SECTION "User styles" [16244-] --></div>
<!-- EDIT17 SECTION "User styles" [16196-] --></div>
</body>
</html>

View file

@ -95,10 +95,6 @@
height: 100%;
}
.waiter img {
margin-top: 38px;
}
div.shortcut a:hover {
border: 1px solid #999;
}
@ -108,6 +104,9 @@
margin: 0px;
padding: 5px 0px 0px;
color: #222;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
div.clear {
@ -194,14 +193,6 @@
<script type="text/javascript">
var sc = JSON.decode ({json_data});
var encodeSafe = function (obj) {
var str = JSON.encode (obj);
str = str.replace (/\'/g, '\\\'');
return str;
}
var getAction = function (id)
{
var a = $(id).getFirst ();
@ -216,63 +207,18 @@
var name = prompt ("{enter_shortcut_name}", "");
if (!name) name = "";
a.setProperty('href', url);
a.getNext().set('text', name);
var num = id.substr (1) - 1;
sc.shortcuts[num].title = name;
a.empty();
var im = new Element('img', { src: '{stock}/image-loading' });
a.addClass ('waiter');
a.grab (im);
getThumbnail (id, url);
console.log ("speed_dial-save-add " + id + " " + url + " " + name);
return false;
}
var getThumbnail = function (id, url)
{
console.log ("speed_dial-get-thumbnail " + id + " " + url);
return false;
}
var setThumbnail = function (id, data, href)
{
var a = $(id).getFirst ();
var im = new Element ('img', { src: 'data:image/png;base64,' + data });
a.empty ().removeClass ('waiter').grab (im);
a.setProperty ('href', href);
var cross = new Element ('div', { 'html': '' });
cross.setProperty ('onclick', 'clearShortcut("' + id + '");');
cross.addClass ('cross');
cross.inject ($(id), 'top');
$(id).addClass ('activated');
var p = a.getNext ();
p.setProperty('onclick', 'javascript:renameShortcut("' + id + '");');
var num = id.substr (1) - 1;
sc.shortcuts[num].href = href;
sc.shortcuts[num].img = data;
console.log ("speed_dial-save '" + encodeSafe (sc) + "'");
}
var renameShortcut = function (id)
{
var num = id.substr (1) - 1;
var name = prompt ("{enter_shortcut_name}", sc.shortcuts[num].title);
var name = prompt ("{enter_shortcut_name}", $(id).getLast ().get ('html', name));
if (!name) return;
$(id).getLast ().set ('html', name);
sc.shortcuts[num].title = name;
console.log ("speed_dial-save '" + encodeSafe (sc) + "'");
console.log ("speed_dial-save-rename " + id + " " + name);
}
var clearShortcut = function (id)
@ -280,96 +226,13 @@
if(!confirm("{are_you_sure}"))
return;
var num = id.substr (1);
var div = $(id);
var cross = div.getFirst ();
var a = cross.getNext ();
var p = a.getNext ();
cross.dispose ();
div.removeClass ('activated');
a.empty ().set ('html', '<h1>' + num + '</h1><h4><span/></h4>');
a.setProperty ('href', '#');
p.empty ().removeProperty ('onclick');
num -= 1;
sc.shortcuts[num].href = "#";
sc.shortcuts[num].title = "";
sc.shortcuts[num].img = "";
console.log ("speed_dial-save '" + encodeSafe (sc) + "'");
}
var buildSpeeddial = function ()
{
var width = 3;
var thumb = 160;
if (sc.thumb)
{
thumb = sc.thumb;
setThumbSize(thumb);
}
if (sc.width)
{
width = sc.width;
$('wrap').style.width = (width * (thumb + 60)) + 'px';
}
sc.shortcuts.each (function (item, index, sc)
{
var cl = "shortcut";
if (index < width)
cl += " top";
if ((index % width) == (width - 1))
cl += " right";
var div = new Element ('div', {
'class': cl,
'id': item.id
});
var a = new Element ('a', {
'href': item.href,
'events': {
'click': function () {
return getAction (item.id);
}
}
});
var p = new Element ('p', {
'text': item.title
});
if (item.href == "#")
a.set ('html', '<h1>' + item.id.substr (1) + '</h1><h4><span/></h4>');
else
{
div.addClass ('activated');
var im = new Element ('img', { src: 'data:image/png;base64,' + item.img });
var cross = new Element ('div', { 'html': '' });
cross.setProperty ('onclick', 'clearShortcut("' + item.id + '");');
cross.addClass ('cross');
cross.inject (div, 'top');
a.grab (im);
p.setProperty('onclick', 'javascript:renameShortcut("' + item.id + '");');
}
div.grab (a);
div.grab (p);
$('content').grab (div);
});
console.log ("speed_dial-save-delete " + id);
}
var setSize = function ()
{
if (typeof sc.width == 'undefined')
sc.width = 3;
var rows = Math.ceil (sc.shortcuts.length / sc.width);
var size = prompt ("{enter_dial_size}", sc.width + 'x' + rows);
var size = prompt ("{enter_dial_size}", columns + 'x' + rows);
if (!size) return;
@ -396,23 +259,7 @@
return;
}
sc.width = cols;
var count = cols * rows;
sc.shortcuts = sc.shortcuts.slice (0, count);
var i = sc.shortcuts.length;
while (i < count)
{
i++;
sc.shortcuts.push ({"id" : "s" + i, "href" : "#", "title" : "", "img" : ""});
}
$('content').empty ();
buildSpeeddial ();
console.log ("speed_dial-save '" + encodeSafe (sc) + "'");
console.log ("speed_dial-save-size " + cols + " " + rows);
}
var setThumbSize = function (size)
@ -420,10 +267,7 @@
var i;
var rules = document.styleSheets[0].cssRules;
var width = 3;
if (sc.width)
width = sc.width;
var width = columns;
var height = Math.round (size / 1.5);
$('wrap').style.width = (width * (size + 60)) + 'px';
@ -452,17 +296,8 @@
break;
}
}
if (sc.thumb != size)
{
sc.thumb = size;
console.log ("speed_dial-save '" + encodeSafe (sc) + "'");
console.log ("speed_dial-save-thumbsize " + size);
}
}
window.addEvent ('domready', function () {
buildSpeeddial ();
});
var key_id = 's';
var key_timeout;
@ -478,14 +313,14 @@
if ($(key_id))
{
if (key_id.substr(1) * 10 > sc.shortcuts.length)
if (key_id.substr(1) > 9)
{
if (getAction (key_id))
document.location = $(key_id).children[1];
key_id = 's';
}
else
key_timeout = setTimeout ('if (getAction (key_id)) document.location = $(key_id).children[1]; key_id = \'s\'', 3000);
key_timeout = setTimeout ('if (getAction (key_id)) document.location = $(key_id).children[1]; key_id = \'s\'', 1000);
}
else
key_id = 's';
@ -511,8 +346,3 @@
</div>
<div id="wrap">
<div id="content">
</div>
</div>
</body>
</html>

View file

@ -1 +0,0 @@
'{"shortcuts":[{"id":"s1","href":"#","title":"","img":""},{"id":"s2","href":"#","title":"","img":""},{"id":"s3","href":"#","title":"","img":""},{"id":"s4","href":"#","title":"","img":""},{"id":"s5","href":"#","title":"","img":""},{"id":"s6","href":"#","title":"","img":""},{"id":"s7","href":"#","title":"","img":""},{"id":"s8","href":"#","title":"","img":""},{"id":"s9","href":"#","title":"","img":""}]}'

View file

@ -1221,10 +1221,10 @@ adblock_frame_add_private (const gchar* line,
if (strchr (data[0], ','))
{
gchar** domains;
gint max, i;
gint i;
domains = g_strsplit (data[0], ",", -1);
for (max = i = 0; domains[i]; i++)
for (i = 0; domains[i]; i++)
{
new_blockcss = g_strdup_printf ("%s;\nsites['%s']+=',%s'",
blockcssprivate, g_strstrip (domains[i]), data[1]);

View file

@ -1,7 +1,7 @@
/*
Copyright (C) 2008 Christian Dywan <christian@twotoasts.de>
Copyright (C) 2008-2010 Arno Renevier <arno@renevier.net>
Copyright (C) 2010 Paweł Forysiuk <tuxator@o2.pl>
Copyright (C) 2010-2011 Paweł Forysiuk <tuxator@o2.pl>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -100,11 +100,7 @@ addons_install_response (GtkWidget* infobar,
{
if (response_id == GTK_RESPONSE_ACCEPT)
{
MidoriBrowser* browser;
const gchar* uri;
browser = midori_browser_get_for_widget (GTK_WIDGET (infobar));
uri = midori_view_get_display_uri (view);
const gchar* uri = midori_view_get_display_uri (view);
if (uri && *uri)
{
gchar** split_uri;
@ -152,15 +148,10 @@ addons_install_response (GtkWidget* infobar,
}
else if (!g_strcmp0 (hostname, "userstyles.org"))
{
gchar* subpage;
gchar* subpage = split_uri[4];
folder = "styles";
if (g_str_has_suffix (uri, "/"))
subpage = split_uri[6];
else
subpage = split_uri[5];
if (!subpage)
if ((subpage && *subpage) && g_ascii_isdigit (subpage[0]))
{
gchar* style_id;
const gchar* js_script;
@ -278,14 +269,10 @@ addons_notify_load_status_cb (MidoriView* view,
else if (g_str_has_prefix (uri, "http://userstyles.org/styles/"))
{
gchar** split_uri = g_strsplit (uri, "/", -1);
gchar* subpage;
gchar* subpage = split_uri[4];
if (g_str_has_suffix (uri, "/"))
subpage = split_uri[6];
else
subpage = split_uri[5];
/* userstyles.org style main page with style description */
if (!subpage)
if ((subpage && *subpage) && g_ascii_isdigit (subpage[0]))
addons_uri_install (view, ADDONS_USER_STYLES);
g_strfreev (split_uri);
@ -674,8 +661,6 @@ addons_get_toolbar (MidoriViewable* viewable)
g_signal_connect (toolitem, "clicked",
G_CALLBACK (midori_addons_button_delete_clicked_cb), viewable);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem),
_("Open target folder for selected addon"));
gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem), _("Remove selected addon"));
gtk_widget_show (GTK_WIDGET (toolitem));
ADDONS (viewable)->toolbar = toolbar;

View file

@ -13,14 +13,23 @@
#include <midori/midori.h>
static void
colorful_tabs_modify_fg (GtkWidget* child,
colorful_tabs_modify_fg (GtkWidget* label,
GdkColor* color)
{
if (GTK_IS_LABEL (child))
GtkWidget* box = gtk_bin_get_child (GTK_BIN (label));
GList* children = gtk_container_get_children (GTK_CONTAINER (box));
for (; children != NULL; children = g_list_next (children))
{
gtk_widget_modify_fg (child, GTK_STATE_ACTIVE, color);
gtk_widget_modify_fg (child, GTK_STATE_NORMAL, color);
if (GTK_IS_LABEL (children->data))
{
gtk_widget_modify_fg (children->data, GTK_STATE_ACTIVE, color);
gtk_widget_modify_fg (children->data, GTK_STATE_NORMAL, color);
/* Also modify the label itself, for Tab Panel */
gtk_widget_modify_fg (label, GTK_STATE_NORMAL, color);
break;
}
}
g_list_free (children);
}
static void
@ -28,7 +37,6 @@ colorful_tabs_view_notify_uri_cb (MidoriView* view,
GParamSpec* pspec,
MidoriExtension* extension)
{
GtkWidget* box;
GtkWidget* label;
SoupURI* uri;
gchar* colorstr;
@ -82,14 +90,9 @@ colorful_tabs_view_notify_uri_cb (MidoriView* view,
else
gdk_color_parse ("#000", &fgcolor);
box = gtk_bin_get_child (GTK_BIN (label));
gtk_event_box_set_visible_window (GTK_EVENT_BOX (label), TRUE);
gtk_container_foreach (GTK_CONTAINER (box),
(GtkCallback) colorful_tabs_modify_fg,
&fgcolor);
colorful_tabs_modify_fg (label, &fgcolor);
gtk_widget_modify_bg (label, GTK_STATE_NORMAL, &color);
if (color.red < 10000)
@ -111,9 +114,7 @@ colorful_tabs_view_notify_uri_cb (MidoriView* view,
{
gtk_widget_modify_bg (label, GTK_STATE_NORMAL, NULL);
gtk_widget_modify_bg (label, GTK_STATE_ACTIVE, NULL);
gtk_container_foreach (GTK_CONTAINER (gtk_bin_get_child (GTK_BIN (label))),
(GtkCallback) colorful_tabs_modify_fg,
NULL);
colorful_tabs_modify_fg (label, NULL);
}
}
@ -153,9 +154,7 @@ colorful_tabs_deactivate_cb (MidoriExtension* extension,
gtk_event_box_set_visible_window (GTK_EVENT_BOX (label), FALSE);
gtk_widget_modify_bg (label, GTK_STATE_NORMAL, NULL);
gtk_widget_modify_bg (label, GTK_STATE_ACTIVE, NULL);
gtk_container_foreach (GTK_CONTAINER (gtk_bin_get_child (GTK_BIN (label))),
(GtkCallback) colorful_tabs_modify_fg,
NULL);
colorful_tabs_modify_fg (label, NULL);
g_signal_handlers_disconnect_by_func (
view, colorful_tabs_view_notify_uri_cb, extension);
}

View file

@ -430,11 +430,8 @@ feed_panel_popup_item (GtkWidget* menu,
gpointer callback,
FeedPanel* panel)
{
const gchar* uri;
GtkWidget* menuitem;
uri = katze_item_get_uri (item);
menuitem = gtk_image_menu_item_new_from_stock (stock_id, NULL);
if (label)
gtk_label_set_text_with_mnemonic (GTK_LABEL (gtk_bin_get_child (

View file

@ -221,31 +221,24 @@ private class HistoryList : Midori.Extension {
hw.walk (step);
}
void browser_added (Midori.Browser browser) {
ulong sidTabNext, sidTabPrevious;
var acg = new Gtk.AccelGroup ();
browser.add_accel_group (acg);
var action_group = browser.get_action_group ();
Gtk.Action action;
action = new Gtk.Action ("HistoryListNextTab",
_("Next Tab (History List)"),
_("Next tab from history"), null);
action.activate.connect ((a) => {
action = action_group.get_action ("TabNext");
browser.block_action (action);
sidTabNext = action.activate.connect ((a) => {
this.walk (a, browser, typeof (TabWindow), 1);
});
action_group.add_action_with_accel (action, "<Ctrl>Tab");
action.set_accel_group (acg);
action.connect_accelerator ();
action = new Gtk.Action ("HistoryListPreviousTab",
_("Previous Tab (History List)"),
_("Previous tab from history"), null);
action.activate.connect ((a) => {
action = action_group.get_action ("TabPrevious");
browser.block_action (action);
sidTabPrevious = action.activate.connect ((a) => {
this.walk (a, browser, typeof (TabWindow), -1);
});
action_group.add_action_with_accel (action, "<Ctrl><Shift>Tab");
action.set_accel_group (acg);
action.connect_accelerator ();
action = new Gtk.Action ("HistoryListNextNewTab",
_("Next new Tab (History List)"),
@ -267,6 +260,9 @@ private class HistoryList : Midori.Extension {
action.set_accel_group (acg);
action.connect_accelerator ();
browser.set_data<ulong> ("history-list-sid-tab-next", sidTabNext);
browser.set_data<ulong> ("history-list-sid-tab-previous", sidTabPrevious);
browser.set_data<GLib.PtrArray*> ("history-list-tab-history",
new GLib.PtrArray ());
browser.set_data<GLib.PtrArray*> ("history-list-tab-history-new",
@ -280,13 +276,24 @@ private class HistoryList : Midori.Extension {
browser.notify["tab"].connect (this.tab_changed);
}
void browser_removed (Midori.Browser browser) {
string[] callbacks = { "HistoryListNextTab", "HistoryListPreviousTab",
"HistoryListNextNewTab", "HistoryListPreviousNewTab" };
string[] callbacks = { "HistoryListNextNewTab", "HistoryListPreviousNewTab" };
ulong sidTabNext, sidTabPrevious;
sidTabNext = browser.get_data<ulong> ("history-list-sid-tab-next");
sidTabPrevious = browser.get_data<ulong> ("history-list-sid-tab-previous");
Gtk.Action action;
Gtk.ActionGroup action_group;
action_group = browser.get_action_group ();
action = action_group.get_action ("TabNext");
action.disconnect (sidTabNext);
browser.unblock_action (action);
action = action_group.get_action ("TabPrevious");
action.disconnect (sidTabPrevious);
browser.unblock_action (action);
for (int i = 0; i < callbacks.length; i++) {
Gtk.Action action = action_group.get_action (callbacks[i]);
action = action_group.get_action (callbacks[i]);
if (action != null)
action_group.remove_action (action);
}

View file

@ -1,184 +0,0 @@
/*
Copyright (C) 2008 Christian Dywan <christian@twotoasts.de>
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/midori.h>
#define STOCK_PAGE_HOLDER "page-holder"
static void
page_holder_app_add_browser_cb (MidoriApp* app,
MidoriBrowser* browser,
MidoriExtension* extension);
static gint
page_holder_notebook_append_view (GtkWidget* notebook)
{
GtkWidget* view;
MidoriBrowser* browser;
MidoriWebSettings *settings;
GtkWidget* label;
view = midori_view_new (NULL);
browser = midori_browser_get_for_widget (notebook);
settings = midori_browser_get_settings (browser);
midori_view_set_settings (MIDORI_VIEW (view), settings);
gtk_widget_show (view);
label = midori_view_get_proxy_tab_label (MIDORI_VIEW (view));
return gtk_notebook_append_page (GTK_NOTEBOOK (notebook), view, label);
}
static void
page_holder_button_jump_to_clicked_cb (GtkWidget* button,
GtkWidget* notebook)
{
gint n;
MidoriBrowser* browser;
const gchar* uri;
GtkWidget* view;
n = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
if (n < 0)
n = page_holder_notebook_append_view (notebook);
browser = midori_browser_get_for_widget (notebook);
uri = midori_browser_get_current_uri (browser);
view = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), n);
midori_view_set_uri (MIDORI_VIEW (view), uri);
}
static void
page_holder_button_add_clicked_cb (GtkWidget* button,
GtkWidget* notebook)
{
gint n;
GtkWidget* view;
MidoriBrowser* browser;
const gchar* uri;
n = page_holder_notebook_append_view (notebook);
view = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), n);
browser = midori_browser_get_for_widget (notebook);
uri = midori_browser_get_current_uri (browser);
midori_view_set_uri (MIDORI_VIEW (view), uri);
}
static void
page_holder_deactivate_cb (MidoriExtension* extension,
GtkWidget* notebook)
{
MidoriApp* app = midori_extension_get_app (extension);
gtk_widget_destroy (notebook);
g_signal_handlers_disconnect_by_func (
extension, page_holder_deactivate_cb, notebook);
g_signal_handlers_disconnect_by_func (
app, page_holder_app_add_browser_cb, extension);
}
static void
page_holder_app_add_browser_cb (MidoriApp* app,
MidoriBrowser* browser,
MidoriExtension* extension)
{
GtkWidget* panel;
GtkWidget* notebook;
GtkWidget* toolbar;
GtkToolItem* toolitem;
panel = katze_object_get_object (browser, "panel");
notebook = gtk_notebook_new ();
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_RIGHT);
gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE);
gtk_widget_show (notebook);
toolbar = gtk_toolbar_new ();
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH_HORIZ);
gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_BUTTON);
gtk_widget_show (toolbar);
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_JUMP_TO);
gtk_tool_item_set_is_important (toolitem, TRUE);
g_signal_connect (toolitem, "clicked",
G_CALLBACK (page_holder_button_jump_to_clicked_cb), notebook);
gtk_widget_show (GTK_WIDGET (toolitem));
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
toolitem = gtk_separator_tool_item_new ();
gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (toolitem), FALSE);
gtk_tool_item_set_expand (toolitem, TRUE);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
gtk_widget_show (GTK_WIDGET (toolitem));
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_ADD);
gtk_tool_item_set_is_important (toolitem, TRUE);
g_signal_connect (toolitem, "clicked",
G_CALLBACK (page_holder_button_add_clicked_cb), notebook);
gtk_widget_show (GTK_WIDGET (toolitem));
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
midori_panel_append_widget (MIDORI_PANEL (panel), notebook,
/* i18n: A panel showing a user specified web page */
STOCK_PAGE_HOLDER, _("Pageholder"), toolbar);
g_signal_connect (extension, "deactivate",
G_CALLBACK (page_holder_deactivate_cb), notebook);
g_object_unref (panel);
}
static void
page_holder_activate_cb (MidoriExtension* extension,
MidoriApp* app)
{
KatzeArray* browsers;
MidoriBrowser* browser;
browsers = katze_object_get_object (app, "browsers");
KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
page_holder_app_add_browser_cb (app, browser, extension);
g_object_unref (browsers);
g_signal_connect (app, "add-browser",
G_CALLBACK (page_holder_app_add_browser_cb), extension);
}
MidoriExtension*
extension_init (void)
{
GtkIconFactory* factory;
GtkIconSource* icon_source;
GtkIconSet* icon_set;
static GtkStockItem items[] =
{
{ STOCK_PAGE_HOLDER, N_("_Pageholder"), 0, 0, NULL },
};
factory = gtk_icon_factory_new ();
gtk_stock_add (items, G_N_ELEMENTS (items));
icon_set = gtk_icon_set_new ();
icon_source = gtk_icon_source_new ();
gtk_icon_source_set_icon_name (icon_source, GTK_STOCK_ORIENTATION_PORTRAIT);
gtk_icon_set_add_source (icon_set, icon_source);
gtk_icon_source_free (icon_source);
gtk_icon_factory_add (factory, STOCK_PAGE_HOLDER, icon_set);
gtk_icon_set_unref (icon_set);
gtk_icon_factory_add_default (factory);
g_object_unref (factory);
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
"name", _("Pageholder"),
"description", _("Keep one or multiple pages open in parallel to your tabs"),
"version", "0.1",
"authors", "Christian Dywan <christian@twotoasts.de>",
NULL);
g_signal_connect (extension, "activate",
G_CALLBACK (page_holder_activate_cb), NULL);
return extension;
}

View file

@ -360,6 +360,7 @@ tab_panel_view_notify_icon_cb (GtkWidget* view,
gtk_tree_store_set (GTK_TREE_STORE (model), &iter,
3, icon,
6, &style->bg[GTK_STATE_NORMAL],
7, &style->fg[GTK_STATE_NORMAL],
-1);
}
}
@ -452,7 +453,7 @@ tab_panel_browser_add_tab_cb (MidoriBrowser* browser,
gtk_tree_store_insert_with_values (GTK_TREE_STORE (model),
&iter, NULL, page, 0, view, 1, GTK_STOCK_CLOSE, 2, buttons,
3, icon, 4, title, 5, ellipsize, 6, NULL, -1);
3, icon, 4, title, 5, ellipsize, 6, NULL, 7, NULL, -1);
}
if (!g_signal_handler_find (view, G_SIGNAL_MATCH_FUNC,
@ -530,8 +531,9 @@ tab_panel_app_add_browser_cb (MidoriApp* app,
panel = katze_object_get_object (browser, "panel");
model = gtk_tree_store_new (7, MIDORI_TYPE_VIEW,
G_TYPE_STRING, G_TYPE_BOOLEAN, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT, GDK_TYPE_COLOR);
model = gtk_tree_store_new (8, MIDORI_TYPE_VIEW,
G_TYPE_STRING, G_TYPE_BOOLEAN, GDK_TYPE_PIXBUF, G_TYPE_STRING,
G_TYPE_INT, GDK_TYPE_COLOR, GDK_TYPE_COLOR);
g_object_set_data (G_OBJECT (browser), "tab-panel-ext-model", model);
treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
@ -549,7 +551,8 @@ tab_panel_app_add_browser_cb (MidoriApp* app,
renderer_text = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (column, renderer_text, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (column), renderer_text,
"text", 4, "ellipsize", 5, "cell-background-gdk", 6, NULL);
"text", 4, "ellipsize", 5,
"cell-background-gdk", 6, "foreground-gdk", 7, NULL);
gtk_tree_view_column_set_expand (column, TRUE);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
column = gtk_tree_view_column_new ();

View file

@ -48,6 +48,9 @@ static const gint tb_editor_dnd_targets_len = G_N_ELEMENTS(tb_editor_dnd_targets
static void tb_editor_browser_populate_tool_menu_cb(MidoriBrowser *browser, GtkWidget *menu, MidoriExtension *ext);
static void tb_editor_browser_populate_toolbar_menu_cb(MidoriBrowser *browser, GtkWidget *menu,
MidoriExtension *ext);
static void tb_editor_app_add_browser_cb(MidoriApp *app, MidoriBrowser *browser, MidoriExtension *ext);
@ -56,6 +59,7 @@ static void tb_editor_deactivate_cb(MidoriExtension *extension, MidoriBrowser *b
MidoriApp *app = midori_extension_get_app(extension);
g_signal_handlers_disconnect_by_func(browser, tb_editor_browser_populate_tool_menu_cb, extension);
g_signal_handlers_disconnect_by_func(browser, tb_editor_browser_populate_toolbar_menu_cb, extension);
g_signal_handlers_disconnect_by_func(extension, tb_editor_deactivate_cb, browser);
g_signal_handlers_disconnect_by_func(app, tb_editor_app_add_browser_cb, extension);
}
@ -579,9 +583,26 @@ static void tb_editor_browser_populate_tool_menu_cb(MidoriBrowser *browser, GtkW
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
}
static void tb_editor_browser_populate_toolbar_menu_cb(MidoriBrowser *browser, GtkWidget *menu,
MidoriExtension *ext)
{
GtkWidget* separator;
GtkWidget* menuitem;
separator = gtk_separator_menu_item_new ();
gtk_widget_show (separator);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), separator);
menuitem = gtk_menu_item_new_with_mnemonic (_("_Customize..."));
g_signal_connect (menuitem, "activate",
G_CALLBACK (tb_editor_menu_configure_toolbar_activate_cb), browser);
gtk_widget_show (menuitem);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
}
static void tb_editor_app_add_browser_cb(MidoriApp *app, MidoriBrowser *browser, MidoriExtension *ext)
{
g_signal_connect(browser, "populate-tool-menu", G_CALLBACK(tb_editor_browser_populate_tool_menu_cb), ext);
g_signal_connect(browser, "populate-toolbar-menu", G_CALLBACK(tb_editor_browser_populate_toolbar_menu_cb), ext);
g_signal_connect(ext, "deactivate", G_CALLBACK(tb_editor_deactivate_cb), browser);
}

View file

@ -21,6 +21,8 @@
#include <unistd.h>
#endif
#if !WEBKIT_CHECK_VERSION (1, 3, 11)
#define MAXLENGTH 1024 * 1024
static gchar*
@ -464,10 +466,14 @@ web_cache_clear_cache_cb (void)
{
sokoke_remove_path (web_cache_get_cache_dir (), TRUE);
}
#endif
MidoriExtension*
extension_init (void)
{
#if WEBKIT_CHECK_VERSION (1, 3, 11)
return NULL;
#else
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
"name", _("Web Cache"),
"description", _("Cache HTTP communication on disk"),
@ -482,4 +488,5 @@ extension_init (void)
G_CALLBACK (web_cache_clear_cache_cb));
return extension;
#endif
}

View file

@ -551,7 +551,6 @@ katze_array_action_item_notify_cb (KatzeItem* item,
GParamSpec* pspec,
GtkToolItem* toolitem)
{
KatzeArrayAction* array_action;
const gchar* property;
const gchar* title;
const gchar* desc;
@ -561,8 +560,6 @@ katze_array_action_item_notify_cb (KatzeItem* item,
if (!G_IS_PARAM_SPEC_STRING (pspec))
return;
array_action = (KatzeArrayAction*)g_object_get_data (
G_OBJECT (toolitem), "KatzeArrayAction");
property = g_param_spec_get_name (pspec);
if (!strcmp (property, "name"))
{

View file

@ -236,7 +236,6 @@ katze_http_cookies_jar_changed_cb (SoupCookieJar* jar,
KatzeHttpCookies* http_cookies)
{
GObject* settings;
guint accept_cookies;
if (old_cookie)
soup_cookie_set_max_age (old_cookie, 0);
@ -244,17 +243,7 @@ katze_http_cookies_jar_changed_cb (SoupCookieJar* jar,
if (new_cookie)
{
settings = g_object_get_data (G_OBJECT (jar), "midori-settings");
accept_cookies = katze_object_get_enum (settings, "accept-cookies");
if (accept_cookies == 2 /* MIDORI_ACCEPT_COOKIES_NONE */)
{
soup_cookie_set_max_age (new_cookie, 0);
}
else if (accept_cookies == 1 /* MIDORI_ACCEPT_COOKIES_SESSION */
&& new_cookie->expires)
{
soup_cookie_set_max_age (new_cookie, -1);
}
else if (new_cookie->expires)
if (new_cookie->expires)
{
gint age = katze_object_get_int (settings, "maximum-cookie-age");
if (age > 0)

View file

@ -249,13 +249,21 @@ katze_preferences_prepare (KatzePreferences* preferences)
* Adds a new category with the specified label to the dialog.
*
* Since: 0.2.1
*
* Since 0.3.4 a #GtkBox is returned that can be packed into.
**/
void
GtkWidget*
katze_preferences_add_category (KatzePreferences* preferences,
const gchar* label,
const gchar* icon)
{
KatzePreferencesPrivate* priv = preferences->priv;
KatzePreferencesPrivate* priv;
g_return_val_if_fail (KATZE_IS_PREFERENCES (preferences), NULL);
g_return_val_if_fail (label != NULL, NULL);
g_return_val_if_fail (icon != NULL, NULL);
priv = preferences->priv;
#if HAVE_HILDON
GtkWidget* widget;
@ -300,6 +308,8 @@ katze_preferences_add_category (KatzePreferences* preferences,
g_object_set_data (G_OBJECT (priv->toolbutton), "notebook", priv->notebook);
#endif
#endif
return priv->page;
}
#if !HAVE_HILDON
@ -325,21 +335,27 @@ katze_hig_frame_new (const gchar* title)
/**
* katze_preferences_add_group:
* @preferences: a #KatzePreferences instance
* @label: a group label
* @label: a group label, or %NULL
*
* Adds a new group with the specified label to the dialog.
*
* Since: 0.2.1
*
* Since 0.3.4 you can pass %NULL to hide the label.
**/
void
katze_preferences_add_group (KatzePreferences* preferences,
const gchar* label)
{
#if !HAVE_HILDON
KatzePreferencesPrivate* priv = preferences->priv;
KatzePreferencesPrivate* priv;
g_return_if_fail (KATZE_IS_PREFERENCES (preferences));
priv = preferences->priv;
priv->sizegroup2 = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
priv->frame = katze_hig_frame_new (label);
priv->frame = label ? katze_hig_frame_new (label) :
g_object_new (GTK_TYPE_FRAME, "shadow-type", GTK_SHADOW_NONE, NULL);
gtk_container_set_border_width (GTK_CONTAINER (priv->frame), 4);
gtk_box_pack_start (GTK_BOX (priv->page), priv->frame, FALSE, FALSE, 0);
priv->box = gtk_vbox_new (FALSE, 4);

View file

@ -51,7 +51,7 @@ katze_preferences_get_type (void) G_GNUC_CONST;
GtkWidget*
katze_preferences_new (GtkWindow* parent);
void
GtkWidget*
katze_preferences_add_category (KatzePreferences* preferences,
const gchar* label,
const gchar* icon);

View file

@ -311,13 +311,12 @@ do_timeout_scroll (KatzeScrolled* scrolled)
GtkScrolledWindow* gtk_scrolled = GTK_SCROLLED_WINDOW (scrolled);
GtkAdjustment* hadjustment;
GtkAdjustment* vadjustment;
gdouble hpage_size, hupper, hlower, hvalue, new_hvalue;
gdouble vpage_size, vupper, vlower, vvalue, new_vvalue;
gdouble hpage_size, hupper, hvalue, new_hvalue;
gdouble vpage_size, vupper, vvalue, new_vvalue;
hadjustment = gtk_scrolled_window_get_hadjustment (gtk_scrolled);
hpage_size = gtk_adjustment_get_page_size (hadjustment);
hupper = gtk_adjustment_get_upper (hadjustment);
hlower = gtk_adjustment_get_lower (hadjustment);
hvalue = gtk_adjustment_get_value (hadjustment);
new_hvalue = calculate_timeout_scroll_values (hvalue,
hupper - hpage_size,
@ -329,7 +328,6 @@ do_timeout_scroll (KatzeScrolled* scrolled)
vadjustment = gtk_scrolled_window_get_vadjustment (gtk_scrolled);
vpage_size = gtk_adjustment_get_page_size (vadjustment);
vupper = gtk_adjustment_get_upper (vadjustment);
vlower = gtk_adjustment_get_lower (vadjustment);
vvalue = gtk_adjustment_get_value (vadjustment);
new_vvalue = calculate_timeout_scroll_values (vvalue,
vupper - vpage_size,

View file

@ -34,6 +34,11 @@
#include <webkit/webkit.h>
#include <sqlite3.h>
#if WEBKIT_CHECK_VERSION (1, 3, 11)
#define LIBSOUP_USE_UNSTABLE_REQUEST_API
#include <libsoup/soup-cache.h>
#endif
#if ENABLE_NLS
#include <libintl.h>
#include <locale.h>
@ -694,6 +699,112 @@ midori_trash_remove_item_cb (KatzeArray* trash,
g_free (config_file);
}
static void
midori_browser_show_preferences_cb (MidoriBrowser* browser,
KatzePreferences* preferences,
MidoriApp* app)
{
GtkWidget* scrolled = katze_scrolled_new (NULL, NULL);
GtkWidget* addon = g_object_new (MIDORI_TYPE_EXTENSIONS, NULL);
GList* children = gtk_container_get_children (GTK_CONTAINER (addon));
GtkWidget* page;
gtk_widget_reparent (g_list_nth_data (children, 0), scrolled);
g_list_free (children);
g_object_set (addon, "app", app, NULL);
gtk_widget_show (scrolled);
page = katze_preferences_add_category (preferences,
_("Extensions"), STOCK_EXTENSIONS);
gtk_box_pack_start (GTK_BOX (page), scrolled, TRUE, TRUE, 4);
}
static void
midori_preferences_delete_cookies_changed_cb (GtkComboBox* combo,
MidoriWebSettings* settings)
{
gint active = gtk_combo_box_get_active (combo);
gint max_age;
switch (active)
{
case 0: max_age = 0; break;
case 1: max_age = 1; break;
case 2: max_age = 7; break;
case 3: max_age = 30; break;
case 4: max_age = 365; break;
default:
max_age = 30;
}
g_object_set (settings, "maximum-cookie-age", max_age, NULL);
}
static void
midori_browser_privacy_preferences_cb (MidoriBrowser* browser,
KatzePreferences* preferences,
MidoriApp* app)
{
MidoriWebSettings* settings = midori_browser_get_settings (browser);
GtkWidget* button;
GtkWidget* label;
gint max_age = katze_object_get_int (settings, "maximum-cookie-age");
guint active;
gchar* markup;
katze_preferences_add_category (preferences, _("Privacy"), GTK_STOCK_INDEX);
katze_preferences_add_group (preferences, NULL);
button = katze_property_label (settings, "maximum-cookie-age");
katze_preferences_add_widget (preferences, button, "indented");
button = gtk_combo_box_new_text ();
gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 hour"));
gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 day"));
gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 week"));
gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 month"));
gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 year"));
switch (max_age)
{
case 0: active = 0; break;
case 1: active = 1; break;
case 7: active = 2; break;
case 30: active = 3; break;
case 365: active = 4; break;
default:
active = 3;
}
gtk_combo_box_set_active (GTK_COMBO_BOX (button), active);
g_signal_connect (button, "changed",
G_CALLBACK (midori_preferences_delete_cookies_changed_cb), settings);
katze_preferences_add_widget (preferences, button, "spanned");
markup = g_strdup_printf ("<span size=\"smaller\">%s</span>",
_("Cookies store login data, saved games, "
"or user profiles for advertisement purposes."));
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), markup);
g_free (markup);
katze_preferences_add_widget (preferences, label, "filled");
#if WEBKIT_CHECK_VERSION (1, 1, 13)
button = katze_property_proxy (settings, "enable-offline-web-application-cache", NULL);
katze_preferences_add_widget (preferences, button, "indented");
#endif
#if WEBKIT_CHECK_VERSION (1, 1, 8)
button = katze_property_proxy (settings, "enable-html5-local-storage", NULL);
katze_preferences_add_widget (preferences, button, "spanned");
#if !WEBKIT_CHECK_VERSION (1, 1, 14)
button = katze_property_proxy (settings, "enable-html5-database", NULL);
katze_preferences_add_widget (preferences, button, "indented");
#endif
#endif
#if HAVE_LIBSOUP_2_27_90
button = katze_property_proxy (settings, "strip-referer", NULL);
katze_preferences_add_widget (preferences, button, "indented");
#endif
button = katze_property_label (settings, "maximum-history-age");
katze_preferences_add_widget (preferences, button, "indented");
button = katze_property_proxy (settings, "maximum-history-age", NULL);
katze_preferences_add_widget (preferences, button, "spanned");
label = gtk_label_new (_("days"));
katze_preferences_add_widget (preferences, label, "spanned");
}
static void
midori_app_add_browser_cb (MidoriApp* app,
MidoriBrowser* browser,
@ -722,10 +833,10 @@ midori_app_add_browser_cb (MidoriApp* app,
#endif
/* Extensions */
addon = g_object_new (MIDORI_TYPE_EXTENSIONS, NULL);
gtk_widget_show (addon);
g_object_set (addon, "app", app, NULL);
midori_panel_append_page (MIDORI_PANEL (panel), MIDORI_VIEWABLE (addon));
g_signal_connect (browser, "show-preferences",
G_CALLBACK (midori_browser_privacy_preferences_cb), app);
g_signal_connect (browser, "show-preferences",
G_CALLBACK (midori_browser_show_preferences_cb), app);
g_object_unref (panel);
}
@ -880,6 +991,29 @@ midori_soup_session_settings_accept_language_cb (SoupSession* session,
g_free (languages);
soup_message_headers_append (msg->request_headers, "Accept-Language", accpt);
g_free (accpt);
#if HAVE_LIBSOUP_2_27_90
if (katze_object_get_boolean (settings, "strip-referer"))
{
const gchar* referer
= soup_message_headers_get_one (msg->request_headers, "Referer");
SoupURI* destination = soup_message_get_uri (msg);
if (referer && destination && !strstr (referer, destination->host))
{
SoupURI* stripped_uri = soup_uri_new (referer);
gchar* stripped_referer;
soup_uri_set_path (stripped_uri, NULL);
soup_uri_set_query (stripped_uri, NULL);
stripped_referer = soup_uri_to_string (stripped_uri, FALSE);
soup_uri_free (stripped_uri);
if (g_getenv ("MIDORI_SOUP_DEBUG"))
g_message ("Referer stripped");
soup_message_headers_replace (msg->request_headers, "Referer",
stripped_referer);
g_free (stripped_referer);
}
}
#endif
}
static void
@ -896,13 +1030,10 @@ midori_soup_session_debug (SoupSession* session)
}
}
static void
midori_soup_session_prepare (SoupSession* session,
SoupCookieJar* cookie_jar,
MidoriWebSettings* settings)
static gboolean
midori_load_soup_session (gpointer settings)
{
SoupSessionFeature* feature;
gchar* config_file;
SoupSession* session = webkit_get_default_session ();
#if WEBKIT_CHECK_VERSION (1, 1, 14) && defined (HAVE_LIBSOUP_2_29_91)
const gchar* certificate_files[] =
@ -951,20 +1082,9 @@ midori_soup_session_prepare (SoupSession* session,
g_signal_connect (session, "request-queued",
G_CALLBACK (midori_soup_session_settings_accept_language_cb), settings);
config_file = build_config_filename ("logins");
feature = g_object_new (KATZE_TYPE_HTTP_AUTH, "filename", config_file, NULL);
g_free (config_file);
soup_session_add_feature (session, feature);
g_object_unref (feature);
midori_soup_session_debug (session);
feature = g_object_new (KATZE_TYPE_HTTP_COOKIES, NULL);
config_file = build_config_filename ("cookies.txt");
g_object_set_data_full (G_OBJECT (feature), "filename",
config_file, (GDestroyNotify)g_free);
soup_session_add_feature (session, SOUP_SESSION_FEATURE (cookie_jar));
soup_session_add_feature (session, feature);
g_object_unref (feature);
return FALSE;
}
static void
@ -1054,6 +1174,9 @@ midori_create_diagnostic_dialog (MidoriWebSettings* settings,
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 4);
gtk_widget_show_all (box);
gtk_container_add (GTK_CONTAINER (content_area), box);
button = katze_property_proxy (settings, "show-crash-dialog", NULL);
gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (content_area), button);
#ifdef HAVE_HILDON_2_2
box = gtk_hbox_new (FALSE, 4);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), box, TRUE, FALSE, 4);
@ -1091,14 +1214,44 @@ midori_create_diagnostic_dialog (MidoriWebSettings* settings,
}
static gboolean
midori_load_cookie_jar (gpointer data)
midori_load_soup_session_full (gpointer settings)
{
SoupSession* session = webkit_get_default_session ();
SoupCookieJar* jar = soup_cookie_jar_new ();
g_object_set_data (G_OBJECT (jar), "midori-settings", data);
midori_soup_session_prepare (session, jar, MIDORI_WEB_SETTINGS (data));
SoupCookieJar* jar;
gchar* config_file;
SoupSessionFeature* feature;
midori_load_soup_session (settings);
config_file = build_config_filename ("logins");
feature = g_object_new (KATZE_TYPE_HTTP_AUTH, "filename", config_file, NULL);
g_free (config_file);
soup_session_add_feature (session, feature);
g_object_unref (feature);
jar = soup_cookie_jar_new ();
g_object_set_data (G_OBJECT (jar), "midori-settings", settings);
soup_session_add_feature (session, SOUP_SESSION_FEATURE (jar));
g_object_unref (jar);
feature = g_object_new (KATZE_TYPE_HTTP_COOKIES, NULL);
config_file = build_config_filename ("cookies.txt");
g_object_set_data_full (G_OBJECT (feature), "filename",
config_file, (GDestroyNotify)g_free);
soup_session_add_feature (session, feature);
g_object_unref (feature);
#if WEBKIT_CHECK_VERSION (1, 3, 11)
config_file = g_build_filename (g_get_user_cache_dir (),
PACKAGE_NAME, "web", NULL);
feature = SOUP_SESSION_FEATURE (soup_cache_new (config_file, 0));
g_free (config_file);
soup_session_add_feature (session, feature);
soup_cache_set_max_size (SOUP_CACHE (feature),
katze_object_get_int (settings, "maximum-cache-size") * 1024 * 1024);
soup_cache_load (SOUP_CACHE (feature));
#endif
return FALSE;
}
@ -1178,6 +1331,10 @@ midori_load_extensions (gpointer data)
if (!extension)
{
/* No extension, no error: not available, not shown */
if (g_module_error () == NULL)
continue;
extension = g_object_new (MIDORI_TYPE_EXTENSION,
"name", filename,
"description", g_module_error (),
@ -1386,12 +1543,11 @@ snapshot_load_finished_cb (GtkWidget* web_view,
{
GError* error;
GtkPrintOperation* operation = gtk_print_operation_new ();
GtkPrintOperationAction action = GTK_PRINT_OPERATION_ACTION_EXPORT;
GtkPrintOperationResult result;
gtk_print_operation_set_export_filename (operation, filename);
error = NULL;
result = webkit_web_frame_print_full (web_frame, operation, action, &error);
webkit_web_frame_print_full (web_frame, operation,
GTK_PRINT_OPERATION_ACTION_EXPORT, &error);
if (error != NULL)
{
@ -1467,27 +1623,36 @@ signal_handler (int signal_id)
}
#endif
#if 0
static void
midori_speeddial_import_from_json (const gchar* json_file,
const gchar* speeddial_file)
static GKeyFile*
speeddial_new_from_file (const gchar* config,
GError** error)
{
GKeyFile* key_file = g_key_file_new ();
gchar* config_file = g_build_filename (config, "speeddial", NULL);
guint i = 0;
guint columns = 3;
guint slot_count = 0;
guint rows;
gchar* slot = NULL;
gchar* dial_id = NULL;
gchar* uri = NULL;
gchar* json_content;
gchar** parts;
GKeyFile* key_file = g_key_file_new ();
g_file_get_contents (json_file, &json_content, NULL, NULL);
if (g_key_file_load_from_file (key_file, config_file, G_KEY_FILE_NONE, error))
{
g_free (config_file);
return key_file;
}
katze_assign (config_file, g_build_filename (config, "speeddial.json", NULL));
g_file_get_contents (config_file, &json_content, NULL, NULL);
parts = g_strsplit (json_content ? json_content : "", ",", -1);
while (parts && parts[i] != NULL)
{
gchar* key;
gchar* val;
gchar* slot;
gchar* dial_id;
gchar* uri;
gchar** values = g_strsplit (parts[i], "\"", -1);
if (*values[1])
@ -1510,24 +1675,20 @@ midori_speeddial_import_from_json (const gchar* json_file,
if (g_str_equal (key, "id"))
{
/* FIXME: leaked string */
slot = g_strdup (val);
katze_assign (slot, g_strdup (val));
dial_id = g_strdup_printf ("Dial %s", slot + 1);
slot_count++;
}
else if (g_str_equal (key, "href") && (*val && strncmp (val, "#", 1)))
else if (g_str_equal (key, "href"))
{
uri = g_strdup (val);
g_key_file_set_value (key_file, dial_id, "name", slot);
katze_assign (uri, g_strdup (val));
g_key_file_set_value (key_file, dial_id, "uri", uri);
}
else if (g_str_equal (key, "img") && *val)
else if (g_str_equal (key, "img") && (*val && strncmp (val, "#", 1)))
{
gsize sz;
gint state = 0;
guint save = 0;
gchar* checksum;
gchar* filename;
gchar* thumb_dir;
gchar* thumb_path;
gsize base64_size = strlen (val);
@ -1535,15 +1696,11 @@ midori_speeddial_import_from_json (const gchar* json_file,
sz = g_base64_decode_step (g_strdup (val), base64_size,
decoded, &state, &save);
checksum = g_compute_checksum_for_string (G_CHECKSUM_MD5, slot, -1);
filename = g_strdup_printf ("%s%s", checksum, ".png");
g_free (checksum);
thumb_dir = g_build_path (G_DIR_SEPARATOR_S, g_get_user_cache_dir (),
PACKAGE_NAME, "thumbnails", NULL);
if (!g_file_test (thumb_dir, G_FILE_TEST_EXISTS))
katze_mkdir_with_parents (thumb_dir, 0700);
thumb_path = g_build_filename (thumb_dir, filename, NULL);
g_free (filename);
thumb_path = sokoke_build_thumbnail_path (uri);
g_file_set_contents (thumb_path, (gchar*)decoded, sz, NULL);
g_free (decoded);
@ -1554,23 +1711,23 @@ midori_speeddial_import_from_json (const gchar* json_file,
{
guint thumb_size;
gchar* thumb_size_type;
gchar* size_tmp = g_strndup (val + 1, strlen (val) - 3);
/* FIXME: leaked string */
thumb_size = atoi (g_strndup (val + 1, strlen (val) - 3));
thumb_size = atoi (size_tmp);
g_free (size_tmp);
if (thumb_size == 80)
thumb_size_type = g_strdup ("SMALL");
else if (thumb_size == 160)
thumb_size_type = g_strdup ("MEDIUM");
else if (thumb_size == 240)
thumb_size_type = g_strdup ("BIG");
else /* if (thumb_size == 160) */
thumb_size_type = g_strdup ("MEDIUM");
g_key_file_set_value (key_file, "settings", "size", thumb_size_type);
g_free (thumb_size_type);
}
else if (g_str_equal (key, "title") && *val)
{
g_key_file_set_value (key_file, dial_id, "name", slot);
g_key_file_set_value (key_file, dial_id, key, val + 3);
g_key_file_set_value (key_file, dial_id, key, val);
}
else if (g_str_equal (key, "width"))
{
@ -1585,16 +1742,21 @@ midori_speeddial_import_from_json (const gchar* json_file,
}
}
/* Default to 3 x 3 grid. Calculate rows here, columns is initialized as 3 */
rows = slot_count / columns > 3 ? slot_count / columns : 3;
g_key_file_set_integer (key_file, "settings", "columns", columns);
g_key_file_set_integer (key_file, "settings", "rows", slot_count / columns);
g_key_file_set_integer (key_file, "settings", "rows", rows);
sokoke_key_file_save_to_file (key_file, speeddial_file, NULL);
katze_assign (config_file, g_build_filename (config, "speeddial", NULL));
sokoke_key_file_save_to_file (key_file, config_file, NULL);
g_strfreev (parts);
g_free (dial_id);
g_free (slot);
g_free (config_file);
g_free (json_content);
g_key_file_free (key_file);
return key_file;
}
#endif
static void
midori_soup_session_block_uris_cb (SoupSession* session,
@ -1746,12 +1908,37 @@ midori_clear_html5_databases_cb (void)
}
#endif
#if WEBKIT_CHECK_VERSION (1, 3, 11)
static void
midori_clear_web_cache_cb (void)
{
SoupSession* session = webkit_get_default_session ();
SoupSessionFeature* feature = soup_session_get_feature (session, SOUP_TYPE_CACHE);
gchar* path = g_build_filename (g_get_user_cache_dir (), PACKAGE_NAME, "web", NULL);
soup_cache_clear (SOUP_CACHE (feature));
soup_cache_flush (SOUP_CACHE (feature));
sokoke_remove_path (path, TRUE);
g_free (path);
}
#endif
#if WEBKIT_CHECK_VERSION (1, 3, 13)
static void
midori_clear_offline_appcache_cb (void)
{
/* Changing the size implies clearing the cache */
unsigned long long maximum = webkit_application_cache_get_maximum_size ();
webkit_application_cache_set_maximum_size (maximum - 1);
}
#endif
int
main (int argc,
char** argv)
{
gchar* webapp;
gchar* config;
gboolean private;
gboolean diagnostic_dialog;
gboolean back_from_crash;
gboolean run;
@ -1773,6 +1960,8 @@ main (int argc,
{ "config", 'c', 0, G_OPTION_ARG_FILENAME, &config,
N_("Use FOLDER as configuration folder"), N_("FOLDER") },
#endif
{ "private", 'p', 0, G_OPTION_ARG_NONE, &private,
N_("Private browsing, no changes are saved"), NULL },
{ "diagnostic-dialog", 'd', 0, G_OPTION_ARG_NONE, &diagnostic_dialog,
N_("Show a diagnostic dialog"), NULL },
{ "run", 'r', 0, G_OPTION_ARG_NONE, &run,
@ -1803,9 +1992,7 @@ main (int argc,
MidoriWebSettings* settings;
gchar* config_file;
gchar* bookmarks_file;
#if 0
gchar* speeddial_file;
#endif
GKeyFile* speeddial;
gboolean bookmarks_exist;
MidoriStartup load_on_startup;
KatzeArray* search_engines;
@ -1868,6 +2055,7 @@ main (int argc,
/* Parse cli options */
webapp = NULL;
config = NULL;
private = FALSE;
back_from_crash = FALSE;
diagnostic_dialog = FALSE;
run = FALSE;
@ -1890,8 +2078,22 @@ main (int argc,
/* libSoup uses threads, so we need to initialize threads. */
if (!g_thread_supported ()) g_thread_init (NULL);
sokoke_register_stock_items ();
if (webapp && config)
if (config && !g_path_is_absolute (config))
{
g_critical (_("The specified configuration folder is invalid."));
return 1;
}
/* Private browsing, window title, default config folder */
if (private)
{
g_set_application_name (_("Midori (Private Browsing)"));
if (!config && !webapp)
config = g_build_filename (g_get_user_config_dir (), PACKAGE_NAME, NULL);
/* Mask the timezone, which can be read by Javascript */
g_setenv ("TZ", "UTC", TRUE);
}
else
g_set_application_name (_("Midori"));
@ -1988,15 +2190,22 @@ main (int argc,
sokoke_register_privacy_item ("html5-databases", _("HTML5 _Databases"),
G_CALLBACK (midori_clear_html5_databases_cb));
#endif
#if WEBKIT_CHECK_VERSION (1, 3, 11)
sokoke_register_privacy_item ("web-cache", _("Web Cache"),
G_CALLBACK (midori_clear_web_cache_cb));
#endif
#if WEBKIT_CHECK_VERSION (1, 3, 13)
sokoke_register_privacy_item ("offline-appcache", _("Offline Application Cache"),
G_CALLBACK (midori_clear_offline_appcache_cb));
#endif
/* Web Application support */
if (webapp)
/* Web Application or Private Browsing support */
if (webapp || private)
{
SoupSession* session = webkit_get_default_session ();
MidoriBrowser* browser = midori_browser_new ();
gchar* tmp_uri = midori_prepare_uri (webapp);
katze_assign (webapp, tmp_uri);
midori_startup_timer ("Browser: \t%f");
if (config)
{
settings = settings_and_accels_new (config, &extensions);
@ -2004,35 +2213,64 @@ main (int argc,
search_engines = search_engines_new_from_folder (config, NULL);
g_object_set (browser, "search-engines", search_engines, NULL);
g_object_unref (search_engines);
speeddial = speeddial_new_from_file (config, &error);
g_object_set (browser, "speed-dial", speeddial, NULL);
}
else
{
settings = g_object_ref (midori_browser_get_settings (browser));
if (webapp)
{
gchar* tmp_uri = midori_prepare_uri (webapp);
g_object_set (settings,
"show-menubar", FALSE,
"show-navigationbar", FALSE,
"toolbar-items", "Back,Forward,ReloadStop,Location,Homepage",
"homepage", webapp,
"homepage", tmp_uri,
"show-statusbar", FALSE,
"enable-developer-extras", FALSE,
NULL);
midori_browser_set_action_visible (browser, "Menubar", FALSE);
midori_browser_add_uri (browser, tmp_uri);
g_free (tmp_uri);
/* Update window icon according to page */
g_signal_connect (browser, "notify::load-status",
G_CALLBACK (midori_web_app_browser_notify_load_status_cb), NULL);
}
g_object_set (settings, "show-panel", FALSE,
"last-window-state", MIDORI_WINDOW_NORMAL,
if (private)
{
g_object_set (settings,
"preferred-languages", "en",
#if WEBKIT_CHECK_VERSION (1, 1, 2)
"enable-private-browsing", TRUE,
#endif
NULL);
#if WEBKIT_CHECK_VERSION (1, 1, 8)
"enable-html5-database", FALSE,
"enable-html5-local-storage", FALSE,
"enable-offline-web-application-cache", FALSE,
#endif
/* Arguably DNS prefetching is or isn't a privacy concern. For the
* lack of more fine-grained control we'll go the safe route. */
"enable-dns-prefetching", FALSE,
"strip-referer", TRUE, NULL);
midori_browser_set_action_visible (browser, "Tools", FALSE);
midori_browser_set_action_visible (browser, "ClearPrivateData", FALSE);
}
if (private || !config)
{
/* Disable saving by setting an unwritable folder */
sokoke_set_config_dir ("/");
}
g_object_set (settings, "show-panel", FALSE,
"last-window-state", MIDORI_WINDOW_NORMAL,
NULL);
midori_browser_set_action_visible (browser, "Panel", FALSE);
g_object_set (browser, "settings", settings, NULL);
midori_startup_timer ("Setup config: \t%f");
g_object_unref (settings);
sokoke_set_config_dir ("/");
g_signal_connect (browser, "notify::load-status",
G_CALLBACK (midori_web_app_browser_notify_load_status_cb), NULL);
midori_browser_add_uri (browser, webapp);
g_signal_connect (browser, "quit",
G_CALLBACK (gtk_main_quit), NULL);
g_signal_connect (browser, "destroy",
@ -2044,11 +2282,25 @@ main (int argc,
for (i = 0; uris[i] != NULL; i++)
midori_browser_activate_action (browser, uris[i]);
}
else if (uris != NULL)
{
for (i = 0; uris[i] != NULL; i++)
{
gchar* new_uri = midori_prepare_uri (uris[i]);
midori_browser_add_uri (browser, new_uri);
g_free (new_uri);
}
}
if (midori_browser_get_current_uri (browser) == NULL)
midori_browser_add_uri (browser, "about:blank");
if (block_uris)
g_signal_connect (session, "request-queued",
G_CALLBACK (midori_soup_session_block_uris_cb),
g_strdup (block_uris));
midori_setup_inactivity_reset (browser, inactivity_reset, webapp);
midori_load_soup_session (settings);
midori_startup_timer ("App created: \t%f");
gtk_main ();
return 0;
@ -2062,11 +2314,6 @@ main (int argc,
if (run)
return midori_run_script (uris ? *uris : NULL);
if (config && !g_path_is_absolute (config))
{
g_critical (_("The specified configuration folder is invalid."));
return 1;
}
sokoke_set_config_dir (config);
if (config)
{
@ -2093,7 +2340,6 @@ main (int argc,
result = midori_app_send_command (app, uris);
else if (uris)
{
/* TODO: Open a tab per URI, seperated by pipes */
/* Encode any IDN addresses because libUnique doesn't like them */
i = 0;
while (uris[i] != NULL)
@ -2217,16 +2463,7 @@ main (int argc,
g_free (bookmarks_file);
midori_startup_timer ("History read: \t%f");
#if 0
speeddial_file = g_build_filename (config, "speeddial", NULL);
if (g_access (speeddial_file, F_OK) != 0)
{
gchar* json_file = g_build_filename (config, "speeddial.json", NULL);
midori_speeddial_import_from_json (json_file, speeddial_file);
g_free (json_file);
}
g_free (speeddial_file);
#endif
speeddial = speeddial_new_from_file (config, &error);
/* In case of errors */
if (error_messages->len)
@ -2335,8 +2572,10 @@ main (int argc,
if (diagnostic_dialog)
{
GtkWidget* dialog = midori_create_diagnostic_dialog (settings, _session);
gtk_dialog_run (GTK_DIALOG (dialog));
gint response = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
if (response == GTK_RESPONSE_DELETE_EVENT)
return 0;
}
midori_startup_timer ("Signal setup: \t%f");
@ -2345,6 +2584,7 @@ main (int argc,
"trash", trash,
"search-engines", search_engines,
"history", history,
"speed-dial", speeddial,
NULL);
g_object_unref (history);
g_object_unref (search_engines);
@ -2355,7 +2595,7 @@ main (int argc,
G_CALLBACK (midori_app_add_browser_cb), NULL);
midori_startup_timer ("App prepared: \t%f");
g_idle_add (midori_load_cookie_jar, settings);
g_idle_add (midori_load_soup_session_full, settings);
g_idle_add (midori_load_extensions, app);
g_idle_add (midori_load_session, _session);
@ -2405,6 +2645,7 @@ main (int argc,
}
g_object_unref (settings);
g_key_file_free (speeddial);
g_object_unref (app);
g_free (config_file);
return 0;

View file

@ -4,7 +4,7 @@ BOOLEAN:OBJECT,UINT
BOOLEAN:VOID
OBJECT:OBJECT
VOID:BOOLEAN,STRING
VOID:OBJECT,ENUM
VOID:OBJECT,ENUM,BOOLEAN
VOID:OBJECT,INT,INT
VOID:POINTER,INT
VOID:STRING,BOOLEAN

View file

@ -60,6 +60,7 @@ struct _MidoriApp
KatzeArray* trash;
KatzeArray* search_engines;
KatzeArray* history;
GKeyFile* speeddial;
KatzeArray* extensions;
KatzeArray* browsers;
@ -97,6 +98,7 @@ enum
PROP_TRASH,
PROP_SEARCH_ENGINES,
PROP_HISTORY,
PROP_SPEED_DIAL,
PROP_EXTENSIONS,
PROP_BROWSERS,
PROP_BROWSER
@ -149,6 +151,7 @@ midori_browser_new_window_cb (MidoriBrowser* browser,
"trash", app->trash,
"search-engines", app->search_engines,
"history", app->history,
"speed-dial", app->speeddial,
NULL);
else
new_browser = midori_app_create_browser (app);
@ -365,6 +368,23 @@ midori_app_class_init (MidoriAppClass* class)
KATZE_TYPE_ARRAY,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* MidoriApp:speed-dial:
*
* The speed dial configuration file.
*
* Since: 0.3.4
*/
g_object_class_install_property (gobject_class,
PROP_SPEED_DIAL,
g_param_spec_pointer (
"speed-dial",
"Speeddial",
"Pointer to key-value object with speed dial items",
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* MidoriApp:browsers:
*
@ -453,7 +473,7 @@ midori_app_command_received (MidoriApp* app,
MidoriNewPage open_external_pages_in;
gboolean first;
g_object_get (app->settings, "open-external-pages-in",
g_object_get (app->settings, "open-new-pages-in",
&open_external_pages_in, NULL);
if (open_external_pages_in == MIDORI_NEW_PAGE_WINDOW)
{
@ -717,6 +737,7 @@ midori_app_init (MidoriApp* app)
app->trash = NULL;
app->search_engines = NULL;
app->history = NULL;
app->speeddial = NULL;
app->extensions = NULL;
app->browsers = katze_array_new (MIDORI_TYPE_BROWSER);
@ -743,6 +764,7 @@ midori_app_finalize (GObject* object)
katze_object_assign (app->trash, NULL);
katze_object_assign (app->search_engines, NULL);
katze_object_assign (app->history, NULL);
app->speeddial = NULL;
katze_object_assign (app->extensions, NULL);
katze_object_assign (app->browsers, NULL);
@ -793,6 +815,9 @@ midori_app_set_property (GObject* object,
case PROP_HISTORY:
katze_object_assign (app->history, g_value_dup_object (value));
break;
case PROP_SPEED_DIAL:
app->speeddial = g_value_get_pointer (value);
break;
case PROP_EXTENSIONS:
katze_object_assign (app->extensions, g_value_dup_object (value));
break;
@ -830,6 +855,9 @@ midori_app_get_property (GObject* object,
case PROP_HISTORY:
g_value_set_object (value, app->history);
break;
case PROP_SPEED_DIAL:
g_value_set_pointer (value, app->speeddial);
break;
case PROP_EXTENSIONS:
g_value_set_object (value, app->extensions);
break;
@ -1122,6 +1150,7 @@ midori_app_create_browser (MidoriApp* app)
"trash", app->trash,
"search-engines", app->search_engines,
"history", app->history,
"speed-dial", app->speeddial,
NULL);
}

View file

@ -703,12 +703,10 @@ static void
string_append_item (GString* string,
KatzeItem* item)
{
gchar* markup;
gchar* metadata;
g_return_if_fail (KATZE_IS_ITEM (item));
markup = NULL;
metadata = katze_item_metadata_to_xbel (item);
if (KATZE_IS_ARRAY (item))
{

File diff suppressed because it is too large Load diff

View file

@ -106,6 +106,14 @@ void
midori_browser_activate_action (MidoriBrowser* browser,
const gchar* name);
void
midori_browser_block_action (MidoriBrowser* browser,
GtkAction* action);
void
midori_browser_unblock_action (MidoriBrowser* browser,
GtkAction* action);
void
midori_browser_set_action_visible (MidoriBrowser* browser,
const gchar* name,

View file

@ -16,6 +16,7 @@
#include "marshal.h"
#include "sokoke.h"
#include "midori-browser.h"
#include "midori-searchaction.h"
#include <string.h>
#include <glib/gi18n.h>
@ -134,6 +135,14 @@ midori_location_action_class_init (MidoriLocationActionClass* class)
GObjectClass* gobject_class;
GtkActionClass* action_class;
/**
* MidoriLocationAction:active-changed:
* @row: the active row
*
* The active-changed signal is emitted when the active row changes.
*
* Deprecated: 0.3.4
*/
signals[ACTIVE_CHANGED] = g_signal_new ("active-changed",
G_TYPE_FROM_CLASS (class),
(GSignalFlags) (G_SIGNAL_RUN_LAST),
@ -254,12 +263,6 @@ midori_location_action_class_init (MidoriLocationActionClass* class)
"The list of history items",
KATZE_TYPE_ARRAY,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/* We want location entries to have appears-as-list applied */
gtk_rc_parse_string ("style \"midori-location-entry-style\" {\n"
" GtkComboBox::appears-as-list = 1\n }\n"
"widget \"*MidoriLocationEntry\" "
"style \"midori-location-entry-style\"\n");
}
static GtkTreeModel*
@ -465,7 +468,7 @@ midori_location_action_popup_timeout_cb (gpointer data)
const unsigned char* title = sqlite3_column_text (stmt, 2);
GdkPixbuf* icon = katze_load_cached_icon ((gchar*)uri, NULL);
if (!icon)
icon = action->default_icon;
icon = g_object_ref (action->default_icon);
if (type == 1 /* history_view */)
{
gtk_list_store_insert_with_values (store, NULL, matches,
@ -480,6 +483,8 @@ midori_location_action_popup_timeout_cb (gpointer data)
STYLE_COL, 1, FAVICON_COL, icon, -1);
g_free (search_title);
}
if (icon != NULL)
g_object_unref (icon);
matches++;
result = sqlite3_step (stmt);
@ -495,15 +500,19 @@ midori_location_action_popup_timeout_cb (gpointer data)
{
gchar* uri;
gchar* title;
GdkPixbuf* icon;
uri = sokoke_search_uri (katze_item_get_uri (item), action->key);
title = g_strdup_printf (_("Search with %s"), katze_item_get_name (item));
icon = midori_search_action_get_icon (item, action->treeview, NULL, FALSE);
gtk_list_store_insert_with_values (store, NULL, matches + i,
URI_COL, uri, TITLE_COL, title, YALIGN_COL, 0.25,
BACKGROUND_COL, style ? &style->bg[GTK_STATE_NORMAL] : NULL,
STYLE_COL, 1, FAVICON_COL, NULL, -1);
STYLE_COL, 1, FAVICON_COL, icon, -1);
g_free (uri);
g_free (title);
if (icon != NULL)
g_object_unref (icon);
i++;
}
searches += i;
@ -614,47 +623,6 @@ midori_location_action_finalize (GObject* object)
G_OBJECT_CLASS (midori_location_action_parent_class)->finalize (object);
}
static void
midori_location_action_toggle_arrow_cb (GtkWidget* widget,
MidoriLocationAction* location_action)
{
gboolean show = FALSE;
gint result;
if (!GTK_IS_BUTTON (widget))
return;
if (location_action->history != NULL)
{
sqlite3* db = g_object_get_data (G_OBJECT (location_action->history), "db");
const char* sqlcmd = "SELECT uri FROM history LIMIT 1";
sqlite3_stmt* statement;
sqlite3_prepare_v2 (db, sqlcmd, -1, &statement, NULL);
result = sqlite3_step (statement);
if (result == SQLITE_ROW)
show = TRUE;
sqlite3_finalize (statement);
}
sokoke_widget_set_visible (widget, show);
gtk_widget_set_size_request (widget, show ? -1 : 1, show ? -1 : 1);
}
static void
midori_location_action_toggle_arrow (MidoriLocationAction* location_action)
{
GSList* proxies;
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_container_forall (GTK_CONTAINER (entry),
(GtkCallback)midori_location_action_toggle_arrow_cb, location_action);
}
}
static void
midori_location_action_set_property (GObject* object,
guint prop_id,
@ -676,8 +644,6 @@ midori_location_action_set_property (GObject* object,
case PROP_HISTORY:
{
katze_assign (location_action->history, g_value_dup_object (value));
midori_location_action_toggle_arrow (location_action);
break;
}
default:
@ -738,7 +704,6 @@ midori_location_action_create_tool_item (GtkAction* action)
{
GtkWidget* toolitem;
GtkWidget* alignment;
GtkWidget* location_entry;
GtkWidget* entry;
#if HAVE_HILDON
HildonGtkInputMode mode;
@ -750,10 +715,6 @@ midori_location_action_create_tool_item (GtkAction* action)
alignment = gtk_alignment_new (0.0f, 0.5f, 1.0f, 0.1f);
gtk_widget_show (alignment);
gtk_container_add (GTK_CONTAINER (toolitem), alignment);
location_entry = gtk_combo_box_entry_new ();
gtk_widget_set_name (location_entry, "MidoriLocationEntry");
gtk_widget_show (location_entry);
gtk_container_add (GTK_CONTAINER (alignment), location_entry);
#if HAVE_HILDON
entry = gtk_entry_new ();
@ -768,7 +729,7 @@ midori_location_action_create_tool_item (GtkAction* action)
GTK_ICON_ENTRY_SECONDARY, TRUE);
#endif
gtk_widget_show (entry);
gtk_container_add (GTK_CONTAINER (location_entry), entry);
gtk_container_add (GTK_CONTAINER (alignment), entry);
return toolitem;
}
@ -940,9 +901,9 @@ midori_location_action_key_press_event_cb (GtkEntry* entry,
case GDK_KP_Down:
case GDK_Up:
case GDK_KP_Up:
case GDK_Tab:
case GDK_ISO_Left_Tab:
{
GtkWidget* parent;
if (location_action->popup && gtk_widget_get_visible (location_action->popup))
{
GtkTreeModel* model = location_action->completion_model;
@ -951,7 +912,8 @@ midori_location_action_key_press_event_cb (GtkEntry* entry,
GtkTreeIter iter;
gint selected = location_action->completion_index;
if (event->keyval == GDK_Down || event->keyval == GDK_KP_Down)
if (event->keyval == GDK_Down || event->keyval == GDK_KP_Down
|| event->keyval == GDK_Tab || event->keyval == GDK_ISO_Left_Tab)
selected = MIN (selected + 1, matches -1);
else if (event->keyval == GDK_Up || event->keyval == GDK_KP_Up)
{
@ -964,6 +926,8 @@ midori_location_action_key_press_event_cb (GtkEntry* entry,
selected = MIN (selected + 14, matches -1);
else if (event->keyval == GDK_Page_Up)
selected = MAX (selected - 14, 0);
else
g_assert_not_reached ();
path = gtk_tree_path_new_from_indices (selected, -1);
gtk_tree_view_set_cursor (GTK_TREE_VIEW (location_action->treeview),
@ -982,10 +946,9 @@ midori_location_action_key_press_event_cb (GtkEntry* entry,
return TRUE;
}
parent = gtk_widget_get_parent (widget);
if (location_action->history != NULL
&& !katze_object_get_boolean (parent, "popup-shown"))
gtk_combo_box_popup (GTK_COMBO_BOX (parent));
/* Allow Tab to handle focus if the popup is closed */
if (event->keyval == GDK_Tab || event->keyval == GDK_ISO_Left_Tab)
return FALSE;
return TRUE;
}
default:
@ -1115,8 +1078,19 @@ midori_location_entry_render_text_cb (GtkCellLayout* layout,
if (G_LIKELY (uri))
{
temp_iter = temp = g_utf8_strdown (uri, -1);
desc_iter = uri;
/* Strip URI scheme and www. for display to reduce visual noise */
gchar* stripped_uri = uri;
if (g_str_has_prefix (uri, "http://"))
stripped_uri = &uri[7];
else if (g_str_has_prefix (uri, "https://"))
stripped_uri = &uri[8];
else if (g_str_has_prefix (uri, "file://"))
stripped_uri = &uri[7];
if (g_str_has_prefix (stripped_uri, "www."))
stripped_uri = &stripped_uri[4];
temp_iter = temp = g_utf8_strdown (stripped_uri, -1);
desc_iter = stripped_uri;
key_idx = 0;
key = keys[key_idx];
offset = 0;
@ -1166,7 +1140,7 @@ midori_location_entry_render_text_cb (GtkCellLayout* layout,
katze_assign (desc_uri, temp_concat);
}
else
desc_uri = g_markup_escape_text (uri, -1);
desc_uri = g_markup_escape_text (stripped_uri, -1);
g_free (temp);
}
@ -1246,96 +1220,6 @@ midori_location_entry_render_text_cb (GtkCellLayout* layout,
g_free (desc);
}
static void
midori_location_action_entry_changed_cb (GtkComboBox* combo_box,
MidoriLocationAction* location_action)
{
GtkTreeIter iter;
if (gtk_combo_box_get_active_iter (combo_box, &iter))
{
GtkIconEntry* entry;
if ((entry = GTK_ICON_ENTRY (gtk_bin_get_child (GTK_BIN (combo_box)))))
{
GtkTreeModel* model;
gchar* uri;
#if !HAVE_HILDON
GdkPixbuf* pixbuf;
#endif
model = gtk_combo_box_get_model (combo_box);
gtk_tree_model_get (model, &iter, URI_COL, &uri, -1);
#if !HAVE_HILDON
gtk_tree_model_get (model, &iter, FAVICON_COL, &pixbuf, -1);
gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_PRIMARY, pixbuf);
g_object_unref (pixbuf);
#endif
katze_assign (location_action->text, uri);
katze_assign (location_action->uri, g_strdup (uri));
g_signal_emit (location_action, signals[ACTIVE_CHANGED], 0,
gtk_combo_box_get_active (combo_box));
}
}
}
static void
midori_location_action_entry_popup_cb (GtkComboBox* combo_box,
MidoriLocationAction* location_action)
{
GtkListStore* store;
gint result;
const gchar* sqlcmd;
static sqlite3_stmt* stmt = NULL;
gint matches;
store = GTK_LIST_STORE (gtk_combo_box_get_model (combo_box));
gtk_list_store_clear (store);
if (!stmt)
{
sqlite3* db;
g_return_if_fail (location_action->history != NULL);
db = g_object_get_data (G_OBJECT (location_action->history), "db");
g_return_if_fail (db != NULL);
sqlcmd = "SELECT uri, title FROM history"
" GROUP BY uri ORDER BY count() DESC LIMIT ?";
sqlite3_prepare_v2 (db, sqlcmd, -1, &stmt, NULL);
}
sqlite3_bind_int64 (stmt, 1, MAX_ITEMS);
result = sqlite3_step (stmt);
if (result != SQLITE_ROW)
{
g_print (_("Failed to execute database statement\n"));
sqlite3_reset (stmt);
sqlite3_clear_bindings (stmt);
return;
}
matches = 0;
do
{
const unsigned char* uri = sqlite3_column_text (stmt, 0);
const unsigned char* title = sqlite3_column_text (stmt, 1);
GdkPixbuf* icon = katze_load_cached_icon ((gchar*)uri, NULL);
if (!icon)
icon = location_action->default_icon;
gtk_list_store_insert_with_values (store, NULL, matches,
URI_COL, uri, TITLE_COL, title, YALIGN_COL, 0.25,
FAVICON_COL, icon, -1);
matches++;
result = sqlite3_step (stmt);
}
while (result == SQLITE_ROW);
sqlite3_reset (stmt);
sqlite3_clear_bindings (stmt);
}
static void
midori_location_action_paste_proceed_cb (GtkWidget* menuitem,
GtkWidget* location_action)
@ -1379,7 +1263,6 @@ midori_location_action_connect_proxy (GtkAction* action,
GtkWidget* proxy)
{
MidoriLocationAction* location_action;
GtkCellRenderer* renderer;
GTK_ACTION_CLASS (midori_location_action_parent_class)->connect_proxy (
action, proxy);
@ -1392,40 +1275,10 @@ midori_location_action_connect_proxy (GtkAction* action,
if (GTK_IS_TOOL_ITEM (proxy))
{
GtkWidget* entry = midori_location_action_entry_for_proxy (proxy);
GtkWidget* child = gtk_bin_get_child (GTK_BIN (entry));
GtkTreeModel* model = midori_location_action_create_model ();
gtk_icon_entry_set_progress_fraction (GTK_ICON_ENTRY (child),
gtk_icon_entry_set_progress_fraction (GTK_ICON_ENTRY (entry),
MIDORI_LOCATION_ACTION (action)->progress);
gtk_combo_box_set_model (GTK_COMBO_BOX (entry), model);
#if GTK_CHECK_VERSION (2, 14, 0)
gtk_combo_box_set_button_sensitivity (GTK_COMBO_BOX (entry),
GTK_SENSITIVITY_ON);
#endif
gtk_combo_box_entry_set_text_column (
GTK_COMBO_BOX_ENTRY (entry), URI_COL);
gtk_cell_layout_clear (GTK_CELL_LAYOUT (entry));
/* Setup the renderer for the favicon */
renderer = gtk_cell_renderer_pixbuf_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (entry), renderer, FALSE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (entry), renderer,
"pixbuf", FAVICON_COL, "yalign", YALIGN_COL, NULL);
renderer = gtk_cell_renderer_text_new ();
g_object_set_data (G_OBJECT (renderer), "location-action", action);
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (entry), renderer, TRUE);
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (entry),
renderer, midori_location_entry_render_text_cb, action, NULL);
gtk_combo_box_set_active (GTK_COMBO_BOX (entry), -1);
gtk_container_forall (GTK_CONTAINER (entry),
(GtkCallback)midori_location_action_toggle_arrow_cb, action);
g_signal_connect (entry, "changed",
G_CALLBACK (midori_location_action_entry_changed_cb), action);
g_signal_connect (entry, "popup",
G_CALLBACK (midori_location_action_entry_popup_cb), action);
g_object_connect (child,
g_object_connect (entry,
"signal::changed",
midori_location_action_changed_cb, action,
"signal::move-cursor",
@ -1515,8 +1368,6 @@ midori_location_action_set_text (MidoriLocationAction* location_action,
const gchar* text)
{
GSList* proxies;
GtkWidget* location_entry;
GtkWidget* entry;
GdkPixbuf* icon;
g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action));
@ -1536,9 +1387,7 @@ midori_location_action_set_text (MidoriLocationAction* location_action,
for (; proxies != NULL; proxies = g_slist_next (proxies))
if (GTK_IS_TOOL_ITEM (proxies->data))
{
location_entry = midori_location_action_entry_for_proxy (proxies->data);
entry = gtk_bin_get_child (GTK_BIN (location_entry));
GtkWidget* entry = midori_location_action_entry_for_proxy (proxies->data);
gtk_entry_set_text (GTK_ENTRY (entry), text);
#if !HAVE_HILDON
gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (entry),
@ -1565,8 +1414,6 @@ midori_location_action_set_icon (MidoriLocationAction* location_action,
{
#if !HAVE_HILDON
GSList* proxies;
GtkWidget* location_entry;
GtkWidget* entry;
g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action));
g_return_if_fail (!icon || GDK_IS_PIXBUF (icon));
@ -1576,9 +1423,7 @@ midori_location_action_set_icon (MidoriLocationAction* location_action,
for (; proxies != NULL; proxies = g_slist_next (proxies))
if (GTK_IS_TOOL_ITEM (proxies->data))
{
location_entry = midori_location_action_entry_for_proxy (proxies->data);
entry = gtk_bin_get_child (GTK_BIN (location_entry));
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);
@ -1597,8 +1442,6 @@ midori_location_action_add_uri (MidoriLocationAction* location_action,
g_return_if_fail (uri != NULL);
katze_assign (location_action->uri, g_strdup (uri));
midori_location_action_toggle_arrow (location_action);
}
void
@ -1609,8 +1452,6 @@ midori_location_action_add_item (MidoriLocationAction* location_action,
{
#if !HAVE_HILDON
GSList* proxies;
GtkWidget* location_entry;
GtkWidget* entry;
#endif
g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action));
@ -1624,9 +1465,7 @@ midori_location_action_add_item (MidoriLocationAction* location_action,
for (; proxies != NULL; proxies = g_slist_next (proxies))
if (GTK_IS_TOOL_ITEM (proxies->data))
{
location_entry = midori_location_action_entry_for_proxy (proxies->data);
entry = gtk_bin_get_child (GTK_BIN (location_entry));
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);
}
@ -1640,8 +1479,6 @@ midori_location_action_set_icon_for_uri (MidoriLocationAction* location_action,
{
#if !HAVE_HILDON
GSList* proxies;
GtkWidget* location_entry;
GtkWidget* entry;
#endif
g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action));
@ -1654,9 +1491,7 @@ midori_location_action_set_icon_for_uri (MidoriLocationAction* location_action,
for (; proxies != NULL; proxies = g_slist_next (proxies))
if (GTK_IS_TOOL_ITEM (proxies->data))
{
location_entry = midori_location_action_entry_for_proxy (proxies->data);
entry = gtk_bin_get_child (GTK_BIN (location_entry));
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);
}
@ -1706,8 +1541,6 @@ midori_location_action_set_progress (MidoriLocationAction* location_action,
gdouble progress)
{
GSList* proxies;
GtkWidget* entry;
GtkWidget* child;
g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action));
@ -1718,10 +1551,8 @@ midori_location_action_set_progress (MidoriLocationAction* location_action,
for (; proxies != NULL; proxies = g_slist_next (proxies))
if (GTK_IS_TOOL_ITEM (proxies->data))
{
entry = midori_location_action_entry_for_proxy (proxies->data);
child = gtk_bin_get_child (GTK_BIN (entry));
gtk_icon_entry_set_progress_fraction (GTK_ICON_ENTRY (child),
GtkWidget* entry = midori_location_action_entry_for_proxy (proxies->data);
gtk_icon_entry_set_progress_fraction (GTK_ICON_ENTRY (entry),
location_action->progress);
}
}
@ -1732,8 +1563,6 @@ midori_location_action_set_secondary_icon (MidoriLocationAction* location_action
{
#if !HAVE_HILDON
GSList* proxies;
GtkWidget* entry;
GtkWidget* child;
#endif
GtkStockItem stock_item;
@ -1748,10 +1577,8 @@ midori_location_action_set_secondary_icon (MidoriLocationAction* location_action
for (; proxies != NULL; proxies = g_slist_next (proxies))
if (GTK_IS_TOOL_ITEM (proxies->data))
{
entry = midori_location_action_entry_for_proxy (proxies->data);
child = gtk_bin_get_child (GTK_BIN (entry));
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (child),
GtkWidget* entry = midori_location_action_entry_for_proxy (proxies->data);
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_SECONDARY, stock_id);
}
#endif
@ -1776,8 +1603,6 @@ void
midori_location_action_clear (MidoriLocationAction* location_action)
{
g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action));
midori_location_action_toggle_arrow (location_action);
}
/**
@ -1806,8 +1631,7 @@ midori_location_action_set_security_hint (MidoriLocationAction* location_action,
GdkColor bg_color = { 0, 1 };
GdkColor fg_color = { 0, 1 };
GtkWidget* entry = midori_location_action_entry_for_proxy (proxies->data);
GtkWidget* child = gtk_bin_get_child (GTK_BIN (entry));
GdkScreen* screen = gtk_widget_get_screen (child);
GdkScreen* screen = gtk_widget_get_screen (entry);
GtkIconTheme* icon_theme = gtk_icon_theme_get_for_screen (screen);
if (hint == MIDORI_SECURITY_UNKNOWN)
@ -1816,12 +1640,12 @@ midori_location_action_set_security_hint (MidoriLocationAction* location_action,
gdk_color_parse ("#000", &fg_color);
#if !HAVE_HILDON
if (gtk_icon_theme_has_icon (icon_theme, "lock-insecure"))
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (child),
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_SECONDARY, "lock-insecure");
else
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (child),
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_SECONDARY, GTK_STOCK_INFO);
gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (child),
gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_SECONDARY, _("Not verified"));
#endif
}
@ -1831,19 +1655,22 @@ midori_location_action_set_security_hint (MidoriLocationAction* location_action,
gdk_color_parse ("#000", &fg_color);
#if !HAVE_HILDON
if (gtk_icon_theme_has_icon (icon_theme, "lock-secure"))
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (child),
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_SECONDARY, "lock-secure");
else
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (child),
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_SECONDARY, GTK_STOCK_DIALOG_AUTHENTICATION);
gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (child),
gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_SECONDARY, _("Verified and encrypted connection"));
#endif
}
else if (hint == MIDORI_SECURITY_NONE)
gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_SECONDARY, NULL);
gtk_widget_modify_base (child, GTK_STATE_NORMAL,
gtk_widget_modify_base (entry, GTK_STATE_NORMAL,
bg_color.red == 1 ? NULL : &bg_color);
gtk_widget_modify_text (child, GTK_STATE_NORMAL,
gtk_widget_modify_text (entry, GTK_STATE_NORMAL,
bg_color.red == 1 ? NULL : &fg_color);
}
}

View file

@ -16,6 +16,7 @@
#endif
#include "sokoke.h"
#include "midori-stock.h"
#include <string.h>
#include <glib/gi18n.h>
@ -196,34 +197,6 @@ midori_preferences_notify_proxy_type_cb (MidoriWebSettings* settings,
}
#endif
static void
midori_preferences_delete_cookies_toggled_cb (GtkToggleButton* button,
MidoriWebSettings* settings)
{
gboolean toggled = gtk_toggle_button_get_active (button);
g_object_set (settings, "accept-cookies",
toggled ? MIDORI_ACCEPT_COOKIES_SESSION : MIDORI_ACCEPT_COOKIES_ALL, NULL);
}
static void
midori_preferences_delete_cookies_changed_cb (GtkComboBox* combo,
MidoriWebSettings* settings)
{
gint active = gtk_combo_box_get_active (combo);
gint max_age;
switch (active)
{
case 0: max_age = 0; break;
case 1: max_age = 1; break;
case 2: max_age = 7; break;
case 3: max_age = 30; break;
case 4: max_age = 365; break;
default:
max_age = 30;
}
g_object_set (settings, "maximum-cookie-age", max_age, NULL);
}
#if HAVE_OSX
static void
midori_preferences_toolbutton_clicked_cb (GtkWidget* toolbutton,
@ -326,8 +299,8 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
#define SPANNED_ADD(__widget) \
katze_preferences_add_widget (_preferences, __widget, "spanned")
/* Page "General" */
PAGE_NEW (GTK_STOCK_HOME, _("General"));
FRAME_NEW (_("Startup"));
PAGE_NEW (GTK_STOCK_HOME, _("Startup"));
FRAME_NEW (NULL);
label = katze_property_label (settings, "load-on-startup");
INDENTED_ADD (label);
button = katze_property_proxy (settings, "load-on-startup", NULL);
@ -355,21 +328,10 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
SPANNED_ADD (button);
#endif
}
button = katze_property_proxy (settings, "show-crash-dialog", NULL);
INDENTED_ADD (button);
button = katze_property_proxy (settings, "speed-dial-in-new-tabs", NULL);
SPANNED_ADD (button);
FRAME_NEW (_("Transfers"));
#if !HAVE_HILDON
label = katze_property_label (settings, "download-folder");
INDENTED_ADD (label);
button = katze_property_proxy (settings, "download-folder", "folder");
SPANNED_ADD (button);
#endif
/* Page "Appearance" */
PAGE_NEW (GTK_STOCK_SELECT_FONT, _("Appearance"));
FRAME_NEW (_("Font settings"));
FRAME_NEW (NULL);
#if !HAVE_HILDON
label = gtk_label_new (_("Default Font Family"));
INDENTED_ADD (label);
@ -400,7 +362,7 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
/* Page "Behavior" */
PAGE_NEW (GTK_STOCK_SELECT_COLOR, _("Behavior"));
FRAME_NEW (_("Features"));
FRAME_NEW (NULL);
#if !HAVE_HILDON
button = katze_property_proxy (settings, "auto-load-images", NULL);
INDENTED_ADD (button);
@ -439,16 +401,25 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
INDENTED_ADD (button);
entry = katze_property_proxy (settings, "preferred-languages", "languages");
SPANNED_ADD (entry);
#if !HAVE_HILDON
label = katze_property_label (settings, "download-folder");
INDENTED_ADD (label);
button = katze_property_proxy (settings, "download-folder", "folder");
SPANNED_ADD (button);
#endif
/* Page "Interface" */
PAGE_NEW (GTK_STOCK_CONVERT, _("Interface"));
FRAME_NEW (_("Navigationbar"));
PAGE_NEW (GTK_STOCK_CONVERT, _("Browsing"));
#if !HAVE_HILDON
if (!g_getenv ("DESKTOP_SESSION"))
{
FRAME_NEW (NULL);
INDENTED_ADD (katze_property_label (settings, "toolbar-style"));
button = katze_property_proxy (settings, "toolbar-style", NULL);
SPANNED_ADD (button);
}
#endif
FRAME_NEW (_("Browsing"));
FRAME_NEW (NULL);
label = katze_property_label (settings, "open-new-pages-in");
INDENTED_ADD (label);
button = katze_property_proxy (settings, "open-new-pages-in", NULL);
@ -464,18 +435,14 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
button = katze_property_proxy (settings, "open-tabs-in-the-background", NULL);
SPANNED_ADD (button);
#if !HAVE_HILDON
/* Page "Applications" */
#if !HAVE_HILDON
PAGE_NEW (GTK_STOCK_CONVERT, _("Applications"));
FRAME_NEW (_("External applications"));
FRAME_NEW (NULL);
label = katze_property_label (settings, "text-editor");
INDENTED_ADD (label);
entry = katze_property_proxy (settings, "text-editor", "application-text/plain");
SPANNED_ADD (entry);
label = katze_property_label (settings, "download-manager");
INDENTED_ADD (label);
entry = katze_property_proxy (settings, "download-manager", "application-FileTransfer");
SPANNED_ADD (entry);
label = katze_property_label (settings, "news-aggregator");
INDENTED_ADD (label);
entry = katze_property_proxy (settings, "news-aggregator", "application-News");
@ -484,7 +451,7 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
/* Page "Network" */
PAGE_NEW (GTK_STOCK_NETWORK, _("Network"));
FRAME_NEW (_("Network"));
FRAME_NEW (NULL);
#if !HAVE_HILDON
label = katze_property_label (settings, "proxy-type");
INDENTED_ADD (label);
@ -498,67 +465,16 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
G_CALLBACK (midori_preferences_notify_proxy_type_cb), entry);
midori_preferences_notify_proxy_type_cb (settings, NULL, entry);
#endif
#if WEBKIT_CHECK_VERSION (1, 3, 11)
label = katze_property_label (settings, "maximum-cache-size");
INDENTED_ADD (label);
button = katze_property_proxy (settings, "maximum-cache-size", NULL);
SPANNED_ADD (button);
label = gtk_label_new (_("MB"));
SPANNED_ADD (label);
#endif
label = katze_property_label (settings, "identify-as");
INDENTED_ADD (label);
button = katze_property_proxy (settings, "identify-as", "custom-user-agent");
SPANNED_ADD (button);
/* Page "Privacy" */
PAGE_NEW (GTK_STOCK_INDEX, _("Privacy"));
FRAME_NEW (_("Web Cookies"));
button = gtk_check_button_new_with_mnemonic (_("Delete cookies when quitting Midori"));
INDENTED_ADD (button);
if (katze_object_get_enum (settings, "accept-cookies") == MIDORI_ACCEPT_COOKIES_SESSION)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
g_signal_connect (button, "toggled",
G_CALLBACK (midori_preferences_delete_cookies_toggled_cb), settings);
button = gtk_combo_box_new_text ();
gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 hour"));
gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 day"));
gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 week"));
gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 month"));
gtk_combo_box_append_text (GTK_COMBO_BOX (button), _("Delete old cookies after 1 year"));
{
gint max_age = katze_object_get_int (settings, "maximum-cookie-age");
guint active;
switch (max_age)
{
case 0: active = 0; break;
case 1: active = 1; break;
case 7: active = 2; break;
case 30: active = 3; break;
case 365: active = 4; break;
default:
active = 3;
}
gtk_combo_box_set_active (GTK_COMBO_BOX (button), active);
}
g_signal_connect (button, "changed",
G_CALLBACK (midori_preferences_delete_cookies_changed_cb), settings);
SPANNED_ADD (button);
{
gchar* markup = g_strdup_printf ("<span size=\"smaller\">%s</span>",
_("Cookies store login data, saved games, "
"or user profiles for advertisement purposes."));
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), markup);
g_free (markup);
}
FILLED_ADD (label);
#if WEBKIT_CHECK_VERSION (1, 1, 13)
INDENTED_ADD (katze_property_proxy (settings, "enable-offline-web-application-cache", NULL));
#endif
#if WEBKIT_CHECK_VERSION (1, 1, 8)
SPANNED_ADD (katze_property_proxy (settings, "enable-html5-local-storage", NULL));
#if !WEBKIT_CHECK_VERSION (1, 1, 14)
INDENTED_ADD (katze_property_proxy (settings, "enable-html5-database", NULL));
#endif
#endif
FRAME_NEW (_("History"));
button = katze_property_label (settings, "maximum-history-age");
INDENTED_ADD (button);
button = katze_property_proxy (settings, "maximum-history-age", NULL);
SPANNED_ADD (button);
label = gtk_label_new (_("days"));
SPANNED_ADD (label);
}

View file

@ -399,8 +399,7 @@ midori_search_action_manage_activate_cb (GtkWidget* menuitem,
gtk_widget_show (dialog);
}
/* Private function, used by MidoriView */
/* static */ GdkPixbuf*
GdkPixbuf*
midori_search_action_get_icon (KatzeItem* item,
GtkWidget* widget,
const gchar** icon_name,
@ -674,8 +673,6 @@ midori_search_action_set_search_engines (MidoriSearchAction* search_action,
KatzeArray* search_engines)
{
GSList* proxies;
GtkWidget* alignment;
GtkWidget* entry;
g_return_if_fail (MIDORI_IS_SEARCH_ACTION (search_action));
g_return_if_fail (!search_engines ||
@ -702,16 +699,6 @@ midori_search_action_set_search_engines (MidoriSearchAction* search_action,
proxies = gtk_action_get_proxies (GTK_ACTION (search_action));
if (!proxies)
return;
do
if (GTK_IS_TOOL_ITEM (proxies->data))
{
alignment = gtk_bin_get_child (GTK_BIN (proxies->data));
entry = gtk_bin_get_child (GTK_BIN (alignment));
/* FIXME: Unset the current item if it isn't in the list */
}
while ((proxies = g_slist_next (proxies)));
}
KatzeItem*
@ -824,13 +811,11 @@ midori_search_action_dialog_render_icon_cb (GtkTreeViewColumn* column,
GtkWidget* treeview)
{
KatzeItem* item;
MidoriSearchAction* search_action;
GdkPixbuf* icon;
const gchar* icon_name;
gtk_tree_model_get (model, iter, 0, &item, -1);
search_action = g_object_get_data (G_OBJECT (treeview), "search-action");
if ((icon = midori_search_action_get_icon (item, treeview, &icon_name, FALSE)))
{
g_object_set (renderer, "pixbuf", icon, "yalign", 0.25, NULL);
@ -1034,6 +1019,7 @@ midori_search_action_get_editor (MidoriSearchAction* search_action,
we need to update the default search engine after editing it. */
else if (item == midori_search_action_get_default_item (search_action))
midori_search_action_set_default_item (search_action, item);
g_object_unref (item);
}
gtk_widget_destroy (dialog);
}
@ -1123,6 +1109,7 @@ midori_search_action_dialog_move_up_cb (GtkWidget* widget,
i = katze_array_get_item_index (search_engines, item);
katze_array_move_item (search_engines, item, i - 1);
g_object_unref (item);
/* If the index of the current item has changed it needs to be reset */
g_object_notify (G_OBJECT (search_action), "current-item");
}
@ -1155,6 +1142,7 @@ midori_search_action_dialog_move_down_cb (GtkWidget* widget,
i = katze_array_get_item_index (search_engines, item);
katze_array_move_item (search_engines, item, i + 1);
g_object_unref (item);
/* If the index of the current item has changed it needs to be reset */
g_object_notify (G_OBJECT (search_action), "current-item");
}
@ -1165,14 +1153,12 @@ static void
midori_search_action_dialog_default_cb (GtkWidget* widget,
MidoriSearchAction* search_action)
{
KatzeArray* search_engines;
GtkWidget* treeview;
GtkTreeSelection* selection;
GtkTreeModel* liststore;
GtkTreeIter iter;
KatzeItem* item;
search_engines = search_action->search_engines;
treeview = search_action->treeview;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
if (gtk_tree_selection_get_selected (selection, &liststore, &iter))
@ -1236,6 +1222,7 @@ midori_search_action_dialog_engines_remove_item_cb (KatzeArray* list,
}
else
valid = gtk_tree_model_iter_next (liststore, &iter);
g_object_unref (found_item);
}
}

View file

@ -59,6 +59,12 @@ midori_search_action_set_current_item (MidoriSearchAction* search_action,
KatzeItem*
midori_search_action_get_default_item (MidoriSearchAction* search_action);
GdkPixbuf*
midori_search_action_get_icon (KatzeItem* item,
GtkWidget* widget,
const gchar** icon_name,
gboolean in_entry);
void
midori_search_action_set_default_item (MidoriSearchAction* search_action,
KatzeItem* item);

File diff suppressed because it is too large Load diff

View file

@ -14,8 +14,13 @@
#include "sokoke.h"
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <string.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_CONFIG_H
#include <config.h>
#endif
@ -48,7 +53,7 @@ struct _MidoriWebSettings
MidoriPreferredEncoding preferred_encoding : 3;
gboolean always_show_tabbar : 1;
gboolean close_buttons_on_tabs : 1;
gboolean close_buttons_left : 1;
gint close_buttons_left;
MidoriNewPage open_new_pages_in : 2;
MidoriNewPage open_external_pages_in : 2;
gboolean middle_click_opens_selection : 1;
@ -81,11 +86,18 @@ struct _MidoriWebSettings
gchar* news_aggregator;
gchar* location_entry_search;
gchar* http_proxy;
#if WEBKIT_CHECK_VERSION (1, 3, 11)
gint maximum_cache_size;
#endif
gchar* http_accept_language;
gchar* ident_string;
gint clear_private_data;
gchar* clear_data;
#if !WEBKIT_CHECK_VERSION (1, 3, 13)
gboolean enable_dns_prefetching;
#endif
gboolean strip_referer;
};
struct _MidoriWebSettingsClass
@ -163,12 +175,15 @@ enum
PROP_PROXY_TYPE,
PROP_HTTP_PROXY,
PROP_MAXIMUM_CACHE_SIZE,
PROP_IDENTIFY_AS,
PROP_USER_AGENT,
PROP_PREFERRED_LANGUAGES,
PROP_CLEAR_PRIVATE_DATA,
PROP_CLEAR_DATA
PROP_CLEAR_DATA,
PROP_ENABLE_DNS_PREFETCHING,
PROP_STRIP_REFERER
};
GType
@ -196,7 +211,7 @@ midori_startup_get_type (void)
if (!type)
{
static const GEnumValue values[] = {
{ MIDORI_STARTUP_BLANK_PAGE, "MIDORI_STARTUP_BLANK_PAGE", N_("Show Blank page") },
{ MIDORI_STARTUP_BLANK_PAGE, "MIDORI_STARTUP_BLANK_PAGE", N_("Show Speed Dial") },
{ MIDORI_STARTUP_HOMEPAGE, "MIDORI_STARTUP_HOMEPAGE", N_("Show Homepage") },
{ MIDORI_STARTUP_LAST_OPEN_PAGES, "MIDORI_STARTUP_LAST_OPEN_PAGES", N_("Show last open tabs") },
#if WEBKIT_CHECK_VERSION (1, 1, 6)
@ -636,6 +651,8 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
* Show spee dial in newly opened tabs.
*
* Since: 0.1.7
*
* Deprecated: 0.3.4
*/
g_object_class_install_property (gobject_class,
PROP_SPEED_DIAL_IN_NEW_TABS,
@ -660,6 +677,13 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
#endif
/**
* MidoriWebSettings:download-manager:
*
* An external download manager that shows up in context menus.
*
* Deprecated: 0.3.4
*/
g_object_class_install_property (gobject_class,
PROP_DOWNLOAD_MANAGER,
g_param_spec_string (
@ -745,12 +769,8 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
"close-buttons-left",
"Close buttons on the left",
"Whether to show close buttons on the left side",
#if HAVE_OSX
TRUE,
#else
FALSE,
#endif
flags));
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
@ -763,6 +783,13 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
MIDORI_NEW_PAGE_TAB,
flags));
/**
* MidoriWebSettings:open-external-pages-in:
*
* Where to open externally opened pages.
*
* Deprecated: 0.3.4
*/
g_object_class_install_property (gobject_class,
PROP_OPEN_EXTERNAL_PAGES_IN,
g_param_spec_enum (
@ -936,6 +963,13 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
TRUE,
flags));
/**
* MidoriWebSettings:accept-cookies:
*
* What type of cookies to accept.
*
* Deprecated: 0.3.4
**/
g_object_class_install_property (gobject_class,
PROP_ACCEPT_COOKIES,
g_param_spec_enum (
@ -1009,6 +1043,24 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
NULL,
flags));
#if WEBKIT_CHECK_VERSION (1, 3, 11)
/**
* MidoriWebSettings:maximum-cache-size:
*
* The maximum size of cached pages on disk.
*
* Since: 0.3.4
*/
g_object_class_install_property (gobject_class,
PROP_MAXIMUM_CACHE_SIZE,
g_param_spec_int (
"maximum-cache-size",
_("Web Cache"),
_("The maximum size of cached pages on disk"),
0, G_MAXINT, 100,
flags));
#endif
/**
* MidoriWebSettings:identify-as:
*
@ -1091,6 +1143,41 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
_("The data selected for deletion"),
NULL,
flags));
#if !WEBKIT_CHECK_VERSION (1, 3, 13)
/**
* MidoriWebSettings:enable-dns-prefetching:
*
* Whether to resolve host names in advance.
*
* Since: 0.3.4
*/
g_object_class_install_property (gobject_class,
PROP_ENABLE_DNS_PREFETCHING,
g_param_spec_boolean (
"enable-dns-prefetching",
"Whether to resolve host names in advance",
"Whether host names on a website or in bookmarks should be prefetched",
TRUE,
flags));
#endif
/**
* MidoriWebSettings:strip-referer:
*
* Whether to strip referrer details sent to external sites.
*
* Since: 0.3.4
*/
g_object_class_install_property (gobject_class,
PROP_STRIP_REFERER,
g_param_spec_boolean (
"strip-referer",
/* i18n: Reworded: Shorten details propagated when going to another page */
_("Strip referrer details sent to external sites"),
/* i18n: Referer here is not a typo but a technical term */
_("Whether the \"Referer\" header should be shortened to the hostname"),
FALSE,
flags));
}
@ -1158,7 +1245,7 @@ midori_web_settings_finalize (GObject* object)
G_OBJECT_CLASS (midori_web_settings_parent_class)->finalize (object);
}
#if defined (G_OS_UNIX) && !HAVE_OSX
#if (!HAVE_OSX && defined (G_OS_UNIX)) || defined (G_OS_WIN32)
static gchar*
get_sys_name (void)
{
@ -1166,11 +1253,17 @@ get_sys_name (void)
if (!sys_name)
{
#ifdef G_OS_WIN32
/* 6.1 Win7, 6.0 Vista, 5.1 XP and 5.0 Win2k */
guint version = g_win32_get_windows_version ();
sys_name = g_strdup_printf ("NT %d.%d", LOBYTE (version), HIBYTE (version));
#else
struct utsname name;
if (uname (&name) != -1)
sys_name = g_strdup(name.sysname);
else
sys_name = "Unix";
sys_name = "Linux";
#endif
}
return sys_name;
}
@ -1180,27 +1273,25 @@ static gchar*
generate_ident_string (MidoriIdentity identify_as)
{
const gchar* platform =
#ifdef GDK_WINDOWING_X11
"X11";
#elif defined(GDK_WINDOWING_WIN32)
#if HAVE_HILDON
"Maemo;"
#elif defined (G_OS_WIN32)
"Windows";
#elif defined(GDK_WINDOWING_QUARTZ)
"Macintosh";
"Macintosh;";
#elif defined(GDK_WINDOWING_DIRECTFB)
"DirectFB";
"DirectFB;";
#else
"Unknown";
"X11;";
#endif
const gchar* os =
#if HAVE_OSX
"Mac OS X";
#elif defined (G_OS_UNIX)
#elif defined (G_OS_UNIX) || defined (G_OS_WIN32)
get_sys_name ();
#elif defined (G_OS_WIN32)
"Windows";
#else
"Unknown";
"Linux";
#endif
const gchar* appname = "Midori/"
@ -1219,24 +1310,21 @@ generate_ident_string (MidoriIdentity identify_as)
switch (identify_as)
{
case MIDORI_IDENT_MIDORI:
return g_strdup_printf ("%s (%s; %s; U; %s) WebKit/%d.%d+",
appname, platform, os, lang, webcore_major, webcore_minor);
return g_strdup_printf ("Mozilla/5.0 (%s %s) AppleWebKit/%d.%d+ %s",
platform, os, webcore_major, webcore_minor, appname);
case MIDORI_IDENT_SAFARI:
return g_strdup_printf ("Mozilla/5.0 (%s; U; %s; %s) "
"AppleWebKit/%d+ (KHTML, like Gecko) Safari/%d.%d+ %s",
platform, os, lang, webcore_major, webcore_major, webcore_minor, appname);
return g_strdup_printf ("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; %s) "
"AppleWebKit/%d+ (KHTML, like Gecko) Version/5.0 Safari/%d.%d+ %s",
lang, webcore_major, webcore_major, webcore_minor, appname);
case MIDORI_IDENT_IPHONE:
return g_strdup_printf ("Mozilla/5.0 (iPhone; U; %s; %s) "
"AppleWebKit/532+ (KHTML, like Gecko) Version/3.0 Mobile/1A538b "
"Safari/419.3 %s",
os, lang, appname);
return g_strdup_printf ("Mozilla/5.0 (iPhone; U; CPU like Mac OS X; %s) "
"AppleWebKit/532+ (KHTML, like Gecko) Version/3.0 Mobile/1A538b Safari/419.3 %s",
lang, appname);
case MIDORI_IDENT_FIREFOX:
return g_strdup_printf ("Mozilla/5.0 (%s; U; %s; %s; rv:1.9.0.2) "
"Gecko/2008092313 Firefox/3.8 %s",
platform, os, lang, appname);
return g_strdup_printf ("Mozilla/5.0 (%s %s; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 %s",
platform, os, appname);
case MIDORI_IDENT_EXPLORER:
return g_strdup_printf ("Mozilla/4.0 (compatible; "
"MSIE 6.0; Windows NT 5.1; %s) %s",
return g_strdup_printf ("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; %s) %s",
lang, appname);
default:
return g_strdup_printf ("%s", appname);
@ -1376,9 +1464,6 @@ midori_web_settings_set_property (GObject* object,
case PROP_CLOSE_BUTTONS_ON_TABS:
web_settings->close_buttons_on_tabs = g_value_get_boolean (value);
break;
case PROP_CLOSE_BUTTONS_LEFT:
web_settings->close_buttons_left = g_value_get_boolean (value);
break;
case PROP_OPEN_NEW_PAGES_IN:
web_settings->open_new_pages_in = g_value_get_enum (value);
break;
@ -1475,6 +1560,11 @@ midori_web_settings_set_property (GObject* object,
case PROP_HTTP_PROXY:
katze_assign (web_settings->http_proxy, g_value_dup_string (value));
break;
#if WEBKIT_CHECK_VERSION (1, 3, 11)
case PROP_MAXIMUM_CACHE_SIZE:
web_settings->maximum_cache_size = g_value_get_int (value);
break;
#endif
case PROP_IDENTIFY_AS:
web_settings->identify_as = g_value_get_enum (value);
if (web_settings->identify_as != MIDORI_IDENT_CUSTOM)
@ -1509,6 +1599,14 @@ midori_web_settings_set_property (GObject* object,
case PROP_CLEAR_DATA:
katze_assign (web_settings->clear_data, g_value_dup_string (value));
break;
#if !WEBKIT_CHECK_VERSION (1, 3, 13)
case PROP_ENABLE_DNS_PREFETCHING:
web_settings->enable_dns_prefetching = g_value_get_boolean (value);
break;
#endif
case PROP_STRIP_REFERER:
web_settings->strip_referer = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -1626,7 +1724,42 @@ midori_web_settings_get_property (GObject* object,
g_value_set_boolean (value, web_settings->close_buttons_on_tabs);
break;
case PROP_CLOSE_BUTTONS_LEFT:
g_value_set_boolean (value, web_settings->close_buttons_left);
#if HAVE_OSX
g_value_set_boolean (value, TRUE);
#elif defined (G_OS_WIN32)
g_value_set_boolean (value, FALSE);
#else
if (!web_settings->close_buttons_left)
{
/* Look for close button in layout specified in index.theme */
GdkScreen* screen = gdk_screen_get_default ();
GtkSettings* settings = gtk_settings_get_for_screen (screen);
gchar* theme = katze_object_get_string (settings, "gtk-theme-name");
gchar* folder = gtk_rc_get_theme_dir ();
gchar* filename = g_build_filename (folder, theme, "index.theme", NULL);
g_free (folder);
web_settings->close_buttons_left = 1;
if (g_access (filename, F_OK) != 0)
katze_assign (filename,
g_build_filename (g_get_home_dir (), ".themes",
theme, "index.theme", NULL));
g_free (theme);
if (g_access (filename, F_OK) == 0)
{
GKeyFile* keyfile = g_key_file_new ();
gchar* button_layout;
g_key_file_load_from_file (keyfile, filename, 0, NULL);
button_layout = g_key_file_get_string (keyfile,
"X-GNOME-Metatheme", "ButtonLayout", NULL);
if (button_layout && strstr (button_layout, "close:"))
web_settings->close_buttons_left = 2;
g_free (button_layout);
g_key_file_free (keyfile);
}
g_free (filename);
}
g_value_set_boolean (value, web_settings->close_buttons_left == 2);
#endif
break;
case PROP_OPEN_NEW_PAGES_IN:
g_value_set_enum (value, web_settings->open_new_pages_in);
@ -1720,6 +1853,11 @@ midori_web_settings_get_property (GObject* object,
case PROP_HTTP_PROXY:
g_value_set_string (value, web_settings->http_proxy);
break;
#if WEBKIT_CHECK_VERSION (1, 3, 11)
case PROP_MAXIMUM_CACHE_SIZE:
g_value_set_int (value, web_settings->maximum_cache_size);
break;
#endif
case PROP_IDENTIFY_AS:
g_value_set_enum (value, web_settings->identify_as);
break;
@ -1740,6 +1878,14 @@ midori_web_settings_get_property (GObject* object,
case PROP_CLEAR_DATA:
g_value_set_string (value, web_settings->clear_data);
break;
#if !WEBKIT_CHECK_VERSION (1, 3, 13)
case PROP_ENABLE_DNS_PREFETCHING:
g_value_set_boolean (value, web_settings->enable_dns_prefetching);
break;
#endif
case PROP_STRIP_REFERER:
g_value_set_boolean (value, web_settings->strip_referer);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;

View file

@ -39,6 +39,8 @@ namespace Midori {
public int add_uri (string uri);
public unowned View get_nth_tab (int n);
public GLib.List<weak View> get_tabs ();
public void block_action (Gtk.Action action);
public void unblock_action (Gtk.Action action);
public unowned Gtk.ActionGroup get_action_group ();
public unowned Browser get_for_widget (Gtk.Widget widget);
public unowned string[] get_toolbar_actions ();

View file

@ -592,7 +592,7 @@ sokoke_spawn_program (const gchar* command,
void
sokoke_spawn_app (const gchar* uri,
gboolean inherit_config)
gboolean private)
{
const gchar* executable = sokoke_get_argv (NULL)[0];
/* "midori"
@ -600,9 +600,9 @@ sokoke_spawn_app (const gchar* uri,
"c:/Program Files/Midori/bin/midori.exe" */
gchar* quoted = g_shell_quote (executable);
gchar* command;
if (inherit_config)
if (private)
command = g_strconcat (quoted, " -c ", sokoke_set_config_dir (NULL),
" -a", NULL);
" -p", NULL);
else
command = g_strconcat (quoted, " -a", NULL);
g_free (quoted);
@ -793,7 +793,7 @@ sokoke_resolve_hostname (const gchar* hostname)
gint host_resolved = 0;
uri = g_strconcat ("http://", hostname, NULL);
if (sokoke_prefetch_uri (uri, sokoke_resolve_hostname_cb,
if (sokoke_prefetch_uri (NULL, uri, sokoke_resolve_hostname_cb,
&host_resolved))
{
GTimer* timer = g_timer_new ();
@ -1957,6 +1957,7 @@ sokoke_file_chooser_dialog_new (const gchar* title,
/**
* sokoke_prefetch_uri:
* @settings: a #MidoriWebSettings instance, or %NULL
* @uri: an URI string
*
* Attempts to prefetch the specified URI, that is
@ -1965,7 +1966,8 @@ sokoke_file_chooser_dialog_new (const gchar* title,
* Return value: %TRUE on success
**/
gboolean
sokoke_prefetch_uri (const char* uri,
sokoke_prefetch_uri (MidoriWebSettings* settings,
const char* uri,
SoupAddressCallback callback,
gpointer user_data)
{
@ -1977,6 +1979,10 @@ sokoke_prefetch_uri (const char* uri,
if (!uri)
return FALSE;
if (settings && !katze_object_get_boolean (settings, "enable-dns-prefetching"))
return FALSE;
s_uri = soup_uri_new (uri);
if (!s_uri || !s_uri->host)
return FALSE;
@ -2184,3 +2190,100 @@ sokoke_widget_copy_clipboard (GtkWidget* widget,
clipboard = gtk_clipboard_get_for_display (display, GDK_SELECTION_PRIMARY);
gtk_clipboard_set_text (clipboard, text, -1);
}
gchar*
sokoke_build_thumbnail_path (const gchar* name)
{
gchar* path = NULL;
if (name != NULL)
{
gchar* checksum = g_compute_checksum_for_string (G_CHECKSUM_MD5, name, -1);
gchar* filename = g_strdup_printf ("%s.png", checksum);
path = g_build_filename (g_get_user_cache_dir (), "midori", "thumbnails",
filename, NULL);
g_free (filename);
g_free (checksum);
}
return path;
}
gchar*
midori_download_prepare_tooltip_text (WebKitDownload* download)
{
gdouble* last_time;
guint64* last_size;
gint hour = 3600, min = 60;
gint hours_left, minutes_left, seconds_left;
guint64 total_size = webkit_download_get_total_size (download);
guint64 current_size = webkit_download_get_current_size (download);
gdouble time_elapsed = webkit_download_get_elapsed_time (download);
gdouble time_estimated, time_diff;
gchar* current, *total, *download_speed;
gchar* hours_str, *minutes_str, *seconds_str;
GString* tooltip = g_string_new (NULL);
time_diff = time_elapsed / current_size;
time_estimated = (total_size - current_size) * time_diff;
hours_left = time_estimated / hour;
minutes_left = (time_estimated - (hours_left * hour)) / min;
seconds_left = (time_estimated - (hours_left * hour) - (minutes_left * min));
hours_str = g_strdup_printf (ngettext ("%d hour", "%d hours", hours_left), hours_left);
minutes_str = g_strdup_printf (ngettext ("%d minute", "%d minutes", minutes_left), minutes_left);
seconds_str = g_strdup_printf (ngettext ("%d second", "%d seconds", seconds_left), seconds_left);
current = g_format_size_for_display (current_size);
total = g_format_size_for_display (total_size);
last_time = g_object_get_data (G_OBJECT (download), "last-time");
last_size = g_object_get_data (G_OBJECT (download), "last-size");
/* i18n: Download tooltip (size): 4KB of 43MB */
g_string_append_printf (tooltip, _("%s of %s"), current, total);
g_free (current);
g_free (total);
if (time_elapsed != *last_time)
download_speed = g_format_size_for_display (
(current_size - *last_size) / (time_elapsed - *last_time));
else
/* i18n: Unknown number of bytes, used for transfer rate like ?B/s */
download_speed = g_strdup (_("?B"));
/* i18n: Download tooltip (transfer rate): (130KB/s) */
g_string_append_printf (tooltip, _(" (%s/s)"), download_speed);
g_free (download_speed);
if (time_estimated > 0)
{
gchar* eta;
if (hours_left > 0)
eta = g_strdup_printf ("%s, %s", hours_str, minutes_str);
else if (minutes_left >= 10)
eta = g_strdup_printf ("%s", minutes_str);
else if (minutes_left < 10 && minutes_left > 0)
eta = g_strdup_printf ("%s, %s", minutes_str, seconds_str);
else if (seconds_left > 0)
eta = g_strdup_printf ("%s", seconds_str);
else
eta = g_strdup ("");
/* i18n: Download tooltip (estimated time) : - 1 hour, 5 minutes remaning */
g_string_append_printf (tooltip, _(" - %s remaining"), eta);
g_free (eta);
}
g_free (hours_str);
g_free (seconds_str);
g_free (minutes_str);
if (time_elapsed - *last_time > 5.0)
{
*last_time = time_elapsed;
*last_size = current_size;
}
return g_string_free (tooltip, FALSE);
}

View file

@ -19,10 +19,8 @@
#define MIDORI_MOD_BACKGROUND(state) (state & GDK_SHIFT_MASK)
#define MIDORI_MOD_SCROLL(state) (state & GDK_CONTROL_MASK)
#include <katze/katze.h>
#include <webkit/webkit.h>
#include <JavaScriptCore/JavaScript.h>
#include <midori/midori-websettings.h>
#if !GLIB_CHECK_VERSION (2, 14, 0)
#define G_PARAM_STATIC_STRINGS \
@ -254,7 +252,8 @@ sokoke_file_chooser_dialog_new (const gchar* title,
GtkFileChooserAction action);
gboolean
sokoke_prefetch_uri (const char* uri,
sokoke_prefetch_uri (MidoriWebSettings* settings,
const char* uri,
SoupAddressCallback callback,
gpointer user_data);
@ -284,4 +283,10 @@ void
sokoke_widget_copy_clipboard (GtkWidget* widget,
const gchar* text);
gchar*
sokoke_build_thumbnail_path (const gchar* name);
gchar*
midori_download_prepare_tooltip_text (WebKitDownload* download);
#endif /* !__SOKOKE_H__ */

View file

@ -337,10 +337,8 @@ midori_bookmarks_row_changed_cb (GtkTreeModel* model,
{
KatzeItem* item;
GtkTreeIter parent;
sqlite3* db;
gchar* parent_name;
db = g_object_get_data (G_OBJECT (bookmarks->array), "db");
gtk_tree_model_get (model, iter, 0, &item, -1);
if (gtk_tree_model_iter_parent (model, &parent, iter))
@ -400,6 +398,17 @@ midori_bookmarks_edit_clicked_cb (GtkWidget* toolitem,
}
}
static void
midori_bookmarks_toolbar_update (MidoriBookmarks *bookmarks)
{
gboolean selected;
selected = katze_tree_view_get_selected_iter (
GTK_TREE_VIEW (bookmarks->treeview), NULL, NULL);
gtk_widget_set_sensitive (GTK_WIDGET (bookmarks->delete), selected);
gtk_widget_set_sensitive (GTK_WIDGET (bookmarks->edit), selected);
}
static void
midori_bookmarks_delete_clicked_cb (GtkWidget* toolitem,
MidoriBookmarks* bookmarks)
@ -464,6 +473,7 @@ midori_bookmarks_get_toolbar (MidoriViewable* viewable)
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
gtk_widget_show (GTK_WIDGET (toolitem));
bookmarks->delete = GTK_WIDGET (toolitem);
midori_bookmarks_toolbar_update (bookmarks);
toolitem = gtk_separator_tool_item_new ();
gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (toolitem), FALSE);
gtk_tool_item_set_expand (toolitem, TRUE);
@ -881,6 +891,13 @@ midori_bookmarks_row_collapsed_cb (GtkTreeView *treeview,
0, 0, NULL, -1);
}
static void
midori_bookmarks_selection_changed_cb (GtkTreeSelection *treeview,
MidoriBookmarks *bookmarks)
{
midori_bookmarks_toolbar_update (bookmarks);
}
static gboolean
midori_bookmarks_filter_timeout_cb (gpointer data)
{
@ -929,6 +946,7 @@ midori_bookmarks_init (MidoriBookmarks* bookmarks)
GtkTreeViewColumn* column;
GtkCellRenderer* renderer_pixbuf;
GtkCellRenderer* renderer_text;
GtkTreeSelection* selection;
/* Create the filter entry */
entry = gtk_icon_entry_new ();
@ -983,6 +1001,10 @@ midori_bookmarks_init (MidoriBookmarks* bookmarks)
"signal::row-collapsed",
midori_bookmarks_row_collapsed_cb, bookmarks,
NULL);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
g_signal_connect_after (selection, "changed",
G_CALLBACK (midori_bookmarks_selection_changed_cb),
bookmarks);
gtk_widget_show (treeview);
gtk_box_pack_start (GTK_BOX (bookmarks), treeview, TRUE, TRUE, 0);
bookmarks->treeview = treeview;

View file

@ -221,11 +221,29 @@ midori_extensions_treeview_render_tick_cb (GtkTreeViewColumn* column,
g_object_set (renderer,
"activatable", midori_extension_is_prepared (extension),
"active", midori_extension_is_active (extension) || g_object_get_data (G_OBJECT (extension), "static"),
"xpad", 4,
NULL);
g_object_unref (extension);
}
static void
midori_extensions_treeview_render_icon_cb (GtkTreeViewColumn* column,
GtkCellRenderer* renderer,
GtkTreeModel* model,
GtkTreeIter* iter,
GtkWidget* treeview)
{
MidoriExtension* extension;
gtk_tree_model_get (model, iter, 0, &extension, -1);
g_object_set (renderer, "stock-id", STOCK_EXTENSION,
"stock-size", GTK_ICON_SIZE_BUTTON,
"sensitive", midori_extension_is_prepared (extension),
"xpad", 4, NULL);
g_object_unref (extension);
}
static void
midori_extensions_treeview_render_text_cb (GtkTreeViewColumn* column,
GtkCellRenderer* renderer,
@ -338,6 +356,7 @@ midori_extensions_init (MidoriExtensions* extensions)
{
/* Create the treeview */
GtkTreeViewColumn* column;
GtkCellRenderer* renderer_icon;
GtkCellRenderer* renderer_text;
GtkCellRenderer* renderer_toggle;
GtkListStore* liststore = gtk_list_store_new (1, G_TYPE_OBJECT);
@ -357,6 +376,13 @@ midori_extensions_init (MidoriExtensions* extensions)
G_CALLBACK (midori_extensions_cell_renderer_toggled_cb), extensions);
gtk_tree_view_append_column (GTK_TREE_VIEW (extensions->treeview), column);
column = gtk_tree_view_column_new ();
renderer_icon = gtk_cell_renderer_pixbuf_new ();
gtk_tree_view_column_pack_start (column, renderer_icon, FALSE);
gtk_tree_view_column_set_cell_data_func (column, renderer_icon,
(GtkTreeCellDataFunc)midori_extensions_treeview_render_icon_cb,
extensions->treeview, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (extensions->treeview), column);
column = gtk_tree_view_column_new ();
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
renderer_text = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (column, renderer_text, FALSE);

View file

@ -154,6 +154,16 @@ midori_history_format_date (KatzeItem *item)
return sdate;
}
static void
midori_history_toolbar_update (MidoriHistory *history)
{
gboolean selected;
selected = katze_tree_view_get_selected_iter (
GTK_TREE_VIEW (history->treeview), NULL, NULL);
gtk_widget_set_sensitive (GTK_WIDGET (history->delete), selected);
}
static void
midori_history_remove_item_from_db (MidoriHistory* history,
KatzeItem* item)
@ -370,6 +380,7 @@ midori_history_get_toolbar (MidoriViewable* viewable)
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
gtk_widget_show (GTK_WIDGET (toolitem));
history->clear = GTK_WIDGET (toolitem);
midori_history_toolbar_update (history);
g_signal_connect (history->bookmark, "destroy",
G_CALLBACK (gtk_widget_destroyed), &history->bookmark);
g_signal_connect (history->delete, "destroy",
@ -903,6 +914,12 @@ midori_history_filter_entry_clear_cb (GtkEntry* entry,
gtk_entry_set_text (entry, "");
}
static void
midori_history_selection_changed_cb (GtkTreeView* treeview,
MidoriHistory* history)
{
midori_history_toolbar_update (history);
}
static void
midori_history_init (MidoriHistory* history)
@ -914,6 +931,7 @@ midori_history_init (MidoriHistory* history)
GtkTreeViewColumn* column;
GtkCellRenderer* renderer_pixbuf;
GtkCellRenderer* renderer_text;
GtkTreeSelection* selection;
/* Create the filter entry */
entry = gtk_icon_entry_new ();
@ -968,6 +986,10 @@ midori_history_init (MidoriHistory* history)
"signal::popup-menu",
midori_history_popup_menu_cb, history,
NULL);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
g_signal_connect_after (selection, "changed",
G_CALLBACK (midori_history_selection_changed_cb),
history);
gtk_widget_show (treeview);
gtk_box_pack_start (GTK_BOX (history), treeview, TRUE, TRUE, 0);
history->treeview = treeview;

View file

@ -41,7 +41,6 @@ extensions/feed-panel/main.c
extensions/formhistory.c
extensions/history-list.vala
extensions/mouse-gestures.c
extensions/page-holder.c
extensions/shortcuts.c
extensions/status-clock.c
extensions/statusbar-features.c

View file

@ -1877,7 +1877,7 @@ msgid "Inspect page - %s"
msgstr ""
#: ../midori/midori-view.c:3762
msgid "Speed dial"
msgid "Speed Dial"
msgstr "حوار السريع"
#: ../midori/midori-view.c:3763

View file

@ -1476,7 +1476,7 @@ msgid "Inspect page - %s"
msgstr "Inspeicionar la páxina - %s"
#: ../midori/midori-view.c:2147
msgid "Speed dial"
msgid "Speed Dial"
msgstr "Marcación rápida"
#: ../midori/midori-view.c:2148

View file

@ -1822,7 +1822,7 @@ msgid "Inspect page - %s"
msgstr "Inspecciona la pàgina «%s»"
#: ../midori/midori-view.c:3762
msgid "Speed dial"
msgid "Speed Dial"
msgstr "Marcador ràpid"
#: ../midori/midori-view.c:3763

1418
po/cs.po

File diff suppressed because it is too large Load diff

View file

@ -1776,7 +1776,7 @@ msgid "Inspect page - %s"
msgstr "Undersøg side - %s"
#: ../midori/midori-view.c:3497
msgid "Speed dial"
msgid "Speed Dial"
msgstr "Hurtigopkald"
#: ../midori/midori-view.c:3498

1594
po/de.po

File diff suppressed because it is too large Load diff

View file

@ -1882,7 +1882,7 @@ msgid "Inspect page - %s"
msgstr "Εξέταση σελίδα -%s"
#: ../midori/midori-view.c:3772
msgid "Speed dial"
msgid "Speed Dial"
msgstr "Γρήγορη σύνδεση"
#: ../midori/midori-view.c:3773

View file

@ -1816,8 +1816,8 @@ msgid "Inspect page - %s"
msgstr "Inspect page - %s"
#: ../midori/midori-view.c:3762
msgid "Speed dial"
msgstr "Speed dial"
msgid "Speed Dial"
msgstr "Speed Dial"
#: ../midori/midori-view.c:3763
msgid "Click to add a shortcut"

1469
po/es.po

File diff suppressed because it is too large Load diff

View file

@ -1834,7 +1834,7 @@ msgid "Inspect page - %s"
msgstr "Tutki sivua - %s"
#: ../midori/midori-view.c:3769
msgid "Speed dial"
msgid "Speed Dial"
msgstr "Pikavalinta"
#: ../midori/midori-view.c:3770

1939
po/fr.po

File diff suppressed because it is too large Load diff

View file

@ -1823,7 +1823,7 @@ msgid "Inspect page - %s"
msgstr "Inspeccionar a páxina - %s"
#: ../midori/midori-view.c:3769
msgid "Speed dial"
msgid "Speed Dial"
msgstr "Marcación rápida"
#: ../midori/midori-view.c:3770

View file

@ -1845,7 +1845,7 @@ msgid "Inspect page - %s"
msgstr "בדיקת עמוד - %s"
#: ../midori/midori-view.c:3754
msgid "Speed dial"
msgid "Speed Dial"
msgstr "חיוג מהיר"
#: ../midori/midori-view.c:3755

View file

@ -1802,7 +1802,7 @@ msgid "Inspect page - %s"
msgstr ""
#: ../midori/midori-view.c:3822
msgid "Speed dial"
msgid "Speed Dial"
msgstr "Brzo biranje"
#: ../midori/midori-view.c:3823

View file

@ -1816,7 +1816,7 @@ msgid "Inspect page - %s"
msgstr "Oldal vizsgálata - %s"
#: ../midori/midori-view.c:3762
msgid "Speed dial"
msgid "Speed Dial"
msgstr "Gyorstárcsázó"
#: ../midori/midori-view.c:3763

View file

@ -1831,7 +1831,7 @@ msgid "Inspect page - %s"
msgstr "Periksa halaman - %s"
#: ../midori/midori-view.c:3822
msgid "Speed dial"
msgid "Speed Dial"
msgstr "Panggil cepat"
#: ../midori/midori-view.c:3823

1500
po/it.po

File diff suppressed because it is too large Load diff

1658
po/ja.po

File diff suppressed because it is too large Load diff

1592
po/ko.po

File diff suppressed because it is too large Load diff

View file

@ -1837,7 +1837,7 @@ msgid "Inspect page - %s"
msgstr ""
#: ../midori/midori-view.c:3736
msgid "Speed dial"
msgid "Speed Dial"
msgstr ""
#: ../midori/midori-view.c:3737

View file

@ -1822,7 +1822,7 @@ msgid "Inspect page - %s"
msgstr "Pagina analyseren - %s"
#: ../midori/midori-view.c:3513
msgid "Speed dial"
msgid "Speed Dial"
msgstr "Snelkeuze"
#: ../midori/midori-view.c:3514

View file

@ -1480,7 +1480,7 @@ msgid "Inspect page - %s"
msgstr "Undersøk side - %s"
#: ../midori/midori-view.c:2147
msgid "Speed dial"
msgid "Speed Dial"
msgstr "Snarveier (Speed dial)"
#: ../midori/midori-view.c:2148

View file

@ -1788,7 +1788,7 @@ msgid "Inspect page - %s"
msgstr ""
#: ../midori/midori-view.c:3368
msgid "Speed dial"
msgid "Speed Dial"
msgstr ""
#: ../midori/midori-view.c:3369

1023
po/pl.po

File diff suppressed because it is too large Load diff

1533
po/pt.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1817,7 +1817,7 @@ msgid "Inspect page - %s"
msgstr "Inspectare pagină - %s"
#: ../midori/midori-view.c:3755
msgid "Speed dial"
msgid "Speed Dial"
msgstr "Apeluri rapide"
# dumol: E ok dacă e mai lung...

1155
po/ru.po

File diff suppressed because it is too large Load diff

1990
po/sk.po

File diff suppressed because it is too large Load diff

View file

@ -1480,7 +1480,7 @@ msgid "Inspect page - %s"
msgstr "Inspektera sida - %s"
#: ../midori/midori-view.c:2147
msgid "Speed dial"
msgid "Speed Dial"
msgstr "Webbgenvägar"
#: ../midori/midori-view.c:2148

View file

@ -1816,7 +1816,7 @@ msgid "Inspect page - %s"
msgstr "Sayfayı incele - %s"
#: ../midori/midori-view.c:3769
msgid "Speed dial"
msgid "Speed Dial"
msgstr "Hızlı arama"
#: ../midori/midori-view.c:3770

View file

@ -1896,7 +1896,7 @@ msgid "Inspect page - %s"
msgstr "بەتنى تەكشۈر - %s"
#: ../midori/midori-view.c:3513
msgid "Speed dial"
msgid "Speed Dial"
msgstr ""
#: ../midori/midori-view.c:3514

1418
po/uk.po

File diff suppressed because it is too large Load diff

View file

@ -1827,7 +1827,7 @@ msgid "Inspect page - %s"
msgstr "检查页面 - %s"
#: ../midori/midori-view.c:3762
msgid "Speed dial"
msgid "Speed Dial"
msgstr "快速拨号"
#: ../midori/midori-view.c:3763

View file

@ -1865,7 +1865,7 @@ msgid "Inspect page - %s"
msgstr "審閱頁面 - %s"
#: ../midori/midori-view.c:3763
msgid "Speed dial"
msgid "Speed Dial"
msgstr "快速播號"
#: ../midori/midori-view.c:3764

View file

@ -178,14 +178,11 @@ midori_findbar_preedit_changed_cb (GtkWidget* entry,
const gchar* preedit,
MidoriFindbar* findbar)
{
if (findbar->find_typing)
{
MidoriBrowser* browser = midori_browser_get_for_widget (entry);
GtkWidget* view = midori_browser_get_current_tab (browser);
midori_view_unmark_text_matches (MIDORI_VIEW (view));
if (g_utf8_strlen (preedit, -1) > 1)
midori_findbar_find_text (findbar, preedit, TRUE);
}
}
static void

View file

@ -75,14 +75,8 @@ midori_transferbar_download_notify_progress_cb (WebKitDownload* download,
GParamSpec* pspec,
GtkWidget* progress)
{
gchar* current;
gchar* total;
gchar* size_text;
gchar* tooltip;
gchar* text;
gchar* transfer;
gdouble* last_time;
guint64* last_size;
gdouble timestamp;
guint64 size;
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress),
@ -96,31 +90,12 @@ midori_transferbar_download_notify_progress_cb (WebKitDownload* download,
return;
}
current = g_format_size_for_display (webkit_download_get_current_size (download));
total = g_format_size_for_display (webkit_download_get_total_size (download));
last_time = g_object_get_data (G_OBJECT (download), "last-time");
last_size = g_object_get_data (G_OBJECT (download), "last-size");
timestamp = webkit_download_get_elapsed_time (download);
if (timestamp != *last_time)
transfer = g_format_size_for_display ((size - *last_size) / (timestamp - *last_time));
else
/* i18n: Unknown number of bytes, used for transfer rate like ?B/s */
transfer = g_strdup (_("?B"));
/* i18n: Download tooltip, 4KB of 43MB, 130KB/s */
size_text = g_strdup_printf (_("%s of %s, %s/s"), current, total, transfer);
if (timestamp - *last_time > 5.0)
{
*last_time = timestamp;
*last_size = size;
}
g_free (current);
g_free (total);
text = g_strdup_printf ("%s (%s)",
gtk_progress_bar_get_text (GTK_PROGRESS_BAR (progress)),
size_text);
tooltip = midori_download_prepare_tooltip_text (download);
text = g_strdup_printf ("%s\n%s",
gtk_progress_bar_get_text (GTK_PROGRESS_BAR (progress)), tooltip);
gtk_widget_set_tooltip_text (progress, text);
g_free (size_text);
g_free (transfer);
g_free (tooltip);
g_free (text);
}
@ -165,9 +140,9 @@ midori_transferbar_download_notify_status_cb (WebKitDownload* download,
#if WEBKIT_CHECK_VERSION (1, 1, 14)
request = webkit_download_get_network_request (download);
original_uri = g_object_get_data (G_OBJECT (request), "midori-original-uri");
#else
original_uri = webkit_download_get_uri (download);
if (!original_uri)
#endif
original_uri = webkit_download_get_uri (download);
fingerprint = g_strsplit (original_uri, "#!md5!", 2);
if (fingerprint && fingerprint[0] && fingerprint[1])
{

View file

@ -0,0 +1,92 @@
This file is licensed under the terms of the LGPL 2.1, see the file COPYING.
FILES
README.txt This file, explaining how to build Midori.
midori-0.3.3.nsi The NSIS installer creation script.
packages.list The suse mingw packages required to build Midori.
x86-mingw32-opensuse/ Install and update script for the opensuse repository.
makedist/ Scripts to create distribution package
from cross-compiled binaries and libs.
crossconfig.sh Setup environment for cross build and run
configure script for cross build.
INTRODUCTION
This document will explain how to get Midori compiling for windows, hopefully.
REQUIREMENTS
A working tool chain with the mingw compiler is required. This can either be
native in Windows or a cross-chain.
This tool chain must have the following applications and all applications
needed to build Midori:
- basename, for x86-mingw32-opensuse
- bash, for the shell scripts
- cat, for makedist.midori
- cp, for x86-mingw32-opensuse and makedist.midori
- cpio, for x86-mingw32-opensuse
- echo, for x86-mingw32-opensuse and makedist.midori
- find, for makedist.midori
- git, to get the development sources
- grep, for makedist.midori
- gunzip, for x86-mingw32-opensuse
- head, for x86-mingw32-opensuse
- ls, for makedist.midori
- mkdir, for x86-mingw32-opensuse and makedist.midori
- mktemp, for makedist.midori
- pwd, for makedist.midori
- rm, for x86-mingw32-opensuse and makedist.midori
- rmdir, for makedist.midori
- rpm2cpio, for x86-mingw32-opensuse
- sed, for x86-mingw32-opensuse
- sha1sum, for makedist.midori
- sort, for x86-mingw32-opensuse and makedist.midori
- strings, for makedist.midori
- tar, to unpack the scripts
- touch, for x86-mingw32-opensuse
- uniq, for makedist.midori
- wget, for x86-mingw32-opensuse
- xmlgrep, for x86-mingw32-opensuse
- zip, for makedist.midori
PREPARATIONS
Install all the packages needed by Midori and its dependencies. There are two
ways to do this. Automatically install the dependencies from opensuse.org or
manually install them.
To automatically install the packages use the scripts and change configuration
in header of install.sh file where needed. And run ./install.sh to install all
necessary packages.
This script can be also invoked with "update" argument ./install.sh update
to update the installed packages to newer versions.
To install the dependencies manually install the packages in packages.list.
This are all the packages needed by Midori and its dependencies.
Get the Midori sources. Either use git to get them or download a snapshot or a
release. See http://git.xfce.org/apps/midori or
http://archive.xfce.org/src/apps/midori/
BUILDING
Read the instruction in the source tree. For cross compiling the script
crossconfig.sh might help.
DISTRIBUTION
To create a Windows installer for Midori you need NSIS. See
http://nsis.sourceforge.net/Main_Page
Use the makedist.midori script to get all files needed for distribution. Add
the version number as argument to makedist.midori to create a version number
in the distribution package. eg. ./makedist.midori -0.3.3
To complete the installer unzip the file created by the makedist script.
Compile midori-0.3.3.nsi with NSIS.

View file

@ -0,0 +1,31 @@
#! /bin/sh
# Copyright (C) 2010-2011 Peter de Ridder <peter@xfce.org>
#
# 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.
temp_file_new=`mktemp`
temp_file_old=`mktemp`
while [ "$1" ]
do
echo $1 >> $temp_file_new
shift
done
while [ "x`sha1sum - < $temp_file_new`" != "x`sha1sum - < $temp_file_old`" ]
do
files=`cat $temp_file_new $temp_file_old | sort | uniq -u`
cp $temp_file_new $temp_file_old
strings $files 2> /dev/null | grep \\.dll | cat - $temp_file_old | sort | uniq > $temp_file_new
done
cat $temp_file_new
rm $temp_file_new $temp_file_old

View file

@ -0,0 +1,96 @@
#! /bin/sh
# Copyright (C) 2010-2011 Peter de Ridder <peter@xfce.org>
#
# 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.
# a bit of configuration
root_dir=$MINGW_PREFIX
script_dir=$PWD
# create temporary working directory
temp_dir=`mktemp -d`
# generate unique filename
ARCHIVE=midori$1-`date +%Y%m%d%H%M`.zip
echo -n "Creating $ARCHIVE ."
# create destination folder
mkdir $temp_dir/midori$1
echo -n .
# auto generate dll list, only of existing files
pushd $root_dir/bin > /dev/null
$script_dir/dll-recursive.sh midori*.exe gspawn-*-helper*.exe libhunspell*.dll > $temp_dir/midori.exe.lst
files=`ls | cat - $temp_dir/midori.exe.lst | sort | uniq -d`
rm $temp_dir/midori.exe.lst
popd > /dev/null
echo -n .
# copy auto generate dll list
pushd $root_dir/bin > /dev/null
mkdir $temp_dir/midori$1/bin
cp $files $temp_dir/midori$1/bin
popd > /dev/null
echo -n .
# copy etc
pushd $root_dir > /dev/null
find etc "(" -name "*midori*" -o -name "gtkrc" ")" -prune -exec mkdir -p $temp_dir/midori$1/{} ";" -exec rmdir --ignore-fail-on-non-empty $temp_dir/midori$1/{} ";" -exec cp -r {} $temp_dir/midori$1/{} ";"
popd > /dev/null
echo -n .
# copy lib
pushd $root_dir > /dev/null
find lib "(" -path "lib/midori/*" -o -path "lib/gtk-2.0/*" -o -path "lib/enchant/*" -o -path "lib/engines/*" ")" -a -name "*.dll" -prune -exec mkdir -p $temp_dir/midori$1/{} ";" -exec rmdir --ignore-fail-on-non-empty $temp_dir/midori$1/{} ";" -exec cp -r {} $temp_dir/midori$1/{} ";"
popd > /dev/null
echo -n .
# copy share
pushd $root_dir > /dev/null
find share "(" -name "*midori*" -o -name "icons" -o -name "MS-Windows" -o -name "mime" ")" -prune -exec mkdir -p $temp_dir/midori$1/{} ";" -exec rmdir --ignore-fail-on-non-empty $temp_dir/midori$1/{} ";" -exec cp -r {} $temp_dir/midori$1/{} ";"
# copy locales for gtk
# so we have translated stock items, file dialogs
find share "(" -name "midori.mo" ")" > locale.list
mkdir -p $temp_dir/midori$1/share/locale/
for LOCALE in $(cat locale.list); do
LOCALE=$(echo $LOCALE|awk -F/ '{print $3}')
cp /usr/share/locale/$LOCALE/LC_MESSAGES/gtk20.mo $temp_dir/midori$1/share/locale/$LOCALE/LC_MESSAGES/
done
rm locale.list
popd > /dev/null
echo -n .
# copy doc files to root
cp $temp_dir/midori$1/share/doc/midori/{COPYING,AUTHORS} $temp_dir/midori$1
echo -n .
ARCHIVE=`pwd`/$ARCHIVE
# store as tar.bz2 file
pushd $temp_dir > /dev/null
zip -rq $ARCHIVE midori$1
popd > /dev/null
echo -n .
# remove working directory
rm -r $temp_dir
echo " ready"

View file

@ -0,0 +1,664 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (C) 2009 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
; 2010-2011 Peter de Ridder <peter(at)xfce(dot)org>
;
; 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.
;
; Installer script for Midori (Windows Installer)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Do a Cyclic Redundancy Check to make sure the installer was not corrupted by the download
CRCCheck force
RequestExecutionLevel user ; set execution level for Windows Vista
;;;;;;;;;;;;;;;;;;;
; helper defines ;
;;;;;;;;;;;;;;;;;;;
!define PRODUCT_NAME "Midori"
!define PRODUCT_VERSION "0.3.3"
!define PRODUCT_BUILD "0"
!define PRODUCT_VERSION_ID "${PRODUCT_VERSION}.${PRODUCT_BUILD}"
!define PRODUCT_PUBLISHER "Christian Dywan"
!define PRODUCT_WEB_SITE "http://www.twotoasts.de/"
!define PRODUCT_DIR_REGKEY "Software\${PRODUCT_NAME}"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_BROWER_KEY "Software\Clients\StartMenuInternet"
!define PRODUCT_EXE "$INSTDIR\bin\midori.exe"
!define UNINSTALL_EXE "$INSTDIR\uninst.exe"
!define RESOURCEDIR "midori-${PRODUCT_VERSION}"
;;;;;;;;;;;;;;;;;;;;;
; Version resource ;
;;;;;;;;;;;;;;;;;;;;;
VIProductVersion "${PRODUCT_VERSION_ID}"
VIAddVersionKey "ProductName" "${PRODUCT_NAME}"
VIAddVersionKey "FileVersion" "${PRODUCT_VERSION}"
VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}"
VIAddVersionKey "LegalCopyright" "Copyright 2009 by Christian Dywan"
VIAddVersionKey "FileDescription" "${PRODUCT_NAME} Installer"
BrandingText "$(^NAME) installer (NSIS ${NSIS_VERSION})"
InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
SetCompressor /SOLID lzma
ShowInstDetails hide
ShowUnInstDetails hide
XPStyle on
OutFile "${PRODUCT_NAME}-${PRODUCT_VERSION}_setup.exe"
Var Answer
Var UserName
Var StartmenuFolder
Var UNINSTDIR
Var DefaultBrowser
;;;;;;;;;;;;;;;;
; MUI Settings ;
;;;;;;;;;;;;;;;;
!include "MUI2.nsh"
!define MUI_ABORTWARNING
!define MUI_ICON "midori.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall-full.ico"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
;!define MUI_LICENSEPAGE_RADIOBUTTONS
!insertmacro MUI_PAGE_LICENSE "${RESOURCEDIR}\COPYING"
; Components page
!insertmacro MUI_PAGE_COMPONENTS
; Directory page
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE OnDirLeave
!insertmacro MUI_PAGE_DIRECTORY
; Start menu page
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Midori"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!insertmacro MUI_PAGE_STARTMENU ${PRODUCT_NAME} "$StartmenuFolder"
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "${PRODUCT_EXE}"
!define MUI_FINISHPAGE_RUN_NOTCHECKED
!define MUI_FINISHPAGE_NOREBOOTSUPPORT
!insertmacro MUI_PAGE_FINISH
; Uninstaller page
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
; Language file
!insertmacro MUI_LANGUAGE "English"
;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Sections and InstTypes ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;
InstType "Full"
InstType "Minimal"
Section "!Program Files" SEC01
SectionIn RO 1 2
SetOverwrite ifnewer
SetOutPath "$INSTDIR"
File "${RESOURCEDIR}\*"
SetOutPath "$INSTDIR\bin"
File /r "${RESOURCEDIR}\bin\*"
SetOutPath "$INSTDIR\etc"
File /r "${RESOURCEDIR}\etc\*"
SetOutPath "$INSTDIR\lib"
File /r /x "midori" "${RESOURCEDIR}\lib\*"
SetOutPath "$INSTDIR\share"
File /r /x "locale" /x "user" /x "Tango" "${RESOURCEDIR}\share\*"
SetOutPath "$INSTDIR\share\icons\Tango"
File "${RESOURCEDIR}\share\icons\Tango\index.theme"
SetOutPath "$INSTDIR"
CreateShortCut "$INSTDIR\Midori.lnk" "${PRODUCT_EXE}"
!insertmacro MUI_STARTMENU_WRITE_BEGIN ${PRODUCT_NAME}
CreateDirectory "$SMPROGRAMS\$StartmenuFolder"
CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Midori.lnk" "${PRODUCT_EXE}"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
Section "Extensions" SEC04
SectionIn 1
SetOverwrite ifnewer
SetOutPath "$INSTDIR\lib"
File /r "${RESOURCEDIR}\lib\midori"
SectionEnd
Section "Language Files" SEC02
SectionIn 1
SetOutPath "$INSTDIR\share"
File /r "${RESOURCEDIR}\share\locale"
SectionEnd
Section "FAQ" SEC06
SectionIn 1
SetOutPath "$INSTDIR\share\doc\midori"
File "${RESOURCEDIR}\share\doc\midori\faq.css"
File "${RESOURCEDIR}\share\doc\midori\faq.html"
SectionEnd
!macro InstallTangoIconRenameSmall OPath IPath
File "/oname=16x16\${OPath}.png" "${RESOURCEDIR}\share\icons\Tango\16x16\${IPath}.png"
File "/oname=22x22\${OPath}.png" "${RESOURCEDIR}\share\icons\Tango\22x22\${IPath}.png"
File "/oname=32x32\${OPath}.png" "${RESOURCEDIR}\share\icons\Tango\32x32\${IPath}.png"
!macroend
!macro InstallTangoIconRename OPath IPath
!insertmacro InstallTangoIconRenameSmall ${OPath} ${IPath}
File "/oname=48x48\${OPath}.png" "${RESOURCEDIR}\share\icons\Tango\48x48\${IPath}.png"
File /nonfatal "/oname=64x64\${OPath}.png" "${RESOURCEDIR}\share\icons\Tango\64x64\${IPath}.png"
File /nonfatal "/oname=72x72\${OPath}.png" "${RESOURCEDIR}\share\icons\Tango\72x72\${IPath}.png"
File /nonfatal "/oname=96x96\${OPath}.png" "${RESOURCEDIR}\share\icons\Tango\96x96\${IPath}.png"
File /nonfatal "/oname=128x128\${OPath}.png" "${RESOURCEDIR}\share\icons\Tango\128x128\${IPath}.png"
File "/oname=scalable\${OPath}.svg" "${RESOURCEDIR}\share\icons\Tango\scalable\${IPath}.svg"
File /nonfatal "/oname=scalable\${OPath}.icon" "${RESOURCEDIR}\share\icons\Tango\scalable\${IPath}.icon"
!macroend
!macro InstallTangoIconSmall IconPath
!insertmacro InstallTangoIconRenameSmall ${IconPath} ${IconPath}
!macroend
!macro InstallTangoIcon IconPath
!insertmacro InstallTangoIconRename ${IconPath} ${IconPath}
!macroend
!macro CreateTangoSectionsSmall SectionPath
CreateDirectory "$INSTDIR\share\icons\Tango\16x16\${SectionPath}"
CreateDirectory "$INSTDIR\share\icons\Tango\22x22\${SectionPath}"
CreateDirectory "$INSTDIR\share\icons\Tango\32x32\${SectionPath}"
!macroend
!macro CreateTangoSections SectionPath
!insertmacro CreateTangoSectionsSmall ${SectionPath}
CreateDirectory "$INSTDIR\share\icons\Tango\48x48\${SectionPath}"
CreateDirectory "$INSTDIR\share\icons\Tango\64x64\${SectionPath}"
CreateDirectory "$INSTDIR\share\icons\Tango\72x72\${SectionPath}"
CreateDirectory "$INSTDIR\share\icons\Tango\96x96\${SectionPath}"
CreateDirectory "$INSTDIR\share\icons\Tango\128x128\${SectionPath}"
CreateDirectory "$INSTDIR\share\icons\Tango\scalable\${SectionPath}"
!macroend
Section "Tango icons" SEC07
SectionIn 1
SetOutPath "$INSTDIR\share\icons\Tango"
!insertmacro CreateTangoSections "actions"
!insertmacro CreateTangoSectionsSmall "animations"
!insertmacro CreateTangoSections "apps"
!insertmacro CreateTangoSections "categories"
!insertmacro CreateTangoSections "devices"
!insertmacro CreateTangoSections "emblems"
!insertmacro CreateTangoSections "emotes"
!insertmacro CreateTangoSections "mimetypes"
!insertmacro CreateTangoSections "places"
!insertmacro CreateTangoSections "status"
!insertmacro InstallTangoIcon "actions\gtk-add"
!insertmacro InstallTangoIcon "actions\gtk-bold"
!insertmacro InstallTangoIcon "actions\gtk-cancel"
!insertmacro InstallTangoIcon "actions\gtk-cancel"
!insertmacro InstallTangoIcon "actions\gtk-clear"
!insertmacro InstallTangoIcon "actions\gtk-copy"
!insertmacro InstallTangoIcon "actions\gtk-cut"
!insertmacro InstallTangoIcon "actions\gtk-delete"
!insertmacro InstallTangoIcon "actions\gtk-find"
!insertmacro InstallTangoIcon "actions\gtk-fullscreen"
!insertmacro InstallTangoIcon "actions\gtk-go-back-ltr"
!insertmacro InstallTangoIcon "actions\gtk-go-back-ltr"
!insertmacro InstallTangoIcon "actions\gtk-go-down"
!insertmacro InstallTangoIcon "actions\gtk-go-forward-ltr"
!insertmacro InstallTangoIcon "actions\gtk-go-forward-ltr"
!insertmacro InstallTangoIcon "actions\gtk-go-up"
!insertmacro InstallTangoIcon "actions\gtk-goto-first-ltr"
!insertmacro InstallTangoIcon "actions\gtk-goto-first-ltr"
!insertmacro InstallTangoIcon "actions\gtk-goto-last-ltr"
!insertmacro InstallTangoIcon "actions\gtk-goto-last-ltr"
!insertmacro InstallTangoIcon "actions\gtk-home"
!insertmacro InstallTangoIcon "actions\gtk-indent-ltr"
!insertmacro InstallTangoIcon "actions\gtk-indent-rtl"
!insertmacro InstallTangoIcon "actions\gtk-italic"
!insertmacro InstallTangoIcon "actions\gtk-jump-to-ltr"
!insertmacro InstallTangoIcon "actions\gtk-jump-to-ltr"
!insertmacro InstallTangoIcon "actions\gtk-media-next-ltr"
!insertmacro InstallTangoIcon "actions\gtk-media-next-rtl"
!insertmacro InstallTangoIcon "actions\gtk-media-previous-ltr"
!insertmacro InstallTangoIcon "actions\gtk-media-previous-rtl"
!insertmacro InstallTangoIcon "actions\gtk-open"
!insertmacro InstallTangoIcon "actions\gtk-paste"
!insertmacro InstallTangoIcon "actions\gtk-print"
!insertmacro InstallTangoIcon "actions\gtk-properties"
!insertmacro InstallTangoIcon "actions\gtk-redo-ltr"
!insertmacro InstallTangoIcon "actions\gtk-refresh"
!insertmacro InstallTangoIcon "actions\gtk-remove"
!insertmacro InstallTangoIcon "actions\gtk-save"
!insertmacro InstallTangoIcon "actions\gtk-save-as"
!insertmacro InstallTangoIcon "actions\gtk-select-all"
!insertmacro InstallTangoIcon "actions\gtk-stop"
!insertmacro InstallTangoIcon "actions\gtk-underline"
!insertmacro InstallTangoIcon "actions\gtk-undo-ltr"
!insertmacro InstallTangoIcon "actions\stock_add-bookmark"
!insertmacro InstallTangoIcon "actions\stock_new-tab"
!insertmacro InstallTangoIcon "actions\stock_new-window"
!insertmacro InstallTangoIconSmall "animations\process-working"
!insertmacro InstallTangoIcon "apps\gnome-settings-theme"
!insertmacro InstallTangoIcon "apps\gtk-help"
!insertmacro InstallTangoIcon "apps\terminal"
!insertmacro InstallTangoIcon "apps\web-browser"
!insertmacro InstallTangoIcon "categories\gtk-preferences"
#!insertmacro InstallTangoIcon "cookie-manager"
#!insertmacro InstallTangoIcon "document-open-recent"
#!insertmacro InstallTangoIcon "extention"
#!insertmacro InstallTangoIcon "feed-panel"
#!insertmacro InstallTangoIcon "gtk-about"
#!insertmacro InstallTangoIcon "gtk-close"
#!insertmacro InstallTangoIcon "gtk-convert"
#!insertmacro InstallTangoIcon "gtk-dialog-authentication"
#!insertmacro InstallTangoIcon "gtk-dnd-multiple"
#!insertmacro InstallTangoIcon "gtk-edit"
#!insertmacro InstallTangoIcon "gtk-execute"
#!insertmacro InstallTangoIcon "gtk-file"
#!insertmacro InstallTangoIcon "gtk-index"
#!insertmacro InstallTangoIcon "gtk-info"
#!insertmacro InstallTangoIcon "gtk-ok"
#!insertmacro InstallTangoIcon "gtk-orientation-portait"
#!insertmacro InstallTangoIcon "gtk-quit"
#!insertmacro InstallTangoIcon "gtk-select-color"
#!insertmacro InstallTangoIcon "gtk-select-font"
#!insertmacro InstallTangoIcon "gtk-sort-ascending"
#!insertmacro InstallTangoIcon "gtk-spell-check"
#!insertmacro InstallTangoIcon "gtk-undelete"
#!insertmacro InstallTangoIcon "gtk-yes"
#!insertmacro InstallTangoIcon "gtk-zoom-100"
#!insertmacro InstallTangoIcon "gtk-zoom-in"
#!insertmacro InstallTangoIcon "gtk-zoom-out"
!insertmacro InstallTangoIcon "mimetypes\gnome-mime-application-x-shockwave-flash"
!insertmacro InstallTangoIcon "mimetypes\gnome-mime-image"
!insertmacro InstallTangoIcon "mimetypes\package"
!insertmacro InstallTangoIcon "mimetypes\stock_script"
!insertmacro InstallTangoIcon "mimetypes\vcard"
#!insertmacro InstallTangoIcon "news-feed"
#!insertmacro InstallTangoIcon "place-holder"
!insertmacro InstallTangoIcon "places\gnome-stock-trash"
!insertmacro InstallTangoIcon "places\gtk-directory"
!insertmacro InstallTangoIcon "places\gtk-network"
!insertmacro InstallTangoIcon "status\gtk-dialog-error"
!insertmacro InstallTangoIcon "status\gtk-dialog-info"
!insertmacro InstallTangoIcon "status\gtk-dialog-warning"
!insertmacro InstallTangoIcon "status\gtk-missing-image"
!insertmacro InstallTangoIcon "status\network-offline"
#!insertmacro InstallTangoIcon "stock_bookmark"
#!insertmacro InstallTangoIcon "stock_mail-send"
#!insertmacro InstallTangoIcon "tab-panel"
SectionEnd
Section "Desktop Shortcuts" SEC03
SectionIn 1
CreateShortCut "$DESKTOP\Midori.lnk" "${PRODUCT_EXE}"
CreateShortCut "$QUICKLAUNCH\Midori.lnk" "${PRODUCT_EXE}"
SectionEnd
Section "Default Browser" SEC05
SectionIn 1
StrCpy $DefaultBrowser "yes"
SectionEnd
Section -AdditionalIcons
SetOutPath $INSTDIR
!insertmacro MUI_STARTMENU_WRITE_BEGIN ${PRODUCT_NAME}
WriteIniStr "$INSTDIR\Website.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Website.lnk" "${PRODUCT_EXE}" \
"${PRODUCT_WEB_SITE}" "${PRODUCT_EXE}"
CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Uninstall.lnk" "${UNINSTALL_EXE}"
CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Make Default.lnk" "${UNINSTALL_EXE}" \
"/S /MAKEDEFAULT" "${PRODUCT_EXE}"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
Section -Post
WriteUninstaller "${UNINSTALL_EXE}"
WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" Path "$INSTDIR"
WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "StartMenu" "$SMPROGRAMS\$StartmenuFolder"
${if} $Answer == "yes" ; if user is admin
WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString" "${UNINSTALL_EXE}"
WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayIcon" "${PRODUCT_EXE}"
WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "URLUpdateInfo" "${PRODUCT_WEB_SITE}"
WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoModify" 0x00000001
WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoRepair" 0x00000001
WriteRegStr HKLM "${PRODUCT_BROWER_KEY}\MIDORI.EXE" "" "${PRODUCT_NAME}"
WriteRegStr HKLM "${PRODUCT_BROWER_KEY}\MIDORI.EXE\DefaultIcon" "" "${PRODUCT_EXE},0"
WriteRegStr HKLM "${PRODUCT_BROWER_KEY}\MIDORI.EXE\shell\open\command" "" "${PRODUCT_EXE}"
WriteRegStr HKLM "${PRODUCT_BROWER_KEY}\MIDORI.EXE\InstallInfo" "HideIconsCommand" '"${UNINSTALL_EXE}" /S /HIDE'
WriteRegDWORD HKLM "${PRODUCT_BROWER_KEY}\MIDORI.EXE\InstallInfo" "IconsVisible" 0x00000000
WriteRegStr HKLM "${PRODUCT_BROWER_KEY}\MIDORI.EXE\InstallInfo" "ReinstallCommand" '"${UNINSTALL_EXE}" /S /MAKEDEFAULT'
WriteRegStr HKLM "${PRODUCT_BROWER_KEY}\MIDORI.EXE\InstallInfo" "ShowIconsCommand" '"${UNINSTALL_EXE}" /S /SHOW'
${endif}
${if} $DefaultBrowser == "yes"
${if} $Answer == "yes" ; if user is admin
WriteRegDWORD HKLM "${PRODUCT_BROWER_KEY}\MIDORI.EXE\InstallInfo" "IconsVisible" 0x00000001
${endif}
WriteRegStr HKCU "${PRODUCT_BROWER_KEY}" "" "MIDORI.EXE"
WriteRegStr HKCR "http\DefaultIcon" "" "${PRODUCT_EXE},0"
WriteRegStr HKCR "http\shell\open\command" "" '${PRODUCT_EXE} "%1"'
WriteRegStr HKCR "https\DefaultIcon" "" "${PRODUCT_EXE},0"
WriteRegStr HKCR "https\shell\open\command" "" '${PRODUCT_EXE} "%1"'
${endif}
SectionEnd
Section Uninstall
Delete "$INSTDIR\Website.url"
Delete "${UNINSTALL_EXE}"
Delete "$INSTDIR\COPYING"
Delete "$INSTDIR\AUTHORS"
Delete "$INSTDIR\Midori.lnk"
; delete start menu entry
ReadRegStr $0 SHCTX "${PRODUCT_UNINST_KEY}" "StartMenu"
RMDir /r "$0"
Delete "$QUICKLAUNCH\Midori.lnk"
Delete "$DESKTOP\Midori.lnk"
RMDir /r "$INSTDIR\bin"
RMDir /r "$INSTDIR\etc"
RMDir /r "$INSTDIR\lib"
RMDir /r "$INSTDIR\share"
RMDir "$INSTDIR"
DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKCU "${PRODUCT_UNINST_KEY}"
DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
DeleteRegKey HKCU "${PRODUCT_DIR_REGKEY}"
DeleteRegKey HKLM "${PRODUCT_BROWER_KEY}\MIDORI.EXE"
SetAutoClose true
SectionEnd
;;;;;;;;;;;;;;;;;;;;;;;;;
; Section descriptions ;
;;;;;;;;;;;;;;;;;;;;;;;;;
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "Required program files. You cannot skip these files."
!insertmacro MUI_DESCRIPTION_TEXT ${SEC02} "Various translations of Midori's interface."
!insertmacro MUI_DESCRIPTION_TEXT ${SEC03} "Create shortcuts for Midori on the desktop and in the Quicklaunch Bar"
!insertmacro MUI_DESCRIPTION_TEXT ${SEC04} "Available plugins like 'Advertisement Blocker', 'Form history filler' and 'Mouse Gestures'."
!insertmacro MUI_DESCRIPTION_TEXT ${SEC05} "Make Midori the default browser."
!insertmacro MUI_DESCRIPTION_TEXT ${SEC06} "User manual of the Midori application."
!insertmacro MUI_DESCRIPTION_TEXT ${SEC07} "Better looking icons from the Tango icon theme."
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;;;;;;;;;;;;;;;;;;;;;
; helper functions ;
;;;;;;;;;;;;;;;;;;;;;
; (from http://jabref.svn.sourceforge.net/viewvc/jabref/trunk/jabref/src/windows/nsis/setup.nsi)
!macro IsUserAdmin Result UName
ClearErrors
UserInfo::GetName
IfErrors Win9x
Pop $0
StrCpy ${UName} $0
UserInfo::GetAccountType
Pop $1
${if} $1 == "Admin"
StrCpy ${Result} "yes"
${else}
StrCpy ${Result} "no"
${endif}
Goto done
Win9x:
StrCpy ${Result} "yes"
done:
!macroend
; (from http://nsis.sourceforge.net/GetOptions)
Function un.GetOptions
!define GetOptions `!insertmacro GetOptionsCall`
!macro GetOptionsCall _PARAMETERS _OPTION _RESULT
Push `${_PARAMETERS}`
Push `${_OPTION}`
Call un.GetOptions
Pop ${_RESULT}
!macroend
Exch $1
Exch
Exch $0
Exch
Push $2
Push $3
Push $4
Push $5
Push $6
Push $7
ClearErrors
StrCpy $2 $1 '' 1
StrCpy $1 $1 1
StrLen $3 $2
StrCpy $7 0
begin:
StrCpy $4 -1
StrCpy $6 ''
quote:
IntOp $4 $4 + 1
StrCpy $5 $0 1 $4
StrCmp $5$7 '0' notfound
StrCmp $5 '' trimright
StrCmp $5 '"' 0 +7
StrCmp $6 '' 0 +3
StrCpy $6 '"'
goto quote
StrCmp $6 '"' 0 +3
StrCpy $6 ''
goto quote
StrCmp $5 `'` 0 +7
StrCmp $6 `` 0 +3
StrCpy $6 `'`
goto quote
StrCmp $6 `'` 0 +3
StrCpy $6 ``
goto quote
StrCmp $5 '`' 0 +7
StrCmp $6 '' 0 +3
StrCpy $6 '`'
goto quote
StrCmp $6 '`' 0 +3
StrCpy $6 ''
goto quote
StrCmp $6 '"' quote
StrCmp $6 `'` quote
StrCmp $6 '`' quote
StrCmp $5 $1 0 quote
StrCmp $7 0 trimleft trimright
trimleft:
IntOp $4 $4 + 1
StrCpy $5 $0 $3 $4
StrCmp $5 '' notfound
StrCmp $5 $2 0 quote
IntOp $4 $4 + $3
StrCpy $0 $0 '' $4
StrCpy $4 $0 1
StrCmp $4 ' ' 0 +3
StrCpy $0 $0 '' 1
goto -3
StrCpy $7 1
goto begin
trimright:
StrCpy $0 $0 $4
StrCpy $4 $0 1 -1
StrCmp $4 ' ' 0 +3
StrCpy $0 $0 -1
goto -3
StrCpy $3 $0 1
StrCpy $4 $0 1 -1
StrCmp $3 $4 0 end
StrCmp $3 '"' +3
StrCmp $3 `'` +2
StrCmp $3 '`' 0 end
StrCpy $0 $0 -1 1
goto end
notfound:
SetErrors
StrCpy $0 ''
end:
Pop $7
Pop $6
Pop $5
Pop $4
Pop $3
Pop $2
Pop $1
Exch $0
FunctionEnd
Function .onInit
StrCpy "$StartmenuFolder" "Midori"
; (from http://jabref.svn.sourceforge.net/viewvc/jabref/trunk/jabref/src/windows/nsis/setup.nsi)
; If the user does *not* have administrator privileges, abort
StrCpy $Answer ""
StrCpy $UserName ""
!insertmacro IsUserAdmin $Answer $UserName ; macro from LyXUtils.nsh
${if} $Answer == "yes"
SetShellVarContext all ; set that e.g. shortcuts will be created for all users
${else}
SetShellVarContext current
; TODO is this really what we want? $PROGRAMFILES is not much better because
; probably the unprivileged user can't write it anyways
StrCpy $INSTDIR "$PROFILE\$(^Name)"
${endif}
; prevent running multiple instances of the installer
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "midori_installer") i .r1 ?e'
Pop $R0
StrCmp $R0 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running." /SD IDOK
Abort
; warn about a new install over an existing installation
ReadRegStr $R0 SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString"
StrCmp $R0 "" finish
MessageBox MB_YESNO|MB_ICONEXCLAMATION \
"Midori has already been installed. $\nDo you want to remove the previous version before installing $(^Name) ?" \
/SD IDYES IDYES remove IDNO finish
remove:
; run the uninstaller
ClearErrors
; we read the installation path of the old installation from the Registry
ReadRegStr $UNINSTDIR SHCTX "${PRODUCT_DIR_REGKEY}" "Path"
IfSilent dosilent nonsilent
dosilent:
ExecWait '$R0 /S _?=$UNINSTDIR' ;Do not copy the uninstaller to a temp file
Goto finish
nonsilent:
ExecWait '$R0 _?=$UNINSTDIR' ;Do not copy the uninstaller to a temp file
finish:
FunctionEnd
Function un.onInit
StrCpy $Answer ""
!insertmacro IsUserAdmin $Answer $UserName
${if} $Answer == "yes"
SetShellVarContext all
${else}
SetShellVarContext current
${endif}
${GetOptions} "$CMDLINE" "/MAKEDEFAULT" $0
IfErrors 0 +2
goto makedefault_next
WriteRegStr HKCU "${PRODUCT_BROWER_KEY}" "" "MIDORI.EXE"
WriteRegStr HKCR "http\DefaultIcon" "" "${PRODUCT_EXE},0"
WriteRegStr HKCR "http\shell\open\command" "" '${PRODUCT_EXE} "%1"'
WriteRegStr HKCR "https\DefaultIcon" "" "${PRODUCT_EXE},0"
WriteRegStr HKCR "https\shell\open\command" "" '${PRODUCT_EXE} "%1"'
Abort
makedefault_next:
${GetOptions} "$CMDLINE" "/SHOW" $0
IfErrors 0 +2
goto show_next
${if} $Answer == "yes" ; if user is admin
WriteRegDWORD HKLM "${PRODUCT_BROWER_KEY}\MIDORI.EXE\InstallInfo" "IconsVisible" 0x00000001
${endif}
CreateShortCut "$DESKTOP\Midori.lnk" "${PRODUCT_EXE}"
CreateShortCut "$QUICKLAUNCH\Midori.lnk" "${PRODUCT_EXE}"
Abort
show_next:
${GetOptions} "$CMDLINE" "/HIDE" $0
IfErrors 0 +2
goto hide_next
${if} $Answer == "yes" ; if user is admin
WriteRegDWORD HKLM "${PRODUCT_BROWER_KEY}\MIDORI.EXE\InstallInfo" "IconsVisible" 0x00000000
${endif}
Delete "$QUICKLAUNCH\Midori.lnk"
Delete "$DESKTOP\Midori.lnk"
Abort
hide_next:
; If the user does *not* have administrator privileges, abort
${if} $Answer != "yes"
; check if the Midori has been installed with admin permisions
ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "Publisher"
${if} $0 != ""
MessageBox MB_OK|MB_ICONSTOP "You need administrator privileges to uninstall Midori!" \
/SD IDOK
Abort
${endif}
${endif}
FunctionEnd
Function OnDirLeave
ClearErrors
SetOutPath "$INSTDIR" ; what about IfError creating $INSTDIR?
GetTempFileName $1 "$INSTDIR" ; creates tmp file (or fails)
FileOpen $0 "$1" "w" ; error to open?
FileWriteByte $0 "0"
IfErrors notPossible possible
notPossible:
RMDir "$INSTDIR" ; removes folder if empty
MessageBox MB_OK "The given directory is not writeable. Please choose another one!" /SD IDOK
Abort
possible:
FileClose $0
Delete "$1"
FunctionEnd

View file

@ -0,0 +1,20 @@
#!/bin/sh
# Copyright (C) 2010-2011 Peter de Ridder <peter@xfce.org>
#
# 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.
export MINGW_PREFIX=~/dev/mingw/ming32
export PATH=$MINGW_PREFIX/bin:$PATH
export PKG_CONFIG_PATH=$MINGW_PREFIX/lib/pkgconfig
export PKG_CONFIG_LIBDIR=
export MINGW_BUILD=`gcc -dumpmachine`
export MINGW_TARGET=i386-mingw32
CC=i386-mingw32-gcc ./configure --prefix=$MINGW_PREFIX $@

View file

@ -0,0 +1,88 @@
#!/bin/sh
# Copyright (C) 2010-2011 Peter de Ridder <peter@xfce.org>
#
# 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.
# config variables
REPO_URL=http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_11.2
REPO_ARCH=noarch
DOWNLOAD_PATH=~/dev/mingw/packages/opensuse
BUILD_PATH=~/tmp/opensuse
INSTALL_PATH=~/dev/mingw/mingw32
if [[ "$1" == "update" ]]
then
UPDATE=yes
fi
# create download and build directory
mkdir -p $DOWNLOAD_PATH
mkdir -p $BUILD_PATH
rm $DOWNLOAD_PATH/repomd.xml
wget -nc $REPO_URL/repodata/repomd.xml -P $DOWNLOAD_PATH || exit 1
OTHER_FILE=`xmlgrep -c -f $DOWNLOAD_PATH/repomd.xml repomd.data:type=other.location | sed 's/.*href="\([^"]*\)".*/\1/'`
wget -nc $REPO_URL/$OTHER_FILE -O $DOWNLOAD_PATH/other.xml.gz || exit 1
rm $DOWNLOAD_PATH/other.xml
#gunzip -N $DOWNLOAD_PATH/`basename $OTHER_FILE`
gunzip -N $DOWNLOAD_PATH/other.xml
rm packages.version
touch packages.version
# downlaod all packages
while read line
do
VERSION=`xmlgrep -c -f $DOWNLOAD_PATH/other.xml otherdata.package:name="$line":arch="$REPO_ARCH" | awk -F\< '{print $2}' |sed -e 'h' -e 's/^.*ver="\([^"]*\)".*$/\1/p' -e 'g' -e 's/^.*rel="\([^"]*\)".*$/\1/' | sed -e N -e 's/\n/-/' | sort -V -r | head -n 1`
FILE=$line-$VERSION.$REPO_ARCH.rpm
test "$UPDATE" == yes || echo $FILE >> packages.version
if [ ! -f $DOWNLOAD_PATH/$FILE ]
then
test "$UPDATE" == yes && echo $FILE >> packages.version
wget -nc $REPO_URL/$REPO_ARCH/$FILE -P $DOWNLOAD_PATH
fi
done < packages.list
# convert and install packages
while read line
do
pushd $BUILD_PATH
# extract rpm
rpm2cpio $DOWNLOAD_PATH/$line | cpio -i -d
if [ -d $BUILD_PATH/usr/i686-pc-ming32/sys-root/mingw ]
then
# convert pkgconfig files
if [ -d $BUILD_PATH/usr/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig ]
then
sed -i -e 's@^prefix=.*@prefix='$INSTALL_PATH'@' -e 's@/usr/i686-pc-mingw32/sys-root/mingw@${prefix}@' $BUILD_PATH/usr/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig/*.pc
fi
# install the package
cp -rf $BUILD_PATH/usr/i686-pc-mingw32/sys-root/mingw/* $INSTALL_PATH/
fi
if [ -d $BUILD_PATH/usr/i686-w64-mingw32/sys-root/mingw ]
then
# convert pkgconfig files
if [ -d $BUILD_PATH/usr/i686-w64=mingw32/sys-root/mingw/lib/pkgconfig ]
then
sed -i -e 's@^prefix=.*@prefix='$INSTALL_PATH'@' -e 's@/usr/i686-w64-mingw32/sys-root/mingw@${prefix}@' $BUILD_PATH/usr/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig/*.pc
fi
# install the package
cp -rf $BUILD_PATH/usr/i686-w64-mingw32/sys-root/mingw/* $INSTALL_PATH/
fi
# remove the extracted file
rm -rf $BUILD_PATH/usr
popd
done < packages.version
# remove build directory
rm -rf $BUILD_PATH

View file

@ -0,0 +1,79 @@
This file is licensed under the terms of the LGPL 2.1, see the file COPYING.
mingw32-atk
mingw32-atk-devel
mingw32-cairo-devel
mingw32-dbus-1
mingw32-dbus-1-glib
mingw32-dbus-1-glib-devel
mingw32-enchant
mingw32-enchant-devel
mingw32-fontconfig
mingw32-fontconfig-devel
mingw32-freetype
mingw32-freetype-devel
mingw32-gcc-c++
mingw32-gcc
mingw32-gdk-pixbuf
mingw32-gdk-pixbuf-devel
mingw32-gettext-runtime
mingw32-gettext-tools
mingw32-glib2
mingw32-glib2-devel
mingw32-gst-plugins-base-devel
mingw32-gstreamer-devel
mingw32-gtk2
mingw32-gtk2-devel
mingw32-hunspell
mingw32-hunspell-devel
mingw32-libexpat
mingw32-libexpat-devel
mingw32-libgcc
mingw32-libgcrypt
mingw32-libgcrypt-devel
mingw32-libcairo2
mingw32-libgeoclue
mingw32-libgeoclue-devel
mingw32-libgnutls
mingw32-libgnutls-devel
mingw32-libgpg-error
mingw32-libgpg-error-devel
mingw32-libgstinterfaces
mingw32-libgstreamer
mingw32-libidn
mingw32-libidn-devel
mingw32-libjasper
mingw32-libjasper-devel
mingw32-libjpeg
mingw32-libjpeg-devel
mingw32-libopenssl
mingw32-libopenssl-devel
mingw32-libpng
mingw32-libpng-devel
mingw32-libsoup
mingw32-libsoup-devel
mingw32-libstdc++
mingw32-libsqlite
mingw32-libsqlite-devel
mingw32-libtasn1
mingw32-libtasn1-devel
mingw32-libtiff
mingw32-libtiff-devel
mingw32-libwebkit
mingw32-libwebkit-devel
mingw32-libxml2
mingw32-libxml2-devel
mingw32-libxslt
mingw32-libxslt-devel
mingw32-pango
mingw32-pango-devel
mingw32-pixman
mingw32-pixman-devel
mingw32-pthreads
mingw32-pthreads-devel
mingw32-shared-mime-info
mingw32-shared-mime-info-devel
mingw32-win_iconv
mingw32-win_iconv-devel
mingw32-zlib
mingw32-zlib-devel

View file

@ -29,7 +29,7 @@ from Configure import find_program_impl
major = 0
minor = 3
micro = 3
micro = 5
APPNAME = 'midori'
VERSION = str (major) + '.' + str (minor) + '.' + str (micro)
@ -209,6 +209,7 @@ def configure (conf):
check_pkg ('libsoup-2.4', '2.27.90', False, var='LIBSOUP_2_27_90')
check_pkg ('libsoup-2.4', '2.29.3', False, var='LIBSOUP_2_29_3')
check_pkg ('libsoup-2.4', '2.29.91', False, var='LIBSOUP_2_29_91')
conf.define ('LIBSOUP_VERSION', conf.check_cfg (modversion='libsoup-2.4'))
check_pkg ('libxml-2.0', '2.6')
check_pkg ('sqlite3', '3.0', True, var='SQLITE')
@ -465,7 +466,6 @@ def build (bld):
bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/error.html')
bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/speeddial-head.html')
bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/speeddial.json')
bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/mootools.js')
if bld.env['addons']: