Merge branch 'upstream-unstable'

This commit is contained in:
Yves-Alexis Perez 2011-10-10 07:33:38 +02:00
commit 23af38a149
73 changed files with 17403 additions and 14968 deletions

View file

@ -1,5 +1,21 @@
This file is licensed under the terms of the expat license, see the file EXPAT. This file is licensed under the terms of the expat license, see the file EXPAT.
v0.4.1:
+ Experimental, unfinnished GTK+ 3 support
+ 'Automatic' identification with quirks
+ Build fix for WebKitGTK+ >= 1.4.3
+ Register downloaded files as recent files
+ Fix Flash window on background tabs
+ Fix regression with clearing cookies on quit
+ Fix opening tabs from toolbar buttons
+ Use symbolic find and clear icons
+ Drop usage of mootools
+ Install separate Private Browsing shortcut
+ Support dragging tabs out of the window
+ Use feed: to support Thunderbird news reader
+ Re-open closed tabs in private browsing
+ Compare link-fingerprints caselessly
v0.4.0: v0.4.0:
+ Provide buttons to choose how to startup after crash + Provide buttons to choose how to startup after crash
+ Fix crash on corrupted datbase + Fix crash on corrupted datbase

View file

@ -62,15 +62,15 @@ description {
</head> </head>
<body> <body>
<div id="container"> <div id="container">
<img id="logo" src="{res}/logo-shade.png" /> <img id="logo" src="res://logo-shade.png" />
<img id="icon" src="{stock}/gtk-dialog-error" /> <img id="icon" src="stock://gtk-dialog-error" />
<div id="main"> <div id="main">
<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 method="GET" action="{uri}"> <form method="GET" action="{uri}">
<button type="submit" onclick="location.reload(); return false;"> <button type="submit" onclick="location.reload(); return false;">
<img src="{stock}/gtk-refresh"/> <img src="stock://gtk-refresh"/>
<span>{tryagain}</span> <span>{tryagain}</span>
</button> </button>
</form> </form>

View file

@ -0,0 +1,13 @@
[Desktop Entry]
Version=1.0
Type=Application
_Name=Private Browsing
_Comment=Open a new private browsing window
Categories=GTK;Network;WebBrowser;
Exec=midori --private
Icon=midori
Terminal=false
StartupNotify=true
X-Osso-Type=application/x-executable
X-Osso-Service=midori

View file

@ -1,313 +0,0 @@
//MooTools, <http://mootools.net>, My Object Oriented (JavaScript) Tools. Copyright (c) 2006-2009 Valerio Proietti, <http://mad4milk.net>, MIT Style License.
var MooTools={version:"1.2.2",build:"f0491d62fbb7e906789aa3733d6a67d43e5af7c9"};var Native=function(k){k=k||{};var a=k.name;var i=k.legacy;var b=k.protect;
var c=k.implement;var h=k.generics;var f=k.initialize;var g=k.afterImplement||function(){};var d=f||i;h=h!==false;d.constructor=Native;d.$family={name:"native"};
if(i&&f){d.prototype=i.prototype;}d.prototype.constructor=d;if(a){var e=a.toLowerCase();d.prototype.$family={name:e};Native.typize(d,e);}var j=function(n,l,o,m){if(!b||m||!n.prototype[l]){n.prototype[l]=o;
}if(h){Native.genericize(n,l,b);}g.call(n,l,o);return n;};d.alias=function(n,l,o){if(typeof n=="string"){if((n=this.prototype[n])){return j(this,l,n,o);
}}for(var m in n){this.alias(m,n[m],l);}return this;};d.implement=function(m,l,o){if(typeof m=="string"){return j(this,m,l,o);}for(var n in m){j(this,n,m[n],l);
}return this;};if(c){d.implement(c);}return d;};Native.genericize=function(b,c,a){if((!a||!b[c])&&typeof b.prototype[c]=="function"){b[c]=function(){var d=Array.prototype.slice.call(arguments);
return b.prototype[c].apply(d.shift(),d);};}};Native.implement=function(d,c){for(var b=0,a=d.length;b<a;b++){d[b].implement(c);}};Native.typize=function(a,b){if(!a.type){a.type=function(c){return($type(c)===b);
};}};(function(){var a={Array:Array,Date:Date,Function:Function,Number:Number,RegExp:RegExp,String:String};for(var h in a){new Native({name:h,initialize:a[h],protect:true});
}var d={"boolean":Boolean,"native":Native,object:Object};for(var c in d){Native.typize(d[c],c);}var f={Array:["concat","indexOf","join","lastIndexOf","pop","push","reverse","shift","slice","sort","splice","toString","unshift","valueOf"],String:["charAt","charCodeAt","concat","indexOf","lastIndexOf","match","replace","search","slice","split","substr","substring","toLowerCase","toUpperCase","valueOf"]};
for(var e in f){for(var b=f[e].length;b--;){Native.genericize(window[e],f[e][b],true);}}})();var Hash=new Native({name:"Hash",initialize:function(a){if($type(a)=="hash"){a=$unlink(a.getClean());
}for(var b in a){this[b]=a[b];}return this;}});Hash.implement({forEach:function(b,c){for(var a in this){if(this.hasOwnProperty(a)){b.call(c,this[a],a,this);
}}},getClean:function(){var b={};for(var a in this){if(this.hasOwnProperty(a)){b[a]=this[a];}}return b;},getLength:function(){var b=0;for(var a in this){if(this.hasOwnProperty(a)){b++;
}}return b;}});Hash.alias("forEach","each");Array.implement({forEach:function(c,d){for(var b=0,a=this.length;b<a;b++){c.call(d,this[b],b,this);}}});Array.alias("forEach","each");
function $A(b){if(b.item){var a=b.length,c=new Array(a);while(a--){c[a]=b[a];}return c;}return Array.prototype.slice.call(b);}function $arguments(a){return function(){return arguments[a];
};}function $chk(a){return !!(a||a===0);}function $clear(a){clearTimeout(a);clearInterval(a);return null;}function $defined(a){return(a!=undefined);}function $each(c,b,d){var a=$type(c);
((a=="arguments"||a=="collection"||a=="array")?Array:Hash).each(c,b,d);}function $empty(){}function $extend(c,a){for(var b in (a||{})){c[b]=a[b];}return c;
}function $H(a){return new Hash(a);}function $lambda(a){return(typeof a=="function")?a:function(){return a;};}function $merge(){var a=Array.slice(arguments);
a.unshift({});return $mixin.apply(null,a);}function $mixin(e){for(var d=1,a=arguments.length;d<a;d++){var b=arguments[d];if($type(b)!="object"){continue;
}for(var c in b){var g=b[c],f=e[c];e[c]=(f&&$type(g)=="object"&&$type(f)=="object")?$mixin(f,g):$unlink(g);}}return e;}function $pick(){for(var b=0,a=arguments.length;
b<a;b++){if(arguments[b]!=undefined){return arguments[b];}}return null;}function $random(b,a){return Math.floor(Math.random()*(a-b+1)+b);}function $splat(b){var a=$type(b);
return(a)?((a!="array"&&a!="arguments")?[b]:b):[];}var $time=Date.now||function(){return +new Date;};function $try(){for(var b=0,a=arguments.length;b<a;
b++){try{return arguments[b]();}catch(c){}}return null;}function $type(a){if(a==undefined){return false;}if(a.$family){return(a.$family.name=="number"&&!isFinite(a))?false:a.$family.name;
}if(a.nodeName){switch(a.nodeType){case 1:return"element";case 3:return(/\S/).test(a.nodeValue)?"textnode":"whitespace";}}else{if(typeof a.length=="number"){if(a.callee){return"arguments";
}else{if(a.item){return"collection";}}}}return typeof a;}function $unlink(c){var b;switch($type(c)){case"object":b={};for(var e in c){b[e]=$unlink(c[e]);
}break;case"hash":b=new Hash(c);break;case"array":b=[];for(var d=0,a=c.length;d<a;d++){b[d]=$unlink(c[d]);}break;default:return c;}return b;}var Browser=$merge({Engine:{name:"unknown",version:0},Platform:{name:(window.orientation!=undefined)?"ipod":(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase()},Features:{xpath:!!(document.evaluate),air:!!(window.runtime),query:!!(document.querySelector)},Plugins:{},Engines:{presto:function(){return(!window.opera)?false:((arguments.callee.caller)?960:((document.getElementsByClassName)?950:925));
},trident:function(){return(!window.ActiveXObject)?false:((window.XMLHttpRequest)?5:4);},webkit:function(){return(navigator.taintEnabled)?false:((Browser.Features.xpath)?((Browser.Features.query)?525:420):419);
},gecko:function(){return(document.getBoxObjectFor==undefined)?false:((document.getElementsByClassName)?19:18);}}},Browser||{});Browser.Platform[Browser.Platform.name]=true;
Browser.detect=function(){for(var b in this.Engines){var a=this.Engines[b]();if(a){this.Engine={name:b,version:a};this.Engine[b]=this.Engine[b+a]=true;
break;}}return{name:b,version:a};};Browser.detect();Browser.Request=function(){return $try(function(){return new XMLHttpRequest();},function(){return new ActiveXObject("MSXML2.XMLHTTP");
});};Browser.Features.xhr=!!(Browser.Request());Browser.Plugins.Flash=(function(){var a=($try(function(){return navigator.plugins["Shockwave Flash"].description;
},function(){return new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version");})||"0 r0").match(/\d+/g);return{version:parseInt(a[0]||0+"."+a[1],10)||0,build:parseInt(a[2],10)||0};
})();function $exec(b){if(!b){return b;}if(window.execScript){window.execScript(b);}else{var a=document.createElement("script");a.setAttribute("type","text/javascript");
a[(Browser.Engine.webkit&&Browser.Engine.version<420)?"innerText":"text"]=b;document.head.appendChild(a);document.head.removeChild(a);}return b;}Native.UID=1;
var $uid=(Browser.Engine.trident)?function(a){return(a.uid||(a.uid=[Native.UID++]))[0];}:function(a){return a.uid||(a.uid=Native.UID++);};var Window=new Native({name:"Window",legacy:(Browser.Engine.trident)?null:window.Window,initialize:function(a){$uid(a);
if(!a.Element){a.Element=$empty;if(Browser.Engine.webkit){a.document.createElement("iframe");}a.Element.prototype=(Browser.Engine.webkit)?window["[[DOMElement.prototype]]"]:{};
}a.document.window=a;return $extend(a,Window.Prototype);},afterImplement:function(b,a){window[b]=Window.Prototype[b]=a;}});Window.Prototype={$family:{name:"window"}};
new Window(window);var Document=new Native({name:"Document",legacy:(Browser.Engine.trident)?null:window.Document,initialize:function(a){$uid(a);a.head=a.getElementsByTagName("head")[0];
a.html=a.getElementsByTagName("html")[0];if(Browser.Engine.trident&&Browser.Engine.version<=4){$try(function(){a.execCommand("BackgroundImageCache",false,true);
});}if(Browser.Engine.trident){a.window.attachEvent("onunload",function(){a.window.detachEvent("onunload",arguments.callee);a.head=a.html=a.window=null;
});}return $extend(a,Document.Prototype);},afterImplement:function(b,a){document[b]=Document.Prototype[b]=a;}});Document.Prototype={$family:{name:"document"}};
new Document(document);Array.implement({every:function(c,d){for(var b=0,a=this.length;b<a;b++){if(!c.call(d,this[b],b,this)){return false;}}return true;
},filter:function(d,e){var c=[];for(var b=0,a=this.length;b<a;b++){if(d.call(e,this[b],b,this)){c.push(this[b]);}}return c;},clean:function(){return this.filter($defined);
},indexOf:function(c,d){var a=this.length;for(var b=(d<0)?Math.max(0,a+d):d||0;b<a;b++){if(this[b]===c){return b;}}return -1;},map:function(d,e){var c=[];
for(var b=0,a=this.length;b<a;b++){c[b]=d.call(e,this[b],b,this);}return c;},some:function(c,d){for(var b=0,a=this.length;b<a;b++){if(c.call(d,this[b],b,this)){return true;
}}return false;},associate:function(c){var d={},b=Math.min(this.length,c.length);for(var a=0;a<b;a++){d[c[a]]=this[a];}return d;},link:function(c){var a={};
for(var e=0,b=this.length;e<b;e++){for(var d in c){if(c[d](this[e])){a[d]=this[e];delete c[d];break;}}}return a;},contains:function(a,b){return this.indexOf(a,b)!=-1;
},extend:function(c){for(var b=0,a=c.length;b<a;b++){this.push(c[b]);}return this;},getLast:function(){return(this.length)?this[this.length-1]:null;},getRandom:function(){return(this.length)?this[$random(0,this.length-1)]:null;
},include:function(a){if(!this.contains(a)){this.push(a);}return this;},combine:function(c){for(var b=0,a=c.length;b<a;b++){this.include(c[b]);}return this;
},erase:function(b){for(var a=this.length;a--;a){if(this[a]===b){this.splice(a,1);}}return this;},empty:function(){this.length=0;return this;},flatten:function(){var d=[];
for(var b=0,a=this.length;b<a;b++){var c=$type(this[b]);if(!c){continue;}d=d.concat((c=="array"||c=="collection"||c=="arguments")?Array.flatten(this[b]):this[b]);
}return d;},hexToRgb:function(b){if(this.length!=3){return null;}var a=this.map(function(c){if(c.length==1){c+=c;}return c.toInt(16);});return(b)?a:"rgb("+a+")";
},rgbToHex:function(d){if(this.length<3){return null;}if(this.length==4&&this[3]==0&&!d){return"transparent";}var b=[];for(var a=0;a<3;a++){var c=(this[a]-0).toString(16);
b.push((c.length==1)?"0"+c:c);}return(d)?b:"#"+b.join("");}});Function.implement({extend:function(a){for(var b in a){this[b]=a[b];}return this;},create:function(b){var a=this;
b=b||{};return function(d){var c=b.arguments;c=(c!=undefined)?$splat(c):Array.slice(arguments,(b.event)?1:0);if(b.event){c=[d||window.event].extend(c);
}var e=function(){return a.apply(b.bind||null,c);};if(b.delay){return setTimeout(e,b.delay);}if(b.periodical){return setInterval(e,b.periodical);}if(b.attempt){return $try(e);
}return e();};},run:function(a,b){return this.apply(b,$splat(a));},pass:function(a,b){return this.create({bind:b,arguments:a});},bind:function(b,a){return this.create({bind:b,arguments:a});
},bindWithEvent:function(b,a){return this.create({bind:b,arguments:a,event:true});},attempt:function(a,b){return this.create({bind:b,arguments:a,attempt:true})();
},delay:function(b,c,a){return this.create({bind:c,arguments:a,delay:b})();},periodical:function(c,b,a){return this.create({bind:b,arguments:a,periodical:c})();
}});Number.implement({limit:function(b,a){return Math.min(a,Math.max(b,this));},round:function(a){a=Math.pow(10,a||0);return Math.round(this*a)/a;},times:function(b,c){for(var a=0;
a<this;a++){b.call(c,a,this);}},toFloat:function(){return parseFloat(this);},toInt:function(a){return parseInt(this,a||10);}});Number.alias("times","each");
(function(b){var a={};b.each(function(c){if(!Number[c]){a[c]=function(){return Math[c].apply(null,[this].concat($A(arguments)));};}});Number.implement(a);
})(["abs","acos","asin","atan","atan2","ceil","cos","exp","floor","log","max","min","pow","sin","sqrt","tan"]);String.implement({test:function(a,b){return((typeof a=="string")?new RegExp(a,b):a).test(this);
},contains:function(a,b){return(b)?(b+this+b).indexOf(b+a+b)>-1:this.indexOf(a)>-1;},trim:function(){return this.replace(/^\s+|\s+$/g,"");},clean:function(){return this.replace(/\s+/g," ").trim();
},camelCase:function(){return this.replace(/-\D/g,function(a){return a.charAt(1).toUpperCase();});},hyphenate:function(){return this.replace(/[A-Z]/g,function(a){return("-"+a.charAt(0).toLowerCase());
});},capitalize:function(){return this.replace(/\b[a-z]/g,function(a){return a.toUpperCase();});},escapeRegExp:function(){return this.replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1");
},toInt:function(a){return parseInt(this,a||10);},toFloat:function(){return parseFloat(this);},hexToRgb:function(b){var a=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);
return(a)?a.slice(1).hexToRgb(b):null;},rgbToHex:function(b){var a=this.match(/\d{1,3}/g);return(a)?a.rgbToHex(b):null;},stripScripts:function(b){var a="";
var c=this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,function(){a+=arguments[1]+"\n";return"";});if(b===true){$exec(a);}else{if($type(b)=="function"){b(a,c);
}}return c;},substitute:function(a,b){return this.replace(b||(/\\?\{([^{}]+)\}/g),function(d,c){if(d.charAt(0)=="\\"){return d.slice(1);}return(a[c]!=undefined)?a[c]:"";
});}});Hash.implement({has:Object.prototype.hasOwnProperty,keyOf:function(b){for(var a in this){if(this.hasOwnProperty(a)&&this[a]===b){return a;}}return null;
},hasValue:function(a){return(Hash.keyOf(this,a)!==null);},extend:function(a){Hash.each(a,function(c,b){Hash.set(this,b,c);},this);return this;},combine:function(a){Hash.each(a,function(c,b){Hash.include(this,b,c);
},this);return this;},erase:function(a){if(this.hasOwnProperty(a)){delete this[a];}return this;},get:function(a){return(this.hasOwnProperty(a))?this[a]:null;
},set:function(a,b){if(!this[a]||this.hasOwnProperty(a)){this[a]=b;}return this;},empty:function(){Hash.each(this,function(b,a){delete this[a];},this);
return this;},include:function(a,b){if(this[a]==undefined){this[a]=b;}return this;},map:function(b,c){var a=new Hash;Hash.each(this,function(e,d){a.set(d,b.call(c,e,d,this));
},this);return a;},filter:function(b,c){var a=new Hash;Hash.each(this,function(e,d){if(b.call(c,e,d,this)){a.set(d,e);}},this);return a;},every:function(b,c){for(var a in this){if(this.hasOwnProperty(a)&&!b.call(c,this[a],a)){return false;
}}return true;},some:function(b,c){for(var a in this){if(this.hasOwnProperty(a)&&b.call(c,this[a],a)){return true;}}return false;},getKeys:function(){var a=[];
Hash.each(this,function(c,b){a.push(b);});return a;},getValues:function(){var a=[];Hash.each(this,function(b){a.push(b);});return a;},toQueryString:function(a){var b=[];
Hash.each(this,function(f,e){if(a){e=a+"["+e+"]";}var d;switch($type(f)){case"object":d=Hash.toQueryString(f,e);break;case"array":var c={};f.each(function(h,g){c[g]=h;
});d=Hash.toQueryString(c,e);break;default:d=e+"="+encodeURIComponent(f);}if(f!=undefined){b.push(d);}});return b.join("&");}});Hash.alias({keyOf:"indexOf",hasValue:"contains"});
var Event=new Native({name:"Event",initialize:function(a,f){f=f||window;var k=f.document;a=a||f.event;if(a.$extended){return a;}this.$extended=true;var j=a.type;
var g=a.target||a.srcElement;while(g&&g.nodeType==3){g=g.parentNode;}if(j.test(/key/)){var b=a.which||a.keyCode;var m=Event.Keys.keyOf(b);if(j=="keydown"){var d=b-111;
if(d>0&&d<13){m="f"+d;}}m=m||String.fromCharCode(b).toLowerCase();}else{if(j.match(/(click|mouse|menu)/i)){k=(!k.compatMode||k.compatMode=="CSS1Compat")?k.html:k.body;
var i={x:a.pageX||a.clientX+k.scrollLeft,y:a.pageY||a.clientY+k.scrollTop};var c={x:(a.pageX)?a.pageX-f.pageXOffset:a.clientX,y:(a.pageY)?a.pageY-f.pageYOffset:a.clientY};
if(j.match(/DOMMouseScroll|mousewheel/)){var h=(a.wheelDelta)?a.wheelDelta/120:-(a.detail||0)/3;}var e=(a.which==3)||(a.button==2);var l=null;if(j.match(/over|out/)){switch(j){case"mouseover":l=a.relatedTarget||a.fromElement;
break;case"mouseout":l=a.relatedTarget||a.toElement;}if(!(function(){while(l&&l.nodeType==3){l=l.parentNode;}return true;}).create({attempt:Browser.Engine.gecko})()){l=false;
}}}}return $extend(this,{event:a,type:j,page:i,client:c,rightClick:e,wheel:h,relatedTarget:l,target:g,code:b,key:m,shift:a.shiftKey,control:a.ctrlKey,alt:a.altKey,meta:a.metaKey});
}});Event.Keys=new Hash({enter:13,up:38,down:40,left:37,right:39,esc:27,space:32,backspace:8,tab:9,"delete":46});Event.implement({stop:function(){return this.stopPropagation().preventDefault();
},stopPropagation:function(){if(this.event.stopPropagation){this.event.stopPropagation();}else{this.event.cancelBubble=true;}return this;},preventDefault:function(){if(this.event.preventDefault){this.event.preventDefault();
}else{this.event.returnValue=false;}return this;}});function Class(b){if(b instanceof Function){b={initialize:b};}var a=function(){Object.reset(this);if(a._prototyping){return this;
}this._current=$empty;var c=(this.initialize)?this.initialize.apply(this,arguments):this;delete this._current;delete this.caller;return c;}.extend(this);
a.implement(b);a.constructor=Class;a.prototype.constructor=a;return a;}Function.prototype.protect=function(){this._protected=true;return this;};Object.reset=function(a,c){if(c==null){for(var e in a){Object.reset(a,e);
}return a;}delete a[c];switch($type(a[c])){case"object":var d=function(){};d.prototype=a[c];var b=new d;a[c]=Object.reset(b);break;case"array":a[c]=$unlink(a[c]);
break;}return a;};new Native({name:"Class",initialize:Class}).extend({instantiate:function(b){b._prototyping=true;var a=new b;delete b._prototyping;return a;
},wrap:function(a,b,c){if(c._origin){c=c._origin;}return function(){if(c._protected&&this._current==null){throw new Error('The method "'+b+'" cannot be called.');
}var e=this.caller,f=this._current;this.caller=f;this._current=arguments.callee;var d=c.apply(this,arguments);this._current=f;this.caller=e;return d;}.extend({_owner:a,_origin:c,_name:b});
}});Class.implement({implement:function(a,d){if($type(a)=="object"){for(var e in a){this.implement(e,a[e]);}return this;}var f=Class.Mutators[a];if(f){d=f.call(this,d);
if(d==null){return this;}}var c=this.prototype;switch($type(d)){case"function":if(d._hidden){return this;}c[a]=Class.wrap(this,a,d);break;case"object":var b=c[a];
if($type(b)=="object"){$mixin(b,d);}else{c[a]=$unlink(d);}break;case"array":c[a]=$unlink(d);break;default:c[a]=d;}return this;}});Class.Mutators={Extends:function(a){this.parent=a;
this.prototype=Class.instantiate(a);this.implement("parent",function(){var b=this.caller._name,c=this.caller._owner.parent.prototype[b];if(!c){throw new Error('The method "'+b+'" has no parent.');
}return c.apply(this,arguments);}.protect());},Implements:function(a){$splat(a).each(function(b){if(b instanceof Function){b=Class.instantiate(b);}this.implement(b);
},this);}};var Chain=new Class({$chain:[],chain:function(){this.$chain.extend(Array.flatten(arguments));return this;},callChain:function(){return(this.$chain.length)?this.$chain.shift().apply(this,arguments):false;
},clearChain:function(){this.$chain.empty();return this;}});var Events=new Class({$events:{},addEvent:function(c,b,a){c=Events.removeOn(c);if(b!=$empty){this.$events[c]=this.$events[c]||[];
this.$events[c].include(b);if(a){b.internal=true;}}return this;},addEvents:function(a){for(var b in a){this.addEvent(b,a[b]);}return this;},fireEvent:function(c,b,a){c=Events.removeOn(c);
if(!this.$events||!this.$events[c]){return this;}this.$events[c].each(function(d){d.create({bind:this,delay:a,"arguments":b})();},this);return this;},removeEvent:function(b,a){b=Events.removeOn(b);
if(!this.$events[b]){return this;}if(!a.internal){this.$events[b].erase(a);}return this;},removeEvents:function(c){var d;if($type(c)=="object"){for(d in c){this.removeEvent(d,c[d]);
}return this;}if(c){c=Events.removeOn(c);}for(d in this.$events){if(c&&c!=d){continue;}var b=this.$events[d];for(var a=b.length;a--;a){this.removeEvent(d,b[a]);
}}return this;}});Events.removeOn=function(a){return a.replace(/^on([A-Z])/,function(b,c){return c.toLowerCase();});};var Options=new Class({setOptions:function(){this.options=$merge.run([this.options].extend(arguments));
if(!this.addEvent){return this;}for(var a in this.options){if($type(this.options[a])!="function"||!(/^on[A-Z]/).test(a)){continue;}this.addEvent(a,this.options[a]);
delete this.options[a];}return this;}});var Element=new Native({name:"Element",legacy:window.Element,initialize:function(a,b){var c=Element.Constructors.get(a);
if(c){return c(b);}if(typeof a=="string"){return document.newElement(a,b);}return $(a).set(b);},afterImplement:function(a,b){Element.Prototype[a]=b;if(Array[a]){return;
}Elements.implement(a,function(){var c=[],g=true;for(var e=0,d=this.length;e<d;e++){var f=this[e][a].apply(this[e],arguments);c.push(f);if(g){g=($type(f)=="element");
}}return(g)?new Elements(c):c;});}});Element.Prototype={$family:{name:"element"}};Element.Constructors=new Hash;var IFrame=new Native({name:"IFrame",generics:false,initialize:function(){var e=Array.link(arguments,{properties:Object.type,iframe:$defined});
var c=e.properties||{};var b=$(e.iframe)||false;var d=c.onload||$empty;delete c.onload;c.id=c.name=$pick(c.id,c.name,b.id,b.name,"IFrame_"+$time());b=new Element(b||"iframe",c);
var a=function(){var f=$try(function(){return b.contentWindow.location.host;});if(f&&f==window.location.host){var g=new Window(b.contentWindow);new Document(b.contentWindow.document);
$extend(g.Element.prototype,Element.Prototype);}d.call(b.contentWindow,b.contentWindow.document);};(window.frames[c.id])?a():b.addListener("load",a);return b;
}});var Elements=new Native({initialize:function(f,b){b=$extend({ddup:true,cash:true},b);f=f||[];if(b.ddup||b.cash){var g={},e=[];for(var c=0,a=f.length;
c<a;c++){var d=$.element(f[c],!b.cash);if(b.ddup){if(g[d.uid]){continue;}g[d.uid]=true;}e.push(d);}f=e;}return(b.cash)?$extend(f,this):f;}});Elements.implement({filter:function(a,b){if(!a){return this;
}return new Elements(Array.filter(this,(typeof a=="string")?function(c){return c.match(a);}:a,b));}});Document.implement({newElement:function(a,b){if(Browser.Engine.trident&&b){["name","type","checked"].each(function(c){if(!b[c]){return;
}a+=" "+c+'="'+b[c]+'"';if(c!="checked"){delete b[c];}});a="<"+a+">";}return $.element(this.createElement(a)).set(b);},newTextNode:function(a){return this.createTextNode(a);
},getDocument:function(){return this;},getWindow:function(){return this.window;}});Window.implement({$:function(b,c){if(b&&b.$family&&b.uid){return b;}var a=$type(b);
return($[a])?$[a](b,c,this.document):null;},$$:function(a){if(arguments.length==1&&typeof a=="string"){return this.document.getElements(a);}var f=[];var c=Array.flatten(arguments);
for(var d=0,b=c.length;d<b;d++){var e=c[d];switch($type(e)){case"element":f.push(e);break;case"string":f.extend(this.document.getElements(e,true));}}return new Elements(f);
},getDocument:function(){return this.document;},getWindow:function(){return this;}});$.string=function(c,b,a){c=a.getElementById(c);return(c)?$.element(c,b):null;
};$.element=function(a,d){$uid(a);if(!d&&!a.$family&&!(/^object|embed$/i).test(a.tagName)){var b=Element.Prototype;for(var c in b){a[c]=b[c];}}return a;
};$.object=function(b,c,a){if(b.toElement){return $.element(b.toElement(a),c);}return null;};$.textnode=$.whitespace=$.window=$.document=$arguments(0);
Native.implement([Element,Document],{getElement:function(a,b){return $(this.getElements(a,true)[0]||null,b);},getElements:function(a,d){a=a.split(",");
var c=[];var b=(a.length>1);a.each(function(e){var f=this.getElementsByTagName(e.trim());(b)?c.extend(f):c=f;},this);return new Elements(c,{ddup:b,cash:!d});
}});(function(){var h={},f={};var i={input:"checked",option:"selected",textarea:(Browser.Engine.webkit&&Browser.Engine.version<420)?"innerHTML":"value"};
var c=function(l){return(f[l]||(f[l]={}));};var g=function(n,l){if(!n){return;}var m=n.uid;if(Browser.Engine.trident){if(n.clearAttributes){var q=l&&n.cloneNode(false);
n.clearAttributes();if(q){n.mergeAttributes(q);}}else{if(n.removeEvents){n.removeEvents();}}if((/object/i).test(n.tagName)){for(var o in n){if(typeof n[o]=="function"){n[o]=$empty;
}}Element.dispose(n);}}if(!m){return;}h[m]=f[m]=null;};var d=function(){Hash.each(h,g);if(Browser.Engine.trident){$A(document.getElementsByTagName("object")).each(g);
}if(window.CollectGarbage){CollectGarbage();}h=f=null;};var j=function(n,l,s,m,p,r){var o=n[s||l];var q=[];while(o){if(o.nodeType==1&&(!m||Element.match(o,m))){if(!p){return $(o,r);
}q.push(o);}o=o[l];}return(p)?new Elements(q,{ddup:false,cash:!r}):null;};var e={html:"innerHTML","class":"className","for":"htmlFor",text:(Browser.Engine.trident||(Browser.Engine.webkit&&Browser.Engine.version<420))?"innerText":"textContent"};
var b=["compact","nowrap","ismap","declare","noshade","checked","disabled","readonly","multiple","selected","noresize","defer"];var k=["value","accessKey","cellPadding","cellSpacing","colSpan","frameBorder","maxLength","readOnly","rowSpan","tabIndex","useMap"];
b=b.associate(b);Hash.extend(e,b);Hash.extend(e,k.associate(k.map(String.toLowerCase)));var a={before:function(m,l){if(l.parentNode){l.parentNode.insertBefore(m,l);
}},after:function(m,l){if(!l.parentNode){return;}var n=l.nextSibling;(n)?l.parentNode.insertBefore(m,n):l.parentNode.appendChild(m);},bottom:function(m,l){l.appendChild(m);
},top:function(m,l){var n=l.firstChild;(n)?l.insertBefore(m,n):l.appendChild(m);}};a.inside=a.bottom;Hash.each(a,function(l,m){m=m.capitalize();Element.implement("inject"+m,function(n){l(this,$(n,true));
return this;});Element.implement("grab"+m,function(n){l($(n,true),this);return this;});});Element.implement({set:function(o,m){switch($type(o)){case"object":for(var n in o){this.set(n,o[n]);
}break;case"string":var l=Element.Properties.get(o);(l&&l.set)?l.set.apply(this,Array.slice(arguments,1)):this.setProperty(o,m);}return this;},get:function(m){var l=Element.Properties.get(m);
return(l&&l.get)?l.get.apply(this,Array.slice(arguments,1)):this.getProperty(m);},erase:function(m){var l=Element.Properties.get(m);(l&&l.erase)?l.erase.apply(this):this.removeProperty(m);
return this;},setProperty:function(m,n){var l=e[m];if(n==undefined){return this.removeProperty(m);}if(l&&b[m]){n=!!n;}(l)?this[l]=n:this.setAttribute(m,""+n);
return this;},setProperties:function(l){for(var m in l){this.setProperty(m,l[m]);}return this;},getProperty:function(m){var l=e[m];var n=(l)?this[l]:this.getAttribute(m,2);
return(b[m])?!!n:(l)?n:n||null;},getProperties:function(){var l=$A(arguments);return l.map(this.getProperty,this).associate(l);},removeProperty:function(m){var l=e[m];
(l)?this[l]=(l&&b[m])?false:"":this.removeAttribute(m);return this;},removeProperties:function(){Array.each(arguments,this.removeProperty,this);return this;
},hasClass:function(l){return this.className.contains(l," ");},addClass:function(l){if(!this.hasClass(l)){this.className=(this.className+" "+l).clean();
}return this;},removeClass:function(l){this.className=this.className.replace(new RegExp("(^|\\s)"+l+"(?:\\s|$)"),"$1");return this;},toggleClass:function(l){return this.hasClass(l)?this.removeClass(l):this.addClass(l);
},adopt:function(){Array.flatten(arguments).each(function(l){l=$(l,true);if(l){this.appendChild(l);}},this);return this;},appendText:function(m,l){return this.grab(this.getDocument().newTextNode(m),l);
},grab:function(m,l){a[l||"bottom"]($(m,true),this);return this;},inject:function(m,l){a[l||"bottom"](this,$(m,true));return this;},replaces:function(l){l=$(l,true);
l.parentNode.replaceChild(this,l);return this;},wraps:function(m,l){m=$(m,true);return this.replaces(m).grab(m,l);},getPrevious:function(l,m){return j(this,"previousSibling",null,l,false,m);
},getAllPrevious:function(l,m){return j(this,"previousSibling",null,l,true,m);},getNext:function(l,m){return j(this,"nextSibling",null,l,false,m);},getAllNext:function(l,m){return j(this,"nextSibling",null,l,true,m);
},getFirst:function(l,m){return j(this,"nextSibling","firstChild",l,false,m);},getLast:function(l,m){return j(this,"previousSibling","lastChild",l,false,m);
},getParent:function(l,m){return j(this,"parentNode",null,l,false,m);},getParents:function(l,m){return j(this,"parentNode",null,l,true,m);},getSiblings:function(l,m){return this.getParent().getChildren(l,m).erase(this);
},getChildren:function(l,m){return j(this,"nextSibling","firstChild",l,true,m);},getWindow:function(){return this.ownerDocument.window;},getDocument:function(){return this.ownerDocument;
},getElementById:function(o,n){var m=this.ownerDocument.getElementById(o);if(!m){return null;}for(var l=m.parentNode;l!=this;l=l.parentNode){if(!l){return null;
}}return $.element(m,n);},getSelected:function(){return new Elements($A(this.options).filter(function(l){return l.selected;}));},getComputedStyle:function(m){if(this.currentStyle){return this.currentStyle[m.camelCase()];
}var l=this.getDocument().defaultView.getComputedStyle(this,null);return(l)?l.getPropertyValue([m.hyphenate()]):null;},toQueryString:function(){var l=[];
this.getElements("input, select, textarea",true).each(function(m){if(!m.name||m.disabled){return;}var n=(m.tagName.toLowerCase()=="select")?Element.getSelected(m).map(function(o){return o.value;
}):((m.type=="radio"||m.type=="checkbox")&&!m.checked)?null:m.value;$splat(n).each(function(o){if(typeof o!="undefined"){l.push(m.name+"="+encodeURIComponent(o));
}});});return l.join("&");},clone:function(o,l){o=o!==false;var r=this.cloneNode(o);var n=function(v,u){if(!l){v.removeAttribute("id");}if(Browser.Engine.trident){v.clearAttributes();
v.mergeAttributes(u);v.removeAttribute("uid");if(v.options){var w=v.options,s=u.options;for(var t=w.length;t--;){w[t].selected=s[t].selected;}}}var x=i[u.tagName.toLowerCase()];
if(x&&u[x]){v[x]=u[x];}};if(o){var p=r.getElementsByTagName("*"),q=this.getElementsByTagName("*");for(var m=p.length;m--;){n(p[m],q[m]);}}n(r,this);return $(r);
},destroy:function(){Element.empty(this);Element.dispose(this);g(this,true);return null;},empty:function(){$A(this.childNodes).each(function(l){Element.destroy(l);
});return this;},dispose:function(){return(this.parentNode)?this.parentNode.removeChild(this):this;},hasChild:function(l){l=$(l,true);if(!l){return false;
}if(Browser.Engine.webkit&&Browser.Engine.version<420){return $A(this.getElementsByTagName(l.tagName)).contains(l);}return(this.contains)?(this!=l&&this.contains(l)):!!(this.compareDocumentPosition(l)&16);
},match:function(l){return(!l||(l==this)||(Element.get(this,"tag")==l));}});Native.implement([Element,Window,Document],{addListener:function(o,n){if(o=="unload"){var l=n,m=this;
n=function(){m.removeListener("unload",n);l();};}else{h[this.uid]=this;}if(this.addEventListener){this.addEventListener(o,n,false);}else{this.attachEvent("on"+o,n);
}return this;},removeListener:function(m,l){if(this.removeEventListener){this.removeEventListener(m,l,false);}else{this.detachEvent("on"+m,l);}return this;
},retrieve:function(m,l){var o=c(this.uid),n=o[m];if(l!=undefined&&n==undefined){n=o[m]=l;}return $pick(n);},store:function(m,l){var n=c(this.uid);n[m]=l;
return this;},eliminate:function(l){var m=c(this.uid);delete m[l];return this;}});window.addListener("unload",d);})();Element.Properties=new Hash;Element.Properties.style={set:function(a){this.style.cssText=a;
},get:function(){return this.style.cssText;},erase:function(){this.style.cssText="";}};Element.Properties.tag={get:function(){return this.tagName.toLowerCase();
}};Element.Properties.html=(function(){var c=document.createElement("div");var a={table:[1,"<table>","</table>"],select:[1,"<select>","</select>"],tbody:[2,"<table><tbody>","</tbody></table>"],tr:[3,"<table><tbody><tr>","</tr></tbody></table>"]};
a.thead=a.tfoot=a.tbody;var b={set:function(){var e=Array.flatten(arguments).join("");var f=Browser.Engine.trident&&a[this.get("tag")];if(f){var g=c;g.innerHTML=f[1]+e+f[2];
for(var d=f[0];d--;){g=g.firstChild;}this.empty().adopt(g.childNodes);}else{this.innerHTML=e;}}};b.erase=b.set;return b;})();if(Browser.Engine.webkit&&Browser.Engine.version<420){Element.Properties.text={get:function(){if(this.innerText){return this.innerText;
}var a=this.ownerDocument.newElement("div",{html:this.innerHTML}).inject(this.ownerDocument.body);var b=a.innerText;a.destroy();return b;}};}Element.Properties.events={set:function(a){this.addEvents(a);
}};Native.implement([Element,Window,Document],{addEvent:function(e,g){var h=this.retrieve("events",{});h[e]=h[e]||{keys:[],values:[]};if(h[e].keys.contains(g)){return this;
}h[e].keys.push(g);var f=e,a=Element.Events.get(e),c=g,i=this;if(a){if(a.onAdd){a.onAdd.call(this,g);}if(a.condition){c=function(j){if(a.condition.call(this,j)){return g.call(this,j);
}return true;};}f=a.base||f;}var d=function(){return g.call(i);};var b=Element.NativeEvents[f];if(b){if(b==2){d=function(j){j=new Event(j,i.getWindow());
if(c.call(i,j)===false){j.stop();}};}this.addListener(f,d);}h[e].values.push(d);return this;},removeEvent:function(c,b){var a=this.retrieve("events");if(!a||!a[c]){return this;
}var f=a[c].keys.indexOf(b);if(f==-1){return this;}a[c].keys.splice(f,1);var e=a[c].values.splice(f,1)[0];var d=Element.Events.get(c);if(d){if(d.onRemove){d.onRemove.call(this,b);
}c=d.base||c;}return(Element.NativeEvents[c])?this.removeListener(c,e):this;},addEvents:function(a){for(var b in a){this.addEvent(b,a[b]);}return this;
},removeEvents:function(a){var c;if($type(a)=="object"){for(c in a){this.removeEvent(c,a[c]);}return this;}var b=this.retrieve("events");if(!b){return this;
}if(!a){for(c in b){this.removeEvents(c);}this.eliminate("events");}else{if(b[a]){while(b[a].keys[0]){this.removeEvent(a,b[a].keys[0]);}b[a]=null;}}return this;
},fireEvent:function(d,b,a){var c=this.retrieve("events");if(!c||!c[d]){return this;}c[d].keys.each(function(e){e.create({bind:this,delay:a,"arguments":b})();
},this);return this;},cloneEvents:function(d,a){d=$(d);var c=d.retrieve("events");if(!c){return this;}if(!a){for(var b in c){this.cloneEvents(d,b);}}else{if(c[a]){c[a].keys.each(function(e){this.addEvent(a,e);
},this);}}return this;}});Element.NativeEvents={click:2,dblclick:2,mouseup:2,mousedown:2,contextmenu:2,mousewheel:2,DOMMouseScroll:2,mouseover:2,mouseout:2,mousemove:2,selectstart:2,selectend:2,keydown:2,keypress:2,keyup:2,focus:2,blur:2,change:2,reset:2,select:2,submit:2,load:1,unload:1,beforeunload:2,resize:1,move:1,DOMContentLoaded:1,readystatechange:1,error:1,abort:1,scroll:1};
(function(){var a=function(b){var c=b.relatedTarget;if(c==undefined){return true;}if(c===false){return false;}return($type(this)!="document"&&c!=this&&c.prefix!="xul"&&!this.hasChild(c));
};Element.Events=new Hash({mouseenter:{base:"mouseover",condition:a},mouseleave:{base:"mouseout",condition:a},mousewheel:{base:(Browser.Engine.gecko)?"DOMMouseScroll":"mousewheel"}});
})();Element.Properties.styles={set:function(a){this.setStyles(a);}};Element.Properties.opacity={set:function(a,b){if(!b){if(a==0){if(this.style.visibility!="hidden"){this.style.visibility="hidden";
}}else{if(this.style.visibility!="visible"){this.style.visibility="visible";}}}if(!this.currentStyle||!this.currentStyle.hasLayout){this.style.zoom=1;}if(Browser.Engine.trident){this.style.filter=(a==1)?"":"alpha(opacity="+a*100+")";
}this.style.opacity=a;this.store("opacity",a);},get:function(){return this.retrieve("opacity",1);}};Element.implement({setOpacity:function(a){return this.set("opacity",a,true);
},getOpacity:function(){return this.get("opacity");},setStyle:function(b,a){switch(b){case"opacity":return this.set("opacity",parseFloat(a));case"float":b=(Browser.Engine.trident)?"styleFloat":"cssFloat";
}b=b.camelCase();if($type(a)!="string"){var c=(Element.Styles.get(b)||"@").split(" ");a=$splat(a).map(function(e,d){if(!c[d]){return"";}return($type(e)=="number")?c[d].replace("@",Math.round(e)):e;
}).join(" ");}else{if(a==String(Number(a))){a=Math.round(a);}}this.style[b]=a;return this;},getStyle:function(g){switch(g){case"opacity":return this.get("opacity");
case"float":g=(Browser.Engine.trident)?"styleFloat":"cssFloat";}g=g.camelCase();var a=this.style[g];if(!$chk(a)){a=[];for(var f in Element.ShortStyles){if(g!=f){continue;
}for(var e in Element.ShortStyles[f]){a.push(this.getStyle(e));}return a.join(" ");}a=this.getComputedStyle(g);}if(a){a=String(a);var c=a.match(/rgba?\([\d\s,]+\)/);
if(c){a=a.replace(c[0],c[0].rgbToHex());}}if(Browser.Engine.presto||(Browser.Engine.trident&&!$chk(parseInt(a,10)))){if(g.test(/^(height|width)$/)){var b=(g=="width")?["left","right"]:["top","bottom"],d=0;
b.each(function(h){d+=this.getStyle("border-"+h+"-width").toInt()+this.getStyle("padding-"+h).toInt();},this);return this["offset"+g.capitalize()]-d+"px";
}if((Browser.Engine.presto)&&String(a).test("px")){return a;}if(g.test(/(border(.+)Width|margin|padding)/)){return"0px";}}return a;},setStyles:function(b){for(var a in b){this.setStyle(a,b[a]);
}return this;},getStyles:function(){var a={};Array.each(arguments,function(b){a[b]=this.getStyle(b);},this);return a;}});Element.Styles=new Hash({left:"@px",top:"@px",bottom:"@px",right:"@px",width:"@px",height:"@px",maxWidth:"@px",maxHeight:"@px",minWidth:"@px",minHeight:"@px",backgroundColor:"rgb(@, @, @)",backgroundPosition:"@px @px",color:"rgb(@, @, @)",fontSize:"@px",letterSpacing:"@px",lineHeight:"@px",clip:"rect(@px @px @px @px)",margin:"@px @px @px @px",padding:"@px @px @px @px",border:"@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)",borderWidth:"@px @px @px @px",borderStyle:"@ @ @ @",borderColor:"rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)",zIndex:"@",zoom:"@",fontWeight:"@",textIndent:"@px",opacity:"@"});
Element.ShortStyles={margin:{},padding:{},border:{},borderWidth:{},borderStyle:{},borderColor:{}};["Top","Right","Bottom","Left"].each(function(g){var f=Element.ShortStyles;
var b=Element.Styles;["margin","padding"].each(function(h){var i=h+g;f[h][i]=b[i]="@px";});var e="border"+g;f.border[e]=b[e]="@px @ rgb(@, @, @)";var d=e+"Width",a=e+"Style",c=e+"Color";
f[e]={};f.borderWidth[d]=f[e][d]=b[d]="@px";f.borderStyle[a]=f[e][a]=b[a]="@";f.borderColor[c]=f[e][c]=b[c]="rgb(@, @, @)";});Native.implement([Document,Element],{getElements:function(h,g){h=h.split(",");
var c,e={};for(var d=0,b=h.length;d<b;d++){var a=h[d],f=Selectors.Utils.search(this,a,e);if(d!=0&&f.item){f=$A(f);}c=(d==0)?f:(c.item)?$A(c).concat(f):c.concat(f);
}return new Elements(c,{ddup:(h.length>1),cash:!g});}});Element.implement({match:function(b){if(!b||(b==this)){return true;}var d=Selectors.Utils.parseTagAndID(b);
var a=d[0],e=d[1];if(!Selectors.Filters.byID(this,e)||!Selectors.Filters.byTag(this,a)){return false;}var c=Selectors.Utils.parseSelector(b);return(c)?Selectors.Utils.filter(this,c,{}):true;
}});var Selectors={Cache:{nth:{},parsed:{}}};Selectors.RegExps={id:(/#([\w-]+)/),tag:(/^(\w+|\*)/),quick:(/^(\w+|\*)$/),splitter:(/\s*([+>~\s])\s*([a-zA-Z#.*:\[])/g),combined:(/\.([\w-]+)|\[(\w+)(?:([!*^$~|]?=)(["']?)([^\4]*?)\4)?\]|:([\w-]+)(?:\(["']?(.*?)?["']?\)|$)/g)};
Selectors.Utils={chk:function(b,c){if(!c){return true;}var a=$uid(b);if(!c[a]){return c[a]=true;}return false;},parseNthArgument:function(h){if(Selectors.Cache.nth[h]){return Selectors.Cache.nth[h];
}var e=h.match(/^([+-]?\d*)?([a-z]+)?([+-]?\d*)?$/);if(!e){return false;}var g=parseInt(e[1],10);var d=(g||g===0)?g:1;var f=e[2]||false;var c=parseInt(e[3],10)||0;
if(d!=0){c--;while(c<1){c+=d;}while(c>=d){c-=d;}}else{d=c;f="index";}switch(f){case"n":e={a:d,b:c,special:"n"};break;case"odd":e={a:2,b:0,special:"n"};
break;case"even":e={a:2,b:1,special:"n"};break;case"first":e={a:0,special:"index"};break;case"last":e={special:"last-child"};break;case"only":e={special:"only-child"};
break;default:e={a:(d-1),special:"index"};}return Selectors.Cache.nth[h]=e;},parseSelector:function(e){if(Selectors.Cache.parsed[e]){return Selectors.Cache.parsed[e];
}var d,h={classes:[],pseudos:[],attributes:[]};while((d=Selectors.RegExps.combined.exec(e))){var i=d[1],g=d[2],f=d[3],b=d[5],c=d[6],j=d[7];if(i){h.classes.push(i);
}else{if(c){var a=Selectors.Pseudo.get(c);if(a){h.pseudos.push({parser:a,argument:j});}else{h.attributes.push({name:c,operator:"=",value:j});}}else{if(g){h.attributes.push({name:g,operator:f,value:b});
}}}}if(!h.classes.length){delete h.classes;}if(!h.attributes.length){delete h.attributes;}if(!h.pseudos.length){delete h.pseudos;}if(!h.classes&&!h.attributes&&!h.pseudos){h=null;
}return Selectors.Cache.parsed[e]=h;},parseTagAndID:function(b){var a=b.match(Selectors.RegExps.tag);var c=b.match(Selectors.RegExps.id);return[(a)?a[1]:"*",(c)?c[1]:false];
},filter:function(f,c,e){var d;if(c.classes){for(d=c.classes.length;d--;d){var g=c.classes[d];if(!Selectors.Filters.byClass(f,g)){return false;}}}if(c.attributes){for(d=c.attributes.length;
d--;d){var b=c.attributes[d];if(!Selectors.Filters.byAttribute(f,b.name,b.operator,b.value)){return false;}}}if(c.pseudos){for(d=c.pseudos.length;d--;d){var a=c.pseudos[d];
if(!Selectors.Filters.byPseudo(f,a.parser,a.argument,e)){return false;}}}return true;},getByTagAndID:function(b,a,d){if(d){var c=(b.getElementById)?b.getElementById(d,true):Element.getElementById(b,d,true);
return(c&&Selectors.Filters.byTag(c,a))?[c]:[];}else{return b.getElementsByTagName(a);}},search:function(o,h,t){var b=[];var c=h.trim().replace(Selectors.RegExps.splitter,function(k,j,i){b.push(j);
return":)"+i;}).split(":)");var p,e,A;for(var z=0,v=c.length;z<v;z++){var y=c[z];if(z==0&&Selectors.RegExps.quick.test(y)){p=o.getElementsByTagName(y);
continue;}var a=b[z-1];var q=Selectors.Utils.parseTagAndID(y);var B=q[0],r=q[1];if(z==0){p=Selectors.Utils.getByTagAndID(o,B,r);}else{var d={},g=[];for(var x=0,w=p.length;
x<w;x++){g=Selectors.Getters[a](g,p[x],B,r,d);}p=g;}var f=Selectors.Utils.parseSelector(y);if(f){e=[];for(var u=0,s=p.length;u<s;u++){A=p[u];if(Selectors.Utils.filter(A,f,t)){e.push(A);
}}p=e;}}return p;}};Selectors.Getters={" ":function(h,g,j,a,e){var d=Selectors.Utils.getByTagAndID(g,j,a);for(var c=0,b=d.length;c<b;c++){var f=d[c];if(Selectors.Utils.chk(f,e)){h.push(f);
}}return h;},">":function(h,g,j,a,f){var c=Selectors.Utils.getByTagAndID(g,j,a);for(var e=0,d=c.length;e<d;e++){var b=c[e];if(b.parentNode==g&&Selectors.Utils.chk(b,f)){h.push(b);
}}return h;},"+":function(c,b,a,e,d){while((b=b.nextSibling)){if(b.nodeType==1){if(Selectors.Utils.chk(b,d)&&Selectors.Filters.byTag(b,a)&&Selectors.Filters.byID(b,e)){c.push(b);
}break;}}return c;},"~":function(c,b,a,e,d){while((b=b.nextSibling)){if(b.nodeType==1){if(!Selectors.Utils.chk(b,d)){break;}if(Selectors.Filters.byTag(b,a)&&Selectors.Filters.byID(b,e)){c.push(b);
}}}return c;}};Selectors.Filters={byTag:function(b,a){return(a=="*"||(b.tagName&&b.tagName.toLowerCase()==a));},byID:function(a,b){return(!b||(a.id&&a.id==b));
},byClass:function(b,a){return(b.className&&b.className.contains(a," "));},byPseudo:function(a,d,c,b){return d.call(a,c,b);},byAttribute:function(c,d,b,e){var a=Element.prototype.getProperty.call(c,d);
if(!a){return(b=="!=");}if(!b||e==undefined){return true;}switch(b){case"=":return(a==e);case"*=":return(a.contains(e));case"^=":return(a.substr(0,e.length)==e);
case"$=":return(a.substr(a.length-e.length)==e);case"!=":return(a!=e);case"~=":return a.contains(e," ");case"|=":return a.contains(e,"-");}return false;
}};Selectors.Pseudo=new Hash({checked:function(){return this.checked;},empty:function(){return !(this.innerText||this.textContent||"").length;},not:function(a){return !Element.match(this,a);
},contains:function(a){return(this.innerText||this.textContent||"").contains(a);},"first-child":function(){return Selectors.Pseudo.index.call(this,0);},"last-child":function(){var a=this;
while((a=a.nextSibling)){if(a.nodeType==1){return false;}}return true;},"only-child":function(){var b=this;while((b=b.previousSibling)){if(b.nodeType==1){return false;
}}var a=this;while((a=a.nextSibling)){if(a.nodeType==1){return false;}}return true;},"nth-child":function(g,e){g=(g==undefined)?"n":g;var c=Selectors.Utils.parseNthArgument(g);
if(c.special!="n"){return Selectors.Pseudo[c.special].call(this,c.a,e);}var f=0;e.positions=e.positions||{};var d=$uid(this);if(!e.positions[d]){var b=this;
while((b=b.previousSibling)){if(b.nodeType!=1){continue;}f++;var a=e.positions[$uid(b)];if(a!=undefined){f=a+f;break;}}e.positions[d]=f;}return(e.positions[d]%c.a==c.b);
},index:function(a){var b=this,c=0;while((b=b.previousSibling)){if(b.nodeType==1&&++c>a){return false;}}return(c==a);},even:function(b,a){return Selectors.Pseudo["nth-child"].call(this,"2n+1",a);
},odd:function(b,a){return Selectors.Pseudo["nth-child"].call(this,"2n",a);},selected:function(){return this.selected;}});Element.Events.domready={onAdd:function(a){if(Browser.loaded){a.call(this);
}}};(function(){var b=function(){if(Browser.loaded){return;}Browser.loaded=true;window.fireEvent("domready");document.fireEvent("domready");};if(Browser.Engine.trident){var a=document.createElement("div");
(function(){($try(function(){a.doScroll("left");return $(a).inject(document.body).set("html","temp").dispose();}))?b():arguments.callee.delay(50);})();
}else{if(Browser.Engine.webkit&&Browser.Engine.version<525){(function(){(["loaded","complete"].contains(document.readyState))?b():arguments.callee.delay(50);
})();}else{window.addEvent("load",b);document.addEvent("DOMContentLoaded",b);}}})();var JSON=new Hash({$specialChars:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},$replaceChars:function(a){return JSON.$specialChars[a]||"\\u00"+Math.floor(a.charCodeAt()/16).toString(16)+(a.charCodeAt()%16).toString(16);
},encode:function(b){switch($type(b)){case"string":return'"'+b.replace(/[\x00-\x1f\\"]/g,JSON.$replaceChars)+'"';case"array":return"["+String(b.map(JSON.encode).filter($defined))+"]";
case"object":case"hash":var a=[];Hash.each(b,function(e,d){var c=JSON.encode(e);if(c){a.push(JSON.encode(d)+":"+c);}});return"{"+a+"}";case"number":case"boolean":return String(b);
case false:return"null";}return null;},decode:function(string,secure){if($type(string)!="string"||!string.length){return null;}if(secure&&!(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(string.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,""))){return null;
}return eval("("+string+")");}});Native.implement([Hash,Array,String,Number],{toJSON:function(){return JSON.encode(this);}});var Cookie=new Class({Implements:Options,options:{path:false,domain:false,duration:false,secure:false,document:document},initialize:function(b,a){this.key=b;
this.setOptions(a);},write:function(b){b=encodeURIComponent(b);if(this.options.domain){b+="; domain="+this.options.domain;}if(this.options.path){b+="; path="+this.options.path;
}if(this.options.duration){var a=new Date();a.setTime(a.getTime()+this.options.duration*24*60*60*1000);b+="; expires="+a.toGMTString();}if(this.options.secure){b+="; secure";
}this.options.document.cookie=this.key+"="+b;return this;},read:function(){var a=this.options.document.cookie.match("(?:^|;)\\s*"+this.key.escapeRegExp()+"=([^;]*)");
return(a)?decodeURIComponent(a[1]):null;},dispose:function(){new Cookie(this.key,$merge(this.options,{duration:-1})).write("");return this;}});Cookie.write=function(b,c,a){return new Cookie(b,a).write(c);
};Cookie.read=function(a){return new Cookie(a).read();};Cookie.dispose=function(b,a){return new Cookie(b,a).dispose();};var Fx=new Class({Implements:[Chain,Events,Options],options:{fps:50,unit:false,duration:500,link:"ignore"},initialize:function(a){this.subject=this.subject||this;
this.setOptions(a);this.options.duration=Fx.Durations[this.options.duration]||this.options.duration.toInt();var b=this.options.wait;if(b===false){this.options.link="cancel";
}},getTransition:function(){return function(a){return -(Math.cos(Math.PI*a)-1)/2;};},step:function(){var a=$time();if(a<this.time+this.options.duration){var b=this.transition((a-this.time)/this.options.duration);
this.set(this.compute(this.from,this.to,b));}else{this.set(this.compute(this.from,this.to,1));this.complete();}},set:function(a){return a;},compute:function(c,b,a){return Fx.compute(c,b,a);
},check:function(){if(!this.timer){return true;}switch(this.options.link){case"cancel":this.cancel();return true;case"chain":this.chain(this.caller.bind(this,arguments));
return false;}return false;},start:function(b,a){if(!this.check(b,a)){return this;}this.from=b;this.to=a;this.time=0;this.transition=this.getTransition();
this.startTimer();this.onStart();return this;},complete:function(){if(this.stopTimer()){this.onComplete();}return this;},cancel:function(){if(this.stopTimer()){this.onCancel();
}return this;},onStart:function(){this.fireEvent("start",this.subject);},onComplete:function(){this.fireEvent("complete",this.subject);if(!this.callChain()){this.fireEvent("chainComplete",this.subject);
}},onCancel:function(){this.fireEvent("cancel",this.subject).clearChain();},pause:function(){this.stopTimer();return this;},resume:function(){this.startTimer();
return this;},stopTimer:function(){if(!this.timer){return false;}this.time=$time()-this.time;this.timer=$clear(this.timer);return true;},startTimer:function(){if(this.timer){return false;
}this.time=$time()-this.time;this.timer=this.step.periodical(Math.round(1000/this.options.fps),this);return true;}});Fx.compute=function(c,b,a){return(b-c)*a+c;
};Fx.Durations={"short":250,normal:500,"long":1000};Fx.CSS=new Class({Extends:Fx,prepare:function(d,e,b){b=$splat(b);var c=b[1];if(!$chk(c)){b[1]=b[0];
b[0]=d.getStyle(e);}var a=b.map(this.parse);return{from:a[0],to:a[1]};},parse:function(a){a=$lambda(a)();a=(typeof a=="string")?a.split(" "):$splat(a);
return a.map(function(c){c=String(c);var b=false;Fx.CSS.Parsers.each(function(f,e){if(b){return;}var d=f.parse(c);if($chk(d)){b={value:d,parser:f};}});
b=b||{value:c,parser:Fx.CSS.Parsers.String};return b;});},compute:function(d,c,b){var a=[];(Math.min(d.length,c.length)).times(function(e){a.push({value:d[e].parser.compute(d[e].value,c[e].value,b),parser:d[e].parser});
});a.$family={name:"fx:css:value"};return a;},serve:function(c,b){if($type(c)!="fx:css:value"){c=this.parse(c);}var a=[];c.each(function(d){a=a.concat(d.parser.serve(d.value,b));
});return a;},render:function(a,d,c,b){a.setStyle(d,this.serve(c,b));},search:function(a){if(Fx.CSS.Cache[a]){return Fx.CSS.Cache[a];}var b={};Array.each(document.styleSheets,function(e,d){var c=e.href;
if(c&&c.contains("://")&&!c.contains(document.domain)){return;}var f=e.rules||e.cssRules;Array.each(f,function(j,g){if(!j.style){return;}var h=(j.selectorText)?j.selectorText.replace(/^\w+/,function(i){return i.toLowerCase();
}):null;if(!h||!h.test("^"+a+"$")){return;}Element.Styles.each(function(k,i){if(!j.style[i]||Element.ShortStyles[i]){return;}k=String(j.style[i]);b[i]=(k.test(/^rgb/))?k.rgbToHex():k;
});});});return Fx.CSS.Cache[a]=b;}});Fx.CSS.Cache={};Fx.CSS.Parsers=new Hash({Color:{parse:function(a){if(a.match(/^#[0-9a-f]{3,6}$/i)){return a.hexToRgb(true);
}return((a=a.match(/(\d+),\s*(\d+),\s*(\d+)/)))?[a[1],a[2],a[3]]:false;},compute:function(c,b,a){return c.map(function(e,d){return Math.round(Fx.compute(c[d],b[d],a));
});},serve:function(a){return a.map(Number);}},Number:{parse:parseFloat,compute:Fx.compute,serve:function(b,a){return(a)?b+a:b;}},String:{parse:$lambda(false),compute:$arguments(1),serve:$arguments(0)}});
Fx.Tween=new Class({Extends:Fx.CSS,initialize:function(b,a){this.element=this.subject=$(b);this.parent(a);},set:function(b,a){if(arguments.length==1){a=b;
b=this.property||this.options.property;}this.render(this.element,b,a,this.options.unit);return this;},start:function(c,e,d){if(!this.check(c,e,d)){return this;
}var b=Array.flatten(arguments);this.property=this.options.property||b.shift();var a=this.prepare(this.element,this.property,b);return this.parent(a.from,a.to);
}});Element.Properties.tween={set:function(a){var b=this.retrieve("tween");if(b){b.cancel();}return this.eliminate("tween").store("tween:options",$extend({link:"cancel"},a));
},get:function(a){if(a||!this.retrieve("tween")){if(a||!this.retrieve("tween:options")){this.set("tween",a);}this.store("tween",new Fx.Tween(this,this.retrieve("tween:options")));
}return this.retrieve("tween");}};Element.implement({tween:function(a,c,b){this.get("tween").start(arguments);return this;},fade:function(c){var e=this.get("tween"),d="opacity",a;
c=$pick(c,"toggle");switch(c){case"in":e.start(d,1);break;case"out":e.start(d,0);break;case"show":e.set(d,1);break;case"hide":e.set(d,0);break;case"toggle":var b=this.retrieve("fade:flag",this.get("opacity")==1);
e.start(d,(b)?0:1);this.store("fade:flag",!b);a=true;break;default:e.start(d,arguments);}if(!a){this.eliminate("fade:flag");}return this;},highlight:function(c,a){if(!a){a=this.retrieve("highlight:original",this.getStyle("background-color"));
a=(a=="transparent")?"#fff":a;}var b=this.get("tween");b.start("background-color",c||"#ffff88",a).chain(function(){this.setStyle("background-color",this.retrieve("highlight:original"));
b.callChain();}.bind(this));return this;}});Fx.Morph=new Class({Extends:Fx.CSS,initialize:function(b,a){this.element=this.subject=$(b);this.parent(a);},set:function(a){if(typeof a=="string"){a=this.search(a);
}for(var b in a){this.render(this.element,b,a[b],this.options.unit);}return this;},compute:function(e,d,c){var a={};for(var b in e){a[b]=this.parent(e[b],d[b],c);
}return a;},start:function(b){if(!this.check(b)){return this;}if(typeof b=="string"){b=this.search(b);}var e={},d={};for(var c in b){var a=this.prepare(this.element,c,b[c]);
e[c]=a.from;d[c]=a.to;}return this.parent(e,d);}});Element.Properties.morph={set:function(a){var b=this.retrieve("morph");if(b){b.cancel();}return this.eliminate("morph").store("morph:options",$extend({link:"cancel"},a));
},get:function(a){if(a||!this.retrieve("morph")){if(a||!this.retrieve("morph:options")){this.set("morph",a);}this.store("morph",new Fx.Morph(this,this.retrieve("morph:options")));
}return this.retrieve("morph");}};Element.implement({morph:function(a){this.get("morph").start(a);return this;}});Fx.implement({getTransition:function(){var a=this.options.transition||Fx.Transitions.Sine.easeInOut;
if(typeof a=="string"){var b=a.split(":");a=Fx.Transitions;a=a[b[0]]||a[b[0].capitalize()];if(b[1]){a=a["ease"+b[1].capitalize()+(b[2]?b[2].capitalize():"")];
}}return a;}});Fx.Transition=function(b,a){a=$splat(a);return $extend(b,{easeIn:function(c){return b(c,a);},easeOut:function(c){return 1-b(1-c,a);},easeInOut:function(c){return(c<=0.5)?b(2*c,a)/2:(2-b(2*(1-c),a))/2;
}});};Fx.Transitions=new Hash({linear:$arguments(0)});Fx.Transitions.extend=function(a){for(var b in a){Fx.Transitions[b]=new Fx.Transition(a[b]);}};Fx.Transitions.extend({Pow:function(b,a){return Math.pow(b,a[0]||6);
},Expo:function(a){return Math.pow(2,8*(a-1));},Circ:function(a){return 1-Math.sin(Math.acos(a));},Sine:function(a){return 1-Math.sin((1-a)*Math.PI/2);
},Back:function(b,a){a=a[0]||1.618;return Math.pow(b,2)*((a+1)*b-a);},Bounce:function(f){var e;for(var d=0,c=1;1;d+=c,c/=2){if(f>=(7-4*d)/11){e=c*c-Math.pow((11-6*d-11*f)/4,2);
break;}}return e;},Elastic:function(b,a){return Math.pow(2,10*--b)*Math.cos(20*b*Math.PI*(a[0]||1)/3);}});["Quad","Cubic","Quart","Quint"].each(function(b,a){Fx.Transitions[b]=new Fx.Transition(function(c){return Math.pow(c,[a+2]);
});});var Request=new Class({Implements:[Chain,Events,Options],options:{url:"",data:"",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"text/javascript, text/html, application/xml, text/xml, */*"},async:true,format:false,method:"post",link:"ignore",isSuccess:null,emulation:true,urlEncoded:true,encoding:"utf-8",evalScripts:false,evalResponse:false,noCache:false},initialize:function(a){this.xhr=new Browser.Request();
this.setOptions(a);this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.headers=new Hash(this.options.headers);},onStateChange:function(){if(this.xhr.readyState!=4||!this.running){return;
}this.running=false;this.status=0;$try(function(){this.status=this.xhr.status;}.bind(this));if(this.options.isSuccess.call(this,this.status)){this.response={text:this.xhr.responseText,xml:this.xhr.responseXML};
this.success(this.response.text,this.response.xml);}else{this.response={text:null,xml:null};this.failure();}this.xhr.onreadystatechange=$empty;},isSuccess:function(){return((this.status>=200)&&(this.status<300));
},processScripts:function(a){if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader("Content-type"))){return $exec(a);}return a.stripScripts(this.options.evalScripts);
},success:function(b,a){this.onSuccess(this.processScripts(b),a);},onSuccess:function(){this.fireEvent("complete",arguments).fireEvent("success",arguments).callChain();
},failure:function(){this.onFailure();},onFailure:function(){this.fireEvent("complete").fireEvent("failure",this.xhr);},setHeader:function(a,b){this.headers.set(a,b);
return this;},getHeader:function(a){return $try(function(){return this.xhr.getResponseHeader(a);}.bind(this));},check:function(){if(!this.running){return true;
}switch(this.options.link){case"cancel":this.cancel();return true;case"chain":this.chain(this.caller.bind(this,arguments));return false;}return false;},send:function(j){if(!this.check(j)){return this;
}this.running=true;var h=$type(j);if(h=="string"||h=="element"){j={data:j};}var d=this.options;j=$extend({data:d.data,url:d.url,method:d.method},j);var f=j.data,b=j.url,a=j.method;
switch($type(f)){case"element":f=$(f).toQueryString();break;case"object":case"hash":f=Hash.toQueryString(f);}if(this.options.format){var i="format="+this.options.format;
f=(f)?i+"&"+f:i;}if(this.options.emulation&&["put","delete"].contains(a)){var g="_method="+a;f=(f)?g+"&"+f:g;a="post";}if(this.options.urlEncoded&&a=="post"){var c=(this.options.encoding)?"; charset="+this.options.encoding:"";
this.headers.set("Content-type","application/x-www-form-urlencoded"+c);}if(this.options.noCache){var e="noCache="+new Date().getTime();f=(f)?e+"&"+f:e;
}if(f&&a=="get"){b=b+(b.contains("?")?"&":"?")+f;f=null;}this.xhr.open(a.toUpperCase(),b,this.options.async);this.xhr.onreadystatechange=this.onStateChange.bind(this);
this.headers.each(function(l,k){try{this.xhr.setRequestHeader(k,l);}catch(m){this.fireEvent("exception",[k,l]);}},this);this.fireEvent("request");this.xhr.send(f);
if(!this.options.async){this.onStateChange();}return this;},cancel:function(){if(!this.running){return this;}this.running=false;this.xhr.abort();this.xhr.onreadystatechange=$empty;
this.xhr=new Browser.Request();this.fireEvent("cancel");return this;}});(function(){var a={};["get","post","put","delete","GET","POST","PUT","DELETE"].each(function(b){a[b]=function(){var c=Array.link(arguments,{url:String.type,data:$defined});
return this.send($extend(c,{method:b.toLowerCase()}));};});Request.implement(a);})();

View file

@ -8,8 +8,6 @@
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title>{title}</title> <title>{title}</title>
<script type="text/javascript" src="{res}/mootools.js"></script>
<style> <style>
html, body, #content { html, body, #content {
margin: 0px; margin: 0px;
@ -117,7 +115,7 @@
width: 16px; width: 16px;
margin-bottom: -17px; margin-bottom: -17px;
margin-top: 2px; margin-top: 2px;
background: url({stock}/1/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;
@ -129,7 +127,7 @@
.activated p { .activated p {
cursor: text; cursor: text;
background: url({stock}/1/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);
} }
@ -189,8 +187,8 @@
var getAction = function (id) var getAction = function (id)
{ {
var a = $(id).getFirst (); var host = document.getElementById(id).childNodes[3].host;
if (a.getProperty ('href') != "#" ) if (host)
return true; return true;
var url = prompt ("{enter_shortcut_address}", "http://"); var url = prompt ("{enter_shortcut_address}", "http://");
@ -207,10 +205,10 @@
var renameShortcut = function (id) var renameShortcut = function (id)
{ {
var name = prompt ("{enter_shortcut_name}", $(id).getLast ().get ('html', name)); var old_name = document.getElementById(id).childNodes[5].textContent;
if (!name) return;
$(id).getLast ().set ('html', name); var name = prompt ("{enter_shortcut_name}", old_name);
if (!name) return;
console.log ("speed_dial-save-rename " + id + " " + name); console.log ("speed_dial-save-rename " + id + " " + name);
} }
@ -270,25 +268,26 @@
clearTimeout (key_timeout); clearTimeout (key_timeout);
$('dialing').innerText = key_id.substr(1); document.getElementById('dialing').innerText = key_id.substr(1);
$('dialing').style.visibility = 'visible'; document.getElementById('dialing').style.visibility = 'visible';
if ($(key_id)) var div = document.getElementById(key_id);
if (div)
{ {
if (key_id.substr(1) > 9) if (key_id.substr(1) > 9)
{ {
if (getAction (key_id)) if (getAction (key_id))
document.location = $(key_id).children[1]; document.location = div.childNodes[3].href;
key_id = 's'; key_id = 's';
} }
else else
key_timeout = setTimeout ('if (getAction (key_id)) document.location = $(key_id).children[1]; key_id = \'s\'', 1000); key_timeout = setTimeout ('if (getAction (key_id)) document.location = document.getElementById(key_id).childNodes[3].href; key_id = \'s\'', 1000);
} }
else else
key_id = 's'; key_id = 's';
if (key_id.length <= 1) if (key_id.length <= 1)
$('dialing').style.visibility = 'hidden'; document.getElementById('dialing').style.visibility = 'hidden';
return false; return false;
} }

View file

@ -107,7 +107,6 @@ adblock_init_db ()
blockcssprivate = g_string_new (""); blockcssprivate = g_string_new ("");
} }
#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,
@ -121,7 +120,6 @@ 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)
@ -178,7 +176,6 @@ 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);
@ -191,7 +188,6 @@ 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);
@ -421,7 +417,11 @@ adblock_get_preferences_dialog (MidoriExtension* extension)
dialog_title = _("Configure Advertisement filters"); dialog_title = _("Configure Advertisement filters");
dialog = gtk_dialog_new_with_buttons (dialog_title, GTK_WINDOW (browser), dialog = gtk_dialog_new_with_buttons (dialog_title, GTK_WINDOW (browser),
#if GTK_CHECK_VERSION(3,0,0)
GTK_DIALOG_DESTROY_WITH_PARENT,
#else
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
#endif
#if !HAVE_OSX #if !HAVE_OSX
#if !HAVE_HILDON #if !HAVE_HILDON
GTK_STOCK_HELP, GTK_RESPONSE_HELP, GTK_STOCK_HELP, GTK_RESPONSE_HELP,
@ -442,11 +442,19 @@ adblock_get_preferences_dialog (MidoriExtension* extension)
/* TODO: We need mnemonics */ /* TODO: We need mnemonics */
if ((xfce_heading = sokoke_xfce_header_new ( if ((xfce_heading = sokoke_xfce_header_new (
gtk_window_get_icon_name (GTK_WINDOW (dialog)), dialog_title))) gtk_window_get_icon_name (GTK_WINDOW (dialog)), dialog_title)))
#if GTK_CHECK_VERSION(3,0,0)
gtk_box_pack_start (gtk_dialog_get_content_area (GTK_DIALOG (dialog)),
xfce_heading, FALSE, FALSE, 0);
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (gtk_dialog_get_content_area (GTK_DIALOG (dialog)), hbox,
TRUE, TRUE, 12);
#else
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
xfce_heading, FALSE, FALSE, 0); xfce_heading, FALSE, FALSE, 0);
hbox = gtk_hbox_new (FALSE, 0); hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox,
TRUE, TRUE, 12); TRUE, TRUE, 12);
#endif
vbox = gtk_vbox_new (FALSE, 0); vbox = gtk_vbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 4); gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 4);
button = gtk_label_new (NULL); button = gtk_label_new (NULL);
@ -557,10 +565,19 @@ adblock_get_preferences_dialog (MidoriExtension* extension)
G_CALLBACK (adblock_preferences_help_clicked_cb), dialog); */ G_CALLBACK (adblock_preferences_help_clicked_cb), dialog); */
gtk_box_pack_end (GTK_BOX (hbox), gtk_box_pack_end (GTK_BOX (hbox),
button, FALSE, FALSE, 4); button, FALSE, FALSE, 4);
#if GTK_CHECK_VERSION(3,0,0)
gtk_box_pack_end (gtk_dialog_get_content_area(GTK_DIALOG (dialog)),
hbox, FALSE, FALSE, 0);
#else
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->vbox), gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->vbox),
hbox, FALSE, FALSE, 0); hbox, FALSE, FALSE, 0);
#endif #endif
#endif
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_show_all (gtk_dialog_get_content_area(GTK_DIALOG (dialog)));
#else
gtk_widget_show_all (GTK_DIALOG (dialog)->vbox); gtk_widget_show_all (GTK_DIALOG (dialog)->vbox);
#endif
g_object_unref (browser); g_object_unref (browser);
@ -756,6 +773,11 @@ adblock_resource_request_starting_cb (WebKitWebView* web_view,
const gchar* req_uri; const gchar* req_uri;
const char *page_uri; const char *page_uri;
page_uri = webkit_web_view_get_uri (web_view);
/* Skip checks on about: pages */
if (!(page_uri && *page_uri) || !strncmp (page_uri, "about:", 6))
return;
/* Never filter the main page itself */ /* Never filter the main page itself */
if (web_frame == webkit_web_view_get_main_frame (web_view) if (web_frame == webkit_web_view_get_main_frame (web_view)
&& webkit_web_frame_get_load_status (web_frame) == WEBKIT_LOAD_PROVISIONAL) && webkit_web_frame_get_load_status (web_frame) == WEBKIT_LOAD_PROVISIONAL)
@ -767,6 +789,11 @@ adblock_resource_request_starting_cb (WebKitWebView* web_view,
return; return;
if (!strncmp (req_uri, "data", 4) || !strncmp (req_uri, "file", 4)) if (!strncmp (req_uri, "data", 4) || !strncmp (req_uri, "file", 4))
return; return;
if (!strncmp (req_uri, "stock", 5) || !strncmp (req_uri, "res", 3))
return;
if (g_str_has_suffix (req_uri, "favicon.ico"))
return;
msg = webkit_network_request_get_message (request); msg = webkit_network_request_get_message (request);
if (!msg) if (!msg)
@ -774,10 +801,6 @@ adblock_resource_request_starting_cb (WebKitWebView* web_view,
if (msg->method && !strncmp (msg->method, "POST", 4)) if (msg->method && !strncmp (msg->method, "POST", 4))
return; return;
page_uri = webkit_web_view_get_uri (web_view);
if (!page_uri || !strcmp (page_uri, "about:blank"))
page_uri = req_uri;
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
if (debug == 2) if (debug == 2)
g_test_timer_start (); g_test_timer_start ();
@ -816,13 +839,21 @@ adblock_custom_block_image_cb (GtkWidget* widget,
title = _("Edit rule"); title = _("Edit rule");
dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (browser), dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (browser),
#if GTK_CHECK_VERSION(3,0,0)
GTK_DIALOG_DESTROY_WITH_PARENT,
#else
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
#endif
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT, GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT,
NULL); NULL);
gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_ADD); gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_ADD);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
#if GTK_CHECK_VERSION(3,0,0)
gtk_container_set_border_width (gtk_dialog_get_content_area (GTK_DIALOG (dialog)), 5);
#else
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 5); gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 5);
#endif
sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
hbox = gtk_hbox_new (FALSE, 8); hbox = gtk_hbox_new (FALSE, 8);
@ -835,7 +866,11 @@ adblock_custom_block_image_cb (GtkWidget* widget,
gtk_entry_set_text (GTK_ENTRY (entry), gtk_entry_set_text (GTK_ENTRY (entry),
g_object_get_data (G_OBJECT (widget), "uri")); g_object_get_data (G_OBJECT (widget), "uri"));
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
#if GTK_CHECK_VERSION(3,0,0)
gtk_container_add (gtk_dialog_get_content_area (GTK_DIALOG (dialog)), hbox);
#else
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
#endif
gtk_widget_show_all (hbox); gtk_widget_show_all (hbox);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
@ -873,7 +908,11 @@ adblock_populate_popup_cb (WebKitWebView* web_view,
WebKitHitTestResultContext context; WebKitHitTestResultContext context;
WebKitHitTestResult* hit_test; WebKitHitTestResult* hit_test;
#if GTK_CHECK_VERSION(3,0,0)
gdk_window_get_pointer (gtk_widget_get_window(GTK_WIDGET (web_view)), &x, &y, NULL);
#else
gdk_window_get_pointer (GTK_WIDGET (web_view)->window, &x, &y, NULL); gdk_window_get_pointer (GTK_WIDGET (web_view)->window, &x, &y, NULL);
#endif
event.x = x; event.x = x;
event.y = y; event.y = y;
hit_test = webkit_web_view_get_hit_test_result (web_view, &event); hit_test = webkit_web_view_get_hit_test_result (web_view, &event);
@ -924,6 +963,13 @@ adblock_window_object_cleared_cb (WebKitWebView* web_view,
JSContextRef js_context, JSContextRef js_context,
JSObjectRef js_window) JSObjectRef js_window)
{ {
const char *page_uri;
page_uri = webkit_web_view_get_uri (web_view);
/* Don't add adblock css into speeddial and about: pages */
if (!(page_uri && *page_uri) || !strncmp (page_uri, "about:", 6))
return;
g_free (sokoke_js_script_eval (js_context, blockscript, NULL)); g_free (sokoke_js_script_eval (js_context, blockscript, NULL));
} }

View file

@ -69,6 +69,9 @@ struct _Addons
static void static void
addons_iface_init (MidoriViewableIface* iface); addons_iface_init (MidoriViewableIface* iface);
static gchar*
addons_convert_to_simple_regexp (const gchar* pattern);
G_DEFINE_TYPE_WITH_CODE (Addons, addons, GTK_TYPE_VBOX, G_DEFINE_TYPE_WITH_CODE (Addons, addons, GTK_TYPE_VBOX,
G_IMPLEMENT_INTERFACE (MIDORI_TYPE_VIEWABLE, G_IMPLEMENT_INTERFACE (MIDORI_TYPE_VIEWABLE,
addons_iface_init)); addons_iface_init));
@ -241,10 +244,8 @@ addons_notify_load_status_cb (MidoriView* view,
const gchar* uri = midori_view_get_display_uri (view); const gchar* uri = midori_view_get_display_uri (view);
WebKitWebView* web_view = WEBKIT_WEB_VIEW (midori_view_get_web_view (view)); WebKitWebView* web_view = WEBKIT_WEB_VIEW (midori_view_get_web_view (view));
#if WEBKIT_CHECK_VERSION (1, 1, 14)
if (webkit_web_view_get_view_source_mode (web_view)) if (webkit_web_view_get_view_source_mode (web_view))
return; return;
#endif
if (uri && *uri) if (uri && *uri)
{ {
@ -282,7 +283,7 @@ addons_notify_load_status_cb (MidoriView* view,
} }
static void static void
midori_addons_button_add_clicked_cb (GtkToolItem* toolitem, addons_button_add_clicked_cb (GtkToolItem* toolitem,
Addons* addons) Addons* addons)
{ {
gchar* addons_type; gchar* addons_type;
@ -398,7 +399,7 @@ midori_addons_button_add_clicked_cb (GtkToolItem* toolitem,
} }
static void static void
midori_addons_button_delete_clicked_cb (GtkWidget* toolitem, addons_button_delete_clicked_cb (GtkWidget* toolitem,
Addons* addons) Addons* addons)
{ {
GtkTreeModel* model; GtkTreeModel* model;
@ -470,7 +471,7 @@ midori_addons_button_delete_clicked_cb (GtkWidget* toolitem,
} }
} }
static void static void
midori_addons_open_in_editor_clicked_cb (GtkWidget* toolitem, addons_open_in_editor_clicked_cb (GtkWidget* toolitem,
Addons* addons) Addons* addons)
{ {
GtkTreeModel* model; GtkTreeModel* model;
@ -505,7 +506,7 @@ midori_addons_open_in_editor_clicked_cb (GtkWidget* toolitem,
} }
static void static void
midori_addons_open_target_folder_clicked_cb (GtkWidget* toolitem, addons_open_target_folder_clicked_cb (GtkWidget* toolitem,
Addons* addons) Addons* addons)
{ {
GtkTreeModel* model; GtkTreeModel* model;
@ -535,7 +536,7 @@ midori_addons_open_target_folder_clicked_cb (GtkWidget* toolitem,
} }
static void static void
midori_addons_popup_item (GtkMenu* menu, addons_popup_item (GtkMenu* menu,
const gchar* stock_id, const gchar* stock_id,
const gchar* label, const gchar* label,
struct AddonElement* element, struct AddonElement* element,
@ -559,7 +560,7 @@ midori_addons_popup_item (GtkMenu* menu,
} }
static void static void
midori_addons_popup (GtkWidget* widget, addons_popup (GtkWidget* widget,
GdkEventButton* event, GdkEventButton* event,
struct AddonElement* element, struct AddonElement* element,
Addons* addons) Addons* addons)
@ -567,17 +568,17 @@ midori_addons_popup (GtkWidget* widget,
GtkWidget* menu; GtkWidget* menu;
menu = gtk_menu_new (); menu = gtk_menu_new ();
midori_addons_popup_item (GTK_MENU (menu), GTK_STOCK_EDIT, _("Open in Text Editor"), addons_popup_item (GTK_MENU (menu), GTK_STOCK_EDIT, _("Open in Text Editor"),
element, midori_addons_open_in_editor_clicked_cb, addons); element, addons_open_in_editor_clicked_cb, addons);
midori_addons_popup_item (GTK_MENU (menu), GTK_STOCK_OPEN, _("Open Target Folder"), addons_popup_item (GTK_MENU (menu), GTK_STOCK_OPEN, _("Open Target Folder"),
element, midori_addons_open_target_folder_clicked_cb, addons); element, addons_open_target_folder_clicked_cb, addons);
midori_addons_popup_item (GTK_MENU (menu), GTK_STOCK_DELETE, NULL, addons_popup_item (GTK_MENU (menu), GTK_STOCK_DELETE, NULL,
element, midori_addons_button_delete_clicked_cb, addons); element, addons_button_delete_clicked_cb, addons);
katze_widget_popup (widget, GTK_MENU (menu), event, KATZE_MENU_POSITION_CURSOR); katze_widget_popup (widget, GTK_MENU (menu), event, KATZE_MENU_POSITION_CURSOR);
} }
static gboolean static gboolean
midori_addons_popup_menu_cb (GtkWidget *widget, addons_popup_menu_cb (GtkWidget *widget,
Addons* addons) Addons* addons)
{ {
GtkTreeModel* model; GtkTreeModel* model;
@ -587,14 +588,14 @@ midori_addons_popup_menu_cb (GtkWidget *widget,
{ {
struct AddonElement* element; struct AddonElement* element;
gtk_tree_model_get (model, &iter, 0, &element, -1); gtk_tree_model_get (model, &iter, 0, &element, -1);
midori_addons_popup (widget, NULL, element, addons); addons_popup (widget, NULL, element, addons);
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
static gboolean static gboolean
midori_addons_button_release_event_cb (GtkWidget* widget, addons_button_release_event_cb (GtkWidget* widget,
GdkEventButton* event, GdkEventButton* event,
Addons* addons) Addons* addons)
{ {
@ -607,7 +608,7 @@ midori_addons_button_release_event_cb (GtkWidget* widget,
{ {
struct AddonElement* element; struct AddonElement* element;
gtk_tree_model_get (model, &iter, 0, &element, -1); gtk_tree_model_get (model, &iter, 0, &element, -1);
midori_addons_popup (widget, NULL, element, addons); addons_popup (widget, NULL, element, addons);
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
@ -633,7 +634,7 @@ addons_get_toolbar (MidoriViewable* viewable)
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_ADD); toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_ADD);
gtk_tool_item_set_is_important (toolitem, TRUE); gtk_tool_item_set_is_important (toolitem, TRUE);
g_signal_connect (toolitem, "clicked", g_signal_connect (toolitem, "clicked",
G_CALLBACK (midori_addons_button_add_clicked_cb), viewable); G_CALLBACK (addons_button_add_clicked_cb), viewable);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem), _("Add new addon")); gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem), _("Add new addon"));
gtk_widget_show (GTK_WIDGET (toolitem)); gtk_widget_show (GTK_WIDGET (toolitem));
@ -641,7 +642,7 @@ addons_get_toolbar (MidoriViewable* viewable)
/* Text editor button */ /* Text editor button */
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_EDIT); toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_EDIT);
g_signal_connect (toolitem, "clicked", g_signal_connect (toolitem, "clicked",
G_CALLBACK (midori_addons_open_in_editor_clicked_cb), viewable); G_CALLBACK (addons_open_in_editor_clicked_cb), viewable);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem), gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem),
_("Open in Text Editor")); _("Open in Text Editor"));
@ -650,7 +651,7 @@ addons_get_toolbar (MidoriViewable* viewable)
/* Target folder button */ /* Target folder button */
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_DIRECTORY); toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_DIRECTORY);
g_signal_connect (toolitem, "clicked", g_signal_connect (toolitem, "clicked",
G_CALLBACK (midori_addons_open_target_folder_clicked_cb), viewable); G_CALLBACK (addons_open_target_folder_clicked_cb), viewable);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem), gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem),
_("Open Target Folder")); _("Open Target Folder"));
@ -659,7 +660,7 @@ addons_get_toolbar (MidoriViewable* viewable)
/* Delete button */ /* Delete button */
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_DELETE); toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_DELETE);
g_signal_connect (toolitem, "clicked", g_signal_connect (toolitem, "clicked",
G_CALLBACK (midori_addons_button_delete_clicked_cb), viewable); G_CALLBACK (addons_button_delete_clicked_cb), viewable);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem), _("Remove selected addon")); gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem), _("Remove selected addon"));
gtk_widget_show (GTK_WIDGET (toolitem)); gtk_widget_show (GTK_WIDGET (toolitem));
@ -948,15 +949,19 @@ js_metadata_from_file (const gchar* filename,
} }
else if (includes && g_str_has_prefix (line, "// @include")) else if (includes && g_str_has_prefix (line, "// @include"))
{ {
gchar* re = NULL;
rest_of_line = g_strdup (line + strlen ("// @include")); rest_of_line = g_strdup (line + strlen ("// @include"));
rest_of_line = g_strstrip (rest_of_line); rest_of_line = g_strstrip (rest_of_line);
*includes = g_slist_prepend (*includes, rest_of_line); re = addons_convert_to_simple_regexp (rest_of_line);
*includes = g_slist_prepend (*includes, re);
} }
else if (excludes && g_str_has_prefix (line, "// @exclude")) else if (excludes && g_str_has_prefix (line, "// @exclude"))
{ {
gchar* re = NULL;
rest_of_line = g_strdup (line + strlen ("// @exclude")); rest_of_line = g_strdup (line + strlen ("// @exclude"));
rest_of_line = g_strstrip (rest_of_line); rest_of_line = g_strstrip (rest_of_line);
*excludes = g_slist_prepend (*excludes, rest_of_line); re = addons_convert_to_simple_regexp (rest_of_line);
*excludes = g_slist_prepend (*excludes, re);
} }
else if (name && g_str_has_prefix (line, "// @name")) else if (name && g_str_has_prefix (line, "// @name"))
{ {
@ -1033,6 +1038,8 @@ css_metadata_from_file (const gchar* filename,
{ {
guint begin, end; guint begin, end;
gchar* domain; gchar* domain;
gchar* tmp_domain;
gchar* re = NULL;
line_has_meta = TRUE; line_has_meta = TRUE;
begin = value[0] == '"' || value[0] == '\'' ? 1 : 0; begin = value[0] == '"' || value[0] == '\'' ? 1 : 0;
@ -1041,15 +1048,15 @@ css_metadata_from_file (const gchar* filename,
++end; ++end;
domain = g_strndup (value + begin, end - begin * 2); domain = g_strndup (value + begin, end - begin * 2);
if (!strncmp ("http", domain, 4)) if (strncmp ("http", domain, 4))
*includes = g_slist_prepend (*includes, domain); tmp_domain = g_strdup_printf ("http://*%s/*", domain);
else else
{ tmp_domain = domain;
*includes = g_slist_prepend (*includes,
g_strdup_printf ("http://*%s/*", domain)); re = addons_convert_to_simple_regexp (tmp_domain);
g_free (domain); *includes = g_slist_prepend (*includes, re);
}
g_free (value); g_free (value);
g_free (domain);
} }
i++; i++;
} }
@ -1330,10 +1337,10 @@ addons_init (Addons* addons)
G_CALLBACK (addons_treeview_row_activated_cb), G_CALLBACK (addons_treeview_row_activated_cb),
addons); addons);
g_signal_connect (addons->treeview, "button-release-event", g_signal_connect (addons->treeview, "button-release-event",
G_CALLBACK (midori_addons_button_release_event_cb), G_CALLBACK (addons_button_release_event_cb),
addons); addons);
g_signal_connect (addons->treeview, "popup-menu", g_signal_connect (addons->treeview, "popup-menu",
G_CALLBACK (midori_addons_popup_menu_cb), G_CALLBACK (addons_popup_menu_cb),
addons); addons);
gtk_widget_show (addons->treeview); gtk_widget_show (addons->treeview);
gtk_box_pack_start (GTK_BOX (addons), addons->treeview, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (addons), addons->treeview, TRUE, TRUE, 0);
@ -1407,9 +1414,7 @@ addons_may_run (const gchar* uri,
list = *includes; list = *includes;
while (list) while (list)
{ {
gchar* re = addons_convert_to_simple_regexp (list->data); gboolean matched = g_regex_match_simple (list->data, uri, 0, 0);
gboolean matched = g_regex_match_simple (re, uri, 0, 0);
g_free (re);
if (matched) if (matched)
{ {
match = TRUE; match = TRUE;
@ -1423,9 +1428,7 @@ addons_may_run (const gchar* uri,
list = *excludes; list = *excludes;
while (list) while (list)
{ {
gchar* re = addons_convert_to_simple_regexp (list->data); gboolean matched = g_regex_match_simple (list->data, uri, 0, 0);
gboolean matched = g_regex_match_simple (re, uri, 0, 0);
g_free (re);
if (matched) if (matched)
{ {
match = FALSE; match = FALSE;
@ -1460,9 +1463,13 @@ addons_context_ready_cb (WebKitWebView* web_view,
struct AddonElement* script, *style; struct AddonElement* script, *style;
struct AddonsList* scripts_list, *styles_list; struct AddonsList* scripts_list, *styles_list;
/* Not a main frame! Abort */
if (web_frame != webkit_web_view_get_main_frame (web_view))
return;
uri = katze_object_get_string (web_view, "uri"); uri = katze_object_get_string (web_view, "uri");
/* Don't run scripts or styles on blank or special pages */ /* Don't run scripts or styles on blank or special pages */
if (!(uri && *uri && strncmp (uri, "about:", 6))) if (!(uri && *uri) || !strncmp (uri, "about:", 6))
{ {
g_free (uri); g_free (uri);
return; return;

View file

@ -14,6 +14,7 @@
#include <midori/midori.h> #include <midori/midori.h>
#include <midori/gtkiconentry.h> #include <midori/gtkiconentry.h>
#include "katze/gtk3-compat.h"
#include <webkit/webkit.h> #include <webkit/webkit.h>
#include <time.h> #include <time.h>
@ -933,7 +934,7 @@ static gboolean cm_tree_popup_menu_cb(GtkWidget *widget, CookieManagerPage *cmp
static gboolean cm_tree_button_release_event_cb(GtkWidget *widget, GdkEventButton *ev, static gboolean cm_tree_button_release_event_cb(GtkWidget *widget, GdkEventButton *ev,
CookieManagerPage *cmp) CookieManagerPage *cmp)
{ {
if (ev->button == 3) if (MIDORI_EVENT_CONTEXT_MENU(ev))
{ {
cm_tree_show_popup_menu(widget, ev, cmp); cm_tree_show_popup_menu(widget, ev, cmp);
return TRUE; return TRUE;
@ -944,7 +945,7 @@ static gboolean cm_tree_button_release_event_cb(GtkWidget *widget, GdkEventButto
static gboolean cm_tree_key_press_cb(GtkWidget *widget, GdkEventKey *event, CookieManagerPage *cmp) static gboolean cm_tree_key_press_cb(GtkWidget *widget, GdkEventKey *event, CookieManagerPage *cmp)
{ {
if (event->keyval == GDK_Delete && ! if (event->keyval == GDK_KEY_Delete && !
(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK))) (event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)))
{ {
cm_delete_item(cmp); cm_delete_item(cmp);

View file

@ -114,7 +114,7 @@ static void cookie_manager_panel_pages_foreach(gpointer ptr, gpointer data)
} }
static void cookie_manager_page_destroy_cb(GtkObject *page, CookieManager *cm) static void cookie_manager_page_destroy_cb(GObject *page, CookieManager *cm)
{ {
CookieManagerPrivate *priv = COOKIE_MANAGER_GET_PRIVATE(cm); CookieManagerPrivate *priv = COOKIE_MANAGER_GET_PRIVATE(cm);

View file

@ -622,7 +622,7 @@ webview_button_press_event_cb (GtkWidget* widget,
GdkEventButton* event) GdkEventButton* event)
{ {
/* Disable the popup menu */ /* Disable the popup menu */
return (event->button == 3); return MIDORI_EVENT_CONTEXT_MENU (event);
} }
static gboolean static gboolean
@ -844,7 +844,11 @@ feed_panel_init (FeedPanel* panel)
gtk_widget_show (treeview); gtk_widget_show (treeview);
webview = webkit_web_view_new (); webview = webkit_web_view_new ();
#if GTK_CHECK_VERSION(3,0,0)
font_desc = gtk_style_context_get_font(gtk_widget_get_style_context(treeview), GTK_STATE_FLAG_NORMAL);
#else
font_desc = treeview->style->font_desc; font_desc = treeview->style->font_desc;
#endif
family = pango_font_description_get_family (font_desc); family = pango_font_description_get_family (font_desc);
size = pango_font_description_get_size (font_desc) / PANGO_SCALE; size = pango_font_description_get_size (font_desc) / PANGO_SCALE;
settings = webkit_web_settings_new (); settings = webkit_web_settings_new ();

View file

@ -363,13 +363,21 @@ panel_add_feed_cb (FeedPanel* panel,
dialog = gtk_dialog_new_with_buttons ( dialog = gtk_dialog_new_with_buttons (
_("New feed"), GTK_WINDOW (priv->browser), _("New feed"), GTK_WINDOW (priv->browser),
#if GTK_CHECK_VERSION(3,0,0)
GTK_DIALOG_DESTROY_WITH_PARENT,
#else
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
#endif
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT, GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT,
NULL); NULL);
gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_ADD); gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_ADD);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
#if GTK_CHECK_VERSION(3,0,0)
gtk_container_set_border_width (GTK_CONTAINER(gtk_dialog_get_content_area( GTK_DIALOG (dialog))), 5);
#else
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 5); gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 5);
#endif
sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
hbox = gtk_hbox_new (FALSE, 8); hbox = gtk_hbox_new (FALSE, 8);
@ -381,7 +389,11 @@ panel_add_feed_cb (FeedPanel* panel,
gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE); gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
gtk_entry_set_text (GTK_ENTRY (entry), ""); gtk_entry_set_text (GTK_ENTRY (entry), "");
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
#if GTK_CHECK_VERSION(3,0,0)
gtk_container_add (GTK_CONTAINER(gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox);
#else
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
#endif
gtk_widget_show_all (hbox); gtk_widget_show_all (hbox);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);

View file

@ -24,6 +24,11 @@
static GHashTable* global_keys; static GHashTable* global_keys;
static gchar* jsforms; static gchar* jsforms;
static void
formhistory_toggle_state_cb (GtkAction* action,
MidoriBrowser* browser);
static gboolean static gboolean
formhistory_prepare_js () formhistory_prepare_js ()
{ {
@ -291,11 +296,30 @@ static void
formhistory_app_add_browser_cb (MidoriApp* app, formhistory_app_add_browser_cb (MidoriApp* app,
MidoriBrowser* browser, MidoriBrowser* browser,
MidoriExtension* extension) MidoriExtension* extension)
{
GtkAccelGroup* acg = gtk_accel_group_new ();
GtkActionGroup* action_group = midori_browser_get_action_group (browser);
GtkAction* action = gtk_action_new ("FormHistoryToggleState",
_("Toggle form history state"),
_("Activate or deactivate form history for the current tab."), NULL);
gtk_window_add_accel_group (GTK_WINDOW (browser), acg);
g_object_set_data (G_OBJECT (browser), "FormHistoryExtension", extension);
g_signal_connect (action, "activate",
G_CALLBACK (formhistory_toggle_state_cb), browser);
gtk_action_group_add_action_with_accel (action_group, action, "<Ctrl><Shift>F");
gtk_action_set_accel_group (action, acg);
gtk_action_connect_accelerator (action);
if (midori_extension_get_boolean (extension, "always-load"))
{ {
midori_browser_foreach (browser, midori_browser_foreach (browser,
(GtkCallback)formhistory_add_tab_foreach_cb, extension); (GtkCallback)formhistory_add_tab_foreach_cb, extension);
g_signal_connect (browser, "add-tab", g_signal_connect (browser, "add-tab",
G_CALLBACK (formhistory_add_tab_cb), extension); G_CALLBACK (formhistory_add_tab_cb), extension);
}
g_signal_connect (extension, "deactivate", g_signal_connect (extension, "deactivate",
G_CALLBACK (formhistory_deactivate_cb), browser); G_CALLBACK (formhistory_deactivate_cb), browser);
} }
@ -319,6 +343,9 @@ formhistory_deactivate_cb (MidoriExtension* extension,
MidoriApp* app = midori_extension_get_app (extension); MidoriApp* app = midori_extension_get_app (extension);
sqlite3* db; sqlite3* db;
GtkActionGroup* action_group = midori_browser_get_action_group (browser);
GtkAction* action;
g_signal_handlers_disconnect_by_func ( g_signal_handlers_disconnect_by_func (
browser, formhistory_add_tab_cb, extension); browser, formhistory_add_tab_cb, extension);
g_signal_handlers_disconnect_by_func ( g_signal_handlers_disconnect_by_func (
@ -328,6 +355,14 @@ formhistory_deactivate_cb (MidoriExtension* extension,
midori_browser_foreach (browser, midori_browser_foreach (browser,
(GtkCallback)formhistory_deactivate_tabs, extension); (GtkCallback)formhistory_deactivate_tabs, extension);
g_object_set_data (G_OBJECT (browser), "FormHistoryExtension", NULL);
action = gtk_action_group_get_action ( action_group, "FormHistoryToggleState");
if (action != NULL)
{
gtk_action_group_remove_action (action_group, action);
g_object_unref (action);
}
katze_assign (jsforms, NULL); katze_assign (jsforms, NULL);
if (global_keys) if (global_keys)
g_hash_table_destroy (global_keys); g_hash_table_destroy (global_keys);
@ -420,6 +455,97 @@ formhistory_activate_cb (MidoriExtension* extension,
g_object_unref (browsers); g_object_unref (browsers);
} }
static void
formhistory_preferences_response_cb (GtkWidget* dialog,
gint response_id,
MidoriExtension* extension)
{
GtkWidget* checkbox;
gboolean old_state;
gboolean new_state;
MidoriApp* app;
KatzeArray* browsers;
MidoriBrowser* browser;
if (response_id == GTK_RESPONSE_APPLY)
{
checkbox = g_object_get_data (G_OBJECT (dialog), "always-load-checkbox");
new_state = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox));
old_state = midori_extension_get_boolean (extension, "always-load");
if (old_state != new_state)
{
midori_extension_set_boolean (extension, "always-load", new_state);
app = midori_extension_get_app (extension);
browsers = katze_object_get_object (app, "browsers");
KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
{
midori_browser_foreach (browser,
(GtkCallback)formhistory_deactivate_tabs, extension);
g_signal_handlers_disconnect_by_func (
browser, formhistory_add_tab_cb, extension);
if (new_state)
{
midori_browser_foreach (browser,
(GtkCallback)formhistory_add_tab_foreach_cb, extension);
g_signal_connect (browser, "add-tab",
G_CALLBACK (formhistory_add_tab_cb), extension);
}
}
}
}
gtk_widget_destroy (dialog);
}
static void
formhistory_preferences_cb (MidoriExtension* extension)
{
GtkWidget* dialog;
GtkWidget* content_area;
GtkWidget* checkbox;
dialog = gtk_dialog_new ();
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_APPLY, GTK_RESPONSE_APPLY);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
checkbox = gtk_check_button_new_with_label (_("only activate form history via hotkey (Ctrl+Shift+F) per tab"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox),
!midori_extension_get_boolean (extension, "always-load"));
g_object_set_data (G_OBJECT (dialog), "always-load-checkbox", checkbox);
gtk_container_add (GTK_CONTAINER (content_area), checkbox);
g_signal_connect (dialog,
"response",
G_CALLBACK (formhistory_preferences_response_cb),
extension);
gtk_widget_show_all (dialog);
}
static void
formhistory_toggle_state_cb (GtkAction* action,
MidoriBrowser* browser)
{
MidoriView* view = MIDORI_VIEW (midori_browser_get_current_tab (browser));
MidoriExtension* extension = g_object_get_data (G_OBJECT (browser), "FormHistoryExtension");
GtkWidget* web_view = midori_view_get_web_view (view);
if (g_signal_handler_find (web_view, G_SIGNAL_MATCH_FUNC,
g_signal_lookup ("window-object-cleared", MIDORI_TYPE_VIEW), 0, NULL,
formhistory_window_object_cleared_cb, extension))
{
formhistory_deactivate_tabs (view, browser, extension);
} else {
formhistory_add_tab_cb (browser, view, extension);
}
}
#if G_ENABLE_DEBUG #if G_ENABLE_DEBUG
/* /*
<html> <html>
@ -463,11 +589,18 @@ extension_init (void)
"version", ver, "version", ver,
"authors", "Alexander V. Butenko <a.butenka@gmail.com>", "authors", "Alexander V. Butenko <a.butenka@gmail.com>",
NULL); NULL);
midori_extension_install_boolean (extension, "always-load", TRUE);
g_free (desc); g_free (desc);
if (should_init) if (should_init)
{
g_signal_connect (extension, "activate", g_signal_connect (extension, "activate",
G_CALLBACK (formhistory_activate_cb), NULL); G_CALLBACK (formhistory_activate_cb), NULL);
g_signal_connect (extension, "open-preferences",
G_CALLBACK (formhistory_preferences_cb), NULL);
}
return extension; return extension;
} }

View file

@ -54,8 +54,9 @@ namespace HistoryList {
var model = this.treeview.get_model () as Gtk.ListStore; var model = this.treeview.get_model () as Gtk.ListStore;
while (new_index < 0 || new_index >= model.length) int length = model.iter_n_children(null);
new_index = new_index < 0 ? model.length + new_index : new_index - model.length; while (new_index < 0 || new_index >= length)
new_index = new_index < 0 ? length + new_index : new_index - length;
path = new Gtk.TreePath.from_indices (new_index); path = new Gtk.TreePath.from_indices (new_index);
this.treeview.set_cursor (path, column, false); this.treeview.set_cursor (path, column, false);
@ -115,25 +116,31 @@ namespace HistoryList {
this.vbox.pack_start (this.hbox, true, true, 0); this.vbox.pack_start (this.hbox, true, true, 0);
this.treeview = new Gtk.TreeView.with_model (store); this.treeview = new Gtk.TreeView.with_model (store);
this.treeview.set_fixed_height_mode (true);
sw.add (treeview); sw.add (treeview);
this.treeview.set_model (store); this.treeview.set_model (store);
this.treeview.set ("headers-visible", false); this.treeview.set ("headers-visible", false);
this.treeview.insert_column_with_attributes ( this.treeview.insert_column_with_attributes (
TabTreeCells.TREE_CELL_PIXBUF, "Icon", -1, "Icon",
new CellRendererPixbuf (), "pixbuf", 0); new CellRendererPixbuf (), "pixbuf", TabTreeCells.TREE_CELL_PIXBUF);
this.treeview.insert_column_with_attributes ( this.treeview.insert_column_with_attributes (
TabTreeCells.TREE_CELL_STRING, "Title", -1, "Title",
new CellRendererText (), "text", 1); new CellRendererText (), "text", TabTreeCells.TREE_CELL_STRING);
Requisition requisition; Requisition requisition;
int height; int height;
int max_lines = 10; int max_lines = 10;
#if HAVE_GTK3
requisition = Requisition();
get_preferred_width(out requisition.width, null);
get_preferred_height(out requisition.height, null);
#else
this.treeview.size_request (out requisition); this.treeview.size_request (out requisition);
if (store.length > max_lines) { #endif
height = requisition.height / store.length * max_lines + 2; int length = store.iter_n_children(null);
if (length > max_lines) {
height = requisition.height / length * max_lines + 2;
} else { } else {
height = requisition.height + 2; height = requisition.height + 2;
} }
@ -226,7 +233,9 @@ namespace HistoryList {
this.hl_manager = manager; this.hl_manager = manager;
this.title = _("Preferences for %s").printf( _("History-List")); this.title = _("Preferences for %s").printf( _("History-List"));
#if !HAVE_GTK3
this.has_separator = false; this.has_separator = false;
#endif
this.border_width = 5; this.border_width = 5;
this.set_modal (true); this.set_modal (true);
this.set_default_size (350, 100); this.set_default_size (350, 100);
@ -278,7 +287,7 @@ namespace HistoryList {
active_iter = iter; active_iter = iter;
model.append (out iter); model.append (out iter);
model.set (iter, TabClosingBehaviorModel.TEXT, _("Switch to last view tab"), model.set (iter, TabClosingBehaviorModel.TEXT, _("Switch to last viewed tab"),
TabClosingBehaviorModel.VALUE, TabClosingBehavior.LAST); TabClosingBehaviorModel.VALUE, TabClosingBehavior.LAST);
if (TabClosingBehavior.LAST == tab_closing_behavior) if (TabClosingBehavior.LAST == tab_closing_behavior)
active_iter = iter; active_iter = iter;
@ -296,7 +305,11 @@ namespace HistoryList {
table.attach_defaults (this.closing_behavior, 1, 2, 0, 1); table.attach_defaults (this.closing_behavior, 1, 2, 0, 1);
#if HAVE_GTK3
(get_content_area() as Gtk.Box).pack_start (table, false, true, 0);
#else
this.vbox.pack_start (table, false, true, 0); this.vbox.pack_start (table, false, true, 0);
#endif
this.add_button (Gtk.STOCK_CANCEL, ResponseType.CANCEL); this.add_button (Gtk.STOCK_CANCEL, ResponseType.CANCEL);
this.add_button (Gtk.STOCK_APPLY, ResponseType.APPLY); this.add_button (Gtk.STOCK_APPLY, ResponseType.APPLY);

View file

@ -187,7 +187,7 @@ mouse_gestures_button_release_event_cb (GtkWidget* web_view,
mouse_gesture_clear (gesture); mouse_gesture_clear (gesture);
} }
if (event->button == 3) if (MIDORI_EVENT_CONTEXT_MENU (event))
{ {
GtkWidget* menu = gtk_menu_new (); GtkWidget* menu = gtk_menu_new ();
midori_view_populate_popup (view, menu, TRUE); midori_view_populate_popup (view, menu, TRUE);

View file

@ -166,6 +166,7 @@ shortcuts_get_preferences_dialog (MidoriExtension* extension)
GList* actions; GList* actions;
guint i; guint i;
GtkAction* action; GtkAction* action;
GtkWidget* dialog_vbox;
#if HAVE_OSX #if HAVE_OSX
GtkWidget* icon; GtkWidget* icon;
#endif #endif
@ -175,7 +176,11 @@ shortcuts_get_preferences_dialog (MidoriExtension* extension)
dialog_title = _("Customize Keyboard shortcuts"); dialog_title = _("Customize Keyboard shortcuts");
dialog = gtk_dialog_new_with_buttons (dialog_title, GTK_WINDOW (browser), dialog = gtk_dialog_new_with_buttons (dialog_title, GTK_WINDOW (browser),
#if GTK_CHECK_VERSION(3,0,0)
GTK_DIALOG_DESTROY_WITH_PARENT,
#else
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
#endif
#if !HAVE_OSX #if !HAVE_OSX
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
#endif #endif
@ -187,12 +192,19 @@ shortcuts_get_preferences_dialog (MidoriExtension* extension)
gtk_window_set_default_size (GTK_WINDOW (dialog), width * 52, height * 24); gtk_window_set_default_size (GTK_WINDOW (dialog), width * 52, height * 24);
g_signal_connect (dialog, "response", g_signal_connect (dialog, "response",
G_CALLBACK (shortcuts_preferences_response_cb), NULL); G_CALLBACK (shortcuts_preferences_response_cb), NULL);
#if GTK_CHECK_VERSION(3,0,0)
dialog_vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
#else
dialog_vbox = GTK_DIALOG (dialog)->vbox;
#endif
if ((xfce_heading = sokoke_xfce_header_new ( if ((xfce_heading = sokoke_xfce_header_new (
gtk_window_get_icon_name (GTK_WINDOW (dialog)), dialog_title))) gtk_window_get_icon_name (GTK_WINDOW (dialog)), dialog_title)))
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), gtk_box_pack_start (GTK_BOX (dialog_vbox),
xfce_heading, FALSE, FALSE, 0); xfce_heading, FALSE, FALSE, 0);
hbox = gtk_hbox_new (FALSE, 0); hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox,
gtk_box_pack_start (GTK_BOX (dialog_vbox), hbox,
TRUE, TRUE, 12); TRUE, TRUE, 12);
liststore = gtk_list_store_new (7, liststore = gtk_list_store_new (7,
G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_BOOLEAN,
@ -248,7 +260,11 @@ shortcuts_get_preferences_dialog (MidoriExtension* extension)
0, GTK_SORT_ASCENDING); 0, GTK_SORT_ASCENDING);
g_object_unref (model); g_object_unref (model);
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_show_all (gtk_dialog_get_content_area(GTK_DIALOG (dialog)));
#else
gtk_widget_show_all (GTK_DIALOG (dialog)->vbox); gtk_widget_show_all (GTK_DIALOG (dialog)->vbox);
#endif
g_object_unref (browser); g_object_unref (browser);

View file

@ -406,7 +406,7 @@ tab_panel_toolitem_button_press_event_cb (GtkToolItem* toolitem,
GdkEventButton* event, GdkEventButton* event,
GtkWidget* view) GtkWidget* view)
{ {
if (event->button == 3) if (MIDORI_EVENT_CONTEXT_MENU (event))
{ {
tab_panel_popup (GTK_WIDGET (toolitem), event, view); tab_panel_popup (GTK_WIDGET (toolitem), event, view);
return TRUE; return TRUE;

View file

@ -274,6 +274,7 @@ static void tb_editor_drag_data_rcvd_cb(GtkWidget *widget, GdkDragContext *conte
gint x, gint y, GtkSelectionData *data, guint info, gint x, gint y, GtkSelectionData *data, guint info,
guint ltime, TBEditorWidget *tbw) guint ltime, TBEditorWidget *tbw)
{ {
#if !GTK_CHECK_VERSION(3,0,0) /* TODO */
GtkTreeView *tree = GTK_TREE_VIEW(widget); GtkTreeView *tree = GTK_TREE_VIEW(widget);
gboolean del = FALSE; gboolean del = FALSE;
@ -331,6 +332,7 @@ static void tb_editor_drag_data_rcvd_cb(GtkWidget *widget, GdkDragContext *conte
tbw->drag_source = NULL; /* reset the value just to be sure */ tbw->drag_source = NULL; /* reset the value just to be sure */
tb_editor_free_path(tbw); tb_editor_free_path(tbw);
gtk_drag_finish(context, TRUE, del, ltime); gtk_drag_finish(context, TRUE, del, ltime);
#endif
} }
@ -392,7 +394,11 @@ static TBEditorWidget *tb_editor_create_dialog(MidoriBrowser *parent)
GTK_WINDOW(parent), GTK_WINDOW(parent),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
#if !GTK_CHECK_VERSION(3,0,0)
vbox = (GTK_DIALOG(dialog))->vbox; vbox = (GTK_DIALOG(dialog))->vbox;
#else
vbox = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog)));
#endif
gtk_box_set_spacing(GTK_BOX(vbox), 6); gtk_box_set_spacing(GTK_BOX(vbox), 6);
gtk_widget_set_name(dialog, "GeanyDialog"); gtk_widget_set_name(dialog, "GeanyDialog");
gtk_window_set_default_size(GTK_WINDOW(dialog), -1, 400); gtk_window_set_default_size(GTK_WINDOW(dialog), -1, 400);

View file

@ -157,7 +157,6 @@ static void
web_cache_set_content_type (SoupMessage* msg, web_cache_set_content_type (SoupMessage* msg,
SoupBuffer* buffer) SoupBuffer* buffer)
{ {
#if WEBKIT_CHECK_VERSION (1, 1, 15)
gchar* sniffed_type; gchar* sniffed_type;
SoupContentSniffer* sniffer = soup_content_sniffer_new (); SoupContentSniffer* sniffer = soup_content_sniffer_new ();
if ((sniffed_type = soup_content_sniffer_sniff (sniffer, msg, buffer, NULL))) if ((sniffed_type = soup_content_sniffer_sniff (sniffer, msg, buffer, NULL)))
@ -171,7 +170,6 @@ web_cache_set_content_type (SoupMessage* msg,
msg->response_headers, "Content-Type"); msg->response_headers, "Content-Type");
g_signal_emit_by_name (msg, "content-sniffed", content_type, NULL); g_signal_emit_by_name (msg, "content-sniffed", content_type, NULL);
} }
#endif
} }
static void static void
@ -390,7 +388,6 @@ web_cache_session_request_queued_cb (SoupSession* session,
g_free (uri); g_free (uri);
} }
#if WEBKIT_CHECK_VERSION (1, 1, 3)
static void static void
web_cache_add_download_cb (MidoriBrowser* browser, web_cache_add_download_cb (MidoriBrowser* browser,
WebKitDownload* download, WebKitDownload* download,
@ -402,7 +399,6 @@ web_cache_add_download_cb (MidoriBrowser* browser,
g_object_set_data (G_OBJECT (msg), "midori-web-cache-download", g_object_set_data (G_OBJECT (msg), "midori-web-cache-download",
(gpointer)0xdeadbeef); (gpointer)0xdeadbeef);
} }
#endif
static void static void
web_cache_deactivate_cb (MidoriExtension* extension, web_cache_deactivate_cb (MidoriExtension* extension,
@ -413,10 +409,8 @@ web_cache_app_add_browser_cb (MidoriApp* app,
MidoriBrowser* browser, MidoriBrowser* browser,
MidoriExtension* extension) MidoriExtension* extension)
{ {
#if WEBKIT_CHECK_VERSION (1, 1, 3)
g_signal_connect (browser, "add-download", g_signal_connect (browser, "add-download",
G_CALLBACK (web_cache_add_download_cb), extension); G_CALLBACK (web_cache_add_download_cb), extension);
#endif
g_signal_connect (extension, "deactivate", g_signal_connect (extension, "deactivate",
G_CALLBACK (web_cache_deactivate_cb), browser); G_CALLBACK (web_cache_deactivate_cb), browser);
} }
@ -434,10 +428,8 @@ web_cache_deactivate_cb (MidoriExtension* extension,
extension, web_cache_deactivate_cb, browser); extension, web_cache_deactivate_cb, browser);
g_signal_handlers_disconnect_by_func ( g_signal_handlers_disconnect_by_func (
app, web_cache_app_add_browser_cb, extension); app, web_cache_app_add_browser_cb, extension);
#if WEBKIT_CHECK_VERSION (1, 1, 3)
g_signal_handlers_disconnect_by_func ( g_signal_handlers_disconnect_by_func (
browser, web_cache_add_download_cb, extension); browser, web_cache_add_download_cb, extension);
#endif
} }
static void static void

View file

@ -34,7 +34,11 @@ for extension in extensions:
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.vapi_dirs = '../midori'
obj.packages = 'glib-2.0 gio-2.0 gtk+-2.0 libsoup-2.4 webkit-1.0 midori' obj.packages = 'glib-2.0 gio-2.0 libsoup-2.4 midori'
if bld.env['HAVE_GTK3']:
obj.packages += ' gtk+-3.0 webkitgtk-3.0'
else:
obj.packages += ' gtk+-2.0 webkit-1.0 unique-1.0'
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'

46
katze/gtk3-compat.h Normal file
View file

@ -0,0 +1,46 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#ifndef H_GTK3_COMPAT_20110110
#define H_GTK3_COMPAT_20110110
#if !GTK_CHECK_VERSION (2, 24 ,0)
#define gtk_combo_box_text_append_text gtk_combo_box_append_text
#define gtk_combo_box_text_new gtk_combo_box_new_text
#define gtk_combo_box_text_get_active_text gtk_combo_box_get_active_text
#define GTK_COMBO_BOX_TEXT GTK_COMBO_BOX
#define GtkComboBoxText GtkComboBox
#endif
#ifndef GDK_KEY_Return
#define GDK_KEY_0 GDK_0
#define GDK_KEY_BackSpace GDK_BackSpace
#define GDK_KEY_space GDK_space
#define GDK_KEY_F5 GDK_F5
#define GDK_KEY_KP_Equal GDK_KP_Equal
#define GDK_KEY_KP_Enter GDK_KP_Enter
#define GDK_KEY_KP_Left GDK_KP_Left
#define GDK_KEY_KP_Right GDK_KP_Right
#define GDK_KEY_KP_Delete GDK_KP_Delete
#define GDK_KEY_KP_Down GDK_KP_Down
#define GDK_KEY_KP_Up GDK_KP_Up
#define GDK_KEY_KP_Divide GDK_KP_Divide
#define GDK_KEY_Tab GDK_Tab
#define GDK_KEY_ISO_Left_Tab GDK_ISO_Left_Tab
#define GDK_KEY_equal GDK_equal
#define GDK_KEY_ISO_Enter GDK_ISO_Enter
#define GDK_KEY_Left GDK_Left
#define GDK_KEY_Right GDK_Right
#define GDK_KEY_Escape GDK_Escape
#define GDK_KEY_Page_Up GDK_Page_Up
#define GDK_KEY_Page_Down GDK_Page_Down
#define GDK_KEY_Delete GDK_Delete
#define GDK_KEY_Down GDK_Down
#define GDK_KEY_Up GDK_Up
#define GDK_KEY_B GDK_B
#define GDK_KEY_H GDK_H
#define GDK_KEY_J GDK_J
#define GDK_KEY_Return GDK_Return
#endif
#endif

View file

@ -212,7 +212,11 @@ katze_http_auth_session_authenticate_cb (SoupSession* session,
dialog = gtk_dialog_new_with_buttons (_("Authentication Required"), dialog = gtk_dialog_new_with_buttons (_("Authentication Required"),
NULL, NULL,
#if GTK_CHECK_VERSION(3,0,0)
GTK_DIALOG_DESTROY_WITH_PARENT,
#else
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
#endif
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK, GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL); NULL);

View file

@ -97,7 +97,9 @@ katze_preferences_init (KatzePreferences* preferences)
g_object_set (preferences, g_object_set (preferences,
"icon-name", GTK_STOCK_PREFERENCES, "icon-name", GTK_STOCK_PREFERENCES,
"title", dialog_title, "title", dialog_title,
#if !GTK_CHECK_VERSION (3, 0, 0)
"has-separator", FALSE, "has-separator", FALSE,
#endif
NULL); NULL);
g_free (dialog_title); g_free (dialog_title);

View file

@ -92,11 +92,25 @@ katze_throbber_get_property (GObject* object,
GParamSpec* pspec); GParamSpec* pspec);
static void static void
#if GTK_CHECK_VERSION (3, 0, 0)
katze_throbber_destroy (GtkWidget* object);
#else
katze_throbber_destroy (GtkObject* object); katze_throbber_destroy (GtkObject* object);
#endif
static void static void
katze_throbber_realize (GtkWidget* widget); katze_throbber_realize (GtkWidget* widget);
#if GTK_CHECK_VERSION (3, 0, 0)
static void
katze_throbber_get_preferred_height (GtkWidget *widget,
gint *minimal_width,
gint *natural_width);
static void
katze_throbber_get_preferred_width (GtkWidget *widget,
gint *minimal_width,
gint *natural_width);
#endif
static void static void
katze_throbber_unrealize (GtkWidget* widget); katze_throbber_unrealize (GtkWidget* widget);
@ -120,7 +134,11 @@ katze_throbber_size_request (GtkWidget* widget,
static gboolean static gboolean
katze_throbber_expose_event (GtkWidget* widget, katze_throbber_expose_event (GtkWidget* widget,
#if GTK_CHECK_VERSION (3, 0, 0)
cairo_t* cr);
#else
GdkEventExpose* event); GdkEventExpose* event);
#endif
static void static void
icon_theme_changed (KatzeThrobber* throbber); icon_theme_changed (KatzeThrobber* throbber);
@ -137,7 +155,9 @@ static void
katze_throbber_class_init (KatzeThrobberClass* class) katze_throbber_class_init (KatzeThrobberClass* class)
{ {
GObjectClass* gobject_class; GObjectClass* gobject_class;
#if !GTK_CHECK_VERSION (3, 0, 0)
GtkObjectClass* object_class; GtkObjectClass* object_class;
#endif
GtkWidgetClass* widget_class; GtkWidgetClass* widget_class;
GParamFlags flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT; GParamFlags flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT;
@ -146,19 +166,30 @@ katze_throbber_class_init (KatzeThrobberClass* class)
gobject_class->set_property = katze_throbber_set_property; gobject_class->set_property = katze_throbber_set_property;
gobject_class->get_property = katze_throbber_get_property; gobject_class->get_property = katze_throbber_get_property;
widget_class = GTK_WIDGET_CLASS (class);
#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->destroy = katze_throbber_destroy;
#else
object_class = GTK_OBJECT_CLASS (class); object_class = GTK_OBJECT_CLASS (class);
object_class->destroy = katze_throbber_destroy; object_class->destroy = katze_throbber_destroy;
#endif
widget_class = GTK_WIDGET_CLASS (class);
widget_class->realize = katze_throbber_realize; widget_class->realize = katze_throbber_realize;
widget_class->unrealize = katze_throbber_unrealize; widget_class->unrealize = katze_throbber_unrealize;
widget_class->map = katze_throbber_map; widget_class->map = katze_throbber_map;
widget_class->unmap = katze_throbber_unmap; widget_class->unmap = katze_throbber_unmap;
widget_class->style_set = katze_throbber_style_set; widget_class->style_set = katze_throbber_style_set;
widget_class->screen_changed = katze_throbber_screen_changed; widget_class->screen_changed = katze_throbber_screen_changed;
#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->get_preferred_width= katze_throbber_get_preferred_width;
widget_class->get_preferred_height= katze_throbber_get_preferred_height;
#else
widget_class->size_request = katze_throbber_size_request; widget_class->size_request = katze_throbber_size_request;
#endif
#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->draw = katze_throbber_expose_event;
#else
widget_class->expose_event = katze_throbber_expose_event; widget_class->expose_event = katze_throbber_expose_event;
#endif
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_ICON_SIZE, PROP_ICON_SIZE,
g_param_spec_int ( g_param_spec_int (
@ -246,7 +277,11 @@ katze_throbber_dispose (GObject* object)
} }
static void static void
#if GTK_CHECK_VERSION (3, 0, 0)
katze_throbber_destroy (GtkWidget* object)
#else
katze_throbber_destroy (GtkObject* object) katze_throbber_destroy (GtkObject* object)
#endif
{ {
KatzeThrobber* throbber = KATZE_THROBBER (object); KatzeThrobber* throbber = KATZE_THROBBER (object);
@ -255,8 +290,11 @@ katze_throbber_destroy (GtkObject* object)
katze_assign (throbber->static_icon_name, NULL); katze_assign (throbber->static_icon_name, NULL);
katze_object_assign (throbber->static_pixbuf, NULL); katze_object_assign (throbber->static_pixbuf, NULL);
katze_assign (throbber->static_stock_id, NULL); katze_assign (throbber->static_stock_id, NULL);
#if GTK_CHECK_VERSION (3, 0, 0)
GTK_WIDGET_CLASS (katze_throbber_parent_class)->destroy (object);
#else
GTK_OBJECT_CLASS (katze_throbber_parent_class)->destroy (object); GTK_OBJECT_CLASS (katze_throbber_parent_class)->destroy (object);
#endif
} }
static void static void
@ -817,11 +855,38 @@ katze_throbber_size_request (GtkWidget* widget,
requisition->width = throbber->width; requisition->width = throbber->width;
requisition->height = throbber->height; requisition->height = throbber->height;
#if !GTK_CHECK_VERSION (3, 0, 0)
GTK_WIDGET_CLASS (katze_throbber_parent_class)->size_request (widget, GTK_WIDGET_CLASS (katze_throbber_parent_class)->size_request (widget,
requisition); requisition);
#endif
} }
#if GTK_CHECK_VERSION (3, 0, 0)
static void
katze_throbber_get_preferred_height (GtkWidget *widget,
gint *minimal_width,
gint *natural_width)
{
GtkRequisition requisition;
katze_throbber_size_request (widget, &requisition);
*minimal_width = *natural_width = requisition.height;
}
static void
katze_throbber_get_preferred_width (GtkWidget *widget,
gint *minimal_width,
gint *natural_width)
{
GtkRequisition requisition;
katze_throbber_size_request (widget, &requisition);
*minimal_width = *natural_width = requisition.width;
}
#endif
static void static void
katze_throbber_aligned_coords (GtkWidget* widget, katze_throbber_aligned_coords (GtkWidget* widget,
gint* ax, gint* ax,
@ -853,7 +918,11 @@ katze_throbber_aligned_coords (GtkWidget* widget,
static gboolean static gboolean
katze_throbber_expose_event (GtkWidget* widget, katze_throbber_expose_event (GtkWidget* widget,
#if GTK_CHECK_VERSION (3, 0, 0)
cairo_t* cr)
#else
GdkEventExpose* event) GdkEventExpose* event)
#endif
{ {
KatzeThrobber* throbber = KATZE_THROBBER (widget); KatzeThrobber* throbber = KATZE_THROBBER (widget);
gint ax, ay; gint ax, ay;
@ -868,8 +937,9 @@ katze_throbber_expose_event (GtkWidget* widget,
if (!throbber->animated && (throbber->static_pixbuf if (!throbber->animated && (throbber->static_pixbuf
|| throbber->static_icon_name || throbber->static_stock_id)) || throbber->static_icon_name || throbber->static_stock_id))
{ {
#if !GTK_CHECK_VERSION (3, 0, 0)
cairo_t* cr; cairo_t* cr;
#endif
if (G_UNLIKELY (!throbber->static_pixbuf && throbber->static_icon_name)) if (G_UNLIKELY (!throbber->static_pixbuf && throbber->static_icon_name))
{ {
icon_theme_changed (KATZE_THROBBER (widget)); icon_theme_changed (KATZE_THROBBER (widget));
@ -899,16 +969,24 @@ katze_throbber_expose_event (GtkWidget* widget,
katze_throbber_aligned_coords (widget, &ax, &ay); katze_throbber_aligned_coords (widget, &ax, &ay);
#if !GTK_CHECK_VERSION (3, 0, 0)
cr = gdk_cairo_create (gtk_widget_get_window (widget)); cr = gdk_cairo_create (gtk_widget_get_window (widget));
#endif
gdk_cairo_set_source_pixbuf (cr, throbber->static_pixbuf, ax, ay); gdk_cairo_set_source_pixbuf (cr, throbber->static_pixbuf, ax, ay);
cairo_paint (cr); cairo_paint (cr);
#if !GTK_CHECK_VERSION (3, 0, 0)
cairo_destroy (cr); cairo_destroy (cr);
#endif
} }
else else
{ {
#if HAVE_SPINNER #if HAVE_SPINNER
if (throbber->animated) if (throbber->animated)
#if GTK_CHECK_VERSION (3, 0, 0)
return GTK_WIDGET_CLASS (katze_throbber_parent_class)->draw (widget, cr);
#else
return GTK_WIDGET_CLASS (katze_throbber_parent_class)->expose_event (widget, event); return GTK_WIDGET_CLASS (katze_throbber_parent_class)->expose_event (widget, event);
#endif
#else #else
gint cols, rows; gint cols, rows;

View file

@ -9,6 +9,8 @@
See the file COPYING for the full license text. See the file COPYING for the full license text.
*/ */
#include "gtk3-compat.h"
#include "katze-utils.h" #include "katze-utils.h"
#include "katze-array.h" #include "katze-array.h"
@ -85,10 +87,10 @@ proxy_uri_file_set_cb (GtkFileChooser* button,
} }
static void static void
proxy_combo_box_text_changed_cb (GtkComboBox* button, proxy_combo_box_text_changed_cb (GtkComboBoxText* button,
GObject* object) GObject* object)
{ {
gchar* text = gtk_combo_box_get_active_text (button); gchar* text = gtk_combo_box_text_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); g_free (text);
@ -494,6 +496,7 @@ g_icon_to_string (GIcon *icon)
* "custom-PROPERTY": the last value of an enumeration will be the "custom" * "custom-PROPERTY": the last value of an enumeration will be the "custom"
* value, where the user may enter text freely, which then updates * value, where the user may enter text freely, which then updates
* the property PROPERTY instead. This applies only to enumerations. * the property PROPERTY instead. This applies only to enumerations.
* Since 0.4.1 mnemonics are automatically stripped.
* Since 0.2.9 the following hints are also supported: * Since 0.2.9 the following hints are also supported:
* "languages": the widget will be particularly suitable for choosing * "languages": the widget will be particularly suitable for choosing
* multiple language codes, ie. "de,en_GB". * multiple language codes, ie. "de,en_GB".
@ -633,7 +636,7 @@ katze_property_proxy (gpointer object,
gboolean monospace = _hint == I_("font-monospace"); gboolean monospace = _hint == I_("font-monospace");
string = katze_object_get_string (object, property); string = katze_object_get_string (object, property);
widget = gtk_combo_box_new_text (); widget = gtk_combo_box_text_new ();
combo = GTK_COMBO_BOX (widget); combo = GTK_COMBO_BOX (widget);
context = gtk_widget_get_pango_context (widget); context = gtk_widget_get_pango_context (widget);
pango_context_list_families (context, &families, &n_families); pango_context_list_families (context, &families, &n_families);
@ -650,7 +653,7 @@ katze_property_proxy (gpointer object,
const gchar* font = pango_font_family_get_name (families[i]); const gchar* font = pango_font_family_get_name (families[i]);
if (monospace != pango_font_family_is_monospace (families[i])) if (monospace != pango_font_family_is_monospace (families[i]))
continue; continue;
gtk_combo_box_append_text (combo, font); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), font);
if (!g_ascii_strcasecmp (font, string)) if (!g_ascii_strcasecmp (font, string))
gtk_combo_box_set_active (combo, j); gtk_combo_box_set_active (combo, j);
j++; j++;
@ -815,12 +818,12 @@ katze_property_proxy (gpointer object,
{ {
gint value = katze_object_get_int (object, property); gint value = katze_object_get_int (object, property);
gint active; gint active;
widget = gtk_combo_box_new_text (); widget = gtk_combo_box_text_new ();
gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("1 hour")); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), _("1 hour"));
gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("1 day")); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), _("1 day"));
gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("1 week")); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), _("1 week"));
gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("1 month")); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), _("1 month"));
gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("1 year")); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), _("1 year"));
switch (value) switch (value)
{ {
case 0: active = 0; break; case 0: active = 0; break;
@ -874,16 +877,18 @@ katze_property_proxy (gpointer object,
hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (widget), hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (widget),
HILDON_TOUCH_SELECTOR (selector)); HILDON_TOUCH_SELECTOR (selector));
#else #else
widget = gtk_combo_box_new_text (); widget = gtk_combo_box_text_new ();
#endif #endif
for (i = 0; i < enum_class->n_values; i++) for (i = 0; i < enum_class->n_values; i++)
{ {
const gchar* label = gettext (enum_class->values[i].value_nick); const gchar* raw_label = gettext (enum_class->values[i].value_nick);
gchar* label = katze_strip_mnemonics (raw_label);
#ifdef HAVE_HILDON_2_2 #ifdef HAVE_HILDON_2_2
hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), label); hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), label);
#else #else
gtk_combo_box_append_text (GTK_COMBO_BOX (widget), label); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), label);
#endif #endif
g_free (label);
} }
#ifdef HAVE_HILDON_2_2 #ifdef HAVE_HILDON_2_2
hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, value); hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, value);

View file

@ -711,10 +711,24 @@ midori_browser_show_preferences_cb (MidoriBrowser* browser,
KatzePreferences* preferences, KatzePreferences* preferences,
MidoriApp* app) MidoriApp* app)
{ {
GtkWidget* scrolled = katze_scrolled_new (NULL, NULL); KatzeArray* array;
GtkWidget* addon = g_object_new (MIDORI_TYPE_EXTENSIONS, NULL); GtkWidget* scrolled;
GList* children = gtk_container_get_children (GTK_CONTAINER (addon)); GtkWidget* addon;
GList* children;
GtkWidget* page; GtkWidget* page;
/* Hide if there are no extensions at all */
array = katze_object_get_object (app, "extensions");
if (!katze_array_get_nth_item (array, 0))
{
g_object_unref (array);
return;
}
g_object_unref (array);
scrolled = katze_scrolled_new (NULL, NULL);
addon = g_object_new (MIDORI_TYPE_EXTENSIONS, NULL);
children = gtk_container_get_children (GTK_CONTAINER (addon));
gtk_widget_reparent (g_list_nth_data (children, 0), scrolled); gtk_widget_reparent (g_list_nth_data (children, 0), scrolled);
g_list_free (children); g_list_free (children);
g_object_set (addon, "app", app, NULL); g_object_set (addon, "app", app, NULL);
@ -1197,27 +1211,12 @@ midori_load_extensions (gpointer data)
g_object_set (app, "extensions", extensions, NULL); g_object_set (app, "extensions", extensions, NULL);
if (g_module_supported ()) if (g_module_supported ())
{ {
/* FIXME: Read extensions from system data dirs */
gchar* extension_path; gchar* extension_path;
GDir* extension_dir; GDir* extension_dir = NULL;
if (!(extension_path = g_strdup (g_getenv ("MIDORI_EXTENSION_PATH")))) if (!(extension_path = g_strdup (g_getenv ("MIDORI_EXTENSION_PATH"))))
{ extension_path = sokoke_find_lib_path (PACKAGE_NAME);
#ifdef G_OS_WIN32 if (extension_path != NULL)
{
gchar *path = g_win32_get_package_installation_directory_of_module (NULL);
extension_path = g_build_filename (path, "lib", PACKAGE_NAME, NULL);
g_free (path);
if (g_access (extension_path, F_OK) != 0)
{
g_free (extension_path);
extension_path = g_build_filename (LIBDIR, PACKAGE_NAME, NULL);
}
}
#else
extension_path = g_build_filename (LIBDIR, PACKAGE_NAME, NULL);
#endif
}
extension_dir = g_dir_open (extension_path, 0, NULL); extension_dir = g_dir_open (extension_path, 0, NULL);
if (extension_dir != NULL) if (extension_dir != NULL)
{ {
@ -2158,6 +2157,10 @@ main (int argc,
if (private) if (private)
{ {
/* In-memory trash for re-opening closed tabs */
trash = katze_array_new (KATZE_TYPE_ITEM);
g_object_set (browser, "trash", trash, NULL);
g_object_set (settings, g_object_set (settings,
"preferred-languages", "en", "preferred-languages", "en",
"enable-private-browsing", TRUE, "enable-private-browsing", TRUE,
@ -2541,9 +2544,6 @@ main (int argc,
g_object_get (settings, "maximum-history-age", &max_history_age, NULL); g_object_get (settings, "maximum-history-age", &max_history_age, NULL);
midori_history_terminate (history, max_history_age); midori_history_terminate (history, max_history_age);
/* Removing KatzeHttpCookies makes it save outstanding changes */
soup_session_remove_feature_by_type (webkit_get_default_session (),
KATZE_TYPE_HTTP_COOKIES);
/* Clear data on quit, according to the Clear private data dialog */ /* Clear data on quit, according to the Clear private data dialog */
g_object_get (settings, "clear-private-data", &clear_prefs, NULL); g_object_get (settings, "clear-private-data", &clear_prefs, NULL);
@ -2565,6 +2565,10 @@ main (int argc,
g_free (clear_data); g_free (clear_data);
} }
/* Removing KatzeHttpCookies makes it save outstanding changes */
soup_session_remove_feature_by_type (webkit_get_default_session (),
KATZE_TYPE_HTTP_COOKIES);
load_on_startup = katze_object_get_int (settings, "load-on-startup"); load_on_startup = katze_object_get_int (settings, "load-on-startup");
if (load_on_startup < MIDORI_STARTUP_LAST_OPEN_PAGES) if (load_on_startup < MIDORI_STARTUP_LAST_OPEN_PAGES)
{ {

View file

@ -499,10 +499,27 @@ midori_app_command_received (MidoriApp* app,
midori_browser_set_current_uri (browser, fixed_uri); midori_browser_set_current_uri (browser, fixed_uri);
first = FALSE; first = FALSE;
} }
else
{
/* Switch to already open tab if possible */
guint i = 0;
GtkWidget* tab;
gboolean found = FALSE;
while ((tab = midori_browser_get_nth_tab (browser, i++)))
if (g_str_equal (
midori_view_get_display_uri (MIDORI_VIEW (tab)),
fixed_uri))
{
found = TRUE;
break;
}
if (found)
midori_browser_set_current_tab (browser, tab);
else else
midori_browser_set_current_page (browser, midori_browser_set_current_page (browser,
midori_browser_add_uri (browser, fixed_uri)); midori_browser_add_uri (browser, fixed_uri));
} }
}
g_free (fixed_uri); g_free (fixed_uri);
uris++; uris++;
} }

View file

@ -11,6 +11,8 @@
See the file COPYING for the full license text. See the file COPYING for the full license text.
*/ */
#include "gtk3-compat.h"
#include "midori-browser.h" #include "midori-browser.h"
#include "midori-array.h" #include "midori-array.h"
@ -22,6 +24,7 @@
#include "midori-stock.h" #include "midori-stock.h"
#include "midori-findbar.h" #include "midori-findbar.h"
#include "midori-transferbar.h" #include "midori-transferbar.h"
#include "midori-platform.h"
#include "gtkiconentry.h" #include "gtkiconentry.h"
#include "marshal.h" #include "marshal.h"
@ -723,7 +726,11 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
title = new_bookmark ? _("New bookmark") : _("Edit bookmark"); title = new_bookmark ? _("New bookmark") : _("Edit bookmark");
dialog = gtk_dialog_new_with_buttons ( dialog = gtk_dialog_new_with_buttons (
title, GTK_WINDOW (browser), title, GTK_WINDOW (browser),
#if GTK_CHECK_VERSION(3,0,0)
GTK_DIALOG_DESTROY_WITH_PARENT,
#else
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
#endif
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
new_bookmark ? GTK_STOCK_ADD : GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, new_bookmark ? GTK_STOCK_ADD : GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NULL); NULL);
@ -901,7 +908,8 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_app))); gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_app)));
} }
selected = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo_folder)); selected = gtk_combo_box_text_get_active_text (
GTK_COMBO_BOX_TEXT (combo_folder));
if (!strcmp (selected, _("Toplevel folder"))) if (!strcmp (selected, _("Toplevel folder")))
katze_assign (selected, g_strdup ("")); katze_assign (selected, g_strdup (""));
katze_item_set_meta_string (bookmark, "folder", selected); katze_item_set_meta_string (bookmark, "folder", selected);
@ -1115,11 +1123,8 @@ midori_browser_add_speed_dial (MidoriBrowser* browser)
if ((img = midori_view_get_snapshot (MIDORI_VIEW (view), 240, 160))) if ((img = midori_view_get_snapshot (MIDORI_VIEW (view), 240, 160)))
{ {
gint i;
GKeyFile* key_file; GKeyFile* key_file;
gchar* dial_id = g_strdup_printf ("Dial %s", slot_id + 1); gchar* dial_id = g_strdup_printf ("Dial %s", slot_id + 1);
gchar* config_file = g_build_filename (sokoke_set_config_dir (NULL),
"speeddial", NULL);
gchar* file_path = sokoke_build_thumbnail_path (uri); gchar* file_path = sokoke_build_thumbnail_path (uri);
gchar* thumb_dir = g_build_path (G_DIR_SEPARATOR_S, g_get_user_cache_dir (), gchar* thumb_dir = g_build_path (G_DIR_SEPARATOR_S, g_get_user_cache_dir (),
PACKAGE_NAME, "thumbnails", NULL); PACKAGE_NAME, "thumbnails", NULL);
@ -1132,19 +1137,12 @@ midori_browser_add_speed_dial (MidoriBrowser* browser)
katze_mkdir_with_parents (thumb_dir, 0700); katze_mkdir_with_parents (thumb_dir, 0700);
gdk_pixbuf_save (img, file_path, "png", NULL, "compression", "7", NULL); gdk_pixbuf_save (img, file_path, "png", NULL, "compression", "7", NULL);
sokoke_key_file_save_to_file (key_file, config_file, NULL);
i = 0;
while ((view = gtk_notebook_get_nth_page (GTK_NOTEBOOK (
browser->notebook), i++)))
if (midori_view_is_blank (MIDORI_VIEW (view)))
midori_view_reload (MIDORI_VIEW (view), FALSE);
midori_view_save_speed_dial_config (MIDORI_VIEW (view), key_file);
g_object_unref (img); g_object_unref (img);
g_free (file_path); g_free (file_path);
g_free (thumb_dir); g_free (thumb_dir);
g_free (config_file);
g_free (dial_id); g_free (dial_id);
} }
g_free (uri); g_free (uri);
@ -1240,6 +1238,23 @@ midori_browser_view_copy_history (GtkWidget* view_to,
} }
} }
static gint
midori_browser_notify_new_tab_timeout_cb (MidoriBrowser *browser)
{
gtk_window_set_opacity (GTK_WINDOW (browser), 1);
return 0;
}
static void
midori_browser_notify_new_tab (MidoriBrowser *browser)
{
if (katze_object_get_boolean (browser->settings, "flash-window-on-new-bg-tabs"))
{
gtk_window_set_opacity (GTK_WINDOW (browser), 0.8);
g_timeout_add (100, (GSourceFunc) midori_browser_notify_new_tab_timeout_cb, browser);
}
}
static void static void
midori_view_new_tab_cb (GtkWidget* view, midori_view_new_tab_cb (GtkWidget* view,
const gchar* uri, const gchar* uri,
@ -1252,6 +1267,8 @@ midori_view_new_tab_cb (GtkWidget* view,
if (!background) if (!background)
midori_browser_set_current_page (browser, n); midori_browser_set_current_page (browser, n);
else
midori_browser_notify_new_tab (browser);
} }
static void static void
@ -1287,6 +1304,8 @@ midori_view_new_view_cb (GtkWidget* view,
gint n = midori_browser_add_tab (browser, new_view); gint n = midori_browser_add_tab (browser, new_view);
if (where != MIDORI_NEW_VIEW_BACKGROUND) if (where != MIDORI_NEW_VIEW_BACKGROUND)
midori_browser_set_current_page (browser, n); midori_browser_set_current_page (browser, n);
else
midori_browser_notify_new_tab (browser);
} }
if (!user_initiated) if (!user_initiated)
@ -1616,13 +1635,13 @@ midori_browser_key_press_event (GtkWidget* widget,
/* Interpret Ctrl(+Shift)+Tab as tab switching for compatibility */ /* Interpret Ctrl(+Shift)+Tab as tab switching for compatibility */
if (midori_browser_get_nth_tab (browser, 1) != NULL if (midori_browser_get_nth_tab (browser, 1) != NULL
&& event->keyval == GDK_Tab && event->keyval == GDK_KEY_Tab
&& (event->state & GDK_CONTROL_MASK)) && (event->state & GDK_CONTROL_MASK))
{ {
gtk_action_activate (_action_by_name (browser, "TabNext")); gtk_action_activate (_action_by_name (browser, "TabNext"));
return TRUE; return TRUE;
} }
else if (event->keyval == GDK_ISO_Left_Tab else if (event->keyval == GDK_KEY_ISO_Left_Tab
&& (event->state & GDK_CONTROL_MASK) && (event->state & GDK_CONTROL_MASK)
&& (event->state & GDK_SHIFT_MASK)) && (event->state & GDK_SHIFT_MASK))
{ {
@ -1630,14 +1649,14 @@ midori_browser_key_press_event (GtkWidget* widget,
return TRUE; return TRUE;
} }
/* Interpret Ctrl+= as Zoom In for compatibility */ /* Interpret Ctrl+= as Zoom In for compatibility */
else if ((event->keyval == GDK_KP_Equal || event->keyval == GDK_equal) else if ((event->keyval == GDK_KEY_KP_Equal || event->keyval == GDK_KEY_equal)
&& (event->state & GDK_CONTROL_MASK)) && (event->state & GDK_CONTROL_MASK))
{ {
midori_browser_activate_action (browser, "ZoomIn"); midori_browser_activate_action (browser, "ZoomIn");
return TRUE; return TRUE;
} }
/* Interpret F5 as reloading for compatibility */ /* Interpret F5 as reloading for compatibility */
else if (event->keyval == GDK_F5) else if (event->keyval == GDK_KEY_F5)
{ {
gtk_action_activate (_action_by_name (browser, "Reload")); gtk_action_activate (_action_by_name (browser, "Reload"));
return TRUE; return TRUE;
@ -1647,7 +1666,7 @@ midori_browser_key_press_event (GtkWidget* widget,
if (focus == NULL) if (focus == NULL)
gtk_widget_grab_focus (midori_browser_get_current_tab (MIDORI_BROWSER (widget))); gtk_widget_grab_focus (midori_browser_get_current_tab (MIDORI_BROWSER (widget)));
else if (G_OBJECT_TYPE (focus) == WEBKIT_TYPE_WEB_VIEW else if (G_OBJECT_TYPE (focus) == WEBKIT_TYPE_WEB_VIEW
&& event->keyval == GDK_space && event->keyval == GDK_KEY_space
&& !webkit_web_view_can_cut_clipboard (WEBKIT_WEB_VIEW (focus)) && !webkit_web_view_can_cut_clipboard (WEBKIT_WEB_VIEW (focus))
&& !webkit_web_view_can_paste_clipboard (WEBKIT_WEB_VIEW (focus))) && !webkit_web_view_can_paste_clipboard (WEBKIT_WEB_VIEW (focus)))
{ {
@ -1685,13 +1704,13 @@ midori_browser_key_press_event (GtkWidget* widget,
return TRUE; return TRUE;
/* Interpret (Shift+)Backspace as going back (forward) for compatibility */ /* Interpret (Shift+)Backspace as going back (forward) for compatibility */
if ((event->keyval == GDK_BackSpace) if ((event->keyval == GDK_KEY_BackSpace)
&& (event->state & GDK_SHIFT_MASK)) && (event->state & GDK_SHIFT_MASK))
{ {
gtk_action_activate (_action_by_name (browser, "Forward")); gtk_action_activate (_action_by_name (browser, "Forward"));
return TRUE; return TRUE;
} }
else if (event->keyval == GDK_BackSpace) else if (event->keyval == GDK_KEY_BackSpace)
{ {
gtk_action_activate (_action_by_name (browser, "Back")); gtk_action_activate (_action_by_name (browser, "Back"));
return TRUE; return TRUE;
@ -2326,12 +2345,22 @@ midori_browser_subscribe_to_news_feed (MidoriBrowser* browser,
{ {
if (browser->news_aggregator && *browser->news_aggregator) if (browser->news_aggregator && *browser->news_aggregator)
{ {
/* Thunderbird only accepts feed://, Liferea doesn't mind */
gchar* feed = g_strdup (uri);
if (g_str_has_prefix (feed, "http://"))
{
feed[0] = 'f';
feed[1] = 'e';
feed[2] = 'e';
feed[3] = 'd';
}
/* Special-case Liferea because a helper script may be required */ /* Special-case Liferea because a helper script may be required */
if (g_str_equal (browser->news_aggregator, "liferea") if (g_str_equal (browser->news_aggregator, "liferea")
&& g_find_program_in_path ("liferea-add-feed")) && g_find_program_in_path ("liferea-add-feed"))
sokoke_spawn_program ("liferea-add-feed", uri); sokoke_spawn_program ("liferea-add-feed", feed);
else else
sokoke_spawn_program (browser->news_aggregator, uri); sokoke_spawn_program (browser->news_aggregator, feed);
g_free (feed);
} }
else else
{ {
@ -2767,15 +2796,15 @@ midori_bookmarkbar_activate_item_alt (GtkAction* action,
guint button, guint button,
MidoriBrowser* browser) MidoriBrowser* browser)
{ {
if (button == 1) if (MIDORI_EVENT_NEW_TAB (gtk_get_current_event ()))
{
midori_browser_open_bookmark (browser, item);
}
else if (button == 2)
{ {
gint n = midori_browser_add_uri (browser, katze_item_get_uri (item)); gint n = midori_browser_add_uri (browser, katze_item_get_uri (item));
midori_browser_set_current_page_smartly (browser, n); midori_browser_set_current_page_smartly (browser, n);
} }
else if (button == 1)
{
midori_browser_open_bookmark (browser, item);
}
return TRUE; return TRUE;
} }
@ -2813,20 +2842,20 @@ _action_trash_activate_item_alt (GtkAction* action,
guint button, guint button,
MidoriBrowser* browser) MidoriBrowser* browser)
{ {
if (button == 1) if (MIDORI_EVENT_NEW_TAB (gtk_get_current_event ()))
{
guint n = midori_browser_add_item (browser, item);
midori_browser_set_current_page (browser, n);
katze_array_remove_item (browser->trash, item);
_midori_browser_update_actions (browser);
}
else if (button == 2)
{ {
gint n = midori_browser_add_item (browser, item); gint n = midori_browser_add_item (browser, item);
midori_browser_set_current_page_smartly (browser, n); midori_browser_set_current_page_smartly (browser, n);
katze_array_remove_item (browser->trash, item); katze_array_remove_item (browser->trash, item);
_midori_browser_update_actions (browser); _midori_browser_update_actions (browser);
} }
else if (button == 1)
{
guint n = midori_browser_add_item (browser, item);
midori_browser_set_current_page (browser, n);
katze_array_remove_item (browser->trash, item);
_midori_browser_update_actions (browser);
}
return TRUE; return TRUE;
} }
@ -3499,14 +3528,20 @@ _action_navigation_activate (GtkAction* action,
GtkWidget* tab; GtkWidget* tab;
gchar* uri; gchar* uri;
const gchar* name; const gchar* name;
gboolean middle_click;
g_assert (GTK_IS_ACTION (action)); g_assert (GTK_IS_ACTION (action));
if (g_object_get_data (G_OBJECT (action), "midori-middle-click")) if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (action),
"midori-middle-click")))
{ {
g_object_set_data (G_OBJECT (action), "midori-middle-click", (void*)0); middle_click = TRUE;
return FALSE; g_object_set_data (G_OBJECT (action),
"midori-middle-click",
GINT_TO_POINTER(0));
} }
else
middle_click = FALSE;
tab = midori_browser_get_current_tab (browser); tab = midori_browser_get_current_tab (browser);
if (!tab) if (!tab)
@ -3518,19 +3553,69 @@ _action_navigation_activate (GtkAction* action,
if (g_str_equal (name, "Back")) if (g_str_equal (name, "Back"))
{ {
if (middle_click)
{
GtkWidget* web_view;
WebKitWebBackForwardList* back_forward_list;
WebKitWebHistoryItem* back_item;
const gchar* back_uri;
gint n;
web_view = midori_view_get_web_view (view);
back_forward_list =
webkit_web_view_get_back_forward_list (WEBKIT_WEB_VIEW (web_view));
back_item = webkit_web_back_forward_list_get_back_item (back_forward_list);
back_uri = webkit_web_history_item_get_uri (back_item);
n = midori_browser_add_uri (browser, back_uri);
midori_browser_set_current_page_smartly (browser, n);
}
else
midori_view_go_back (view); midori_view_go_back (view);
return TRUE; return TRUE;
} }
else if (g_str_equal (name, "Forward")) else if (g_str_equal (name, "Forward"))
{ {
if (middle_click)
{
GtkWidget* web_view;
WebKitWebBackForwardList* back_forward_list;
WebKitWebHistoryItem* forward_item;
const gchar* forward_uri;
gint n;
web_view = midori_view_get_web_view (view);
back_forward_list =
webkit_web_view_get_back_forward_list (WEBKIT_WEB_VIEW (web_view));
forward_item = webkit_web_back_forward_list_get_forward_item (back_forward_list);
forward_uri = webkit_web_history_item_get_uri (forward_item);
n = midori_browser_add_uri (browser, forward_uri);
midori_browser_set_current_page_smartly (browser, n);
}
else
midori_view_go_forward (view); midori_view_go_forward (view);
return TRUE; return TRUE;
} }
else if (g_str_equal (name, "Previous")) else if (g_str_equal (name, "Previous"))
{ {
/* Duplicate here because the URI pointer might change */ /* Duplicate here because the URI pointer might change */
uri = g_strdup (midori_view_get_previous_page (view)); uri = g_strdup (midori_view_get_previous_page (view));
if (middle_click)
{
gint n;
n = midori_browser_add_uri (browser, uri);
midori_browser_set_current_page_smartly (browser, n);
}
else
midori_view_set_uri (view, uri); midori_view_set_uri (view, uri);
g_free (uri); g_free (uri);
return TRUE; return TRUE;
} }
@ -3538,14 +3623,34 @@ _action_navigation_activate (GtkAction* action,
{ {
/* Duplicate here because the URI pointer might change */ /* Duplicate here because the URI pointer might change */
uri = g_strdup (midori_view_get_next_page (view)); uri = g_strdup (midori_view_get_next_page (view));
if (middle_click)
{
gint n;
n = midori_browser_add_uri (browser, uri);
midori_browser_set_current_page_smartly (browser, n);
}
else
midori_view_set_uri (view, uri); midori_view_set_uri (view, uri);
g_free (uri); g_free (uri);
return TRUE; return TRUE;
} }
else if (g_str_equal (name, "Homepage")) else if (g_str_equal (name, "Homepage"))
{ {
g_object_get (browser->settings, "homepage", &uri, NULL); g_object_get (browser->settings, "homepage", &uri, NULL);
if (middle_click)
{
gint n;
n = midori_browser_add_uri (browser, uri);
midori_browser_set_current_page_smartly (browser, n);
}
else
midori_view_set_uri (view, uri); midori_view_set_uri (view, uri);
g_free (uri); g_free (uri);
return TRUE; return TRUE;
} }
@ -4043,11 +4148,12 @@ midori_browser_menu_item_middle_click_event_cb (GtkWidget* toolitem,
GdkEventButton* event, GdkEventButton* event,
MidoriBrowser* browser) MidoriBrowser* browser)
{ {
if (event->button == 2) if (MIDORI_EVENT_NEW_TAB (event))
{ {
GtkAction* action; GtkAction* action;
action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (toolitem)); action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (toolitem));
g_object_set_data (G_OBJECT (action), "midori-middle-click", GINT_TO_POINTER (1));
return _action_navigation_activate (action, browser); return _action_navigation_activate (action, browser);
} }
@ -4105,7 +4211,11 @@ _action_bookmarks_import_activate (GtkAction* action,
dialog = gtk_dialog_new_with_buttons ( dialog = gtk_dialog_new_with_buttons (
_("Import bookmarks..."), GTK_WINDOW (browser), _("Import bookmarks..."), GTK_WINDOW (browser),
#if GTK_CHECK_VERSION(3,0,0)
GTK_DIALOG_DESTROY_WITH_PARENT,
#else
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
#endif
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
_("_Import bookmarks"), GTK_RESPONSE_ACCEPT, _("_Import bookmarks"), GTK_RESPONSE_ACCEPT,
NULL); NULL);
@ -4156,9 +4266,10 @@ _action_bookmarks_import_activate (GtkAction* action,
label = gtk_label_new_with_mnemonic (_("_Folder:")); label = gtk_label_new_with_mnemonic (_("_Folder:"));
gtk_size_group_add_widget (sizegroup, label); gtk_size_group_add_widget (sizegroup, label);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
combo = gtk_combo_box_new_text (); combo = gtk_combo_box_text_new ();
combobox_folder = GTK_COMBO_BOX (combo); combobox_folder = GTK_COMBO_BOX (combo);
gtk_combo_box_append_text (combobox_folder, _("Toplevel folder")); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox_folder),
_("Toplevel folder"));
gtk_combo_box_set_active (combobox_folder, 0); gtk_combo_box_set_active (combobox_folder, 0);
db = g_object_get_data (G_OBJECT (browser->bookmarks), "db"); db = g_object_get_data (G_OBJECT (browser->bookmarks), "db");
@ -4167,7 +4278,7 @@ _action_bookmarks_import_activate (GtkAction* action,
KATZE_ARRAY_FOREACH_ITEM (item, bookmarkdirs) KATZE_ARRAY_FOREACH_ITEM (item, bookmarkdirs)
{ {
const gchar* name = katze_item_get_name (item); const gchar* name = katze_item_get_name (item);
gtk_combo_box_append_text (combobox_folder, name); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox_folder), name);
} }
gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (content_area), hbox); gtk_container_add (GTK_CONTAINER (content_area), hbox);
@ -4185,7 +4296,8 @@ _action_bookmarks_import_activate (GtkAction* action,
gtk_combo_box_get_active_iter (combobox, &iter); gtk_combo_box_get_active_iter (combobox, &iter);
gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, 2, &path, -1); gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, 2, &path, -1);
selected = gtk_combo_box_get_active_text (combobox_folder); selected = gtk_combo_box_text_get_active_text (
GTK_COMBO_BOX_TEXT (combobox_folder));
if (g_str_equal (selected, _("Toplevel folder"))) if (g_str_equal (selected, _("Toplevel folder")))
selected = g_strdup (""); selected = g_strdup ("");
@ -4405,7 +4517,11 @@ _action_clear_private_data_activate (GtkAction* action,
/* i18n: Dialog: Clear Private Data, in the Tools menu */ /* i18n: Dialog: Clear Private Data, in the Tools menu */
dialog = gtk_dialog_new_with_buttons (_("Clear Private Data"), dialog = gtk_dialog_new_with_buttons (_("Clear Private Data"),
GTK_WINDOW (browser), GTK_WINDOW (browser),
GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_DESTROY_WITH_PARENT, #if GTK_CHECK_VERSION(3,0,0)
GTK_DIALOG_DESTROY_WITH_PARENT,
#else
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
#endif
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
_("_Clear private data"), GTK_RESPONSE_ACCEPT, NULL); _("_Clear private data"), GTK_RESPONSE_ACCEPT, NULL);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
@ -4603,6 +4719,7 @@ static const gchar* credits_documenters[] =
static const gchar* credits_artists[] = static const gchar* credits_artists[] =
{ "Nancy Runge <nancy@twotoasts.de>", NULL }; { "Nancy Runge <nancy@twotoasts.de>", NULL };
#if !GTK_CHECK_VERSION (3, 0, 0)
static void static void
_action_about_activate_link (GtkAboutDialog* about, _action_about_activate_link (GtkAboutDialog* about,
const gchar* uri, const gchar* uri,
@ -4629,6 +4746,7 @@ _action_about_activate_email (GtkAboutDialog* about,
sokoke_show_uri (NULL, newuri ? newuri : uri, GDK_CURRENT_TIME, NULL); sokoke_show_uri (NULL, newuri ? newuri : uri, GDK_CURRENT_TIME, NULL);
g_free (newuri); g_free (newuri);
} }
#endif
static void static void
_action_about_activate (GtkAction* action, _action_about_activate (GtkAction* action,
@ -4643,8 +4761,10 @@ _action_about_activate (GtkAction* action,
"License as published by the Free Software Foundation; either " "License as published by the Free Software Foundation; either "
"version 2.1 of the License, or (at your option) any later version."); "version 2.1 of the License, or (at your option) any later version.");
#if !GTK_CHECK_VERSION (3, 0, 0)
gtk_about_dialog_set_email_hook (_action_about_activate_email, NULL, NULL); gtk_about_dialog_set_email_hook (_action_about_activate_email, NULL, NULL);
gtk_about_dialog_set_url_hook (_action_about_activate_link, browser, NULL); gtk_about_dialog_set_url_hook (_action_about_activate_link, browser, NULL);
#endif
gtk_show_about_dialog (GTK_WINDOW (browser), gtk_show_about_dialog (GTK_WINDOW (browser),
"logo-icon-name", gtk_window_get_icon_name (GTK_WINDOW (browser)), "logo-icon-name", gtk_window_get_icon_name (GTK_WINDOW (browser)),
"name", PACKAGE_NAME, "name", PACKAGE_NAME,
@ -4907,6 +5027,26 @@ midori_browser_notebook_reorder_tab_cb (GtkNotebook* notebook,
return TRUE; return TRUE;
} }
static GtkWidget*
midori_browser_notebook_create_window_cb (GtkNotebook* notebook,
MidoriView* view,
gint x,
gint y,
MidoriBrowser* browser)
{
MidoriBrowser* new_browser;
g_signal_emit (browser, signals[NEW_WINDOW], 0, NULL, &new_browser);
if (new_browser)
{
GtkWidget* new_notebook = katze_object_get_object (new_browser, "notebook");
g_object_unref (new_notebook);
gtk_window_move (GTK_WINDOW (browser), x, y);
return new_notebook;
}
else /* No MidoriApp, so this is app or private mode */
return NULL;
}
static void static void
midori_browser_switch_tab_cb (GtkWidget* menuitem, midori_browser_switch_tab_cb (GtkWidget* menuitem,
MidoriBrowser* browser) MidoriBrowser* browser)
@ -4920,21 +5060,23 @@ midori_browser_notebook_button_press_event_after_cb (GtkNotebook* notebook,
GdkEventButton* event, GdkEventButton* event,
MidoriBrowser* browser) MidoriBrowser* browser)
{ {
#if !GTK_CHECK_VERSION(3,0,0) /* TODO */
if (event->window != notebook->event_window) if (event->window != notebook->event_window)
return FALSE; return FALSE;
#endif
/* FIXME: Handle double click only when it wasn't handled by GtkNotebook */ /* FIXME: Handle double click only when it wasn't handled by GtkNotebook */
/* Open a new tab on double click or middle mouse click */ /* Open a new tab on double click or middle mouse click */
if (/*(event->type == GDK_2BUTTON_PRESS && event->button == 1) if (/*(event->type == GDK_2BUTTON_PRESS && event->button == 1)
|| */(event->type == GDK_BUTTON_PRESS && event->button == 2)) || */(event->type == GDK_BUTTON_PRESS && MIDORI_EVENT_NEW_TAB (event)))
{ {
gint n = midori_browser_add_uri (browser, ""); gint n = midori_browser_add_uri (browser, "");
midori_browser_set_current_page (browser, n); midori_browser_set_current_page (browser, n);
return TRUE; return TRUE;
} }
else if (event->type == GDK_BUTTON_PRESS && event->button == 3) else if (event->type == GDK_BUTTON_PRESS && MIDORI_EVENT_CONTEXT_MENU (event))
{ {
GtkWidget* menu = gtk_menu_new (); GtkWidget* menu = gtk_menu_new ();
GList* tabs = gtk_container_get_children (GTK_CONTAINER (notebook)); GList* tabs = gtk_container_get_children (GTK_CONTAINER (notebook));
@ -5626,7 +5768,7 @@ midori_browser_accel_switch_tab_activate_cb (GtkAccelGroup* accel_group,
GtkWidget* view; GtkWidget* view;
/* Switch to n-th tab. 9 and 0 go to the last tab. */ /* Switch to n-th tab. 9 and 0 go to the last tab. */
n = keyval - GDK_0; n = keyval - GDK_KEY_0;
browser = g_object_get_data (G_OBJECT (accel_group), "midori-browser"); browser = g_object_get_data (G_OBJECT (accel_group), "midori-browser");
if ((view = gtk_notebook_get_nth_page (GTK_NOTEBOOK (browser->notebook), if ((view = gtk_notebook_get_nth_page (GTK_NOTEBOOK (browser->notebook),
n < 9 ? n - 1 : -1))) n < 9 ? n - 1 : -1)))
@ -5785,7 +5927,7 @@ midori_browser_init (MidoriBrowser* browser)
for (i = 0; i < 10; i++) for (i = 0; i < 10; i++)
{ {
gchar* accel_path = g_strdup_printf ("<Manual>/Browser/SwitchTab%d", i); gchar* accel_path = g_strdup_printf ("<Manual>/Browser/SwitchTab%d", i);
gtk_accel_map_add_entry (accel_path, GDK_0 + i, GDK_MOD1_MASK); gtk_accel_map_add_entry (accel_path, GDK_KEY_0 + i, GDK_MOD1_MASK);
gtk_accel_group_connect_by_path (accel_group, accel_path, accel_closure); gtk_accel_group_connect_by_path (accel_group, accel_path, accel_closure);
g_free (accel_path); g_free (accel_path);
} }
@ -6001,6 +6143,9 @@ midori_browser_init (MidoriBrowser* browser)
/* Create the navigationbar */ /* Create the navigationbar */
browser->navigationbar = gtk_ui_manager_get_widget ( browser->navigationbar = gtk_ui_manager_get_widget (
ui_manager, "/toolbar_navigation"); ui_manager, "/toolbar_navigation");
#if GTK_CHECK_VERSION(3,0,0)
gtk_style_context_add_class(gtk_widget_get_style_context(browser->navigationbar), "primary-toolbar");
#endif
/* FIXME: Settings should be connected with screen changes */ /* FIXME: Settings should be connected with screen changes */
gtk_settings = gtk_widget_get_settings (GTK_WIDGET (browser)); gtk_settings = gtk_widget_get_settings (GTK_WIDGET (browser));
if (gtk_settings) if (gtk_settings)
@ -6032,6 +6177,10 @@ midori_browser_init (MidoriBrowser* browser)
/* Bookmarkbar */ /* Bookmarkbar */
browser->bookmarkbar = gtk_toolbar_new (); browser->bookmarkbar = gtk_toolbar_new ();
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_style_context_add_class (
gtk_widget_get_style_context (browser->bookmarkbar), "secondary-toolbar");
#endif
gtk_widget_set_name (browser->bookmarkbar, "MidoriBookmarkbar"); gtk_widget_set_name (browser->bookmarkbar, "MidoriBookmarkbar");
gtk_toolbar_set_icon_size (GTK_TOOLBAR (browser->bookmarkbar), gtk_toolbar_set_icon_size (GTK_TOOLBAR (browser->bookmarkbar),
GTK_ICON_SIZE_MENU); GTK_ICON_SIZE_MENU);
@ -6100,6 +6249,8 @@ midori_browser_init (MidoriBrowser* browser)
browser); browser);
g_signal_connect (browser->notebook, "reorder-tab", g_signal_connect (browser->notebook, "reorder-tab",
G_CALLBACK (midori_browser_notebook_reorder_tab_cb), NULL); G_CALLBACK (midori_browser_notebook_reorder_tab_cb), NULL);
g_signal_connect (browser->notebook, "create-window",
G_CALLBACK (midori_browser_notebook_create_window_cb), browser);
gtk_widget_show (browser->notebook); gtk_widget_show (browser->notebook);
/* Inspector container */ /* Inspector container */
@ -6237,15 +6388,19 @@ midori_browser_toolbar_item_button_press_event_cb (GtkWidget* toolitem,
GdkEventButton* event, GdkEventButton* event,
MidoriBrowser* browser) MidoriBrowser* browser)
{ {
if (event->button == 2) if (MIDORI_EVENT_NEW_TAB (event))
{ {
GtkWidget* parent = gtk_widget_get_parent (toolitem); GtkWidget* parent = gtk_widget_get_parent (toolitem);
GtkAction* action = gtk_activatable_get_related_action ( GtkAction* action = gtk_activatable_get_related_action (
GTK_ACTIVATABLE (parent)); GTK_ACTIVATABLE (parent));
g_object_set_data (G_OBJECT (action),
"midori-middle-click",
GINT_TO_POINTER (1));
return _action_navigation_activate (action, browser); return _action_navigation_activate (action, browser);
} }
else if (event->button == 3) else if (MIDORI_EVENT_CONTEXT_MENU (event))
{ {
midori_browser_toolbar_popup_context_menu_cb ( midori_browser_toolbar_popup_context_menu_cb (
GTK_IS_BIN (toolitem) && gtk_bin_get_child (GTK_BIN (toolitem)) ? GTK_IS_BIN (toolitem) && gtk_bin_get_child (GTK_BIN (toolitem)) ?
@ -6478,7 +6633,7 @@ midori_bookmarkbar_item_button_press_event_cb (GtkWidget* toolitem,
gint n; gint n;
item = (KatzeItem*)g_object_get_data (G_OBJECT (toolitem), "KatzeItem"); item = (KatzeItem*)g_object_get_data (G_OBJECT (toolitem), "KatzeItem");
if (event->button == 2) if (MIDORI_EVENT_NEW_TAB (event))
{ {
if (KATZE_ITEM_IS_BOOKMARK (item)) if (KATZE_ITEM_IS_BOOKMARK (item))
{ {
@ -6487,7 +6642,7 @@ midori_bookmarkbar_item_button_press_event_cb (GtkWidget* toolitem,
return TRUE; return TRUE;
} }
} }
else if (event->button == 3) else if (MIDORI_EVENT_CONTEXT_MENU (event))
{ {
midori_browser_bookmark_popup (toolitem, NULL, item, browser); midori_browser_bookmark_popup (toolitem, NULL, item, browser);
return TRUE; return TRUE;

View file

@ -12,11 +12,13 @@
#include "midori-locationaction.h" #include "midori-locationaction.h"
#include "gtk3-compat.h"
#include "gtkiconentry.h" #include "gtkiconentry.h"
#include "marshal.h" #include "marshal.h"
#include "sokoke.h" #include "sokoke.h"
#include "midori-browser.h" #include "midori-browser.h"
#include "midori-searchaction.h" #include "midori-searchaction.h"
#include "midori-platform.h"
#include <string.h> #include <string.h>
#include <glib/gi18n.h> #include <glib/gi18n.h>
@ -805,15 +807,14 @@ midori_location_action_key_press_event_cb (GtkEntry* entry,
switch (event->keyval) switch (event->keyval)
{ {
case GDK_ISO_Enter: case GDK_KEY_ISO_Enter:
case GDK_KP_Enter: case GDK_KEY_KP_Enter:
case GDK_Return: case GDK_KEY_Return:
is_enter = TRUE; is_enter = TRUE;
case GDK_Left: case GDK_KEY_Left:
case GDK_KP_Left: case GDK_KEY_KP_Left:
case GDK_Right: case GDK_KEY_Right:
case GDK_KP_Right: case GDK_KEY_KP_Right:
if (location_action->popup && gtk_widget_get_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;
@ -841,7 +842,7 @@ midori_location_action_key_press_event_cb (GtkEntry* entry,
g_signal_emit (action, signals[SUBMIT_URI], 0, text, g_signal_emit (action, signals[SUBMIT_URI], 0, text,
MIDORI_MOD_NEW_TAB (event->state)); MIDORI_MOD_NEW_TAB (event->state));
break; break;
case GDK_Escape: case GDK_KEY_Escape:
{ {
if (location_action->popup && gtk_widget_get_visible (location_action->popup)) if (location_action->popup && gtk_widget_get_visible (location_action->popup))
{ {
@ -855,12 +856,12 @@ midori_location_action_key_press_event_cb (GtkEntry* entry,
/* Return FALSE to allow Escape to stop loading */ /* Return FALSE to allow Escape to stop loading */
return FALSE; return FALSE;
} }
case GDK_Page_Up: case GDK_KEY_Page_Up:
case GDK_Page_Down: case GDK_KEY_Page_Down:
if (!(location_action->popup && gtk_widget_get_visible (location_action->popup))) if (!(location_action->popup && gtk_widget_get_visible (location_action->popup)))
return TRUE; return TRUE;
case GDK_Delete: case GDK_KEY_Delete:
case GDK_KP_Delete: case GDK_KEY_KP_Delete:
{ {
gint selected = location_action->completion_index; gint selected = location_action->completion_index;
GtkTreeModel* model = location_action->completion_model; GtkTreeModel* model = location_action->completion_model;
@ -901,12 +902,12 @@ midori_location_action_key_press_event_cb (GtkEntry* entry,
else else
break; break;
} }
case GDK_Down: case GDK_KEY_Down:
case GDK_KP_Down: case GDK_KEY_KP_Down:
case GDK_Up: case GDK_KEY_Up:
case GDK_KP_Up: case GDK_KEY_KP_Up:
case GDK_Tab: case GDK_KEY_Tab:
case GDK_ISO_Left_Tab: case GDK_KEY_ISO_Left_Tab:
{ {
if (location_action->popup && gtk_widget_get_visible (location_action->popup)) if (location_action->popup && gtk_widget_get_visible (location_action->popup))
{ {
@ -916,21 +917,21 @@ midori_location_action_key_press_event_cb (GtkEntry* entry,
GtkTreeIter iter; GtkTreeIter iter;
gint selected = location_action->completion_index; gint selected = location_action->completion_index;
if (event->keyval == GDK_Down || event->keyval == GDK_KP_Down if (event->keyval == GDK_KEY_Down || event->keyval == GDK_KEY_KP_Down
|| event->keyval == GDK_Tab || event->keyval == GDK_ISO_Left_Tab) || event->keyval == GDK_KEY_Tab || event->keyval == GDK_KEY_ISO_Left_Tab)
selected = MIN (selected + 1, matches -1); selected = MIN (selected + 1, matches -1);
else if (event->keyval == GDK_Up || event->keyval == GDK_KP_Up) else if (event->keyval == GDK_KEY_Up || event->keyval == GDK_KEY_KP_Up)
{ {
if (selected == -1) if (selected == -1)
selected = matches - 1; selected = matches - 1;
else else
selected = MAX (selected - 1, 0); selected = MAX (selected - 1, 0);
} }
else if (event->keyval == GDK_Page_Down) else if (event->keyval == GDK_KEY_Page_Down)
selected = MIN (selected + 14, matches -1); selected = MIN (selected + 14, matches -1);
else if (event->keyval == GDK_Page_Up) else if (event->keyval == GDK_KEY_Page_Up)
selected = MAX (selected - 14, 0); selected = MAX (selected - 14, 0);
else if (event->keyval != GDK_KP_Delete && event->keyval != GDK_Delete) else if (event->keyval != GDK_KEY_KP_Delete && event->keyval != GDK_KEY_Delete)
g_assert_not_reached (); g_assert_not_reached ();
path = gtk_tree_path_new_from_indices (selected, -1); path = gtk_tree_path_new_from_indices (selected, -1);
@ -951,7 +952,7 @@ midori_location_action_key_press_event_cb (GtkEntry* entry,
} }
/* Allow Tab to handle focus if the popup is closed */ /* Allow Tab to handle focus if the popup is closed */
if (event->keyval == GDK_Tab || event->keyval == GDK_ISO_Left_Tab) if (event->keyval == GDK_KEY_Tab || event->keyval == GDK_KEY_ISO_Left_Tab)
return FALSE; return FALSE;
return TRUE; return TRUE;
} }

View file

@ -13,6 +13,8 @@
#include "midori-view.h" #include "midori-view.h"
#include "midori-browser.h"
#include "marshal.h" #include "marshal.h"
#include "sokoke.h" #include "sokoke.h"
@ -588,6 +590,7 @@ static void
midori_panel_viewable_destroy_cb (GtkWidget* viewable, midori_panel_viewable_destroy_cb (GtkWidget* viewable,
MidoriPanel* panel) MidoriPanel* panel)
{ {
MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (panel));
gint n_pages; gint n_pages;
gchar* action_name; gchar* action_name;
GtkAction* action; GtkAction* action;
@ -601,7 +604,7 @@ midori_panel_viewable_destroy_cb (GtkWidget* viewable,
viewable, midori_panel_viewable_destroy_cb, panel); viewable, midori_panel_viewable_destroy_cb, panel);
n_pages = midori_panel_get_n_pages (panel); n_pages = midori_panel_get_n_pages (panel);
if (n_pages > 0) if (n_pages > 0 && browser && !g_object_get_data (G_OBJECT (browser), "midori-browser-destroyed"))
midori_panel_set_current_page (panel, (n_pages-1 > i) ? i : n_pages - 1); midori_panel_set_current_page (panel, (n_pages-1 > i) ? i : n_pages - 1);
action_name = g_strconcat ("PanelPage", action_name = g_strconcat ("PanelPage",
@ -706,9 +709,11 @@ midori_panel_append_page (MidoriPanel* panel,
gtk_widget_set_can_focus (scrolled, TRUE); gtk_widget_set_can_focus (scrolled, TRUE);
gtk_widget_show (scrolled); gtk_widget_show (scrolled);
gobject_class = G_OBJECT_GET_CLASS (viewable); gobject_class = G_OBJECT_GET_CLASS (viewable);
#if !GTK_CHECK_VERSION(3,0,0) /* TODO */
if (GTK_WIDGET_CLASS (gobject_class)->set_scroll_adjustments_signal) if (GTK_WIDGET_CLASS (gobject_class)->set_scroll_adjustments_signal)
widget = (GtkWidget*)viewable; widget = (GtkWidget*)viewable;
else else
#endif
{ {
widget = gtk_viewport_new (NULL, NULL); widget = gtk_viewport_new (NULL, NULL);
gtk_widget_show (widget); gtk_widget_show (widget);

37
midori/midori-platform.h Normal file
View file

@ -0,0 +1,37 @@
/*
Copyright (C) 2010-2011 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_PLATFORM_H__
#define __MIDORI_PLATFORM_H__ 1
#include <gtk/gtk.h>
/* Common behavior modifiers */
#define MIDORI_MOD_NEW_WINDOW(state) (state & GDK_SHIFT_MASK)
#define MIDORI_MOD_NEW_TAB(state) (state & GDK_CONTROL_MASK)
#define MIDORI_MOD_BACKGROUND(state) (state & GDK_SHIFT_MASK)
#define MIDORI_MOD_SCROLL(state) (state & GDK_CONTROL_MASK)
#ifdef GDK_WINDOWING_QUARTZ
#define MIDORI_EVENT_CONTEXT_MENU(evt) \
((evt->button == 3) \
|| (evt->button == 1 && (evt->state & GDK_CONTROL_MASK)))
#else
#define MIDORI_EVENT_CONTEXT_MENU(evt) \
(evt->button == 3)
#endif
#define MIDORI_EVENT_NEW_TAB(evt) \
((((GdkEventButton*)evt)->button == 1 \
&& MIDORI_MOD_NEW_TAB(((GdkEventButton*)evt)->state)) \
|| (((GdkEventButton*)evt)->button == 2))
#endif /* !__MIDORI_PLATFORM_H__ */

View file

@ -22,6 +22,11 @@
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <libsoup/soup.h> #include <libsoup/soup.h>
#if WEBKIT_CHECK_VERSION (1, 3, 11)
#define LIBSOUP_USE_UNSTABLE_REQUEST_API
#include <libsoup/soup-cache.h>
#endif
#if HAVE_LIBNOTIFY #if HAVE_LIBNOTIFY
#include <libnotify/notify.h> #include <libnotify/notify.h>
#endif #endif
@ -291,6 +296,8 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
#define SPANNED_ADD(__widget) \ #define SPANNED_ADD(__widget) \
katze_preferences_add_widget (_preferences, __widget, "spanned") katze_preferences_add_widget (_preferences, __widget, "spanned")
/* Page "General" */ /* Page "General" */
if (sokoke_is_app_or_private ())
{
PAGE_NEW (GTK_STOCK_HOME, _("Startup")); PAGE_NEW (GTK_STOCK_HOME, _("Startup"));
FRAME_NEW (NULL); FRAME_NEW (NULL);
label = katze_property_label (settings, "load-on-startup"); label = katze_property_label (settings, "load-on-startup");
@ -314,6 +321,7 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
G_CALLBACK (midori_preferences_homepage_current_clicked_cb), settings); G_CALLBACK (midori_preferences_homepage_current_clicked_cb), settings);
SPANNED_ADD (button); SPANNED_ADD (button);
} }
}
/* Page "Appearance" */ /* Page "Appearance" */
PAGE_NEW (GTK_STOCK_SELECT_FONT, _("Fonts")); PAGE_NEW (GTK_STOCK_SELECT_FONT, _("Fonts"));
@ -357,6 +365,17 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
INDENTED_ADD (button); INDENTED_ADD (button);
button = katze_property_proxy (settings, "enable-spell-checking", NULL); button = katze_property_proxy (settings, "enable-spell-checking", NULL);
SPANNED_ADD (button); SPANNED_ADD (button);
/* Disable spell check option if there are no enchant modules */
{
gchar* enchant_path = sokoke_find_lib_path ("enchant");
if (enchant_path == NULL)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE);
gtk_widget_set_sensitive (button, FALSE);
}
else
g_free (enchant_path);
}
button = katze_property_proxy (settings, "enable-scripts", NULL); button = katze_property_proxy (settings, "enable-scripts", NULL);
INDENTED_ADD (button); INDENTED_ADD (button);
button = katze_property_proxy (settings, "enable-plugins", NULL); button = katze_property_proxy (settings, "enable-plugins", NULL);
@ -374,6 +393,8 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
else else
button = katze_property_proxy (settings, "middle-click-opens-selection", NULL); button = katze_property_proxy (settings, "middle-click-opens-selection", NULL);
INDENTED_ADD (button); INDENTED_ADD (button);
button = katze_property_proxy (settings, "flash-window-on-new-bg-tabs", NULL);
SPANNED_ADD (button);
FRAME_NEW (NULL); FRAME_NEW (NULL);
button = katze_property_label (settings, "preferred-languages"); button = katze_property_label (settings, "preferred-languages");
INDENTED_ADD (button); INDENTED_ADD (button);
@ -442,6 +463,8 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
midori_preferences_notify_proxy_type_cb (settings, NULL, entry); midori_preferences_notify_proxy_type_cb (settings, NULL, entry);
#endif #endif
#if WEBKIT_CHECK_VERSION (1, 3, 11) #if WEBKIT_CHECK_VERSION (1, 3, 11)
if (soup_session_get_feature (webkit_get_default_session (), SOUP_TYPE_CACHE))
{
label = katze_property_label (settings, "maximum-cache-size"); label = katze_property_label (settings, "maximum-cache-size");
INDENTED_ADD (label); INDENTED_ADD (label);
button = katze_property_proxy (settings, "maximum-cache-size", NULL); button = katze_property_proxy (settings, "maximum-cache-size", NULL);
@ -449,6 +472,7 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
label = gtk_label_new (_("MB")); label = gtk_label_new (_("MB"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
SPANNED_ADD (label); SPANNED_ADD (label);
}
#endif #endif
label = katze_property_label (settings, "identify-as"); label = katze_property_label (settings, "identify-as");
INDENTED_ADD (label); INDENTED_ADD (label);

View file

@ -11,9 +11,11 @@
#include "midori-searchaction.h" #include "midori-searchaction.h"
#include "gtk3-compat.h"
#include "gtkiconentry.h" #include "gtkiconentry.h"
#include "marshal.h" #include "marshal.h"
#include "sokoke.h" #include "sokoke.h"
#include "midori-platform.h"
#include <string.h> #include <string.h>
#include <glib/gi18n.h> #include <glib/gi18n.h>
@ -346,19 +348,19 @@ midori_search_action_key_press_event_cb (GtkWidget* entry,
switch (event->keyval) switch (event->keyval)
{ {
case GDK_ISO_Enter: case GDK_KEY_ISO_Enter:
case GDK_KP_Enter: case GDK_KEY_KP_Enter:
case GDK_Return: case GDK_KEY_Return:
text = gtk_entry_get_text (GTK_ENTRY (entry)); text = gtk_entry_get_text (GTK_ENTRY (entry));
g_signal_emit (search_action, signals[SUBMIT], 0, text, g_signal_emit (search_action, signals[SUBMIT], 0, text,
MIDORI_MOD_NEW_TAB (event->state)); MIDORI_MOD_NEW_TAB (event->state));
search_action->last_proxy = entry; search_action->last_proxy = entry;
return TRUE; return TRUE;
case GDK_Up: case GDK_KEY_Up:
if (MIDORI_MOD_SCROLL (event->state)) if (MIDORI_MOD_SCROLL (event->state))
_midori_search_action_move_index (search_action, - 1); _midori_search_action_move_index (search_action, - 1);
return TRUE; return TRUE;
case GDK_Down: case GDK_KEY_Down:
if (MIDORI_MOD_SCROLL (event->state)) if (MIDORI_MOD_SCROLL (event->state))
_midori_search_action_move_index (search_action, + 1); _midori_search_action_move_index (search_action, + 1);
return TRUE; return TRUE;
@ -907,7 +909,11 @@ midori_search_action_get_editor (MidoriSearchAction* search_action,
dialog = gtk_dialog_new_with_buttons ( dialog = gtk_dialog_new_with_buttons (
new_engine ? _("Add search engine") : _("Edit search engine"), new_engine ? _("Add search engine") : _("Edit search engine"),
toplevel ? GTK_WINDOW (toplevel) : NULL, toplevel ? GTK_WINDOW (toplevel) : NULL,
#if GTK_CHECK_VERSION(3,0,0)
GTK_DIALOG_DESTROY_WITH_PARENT,
#else
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
#endif
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
new_engine ? GTK_STOCK_ADD : GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, new_engine ? GTK_STOCK_ADD : GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NULL); NULL);
@ -1302,7 +1308,11 @@ midori_search_action_get_dialog (MidoriSearchAction* search_action)
gtk_widget_get_toplevel (search_action->last_proxy) : NULL; gtk_widget_get_toplevel (search_action->last_proxy) : NULL;
dialog = gtk_dialog_new_with_buttons (dialog_title, dialog = gtk_dialog_new_with_buttons (dialog_title,
toplevel ? GTK_WINDOW (toplevel) : NULL, toplevel ? GTK_WINDOW (toplevel) : NULL,
#if GTK_CHECK_VERSION(3,0,0)
GTK_DIALOG_DESTROY_WITH_PARENT,
#else
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
#endif
#if !HAVE_OSX #if !HAVE_OSX
#if !HAVE_HILDON #if !HAVE_HILDON
GTK_STOCK_HELP, GTK_RESPONSE_HELP, GTK_STOCK_HELP, GTK_RESPONSE_HELP,

View file

@ -14,10 +14,12 @@
#include <config.h> #include <config.h>
#endif #endif
#include "gtk3-compat.h"
#include "midori-view.h" #include "midori-view.h"
#include "midori-stock.h" #include "midori-stock.h"
#include "midori-browser.h" #include "midori-browser.h"
#include "midori-searchaction.h" #include "midori-searchaction.h"
#include "midori-platform.h"
#include "marshal.h" #include "marshal.h"
#include "sokoke.h" #include "sokoke.h"
@ -38,9 +40,11 @@
#include <sys/utsname.h> #include <sys/utsname.h>
#endif #endif
#if !WEBKIT_CHECK_VERSION (1, 4, 3)
/* This is unstable API, so we need to declare it */ /* This is unstable API, so we need to declare it */
gchar* gchar*
webkit_web_view_get_selected_text (WebKitWebView* web_view); webkit_web_view_get_selected_text (WebKitWebView* web_view);
#endif
static void static void
midori_view_construct_web_view (MidoriView* view); midori_view_construct_web_view (MidoriView* view);
@ -54,6 +58,11 @@ static void
_midori_view_set_settings (MidoriView* view, _midori_view_set_settings (MidoriView* view,
MidoriWebSettings* settings); MidoriWebSettings* settings);
static GdkPixbuf*
midori_view_web_view_get_snapshot (GtkWidget* web_view,
gint width,
gint height);
struct _MidoriView struct _MidoriView
{ {
GtkVBox parent_instance; GtkVBox parent_instance;
@ -69,15 +78,12 @@ struct _MidoriView
MidoriLoadStatus load_status; MidoriLoadStatus load_status;
gboolean minimized; gboolean minimized;
gchar* statusbar_text; gchar* statusbar_text;
#if WEBKIT_CHECK_VERSION (1, 1, 15)
WebKitHitTestResult* hit_test; WebKitHitTestResult* hit_test;
#endif
gchar* link_uri; gchar* link_uri;
gboolean has_selection; gboolean has_selection;
gchar* selected_text; gchar* selected_text;
MidoriWebSettings* settings; MidoriWebSettings* settings;
GtkWidget* web_view; GtkWidget* web_view;
GtkWidget* thumb_view;
KatzeArray* news_feeds; KatzeArray* news_feeds;
gboolean middle_click_opens_selection; gboolean middle_click_opens_selection;
@ -198,6 +204,9 @@ enum {
static guint signals[LAST_SIGNAL]; static guint signals[LAST_SIGNAL];
static gchar* speeddial_markup = NULL;
static GtkWidget* thumb_view = NULL;
static void static void
midori_view_finalize (GObject* object); midori_view_finalize (GObject* object);
@ -1207,6 +1216,7 @@ midori_view_web_view_resource_request_cb (WebKitWebView* web_view,
} }
#define HAVE_GTK_INFO_BAR GTK_CHECK_VERSION (2, 18, 0) #define HAVE_GTK_INFO_BAR GTK_CHECK_VERSION (2, 18, 0)
#define HAVE_OFFSCREEN GTK_CHECK_VERSION (2, 20, 0)
#if HAVE_GTK_INFO_BAR #if HAVE_GTK_INFO_BAR
static void static void
@ -1389,7 +1399,6 @@ midori_view_web_view_geolocation_decision_cb (WebKitWebView* w
static void static void
midori_view_load_alternate_string (MidoriView* view, midori_view_load_alternate_string (MidoriView* view,
const gchar* data, const gchar* data,
const gchar* res_root,
const gchar* uri, const gchar* uri,
WebKitWebFrame* web_frame) WebKitWebFrame* web_frame)
{ {
@ -1417,32 +1426,23 @@ midori_view_display_error (MidoriView* view,
g_free (template_file); g_free (template_file);
if (g_file_get_contents (path, &template, NULL, NULL)) if (g_file_get_contents (path, &template, NULL, NULL))
{ {
gchar* res_root;
gchar* stock_root;
gchar* title_escaped; gchar* title_escaped;
gchar* result; gchar* result;
res_root = g_strdup ("res:/");
stock_root = g_strdup ("stock:/");
title_escaped = g_markup_escape_text (title, -1); title_escaped = g_markup_escape_text (title, -1);
result = sokoke_replace_variables (template, result = sokoke_replace_variables (template,
"{title}", title_escaped, "{title}", title_escaped,
"{message}", message, "{message}", message,
"{description}", description, "{description}", description,
"{tryagain}", try_again, "{tryagain}", try_again,
"{res}", res_root,
"{stock}", stock_root,
"{uri}", uri, "{uri}", uri,
NULL); NULL);
g_free (title_escaped); g_free (title_escaped);
g_free (template); g_free (template);
midori_view_load_alternate_string (view, midori_view_load_alternate_string (view,
result, res_root, uri, web_frame); result, uri, web_frame);
g_free (res_root);
g_free (stock_root);
g_free (result); g_free (result);
g_free (path); g_free (path);
@ -1828,6 +1828,18 @@ gtk_widget_button_press_event_cb (WebKitWebView* web_view,
return FALSE; return FALSE;
} }
static gboolean
midori_view_inspector_window_key_press_event_cb (GtkWidget* window,
GdkEventKey* event,
gpointer user_data)
{
/* Close window on Ctrl+W */
if (event->keyval == 'w' && (event->state & GDK_CONTROL_MASK))
gtk_widget_destroy (window);
return FALSE;
}
static gboolean static gboolean
gtk_widget_key_press_event_cb (WebKitWebView* web_view, gtk_widget_key_press_event_cb (WebKitWebView* web_view,
GdkEventKey* event, GdkEventKey* event,
@ -1847,7 +1859,7 @@ gtk_widget_key_press_event_cb (WebKitWebView* web_view,
/* Find links by number: . to show links, type number, Return to go */ /* Find links by number: . to show links, type number, Return to go */
if (event->keyval == '.' if (event->keyval == '.'
|| (view->find_links > -1 || (view->find_links > -1
&& (digit != -1 || event->keyval == GDK_Return || event->keyval == GDK_Escape))) && (digit != -1 || event->keyval == GDK_KEY_Return || event->keyval == GDK_KEY_Escape)))
{ {
WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (web_view); WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (web_view);
JSContextRef js_context = webkit_web_frame_get_global_context (web_frame); JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
@ -1891,17 +1903,17 @@ gtk_widget_key_press_event_cb (WebKitWebView* web_view,
NULL); NULL);
view->find_links = 0; view->find_links = 0;
} }
else if (digit != -1 && event->keyval != GDK_Return && event->keyval != GDK_Escape) else if (digit != -1 && event->keyval != GDK_KEY_Return && event->keyval != GDK_KEY_Escape)
{ {
if (view->find_links > -1) if (view->find_links > -1)
view->find_links *= 10; view->find_links *= 10;
view->find_links += digit; view->find_links += digit;
} }
else if (event->keyval == GDK_Escape) else if (event->keyval == GDK_KEY_Escape)
{ {
view->find_links = 0; view->find_links = 0;
} }
else if (event->keyval == GDK_Return) else if (event->keyval == GDK_KEY_Return)
{ {
gchar* script; gchar* script;
script = g_strdup_printf ( script = g_strdup_printf (
@ -1910,7 +1922,8 @@ gtk_widget_key_press_event_cb (WebKitWebView* web_view,
"if (return_key) {" "if (return_key) {"
" if (typeof links[i] != 'undefined')" " if (typeof links[i] != 'undefined')"
" links[i].parentNode.href; }", " links[i].parentNode.href; }",
view->find_links, event->keyval == GDK_Return); view->find_links, event->keyval == GDK_KEY_Return
);
result = sokoke_js_script_eval (js_context, script, NULL); result = sokoke_js_script_eval (js_context, script, NULL);
if (result && strstr (result, "://")) if (result && strstr (result, "://"))
{ {
@ -1951,7 +1964,7 @@ gtk_widget_key_press_event_cb (WebKitWebView* web_view,
} }
/* Find inline */ /* Find inline */
if (event->keyval == ',' || event->keyval == '/' || event->keyval == GDK_KP_Divide) if (event->keyval == ',' || event->keyval == '/' || event->keyval == GDK_KEY_KP_Divide)
character = '\0'; character = '\0';
else else
return FALSE; return FALSE;
@ -2589,8 +2602,7 @@ midori_view_populate_popup (MidoriView* view,
gtk_action_group_get_action (actions, "BookmarkAdd")); gtk_action_group_get_action (actions, "BookmarkAdd"));
gtk_menu_shell_append (menu_shell, menuitem); gtk_menu_shell_append (menu_shell, menuitem);
if (!midori_view_is_blank (view) if (!midori_view_is_blank (view) && sokoke_is_app_or_private ())
&& strcmp ("/", sokoke_set_config_dir (NULL)))
{ {
menuitem = sokoke_action_create_popup_menu_item ( menuitem = sokoke_action_create_popup_menu_item (
gtk_action_group_get_action (actions, "AddSpeedDial")); gtk_action_group_get_action (actions, "AddSpeedDial"));
@ -3075,12 +3087,6 @@ midori_view_finalize (GObject* object)
g_signal_handlers_disconnect_by_func (view->item, g_signal_handlers_disconnect_by_func (view->item,
midori_view_item_meta_data_changed, view); midori_view_item_meta_data_changed, view);
if (view->thumb_view)
{
gtk_widget_destroy (view->thumb_view);
view->thumb_view = NULL;
}
katze_assign (view->uri, NULL); katze_assign (view->uri, NULL);
katze_assign (view->title, NULL); katze_assign (view->title, NULL);
katze_object_assign (view->icon, NULL); katze_object_assign (view->icon, NULL);
@ -3430,6 +3436,9 @@ midori_view_web_inspector_construct_window (gpointer inspector,
gtk_container_add (GTK_CONTAINER (window), inspector_view); gtk_container_add (GTK_CONTAINER (window), inspector_view);
gtk_widget_show_all (window); gtk_widget_show_all (window);
g_signal_connect (window, "key-press-event",
G_CALLBACK (midori_view_inspector_window_key_press_event_cb), NULL);
/* FIXME: Update window title with URI */ /* FIXME: Update window title with URI */
} }
@ -3683,8 +3692,6 @@ prepare_speed_dial_html (MidoriView* view)
&& g_file_get_contents (file_path, &speed_dial_head, NULL, NULL)) && g_file_get_contents (file_path, &speed_dial_head, NULL, NULL))
{ {
gchar* header = sokoke_replace_variables (speed_dial_head, gchar* header = sokoke_replace_variables (speed_dial_head,
"{res}", "res:/",
"{stock}", "stock:/",
"{title}", _("Speed Dial"), "{title}", _("Speed Dial"),
"{click_to_add}", _("Click to add a shortcut"), "{click_to_add}", _("Click to add a shortcut"),
"{enter_shortcut_address}", _("Enter shortcut address"), "{enter_shortcut_address}", _("Enter shortcut address"),
@ -3745,15 +3752,12 @@ prepare_speed_dial_html (MidoriView* view)
cols * (thumb_size + 60), cols * (thumb_size + 60),
thumb_size < 160 ? "hidden" : "visible"); thumb_size < 160 ? "hidden" : "visible");
if (!katze_object_get_boolean (view->settings, "enable-scripts"))
{
g_string_append (markup, g_string_append (markup,
"<style type=\"text/css\">" "<noscript><style type=\"text/css\">"
"#content h4 span:before { visibility: hidden; }\n" "#content h4 span:before { visibility: hidden; }\n"
"div.config { visibility: hidden; }\n" "div.config { visibility: hidden; }\n"
".cross { visibility:hidden; }\n" ".cross { visibility:hidden; }\n"
".activated p { background-image: none; }</style>"); ".activated p { background-image: none; }</style></noscript>");
}
while (slot <= rows * cols) while (slot <= rows * cols)
{ {
@ -3771,7 +3775,6 @@ prepare_speed_dial_html (MidoriView* view)
if (uri && *uri && *uri != '#') if (uri && *uri && *uri != '#')
{ {
gchar* slot_id = g_strdup_printf ("s%d", slot);
gchar* title = g_key_file_get_string (key_file, dial_entry, "title", NULL); gchar* title = g_key_file_get_string (key_file, dial_entry, "title", NULL);
gchar* thumb_file = sokoke_build_thumbnail_path (uri); gchar* thumb_file = sokoke_build_thumbnail_path (uri);
gchar* encoded; gchar* encoded;
@ -3788,7 +3791,6 @@ prepare_speed_dial_html (MidoriView* view)
{ {
encoded = g_strdup (""); encoded = g_strdup ("");
} }
g_free (slot_id);
g_free (thumb_file); g_free (thumb_file);
g_string_append_printf (markup, g_string_append_printf (markup,
@ -3864,7 +3866,11 @@ midori_view_set_uri (MidoriView* view,
katze_assign (view->uri, g_strdup ("")); katze_assign (view->uri, g_strdup (""));
katze_item_set_uri (view->item, ""); katze_item_set_uri (view->item, "");
data = prepare_speed_dial_html (view); if (speeddial_markup == NULL)
speeddial_markup = prepare_speed_dial_html (view);
midori_view_load_alternate_string (view,
speeddial_markup, "about:blank", NULL);
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
if (g_getenv ("MIDORI_STARTTIME") != NULL) if (g_getenv ("MIDORI_STARTTIME") != NULL)
@ -3873,9 +3879,6 @@ midori_view_set_uri (MidoriView* view,
g_timer_destroy (timer); g_timer_destroy (timer);
} }
#endif #endif
midori_view_load_alternate_string (view,
data, "res:/", "about:blank", NULL);
g_free (data);
} }
/* This is not prefectly elegant, but creating /* This is not prefectly elegant, but creating
special pages inline is the simplest solution. */ special pages inline is the simplest solution. */
@ -3885,18 +3888,13 @@ midori_view_set_uri (MidoriView* view,
if (!strncmp (uri, "error:nodocs ", 13)) if (!strncmp (uri, "error:nodocs ", 13))
{ {
gchar* title; gchar* title;
gchar* logo_path;
gchar* logo_uri;
katze_assign (view->uri, g_strdup (&uri[13])); katze_assign (view->uri, g_strdup (&uri[13]));
title = g_strdup_printf (_("No documentation installed")); title = g_strdup_printf (_("No documentation installed"));
logo_path = sokoke_find_data_filename ("midori/res/logo-shade.png");
logo_uri = g_filename_to_uri (logo_path, NULL, NULL);
g_free (logo_path);
data = g_strdup_printf ( data = g_strdup_printf (
"<html><head><title>%s</title></head>" "<html><head><title>%s</title></head>"
"<body><h1>%s</h1>" "<body><h1>%s</h1>"
"<img src=\"%s\" " "<img src=\"res://logo-shade.png\" "
"style=\"position: absolute; right: 15px; bottom: 15px; z-index: -9;\">" "style=\"position: absolute; right: 15px; bottom: 15px; z-index: -9;\">"
"<p />There is no documentation installed at %s. " "<p />There is no documentation installed at %s. "
"You may want to ask your distribution or " "You may want to ask your distribution or "
@ -3904,9 +3902,8 @@ midori_view_set_uri (MidoriView* view,
"verify that the build is setup properly. " "verify that the build is setup properly. "
"<a href=\"http://wiki.xfce.org/midori/faq\">View the FAQ online</a>" "<a href=\"http://wiki.xfce.org/midori/faq\">View the FAQ online</a>"
"</body></html>", "</body></html>",
title, title, logo_uri, view->uri); title, title, view->uri);
g_free (title); g_free (title);
g_free (logo_uri);
} }
else if (!strcmp (uri, "about:") || !strcmp (uri, "about:version")) else if (!strcmp (uri, "about:") || !strcmp (uri, "about:version"))
{ {
@ -3991,7 +3988,7 @@ midori_view_set_uri (MidoriView* view,
katze_assign (view->uri, g_strdup (uri)); katze_assign (view->uri, g_strdup (uri));
data = g_strdup_printf ( data = g_strdup_printf (
"<html><head><title>%s</title></head><body><h1>%s</h1>" "<html><head><title>%s</title></head><body><h1>%s</h1>"
"<img src=\"file://" MDATADIR "/midori/res/logo-shade.png\" " "<img src=\"res://logo-shade.png\" "
"style=\"position: absolute; right: 15px; bottom: 15px; z-index: -9;\">" "style=\"position: absolute; right: 15px; bottom: 15px; z-index: -9;\">"
"</body></html>", view->uri, view->uri); "</body></html>", view->uri, view->uri);
} }
@ -4189,10 +4186,33 @@ midori_view_get_link_uri (MidoriView* view)
gboolean gboolean
midori_view_has_selection (MidoriView* view) midori_view_has_selection (MidoriView* view)
{ {
#if WEBKIT_CHECK_VERSION (1, 4, 3)
WebKitDOMDocument* doc;
WebKitDOMDOMWindow* window;
WebKitDOMDOMSelection* selection;
WebKitDOMRange* range;
#endif
g_return_val_if_fail (MIDORI_IS_VIEW (view), FALSE); g_return_val_if_fail (MIDORI_IS_VIEW (view), FALSE);
#if WEBKIT_CHECK_VERSION (1, 4, 3)
doc = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (view->web_view));
window = webkit_dom_document_get_default_view (doc);
selection = webkit_dom_dom_window_get_selection (window);
if (selection == NULL)
return FALSE;
range = webkit_dom_dom_selection_get_range_at (selection, 0, NULL);
if (range == NULL)
return FALSE;
katze_assign (view->selected_text, webkit_dom_range_get_text (range));
#else
katze_assign (view->selected_text, webkit_web_view_get_selected_text ( katze_assign (view->selected_text, webkit_web_view_get_selected_text (
WEBKIT_WEB_VIEW (view->web_view))); WEBKIT_WEB_VIEW (view->web_view)));
#endif
if (view->selected_text && *view->selected_text) if (view->selected_text && *view->selected_text)
return TRUE; return TRUE;
else else
@ -4428,7 +4448,7 @@ midori_view_tab_label_button_press_event (GtkWidget* tab_label,
gtk_widget_destroy (widget); gtk_widget_destroy (widget);
return TRUE; return TRUE;
} }
else if (event->button == 3) else if (MIDORI_EVENT_CONTEXT_MENU (event))
{ {
/* Show a context menu on right click */ /* Show a context menu on right click */
GtkWidget* menu = midori_view_get_tab_menu (MIDORI_VIEW (widget)); GtkWidget* menu = midori_view_get_tab_menu (MIDORI_VIEW (widget));
@ -4500,7 +4520,11 @@ gtk_box_repack (GtkBox* box,
static void static void
midori_view_tab_label_parent_set (GtkWidget* tab_label, midori_view_tab_label_parent_set (GtkWidget* tab_label,
#if GTK_CHECK_VERSION(3,0,0)
GObject* old_parent,
#else
GtkObject* old_parent, GtkObject* old_parent,
#endif
MidoriView* view) MidoriView* view)
{ {
GtkWidget* parent; GtkWidget* parent;
@ -4534,13 +4558,16 @@ midori_view_tab_label_parent_set (GtkWidget* tab_label,
if (old_angle != angle) if (old_angle != angle)
{ {
GtkWidget* align;
if (angle == 0.0) if (angle == 0.0)
box = gtk_hbox_new (FALSE, 1); box = gtk_hbox_new (FALSE, 1);
else else
box = gtk_vbox_new (FALSE, 1); box = gtk_vbox_new (FALSE, 1);
gtk_box_repack (GTK_BOX (box), view->tab_icon); gtk_box_repack (GTK_BOX (box), view->tab_icon);
gtk_box_repack (GTK_BOX (box), view->tab_title); gtk_box_repack (GTK_BOX (box), view->tab_title);
gtk_box_repack (GTK_BOX (box), view->tab_close); align = gtk_widget_get_parent (view->tab_close);
gtk_box_repack (GTK_BOX (box), align);
gtk_container_remove (GTK_CONTAINER (tab_label), gtk_container_remove (GTK_CONTAINER (tab_label),
gtk_bin_get_child (GTK_BIN (tab_label))); gtk_bin_get_child (GTK_BIN (tab_label)));
@ -5211,20 +5238,29 @@ midori_view_get_snapshot (MidoriView* view,
gint width, gint width,
gint height) gint height)
{ {
GtkWidget* web_view; g_return_val_if_fail (MIDORI_IS_VIEW (view), NULL);
return midori_view_web_view_get_snapshot ((GtkWidget*)view->web_view, width, height);
}
static GdkPixbuf*
midori_view_web_view_get_snapshot (GtkWidget* web_view,
gint width,
gint height)
{
GdkWindow* window; GdkWindow* window;
GtkAllocation allocation; GtkAllocation allocation;
gboolean fast; gboolean fast;
gint x, y, w, h; gint x, y, w, h;
GdkRectangle rect; GdkRectangle rect;
#if !GTK_CHECK_VERSION (3, 0, 0)
GdkPixmap* pixmap; GdkPixmap* pixmap;
GdkEvent event; GdkEvent event;
gboolean result; gboolean result;
GdkColormap* colormap; GdkColormap* colormap;
#endif
GdkPixbuf* pixbuf; GdkPixbuf* pixbuf;
g_return_val_if_fail (MIDORI_IS_VIEW (view), NULL); g_return_val_if_fail (WEBKIT_IS_WEB_VIEW (web_view), NULL);
web_view = view->web_view;
window = gtk_widget_get_window (web_view); window = gtk_widget_get_window (web_view);
g_return_val_if_fail (window != NULL, NULL); g_return_val_if_fail (window != NULL, NULL);
@ -5247,6 +5283,12 @@ midori_view_get_snapshot (MidoriView* view,
fast = TRUE; fast = TRUE;
} }
#if GTK_CHECK_VERSION (3, 0, 0)
cairo_t* cr = gdk_cairo_create (window);
gtk_widget_draw (web_view, cr);
pixbuf = NULL; /* TODO */
cairo_destroy (cr);
#else
rect.x = x; rect.x = x;
rect.y = y; rect.y = y;
rect.width = w; rect.width = w;
@ -5269,6 +5311,7 @@ midori_view_get_snapshot (MidoriView* view,
pixbuf = gdk_pixbuf_get_from_drawable (NULL, pixmap, colormap, 0, 0, pixbuf = gdk_pixbuf_get_from_drawable (NULL, pixmap, colormap, 0, 0,
0, 0, rect.width, rect.height); 0, 0, rect.width, rect.height);
g_object_unref (pixmap); g_object_unref (pixmap);
#endif
if (width || height) if (width || height)
{ {
@ -5320,23 +5363,32 @@ midori_view_get_security (MidoriView* view)
} }
static void static void
thumb_view_load_status_cb (MidoriView* thumb_view, thumb_view_load_status_cb (WebKitWebView* thumb_view_,
GParamSpec* pspec, GParamSpec* pspec,
MidoriView* view) MidoriView* view)
{ {
GdkPixbuf* img; GdkPixbuf* img;
#if HAVE_OFFSCREEN
GdkPixbuf* pixbuf_scaled;
#endif
gchar* file_path; gchar* file_path;
gchar* thumb_dir; gchar* thumb_dir;
gchar* thumb_uri; gchar* thumb_uri;
MidoriBrowser* browser; MidoriBrowser* browser;
gint i; GKeyFile* key_file;
GtkWidget* tab;
if (midori_view_get_load_status (thumb_view) != MIDORI_LOAD_FINISHED) if (webkit_web_view_get_load_status (thumb_view_) != WEBKIT_LOAD_FINISHED)
return; return;
gtk_widget_realize (midori_view_get_web_view (MIDORI_VIEW (thumb_view))); #if HAVE_OFFSCREEN
img = midori_view_get_snapshot (MIDORI_VIEW (thumb_view), 240, 160); img = gtk_offscreen_window_get_pixbuf (GTK_OFFSCREEN_WINDOW (
gtk_widget_get_parent (GTK_WIDGET (thumb_view))));
pixbuf_scaled = gdk_pixbuf_scale_simple (img, 240, 160, GDK_INTERP_TILES);
katze_object_assign (img, pixbuf_scaled);
#else
gtk_widget_realize (thumb_view);
img = midori_view_web_view_get_snapshot (thumb_view, 240, 160);
#endif
thumb_uri = g_object_get_data (G_OBJECT (thumb_view), "thumb-uri"); thumb_uri = g_object_get_data (G_OBJECT (thumb_view), "thumb-uri");
file_path = sokoke_build_thumbnail_path (thumb_uri); file_path = sokoke_build_thumbnail_path (thumb_uri);
thumb_dir = g_build_path (G_DIR_SEPARATOR_S, g_get_user_cache_dir (), thumb_dir = g_build_path (G_DIR_SEPARATOR_S, g_get_user_cache_dir (),
@ -5357,16 +5409,14 @@ thumb_view_load_status_cb (MidoriView* thumb_view,
thumb_view, thumb_view_load_status_cb, view); thumb_view, thumb_view_load_status_cb, view);
/* Destroying the view here may trigger a WebKitGTK+ 1.1.14 bug */ /* Destroying the view here may trigger a WebKitGTK+ 1.1.14 bug */
#if !WEBKIT_CHECK_VERSION (1, 1, 14) || WEBKIT_CHECK_VERSION (1, 1, 15) #if 0
gtk_widget_destroy (GTK_WIDGET (thumb_view)); gtk_widget_destroy (GTK_WIDGET (thumb_view));
view->thumb_view = NULL; thumb_view = NULL;
#endif #endif
browser = midori_browser_get_for_widget (GTK_WIDGET (view)); browser = midori_browser_get_for_widget (GTK_WIDGET (view));
i = 0; g_object_get (browser, "speed-dial", &key_file, NULL);
while ((tab = midori_browser_get_nth_tab (browser, i++))) midori_view_save_speed_dial_config (view, key_file);
if (midori_view_is_blank (MIDORI_VIEW (tab)))
midori_view_reload (MIDORI_VIEW (tab), FALSE);
} }
/** /**
@ -5380,9 +5430,9 @@ midori_view_speed_dial_get_thumb (MidoriView* view,
gchar* dom_id, gchar* dom_id,
gchar* url) gchar* url)
{ {
GtkWidget* thumb_view; WebKitWebSettings* settings;
MidoriWebSettings* settings;
GtkWidget* browser; GtkWidget* browser;
#if !HAVE_OFFSCREEN
GtkWidget* notebook; GtkWidget* notebook;
GtkWidget* label; GtkWidget* label;
@ -5397,26 +5447,43 @@ midori_view_speed_dial_get_thumb (MidoriView* view,
notebook = katze_object_get_object (browser, "notebook"); notebook = katze_object_get_object (browser, "notebook");
if (!notebook) if (!notebook)
return; return;
#endif
if (!view->thumb_view) if (!thumb_view)
{ {
view->thumb_view = midori_view_new_with_title (NULL, NULL, FALSE); thumb_view = webkit_web_view_new ();
gtk_container_add (GTK_CONTAINER (notebook), view->thumb_view); #if HAVE_OFFSCREEN
browser = gtk_offscreen_window_new ();
gtk_container_add (GTK_CONTAINER (browser), thumb_view);
gtk_widget_set_size_request (thumb_view, 800, 600);
gtk_widget_show_all (browser);
#else
gtk_container_add (GTK_CONTAINER (notebook), thumb_view);
g_signal_connect (thumb_view, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&thumb_view);
/* We use an empty label. It's not invisible but at least hard to spot. */ /* We use an empty label. It's not invisible but at least hard to spot. */
label = gtk_event_box_new (); label = gtk_event_box_new ();
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), view->thumb_view, label); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), thumb_view, label);
gtk_widget_show (view->thumb_view); #endif
gtk_widget_show (thumb_view);
} }
#if !HAVE_OFFSCREEN
g_object_unref (notebook); g_object_unref (notebook);
thumb_view = view->thumb_view; #endif
settings = g_object_new (MIDORI_TYPE_WEB_SETTINGS, "enable-scripts", FALSE, settings = g_object_new (WEBKIT_TYPE_WEB_SETTINGS, "enable-scripts", FALSE,
"enable-plugins", FALSE, "auto-load-images", TRUE, NULL); "enable-plugins", FALSE, "auto-load-images", TRUE,
_midori_view_set_settings (MIDORI_VIEW (thumb_view), settings); "enable-html5-database", FALSE, "enable-html5-local-storage", FALSE,
#if WEBKIT_CHECK_VERSION (1, 1, 22)
"enable-java-applet", FALSE,
#endif
NULL);
webkit_web_view_set_settings (WEBKIT_WEB_VIEW (thumb_view), settings);
g_object_set_data (G_OBJECT (thumb_view), "thumb-uri", url); g_object_set_data (G_OBJECT (thumb_view), "thumb-uri", url);
g_signal_connect (thumb_view, "notify::load-status", g_signal_connect (thumb_view, "notify::load-status",
G_CALLBACK (thumb_view_load_status_cb), view); G_CALLBACK (thumb_view_load_status_cb), view);
midori_view_set_uri (MIDORI_VIEW (thumb_view), url); webkit_web_view_open (WEBKIT_WEB_VIEW (thumb_view), url);
} }
/** /**
@ -5432,13 +5499,10 @@ midori_view_speed_dial_save (MidoriView* view,
const gchar* message) const gchar* message)
{ {
gchar* action; gchar* action;
gchar* config_file;
GKeyFile* key_file; GKeyFile* key_file;
MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (view)); MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (view));
gchar* msg = g_strdup (message + 16); gchar* msg = g_strdup (message + 16);
gchar** parts = g_strsplit (msg, " ", 4); gchar** parts = g_strsplit (msg, " ", 4);
gint i;
GtkWidget* tab;
g_object_get (browser, "speed-dial", &key_file, NULL); g_object_get (browser, "speed-dial", &key_file, NULL);
action = parts[0]; action = parts[0];
@ -5512,15 +5576,29 @@ midori_view_speed_dial_save (MidoriView* view,
g_free (dial_id); g_free (dial_id);
} }
midori_view_save_speed_dial_config (view, key_file);
g_free (msg);
g_free (action);
}
void
midori_view_save_speed_dial_config (MidoriView* view,
GKeyFile* key_file)
{
gchar* config_file;
guint i = 0;
MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (view));
GtkWidget* tab;
config_file = g_build_filename (sokoke_set_config_dir (NULL), "speeddial", NULL); config_file = g_build_filename (sokoke_set_config_dir (NULL), "speeddial", NULL);
sokoke_key_file_save_to_file (key_file, config_file, NULL); sokoke_key_file_save_to_file (key_file, config_file, NULL);
g_free (config_file);
katze_assign (speeddial_markup, prepare_speed_dial_html (view));
i = 0;
while ((tab = midori_browser_get_nth_tab (browser, i++))) while ((tab = midori_browser_get_nth_tab (browser, i++)))
if (midori_view_is_blank (MIDORI_VIEW (tab))) if (midori_view_is_blank (MIDORI_VIEW (tab)))
midori_view_reload (MIDORI_VIEW (tab), FALSE); midori_view_reload (MIDORI_VIEW (tab), FALSE);
g_free (msg);
g_free (action);
g_free (config_file);
} }

View file

@ -248,6 +248,10 @@ midori_view_add_info_bar (MidoriView* view,
const gchar* first_button_text, const gchar* first_button_text,
...); ...);
void
midori_view_save_speed_dial_config (MidoriView* view,
GKeyFile* key_file);
G_END_DECLS G_END_DECLS
#endif /* __MIDORI_VIEW_H__ */ #endif /* __MIDORI_VIEW_H__ */

View file

@ -90,6 +90,7 @@ struct _MidoriWebSettings
gboolean enable_dns_prefetching; gboolean enable_dns_prefetching;
#endif #endif
gboolean strip_referer; gboolean strip_referer;
gboolean flash_window_on_bg_tabs;
}; };
struct _MidoriWebSettingsClass struct _MidoriWebSettingsClass
@ -140,6 +141,7 @@ enum
PROP_OPEN_TABS_IN_THE_BACKGROUND, PROP_OPEN_TABS_IN_THE_BACKGROUND,
PROP_OPEN_TABS_NEXT_TO_CURRENT, PROP_OPEN_TABS_NEXT_TO_CURRENT,
PROP_OPEN_POPUPS_IN_TABS, PROP_OPEN_POPUPS_IN_TABS,
PROP_FLASH_WINDOW_ON_BG_TABS,
PROP_AUTO_LOAD_IMAGES, PROP_AUTO_LOAD_IMAGES,
PROP_ENABLE_SCRIPTS, PROP_ENABLE_SCRIPTS,
@ -167,7 +169,7 @@ enum
PROP_CLEAR_PRIVATE_DATA, PROP_CLEAR_PRIVATE_DATA,
PROP_CLEAR_DATA, PROP_CLEAR_DATA,
PROP_ENABLE_DNS_PREFETCHING, PROP_ENABLE_DNS_PREFETCHING,
PROP_STRIP_REFERER PROP_STRIP_REFERER,
}; };
GType GType
@ -288,7 +290,8 @@ midori_identity_get_type (void)
if (!type) if (!type)
{ {
static const GEnumValue values[] = { static const GEnumValue values[] = {
{ MIDORI_IDENT_MIDORI, "MIDORI_IDENT_MIDORI", N_("Midori") }, { MIDORI_IDENT_MIDORI, "MIDORI_IDENT_MIDORI", N_("_Automatic") },
{ MIDORI_IDENT_GENUINE, "MIDORI_IDENT_GENUINE", N_("Midori") },
{ MIDORI_IDENT_SAFARI, "MIDORI_IDENT_SAFARI", N_("Safari") }, { MIDORI_IDENT_SAFARI, "MIDORI_IDENT_SAFARI", N_("Safari") },
{ MIDORI_IDENT_IPHONE, "MIDORI_IDENT_IPHONE", N_("iPhone") }, { MIDORI_IDENT_IPHONE, "MIDORI_IDENT_IPHONE", N_("iPhone") },
{ MIDORI_IDENT_FIREFOX, "MIDORI_IDENT_FIREFOX", N_("Firefox") }, { MIDORI_IDENT_FIREFOX, "MIDORI_IDENT_FIREFOX", N_("Firefox") },
@ -715,8 +718,13 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
"enable-plugins", "enable-plugins",
_("Enable Netscape plugins"), _("Enable Netscape plugins"),
_("Enable embedded Netscape plugin objects"), _("Enable embedded Netscape plugin objects"),
#ifdef G_OS_WIN32
FALSE,
G_PARAM_READABLE));
#else
TRUE, TRUE,
flags)); flags));
#endif
/* Override properties to override defaults */ /* Override properties to override defaults */
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_ENABLE_DEVELOPER_EXTRAS, PROP_ENABLE_DEVELOPER_EXTRAS,
@ -763,6 +771,14 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
TRUE, TRUE,
flags)); flags));
#endif #endif
g_object_class_install_property (gobject_class,
PROP_FLASH_WINDOW_ON_BG_TABS,
g_param_spec_boolean (
"flash-window-on-new-bg-tabs",
_("Flash window on background tabs"),
_("Flash the browser window if a new tab was opened in the background"),
FALSE,
flags));
/** /**
* MidoriWebSettings:zoom-text-and-images: * MidoriWebSettings:zoom-text-and-images:
@ -1081,7 +1097,8 @@ get_sys_name (void)
#endif #endif
static gchar* static gchar*
generate_ident_string (MidoriIdentity identify_as) generate_ident_string (MidoriWebSettings* web_settings,
MidoriIdentity identify_as)
{ {
const gchar* platform = const gchar* platform =
#if HAVE_HILDON #if HAVE_HILDON
@ -1118,12 +1135,19 @@ generate_ident_string (MidoriIdentity identify_as)
const int webcore_major = WEBKIT_USER_AGENT_MAJOR_VERSION; const int webcore_major = WEBKIT_USER_AGENT_MAJOR_VERSION;
const int webcore_minor = WEBKIT_USER_AGENT_MINOR_VERSION; const int webcore_minor = WEBKIT_USER_AGENT_MINOR_VERSION;
#if WEBKIT_CHECK_VERSION (1, 1, 18)
g_object_set (web_settings, "enable-site-specific-quirks",
identify_as != MIDORI_IDENT_GENUINE, NULL);
#endif
switch (identify_as) switch (identify_as)
{ {
case MIDORI_IDENT_MIDORI: case MIDORI_IDENT_GENUINE:
return g_strdup_printf ("Mozilla/5.0 (%s %s) AppleWebKit/%d.%d+ %s", return g_strdup_printf ("Mozilla/5.0 (%s %s) AppleWebKit/%d.%d+ %s",
platform, os, webcore_major, webcore_minor, appname); platform, os, webcore_major, webcore_minor, appname);
case MIDORI_IDENT_MIDORI:
case MIDORI_IDENT_SAFARI: case MIDORI_IDENT_SAFARI:
g_object_set (web_settings, "enable-site-specific-quirks", TRUE, NULL);
return g_strdup_printf ("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; %s) " return g_strdup_printf ("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; %s) "
"AppleWebKit/%d+ (KHTML, like Gecko) Version/5.0 Safari/%d.%d+ %s", "AppleWebKit/%d+ (KHTML, like Gecko) Version/5.0 Safari/%d.%d+ %s",
lang, webcore_major, webcore_major, webcore_minor, appname); lang, webcore_major, webcore_major, webcore_minor, appname);
@ -1350,7 +1374,7 @@ midori_web_settings_set_property (GObject* object,
web_settings->identify_as = g_value_get_enum (value); web_settings->identify_as = g_value_get_enum (value);
if (web_settings->identify_as != MIDORI_IDENT_CUSTOM) if (web_settings->identify_as != MIDORI_IDENT_CUSTOM)
{ {
gchar* string = generate_ident_string (web_settings->identify_as); gchar* string = generate_ident_string (web_settings, web_settings->identify_as);
katze_assign (web_settings->ident_string, string); katze_assign (web_settings->ident_string, string);
g_object_set (web_settings, "user-agent", string, NULL); g_object_set (web_settings, "user-agent", string, NULL);
} }
@ -1380,6 +1404,9 @@ midori_web_settings_set_property (GObject* object,
case PROP_STRIP_REFERER: case PROP_STRIP_REFERER:
web_settings->strip_referer = g_value_get_boolean (value); web_settings->strip_referer = g_value_get_boolean (value);
break; break;
case PROP_FLASH_WINDOW_ON_BG_TABS:
web_settings->flash_window_on_bg_tabs = g_value_get_boolean (value);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -1607,7 +1634,7 @@ midori_web_settings_get_property (GObject* object,
case PROP_USER_AGENT: case PROP_USER_AGENT:
if (!g_strcmp0 (web_settings->ident_string, "")) if (!g_strcmp0 (web_settings->ident_string, ""))
{ {
gchar* string = generate_ident_string (web_settings->identify_as); gchar* string = generate_ident_string (web_settings, web_settings->identify_as);
katze_assign (web_settings->ident_string, string); katze_assign (web_settings->ident_string, string);
} }
g_value_set_string (value, web_settings->ident_string); g_value_set_string (value, web_settings->ident_string);
@ -1629,6 +1656,9 @@ midori_web_settings_get_property (GObject* object,
case PROP_STRIP_REFERER: case PROP_STRIP_REFERER:
g_value_set_boolean (value, web_settings->strip_referer); g_value_set_boolean (value, web_settings->strip_referer);
break; break;
case PROP_FLASH_WINDOW_ON_BG_TABS:
g_value_set_boolean (value, web_settings->flash_window_on_bg_tabs);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;

View file

@ -137,7 +137,8 @@ midori_proxy_get_type (void) G_GNUC_CONST;
typedef enum typedef enum
{ {
MIDORI_IDENT_MIDORI, MIDORI_IDENT_MIDORI /* Automatic */,
MIDORI_IDENT_GENUINE /* Midori */,
MIDORI_IDENT_SAFARI, MIDORI_IDENT_SAFARI,
MIDORI_IDENT_IPHONE, MIDORI_IDENT_IPHONE,
MIDORI_IDENT_FIREFOX, MIDORI_IDENT_FIREFOX,

View file

@ -24,6 +24,7 @@
#include "midori-view.h" #include "midori-view.h"
#include "midori-viewable.h" #include "midori-viewable.h"
#include "midori-websettings.h" #include "midori-websettings.h"
#include "midori-platform.h"
/* For convenience, include localization header */ /* For convenience, include localization header */
#include <glib/gi18n-lib.h> #include <glib/gi18n-lib.h>

View file

@ -12,6 +12,7 @@
*/ */
#include "sokoke.h" #include "sokoke.h"
#include "gtk3-compat.h"
#if HAVE_CONFIG_H #if HAVE_CONFIG_H
#include <config.h> #include <config.h>
@ -601,8 +602,12 @@ sokoke_spawn_app (const gchar* uri,
gchar* quoted = g_shell_quote (executable); gchar* quoted = g_shell_quote (executable);
gchar* command; gchar* command;
if (private) if (private)
command = g_strconcat (quoted, " -c ", sokoke_set_config_dir (NULL), {
gchar* quoted_config = g_shell_quote (sokoke_set_config_dir (NULL));
command = g_strconcat (quoted, " -c ", quoted_config,
" -p", NULL); " -p", NULL);
g_free (quoted_config);
}
else else
command = g_strconcat (quoted, " -a", NULL); command = g_strconcat (quoted, " -a", NULL);
g_free (quoted); g_free (quoted);
@ -1011,7 +1016,7 @@ sokoke_combo_box_add_strings (GtkComboBox* combobox,
va_start (args, label_first); va_start (args, label_first);
for (label = label_first; label; label = va_arg (args, const gchar*)) for (label = label_first; label; label = va_arg (args, const gchar*))
gtk_combo_box_append_text (combobox, label); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), label);
va_end (args); va_end (args);
} }
@ -1509,15 +1514,15 @@ sokoke_register_stock_items (void)
{ STOCK_TRANSFER, NULL, 0, 0, GTK_STOCK_SAVE }, { STOCK_TRANSFER, NULL, 0, 0, GTK_STOCK_SAVE },
{ STOCK_BOOKMARK, N_("_Bookmark"), 0, 0, GTK_STOCK_FILE }, { STOCK_BOOKMARK, N_("_Bookmark"), 0, 0, GTK_STOCK_FILE },
{ STOCK_BOOKMARKS, N_("_Bookmarks"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_B, GTK_STOCK_DIRECTORY }, { STOCK_BOOKMARKS, N_("_Bookmarks"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_KEY_B, GTK_STOCK_DIRECTORY },
{ STOCK_BOOKMARK_ADD, N_("Add Boo_kmark"), 0, 0, GTK_STOCK_ADD }, { STOCK_BOOKMARK_ADD, N_("Add Boo_kmark"), 0, 0, GTK_STOCK_ADD },
{ STOCK_CONSOLE, N_("_Console"), 0, 0, GTK_STOCK_DIALOG_WARNING }, { STOCK_CONSOLE, N_("_Console"), 0, 0, GTK_STOCK_DIALOG_WARNING },
{ STOCK_EXTENSIONS, N_("_Extensions"), 0, 0, GTK_STOCK_CONVERT }, { STOCK_EXTENSIONS, N_("_Extensions"), 0, 0, GTK_STOCK_CONVERT },
{ STOCK_HISTORY, N_("_History"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_H, GTK_STOCK_SORT_ASCENDING }, { STOCK_HISTORY, N_("_History"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_KEY_H, GTK_STOCK_SORT_ASCENDING },
{ STOCK_HOMEPAGE, N_("_Homepage"), 0, 0, GTK_STOCK_HOME }, { STOCK_HOMEPAGE, N_("_Homepage"), 0, 0, GTK_STOCK_HOME },
{ STOCK_SCRIPTS, N_("_Userscripts"), 0, 0, GTK_STOCK_EXECUTE }, { STOCK_SCRIPTS, N_("_Userscripts"), 0, 0, GTK_STOCK_EXECUTE },
{ STOCK_TAB_NEW, N_("New _Tab"), 0, 0, GTK_STOCK_ADD }, { STOCK_TAB_NEW, N_("New _Tab"), 0, 0, GTK_STOCK_ADD },
{ STOCK_TRANSFERS, N_("_Transfers"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_J, GTK_STOCK_SAVE }, { STOCK_TRANSFERS, N_("_Transfers"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_KEY_J, GTK_STOCK_SAVE },
{ 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 },
@ -1625,6 +1630,12 @@ sokoke_set_config_dir (const gchar* new_config_dir)
return config_dir; return config_dir;
} }
gboolean
sokoke_is_app_or_private (void)
{
return strcmp ("/", sokoke_set_config_dir (NULL));
}
/** /**
* sokoke_remove_path: * sokoke_remove_path:
* @path: an absolute path * @path: an absolute path
@ -1705,6 +1716,45 @@ sokoke_find_config_filename (const gchar* folder,
return g_build_filename (SYSCONFDIR, "xdg", PACKAGE_NAME, folder, filename, NULL); return g_build_filename (SYSCONFDIR, "xdg", PACKAGE_NAME, folder, filename, NULL);
} }
/**
* sokoke_find_lib_path:
* @folder: the lib subfolder
*
* Looks for the specified folder in the lib directories.
*
* Return value: a newly allocated full path, or %NULL
**/
gchar* sokoke_find_lib_path (const gchar* folder)
{
#ifdef G_OS_WIN32
gchar* path = g_win32_get_package_installation_directory_of_module (NULL);
gchar* lib_path = g_build_filename (path, "lib", folder ? folder : "", NULL);
g_free (path);
if (g_access (lib_path, F_OK) == 0)
return lib_path;
#else
const gchar* lib_dirs[] =
{
LIBDIR,
"/usr/local/lib",
"/usr/lib",
NULL
};
guint i;
for (i = 0; i < G_N_ELEMENTS (lib_dirs); i++)
{
gchar* lib_path = g_build_filename (lib_dirs[i], folder ? folder : "", NULL);
if (g_access (lib_path, F_OK) == 0)
return lib_path;
else
g_free (lib_path);
}
#endif
return NULL;
}
/** /**
* sokoke_find_data_filename: * sokoke_find_data_filename:
* @filename: a filename or relative path * @filename: a filename or relative path
@ -1816,7 +1866,7 @@ sokoke_window_activate_key (GtkWindow* window,
/* Hack to allow Ctrl + Shift + Tab */ /* Hack to allow Ctrl + Shift + Tab */
if (event->keyval == 65056) if (event->keyval == 65056)
event->keyval = GDK_Tab; event->keyval = GDK_KEY_Tab;
/* We don't use gtk_accel_groups_activate because it refuses to /* We don't use gtk_accel_groups_activate because it refuses to
activate anything that gtk_accelerator_valid doesn't like. */ activate anything that gtk_accelerator_valid doesn't like. */

View file

@ -13,12 +13,6 @@
#ifndef __SOKOKE_H__ #ifndef __SOKOKE_H__
#define __SOKOKE_H__ 1 #define __SOKOKE_H__ 1
/* Common behavior modifiers */
#define MIDORI_MOD_NEW_WINDOW(state) (state & GDK_SHIFT_MASK)
#define MIDORI_MOD_NEW_TAB(state) (state & GDK_CONTROL_MASK)
#define MIDORI_MOD_BACKGROUND(state) (state & GDK_SHIFT_MASK)
#define MIDORI_MOD_SCROLL(state) (state & GDK_CONTROL_MASK)
#include <JavaScriptCore/JavaScript.h> #include <JavaScriptCore/JavaScript.h>
#include <midori/midori-websettings.h> #include <midori/midori-websettings.h>
@ -217,6 +211,9 @@ sokoke_register_stock_items (void);
const gchar* const gchar*
sokoke_set_config_dir (const gchar* new_config_dir); sokoke_set_config_dir (const gchar* new_config_dir);
gboolean
sokoke_is_app_or_private (void);
gboolean gboolean
sokoke_remove_path (const gchar* path, sokoke_remove_path (const gchar* path,
gboolean ignore_errors); gboolean ignore_errors);
@ -225,6 +222,9 @@ gchar*
sokoke_find_config_filename (const gchar* folder, sokoke_find_config_filename (const gchar* folder,
const gchar* filename); const gchar* filename);
gchar*
sokoke_find_lib_path (const gchar* folder);
gchar* gchar*
sokoke_find_data_filename (const gchar* filename); sokoke_find_data_filename (const gchar* filename);

View file

@ -0,0 +1,8 @@
atk
gio-2.0
cairo
pango
gdk-pixbuf-2.0
gdk-3.0
gtk+-3.0
libsoup-2.4

653
midori/webkitgtk-3.0.vapi Normal file
View file

@ -0,0 +1,653 @@
/* webkit-1.0.vapi generated by vapigen, do not modify. */
[CCode (cprefix = "WebKit", lower_case_cprefix = "webkit_")]
namespace WebKit {
[CCode (cheader_filename = "webkit/webkit.h")]
public class Download : GLib.Object {
[CCode (has_construct_function = false)]
public Download (WebKit.NetworkRequest request);
public void cancel ();
public uint64 get_current_size ();
public unowned string get_destination_uri ();
public double get_elapsed_time ();
public unowned WebKit.NetworkRequest get_network_request ();
public unowned WebKit.NetworkResponse get_network_response ();
public double get_progress ();
public WebKit.DownloadStatus get_status ();
public unowned string get_suggested_filename ();
public uint64 get_total_size ();
public unowned string get_uri ();
public void set_destination_uri (string destination_uri);
public void start ();
public uint64 current_size { get; }
public string destination_uri { get; set; }
public WebKit.NetworkRequest network_request { get; construct; }
public WebKit.NetworkResponse network_response { get; construct; }
public double progress { get; }
public WebKit.DownloadStatus status { get; }
public string suggested_filename { get; }
public uint64 total_size { get; }
public virtual signal bool error (int p0, int p1, string p2);
}
[CCode (cheader_filename = "webkit/webkit.h")]
public class GeolocationPolicyDecision : GLib.Object {
[CCode (has_construct_function = false)]
protected GeolocationPolicyDecision ();
}
[CCode (cheader_filename = "webkit/webkit.h")]
public class HitTestResult : GLib.Object {
[CCode (has_construct_function = false)]
protected HitTestResult ();
[NoAccessorMethod]
public WebKit.HitTestResultContext context { get; construct; }
[NoAccessorMethod]
public string image_uri { owned get; construct; }
[NoAccessorMethod]
public string link_uri { owned get; construct; }
[NoAccessorMethod]
public string media_uri { owned get; construct; }
}
[CCode (cheader_filename = "webkit/webkit.h")]
public class NetworkRequest : GLib.Object {
[CCode (has_construct_function = false)]
public NetworkRequest (string uri);
public unowned Soup.Message get_message ();
public unowned string get_uri ();
public void set_uri (string uri);
public Soup.Message message { get; construct; }
public string uri { get; set; }
}
[CCode (cheader_filename = "webkit/webkit.h")]
public class NetworkResponse : GLib.Object {
[CCode (has_construct_function = false)]
public NetworkResponse (string uri);
public unowned Soup.Message get_message ();
public unowned string get_uri ();
public void set_uri (string uri);
public Soup.Message message { get; construct; }
public string uri { get; set; }
}
[CCode (cheader_filename = "webkit/webkit.h")]
public class SecurityOrigin : GLib.Object {
[CCode (has_construct_function = false)]
protected SecurityOrigin ();
public unowned GLib.List<WebKit.WebDatabase> get_all_web_databases ();
public unowned string get_host ();
public uint get_port ();
public unowned string get_protocol ();
public uint64 get_web_database_quota ();
public uint64 get_web_database_usage ();
public void set_web_database_quota (uint64 quota);
public string host { get; }
public uint port { get; }
public string protocol { get; }
public uint64 web_database_quota { get; set; }
public uint64 web_database_usage { get; }
}
[CCode (cheader_filename = "webkit/webkit.h")]
public class SoupAuthDialog : GLib.Object, Soup.SessionFeature {
[CCode (has_construct_function = false)]
protected SoupAuthDialog ();
public virtual signal unowned Gtk.Widget current_toplevel (Soup.Message message);
}
[CCode (cheader_filename = "webkit/webkit.h")]
public class WebBackForwardList : GLib.Object {
[CCode (has_construct_function = false)]
protected WebBackForwardList ();
public void add_item (WebKit.WebHistoryItem history_item);
public void clear ();
public bool contains_item (WebKit.WebHistoryItem history_item);
public unowned WebKit.WebHistoryItem get_back_item ();
public int get_back_length ();
public unowned GLib.List<WebKit.WebHistoryItem> get_back_list_with_limit (int limit);
public unowned WebKit.WebHistoryItem get_current_item ();
public unowned WebKit.WebHistoryItem get_forward_item ();
public int get_forward_length ();
public unowned GLib.List<WebKit.WebHistoryItem> get_forward_list_with_limit (int limit);
public int get_limit ();
public unowned WebKit.WebHistoryItem get_nth_item (int index);
public void go_back ();
public void go_forward ();
public void go_to_item (WebKit.WebHistoryItem history_item);
public void set_limit (int limit);
[CCode (has_construct_function = false)]
public WebBackForwardList.with_web_view (WebKit.WebView web_view);
}
[CCode (cheader_filename = "webkit/webkit.h")]
public class WebDataSource : GLib.Object {
[CCode (has_construct_function = false)]
public WebDataSource ();
public unowned GLib.StringBuilder get_data ();
public unowned string get_encoding ();
public unowned WebKit.NetworkRequest get_initial_request ();
public unowned WebKit.WebResource get_main_resource ();
public unowned WebKit.NetworkRequest get_request ();
public unowned GLib.List<WebKit.WebResource> get_subresources ();
public unowned string get_unreachable_uri ();
public unowned WebKit.WebFrame get_web_frame ();
public bool is_loading ();
[CCode (has_construct_function = false)]
public WebDataSource.with_request (WebKit.NetworkRequest request);
}
[CCode (cheader_filename = "webkit/webkit.h")]
public class WebDatabase : GLib.Object {
[CCode (has_construct_function = false)]
protected WebDatabase ();
public unowned string get_display_name ();
public uint64 get_expected_size ();
public unowned string get_filename ();
public unowned string get_name ();
public unowned WebKit.SecurityOrigin get_security_origin ();
public uint64 get_size ();
public void remove ();
public string display_name { get; }
public uint64 expected_size { get; }
public string filename { get; }
public string name { get; construct; }
public WebKit.SecurityOrigin security_origin { get; construct; }
public uint64 size { get; }
}
[CCode (cheader_filename = "webkit/webkit.h")]
public class WebFrame : GLib.Object {
[CCode (has_construct_function = false)]
public WebFrame (WebKit.WebView web_view);
public unowned WebKit.WebFrame find_frame (string name);
public unowned WebKit.WebDataSource get_data_source ();
public Gtk.PolicyType get_horizontal_scrollbar_policy ();
public WebKit.LoadStatus get_load_status ();
public unowned string get_name ();
public unowned WebKit.NetworkResponse get_network_response ();
public unowned WebKit.WebFrame get_parent ();
public unowned WebKit.WebDataSource get_provisional_data_source ();
public unowned WebKit.SecurityOrigin get_security_origin ();
public unowned string get_title ();
public unowned string get_uri ();
public Gtk.PolicyType get_vertical_scrollbar_policy ();
public unowned WebKit.WebView get_web_view ();
public void load_alternate_string (string content, string base_url, string unreachable_url);
public void load_request (WebKit.NetworkRequest request);
public void load_string (string content, string mime_type, string encoding, string base_uri);
public void load_uri (string uri);
public void print ();
public Gtk.PrintOperationResult print_full (Gtk.PrintOperation operation, Gtk.PrintOperationAction action) throws GLib.Error;
public void reload ();
public void stop_loading ();
public Gtk.PolicyType horizontal_scrollbar_policy { get; }
public WebKit.LoadStatus load_status { get; }
public string name { get; }
public string title { get; }
public string uri { get; }
public Gtk.PolicyType vertical_scrollbar_policy { get; }
public virtual signal void cleared ();
public virtual signal void hovering_over_link (string p0, string p1);
public virtual signal void load_committed ();
public virtual signal void load_done (bool p0);
public virtual signal bool scrollbars_policy_changed ();
public virtual signal void title_changed (string p0);
}
[CCode (cheader_filename = "webkit/webkit.h")]
public class WebHistoryItem : GLib.Object {
[CCode (has_construct_function = false)]
public WebHistoryItem ();
public unowned WebKit.WebHistoryItem copy ();
public unowned string get_alternate_title ();
public double get_last_visited_time ();
public unowned string get_original_uri ();
public unowned string get_title ();
public unowned string get_uri ();
public void set_alternate_title (string title);
[CCode (has_construct_function = false)]
public WebHistoryItem.with_data (string uri, string title);
public string alternate_title { get; set; }
public double last_visited_time { get; }
public string original_uri { get; }
public string title { get; }
public string uri { get; }
}
[CCode (cheader_filename = "webkit/webkit.h")]
public class WebInspector : GLib.Object {
[CCode (has_construct_function = false)]
protected WebInspector ();
public void close ();
public unowned string get_inspected_uri ();
public unowned WebKit.WebView get_web_view ();
public void inspect_coordinates (double x, double y);
public void show ();
public string inspected_uri { get; }
[NoAccessorMethod]
public bool javascript_profiling_enabled { get; set; }
[NoAccessorMethod]
public bool timeline_profiling_enabled { get; set; }
public WebKit.WebView web_view { get; }
public virtual signal bool attach_window ();
public virtual signal bool close_window ();
public virtual signal bool detach_window ();
public virtual signal void finished ();
public virtual signal unowned WebKit.WebView inspect_web_view (WebKit.WebView p0);
public virtual signal bool show_window ();
}
[CCode (cheader_filename = "webkit/webkit.h")]
public class WebNavigationAction : GLib.Object {
[CCode (has_construct_function = false)]
protected WebNavigationAction ();
public int get_button ();
public int get_modifier_state ();
public unowned string get_original_uri ();
public WebKit.WebNavigationReason get_reason ();
public unowned string get_target_frame ();
public void set_original_uri (string originalUri);
public void set_reason (WebKit.WebNavigationReason reason);
public int button { get; construct; }
public int modifier_state { get; construct; }
public string original_uri { get; set construct; }
public WebKit.WebNavigationReason reason { get; set construct; }
public string target_frame { get; construct; }
}
[CCode (cheader_filename = "webkit/webkit.h")]
public class WebPolicyDecision : GLib.Object {
[CCode (has_construct_function = false)]
protected WebPolicyDecision ();
public void download ();
public void ignore ();
public void use ();
}
[CCode (cheader_filename = "webkit/webkit.h")]
public class WebResource : GLib.Object {
[CCode (has_construct_function = false)]
public WebResource (string data, ssize_t size, string uri, string mime_type, string encoding, string frame_name);
public unowned GLib.StringBuilder get_data ();
public unowned string get_encoding ();
public unowned string get_frame_name ();
public unowned string get_mime_type ();
public unowned string get_uri ();
public string encoding { get; }
public string frame_name { get; }
public string mime_type { get; }
public string uri { get; construct; }
}
[CCode (cheader_filename = "webkit/webkit.h")]
public class WebSettings : GLib.Object {
[CCode (has_construct_function = false)]
public WebSettings ();
public WebKit.WebSettings copy ();
public unowned string get_user_agent ();
[NoAccessorMethod]
public bool auto_load_images { get; set construct; }
[NoAccessorMethod]
public bool auto_resize_window { get; set construct; }
[NoAccessorMethod]
public bool auto_shrink_images { get; set construct; }
[NoAccessorMethod]
public string cursive_font_family { owned get; set construct; }
[NoAccessorMethod]
public string default_encoding { owned get; set construct; }
[NoAccessorMethod]
public string default_font_family { owned get; set construct; }
[NoAccessorMethod]
public int default_font_size { get; set construct; }
[NoAccessorMethod]
public int default_monospace_font_size { get; set construct; }
[NoAccessorMethod]
public WebKit.EditingBehavior editing_behavior { get; set construct; }
[NoAccessorMethod]
public bool enable_caret_browsing { get; set construct; }
[NoAccessorMethod]
public bool enable_default_context_menu { get; set construct; }
[NoAccessorMethod]
public bool enable_developer_extras { get; set construct; }
[NoAccessorMethod]
public bool enable_dom_paste { get; set construct; }
[NoAccessorMethod]
public bool enable_file_access_from_file_uris { get; set construct; }
[NoAccessorMethod]
public bool enable_html5_database { get; set construct; }
[NoAccessorMethod]
public bool enable_html5_local_storage { get; set construct; }
[NoAccessorMethod]
public bool enable_java_applet { get; set construct; }
[NoAccessorMethod]
public bool enable_offline_web_application_cache { get; set construct; }
[NoAccessorMethod]
public bool enable_page_cache { get; set construct; }
[NoAccessorMethod]
public bool enable_plugins { get; set construct; }
[NoAccessorMethod]
public bool enable_private_browsing { get; set construct; }
[NoAccessorMethod]
public bool enable_scripts { get; set construct; }
[NoAccessorMethod]
public bool enable_site_specific_quirks { get; set construct; }
[NoAccessorMethod]
public bool enable_spatial_navigation { get; set construct; }
[NoAccessorMethod]
public bool enable_spell_checking { get; set construct; }
[NoAccessorMethod]
public bool enable_universal_access_from_file_uris { get; set construct; }
[NoAccessorMethod]
public bool enable_xss_auditor { get; set construct; }
[NoAccessorMethod]
public bool enforce_96_dpi { get; set construct; }
[NoAccessorMethod]
public string fantasy_font_family { owned get; set construct; }
[NoAccessorMethod]
public bool javascript_can_access_clipboard { get; set construct; }
[NoAccessorMethod]
public bool javascript_can_open_windows_automatically { get; set construct; }
[NoAccessorMethod]
public int minimum_font_size { get; set construct; }
[NoAccessorMethod]
public int minimum_logical_font_size { get; set construct; }
[NoAccessorMethod]
public string monospace_font_family { owned get; set construct; }
[NoAccessorMethod]
public bool print_backgrounds { get; set construct; }
[NoAccessorMethod]
public bool resizable_text_areas { get; set construct; }
[NoAccessorMethod]
public string sans_serif_font_family { owned get; set construct; }
[NoAccessorMethod]
public string serif_font_family { owned get; set construct; }
[NoAccessorMethod]
public string spell_checking_languages { owned get; set construct; }
[NoAccessorMethod]
public bool tab_key_cycles_through_elements { get; set construct; }
[NoAccessorMethod]
public string user_agent { owned get; set construct; }
[NoAccessorMethod]
public string user_stylesheet_uri { owned get; set construct; }
[NoAccessorMethod]
public float zoom_step { get; set construct; }
}
[CCode (cheader_filename = "webkit/webkit.h")]
public class WebView : Gtk.Container, Atk.Implementor, Gtk.Buildable {
[CCode (type = "GtkWidget*", has_construct_function = false)]
public WebView ();
public bool can_copy_clipboard ();
public bool can_cut_clipboard ();
public bool can_go_back ();
public bool can_go_back_or_forward (int steps);
public bool can_go_forward ();
public bool can_paste_clipboard ();
public bool can_redo ();
public bool can_show_mime_type (string mime_type);
public bool can_undo ();
[NoWrapper]
public virtual unowned string choose_file (WebKit.WebFrame frame, string old_file);
public void delete_selection ();
public void execute_script (string script);
public unowned WebKit.WebBackForwardList get_back_forward_list ();
public unowned Gtk.TargetList get_copy_target_list ();
public unowned string get_custom_encoding ();
public bool get_editable ();
public unowned string get_encoding ();
public unowned WebKit.WebFrame get_focused_frame ();
public bool get_full_content_zoom ();
public unowned WebKit.HitTestResult get_hit_test_result (Gdk.EventButton event);
public unowned string get_icon_uri ();
public unowned WebKit.WebInspector get_inspector ();
public WebKit.LoadStatus get_load_status ();
public unowned WebKit.WebFrame get_main_frame ();
public unowned Gtk.TargetList get_paste_target_list ();
public double get_progress ();
public unowned WebKit.WebSettings get_settings ();
public unowned string get_title ();
public bool get_transparent ();
public unowned string get_uri ();
public bool get_view_source_mode ();
public unowned WebKit.WebWindowFeatures get_window_features ();
public float get_zoom_level ();
public void go_back ();
public void go_back_or_forward (int steps);
public void go_forward ();
public bool go_to_back_forward_item (WebKit.WebHistoryItem item);
public bool has_selection ();
public void load_html_string (string content, string base_uri);
public void load_request (WebKit.NetworkRequest request);
public void load_string (string content, string mime_type, string encoding, string base_uri);
public void load_uri (string uri);
public uint mark_text_matches (string str, bool case_sensitive, uint limit);
public void open (string uri);
public void reload ();
public void reload_bypass_cache ();
public bool search_text (string text, bool case_sensitive, bool forward, bool wrap);
public void set_custom_encoding (string encoding);
public void set_editable (bool flag);
public void set_full_content_zoom (bool full_content_zoom);
public void set_highlight_text_matches (bool highlight);
public void set_maintains_back_forward_list (bool flag);
public void set_settings (WebKit.WebSettings settings);
public void set_transparent (bool flag);
public void set_view_source_mode (bool view_source_mode);
public void set_zoom_level (float zoom_level);
public void stop_loading ();
public void unmark_text_matches ();
public void zoom_in ();
public void zoom_out ();
public Gtk.TargetList copy_target_list { get; }
public string custom_encoding { get; set; }
public bool editable { get; set; }
public string encoding { get; }
public bool full_content_zoom { get; set; }
public string icon_uri { get; }
[NoAccessorMethod]
public Gtk.IMContext im_context { owned get; }
public WebKit.LoadStatus load_status { get; }
public Gtk.TargetList paste_target_list { get; }
public double progress { get; }
public WebKit.WebSettings settings { get; set; }
public string title { get; }
public bool transparent { get; set; }
public string uri { get; }
[NoAccessorMethod]
public WebKit.WebInspector web_inspector { owned get; }
[NoAccessorMethod]
public WebKit.WebWindowFeatures window_features { owned get; set; }
public float zoom_level { get; set; }
public virtual signal bool close_web_view ();
public virtual signal bool console_message (string message, int line_number, string source_id);
[HasEmitter]
public virtual signal void copy_clipboard ();
public virtual signal unowned Gtk.Widget create_plugin_widget (string p0, string p1, GLib.HashTable p2);
public virtual signal WebKit.WebView create_web_view (WebKit.WebFrame web_frame);
[HasEmitter]
public virtual signal void cut_clipboard ();
public virtual signal void database_quota_exceeded (GLib.Object p0, GLib.Object p1);
public virtual signal void document_load_finished (WebKit.WebFrame p0);
public virtual signal bool download_requested (GLib.Object p0);
public virtual signal void geolocation_policy_decision_cancelled (WebKit.WebFrame p0);
public virtual signal bool geolocation_policy_decision_requested (WebKit.WebFrame p0, WebKit.GeolocationPolicyDecision p1);
public virtual signal void hovering_over_link (string? p0, string p1);
public virtual signal void icon_loaded (string p0);
public virtual signal void load_committed (WebKit.WebFrame p0);
public virtual signal bool load_error (WebKit.WebFrame p0, string p1, void* p2);
public virtual signal void load_finished (WebKit.WebFrame p0);
public virtual signal void load_progress_changed (int p0);
public virtual signal void load_started (WebKit.WebFrame p0);
public virtual signal bool mime_type_policy_decision_requested (WebKit.WebFrame p0, WebKit.NetworkRequest p1, string p2, WebKit.WebPolicyDecision p3);
[HasEmitter]
public virtual signal bool move_cursor (Gtk.MovementStep step, int count);
public virtual signal bool navigation_policy_decision_requested (WebKit.WebFrame p0, WebKit.NetworkRequest p1, WebKit.WebNavigationAction p2, WebKit.WebPolicyDecision p3);
public virtual signal WebKit.NavigationResponse navigation_requested (WebKit.WebFrame frame, WebKit.NetworkRequest request);
public virtual signal bool new_window_policy_decision_requested (WebKit.WebFrame p0, WebKit.NetworkRequest p1, WebKit.WebNavigationAction p2, WebKit.WebPolicyDecision p3);
[HasEmitter]
public virtual signal void paste_clipboard ();
public virtual signal void populate_popup (Gtk.Menu p0);
public virtual signal bool print_requested (WebKit.WebFrame p0);
[HasEmitter]
public virtual signal void redo ();
public virtual signal void resource_request_starting (WebKit.WebFrame p0, WebKit.WebResource p1, WebKit.NetworkRequest p2, WebKit.NetworkResponse p3);
public virtual signal bool script_alert (WebKit.WebFrame frame, string alert_message);
public virtual signal bool script_confirm (WebKit.WebFrame frame, string confirm_message, void* did_confirm);
public virtual signal bool script_prompt (WebKit.WebFrame frame, string message, string default_value, void* value);
[HasEmitter]
public virtual signal void select_all ();
public virtual signal void selection_changed ();
public virtual signal void set_scroll_adjustments (Gtk.Adjustment hadjustment, Gtk.Adjustment vadjustment);
public virtual signal void status_bar_text_changed (string p0);
public virtual signal void title_changed (WebKit.WebFrame p0, string p1);
[HasEmitter]
public virtual signal void undo ();
public virtual signal bool web_view_ready ();
public virtual signal void window_object_cleared (WebKit.WebFrame frame, void* context, void* window_object);
}
[CCode (cheader_filename = "webkit/webkit.h")]
public class WebWindowFeatures : GLib.Object {
[CCode (has_construct_function = false)]
public WebWindowFeatures ();
public bool equal (WebKit.WebWindowFeatures features2);
[NoAccessorMethod]
public bool fullscreen { get; set construct; }
[NoAccessorMethod]
public int height { get; set construct; }
[NoAccessorMethod]
public bool locationbar_visible { get; set construct; }
[NoAccessorMethod]
public bool menubar_visible { get; set construct; }
[NoAccessorMethod]
public bool scrollbar_visible { get; set construct; }
[NoAccessorMethod]
public bool statusbar_visible { get; set construct; }
[NoAccessorMethod]
public bool toolbar_visible { get; set construct; }
[NoAccessorMethod]
public int width { get; set construct; }
[NoAccessorMethod]
public int x { get; set construct; }
[NoAccessorMethod]
public int y { get; set construct; }
}
[CCode (cprefix = "WEBKIT_CACHE_MODEL_", cheader_filename = "webkit/webkit.h")]
public enum CacheModel {
DOCUMENT_VIEWER,
WEB_BROWSER
}
[CCode (cprefix = "WEBKIT_DOWNLOAD_ERROR_", cheader_filename = "webkit/webkit.h")]
public enum DownloadError {
CANCELLED_BY_USER,
DESTINATION,
NETWORK
}
[CCode (cprefix = "WEBKIT_DOWNLOAD_STATUS_", cheader_filename = "webkit/webkit.h")]
public enum DownloadStatus {
ERROR,
CREATED,
STARTED,
CANCELLED,
FINISHED
}
[CCode (cprefix = "WEBKIT_EDITING_BEHAVIOR_", cheader_filename = "webkit/webkit.h")]
public enum EditingBehavior {
MAC,
WINDOWS
}
[CCode (cprefix = "WEBKIT_HIT_TEST_RESULT_CONTEXT_", cheader_filename = "webkit/webkit.h")]
[Flags]
public enum HitTestResultContext {
DOCUMENT,
LINK,
IMAGE,
MEDIA,
SELECTION,
EDITABLE
}
[CCode (cprefix = "WEBKIT_LOAD_", cheader_filename = "webkit/webkit.h")]
public enum LoadStatus {
PROVISIONAL,
COMMITTED,
FINISHED,
FIRST_VISUALLY_NON_EMPTY_LAYOUT,
FAILED
}
[CCode (cprefix = "WEBKIT_NAVIGATION_RESPONSE_", cheader_filename = "webkit/webkit.h")]
public enum NavigationResponse {
ACCEPT,
IGNORE,
DOWNLOAD
}
[CCode (cprefix = "WEBKIT_NETWORK_ERROR_", cheader_filename = "webkit/webkit.h")]
public enum NetworkError {
FAILED,
TRANSPORT,
UNKNOWN_PROTOCOL,
CANCELLED,
FILE_DOES_NOT_EXIST
}
[CCode (cprefix = "WEBKIT_PLUGIN_ERROR_", cheader_filename = "webkit/webkit.h")]
public enum PluginError {
FAILED,
CANNOT_FIND_PLUGIN,
CANNOT_LOAD_PLUGIN,
JAVA_UNAVAILABLE,
CONNECTION_CANCELLED,
WILL_HANDLE_LOAD
}
[CCode (cprefix = "WEBKIT_POLICY_ERROR_", cheader_filename = "webkit/webkit.h")]
public enum PolicyError {
FAILED,
CANNOT_SHOW_MIME_TYPE,
CANNOT_SHOW_URL,
FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE,
CANNOT_USE_RESTRICTED_PORT
}
[CCode (cprefix = "WEBKIT_WEB_NAVIGATION_REASON_", cheader_filename = "webkit/webkit.h")]
public enum WebNavigationReason {
LINK_CLICKED,
FORM_SUBMITTED,
BACK_FORWARD,
RELOAD,
FORM_RESUBMITTED,
OTHER
}
[CCode (cprefix = "WEBKIT_WEB_VIEW_TARGET_INFO_", cheader_filename = "webkit/webkit.h")]
public enum WebViewTargetInfo {
HTML,
TEXT,
IMAGE,
URI_LIST,
NETSCAPE_URL
}
[CCode (cheader_filename = "webkit/webkit.h")]
public const int MAJOR_VERSION;
[CCode (cheader_filename = "webkit/webkit.h")]
public const int MICRO_VERSION;
[CCode (cheader_filename = "webkit/webkit.h")]
public const int MINOR_VERSION;
[CCode (cheader_filename = "webkit/webkit.h")]
public const int USER_AGENT_MAJOR_VERSION;
[CCode (cheader_filename = "webkit/webkit.h")]
public const int USER_AGENT_MINOR_VERSION;
[CCode (cheader_filename = "webkit/webkit.h")]
public static bool check_version (uint major, uint minor, uint micro);
[CCode (cheader_filename = "webkit/webkit.h")]
public static void geolocation_policy_allow (WebKit.GeolocationPolicyDecision decision);
[CCode (cheader_filename = "webkit/webkit.h")]
public static void geolocation_policy_deny (WebKit.GeolocationPolicyDecision decision);
[CCode (cheader_filename = "webkit/webkit.h")]
public static WebKit.CacheModel get_cache_model ();
[CCode (cheader_filename = "webkit/webkit.h")]
public static unowned Soup.Session get_default_session ();
[CCode (cheader_filename = "webkit/webkit.h")]
public static uint64 get_default_web_database_quota ();
[CCode (cheader_filename = "webkit/webkit.h")]
public static unowned string get_web_database_directory_path ();
[CCode (cheader_filename = "webkit/webkit.h")]
public static uint major_version ();
[CCode (cheader_filename = "webkit/webkit.h")]
public static uint micro_version ();
[CCode (cheader_filename = "webkit/webkit.h")]
public static uint minor_version ();
[CCode (cheader_filename = "webkit/webkit.h")]
public static GLib.Quark network_error_quark ();
[CCode (cheader_filename = "webkit/webkit.h")]
public static GLib.Quark plugin_error_quark ();
[CCode (cheader_filename = "webkit/webkit.h")]
public static GLib.Quark policy_error_quark ();
[CCode (cheader_filename = "webkit/webkit.h")]
public static void remove_all_web_databases ();
[CCode (cheader_filename = "webkit/webkit.h")]
public static void set_cache_model (WebKit.CacheModel cache_model);
[CCode (cheader_filename = "webkit/webkit.h")]
public static void set_default_web_database_quota (uint64 defaultQuota);
[CCode (cheader_filename = "webkit/webkit.h")]
public static void set_web_database_directory_path (string path);
}

View file

@ -7,7 +7,8 @@ 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 XSS WS2_32 OPENSSL HILDON HILDON_FM' 'LIBNOTIFY WEBKIT JAVASCRIPTCOREGTK 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')

View file

@ -10,6 +10,7 @@
*/ */
#include "midori-bookmarks.h" #include "midori-bookmarks.h"
#include "gtk3-compat.h"
#include "midori-array.h" #include "midori-array.h"
#include "midori-app.h" #include "midori-app.h"
@ -205,7 +206,7 @@ midori_bookmarks_read_from_db (MidoriBookmarks* bookmarks,
if (!folder) if (!folder)
folder = ""; folder = "";
sqlcmd = "SELECT uri, title, desc, app, toolbar, folder from bookmarks where " sqlcmd = "SELECT uri, title, desc, app, toolbar, folder from bookmarks where "
" folder = ? ORDER BY uri DESC"; " folder = ? ORDER BY title DESC";
result = sqlite3_prepare_v2 (db, sqlcmd, -1, &statement, NULL); result = sqlite3_prepare_v2 (db, sqlcmd, -1, &statement, NULL);
sqlite3_bind_text (statement, 1, g_strdup (folder), -1, g_free); sqlite3_bind_text (statement, 1, g_strdup (folder), -1, g_free);
} }
@ -846,7 +847,7 @@ midori_bookmarks_key_release_event_cb (GtkWidget* widget,
GdkEventKey* event, GdkEventKey* event,
MidoriBookmarks* bookmarks) MidoriBookmarks* bookmarks)
{ {
if (event->keyval == GDK_Delete) if (event->keyval == GDK_KEY_Delete)
midori_bookmarks_delete_clicked_cb (widget, bookmarks); midori_bookmarks_delete_clicked_cb (widget, bookmarks);
return FALSE; return FALSE;

View file

@ -178,10 +178,7 @@ midori_extensions_set_property (GObject* object,
KATZE_ARRAY_FOREACH_ITEM (extension, array) KATZE_ARRAY_FOREACH_ITEM (extension, array)
midori_extensions_add_item_cb (array, extension, extensions); midori_extensions_add_item_cb (array, extension, extensions);
g_object_unref (array);
/* Hide if there are no extensions at all */
if (!katze_array_get_nth_item (array, 0))
gtk_widget_hide (GTK_WIDGET (object));
} }
break; break;
default: default:

View file

@ -10,6 +10,7 @@
*/ */
#include "midori-history.h" #include "midori-history.h"
#include "gtk3-compat.h"
#include "midori-app.h" #include "midori-app.h"
#include "midori-array.h" #include "midori-array.h"
@ -821,7 +822,7 @@ midori_history_key_release_event_cb (GtkWidget* widget,
GtkTreeModel* model; GtkTreeModel* model;
GtkTreeIter iter; GtkTreeIter iter;
if (event->keyval != GDK_Delete) if (event->keyval != GDK_KEY_Delete)
return FALSE; return FALSE;
if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (widget), &model, &iter)) if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (widget), &model, &iter))

View file

@ -442,7 +442,7 @@ midori_transfers_copy_address_activate_cb (GtkWidget* menuitem,
download = g_object_get_data (G_OBJECT (menuitem), "WebKitDownload"); download = g_object_get_data (G_OBJECT (menuitem), "WebKitDownload");
g_return_if_fail (download != NULL); g_return_if_fail (download != NULL);
uri = webkit_download_get_destination_uri (download); uri = webkit_download_get_uri (download);
clipboard = gtk_clipboard_get_for_display ( clipboard = gtk_clipboard_get_for_display (
gtk_widget_get_display (GTK_WIDGET (menuitem)), gtk_widget_get_display (GTK_WIDGET (menuitem)),
GDK_SELECTION_CLIPBOARD); GDK_SELECTION_CLIPBOARD);

1046
po/ar.po

File diff suppressed because it is too large Load diff

2167
po/ca.po

File diff suppressed because it is too large Load diff

1005
po/cs.po

File diff suppressed because it is too large Load diff

1102
po/da.po

File diff suppressed because it is too large Load diff

1179
po/de.po

File diff suppressed because it is too large Load diff

1515
po/el.po

File diff suppressed because it is too large Load diff

1090
po/es.po

File diff suppressed because it is too large Load diff

1167
po/hr.po

File diff suppressed because it is too large Load diff

1105
po/id.po

File diff suppressed because it is too large Load diff

1156
po/it.po

File diff suppressed because it is too large Load diff

1254
po/ja.po

File diff suppressed because it is too large Load diff

1329
po/ko.po

File diff suppressed because it is too large Load diff

2249
po/lt.po

File diff suppressed because it is too large Load diff

1343
po/nl.po

File diff suppressed because it is too large Load diff

853
po/pl.po

File diff suppressed because it is too large Load diff

1110
po/pt.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

1310
po/ro.po

File diff suppressed because it is too large Load diff

850
po/ru.po

File diff suppressed because it is too large Load diff

1247
po/sk.po

File diff suppressed because it is too large Load diff

1152
po/tr.po

File diff suppressed because it is too large Load diff

1102
po/uk.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -10,6 +10,7 @@
*/ */
#include "midori-findbar.h" #include "midori-findbar.h"
#include "gtk3-compat.h"
#include "midori-browser.h" #include "midori-browser.h"
#include "gtkiconentry.h" #include "gtkiconentry.h"
@ -48,6 +49,34 @@ midori_findbar_class_init (MidoriFindbarClass* class)
/* Nothing to do */ /* Nothing to do */
} }
static void
midori_findbar_set_icon (MidoriFindbar* findbar,
GtkIconEntryPosition icon_pos,
const gchar* icon_name)
{
#if !HAVE_HILDON
GdkScreen* screen = gtk_widget_get_screen (findbar->find_text);
GtkIconTheme* icon_theme = gtk_icon_theme_get_for_screen (screen);
gchar* symbolic_icon_name;
if (icon_name == NULL)
{
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (findbar->find_text),
icon_pos, NULL);
return;
}
symbolic_icon_name = g_strconcat (icon_name, "-symbolic", NULL);
if (gtk_icon_theme_has_icon (icon_theme, symbolic_icon_name))
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (findbar->find_text),
icon_pos, symbolic_icon_name);
else
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (findbar->find_text),
icon_pos, icon_name);
g_free (symbolic_icon_name);
#endif
}
static void static void
midori_findbar_done (MidoriFindbar* findbar) midori_findbar_done (MidoriFindbar* findbar)
{ {
@ -64,12 +93,12 @@ static gboolean
midori_findbar_find_key_press_event_cb (MidoriFindbar* findbar, midori_findbar_find_key_press_event_cb (MidoriFindbar* findbar,
GdkEventKey* event) GdkEventKey* event)
{ {
if (event->keyval == GDK_Escape) if (event->keyval == GDK_KEY_Escape)
{ {
midori_findbar_done (findbar); midori_findbar_done (findbar);
return TRUE; return TRUE;
} }
else if (event->keyval == GDK_Return else if (event->keyval == GDK_KEY_Return
&& (event->state & GDK_SHIFT_MASK)) && (event->state & GDK_SHIFT_MASK))
{ {
midori_findbar_find (findbar, FALSE); midori_findbar_find (findbar, FALSE);
@ -86,7 +115,13 @@ midori_findbar_entry_clear_icon_released_cb (GtkIconEntry* entry,
gpointer user_data) gpointer user_data)
{ {
if (icon_pos == GTK_ICON_ENTRY_SECONDARY) if (icon_pos == GTK_ICON_ENTRY_SECONDARY)
{
gtk_entry_set_text (GTK_ENTRY (entry), ""); gtk_entry_set_text (GTK_ENTRY (entry), "");
#if !HAVE_HILDON
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_PRIMARY, GTK_STOCK_FIND);
#endif
}
} }
static gboolean static gboolean
@ -137,11 +172,8 @@ midori_findbar_invoke (MidoriFindbar* findbar)
GtkWidget* view = midori_browser_get_current_tab (browser); GtkWidget* view = midori_browser_get_current_tab (browser);
const gchar* text; const gchar* text;
#if !HAVE_HILDON midori_findbar_set_icon (findbar, GTK_ICON_ENTRY_PRIMARY, "edit-find");
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (findbar->find_text),
GTK_ICON_ENTRY_PRIMARY, GTK_STOCK_FIND);
gtk_widget_show (GTK_WIDGET (findbar->find_case)); gtk_widget_show (GTK_WIDGET (findbar->find_case));
#endif
gtk_widget_show (GTK_WIDGET (findbar->find_highlight)); gtk_widget_show (GTK_WIDGET (findbar->find_highlight));
gtk_widget_show (GTK_WIDGET (findbar->find_close)); gtk_widget_show (GTK_WIDGET (findbar->find_close));
if ((text = midori_view_get_selected_text (MIDORI_VIEW (view)))) if ((text = midori_view_get_selected_text (MIDORI_VIEW (view))))
@ -180,9 +212,14 @@ midori_findbar_preedit_changed_cb (GtkWidget* entry,
MidoriBrowser* browser = midori_browser_get_for_widget (entry); MidoriBrowser* browser = midori_browser_get_for_widget (entry);
GtkWidget* view = midori_browser_get_current_tab (browser); GtkWidget* view = midori_browser_get_current_tab (browser);
midori_view_unmark_text_matches (MIDORI_VIEW (view)); midori_view_unmark_text_matches (MIDORI_VIEW (view));
if (g_utf8_strlen (preedit, -1) > 1) if (g_utf8_strlen (preedit, -1) >= 1)
{
midori_findbar_set_icon (findbar, GTK_ICON_ENTRY_SECONDARY, "edit-clear");
midori_findbar_find_text (findbar, preedit, TRUE); midori_findbar_find_text (findbar, preedit, TRUE);
} }
else
midori_findbar_set_icon (findbar, GTK_ICON_ENTRY_SECONDARY, NULL);
}
static void static void
midori_findbar_text_changed_cb (GtkWidget* entry, midori_findbar_text_changed_cb (GtkWidget* entry,
@ -230,16 +267,9 @@ midori_findbar_init (MidoriFindbar* findbar)
gtk_label_new_with_mnemonic (_("_Inline Find:"))); gtk_label_new_with_mnemonic (_("_Inline Find:")));
gtk_toolbar_insert (GTK_TOOLBAR (findbar), toolitem, -1); gtk_toolbar_insert (GTK_TOOLBAR (findbar), toolitem, -1);
findbar->find_text = gtk_icon_entry_new (); findbar->find_text = gtk_icon_entry_new ();
#if !HAVE_HILDON midori_findbar_set_icon (findbar, GTK_ICON_ENTRY_PRIMARY, "edit-find");
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (findbar->find_text),
GTK_ICON_ENTRY_PRIMARY,
GTK_STOCK_FIND);
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (findbar->find_text),
GTK_ICON_ENTRY_SECONDARY,
GTK_STOCK_CLEAR);
gtk_icon_entry_set_icon_highlight (GTK_ICON_ENTRY (findbar->find_text), gtk_icon_entry_set_icon_highlight (GTK_ICON_ENTRY (findbar->find_text),
GTK_ICON_ENTRY_SECONDARY, TRUE); GTK_ICON_ENTRY_SECONDARY, TRUE);
#endif
g_signal_connect (findbar->find_text, "icon-release", g_signal_connect (findbar->find_text, "icon-release",
G_CALLBACK (midori_findbar_entry_clear_icon_released_cb), NULL); G_CALLBACK (midori_findbar_entry_clear_icon_released_cb), NULL);
g_signal_connect (findbar->find_text, "activate", g_signal_connect (findbar->find_text, "activate",
@ -320,6 +350,8 @@ midori_findbar_search_text (MidoriFindbar* findbar,
gboolean case_sensitive; gboolean case_sensitive;
gboolean highlight; gboolean highlight;
midori_findbar_set_icon (findbar, GTK_ICON_ENTRY_PRIMARY, found ? "edit-find" : "stop");
if (typing) if (typing)
{ {
MidoriBrowser* browser = midori_browser_get_for_widget (view); MidoriBrowser* browser = midori_browser_get_for_widget (view);
@ -341,10 +373,6 @@ midori_findbar_search_text (MidoriFindbar* findbar,
} }
if (gtk_widget_get_visible (GTK_WIDGET (findbar)) && !typing) if (gtk_widget_get_visible (GTK_WIDGET (findbar)) && !typing)
{ {
#if !HAVE_HILDON
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (findbar->find_text),
GTK_ICON_ENTRY_PRIMARY, (found) ? GTK_STOCK_FIND : GTK_STOCK_STOP);
#endif
text = gtk_entry_get_text (GTK_ENTRY (findbar->find_text)); text = gtk_entry_get_text (GTK_ENTRY (findbar->find_text));
case_sensitive = midori_findbar_case_sensitive (findbar); case_sensitive = midori_findbar_case_sensitive (findbar);
midori_view_mark_text_matches (MIDORI_VIEW (view), text, case_sensitive); midori_view_mark_text_matches (MIDORI_VIEW (view), text, case_sensitive);

View file

@ -76,19 +76,9 @@ midori_transferbar_download_notify_progress_cb (WebKitDownload* download,
{ {
gchar* tooltip; gchar* tooltip;
gchar* text; gchar* text;
guint64 size;
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress),
webkit_download_get_progress (download)); webkit_download_get_progress (download));
size = webkit_download_get_current_size (download);
if (size == webkit_download_get_total_size (download))
{
gtk_widget_set_tooltip_text (progress,
gtk_progress_bar_get_text (GTK_PROGRESS_BAR (progress)));
return;
}
tooltip = midori_download_prepare_tooltip_text (download); tooltip = midori_download_prepare_tooltip_text (download);
text = g_strdup_printf ("%s\n%s", text = g_strdup_printf ("%s\n%s",
gtk_progress_bar_get_text (GTK_PROGRESS_BAR (progress)), tooltip); gtk_progress_bar_get_text (GTK_PROGRESS_BAR (progress)), tooltip);
@ -114,6 +104,7 @@ midori_transferbar_download_notify_status_cb (WebKitDownload* download,
WebKitNetworkRequest* request; WebKitNetworkRequest* request;
const gchar* original_uri; const gchar* original_uri;
gchar** fingerprint; gchar** fingerprint;
gboolean verified = TRUE;
icon = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU); icon = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
gtk_button_set_image (GTK_BUTTON (button), icon); gtk_button_set_image (GTK_BUTTON (button), icon);
@ -150,9 +141,9 @@ midori_transferbar_download_notify_status_cb (WebKitDownload* download,
(guchar*)contents, length); (guchar*)contents, length);
g_free (filename); g_free (filename);
g_free (contents); g_free (contents);
if (!y || !g_str_equal (fingerprint[1], checksum)) /* Checksums are case-insensitive */
gtk_image_set_from_stock (GTK_IMAGE (icon), if (!y || g_ascii_strcasecmp (fingerprint[1], checksum) != 0)
GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_MENU); verified = FALSE;
g_free (checksum); g_free (checksum);
} }
else else
@ -169,14 +160,20 @@ midori_transferbar_download_notify_status_cb (WebKitDownload* download,
gchar* checksum = g_compute_checksum_for_data (G_CHECKSUM_SHA1, gchar* checksum = g_compute_checksum_for_data (G_CHECKSUM_SHA1,
(guchar*)contents, length); (guchar*)contents, length);
g_free (contents); g_free (contents);
if (!y || !g_str_equal (fingerprint[1], checksum)) /* Checksums are case-insensitive */
gtk_image_set_from_stock (GTK_IMAGE (icon), if (!y || g_ascii_strcasecmp (fingerprint[1], checksum) != 0)
GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_MENU); verified = FALSE;
g_free (checksum); g_free (checksum);
} }
g_free (filename); g_free (filename);
} }
g_strfreev (fingerprint); g_strfreev (fingerprint);
if (verified)
gtk_recent_manager_add_item (gtk_recent_manager_get_default (),
webkit_download_get_destination_uri (download));
else
gtk_image_set_from_stock (GTK_IMAGE (icon),
GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_MENU);
break; break;
} }
case WEBKIT_DOWNLOAD_STATUS_CANCELLED: case WEBKIT_DOWNLOAD_STATUS_CANCELLED:

View file

@ -22,8 +22,8 @@ mingw32-gettext-tools
mingw32-glib2 mingw32-glib2
mingw32-glib2-devel mingw32-glib2-devel
mingw32-glib-networking mingw32-glib-networking
mingw32-gst-plugins-base-devel #mingw32-gst-plugins-base-devel
mingw32-gstreamer-devel #mingw32-gstreamer-devel
mingw32-gtk2 mingw32-gtk2
mingw32-gtk2-devel mingw32-gtk2-devel
mingw32-hunspell mingw32-hunspell
@ -63,8 +63,8 @@ mingw32-libtasn1
mingw32-libtasn1-devel mingw32-libtasn1-devel
mingw32-libtiff mingw32-libtiff
mingw32-libtiff-devel mingw32-libtiff-devel
mingw32-libwebkitgtk #mingw32-libwebkitgtk
mingw32-libwebkitgtk-devel #mingw32-libwebkitgtk-devel
mingw32-webkit-tools mingw32-webkit-tools
mingw32-libxml2 mingw32-libxml2
mingw32-libxml2-devel mingw32-libxml2-devel
@ -84,3 +84,5 @@ mingw32-win_iconv
mingw32-win_iconv-devel mingw32-win_iconv-devel
mingw32-zlib mingw32-zlib
mingw32-zlib-devel mingw32-zlib-devel
mingw32-libunique
mingw32-libunique-devel

30
wscript
View file

@ -29,7 +29,7 @@ from Configure import find_program_impl
major = 0 major = 0
minor = 4 minor = 4
micro = 0 micro = 1
APPNAME = 'midori' APPNAME = 'midori'
VERSION = str (major) + '.' + str (minor) + '.' + str (micro) VERSION = str (major) + '.' + str (minor) + '.' + str (micro)
@ -164,7 +164,7 @@ def configure (conf):
atleast_version=version, mandatory=mandatory) atleast_version=version, mandatory=mandatory)
return conf.env['HAVE_' + var] return conf.env['HAVE_' + var]
if option_enabled ('unique'): if option_enabled ('unique') and not option_enabled('gtk3'):
check_pkg ('unique-1.0', '0.9', False) check_pkg ('unique-1.0', '0.9', False)
unique = ['N/A', 'yes'][conf.env['HAVE_UNIQUE'] == 1] unique = ['N/A', 'yes'][conf.env['HAVE_UNIQUE'] == 1]
if unique != 'yes': if unique != 'yes':
@ -195,8 +195,21 @@ def configure (conf):
conf.check (header_name='X11/extensions/scrnsaver.h', conf.check (header_name='X11/extensions/scrnsaver.h',
includes='/usr/X11R6/include', mandatory=False) includes='/usr/X11R6/include', mandatory=False)
conf.check (lib='Xss', libpath='/usr/X11R6/lib', mandatory=False) conf.check (lib='Xss', libpath='/usr/X11R6/lib', mandatory=False)
check_pkg ('gtk+-2.0', '2.10.0', var='GTK', args=args) if option_enabled ('gtk3'):
check_pkg ('gtk+-3.0', '3.0.0', var='GTK', mandatory=False)
check_pkg ('webkitgtk-3.0', '1.1.17', var='WEBKIT', mandatory=False)
if not conf.env['HAVE_GTK'] or not conf.env['HAVE_WEBKIT']:
Utils.pprint ('RED', 'GTK+3 was not found.\n' \
'Pass --disable-gtk3 to build without GTK+3.')
sys.exit (1)
conf.env.append_value ('VALAFLAGS', '-D HAVE_GTK3')
else:
check_pkg ('gtk+-2.0', '2.10.0', var='GTK')
check_pkg ('webkit-1.0', '1.1.17', args=args) check_pkg ('webkit-1.0', '1.1.17', args=args)
conf.env['HAVE_GTK3'] = option_enabled ('gtk3')
webkit_version = conf.check_cfg (modversion='webkit-1.0').split ('.')
if int(webkit_version[0]) >= 1 and int(webkit_version[1]) >= 5 and int(webkit_version[2]) >= 1:
check_pkg ('javascriptcoregtk-1.0', '1.1.17', 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')
@ -358,6 +371,7 @@ def set_options (opt):
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 ('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 ())
add_enable_option ('gtk3', 'GTK+3 and WebKitGTK+3 support', group, disable=True)
# Provided for compatibility # Provided for compatibility
opt.add_option ('--build', help='Ignored') opt.add_option ('--build', help='Ignored')
@ -412,7 +426,9 @@ def build (bld):
bld.add_subdirs ('docs/api') bld.add_subdirs ('docs/api')
bld.install_files ('${DOCDIR}/api/', blddir + '/docs/api/*') bld.install_files ('${DOCDIR}/api/', blddir + '/docs/api/*')
if not is_mingw (bld.env) and Options.platform != 'win32': for desktop in [APPNAME + '.desktop', APPNAME + '-private.desktop']:
if is_mingw (bld.env) or Options.platform == 'win32':
break
if bld.env['HAVE_HILDON']: if bld.env['HAVE_HILDON']:
appdir = '${MDATADIR}/applications/hildon' appdir = '${MDATADIR}/applications/hildon'
bld.install_files ('${MDATADIR}/dbus-1/services', bld.install_files ('${MDATADIR}/dbus-1/services',
@ -421,14 +437,13 @@ def build (bld):
appdir = '${MDATADIR}/applications' appdir = '${MDATADIR}/applications'
if bld.env['INTLTOOL']: if bld.env['INTLTOOL']:
obj = bld.new_task_gen ('intltool_in') obj = bld.new_task_gen ('intltool_in')
obj.source = 'data/' + APPNAME + '.desktop.in' obj.source = 'data/' + desktop + '.in'
obj.install_path = appdir obj.install_path = appdir
obj.flags = ['-d', '-c'] obj.flags = ['-d', '-c']
bld.install_files (appdir, 'data/' + APPNAME + '.desktop') bld.install_files (appdir, 'data/' + desktop)
else: else:
folder = os.path.abspath (blddir + '/default/data') folder = os.path.abspath (blddir + '/default/data')
Utils.check_dir (folder) Utils.check_dir (folder)
desktop = APPNAME + '.desktop'
pre = open ('data/' + desktop + '.in') pre = open ('data/' + desktop + '.in')
after = open (folder + '/' + desktop, 'w') after = open (folder + '/' + desktop, 'w')
try: try:
@ -459,7 +474,6 @@ def build (bld):
bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/error.html') bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/error.html')
bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/speeddial-head.html') bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/speeddial-head.html')
bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/mootools.js')
if bld.env['addons']: if bld.env['addons']:
bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/autosuggestcontrol.js') bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/autosuggestcontrol.js')