├── .gitignore ├── AUTHORS ├── COPYING ├── INSTALL ├── MAINTAINERS ├── Makefile.am ├── NEWS ├── README.md ├── autogen.sh ├── configure.ac ├── demos ├── browser.py └── inspector.py ├── javascriptcore ├── javascriptcore_types.c └── javascriptcore_types.h ├── m4 └── python.m4 ├── pywebkitgtk.pc.in ├── tests ├── test_networkrequest.py ├── test_networkresponse.py ├── test_webbackforwardlist.py ├── test_webframe.py └── test_webnavigationaction.py └── webkit ├── __init__.py ├── webkit-1.0.2.defs ├── webkit-1.1-types.defs ├── webkit-1.1.defs ├── webkit-base-types.defs ├── webkit.override ├── webkitdom.defs └── webkitmodule.c /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | m4/libtool.m4 3 | m4/ltoptions.m4 4 | m4/ltsugar.m4 5 | m4/ltversion.m4 6 | m4/lt~obsolete.m4 -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | AUTHORS 2 | ---- 3 | 4 | Dan Winship 5 | http://mysterion.org/~danw 6 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU LIBRARY GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1991 Free Software Foundation, Inc. 5 | 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | [This is the first released version of the library GPL. It is 10 | numbered 2 because it goes with version 2 of the ordinary GPL.] 11 | 12 | Preamble 13 | 14 | The licenses for most software are designed to take away your 15 | freedom to share and change it. By contrast, the GNU General Public 16 | Licenses are intended to guarantee your freedom to share and change 17 | free software--to make sure the software is free for all its users. 18 | 19 | This license, the Library General Public License, applies to some 20 | specially designated Free Software Foundation software, and to any 21 | other libraries whose authors decide to use it. You can use it for 22 | your libraries, too. 23 | 24 | When we speak of free software, we are referring to freedom, not 25 | price. Our General Public Licenses are designed to make sure that you 26 | have the freedom to distribute copies of free software (and charge for 27 | this service if you wish), that you receive source code or can get it 28 | if you want it, that you can change the software or use pieces of it 29 | in new free programs; and that you know you can do these things. 30 | 31 | To protect your rights, we need to make restrictions that forbid 32 | anyone to deny you these rights or to ask you to surrender the rights. 33 | These restrictions translate to certain responsibilities for you if 34 | you distribute copies of the library, or if you modify it. 35 | 36 | For example, if you distribute copies of the library, whether gratis 37 | or for a fee, you must give the recipients all the rights that we gave 38 | you. You must make sure that they, too, receive or can get the source 39 | code. If you link a program with the library, you must provide 40 | complete object files to the recipients so that they can relink them 41 | with the library, after making changes to the library and recompiling 42 | it. And you must show them these terms so they know their rights. 43 | 44 | Our method of protecting your rights has two steps: (1) copyright 45 | the library, and (2) offer you this license which gives you legal 46 | permission to copy, distribute and/or modify the library. 47 | 48 | Also, for each distributor's protection, we want to make certain 49 | that everyone understands that there is no warranty for this free 50 | library. If the library is modified by someone else and passed on, we 51 | want its recipients to know that what they have is not the original 52 | version, so that any problems introduced by others will not reflect on 53 | the original authors' reputations. 54 | 55 | Finally, any free program is threatened constantly by software 56 | patents. We wish to avoid the danger that companies distributing free 57 | software will individually obtain patent licenses, thus in effect 58 | transforming the program into proprietary software. To prevent this, 59 | we have made it clear that any patent must be licensed for everyone's 60 | free use or not licensed at all. 61 | 62 | Most GNU software, including some libraries, is covered by the ordinary 63 | GNU General Public License, which was designed for utility programs. This 64 | license, the GNU Library General Public License, applies to certain 65 | designated libraries. This license is quite different from the ordinary 66 | one; be sure to read it in full, and don't assume that anything in it is 67 | the same as in the ordinary license. 68 | 69 | The reason we have a separate public license for some libraries is that 70 | they blur the distinction we usually make between modifying or adding to a 71 | program and simply using it. Linking a program with a library, without 72 | changing the library, is in some sense simply using the library, and is 73 | analogous to running a utility program or application program. However, in 74 | a textual and legal sense, the linked executable is a combined work, a 75 | derivative of the original library, and the ordinary General Public License 76 | treats it as such. 77 | 78 | Because of this blurred distinction, using the ordinary General 79 | Public License for libraries did not effectively promote software 80 | sharing, because most developers did not use the libraries. We 81 | concluded that weaker conditions might promote sharing better. 82 | 83 | However, unrestricted linking of non-free programs would deprive the 84 | users of those programs of all benefit from the free status of the 85 | libraries themselves. This Library General Public License is intended to 86 | permit developers of non-free programs to use free libraries, while 87 | preserving your freedom as a user of such programs to change the free 88 | libraries that are incorporated in them. (We have not seen how to achieve 89 | this as regards changes in header files, but we have achieved it as regards 90 | changes in the actual functions of the Library.) The hope is that this 91 | will lead to faster development of free libraries. 92 | 93 | The precise terms and conditions for copying, distribution and 94 | modification follow. Pay close attention to the difference between a 95 | "work based on the library" and a "work that uses the library". The 96 | former contains code derived from the library, while the latter only 97 | works together with the library. 98 | 99 | Note that it is possible for a library to be covered by the ordinary 100 | General Public License rather than by this special one. 101 | 102 | GNU LIBRARY GENERAL PUBLIC LICENSE 103 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 104 | 105 | 0. This License Agreement applies to any software library which 106 | contains a notice placed by the copyright holder or other authorized 107 | party saying it may be distributed under the terms of this Library 108 | General Public License (also called "this License"). Each licensee is 109 | addressed as "you". 110 | 111 | A "library" means a collection of software functions and/or data 112 | prepared so as to be conveniently linked with application programs 113 | (which use some of those functions and data) to form executables. 114 | 115 | The "Library", below, refers to any such software library or work 116 | which has been distributed under these terms. A "work based on the 117 | Library" means either the Library or any derivative work under 118 | copyright law: that is to say, a work containing the Library or a 119 | portion of it, either verbatim or with modifications and/or translated 120 | straightforwardly into another language. (Hereinafter, translation is 121 | included without limitation in the term "modification".) 122 | 123 | "Source code" for a work means the preferred form of the work for 124 | making modifications to it. For a library, complete source code means 125 | all the source code for all modules it contains, plus any associated 126 | interface definition files, plus the scripts used to control compilation 127 | and installation of the library. 128 | 129 | Activities other than copying, distribution and modification are not 130 | covered by this License; they are outside its scope. The act of 131 | running a program using the Library is not restricted, and output from 132 | such a program is covered only if its contents constitute a work based 133 | on the Library (independent of the use of the Library in a tool for 134 | writing it). Whether that is true depends on what the Library does 135 | and what the program that uses the Library does. 136 | 137 | 1. You may copy and distribute verbatim copies of the Library's 138 | complete source code as you receive it, in any medium, provided that 139 | you conspicuously and appropriately publish on each copy an 140 | appropriate copyright notice and disclaimer of warranty; keep intact 141 | all the notices that refer to this License and to the absence of any 142 | warranty; and distribute a copy of this License along with the 143 | Library. 144 | 145 | You may charge a fee for the physical act of transferring a copy, 146 | and you may at your option offer warranty protection in exchange for a 147 | fee. 148 | 149 | 2. You may modify your copy or copies of the Library or any portion 150 | of it, thus forming a work based on the Library, and copy and 151 | distribute such modifications or work under the terms of Section 1 152 | above, provided that you also meet all of these conditions: 153 | 154 | a) The modified work must itself be a software library. 155 | 156 | b) You must cause the files modified to carry prominent notices 157 | stating that you changed the files and the date of any change. 158 | 159 | c) You must cause the whole of the work to be licensed at no 160 | charge to all third parties under the terms of this License. 161 | 162 | d) If a facility in the modified Library refers to a function or a 163 | table of data to be supplied by an application program that uses 164 | the facility, other than as an argument passed when the facility 165 | is invoked, then you must make a good faith effort to ensure that, 166 | in the event an application does not supply such function or 167 | table, the facility still operates, and performs whatever part of 168 | its purpose remains meaningful. 169 | 170 | (For example, a function in a library to compute square roots has 171 | a purpose that is entirely well-defined independent of the 172 | application. Therefore, Subsection 2d requires that any 173 | application-supplied function or table used by this function must 174 | be optional: if the application does not supply it, the square 175 | root function must still compute square roots.) 176 | 177 | These requirements apply to the modified work as a whole. If 178 | identifiable sections of that work are not derived from the Library, 179 | and can be reasonably considered independent and separate works in 180 | themselves, then this License, and its terms, do not apply to those 181 | sections when you distribute them as separate works. But when you 182 | distribute the same sections as part of a whole which is a work based 183 | on the Library, the distribution of the whole must be on the terms of 184 | this License, whose permissions for other licensees extend to the 185 | entire whole, and thus to each and every part regardless of who wrote 186 | it. 187 | 188 | Thus, it is not the intent of this section to claim rights or contest 189 | your rights to work written entirely by you; rather, the intent is to 190 | exercise the right to control the distribution of derivative or 191 | collective works based on the Library. 192 | 193 | In addition, mere aggregation of another work not based on the Library 194 | with the Library (or with a work based on the Library) on a volume of 195 | a storage or distribution medium does not bring the other work under 196 | the scope of this License. 197 | 198 | 3. You may opt to apply the terms of the ordinary GNU General Public 199 | License instead of this License to a given copy of the Library. To do 200 | this, you must alter all the notices that refer to this License, so 201 | that they refer to the ordinary GNU General Public License, version 2, 202 | instead of to this License. (If a newer version than version 2 of the 203 | ordinary GNU General Public License has appeared, then you can specify 204 | that version instead if you wish.) Do not make any other change in 205 | these notices. 206 | 207 | Once this change is made in a given copy, it is irreversible for 208 | that copy, so the ordinary GNU General Public License applies to all 209 | subsequent copies and derivative works made from that copy. 210 | 211 | This option is useful when you wish to copy part of the code of 212 | the Library into a program that is not a library. 213 | 214 | 4. You may copy and distribute the Library (or a portion or 215 | derivative of it, under Section 2) in object code or executable form 216 | under the terms of Sections 1 and 2 above provided that you accompany 217 | it with the complete corresponding machine-readable source code, which 218 | must be distributed under the terms of Sections 1 and 2 above on a 219 | medium customarily used for software interchange. 220 | 221 | If distribution of object code is made by offering access to copy 222 | from a designated place, then offering equivalent access to copy the 223 | source code from the same place satisfies the requirement to 224 | distribute the source code, even though third parties are not 225 | compelled to copy the source along with the object code. 226 | 227 | 5. A program that contains no derivative of any portion of the 228 | Library, but is designed to work with the Library by being compiled or 229 | linked with it, is called a "work that uses the Library". Such a 230 | work, in isolation, is not a derivative work of the Library, and 231 | therefore falls outside the scope of this License. 232 | 233 | However, linking a "work that uses the Library" with the Library 234 | creates an executable that is a derivative of the Library (because it 235 | contains portions of the Library), rather than a "work that uses the 236 | library". The executable is therefore covered by this License. 237 | Section 6 states terms for distribution of such executables. 238 | 239 | When a "work that uses the Library" uses material from a header file 240 | that is part of the Library, the object code for the work may be a 241 | derivative work of the Library even though the source code is not. 242 | Whether this is true is especially significant if the work can be 243 | linked without the Library, or if the work is itself a library. The 244 | threshold for this to be true is not precisely defined by law. 245 | 246 | If such an object file uses only numerical parameters, data 247 | structure layouts and accessors, and small macros and small inline 248 | functions (ten lines or less in length), then the use of the object 249 | file is unrestricted, regardless of whether it is legally a derivative 250 | work. (Executables containing this object code plus portions of the 251 | Library will still fall under Section 6.) 252 | 253 | Otherwise, if the work is a derivative of the Library, you may 254 | distribute the object code for the work under the terms of Section 6. 255 | Any executables containing that work also fall under Section 6, 256 | whether or not they are linked directly with the Library itself. 257 | 258 | 6. As an exception to the Sections above, you may also compile or 259 | link a "work that uses the Library" with the Library to produce a 260 | work containing portions of the Library, and distribute that work 261 | under terms of your choice, provided that the terms permit 262 | modification of the work for the customer's own use and reverse 263 | engineering for debugging such modifications. 264 | 265 | You must give prominent notice with each copy of the work that the 266 | Library is used in it and that the Library and its use are covered by 267 | this License. You must supply a copy of this License. If the work 268 | during execution displays copyright notices, you must include the 269 | copyright notice for the Library among them, as well as a reference 270 | directing the user to the copy of this License. Also, you must do one 271 | of these things: 272 | 273 | a) Accompany the work with the complete corresponding 274 | machine-readable source code for the Library including whatever 275 | changes were used in the work (which must be distributed under 276 | Sections 1 and 2 above); and, if the work is an executable linked 277 | with the Library, with the complete machine-readable "work that 278 | uses the Library", as object code and/or source code, so that the 279 | user can modify the Library and then relink to produce a modified 280 | executable containing the modified Library. (It is understood 281 | that the user who changes the contents of definitions files in the 282 | Library will not necessarily be able to recompile the application 283 | to use the modified definitions.) 284 | 285 | b) Accompany the work with a written offer, valid for at 286 | least three years, to give the same user the materials 287 | specified in Subsection 6a, above, for a charge no more 288 | than the cost of performing this distribution. 289 | 290 | c) If distribution of the work is made by offering access to copy 291 | from a designated place, offer equivalent access to copy the above 292 | specified materials from the same place. 293 | 294 | d) Verify that the user has already received a copy of these 295 | materials or that you have already sent this user a copy. 296 | 297 | For an executable, the required form of the "work that uses the 298 | Library" must include any data and utility programs needed for 299 | reproducing the executable from it. However, as a special exception, 300 | the source code distributed need not include anything that is normally 301 | distributed (in either source or binary form) with the major 302 | components (compiler, kernel, and so on) of the operating system on 303 | which the executable runs, unless that component itself accompanies 304 | the executable. 305 | 306 | It may happen that this requirement contradicts the license 307 | restrictions of other proprietary libraries that do not normally 308 | accompany the operating system. Such a contradiction means you cannot 309 | use both them and the Library together in an executable that you 310 | distribute. 311 | 312 | 7. You may place library facilities that are a work based on the 313 | Library side-by-side in a single library together with other library 314 | facilities not covered by this License, and distribute such a combined 315 | library, provided that the separate distribution of the work based on 316 | the Library and of the other library facilities is otherwise 317 | permitted, and provided that you do these two things: 318 | 319 | a) Accompany the combined library with a copy of the same work 320 | based on the Library, uncombined with any other library 321 | facilities. This must be distributed under the terms of the 322 | Sections above. 323 | 324 | b) Give prominent notice with the combined library of the fact 325 | that part of it is a work based on the Library, and explaining 326 | where to find the accompanying uncombined form of the same work. 327 | 328 | 8. You may not copy, modify, sublicense, link with, or distribute 329 | the Library except as expressly provided under this License. Any 330 | attempt otherwise to copy, modify, sublicense, link with, or 331 | distribute the Library is void, and will automatically terminate your 332 | rights under this License. However, parties who have received copies, 333 | or rights, from you under this License will not have their licenses 334 | terminated so long as such parties remain in full compliance. 335 | 336 | 9. You are not required to accept this License, since you have not 337 | signed it. However, nothing else grants you permission to modify or 338 | distribute the Library or its derivative works. These actions are 339 | prohibited by law if you do not accept this License. Therefore, by 340 | modifying or distributing the Library (or any work based on the 341 | Library), you indicate your acceptance of this License to do so, and 342 | all its terms and conditions for copying, distributing or modifying 343 | the Library or works based on it. 344 | 345 | 10. Each time you redistribute the Library (or any work based on the 346 | Library), the recipient automatically receives a license from the 347 | original licensor to copy, distribute, link with or modify the Library 348 | subject to these terms and conditions. You may not impose any further 349 | restrictions on the recipients' exercise of the rights granted herein. 350 | You are not responsible for enforcing compliance by third parties to 351 | this License. 352 | 353 | 11. If, as a consequence of a court judgment or allegation of patent 354 | infringement or for any other reason (not limited to patent issues), 355 | conditions are imposed on you (whether by court order, agreement or 356 | otherwise) that contradict the conditions of this License, they do not 357 | excuse you from the conditions of this License. If you cannot 358 | distribute so as to satisfy simultaneously your obligations under this 359 | License and any other pertinent obligations, then as a consequence you 360 | may not distribute the Library at all. For example, if a patent 361 | license would not permit royalty-free redistribution of the Library by 362 | all those who receive copies directly or indirectly through you, then 363 | the only way you could satisfy both it and this License would be to 364 | refrain entirely from distribution of the Library. 365 | 366 | If any portion of this section is held invalid or unenforceable under any 367 | particular circumstance, the balance of the section is intended to apply, 368 | and the section as a whole is intended to apply in other circumstances. 369 | 370 | It is not the purpose of this section to induce you to infringe any 371 | patents or other property right claims or to contest validity of any 372 | such claims; this section has the sole purpose of protecting the 373 | integrity of the free software distribution system which is 374 | implemented by public license practices. Many people have made 375 | generous contributions to the wide range of software distributed 376 | through that system in reliance on consistent application of that 377 | system; it is up to the author/donor to decide if he or she is willing 378 | to distribute software through any other system and a licensee cannot 379 | impose that choice. 380 | 381 | This section is intended to make thoroughly clear what is believed to 382 | be a consequence of the rest of this License. 383 | 384 | 12. If the distribution and/or use of the Library is restricted in 385 | certain countries either by patents or by copyrighted interfaces, the 386 | original copyright holder who places the Library under this License may add 387 | an explicit geographical distribution limitation excluding those countries, 388 | so that distribution is permitted only in or among countries not thus 389 | excluded. In such case, this License incorporates the limitation as if 390 | written in the body of this License. 391 | 392 | 13. The Free Software Foundation may publish revised and/or new 393 | versions of the Library General Public License from time to time. 394 | Such new versions will be similar in spirit to the present version, 395 | but may differ in detail to address new problems or concerns. 396 | 397 | Each version is given a distinguishing version number. If the Library 398 | specifies a version number of this License which applies to it and 399 | "any later version", you have the option of following the terms and 400 | conditions either of that version or of any later version published by 401 | the Free Software Foundation. If the Library does not specify a 402 | license version number, you may choose any version ever published by 403 | the Free Software Foundation. 404 | 405 | 14. If you wish to incorporate parts of the Library into other free 406 | programs whose distribution conditions are incompatible with these, 407 | write to the author to ask for permission. For software which is 408 | copyrighted by the Free Software Foundation, write to the Free 409 | Software Foundation; we sometimes make exceptions for this. Our 410 | decision will be guided by the two goals of preserving the free status 411 | of all derivatives of our free software and of promoting the sharing 412 | and reuse of software generally. 413 | 414 | NO WARRANTY 415 | 416 | 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO 417 | WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 418 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR 419 | OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY 420 | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE 421 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 422 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE 423 | LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME 424 | THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 425 | 426 | 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 427 | WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY 428 | AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU 429 | FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR 430 | CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE 431 | LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING 432 | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A 433 | FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF 434 | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 435 | DAMAGES. 436 | 437 | END OF TERMS AND CONDITIONS 438 | 439 | How to Apply These Terms to Your New Libraries 440 | 441 | If you develop a new library, and you want it to be of the greatest 442 | possible use to the public, we recommend making it free software that 443 | everyone can redistribute and change. You can do so by permitting 444 | redistribution under these terms (or, alternatively, under the terms of the 445 | ordinary General Public License). 446 | 447 | To apply these terms, attach the following notices to the library. It is 448 | safest to attach them to the start of each source file to most effectively 449 | convey the exclusion of warranty; and each file should have at least the 450 | "copyright" line and a pointer to where the full notice is found. 451 | 452 | 453 | Copyright (C) 454 | 455 | This library is free software; you can redistribute it and/or 456 | modify it under the terms of the GNU Library General Public 457 | License as published by the Free Software Foundation; either 458 | version 2 of the License, or (at your option) any later version. 459 | 460 | This library is distributed in the hope that it will be useful, 461 | but WITHOUT ANY WARRANTY; without even the implied warranty of 462 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 463 | Library General Public License for more details. 464 | 465 | You should have received a copy of the GNU Library General Public 466 | License along with this library; if not, write to the Free Software 467 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA 468 | 469 | Also add information on how to contact you by electronic and paper mail. 470 | 471 | You should also get your employer (if you work as a programmer) or your 472 | school, if any, to sign a "copyright disclaimer" for the library, if 473 | necessary. Here is a sample; alter the names: 474 | 475 | Yoyodyne, Inc., hereby disclaims all copyright interest in the 476 | library `Frob' (a library for tweaking knobs) written by James Random Hacker. 477 | 478 | , 1 April 1990 479 | Ty Coon, President of Vice 480 | 481 | That's all there is to it! 482 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Installation Instructions 2 | ************************* 3 | 4 | Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free 5 | Software Foundation, Inc. 6 | 7 | This file is free documentation; the Free Software Foundation gives 8 | unlimited permission to copy, distribute and modify it. 9 | 10 | Basic Installation 11 | ================== 12 | 13 | These are generic installation instructions. 14 | 15 | The `configure' shell script attempts to guess correct values for 16 | various system-dependent variables used during compilation. It uses 17 | those values to create a `Makefile' in each directory of the package. 18 | It may also create one or more `.h' files containing system-dependent 19 | definitions. Finally, it creates a shell script `config.status' that 20 | you can run in the future to recreate the current configuration, and a 21 | file `config.log' containing compiler output (useful mainly for 22 | debugging `configure'). 23 | 24 | It can also use an optional file (typically called `config.cache' 25 | and enabled with `--cache-file=config.cache' or simply `-C') that saves 26 | the results of its tests to speed up reconfiguring. (Caching is 27 | disabled by default to prevent problems with accidental use of stale 28 | cache files.) 29 | 30 | If you need to do unusual things to compile the package, please try 31 | to figure out how `configure' could check whether to do them, and mail 32 | diffs or instructions to the address given in the `README' so they can 33 | be considered for the next release. If you are using the cache, and at 34 | some point `config.cache' contains results you don't want to keep, you 35 | may remove or edit it. 36 | 37 | The file `configure.ac' (or `configure.in') is used to create 38 | `configure' by a program called `autoconf'. You only need 39 | `configure.ac' if you want to change it or regenerate `configure' using 40 | a newer version of `autoconf'. 41 | 42 | The simplest way to compile this package is: 43 | 44 | 1. `cd' to the directory containing the package's source code and type 45 | `./configure' to configure the package for your system. If you're 46 | using `csh' on an old version of System V, you might need to type 47 | `sh ./configure' instead to prevent `csh' from trying to execute 48 | `configure' itself. 49 | 50 | Running `configure' takes awhile. While running, it prints some 51 | messages telling which features it is checking for. 52 | 53 | 2. Type `make' to compile the package. 54 | 55 | 3. Optionally, type `make check' to run any self-tests that come with 56 | the package. 57 | 58 | 4. Type `make install' to install the programs and any data files and 59 | documentation. 60 | 61 | 5. You can remove the program binaries and object files from the 62 | source code directory by typing `make clean'. To also remove the 63 | files that `configure' created (so you can compile the package for 64 | a different kind of computer), type `make distclean'. There is 65 | also a `make maintainer-clean' target, but that is intended mainly 66 | for the package's developers. If you use it, you may have to get 67 | all sorts of other programs in order to regenerate files that came 68 | with the distribution. 69 | 70 | Compilers and Options 71 | ===================== 72 | 73 | Some systems require unusual options for compilation or linking that the 74 | `configure' script does not know about. Run `./configure --help' for 75 | details on some of the pertinent environment variables. 76 | 77 | You can give `configure' initial values for configuration parameters 78 | by setting variables in the command line or in the environment. Here 79 | is an example: 80 | 81 | ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix 82 | 83 | *Note Defining Variables::, for more details. 84 | 85 | Compiling For Multiple Architectures 86 | ==================================== 87 | 88 | You can compile the package for more than one kind of computer at the 89 | same time, by placing the object files for each architecture in their 90 | own directory. To do this, you must use a version of `make' that 91 | supports the `VPATH' variable, such as GNU `make'. `cd' to the 92 | directory where you want the object files and executables to go and run 93 | the `configure' script. `configure' automatically checks for the 94 | source code in the directory that `configure' is in and in `..'. 95 | 96 | If you have to use a `make' that does not support the `VPATH' 97 | variable, you have to compile the package for one architecture at a 98 | time in the source code directory. After you have installed the 99 | package for one architecture, use `make distclean' before reconfiguring 100 | for another architecture. 101 | 102 | Installation Names 103 | ================== 104 | 105 | By default, `make install' installs the package's commands under 106 | `/usr/local/bin', include files under `/usr/local/include', etc. You 107 | can specify an installation prefix other than `/usr/local' by giving 108 | `configure' the option `--prefix=PREFIX'. 109 | 110 | You can specify separate installation prefixes for 111 | architecture-specific files and architecture-independent files. If you 112 | pass the option `--exec-prefix=PREFIX' to `configure', the package uses 113 | PREFIX as the prefix for installing programs and libraries. 114 | Documentation and other data files still use the regular prefix. 115 | 116 | In addition, if you use an unusual directory layout you can give 117 | options like `--bindir=DIR' to specify different values for particular 118 | kinds of files. Run `configure --help' for a list of the directories 119 | you can set and what kinds of files go in them. 120 | 121 | If the package supports it, you can cause programs to be installed 122 | with an extra prefix or suffix on their names by giving `configure' the 123 | option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. 124 | 125 | Optional Features 126 | ================= 127 | 128 | Some packages pay attention to `--enable-FEATURE' options to 129 | `configure', where FEATURE indicates an optional part of the package. 130 | They may also pay attention to `--with-PACKAGE' options, where PACKAGE 131 | is something like `gnu-as' or `x' (for the X Window System). The 132 | `README' should mention any `--enable-' and `--with-' options that the 133 | package recognizes. 134 | 135 | For packages that use the X Window System, `configure' can usually 136 | find the X include and library files automatically, but if it doesn't, 137 | you can use the `configure' options `--x-includes=DIR' and 138 | `--x-libraries=DIR' to specify their locations. 139 | 140 | Specifying the System Type 141 | ========================== 142 | 143 | There may be some features `configure' cannot figure out automatically, 144 | but needs to determine by the type of machine the package will run on. 145 | Usually, assuming the package is built to be run on the _same_ 146 | architectures, `configure' can figure that out, but if it prints a 147 | message saying it cannot guess the machine type, give it the 148 | `--build=TYPE' option. TYPE can either be a short name for the system 149 | type, such as `sun4', or a canonical name which has the form: 150 | 151 | CPU-COMPANY-SYSTEM 152 | 153 | where SYSTEM can have one of these forms: 154 | 155 | OS KERNEL-OS 156 | 157 | See the file `config.sub' for the possible values of each field. If 158 | `config.sub' isn't included in this package, then this package doesn't 159 | need to know the machine type. 160 | 161 | If you are _building_ compiler tools for cross-compiling, you should 162 | use the option `--target=TYPE' to select the type of system they will 163 | produce code for. 164 | 165 | If you want to _use_ a cross compiler, that generates code for a 166 | platform different from the build platform, you should specify the 167 | "host" platform (i.e., that on which the generated programs will 168 | eventually be run) with `--host=TYPE'. 169 | 170 | Sharing Defaults 171 | ================ 172 | 173 | If you want to set default values for `configure' scripts to share, you 174 | can create a site shell script called `config.site' that gives default 175 | values for variables like `CC', `cache_file', and `prefix'. 176 | `configure' looks for `PREFIX/share/config.site' if it exists, then 177 | `PREFIX/etc/config.site' if it exists. Or, you can set the 178 | `CONFIG_SITE' environment variable to the location of the site script. 179 | A warning: not all `configure' scripts look for a site script. 180 | 181 | Defining Variables 182 | ================== 183 | 184 | Variables not defined in a site shell script can be set in the 185 | environment passed to `configure'. However, some packages may run 186 | configure again during the build, and the customized values of these 187 | variables may be lost. In order to avoid this problem, you should set 188 | them in the `configure' command line, using `VAR=value'. For example: 189 | 190 | ./configure CC=/usr/local2/bin/gcc 191 | 192 | causes the specified `gcc' to be used as the C compiler (unless it is 193 | overridden in the site shell script). Here is a another example: 194 | 195 | /bin/bash ./configure CONFIG_SHELL=/bin/bash 196 | 197 | Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent 198 | configuration-related scripts to be executed by `/bin/bash'. 199 | 200 | `configure' Invocation 201 | ====================== 202 | 203 | `configure' recognizes the following options to control how it operates. 204 | 205 | `--help' 206 | `-h' 207 | Print a summary of the options to `configure', and exit. 208 | 209 | `--version' 210 | `-V' 211 | Print the version of Autoconf used to generate the `configure' 212 | script, and exit. 213 | 214 | `--cache-file=FILE' 215 | Enable the cache: use and save the results of the tests in FILE, 216 | traditionally `config.cache'. FILE defaults to `/dev/null' to 217 | disable caching. 218 | 219 | `--config-cache' 220 | `-C' 221 | Alias for `--cache-file=config.cache'. 222 | 223 | `--quiet' 224 | `--silent' 225 | `-q' 226 | Do not print messages saying which checks are being made. To 227 | suppress all normal output, redirect it to `/dev/null' (any error 228 | messages will still be shown). 229 | 230 | `--srcdir=DIR' 231 | Look for the package's source code in directory DIR. Usually 232 | `configure' can determine that directory automatically. 233 | 234 | `configure' also accepts some other, not widely useful, options. Run 235 | `configure --help' for more details. 236 | 237 | -------------------------------------------------------------------------------- /MAINTAINERS: -------------------------------------------------------------------------------- 1 | MAINTAINERS 2 | ---- 3 | 4 | Jan Michael Alonzo jmalonzo@webkit.org 5 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | srcdir = @srcdir@ 3 | VPATH = @srcdir@ 4 | 5 | webkit_defs := 6 | webkit_sources := 7 | webkit_py_sources := 8 | nodist_webkit_sources := 9 | webkit_cflags := 10 | 11 | CREATEDEFS = $(PYTHON) $(PYGTK_CODEGENDIR)/createdefs.py 12 | 13 | defsdir = $(pkgdatadir)/defs 14 | defs_DATA = $(webkit_defs) 15 | 16 | common_ldflags = -module -avoid-version 17 | 18 | pkgpythondir = $(pyexecdir)/webkit 19 | pkgpyexecdir = $(pyexecdir)/webkit 20 | 21 | webkitdir = $(pkgpyexecdir)/webkit 22 | 23 | # pywebkitgtk library 24 | pkgpyexec_LTLIBRARIES = webkit.la 25 | 26 | webkit_la_CPPFLAGS = $(PYTHON_INCLUDES) $(DEPS_CPPFLAGS) $(WEBKIT_CPPFLAGS) $(webkit_cflags) 27 | webkit_la_CFLAGS = $(DEPS_CFLAGS) $(WEBKIT_CFLAGS) 28 | webkit_la_LDFLAGS = $(common_ldflags) -export-symbols-regex initwebkit 29 | webkit_la_LIBADD = $(DEPS_LIBS) $(WEBKIT_LIBS) 30 | webkit_la_SOURCES = $(webkit_sources) 31 | nodist_webkit_la_SOURCES = $(nodist_webkit_sources) 32 | 33 | pkgconfigdir = $(libdir)/pkgconfig 34 | pkgconfig_DATA = pywebkitgtk-1.0.pc 35 | 36 | # Python sources 37 | webkit_py_sources += \ 38 | webkit/__init__.py 39 | pkgpython_DATA = $(webkit_py_sources) 40 | 41 | # Build components 42 | webkit_sources += \ 43 | webkit/webkitmodule.c \ 44 | javascriptcore/javascriptcore_types.c \ 45 | javascriptcore/javascriptcore_types.h 46 | nodist_webkit_sources += webkit/webkit.c 47 | 48 | # WebKit/Gtk definitions 49 | webkit_defs += $(srcdir)/webkit/webkitdom.defs 50 | webkit_defs += $(srcdir)/webkit/webkit-base-types.defs $(srcdir)/webkit/webkit-1.1-types.defs 51 | webkit_defs += $(srcdir)/webkit/webkit-1.0.2.defs $(srcdir)/webkit/webkit-1.1.defs 52 | 53 | webkit_deps := \ 54 | $(srcdir)/webkit/webkit.override \ 55 | webkit/webkit.defs 56 | 57 | webkit/webkit.c: $(webkit_deps) 58 | 59 | webkit/webkit.defs: $(webkit_defs) 60 | $(CREATEDEFS) $@ $(webkit_defs) 61 | 62 | # FIXME: this is causing a build issue in ArchLinux. Figure out why 63 | # disable for now since line is not really critical. 64 | # && ! grep -q -v "^\*\*\*INFO\*\*\*" $(*D)/$(*F).errors 65 | .defs.c: 66 | ($(PYGOBJECT_CODEGEN) \ 67 | --register $(PYGTK_DEFSDIR)/gdk-types.defs \ 68 | --register $(PYGTK_DEFSDIR)/gtk-types.defs \ 69 | --override $(srcdir)/$(*D)/$(*F).override \ 70 | --prefix py$(*F) $(*D)/$(*F).defs) 2>&1 > $(*D)/gen-$(*F).c | tee $(*D)/$(*F).errors \ 71 | && cp $(*D)/gen-$(*F).c $(*D)/$(*F).c \ 72 | && rm -f $(*D)/gen-$(*F).c 73 | 74 | dist-hook: ChangeLog 75 | 76 | ChangeLog: 77 | git log --stat > ChangeLog 78 | 79 | uninstall-hook: 80 | -rmdir $(webkitdir) 81 | 82 | MAINTAINERCLEANFILES = \ 83 | ChangeLog \ 84 | $(srcdir)/aclocal.m4 \ 85 | $(srcdir)/config.h.in \ 86 | $(srcdir)/compile \ 87 | $(srcdir)/config.guess \ 88 | $(srcdir)/config.sub \ 89 | $(srcdir)/configure \ 90 | $(srcdir)/depcomp \ 91 | $(srcdir)/install-sh \ 92 | $(srcdir)/ltmain.sh \ 93 | $(srcdir)/missing 94 | 95 | CLEANFILES = \ 96 | config.lt \ 97 | demos/inspector.pyc \ 98 | $(srcdir)/webkit/gen-webkit.c \ 99 | $(builddir)/webkit/webkit.c \ 100 | webkit/__init__.pyc \ 101 | webkit/webkit.defs \ 102 | webkit/webkit-types.defs \ 103 | $(builddir)/webkit/webkit.errors \ 104 | Makefile.in \ 105 | pywebkitgtk-1.0.pc 106 | 107 | EXTRA_DIST = \ 108 | AUTHORS \ 109 | COPYING \ 110 | INSTALL \ 111 | MAINTAINERS \ 112 | NEWS \ 113 | README \ 114 | demos/inspector.py \ 115 | demos/browser.py \ 116 | webkit/webkit.override \ 117 | tests/test_webbackforwardlist.py \ 118 | tests/test_webframe.py \ 119 | tests/test_webnavigationaction.py \ 120 | $(webkit_types_defs) \ 121 | $(webkit_defs) \ 122 | $(webkit_py_sources) 123 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | 07 August 2010 - pywebkitgtk 1.1.8 2 | --- 3 | - Fixes for he following defects 4 | * Issue 36: Compiled code is recompiled during 'make install' 5 | * Issue 40: Segmentation fault on destroy 6 | * Issue 44: Expose the enums 7 | * Issue 46: Install the pkgconfig file on make install 8 | * Issue 47: pkg-config variable 'codegendir' should be taken from pygobject-2.0 9 | * Issue 48: segfault when calling WebBackForwardList.get_back_list_with_limit() 10 | * Issue 51: Add support for getting a NetworkResponse from a WebFrame 11 | 12 | 03 October 2010 - pywebkitgtk 1.1.7 13 | --- 14 | - WebDataSource and WebDatabase bindings 15 | - Miscellaneous bug fixes 16 | 17 | 08 August 2009 - pywebkitgtk 1.1.6 18 | ---- 19 | - WebView wrapper fixes (mostly by Sayamindu): 20 | * load_uri, move_cursor, copy_clipboard (NEW) 21 | * cut_clipboard, can_copy_clipboard and can_paste_clipboard 22 | - GObject threads are now initialized by the PyWebKitGtk 23 | - OS X build fix 24 | 25 | 29 May 2009 - pywebkitgtk 1.1.5 26 | ---- 27 | - New Printing API added to WebFrame. 28 | - Covers improvements and changes from WebKitGtk 1.1.5 up to 1.1.8 29 | Summary: 30 | * Accessibility improvements 31 | * Support for caret browsing 32 | * Support for spell-checking 33 | * WebKitGtk now displays an error page for load errors 34 | * JIT support for X86_64 35 | * Arbitrary widget embedding as if it was a plugin 36 | * HTML5 database and localStorage Settings API 37 | See http://trac.webkit.org/browser/trunk/WebKit/gtk/NEWS for more info. 38 | 39 | 1 Apr 2009 - pywebkitgtk 1.1.4 40 | ---- 41 | - Libtool 2.2 compatibility 42 | - WebPolicyDecision API 43 | 44 | 18 Mar 2009 - pywebkitgtk 1.1.3 45 | ---- 46 | - New API: WebDownload 47 | - WebHistoryItem constructor update 48 | - now accepts 'uri' and 'title' properties 49 | - More unit tests 50 | 51 | 7 Mar 2009 - pywebkitgtk 1.1 52 | ---- 53 | - WebKitGtk 1.1 API 54 | * WebInspector 55 | * WebNavigationDecision 56 | * WebPolicyDecision 57 | * API updates 58 | * Bug fixes 59 | - tabbed_browser replaces webbrowser 60 | 61 | 1 Nov 2008 - pywebkitgtk 1.0.2 62 | ---- 63 | - .pc file cleanup when invoking make clean 64 | - Build fix for PyGtk 2.13 - Patch by Jason Ribeiro 65 | - demos/webbrowser.py style fix - Patch by Steve Milner 66 | 67 | 68 | 15 Aug 2008 - pywebkitgtk 1.0.1 69 | ---- 70 | - Release for WebKitGtk 1.0.1 71 | 72 | 73 | 1 Oct 2007 - pywebkitgtk 0.2 74 | ---- 75 | - Initial release 76 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NEWS 2 | 3 | *This project is currently unmaintaned. I currently have no time to work on this project so feel free to volunteer.* 4 | 5 | # Python WebKit GTK+ 6 | 7 | The PyWebKitGtk project aims to provide Python bindings to the GTK+ port of 8 | WebKit, an open-source web browser engine that powers numerous applications 9 | such as web browsers, email clients, feed readers, web and text editors, and a 10 | whole lot more[1] 11 | 12 | # Project Goals 13 | 14 | The project share the same goals with WebKit[2]. The purpose of this binding 15 | is to bring an alternative web engine to Python/GTK+ application developers who 16 | might need a web browser engine for their next application or developers 17 | wishing to have a better browser engine that they can access to using the 18 | Python programming language. 19 | 20 | Happy Hacking! 21 | 22 | # Contact 23 | 24 | Web: http://code.google.com/p/pywebkitgtk 25 | 26 | Source (Git): http://repo.or.cz/w/pywebkitgtk.git 27 | 28 | Source (SVN): http://code.google.com/p/pywebkitgtk/source 29 | 30 | 31 | References 32 | ---- 33 | 34 | [1] Applications that use WebKit 35 | http://trac.webkit.org/projects/webkit/wiki/Applications%20using%20WebKit 36 | 37 | [2] WebKit Goals 38 | http://webkit.org/projects/goals.html 39 | 40 | [3] WebKit Bugzilla 41 | http://bugs.webkit.org 42 | 43 | 44 | Resources 45 | ---- 46 | 47 | * GNOME Desktop 48 | http://www.gnome.org 49 | 50 | * GTK+ 51 | http://www.gtk.org 52 | 53 | * Python 54 | http://www.python.org 55 | 56 | * WebKit 57 | http://www.webkit.org 58 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # Allow invocation from a separate build directory; in that case, we change 4 | # to the source directory to run the auto*, then change back before running configure 5 | srcdir=`dirname $0` 6 | test -z "$srcdir" && srcdir=. 7 | 8 | PROJECT="pywebkitgtk" 9 | ORIGDIR=`pwd` 10 | cd $srcdir 11 | 12 | DIE=0 13 | 14 | (autoconf --version) < /dev/null > /dev/null 2>&1 || { 15 | echo 16 | echo "You must have autoconf installed to compile $PROJECT." 17 | echo "Install the appropriate package for your distribution," 18 | echo "or get the source tarball at http://ftp.gnu.org/gnu/autoconf/" 19 | DIE=1 20 | } 21 | 22 | (automake --version) < /dev/null > /dev/null 2>&1 || { 23 | echo 24 | echo "You must have automake installed to compile $PROJECT." 25 | echo "Install the appropriate package for your distribution," 26 | echo "or get the source tarball at http://ftp.gnu.org/gnu/automake/" 27 | DIE=1 28 | } 29 | 30 | LIBTOOLIZE=libtoolize 31 | ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || { 32 | LIBTOOLIZE=glibtoolize 33 | ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || { 34 | echo 35 | echo "You must have libtool installed to compile $PROJECT." 36 | echo "Install the appropriate package for your distribution," 37 | echo "or get the source tarball at http://ftp.gnu.org/gnu/libtool/" 38 | DIE=1 39 | } 40 | } 41 | 42 | if test "$DIE" -eq 1; then 43 | exit 1 44 | fi 45 | 46 | rm -rf $top_srcdir/autom4te.cache 47 | 48 | aclocal -I m4 || exit $? 49 | $LIBTOOLIZE --force || exit $? 50 | autoheader || exit $? 51 | automake --foreign --add-missing || exit $? 52 | autoconf || exit $? 53 | 54 | cd $ORIGDIR || exit 1 55 | 56 | $srcdir/configure $AUTOGEN_CONFIGURE_ARGS "$@" || exit $? 57 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | # configure script for pywebkitgtk 2 | 3 | m4_define([pywebkitgtk_major_version], [1]) 4 | m4_define([pywebkitgtk_minor_version], [1]) 5 | m4_define([pywebkitgtk_micro_version], [8]) 6 | 7 | m4_define([pywebkitgtk_version], 8 | [pywebkitgtk_major_version.pywebkitgtk_minor_version.pywebkitgtk_micro_version]) 9 | 10 | AC_INIT([pywebkitgtk], 11 | [pywebkitgtk_version], 12 | [http://code.google.com/p/pywebkitgtk/issues]) 13 | 14 | AC_PREREQ([2.59]) 15 | AC_CONFIG_MACRO_DIR([m4]) 16 | AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I .") 17 | 18 | AC_CONFIG_SRCDIR([configure.ac]) 19 | AC_CONFIG_HEADERS([config.h]) 20 | 21 | AC_DEFINE_UNQUOTED(PYWEBKITGTK_VERSION, pywebkitgtk_version, 22 | [The release version of Python WebKit Gtk+]) 23 | AC_DEFINE_UNQUOTED(PYWEBKITGTK_MAJOR_VERSION, pywebkitgtk_major_version, 24 | [The major version of Python WebKit Gtk+.]) 25 | AC_DEFINE_UNQUOTED(PYWEBKITGTK_MINOR_VERSION, pywebkitgtk_minor_version, 26 | [The minor version of Python WebKit Gtk+.]) 27 | AC_DEFINE_UNQUOTED(PYWEBKITGTK_MICRO_VERSION, pywebkitgtk_micro_version, 28 | [The micro version of Python WebKit Gtk+.]) 29 | 30 | AM_INIT_AUTOMAKE([foreign subdir-objects]) 31 | 32 | AM_PROG_CC_C_O 33 | AC_PROG_LIBTOOL 34 | dnl when using libtool 2.x create libtool early, because it's used in configure 35 | m4_ifdef([LT_OUTPUT], [LT_OUTPUT]) 36 | 37 | dnl check for python 38 | AM_PATH_PYTHON(2.4) 39 | AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)]) 40 | 41 | dnl from pygtk: get rid of -export-dynamic stuff from the configure flags... 42 | export_dynamic=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh` 43 | 44 | dnl check for dependencies 45 | dnl Check for libxslt until upstream WebKit checks for it as this is a webkit 46 | dnl dep and not pywebkitgtk's. 47 | PKG_CHECK_MODULES(DEPS, 48 | [libxslt 49 | gthread-2.0 50 | pygtk-2.0]) 51 | AC_SUBST(DEPS_CFLAGS) 52 | AC_SUBST(DEPS_LIBS) 53 | AC_SUBST(DEPS_CPPFLAGS) 54 | 55 | dnl python code gen 56 | AC_PATH_PROGS(PYGOBJECT_CODEGEN, pygobject-codegen-2.0 pygtk-codegen-2.0, no) 57 | if test "x$PYGOBJECT_CODEGEN" = xno; then 58 | AC_MSG_ERROR(could not find pygobject-codegen-2.0 script) 59 | fi 60 | 61 | dnl check for pygtk defsdir 62 | AC_MSG_CHECKING(for pygtk defs) 63 | PYGTK_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygtk-2.0` 64 | AC_SUBST(PYGTK_DEFSDIR) 65 | AC_MSG_RESULT($PYGTK_DEFSDIR) 66 | 67 | dnl check for pygtk codegen dir 68 | AC_MSG_CHECKING(for pygtk codegendir) 69 | PYGTK_CODEGENDIR=`$PKG_CONFIG --variable=codegendir pygobject-2.0` 70 | AC_SUBST(PYGTK_CODEGENDIR) 71 | AC_MSG_RESULT($PYGTK_CODEGENDIR) 72 | 73 | # the minimum version of WebKitGtk required for this version of PyWebKitGtk to work 74 | WEBKITGTK_REQUIRED_VERSION=1.1.10 75 | 76 | dnl check for webkit versions installed 77 | PKG_CHECK_MODULES(WEBKIT, [webkit-1.0 >= $WEBKITGTK_REQUIRED_VERSION]) 78 | AC_SUBST(WEBKIT_CFLAGS) 79 | AC_SUBST(WEBKIT_LIBS) 80 | AC_SUBST(WEBKIT_CPPFLAGS) 81 | 82 | dnl output 83 | AC_CONFIG_FILES([ 84 | Makefile 85 | pywebkitgtk-1.0.pc:pywebkitgtk.pc.in 86 | ]) 87 | 88 | AC_OUTPUT 89 | -------------------------------------------------------------------------------- /demos/browser.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (C) 2007, 2008, 2009 Jan Michael Alonzo 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | # TODO: 19 | # 20 | # * fix tab relabelling 21 | # * search page interface 22 | # * custom button - w/o margins/padding to make tabs thin 23 | # 24 | 25 | from gettext import gettext as _ 26 | 27 | import gobject 28 | import gtk 29 | import pango 30 | import webkit 31 | from inspector import Inspector 32 | 33 | ABOUT_PAGE = """ 34 | PyWebKitGtk - About 35 |

Welcome to webbrowser.py

36 |

http://code.google.com/p/pywebkitgtk/
38 |

39 | 40 | """ 41 | 42 | class BrowserPage(webkit.WebView): 43 | 44 | def __init__(self): 45 | webkit.WebView.__init__(self) 46 | settings = self.get_settings() 47 | settings.set_property("enable-developer-extras", True) 48 | 49 | # scale other content besides from text as well 50 | self.set_full_content_zoom(True) 51 | 52 | # make sure the items will be added in the end 53 | # hence the reason for the connect_after 54 | self.connect_after("populate-popup", self.populate_popup) 55 | 56 | def populate_popup(self, view, menu): 57 | # zoom buttons 58 | zoom_in = gtk.ImageMenuItem(gtk.STOCK_ZOOM_IN) 59 | zoom_in.connect('activate', zoom_in_cb, view) 60 | menu.append(zoom_in) 61 | 62 | zoom_out = gtk.ImageMenuItem(gtk.STOCK_ZOOM_OUT) 63 | zoom_out.connect('activate', zoom_out_cb, view) 64 | menu.append(zoom_out) 65 | 66 | zoom_hundred = gtk.ImageMenuItem(gtk.STOCK_ZOOM_100) 67 | zoom_hundred.connect('activate', zoom_hundred_cb, view) 68 | menu.append(zoom_hundred) 69 | 70 | printitem = gtk.ImageMenuItem(gtk.STOCK_PRINT) 71 | menu.append(printitem) 72 | printitem.connect('activate', print_cb, view) 73 | 74 | page_properties = gtk.ImageMenuItem(gtk.STOCK_PROPERTIES) 75 | menu.append(page_properties) 76 | page_properties.connect('activate', page_properties_cb, view) 77 | 78 | menu.append(gtk.SeparatorMenuItem()) 79 | 80 | aboutitem = gtk.ImageMenuItem(gtk.STOCK_ABOUT) 81 | menu.append(aboutitem) 82 | aboutitem.connect('activate', about_pywebkitgtk_cb, view) 83 | 84 | menu.show_all() 85 | return False 86 | 87 | class TabLabel (gtk.HBox): 88 | """A class for Tab labels""" 89 | 90 | __gsignals__ = { 91 | "close": (gobject.SIGNAL_RUN_FIRST, 92 | gobject.TYPE_NONE, 93 | (gobject.TYPE_OBJECT,)) 94 | } 95 | 96 | def __init__ (self, title, child): 97 | """initialize the tab label""" 98 | gtk.HBox.__init__(self, False, 4) 99 | self.title = title 100 | self.child = child 101 | self.label = gtk.Label(title) 102 | self.label.props.max_width_chars = 30 103 | self.label.set_ellipsize(pango.ELLIPSIZE_MIDDLE) 104 | self.label.set_alignment(0.0, 0.5) 105 | 106 | icon = gtk.image_new_from_stock(gtk.STOCK_ORIENTATION_PORTRAIT, gtk.ICON_SIZE_BUTTON) 107 | close_image = gtk.image_new_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU) 108 | close_button = gtk.Button() 109 | close_button.set_relief(gtk.RELIEF_NONE) 110 | close_button.connect("clicked", self._close_tab, child) 111 | close_button.set_image(close_image) 112 | self.pack_start(icon, False, False, 0) 113 | self.pack_start(self.label, True, True, 0) 114 | self.pack_start(close_button, False, False, 0) 115 | 116 | self.set_data("label", self.label) 117 | self.set_data("close-button", close_button) 118 | self.connect("style-set", tab_label_style_set_cb) 119 | 120 | def set_label (self, text): 121 | """sets the text of this label""" 122 | self.label.set_label(text) 123 | 124 | def _close_tab (self, widget, child): 125 | self.emit("close", child) 126 | 127 | def tab_label_style_set_cb (tab_label, style): 128 | context = tab_label.get_pango_context() 129 | metrics = context.get_metrics(tab_label.style.font_desc, context.get_language()) 130 | char_width = metrics.get_approximate_digit_width() 131 | (width, height) = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU) 132 | tab_label.set_size_request(20 * pango.PIXELS(char_width) + 2 * width, 133 | pango.PIXELS(metrics.get_ascent() + 134 | metrics.get_descent()) + 8) 135 | 136 | 137 | class ContentPane (gtk.Notebook): 138 | 139 | __gsignals__ = { 140 | "focus-view-title-changed": (gobject.SIGNAL_RUN_FIRST, 141 | gobject.TYPE_NONE, 142 | (gobject.TYPE_OBJECT, gobject.TYPE_STRING,)), 143 | "new-window-requested": (gobject.SIGNAL_RUN_FIRST, 144 | gobject.TYPE_NONE, 145 | (gobject.TYPE_OBJECT,)) 146 | } 147 | 148 | def __init__ (self): 149 | """initialize the content pane""" 150 | gtk.Notebook.__init__(self) 151 | self.props.scrollable = True 152 | self.props.homogeneous = True 153 | self.connect("switch-page", self._switch_page) 154 | 155 | self.show_all() 156 | self._hovered_uri = None 157 | 158 | def load (self, text): 159 | """load the given uri in the current web view""" 160 | child = self.get_nth_page(self.get_current_page()) 161 | view = child.get_child() 162 | view.open(text) 163 | 164 | def new_tab_with_webview (self, webview): 165 | """creates a new tab with the given webview as its child""" 166 | self._construct_tab_view(webview) 167 | 168 | def new_tab (self, url=None): 169 | """creates a new page in a new tab""" 170 | # create the tab content 171 | browser = BrowserPage() 172 | self._construct_tab_view(browser, url) 173 | 174 | def _construct_tab_view (self, web_view, url=None): 175 | web_view.connect("hovering-over-link", self._hovering_over_link_cb) 176 | web_view.connect("populate-popup", self._populate_page_popup_cb) 177 | web_view.connect("load-finished", self._view_load_finished_cb) 178 | web_view.connect("create-web-view", self._new_web_view_request_cb) 179 | web_view.connect("title-changed", self._title_changed_cb) 180 | inspector = Inspector(web_view.get_web_inspector()) 181 | 182 | scrolled_window = gtk.ScrolledWindow() 183 | scrolled_window.props.hscrollbar_policy = gtk.POLICY_AUTOMATIC 184 | scrolled_window.props.vscrollbar_policy = gtk.POLICY_AUTOMATIC 185 | scrolled_window.add(web_view) 186 | scrolled_window.show_all() 187 | 188 | # create the tab 189 | label = TabLabel(url, scrolled_window) 190 | label.connect("close", self._close_tab) 191 | label.show_all() 192 | 193 | new_tab_number = self.append_page(scrolled_window, label) 194 | self.set_tab_label_packing(scrolled_window, False, False, gtk.PACK_START) 195 | self.set_tab_label(scrolled_window, label) 196 | 197 | # hide the tab if there's only one 198 | self.set_show_tabs(self.get_n_pages() > 1) 199 | 200 | self.show_all() 201 | self.set_current_page(new_tab_number) 202 | 203 | # load the content 204 | self._hovered_uri = None 205 | if not url: 206 | web_view.load_string(ABOUT_PAGE, "text/html", "iso-8859-15", "about") 207 | else: 208 | web_view.load_uri(url) 209 | 210 | def _populate_page_popup_cb(self, view, menu): 211 | # misc 212 | if self._hovered_uri: 213 | open_in_new_tab = gtk.MenuItem(_("Open Link in New Tab")) 214 | open_in_new_tab.connect("activate", self._open_in_new_tab, view) 215 | menu.insert(open_in_new_tab, 0) 216 | menu.show_all() 217 | 218 | def _open_in_new_tab (self, menuitem, view): 219 | self.new_tab(self._hovered_uri) 220 | 221 | def _close_tab (self, label, child): 222 | page_num = self.page_num(child) 223 | if page_num != -1: 224 | view = child.get_child() 225 | view.destroy() 226 | self.remove_page(page_num) 227 | self.set_show_tabs(self.get_n_pages() > 1) 228 | 229 | def _switch_page (self, notebook, page, page_num): 230 | child = self.get_nth_page(page_num) 231 | view = child.get_child() 232 | frame = view.get_main_frame() 233 | self.emit("focus-view-title-changed", frame, frame.props.title) 234 | 235 | def _hovering_over_link_cb (self, view, title, uri): 236 | self._hovered_uri = uri 237 | 238 | def _title_changed_cb (self, view, frame, title): 239 | child = self.get_nth_page(self.get_current_page()) 240 | label = self.get_tab_label(child) 241 | label.set_label(title) 242 | self.emit("focus-view-title-changed", frame, title) 243 | 244 | def _view_load_finished_cb(self, view, frame): 245 | child = self.get_nth_page(self.get_current_page()) 246 | label = self.get_tab_label(child) 247 | title = frame.get_title() 248 | if not title: 249 | title = frame.get_uri() 250 | if title: 251 | label.set_label(title) 252 | 253 | def _new_web_view_request_cb (self, web_view, web_frame): 254 | scrolled_window = gtk.ScrolledWindow() 255 | scrolled_window.props.hscrollbar_policy = gtk.POLICY_AUTOMATIC 256 | scrolled_window.props.vscrollbar_policy = gtk.POLICY_AUTOMATIC 257 | view = BrowserPage() 258 | scrolled_window.add(view) 259 | scrolled_window.show_all() 260 | 261 | vbox = gtk.VBox(spacing=1) 262 | vbox.pack_start(scrolled_window, True, True) 263 | 264 | window = gtk.Window() 265 | window.add(vbox) 266 | view.connect("web-view-ready", self._new_web_view_ready_cb) 267 | return view 268 | 269 | def _new_web_view_ready_cb (self, web_view): 270 | self.emit("new-window-requested", web_view) 271 | 272 | 273 | class WebToolbar(gtk.Toolbar): 274 | 275 | __gsignals__ = { 276 | "load-requested": (gobject.SIGNAL_RUN_FIRST, 277 | gobject.TYPE_NONE, 278 | (gobject.TYPE_STRING,)), 279 | "new-tab-requested": (gobject.SIGNAL_RUN_FIRST, 280 | gobject.TYPE_NONE, ()), 281 | "view-source-mode-requested": (gobject.SIGNAL_RUN_FIRST, 282 | gobject.TYPE_NONE, 283 | (gobject.TYPE_BOOLEAN, )) 284 | } 285 | 286 | def __init__(self, location_enabled=True, toolbar_enabled=True): 287 | gtk.Toolbar.__init__(self) 288 | 289 | # location entry 290 | if location_enabled: 291 | self._entry = gtk.Entry() 292 | self._entry.connect('activate', self._entry_activate_cb) 293 | entry_item = gtk.ToolItem() 294 | entry_item.set_expand(True) 295 | entry_item.add(self._entry) 296 | self._entry.show() 297 | self.insert(entry_item, -1) 298 | entry_item.show() 299 | 300 | # add tab button 301 | if toolbar_enabled: 302 | addTabButton = gtk.ToolButton(gtk.STOCK_ADD) 303 | addTabButton.connect("clicked", self._add_tab_cb) 304 | self.insert(addTabButton, -1) 305 | addTabButton.show() 306 | 307 | viewSourceItem = gtk.ToggleToolButton(gtk.STOCK_PROPERTIES) 308 | viewSourceItem.set_label("View Source Mode") 309 | viewSourceItem.connect('toggled', self._view_source_mode_cb) 310 | self.insert(viewSourceItem, -1) 311 | viewSourceItem.show() 312 | 313 | def location_set_text (self, text): 314 | self._entry.set_text(text) 315 | 316 | def _entry_activate_cb(self, entry): 317 | self.emit("load-requested", entry.props.text) 318 | 319 | def _add_tab_cb(self, button): 320 | self.emit("new-tab-requested") 321 | 322 | def _view_source_mode_cb(self, button): 323 | self.emit("view-source-mode-requested", button.get_active()) 324 | 325 | class WebBrowser(gtk.Window): 326 | 327 | def __init__(self): 328 | gtk.Window.__init__(self) 329 | 330 | toolbar = WebToolbar() 331 | content_tabs = ContentPane() 332 | content_tabs.connect("focus-view-title-changed", self._title_changed_cb, toolbar) 333 | content_tabs.connect("new-window-requested", self._new_window_requested_cb) 334 | toolbar.connect("load-requested", load_requested_cb, content_tabs) 335 | toolbar.connect("new-tab-requested", new_tab_requested_cb, content_tabs) 336 | toolbar.connect("view-source-mode-requested", view_source_mode_requested_cb, content_tabs) 337 | 338 | vbox = gtk.VBox(spacing=1) 339 | vbox.pack_start(toolbar, expand=False, fill=False) 340 | vbox.pack_start(content_tabs) 341 | 342 | self.add(vbox) 343 | self.set_default_size(800, 600) 344 | self.connect('destroy', destroy_cb, content_tabs) 345 | 346 | self.show_all() 347 | 348 | content_tabs.new_tab("http://www.google.com") 349 | 350 | def _new_window_requested_cb (self, content_pane, view): 351 | features = view.get_window_features() 352 | window = view.get_toplevel() 353 | 354 | scrolled_window = view.get_parent() 355 | if features.get_property("scrollbar-visible"): 356 | scrolled_window.props.hscrollbar_policy = gtk.POLICY_NEVER 357 | scrolled_window.props.vscrollbar_policy = gtk.POLICY_NEVER 358 | 359 | isLocationbarVisible = features.get_property("locationbar-visible") 360 | isToolbarVisible = features.get_property("toolbar-visible") 361 | if isLocationbarVisible or isToolbarVisible: 362 | toolbar = WebToolbar(isLocationbarVisible, isToolbarVisible) 363 | scrolled_window.get_parent().pack_start(toolbar, False, False, 0) 364 | 365 | window.set_default_size(features.props.width, features.props.height) 366 | window.move(features.props.x, features.props.y) 367 | 368 | window.show_all() 369 | return True 370 | 371 | def _title_changed_cb (self, tabbed_pane, frame, title, toolbar): 372 | if not title: 373 | title = frame.get_uri() 374 | self.set_title(_("PyWebKitGtk - %s") % title) 375 | load_committed_cb(tabbed_pane, frame, toolbar) 376 | 377 | # event handlers 378 | def new_tab_requested_cb (toolbar, content_pane): 379 | content_pane.new_tab("about:blank") 380 | 381 | def load_requested_cb (widget, text, content_pane): 382 | if not text: 383 | return 384 | content_pane.load(text) 385 | 386 | def load_committed_cb (tabbed_pane, frame, toolbar): 387 | uri = frame.get_uri() 388 | if uri: 389 | toolbar.location_set_text(uri) 390 | 391 | def destroy_cb(window, content_pane): 392 | """destroy window resources""" 393 | num_pages = content_pane.get_n_pages() 394 | while num_pages != -1: 395 | child = content_pane.get_nth_page(num_pages) 396 | if child: 397 | view = child.get_child() 398 | num_pages = num_pages - 1 399 | window.destroy() 400 | gtk.main_quit() 401 | 402 | # context menu item callbacks 403 | def about_pywebkitgtk_cb(menu_item, web_view): 404 | web_view.open("http://live.gnome.org/PyWebKitGtk") 405 | 406 | def zoom_in_cb(menu_item, web_view): 407 | """Zoom into the page""" 408 | web_view.zoom_in() 409 | 410 | def zoom_out_cb(menu_item, web_view): 411 | """Zoom out of the page""" 412 | web_view.zoom_out() 413 | 414 | def zoom_hundred_cb(menu_item, web_view): 415 | """Zoom 100%""" 416 | if not (web_view.get_zoom_level() == 1.0): 417 | web_view.set_zoom_level(1.0) 418 | 419 | def print_cb(menu_item, web_view): 420 | mainframe = web_view.get_main_frame() 421 | mainframe.print_full(gtk.PrintOperation(), gtk.PRINT_OPERATION_ACTION_PRINT_DIALOG); 422 | 423 | def page_properties_cb(menu_item, web_view): 424 | mainframe = web_view.get_main_frame() 425 | datasource = mainframe.get_data_source() 426 | main_resource = datasource.get_main_resource() 427 | window = gtk.Window() 428 | window.set_default_size(100, 60) 429 | vbox = gtk.VBox() 430 | hbox = gtk.HBox() 431 | hbox.pack_start(gtk.Label("MIME Type :"), False, False) 432 | hbox.pack_end(gtk.Label(main_resource.get_mime_type()), False, False) 433 | vbox.pack_start(hbox, False, False) 434 | hbox2 = gtk.HBox() 435 | hbox2.pack_start(gtk.Label("URI : "), False, False) 436 | hbox2.pack_end(gtk.Label(main_resource.get_uri()), False, False) 437 | vbox.pack_start(hbox2, False, False) 438 | hbox3 = gtk.HBox() 439 | hbox3.pack_start(gtk.Label("Encoding : "), False, False) 440 | hbox3.pack_end(gtk.Label(main_resource.get_encoding()), False, False) 441 | vbox.pack_start(hbox3, False, False) 442 | window.add(vbox) 443 | window.show_all() 444 | window.present() 445 | 446 | 447 | def view_source_mode_requested_cb(widget, is_active, content_pane): 448 | currentTab = content_pane.get_nth_page(content_pane.get_current_page()) 449 | childView = currentTab.get_child() 450 | childView.set_view_source_mode(is_active) 451 | childView.reload() 452 | 453 | if __name__ == "__main__": 454 | webbrowser = WebBrowser() 455 | gtk.main() 456 | -------------------------------------------------------------------------------- /demos/inspector.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2008 Jan Alonzo 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 | 17 | import gtk 18 | import webkit 19 | 20 | class Inspector (gtk.Window): 21 | def __init__ (self, inspector): 22 | """initialize the WebInspector class""" 23 | gtk.Window.__init__(self) 24 | self.set_default_size(600, 480) 25 | 26 | self._web_inspector = inspector 27 | 28 | self._web_inspector.connect("inspect-web-view", 29 | self._inspect_web_view_cb) 30 | self._web_inspector.connect("show-window", 31 | self._show_window_cb) 32 | self._web_inspector.connect("attach-window", 33 | self._attach_window_cb) 34 | self._web_inspector.connect("detach-window", 35 | self._detach_window_cb) 36 | self._web_inspector.connect("close-window", 37 | self._close_window_cb) 38 | self._web_inspector.connect("finished", 39 | self._finished_cb) 40 | 41 | self.connect("delete-event", self._close_window_cb) 42 | 43 | def _inspect_web_view_cb (self, inspector, web_view): 44 | """Called when the 'inspect' menu item is activated""" 45 | scrolled_window = gtk.ScrolledWindow() 46 | scrolled_window.props.hscrollbar_policy = gtk.POLICY_AUTOMATIC 47 | scrolled_window.props.vscrollbar_policy = gtk.POLICY_AUTOMATIC 48 | webview = webkit.WebView() 49 | scrolled_window.add(webview) 50 | scrolled_window.show_all() 51 | 52 | self.add(scrolled_window) 53 | return webview 54 | 55 | def _show_window_cb (self, inspector): 56 | """Called when the inspector window should be displayed""" 57 | self.present() 58 | return True 59 | 60 | def _attach_window_cb (self, inspector): 61 | """Called when the inspector should displayed in the same 62 | window as the WebView being inspected 63 | """ 64 | return False 65 | 66 | def _detach_window_cb (self, inspector): 67 | """Called when the inspector should appear in a separate window""" 68 | return False 69 | 70 | def _close_window_cb (self, inspector, view): 71 | """Called when the inspector window should be closed""" 72 | self.hide() 73 | return True 74 | 75 | def _finished_cb (self, inspector): 76 | """Called when inspection is done""" 77 | self._web_inspector = 0 78 | self.destroy() 79 | return False 80 | -------------------------------------------------------------------------------- /javascriptcore/javascriptcore_types.c: -------------------------------------------------------------------------------- 1 | /* PyWebKitGtk - Python bindings to WebKit/GTK+ 2 | * 3 | * Copyright (C) 2009 Jan Michael Alonzo 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with this library; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA 18 | */ 19 | 20 | #include "javascriptcore_types.h" 21 | 22 | /** functions to wrap C objects -> Python Objects */ 23 | 24 | PyObject* wrap_JSGlobalContextRef(JSGlobalContextRef jsglobalref) 25 | { 26 | PyObject *ret; 27 | 28 | if (jsglobalref == NULL) { 29 | Py_INCREF (Py_None); 30 | return (Py_None); 31 | } 32 | 33 | ret = PyCObject_FromVoidPtrAndDesc ((void *) jsglobalref, (char *) 34 | "JSGlobalContextRef", NULL); 35 | return (ret); 36 | } 37 | 38 | PyObject* wrap_JSContextRef(JSContextRef jsglobalref) 39 | { 40 | PyObject *ret; 41 | 42 | if (jsglobalref == NULL) { 43 | Py_INCREF (Py_None); 44 | return (Py_None); 45 | } 46 | 47 | ret = PyCObject_FromVoidPtrAndDesc ((void *) jsglobalref, (char *) 48 | "JSContextRef", NULL); 49 | return (ret); 50 | } 51 | -------------------------------------------------------------------------------- /javascriptcore/javascriptcore_types.h: -------------------------------------------------------------------------------- 1 | /* PyWebKitGtk - Python bindings to WebKit/GTK+ 2 | * 3 | * Copyright (C) 2009 Jan Michael Alonzo 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with this library; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef PYWEBKITGTK_WRAP_JSC_H 21 | #define PYWEBKITGTK_WRAP_JSC_H 22 | 23 | #undef _POSIX_C_SOURCE 24 | #include 25 | #include 26 | 27 | typedef struct { 28 | PyObject_HEAD 29 | JSContextRef obj; 30 | } JSContextRef_object; 31 | 32 | typedef struct { 33 | PyObject_HEAD 34 | JSGlobalContextRef obj; 35 | } JSGlobalContextRef_object; 36 | 37 | /* Functions to wrap JavaScriptCore Python objects -> JavaScriptCore C objects */ 38 | #define JSContextRef_get(v) (((v) == Py_None) ? NULL : (((JSContextRef_object *)(PyObject_GetAttr(v,PyString_FromString("_o"))))->obj)); 39 | 40 | #define JSGlobalContextRef_get(v) (((v) == Py_None) ? NULL : (((JSGlobalContextRef_object *)(PyObject_GetAttr(v,PyString_FromString("_o"))))->obj)); 41 | 42 | PyObject* wrap_JSContextRef(JSContextRef jscontextref); 43 | PyObject* wrap_JSGlobalContextRef(JSGlobalContextRef jsglobalref); 44 | 45 | #endif /* PYWEBKITGTK_WRAP_JSC_H */ 46 | -------------------------------------------------------------------------------- /m4/python.m4: -------------------------------------------------------------------------------- 1 | ## this one is commonly used with AM_PATH_PYTHONDIR ... 2 | dnl AM_CHECK_PYMOD(MODNAME [,SYMBOL [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]]) 3 | dnl Check if a module containing a given symbol is visible to python. 4 | AC_DEFUN([AM_CHECK_PYMOD], 5 | [AC_REQUIRE([AM_PATH_PYTHON]) 6 | py_mod_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'` 7 | AC_MSG_CHECKING(for ifelse([$2],[],,[$2 in ])python module $1) 8 | AC_CACHE_VAL(py_cv_mod_$py_mod_var, [ 9 | ifelse([$2],[], [prog=" 10 | import sys 11 | try: 12 | import $1 13 | except ImportError: 14 | sys.exit(1) 15 | except: 16 | sys.exit(0) 17 | sys.exit(0)"], [prog=" 18 | import $1 19 | $1.$2"]) 20 | if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC 21 | then 22 | eval "py_cv_mod_$py_mod_var=yes" 23 | else 24 | eval "py_cv_mod_$py_mod_var=no" 25 | fi 26 | ]) 27 | py_val=`eval "echo \`echo '$py_cv_mod_'$py_mod_var\`"` 28 | if test "x$py_val" != xno; then 29 | AC_MSG_RESULT(yes) 30 | ifelse([$3], [],, [$3 31 | ])dnl 32 | else 33 | AC_MSG_RESULT(no) 34 | ifelse([$4], [],, [$4 35 | ])dnl 36 | fi 37 | ]) 38 | 39 | dnl a macro to check for ability to create python extensions 40 | dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE]) 41 | dnl function also defines PYTHON_INCLUDES 42 | AC_DEFUN([AM_CHECK_PYTHON_HEADERS], 43 | [AC_REQUIRE([AM_PATH_PYTHON]) 44 | AC_MSG_CHECKING(for headers required to compile python extensions) 45 | dnl deduce PYTHON_INCLUDES 46 | py_prefix=`$PYTHON -c "import sys; print sys.prefix"` 47 | py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"` 48 | PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" 49 | if test "$py_prefix" != "$py_exec_prefix"; then 50 | PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}" 51 | fi 52 | AC_SUBST(PYTHON_INCLUDES) 53 | dnl check if the headers exist: 54 | save_CPPFLAGS="$CPPFLAGS" 55 | CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES" 56 | AC_TRY_CPP([#include ],dnl 57 | [AC_MSG_RESULT(found) 58 | $1],dnl 59 | [AC_MSG_RESULT(not found) 60 | $2]) 61 | CPPFLAGS="$save_CPPFLAGS" 62 | ]) 63 | -------------------------------------------------------------------------------- /pywebkitgtk.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: PyWebKitGtk 7 | Description: Python bindings for WebKit's GTK port 8 | Requires: webkit-1.0 9 | Version: @VERSION@ 10 | -------------------------------------------------------------------------------- /tests/test_networkrequest.py: -------------------------------------------------------------------------------- 1 | 2 | import webkit 3 | from webkit import NetworkRequest 4 | 5 | import gobject 6 | import unittest 7 | 8 | class TestNetworkRequest(unittest.TestCase): 9 | 10 | def setUp(self): 11 | self.request = webkit.NetworkRequest() 12 | 13 | def testsettergetter(self): 14 | self.request.set_uri("http://example.com/index.php") 15 | self.assertEqual("http://example.com/index.php", self.request.get_uri()) 16 | 17 | def testdefaultinitvalue(self): 18 | self.assertEqual("about:blank", self.request.get_uri()) 19 | 20 | def testsetproxy(self): 21 | webkit.set_proxy("http://localhost:8080") 22 | # we're still OK. 23 | self.assertTrue(True) 24 | 25 | def tearDown(self): 26 | del self.request 27 | 28 | if __name__ == '__main__': 29 | unittest.main() 30 | -------------------------------------------------------------------------------- /tests/test_networkresponse.py: -------------------------------------------------------------------------------- 1 | 2 | import webkit 3 | from webkit import NetworkResponse 4 | 5 | import gobject 6 | import unittest 7 | 8 | class TestWebView(unittest.TestCase): 9 | 10 | def setUp(self): 11 | self.response = webkit.NetworkResponse() 12 | 13 | def testsettergetter(self): 14 | self.response.set_uri("http://example.com/index.php") 15 | self.assertEqual("http://example.com/index.php", self.response.get_uri()) 16 | 17 | def testdefaultinitvalue(self): 18 | self.assertEqual("about:blank", self.response.get_uri()) 19 | 20 | def tearDown(self): 21 | del self.response 22 | 23 | if __name__ == '__main__': 24 | unittest.main() 25 | -------------------------------------------------------------------------------- /tests/test_webbackforwardlist.py: -------------------------------------------------------------------------------- 1 | 2 | from webkit import WebHistoryItem, WebBackForwardList, WebView 3 | 4 | import gobject 5 | import unittest 6 | 7 | class TestWebBackForwardList (unittest.TestCase): 8 | """Test WebBackForwardList functions""" 9 | 10 | def setUp(self): 11 | gobject.threads_init() 12 | self.view = WebView() 13 | self.bf_list = self.view.get_back_forward_list() 14 | 15 | def testadditem(self): 16 | item = WebHistoryItem(uri="http://example.com/", title="Example1") 17 | self.bf_list.add_item(item) 18 | self.assertEqual(item, self.bf_list.get_current_item()) 19 | currentItem = self.bf_list.get_current_item() 20 | self.assertEqual("Example1", currentItem.get_title()) 21 | self.assertEqual("http://example.com/", currentItem.get_uri()) 22 | 23 | def testbackforwardlistwithlimit(self): 24 | item1 = WebHistoryItem(uri="http://example.com/1/", title="Example1") 25 | item2 = WebHistoryItem(uri="http://example.com/2/", title="Example2") 26 | item3 = WebHistoryItem(uri="http://example.com/3/", title="Example3") 27 | item4 = WebHistoryItem(uri="http://example.com/4/", title="Example4") 28 | self.bf_list.add_item(item1) 29 | self.bf_list.add_item(item2) 30 | self.bf_list.add_item(item3) 31 | self.bf_list.add_item(item4) 32 | backList = list() 33 | backList = self.bf_list.get_back_list_with_limit(10) 34 | self.assertTrue(backList is not None) 35 | self.assertEqual("Example4", self.bf_list.get_current_item().get_title()) 36 | self.assertEqual("Example3", backList[0].props.title) 37 | self.assertEqual("Example2", backList[1].props.title) 38 | self.assertEqual("Example1", backList[2].props.title) 39 | self.bf_list.go_to_item(item1) 40 | self.assertEqual(self.bf_list.get_current_item().get_title(), item1.get_title()) 41 | forwardList = list() 42 | forwardList = self.bf_list.get_forward_list_with_limit(10) 43 | self.assertTrue(forwardList is not None) 44 | self.assertEqual("Example4", forwardList[0].props.title) 45 | self.assertEqual("Example3", forwardList[1].props.title) 46 | self.assertEqual("Example2", forwardList[2].props.title) 47 | 48 | def testclearbackforwardlist(self): 49 | item1 = WebHistoryItem(uri="http://example.com/1/", title="Example1") 50 | item2 = WebHistoryItem(uri="http://example.com/2/", title="Example2") 51 | 52 | self.bf_list.set_limit(0) 53 | self.bf_list.set_limit(1) 54 | self.bf_list.add_item(item2) 55 | self.assertEqual(self.bf_list.get_back_length(), 0) 56 | self.assertEqual(self.bf_list.get_forward_length(), 0) 57 | self.assertEqual(self.bf_list.get_current_item(), item2) 58 | 59 | def tearDown(self): 60 | # nothing here. 61 | pass 62 | 63 | if __name__ == '__main__': 64 | unittest.main() 65 | -------------------------------------------------------------------------------- /tests/test_webframe.py: -------------------------------------------------------------------------------- 1 | 2 | from webkit import WebFrame, WebView 3 | 4 | import gobject 5 | import unittest 6 | 7 | class TestWebFrame(unittest.TestCase): 8 | 9 | def setUp(self): 10 | gobject.threads_init() 11 | self.view = WebView() 12 | self.mainFrame = self.view.get_main_frame() 13 | 14 | def testloaduri(self): 15 | self.mainFrame.load_uri("about:blank") 16 | self.assertEqual("about:blank", self.mainFrame.get_uri()); 17 | 18 | 19 | def tearDown(self): 20 | self.view.destroy() 21 | 22 | if __name__ == '__main__': 23 | unittest.main() 24 | -------------------------------------------------------------------------------- /tests/test_webnavigationaction.py: -------------------------------------------------------------------------------- 1 | 2 | import webkit 3 | import unittest 4 | 5 | class TestWebNavigationAction (unittest.TestCase): 6 | """Test WebNavigationAction functions""" 7 | 8 | def setUp (self): 9 | """set up test""" 10 | self.navigation_action = webkit.WebNavigationAction() 11 | 12 | def testsetreason (self): 13 | """test for WebNavigationAction.set_reason/get_reason overrides""" 14 | reasons = ["link-clicked","reload","form-submitted","back-forward","form-resubmitted","other"] 15 | for r in reasons: 16 | self.navigation_action.set_reason(r) 17 | self.assertEqual(r, self.navigation_action.get_reason().value_nick) 18 | 19 | def testoriginaluri (self): 20 | """test WebNavigationAction.set/get_original_uri""" 21 | self.navigation_action.set_original_uri("http://www.google.com") 22 | self.assertEqual("http://www.google.com", self.navigation_action.get_original_uri()) 23 | 24 | if __name__ == '__main__': 25 | unittest.main() 26 | -------------------------------------------------------------------------------- /webkit/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009 Jan Michael Alonzo 2 | # 3 | # This library is free software; you can redistribute it and/or 4 | # modify it under the terms of the GNU Lesser General Public 5 | # License as published by the Free Software Foundation; either 6 | # version 2 of the License, or (at your option) any later version. 7 | # 8 | # This library is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # Lesser General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU Lesser General Public 14 | # License along with this library; if not, write to the 15 | # Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 | # Boston, MA 02111-1307, USA. 17 | # 18 | 19 | import gobject 20 | gobject.threads_init() 21 | import webkit 22 | 23 | # fine-tune this when necessary. 24 | from webkit import * 25 | -------------------------------------------------------------------------------- /webkit/webkit-1.0.2.defs: -------------------------------------------------------------------------------- 1 | ;; -*- scheme -*- 2 | ;; PyWebKitGtk - Python bindings to WebKit/GTK+ 3 | ;; 4 | ;; Copyright (C) 2009 Jan Michael Alonzo 5 | ;; 6 | ;; This library is free software; you can redistribute it and/or 7 | ;; modify it under the terms of the GNU Library General Public 8 | ;; License as published by the Free Software Foundation; either 9 | ;; version 2 of the License, or (at your option) any later version. 10 | ;; 11 | ;; This library is distributed in the hope that it will be useful, 12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | ;; Library General Public License for more details. 15 | ;; 16 | ;; You should have received a copy of the GNU Library General Public 17 | ;; License along with this library; if not, write to the Free Software 18 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA 19 | ;; 20 | 21 | 22 | ;; From 23 | 24 | (define-function webkit_web_view_new 25 | (is-constructor-of "WebKitWebView") 26 | (c-name "webkit_web_view_new") 27 | (caller-owns-return #t) 28 | (return-type "GtkWidget*") 29 | ) 30 | 31 | (define-method set_maintains_back_forward_list 32 | (of-object "WebKitWebView") 33 | (c-name "webkit_web_view_set_maintains_back_forward_list") 34 | (parameters 35 | '("gboolean" "flag") 36 | ) 37 | ) 38 | 39 | (define-method get_back_forward_list 40 | (of-object "WebKitWebView") 41 | (c-name "webkit_web_view_get_back_forward_list") 42 | (return-type "WebKitWebBackForwardList*") 43 | ) 44 | 45 | (define-method go_to_back_forward_item 46 | (of-object "WebKitWebView") 47 | (c-name "webkit_web_view_go_to_back_forward_item") 48 | (return-type "gboolean") 49 | (parameters 50 | '("WebKitWebHistoryItem*" "item") 51 | ) 52 | ) 53 | 54 | (define-method can_go_back 55 | (of-object "WebKitWebView") 56 | (c-name "webkit_web_view_can_go_back") 57 | (return-type "gboolean") 58 | ) 59 | 60 | (define-method can_go_forward 61 | (of-object "WebKitWebView") 62 | (c-name "webkit_web_view_can_go_forward") 63 | (return-type "gboolean") 64 | ) 65 | 66 | (define-method go_back 67 | (of-object "WebKitWebView") 68 | (c-name "webkit_web_view_go_back") 69 | (return-type "none") 70 | ) 71 | 72 | (define-method go_forward 73 | (of-object "WebKitWebView") 74 | (c-name "webkit_web_view_go_forward") 75 | (return-type "none") 76 | ) 77 | 78 | (define-method go_back_or_forward 79 | (of-object "WebKitWebView") 80 | (c-name "webkit_web_view_go_back_or_forward") 81 | (return-type "none") 82 | (parameters 83 | '("gint" "steps") 84 | ) 85 | ) 86 | 87 | (define-method stop_loading 88 | (of-object "WebKitWebView") 89 | (c-name "webkit_web_view_stop_loading") 90 | (return-type "none") 91 | ) 92 | 93 | (define-method open 94 | (of-object "WebKitWebView") 95 | (c-name "webkit_web_view_open") 96 | (return-type "none") 97 | (parameters 98 | '("const-gchar*" "uri") 99 | ) 100 | ) 101 | 102 | (define-method reload 103 | (of-object "WebKitWebView") 104 | (c-name "webkit_web_view_reload") 105 | (return-type "none") 106 | ) 107 | 108 | (define-method load_html_string 109 | (of-object "WebKitWebView") 110 | (c-name "webkit_web_view_load_html_string") 111 | (return-type "none") 112 | (parameters 113 | '("const-gchar*" "content") 114 | '("const-gchar*" "base_uri") 115 | ) 116 | ) 117 | 118 | (define-method load_string 119 | (of-object "WebKitWebView") 120 | (c-name "webkit_web_view_load_string") 121 | (return-type "none") 122 | (parameters 123 | '("const-gchar*" "content") 124 | '("const-gchar*" "content_mimetype") 125 | '("const-gchar*" "content_encoding") 126 | '("const-gchar*" "base_uri") 127 | ) 128 | ) 129 | 130 | (define-method get_main_frame 131 | (of-object "WebKitWebView") 132 | (c-name "webkit_web_view_get_main_frame") 133 | (return-type "WebKitWebFrame*") 134 | ) 135 | 136 | (define-method get_focused_frame 137 | (of-object "WebKitWebView") 138 | (c-name "webkit_web_view_get_focused_frame") 139 | (return-type "WebKitWebFrame*") 140 | ) 141 | 142 | (define-method execute_script 143 | (of-object "WebKitWebView") 144 | (c-name "webkit_web_view_execute_script") 145 | (return-type "none") 146 | (parameters 147 | '("const-gchar*" "script") 148 | ) 149 | ) 150 | 151 | (define-method get_editable 152 | (of-object "WebKitWebView") 153 | (c-name "webkit_web_view_get_editable") 154 | (return-type "gboolean") 155 | ) 156 | 157 | (define-method set_editable 158 | (of-object "WebKitWebView") 159 | (c-name "webkit_web_view_set_editable") 160 | (return-type "none") 161 | (parameters 162 | '("gboolean" "flag") 163 | ) 164 | ) 165 | 166 | (define-method search_text 167 | (of-object "WebKitWebView") 168 | (c-name "webkit_web_view_search_text") 169 | (return-type "gboolean") 170 | (parameters 171 | ("const-gchar*" "string") 172 | ("gboolean" "case_sensitive") 173 | ("gboolean" "forward") 174 | ("gboolean" "wrap") 175 | ) 176 | ) 177 | 178 | (define-method mark_text_matches 179 | (of-object "WebKitWebView") 180 | (c-name "webkit_web_view_mark_text_matches") 181 | (return-type "guint") 182 | (parameters 183 | ("const-gchar*" "string") 184 | ("gboolean" "case_sensitive") 185 | ("guint" "limit") 186 | ) 187 | ) 188 | 189 | (define-method unmark_text_matches 190 | (of-object "WebKitWebView") 191 | (c-name "webkit_web_view_unmark_text_matches") 192 | (return-type "none") 193 | ) 194 | 195 | (define-method set_highlight_text_matches 196 | (of-object "WebKitWebView") 197 | (c-name "webkit_web_view_set_highlight_text_matches") 198 | (return-type "none") 199 | (parameters 200 | ("gboolean" "highlight") 201 | ) 202 | ) 203 | 204 | (define-method can_cut_clipboard 205 | (of-object "WebKitWebView") 206 | (c-name "webkit_web_view_can_cut_clipboard") 207 | (return-type "gboolean") 208 | ) 209 | 210 | (define-method can_copy_clipboard 211 | (of-object "WebKitWebView") 212 | (c-name "webkit_web_view_can_copy_clipboard") 213 | (return-type "gboolean") 214 | ) 215 | 216 | (define-method can_paste_clipboard 217 | (of-object "WebKitWebView") 218 | (c-name "webkit_web_view_can_paste_clipboard") 219 | (return-type "gboolean") 220 | ) 221 | 222 | (define-method copy_clipboard 223 | (of-object "WebKitWebView") 224 | (c-name "webkit_web_view_copy_clipboard") 225 | (return-type "none") 226 | ) 227 | 228 | (define-method cut_clipboard 229 | (of-object "WebKitWebView") 230 | (c-name "webkit_web_view_cut_clipboard") 231 | (return-type "none") 232 | ) 233 | 234 | (define-method paste_clipboard 235 | (of-object "WebKitWebView") 236 | (c-name "webkit_web_view_paste_clipboard") 237 | (return-type "none") 238 | ) 239 | 240 | (define-method delete_selection 241 | (of-object "WebKitWebView") 242 | (c-name "webkit_web_view_delete_selection") 243 | (return-type "none") 244 | ) 245 | 246 | (define-method has_selection 247 | (of-object "WebKitWebView") 248 | (c-name "webkit_web_view_has_selection") 249 | (return-type "gboolean") 250 | ) 251 | 252 | (define-method select_all 253 | (of-object "WebKitWebView") 254 | (c-name "webkit_web_view_select_all") 255 | (return-type "none") 256 | ) 257 | 258 | (define-method get_copy_target_list 259 | (of-object "WebKitWebView") 260 | (c-name "webkit_web_view_get_copy_target_list") 261 | (return-type "GtkTargetList*") 262 | ) 263 | 264 | (define-method get_paste_target_list 265 | (of-object "WebKitWebView") 266 | (c-name "webkit_web_view_get_paste_target_list") 267 | (return-type "GtkTargetList*") 268 | ) 269 | 270 | (define-method set_settings 271 | (of-object "WebKitWebView") 272 | (c-name "webkit_web_view_set_settings") 273 | (return-type "none") 274 | (parameters 275 | '("WebKitWebSettings" "settings") 276 | ) 277 | ) 278 | 279 | (define-method get_settings 280 | (of-object "WebKitWebView") 281 | (c-name "webkit_web_view_get_settings") 282 | (return-type "WebKitWebSettings*") 283 | ) 284 | 285 | (define-method get_transparent 286 | (of-object "WebKitWebView") 287 | (c-name "webkit_web_view_get_transparent") 288 | (return-type "gboolean") 289 | ) 290 | 291 | (define-method set_transparent 292 | (of-object "WebKitWebView") 293 | (c-name "webkit_web_view_set_transparent") 294 | (return-type "none") 295 | (parameters 296 | '("gboolean" "flag") 297 | ) 298 | ) 299 | 300 | (define-method get_zoom_level 301 | (of-object "WebKitWebView") 302 | (c-name "webkit_web_view_get_zoom_level") 303 | (return-type "gfloat") 304 | ) 305 | 306 | (define-method set_zoom_level 307 | (of-object "WebKitWebView") 308 | (c-name "webkit_web_view_set_zoom_level") 309 | (return-type "none") 310 | (parameters 311 | '("gfloat" "zoom_level") 312 | ) 313 | ) 314 | 315 | (define-method zoom_in 316 | (of-object "WebKitWebView") 317 | (c-name "webkit_web_view_zoom_in") 318 | (return-type "none") 319 | ) 320 | 321 | (define-method zoom_out 322 | (of-object "WebKitWebView") 323 | (c-name "webkit_web_view_zoom_out") 324 | (return-type "none") 325 | ) 326 | 327 | (define-method get_full_content_zoom 328 | (of-object "WebKitWebView") 329 | (c-name "webkit_web_view_get_full_content_zoom") 330 | (return-type "gboolean") 331 | ) 332 | 333 | (define-method set_full_content_zoom 334 | (of-object "WebKitWebView") 335 | (c-name "webkit_web_view_set_full_content_zoom") 336 | (return-type "none") 337 | (parameters 338 | '("gboolean" "full_content_zoom") 339 | ) 340 | ) 341 | 342 | ;; From 343 | 344 | (define-method get_web_view 345 | (of-object "WebKitWebFrame") 346 | (c-name "webkit_web_frame_get_web_view") 347 | (return-type "WebKitWebView*") 348 | ) 349 | 350 | (define-method get_name 351 | (of-object "WebKitWebFrame") 352 | (c-name "webkit_web_frame_get_name") 353 | (return-type "const-gchar*") 354 | ) 355 | 356 | (define-method get_title 357 | (of-object "WebKitWebFrame") 358 | (c-name "webkit_web_frame_get_title") 359 | (return-type "const-gchar*") 360 | ) 361 | 362 | (define-method get_uri 363 | (of-object "WebKitWebFrame") 364 | (c-name "webkit_web_frame_get_uri") 365 | (return-type "const-gchar*") 366 | ) 367 | 368 | (define-method get_parent 369 | (of-object "WebKitWebFrame") 370 | (c-name "webkit_web_frame_get_parent") 371 | (return-type "WebKitWebFrame*") 372 | ) 373 | 374 | (define-method load_request 375 | (of-object "WebKitWebFrame") 376 | (c-name "webkit_web_frame_load_request") 377 | (return-type "none") 378 | (parameters 379 | '("WebKitNetworkRequest*" "request") 380 | ) 381 | ) 382 | 383 | (define-method stop_loading 384 | (of-object "WebKitWebFrame") 385 | (c-name "webkit_web_frame_stop_loading") 386 | (return-type "none") 387 | ) 388 | 389 | (define-method reload 390 | (of-object "WebKitWebFrame") 391 | (c-name "webkit_web_frame_reload") 392 | (return-type "none") 393 | ) 394 | 395 | (define-method find_frame 396 | (of-object "WebKitWebFrame") 397 | (c-name "webkit_web_frame_find_frame") 398 | (caller-owns-return #f) 399 | (return-type "WebKitWebFrame*") 400 | (parameters 401 | '("const-gchar*" "name") 402 | ) 403 | ) 404 | 405 | (define-method get_global_context 406 | (of-object "WebKitWebFrame") 407 | (c-name "webkit_web_frame_get_global_context") 408 | (return-type "JSGlobalContextRef") 409 | ) 410 | 411 | ;; From 412 | 413 | (define-function webkit_network_request_new 414 | (is-constructor-of "WebKitNetworkRequest") 415 | (c-name "webkit_network_request_new") 416 | (caller-owns-return #t) 417 | (return-type "WebKitNetworkRequest*") 418 | (properties 419 | '("uri" (argname "uri")) 420 | ) 421 | ) 422 | 423 | (define-method set_uri 424 | (of-object "WebKitNetworkRequest") 425 | (c-name "webkit_network_request_set_uri") 426 | (return-type "none") 427 | (parameters 428 | '("const-gchar*" "uri") 429 | ) 430 | ) 431 | 432 | (define-method get_uri 433 | (of-object "WebKitNetworkRequest") 434 | (c-name "webkit_network_request_get_uri") 435 | (return-type "const-gchar*") 436 | ) 437 | 438 | 439 | ;; From 440 | 441 | (define-function webkit_web_history_item_new 442 | (is-constructor-of "WebKitWebHistoryItem") 443 | (c-name "webkit_web_history_item_new") 444 | (caller-owns-return #t) 445 | (return-type "WebKitWebHistoryItem*") 446 | (properties 447 | '("uri" (argname "uri")) 448 | '("title" (argname "title")) 449 | ) 450 | ) 451 | 452 | (define-method get_title 453 | (of-object "WebKitWebHistoryItem") 454 | (c-name "webkit_web_history_item_get_title") 455 | (return-type "const-gchar*") 456 | ) 457 | 458 | (define-method get_alternate_title 459 | (of-object "WebKitWebHistoryItem") 460 | (c-name "webkit_web_history_item_get_alternate_title") 461 | (return-type "const-gchar*") 462 | ) 463 | 464 | (define-method set_alternate_title 465 | (of-object "WebKitWebHistoryItem") 466 | (c-name "webkit_web_history_item_set_alternate_title") 467 | (parameters 468 | '("const-gchar*" "title") 469 | ) 470 | ) 471 | 472 | (define-method get_uri 473 | (of-object "WebKitWebHistoryItem") 474 | (c-name "webkit_web_history_item_get_uri") 475 | (return-type "const-gchar*") 476 | ) 477 | 478 | (define-method get_original_uri 479 | (of-object "WebKitWebHistoryItem") 480 | (c-name "webkit_web_history_item_get_original_uri") 481 | (return-type "const-gchar*") 482 | ) 483 | 484 | (define-method get_last_visited_time 485 | (of-object "WebKitWebHistoryItem") 486 | (c-name "webkit_web_history_item_get_last_visited_time") 487 | (return-type "gdouble") 488 | ) 489 | 490 | 491 | ;; From 492 | 493 | (define-function webkit_web_back_forward_list_new_with_web_view 494 | (is-constructor-of "WebKitWebBackForwardList") 495 | (c-name "webkit_web_back_forward_list_new_with_web_view") 496 | (caller-owns-return #t) 497 | (return-type "WebKitWebHistoryItem*") 498 | ) 499 | 500 | (define-method go_forward 501 | (of-object "WebKitWebBackForwardList") 502 | (c-name "webkit_web_back_forward_list_go_forward") 503 | (return-type "none") 504 | ) 505 | 506 | (define-method go_back 507 | (of-object "WebKitWebBackForwardList") 508 | (c-name "webkit_web_back_forward_list_go_back") 509 | (return-type "none") 510 | ) 511 | 512 | (define-method contains_item 513 | (of-object "WebKitWebBackForwardList") 514 | (c-name "webkit_web_back_forward_list_contains_item") 515 | (return-type "gboolean") 516 | (parameters 517 | '("WebKitWebHistoryItem*" "history_item") 518 | ) 519 | ) 520 | 521 | (define-method go_to_item 522 | (of-object "WebKitWebBackForwardList") 523 | (c-name "webkit_web_back_forward_list_go_to_item") 524 | (return-type "none") 525 | (parameters 526 | '("WebKitWebHistoryItem*" "history_item") 527 | ) 528 | ) 529 | 530 | (define-method get_forward_list_with_limit 531 | (of-object "WebKitWebBackForwardList") 532 | (c-name "webkit_web_back_forward_list_get_forward_list_with_limit") 533 | (return-type "GList*") 534 | (parameters 535 | '("gint" "limit") 536 | ) 537 | ) 538 | 539 | (define-method get_back_list_with_limit 540 | (of-object "WebKitWebBackForwardList") 541 | (c-name "webkit_web_back_forward_list_get_back_list_with_limit") 542 | (return-type "GList*") 543 | (parameters 544 | '("gint" "limit") 545 | ) 546 | ) 547 | 548 | (define-method get_back_item 549 | (of-object "WebKitWebBackForwardList") 550 | (c-name "webkit_web_back_forward_list_get_back_item") 551 | (return-type "WebKitWebHistoryItem*") 552 | ) 553 | 554 | (define-method get_current_item 555 | (of-object "WebKitWebBackForwardList") 556 | (c-name "webkit_web_back_forward_list_get_current_item") 557 | (return-type "WebKitWebHistoryItem*") 558 | ) 559 | 560 | (define-method get_forward_item 561 | (of-object "WebKitWebBackForwardList") 562 | (c-name "webkit_web_back_forward_list_get_forward_item") 563 | (return-type "WebKitWebHistoryItem*") 564 | ) 565 | 566 | (define-method get_nth_item 567 | (of-object "WebKitWebBackForwardList") 568 | (c-name "webkit_web_back_forward_list_get_nth_item") 569 | (return-type "WebKitWebHistoryItem*") 570 | (parameters 571 | '("gint" "index") 572 | ) 573 | ) 574 | 575 | (define-method get_back_length 576 | (of-object "WebKitWebBackForwardList") 577 | (c-name "webkit_web_back_forward_list_get_back_length") 578 | (return-type "gint") 579 | ) 580 | 581 | (define-method get_forward_length 582 | (of-object "WebKitWebBackForwardList") 583 | (c-name "webkit_web_back_forward_list_get_forward_length") 584 | (return-type "gint") 585 | ) 586 | 587 | (define-method get_limit 588 | (of-object "WebKitWebBackForwardList") 589 | (c-name "webkit_web_back_forward_list_get_limit") 590 | (return-type "gint") 591 | ) 592 | 593 | (define-method set_limit 594 | (of-object "WebKitWebBackForwardList") 595 | (c-name "webkit_web_back_forward_list_set_limit") 596 | (return-type "none") 597 | (parameters 598 | '("gint" "limit") 599 | ) 600 | ) 601 | 602 | ;; From 603 | 604 | (define-function webkit_web_settings_new 605 | (is-constructor-of "WebKitWebSettings") 606 | (c-name "webkit_web_settings_new") 607 | (caller-owns-return #t) 608 | (return-type "WebKitWebSettings*") 609 | ) 610 | 611 | (define-method copy 612 | (of-object "WebKitWebSettings") 613 | (c-name "webkit_web_settings_copy") 614 | (caller-owns-return #f) 615 | (return-type "WebKitWebSettings*") 616 | ) 617 | -------------------------------------------------------------------------------- /webkit/webkit-1.1-types.defs: -------------------------------------------------------------------------------- 1 | ;; -*- scheme -*- 2 | ;; PyWebKitGtk - Python bindings to WebKit/GTK+ 3 | ;; 4 | ;; Copyright (C) 2009 Jan Michael Alonzo 5 | ;; 6 | ;; This library is free software; you can redistribute it and/or 7 | ;; modify it under the terms of the GNU Library General Public 8 | ;; License as published by the Free Software Foundation; either 9 | ;; version 2 of the License, or (at your option) any later version. 10 | ;; 11 | ;; This library is distributed in the hope that it will be useful, 12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | ;; Library General Public License for more details. 15 | ;; 16 | ;; You should have received a copy of the GNU Library General Public 17 | ;; License along with this library; if not, write to the Free Software 18 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA 19 | ;; 20 | 21 | ; object definitions ... 22 | (define-object WebInspector 23 | (in-module "WebKit") 24 | (parent "GObject") 25 | (c-name "WebKitWebInspector") 26 | (gtype-id "WEBKIT_TYPE_WEB_INSPECTOR") 27 | ) 28 | 29 | (define-object WindowFeatures 30 | (in-module "WebKit") 31 | (parent "GObject") 32 | (c-name "WebKitWebWindowFeatures") 33 | (gtype-id "WEBKIT_TYPE_WEB_WINDOW_FEATURES") 34 | ) 35 | 36 | (define-object WebNavigationAction 37 | (in-module "WebKit") 38 | (parent "GObject") 39 | (c-name "WebKitWebNavigationAction") 40 | (gtype-id "WEBKIT_TYPE_WEB_NAVIGATION_ACTION") 41 | ) 42 | 43 | (define-object WebPolicyDecision 44 | (in-module "WebKit") 45 | (parent "GObject") 46 | (c-name "WebKitWebPolicyDecision") 47 | (gtype-id "WEBKIT_TYPE_WEB_POLICY_DECISION") 48 | ) 49 | 50 | (define-object Download 51 | (in-module "WebKit") 52 | (parent "GObject") 53 | (c-name "WebKitDownload") 54 | (gtype-id "WEBKIT_TYPE_DOWNLOAD") 55 | ) 56 | 57 | (define-object NetworkResponse 58 | (in-module "WebKit") 59 | (parent "GObject") 60 | (c-name "WebKitNetworkResponse") 61 | (gtype-id "WEBKIT_TYPE_NETWORK_RESPONSE") 62 | ) 63 | 64 | (define-object SecurityOrigin 65 | (in-module "WebKit") 66 | (parent "GObject") 67 | (c-name "WebKitSecurityOrigin") 68 | (gtype-id "WEBKIT_TYPE_SECURITY_ORIGIN") 69 | ) 70 | 71 | (define-object WebDatabase 72 | (in-module "WebKit") 73 | (parent "GObject") 74 | (c-name "WebKitWebDatabase") 75 | (gtype-id "WEBKIT_TYPE_WEB_DATABASE") 76 | ) 77 | 78 | (define-object WebResource 79 | (in-module "WebKit") 80 | (parent "GObject") 81 | (c-name "WebKitWebResource") 82 | (gtype-id "WEBKIT_TYPE_WEB_RESOURCE") 83 | ) 84 | 85 | (define-object WebDataSource 86 | (in-module "WebKit") 87 | (parent "GObject") 88 | (c-name "WebKitWebDataSource") 89 | (gtype-id "WEBKIT_TYPE_WEB_DATA_SOURCE") 90 | ) 91 | 92 | (define-enum DownloadStatus 93 | (in-module "WebKit") 94 | (c-name "WebKitDownloadStatus") 95 | (gtype-id "WEBKIT_TYPE_DOWNLOAD_STATUS") 96 | (values 97 | '("error" "WEBKIT_DOWNLOAD_STATUS_ERROR") 98 | '("created" "WEBKIT_DOWNLOAD_STATUS_CREATED") 99 | '("started" "WEBKIT_DOWNLOAD_STATUS_STARTED") 100 | '("cancelled" "WEBKIT_DOWNLOAD_STATUS_CANCELLED") 101 | '("finished" "WEBKIT_DOWNLOAD_STATUS_FINISHED") 102 | ) 103 | ) 104 | 105 | (define-enum DownloadError 106 | (in-module "WebKit") 107 | (c-name "WebKitDownloadError") 108 | (gtype-id "WEBKIT_TYPE_DOWNLOAD_ERROR") 109 | (values 110 | '("cancelled-by-user" "WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER") 111 | '("destination" "WEBKIT_DOWNLOAD_ERROR_DESTINATION") 112 | '("network" "WEBKIT_DOWNLOAD_ERROR_NETWORK") 113 | ) 114 | ) 115 | 116 | (define-enum WebNavigationReason 117 | (in-module "WebKit") 118 | (c-name "WebKitWebNavigationReason") 119 | (gtype-id "WEBKIT_TYPE_WEB_NAVIGATION_REASON") 120 | (values 121 | '("link-clicked" "WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED") 122 | '("form-submitted" "WEBKIT_WEB_NAVIGATION_REASON_FORM_SUBMITTED") 123 | '("back-forward" "WEBKIT_WEB_NAVIGATION_REASON_BACK_FORWARD") 124 | '("reload" "WEBKIT_WEB_NAVIGATION_REASON_RELOAD") 125 | '("form-resubmitted" "WEBKIT_WEB_NAVIGATION_REASON_FORM_RESUBMITTED") 126 | '("other" "WEBKIT_WEB_NAVIGATION_REASON_OTHER") 127 | ) 128 | ) 129 | 130 | (define-enum NetworkError 131 | (in-module "WebKit") 132 | (c-name "WebKitNetworkError") 133 | (gtype-id "WEBKIT_TYPE_NETWORK_ERROR") 134 | (values 135 | '("failed" "WEBKIT_NETWORK_ERROR_FAILED") 136 | '("transport" "WEBKIT_NETWORK_ERROR_TRANSPORT") 137 | '("unknown-protocol" "WEBKIT_NETWORK_ERROR_UNKNOWN_PROTOCOL") 138 | '("cancelled" "WEBKIT_NETWORK_ERROR_CANCELLED") 139 | '("file-does-not-exist" "WEBKIT_NETWORK_ERROR_FILE_DOES_NOT_EXIST") 140 | ) 141 | ) 142 | 143 | (define-enum PolicyError 144 | (in-module "WebKit") 145 | (c-name "WebKitPolicyError") 146 | (gtype-id "WEBKIT_TYPE_POLICY_ERROR") 147 | (values 148 | '("failed" "WEBKIT_POLICY_ERROR_FAILED") 149 | '("cannot-show-mime-type" "WEBKIT_POLICY_ERROR_CANNOT_SHOW_MIME_TYPE") 150 | '("cannot-show-url" "WEBKIT_POLICY_ERROR_CANNOT_SHOW_URL") 151 | '("frame-load-interrupted-by-policy-change" "WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE") 152 | '("cannot-use-restricted-port" "WEBKIT_POLICY_ERROR_CANNOT_USE_RESTRICTED_PORT") 153 | ) 154 | ) 155 | 156 | (define-enum PluginError 157 | (in-module "WebKit") 158 | (c-name "WebKitPluginError") 159 | (gtype-id "WEBKIT_TYPE_PLUGIN_ERROR") 160 | (values 161 | '("failed" "WEBKIT_PLUGIN_ERROR_FAILED") 162 | '("cannot-find-plugin" "WEBKIT_PLUGIN_ERROR_CANNOT_FIND_PLUGIN") 163 | '("cannot-load-plugin" "WEBKIT_PLUGIN_ERROR_CANNOT_LOAD_PLUGIN") 164 | '("java-unavailable" "WEBKIT_PLUGIN_ERROR_JAVA_UNAVAILABLE") 165 | '("connection-cancelled" "WEBKIT_PLUGIN_ERROR_CONNECTION_CANCELLED") 166 | '("will-handle-load" "WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD") 167 | ) 168 | ) 169 | 170 | (define-enum LoadStatus 171 | (in-module "WebKit") 172 | (c-name "WebKitLoadStatus") 173 | (gtype-id "WEBKIT_TYPE_LOAD_STATUS") 174 | (values 175 | '("provisional" "WEBKIT_LOAD_PROVISIONAL") 176 | '("committed" "WEBKIT_LOAD_COMMITTED") 177 | '("finished" "WEBKIT_LOAD_FINISHED") 178 | '("first-visually-non-empty-layout" "WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT") 179 | ) 180 | ) 181 | 182 | (define-enum EditingBehavior 183 | (in-module "WebKit") 184 | (c-name "WebKitEditingBehavior") 185 | (gtype-id "WEBKIT_TYPE_EDITING_BEHAVIOR") 186 | (values 187 | '("mac" "WEBKIT_EDITING_BEHAVIOR_MAC") 188 | '("windows" "WEBKIT_EDITING_BEHAVIOR_WINDOWS") 189 | ) 190 | ) 191 | 192 | (define-enum NavigationResponse 193 | (in-module "WebKit") 194 | (c-name "WebKitNavigationResponse") 195 | (gtype-id "WEBKIT_TYPE_NAVIGATION_RESPONSE") 196 | (values 197 | '("accept" "WEBKIT_NAVIGATION_RESPONSE_ACCEPT") 198 | '("ignore" "WEBKIT_NAVIGATION_RESPONSE_IGNORE") 199 | '("download" "WEBKIT_NAVIGATION_RESPONSE_DOWNLOAD") 200 | ) 201 | ) 202 | 203 | (define-enum WebViewTargetInfo 204 | (in-module "WebKit") 205 | (c-name "WebKitWebViewTargetInfo") 206 | (gtype-id "WEBKIT_TYPE_WEB_VIEW_TARGET_INFO") 207 | (values 208 | '("html" "WEBKIT_WEB_VIEW_TARGET_INFO_HTML") 209 | '("text" "WEBKIT_WEB_VIEW_TARGET_INFO_TEXT") 210 | '("image" "WEBKIT_WEB_VIEW_TARGET_INFO_IMAGE") 211 | '("uri-list" "WEBKIT_WEB_VIEW_TARGET_INFO_URI_LIST") 212 | '("netscape-url" "WEBKIT_WEB_VIEW_TARGET_INFO_NETSCAPE_URL") 213 | ) 214 | ) 215 | -------------------------------------------------------------------------------- /webkit/webkit-1.1.defs: -------------------------------------------------------------------------------- 1 | ;; -*- scheme -*- 2 | ;; PyWebKitGtk - Python bindings to WebKit/GTK+ 3 | ;; 4 | ;; Copyright (C) 2009 Jan Michael Alonzo 5 | ;; 6 | ;; This library is free software; you can redistribute it and/or 7 | ;; modify it under the terms of the GNU Library General Public 8 | ;; License as published by the Free Software Foundation; either 9 | ;; version 2 of the License, or (at your option) any later version. 10 | ;; 11 | ;; This library is distributed in the hope that it will be useful, 12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | ;; Library General Public License for more details. 15 | ;; 16 | ;; You should have received a copy of the GNU Library General Public 17 | ;; License along with this library; if not, write to the Free Software 18 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA 19 | ;; 20 | 21 | 22 | ;; from webkit/webkitwebinspector.h 23 | (define-method get_web_view 24 | (of-object "WebKitWebInspector") 25 | (c-name "webkit_web_inspector_get_web_view") 26 | (return-type "WebKitWebView*") 27 | ) 28 | 29 | (define-method get_inspected_uri 30 | (of-object "WebKitWebInspector") 31 | (c-name "webkit_web_inspector_get_inspected_uri") 32 | (return-type "const-gchar*") 33 | ) 34 | 35 | ;; from webkit/webkitwebview.h 36 | (define-method get_web_inspector 37 | (of-object "WebKitWebView") 38 | (c-name "webkit_web_view_get_inspector") 39 | (return-type "WebKitWebInspector*") 40 | ) 41 | 42 | (define-method get_window_features 43 | (of-object "WebKitWebView") 44 | (c-name "webkit_web_view_get_window_features") 45 | (return-type "WebKitWebWindowFeatures*") 46 | ) 47 | 48 | (define-method reload_bypass_cache 49 | (of-object "WebKitWebView") 50 | (c-name "webkit_web_view_reload_bypass_cache") 51 | (return-type "none") 52 | ) 53 | 54 | (define-method can_show_mime_type 55 | (of-object "WebKitWebView") 56 | (c-name "webkit_web_view_can_show_mime_type") 57 | (return-type "gboolean") 58 | (parameters 59 | '("const-gchar*" "mime_type") 60 | ) 61 | ) 62 | 63 | (define-method load_uri 64 | (of-object "WebKitWebView") 65 | (c-name "webkit_web_view_load_uri") 66 | (return-type "none") 67 | (parameters 68 | '("const-gchar*" "uri") 69 | ) 70 | ) 71 | 72 | (define-method get_encoding 73 | (of-object "WebKitWebView") 74 | (c-name "webkit_web_view_get_encoding") 75 | (return-type "const-gchar*") 76 | ) 77 | 78 | (define-method set_custom_encoding 79 | (of-object "WebKitWebView") 80 | (c-name "webkit_web_view_set_custom_encoding") 81 | (return-type "none") 82 | (parameters 83 | '("const-gchar*" "encoding") 84 | ) 85 | ) 86 | 87 | (define-method get_custom_encoding 88 | (of-object "WebKitWebView") 89 | (c-name "webkit_web_view_get_custom_encoding") 90 | (return-type "const-gchar*") 91 | ) 92 | 93 | (define-method move_cursor 94 | (of-object "WebKitWebView") 95 | (c-name "webkit_web_view_move_cursor") 96 | (parameters 97 | '("GtkMovementStep" "step") 98 | ("gint" "count") 99 | ) 100 | (return-type "none") 101 | ) 102 | 103 | (define-method get_load_status 104 | (of-object "WebKitWebView") 105 | (c-name "webkit_web_view_get_load_status") 106 | (return-type "WebKitLoadStatus") 107 | ) 108 | 109 | (define-method get_progress 110 | (of-object "WebKitWebView") 111 | (c-name "webkit_web_view_get_progress") 112 | (return-type "gdouble") 113 | ) 114 | 115 | (define-method undo 116 | (of-object "WebKitWebView") 117 | (c-name "webkit_web_view_undo") 118 | (return-type "none") 119 | ) 120 | 121 | (define-method can_undo 122 | (of-object "WebKitWebView") 123 | (c-name "webkit_web_view_can_undo") 124 | (return-type "gboolean") 125 | ) 126 | 127 | (define-method redo 128 | (of-object "WebKitWebView") 129 | (c-name "webkit_web_view_redo") 130 | (return-type "none") 131 | ) 132 | 133 | (define-method can_redo 134 | (of-object "WebKitWebView") 135 | (c-name "webkit_web_view_can_redo") 136 | (return-type "gboolean") 137 | ) 138 | 139 | (define-method set_view_source_mode 140 | (of-object "WebKitWebView") 141 | (c-name "webkit_web_view_set_view_source_mode") 142 | (parameters 143 | '("gboolean" "view_source_mode") 144 | ) 145 | ) 146 | 147 | (define-method get_view_source_mode 148 | (of-object "WebKitWebView") 149 | (c-name "webkit_web_view_get_view_source_mode") 150 | (return-type "gboolean") 151 | ) 152 | 153 | (define-method get_dom_document 154 | (of-object "WebKitWebView") 155 | (c-name "webkit_web_view_get_dom_document") 156 | (return-type "WebKitDOMDocument*") 157 | ) 158 | 159 | 160 | ;; from webkit/webkitwebwindowfeatures.h 161 | (define-function webkit_web_window_features_new 162 | (is-constructor-of "WebKitWebWindowFeatures") 163 | (c-name "webkit_web_window_features_new") 164 | (caller-owns-return #t) 165 | (return-type "WebKitWebWindowFeatures*") 166 | ) 167 | 168 | (define-method equal 169 | (of-object "WebKitWebWindowFeatures") 170 | (c-name "webkit_web_window_features_equal") 171 | (return-type "gboolean") 172 | (parameters 173 | '("WebKitWebWindowFeatures*" "other_features") 174 | ) 175 | ) 176 | 177 | ;; from webkit/webkitwebnavigationaction.h 178 | 179 | (define-method get_reason 180 | (of-object "WebKitWebNavigationAction") 181 | (c-name "webkit_web_navigation_action_get_reason") 182 | (return-type "WebKitWebNavigationReason") 183 | ) 184 | 185 | (define-method set_reason 186 | (of-object "WebKitWebNavigationAction") 187 | (c-name "webkit_web_navigation_action_set_reason") 188 | (return-type "none") 189 | (parameters 190 | '("WebKitWebNavigationReason" "reason") 191 | ) 192 | ) 193 | 194 | (define-method get_original_uri 195 | (of-object "WebKitWebNavigationAction") 196 | (c-name "webkit_web_navigation_action_get_original_uri") 197 | (return-type "const-gchar*") 198 | ) 199 | 200 | (define-method set_original_uri 201 | (of-object "WebKitWebNavigationAction") 202 | (c-name "webkit_web_navigation_action_set_original_uri") 203 | (return-type "none") 204 | (parameters 205 | '("const-gchar*" "original_uri") 206 | ) 207 | ) 208 | 209 | (define-method get_button 210 | (of-object "WebKitWebNavigationAction") 211 | (c-name "webkit_web_navigation_action_get_button") 212 | (return-type "gint") 213 | ) 214 | 215 | (define-method get_modifier_state 216 | (of-object "WebKitWebNavigationAction") 217 | (c-name "webkit_web_navigation_action_get_modifier_state") 218 | (return-type "gint") 219 | ) 220 | 221 | ;; from webkit/webkitwebpolicydecision.h 222 | 223 | (define-method use 224 | (of-object "WebKitWebPolicyDecision") 225 | (c-name "webkit_web_policy_decision_use") 226 | (return-type "none") 227 | ) 228 | 229 | (define-method ignore 230 | (of-object "WebKitWebPolicyDecision") 231 | (c-name "webkit_web_policy_decision_ignore") 232 | (return-type "none") 233 | ) 234 | 235 | (define-method download 236 | (of-object "WebKitWebPolicyDecision") 237 | (c-name "webkit_web_policy_decision_download") 238 | (return-type "none") 239 | ) 240 | 241 | ;; from webkit/webkitwebbackforwardlist.h 242 | 243 | (define-method add_item 244 | (of-object "WebKitWebBackForwardList") 245 | (c-name "webkit_web_back_forward_list_add_item") 246 | (return-type "none") 247 | (parameters 248 | '("WebKitWebHistoryItem*" "history_item") 249 | ) 250 | ) 251 | 252 | ;; from webkit/webkitwebframe.h 253 | 254 | (define-method load_uri 255 | (of-object "WebKitWebFrame") 256 | (c-name "webkit_web_frame_load_uri") 257 | (return-type "none") 258 | (parameters 259 | '("const-gchar*" "uri") 260 | ) 261 | ) 262 | 263 | (define-method load_string 264 | (of-object "WebKitWebFrame") 265 | (c-name "webkit_web_frame_load_string") 266 | (return-type "none") 267 | (parameters 268 | '("const-gchar*" "content") 269 | ("const-gchar*" "mime_type") 270 | ("const-gchar*" "encoding") 271 | ("const-gchar*" "base_uri") 272 | ) 273 | ) 274 | 275 | (define-method print_full 276 | (of-object "WebKitWebFrame") 277 | (c-name "webkit_web_frame_print_full") 278 | (return-type "GtkPrintOperationResult") 279 | (parameters 280 | '("GtkPrintOperation*" "operation") 281 | ("GtkPrintOperationAction" "action") 282 | ("GError**" "error") 283 | ) 284 | ) 285 | 286 | (define-method print 287 | (of-object "WebKitWebFrame") 288 | (c-name "webkit_web_frame_print") 289 | (return-type "none") 290 | ) 291 | 292 | (define-method get_security_origin 293 | (of-object "WebKitWebFrame") 294 | (c-name "webkit_web_frame_get_security_origin") 295 | (return-type "WebKitSecurityOrigin*") 296 | ) 297 | 298 | (define-method get_data_source 299 | (of-object "WebKitWebFrame") 300 | (c-name "webkit_web_frame_get_data_source") 301 | (return-type "WebKitWebDataSource*") 302 | ) 303 | 304 | (define-method get_network_response 305 | (of-object "WebKitWebFrame") 306 | (c-name "webkit_web_frame_get_network_response") 307 | (return-type "WebKitNetworkResponse*") 308 | ) 309 | 310 | (define-method get_provisional_data_source 311 | (of-object "WebKitWebFrame") 312 | (c-name "webkit_web_frame_get_provisional_data_source") 313 | (return-type "WebKitWebDataSource*") 314 | ) 315 | 316 | ;; from webkit/webkitdownload.h 317 | (define-function webkit_download_new 318 | (is-constructor-of "WebKitDownload") 319 | (c-name "webkit_download_new") 320 | (caller-owns-return #t) 321 | (return-type "WebKitDownload*") 322 | ) 323 | 324 | (define-method start 325 | (of-object "WebKitDownload") 326 | (c-name "webkit_download_start") 327 | (return-type "none") 328 | ) 329 | 330 | (define-method cancel 331 | (of-object "WebKitDownload") 332 | (c-name "webkit_download_cancel") 333 | (return-type "none") 334 | ) 335 | 336 | (define-method get_uri 337 | (of-object "WebKitDownload") 338 | (c-name "webkit_download_get_uri") 339 | (return-type "const-gchar*") 340 | ) 341 | 342 | (define-method get_network_request 343 | (of-object "WebKitDownload") 344 | (c-name "webkit_download_get_network_request") 345 | (return-type "WebKitNetworkRequest*") 346 | ) 347 | 348 | (define-method get_suggested_filename 349 | (of-object "WebKitDownload") 350 | (c-name "webkit_download_get_suggested_filename") 351 | (return-type "const-gchar*") 352 | ) 353 | 354 | (define-method get_destination_uri 355 | (of-object "WebKitDownload") 356 | (c-name "webkit_download_get_destination_uri") 357 | (return-type "const-gchar*") 358 | ) 359 | 360 | (define-method set_destination_uri 361 | (of-object "WebKitDownload") 362 | (c-name "webkit_download_set_destination_uri") 363 | (return-type "none") 364 | (parameters 365 | '("const-gchar*" "destination_uri") 366 | ) 367 | ) 368 | 369 | (define-method get_progress 370 | (of-object "WebKitDownload") 371 | (c-name "webkit_download_get_progress") 372 | (return-type "gdouble") 373 | ) 374 | 375 | (define-method get_elapsed_time 376 | (of-object "WebKitDownload") 377 | (c-name "webkit_download_get_elapsed_time") 378 | (return-type "gdouble") 379 | ) 380 | 381 | (define-method get_total_size 382 | (of-object "WebKitDownload") 383 | (c-name "webkit_download_get_total_size") 384 | (return-type "guint64") 385 | ) 386 | 387 | (define-method get_current_size 388 | (of-object "WebKitDownload") 389 | (c-name "webkit_download_get_current_size") 390 | (return-type "guint64") 391 | ) 392 | 393 | (define-method get_status 394 | (of-object "WebKitDownload") 395 | (c-name "webkit_download_get_status") 396 | (return-type "WebKitDownloadStatus") 397 | ) 398 | 399 | ;; From 400 | 401 | (define-function webkit_network_response_new 402 | (is-constructor-of "WebKitNetworkResponse") 403 | (c-name "webkit_network_response_new") 404 | (caller-owns-return #t) 405 | (return-type "WebKitNetworkResponse*") 406 | (properties 407 | '("uri" (argname "uri")) 408 | ) 409 | ) 410 | 411 | (define-method set_uri 412 | (of-object "WebKitNetworkResponse") 413 | (c-name "webkit_network_response_set_uri") 414 | (return-type "none") 415 | (parameters 416 | '("const-gchar*" "uri") 417 | ) 418 | ) 419 | 420 | (define-method get_uri 421 | (of-object "WebKitNetworkResponse") 422 | (c-name "webkit_network_response_get_uri") 423 | (return-type "const-gchar*") 424 | ) 425 | 426 | ;; From 427 | 428 | (define-method get_host 429 | (of-object "WebKitSecurityOrigin") 430 | (c-name "webkit_security_origin_get_host") 431 | (return-type "const-gchar*") 432 | ) 433 | 434 | (define-method get_protocol 435 | (of-object "WebKitSecurityOrigin") 436 | (c-name "webkit_security_origin_get_protocol") 437 | (return-type "const-gchar*") 438 | ) 439 | 440 | (define-method get_port 441 | (of-object "WebKitSecurityOrigin") 442 | (c-name "webkit_security_origin_get_port") 443 | (return-type "guint") 444 | ) 445 | 446 | (define-method get_web_database_usage 447 | (of-object "WebKitSecurityOrigin") 448 | (c-name "webkit_security_origin_get_web_database_usage") 449 | (return-type "guint64") 450 | ) 451 | 452 | (define-method get_web_database_quota 453 | (of-object "WebKitSecurityOrigin") 454 | (c-name "webkit_security_origin_get_web_database_quota") 455 | (return-type "guint64") 456 | ) 457 | 458 | (define-method set_web_database_quota 459 | (of-object "WebKitSecurityOrigin") 460 | (c-name "webkit_security_origin_set_web_database_quota") 461 | (return-type "none") 462 | (parameters 463 | '("guint64" "quota") 464 | ) 465 | ) 466 | 467 | (define-method get_all_web_databases 468 | (of-object "WebKitSecurityOrigin") 469 | (c-name "webkit_security_origin_get_all_web_databases") 470 | (return-type "GList*") 471 | ) 472 | 473 | ;; From 474 | 475 | (define-method get_security_origin 476 | (of-object "WebKitWebDatabase") 477 | (c-name "webkit_web_database_get_security_origin") 478 | (return-type "WebKitSecurityOrigin*") 479 | ) 480 | 481 | (define-method get_name 482 | (of-object "WebKitWebDatabase") 483 | (c-name "webkit_web_database_get_name") 484 | (return-type "const-gchar*") 485 | ) 486 | 487 | (define-method get_display_name 488 | (of-object "WebKitWebDatabase") 489 | (c-name "webkit_web_database_get_display_name") 490 | (return-type "const-gchar*") 491 | ) 492 | 493 | (define-method get_expected_size 494 | (of-object "WebKitWebDatabase") 495 | (c-name "webkit_web_database_get_expected_size") 496 | (return-type "guint64") 497 | ) 498 | 499 | (define-method get_size 500 | (of-object "WebKitWebDatabase") 501 | (c-name "webkit_web_database_get_size") 502 | (return-type "guint64") 503 | ) 504 | 505 | (define-method get_filename 506 | (of-object "WebKitWebDatabase") 507 | (c-name "webkit_web_database_get_filename") 508 | (return-type "const-gchar*") 509 | ) 510 | 511 | (define-method remove 512 | (of-object "WebKitWebDatabase") 513 | (c-name "webkit_web_database_remove") 514 | (return-type "none") 515 | ) 516 | 517 | (define-function remove_all_web_databases 518 | (c-name "webkit_remove_all_web_databases") 519 | (return-type "none") 520 | ) 521 | 522 | (define-function get_web_database_directory_path 523 | (c-name "webkit_get_web_database_directory_path") 524 | (return-type "const-gchar*") 525 | ) 526 | 527 | (define-function set_web_database_directory_path 528 | (c-name "webkit_set_web_database_directory_path") 529 | (return-type "none") 530 | (parameters 531 | '("const-gchar*" "path") 532 | ) 533 | ) 534 | 535 | (define-function get_default_web_database_quota 536 | (c-name "webkit_get_default_web_database_quota") 537 | (return-type "guint64") 538 | ) 539 | 540 | (define-function set_default_web_database_quota 541 | (c-name "webkit_set_default_web_database_quota") 542 | (return-type "none") 543 | (parameters 544 | '("guint64" "default_quota") 545 | ) 546 | ) 547 | 548 | ;; From 549 | 550 | (define-function webkit_web_data_source_new 551 | (is-constructor-of "WebKitWebDataSource") 552 | (c-name "webkit_web_data_source_new") 553 | (caller-owns-return #t) 554 | (return-type "WebKitWebDataSource*") 555 | ) 556 | 557 | (define-method get_web_frame 558 | (of-object "WebKitWebDataSource") 559 | (c-name "webkit_web_data_source_get_web_frame") 560 | (return-type "WebKitWebFrame*") 561 | ) 562 | 563 | (define-method get_initial_request 564 | (of-object "WebKitWebDataSource") 565 | (c-name "webkit_web_data_source_get_initial_request") 566 | (return-type "WebKitNetworkRequest*") 567 | ) 568 | 569 | (define-method get_request 570 | (of-object "WebKitWebDataSource") 571 | (c-name "webkit_web_data_source_get_request") 572 | (return-type "WebKitNetworkRequest*") 573 | ) 574 | 575 | (define-method get_encoding 576 | (of-object "WebKitWebDataSource") 577 | (c-name "webkit_web_data_source_get_encoding") 578 | (return-type "const-gchar*") 579 | ) 580 | 581 | (define-method is_loading 582 | (of-object "WebKitWebDataSource") 583 | (c-name "webkit_web_data_source_is_loading") 584 | (return-type "gboolean") 585 | ) 586 | 587 | (define-method get_data 588 | (of-object "WebKitWebDataSource") 589 | (c-name "webkit_web_data_source_get_data") 590 | (return-type "GString*") 591 | ) 592 | 593 | (define-method get_main_resource 594 | (of-object "WebKitWebDataSource") 595 | (c-name "webkit_web_data_source_get_main_resource") 596 | (return-type "WebKitWebResource*") 597 | ) 598 | 599 | (define-method get_unreachable_uri 600 | (of-object "WebKitWebDataSource") 601 | (c-name "webkit_web_data_source_get_unreachable_uri") 602 | (return-type "const-gchar*") 603 | ) 604 | 605 | ;; From 606 | 607 | (define-function webkit_web_resource_new 608 | (is-constructor-of "WebKitWebResource") 609 | (c-name "webkit_web_resource_new") 610 | (caller-owns-return #t) 611 | (return-type "WebKitWebResource*") 612 | (properties 613 | '("data" (argname "data")) 614 | '("size" (argname "size")) 615 | '("uri" (argname "uri")) 616 | '("mime_type" (argname "mime_type")) 617 | '("encoding" (argname "encoding")) 618 | '("frame_name" (argname "frame_name")) 619 | ) 620 | ) 621 | 622 | (define-method get_data 623 | (of-object "WebKitWebResource") 624 | (c-name "webkit_web_resource_get_data") 625 | (return-type "GString*") 626 | ) 627 | 628 | (define-method get_uri 629 | (of-object "WebKitWebResource") 630 | (c-name "webkit_web_resource_get_uri") 631 | (return-type "const-gchar*") 632 | ) 633 | 634 | (define-method get_mime_type 635 | (of-object "WebKitWebResource") 636 | (c-name "webkit_web_resource_get_mime_type") 637 | (return-type "const-gchar*") 638 | ) 639 | 640 | (define-method get_encoding 641 | (of-object "WebKitWebResource") 642 | (c-name "webkit_web_resource_get_encoding") 643 | (return-type "const-gchar*") 644 | ) 645 | 646 | (define-method get_frame_name 647 | (of-object "WebKitWebResource") 648 | (c-name "webkit_web_resource_get_frame_name") 649 | (return-type "const-gchar*") 650 | ) 651 | -------------------------------------------------------------------------------- /webkit/webkit-base-types.defs: -------------------------------------------------------------------------------- 1 | ;; -*- scheme -*- 2 | ;; PyWebKitGtk - Python bindings to WebKit/GTK+ 3 | ;; 4 | ;; Copyright (C) 2009 Jan Michael Alonzo 5 | ;; 6 | ;; This library is free software; you can redistribute it and/or 7 | ;; modify it under the terms of the GNU Library General Public 8 | ;; License as published by the Free Software Foundation; either 9 | ;; version 2 of the License, or (at your option) any later version. 10 | ;; 11 | ;; This library is distributed in the hope that it will be useful, 12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | ;; Library General Public License for more details. 15 | ;; 16 | ;; You should have received a copy of the GNU Library General Public 17 | ;; License along with this library; if not, write to the Free Software 18 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA 19 | ;; 20 | 21 | 22 | ; object definitions ... 23 | (define-object WebView 24 | (in-module "WebKit") 25 | (parent "GtkContainer") 26 | (c-name "WebKitWebView") 27 | (gtype-id "WEBKIT_TYPE_WEB_VIEW") 28 | ) 29 | 30 | (define-object WebFrame 31 | (in-module "WebKit") 32 | (parent "GObject") 33 | (c-name "WebKitWebFrame") 34 | (gtype-id "WEBKIT_TYPE_WEB_FRAME") 35 | ) 36 | 37 | (define-object WebHistoryItem 38 | (in-module "WebKit") 39 | (parent "GObject") 40 | (c-name "WebKitWebHistoryItem") 41 | (gtype-id "WEBKIT_TYPE_WEB_HISTORY_ITEM") 42 | ) 43 | 44 | (define-object WebBackForwardList 45 | (in-module "WebKit") 46 | (parent "GObject") 47 | (c-name "WebKitWebBackForwardList") 48 | (gtype-id "WEBKIT_TYPE_WEB_BACK_FORWARD_LIST") 49 | ) 50 | 51 | (define-object WebSettings 52 | (in-module "WebKit") 53 | (parent "GObject") 54 | (c-name "WebKitWebSettings") 55 | (gtype-id "WEBKIT_TYPE_WEB_SETTINGS") 56 | ) 57 | 58 | (define-object NetworkRequest 59 | (in-module "WebKit") 60 | (parent "GObject") 61 | (c-name "WebKitNetworkRequest") 62 | (gtype-id "WEBKIT_TYPE_NETWORK_REQUEST") 63 | ) 64 | 65 | ;; Enumerations and flags ... 66 | (define-enum NavigationResponse 67 | (in-module "WebKit") 68 | (c-name "WebKitNavigationResponse") 69 | (gtype-id "WEBKIT_TYPE_NAVIGATION_RESPONSE") 70 | (values 71 | '("accept" "WEBKIT_NAVIGATION_RESPONSE_ACCEPT") 72 | '("ignore" "WEBKIT_NAVIGATION_RESPONSE_IGNORE") 73 | '("download" "WEBKIT_NAVIGATION_RESPONSE_DOWNLOAD") 74 | ) 75 | ) 76 | 77 | (define-enum WebViewTargetInfo 78 | (in-module "WebKit") 79 | (c-name "WebKitWebViewTargetInfo") 80 | (gtype-id "WEBKIT_TYPE_WEB_VIEW_TARGET_INFO") 81 | (values 82 | '("html" "WEBKIT_WEB_VIEW_TARGET_INFO_HTML") 83 | '("text" "WEBKIT_WEB_VIEW_TARGET_INFO_TEXT") 84 | ) 85 | ) 86 | -------------------------------------------------------------------------------- /webkit/webkit.override: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; c-basic-offset: 4 -*- */ 2 | /* 3 | Copyright (C) 2006, Red Hat, Inc. 4 | Copyright (C) 2007, One Laptop Per Child 5 | Copyright (C) 2009, Jan Michael Alonzo 6 | 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program; if not, write to the Free Software 19 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | %% 23 | headers 24 | #include 25 | #define NO_IMPORT_PYGOBJECT 26 | #include 27 | #include 28 | #include 29 | 30 | #include "javascriptcore/javascriptcore_types.h" 31 | %% 32 | body 33 | static PyObject * 34 | _helper_wrap_gobject_glist (GList *list) 35 | { 36 | PyObject *py_list; 37 | GList *tmp; 38 | 39 | if ((py_list = PyList_New(0)) == NULL) { 40 | return NULL; 41 | } 42 | for (tmp = list; tmp != NULL; tmp = tmp->next) { 43 | PyObject *py_obj = pygobject_new(G_OBJECT(tmp->data)); 44 | 45 | if (py_obj == NULL) { 46 | Py_DECREF(py_list); 47 | return NULL; 48 | } 49 | 50 | PyList_Append(py_list, py_obj); 51 | Py_DECREF(py_obj); 52 | } 53 | 54 | return py_list; 55 | } 56 | %% 57 | modulename webkit 58 | %% 59 | import gtk.Container as PyGtkContainer_Type 60 | import gobject.GObject as PyGObject_Type 61 | import gtk.PrintOperation as PyGtkPrintOperation_Type 62 | %% 63 | ignore-glob 64 | *_get_type 65 | _* 66 | %% 67 | ignore 68 | webkit_network_request_get_type 69 | webkit_web_back_forward_list_get_type 70 | webkit_web_frame_get_type 71 | webkit_web_history_item_get_type 72 | webkit_web_inspector_get_type 73 | webkit_web_view_get_type 74 | webkit_web_settings_get_type 75 | webkit_download_get_type 76 | webkit_network_response_get_type 77 | webkit_security_origin_get_type 78 | webkit_web_database_get_type 79 | webkit_web_resource_new 80 | %% 81 | override webkit_web_frame_get_global_context noargs 82 | static PyObject * 83 | _wrap_webkit_web_frame_get_global_context (PyGObject *self) 84 | { 85 | JSGlobalContextRef ref; 86 | 87 | ref = webkit_web_frame_get_global_context (WEBKIT_WEB_FRAME (self->obj)); 88 | 89 | return wrap_JSGlobalContextRef (ref); 90 | } 91 | %% 92 | override webkit_web_back_forward_list_get_back_list_with_limit kwargs 93 | static PyObject * 94 | _wrap_webkit_web_back_forward_list_get_back_list_with_limit (PyGObject *self, PyObject *args, PyObject *kwargs) 95 | { 96 | static char *kwlist[] = { "limit", NULL }; 97 | 98 | GList *list; 99 | int limit; 100 | 101 | if (! PyArg_ParseTupleAndKeywords (args, kwargs, "i:WebBackForwardList.get_back_list_with_limit", kwlist, &limit)) 102 | return NULL; 103 | 104 | list = webkit_web_back_forward_list_get_back_list_with_limit(WEBKIT_WEB_BACK_FORWARD_LIST(self->obj), 105 | limit); 106 | return _helper_wrap_gobject_glist (list); 107 | } 108 | %% 109 | override webkit_web_back_forward_list_get_forward_list_with_limit kwargs 110 | static PyObject * 111 | _wrap_webkit_web_back_forward_list_get_forward_list_with_limit (PyGObject *self, 112 | PyObject *args, 113 | PyObject *kwargs) 114 | { 115 | static char *kwlist[] = { "limit", NULL }; 116 | 117 | GList *list; 118 | int limit; 119 | 120 | if (! PyArg_ParseTupleAndKeywords (args, kwargs, "i:WebBackForwardList.get_forward_list_with_limit", kwlist, &limit)) 121 | return NULL; 122 | 123 | list = webkit_web_back_forward_list_get_forward_list_with_limit(WEBKIT_WEB_BACK_FORWARD_LIST(self->obj), 124 | limit); 125 | return _helper_wrap_gobject_glist (list); 126 | } 127 | %% 128 | override webkit_security_origin_get_all_web_databases noargs 129 | static PyObject * 130 | _wrap_webkit_security_origin_get_all_web_databases (PyGObject *self) 131 | { 132 | GList *list; 133 | 134 | list = webkit_security_origin_get_all_web_databases(WEBKIT_SECURITY_ORIGIN(self->obj)); 135 | 136 | return _helper_wrap_gobject_glist (list); 137 | } 138 | %% 139 | override webkit_web_navigation_action_set_reason kwargs 140 | static PyObject * 141 | _wrap_webkit_web_navigation_action_set_reason(PyGObject *self, PyObject *args, PyObject *kwargs) 142 | { 143 | static char *kwlist[] = { "reason", NULL }; 144 | PyObject *py_reason; 145 | WebKitWebNavigationReason reason = 0; 146 | 147 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:WebKitWebNavigationAction.set_reason", 148 | kwlist, &py_reason)) 149 | return NULL; 150 | 151 | pyg_enum_get_value(WEBKIT_TYPE_WEB_NAVIGATION_REASON, py_reason, (gint*) &reason); 152 | 153 | webkit_web_navigation_action_set_reason(WEBKIT_WEB_NAVIGATION_ACTION(self->obj), reason); 154 | 155 | Py_INCREF(Py_None); 156 | return Py_None; 157 | } 158 | %% 159 | override webkit_web_navigation_action_get_reason noargs 160 | static PyObject * 161 | _wrap_webkit_web_navigation_action_get_reason(PyGObject *self) 162 | { 163 | WebKitWebNavigationReason reason; 164 | 165 | reason = webkit_web_navigation_action_get_reason(WEBKIT_WEB_NAVIGATION_ACTION(self->obj)); 166 | 167 | return Py_BuildValue("N", pyg_enum_from_gtype(WEBKIT_TYPE_WEB_NAVIGATION_REASON, reason)); 168 | } 169 | %% 170 | override webkit_download_get_status noargs 171 | static PyObject * 172 | _wrap_webkit_download_get_status(PyGObject *self) 173 | { 174 | WebKitDownloadStatus status; 175 | 176 | status = webkit_download_get_status(WEBKIT_DOWNLOAD(self->obj)); 177 | 178 | return Py_BuildValue("N", pyg_enum_from_gtype(WEBKIT_TYPE_DOWNLOAD_STATUS, status)); 179 | } 180 | %% 181 | override webkit_web_view_get_load_status noargs 182 | static PyObject * 183 | _wrap_webkit_web_view_get_load_status(PyGObject *self) 184 | { 185 | WebKitLoadStatus status; 186 | 187 | status = webkit_web_view_get_load_status(WEBKIT_WEB_VIEW(self->obj)); 188 | 189 | return Py_BuildValue("N", pyg_enum_from_gtype(WEBKIT_TYPE_LOAD_STATUS, status)); 190 | 191 | } 192 | %% 193 | new-constructor WEBKIT_TYPE_HISTORY_ITEM 194 | %% 195 | override webkit_web_history_item_new kwargs 196 | static int 197 | _wrap_webkit_web_history_item_new(PyGObject *self, PyObject *args, PyObject *kwargs) 198 | { 199 | static char *kwlist[] = {"uri", "title", NULL}; 200 | gchar *uri = NULL; 201 | gchar *title = NULL; 202 | 203 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|zz:WebHistoryItem.__init__", 204 | kwlist, &uri, &title)) 205 | return -1; 206 | 207 | 208 | if (uri) 209 | self->obj = (GObject *)webkit_web_history_item_new_with_data(uri, title); 210 | else 211 | self->obj = (GObject *)webkit_web_history_item_new(); 212 | 213 | if (!self->obj) { 214 | PyErr_SetString(PyExc_RuntimeError, 215 | "count not create WebHistoryItem object"); 216 | return -1; 217 | } 218 | pygobject_register_wrapper((PyObject *)self); 219 | return 0; 220 | } 221 | %% 222 | new-constructor WEBKIT_TYPE_NETWORK_RESPONSE 223 | %% 224 | override webkit_network_response_new kwargs 225 | static int 226 | _wrap_webkit_network_response_new(PyGObject *self, PyObject* args, PyObject *kwargs) 227 | { 228 | static char *kwlist[] = {"uri", NULL }; 229 | gchar* uri = NULL; 230 | 231 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|z:NetworkResponse.__init__", 232 | kwlist, &uri)) 233 | return -1; 234 | 235 | if (uri) 236 | self->obj = G_OBJECT(webkit_network_response_new(uri)); 237 | else 238 | self->obj = G_OBJECT(webkit_network_response_new("about:blank")); 239 | 240 | if (!self->obj) { 241 | PyErr_SetString(PyExc_RuntimeError, 242 | "cannot create NetworkResponse object"); 243 | return -1; 244 | } 245 | pygobject_register_wrapper((PyObject *)self); 246 | return 0; 247 | } 248 | %% 249 | new-constructor WEBKIT_TYPE_NETWORK_REQUEST 250 | %% 251 | override webkit_network_request_new kwargs 252 | static int 253 | _wrap_webkit_network_request_new(PyGObject *self, PyObject* args, PyObject *kwargs) 254 | { 255 | static char *kwlist[] = {"uri", NULL }; 256 | gchar* uri = NULL; 257 | 258 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|z:NetworkRequest.__init__", 259 | kwlist, &uri)) 260 | return -1; 261 | 262 | if (uri) 263 | self->obj = G_OBJECT(webkit_network_request_new(uri)); 264 | else 265 | self->obj = G_OBJECT(webkit_network_request_new("about:blank")); 266 | 267 | if (!self->obj) { 268 | PyErr_SetString(PyExc_RuntimeError, 269 | "cannot create NetworkRequest object"); 270 | return -1; 271 | } 272 | pygobject_register_wrapper((PyObject *)self); 273 | return 0; 274 | } 275 | %% 276 | override webkit_web_resource_get_data noargs 277 | static PyObject * 278 | _wrap_webkit_web_resource_get_data(PyGObject *self) 279 | { 280 | PyObject *ret; 281 | GString *data; 282 | 283 | data = webkit_web_resource_get_data(WEBKIT_WEB_RESOURCE(self->obj)); 284 | 285 | if (data == NULL) { 286 | Py_INCREF(Py_None); 287 | return (Py_None); 288 | } 289 | 290 | return Py_BuildValue("s#", data->str, data->len); 291 | } 292 | %% 293 | override webkit_web_data_source_get_data noargs 294 | static PyObject * 295 | _wrap_webkit_web_data_source_get_data(PyGObject *self) 296 | { 297 | PyObject *ret; 298 | GString *data; 299 | 300 | data = webkit_web_data_source_get_data(WEBKIT_WEB_DATA_SOURCE(self->obj)); 301 | 302 | if (data == NULL) { 303 | Py_INCREF(Py_None); 304 | return (Py_None); 305 | } 306 | 307 | return Py_BuildValue("s#", data->str, data->len); 308 | } 309 | 310 | 311 | -------------------------------------------------------------------------------- /webkit/webkitmodule.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006-2007, Red Hat, Inc. 3 | * Copyright (C) 2009 Jan Michael Alonzo 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the 17 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 | * Boston, MA 02111-1307, USA. 19 | */ 20 | #include 21 | #ifdef HAVE_CONFIG_H 22 | #include "config.h" 23 | #endif 24 | 25 | #include 26 | /* include this first, before NO_IMPORT_PYGOBJECT is defined */ 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | 33 | void *webkit_get_default_session(void); 34 | void pywebkit_register_classes (PyObject *d); 35 | void pywebkit_add_constants(PyObject *module, const gchar *strip_prefix); 36 | 37 | 38 | static PyObject * 39 | pywebkit_set_proxy(PyObject *obj, PyObject *args, PyObject *kwargs) 40 | { 41 | static char *kwlist[] = {"proxy_uri", 0}; 42 | const char *uri; 43 | SoupSession *session; 44 | SoupURI *proxy_uri; 45 | 46 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s", kwlist, &uri)) 47 | return NULL; 48 | 49 | proxy_uri = soup_uri_new(uri); 50 | if (!proxy_uri) { 51 | PyErr_SetString(PyExc_ValueError, "malformed proxy uri"); 52 | return NULL; 53 | } 54 | session = webkit_get_default_session(); 55 | g_object_set(session, "proxy-uri", proxy_uri, NULL); 56 | soup_uri_free(proxy_uri); 57 | 58 | Py_INCREF(Py_None); 59 | return Py_None; 60 | } 61 | 62 | 63 | extern PyMethodDef pywebkit_functions[]; 64 | 65 | static PyMethodDef pywebkit_extras[] = { 66 | {"set_proxy", (PyCFunction)pywebkit_set_proxy, METH_VARARGS | METH_KEYWORDS, 67 | PyDoc_STR("set_proxy(proxy_uri) - set the webkit proxy")}, 68 | {NULL, NULL} 69 | }; 70 | 71 | static PyMethodDef *__methods; 72 | 73 | 74 | /* 75 | * Return the number of method definitions found. 76 | */ 77 | static size_t 78 | _count_methods(PyMethodDef *methods) 79 | { 80 | size_t i = 0; 81 | 82 | while (methods[i].ml_name) 83 | i++; 84 | return i; 85 | } 86 | 87 | 88 | /* 89 | * Concatenate the local function definitions with those created by 90 | * pygobject's code generator. 91 | */ 92 | static PyMethodDef * 93 | _merge_methods(PyMethodDef *md1, PyMethodDef *md2) 94 | { 95 | PyMethodDef *methods; 96 | size_t md1_size; 97 | size_t md2_size; 98 | size_t total; 99 | int i; 100 | int j; 101 | 102 | /* compute size of new merged array */ 103 | md1_size = _count_methods(md1); 104 | md2_size = _count_methods(md2); 105 | total = md1_size + md2_size + 1; 106 | 107 | /* allocate new array and copy method defs */ 108 | methods = calloc(total, sizeof(PyMethodDef)); 109 | j = 0; 110 | for (i = 0; i < md1_size; i++) { 111 | methods[j++] = md1[i]; 112 | } 113 | /* copy md2 and include its sentinel */ 114 | for (i = 0; i < md2_size + 1; i++) { 115 | methods[j++] = md2[i]; 116 | } 117 | return methods; 118 | } 119 | 120 | 121 | /* 122 | * Clean up so Valgrind is happy. 123 | */ 124 | static void 125 | _release_global_methods(void) 126 | { 127 | if (__methods) { 128 | free(__methods); 129 | __methods = NULL; 130 | } 131 | } 132 | 133 | 134 | DL_EXPORT(void) 135 | initwebkit(void) 136 | { 137 | PyObject *m, *d; 138 | 139 | if (!pygobject_init(-1, -1, -1)) { 140 | PyErr_Print(); 141 | Py_FatalError ("can't initialise module gobject"); 142 | } 143 | 144 | init_pygobject(); 145 | 146 | __methods = _merge_methods(pywebkit_functions, pywebkit_extras); 147 | m = Py_InitModule ("webkit", __methods); 148 | 149 | d = PyModule_GetDict (m); 150 | pywebkit_register_classes (d); 151 | pywebkit_add_constants (m, "WEBKIT_"); 152 | 153 | if (PyErr_Occurred ()) { 154 | PyErr_Print(); 155 | Py_FatalError ("can't initialise module webkit"); 156 | } 157 | Py_AtExit(_release_global_methods); 158 | } 159 | 160 | 161 | --------------------------------------------------------------------------------