Imported Upstream version 0.2.6
This commit is contained in:
parent
9eaa210044
commit
8c2cf594c8
85 changed files with 29957 additions and 14985 deletions
7
.lock-wscript
Normal file
7
.lock-wscript
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
argv = ['./waf', '--nocache', 'configure', '--prefix', '/usr']
|
||||||
|
blddir = '/server/home/ryan52/projects/deb/midori/midori/_build_'
|
||||||
|
commands = {'dist': 0, 'configure': True, 'distcheck': 0, 'install': 0, 'build': 0, 'clean': 0, 'distclean': 0, 'check': 0, 'uninstall': 0}
|
||||||
|
files = []
|
||||||
|
hash = 0
|
||||||
|
options = {'enable_apidocs': False, 'disable_hildon': True, 'force': False, 'verbose': 0, 'SHAREDSTATEDIR': '', 'destdir': '', 'disable_libidn': False, 'zones': '', 'enable_libidn': False, 'prefix': '/usr', 'run': False, 'enable_libnotify': False, 'disable_sqlite': False, 'enable_addons': False, 'blddir': '', 'compile_targets': '', 'INFODIR': '', 'nocache': True, 'progress_bar': 0, 'EXEC_PREFIX': '', 'disable_apidocs': True, 'LOCALSTATEDIR': '', 'disable_libnotify': False, 'datadir': '', 'INCLUDEDIR': '', 'build': None, 'LIBEXECDIR': '', 'MANDIR': '', 'PSDIR': '', 'BINDIR': '', 'enable_hildon': False, 'enable_unique': False, 'DOCDIR': '', 'SYSCONFDIR': '', 'jobs': 2, 'DATAROOTDIR': '', 'disable_userdocs': False, 'PDFDIR': '', 'DATADIR': '', 'LIBDIR': '', 'SBINDIR': '', 'disable_docs': False, 'enable_sqlite': False, 'srcdir': '', 'enable_nls': False, 'want_rpath': 1, 'disable_unique': False, 'enable_userdocs': False, 'disable_addons': False, 'disable_maintainer_mode': None, 'debug_level': '', 'HTMLDIR': '', 'LOCALEDIR': '', 'keep': False, 'disable_nls': False, 'enable_docs': False, 'update_po': False, 'DVIDIR': '', 'check_c_compiler': 'gcc icc suncc', 'OLDINCLUDEDIR': ''}
|
||||||
|
srcdir = '/server/home/ryan52/projects/deb/midori/midori'
|
38
ChangeLog
38
ChangeLog
|
@ -1,5 +1,43 @@
|
||||||
This file is licensed under the terms of the expat license, see the file EXPAT.
|
This file is licensed under the terms of the expat license, see the file EXPAT.
|
||||||
|
|
||||||
|
v0.2.6
|
||||||
|
+ Show a dialogue when quitting while downloading
|
||||||
|
+ Render icons in errors/ speed dial properly
|
||||||
|
+ Fix a build error with API documentation
|
||||||
|
+ Fix error pages in frames, and a related crash
|
||||||
|
+ Allow more shortcuts or columns in speed dial
|
||||||
|
+ Add 'Copy All' button to Console panel
|
||||||
|
|
||||||
|
v0.2.5
|
||||||
|
+ Keyboard access in speed dial
|
||||||
|
+ Panels adapt to system icon style
|
||||||
|
+ Revamp tab focus handling
|
||||||
|
+ Use new GTK+ 2.20 spinner (throbber) widget
|
||||||
|
+ Userscripts and -styles can be (de)activated
|
||||||
|
+ Warn if trying to download with few space
|
||||||
|
+ Support right button in Mouse Gestures
|
||||||
|
+ Add (unfinished) 'External Applications' extension
|
||||||
|
+ Vala support for extensions and tests
|
||||||
|
+ Yellow location for valid SSL, red for invalid
|
||||||
|
+ Render XML as source code
|
||||||
|
+ Provide tools/midori-dev and check-style scripts
|
||||||
|
+ Implement MIDORI_ADBLOCK for Adblock testing
|
||||||
|
+ Fix https URI support in Adblock
|
||||||
|
+ Change 'Autodetect proxy' into 'Proxy type'
|
||||||
|
+ Update use of deprecated GTK+ API
|
||||||
|
+ Implement --blocked-uris for kiosk usage
|
||||||
|
+ Implement --inactivity-reset for kiosk usage
|
||||||
|
+ Fix typing with dead keys and NumLock
|
||||||
|
+ Improve parsing in the Feed Panel
|
||||||
|
+ Add preference 'Allow scripts to open popups'
|
||||||
|
+ Spawn web apps and private mode with same executable
|
||||||
|
+ Base Colourful Tabs on icon colours
|
||||||
|
+ Add Status Clock extension
|
||||||
|
+ Resolve hosts before trying a search
|
||||||
|
+ Allow page icons for https
|
||||||
|
+ Improve handling of special pages
|
||||||
|
+ Protect against recursive external URI handlers
|
||||||
|
|
||||||
v0.2.4
|
v0.2.4
|
||||||
+ Prevent completion from overlapping
|
+ Prevent completion from overlapping
|
||||||
+ Fix tab order when restoring session
|
+ Fix tab order when restoring session
|
||||||
|
|
19
HACKING
19
HACKING
|
@ -1,6 +1,23 @@
|
||||||
This file is licensed under the terms of the expat license, see the file EXPAT.
|
This file is licensed under the terms of the expat license, see the file EXPAT.
|
||||||
|
|
||||||
+++ Hacking guide for Midori +++
|
+ Hacking guide for Midori +
|
||||||
|
|
||||||
|
- How to contribute
|
||||||
|
- Coding style
|
||||||
|
- Source files in the project
|
||||||
|
- Examplary source code
|
||||||
|
|
||||||
|
+++ How to contribute +++
|
||||||
|
|
||||||
|
There are several ways to contribute to the project:
|
||||||
|
|
||||||
|
For translating, have a look at the file TRANSLATE.
|
||||||
|
|
||||||
|
For helping with testing and triaging bug reports, you should registers with the bug tracker at http://www.twotoasts.de/bugs and join #midori on irc.freenode.net where a lot of problems are discussed. You can start right away by trying to reproduce bug reports and comment with your findings.
|
||||||
|
|
||||||
|
If you are interested in contributing code, there are a few options. You can join #midori to discuss a particular problem you would like to look into, or a feature you would want to implement. Opening a bug report or feature request if there isn't already one is the next step. To attract some attention, if you attached a patch or have questions, ask in #midori.
|
||||||
|
|
||||||
|
+++ Coding style +++
|
||||||
|
|
||||||
Indentation is 4 spaces, no tabs, preferrably at 80 to 120 columns per line to
|
Indentation is 4 spaces, no tabs, preferrably at 80 to 120 columns per line to
|
||||||
avoid automated line-breaks. Trailing whitespace is not desirable.
|
avoid automated line-breaks. Trailing whitespace is not desirable.
|
||||||
|
|
|
@ -68,12 +68,10 @@ description {
|
||||||
<h1>{title}</h1>
|
<h1>{title}</h1>
|
||||||
<p id="message">{message}</p>
|
<p id="message">{message}</p>
|
||||||
<p id="description">{description}</p>
|
<p id="description">{description}</p>
|
||||||
<form onsubmit="location.reload()">
|
<button onclick="location.reload()">
|
||||||
<button>
|
<img src="{stock}/gtk-refresh"/>
|
||||||
<img src="{stock}/gtk-refresh"/>
|
<span>{tryagain}</span>
|
||||||
<span>{tryagain}</span>
|
</button>
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
<br style="clear: both;"/>
|
<br style="clear: both;"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#content {
|
#content {
|
||||||
margin-top: 40px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.shortcut {
|
div.shortcut {
|
||||||
|
@ -119,7 +119,7 @@
|
||||||
margin-bottom: -17px;
|
margin-bottom: -17px;
|
||||||
margin-left: 180px;
|
margin-left: 180px;
|
||||||
margin-top: 2px;
|
margin-top: 2px;
|
||||||
background: url({stock}/16/gtk-close) 98% 70% no-repeat;
|
background: url({stock}/1/gtk-close) 98% 70% no-repeat;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
z-index: -4;
|
z-index: -4;
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
|
@ -131,7 +131,7 @@
|
||||||
|
|
||||||
.activated p {
|
.activated p {
|
||||||
cursor: text;
|
cursor: text;
|
||||||
background: url({stock}/16/gtk-edit) 98% 70% no-repeat;
|
background: url({stock}/1/gtk-edit) 98% 70% no-repeat;
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
color: rgba(0,0,0,1);
|
color: rgba(0,0,0,1);
|
||||||
}
|
}
|
||||||
|
@ -140,6 +140,20 @@
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
color: rgba(0,0,0,0.5);
|
color: rgba(0,0,0,0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.config {
|
||||||
|
padding: 12px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.config span {
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.config span:hover {
|
||||||
|
color: #999;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -167,7 +181,7 @@
|
||||||
a.setProperty('href', url);
|
a.setProperty('href', url);
|
||||||
a.getNext().set('text', name);
|
a.getNext().set('text', name);
|
||||||
|
|
||||||
var num = id.charAt (1) - 1;
|
var num = id.substr (1) - 1;
|
||||||
sc.shortcuts[num].title = name;
|
sc.shortcuts[num].title = name;
|
||||||
|
|
||||||
a.empty();
|
a.empty();
|
||||||
|
@ -204,7 +218,7 @@
|
||||||
var p = a.getNext ();
|
var p = a.getNext ();
|
||||||
p.setProperty('onclick', 'javascript:renameShortcut("' + id + '");');
|
p.setProperty('onclick', 'javascript:renameShortcut("' + id + '");');
|
||||||
|
|
||||||
var num = id.charAt (1) - 1;
|
var num = id.substr (1) - 1;
|
||||||
sc.shortcuts[num].href = href;
|
sc.shortcuts[num].href = href;
|
||||||
sc.shortcuts[num].img = data;
|
sc.shortcuts[num].img = data;
|
||||||
|
|
||||||
|
@ -216,7 +230,7 @@
|
||||||
var name = prompt ("{enter_shortcut_name}", "");
|
var name = prompt ("{enter_shortcut_name}", "");
|
||||||
if (!name) return;
|
if (!name) return;
|
||||||
|
|
||||||
var num = id.charAt (1) - 1;
|
var num = id.substr (1) - 1;
|
||||||
|
|
||||||
$(id).getLast ().set ('html', name);
|
$(id).getLast ().set ('html', name);
|
||||||
sc.shortcuts[num].title = name;
|
sc.shortcuts[num].title = name;
|
||||||
|
@ -229,7 +243,7 @@
|
||||||
if(!confirm("{are_you_sure}"))
|
if(!confirm("{are_you_sure}"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var num = id.charAt (1);
|
var num = id.substr (1);
|
||||||
var div = $(id);
|
var div = $(id);
|
||||||
var cross = div.getFirst ();
|
var cross = div.getFirst ();
|
||||||
var a = cross.getNext ();
|
var a = cross.getNext ();
|
||||||
|
@ -251,13 +265,20 @@
|
||||||
|
|
||||||
var buildSpeeddial = function ()
|
var buildSpeeddial = function ()
|
||||||
{
|
{
|
||||||
|
var width = 3;
|
||||||
|
if (sc.width)
|
||||||
|
{
|
||||||
|
width = sc.width;
|
||||||
|
$('wrap').style.width = (width * 220) + 'px';
|
||||||
|
}
|
||||||
|
|
||||||
sc.shortcuts.each (function (item, index, sc)
|
sc.shortcuts.each (function (item, index, sc)
|
||||||
{
|
{
|
||||||
var cl = "shortcut";
|
var cl = "shortcut";
|
||||||
|
|
||||||
if (index == 0 || index == 1 || index == 2)
|
if (index < width)
|
||||||
cl += " top";
|
cl += " top";
|
||||||
if (index == 2 || index == 5 || index == 8)
|
if ((index % width) == (width - 1))
|
||||||
cl += " right";
|
cl += " right";
|
||||||
|
|
||||||
var div = new Element ('div', {
|
var div = new Element ('div', {
|
||||||
|
@ -279,7 +300,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
if (item.href == "#")
|
if (item.href == "#")
|
||||||
a.set ('html', '<h1>' + item.id.charAt (1) + '</h1><h4><span/></h4>');
|
a.set ('html', '<h1>' + item.id.substr (1) + '</h1><h4><span/></h4>');
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
div.addClass ('activated');
|
div.addClass ('activated');
|
||||||
|
@ -298,12 +319,64 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var setWidth = function ()
|
||||||
|
{
|
||||||
|
var width = prompt ("{enter_dial_width}", "");
|
||||||
|
if (!width || isNaN (width)) return;
|
||||||
|
|
||||||
|
sc.width = width;
|
||||||
|
|
||||||
|
$('content').empty ();
|
||||||
|
buildSpeeddial ();
|
||||||
|
|
||||||
|
console.log ("speed_dial-save '" + encodeSafe (sc) + "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
var setCount = function ()
|
||||||
|
{
|
||||||
|
var count = prompt ("{enter_shortcut_count}", "");
|
||||||
|
if (!count || isNaN (count)) return;
|
||||||
|
|
||||||
|
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) + "'");
|
||||||
|
}
|
||||||
|
|
||||||
window.addEvent ('domready', function () {
|
window.addEvent ('domready', function () {
|
||||||
buildSpeeddial ();
|
buildSpeeddial ();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.onkeypress = function ()
|
||||||
|
{
|
||||||
|
var id = $('s' + String.fromCharCode (event.which));
|
||||||
|
|
||||||
|
if ($(id))
|
||||||
|
{
|
||||||
|
if (getAction (id))
|
||||||
|
document.location = $(id).children[1];
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div class="config">
|
||||||
|
<span onclick="javascript:setWidth()">{set_dial_width}</span>
|
||||||
|
<span onclick="javascript:setCount()">{set_shortcut_count}</span>
|
||||||
|
</div>
|
||||||
<div id="wrap">
|
<div id="wrap">
|
||||||
<div id="content">
|
<div id="content">
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
import pproc as subprocess
|
import pproc as subprocess
|
||||||
import os
|
import os
|
||||||
|
import Utils
|
||||||
|
|
||||||
for module in ('midori', 'katze'):
|
for module in ('midori', 'katze'):
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2009 Christian Dywan <christian@twotoasts.de>
|
Copyright (C) 2009-2010 Christian Dywan <christian@twotoasts.de>
|
||||||
Copyright (C) 2009 Alexander Butenko <a.butenka@gmail.com>
|
Copyright (C) 2009 Alexander Butenko <a.butenka@gmail.com>
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
|
@ -28,12 +28,25 @@
|
||||||
#define ADBLOCK_FILTER_VALID(__filter) \
|
#define ADBLOCK_FILTER_VALID(__filter) \
|
||||||
(__filter && (g_str_has_prefix (__filter, "http") \
|
(__filter && (g_str_has_prefix (__filter, "http") \
|
||||||
|| g_str_has_prefix (__filter, "file")))
|
|| g_str_has_prefix (__filter, "file")))
|
||||||
|
#define ADBLOCK_FILTER_SET(__filter,__active) \
|
||||||
|
filter[4] = __active ? (__filter[5] == ':' ? 's' : ':') : '-'
|
||||||
|
#define ADBLOCK_FILTER_IS_SET(__filter) \
|
||||||
|
filter[4] != '-'
|
||||||
|
#ifdef G_ENABLE_DEBUG
|
||||||
|
#define adblock_debug(dmsg, darg1, darg2) \
|
||||||
|
do { if (debug == 1) g_debug (dmsg, darg1, darg2); } while (0)
|
||||||
|
#else
|
||||||
|
#define adblock_debug(dmsg, darg1, darg2) /* nothing */
|
||||||
|
#endif
|
||||||
|
|
||||||
static GHashTable* pattern;
|
static GHashTable* pattern;
|
||||||
static GHashTable* keys;
|
static GHashTable* keys;
|
||||||
static gchar* blockcss = NULL;
|
static gchar* blockcss = NULL;
|
||||||
static gchar* blockcssprivate = NULL;
|
static gchar* blockcssprivate = NULL;
|
||||||
static gchar* blockscript = NULL;
|
static gchar* blockscript = NULL;
|
||||||
|
#ifdef G_ENABLE_DEBUG
|
||||||
|
static guint debug;
|
||||||
|
#endif
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
adblock_parse_file (gchar* path);
|
adblock_parse_file (gchar* path);
|
||||||
|
@ -83,6 +96,7 @@ adblock_init_db ()
|
||||||
katze_assign (blockcssprivate, g_strdup (""));
|
katze_assign (blockcssprivate, g_strdup (""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if WEBKIT_CHECK_VERSION (1, 1, 2)
|
||||||
static void
|
static void
|
||||||
adblock_download_notify_status_cb (WebKitDownload* download,
|
adblock_download_notify_status_cb (WebKitDownload* download,
|
||||||
GParamSpec* pspec,
|
GParamSpec* pspec,
|
||||||
|
@ -96,6 +110,7 @@ adblock_download_notify_status_cb (WebKitDownload* download,
|
||||||
g_free (path);
|
g_free (path);
|
||||||
/* g_object_unref (download); */
|
/* g_object_unref (download); */
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static gchar*
|
static gchar*
|
||||||
adblock_get_filename_for_uri (const gchar* uri)
|
adblock_get_filename_for_uri (const gchar* uri)
|
||||||
|
@ -152,6 +167,7 @@ adblock_reload_rules (MidoriExtension* extension,
|
||||||
|
|
||||||
if (!adblock_parse_file (path))
|
if (!adblock_parse_file (path))
|
||||||
{
|
{
|
||||||
|
#if WEBKIT_CHECK_VERSION (1, 1, 2)
|
||||||
WebKitNetworkRequest* request;
|
WebKitNetworkRequest* request;
|
||||||
WebKitDownload* download;
|
WebKitDownload* download;
|
||||||
gchar* destination = g_filename_to_uri (path, NULL, NULL);
|
gchar* destination = g_filename_to_uri (path, NULL, NULL);
|
||||||
|
@ -164,6 +180,7 @@ adblock_reload_rules (MidoriExtension* extension,
|
||||||
g_signal_connect (download, "notify::status",
|
g_signal_connect (download, "notify::status",
|
||||||
G_CALLBACK (adblock_download_notify_status_cb), path);
|
G_CALLBACK (adblock_download_notify_status_cb), path);
|
||||||
webkit_download_start (download);
|
webkit_download_start (download);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
g_free (path);
|
g_free (path);
|
||||||
|
@ -192,7 +209,7 @@ adblock_preferences_render_tick_cb (GtkTreeViewColumn* column,
|
||||||
|
|
||||||
g_object_set (renderer,
|
g_object_set (renderer,
|
||||||
"activatable", ADBLOCK_FILTER_VALID (filter),
|
"activatable", ADBLOCK_FILTER_VALID (filter),
|
||||||
"active", ADBLOCK_FILTER_VALID (filter) && filter[4] != '-',
|
"active", ADBLOCK_FILTER_VALID (filter) && ADBLOCK_FILTER_IS_SET (filter),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_free (filter);
|
g_free (filter);
|
||||||
|
@ -225,7 +242,7 @@ adblock_preferences_renderer_toggle_toggled_cb (GtkCellRendererToggle* renderer,
|
||||||
|
|
||||||
if (ADBLOCK_FILTER_VALID (filter))
|
if (ADBLOCK_FILTER_VALID (filter))
|
||||||
{
|
{
|
||||||
filter[4] = ':';
|
ADBLOCK_FILTER_SET (filter, TRUE);
|
||||||
if (gtk_cell_renderer_toggle_get_active (renderer))
|
if (gtk_cell_renderer_toggle_get_active (renderer))
|
||||||
{
|
{
|
||||||
if (!strncmp (filter, "http", 4))
|
if (!strncmp (filter, "http", 4))
|
||||||
|
@ -234,7 +251,7 @@ adblock_preferences_renderer_toggle_toggled_cb (GtkCellRendererToggle* renderer,
|
||||||
g_unlink (filename);
|
g_unlink (filename);
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
}
|
}
|
||||||
filter[4] = '-';
|
ADBLOCK_FILTER_SET (filter, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, filter, -1);
|
gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, filter, -1);
|
||||||
|
@ -256,7 +273,7 @@ adblock_preferences_render_text_cb (GtkTreeViewColumn* column,
|
||||||
gtk_tree_model_get (model, iter, 0, &filter, -1);
|
gtk_tree_model_get (model, iter, 0, &filter, -1);
|
||||||
|
|
||||||
if (ADBLOCK_FILTER_VALID (filter))
|
if (ADBLOCK_FILTER_VALID (filter))
|
||||||
filter[4] = ':';
|
ADBLOCK_FILTER_SET (filter, TRUE);
|
||||||
|
|
||||||
g_object_set (renderer,
|
g_object_set (renderer,
|
||||||
"text", filter,
|
"text", filter,
|
||||||
|
@ -609,7 +626,7 @@ adblock_is_matched_by_pattern (const gchar* req_uri,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* g_debug("blocked by pattern regexp=%s -- %s", g_regex_get_pattern (regex), req_uri); */
|
adblock_debug ("blocked by pattern regexp=%s -- %s", g_regex_get_pattern (regex), req_uri);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -646,7 +663,7 @@ adblock_is_matched_by_key (const gchar* opts,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* g_debug("blocked by key sig=%s regexp=%s -- %s", sig, g_regex_get_pattern (regex), req_uri); */
|
adblock_debug ("blocked by regexp=%s -- %s", g_regex_get_pattern (regex), uri);
|
||||||
g_list_free (regex_bl);
|
g_list_free (regex_bl);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -752,7 +769,10 @@ adblock_resource_request_starting_cb (WebKitWebView* web_view,
|
||||||
if (!page_uri || !strcmp (page_uri, "about:blank"))
|
if (!page_uri || !strcmp (page_uri, "about:blank"))
|
||||||
page_uri = req_uri;
|
page_uri = req_uri;
|
||||||
|
|
||||||
/* g_test_timer_start (); */
|
#ifdef G_ENABLE_DEBUG
|
||||||
|
if (debug == 2)
|
||||||
|
g_test_timer_start ();
|
||||||
|
#endif
|
||||||
/* TODO: opts should be defined */
|
/* TODO: opts should be defined */
|
||||||
if (adblock_is_matched (NULL, req_uri, page_uri))
|
if (adblock_is_matched (NULL, req_uri, page_uri))
|
||||||
{
|
{
|
||||||
|
@ -761,7 +781,10 @@ adblock_resource_request_starting_cb (WebKitWebView* web_view,
|
||||||
webkit_network_request_set_uri (request, "about:blank");
|
webkit_network_request_set_uri (request, "about:blank");
|
||||||
g_object_set_data (G_OBJECT (web_view), "blocked-uris", blocked_uris);
|
g_object_set_data (G_OBJECT (web_view), "blocked-uris", blocked_uris);
|
||||||
}
|
}
|
||||||
/* g_debug ("%f", g_test_timer_elapsed ()); */
|
#ifdef G_ENABLE_DEBUG
|
||||||
|
if (debug == 2)
|
||||||
|
g_debug ("match: %f%s", g_test_timer_elapsed (), "seconds");
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -907,13 +930,16 @@ adblock_load_finished_cb (WebKitWebView *web_view,
|
||||||
{
|
{
|
||||||
JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
|
JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
|
||||||
GList* uris = g_object_get_data (G_OBJECT (web_view), "blocked-uris");
|
GList* uris = g_object_get_data (G_OBJECT (web_view), "blocked-uris");
|
||||||
|
gchar* script;
|
||||||
|
GList* li;
|
||||||
|
|
||||||
if (g_list_nth_data (uris, 0) == NULL)
|
if (g_list_nth_data (uris, 0) == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gchar* script = adblock_prepare_urihider_js (uris);
|
script = adblock_prepare_urihider_js (uris);
|
||||||
webkit_web_view_execute_script (web_view, script);
|
webkit_web_view_execute_script (web_view, script);
|
||||||
sokoke_js_script_eval (js_context, script, NULL);
|
sokoke_js_script_eval (js_context, script, NULL);
|
||||||
GList* li = NULL;
|
li = NULL;
|
||||||
for (li = uris; li != NULL; li = g_list_next (li))
|
for (li = uris; li != NULL; li = g_list_next (li))
|
||||||
uris = g_list_remove (uris, li->data);
|
uris = g_list_remove (uris, li->data);
|
||||||
g_free (script);
|
g_free (script);
|
||||||
|
@ -935,7 +961,7 @@ adblock_add_tab_cb (MidoriBrowser* browser,
|
||||||
MidoriView* view,
|
MidoriView* view,
|
||||||
MidoriExtension* extension)
|
MidoriExtension* extension)
|
||||||
{
|
{
|
||||||
GtkWidget* web_view = gtk_bin_get_child (GTK_BIN (view));
|
GtkWidget* web_view = midori_view_get_web_view (view);
|
||||||
#if HAVE_WEBKIT_RESOURCE_REQUEST
|
#if HAVE_WEBKIT_RESOURCE_REQUEST
|
||||||
GtkWidget* image = g_object_get_data (G_OBJECT (browser), "status-image");
|
GtkWidget* image = g_object_get_data (G_OBJECT (browser), "status-image");
|
||||||
#endif
|
#endif
|
||||||
|
@ -1082,7 +1108,7 @@ adblock_compile_regexp (GHashTable* tbl,
|
||||||
if (!g_regex_match_simple ("[\\*]", sig, G_REGEX_UNGREEDY, G_REGEX_MATCH_NOTEMPTY) &&
|
if (!g_regex_match_simple ("[\\*]", sig, G_REGEX_UNGREEDY, G_REGEX_MATCH_NOTEMPTY) &&
|
||||||
!g_hash_table_lookup (keystbl, sig))
|
!g_hash_table_lookup (keystbl, sig))
|
||||||
{
|
{
|
||||||
/* g_debug ("sig: %s %s", sig, patt); */
|
adblock_debug ("sig: %s %s", sig, patt);
|
||||||
g_hash_table_insert (keystbl, sig, regex);
|
g_hash_table_insert (keystbl, sig, regex);
|
||||||
signature_count++;
|
signature_count++;
|
||||||
}
|
}
|
||||||
|
@ -1091,7 +1117,7 @@ adblock_compile_regexp (GHashTable* tbl,
|
||||||
if (g_regex_match_simple ("^\\*", sig, G_REGEX_UNGREEDY, G_REGEX_MATCH_NOTEMPTY) &&
|
if (g_regex_match_simple ("^\\*", sig, G_REGEX_UNGREEDY, G_REGEX_MATCH_NOTEMPTY) &&
|
||||||
!g_hash_table_lookup (tbl, opts))
|
!g_hash_table_lookup (tbl, opts))
|
||||||
{
|
{
|
||||||
/* g_debug ("patt2: %s %s", sig, patt); */
|
adblock_debug ("patt2: %s %s", sig, patt);
|
||||||
g_hash_table_insert (tbl, opts, regex);
|
g_hash_table_insert (tbl, opts, regex);
|
||||||
}
|
}
|
||||||
g_free (sig);
|
g_free (sig);
|
||||||
|
@ -1102,7 +1128,7 @@ adblock_compile_regexp (GHashTable* tbl,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*g_debug ("patt: %s", patt); */
|
adblock_debug ("patt: %s%s", patt, "");
|
||||||
/* Pattern is a regexp chars */
|
/* Pattern is a regexp chars */
|
||||||
g_hash_table_insert (tbl, opts, regex);
|
g_hash_table_insert (tbl, opts, regex);
|
||||||
}
|
}
|
||||||
|
@ -1139,7 +1165,7 @@ adblock_add_url_pattern (gchar* format,
|
||||||
fixed_patt = adblock_fixup_regexp (patt);
|
fixed_patt = adblock_fixup_regexp (patt);
|
||||||
format_patt = g_strdup_printf (format, fixed_patt);
|
format_patt = g_strdup_printf (format, fixed_patt);
|
||||||
|
|
||||||
/* g_debug ("got: %s opts %s", format_patt, opts); */
|
adblock_debug ("got: %s opts %s", format_patt, opts);
|
||||||
adblock_compile_regexp (pattern, keys, format_patt, opts);
|
adblock_compile_regexp (pattern, keys, format_patt, opts);
|
||||||
|
|
||||||
g_strfreev (data);
|
g_strfreev (data);
|
||||||
|
@ -1282,7 +1308,7 @@ adblock_deactivate_tabs (MidoriView* view,
|
||||||
MidoriBrowser* browser,
|
MidoriBrowser* browser,
|
||||||
MidoriExtension* extension)
|
MidoriExtension* extension)
|
||||||
{
|
{
|
||||||
GtkWidget* web_view = gtk_bin_get_child (GTK_BIN (view));
|
GtkWidget* web_view = midori_view_get_web_view (view);
|
||||||
#if HAVE_WEBKIT_RESOURCE_REQUEST
|
#if HAVE_WEBKIT_RESOURCE_REQUEST
|
||||||
GtkWidget* image = g_object_get_data (G_OBJECT (browser), "status-image");
|
GtkWidget* image = g_object_get_data (G_OBJECT (browser), "status-image");
|
||||||
#endif
|
#endif
|
||||||
|
@ -1332,6 +1358,9 @@ static void
|
||||||
adblock_activate_cb (MidoriExtension* extension,
|
adblock_activate_cb (MidoriExtension* extension,
|
||||||
MidoriApp* app)
|
MidoriApp* app)
|
||||||
{
|
{
|
||||||
|
#ifdef G_ENABLE_DEBUG
|
||||||
|
const gchar* debug_mode;
|
||||||
|
#endif
|
||||||
KatzeArray* browsers;
|
KatzeArray* browsers;
|
||||||
MidoriBrowser* browser;
|
MidoriBrowser* browser;
|
||||||
guint i;
|
guint i;
|
||||||
|
@ -1342,6 +1371,19 @@ adblock_activate_cb (MidoriExtension* extension,
|
||||||
G_CALLBACK (adblock_session_request_queued_cb), NULL);
|
G_CALLBACK (adblock_session_request_queued_cb), NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef G_ENABLE_DEBUG
|
||||||
|
debug_mode = g_getenv ("MIDORI_ADBLOCK");
|
||||||
|
if (debug_mode)
|
||||||
|
{
|
||||||
|
if (*debug_mode == '1')
|
||||||
|
debug = 1;
|
||||||
|
else if (*debug_mode == '2')
|
||||||
|
debug = 2;
|
||||||
|
else
|
||||||
|
debug = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
adblock_reload_rules (extension, FALSE);
|
adblock_reload_rules (extension, FALSE);
|
||||||
|
|
||||||
browsers = katze_object_get_object (app, "browsers");
|
browsers = katze_object_get_object (app, "browsers");
|
||||||
|
|
1262
extensions/addons.c
Normal file
1262
extensions/addons.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2009 Christian Dywan <christian@twotoasts.de>
|
Copyright (C) 2009 Christian Dywan <christian@twotoasts.de>
|
||||||
|
Copyright (C) 2010 Samuel Creshal <creshal@arcor.de>
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -11,56 +12,118 @@
|
||||||
|
|
||||||
#include <midori/midori.h>
|
#include <midori/midori.h>
|
||||||
|
|
||||||
|
static void
|
||||||
|
colorful_tabs_modify_fg (GtkWidget* child,
|
||||||
|
GdkColor* color)
|
||||||
|
{
|
||||||
|
if (GTK_IS_LABEL (child))
|
||||||
|
{
|
||||||
|
gtk_widget_modify_fg (child, GTK_STATE_ACTIVE, color);
|
||||||
|
gtk_widget_modify_fg (child, GTK_STATE_NORMAL, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
colorful_tabs_view_notify_uri_cb (MidoriView* view,
|
colorful_tabs_view_notify_uri_cb (MidoriView* view,
|
||||||
GParamSpec* pspec,
|
GParamSpec* pspec,
|
||||||
MidoriExtension* extension)
|
MidoriExtension* extension)
|
||||||
{
|
{
|
||||||
|
GtkWidget* box;
|
||||||
GtkWidget* label;
|
GtkWidget* label;
|
||||||
SoupURI* uri;
|
SoupURI* uri;
|
||||||
gchar* hash;
|
|
||||||
gchar* colorstr;
|
gchar* colorstr;
|
||||||
GdkColor color;
|
GdkColor color;
|
||||||
|
GdkColor fgcolor;
|
||||||
|
GdkPixbuf* icon;
|
||||||
|
|
||||||
label = midori_view_get_proxy_tab_label (view);
|
label = midori_view_get_proxy_tab_label (view);
|
||||||
|
|
||||||
/* Find a color that is unique to an address. We merely compute
|
if ((uri = soup_uri_new (midori_view_get_display_uri (view)))
|
||||||
a hash value, pick the first 6 + 1 characters and turn the
|
&& uri->host && (katze_object_get_enum (view, "load-status") == MIDORI_LOAD_FINISHED))
|
||||||
first into a hash sign, ie. #8b424b. In case a color is too
|
|
||||||
dark, we lighten it up a litte. Finally we make the event box
|
|
||||||
visible and modify its background. */
|
|
||||||
|
|
||||||
if ((uri = soup_uri_new (midori_view_get_display_uri (view))) && uri->host)
|
|
||||||
{
|
{
|
||||||
hash = g_compute_checksum_for_string (G_CHECKSUM_MD5, uri->host, -1);
|
icon = midori_view_get_icon (view);
|
||||||
|
|
||||||
|
if (midori_view_get_icon_uri (view) != NULL)
|
||||||
|
{
|
||||||
|
GdkPixbuf* newpix;
|
||||||
|
guchar* pixels;
|
||||||
|
|
||||||
|
newpix = gdk_pixbuf_scale_simple (icon, 1, 1, GDK_INTERP_BILINEAR);
|
||||||
|
g_return_if_fail (gdk_pixbuf_get_bits_per_sample (newpix) == 8);
|
||||||
|
pixels = gdk_pixbuf_get_pixels (newpix);
|
||||||
|
color.red = pixels[0] * 225;
|
||||||
|
color.green = pixels[1] * 225;
|
||||||
|
color.blue = pixels[2] * 225;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gchar* hash = g_compute_checksum_for_string (G_CHECKSUM_MD5, uri->host, 1);
|
||||||
|
colorstr = g_strndup (hash, 6 + 1);
|
||||||
|
g_free (hash);
|
||||||
|
colorstr[0] = '#';
|
||||||
|
gdk_color_parse (colorstr, &color);
|
||||||
|
}
|
||||||
soup_uri_free (uri);
|
soup_uri_free (uri);
|
||||||
colorstr = g_strndup (hash, 6 + 1);
|
|
||||||
g_free (hash);
|
if ((color.red < 35000)
|
||||||
colorstr[0] = '#';
|
&& (color.green < 35000)
|
||||||
gdk_color_parse (colorstr, &color);
|
&& (color.blue < 35000))
|
||||||
if (color.red < 35000)
|
{
|
||||||
color.red += 25000 + (color.blue + 1) / 2;
|
color.red += 20000;
|
||||||
if (color.green < 35000)
|
color.green += 20000;
|
||||||
color.green += 25000 + (color.red + 1) / 2;
|
color.blue += 20000;
|
||||||
if (color.blue < 35000)
|
}
|
||||||
color.blue += 25000 + (color.green + 1) / 2;
|
|
||||||
|
/* Ensure high contrast by enforcing black/ white text colour. */
|
||||||
|
if ((color.red < 41000)
|
||||||
|
&& (color.green < 41000)
|
||||||
|
&& (color.blue < 41000))
|
||||||
|
gdk_color_parse ("#fff", &fgcolor);
|
||||||
|
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_event_box_set_visible_window (GTK_EVENT_BOX (label), TRUE);
|
||||||
|
|
||||||
|
gtk_container_foreach (GTK_CONTAINER (box),
|
||||||
|
(GtkCallback) colorful_tabs_modify_fg,
|
||||||
|
&fgcolor);
|
||||||
|
|
||||||
gtk_widget_modify_bg (label, GTK_STATE_NORMAL, &color);
|
gtk_widget_modify_bg (label, GTK_STATE_NORMAL, &color);
|
||||||
|
|
||||||
|
if (color.red < 10000)
|
||||||
|
color.red = 5000;
|
||||||
|
else
|
||||||
|
color.red -= 5000;
|
||||||
|
if (color.blue < 10000)
|
||||||
|
color.blue = 5000;
|
||||||
|
else
|
||||||
|
color.blue -= 5000;
|
||||||
|
if (color.green < 10000)
|
||||||
|
color.green = 5000;
|
||||||
|
else
|
||||||
|
color.green -= 5000;
|
||||||
|
|
||||||
gtk_widget_modify_bg (label, GTK_STATE_ACTIVE, &color);
|
gtk_widget_modify_bg (label, GTK_STATE_ACTIVE, &color);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_widget_modify_bg (label, GTK_STATE_NORMAL, NULL);
|
gtk_widget_modify_bg (label, GTK_STATE_NORMAL, NULL);
|
||||||
gtk_widget_modify_bg (label, GTK_STATE_ACTIVE, 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
colorful_tabs_browser_add_tab_cb (MidoriBrowser* browser,
|
colorful_tabs_browser_add_tab_cb (MidoriBrowser* browser,
|
||||||
GtkWidget* view,
|
GtkWidget* view,
|
||||||
MidoriExtension* extension)
|
MidoriExtension* extension)
|
||||||
{
|
{
|
||||||
colorful_tabs_view_notify_uri_cb (MIDORI_VIEW (view), NULL, extension);
|
colorful_tabs_view_notify_uri_cb (MIDORI_VIEW (view), NULL, extension);
|
||||||
g_signal_connect (view, "notify::uri",
|
g_signal_connect (view, "notify::icon",
|
||||||
G_CALLBACK (colorful_tabs_view_notify_uri_cb), extension);
|
G_CALLBACK (colorful_tabs_view_notify_uri_cb), extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,6 +153,9 @@ colorful_tabs_deactivate_cb (MidoriExtension* extension,
|
||||||
gtk_event_box_set_visible_window (GTK_EVENT_BOX (label), FALSE);
|
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_NORMAL, NULL);
|
||||||
gtk_widget_modify_bg (label, GTK_STATE_ACTIVE, 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);
|
||||||
g_signal_handlers_disconnect_by_func (
|
g_signal_handlers_disconnect_by_func (
|
||||||
view, colorful_tabs_view_notify_uri_cb, extension);
|
view, colorful_tabs_view_notify_uri_cb, extension);
|
||||||
}
|
}
|
||||||
|
@ -137,8 +203,8 @@ extension_init (void)
|
||||||
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
|
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
|
||||||
"name", _("Colorful Tabs"),
|
"name", _("Colorful Tabs"),
|
||||||
"description", _("Tint each tab distinctly"),
|
"description", _("Tint each tab distinctly"),
|
||||||
"version", "0.1",
|
"version", "0.5",
|
||||||
"authors", "Christian Dywan <christian@twotoasts.de>",
|
"authors", "Christian Dywan <christian@twotoasts.de>, Samuel Creshal <creshal@arcor.de>",
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_signal_connect (extension, "activate",
|
g_signal_connect (extension, "activate",
|
||||||
|
|
105
extensions/external-applications.vala
Normal file
105
extensions/external-applications.vala
Normal file
|
@ -0,0 +1,105 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2010 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using Gtk;
|
||||||
|
using WebKit;
|
||||||
|
using Midori;
|
||||||
|
|
||||||
|
public class ExternalApplications : Midori.Extension {
|
||||||
|
Dialog? dialog;
|
||||||
|
bool launch (string command, string uri) {
|
||||||
|
try {
|
||||||
|
var info = GLib.AppInfo.create_from_commandline (command, "", 0);
|
||||||
|
var uris = new List<string>();
|
||||||
|
uris.prepend (uri);
|
||||||
|
info.launch_uris (uris, new GLib.AppLaunchContext ());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (GLib.Error error) {
|
||||||
|
var error_dialog = new Gtk.MessageDialog (null, 0,
|
||||||
|
Gtk.MessageType.ERROR, Gtk.ButtonsType.OK,
|
||||||
|
"Failed to launch external application.");
|
||||||
|
error_dialog.format_secondary_text (error.message);
|
||||||
|
error_dialog.response.connect ((dialog, response)
|
||||||
|
=> { dialog.destroy (); });
|
||||||
|
error_dialog.show ();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bool navigating (WebFrame web_frame, NetworkRequest request,
|
||||||
|
WebNavigationAction action, WebPolicyDecision decision) {
|
||||||
|
string uri = request.get_uri ();
|
||||||
|
if (uri.has_prefix ("ftp://")) {
|
||||||
|
if (launch ("gftp", uri)) {
|
||||||
|
decision.ignore ();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
void tab_added (View tab) {
|
||||||
|
var web_view = tab.get_web_view ();
|
||||||
|
web_view.navigation_policy_decision_requested.connect (navigating);
|
||||||
|
}
|
||||||
|
void configure_external_applications () {
|
||||||
|
if (dialog == null) {
|
||||||
|
dialog = new Dialog.with_buttons ("Configure External Applications",
|
||||||
|
get_app ().browser,
|
||||||
|
DialogFlags.DESTROY_WITH_PARENT | DialogFlags.NO_SEPARATOR,
|
||||||
|
STOCK_CLOSE, ResponseType.CLOSE);
|
||||||
|
dialog.icon_name = STOCK_PROPERTIES;
|
||||||
|
dialog.destroy.connect ((dialog) => { dialog = null; });
|
||||||
|
dialog.response.connect ((dialog, response) => { dialog.destroy (); });
|
||||||
|
dialog.show ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
dialog.present ();
|
||||||
|
}
|
||||||
|
void tool_menu_populated (Menu menu) {
|
||||||
|
var menuitem = new MenuItem.with_mnemonic ("Configure _External Applications...");
|
||||||
|
menuitem.activate.connect (configure_external_applications);
|
||||||
|
menuitem.show ();
|
||||||
|
menu.append (menuitem);
|
||||||
|
}
|
||||||
|
void browser_added (Browser browser) {
|
||||||
|
foreach (var tab in browser.get_tabs ())
|
||||||
|
tab_added (tab);
|
||||||
|
browser.add_tab.connect (tab_added);
|
||||||
|
browser.populate_tool_menu.connect (tool_menu_populated);
|
||||||
|
}
|
||||||
|
void activated (Midori.App app) {
|
||||||
|
foreach (var browser in app.get_browsers ())
|
||||||
|
browser_added (browser);
|
||||||
|
app.add_browser.connect (browser_added);
|
||||||
|
}
|
||||||
|
void deactivated () {
|
||||||
|
var app = get_app ();
|
||||||
|
app.add_browser.disconnect (browser_added);
|
||||||
|
foreach (var browser in app.get_browsers ()) {
|
||||||
|
foreach (var tab in browser.get_tabs ())
|
||||||
|
/* */;
|
||||||
|
browser.populate_tool_menu.disconnect (tool_menu_populated);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
internal ExternalApplications () {
|
||||||
|
GLib.Object (name: "External Applications",
|
||||||
|
description: "Associate URL schemes with external commands",
|
||||||
|
version: "0.1",
|
||||||
|
authors: "Christian Dywan <christian@twotoasts.de>");
|
||||||
|
activate.connect (activated);
|
||||||
|
deactivate.connect (deactivated);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Midori.Extension extension_init () {
|
||||||
|
return new ExternalApplications ();
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2009 Dale Whittaker <dayul@users.sf.net>
|
Copyright (C) 2009-2010 Dale Whittaker <dayul@users.sf.net>
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -130,34 +130,6 @@ atom_get_link (KatzeItem* item,
|
||||||
xmlFree (newtype);
|
xmlFree (newtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar*
|
|
||||||
atom_get_title (FeedParser* fparser)
|
|
||||||
{
|
|
||||||
const gchar* name;
|
|
||||||
|
|
||||||
if (!(name = katze_item_get_name (fparser->item)))
|
|
||||||
{
|
|
||||||
gchar* type;
|
|
||||||
|
|
||||||
type = (gchar*)xmlGetProp (fparser->node, BAD_CAST "type");
|
|
||||||
if (type)
|
|
||||||
{
|
|
||||||
gchar* content = NULL;
|
|
||||||
|
|
||||||
if (g_str_equal (type, "html") ||
|
|
||||||
g_str_equal (type, "xhtml"))
|
|
||||||
content = feed_get_element_markup (fparser);
|
|
||||||
|
|
||||||
xmlFree (type);
|
|
||||||
|
|
||||||
if (content)
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
return feed_get_element_string (fparser);
|
|
||||||
}
|
|
||||||
return g_strdup (name);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
atom_preparse_entry (FeedParser* fparser)
|
atom_preparse_entry (FeedParser* fparser)
|
||||||
{
|
{
|
||||||
|
@ -181,12 +153,12 @@ atom_parse_entry (FeedParser* fparser)
|
||||||
}
|
}
|
||||||
else if (!xmlStrcmp (node->name, BAD_CAST "title"))
|
else if (!xmlStrcmp (node->name, BAD_CAST "title"))
|
||||||
{
|
{
|
||||||
content = atom_get_title (fparser);
|
content = feed_get_element_string (fparser);
|
||||||
katze_item_set_name (fparser->item, content);
|
katze_item_set_name (fparser->item, content);
|
||||||
}
|
}
|
||||||
else if (!xmlStrcmp (node->name, BAD_CAST "summary"))
|
else if (!xmlStrcmp (node->name, BAD_CAST "summary"))
|
||||||
{
|
{
|
||||||
content = feed_get_element_string (fparser);
|
content = feed_get_element_markup (fparser);
|
||||||
katze_item_set_text (fparser->item, content);
|
katze_item_set_text (fparser->item, content);
|
||||||
}
|
}
|
||||||
else if (!xmlStrcmp (node->name, BAD_CAST "updated"))
|
else if (!xmlStrcmp (node->name, BAD_CAST "updated"))
|
||||||
|
@ -209,7 +181,7 @@ atom_parse_entry (FeedParser* fparser)
|
||||||
/* Only retrieve content if there is no summary */
|
/* Only retrieve content if there is no summary */
|
||||||
if (!katze_item_get_text (fparser->item))
|
if (!katze_item_get_text (fparser->item))
|
||||||
{
|
{
|
||||||
content = feed_get_element_string (fparser);
|
content = feed_get_element_markup (fparser);
|
||||||
katze_item_set_text (fparser->item, content);
|
katze_item_set_text (fparser->item, content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -269,12 +241,12 @@ atom_parse_feed (FeedParser* fparser)
|
||||||
}
|
}
|
||||||
else if (!xmlStrcmp (node->name, BAD_CAST "title"))
|
else if (!xmlStrcmp (node->name, BAD_CAST "title"))
|
||||||
{
|
{
|
||||||
content = atom_get_title (fparser);
|
content = feed_get_element_string (fparser);
|
||||||
katze_item_set_name (fparser->item, content);
|
katze_item_set_name (fparser->item, content);
|
||||||
}
|
}
|
||||||
else if (!xmlStrcmp (node->name, BAD_CAST "subtitle"))
|
else if (!xmlStrcmp (node->name, BAD_CAST "subtitle"))
|
||||||
{
|
{
|
||||||
content = feed_get_element_string (fparser);
|
content = feed_get_element_markup (fparser);
|
||||||
katze_item_set_text (fparser->item, content);
|
katze_item_set_text (fparser->item, content);
|
||||||
}
|
}
|
||||||
else if (!xmlStrcmp (node->name, BAD_CAST "updated"))
|
else if (!xmlStrcmp (node->name, BAD_CAST "updated"))
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2009 Dale Whittaker <dayul@users.sf.net>
|
Copyright (C) 2009-2010 Dale Whittaker <dayul@users.sf.net>
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -657,8 +657,12 @@ webview_navigation_request_cb (WebKitWebView* web_view,
|
||||||
uri = webkit_network_request_get_uri (request);
|
uri = webkit_network_request_get_uri (request);
|
||||||
n = midori_browser_add_uri (browser, uri);
|
n = midori_browser_add_uri (browser, uri);
|
||||||
midori_browser_set_current_page (browser, n);
|
midori_browser_set_current_page (browser, n);
|
||||||
|
webkit_web_policy_decision_ignore (policy_decision);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const gchar*
|
static const gchar*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2009 Dale Whittaker <dayul@users.sf.net>
|
Copyright (C) 2009-2010 Dale Whittaker <dayul@users.sf.net>
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -13,16 +13,24 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
gchar*
|
gchar*
|
||||||
feed_get_element_string (FeedParser* fparser)
|
feed_get_element_markup (FeedParser* fparser)
|
||||||
{
|
{
|
||||||
xmlNodePtr node;
|
xmlNodePtr node;
|
||||||
|
|
||||||
node = fparser->node;
|
node = fparser->node;
|
||||||
|
|
||||||
|
if (node->children &&
|
||||||
|
!xmlIsBlankNode (node->children) &&
|
||||||
|
node->children->type == XML_ELEMENT_NODE)
|
||||||
|
{
|
||||||
|
return ((gchar*) xmlNodeGetContent (node->children));
|
||||||
|
}
|
||||||
|
|
||||||
if (!node->children ||
|
if (!node->children ||
|
||||||
xmlIsBlankNode (node->children) ||
|
xmlIsBlankNode (node->children) ||
|
||||||
node->children->type != XML_TEXT_NODE
|
(node->children->type != XML_TEXT_NODE &&
|
||||||
)
|
node->children->type != XML_CDATA_SECTION_NODE)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
/* Some servers add required elements with no content,
|
/* Some servers add required elements with no content,
|
||||||
* create a dummy string to handle it.
|
* create a dummy string to handle it.
|
||||||
|
@ -70,19 +78,11 @@ feed_remove_markup (gchar* markup)
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar*
|
gchar*
|
||||||
feed_get_element_markup (FeedParser* fparser)
|
feed_get_element_string (FeedParser* fparser)
|
||||||
{
|
{
|
||||||
gchar* markup;
|
gchar* markup;
|
||||||
xmlNodePtr node = fparser->node;
|
|
||||||
|
|
||||||
if (node->children &&
|
markup = feed_get_element_markup (fparser);
|
||||||
!xmlIsBlankNode (node->children) &&
|
|
||||||
node->children->type == XML_ELEMENT_NODE)
|
|
||||||
{
|
|
||||||
return (gchar*) xmlNodeGetContent (node->children);
|
|
||||||
}
|
|
||||||
|
|
||||||
markup = feed_get_element_string (fparser);
|
|
||||||
return feed_remove_markup (markup);
|
return feed_remove_markup (markup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2009 Dale Whittaker <dayul@users.sf.net>
|
Copyright (C) 2009-2010 Dale Whittaker <dayul@users.sf.net>
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -107,12 +107,12 @@ rss_parse_item (FeedParser* fparser)
|
||||||
}
|
}
|
||||||
else if (!xmlStrcmp (node->name, BAD_CAST "title"))
|
else if (!xmlStrcmp (node->name, BAD_CAST "title"))
|
||||||
{
|
{
|
||||||
content = feed_get_element_markup (fparser);
|
content = feed_get_element_string (fparser);
|
||||||
katze_item_set_name (fparser->item, content);
|
katze_item_set_name (fparser->item, content);
|
||||||
}
|
}
|
||||||
else if (!xmlStrcmp (node->name, BAD_CAST "description"))
|
else if (!xmlStrcmp (node->name, BAD_CAST "description"))
|
||||||
{
|
{
|
||||||
content = feed_get_element_string (fparser);
|
content = feed_get_element_markup (fparser);
|
||||||
katze_item_set_text (fparser->item, content);
|
katze_item_set_text (fparser->item, content);
|
||||||
}
|
}
|
||||||
else if (!xmlStrcmp (node->name, BAD_CAST "pubDate"))
|
else if (!xmlStrcmp (node->name, BAD_CAST "pubDate"))
|
||||||
|
@ -184,12 +184,12 @@ rss_parse_channel (FeedParser* fparser)
|
||||||
|
|
||||||
if (!xmlStrcmp (node->name, BAD_CAST "title"))
|
if (!xmlStrcmp (node->name, BAD_CAST "title"))
|
||||||
{
|
{
|
||||||
content = feed_get_element_markup (fparser);
|
content = feed_get_element_string (fparser);
|
||||||
katze_item_set_name (fparser->item, content);
|
katze_item_set_name (fparser->item, content);
|
||||||
}
|
}
|
||||||
else if (!xmlStrcmp (node->name, BAD_CAST "description"))
|
else if (!xmlStrcmp (node->name, BAD_CAST "description"))
|
||||||
{
|
{
|
||||||
content = feed_get_element_string (fparser);
|
content = feed_get_element_markup (fparser);
|
||||||
katze_item_set_text (fparser->item, content);
|
katze_item_set_text (fparser->item, content);
|
||||||
}
|
}
|
||||||
else if (!xmlStrcmp (node->name, BAD_CAST "lastBuildDate"))
|
else if (!xmlStrcmp (node->name, BAD_CAST "lastBuildDate"))
|
||||||
|
|
|
@ -306,7 +306,7 @@ formhistory_add_tab_cb (MidoriBrowser* browser,
|
||||||
MidoriView* view,
|
MidoriView* view,
|
||||||
MidoriExtension* extension)
|
MidoriExtension* extension)
|
||||||
{
|
{
|
||||||
GtkWidget* web_view = gtk_bin_get_child (GTK_BIN (view));
|
GtkWidget* web_view = midori_view_get_web_view (view);
|
||||||
g_signal_connect (web_view, "window-object-cleared",
|
g_signal_connect (web_view, "window-object-cleared",
|
||||||
G_CALLBACK (formhistory_window_object_cleared_cb), NULL);
|
G_CALLBACK (formhistory_window_object_cleared_cb), NULL);
|
||||||
#if WEBKIT_CHECK_VERSION (1, 1, 4)
|
#if WEBKIT_CHECK_VERSION (1, 1, 4)
|
||||||
|
@ -348,7 +348,7 @@ formhistory_deactivate_tabs (MidoriView* view,
|
||||||
MidoriBrowser* browser,
|
MidoriBrowser* browser,
|
||||||
MidoriExtension* extension)
|
MidoriExtension* extension)
|
||||||
{
|
{
|
||||||
GtkWidget* web_view = gtk_bin_get_child (GTK_BIN (view));
|
GtkWidget* web_view = midori_view_get_web_view (view);
|
||||||
g_signal_handlers_disconnect_by_func (
|
g_signal_handlers_disconnect_by_func (
|
||||||
web_view, formhistory_window_object_cleared_cb, NULL);
|
web_view, formhistory_window_object_cleared_cb, NULL);
|
||||||
#if WEBKIT_CHECK_VERSION (1, 1, 4)
|
#if WEBKIT_CHECK_VERSION (1, 1, 4)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2009 Matthias Kruk <mkruk@matthiaskruk.de>
|
Copyright (C) 2009 Matthias Kruk <mkruk@matthiaskruk.de>
|
||||||
Copyright (C) 2009 Christian Dywan <christian@twotoasts.de>
|
Copyright (C) 2009-2010 Christian Dywan <christian@twotoasts.de>
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -28,6 +28,7 @@ struct MouseGestureNode {
|
||||||
} MouseGestureNode_t;
|
} MouseGestureNode_t;
|
||||||
|
|
||||||
struct _MouseGesture {
|
struct _MouseGesture {
|
||||||
|
MouseButton button;
|
||||||
struct MouseGestureNode start;
|
struct MouseGestureNode start;
|
||||||
struct MouseGestureNode middle;
|
struct MouseGestureNode middle;
|
||||||
struct MouseGestureNode end;
|
struct MouseGestureNode end;
|
||||||
|
@ -37,8 +38,6 @@ struct _MouseGesture {
|
||||||
#define DEVIANCE 20
|
#define DEVIANCE 20
|
||||||
#define MINLENGTH 50
|
#define MINLENGTH 50
|
||||||
|
|
||||||
#define MOUSE_GESTURES_BUTTON MOUSE_BUTTON_MIDDLE
|
|
||||||
|
|
||||||
MouseGesture *gesture;
|
MouseGesture *gesture;
|
||||||
|
|
||||||
void mouse_gesture_clear (MouseGesture *g)
|
void mouse_gesture_clear (MouseGesture *g)
|
||||||
|
@ -65,7 +64,7 @@ mouse_gestures_button_press_event_cb (GtkWidget* web_view,
|
||||||
GdkEvent* event,
|
GdkEvent* event,
|
||||||
MidoriBrowser* browser)
|
MidoriBrowser* browser)
|
||||||
{
|
{
|
||||||
if (event->button.button == MOUSE_GESTURES_BUTTON)
|
if (event->button.button == gesture->button)
|
||||||
{
|
{
|
||||||
/* If the gesture was previously cleaned,
|
/* If the gesture was previously cleaned,
|
||||||
start a new gesture and coordinates. */
|
start a new gesture and coordinates. */
|
||||||
|
@ -98,27 +97,36 @@ mouse_gestures_motion_notify_event_cb (GtkWidget* web_view,
|
||||||
{
|
{
|
||||||
gesture->middle.x = x;
|
gesture->middle.x = x;
|
||||||
gesture->middle.y = y;
|
gesture->middle.y = y;
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if ((gesture->middle.x - x < DEVIANCE && gesture->middle.x - x > -DEVIANCE) ||
|
else if ((gesture->middle.x - x < DEVIANCE && gesture->middle.x - x > -DEVIANCE) ||
|
||||||
(gesture->middle.y - y < DEVIANCE && gesture->middle.y - y > -DEVIANCE))
|
(gesture->middle.y - y < DEVIANCE && gesture->middle.y - y > -DEVIANCE))
|
||||||
{
|
{
|
||||||
gesture->end.x = x;
|
gesture->end.x = x;
|
||||||
gesture->end.y = y;
|
gesture->end.y = y;
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
mouse_gestures_button_release_event_cb (GtkWidget* web_view,
|
mouse_gestures_activate_action (MidoriView* view,
|
||||||
GdkEvent* event,
|
const gchar* name)
|
||||||
MidoriBrowser* browser)
|
{
|
||||||
|
MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (view));
|
||||||
|
midori_browser_activate_action (browser, name);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
mouse_gestures_button_release_event_cb (GtkWidget* web_view,
|
||||||
|
GdkEventButton* event,
|
||||||
|
MidoriView* view)
|
||||||
{
|
{
|
||||||
/* All mouse gestures will use this mouse button */
|
/* All mouse gestures will use this mouse button */
|
||||||
if (gesture->last == MOUSE_GESTURES_BUTTON)
|
if (gesture->last == gesture->button)
|
||||||
{
|
{
|
||||||
/* The initial horizontal move is between the bounds */
|
/* The initial horizontal move is between the bounds */
|
||||||
if ((gesture->middle.x - gesture->start.x < DEVIANCE) &&
|
if ((gesture->middle.x - gesture->start.x < DEVIANCE) &&
|
||||||
|
@ -133,18 +141,18 @@ mouse_gestures_button_release_event_cb (GtkWidget* web_view,
|
||||||
(gesture->middle.y - gesture->end.y > -DEVIANCE) &&
|
(gesture->middle.y - gesture->end.y > -DEVIANCE) &&
|
||||||
(gesture->end.x > gesture->middle.x + MINLENGTH))
|
(gesture->end.x > gesture->middle.x + MINLENGTH))
|
||||||
/* We moved down then right: close the tab */
|
/* We moved down then right: close the tab */
|
||||||
midori_browser_activate_action (browser, "TabClose");
|
return mouse_gestures_activate_action (view, "TabClose");
|
||||||
/* Then we the final vertical move is between the bounds and
|
/* Then we the final vertical move is between the bounds and
|
||||||
we moved left more than MINLENGTH pixels */
|
we moved left more than MINLENGTH pixels */
|
||||||
else if ((gesture->middle.y - gesture->end.y < DEVIANCE) &&
|
else if ((gesture->middle.y - gesture->end.y < DEVIANCE) &&
|
||||||
(gesture->middle.y - gesture->end.y > -DEVIANCE) &&
|
(gesture->middle.y - gesture->end.y > -DEVIANCE) &&
|
||||||
(gesture->end.x + MINLENGTH < gesture->middle.x))
|
(gesture->end.x + MINLENGTH < gesture->middle.x))
|
||||||
/* We moved down then left: reload */
|
/* We moved down then left: reload */
|
||||||
midori_browser_activate_action (browser, "Reload");
|
return mouse_gestures_activate_action (view, "Reload");
|
||||||
/* The end node was never updated, we only did a vertical move */
|
/* The end node was never updated, we only did a vertical move */
|
||||||
else if(gesture->end.y == 0 && gesture->end.x == 0)
|
else if(gesture->end.y == 0 && gesture->end.x == 0)
|
||||||
/* We moved down then: create a new tab */
|
/* We moved down then: create a new tab */
|
||||||
midori_browser_activate_action (browser, "TabNew");
|
return mouse_gestures_activate_action (view, "TabNew");
|
||||||
}
|
}
|
||||||
/* We initially moved up more than MINLENGTH pixels */
|
/* We initially moved up more than MINLENGTH pixels */
|
||||||
else if (gesture->middle.y + MINLENGTH < gesture->start.y)
|
else if (gesture->middle.y + MINLENGTH < gesture->start.y)
|
||||||
|
@ -152,7 +160,7 @@ mouse_gestures_button_release_event_cb (GtkWidget* web_view,
|
||||||
/* The end node was never updated, we only did a vertical move */
|
/* The end node was never updated, we only did a vertical move */
|
||||||
if (gesture->end.y == 0 && gesture->end.x == 0)
|
if (gesture->end.y == 0 && gesture->end.x == 0)
|
||||||
/* We moved up: stop */
|
/* We moved up: stop */
|
||||||
midori_browser_activate_action (browser, "Stop");
|
return mouse_gestures_activate_action (view, "Stop");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* The initial horizontal move is between the bounds */
|
/* The initial horizontal move is between the bounds */
|
||||||
|
@ -165,7 +173,7 @@ mouse_gestures_button_release_event_cb (GtkWidget* web_view,
|
||||||
/* The end node was never updated, we only did an horizontal move */
|
/* The end node was never updated, we only did an horizontal move */
|
||||||
if (gesture->end.x == 0 && gesture->end.y == 0)
|
if (gesture->end.x == 0 && gesture->end.y == 0)
|
||||||
/* We moved right: forward */
|
/* We moved right: forward */
|
||||||
midori_browser_activate_action (browser, "Forward");
|
return mouse_gestures_activate_action (view, "Forward");
|
||||||
}
|
}
|
||||||
/* We initially moved left more than MINLENGTH pixels */
|
/* We initially moved left more than MINLENGTH pixels */
|
||||||
else if (gesture->middle.x + MINLENGTH < gesture->start.x)
|
else if (gesture->middle.x + MINLENGTH < gesture->start.x)
|
||||||
|
@ -173,12 +181,18 @@ mouse_gestures_button_release_event_cb (GtkWidget* web_view,
|
||||||
/* The end node was never updated, we only did an horizontal move */
|
/* The end node was never updated, we only did an horizontal move */
|
||||||
if (gesture->end.x == 0 && gesture->end.y == 0)
|
if (gesture->end.x == 0 && gesture->end.y == 0)
|
||||||
/* We moved left: back */
|
/* We moved left: back */
|
||||||
midori_browser_activate_action (browser, "Back");
|
return mouse_gestures_activate_action (view, "Back");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mouse_gesture_clear (gesture);
|
mouse_gesture_clear (gesture);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event->button == 3)
|
||||||
|
{
|
||||||
|
GtkWidget* menu = gtk_menu_new ();
|
||||||
|
midori_view_populate_popup (view, menu, TRUE);
|
||||||
|
katze_widget_popup (GTK_WIDGET (web_view), GTK_MENU (menu),
|
||||||
|
event, KATZE_MENU_POSITION_CURSOR);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +204,7 @@ mouse_gestures_add_tab_cb (MidoriBrowser* browser,
|
||||||
MidoriView* view,
|
MidoriView* view,
|
||||||
MidoriExtension* extension)
|
MidoriExtension* extension)
|
||||||
{
|
{
|
||||||
GtkWidget* web_view = gtk_bin_get_child (GTK_BIN (view));
|
GtkWidget* web_view = midori_view_get_web_view (view);
|
||||||
|
|
||||||
g_object_connect (web_view,
|
g_object_connect (web_view,
|
||||||
"signal::button-press-event",
|
"signal::button-press-event",
|
||||||
|
@ -198,7 +212,7 @@ mouse_gestures_add_tab_cb (MidoriBrowser* browser,
|
||||||
"signal::motion-notify-event",
|
"signal::motion-notify-event",
|
||||||
mouse_gestures_motion_notify_event_cb, browser,
|
mouse_gestures_motion_notify_event_cb, browser,
|
||||||
"signal::button-release-event",
|
"signal::button-release-event",
|
||||||
mouse_gestures_button_release_event_cb, browser,
|
mouse_gestures_button_release_event_cb, view,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +245,7 @@ static void
|
||||||
mouse_gestures_deactivate_tabs (MidoriView* view,
|
mouse_gestures_deactivate_tabs (MidoriView* view,
|
||||||
MidoriBrowser* browser)
|
MidoriBrowser* browser)
|
||||||
{
|
{
|
||||||
GtkWidget* web_view = gtk_bin_get_child (GTK_BIN (view));
|
GtkWidget* web_view = midori_view_get_web_view (view);
|
||||||
|
|
||||||
g_object_disconnect (web_view,
|
g_object_disconnect (web_view,
|
||||||
"any_signal::button-press-event",
|
"any_signal::button-press-event",
|
||||||
|
@ -239,7 +253,7 @@ mouse_gestures_deactivate_tabs (MidoriView* view,
|
||||||
"any_signal::motion-notify-event",
|
"any_signal::motion-notify-event",
|
||||||
mouse_gestures_motion_notify_event_cb, browser,
|
mouse_gestures_motion_notify_event_cb, browser,
|
||||||
"any_signal::button-release-event",
|
"any_signal::button-release-event",
|
||||||
mouse_gestures_button_release_event_cb, browser,
|
mouse_gestures_button_release_event_cb, view,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,6 +284,7 @@ mouse_gestures_activate_cb (MidoriExtension* extension,
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
gesture = mouse_gesture_new ();
|
gesture = mouse_gesture_new ();
|
||||||
|
gesture->button = midori_extension_get_integer (extension, "button");
|
||||||
|
|
||||||
browsers = katze_object_get_object (app, "browsers");
|
browsers = katze_object_get_object (app, "browsers");
|
||||||
i = 0;
|
i = 0;
|
||||||
|
@ -289,7 +304,7 @@ extension_init (void)
|
||||||
"description", _("Control Midori by moving the mouse"),
|
"description", _("Control Midori by moving the mouse"),
|
||||||
"version", "0.1",
|
"version", "0.1",
|
||||||
"authors", "Matthias Kruk <mkruk@matthiaskruk.de>", NULL);
|
"authors", "Matthias Kruk <mkruk@matthiaskruk.de>", NULL);
|
||||||
midori_extension_install_integer (extension, "button", MOUSE_GESTURES_BUTTON);
|
midori_extension_install_integer (extension, "button", MOUSE_BUTTON_RIGHT);
|
||||||
|
|
||||||
g_signal_connect (extension, "activate",
|
g_signal_connect (extension, "activate",
|
||||||
G_CALLBACK (mouse_gestures_activate_cb), NULL);
|
G_CALLBACK (mouse_gestures_activate_cb), NULL);
|
||||||
|
|
187
extensions/status-clock.c
Normal file
187
extensions/status-clock.c
Normal file
|
@ -0,0 +1,187 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2010 Arno Renevier <arno@renevier.net>
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This extension adds time and/or date in midori statusbar. Format for time
|
||||||
|
* display can be configured by creating a desktop entry file named
|
||||||
|
* ~/.config/midori/extensions/libclock.so/config
|
||||||
|
*
|
||||||
|
* That file must contain a section "settings", and a key "format". That format
|
||||||
|
* will be used as format parameter to strftime. For example, If you want to
|
||||||
|
* display full date and time according to your locale, "config" must contain:
|
||||||
|
*
|
||||||
|
* [settings]
|
||||||
|
* format=%c
|
||||||
|
*
|
||||||
|
* If that file does not exist, or format specification cannot be read, format
|
||||||
|
* fallback to %R which means time will be display with a 24-hour notation. For
|
||||||
|
* example, 13:53
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <midori/midori.h>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#define DEFAULT_FORMAT "%R"
|
||||||
|
|
||||||
|
static void
|
||||||
|
clock_deactivate_cb (MidoriExtension* extension,
|
||||||
|
MidoriApp* app);
|
||||||
|
|
||||||
|
static void
|
||||||
|
clock_set_timeout (MidoriBrowser* browser,
|
||||||
|
guint interval);
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
clock_set_current_time (MidoriBrowser* browser)
|
||||||
|
{
|
||||||
|
MidoriExtension* extension;
|
||||||
|
GtkWidget* label;
|
||||||
|
const gchar* format;
|
||||||
|
struct tm *tm;
|
||||||
|
time_t rawtime;
|
||||||
|
char datestring[60];
|
||||||
|
guint interval;
|
||||||
|
|
||||||
|
extension = g_object_get_data (G_OBJECT (browser), "clock-extension");
|
||||||
|
label = g_object_get_data (G_OBJECT (browser), "clock-label");
|
||||||
|
format = midori_extension_get_string (extension, "format");
|
||||||
|
|
||||||
|
rawtime = time (NULL);
|
||||||
|
tm = localtime (&rawtime);
|
||||||
|
|
||||||
|
strftime (datestring, 60, format, tm);
|
||||||
|
gtk_label_set_label (GTK_LABEL (label), datestring);
|
||||||
|
|
||||||
|
if (g_strstr_len (format, -1, "%c")
|
||||||
|
|| g_strstr_len (format, -1, "%N")
|
||||||
|
|| g_strstr_len (format, -1, "%s")
|
||||||
|
|| g_strstr_len (format, -1, "%S")
|
||||||
|
|| g_strstr_len (format, -1, "%T")
|
||||||
|
|| g_strstr_len (format, -1, "%X")
|
||||||
|
)
|
||||||
|
interval = 1;
|
||||||
|
else
|
||||||
|
/* FIXME: Occasionally there are more than 60 seconds in a minute. */
|
||||||
|
interval = MAX (60 - tm->tm_sec, 1);
|
||||||
|
|
||||||
|
clock_set_timeout (browser, interval);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clock_set_timeout (MidoriBrowser* browser,
|
||||||
|
guint interval)
|
||||||
|
{
|
||||||
|
GSource* source;
|
||||||
|
source = g_timeout_source_new_seconds (interval);
|
||||||
|
g_source_set_callback (source, (GSourceFunc)clock_set_current_time, browser, NULL);
|
||||||
|
g_source_attach (source, NULL);
|
||||||
|
g_object_set_data (G_OBJECT (browser), "clock-timer", source);
|
||||||
|
g_source_unref (source);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clock_browser_destroy_cb (MidoriBrowser* browser,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GSource* source;
|
||||||
|
source = g_object_get_data (G_OBJECT (browser), "clock-timer");
|
||||||
|
g_source_destroy (source);
|
||||||
|
g_signal_handlers_disconnect_by_func (browser, clock_browser_destroy_cb, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clock_app_add_browser_cb (MidoriApp* app,
|
||||||
|
MidoriBrowser* browser,
|
||||||
|
MidoriExtension* extension)
|
||||||
|
{
|
||||||
|
GtkWidget* statusbar;
|
||||||
|
GtkWidget* label;
|
||||||
|
|
||||||
|
label = gtk_label_new (NULL);
|
||||||
|
|
||||||
|
statusbar = katze_object_get_object (browser, "statusbar");
|
||||||
|
gtk_box_pack_end (GTK_BOX (statusbar), label, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
g_object_set_data (G_OBJECT (browser), "clock-label", label);
|
||||||
|
g_object_set_data (G_OBJECT (browser), "clock-extension", extension);
|
||||||
|
|
||||||
|
clock_set_current_time (browser);
|
||||||
|
gtk_widget_show (label);
|
||||||
|
|
||||||
|
g_object_unref (statusbar);
|
||||||
|
|
||||||
|
g_signal_connect (browser, "destroy", G_CALLBACK (clock_browser_destroy_cb), NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clock_deactivate_cb (MidoriExtension* extension,
|
||||||
|
MidoriApp* app)
|
||||||
|
{
|
||||||
|
KatzeArray* browsers;
|
||||||
|
MidoriBrowser* browser;
|
||||||
|
GtkWidget* label;
|
||||||
|
guint i = 0;
|
||||||
|
|
||||||
|
browsers = katze_object_get_object (app, "browsers");
|
||||||
|
while ((browser = katze_array_get_nth_item (browsers, i++)))
|
||||||
|
{
|
||||||
|
clock_browser_destroy_cb (browser, NULL);
|
||||||
|
label = g_object_get_data (G_OBJECT (browser), "clock-label");
|
||||||
|
gtk_widget_destroy (label);
|
||||||
|
g_object_set_data (G_OBJECT (browser), "clock-label", NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_signal_handlers_disconnect_by_func (
|
||||||
|
app, clock_app_add_browser_cb, extension);
|
||||||
|
g_signal_handlers_disconnect_by_func (
|
||||||
|
extension, clock_deactivate_cb, app);
|
||||||
|
g_object_unref (browsers);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clock_activate_cb (MidoriExtension* extension,
|
||||||
|
MidoriApp* app)
|
||||||
|
{
|
||||||
|
KatzeArray* browsers;
|
||||||
|
MidoriBrowser* browser;
|
||||||
|
guint i = 0;
|
||||||
|
|
||||||
|
browsers = katze_object_get_object (app, "browsers");
|
||||||
|
while ((browser = katze_array_get_nth_item (browsers, i++)))
|
||||||
|
clock_app_add_browser_cb (app, browser, extension);
|
||||||
|
g_signal_connect (app, "add-browser",
|
||||||
|
G_CALLBACK (clock_app_add_browser_cb), extension);
|
||||||
|
|
||||||
|
g_signal_connect (extension, "deactivate",
|
||||||
|
G_CALLBACK (clock_deactivate_cb), app);
|
||||||
|
|
||||||
|
g_object_unref (browsers);
|
||||||
|
}
|
||||||
|
|
||||||
|
MidoriExtension*
|
||||||
|
extension_init (void)
|
||||||
|
{
|
||||||
|
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
|
||||||
|
"name", _("Status clock"),
|
||||||
|
"description", _("Display date and time in the statusbar"),
|
||||||
|
"version", "0.1",
|
||||||
|
"authors", "Arno Renevier <arno@renevier.net>",
|
||||||
|
NULL);
|
||||||
|
midori_extension_install_string (extension, "format", DEFAULT_FORMAT);
|
||||||
|
|
||||||
|
g_signal_connect (extension, "activate",
|
||||||
|
G_CALLBACK (clock_activate_cb), NULL);
|
||||||
|
|
||||||
|
return extension;
|
||||||
|
}
|
|
@ -329,8 +329,13 @@ tab_panel_view_notify_icon_cb (GtkWidget* view,
|
||||||
{
|
{
|
||||||
GtkTreeModel* model = tab_panel_get_model_for_browser (browser);
|
GtkTreeModel* model = tab_panel_get_model_for_browser (browser);
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
GtkWidget* label = midori_view_get_proxy_tab_label (MIDORI_VIEW (view));
|
||||||
|
GtkStyle* style = gtk_widget_get_style (label);
|
||||||
if (tab_panel_get_iter_for_view (model, &iter, view))
|
if (tab_panel_get_iter_for_view (model, &iter, view))
|
||||||
gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 3, icon, -1);
|
gtk_tree_store_set (GTK_TREE_STORE (model), &iter,
|
||||||
|
3, icon,
|
||||||
|
6, &style->bg[GTK_STATE_NORMAL],
|
||||||
|
-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,12 +359,10 @@ tab_panel_view_notify_title_cb (GtkWidget* view,
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
if (tab_panel_get_iter_for_view (model, &iter, view))
|
if (tab_panel_get_iter_for_view (model, &iter, view))
|
||||||
{
|
{
|
||||||
GtkWidget* label = midori_view_get_proxy_tab_label (MIDORI_VIEW (view));
|
|
||||||
GtkStyle* style = gtk_widget_get_style (label);
|
|
||||||
gtk_tree_store_set (GTK_TREE_STORE (model), &iter,
|
gtk_tree_store_set (GTK_TREE_STORE (model), &iter,
|
||||||
4, title,
|
4, title,
|
||||||
5, midori_view_get_label_ellipsize (MIDORI_VIEW (view)),
|
5, midori_view_get_label_ellipsize (MIDORI_VIEW (view)),
|
||||||
6, &style->bg[GTK_STATE_NORMAL], -1);
|
-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,8 @@ static GdkPixbuf* tab_selector_get_snapshot(MidoriView* view,
|
||||||
gfloat factor;
|
gfloat factor;
|
||||||
|
|
||||||
g_return_val_if_fail (MIDORI_IS_VIEW (view), NULL);
|
g_return_val_if_fail (MIDORI_IS_VIEW (view), NULL);
|
||||||
web_view = gtk_bin_get_child (GTK_BIN (view));
|
|
||||||
|
web_view = midori_view_get_web_view (view);
|
||||||
|
|
||||||
if(maxwidth < 0) {
|
if(maxwidth < 0) {
|
||||||
maxwidth *= -1;
|
maxwidth *= -1;
|
||||||
|
|
|
@ -14,13 +14,18 @@ for extension in extensions:
|
||||||
for fila in files:
|
for fila in files:
|
||||||
if fila[-2:] == '.c':
|
if fila[-2:] == '.c':
|
||||||
source += ' ' + extension + os.sep + fila
|
source += ' ' + extension + os.sep + fila
|
||||||
|
elif 'VALAC' in bld.env and fila[-5:] == '.vala':
|
||||||
|
source += ' ' + extension + os.sep + fila
|
||||||
if not source:
|
if not source:
|
||||||
Utils.pprint ('RED', folder + ': No source files found')
|
Utils.pprint ('RED', folder + ': No source files found')
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
if extension[-2:] != '.c':
|
if extension[-2:] == '.c':
|
||||||
|
target = extension[:-2]
|
||||||
|
elif 'VALAC' in bld.env and extension[-5:] == '.vala':
|
||||||
|
target = extension[:-5]
|
||||||
|
else:
|
||||||
continue
|
continue
|
||||||
target = extension[:-2]
|
|
||||||
source = extension
|
source = extension
|
||||||
|
|
||||||
obj = bld.new_task_gen ('cc', 'shlib')
|
obj = bld.new_task_gen ('cc', 'shlib')
|
||||||
|
@ -28,6 +33,8 @@ for extension in extensions:
|
||||||
obj.includes = '..'
|
obj.includes = '..'
|
||||||
obj.source = source
|
obj.source = source
|
||||||
obj.uselib = 'UNIQUE LIBSOUP GIO GTK SQLITE WEBKIT LIBXML HILDON'
|
obj.uselib = 'UNIQUE LIBSOUP GIO GTK SQLITE WEBKIT LIBXML HILDON'
|
||||||
|
obj.vapi_dirs = '../midori'
|
||||||
|
obj.packages = 'glib-2.0 gio-2.0 gtk+-2.0 libsoup-2.4 webkit-1.0 midori'
|
||||||
obj.install_path = '${LIBDIR}/midori'
|
obj.install_path = '${LIBDIR}/midori'
|
||||||
if bld.env['platform'] == 'win32':
|
if bld.env['platform'] == 'win32':
|
||||||
obj.uselib_local = 'midori'
|
obj.uselib_local = 'midori'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2008-2009 Christian Dywan <christian@twotoasts.de>
|
Copyright (C) 2008-2010 Christian Dywan <christian@twotoasts.de>
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -76,7 +76,7 @@ _katze_array_add_item (KatzeArray* array,
|
||||||
{
|
{
|
||||||
GType type = G_OBJECT_TYPE (item);
|
GType type = G_OBJECT_TYPE (item);
|
||||||
|
|
||||||
g_return_if_fail (katze_array_is_a (array, type));
|
/* g_return_if_fail (katze_array_is_a (array, type)); */
|
||||||
g_object_ref (item);
|
g_object_ref (item);
|
||||||
if (g_type_is_a (type, KATZE_TYPE_ITEM))
|
if (g_type_is_a (type, KATZE_TYPE_ITEM))
|
||||||
katze_item_set_parent (item, array);
|
katze_item_set_parent (item, array);
|
||||||
|
@ -461,6 +461,24 @@ katze_array_move_item (KatzeArray* array,
|
||||||
g_signal_emit (array, signals[MOVE_ITEM], 0, item, position);
|
g_signal_emit (array, signals[MOVE_ITEM], 0, item, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* katze_array_get_items:
|
||||||
|
* @array: a #KatzeArray
|
||||||
|
*
|
||||||
|
* Retrieves the items as a list.
|
||||||
|
*
|
||||||
|
* Return value: a newly allocated #GList of items
|
||||||
|
*
|
||||||
|
* Since: 0.2.5
|
||||||
|
**/
|
||||||
|
GList*
|
||||||
|
katze_array_get_items (KatzeArray* array)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (KATZE_IS_ARRAY (array), NULL);
|
||||||
|
|
||||||
|
return g_list_copy (array->items);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* katze_array_clear:
|
* katze_array_clear:
|
||||||
* @array: a #KatzeArray
|
* @array: a #KatzeArray
|
||||||
|
|
|
@ -77,6 +77,9 @@ katze_array_move_item (KatzeArray* array,
|
||||||
gpointer item,
|
gpointer item,
|
||||||
gint position);
|
gint position);
|
||||||
|
|
||||||
|
GList*
|
||||||
|
katze_array_get_items (KatzeArray* array);
|
||||||
|
|
||||||
void
|
void
|
||||||
katze_array_clear (KatzeArray* array);
|
katze_array_clear (KatzeArray* array);
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,6 @@ katze_item_finalize (GObject* object)
|
||||||
g_free (item->name);
|
g_free (item->name);
|
||||||
g_free (item->text);
|
g_free (item->text);
|
||||||
g_free (item->uri);
|
g_free (item->uri);
|
||||||
g_free (item->icon);
|
|
||||||
g_free (item->token);
|
g_free (item->token);
|
||||||
|
|
||||||
g_hash_table_unref (item->metadata);
|
g_hash_table_unref (item->metadata);
|
||||||
|
@ -217,7 +216,7 @@ katze_item_set_property (GObject* object,
|
||||||
katze_assign (item->uri, g_value_dup_string (value));
|
katze_assign (item->uri, g_value_dup_string (value));
|
||||||
break;
|
break;
|
||||||
case PROP_ICON:
|
case PROP_ICON:
|
||||||
katze_assign (item->icon, g_value_dup_string (value));
|
katze_item_set_icon (item, g_value_get_string (value));
|
||||||
break;
|
break;
|
||||||
case PROP_TOKEN:
|
case PROP_TOKEN:
|
||||||
katze_assign (item->token, g_value_dup_string (value));
|
katze_assign (item->token, g_value_dup_string (value));
|
||||||
|
@ -254,7 +253,7 @@ katze_item_get_property (GObject* object,
|
||||||
g_value_set_string (value, item->uri);
|
g_value_set_string (value, item->uri);
|
||||||
break;
|
break;
|
||||||
case PROP_ICON:
|
case PROP_ICON:
|
||||||
g_value_set_string (value, item->icon);
|
g_value_set_string (value, katze_item_get_icon (item));
|
||||||
break;
|
break;
|
||||||
case PROP_TOKEN:
|
case PROP_TOKEN:
|
||||||
g_value_set_string (value, item->token);
|
g_value_set_string (value, item->token);
|
||||||
|
@ -398,7 +397,7 @@ katze_item_get_icon (KatzeItem* item)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (KATZE_IS_ITEM (item), NULL);
|
g_return_val_if_fail (KATZE_IS_ITEM (item), NULL);
|
||||||
|
|
||||||
return item->icon;
|
return katze_item_get_meta_string (item, "icon");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -414,7 +413,7 @@ katze_item_set_icon (KatzeItem* item,
|
||||||
{
|
{
|
||||||
g_return_if_fail (KATZE_IS_ITEM (item));
|
g_return_if_fail (KATZE_IS_ITEM (item));
|
||||||
|
|
||||||
katze_assign (item->icon, g_strdup (icon));
|
katze_item_set_meta_string (item, "icon", icon);
|
||||||
g_object_notify (G_OBJECT (item), "icon");
|
g_object_notify (G_OBJECT (item), "icon");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -698,7 +697,6 @@ katze_item_copy (KatzeItem* item)
|
||||||
"name", item->name,
|
"name", item->name,
|
||||||
"text", item->text,
|
"text", item->text,
|
||||||
"uri", item->uri,
|
"uri", item->uri,
|
||||||
"icon", item->icon,
|
|
||||||
"token", item->token,
|
"token", item->token,
|
||||||
"added", item->added,
|
"added", item->added,
|
||||||
"parent", item->parent,
|
"parent", item->parent,
|
||||||
|
|
|
@ -39,7 +39,6 @@ struct _KatzeItem
|
||||||
gchar* name;
|
gchar* name;
|
||||||
gchar* text;
|
gchar* text;
|
||||||
gchar* uri;
|
gchar* uri;
|
||||||
gchar* icon;
|
|
||||||
gchar* token;
|
gchar* token;
|
||||||
gint64 added;
|
gint64 added;
|
||||||
GHashTable* metadata;
|
GHashTable* metadata;
|
||||||
|
|
|
@ -27,7 +27,6 @@ struct _KatzeNet
|
||||||
{
|
{
|
||||||
GObject parent_instance;
|
GObject parent_instance;
|
||||||
|
|
||||||
GHashTable* memory;
|
|
||||||
gchar* cache_path;
|
gchar* cache_path;
|
||||||
guint cache_size;
|
guint cache_size;
|
||||||
|
|
||||||
|
@ -53,18 +52,9 @@ katze_net_class_init (KatzeNetClass* class)
|
||||||
gobject_class->finalize = katze_net_finalize;
|
gobject_class->finalize = katze_net_finalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
katze_net_object_maybe_unref (gpointer object)
|
|
||||||
{
|
|
||||||
if (object)
|
|
||||||
g_object_unref (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
katze_net_init (KatzeNet* net)
|
katze_net_init (KatzeNet* net)
|
||||||
{
|
{
|
||||||
net->memory = g_hash_table_new_full (g_str_hash, g_str_equal,
|
|
||||||
g_free, katze_net_object_maybe_unref);
|
|
||||||
net->cache_path = g_build_filename (g_get_user_cache_dir (),
|
net->cache_path = g_build_filename (g_get_user_cache_dir (),
|
||||||
PACKAGE_NAME, NULL);
|
PACKAGE_NAME, NULL);
|
||||||
|
|
||||||
|
@ -76,7 +66,6 @@ katze_net_finalize (GObject* object)
|
||||||
{
|
{
|
||||||
KatzeNet* net = KATZE_NET (object);
|
KatzeNet* net = KATZE_NET (object);
|
||||||
|
|
||||||
g_hash_table_destroy (net->memory);
|
|
||||||
katze_assign (net->cache_path, NULL);
|
katze_assign (net->cache_path, NULL);
|
||||||
|
|
||||||
G_OBJECT_CLASS (katze_net_parent_class)->finalize (object);
|
G_OBJECT_CLASS (katze_net_parent_class)->finalize (object);
|
||||||
|
@ -147,7 +136,7 @@ katze_net_priv_free (KatzeNetPriv* priv)
|
||||||
g_free (priv);
|
g_free (priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar*
|
gchar*
|
||||||
katze_net_get_cached_path (KatzeNet* net,
|
katze_net_get_cached_path (KatzeNet* net,
|
||||||
const gchar* uri,
|
const gchar* uri,
|
||||||
const gchar* subfolder)
|
const gchar* subfolder)
|
||||||
|
@ -383,242 +372,3 @@ katze_net_load_uri (KatzeNet* net,
|
||||||
g_idle_add ((GSourceFunc)katze_net_default_cb, priv);
|
g_idle_add ((GSourceFunc)katze_net_default_cb, priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
KatzeNet* net;
|
|
||||||
gchar* icon_file;
|
|
||||||
KatzeNetIconCb icon_cb;
|
|
||||||
GtkWidget* widget;
|
|
||||||
gpointer user_data;
|
|
||||||
} KatzeNetIconPriv;
|
|
||||||
|
|
||||||
static void
|
|
||||||
katze_net_icon_priv_free (KatzeNetIconPriv* priv)
|
|
||||||
{
|
|
||||||
g_free (priv->icon_file);
|
|
||||||
if (priv->widget)
|
|
||||||
g_object_unref (priv->widget);
|
|
||||||
g_free (priv);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
katze_net_icon_status_cb (KatzeNetRequest* request,
|
|
||||||
KatzeNetIconPriv* priv)
|
|
||||||
{
|
|
||||||
switch (request->status)
|
|
||||||
{
|
|
||||||
case KATZE_NET_VERIFIED:
|
|
||||||
if (request->mime_type &&
|
|
||||||
!g_str_has_prefix (request->mime_type, "image/"))
|
|
||||||
{
|
|
||||||
katze_net_icon_priv_free (priv);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case KATZE_NET_MOVED:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
katze_net_icon_priv_free (priv);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
katze_net_icon_transfer_cb (KatzeNetRequest* request,
|
|
||||||
KatzeNetIconPriv* priv)
|
|
||||||
{
|
|
||||||
GdkPixbuf* pixbuf;
|
|
||||||
FILE* fp;
|
|
||||||
GdkPixbuf* pixbuf_scaled;
|
|
||||||
gint icon_width, icon_height;
|
|
||||||
size_t ret;
|
|
||||||
GtkSettings* settings;
|
|
||||||
|
|
||||||
if (request->status == KATZE_NET_MOVED)
|
|
||||||
return;
|
|
||||||
|
|
||||||
pixbuf = NULL;
|
|
||||||
if (request->data)
|
|
||||||
{
|
|
||||||
if ((fp = fopen (priv->icon_file, "wb")))
|
|
||||||
{
|
|
||||||
ret = fwrite (request->data, 1, request->length, fp);
|
|
||||||
fclose (fp);
|
|
||||||
if ((ret - request->length) != 0)
|
|
||||||
{
|
|
||||||
g_warning ("Error writing to file %s "
|
|
||||||
"in katze_net_icon_transfer_cb()", priv->icon_file);
|
|
||||||
}
|
|
||||||
pixbuf = gdk_pixbuf_new_from_file (priv->icon_file, NULL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
pixbuf = katze_pixbuf_new_from_buffer ((guchar*)request->data,
|
|
||||||
request->length, request->mime_type, NULL);
|
|
||||||
if (pixbuf)
|
|
||||||
g_object_ref (pixbuf);
|
|
||||||
g_hash_table_insert (priv->net->memory,
|
|
||||||
g_strdup (priv->icon_file), pixbuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!priv->icon_cb)
|
|
||||||
{
|
|
||||||
katze_net_icon_priv_free (priv);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pixbuf)
|
|
||||||
{
|
|
||||||
if (priv->widget)
|
|
||||||
pixbuf = gtk_widget_render_icon (priv->widget,
|
|
||||||
GTK_STOCK_FILE, GTK_ICON_SIZE_MENU, NULL);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
priv->icon_cb (NULL, priv->user_data);
|
|
||||||
katze_net_icon_priv_free (priv);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->widget)
|
|
||||||
settings = gtk_widget_get_settings (priv->widget);
|
|
||||||
else
|
|
||||||
settings = gtk_settings_get_for_screen (gdk_screen_get_default ());
|
|
||||||
|
|
||||||
gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU,
|
|
||||||
&icon_width, &icon_height);
|
|
||||||
pixbuf_scaled = gdk_pixbuf_scale_simple (pixbuf, icon_width, icon_height,
|
|
||||||
GDK_INTERP_BILINEAR);
|
|
||||||
g_object_unref (pixbuf);
|
|
||||||
|
|
||||||
priv->icon_cb (pixbuf_scaled, priv->user_data);
|
|
||||||
katze_net_icon_priv_free (priv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* katze_net_load_icon:
|
|
||||||
* @net: a #KatzeNet
|
|
||||||
* @uri: an URI string, or %NULL
|
|
||||||
* @icon_cb: function to call upon completion
|
|
||||||
* @widget: a related #GtkWidget, or %NULL
|
|
||||||
* @user_data: data to pass to the callback
|
|
||||||
*
|
|
||||||
* Requests a transfer of an icon for @uri. This is
|
|
||||||
* implemented by looking for a favicon.ico, an
|
|
||||||
* image according to the file type or even a
|
|
||||||
* generated icon. The provided icon is intended
|
|
||||||
* for user interfaces and not guaranteed to be
|
|
||||||
* the same over multiple requests, plus it may
|
|
||||||
* be scaled to fit the menu icon size.
|
|
||||||
*
|
|
||||||
* Pass a valid #GtkWidget to @widget if you want
|
|
||||||
* a themed default icon in case of a missing icon,
|
|
||||||
* otherwise %NULL will be returned in that case.
|
|
||||||
*
|
|
||||||
* The caller is expected to use the returned icon
|
|
||||||
* and update it if @icon_cb is called.
|
|
||||||
*
|
|
||||||
* Depending on whether the icon was previously
|
|
||||||
* cached or @uri is a local resource, the returned
|
|
||||||
* icon may already be the final one.
|
|
||||||
*
|
|
||||||
* Note that both the returned #GdkPixbuf and the
|
|
||||||
* icon passed to @icon_cb are newly allocated and
|
|
||||||
* the caller owns the reference.
|
|
||||||
*
|
|
||||||
* Since 0.1.2 @widget can be %NULL.
|
|
||||||
*
|
|
||||||
* Return value: a #GdkPixbuf, or %NULL
|
|
||||||
**/
|
|
||||||
GdkPixbuf*
|
|
||||||
katze_net_load_icon (KatzeNet* net,
|
|
||||||
const gchar* uri,
|
|
||||||
KatzeNetIconCb icon_cb,
|
|
||||||
GtkWidget* widget,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
KatzeNetIconPriv* priv;
|
|
||||||
gchar* icon_uri;
|
|
||||||
gchar* icon_file;
|
|
||||||
GdkPixbuf* pixbuf;
|
|
||||||
gint icon_width, icon_height;
|
|
||||||
GdkPixbuf* pixbuf_scaled;
|
|
||||||
GtkSettings* settings;
|
|
||||||
|
|
||||||
g_return_val_if_fail (KATZE_IS_NET (net), NULL);
|
|
||||||
g_return_val_if_fail (!widget || GTK_IS_WIDGET (widget), NULL);
|
|
||||||
g_return_val_if_fail (uri != NULL, NULL);
|
|
||||||
|
|
||||||
pixbuf = NULL;
|
|
||||||
icon_uri = g_strdup (g_object_get_data (G_OBJECT (net), uri));
|
|
||||||
g_object_set_data (G_OBJECT (net), uri, NULL);
|
|
||||||
if ((icon_uri && g_str_has_prefix (icon_uri, "http"))
|
|
||||||
|| g_str_has_prefix (uri, "http"))
|
|
||||||
{
|
|
||||||
if (!icon_uri)
|
|
||||||
{
|
|
||||||
guint i = 8;
|
|
||||||
while (uri[i] != '\0' && uri[i] != '/')
|
|
||||||
i++;
|
|
||||||
if (uri[i] == '/')
|
|
||||||
{
|
|
||||||
icon_uri = g_strdup (uri);
|
|
||||||
icon_uri[i] = '\0';
|
|
||||||
icon_uri = g_strdup_printf ("%s/favicon.ico", icon_uri);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
icon_uri = g_strdup_printf ("%s/favicon.ico", uri);
|
|
||||||
}
|
|
||||||
|
|
||||||
icon_file = katze_net_get_cached_path (net, icon_uri, "icons");
|
|
||||||
|
|
||||||
if (g_hash_table_lookup_extended (net->memory,
|
|
||||||
icon_file, NULL, (gpointer)&pixbuf))
|
|
||||||
{
|
|
||||||
g_free (icon_file);
|
|
||||||
if (pixbuf)
|
|
||||||
g_object_ref (pixbuf);
|
|
||||||
}
|
|
||||||
else if ((pixbuf = gdk_pixbuf_new_from_file (icon_file, NULL)))
|
|
||||||
g_free (icon_file);
|
|
||||||
/* If the called doesn't provide an icon callback,
|
|
||||||
we assume there is no interest in loading an un-cached icon. */
|
|
||||||
else if (icon_cb)
|
|
||||||
{
|
|
||||||
priv = g_new0 (KatzeNetIconPriv, 1);
|
|
||||||
priv->net = net;
|
|
||||||
priv->icon_file = icon_file;
|
|
||||||
priv->icon_cb = icon_cb;
|
|
||||||
priv->widget = widget ? g_object_ref (widget) : NULL;
|
|
||||||
priv->user_data = user_data;
|
|
||||||
|
|
||||||
katze_net_load_uri (net, icon_uri,
|
|
||||||
(KatzeNetStatusCb)katze_net_icon_status_cb,
|
|
||||||
(KatzeNetTransferCb)katze_net_icon_transfer_cb, priv);
|
|
||||||
}
|
|
||||||
g_free (icon_uri);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pixbuf)
|
|
||||||
{
|
|
||||||
if (widget)
|
|
||||||
pixbuf = gtk_widget_render_icon (widget,
|
|
||||||
GTK_STOCK_FILE, GTK_ICON_SIZE_MENU, NULL);
|
|
||||||
else
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (widget)
|
|
||||||
settings = gtk_widget_get_settings (widget);
|
|
||||||
else
|
|
||||||
settings = gtk_settings_get_for_screen (gdk_screen_get_default ());
|
|
||||||
|
|
||||||
gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU,
|
|
||||||
&icon_width, &icon_height);
|
|
||||||
pixbuf_scaled = gdk_pixbuf_scale_simple (pixbuf, icon_width, icon_height,
|
|
||||||
GDK_INTERP_BILINEAR);
|
|
||||||
g_object_unref (pixbuf);
|
|
||||||
|
|
||||||
return pixbuf_scaled;
|
|
||||||
}
|
|
||||||
|
|
|
@ -74,15 +74,10 @@ katze_net_load_uri (KatzeNet* net,
|
||||||
KatzeNetTransferCb transfer_cb,
|
KatzeNetTransferCb transfer_cb,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
typedef void (*KatzeNetIconCb) (GdkPixbuf* icon,
|
gchar*
|
||||||
gpointer user_data);
|
katze_net_get_cached_path (KatzeNet* net,
|
||||||
|
|
||||||
GdkPixbuf*
|
|
||||||
katze_net_load_icon (KatzeNet* net,
|
|
||||||
const gchar* uri,
|
const gchar* uri,
|
||||||
KatzeNetIconCb icon_cb,
|
const gchar* subfolder);
|
||||||
GtkWidget* widget,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2007-2008 Christian Dywan <christian@twotoasts.de>
|
Copyright (C) 2007-2010 Christian Dywan <christian@twotoasts.de>
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
#define HAVE_SPINNER GTK_CHECK_VERSION (2, 20, 0)
|
||||||
|
|
||||||
#if !GTK_CHECK_VERSION (2, 18, 0)
|
#if !GTK_CHECK_VERSION (2, 18, 0)
|
||||||
#define gtk_widget_get_allocation(wdgt, alloc) *alloc = wdgt->allocation
|
#define gtk_widget_get_allocation(wdgt, alloc) *alloc = wdgt->allocation
|
||||||
#define gtk_widget_set_has_window(wdgt, wnd) \
|
#define gtk_widget_set_has_window(wdgt, wnd) \
|
||||||
|
@ -25,7 +27,11 @@
|
||||||
|
|
||||||
struct _KatzeThrobber
|
struct _KatzeThrobber
|
||||||
{
|
{
|
||||||
|
#if HAVE_SPINNER
|
||||||
|
GtkSpinner parent_instance;
|
||||||
|
#else
|
||||||
GtkMisc parent_instance;
|
GtkMisc parent_instance;
|
||||||
|
#endif
|
||||||
|
|
||||||
GtkIconSize icon_size;
|
GtkIconSize icon_size;
|
||||||
gchar* icon_name;
|
gchar* icon_name;
|
||||||
|
@ -42,7 +48,20 @@ struct _KatzeThrobber
|
||||||
gint height;
|
gint height;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _KatzeThrobberClass
|
||||||
|
{
|
||||||
|
#if HAVE_SPINNER
|
||||||
|
GtkSpinnerClass parent_class;
|
||||||
|
#else
|
||||||
|
GtkMiscClass parent_class;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
#if HAVE_SPINNER
|
||||||
|
G_DEFINE_TYPE (KatzeThrobber, katze_throbber, GTK_TYPE_SPINNER);
|
||||||
|
#else
|
||||||
G_DEFINE_TYPE (KatzeThrobber, katze_throbber, GTK_TYPE_MISC);
|
G_DEFINE_TYPE (KatzeThrobber, katze_throbber, GTK_TYPE_MISC);
|
||||||
|
#endif
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -106,11 +125,13 @@ katze_throbber_expose_event (GtkWidget* widget,
|
||||||
static void
|
static void
|
||||||
icon_theme_changed (KatzeThrobber* throbber);
|
icon_theme_changed (KatzeThrobber* throbber);
|
||||||
|
|
||||||
|
#if !HAVE_SPINNER
|
||||||
static gboolean
|
static gboolean
|
||||||
katze_throbber_timeout (KatzeThrobber* throbber);
|
katze_throbber_timeout (KatzeThrobber* throbber);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
katze_throbber_timeout_destroy (KatzeThrobber* throbber);
|
katze_throbber_timeout_destroy (KatzeThrobber* throbber);
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
katze_throbber_class_init (KatzeThrobberClass* class)
|
katze_throbber_class_init (KatzeThrobberClass* class)
|
||||||
|
@ -206,6 +227,9 @@ static void
|
||||||
katze_throbber_init (KatzeThrobber *throbber)
|
katze_throbber_init (KatzeThrobber *throbber)
|
||||||
{
|
{
|
||||||
gtk_widget_set_has_window (GTK_WIDGET (throbber), FALSE);
|
gtk_widget_set_has_window (GTK_WIDGET (throbber), FALSE);
|
||||||
|
#if !HAVE_SPINNER
|
||||||
|
gtk_misc_set_alignment (GTK_MISC (throbber), 0.0, 0.5);
|
||||||
|
#endif
|
||||||
|
|
||||||
throbber->timer_id = -1;
|
throbber->timer_id = -1;
|
||||||
}
|
}
|
||||||
|
@ -431,14 +455,17 @@ katze_throbber_set_animated (KatzeThrobber* throbber,
|
||||||
|
|
||||||
throbber->animated = animated;
|
throbber->animated = animated;
|
||||||
|
|
||||||
|
#if HAVE_SPINNER
|
||||||
|
g_object_set (throbber, "active", animated, NULL);
|
||||||
|
#else
|
||||||
if (animated && (throbber->timer_id < 0))
|
if (animated && (throbber->timer_id < 0))
|
||||||
throbber->timer_id = g_timeout_add_full (
|
throbber->timer_id = g_timeout_add_full (
|
||||||
G_PRIORITY_LOW, 50,
|
G_PRIORITY_LOW, 50,
|
||||||
(GSourceFunc)katze_throbber_timeout,
|
(GSourceFunc)katze_throbber_timeout,
|
||||||
throbber,
|
throbber,
|
||||||
(GDestroyNotify)katze_throbber_timeout_destroy);
|
(GDestroyNotify)katze_throbber_timeout_destroy);
|
||||||
|
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (throbber));
|
gtk_widget_queue_draw (GTK_WIDGET (throbber));
|
||||||
|
#endif
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (throbber), "animated");
|
g_object_notify (G_OBJECT (throbber), "animated");
|
||||||
}
|
}
|
||||||
|
@ -741,6 +768,7 @@ katze_throbber_unmap (GtkWidget* widget)
|
||||||
GTK_WIDGET_CLASS (katze_throbber_parent_class)->unmap (widget);
|
GTK_WIDGET_CLASS (katze_throbber_parent_class)->unmap (widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !HAVE_SPINNER
|
||||||
static gboolean
|
static gboolean
|
||||||
katze_throbber_timeout (KatzeThrobber* throbber)
|
katze_throbber_timeout (KatzeThrobber* throbber)
|
||||||
{
|
{
|
||||||
|
@ -756,6 +784,7 @@ katze_throbber_timeout_destroy (KatzeThrobber* throbber)
|
||||||
throbber->index = 0;
|
throbber->index = 0;
|
||||||
throbber->timer_id = -1;
|
throbber->timer_id = -1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
katze_throbber_style_set (GtkWidget* widget,
|
katze_throbber_style_set (GtkWidget* widget,
|
||||||
|
@ -803,10 +832,16 @@ katze_throbber_aligned_coords (GtkWidget* widget,
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
GtkRequisition requisition;
|
GtkRequisition requisition;
|
||||||
|
|
||||||
|
#if HAVE_SPINNER
|
||||||
|
xalign = 0.0;
|
||||||
|
yalign = 0.5;
|
||||||
|
xpad = ypad = 0.0;
|
||||||
|
#else
|
||||||
gtk_misc_get_alignment (GTK_MISC (widget), &xalign, &yalign);
|
gtk_misc_get_alignment (GTK_MISC (widget), &xalign, &yalign);
|
||||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
||||||
xalign = 1.0f - xalign;
|
xalign = 1.0f - xalign;
|
||||||
gtk_misc_get_padding (GTK_MISC (widget), &xpad, &ypad);
|
gtk_misc_get_padding (GTK_MISC (widget), &xpad, &ypad);
|
||||||
|
#endif
|
||||||
|
|
||||||
gtk_widget_get_allocation (widget, &allocation);
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
gtk_widget_size_request (widget, &requisition);
|
gtk_widget_size_request (widget, &requisition);
|
||||||
|
@ -823,6 +858,11 @@ katze_throbber_expose_event (GtkWidget* widget,
|
||||||
gint ax, ay;
|
gint ax, ay;
|
||||||
KatzeThrobber* throbber = KATZE_THROBBER (widget);
|
KatzeThrobber* throbber = KATZE_THROBBER (widget);
|
||||||
|
|
||||||
|
#if HAVE_SPINNER
|
||||||
|
if (throbber->animated)
|
||||||
|
return GTK_WIDGET_CLASS (katze_throbber_parent_class)->expose_event (widget, event);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (G_UNLIKELY (!throbber->width || !throbber->height))
|
if (G_UNLIKELY (!throbber->width || !throbber->height))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
|
|
@ -33,16 +33,6 @@ typedef struct _KatzeThrobber KatzeThrobber;
|
||||||
typedef struct _KatzeThrobberPrivate KatzeThrobberPrivate;
|
typedef struct _KatzeThrobberPrivate KatzeThrobberPrivate;
|
||||||
typedef struct _KatzeThrobberClass KatzeThrobberClass;
|
typedef struct _KatzeThrobberClass KatzeThrobberClass;
|
||||||
|
|
||||||
struct _KatzeThrobberClass
|
|
||||||
{
|
|
||||||
GtkMiscClass parent_class;
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_katze_reserved1) (void);
|
|
||||||
void (*_katze_reserved2) (void);
|
|
||||||
void (*_katze_reserved3) (void);
|
|
||||||
void (*_katze_reserved4) (void);
|
|
||||||
};
|
|
||||||
|
|
||||||
GType
|
GType
|
||||||
katze_throbber_get_type (void) G_GNUC_CONST;
|
katze_throbber_get_type (void) G_GNUC_CONST;
|
||||||
|
|
|
@ -29,6 +29,9 @@
|
||||||
#include <hildon/hildon.h>
|
#include <hildon/hildon.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !GTK_CHECK_VERSION (2, 14, 0)
|
||||||
|
#define gtk_widget_get_window(wdgt) wdgt->window
|
||||||
|
#endif
|
||||||
#if !GTK_CHECK_VERSION (2, 18, 0)
|
#if !GTK_CHECK_VERSION (2, 18, 0)
|
||||||
#define gtk_widget_get_has_window(wdgt) !GTK_WIDGET_NO_WINDOW (wdgt)
|
#define gtk_widget_get_has_window(wdgt) !GTK_WIDGET_NO_WINDOW (wdgt)
|
||||||
#define gtk_widget_get_allocation(wdgt, alloc) *alloc = wdgt->allocation
|
#define gtk_widget_get_allocation(wdgt, alloc) *alloc = wdgt->allocation
|
||||||
|
@ -85,6 +88,7 @@ proxy_combo_box_text_changed_cb (GtkComboBox* button,
|
||||||
gchar* text = gtk_combo_box_get_active_text (button);
|
gchar* text = gtk_combo_box_get_active_text (button);
|
||||||
const gchar* property = g_object_get_data (G_OBJECT (button), "property");
|
const gchar* property = g_object_get_data (G_OBJECT (button), "property");
|
||||||
g_object_set (object, property, text, NULL);
|
g_object_set (object, property, text, NULL);
|
||||||
|
g_free (text);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const gchar*
|
static const gchar*
|
||||||
|
@ -1457,7 +1461,7 @@ katze_load_cached_icon (const gchar* uri,
|
||||||
{
|
{
|
||||||
GdkPixbuf* icon = NULL;
|
GdkPixbuf* icon = NULL;
|
||||||
|
|
||||||
if (g_str_has_prefix (uri, "http://"))
|
if (g_str_has_prefix (uri, "http://") || g_str_has_prefix (uri,"https://"))
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
gchar* icon_uri;
|
gchar* icon_uri;
|
||||||
|
|
|
@ -67,8 +67,6 @@ gtk_icon_entry_set_icon_from_pixbuf (GtkEntry* entry,
|
||||||
((pos) == GTK_ICON_ENTRY_PRIMARY || \
|
((pos) == GTK_ICON_ENTRY_PRIMARY || \
|
||||||
(pos) == GTK_ICON_ENTRY_SECONDARY)
|
(pos) == GTK_ICON_ENTRY_SECONDARY)
|
||||||
|
|
||||||
#define GTK_ICON_ENTRY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_ICON_ENTRY, GtkIconEntryPrivate))
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
|
@ -84,13 +82,13 @@ typedef struct
|
||||||
gboolean insensitive;
|
gboolean insensitive;
|
||||||
} EntryIconInfo;
|
} EntryIconInfo;
|
||||||
|
|
||||||
typedef struct _GtkIconEntryPrivate
|
struct _GtkIconEntryPrivate
|
||||||
{
|
{
|
||||||
gdouble fraction;
|
gdouble fraction;
|
||||||
EntryIconInfo icons[MAX_ICONS];
|
EntryIconInfo icons[MAX_ICONS];
|
||||||
|
|
||||||
gulong icon_released_id;
|
gulong icon_released_id;
|
||||||
} GtkIconEntryPrivate;
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -602,7 +600,7 @@ entry_expose_event (GtkWidget* entry,
|
||||||
GdkWindow* text_area;
|
GdkWindow* text_area;
|
||||||
gint width, height;
|
gint width, height;
|
||||||
|
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (icon_entry);
|
priv = icon_entry->priv;
|
||||||
text_area = GTK_ENTRY (entry)->text_area;
|
text_area = GTK_ENTRY (entry)->text_area;
|
||||||
gdk_drawable_get_size (text_area, &width, &height);
|
gdk_drawable_get_size (text_area, &width, &height);
|
||||||
|
|
||||||
|
@ -620,6 +618,9 @@ entry_expose_event (GtkWidget* entry,
|
||||||
static void
|
static void
|
||||||
gtk_icon_entry_init (GtkIconEntry *entry)
|
gtk_icon_entry_init (GtkIconEntry *entry)
|
||||||
{
|
{
|
||||||
|
entry->priv = G_TYPE_INSTANCE_GET_PRIVATE (entry, GTK_TYPE_ICON_ENTRY,
|
||||||
|
GtkIconEntryPrivate);
|
||||||
|
|
||||||
g_signal_connect_after (entry, "expose-event",
|
g_signal_connect_after (entry, "expose-event",
|
||||||
G_CALLBACK (entry_expose_event), entry);
|
G_CALLBACK (entry_expose_event), entry);
|
||||||
}
|
}
|
||||||
|
@ -662,7 +663,7 @@ gtk_icon_entry_map (GtkWidget *widget)
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (parent_class)->map (widget);
|
GTK_WIDGET_CLASS (parent_class)->map (widget);
|
||||||
|
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (widget);
|
priv = GTK_ICON_ENTRY (widget)->priv;
|
||||||
|
|
||||||
for (i = 0; i < MAX_ICONS; i++)
|
for (i = 0; i < MAX_ICONS; i++)
|
||||||
{
|
{
|
||||||
|
@ -692,7 +693,7 @@ gtk_icon_entry_unmap (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (widget);
|
priv = GTK_ICON_ENTRY (widget)->priv;
|
||||||
|
|
||||||
for (i = 0; i < MAX_ICONS; i++)
|
for (i = 0; i < MAX_ICONS; i++)
|
||||||
{
|
{
|
||||||
|
@ -809,7 +810,7 @@ get_icon_width (GtkIconEntry *entry, GtkIconEntryPosition icon_pos)
|
||||||
GtkIconEntryPrivate *priv;
|
GtkIconEntryPrivate *priv;
|
||||||
EntryIconInfo *icon_info;
|
EntryIconInfo *icon_info;
|
||||||
|
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (entry);
|
priv = entry->priv;
|
||||||
icon_info = &priv->icons[icon_pos];
|
icon_info = &priv->icons[icon_pos];
|
||||||
|
|
||||||
if (icon_info->pixbuf == NULL)
|
if (icon_info->pixbuf == NULL)
|
||||||
|
@ -911,7 +912,7 @@ gtk_icon_entry_realize (GtkWidget *widget)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
entry = GTK_ICON_ENTRY (widget);
|
entry = GTK_ICON_ENTRY (widget);
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (entry);
|
priv = entry->priv;
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (parent_class)->realize (widget);
|
GTK_WIDGET_CLASS (parent_class)->realize (widget);
|
||||||
|
|
||||||
|
@ -955,7 +956,7 @@ gtk_icon_entry_unrealize (GtkWidget *widget)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
entry = GTK_ICON_ENTRY (widget);
|
entry = GTK_ICON_ENTRY (widget);
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (entry);
|
priv = entry->priv;
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
|
GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
|
||||||
|
|
||||||
|
@ -1006,7 +1007,7 @@ place_windows (GtkIconEntry *icon_entry, GtkAllocation *widget_alloc)
|
||||||
GtkIconEntryPrivate *priv;
|
GtkIconEntryPrivate *priv;
|
||||||
gint y;
|
gint y;
|
||||||
|
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (icon_entry);
|
priv = icon_entry->priv;
|
||||||
|
|
||||||
get_text_area_size (icon_entry, &text_area_alloc);
|
get_text_area_size (icon_entry, &text_area_alloc);
|
||||||
|
|
||||||
|
@ -1066,7 +1067,7 @@ get_pixbuf_from_icon (GtkIconEntry *entry, GtkIconEntryPosition icon_pos)
|
||||||
EntryIconInfo *icon_info;
|
EntryIconInfo *icon_info;
|
||||||
GtkIconEntryPrivate *priv;
|
GtkIconEntryPrivate *priv;
|
||||||
|
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (entry);
|
priv = entry->priv;
|
||||||
icon_info = &priv->icons[icon_pos];
|
icon_info = &priv->icons[icon_pos];
|
||||||
|
|
||||||
g_object_ref (icon_info->pixbuf);
|
g_object_ref (icon_info->pixbuf);
|
||||||
|
@ -1131,7 +1132,7 @@ draw_icon (GtkWidget *widget, GtkIconEntryPosition icon_pos)
|
||||||
gint x, y, width, height;
|
gint x, y, width, height;
|
||||||
|
|
||||||
entry = GTK_ICON_ENTRY (widget);
|
entry = GTK_ICON_ENTRY (widget);
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (entry);
|
priv = entry->priv;
|
||||||
icon_info = &priv->icons[icon_pos];
|
icon_info = &priv->icons[icon_pos];
|
||||||
|
|
||||||
if (icon_info->pixbuf == NULL || !GTK_WIDGET_REALIZED (widget))
|
if (icon_info->pixbuf == NULL || !GTK_WIDGET_REALIZED (widget))
|
||||||
|
@ -1211,7 +1212,7 @@ gtk_icon_entry_expose (GtkWidget *widget, GdkEventExpose *event)
|
||||||
g_return_val_if_fail (event != NULL, FALSE);
|
g_return_val_if_fail (event != NULL, FALSE);
|
||||||
|
|
||||||
entry = GTK_ICON_ENTRY (widget);
|
entry = GTK_ICON_ENTRY (widget);
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (entry);
|
priv = entry->priv;
|
||||||
|
|
||||||
if (GTK_WIDGET_DRAWABLE (widget))
|
if (GTK_WIDGET_DRAWABLE (widget))
|
||||||
{
|
{
|
||||||
|
@ -1256,7 +1257,7 @@ gtk_icon_entry_enter_notify (GtkWidget *widget, GdkEventCrossing *event)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
entry = GTK_ICON_ENTRY (widget);
|
entry = GTK_ICON_ENTRY (widget);
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (entry);
|
priv = entry->priv;
|
||||||
|
|
||||||
for (i = 0; i < MAX_ICONS; i++)
|
for (i = 0; i < MAX_ICONS; i++)
|
||||||
{
|
{
|
||||||
|
@ -1293,7 +1294,7 @@ gtk_icon_entry_leave_notify (GtkWidget *widget, GdkEventCrossing *event)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
entry = GTK_ICON_ENTRY (widget);
|
entry = GTK_ICON_ENTRY (widget);
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (entry);
|
priv = entry->priv;
|
||||||
|
|
||||||
for (i = 0; i < MAX_ICONS; i++)
|
for (i = 0; i < MAX_ICONS; i++)
|
||||||
{
|
{
|
||||||
|
@ -1322,7 +1323,7 @@ gtk_icon_entry_button_press (GtkWidget *widget, GdkEventButton *event)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
entry = GTK_ICON_ENTRY (widget);
|
entry = GTK_ICON_ENTRY (widget);
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (entry);
|
priv = entry->priv;
|
||||||
|
|
||||||
for (i = 0; i < MAX_ICONS; i++)
|
for (i = 0; i < MAX_ICONS; i++)
|
||||||
{
|
{
|
||||||
|
@ -1355,7 +1356,7 @@ gtk_icon_entry_button_release (GtkWidget *widget, GdkEventButton *event)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
entry = GTK_ICON_ENTRY (widget);
|
entry = GTK_ICON_ENTRY (widget);
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (entry);
|
priv = entry->priv;
|
||||||
|
|
||||||
for (i = 0; i < MAX_ICONS; i++)
|
for (i = 0; i < MAX_ICONS; i++)
|
||||||
{
|
{
|
||||||
|
@ -1407,7 +1408,7 @@ icon_theme_changed (GtkIconEntry *entry)
|
||||||
GtkIconEntryPrivate *priv;
|
GtkIconEntryPrivate *priv;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (entry);
|
priv = entry->priv;
|
||||||
|
|
||||||
for (i = 0; i < MAX_ICONS; i++)
|
for (i = 0; i < MAX_ICONS; i++)
|
||||||
{
|
{
|
||||||
|
@ -1445,7 +1446,7 @@ gtk_icon_entry_set_icon_internal (GtkIconEntry *entry,
|
||||||
g_return_if_fail (GTK_IS_ICON_ENTRY (entry));
|
g_return_if_fail (GTK_IS_ICON_ENTRY (entry));
|
||||||
g_return_if_fail (IS_VALID_ICON_ENTRY_POSITION (icon_pos));
|
g_return_if_fail (IS_VALID_ICON_ENTRY_POSITION (icon_pos));
|
||||||
|
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (entry);
|
priv = entry->priv;
|
||||||
icon_info = &priv->icons[icon_pos];
|
icon_info = &priv->icons[icon_pos];
|
||||||
|
|
||||||
if (pixbuf == icon_info->pixbuf)
|
if (pixbuf == icon_info->pixbuf)
|
||||||
|
@ -1517,7 +1518,7 @@ gtk_icon_entry_set_icon_from_pixbuf (GtkIconEntry *entry,
|
||||||
g_return_if_fail (GTK_IS_ICON_ENTRY (entry));
|
g_return_if_fail (GTK_IS_ICON_ENTRY (entry));
|
||||||
g_return_if_fail (IS_VALID_ICON_ENTRY_POSITION (icon_pos));
|
g_return_if_fail (IS_VALID_ICON_ENTRY_POSITION (icon_pos));
|
||||||
|
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (entry);
|
priv = entry->priv;
|
||||||
icon_info = &priv->icons[icon_pos];
|
icon_info = &priv->icons[icon_pos];
|
||||||
|
|
||||||
if (pixbuf == icon_info->pixbuf)
|
if (pixbuf == icon_info->pixbuf)
|
||||||
|
@ -1614,7 +1615,7 @@ gtk_icon_entry_set_icon_from_icon_name (GtkIconEntry *entry,
|
||||||
g_return_if_fail (GTK_IS_ICON_ENTRY (entry));
|
g_return_if_fail (GTK_IS_ICON_ENTRY (entry));
|
||||||
g_return_if_fail (IS_VALID_ICON_ENTRY_POSITION (icon_pos));
|
g_return_if_fail (IS_VALID_ICON_ENTRY_POSITION (icon_pos));
|
||||||
|
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (entry);
|
priv = entry->priv;
|
||||||
icon_info = &priv->icons[icon_pos];
|
icon_info = &priv->icons[icon_pos];
|
||||||
|
|
||||||
screen = gtk_widget_get_screen (GTK_WIDGET (entry));
|
screen = gtk_widget_get_screen (GTK_WIDGET (entry));
|
||||||
|
@ -1672,7 +1673,7 @@ gtk_icon_entry_set_icon_from_gicon (const GtkIconEntry *entry,
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GtkIconInfo *info;
|
GtkIconInfo *info;
|
||||||
|
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (entry);
|
priv = entry->priv;
|
||||||
icon_info = &priv->icons[icon_pos];
|
icon_info = &priv->icons[icon_pos];
|
||||||
|
|
||||||
screen = gtk_widget_get_screen (GTK_WIDGET (entry));
|
screen = gtk_widget_get_screen (GTK_WIDGET (entry));
|
||||||
|
@ -1725,7 +1726,7 @@ gtk_icon_entry_set_cursor (const GtkIconEntry *entry,
|
||||||
GtkIconEntryPrivate *priv;
|
GtkIconEntryPrivate *priv;
|
||||||
GdkCursor *cursor;
|
GdkCursor *cursor;
|
||||||
|
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (entry);
|
priv = entry->priv;
|
||||||
icon_info = &priv->icons[icon_pos];
|
icon_info = &priv->icons[icon_pos];
|
||||||
|
|
||||||
icon_info->cursor_type = cursor_type;
|
icon_info->cursor_type = cursor_type;
|
||||||
|
@ -1757,7 +1758,7 @@ gtk_icon_entry_set_icon_highlight (const GtkIconEntry *entry,
|
||||||
EntryIconInfo *icon_info;
|
EntryIconInfo *icon_info;
|
||||||
GtkIconEntryPrivate *priv;
|
GtkIconEntryPrivate *priv;
|
||||||
|
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (entry);
|
priv = entry->priv;
|
||||||
|
|
||||||
g_return_if_fail (entry != NULL);
|
g_return_if_fail (entry != NULL);
|
||||||
g_return_if_fail (GTK_IS_ICON_ENTRY (entry));
|
g_return_if_fail (GTK_IS_ICON_ENTRY (entry));
|
||||||
|
@ -1792,7 +1793,7 @@ gtk_icon_entry_get_pixbuf (const GtkIconEntry *entry,
|
||||||
g_return_val_if_fail (GTK_IS_ICON_ENTRY (entry), NULL);
|
g_return_val_if_fail (GTK_IS_ICON_ENTRY (entry), NULL);
|
||||||
g_return_val_if_fail (IS_VALID_ICON_ENTRY_POSITION (icon_pos), NULL);
|
g_return_val_if_fail (IS_VALID_ICON_ENTRY_POSITION (icon_pos), NULL);
|
||||||
|
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (entry);
|
priv = entry->priv;
|
||||||
|
|
||||||
return priv->icons[icon_pos].pixbuf;
|
return priv->icons[icon_pos].pixbuf;
|
||||||
}
|
}
|
||||||
|
@ -1818,7 +1819,7 @@ gtk_icon_entry_get_gicon (const GtkIconEntry *entry,
|
||||||
g_return_val_if_fail (GTK_IS_ICON_ENTRY (entry), NULL);
|
g_return_val_if_fail (GTK_IS_ICON_ENTRY (entry), NULL);
|
||||||
g_return_val_if_fail (IS_VALID_ICON_ENTRY_POSITION (icon_pos), NULL);
|
g_return_val_if_fail (IS_VALID_ICON_ENTRY_POSITION (icon_pos), NULL);
|
||||||
|
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (entry);
|
priv = entry->priv;
|
||||||
icon_info = &priv->icons[icon_pos];
|
icon_info = &priv->icons[icon_pos];
|
||||||
|
|
||||||
return icon_info->storage_type == _GTK_IMAGE_GICON ? icon_info->gicon : NULL;
|
return icon_info->storage_type == _GTK_IMAGE_GICON ? icon_info->gicon : NULL;
|
||||||
|
@ -1843,7 +1844,7 @@ gtk_icon_entry_get_icon_highlight (const GtkIconEntry *entry,
|
||||||
g_return_val_if_fail (GTK_IS_ICON_ENTRY (entry), FALSE);
|
g_return_val_if_fail (GTK_IS_ICON_ENTRY (entry), FALSE);
|
||||||
g_return_val_if_fail (IS_VALID_ICON_ENTRY_POSITION (icon_pos), FALSE);
|
g_return_val_if_fail (IS_VALID_ICON_ENTRY_POSITION (icon_pos), FALSE);
|
||||||
|
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (entry);
|
priv = entry->priv;
|
||||||
|
|
||||||
return priv->icons[icon_pos].highlight;
|
return priv->icons[icon_pos].highlight;
|
||||||
}
|
}
|
||||||
|
@ -1869,7 +1870,7 @@ gtk_icon_entry_set_tooltip (const GtkIconEntry *entry,
|
||||||
g_return_if_fail (GTK_IS_ICON_ENTRY (entry));
|
g_return_if_fail (GTK_IS_ICON_ENTRY (entry));
|
||||||
g_return_if_fail (IS_VALID_ICON_ENTRY_POSITION (icon_pos));
|
g_return_if_fail (IS_VALID_ICON_ENTRY_POSITION (icon_pos));
|
||||||
|
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (entry);
|
priv = entry->priv;
|
||||||
|
|
||||||
icon_info = &priv->icons[icon_pos];
|
icon_info = &priv->icons[icon_pos];
|
||||||
|
|
||||||
|
@ -1899,7 +1900,7 @@ gtk_icon_entry_set_icon_sensitive (const GtkIconEntry *icon_entry,
|
||||||
g_return_if_fail (GTK_IS_ICON_ENTRY (icon_entry));
|
g_return_if_fail (GTK_IS_ICON_ENTRY (icon_entry));
|
||||||
g_return_if_fail (IS_VALID_ICON_ENTRY_POSITION (icon_pos));
|
g_return_if_fail (IS_VALID_ICON_ENTRY_POSITION (icon_pos));
|
||||||
|
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (icon_entry);
|
priv = icon_entry->priv;
|
||||||
|
|
||||||
icon_info = &priv->icons[icon_pos];
|
icon_info = &priv->icons[icon_pos];
|
||||||
|
|
||||||
|
@ -1922,7 +1923,7 @@ gtk_icon_entry_set_progress_fraction (GtkIconEntry *icon_entry,
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_ICON_ENTRY (icon_entry));
|
g_return_if_fail (GTK_IS_ICON_ENTRY (icon_entry));
|
||||||
|
|
||||||
priv = GTK_ICON_ENTRY_GET_PRIVATE (icon_entry);
|
priv = icon_entry->priv;
|
||||||
priv->fraction = CLAMP (fraction, 0.0, 1.0);
|
priv->fraction = CLAMP (fraction, 0.0, 1.0);
|
||||||
|
|
||||||
if (GTK_ENTRY (icon_entry)->text_area)
|
if (GTK_ENTRY (icon_entry)->text_area)
|
||||||
|
|
|
@ -62,12 +62,15 @@ typedef enum
|
||||||
GTK_ICON_ENTRY_SECONDARY
|
GTK_ICON_ENTRY_SECONDARY
|
||||||
} GtkIconEntryPosition;
|
} GtkIconEntryPosition;
|
||||||
|
|
||||||
typedef struct _GtkIconEntry GtkIconEntry;
|
typedef struct _GtkIconEntry GtkIconEntry;
|
||||||
typedef struct _GtkIconEntryClass GtkIconEntryClass;
|
typedef struct _GtkIconEntryClass GtkIconEntryClass;
|
||||||
|
typedef struct _GtkIconEntryPrivate GtkIconEntryPrivate;
|
||||||
|
|
||||||
struct _GtkIconEntry
|
struct _GtkIconEntry
|
||||||
{
|
{
|
||||||
GtkEntry parent_object;
|
GtkEntry parent_object;
|
||||||
|
|
||||||
|
GtkIconEntryPrivate* priv;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkIconEntryClass
|
struct _GtkIconEntryClass
|
||||||
|
|
159
midori/main.c
159
midori/main.c
|
@ -15,7 +15,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "midori.h"
|
#include "midori.h"
|
||||||
#include "midori-addons.h"
|
|
||||||
#include "midori-array.h"
|
#include "midori-array.h"
|
||||||
#include "midori-bookmarks.h"
|
#include "midori-bookmarks.h"
|
||||||
#include "midori-console.h"
|
#include "midori-console.h"
|
||||||
|
@ -54,6 +53,13 @@
|
||||||
#define BOOKMARK_FILE "bookmarks.xbel"
|
#define BOOKMARK_FILE "bookmarks.xbel"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_X11_EXTENSIONS_SCRNSAVER_H
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/Xutil.h>
|
||||||
|
#include <X11/extensions/scrnsaver.h>
|
||||||
|
#include <gdk/gdkx.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static gchar*
|
static gchar*
|
||||||
build_config_filename (const gchar* filename)
|
build_config_filename (const gchar* filename)
|
||||||
{
|
{
|
||||||
|
@ -654,11 +660,6 @@ midori_app_add_browser_cb (MidoriApp* app,
|
||||||
gtk_widget_show (addon);
|
gtk_widget_show (addon);
|
||||||
midori_panel_append_page (MIDORI_PANEL (panel), MIDORI_VIEWABLE (addon));
|
midori_panel_append_page (MIDORI_PANEL (panel), MIDORI_VIEWABLE (addon));
|
||||||
|
|
||||||
/* Userscripts */
|
|
||||||
addon = midori_addons_new (MIDORI_ADDON_USER_SCRIPTS, GTK_WIDGET (browser));
|
|
||||||
gtk_widget_show (addon);
|
|
||||||
midori_panel_append_page (MIDORI_PANEL (panel), MIDORI_VIEWABLE (addon));
|
|
||||||
|
|
||||||
/* Extensions */
|
/* Extensions */
|
||||||
addon = g_object_new (MIDORI_TYPE_EXTENSIONS, NULL);
|
addon = g_object_new (MIDORI_TYPE_EXTENSIONS, NULL);
|
||||||
gtk_widget_show (addon);
|
gtk_widget_show (addon);
|
||||||
|
@ -752,10 +753,10 @@ soup_session_settings_notify_http_proxy_cb (MidoriWebSettings* settings,
|
||||||
GParamSpec* pspec,
|
GParamSpec* pspec,
|
||||||
SoupSession* session)
|
SoupSession* session)
|
||||||
{
|
{
|
||||||
gboolean auto_detect_proxy;
|
MidoriProxy proxy_type;
|
||||||
|
|
||||||
auto_detect_proxy = katze_object_get_boolean (settings, "auto-detect-proxy");
|
proxy_type = katze_object_get_enum (settings, "proxy-type");
|
||||||
if (auto_detect_proxy)
|
if (proxy_type == MIDORI_PROXY_AUTOMATIC)
|
||||||
{
|
{
|
||||||
gboolean gnome_supported = FALSE;
|
gboolean gnome_supported = FALSE;
|
||||||
GModule* module;
|
GModule* module;
|
||||||
|
@ -773,12 +774,14 @@ soup_session_settings_notify_http_proxy_cb (MidoriWebSettings* settings,
|
||||||
if (!gnome_supported)
|
if (!gnome_supported)
|
||||||
midori_soup_session_set_proxy_uri (session, g_getenv ("http_proxy"));
|
midori_soup_session_set_proxy_uri (session, g_getenv ("http_proxy"));
|
||||||
}
|
}
|
||||||
else
|
else if (proxy_type == MIDORI_PROXY_HTTP)
|
||||||
{
|
{
|
||||||
gchar* http_proxy = katze_object_get_string (settings, "http-proxy");
|
gchar* http_proxy = katze_object_get_string (settings, "http-proxy");
|
||||||
midori_soup_session_set_proxy_uri (session, http_proxy);
|
midori_soup_session_set_proxy_uri (session, http_proxy);
|
||||||
g_free (http_proxy);
|
g_free (http_proxy);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
midori_soup_session_set_proxy_uri (session, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !WEBKIT_CHECK_VERSION (1, 1, 11)
|
#if !WEBKIT_CHECK_VERSION (1, 1, 11)
|
||||||
|
@ -843,6 +846,29 @@ midori_soup_session_prepare (SoupSession* session,
|
||||||
SoupSessionFeature* feature;
|
SoupSessionFeature* feature;
|
||||||
gchar* config_file;
|
gchar* config_file;
|
||||||
|
|
||||||
|
#if WEBKIT_CHECK_VERSION (1, 1, 14) && defined (HAVE_LIBSOUP_2_29_91)
|
||||||
|
const gchar* certificate_files[] =
|
||||||
|
{
|
||||||
|
"/etc/pki/tls/certs/ca-bundle.crt",
|
||||||
|
"/etc/ssl/certs/ca-certificates.crt",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
for (i = 0; i < G_N_ELEMENTS (certificate_files); i++)
|
||||||
|
if (g_access (certificate_files[i], F_OK) == 0)
|
||||||
|
{
|
||||||
|
g_object_set (session,
|
||||||
|
"ssl-ca-file", certificate_files[i],
|
||||||
|
"ssl-strict", FALSE,
|
||||||
|
NULL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i == G_N_ELEMENTS (certificate_files))
|
||||||
|
g_warning (_("No root certificate file is available. "
|
||||||
|
"SSL certificates cannot be verified."));
|
||||||
|
#endif
|
||||||
|
|
||||||
soup_session_settings_notify_http_proxy_cb (settings, NULL, session);
|
soup_session_settings_notify_http_proxy_cb (settings, NULL, session);
|
||||||
g_signal_connect (settings, "notify::http-proxy",
|
g_signal_connect (settings, "notify::http-proxy",
|
||||||
G_CALLBACK (soup_session_settings_notify_http_proxy_cb), session);
|
G_CALLBACK (soup_session_settings_notify_http_proxy_cb), session);
|
||||||
|
@ -1422,6 +1448,92 @@ signal_handler (int signal_id)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void
|
||||||
|
midori_soup_session_block_uris_cb (SoupSession* session,
|
||||||
|
SoupMessage* msg,
|
||||||
|
gchar* blocked_uris)
|
||||||
|
{
|
||||||
|
static GRegex* regex = NULL;
|
||||||
|
SoupURI* soup_uri;
|
||||||
|
gchar* uri;
|
||||||
|
if (!regex)
|
||||||
|
regex = g_regex_new (blocked_uris, 0, 0, NULL);
|
||||||
|
soup_uri = soup_message_get_uri (msg);
|
||||||
|
uri = soup_uri_to_string (soup_uri, FALSE);
|
||||||
|
if (g_regex_match (regex, uri, 0, 0))
|
||||||
|
{
|
||||||
|
soup_uri = soup_uri_new ("http://.invalid");
|
||||||
|
soup_message_set_uri (msg, soup_uri);
|
||||||
|
soup_uri_free (soup_uri);
|
||||||
|
}
|
||||||
|
g_free (uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
MidoriBrowser* browser;
|
||||||
|
guint timeout;
|
||||||
|
gchar* uri;
|
||||||
|
} MidoriInactivityTimeout;
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
midori_inactivity_timeout (gpointer data)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_X11_EXTENSIONS_SCRNSAVER_H
|
||||||
|
MidoriInactivityTimeout* mit = data;
|
||||||
|
static Display* xdisplay = NULL;
|
||||||
|
static XScreenSaverInfo* mit_info = NULL;
|
||||||
|
static int has_extension = -1;
|
||||||
|
int event_base, error_base;
|
||||||
|
|
||||||
|
if (has_extension == -1)
|
||||||
|
{
|
||||||
|
GdkDisplay* display = gtk_widget_get_display (GTK_WIDGET (mit->browser));
|
||||||
|
xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
||||||
|
has_extension = XScreenSaverQueryExtension (xdisplay,
|
||||||
|
&event_base, &error_base);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (has_extension)
|
||||||
|
{
|
||||||
|
if (!mit_info)
|
||||||
|
mit_info = XScreenSaverAllocInfo ();
|
||||||
|
|
||||||
|
XScreenSaverQueryInfo (xdisplay, RootWindow (xdisplay, 0), mit_info);
|
||||||
|
if (mit_info->idle / 1000 > mit->timeout)
|
||||||
|
{
|
||||||
|
guint i = 0;
|
||||||
|
GtkWidget* view;
|
||||||
|
|
||||||
|
while ((view = midori_browser_get_nth_tab (mit->browser, i++)))
|
||||||
|
gtk_widget_destroy (view);
|
||||||
|
midori_browser_set_current_uri (mit->browser, mit->uri);
|
||||||
|
/* TODO: Re-run initial commands */
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/* TODO: Implement for other windowing systems */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
midori_setup_inactivity_reset (MidoriBrowser* browser,
|
||||||
|
gint inactivity_reset,
|
||||||
|
const gchar* uri)
|
||||||
|
{
|
||||||
|
if (inactivity_reset > 0)
|
||||||
|
{
|
||||||
|
MidoriInactivityTimeout* mit = g_new (MidoriInactivityTimeout, 1);
|
||||||
|
mit->browser = browser;
|
||||||
|
mit->timeout = inactivity_reset;
|
||||||
|
mit->uri = g_strdup (uri);
|
||||||
|
g_timeout_add_seconds (inactivity_reset, midori_inactivity_timeout,
|
||||||
|
mit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc,
|
main (int argc,
|
||||||
char** argv)
|
char** argv)
|
||||||
|
@ -1434,6 +1546,8 @@ main (int argc,
|
||||||
gboolean execute;
|
gboolean execute;
|
||||||
gboolean version;
|
gboolean version;
|
||||||
gchar** uris;
|
gchar** uris;
|
||||||
|
gchar* block_uris;
|
||||||
|
gint inactivity_reset;
|
||||||
MidoriApp* app;
|
MidoriApp* app;
|
||||||
gboolean result;
|
gboolean result;
|
||||||
GError* error;
|
GError* error;
|
||||||
|
@ -1459,6 +1573,13 @@ main (int argc,
|
||||||
N_("Display program version"), NULL },
|
N_("Display program version"), NULL },
|
||||||
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &uris,
|
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &uris,
|
||||||
N_("Addresses"), NULL },
|
N_("Addresses"), NULL },
|
||||||
|
{ "block-uris", 'b', 0, G_OPTION_ARG_STRING, &block_uris,
|
||||||
|
N_("Block URIs according to regular expression PATTERN"), _("PATTERN") },
|
||||||
|
#ifdef HAVE_X11_EXTENSIONS_SCRNSAVER_H
|
||||||
|
{ "inactivity-reset", 'i', 0, G_OPTION_ARG_INT, &inactivity_reset,
|
||||||
|
/* i18n: CLI: Close tabs, clear private data, open starting page */
|
||||||
|
N_("Reset Midori after SECONDS seconds of inactivity"), N_("SECONDS") },
|
||||||
|
#endif
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
GString* error_messages;
|
GString* error_messages;
|
||||||
|
@ -1534,6 +1655,8 @@ main (int argc,
|
||||||
execute = FALSE;
|
execute = FALSE;
|
||||||
version = FALSE;
|
version = FALSE;
|
||||||
uris = NULL;
|
uris = NULL;
|
||||||
|
block_uris = NULL;
|
||||||
|
inactivity_reset = 0;
|
||||||
error = NULL;
|
error = NULL;
|
||||||
if (!gtk_init_with_args (&argc, &argv, _("[Addresses]"), entries,
|
if (!gtk_init_with_args (&argc, &argv, _("[Addresses]"), entries,
|
||||||
GETTEXT_PACKAGE, &error))
|
GETTEXT_PACKAGE, &error))
|
||||||
|
@ -1557,7 +1680,7 @@ main (int argc,
|
||||||
{
|
{
|
||||||
g_print (
|
g_print (
|
||||||
"%s %s\n\n"
|
"%s %s\n\n"
|
||||||
"Copyright (c) 2007-2009 Christian Dywan\n\n"
|
"Copyright (c) 2007-2010 Christian Dywan\n\n"
|
||||||
"%s\n"
|
"%s\n"
|
||||||
"\t%s\n\n"
|
"\t%s\n\n"
|
||||||
"%s\n"
|
"%s\n"
|
||||||
|
@ -1642,11 +1765,20 @@ main (int argc,
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (block_uris)
|
||||||
|
g_signal_connect (webkit_get_default_session (), "request-queued",
|
||||||
|
G_CALLBACK (midori_soup_session_block_uris_cb),
|
||||||
|
g_strdup (block_uris));
|
||||||
|
midori_setup_inactivity_reset (browser, inactivity_reset, webapp);
|
||||||
midori_startup_timer ("App created: \t%f");
|
midori_startup_timer ("App created: \t%f");
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME: Inactivity reset is only supported for app mode */
|
||||||
|
if (inactivity_reset > 0)
|
||||||
|
g_error ("--inactivity-reset is currently only supported with --app.");
|
||||||
|
|
||||||
/* Standalone javascript support */
|
/* Standalone javascript support */
|
||||||
if (run)
|
if (run)
|
||||||
return midori_run_script (uris ? *uris : NULL);
|
return midori_run_script (uris ? *uris : NULL);
|
||||||
|
@ -1978,6 +2110,11 @@ main (int argc,
|
||||||
|
|
||||||
if (execute)
|
if (execute)
|
||||||
g_object_set_data (G_OBJECT (app), "execute-command", uris);
|
g_object_set_data (G_OBJECT (app), "execute-command", uris);
|
||||||
|
if (block_uris)
|
||||||
|
g_signal_connect (webkit_get_default_session (), "request-queued",
|
||||||
|
G_CALLBACK (midori_soup_session_block_uris_cb),
|
||||||
|
g_strdup (block_uris));
|
||||||
|
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2008-2009 Christian Dywan <christian@twotoasts.de>
|
Copyright (C) 2008-2010 Christian Dywan <christian@twotoasts.de>
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -227,6 +227,14 @@ midori_app_class_init (MidoriAppClass* class)
|
||||||
{
|
{
|
||||||
GObjectClass* gobject_class;
|
GObjectClass* gobject_class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MidoriApp::add-browser:
|
||||||
|
* @app: the object on which the signal is emitted
|
||||||
|
* @browser: a #MidoriBrowser
|
||||||
|
*
|
||||||
|
* A new browser is being added to the app,
|
||||||
|
* see midori_app_add_browser().
|
||||||
|
*/
|
||||||
signals[ADD_BROWSER] = g_signal_new (
|
signals[ADD_BROWSER] = g_signal_new (
|
||||||
"add-browser",
|
"add-browser",
|
||||||
G_TYPE_FROM_CLASS (class),
|
G_TYPE_FROM_CLASS (class),
|
||||||
|
@ -243,7 +251,8 @@ midori_app_class_init (MidoriAppClass* class)
|
||||||
* @app: the object on which the signal is emitted
|
* @app: the object on which the signal is emitted
|
||||||
* @browser: a #MidoriBrowser
|
* @browser: a #MidoriBrowser
|
||||||
*
|
*
|
||||||
* A new browser is being added to the app.
|
* A browser is being removed from the app because it
|
||||||
|
* was destroyed.
|
||||||
*
|
*
|
||||||
* Since: 0.1.7
|
* Since: 0.1.7
|
||||||
*/
|
*/
|
||||||
|
@ -258,6 +267,13 @@ midori_app_class_init (MidoriAppClass* class)
|
||||||
G_TYPE_NONE, 1,
|
G_TYPE_NONE, 1,
|
||||||
MIDORI_TYPE_BROWSER);
|
MIDORI_TYPE_BROWSER);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MidoriApp::quit:
|
||||||
|
* @app: the object on which the signal is emitted
|
||||||
|
* @browser: a #MidoriBrowser
|
||||||
|
*
|
||||||
|
* The app is being quit, see midori_app_quit().
|
||||||
|
*/
|
||||||
signals[QUIT] = g_signal_new (
|
signals[QUIT] = g_signal_new (
|
||||||
"quit",
|
"quit",
|
||||||
G_TYPE_FROM_CLASS (class),
|
G_TYPE_FROM_CLASS (class),
|
||||||
|
@ -470,14 +486,17 @@ midori_app_command_received (MidoriApp* app,
|
||||||
gchar* fixed_uri = sokoke_magic_uri (*uris);
|
gchar* fixed_uri = sokoke_magic_uri (*uris);
|
||||||
if (!fixed_uri)
|
if (!fixed_uri)
|
||||||
fixed_uri = g_strdup (*uris);
|
fixed_uri = g_strdup (*uris);
|
||||||
if (first)
|
if (sokoke_recursive_fork_protection (fixed_uri, FALSE))
|
||||||
{
|
{
|
||||||
midori_browser_set_current_uri (browser, fixed_uri);
|
if (first)
|
||||||
first = FALSE;
|
{
|
||||||
|
midori_browser_set_current_uri (browser, fixed_uri);
|
||||||
|
first = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
midori_browser_set_current_page (browser,
|
||||||
|
midori_browser_add_uri (browser, fixed_uri));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
midori_browser_set_current_page (browser,
|
|
||||||
midori_browser_add_uri (browser, fixed_uri));
|
|
||||||
g_free (fixed_uri);
|
g_free (fixed_uri);
|
||||||
uris++;
|
uris++;
|
||||||
}
|
}
|
||||||
|
@ -1128,11 +1147,48 @@ midori_app_create_browser (MidoriApp* app)
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* midori_app_get_browsers:
|
||||||
|
* @app: a #MidoriApp
|
||||||
|
*
|
||||||
|
* Retrieves the browsers as a list.
|
||||||
|
*
|
||||||
|
* Return value: a newly allocated #Glist of #MidoriBrowser
|
||||||
|
*
|
||||||
|
* Since: 0.2.5
|
||||||
|
**/
|
||||||
|
GList*
|
||||||
|
midori_app_get_browsers (MidoriApp* app)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (MIDORI_IS_APP (app), NULL);
|
||||||
|
|
||||||
|
return katze_array_get_items (app->browsers);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* midori_app_get_browser:
|
||||||
|
* @app: a #MidoriApp
|
||||||
|
*
|
||||||
|
* Determines the current browser, which is the one that was
|
||||||
|
* last focussed.
|
||||||
|
*
|
||||||
|
* Return value: the current #MidoriBrowser
|
||||||
|
*
|
||||||
|
* Since: 0.2.5
|
||||||
|
**/
|
||||||
|
MidoriBrowser*
|
||||||
|
midori_app_get_browser (MidoriApp* app)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (MIDORI_IS_APP (app), NULL);
|
||||||
|
|
||||||
|
return app->browser;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* midori_app_quit:
|
* midori_app_quit:
|
||||||
* @app: a #MidoriApp
|
* @app: a #MidoriApp
|
||||||
*
|
*
|
||||||
* Quits the #MidoriApp singleton.
|
* Quits the #MidoriApp.
|
||||||
*
|
*
|
||||||
* Since 0.1.2 the "quit" signal is always emitted before quitting.
|
* Since 0.1.2 the "quit" signal is always emitted before quitting.
|
||||||
**/
|
**/
|
||||||
|
|
|
@ -65,6 +65,12 @@ midori_app_add_browser (MidoriApp* app,
|
||||||
MidoriBrowser*
|
MidoriBrowser*
|
||||||
midori_app_create_browser (MidoriApp* app);
|
midori_app_create_browser (MidoriApp* app);
|
||||||
|
|
||||||
|
MidoriBrowser*
|
||||||
|
midori_app_get_browser (MidoriApp* app);
|
||||||
|
|
||||||
|
GList*
|
||||||
|
midori_app_get_browsers (MidoriApp* app);
|
||||||
|
|
||||||
void
|
void
|
||||||
midori_app_quit (MidoriApp* app);
|
midori_app_quit (MidoriApp* app);
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -18,6 +18,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <katze/katze.h>
|
#include <katze/katze.h>
|
||||||
|
#include "midori-view.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -129,9 +130,17 @@ midori_browser_get_nth_tab (MidoriBrowser* browser,
|
||||||
void
|
void
|
||||||
midori_browser_set_current_tab (MidoriBrowser* browser,
|
midori_browser_set_current_tab (MidoriBrowser* browser,
|
||||||
GtkWidget* widget);
|
GtkWidget* widget);
|
||||||
|
#define midori_browser_set_tab midori_browser_set_current_tab
|
||||||
|
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
midori_browser_get_current_tab (MidoriBrowser* browser);
|
midori_browser_get_current_tab (MidoriBrowser* browser);
|
||||||
|
#define midori_browser_get_tab midori_browser_get_current_tab
|
||||||
|
|
||||||
|
GList*
|
||||||
|
midori_browser_get_tabs (MidoriBrowser* browser);
|
||||||
|
|
||||||
|
KatzeArray*
|
||||||
|
midori_browser_get_proxy_items (MidoriBrowser* browser);
|
||||||
|
|
||||||
KatzeArray*
|
KatzeArray*
|
||||||
midori_browser_get_proxy_array (MidoriBrowser* browser);
|
midori_browser_get_proxy_array (MidoriBrowser* browser);
|
||||||
|
@ -145,6 +154,9 @@ midori_browser_quit (MidoriBrowser* browser);
|
||||||
const gchar**
|
const gchar**
|
||||||
midori_browser_get_toolbar_actions (MidoriBrowser* browser);
|
midori_browser_get_toolbar_actions (MidoriBrowser* browser);
|
||||||
|
|
||||||
|
MidoriWebSettings*
|
||||||
|
midori_browser_get_settings (MidoriBrowser* browser);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __MIDORI_BROWSER_H__ */
|
#endif /* __MIDORI_BROWSER_H__ */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2008-2009 Christian Dywan <christian@twotoasts.de>
|
Copyright (C) 2008-2010 Christian Dywan <christian@twotoasts.de>
|
||||||
Copyright (C) 2008 Dale Whittaker <dayul@users.sf.net>
|
Copyright (C) 2008-2010 Dale Whittaker <dayul@users.sf.net>
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -373,7 +373,8 @@ midori_location_action_popup_timeout_cb (gpointer data)
|
||||||
result = sqlite3_step (stmt);
|
result = sqlite3_step (stmt);
|
||||||
if (result != SQLITE_ROW && !action->search_engines)
|
if (result != SQLITE_ROW && !action->search_engines)
|
||||||
{
|
{
|
||||||
g_print (_("Failed to select from history\n"));
|
if (result == SQLITE_ERROR)
|
||||||
|
g_print (_("Failed to select from history\n"));
|
||||||
sqlite3_reset (stmt);
|
sqlite3_reset (stmt);
|
||||||
sqlite3_clear_bindings (stmt);
|
sqlite3_clear_bindings (stmt);
|
||||||
midori_location_action_popdown_completion (action);
|
midori_location_action_popdown_completion (action);
|
||||||
|
@ -384,6 +385,7 @@ midori_location_action_popup_timeout_cb (gpointer data)
|
||||||
{
|
{
|
||||||
GtkTreeModel* model = NULL;
|
GtkTreeModel* model = NULL;
|
||||||
GtkWidget* popup;
|
GtkWidget* popup;
|
||||||
|
GtkWidget* popup_frame;
|
||||||
GtkWidget* scrolled;
|
GtkWidget* scrolled;
|
||||||
GtkWidget* treeview;
|
GtkWidget* treeview;
|
||||||
GtkCellRenderer* renderer;
|
GtkCellRenderer* renderer;
|
||||||
|
@ -393,10 +395,13 @@ midori_location_action_popup_timeout_cb (gpointer data)
|
||||||
|
|
||||||
popup = gtk_window_new (GTK_WINDOW_POPUP);
|
popup = gtk_window_new (GTK_WINDOW_POPUP);
|
||||||
gtk_window_set_type_hint (GTK_WINDOW (popup), GDK_WINDOW_TYPE_HINT_COMBO);
|
gtk_window_set_type_hint (GTK_WINDOW (popup), GDK_WINDOW_TYPE_HINT_COMBO);
|
||||||
|
popup_frame = gtk_frame_new (NULL);
|
||||||
|
gtk_frame_set_shadow_type (GTK_FRAME (popup_frame), GTK_SHADOW_ETCHED_IN);
|
||||||
|
gtk_container_add (GTK_CONTAINER (popup), popup_frame);
|
||||||
scrolled = g_object_new (GTK_TYPE_SCROLLED_WINDOW,
|
scrolled = g_object_new (GTK_TYPE_SCROLLED_WINDOW,
|
||||||
"hscrollbar-policy", GTK_POLICY_NEVER,
|
"hscrollbar-policy", GTK_POLICY_NEVER,
|
||||||
"vscrollbar-policy", GTK_POLICY_AUTOMATIC, NULL);
|
"vscrollbar-policy", GTK_POLICY_AUTOMATIC, NULL);
|
||||||
gtk_container_add (GTK_CONTAINER (popup), scrolled);
|
gtk_container_add (GTK_CONTAINER (popup_frame), scrolled);
|
||||||
treeview = gtk_tree_view_new_with_model (model);
|
treeview = gtk_tree_view_new_with_model (model);
|
||||||
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
|
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
|
||||||
gtk_tree_view_set_hover_selection (GTK_TREE_VIEW (treeview), TRUE);
|
gtk_tree_view_set_hover_selection (GTK_TREE_VIEW (treeview), TRUE);
|
||||||
|
@ -486,7 +491,7 @@ midori_location_action_popup_timeout_cb (gpointer data)
|
||||||
searches += i;
|
searches += i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GTK_WIDGET_VISIBLE (action->popup))
|
if (!gtk_widget_get_visible (action->popup))
|
||||||
{
|
{
|
||||||
GtkWidget* toplevel = gtk_widget_get_toplevel (action->entry);
|
GtkWidget* toplevel = gtk_widget_get_toplevel (action->entry);
|
||||||
gtk_window_set_screen (GTK_WINDOW (action->popup),
|
gtk_window_set_screen (GTK_WINDOW (action->popup),
|
||||||
|
@ -831,7 +836,7 @@ midori_location_action_button_press_event_cb (GtkEntry* entry,
|
||||||
GdkEventKey* event,
|
GdkEventKey* event,
|
||||||
MidoriLocationAction* action)
|
MidoriLocationAction* action)
|
||||||
{
|
{
|
||||||
if (action->popup && GTK_WIDGET_VISIBLE (action->popup))
|
if (action->popup && gtk_widget_get_visible (action->popup))
|
||||||
{
|
{
|
||||||
midori_location_action_popdown_completion (action);
|
midori_location_action_popdown_completion (action);
|
||||||
|
|
||||||
|
@ -863,7 +868,7 @@ midori_location_action_key_press_event_cb (GtkEntry* entry,
|
||||||
case GDK_Right:
|
case GDK_Right:
|
||||||
case GDK_KP_Right:
|
case GDK_KP_Right:
|
||||||
|
|
||||||
if (location_action->popup && GTK_WIDGET_VISIBLE (location_action->popup))
|
if (location_action->popup && gtk_widget_get_visible (location_action->popup))
|
||||||
{
|
{
|
||||||
GtkTreeModel* model = location_action->completion_model;
|
GtkTreeModel* model = location_action->completion_model;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
@ -892,7 +897,7 @@ midori_location_action_key_press_event_cb (GtkEntry* entry,
|
||||||
break;
|
break;
|
||||||
case GDK_Escape:
|
case GDK_Escape:
|
||||||
{
|
{
|
||||||
if (location_action->popup && GTK_WIDGET_VISIBLE (location_action->popup))
|
if (location_action->popup && gtk_widget_get_visible (location_action->popup))
|
||||||
{
|
{
|
||||||
midori_location_action_popdown_completion (location_action);
|
midori_location_action_popdown_completion (location_action);
|
||||||
text = gtk_entry_get_text (entry);
|
text = gtk_entry_get_text (entry);
|
||||||
|
@ -906,7 +911,7 @@ midori_location_action_key_press_event_cb (GtkEntry* entry,
|
||||||
}
|
}
|
||||||
case GDK_Page_Up:
|
case GDK_Page_Up:
|
||||||
case GDK_Page_Down:
|
case GDK_Page_Down:
|
||||||
if (!(location_action->popup && GTK_WIDGET_VISIBLE (location_action->popup)))
|
if (!(location_action->popup && gtk_widget_get_visible (location_action->popup)))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case GDK_Down:
|
case GDK_Down:
|
||||||
case GDK_KP_Down:
|
case GDK_KP_Down:
|
||||||
|
@ -915,7 +920,7 @@ midori_location_action_key_press_event_cb (GtkEntry* entry,
|
||||||
{
|
{
|
||||||
GtkWidget* parent;
|
GtkWidget* parent;
|
||||||
|
|
||||||
if (location_action->popup && GTK_WIDGET_VISIBLE (location_action->popup))
|
if (location_action->popup && gtk_widget_get_visible (location_action->popup))
|
||||||
{
|
{
|
||||||
GtkTreeModel* model = location_action->completion_model;
|
GtkTreeModel* model = location_action->completion_model;
|
||||||
gint matches = gtk_tree_model_iter_n_children (model, NULL);
|
gint matches = gtk_tree_model_iter_n_children (model, NULL);
|
||||||
|
@ -1680,3 +1685,60 @@ midori_location_action_clear (MidoriLocationAction* location_action)
|
||||||
|
|
||||||
midori_location_action_toggle_arrow (location_action);
|
midori_location_action_toggle_arrow (location_action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* midori_location_action_set_security_hint:
|
||||||
|
* @location_action: a #MidoriLocationAction
|
||||||
|
* @hint: a security hint
|
||||||
|
*
|
||||||
|
* Sets a security hint on the action, so that the security status
|
||||||
|
* can be reflected visually.
|
||||||
|
*
|
||||||
|
* Since: 0.2.5
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
midori_location_action_set_security_hint (MidoriLocationAction* location_action,
|
||||||
|
MidoriSecurity hint)
|
||||||
|
{
|
||||||
|
GSList* proxies;
|
||||||
|
GtkWidget* entry;
|
||||||
|
GtkWidget* child;
|
||||||
|
|
||||||
|
g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action));
|
||||||
|
|
||||||
|
proxies = gtk_action_get_proxies (GTK_ACTION (location_action));
|
||||||
|
|
||||||
|
for (; proxies != NULL; proxies = g_slist_next (proxies))
|
||||||
|
if (GTK_IS_TOOL_ITEM (proxies->data))
|
||||||
|
{
|
||||||
|
GdkColor bg_color = { 0, 1 };
|
||||||
|
GdkColor fg_color = { 0, 1 };
|
||||||
|
|
||||||
|
entry = midori_location_action_entry_for_proxy (proxies->data);
|
||||||
|
child = gtk_bin_get_child (GTK_BIN (entry));
|
||||||
|
|
||||||
|
if (hint == MIDORI_SECURITY_UNKNOWN)
|
||||||
|
{
|
||||||
|
gdk_color_parse ("#ef7070", &bg_color);
|
||||||
|
gdk_color_parse ("#000", &fg_color);
|
||||||
|
#if !HAVE_HILDON
|
||||||
|
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (child),
|
||||||
|
GTK_ICON_ENTRY_SECONDARY, GTK_STOCK_INFO);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else if (hint == MIDORI_SECURITY_TRUSTED)
|
||||||
|
{
|
||||||
|
gdk_color_parse ("#fcf19a", &bg_color);
|
||||||
|
gdk_color_parse ("#000", &fg_color);
|
||||||
|
#if !HAVE_HILDON
|
||||||
|
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (child),
|
||||||
|
GTK_ICON_ENTRY_SECONDARY, GTK_STOCK_DIALOG_AUTHENTICATION);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_widget_modify_base (child, GTK_STATE_NORMAL,
|
||||||
|
bg_color.red == 1 ? NULL : &bg_color);
|
||||||
|
gtk_widget_modify_text (child, GTK_STATE_NORMAL,
|
||||||
|
bg_color.red == 1 ? NULL : &fg_color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#define __MIDORI_LOCATION_ACTION_H__
|
#define __MIDORI_LOCATION_ACTION_H__
|
||||||
|
|
||||||
#include <katze/katze.h>
|
#include <katze/katze.h>
|
||||||
|
#include "midori-view.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -101,6 +102,10 @@ midori_location_action_delete_item_from_uri (MidoriLocationAction* location_acti
|
||||||
void
|
void
|
||||||
midori_location_action_clear (MidoriLocationAction* location_action);
|
midori_location_action_clear (MidoriLocationAction* location_action);
|
||||||
|
|
||||||
|
void
|
||||||
|
midori_location_action_set_security_hint (MidoriLocationAction* location_action,
|
||||||
|
MidoriSecurity hint);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __MIDORI_LOCATION_ACTION_H__ */
|
#endif /* __MIDORI_LOCATION_ACTION_H__ */
|
||||||
|
|
|
@ -405,7 +405,6 @@ midori_panel_init (MidoriPanel* panel)
|
||||||
|
|
||||||
/* Create the sidebar */
|
/* Create the sidebar */
|
||||||
panel->toolbar = gtk_toolbar_new ();
|
panel->toolbar = gtk_toolbar_new ();
|
||||||
gtk_toolbar_set_style (GTK_TOOLBAR (panel->toolbar), GTK_TOOLBAR_ICONS);
|
|
||||||
gtk_toolbar_set_icon_size (GTK_TOOLBAR (panel->toolbar), GTK_ICON_SIZE_BUTTON);
|
gtk_toolbar_set_icon_size (GTK_TOOLBAR (panel->toolbar), GTK_ICON_SIZE_BUTTON);
|
||||||
gtk_toolbar_set_show_arrow (GTK_TOOLBAR (panel->toolbar), FALSE);
|
gtk_toolbar_set_show_arrow (GTK_TOOLBAR (panel->toolbar), FALSE);
|
||||||
gtk_widget_show_all (panel->toolbar);
|
gtk_widget_show_all (panel->toolbar);
|
||||||
|
@ -657,7 +656,7 @@ midori_panel_construct_menu_item (MidoriPanel* panel,
|
||||||
menuitem = gtk_action_create_menu_item (action);
|
menuitem = gtk_action_create_menu_item (action);
|
||||||
g_object_set_data (G_OBJECT (menuitem), "page", viewable);
|
g_object_set_data (G_OBJECT (menuitem), "page", viewable);
|
||||||
|
|
||||||
if (GTK_WIDGET_VISIBLE (viewable))
|
if (gtk_widget_get_visible (GTK_WIDGET (viewable)))
|
||||||
gtk_widget_show (menuitem);
|
gtk_widget_show (menuitem);
|
||||||
return menuitem;
|
return menuitem;
|
||||||
}
|
}
|
||||||
|
@ -841,7 +840,7 @@ midori_panel_append_page (MidoriPanel* panel,
|
||||||
g_signal_connect (viewable, "destroy",
|
g_signal_connect (viewable, "destroy",
|
||||||
G_CALLBACK (midori_panel_viewable_destroy_cb), panel);
|
G_CALLBACK (midori_panel_viewable_destroy_cb), panel);
|
||||||
|
|
||||||
if (!GTK_WIDGET_VISIBLE (viewable))
|
if (!gtk_widget_get_visible (GTK_WIDGET (viewable)))
|
||||||
{
|
{
|
||||||
gtk_widget_hide (scrolled);
|
gtk_widget_hide (scrolled);
|
||||||
gtk_widget_hide (GTK_WIDGET (toolitem));
|
gtk_widget_hide (GTK_WIDGET (toolitem));
|
||||||
|
@ -992,7 +991,7 @@ midori_panel_set_current_page (MidoriPanel* panel,
|
||||||
GList* items;
|
GList* items;
|
||||||
const gchar* label;
|
const gchar* label;
|
||||||
|
|
||||||
if (!GTK_WIDGET_VISIBLE (viewable))
|
if (!gtk_widget_get_visible (viewable))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (panel->toolbook), n);
|
gtk_notebook_set_current_page (GTK_NOTEBOOK (panel->toolbook), n);
|
||||||
|
|
|
@ -183,14 +183,13 @@ midori_preferences_homepage_current_clicked_cb (GtkWidget* button,
|
||||||
|
|
||||||
#if !HAVE_HILDON
|
#if !HAVE_HILDON
|
||||||
static void
|
static void
|
||||||
midori_preferences_notify_auto_detect_proxy_cb (MidoriWebSettings* settings,
|
midori_preferences_notify_proxy_type_cb (MidoriWebSettings* settings,
|
||||||
GParamSpec* pspec,
|
GParamSpec* pspec,
|
||||||
GtkWidget* entry)
|
GtkWidget* entry)
|
||||||
{
|
{
|
||||||
MidoriIdentity auto_detect_proxy = katze_object_get_enum (settings,
|
MidoriProxy proxy_type = katze_object_get_enum (settings, "proxy-type");
|
||||||
"auto-detect-proxy");
|
|
||||||
|
|
||||||
gtk_widget_set_sensitive (entry, !auto_detect_proxy);
|
gtk_widget_set_sensitive (entry, proxy_type == MIDORI_PROXY_HTTP);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -410,6 +409,12 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
|
||||||
SPANNED_ADD (button);
|
SPANNED_ADD (button);
|
||||||
button = katze_property_proxy (settings, "zoom-text-and-images", NULL);
|
button = katze_property_proxy (settings, "zoom-text-and-images", NULL);
|
||||||
INDENTED_ADD (button);
|
INDENTED_ADD (button);
|
||||||
|
#if WEBKIT_CHECK_VERSION (1, 1, 11)
|
||||||
|
button = katze_property_proxy (settings, "javascript-can-open-windows-automatically", NULL);
|
||||||
|
gtk_button_set_label (GTK_BUTTON (button), _("Allow scripts to open popups"));
|
||||||
|
gtk_widget_set_tooltip_text (button, _("Whether scripts are allowed to open popup windows automatically"));
|
||||||
|
SPANNED_ADD (button);
|
||||||
|
#endif
|
||||||
#if WEBKIT_CHECK_VERSION (1, 1, 6)
|
#if WEBKIT_CHECK_VERSION (1, 1, 6)
|
||||||
FRAME_NEW (_("Spell Checking"));
|
FRAME_NEW (_("Spell Checking"));
|
||||||
/* FIXME: Provide a nice dictionary selection */
|
/* FIXME: Provide a nice dictionary selection */
|
||||||
|
@ -480,16 +485,17 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
|
||||||
PAGE_NEW (GTK_STOCK_NETWORK, _("Network"));
|
PAGE_NEW (GTK_STOCK_NETWORK, _("Network"));
|
||||||
FRAME_NEW (_("Network"));
|
FRAME_NEW (_("Network"));
|
||||||
#if !HAVE_HILDON
|
#if !HAVE_HILDON
|
||||||
label = katze_property_label (settings, "http-proxy");
|
label = katze_property_label (settings, "proxy-type");
|
||||||
|
INDENTED_ADD (label);
|
||||||
|
button = katze_property_proxy (settings, "proxy-type", NULL);
|
||||||
|
SPANNED_ADD (button);
|
||||||
|
label = gtk_label_new (_("Hostname"));
|
||||||
INDENTED_ADD (label);
|
INDENTED_ADD (label);
|
||||||
entry = katze_property_proxy (settings, "http-proxy", NULL);
|
entry = katze_property_proxy (settings, "http-proxy", NULL);
|
||||||
SPANNED_ADD (entry);
|
SPANNED_ADD (entry);
|
||||||
INDENTED_ADD (gtk_event_box_new ());
|
g_signal_connect (settings, "notify::proxy-type",
|
||||||
button = katze_property_proxy (settings, "auto-detect-proxy", NULL);
|
G_CALLBACK (midori_preferences_notify_proxy_type_cb), entry);
|
||||||
SPANNED_ADD (button);
|
midori_preferences_notify_proxy_type_cb (settings, NULL, entry);
|
||||||
g_signal_connect (settings, "notify::auto-detect-proxy",
|
|
||||||
G_CALLBACK (midori_preferences_notify_auto_detect_proxy_cb), entry);
|
|
||||||
midori_preferences_notify_auto_detect_proxy_cb (settings, NULL, entry);
|
|
||||||
#endif
|
#endif
|
||||||
label = katze_property_label (settings, "identify-as");
|
label = katze_property_label (settings, "identify-as");
|
||||||
INDENTED_ADD (label);
|
INDENTED_ADD (label);
|
||||||
|
|
|
@ -393,7 +393,7 @@ midori_search_action_manage_activate_cb (GtkWidget* menuitem,
|
||||||
GtkWidget* dialog;
|
GtkWidget* dialog;
|
||||||
|
|
||||||
dialog = midori_search_action_get_dialog (search_action);
|
dialog = midori_search_action_get_dialog (search_action);
|
||||||
if (GTK_WIDGET_VISIBLE (dialog))
|
if (gtk_widget_get_visible (dialog))
|
||||||
gtk_window_present (GTK_WINDOW (dialog));
|
gtk_window_present (GTK_WINDOW (dialog));
|
||||||
else
|
else
|
||||||
gtk_widget_show (dialog);
|
gtk_widget_show (dialog);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -46,6 +46,20 @@ midori_new_view_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
#define MIDORI_TYPE_VIEW \
|
#define MIDORI_TYPE_VIEW \
|
||||||
(midori_view_get_type ())
|
(midori_view_get_type ())
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
MIDORI_SECURITY_NONE, /* The connection is neither encrypted nor verified. */
|
||||||
|
MIDORI_SECURITY_UNKNOWN, /* The security is unknown, due to lack of validation. */
|
||||||
|
MIDORI_SECURITY_TRUSTED /* The security is validated and trusted. */
|
||||||
|
} MidoriSecurity;
|
||||||
|
|
||||||
|
GType
|
||||||
|
midori_security_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
#define MIDORI_TYPE_SECURITY \
|
||||||
|
(midori_security_get_type ())
|
||||||
|
|
||||||
#define MIDORI_VIEW(obj) \
|
#define MIDORI_VIEW(obj) \
|
||||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), MIDORI_TYPE_VIEW, MidoriView))
|
(G_TYPE_CHECK_INSTANCE_CAST ((obj), MIDORI_TYPE_VIEW, MidoriView))
|
||||||
#define MIDORI_VIEW_CLASS(klass) \
|
#define MIDORI_VIEW_CLASS(klass) \
|
||||||
|
@ -92,6 +106,9 @@ midori_view_get_display_title (MidoriView* view);
|
||||||
GdkPixbuf*
|
GdkPixbuf*
|
||||||
midori_view_get_icon (MidoriView* view);
|
midori_view_get_icon (MidoriView* view);
|
||||||
|
|
||||||
|
const gchar*
|
||||||
|
midori_view_get_icon_uri (MidoriView* view);
|
||||||
|
|
||||||
const gchar*
|
const gchar*
|
||||||
midori_view_get_link_uri (MidoriView* view);
|
midori_view_get_link_uri (MidoriView* view);
|
||||||
|
|
||||||
|
@ -206,6 +223,18 @@ midori_view_get_snapshot (MidoriView* view,
|
||||||
gint width,
|
gint width,
|
||||||
gint height);
|
gint height);
|
||||||
|
|
||||||
|
GtkWidget*
|
||||||
|
midori_view_get_web_view (MidoriView* view);
|
||||||
|
|
||||||
|
MidoriSecurity
|
||||||
|
midori_view_get_security (MidoriView* view);
|
||||||
|
|
||||||
|
void
|
||||||
|
midori_view_populate_popup (MidoriView* view,
|
||||||
|
GtkWidget* menu,
|
||||||
|
gboolean manual);
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __MIDORI_VIEW_H__ */
|
#endif /* __MIDORI_VIEW_H__ */
|
||||||
|
|
|
@ -122,6 +122,8 @@ midori_viewable_base_finalize (MidoriViewableIface* iface)
|
||||||
* the #MidoriViewable via midori_viewable_register_protocol().
|
* the #MidoriViewable via midori_viewable_register_protocol().
|
||||||
*
|
*
|
||||||
* Return value: a new #MidoriViewable, or %NULL
|
* Return value: a new #MidoriViewable, or %NULL
|
||||||
|
*
|
||||||
|
* Deprecated: 0.2.6
|
||||||
**/
|
**/
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
midori_viewable_new_from_uri (const gchar* uri)
|
midori_viewable_new_from_uri (const gchar* uri)
|
||||||
|
@ -210,6 +212,8 @@ viewable_type_implements (GType type,
|
||||||
* "midori://dummy": support URIs like "midori://dummy/foo"
|
* "midori://dummy": support URIs like "midori://dummy/foo"
|
||||||
*
|
*
|
||||||
* Return value: a new #MidoriViewable, or %NULL
|
* Return value: a new #MidoriViewable, or %NULL
|
||||||
|
*
|
||||||
|
* Deprecated: 0.2.6
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
midori_viewable_register_protocol (GType type,
|
midori_viewable_register_protocol (GType type,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2008-2009 Christian Dywan <christian@twotoasts.de>
|
Copyright (C) 2008-2010 Christian Dywan <christian@twotoasts.de>
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -28,67 +28,63 @@ struct _MidoriWebSettings
|
||||||
{
|
{
|
||||||
WebKitWebSettings parent_instance;
|
WebKitWebSettings parent_instance;
|
||||||
|
|
||||||
gboolean remember_last_window_size;
|
gboolean remember_last_window_size : 1;
|
||||||
|
MidoriWindowState last_window_state : 2;
|
||||||
|
gboolean show_menubar : 1;
|
||||||
|
gboolean show_navigationbar : 1;
|
||||||
|
gboolean show_bookmarkbar : 1;
|
||||||
|
gboolean show_panel : 1;
|
||||||
|
gboolean show_transferbar : 1;
|
||||||
|
gboolean show_statusbar : 1;
|
||||||
|
MidoriToolbarStyle toolbar_style : 3;
|
||||||
|
gboolean progress_in_location : 1;
|
||||||
|
gboolean search_engines_in_completion : 1;
|
||||||
|
gboolean compact_sidepanel : 1;
|
||||||
|
gboolean show_panel_controls : 1;
|
||||||
|
gboolean right_align_sidepanel : 1;
|
||||||
|
gboolean open_panels_in_windows : 1;
|
||||||
|
MidoriStartup load_on_startup : 2;
|
||||||
|
gboolean show_crash_dialog : 1;
|
||||||
|
gboolean speed_dial_in_new_tabs : 1;
|
||||||
|
gboolean ask_for_destination_folder : 1;
|
||||||
|
gboolean notify_transfer_completed : 1;
|
||||||
|
MidoriPreferredEncoding preferred_encoding : 3;
|
||||||
|
gboolean always_show_tabbar : 1;
|
||||||
|
gboolean close_buttons_on_tabs : 1;
|
||||||
|
MidoriNewPage open_new_pages_in : 2;
|
||||||
|
MidoriNewPage open_external_pages_in : 2;
|
||||||
|
gboolean middle_click_opens_selection : 1;
|
||||||
|
gboolean open_tabs_in_the_background : 1;
|
||||||
|
gboolean open_tabs_next_to_current : 1;
|
||||||
|
gboolean open_popups_in_tabs : 1;
|
||||||
|
gboolean zoom_text_and_images : 1;
|
||||||
|
gboolean find_while_typing : 1;
|
||||||
|
gboolean kinetic_scrolling : 1;
|
||||||
|
MidoriAcceptCookies accept_cookies : 2;
|
||||||
|
gboolean original_cookies_only : 1;
|
||||||
|
gboolean remember_last_visited_pages : 1;
|
||||||
|
gboolean remember_last_downloaded_files : 1;
|
||||||
|
MidoriProxy proxy_type : 2;
|
||||||
|
gboolean auto_detect_proxy : 1;
|
||||||
|
MidoriIdentity identify_as : 3;
|
||||||
|
|
||||||
gint last_window_width;
|
gint last_window_width;
|
||||||
gint last_window_height;
|
gint last_window_height;
|
||||||
MidoriWindowState last_window_state;
|
|
||||||
gint last_panel_position;
|
gint last_panel_position;
|
||||||
gint last_panel_page;
|
gint last_panel_page;
|
||||||
gint last_web_search;
|
gint last_web_search;
|
||||||
|
gint maximum_cookie_age;
|
||||||
|
gint maximum_history_age;
|
||||||
|
|
||||||
gboolean show_menubar;
|
|
||||||
gboolean show_navigationbar;
|
|
||||||
gboolean show_bookmarkbar;
|
|
||||||
gboolean show_panel;
|
|
||||||
gboolean show_transferbar;
|
|
||||||
gboolean show_statusbar;
|
|
||||||
|
|
||||||
MidoriToolbarStyle toolbar_style;
|
|
||||||
gboolean progress_in_location;
|
|
||||||
gboolean search_engines_in_completion;
|
|
||||||
gchar* toolbar_items;
|
gchar* toolbar_items;
|
||||||
gboolean compact_sidepanel;
|
|
||||||
gboolean show_panel_controls;
|
|
||||||
gboolean right_align_sidepanel;
|
|
||||||
gboolean open_panels_in_windows;
|
|
||||||
|
|
||||||
MidoriStartup load_on_startup;
|
|
||||||
gchar* homepage;
|
gchar* homepage;
|
||||||
gboolean show_crash_dialog;
|
|
||||||
gboolean speed_dial_in_new_tabs;
|
|
||||||
gchar* download_folder;
|
gchar* download_folder;
|
||||||
gboolean ask_for_destination_folder;
|
|
||||||
gboolean notify_transfer_completed;
|
|
||||||
gchar* download_manager;
|
gchar* download_manager;
|
||||||
gchar* text_editor;
|
gchar* text_editor;
|
||||||
gchar* news_aggregator;
|
gchar* news_aggregator;
|
||||||
gchar* location_entry_search;
|
gchar* location_entry_search;
|
||||||
MidoriPreferredEncoding preferred_encoding;
|
|
||||||
|
|
||||||
gboolean always_show_tabbar;
|
|
||||||
gboolean close_buttons_on_tabs;
|
|
||||||
MidoriNewPage open_new_pages_in;
|
|
||||||
MidoriNewPage open_external_pages_in;
|
|
||||||
gboolean middle_click_opens_selection;
|
|
||||||
gboolean open_tabs_in_the_background;
|
|
||||||
gboolean open_tabs_next_to_current;
|
|
||||||
gboolean open_popups_in_tabs;
|
|
||||||
|
|
||||||
gboolean zoom_text_and_images;
|
|
||||||
gboolean find_while_typing;
|
|
||||||
gboolean kinetic_scrolling;
|
|
||||||
MidoriAcceptCookies accept_cookies;
|
|
||||||
gboolean original_cookies_only;
|
|
||||||
gint maximum_cookie_age;
|
|
||||||
|
|
||||||
gboolean remember_last_visited_pages;
|
|
||||||
gint maximum_history_age;
|
|
||||||
gboolean remember_last_downloaded_files;
|
|
||||||
|
|
||||||
gchar* http_proxy;
|
gchar* http_proxy;
|
||||||
gchar* http_accept_language;
|
gchar* http_accept_language;
|
||||||
gboolean auto_detect_proxy;
|
|
||||||
MidoriIdentity identify_as;
|
|
||||||
gchar* ident_string;
|
gchar* ident_string;
|
||||||
|
|
||||||
gint clear_private_data;
|
gint clear_private_data;
|
||||||
|
@ -170,6 +166,7 @@ enum
|
||||||
PROP_MAXIMUM_HISTORY_AGE,
|
PROP_MAXIMUM_HISTORY_AGE,
|
||||||
PROP_REMEMBER_LAST_DOWNLOADED_FILES,
|
PROP_REMEMBER_LAST_DOWNLOADED_FILES,
|
||||||
|
|
||||||
|
PROP_PROXY_TYPE,
|
||||||
PROP_HTTP_PROXY,
|
PROP_HTTP_PROXY,
|
||||||
PROP_AUTO_DETECT_PROXY,
|
PROP_AUTO_DETECT_PROXY,
|
||||||
PROP_IDENTIFY_AS,
|
PROP_IDENTIFY_AS,
|
||||||
|
@ -272,6 +269,23 @@ midori_toolbar_style_get_type (void)
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GType
|
||||||
|
midori_proxy_get_type (void)
|
||||||
|
{
|
||||||
|
static GType type = 0;
|
||||||
|
if (!type)
|
||||||
|
{
|
||||||
|
static const GEnumValue values[] = {
|
||||||
|
{ MIDORI_PROXY_AUTOMATIC, "MIDORI_PROXY_AUTOMATIC", N_("Automatic (GNOME or environment)") },
|
||||||
|
{ MIDORI_PROXY_HTTP, "MIDORI_PROXY_HTTP", N_("HTTP proxy server") },
|
||||||
|
{ MIDORI_PROXY_NONE, "MIDORI_PROXY_NONE", N_("No proxy server") },
|
||||||
|
{ 0, NULL, NULL }
|
||||||
|
};
|
||||||
|
type = g_enum_register_static ("MidoriProxy", values);
|
||||||
|
}
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
GType
|
GType
|
||||||
midori_accept_cookies_get_type (void)
|
midori_accept_cookies_get_type (void)
|
||||||
{
|
{
|
||||||
|
@ -1019,22 +1033,39 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MidoriWebSettings:proxy-type:
|
||||||
|
*
|
||||||
|
* The type of proxy server to use.
|
||||||
|
*
|
||||||
|
* Since: 0.2.5
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (gobject_class,
|
||||||
|
PROP_PROXY_TYPE,
|
||||||
|
g_param_spec_enum (
|
||||||
|
"proxy-type",
|
||||||
|
_("Proxy server"),
|
||||||
|
_("The type of proxy server to use"),
|
||||||
|
MIDORI_TYPE_PROXY,
|
||||||
|
MIDORI_PROXY_AUTOMATIC,
|
||||||
|
flags));
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_HTTP_PROXY,
|
PROP_HTTP_PROXY,
|
||||||
g_param_spec_string (
|
g_param_spec_string (
|
||||||
"http-proxy",
|
"http-proxy",
|
||||||
_("Proxy Server"),
|
_("HTTP Proxy Server"),
|
||||||
_("The proxy server used for HTTP connections"),
|
_("The proxy server used for HTTP connections"),
|
||||||
NULL,
|
NULL,
|
||||||
flags));
|
flags));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MidoriWebSettings:auto-detect-proxy:
|
* MidoriWebSettings:auto-detect-proxy:
|
||||||
*
|
*
|
||||||
* Whether to detect the proxy server automatically from the environment
|
* Whether to detect the proxy server automatically from the environment
|
||||||
*
|
*
|
||||||
* Since: 0.1.3
|
* Deprecated: 0.2.5
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_AUTO_DETECT_PROXY,
|
PROP_AUTO_DETECT_PROXY,
|
||||||
g_param_spec_boolean (
|
g_param_spec_boolean (
|
||||||
|
@ -1491,6 +1522,13 @@ midori_web_settings_set_property (GObject* object,
|
||||||
web_settings->remember_last_downloaded_files = g_value_get_boolean (value);
|
web_settings->remember_last_downloaded_files = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_PROXY_TYPE:
|
||||||
|
web_settings->proxy_type = g_value_get_enum (value);
|
||||||
|
web_settings->auto_detect_proxy =
|
||||||
|
web_settings->proxy_type == MIDORI_PROXY_AUTOMATIC
|
||||||
|
? TRUE : FALSE;
|
||||||
|
g_object_notify (object, "auto-detect-proxy");
|
||||||
|
break;
|
||||||
case PROP_HTTP_PROXY:
|
case PROP_HTTP_PROXY:
|
||||||
katze_assign (web_settings->http_proxy, g_value_dup_string (value));
|
katze_assign (web_settings->http_proxy, g_value_dup_string (value));
|
||||||
break;
|
break;
|
||||||
|
@ -1735,6 +1773,9 @@ midori_web_settings_get_property (GObject* object,
|
||||||
g_value_set_boolean (value, web_settings->remember_last_downloaded_files);
|
g_value_set_boolean (value, web_settings->remember_last_downloaded_files);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_PROXY_TYPE:
|
||||||
|
g_value_set_enum (value, web_settings->proxy_type);
|
||||||
|
break;
|
||||||
case PROP_HTTP_PROXY:
|
case PROP_HTTP_PROXY:
|
||||||
g_value_set_string (value, web_settings->http_proxy);
|
g_value_set_string (value, web_settings->http_proxy);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2008 Christian Dywan <christian@twotoasts.de>
|
Copyright (C) 2008-2010 Christian Dywan <christian@twotoasts.de>
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -119,6 +119,19 @@ midori_toolbar_style_get_type (void) G_GNUC_CONST;
|
||||||
#define MIDORI_TYPE_TOOLBAR_STYLE \
|
#define MIDORI_TYPE_TOOLBAR_STYLE \
|
||||||
(midori_toolbar_style_get_type ())
|
(midori_toolbar_style_get_type ())
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
MIDORI_PROXY_AUTOMATIC,
|
||||||
|
MIDORI_PROXY_HTTP,
|
||||||
|
MIDORI_PROXY_NONE
|
||||||
|
} MidoriProxy;
|
||||||
|
|
||||||
|
GType
|
||||||
|
midori_proxy_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
#define MIDORI_TYPE_PROXY \
|
||||||
|
(midori_proxy_get_type ())
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
MIDORI_ACCEPT_COOKIES_ALL,
|
MIDORI_ACCEPT_COOKIES_ALL,
|
||||||
|
|
153
midori/midori.vapi
Normal file
153
midori/midori.vapi
Normal file
|
@ -0,0 +1,153 @@
|
||||||
|
/* Copyright (C) 2010 Christian Dywan <christian@twotoasts.de>
|
||||||
|
This file is licensed under the terms of the expat license, see the file EXPAT. */
|
||||||
|
|
||||||
|
[CCode (cprefix = "Midori", lower_case_cprefix = "midori_")]
|
||||||
|
namespace Midori {
|
||||||
|
[CCode (cheader_filename = "midori/midori.h")]
|
||||||
|
public class App : GLib.Object {
|
||||||
|
public App ();
|
||||||
|
public Browser create_browser ();
|
||||||
|
public GLib.List<weak Browser> get_browsers ();
|
||||||
|
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public string name { get; set; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public Midori.WebSettings settings { get; set; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public GLib.Object bookmarks { get; set; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public GLib.Object trash { get; set; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public GLib.Object search_engines { get; set; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public GLib.Object history { get; set; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public GLib.Object extensions { get; set; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public GLib.Object browsers { get; }
|
||||||
|
public Browser? browser { get; }
|
||||||
|
|
||||||
|
[HasEmitter]
|
||||||
|
public signal void add_browser (Browser browser);
|
||||||
|
public signal void remove_browser (Browser browser);
|
||||||
|
[HasEmitter]
|
||||||
|
public signal void quit ();
|
||||||
|
}
|
||||||
|
public class Browser : Gtk.Window {
|
||||||
|
public Browser ();
|
||||||
|
public int add_item (GLib.Object item);
|
||||||
|
public int add_uri (string uri);
|
||||||
|
public unowned View get_nth_tab (int n);
|
||||||
|
public GLib.List<weak View> get_tabs ();
|
||||||
|
public unowned Gtk.ActionGroup get_action_group ();
|
||||||
|
public unowned Browser get_for_widget (Gtk.Widget widget);
|
||||||
|
public unowned string[] get_toolbar_actions ();
|
||||||
|
public unowned GLib.Object get_proxy_items ();
|
||||||
|
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public Gtk.MenuBar menubar { get; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public Gtk.Toolbar navigationbar { get; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public Gtk.Notebook notebook { get; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public Gtk.Widget panel { get; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public string uri { get; set; }
|
||||||
|
public Gtk.Widget? tab { get; set; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public uint load_status { get; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public Gtk.Statusbar statusbar { get; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public string statusbar_text { get; set; }
|
||||||
|
public Midori.WebSettings settings { get; set; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public GLib.Object bookmarks { get; set; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public GLib.Object trash { get; set; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public GLib.Object search_engines { get; set; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public GLib.Object history { get; set; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public bool show_tabs { get; set; }
|
||||||
|
|
||||||
|
public signal Browser new_window (Browser? browser);
|
||||||
|
[HasEmitter]
|
||||||
|
public signal void add_tab (View tab);
|
||||||
|
[HasEmitter]
|
||||||
|
public signal void remove_tab (View tab);
|
||||||
|
[HasEmitter]
|
||||||
|
public signal void activate_action (string name);
|
||||||
|
public signal void add_download (GLib.Object download);
|
||||||
|
public signal void populate_tool_menu (Gtk.Menu menu);
|
||||||
|
[HasEmitter]
|
||||||
|
public signal void quit ();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Extension : GLib.Object {
|
||||||
|
[CCode (has_construct_function = false)]
|
||||||
|
public Extension ();
|
||||||
|
public unowned Midori.App get_app ();
|
||||||
|
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public string name { get; set; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public string description { get; set; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public string version { get; set; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public string authors { get; set; }
|
||||||
|
|
||||||
|
public signal void activate (Midori.App app);
|
||||||
|
public signal void deactivate ();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class View : Gtk.VBox {
|
||||||
|
[CCode (type = "GtkWidget*")]
|
||||||
|
public View (GLib.Object net);
|
||||||
|
public void set_uri (string uri);
|
||||||
|
public bool is_blank ();
|
||||||
|
public string get_display_uri ();
|
||||||
|
public string get_display_title ();
|
||||||
|
public string get_icon_uri ();
|
||||||
|
public string get_link_uri ();
|
||||||
|
public bool has_selection ();
|
||||||
|
public string get_selected_text ();
|
||||||
|
public Gtk.MenuItem get_proxy_menu_item ();
|
||||||
|
public Gtk.Menu get_tab_menu ();
|
||||||
|
public Pango.EllipsizeMode get_label_ellipsize ();
|
||||||
|
public Gtk.Label get_proxy_tab_label ();
|
||||||
|
public GLib.Object get_proxy_item ();
|
||||||
|
public bool can_view_source ();
|
||||||
|
public bool can_find ();
|
||||||
|
public void search_text (string text, bool case_sensitive, bool forward);
|
||||||
|
public void mark_text_matches (string text, bool case_sensitive);
|
||||||
|
public void set_highlight_text_matches (bool highlight);
|
||||||
|
public bool execute_script (string script, out string exception);
|
||||||
|
public Gdk.Pixbuf get_snapshot (int width, int height);
|
||||||
|
public unowned WebKit.WebView get_web_view ();
|
||||||
|
public void populate_popup (Gtk.Menu menu, bool manual);
|
||||||
|
|
||||||
|
public string uri { get; }
|
||||||
|
public string title { get; }
|
||||||
|
public int security { get; }
|
||||||
|
public string mime_type { get; }
|
||||||
|
public Gdk.Pixbuf icon { get; }
|
||||||
|
public int load_status { get; }
|
||||||
|
public double progress { get; set; }
|
||||||
|
public bool minimized { get; }
|
||||||
|
public float zoom_level { get; }
|
||||||
|
public GLib.Object news_feeds { get; }
|
||||||
|
public string statusbar_text { get; }
|
||||||
|
public WebSettings settings { get; set; }
|
||||||
|
public GLib.Object net { get; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class WebSettings : WebKit.WebSettings {
|
||||||
|
public WebSettings ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
104
midori/sokoke.c
104
midori/sokoke.c
|
@ -224,12 +224,7 @@ sokoke_show_uri_with_mime_type (GdkScreen* screen,
|
||||||
GList* files;
|
GList* files;
|
||||||
gpointer context;
|
gpointer context;
|
||||||
|
|
||||||
#if GLIB_CHECK_VERSION (2, 18, 0)
|
|
||||||
content_type = g_content_type_from_mime_type (mime_type);
|
content_type = g_content_type_from_mime_type (mime_type);
|
||||||
#else
|
|
||||||
content_type = g_strdup (mime_type);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
app_info = g_app_info_get_default_for_type (content_type,
|
app_info = g_app_info_get_default_for_type (content_type,
|
||||||
!g_str_has_prefix (uri, "file://"));
|
!g_str_has_prefix (uri, "file://"));
|
||||||
g_free (content_type);
|
g_free (content_type);
|
||||||
|
@ -273,6 +268,7 @@ sokoke_show_uri (GdkScreen* screen,
|
||||||
guint32 timestamp,
|
guint32 timestamp,
|
||||||
GError** error)
|
GError** error)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if HAVE_HILDON
|
#if HAVE_HILDON
|
||||||
HildonURIAction* action = hildon_uri_get_default_action_by_uri (uri, NULL);
|
HildonURIAction* action = hildon_uri_get_default_action_by_uri (uri, NULL);
|
||||||
return hildon_uri_open (uri, action, error);
|
return hildon_uri_open (uri, action, error);
|
||||||
|
@ -352,6 +348,8 @@ sokoke_show_uri (GdkScreen* screen,
|
||||||
g_return_val_if_fail (uri != NULL, FALSE);
|
g_return_val_if_fail (uri != NULL, FALSE);
|
||||||
g_return_val_if_fail (!error || !*error, FALSE);
|
g_return_val_if_fail (!error || !*error, FALSE);
|
||||||
|
|
||||||
|
sokoke_recursive_fork_protection (uri, TRUE);
|
||||||
|
|
||||||
#if GTK_CHECK_VERSION (2, 14, 0)
|
#if GTK_CHECK_VERSION (2, 14, 0)
|
||||||
if (gtk_show_uri (screen, uri, timestamp, error))
|
if (gtk_show_uri (screen, uri, timestamp, error))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -637,6 +635,45 @@ gchar* sokoke_search_uri (const gchar* uri,
|
||||||
return search;
|
return search;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sokoke_resolve_hostname_cb (SoupAddress *address,
|
||||||
|
guint status,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
if (status == SOUP_STATUS_OK)
|
||||||
|
*(gint *)data = 1;
|
||||||
|
else
|
||||||
|
*(gint *)data = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sokoke_resolve_hostname
|
||||||
|
* @hostname: a string typed by a user
|
||||||
|
*
|
||||||
|
* Takes a string that was typed by a user,
|
||||||
|
* resolves the hostname, and returns the status.
|
||||||
|
*
|
||||||
|
* Return value: %TRUE if is a valid host, else %FALSE
|
||||||
|
**/
|
||||||
|
gboolean
|
||||||
|
sokoke_resolve_hostname (const gchar* hostname)
|
||||||
|
{
|
||||||
|
gchar* uri;
|
||||||
|
gint host_resolved = 0;
|
||||||
|
|
||||||
|
uri = g_strconcat ("http://", hostname, NULL);
|
||||||
|
if (sokoke_prefetch_uri (uri, sokoke_resolve_hostname_cb,
|
||||||
|
&host_resolved))
|
||||||
|
{
|
||||||
|
GTimer* timer = g_timer_new ();
|
||||||
|
while (!host_resolved && g_timer_elapsed (timer, NULL) < 10)
|
||||||
|
g_main_context_iteration (NULL, FALSE);
|
||||||
|
g_timer_destroy (timer);
|
||||||
|
}
|
||||||
|
g_free (uri);
|
||||||
|
return host_resolved == 1 ? TRUE : FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sokoke_magic_uri:
|
* sokoke_magic_uri:
|
||||||
* @uri: a string typed by a user
|
* @uri: a string typed by a user
|
||||||
|
@ -679,7 +716,8 @@ sokoke_magic_uri (const gchar* uri)
|
||||||
((search = strchr (uri, ':')) || (search = strchr (uri, '@'))) &&
|
((search = strchr (uri, ':')) || (search = strchr (uri, '@'))) &&
|
||||||
search[0] && !g_ascii_isalpha (search[1]))
|
search[0] && !g_ascii_isalpha (search[1]))
|
||||||
return sokoke_idn_to_punycode (g_strconcat ("http://", uri, NULL));
|
return sokoke_idn_to_punycode (g_strconcat ("http://", uri, NULL));
|
||||||
if (!strncmp (uri, "localhost", 9) && (uri[9] == '\0' || uri[9] == '/'))
|
if ((!strcmp (uri, "localhost") || strchr (uri, '/'))
|
||||||
|
&& sokoke_resolve_hostname (uri))
|
||||||
return g_strconcat ("http://", uri, NULL);
|
return g_strconcat ("http://", uri, NULL);
|
||||||
if (!search)
|
if (!search)
|
||||||
{
|
{
|
||||||
|
@ -816,7 +854,8 @@ sokoke_get_desktop (void)
|
||||||
GdkDisplay* display = gdk_display_get_default ();
|
GdkDisplay* display = gdk_display_get_default ();
|
||||||
Display* xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
Display* xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
||||||
Window root_window = RootWindow (xdisplay, 0);
|
Window root_window = RootWindow (xdisplay, 0);
|
||||||
Atom save_mode_atom = gdk_x11_get_xatom_by_name ("_DT_SAVE_MODE");
|
Atom save_mode_atom = gdk_x11_get_xatom_by_name_for_display (
|
||||||
|
display, "_DT_SAVE_MODE");
|
||||||
Atom actual_type;
|
Atom actual_type;
|
||||||
int actual_format;
|
int actual_format;
|
||||||
unsigned long n_items, bytes;
|
unsigned long n_items, bytes;
|
||||||
|
@ -973,7 +1012,7 @@ sokoke_entry_set_default_text (GtkEntry* entry,
|
||||||
PANGO_STYLE_ITALIC);
|
PANGO_STYLE_ITALIC);
|
||||||
gtk_entry_set_text (entry, default_text);
|
gtk_entry_set_text (entry, default_text);
|
||||||
}
|
}
|
||||||
else if (!GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (entry)))
|
else if (!gtk_widget_has_focus (GTK_WIDGET (entry)))
|
||||||
{
|
{
|
||||||
gint has_default = GPOINTER_TO_INT (
|
gint has_default = GPOINTER_TO_INT (
|
||||||
g_object_get_data (G_OBJECT (entry), "sokoke_has_default"));
|
g_object_get_data (G_OBJECT (entry), "sokoke_has_default"));
|
||||||
|
@ -1265,6 +1304,7 @@ sokoke_register_stock_items (void)
|
||||||
{ STOCK_PLUGINS, N_("Netscape p_lugins"), 0, 0, GTK_STOCK_CONVERT },
|
{ STOCK_PLUGINS, N_("Netscape p_lugins"), 0, 0, GTK_STOCK_CONVERT },
|
||||||
{ STOCK_USER_TRASH, N_("_Closed Tabs"), 0, 0, "gtk-undo-ltr" },
|
{ STOCK_USER_TRASH, N_("_Closed Tabs"), 0, 0, "gtk-undo-ltr" },
|
||||||
{ STOCK_WINDOW_NEW, N_("New _Window"), 0, 0, GTK_STOCK_ADD },
|
{ STOCK_WINDOW_NEW, N_("New _Window"), 0, 0, GTK_STOCK_ADD },
|
||||||
|
{ GTK_STOCK_DIRECTORY, N_("New _Folder"), 0, 0, NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
factory = gtk_icon_factory_new ();
|
factory = gtk_icon_factory_new ();
|
||||||
|
@ -1443,7 +1483,7 @@ sokoke_find_config_filename (const gchar* folder,
|
||||||
* Looks for the specified filename in the system data
|
* Looks for the specified filename in the system data
|
||||||
* directories, depending on the platform.
|
* directories, depending on the platform.
|
||||||
*
|
*
|
||||||
* Return value: a full path
|
* Return value: a newly allocated full path
|
||||||
**/
|
**/
|
||||||
gchar*
|
gchar*
|
||||||
sokoke_find_data_filename (const gchar* filename)
|
sokoke_find_data_filename (const gchar* filename)
|
||||||
|
@ -1451,10 +1491,16 @@ sokoke_find_data_filename (const gchar* filename)
|
||||||
const gchar* const* data_dirs = g_get_system_data_dirs ();
|
const gchar* const* data_dirs = g_get_system_data_dirs ();
|
||||||
guint i = 0;
|
guint i = 0;
|
||||||
const gchar* data_dir;
|
const gchar* data_dir;
|
||||||
|
gchar* path;
|
||||||
|
|
||||||
|
path = g_build_filename (g_get_user_data_dir (), filename, NULL);
|
||||||
|
if (g_access (path, F_OK) == 0)
|
||||||
|
return path;
|
||||||
|
g_free (path);
|
||||||
|
|
||||||
while ((data_dir = data_dirs[i++]))
|
while ((data_dir = data_dirs[i++]))
|
||||||
{
|
{
|
||||||
gchar* path = g_build_filename (data_dir, filename, NULL);
|
path = g_build_filename (data_dir, filename, NULL);
|
||||||
if (g_access (path, F_OK) == 0)
|
if (g_access (path, F_OK) == 0)
|
||||||
return path;
|
return path;
|
||||||
g_free (path);
|
g_free (path);
|
||||||
|
@ -1687,7 +1733,9 @@ sokoke_file_chooser_dialog_new (const gchar* title,
|
||||||
* Return value: %TRUE on success
|
* Return value: %TRUE on success
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
sokoke_prefetch_uri (const char* uri)
|
sokoke_prefetch_uri (const char* uri,
|
||||||
|
SoupAddressCallback callback,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
#define MAXHOSTS 50
|
#define MAXHOSTS 50
|
||||||
static gchar* hosts = NULL;
|
static gchar* hosts = NULL;
|
||||||
|
@ -1724,7 +1772,7 @@ sokoke_prefetch_uri (const char* uri)
|
||||||
gchar* new_hosts;
|
gchar* new_hosts;
|
||||||
|
|
||||||
address = soup_address_new (s_uri->host, SOUP_ADDRESS_ANY_PORT);
|
address = soup_address_new (s_uri->host, SOUP_ADDRESS_ANY_PORT);
|
||||||
soup_address_resolve_async (address, 0, 0, 0, 0);
|
soup_address_resolve_async (address, 0, 0, callback, user_data);
|
||||||
g_object_unref (address);
|
g_object_unref (address);
|
||||||
|
|
||||||
if (host_count > MAXHOSTS)
|
if (host_count > MAXHOSTS)
|
||||||
|
@ -1736,10 +1784,42 @@ sokoke_prefetch_uri (const char* uri)
|
||||||
new_hosts = g_strdup_printf ("%s|%s", hosts, s_uri->host);
|
new_hosts = g_strdup_printf ("%s|%s", hosts, s_uri->host);
|
||||||
katze_assign (hosts, new_hosts);
|
katze_assign (hosts, new_hosts);
|
||||||
}
|
}
|
||||||
|
else if (callback)
|
||||||
|
callback (NULL, SOUP_STATUS_OK, user_data);
|
||||||
soup_uri_free (s_uri);
|
soup_uri_free (s_uri);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sokoke_recursive_fork_protection
|
||||||
|
* @uri: the URI to check
|
||||||
|
* @set_uri: if TRUE the URI will be saved
|
||||||
|
*
|
||||||
|
* Protects against recursive invokations of the Midori executable
|
||||||
|
* with the same URI.
|
||||||
|
*
|
||||||
|
* As an example, consider having an URI starting with 'tel://'. You
|
||||||
|
* could attempt to open it with sokoke_show_uri. In turn, 'exo-open'
|
||||||
|
* might be called. Now quite possibly 'exo-open' is unable to handle
|
||||||
|
* 'tel://' and might well fall back to 'midori' as default browser.
|
||||||
|
*
|
||||||
|
* To protect against this scenario, call this function with the
|
||||||
|
* URI and %TRUE before calling any external tool.
|
||||||
|
* #MidoriApp calls sokoke_recursive_fork_protection() with %FALSE
|
||||||
|
* and bails out if %FALSE is returned.
|
||||||
|
*
|
||||||
|
* Return value: %TRUE if @uri is new, %FALSE on recursion
|
||||||
|
**/
|
||||||
|
gboolean
|
||||||
|
sokoke_recursive_fork_protection (const gchar* uri,
|
||||||
|
gboolean set_uri)
|
||||||
|
{
|
||||||
|
static gchar* fork_uri = NULL;
|
||||||
|
if (set_uri)
|
||||||
|
katze_assign (fork_uri, g_strdup (uri));
|
||||||
|
return g_strcmp0 (fork_uri, uri) == 0 ? FALSE : TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Provide a new way for SoupSession to assume an 'Accept-Language'
|
/* Provide a new way for SoupSession to assume an 'Accept-Language'
|
||||||
string automatically from the return value of g_get_language_names(),
|
string automatically from the return value of g_get_language_names(),
|
||||||
properly formatted according to RFC2616.
|
properly formatted according to RFC2616.
|
||||||
|
|
|
@ -27,6 +27,13 @@
|
||||||
#if !GLIB_CHECK_VERSION (2, 14, 0)
|
#if !GLIB_CHECK_VERSION (2, 14, 0)
|
||||||
#define G_PARAM_STATIC_STRINGS \
|
#define G_PARAM_STATIC_STRINGS \
|
||||||
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
|
(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !GLIB_CHECK_VERSION (2, 18, 0)
|
||||||
|
#define g_content_type_from_mime_type(mtp) g_strdup (mtp)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !GTK_CHECK_VERSION (2, 14, 0)
|
||||||
#define gtk_dialog_get_content_area(dlg) dlg->vbox
|
#define gtk_dialog_get_content_area(dlg) dlg->vbox
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -38,6 +45,12 @@
|
||||||
#if !GTK_CHECK_VERSION (2, 18, 0)
|
#if !GTK_CHECK_VERSION (2, 18, 0)
|
||||||
#define gtk_widget_is_toplevel(widget) GTK_WIDGET_TOPLEVEL (widget)
|
#define gtk_widget_is_toplevel(widget) GTK_WIDGET_TOPLEVEL (widget)
|
||||||
#define gtk_widget_has_focus(widget) GTK_WIDGET_HAS_FOCUS (widget)
|
#define gtk_widget_has_focus(widget) GTK_WIDGET_HAS_FOCUS (widget)
|
||||||
|
#define gtk_widget_get_visible(widget) GTK_WIDGET_VISIBLE (widget)
|
||||||
|
#define gtk_widget_get_sensitive(widget) GTK_WIDGET_IS_SENSITIVE (widget)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !GTK_CHECK_VERSION (2, 20, 0)
|
||||||
|
#define gtk_widget_get_realized(widget) GTK_WIDGET_REALIZED (widget)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !GTK_CHECK_VERSION(2, 12, 0)
|
#if !GTK_CHECK_VERSION(2, 12, 0)
|
||||||
|
@ -221,9 +234,18 @@ sokoke_file_chooser_dialog_new (const gchar* title,
|
||||||
GtkFileChooserAction action);
|
GtkFileChooserAction action);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
sokoke_prefetch_uri (const char* uri);
|
sokoke_prefetch_uri (const char* uri,
|
||||||
|
SoupAddressCallback callback,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
sokoke_resolve_hostname (const gchar* hostname);
|
||||||
|
|
||||||
gchar *
|
gchar *
|
||||||
sokoke_accept_languages (const gchar* const * lang_names);
|
sokoke_accept_languages (const gchar* const * lang_names);
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
sokoke_recursive_fork_protection (const gchar* uri,
|
||||||
|
gboolean set_uri);
|
||||||
|
|
||||||
#endif /* !__SOKOKE_H__ */
|
#endif /* !__SOKOKE_H__ */
|
||||||
|
|
|
@ -6,7 +6,7 @@ import platform
|
||||||
|
|
||||||
progressive = True
|
progressive = True
|
||||||
libs = 'M UNIQUE LIBSOUP GMODULE GTHREAD LIBIDN GIO GTK SQLITE ' \
|
libs = 'M UNIQUE LIBSOUP GMODULE GTHREAD LIBIDN GIO GTK SQLITE ' \
|
||||||
'LIBNOTIFY WEBKIT LIBXML X11 WS2_32 OPENSSL HILDON HILDON_FM'
|
'LIBNOTIFY WEBKIT LIBXML X11 XSS WS2_32 OPENSSL HILDON HILDON_FM'
|
||||||
|
|
||||||
if progressive or Options.commands['check']:
|
if progressive or Options.commands['check']:
|
||||||
obj = bld.new_task_gen ('cc', 'staticlib')
|
obj = bld.new_task_gen ('cc', 'staticlib')
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,67 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __MIDORI_ADDONS_H__
|
|
||||||
#define __MIDORI_ADDONS_H__
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#include <katze/katze.h>
|
|
||||||
|
|
||||||
#include "midori-viewable.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define MIDORI_TYPE_ADDONS \
|
|
||||||
(midori_addons_get_type ())
|
|
||||||
#define MIDORI_ADDONS(obj) \
|
|
||||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), MIDORI_TYPE_ADDONS, MidoriAddons))
|
|
||||||
#define MIDORI_ADDONS_CLASS(klass) \
|
|
||||||
(G_TYPE_CHECK_CLASS_CAST ((klass), MIDORI_TYPE_ADDONS, MidoriAddonsClass))
|
|
||||||
#define MIDORI_IS_ADDONS(obj) \
|
|
||||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIDORI_TYPE_ADDONS))
|
|
||||||
#define MIDORI_IS_ADDONS_CLASS(klass) \
|
|
||||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), MIDORI_TYPE_ADDONS))
|
|
||||||
#define MIDORI_ADDONS_GET_CLASS(obj) \
|
|
||||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), MIDORI_TYPE_ADDONS, MidoriAddonsClass))
|
|
||||||
|
|
||||||
typedef struct _MidoriAddons MidoriAddons;
|
|
||||||
typedef struct _MidoriAddonsClass MidoriAddonsClass;
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
MIDORI_ADDON_NONE,
|
|
||||||
MIDORI_ADDON_USER_SCRIPTS,
|
|
||||||
MIDORI_ADDON_USER_STYLES
|
|
||||||
} MidoriAddonKind;
|
|
||||||
|
|
||||||
GType
|
|
||||||
midori_addon_kind_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
#define MIDORI_TYPE_ADDON_KIND \
|
|
||||||
(midori_addon_kind_get_type ())
|
|
||||||
|
|
||||||
GType
|
|
||||||
midori_addons_get_type (void);
|
|
||||||
|
|
||||||
GtkWidget*
|
|
||||||
midori_addons_new (MidoriAddonKind kind,
|
|
||||||
GtkWidget* web_widget);
|
|
||||||
|
|
||||||
GtkWidget*
|
|
||||||
midori_addons_get_toolbar (MidoriViewable* addons);
|
|
||||||
|
|
||||||
void
|
|
||||||
midori_addons_update_elements (MidoriAddons* addons);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __MIDORI_ADDONS_H__ */
|
|
|
@ -185,14 +185,6 @@ midori_bookmarks_folder_clicked_cb (GtkWidget* toolitem)
|
||||||
NULL, TRUE, TRUE);
|
NULL, TRUE, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
midori_bookmarks_import_clicked_cb (GtkWidget* toolitem)
|
|
||||||
{
|
|
||||||
MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (toolitem));
|
|
||||||
/* FIXME: Take selected folder into account */
|
|
||||||
midori_browser_activate_action (browser, "BookmarksImport");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
midori_bookmarks_cursor_or_row_changed_cb (GtkTreeView* treeview,
|
midori_bookmarks_cursor_or_row_changed_cb (GtkTreeView* treeview,
|
||||||
MidoriBookmarks* bookmarks)
|
MidoriBookmarks* bookmarks)
|
||||||
|
@ -234,7 +226,6 @@ midori_bookmarks_get_toolbar (MidoriViewable* viewable)
|
||||||
GtkToolItem* toolitem;
|
GtkToolItem* toolitem;
|
||||||
|
|
||||||
toolbar = gtk_toolbar_new ();
|
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_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_BUTTON);
|
||||||
bookmarks->toolbar = toolbar;
|
bookmarks->toolbar = toolbar;
|
||||||
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_ADD);
|
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_ADD);
|
||||||
|
@ -266,13 +257,6 @@ midori_bookmarks_get_toolbar (MidoriViewable* viewable)
|
||||||
gtk_tool_item_set_expand (toolitem, TRUE);
|
gtk_tool_item_set_expand (toolitem, TRUE);
|
||||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
||||||
gtk_widget_show (GTK_WIDGET (toolitem));
|
gtk_widget_show (GTK_WIDGET (toolitem));
|
||||||
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_CONVERT);
|
|
||||||
gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem),
|
|
||||||
_("Import bookmarks..."));
|
|
||||||
g_signal_connect (toolitem, "clicked",
|
|
||||||
G_CALLBACK (midori_bookmarks_import_clicked_cb), bookmarks);
|
|
||||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
|
||||||
gtk_widget_show (GTK_WIDGET (toolitem));
|
|
||||||
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_DIRECTORY);
|
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_DIRECTORY);
|
||||||
gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem),
|
gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem),
|
||||||
_("Add a new folder"));
|
_("Add a new folder"));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2008-2009 Christian Dywan <christian@twotoasts.de>
|
Copyright (C) 2008-2010 Christian Dywan <christian@twotoasts.de>
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -186,6 +186,47 @@ midori_console_button_copy_clicked_cb (GtkToolItem* toolitem,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
midori_console_button_copy_all_clicked_cb (GtkToolItem* toolitem,
|
||||||
|
MidoriConsole* console)
|
||||||
|
{
|
||||||
|
GtkTreeModel* model;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
gint count;
|
||||||
|
GString* all_text;
|
||||||
|
GdkDisplay* display;
|
||||||
|
GtkClipboard* clipboard;
|
||||||
|
|
||||||
|
model = gtk_tree_view_get_model (GTK_TREE_VIEW (console->treeview));
|
||||||
|
if (!gtk_tree_model_get_iter_first (model, &iter))
|
||||||
|
return;
|
||||||
|
|
||||||
|
count = gtk_tree_model_iter_n_children (model, NULL);
|
||||||
|
all_text = g_string_sized_new (count * 96);
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
gchar* text;
|
||||||
|
gchar* message;
|
||||||
|
gint line;
|
||||||
|
gchar* source_id;
|
||||||
|
|
||||||
|
gtk_tree_model_get (model, &iter, 0, &message, 1, &line, 2, &source_id, -1);
|
||||||
|
|
||||||
|
text = g_strdup_printf ("%d @ %s: %s\n", line, source_id, message);
|
||||||
|
g_free (source_id);
|
||||||
|
g_free (message);
|
||||||
|
g_string_append (all_text, text);
|
||||||
|
g_free (text);
|
||||||
|
}
|
||||||
|
while (gtk_tree_model_iter_next (model, &iter));
|
||||||
|
|
||||||
|
display = gtk_widget_get_display (GTK_WIDGET (console));
|
||||||
|
clipboard = gtk_clipboard_get_for_display (display, GDK_SELECTION_CLIPBOARD);
|
||||||
|
gtk_clipboard_set_text (clipboard, all_text->str, -1);
|
||||||
|
g_string_free (all_text, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
midori_console_button_clear_clicked_cb (GtkToolItem* toolitem,
|
midori_console_button_clear_clicked_cb (GtkToolItem* toolitem,
|
||||||
MidoriConsole* console)
|
MidoriConsole* console)
|
||||||
|
@ -308,7 +349,6 @@ midori_console_get_toolbar (MidoriViewable* console)
|
||||||
GtkToolItem* toolitem;
|
GtkToolItem* toolitem;
|
||||||
|
|
||||||
toolbar = gtk_toolbar_new ();
|
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_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_BUTTON);
|
||||||
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_COPY);
|
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_COPY);
|
||||||
gtk_tool_item_set_is_important (toolitem, TRUE);
|
gtk_tool_item_set_is_important (toolitem, TRUE);
|
||||||
|
@ -316,6 +356,15 @@ midori_console_get_toolbar (MidoriViewable* console)
|
||||||
G_CALLBACK (midori_console_button_copy_clicked_cb), console);
|
G_CALLBACK (midori_console_button_copy_clicked_cb), console);
|
||||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
||||||
gtk_widget_show (GTK_WIDGET (toolitem));
|
gtk_widget_show (GTK_WIDGET (toolitem));
|
||||||
|
|
||||||
|
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_DND_MULTIPLE);
|
||||||
|
gtk_tool_button_set_label (GTK_TOOL_BUTTON (toolitem), _("Copy _All"));
|
||||||
|
gtk_tool_item_set_tooltip_text (toolitem, _("Copy All"));
|
||||||
|
g_signal_connect (toolitem, "clicked",
|
||||||
|
G_CALLBACK (midori_console_button_copy_all_clicked_cb), console);
|
||||||
|
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
||||||
|
gtk_widget_show (GTK_WIDGET (toolitem));
|
||||||
|
|
||||||
/* TODO: What about a find entry here that filters e.g. by url? */
|
/* TODO: What about a find entry here that filters e.g. by url? */
|
||||||
toolitem = gtk_separator_tool_item_new ();
|
toolitem = gtk_separator_tool_item_new ();
|
||||||
gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (toolitem),
|
gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (toolitem),
|
||||||
|
|
|
@ -105,7 +105,6 @@ midori_extensions_get_toolbar (MidoriViewable* extensions)
|
||||||
GtkWidget* toolbar;
|
GtkWidget* toolbar;
|
||||||
|
|
||||||
toolbar = gtk_toolbar_new ();
|
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_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_BUTTON);
|
||||||
|
|
||||||
MIDORI_EXTENSIONS (extensions)->toolbar = toolbar;
|
MIDORI_EXTENSIONS (extensions)->toolbar = toolbar;
|
||||||
|
@ -286,147 +285,6 @@ midori_extensions_treeview_row_activated_cb (GtkTreeView* treeview,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
midori_extensions_preferences_activate_cb (GtkWidget* menuitem,
|
|
||||||
MidoriExtensions* extensions)
|
|
||||||
{
|
|
||||||
MidoriExtension* extension;
|
|
||||||
|
|
||||||
extension = g_object_get_data (G_OBJECT (menuitem), "MidoriExtension");
|
|
||||||
g_return_if_fail (extension != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
midori_extensions_website_activate_cb (GtkWidget* menuitem,
|
|
||||||
MidoriExtensions* extensions)
|
|
||||||
{
|
|
||||||
gchar* uri;
|
|
||||||
gint n;
|
|
||||||
MidoriBrowser* browser;
|
|
||||||
|
|
||||||
MidoriExtension* extension;
|
|
||||||
|
|
||||||
extension = g_object_get_data (G_OBJECT (menuitem), "MidoriExtension");
|
|
||||||
g_return_if_fail (extension != NULL);
|
|
||||||
uri = katze_object_get_string (extension, "website");
|
|
||||||
|
|
||||||
browser = midori_browser_get_for_widget (GTK_WIDGET (extensions));
|
|
||||||
n = midori_browser_add_uri (browser, uri);
|
|
||||||
midori_browser_set_current_page (browser, n);
|
|
||||||
|
|
||||||
g_free (uri);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
midori_extensions_about_activate_cb (GtkWidget* menuitem,
|
|
||||||
MidoriExtensions* extensions)
|
|
||||||
{
|
|
||||||
MidoriExtension* extension;
|
|
||||||
|
|
||||||
extension = g_object_get_data (G_OBJECT (menuitem), "MidoriExtension");
|
|
||||||
g_return_if_fail (extension != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GtkWidget*
|
|
||||||
midori_extensions_popup_menu_item (GtkMenu* menu,
|
|
||||||
const gchar* stock_id,
|
|
||||||
const gchar* label,
|
|
||||||
MidoriExtension* extension,
|
|
||||||
gpointer callback,
|
|
||||||
gboolean enabled,
|
|
||||||
MidoriExtensions* extensions)
|
|
||||||
{
|
|
||||||
GtkWidget* menuitem;
|
|
||||||
|
|
||||||
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 (
|
|
||||||
GTK_BIN (menuitem))), label);
|
|
||||||
|
|
||||||
if (!enabled)
|
|
||||||
gtk_widget_set_sensitive (menuitem, FALSE);
|
|
||||||
|
|
||||||
g_object_set_data (G_OBJECT (menuitem), "MidoriExtension", extension);
|
|
||||||
|
|
||||||
if (callback)
|
|
||||||
g_signal_connect (menuitem, "activate", G_CALLBACK (callback), extensions);
|
|
||||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
|
||||||
gtk_widget_show (menuitem);
|
|
||||||
|
|
||||||
return menuitem;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
midori_extensions_popup (GtkWidget* widget,
|
|
||||||
GdkEventButton* event,
|
|
||||||
MidoriExtension* extension,
|
|
||||||
MidoriExtensions* extensions)
|
|
||||||
{
|
|
||||||
GtkWidget* menu;
|
|
||||||
gchar* website;
|
|
||||||
|
|
||||||
website = katze_object_get_string (extension, "website");
|
|
||||||
|
|
||||||
menu = gtk_menu_new ();
|
|
||||||
midori_extensions_popup_menu_item (GTK_MENU (menu), GTK_STOCK_PREFERENCES, NULL, extension,
|
|
||||||
midori_extensions_preferences_activate_cb, FALSE,
|
|
||||||
extensions);
|
|
||||||
midori_extensions_popup_menu_item (GTK_MENU (menu), GTK_STOCK_HOME, NULL, extension,
|
|
||||||
midori_extensions_website_activate_cb, website != NULL,
|
|
||||||
extensions);
|
|
||||||
midori_extensions_popup_menu_item (GTK_MENU (menu), GTK_STOCK_ABOUT, NULL, extension,
|
|
||||||
midori_extensions_about_activate_cb, FALSE,
|
|
||||||
extensions);
|
|
||||||
|
|
||||||
katze_widget_popup (widget, GTK_MENU (menu), event, KATZE_MENU_POSITION_CURSOR);
|
|
||||||
|
|
||||||
g_free (website);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
midori_extensions_popup_menu_cb (GtkWidget* widget,
|
|
||||||
MidoriExtensions* extensions)
|
|
||||||
{
|
|
||||||
GtkTreeModel* model;
|
|
||||||
GtkTreeIter iter;
|
|
||||||
|
|
||||||
if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (widget), &model, &iter))
|
|
||||||
{
|
|
||||||
MidoriExtension *extension;
|
|
||||||
|
|
||||||
gtk_tree_model_get (model, &iter, 0, &extension, -1);
|
|
||||||
|
|
||||||
midori_extensions_popup (widget, NULL, extension, extensions);
|
|
||||||
g_object_unref (extension);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
midori_extensions_button_release_event_cb (GtkWidget* widget,
|
|
||||||
GdkEventButton* event,
|
|
||||||
MidoriExtensions* extensions)
|
|
||||||
{
|
|
||||||
GtkTreeModel* model;
|
|
||||||
GtkTreeIter iter;
|
|
||||||
|
|
||||||
if (event->button != 3)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (widget), &model, &iter))
|
|
||||||
{
|
|
||||||
MidoriExtension* extension;
|
|
||||||
|
|
||||||
gtk_tree_model_get (model, &iter, 0, &extension, -1);
|
|
||||||
|
|
||||||
midori_extensions_popup (widget, event, extension, extensions);
|
|
||||||
g_object_unref (extension);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
midori_extensions_cell_renderer_toggled_cb (GtkCellRendererToggle* renderer,
|
midori_extensions_cell_renderer_toggled_cb (GtkCellRendererToggle* renderer,
|
||||||
const gchar* path,
|
const gchar* path,
|
||||||
|
@ -511,10 +369,6 @@ midori_extensions_init (MidoriExtensions* extensions)
|
||||||
g_object_connect (extensions->treeview,
|
g_object_connect (extensions->treeview,
|
||||||
"signal::row-activated",
|
"signal::row-activated",
|
||||||
midori_extensions_treeview_row_activated_cb, extensions,
|
midori_extensions_treeview_row_activated_cb, extensions,
|
||||||
"signal::button-release-event",
|
|
||||||
midori_extensions_button_release_event_cb, extensions,
|
|
||||||
"signal::popup-menu",
|
|
||||||
midori_extensions_popup_menu_cb, extensions,
|
|
||||||
NULL);
|
NULL);
|
||||||
gtk_widget_show (extensions->treeview);
|
gtk_widget_show (extensions->treeview);
|
||||||
gtk_box_pack_start (GTK_BOX (extensions), extensions->treeview, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (extensions), extensions->treeview, TRUE, TRUE, 0);
|
||||||
|
|
|
@ -429,7 +429,6 @@ midori_history_get_toolbar (MidoriViewable* viewable)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
toolbar = gtk_toolbar_new ();
|
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_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_BUTTON);
|
||||||
history->toolbar = toolbar;
|
history->toolbar = toolbar;
|
||||||
#if HAVE_SQLITE
|
#if HAVE_SQLITE
|
||||||
|
|
|
@ -127,7 +127,6 @@ midori_transfers_get_toolbar (MidoriViewable* transfers)
|
||||||
GtkToolItem* toolitem;
|
GtkToolItem* toolitem;
|
||||||
|
|
||||||
toolbar = gtk_toolbar_new ();
|
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_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_BUTTON);
|
||||||
toolitem = gtk_tool_item_new ();
|
toolitem = gtk_tool_item_new ();
|
||||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
||||||
|
|
|
@ -12,7 +12,6 @@ midori/midori-view.c
|
||||||
midori/midori-preferences.c
|
midori/midori-preferences.c
|
||||||
midori/midori-searchaction.c
|
midori/midori-searchaction.c
|
||||||
midori/sokoke.c
|
midori/sokoke.c
|
||||||
panels/midori-addons.c
|
|
||||||
panels/midori-bookmarks.c
|
panels/midori-bookmarks.c
|
||||||
panels/midori-console.c
|
panels/midori-console.c
|
||||||
panels/midori-extensions.c
|
panels/midori-extensions.c
|
||||||
|
@ -26,6 +25,7 @@ katze/katze-array.c
|
||||||
katze/katze-arrayaction.c
|
katze/katze-arrayaction.c
|
||||||
katze/katze-preferences.c
|
katze/katze-preferences.c
|
||||||
extensions/adblock.c
|
extensions/adblock.c
|
||||||
|
extensions/addons.c
|
||||||
extensions/colorful-tabs.c
|
extensions/colorful-tabs.c
|
||||||
extensions/cookie-manager/cookie-manager.c
|
extensions/cookie-manager/cookie-manager.c
|
||||||
extensions/cookie-manager/cookie-manager-page.c
|
extensions/cookie-manager/cookie-manager-page.c
|
||||||
|
|
1406
po/zh_CN.po
1406
po/zh_CN.po
File diff suppressed because it is too large
Load diff
|
@ -95,9 +95,12 @@ magic_uri_uri (void)
|
||||||
test_input ("example.com", "http://example.com");
|
test_input ("example.com", "http://example.com");
|
||||||
test_input ("www.google..com", "http://www.google..com");
|
test_input ("www.google..com", "http://www.google..com");
|
||||||
test_input ("/home/user/midori.html", "file:///home/user/midori.html");
|
test_input ("/home/user/midori.html", "file:///home/user/midori.html");
|
||||||
test_input ("localhost", "http://localhost");
|
if (sokoke_resolve_hostname ("localhost"))
|
||||||
test_input ("localhost:8000", "http://localhost:8000");
|
{
|
||||||
test_input ("localhost/rss", "http://localhost/rss");
|
test_input ("localhost", "http://localhost");
|
||||||
|
test_input ("localhost:8000", "http://localhost:8000");
|
||||||
|
test_input ("localhost/rss", "http://localhost/rss");
|
||||||
|
}
|
||||||
test_input ("10.0.0.1", "http://10.0.0.1");
|
test_input ("10.0.0.1", "http://10.0.0.1");
|
||||||
test_input ("192.168.1.1", "http://192.168.1.1");
|
test_input ("192.168.1.1", "http://192.168.1.1");
|
||||||
test_input ("192.168.1.1:8000", "http://192.168.1.1:8000");
|
test_input ("192.168.1.1:8000", "http://192.168.1.1:8000");
|
||||||
|
@ -255,18 +258,18 @@ magic_uri_format (void)
|
||||||
static void
|
static void
|
||||||
magic_uri_prefetch (void)
|
magic_uri_prefetch (void)
|
||||||
{
|
{
|
||||||
g_assert (!sokoke_prefetch_uri (NULL));
|
g_assert (!sokoke_prefetch_uri (NULL, NULL, NULL));
|
||||||
g_assert (sokoke_prefetch_uri ("http://google.com"));
|
g_assert (sokoke_prefetch_uri ("http://google.com", NULL, NULL));
|
||||||
g_assert (sokoke_prefetch_uri ("http://google.com"));
|
g_assert (sokoke_prefetch_uri ("http://google.com", NULL, NULL));
|
||||||
g_assert (sokoke_prefetch_uri ("http://googlecom"));
|
g_assert (sokoke_prefetch_uri ("http://googlecom", NULL, NULL));
|
||||||
g_assert (sokoke_prefetch_uri ("http://1kino.com"));
|
g_assert (sokoke_prefetch_uri ("http://1kino.com", NULL, NULL));
|
||||||
g_assert (sokoke_prefetch_uri ("http://"));
|
g_assert (sokoke_prefetch_uri ("http://", NULL, NULL));
|
||||||
g_assert (!sokoke_prefetch_uri ("http:/"));
|
g_assert (!sokoke_prefetch_uri ("http:/", NULL, NULL));
|
||||||
g_assert (!sokoke_prefetch_uri ("http"));
|
g_assert (!sokoke_prefetch_uri ("http", NULL, NULL));
|
||||||
g_assert (!sokoke_prefetch_uri ("ftp://ftphost.org"));
|
g_assert (!sokoke_prefetch_uri ("ftp://ftphost.org", NULL, NULL));
|
||||||
g_assert (!sokoke_prefetch_uri ("http://10.0.0.1"));
|
g_assert (!sokoke_prefetch_uri ("http://10.0.0.1", NULL, NULL));
|
||||||
g_assert (!sokoke_prefetch_uri ("about:blank"));
|
g_assert (!sokoke_prefetch_uri ("about:blank", NULL, NULL));
|
||||||
g_assert (!sokoke_prefetch_uri ("javascript: alert()"));
|
g_assert (!sokoke_prefetch_uri ("javascript: alert()", NULL, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -14,13 +14,18 @@ for test in tests:
|
||||||
for fila in files:
|
for fila in files:
|
||||||
if fila[-2:] == '.c':
|
if fila[-2:] == '.c':
|
||||||
source += ' ' + test + os.sep + fila
|
source += ' ' + test + os.sep + fila
|
||||||
|
elif 'VALAC' in bld.env and file[-5:] == '.vala':
|
||||||
|
source += ' ' + test + os.sep + fila
|
||||||
if not source:
|
if not source:
|
||||||
Utils.pprint ('RED', folder + ': No source files found')
|
Utils.pprint ('RED', folder + ': No source files found')
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
if test[-2:] != '.c':
|
if test[-2:] == '.c':
|
||||||
|
target = test[:-2]
|
||||||
|
elif 'VALAC' in bld.env and test[-5:] == '.vala':
|
||||||
|
target = test[:-5]
|
||||||
|
else:
|
||||||
continue
|
continue
|
||||||
target = test[:-2]
|
|
||||||
source = test
|
source = test
|
||||||
|
|
||||||
obj = bld.new_task_gen ('cc', 'program')
|
obj = bld.new_task_gen ('cc', 'program')
|
||||||
|
@ -28,6 +33,8 @@ for test in tests:
|
||||||
obj.includes = '.. ../midori ../panels'
|
obj.includes = '.. ../midori ../panels'
|
||||||
obj.cflags = ['-DEXTENSION_PATH="' + os.path.abspath ('_build_/default/extensions') + '"']
|
obj.cflags = ['-DEXTENSION_PATH="' + os.path.abspath ('_build_/default/extensions') + '"']
|
||||||
obj.source = source
|
obj.source = source
|
||||||
|
obj.vapi_dirs = '../midori'
|
||||||
|
obj.packages = 'glib-2.0 gio-2.0 gtk+-2.0 libsoup-2.4 webkit-1.0 midori'
|
||||||
obj.uselib = 'UNIQUE LIBSOUP GIO GTK SQLITE WEBKIT LIBXML'
|
obj.uselib = 'UNIQUE LIBSOUP GIO GTK SQLITE WEBKIT LIBXML'
|
||||||
obj.uselib_local = 'midori-core'
|
obj.uselib_local = 'midori-core'
|
||||||
obj.unit_test = 1
|
obj.unit_test = 1
|
||||||
|
|
161
tools/check-style
Executable file
161
tools/check-style
Executable file
|
@ -0,0 +1,161 @@
|
||||||
|
#! /usr/bin/env python
|
||||||
|
|
||||||
|
# Copyright (C) 2010 Christian Dywan <christian@twotoasts.de>
|
||||||
|
# Copyright (C) 2010 Arno Renevier <arno@renevier.net>
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# check-style: Verify C source code according to coding style.
|
||||||
|
|
||||||
|
import glob, re, string, subprocess, sys, os
|
||||||
|
|
||||||
|
if len (sys.argv) < 2:
|
||||||
|
name = os.path.basename (sys.argv[0])
|
||||||
|
print ('Usage:\n ' + name + ' FILENAMES\n'
|
||||||
|
' Pass "-" to read stdin, eg. "cat my-feature.diff | ' + name + ' -"\n'
|
||||||
|
' Pass "." to mean "git diff ^HEAD | ' + name + ' -"')
|
||||||
|
sys.exit (1)
|
||||||
|
|
||||||
|
# Coding style violations
|
||||||
|
violations = [
|
||||||
|
['.{101}', 'Line longer than 100 columns'],
|
||||||
|
['^[ ]{1,3}[^ ]+', 'Indentation is less than 4 spaces'],
|
||||||
|
# FIXME: Don't match empty strings
|
||||||
|
# FIXME: Don't match indented function arguments
|
||||||
|
# ['^(?!(([ ]{4})*[^ ]+))', 'Indentation is not 4 spaces'],
|
||||||
|
['.*[ ]+$', 'Trailing whitespace'],
|
||||||
|
[r"\t+", 'Tabs instead of spaces'],
|
||||||
|
["[^0-9],[^ ][^0-9]", 'No space after comma'],
|
||||||
|
# ['(([A-Z][a-z]+)+)\*?[ ][a-z]{2,}', 'Good variable name'],
|
||||||
|
# ['(g?char|g(boolean|pointer))\*?[ ][a-z]{2,}', 'Good variable name'],
|
||||||
|
# ['(g?int|guint)[ ][a-z]+', 'Good iterator name'],
|
||||||
|
# ['(struct)[ ]+[_]?([A-Z][a-z]+)+', 'Good type name'],
|
||||||
|
['^\s*\w+(?<!\\breturn)\s+\*\s*\w*\s*[;,]', 'Space between type and asterisk'],
|
||||||
|
["(\w[+|-|*|/|<|>|=]{1,2}\w)", 'No space around operators'],
|
||||||
|
["\/\*[^ *\n]", 'No space after open comment'],
|
||||||
|
['[^ *]\*\/', 'No space before close comment'],
|
||||||
|
['\)\{', 'No space between ) and {'],
|
||||||
|
[';[^ \s]', 'No space or newline after semicolon'],
|
||||||
|
# ['(if)( \([^ ].*[^ ]\))$', 'Good if style'],
|
||||||
|
['^#\s+(if(n?def)?|define|else|elif)[ ].*$', 'Space between # and cpp'],
|
||||||
|
[r'^\s*\*\w+(\+\+|--);', 'Invalid increment, use (*i)++ or *i += 1'],
|
||||||
|
['asctime|ctime|getgrgid|getprgnam|getlogin \
|
||||||
|
|getpwnam|getpwuid|gmtime|localtime \
|
||||||
|
|rand|readdir|strtok|ttyname', 'Not thread-safe posix, use _r variant'],
|
||||||
|
]
|
||||||
|
# No validation for strings, comments, includes
|
||||||
|
omissions = [
|
||||||
|
[r'["]{1}.*["]', 'STRING'],
|
||||||
|
["'\\\?.'", 'CHAR'],
|
||||||
|
["^\s*\/\*.*\*\/\s*$", 'COMMENT'],
|
||||||
|
['#include <.*>', 'INCLUDE'],
|
||||||
|
]
|
||||||
|
|
||||||
|
# Output format
|
||||||
|
fmt = '%s - %d: %s'
|
||||||
|
|
||||||
|
# Pre-compile expressions
|
||||||
|
for violation in violations:
|
||||||
|
violation[0] = re.compile (violation[0])
|
||||||
|
for omission in omissions:
|
||||||
|
omission[0] = re.compile (omission[0])
|
||||||
|
|
||||||
|
for filename_or_glob in sys.argv[1:]:
|
||||||
|
if filename_or_glob == '-':
|
||||||
|
handles = [sys.stdin]
|
||||||
|
else:
|
||||||
|
handles = []
|
||||||
|
for filename in glob.glob (filename_or_glob):
|
||||||
|
if os.path.isdir (filename):
|
||||||
|
gitdiff = subprocess.Popen (['git', 'diff', '^HEAD',
|
||||||
|
'--relative', filename], stdout=subprocess.PIPE)
|
||||||
|
handles.append (gitdiff.stdout)
|
||||||
|
else:
|
||||||
|
handles.append (open (filename))
|
||||||
|
if not handles:
|
||||||
|
print (filename_or_glob + ' not found')
|
||||||
|
sys.exit (1)
|
||||||
|
|
||||||
|
for handle in handles:
|
||||||
|
previous = ''
|
||||||
|
i = 0
|
||||||
|
mode = ''
|
||||||
|
filename = handle.name
|
||||||
|
comment = False
|
||||||
|
curly = []
|
||||||
|
|
||||||
|
for line in handle:
|
||||||
|
line = line[:-1]
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
# Parse diff, only validate modified lines
|
||||||
|
if i == 1 and 'diff' in line:
|
||||||
|
mode = 'diff'
|
||||||
|
if mode == 'diff':
|
||||||
|
if line[:3] == '+++':
|
||||||
|
filename = line[6:]
|
||||||
|
comment = False
|
||||||
|
curly = []
|
||||||
|
continue
|
||||||
|
if line[:2] == '@@':
|
||||||
|
i = int (line.split (' ')[2].split (',')[0][1:]) - 1
|
||||||
|
curly = []
|
||||||
|
if line[0] == '-':
|
||||||
|
i = i -1
|
||||||
|
if line[0] != '+':
|
||||||
|
continue
|
||||||
|
line = line[1:]
|
||||||
|
|
||||||
|
# Spurious blank lines
|
||||||
|
if previous == line == '':
|
||||||
|
print (fmt % (filename, i, 'Spurious blank line'))
|
||||||
|
previous = line
|
||||||
|
continue
|
||||||
|
previous = line
|
||||||
|
|
||||||
|
# Skip multi-line comment blocks
|
||||||
|
if '/*' in line and not '*/' in line:
|
||||||
|
comment = True
|
||||||
|
if comment:
|
||||||
|
if '*/' in line and not '/*' in line:
|
||||||
|
comment = False
|
||||||
|
continue
|
||||||
|
|
||||||
|
cleaned = line
|
||||||
|
for omission in omissions:
|
||||||
|
cleaned = omission[0].sub (omission[1], cleaned)
|
||||||
|
|
||||||
|
# Validate curly bracket indentation
|
||||||
|
if '{' in cleaned and not '}' in cleaned:
|
||||||
|
curly.append ((cleaned.index ('{'), cleaned))
|
||||||
|
if '}' in cleaned and not '{' in cleaned and not '},' in cleaned:
|
||||||
|
if len (curly) == 0 or curly[-1][0] != cleaned.index ('}'):
|
||||||
|
print (fmt % (filename, i, 'Misindented curly bracket'))
|
||||||
|
print (curly[-1][1])
|
||||||
|
print (line)
|
||||||
|
curly.pop()
|
||||||
|
continue
|
||||||
|
curly.pop()
|
||||||
|
|
||||||
|
# Validate preprocessor indentation
|
||||||
|
# FIXME: Don't warn if the *following* line is a curly
|
||||||
|
cpp = cleaned.find ('#if')
|
||||||
|
if cpp != -1:
|
||||||
|
if len (curly) != 0 and cpp != curly[-1][0] + 4:
|
||||||
|
print (fmt % (filename, i, 'Misindented preprocessor #if'))
|
||||||
|
print (curly[-1][1])
|
||||||
|
print (line)
|
||||||
|
|
||||||
|
violated = False
|
||||||
|
for violation in violations:
|
||||||
|
if violation[0].search (cleaned):
|
||||||
|
violated = True
|
||||||
|
print (fmt % (filename, i, violation[1]))
|
||||||
|
if violated:
|
||||||
|
print (line)
|
||||||
|
|
87
tools/midori-dev
Executable file
87
tools/midori-dev
Executable file
|
@ -0,0 +1,87 @@
|
||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
# Copyright (C) 2010 David Mohr <david@mcbf.net>
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# midori-dev: Run, update or debug Midori from git.
|
||||||
|
|
||||||
|
# Adjust this to where you have your git sources
|
||||||
|
DEVDIR=~/src/xfce/midori/git
|
||||||
|
|
||||||
|
# Location of stdout and stderr from running midori
|
||||||
|
LOG=~/.midori.out
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
BIN=_build_/default/midori/midori
|
||||||
|
BASENAME=`basename $0`
|
||||||
|
|
||||||
|
ulimit -c unlimited
|
||||||
|
|
||||||
|
cd $DEVDIR
|
||||||
|
|
||||||
|
CMD=`echo $BASENAME | sed 's/^midori-//'`
|
||||||
|
if [ -z $CMD ]; then
|
||||||
|
echo "I'm confused, basename $BASENAME is not in the midori-<FOO> format"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $CMD == "dev" ]; then
|
||||||
|
# No command was given through a symlink,
|
||||||
|
# so check the first parameter instead
|
||||||
|
CMD=$1
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $CMD in
|
||||||
|
git)
|
||||||
|
exec ./waf build --run "$@" >& $LOG
|
||||||
|
;;
|
||||||
|
gdb)
|
||||||
|
gdb $BIN core
|
||||||
|
;;
|
||||||
|
save)
|
||||||
|
NAME=`date '+%Y%m%d-%H%M%S'`
|
||||||
|
DESC="$1"
|
||||||
|
CAT="$2"
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "It is recommended to save a description of the cause of the crash"
|
||||||
|
echo "Enter one line now, or press <ENTER> to continue"
|
||||||
|
read DESC
|
||||||
|
fi
|
||||||
|
CRASH=crash/$NAME
|
||||||
|
|
||||||
|
echo "Saving crash info..."
|
||||||
|
mkdir -p $CRASH
|
||||||
|
echo $DESC > $CRASH/description
|
||||||
|
echo " (gdb will take some time)"
|
||||||
|
gdb $BIN core --batch -ex 'thread apply all bt' >& $CRASH/backtrace
|
||||||
|
echo " Backtrace is in $DEVDIR/$CRASH/backtrace."
|
||||||
|
cp $BIN $CRASH
|
||||||
|
cp core $CRASH
|
||||||
|
cp $LOG $CRASH/output
|
||||||
|
|
||||||
|
if [ -n "$CAT" ]; then
|
||||||
|
cat $CRASH/backtrace
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
pull)
|
||||||
|
git pull
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
cat << EOM
|
||||||
|
Usage: Create a symlink midori-<CMD>, or run 'midori-dev <CMD>'
|
||||||
|
where CMD can be
|
||||||
|
git: run the current git version
|
||||||
|
gdb: open the last core dump in gdb
|
||||||
|
save: saves relevant information about the last crash
|
||||||
|
so that it can be analyzed later
|
||||||
|
pull: pulls the latest updates from the repository
|
||||||
|
EOM
|
||||||
|
esac
|
BIN
waf
vendored
BIN
waf
vendored
Binary file not shown.
56
wscript
56
wscript
|
@ -18,14 +18,18 @@ import Options
|
||||||
import Utils
|
import Utils
|
||||||
import pproc as subprocess
|
import pproc as subprocess
|
||||||
import os
|
import os
|
||||||
import UnitTest
|
try:
|
||||||
|
import UnitTest
|
||||||
|
except:
|
||||||
|
import unittestw as UnitTest
|
||||||
import Task
|
import Task
|
||||||
from TaskGen import extension, feature, taskgen
|
from TaskGen import extension, feature, taskgen
|
||||||
import misc
|
import misc
|
||||||
|
from Configure import find_program_impl
|
||||||
|
|
||||||
major = 0
|
major = 0
|
||||||
minor = 2
|
minor = 2
|
||||||
micro = 4
|
micro = 6
|
||||||
|
|
||||||
APPNAME = 'midori'
|
APPNAME = 'midori'
|
||||||
VERSION = str (major) + '.' + str (minor) + '.' + str (micro)
|
VERSION = str (major) + '.' + str (minor) + '.' + str (micro)
|
||||||
|
@ -83,6 +87,11 @@ def configure (conf):
|
||||||
return dirvalue
|
return dirvalue
|
||||||
|
|
||||||
conf.check_tool ('compiler_cc')
|
conf.check_tool ('compiler_cc')
|
||||||
|
# Circumvent mandatory check for valac
|
||||||
|
if find_program_impl (conf.env, 'valac'):
|
||||||
|
conf.check_tool ('vala')
|
||||||
|
else:
|
||||||
|
conf.check_message ('program', 'valac', False, False)
|
||||||
conf.check_tool ('glib2')
|
conf.check_tool ('glib2')
|
||||||
|
|
||||||
if option_enabled ('userdocs'):
|
if option_enabled ('userdocs'):
|
||||||
|
@ -209,12 +218,17 @@ def configure (conf):
|
||||||
args = '--define-variable=target=win32'
|
args = '--define-variable=target=win32'
|
||||||
elif sys.platform != 'darwin':
|
elif sys.platform != 'darwin':
|
||||||
check_pkg ('x11')
|
check_pkg ('x11')
|
||||||
|
# Pass /usr/X11R6/include for OpenBSD
|
||||||
|
conf.check (header_name='X11/extensions/scrnsaver.h',
|
||||||
|
includes='/usr/X11R6/include', mandatory=False)
|
||||||
|
conf.check (lib='Xss', libpath='/usr/X11R6/lib', mandatory=False)
|
||||||
check_pkg ('gtk+-2.0', '2.10.0', var='GTK', args=args)
|
check_pkg ('gtk+-2.0', '2.10.0', var='GTK', args=args)
|
||||||
check_pkg ('webkit-1.0', '1.1.1', args=args)
|
check_pkg ('webkit-1.0', '1.1.1', args=args)
|
||||||
check_pkg ('libsoup-2.4', '2.25.2')
|
check_pkg ('libsoup-2.4', '2.25.2')
|
||||||
conf.define ('HAVE_LIBSOUP_2_25_2', 1)
|
conf.define ('HAVE_LIBSOUP_2_25_2', 1)
|
||||||
check_pkg ('libsoup-2.4', '2.27.90', False, var='LIBSOUP_2_27_90')
|
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.3', False, var='LIBSOUP_2_29_3')
|
||||||
|
check_pkg ('libsoup-2.4', '2.29.91', False, var='LIBSOUP_2_29_91')
|
||||||
check_pkg ('libxml-2.0', '2.6')
|
check_pkg ('libxml-2.0', '2.6')
|
||||||
|
|
||||||
if conf.env['HAVE_LIBSOUP_2_27_90']:
|
if conf.env['HAVE_LIBSOUP_2_27_90']:
|
||||||
|
@ -245,6 +259,7 @@ def configure (conf):
|
||||||
# Store options in env, since 'Options' is not persistent
|
# Store options in env, since 'Options' is not persistent
|
||||||
if 'CC' in os.environ: conf.env['CC'] = os.environ['CC'].split()
|
if 'CC' in os.environ: conf.env['CC'] = os.environ['CC'].split()
|
||||||
conf.env['addons'] = option_enabled ('addons')
|
conf.env['addons'] = option_enabled ('addons')
|
||||||
|
conf.env['tests'] = option_enabled ('tests')
|
||||||
conf.env['docs'] = option_enabled ('docs')
|
conf.env['docs'] = option_enabled ('docs')
|
||||||
if 'LINGUAS' in os.environ: conf.env['LINGUAS'] = os.environ['LINGUAS']
|
if 'LINGUAS' in os.environ: conf.env['LINGUAS'] = os.environ['LINGUAS']
|
||||||
|
|
||||||
|
@ -279,13 +294,18 @@ def configure (conf):
|
||||||
conf.env.append_value ('CCFLAGS', '-DHAVE_CONFIG_H')
|
conf.env.append_value ('CCFLAGS', '-DHAVE_CONFIG_H')
|
||||||
debug_level = Options.options.debug_level
|
debug_level = Options.options.debug_level
|
||||||
compiler = conf.env['CC_NAME']
|
compiler = conf.env['CC_NAME']
|
||||||
if debug_level == '':
|
if debug_level != '' and compiler != 'gcc':
|
||||||
if compiler == 'gcc':
|
Utils.pprint ('RED', 'No debugging level support for ' + compiler)
|
||||||
debug_level = 'debug'
|
sys.exit (1)
|
||||||
else:
|
elif debug_level == '':
|
||||||
debug_level = 'none'
|
debug_level = 'debug'
|
||||||
if compiler == 'gcc':
|
if compiler == 'gcc':
|
||||||
if debug_level == 'debug':
|
if debug_level == 'none':
|
||||||
|
if 'CCFLAGS' in os.environ:
|
||||||
|
conf.env.append_value ('CCFLAGS', os.environ['CCFLAGS'].split ())
|
||||||
|
else:
|
||||||
|
conf.env.append_value ('CCFLAGS', '-DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT'.split ())
|
||||||
|
elif debug_level == 'debug':
|
||||||
conf.env.append_value ('CCFLAGS', '-Wall -O0 -g'.split ())
|
conf.env.append_value ('CCFLAGS', '-Wall -O0 -g'.split ())
|
||||||
elif debug_level == 'full':
|
elif debug_level == 'full':
|
||||||
# -Wdeclaration-after-statement
|
# -Wdeclaration-after-statement
|
||||||
|
@ -305,10 +325,10 @@ def configure (conf):
|
||||||
'-DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED '
|
'-DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED '
|
||||||
'-DGTK_DISABLE_DEPRECATED -DPANGO_DISABLE_DEPRECATED '
|
'-DGTK_DISABLE_DEPRECATED -DPANGO_DISABLE_DEPRECATED '
|
||||||
'-DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE'.split ())
|
'-DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE'.split ())
|
||||||
elif debug_level != 'none':
|
if debug_level == 'full':
|
||||||
Utils.pprint ('RED', 'No debugging level support for ' + compiler)
|
conf.env.append_value ('VALAFLAGS', '--enable-checking'.split ())
|
||||||
sys.exit (1)
|
elif debug_level == 'none':
|
||||||
|
conf.env.append_value ('VALAFLAGS', '--disable-assert')
|
||||||
print '''
|
print '''
|
||||||
Localization: %(nls)s (intltool)
|
Localization: %(nls)s (intltool)
|
||||||
Icon optimizations: %(icons)s (rsvg-convert)
|
Icon optimizations: %(icons)s (rsvg-convert)
|
||||||
|
@ -364,6 +384,7 @@ def set_options (opt):
|
||||||
add_enable_option ('sqlite', 'history database support', group)
|
add_enable_option ('sqlite', 'history database support', group)
|
||||||
add_enable_option ('libnotify', 'notification support', group)
|
add_enable_option ('libnotify', 'notification support', group)
|
||||||
add_enable_option ('addons', 'building of extensions', group)
|
add_enable_option ('addons', 'building of extensions', group)
|
||||||
|
add_enable_option ('tests', 'building of tests', group, disable=True)
|
||||||
add_enable_option ('hildon', 'Maemo integration', group, disable=not is_maemo ())
|
add_enable_option ('hildon', 'Maemo integration', group, disable=not is_maemo ())
|
||||||
|
|
||||||
# Provided for compatibility
|
# Provided for compatibility
|
||||||
|
@ -379,7 +400,10 @@ def write_linguas_file (self):
|
||||||
else:
|
else:
|
||||||
podir = '../po'
|
podir = '../po'
|
||||||
if 'LINGUAS' in Build.bld.env:
|
if 'LINGUAS' in Build.bld.env:
|
||||||
linguas = Build.bld.env['LINGUAS']
|
files = Build.bld.env['LINGUAS']
|
||||||
|
for f in files.split (' '):
|
||||||
|
if os.path.exists (podir + '/' + f + '.po'):
|
||||||
|
linguas += f + ' '
|
||||||
else:
|
else:
|
||||||
files = os.listdir (podir)
|
files = os.listdir (podir)
|
||||||
for f in files:
|
for f in files:
|
||||||
|
@ -518,12 +542,16 @@ def build (bld):
|
||||||
bld.install_files ('${SYSCONFDIR}/xdg/' + APPNAME + \
|
bld.install_files ('${SYSCONFDIR}/xdg/' + APPNAME + \
|
||||||
'/extensions/' + folder, source)
|
'/extensions/' + folder, source)
|
||||||
|
|
||||||
if Options.commands['check']:
|
if Options.commands['check'] or bld.env['tests']:
|
||||||
bld.add_subdirs ('tests')
|
bld.add_subdirs ('tests')
|
||||||
|
|
||||||
if Options.commands['clean']:
|
if Options.commands['clean']:
|
||||||
distclean ()
|
distclean ()
|
||||||
|
|
||||||
|
def check (ctx):
|
||||||
|
# The real work happens in shutdown ()
|
||||||
|
pass
|
||||||
|
|
||||||
def distclean ():
|
def distclean ():
|
||||||
if os.path.exists ('po/LINGUAS'):
|
if os.path.exists ('po/LINGUAS'):
|
||||||
os.remove ('po/LINGUAS')
|
os.remove ('po/LINGUAS')
|
||||||
|
|
Loading…
Reference in a new issue