pax_global_header00006660000000000000000000000064140052525130014507gustar00rootroot0000000000000052 comment=797226e3c69feb248dd20eac2f4b6265a0c191c2 thunarx-python-thunarx-python-0.5.2/000077500000000000000000000000001400525251300175315ustar00rootroot00000000000000thunarx-python-thunarx-python-0.5.2/.gitignore000066400000000000000000000005251400525251300215230ustar00rootroot00000000000000docs/reference/*.docbook src/.deps src/.libs src/*.la src/*.lo Makefile Makefile.in depcomp stamp-h1 *.stamp missing *.tar.gz *.tar.bz2 libtool ltmain.sh install-sh aclocal.m4 autom4te.cache compile config.* configure configure.ac *.m4 *.make docs/*.html docs/*.png docs/*.css docs/reference/html docs/reference/xml builddate.xml *.devhelp2 thunarx-python-thunarx-python-0.5.2/.gitlab-ci.yml000066400000000000000000000001171400525251300221640ustar00rootroot00000000000000include: - project: 'xfce/xfce4-dev-tools' file: '/ci/build_project.yml' thunarx-python-thunarx-python-0.5.2/AUTHORS000066400000000000000000000000411400525251300205740ustar00rootroot00000000000000Adam Plumb thunarx-python-thunarx-python-0.5.2/COPYING000066400000000000000000001045131400525251300205700ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . thunarx-python-thunarx-python-0.5.2/ChangeLog000066400000000000000000000001171400525251300213020ustar00rootroot00000000000000For a list of changes go to: http://git.xfce.org/bindings/thunarx-python/ thunarx-python-thunarx-python-0.5.2/INSTALL000066400000000000000000000366141400525251300205740ustar00rootroot00000000000000Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell command './configure && make && make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the 'README' file for instructions specific to this package. Some packages provide this 'INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The 'configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a 'Makefile' in each directory of the package. It may also create one or more '.h' files containing system-dependent definitions. Finally, it creates a shell script 'config.status' that you can run in the future to recreate the current configuration, and a file 'config.log' containing compiler output (useful mainly for debugging 'configure'). It can also use an optional file (typically called 'config.cache' and enabled with '--cache-file=config.cache' or simply '-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how 'configure' could check whether to do them, and mail diffs or instructions to the address given in the 'README' so they can be considered for the next release. If you are using the cache, and at some point 'config.cache' contains results you don't want to keep, you may remove or edit it. The file 'configure.ac' (or 'configure.in') is used to create 'configure' by a program called 'autoconf'. You need 'configure.ac' if you want to change it or regenerate 'configure' using a newer version of 'autoconf'. The simplest way to compile this package is: 1. 'cd' to the directory containing the package's source code and type './configure' to configure the package for your system. Running 'configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type 'make' to compile the package. 3. Optionally, type 'make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type 'make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the 'make install' phase executed with root privileges. 5. Optionally, type 'make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior 'make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing 'make clean'. To also remove the files that 'configure' created (so you can compile the package for a different kind of computer), type 'make distclean'. There is also a 'make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type 'make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide 'make distcheck', which can by used by developers to test that all other targets like 'make install' and 'make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the 'configure' script does not know about. Run './configure --help' for details on some of the pertinent environment variables. You can give 'configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU 'make'. 'cd' to the directory where you want the object files and executables to go and run the 'configure' script. 'configure' automatically checks for the source code in the directory that 'configure' is in and in '..'. This is known as a "VPATH" build. With a non-GNU 'make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use 'make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple '-arch' options to the compiler but only a single '-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the 'lipo' tool if you have problems. Installation Names ================== By default, 'make install' installs the package's commands under '/usr/local/bin', include files under '/usr/local/include', etc. You can specify an installation prefix other than '/usr/local' by giving 'configure' the option '--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option '--exec-prefix=PREFIX' to 'configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like '--bindir=DIR' to specify different values for particular kinds of files. Run 'configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of '${prefix}', so that specifying just '--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to 'configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the 'make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, 'make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of '${prefix}'. Any directories that were specified during 'configure', but not in terms of '${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the 'DESTDIR' variable. For example, 'make install DESTDIR=/alternate/directory' will prepend '/alternate/directory' before all installation names. The approach of 'DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of '${prefix}' at 'configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving 'configure' the option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'. Some packages pay attention to '--enable-FEATURE' options to 'configure', where FEATURE indicates an optional part of the package. They may also pay attention to '--with-PACKAGE' options, where PACKAGE is something like 'gnu-as' or 'x' (for the X Window System). The 'README' should mention any '--enable-' and '--with-' options that the package recognizes. For packages that use the X Window System, 'configure' can usually find the X include and library files automatically, but if it doesn't, you can use the 'configure' options '--x-includes=DIR' and '--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of 'make' will be. For these packages, running './configure --enable-silent-rules' sets the default to minimal output, which can be overridden with 'make V=1'; while running './configure --disable-silent-rules' sets the default to verbose, which can be overridden with 'make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX 'make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as 'configure' are involved. Use GNU 'make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its '' header file. The option '-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put '/usr/ucb' early in your 'PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in '/usr/bin'. So, if you need '/usr/ucb' in your 'PATH', put it _after_ '/usr/bin'. On Haiku, software installed for all users goes in '/boot/common', not '/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features 'configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, 'configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the '--build=TYPE' option. TYPE can either be a short name for the system type, such as 'sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file 'config.sub' for the possible values of each field. If 'config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option '--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with '--host=TYPE'. Sharing Defaults ================ If you want to set default values for 'configure' scripts to share, you can create a site shell script called 'config.site' that gives default values for variables like 'CC', 'cache_file', and 'prefix'. 'configure' looks for 'PREFIX/share/config.site' if it exists, then 'PREFIX/etc/config.site' if it exists. Or, you can set the 'CONFIG_SITE' environment variable to the location of the site script. A warning: not all 'configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to 'configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the 'configure' command line, using 'VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified 'gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an Autoconf limitation. Until the limitation is lifted, you can use this workaround: CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash 'configure' Invocation ====================== 'configure' recognizes the following options to control how it operates. '--help' '-h' Print a summary of all of the options to 'configure', and exit. '--help=short' '--help=recursive' Print a summary of the options unique to this package's 'configure', and exit. The 'short' variant lists options used only in the top level, while the 'recursive' variant lists options also present in any nested packages. '--version' '-V' Print the version of Autoconf used to generate the 'configure' script, and exit. '--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally 'config.cache'. FILE defaults to '/dev/null' to disable caching. '--config-cache' '-C' Alias for '--cache-file=config.cache'. '--quiet' '--silent' '-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to '/dev/null' (any error messages will still be shown). '--srcdir=DIR' Look for the package's source code in directory DIR. Usually 'configure' can determine that directory automatically. '--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. '--no-create' '-n' Run the configure checks, but stop before creating any output files. 'configure' also accepts some other, not widely useful, options. Run 'configure --help' for more details. thunarx-python-thunarx-python-0.5.2/Makefile.am000066400000000000000000000001621400525251300215640ustar00rootroot00000000000000ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} SUBDIRS = src examples docs DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc thunarx-python-thunarx-python-0.5.2/NEWS000066400000000000000000000036431400525251300202360ustar00rootroot000000000000000.5.2: - Add gitlab-ci for thunarx-python - Update configure.ac.in syntax - Remove checks with unused result - Remove check for unused sys/wait.h - Fix missing-prototypes - Fix g_list_find_custom usage - make distcheck now works ! - Update gtk-doc for thunarx-python - Fix compilation with python3.8 - fix compilation issues with gcc-10 - Scan extension directories only once 0.5.1: - Fix bug #14199, building docs with python3 0.5.0: - Updated to work with python3 or python2 - Improve extension path loading semantics to follow XDG recommendations 0.4.0: - Updated to work with Thunarx-3 which requires uses gobject introspection and requires Gtk+3 and PyGObject3. - Fix x86_64 python lib path issue on Debian-based systems 0.3.0: - Look for python extensions in $XDG_DATA_DIR/thunarx-python/extensions now. No longer look in /usr/lib/thunarx-1/python. - Fix PyCapsule support for the pygobject module - Don't hard-code the docs directory in the Makefile.am files - Use g_return_val_if_fail in override function instead of g_return_if_fail - Updated documentation and moved examples to its own folder - Removed the dependency on gnome-python2, there was no need for it. 0.2.3: - Fix the python macros to work with python3 - Fix the main Makefile.am to only build the docs folder if --gtk-docs-enable is set - The overview docs now properly includes the example script. This fixes an install bug - Add support for importing the pygtk module as a PyCapsule 0.2.2: - Add gtk-doc documentation - Fixed dependency information in the README file 0.2.1: - Override the thunarx.PropertyPage constructor to allow for a string or GtkWidget label - Updated the README file with some corrections and clarifications 0.2.0: - Allow thunarx-python to run on all versions of thunar (>= 0.4.0) 0.1.0: - First release thunarx-python-thunarx-python-0.5.2/README000066400000000000000000000030101400525251300204030ustar00rootroot00000000000000Thunarx Python Bindings These bindings allow one to create python plugins for Thunar. As of v0.4.0 the thunarx-python bindings will only work with Gtk+3 and Thunar v1.7. To use these with Gtk+2, make sure to use thunarx-python v0.3.0. As of v0.5.0 the thunarx-python bindings can be built with either python3 or python2 support. Ensure the $PYTHON environment variable is pointed at your preferred python executable before running configure or autogen. Install ----------- To install, run the following commands: $ ./configure (or ./autogen.sh if building from git) $ make $ make install If you have built Thunar into a non-standard prefix, thunarx-python will be installed there, but make sure pkg-config knows where it is. You may have to update your PKG_CONFIG_PATH environment variable to include your Thunar's pkgconfig path. export PKG_CONFIG_PATH="/thunar_prefix/lib/pkgconfig" Running Extensions ------------------ As of thunarx-python 0.5.0, scripts are loaded in the following order: 1. $XDG_DATA_HOME/thunarx-python/extensions 2. thunar_prefix/share/thunarx-python/extensions 3. $XDG_DATA_DIRS/thunarx-python/extensions 4. THUNARX_EXTENSION_DIR/python (i.e. /usr/lib64/thunarx-3/python) Simply copy your python scripts into that folder and restart Thunar. Dependencies ------------ * Thunar (1.7.0 or later) * pygobject (3.20.0 or later) * gtk+3 (3.20.0 or later) Debugging ----------- To enable debug mode, start Thunar with the following command: $ THUNARX_PYTHON_DEBUG=all /path/to/thunar thunarx-python-thunarx-python-0.5.2/autogen.sh000077500000000000000000000011321400525251300215270ustar00rootroot00000000000000#!/bin/sh # # Copyright (c) 2002-2006 # The Thunar development team. All rights reserved. # # Written for Thunar by Benedikt Meurer . # (type xdt-autogen) >/dev/null 2>&1 || { cat >&2 <. dnl Modified by Peter de Ridder . dnl Modified by Adam Plumb dnl dnl *************************** dnl *** Version information *** dnl *************************** m4_define([txp_version_major], [0]) m4_define([txp_version_minor], [5]) m4_define([txp_version_micro], [2]) m4_define([txp_version_tag], []) m4_define([txp_version_build], [@REVISION@]) m4_define([txp_version], [txp_version_major().txp_version_minor().txp_version_micro()ifelse(txp_version_tag(), [], [], [txp_version_tag()-txp_version_build()])]) dnl *************************** dnl *** Initialize autoconf *** dnl *************************** AC_COPYRIGHT([Copyright (c) 2017 Adam Plumb .]) AC_INIT([thunarx-python], [txp_version], [https://gitlab.xfce.org/bindings/thunarx-python]) AC_PREREQ([2.69]) AC_CANONICAL_TARGET() AC_CONFIG_MACRO_DIRS(m4) AC_CONFIG_HEADERS([config.h]) dnl *************************** dnl *** Initialize automake *** dnl *************************** AM_INIT_AUTOMAKE([1.8 dist-bzip2 no-dist-gzip tar-ustar]) AM_MAINTAINER_MODE() AM_SILENT_RULES([yes]) dnl ******************************** dnl *** Check for basic programs *** dnl ******************************** AC_PROG_CC() LT_PATH_LD([]) AC_PROG_INSTALL() AM_PROG_CC_C_O() dnl ************************** dnl *** Initialize libtool *** dnl ************************** LT_PREREQ([2.4]) LT_INIT([disable-static]) dnl Check for gtk-doc GTK_DOC_CHECK(1.14) PYG_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)]) PYG_CHECK_PYTHON_LIBS(,[AC_MSG_ERROR(could not find Python lib)]) dnl *************************** dnl *** Determine the installed thunarx version *** dnl *************************** THUNARX_API_VERSION=3 XDT_CHECK_PACKAGE([THUNARX], [thunarx-3], [1.7.0]) XDT_CHECK_PACKAGE([GTK], [gtk+-3.0], [3.20.0]) XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.30.0]) XDT_CHECK_PACKAGE([PYGOBJECT], [pygobject-3.0], [3.20.0]) AC_SUBST(THUNARX_API_VERSION) dnl *********************************** dnl *** Check for debugging support *** dnl *********************************** XDT_FEATURE_DEBUG([txp_debug_default]) dnl ************************************** dnl *** Check for linker optimizations *** dnl ************************************** XDT_FEATURE_LINKER_OPTS() AC_CONFIG_FILES([ Makefile src/Makefile examples/Makefile docs/Makefile docs/reference/Makefile docs/reference/version.xml ]) AC_OUTPUT dnl *************************** dnl *** Print configuration *** dnl *************************** echo echo "Build Configuration:" echo echo " Prefix: $prefix" echo " Documentation: ${enable_gtk_doc}" echo " Python Version: ${PYTHON_LIB_NAME}" echo thunarx-python-thunarx-python-0.5.2/docs/000077500000000000000000000000001400525251300204615ustar00rootroot00000000000000thunarx-python-thunarx-python-0.5.2/docs/Makefile.am000066400000000000000000000002031400525251300225100ustar00rootroot00000000000000# vi:set ts=8 sw=8 noet ai nocindent: SUBDIRS = \ reference thunarx-python-thunarx-python-0.5.2/docs/reference/000077500000000000000000000000001400525251300224175ustar00rootroot00000000000000thunarx-python-thunarx-python-0.5.2/docs/reference/Makefile.am000066400000000000000000000117061400525251300244600ustar00rootroot00000000000000# -*- mode: makefile -*- # # Makefile.am - template makefile for gtk-doc module # Copyright (C) 2007-2017 Stefan Sauer # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # As a special exception, the above copyright owner gives unlimited # permission to copy, distribute and modify this Makefile.am template. # You need not follow the terms of the GNU General Public License when # using or distributing such Makefile.am files, even though portions of # the text of the Makefile.am appear in them. The GNU General Public # License (GPL) does govern all other use of the material that constitutes # the Makefile.am template. # This is a blank Makefile.am for using gtk-doc. # Copy this to your project's API docs directory and modify the variables to # suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples # of using the various options. # The name of the module, e.g. 'glib'. DOC_MODULE=thunarx-python # Uncomment for versioned docs and specify the version of the module, e.g. '2'. #DOC_MODULE_VERSION=2 # The top-level XML file. DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml # Directories containing the source code. # gtk-doc will search all .c and .h files beneath these paths # for inline comments documenting functions and macros. # e.g. DOC_SOURCE_DIR=$(top_srcdir)/gtk $(top_srcdir)/gdk DOC_SOURCE_DIR= # Extra options to pass to gtkdoc-scangobj. Normally not needed. SCANGOBJ_OPTIONS= # Extra options to supply to gtkdoc-scan. # e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" SCAN_OPTIONS= # Extra options to supply to gtkdoc-mkdb # e.g. MKDB_OPTIONS=--xml-mode --output-format=xml MKDB_OPTIONS=--xml-mode --output-format=xml # Extra options to supply to gtkdoc-mkhtml MKHTML_OPTIONS= #--path $(srcdir)/reference # Extra options to supply to gtkdoc-fixref. Normally not needed. # e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html FIXXREF_OPTIONS= # Used for dependencies. The docs will be rebuilt if any of these change. # e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h # e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c HFILE_GLOB= CFILE_GLOB= # Extra header to include when scanning, which are not under DOC_SOURCE_DIR # e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h EXTRA_HFILES= # Header files or dirs to ignore when scanning. Use base file/dir names # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h private_code IGNORE_HFILES= # Images to copy into HTML directory. # e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png HTML_IMAGES= # Extra files that are included by $(DOC_MAIN_SGML_FILE). # e.g. content_files=running.xml building.xml changes-2.0.xml content_files=version.xml \ thunarx-python-overview.xml \ thunarx-python-overview-example.xml \ thunarx-python-class-reference.xml \ thunarx-python-provider-reference.xml \ thunarx-python-menu-provider.xml \ thunarx-python-menu-item.xml \ thunarx-python-menu.xml \ thunarx-python-property-page.xml \ thunarx-python-property-page-provider.xml \ thunarx-python-renamer.xml \ thunarx-python-renamer-provider.xml \ thunarx-python-preferences-provider.xml \ thunarx-python-file-info.xml # Files where gtk-doc abbreviations (#GtkWidget) are expanded # e.g. expand_content_files=running.xml expand_content_files= # CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. # Only needed if you are using gtkdoc-scangobj to dynamically query widget # signals and properties. # e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) GTKDOC_CFLAGS= GTKDOC_LIBS= # This includes the standard gtk-doc make rules, copied by gtkdocize. include $(top_srcdir)/gtk-doc.make # Other files to distribute EXTRA_DIST += \ version.xml.in thunarx-python-overview.xml \ thunarx-python-overview-example.xml \ thunarx-python-class-reference.xml \ thunarx-python-provider-reference.xml \ thunarx-python-menu-provider.xml \ thunarx-python-menu-item.xml \ thunarx-python-menu.xml \ thunarx-python-property-page.xml \ thunarx-python-property-page-provider.xml \ thunarx-python-renamer.xml \ thunarx-python-renamer-provider.xml \ thunarx-python-preferences-provider.xml \ thunarx-python-file-info.xml -include $(top_srcdir)/git.mk thunarx-python-thunarx-python-0.5.2/docs/reference/thunarx-python-class-reference.xml000066400000000000000000000010761400525251300312140ustar00rootroot00000000000000 Available Classes thunarx-python-thunarx-python-0.5.2/docs/reference/thunarx-python-docs.xml000066400000000000000000000020531400525251300270770ustar00rootroot00000000000000 %gtkdocentities; ]> thunarx-python Reference Manual Reference Manual for thunarx-python For thunarx-python version Adam Plumb This reference describes the classes of the thunarx-python module. thunarx-python-thunarx-python-0.5.2/docs/reference/thunarx-python-file-info.xml000066400000000000000000000351711400525251300300260ustar00rootroot00000000000000 Thunarx.FileInfo Thunarx.FileInfo Reference Synopsis Thunarx.FileInfo GObject.GInterface get_name get_uri get_parent_uri get_uri_scheme get_mime_type has_mime_type mime_type is_directory get_file_info get_filesystem_info get_location changed renamed Ancestry +-- GObject.GInterface +-- Thunarx.FileInfo Description Each Thunarx.FileInfo object is an abstraction of a real file. Signals "changed" callback "renamed" callback Public Methods Thunarx.FileInfo.get_name get_name Returns : Returns the real name of the file represented by file_info in the local file system encoding. Thunarx.FileInfo.get_uri get_uri Returns : Returns the escaped, fully qualified URI of the file object represented by file_info. Thunarx.FileInfo.get_parent_uri get_parent_uri Returns : Returns the URI to the parent file of file_info or NULL if file_info has no parent. Note that the parent URI may be of a different type than the URI of file_info. For example, the parent of "file:///" is "computer:///". Thunarx.FileInfo.get_uri_scheme get_uri_scheme Returns : Returns the URI scheme of the file represented by file_info. E.g. if file_info refers to the file "file:///usr/home", the return value will be "file". Thunarx.FileInfo.get_mime_type get_mime_type Returns : Returns the MIME-type of the file represented by file_info or NULL if no MIME-type is known for file_info. Thunarx.FileInfo.has_mime_type has_mime_type mime_type : the mime_type to check for Returns : Checks whether file_info is of the given mime_type or whether the MIME-type of file_info is a subclass of mime_type. This is the preferred way for most extensions to check whether they support a given file or not, and you should consider using this method rather than Thunarx.FileInfo.get_mime_type(). A simple example would be a menu extension that performs a certain action on text files. In this case you want to check whether a given Thunarx.FileInfo refers to any kind of text file, not only to "text/plain" (e.g. this also includes "text/xml" and "application/x-desktop"). But you should be aware that this method may take some time to test whether mime_type is valid for file_info, so don't call it too often. Thunarx.FileInfo.is_directory is_directory Returns : Checks whether file_info refers to a directory. Thunarx.FileInfo.get_file_info get_file_info Returns : Returns the GFileInfo object associated with file_info, which includes additional information about the file_info as queried from GIO earlier. Thunarx.FileInfo.get_filesystem_info get_filesystem_info Returns : Returns the GFileInfo which includes additional information about the filesystem file_info resides on. Thunarx.FileInfo.get_location get_location Returns : Returns the GFile file_info points to. The GFile is a more powerful tool than just the URI or the path. Thunarx.FileInfo.changed changed Returns : Emits the ::changed signal on file_info. This method should not be invoked by Thunar plugins, instead the file manager itself will use this method to emit ::changed whenever it notices a change on file_info. Thunarx.FileInfo.renamed renamed Returns : Emits the ::renamed signal on file_info. This method should not be invoked by Thunar plugins, instead the file manager will emit this signal whenever the user renamed the file_info. The plugins should instead connect to the ::renamed signal and update it's internal state and it's user interface after the file manager renamed a file. Signal Details The "changed" Thunarx.FileInfo Signal Emitted whenever the system notices a change to file_info. Thunar plugins should use this signal to stay informed about changes to a file_info for which they currently display information (i.e. in a Thunarx.PropertyPage), and update it's user interface whenever a change is noticed on file_info. The "renamed" Thunarx.FileInfo Signal Emitted when the file_info is renamed to another name. For example, within Thunar, ThunarFolder uses this signal to reregister it's VFS directory monitor, after the corresponding file was renamed. thunarx-python-thunarx-python-0.5.2/docs/reference/thunarx-python-menu-item.xml000066400000000000000000000141431400525251300300520ustar00rootroot00000000000000 Thunarx.MenuItem Thunarx.MenuItem Reference Synopsis Thunarx.MenuItem GObject.GInterface set_sensitive Boolean get_sensitive set_menu ThunarxMenu activate Ancestry +-- GObject.GInterface +-- Thunarx.MenuItem Description Each Thunarx.MenuItem object is an abstraction of a real menu item. Signals "activate" callback Public Methods Thunarx.MenuItem.get_sensitive get_sensitive Returns :Boolean Returns whether the menu item is sensitive. Thunarx.MenuItem.set_sensitive set_sensitive Boolean Returns : Set whether the menu item is sensitive. Thunarx.MenuItem.set_menu set_menu ThunarxMenu Returns : Add a menu to the menu item (i.e. submenu) Thunarx.MenuItem.activate activate Returns : Emits the ::activate signal on menu_item. This method should not be invoked by thunarx-python plugins, instead the file manager itself will use this method to emit ::activate whenever it notices a change on menu_item. Signal Details The "activate" Thunarx.MenuItem Signal Emitted whenever the system notices a change to menu_item. Thunar plugins should use this signal to stay informed about changes to a menu_item for which they currently display information (i.e. in a Thunarx.PropertyPage), and update it's user interface whenever a change is noticed on menu_item. thunarx-python-thunarx-python-0.5.2/docs/reference/thunarx-python-menu-provider.xml000066400000000000000000000231741400525251300307520ustar00rootroot00000000000000 Thunarx.MenuProvider Thunarx.MenuProvider Reference Synopsis Thunarx.MenuProvider get_file_menu_items window files get_folder_menu_items window folder get_dnd_menu_items window folder files Description The interface to extensions that provide additional menu items A Thunarx.MenuProvider plugin (without submenus) from gi.repository import GObject, Gtk, Thunarx class ThunarxMenuProviderPlugin(GObject.GObject, Thunarx.MenuProvider): def __init__(self): pass def get_file_menu_items(self, window, files): item = Thunarx.MenuItem(name="TMP:TestFileAction", label="Python File Action", tooltip='', icon=Gtk.STOCK_FILE) item.connect("activate", self.__do_something, window) return [item] def get_folder_menu_items(self, window, folder): return [Thunarx.MenuItem(name="TMP:TestFolderAction", label="Python Folder Action", tooltip='', icon=Gtk.STOCK_OPEN)] def __do_something(self, item, window): print("Doing something") A Thunarx.MenuProvider plugin (with submenus) from gi.repository import GObject, Gtk, Thunarx class ThunarxSubMenuProviderPlugin(GObject.GObject, Thunarx.MenuProvider): def __init__(self): pass def get_file_menu_items(self, window, files): item = Thunarx.MenuItem(name="TMP:Item1", label="Python File Action", tooltip='', icon=Gtk.STOCK_FILE) submenu = Thunarx.Menu() subitem1 = Thunarx.MenuItem(name='TMP::Subitem1', label='Subitem1', tooltip='First tip', icon=Gtk.STOCK_DND) subitem1.connect("activate", self.__subitem1_callback, window) submenu.append_item(subitem1) subitem2 = Thunarx.MenuItem(name='TMP::Subitem2', label='Subitem2', tooltip='Second tip', icon=Gtk.STOCK_FULLSCREEN) subitem2.connect("activate", self.__subitem2_callback, window) submenu.append_item(subitem2) item.set_menu(submenu) item2 = Thunarx.MenuItem(name='TMP::Item2', label='Another item', tooltip='', icon=Gtk.STOCK_OK) return item,item2 def __subitem1_callback(self, item, window): print("Subitem1 call") def __subitem2_callback(self, item, window): print("Subitem2 call") Passive Methods Thunarx.MenuProvider.get_file_menu_items get_file_menu_items window files window : the current Gtk.Window instance menu : a list of Thunarx.FileInfo objects. Returns : a list of Thunarx.MenuItem objects The get_file_menu_items() method returns a list of Thunarx.MenuItem objects. Thunarx.MenuProvider.get_folder_menu_items get_folder_menu_items window folder window : the current Gtk.Window instance folder : the current folder, as a Thunarx.FileInfo object. Returns : a list of Thunarx.MenuItem objects The get_folder_menu_items() method returns a list of Thunarx.MenuItem objects. Thunarx.MenuProvider.get_dnd_menu_items get_dnd_menu_items window folder files window : the current Gtk.Window instance folder : the current folder, as a Thunarx.FileInfo object. files : a list of the currently selected files, as a Thunarx.FileInfo objects. Returns : a list of Thunarx.MenuItem objects The get_dnd_menu_items() method returns a list of Thunarx.MenuItem objects. thunarx-python-thunarx-python-0.5.2/docs/reference/thunarx-python-menu.xml000066400000000000000000000062051400525251300271160ustar00rootroot00000000000000 Thunarx.Menu Thunarx.Menu Reference Synopsis Thunarx.Menu GObject.GInterface get_items append_item ThunarxMenuItem Ancestry +-- GObject.GInterface +-- Thunarx.Menu Description Each Thunarx.Menu object is an abstraction of a real menu. Public Methods Thunarx.Menu.get_items get_items Returns :List Returns a list of attached menu items Thunarx.Menu.append_item append_item ThunarxMenuItem Returns : Append menu items to menu thunarx-python-thunarx-python-0.5.2/docs/reference/thunarx-python-overview-example.xml000066400000000000000000000043071400525251300314520ustar00rootroot00000000000000 A Simple Extension Create an empty file with the following code: A Simple Extension from gi.repository import GObject, Gtk, Thunarx class ThunarxMenuProviderPlugin(GObject.GObject, Thunarx.MenuProvider): def __init__(self): pass def get_file_menu_items(self, window, files): item = Thunarx.MenuItem(name="TMP:TestFileAction", label="Python File Action", tooltip='', icon=Gtk.STOCK_FILE) item.connect("activate", self.__do_something, window) return [item] def get_folder_menu_items(self, window, folder): return [Thunarx.MenuItem(name="TMP:TestFolderAction", label="Python Folder Action", tooltip='', icon=Gtk.STOCK_OPEN)] def __do_something(self, item, window): print("Doing something") Save this file as TestExtension.py in the $XDG_DATA_DIR/thunarx-python/extensions folder or ~/.local/share/thunarx-python/extensions. You may need to create this folder. To run, open the terminal and type: $ killall thunar $ thunar Once Thunar starts, right-click on a file and you should see a new menu item, "Python File Action". It is as simple as that! As mentioned above, in order to get loaded by Thunar, a python extension must import the Thunarx module, create a class derived from a Thunarx *Provider, then create the methods that will be called by Thunar when it requests information from its providers. In this case, when someone right-clicks on a file, Thunar will ask all of its MenuProviders for additional menu items to show the user. When folders or files are clicked, the get_file_menu_items method is called and a list of Thunarx.MenuItem objects is expected. thunarx-python-thunarx-python-0.5.2/docs/reference/thunarx-python-overview.xml000066400000000000000000000047261400525251300300260ustar00rootroot00000000000000 Overview Writing a thunarx-python extension is a fairly straight-forward process. One simply imports the Thunarx module and creates a class which is derived from a number of the Thunarx module's classes. When an extension derives a class, it becomes a "provider", telling Thunarx to ask it for information. There are several types of providers available for extensions to use: there is MenuProvider, PropertyPageProvider, RenamerProvider, and PreferencePageProvider, all of which will be explained in more detail below. Your class can be derived from multiple providers. Here are the basic steps: 1. A script is written and installed to the standard python extensions install path 2. Thunar is (re)started and loads the thunarx-python C extension, which in turn loads all python extensions 3. Any python script in the standard python extensions install path that imports the Thunarx module and derives the main class from a Thunarx module class will be loaded Where to install python extensions As of thunarx-python 0.3.0, python extensions are installed in $XDG_DATA_DIR/thunarx-python/extensions where $XDG_DATA_DIR could be /usr/share for a global install or ~/.local/share for a local install. As of thunarx-python 0.5.0, python extensions are loaded in the following order: 1. $XDG_DATA_HOME/thunarx-python/extensions 2. thunar_prefix/share/thunarx-python/extensions 3. $XDG_DATA_DIRS/thunarx-python/extensions 4. THUNARX_EXTENSION_DIR/python (i.e. /usr/lib64/thunarx-3/python) thunarx-3 As of thunar v1.7.0, thunarx requires Gtk+3 and no longer accepts gtk.Actions. Instead, it expects Thunarx.MenuItems. python3 As of thunarx-python v0.5.0, thunarx-python can be built to embed python3 instead of python2. It uses the $PYTHON environment variable to determine which library to use. thunarx-python-thunarx-python-0.5.2/docs/reference/thunarx-python-preferences-provider.xml000066400000000000000000000115331400525251300323030ustar00rootroot00000000000000 Thunarx.PreferencesProvider Thunarx.PreferencesProvider Reference Synopsis Thunarx.PreferencesProvider get_preferences_menu_items window Description The Thunarx.PreferencesProvider interface is implemented by extensions that want to register additional actions in the preferences menu of the file manager. In general this should only be done by extensions that are closely tied to the file manager (for example, the thunar-uca is such an extension, while an extension that just adds Compress file and Uncompress file to the context menu of compressed files should not add their own preferences to the file manager menu, because it should use desktop-wide settings for archive managers instead). The Thunarx.MenuItem objects returned from the Thunarx.PreferencesProvider.get_preferences_menu_items() method must be namespaced with the model to avoid collision with internal file manager actions and actions provided by other extensions. For example, the preferences action provided by the thunar-uca extension is called ThunarUca::manage-actions. A Thunarx.PreferencesProvider plugin from gi.repository import GObject, Gtk, Thunarx class DialogExample(Gtk.Dialog): def __init__(self, parent): Gtk.Dialog.__init__(self, "My Dialog", parent, 0, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK)) self.set_default_size(150, 100) self.set_transient_for(parent) label = Gtk.Label("This is a dialog to display additional information") box = self.get_content_area() box.add(label) self.show_all() class ThunarxPreferencesPlugin(GObject.GObject, Thunarx.PreferencesProvider): def __init__(self): pass def get_preferences_menu_items(self, window): item = Thunarx.MenuItem(name="TPP:PrefItem", label="My Example Preferences", tooltip=None, icon=None) item.connect("activate", self.__open_preferences, window) return item, def __open_preferences(self, action, window): dialog = DialogExample(window) response = dialog.run() dialog.destroy() Passive Methods Thunarx.PreferencesProvider.get_preferences_menu_items get_preferences_menu_items window : a Gtk.Window Returns : the list of Thunarx.MenuItem objects that provider has to offer as preferences within window. Returns the list of ThunarxMenuItems that provider has to offer as preferences within window. These actions will usually be added to the builtin list of preferences in the "Edit" menu of the file manager's window. Plugin writers that implement this interface should make sure to choose descriptive action names and tooltips, and not to crowd the "Edit" menu too much. That said, think twice before implementing this interface, as too many preference actions will render the file manager useless over time! thunarx-python-thunarx-python-0.5.2/docs/reference/thunarx-python-property-page-provider.xml000066400000000000000000000101321400525251300325720ustar00rootroot00000000000000 Thunarx.PropertyPageProvider Thunarx.PropertyPageProvider Reference Synopsis Thunarx.PropertyPageProvider get_pages files Description To add a property page to the file properties dialog, extensions must implement the ThunarxPropertyPageProvider interface. This interface has only one virtual method, get_pages, that is passed a list of Thunarx.FileInfo objects and returns a list of Thunarx.PropertyPage objects. A Thunarx.PropertyPageProvider plugin import hashlib # A way to get unquote working with python 2 and 3 try: from urllib import unquote except ImportError: from urllib.parse import unquote from gi.repository import GObject, Gtk, Thunarx class ThunarxPropertyPagePlugin(GObject.GObject, Thunarx.PropertyPageProvider): def __init__(self): pass def get_property_pages(self, files): if len(files) != 1: return file = files[0] if file.get_uri_scheme() != 'file': return if file.is_directory(): return filename = unquote(file.get_uri()[7:]) hbox = Gtk.HBox(0, False) hbox.show() label = Gtk.Label('MD5Sum:') label.show() hbox.pack_start(label, True, True, 0) value_label = Gtk.Label() hbox.pack_start(value_label, True, True, 0) md5sum = hashlib.md5(filename.encode("utf-8")).hexdigest() value_label.set_text(md5sum) value_label.show() page = Thunarx.PropertyPage() page.set_label("MD5") page.add(hbox) return [page] Passive Methods Thunarx.PropertyPageProvider.get_pages get_pages files files : a list of Thunarx.FileInfo objects. Returns : a list of Thunarx.PropertyPage objects This function is called by Thunar when it wants property page items from the extension. It is called in the main thread before a property page is shown, so it should return quickly. thunarx-python-thunarx-python-0.5.2/docs/reference/thunarx-python-property-page.xml000066400000000000000000000177131400525251300307560ustar00rootroot00000000000000 Thunarx.PropertyPage Thunarx.PropertyPage Reference Synopsis Thunarx.PropertyPage GObject.GObject Thunarx.PropertyPage label Thunarx.PropertyPage label_widget get_label set_label label get_label_widget set_label_widget label_widget Ancestry +-- GObject.GObject +-- Thunarx.PropertyPage Description A Thunarx.PropertyPage object is returned by Thunarx.PropertyPageProvider extensions. Properties
"label" The label displayed in the notebook tab. Read-Write "label-widget" The label widget displayed in the notebook tab. Default value: None Read-Write
Constructor Thunarx.PropertyPage label label : the user-visible label for the property page Creates a new Thunarx.PropertyPage object. Constructor Thunarx.PropertyPage label_widget label_widget : the user-visible label widget for the property page Creates a new Thunarx.PropertyPage object. Public Methods Thunarx.FileInfo.get_label get_label Returns : the text in the label or NULL Thunarx.FileInfo.set_label set_label Returns : Sets the text of the label. Thunarx.FileInfo.get_label_widget get_label_widget Returns : Returns the label widget for the property_page. Thunarx.FileInfo.set_label_widget set_label_widget Returns : Sets the label widget for the property_page. This is the widget that will appear in the notebook header for the property_page.
thunarx-python-thunarx-python-0.5.2/docs/reference/thunarx-python-provider-reference.xml000066400000000000000000000010631400525251300317350ustar00rootroot00000000000000 Provider Interfaces thunarx-python-thunarx-python-0.5.2/docs/reference/thunarx-python-renamer-provider.xml000066400000000000000000000106651400525251300314400ustar00rootroot00000000000000 Thunarx.RenamerProvider Thunarx.RenamerProvider Reference Synopsis Thunarx.RenamerProvider get_renamers files Description The Thunarx.RenamerProvider interface is implemented by extensions which provide additional bulk renamers that should be used by the bulk rename dialog in Thunar. A Thunarx.RenamerProvider Extension from gi.repository import GObject, Gtk, Thunarx class ThunarxPythonRenamer(Thunarx.Renamer): __gtype_name__ = "ThunarxPythonRenamer" prefix = GObject.property(type=str) def __init__(self): Thunarx.Renamer.__init__(self) # Set properties to be saved in the settings files self.set_property("prefix", "__") self.set_name("Example Python Renamer") self.set_help_url("http://www.google.com") hbox = Gtk.HBox(0, False) label = Gtk.Label("Prefix:") hbox.pack_start(label, False, False, 0) self.entry = Gtk.Entry() self.entry.set_text(self.get_property("prefix")) self.entry.connect("changed", self.entry_changed) hbox.pack_start(self.entry, False, False, 0) label.show() self.entry.show() self.add(hbox) hbox.show() def do_process(self, file, text, index): prefix = self.entry.get_text() return prefix + text def entry_changed(self, widget): self.set_property("prefix", widget.get_text()) # Emitting this will cause the do_process method to be called self.emit("changed") def do_get_menu_items(self, window, files): return [Gtk.Action(name="TPR:SomeAction", label="Some Action", tooltip=None, icon=Gtk.STOCK_OPEN)] def do_load(self, settings): """ Loads settings saved in ~/.config/Thunar/renamerrc """ if settings.haskey("Prefix"): self.set_property("prefix", settings["Prefix"]) self.entry.set_text(self.get_property("prefix")) def do_save(self, settings): """ If do_save is overriden, you must rebuild the settings dictionary and then return it. """ settings["Prefix"] = self.get_property("prefix") return settings class ThunarxRenamerPlugin(GObject.GObject, Thunarx.RenamerProvider): def __init__(self): pass def get_renamers(self): return [ThunarxPythonRenamer()] Passive Methods Thunarx.RenamerProvider.get_renamers get_renamers files Returns : the list of Thunarx.Renamer objects provided by the specified provider. Returns the list of ThunarxRenamers provided by the specified provider. thunarx-python-thunarx-python-0.5.2/docs/reference/thunarx-python-renamer.xml000066400000000000000000000450161400525251300276060ustar00rootroot00000000000000 Thunarx.Renamer Thunarx.Renamer Reference Synopsis Thunarx.Renamer GObject.GObject get_help_name set_help_url help_url get_name set_name name do_process file text index do_load settings do_save settings do_get_menu_items window files do_changed Ancestry +-- GObject.GObject +-- Thunarx.Renamer Description The abstract base class Thunarx.Renamer is implemented by extensions which provide additional bulk renamers that should be used in the bulk rename dialog. Derived classes must override the do_process() method, which is called by the bulk rename dialog for every file to generate a new name. For example, the ThunarSbrReplaceRenamer class included in the thunar-sbr plugin (which is part of the Thunar distribution) provides a bulk renamer, named Search & Replace, which allows the user to rename multiple files by searching for a pattern in each file name and, if the pattern is found, replacing it with the specified replacement text. Properties
"help-url" The URL to the documentation of this ThunarxRenamer. Derived classes can set this property to point to the documentation for the specific renamer. The documentation of the specific renamer in turn should contain a link to the general Thunar renamer documentation. May also be unset, in which case the general Thunar renamer documentation will be shown when the user clicks the "Help" button. Default value: NULL Read-Write "name" The user visible name of the renamer, that is displayed in the bulk rename dialog of the file manager. Derived classes should set a useful name. Default value: NULL Read-Write
Signals "changed" callback Passive Methods Thunarx.Renamer.do_process do_process file text index file : the Thunarx.FileInfo for the file whose new name - according to renamer - should be determined. text : the part of the filename to which the renamer should be applied. index : the index of the file in the list, used for renamers that work on numbering. Returns : the string with which to replace text. Determines the replacement for text (which is the relevant part of the full file name, i.e. either the suffix, the name or the name and the suffix). Thunarx.Renamer.do_load do_load settings settings : a dictionary which contains the previously saved settings for renamer as key/value pairs of strings. Tells renamer to load its internal settings from the specified settings. The settings hash table contains previously saved settings, see Thunarx.Renamer.do_save(), as key/value pairs of strings. That is, both the keys and the values are strings. Implementations of Thunarx.Renamer may decide to override this method to perform custom loading of settings. If you do not override this method, the default method of Thunarx.Renamer will be used, which simply loads all GObject properties provided by renamers class (excluding the ones provided by the parent classes) from the settings. The GObject properties must be transformable to strings and from strings. If you decide to override this method for your Thunarx.Renamer implementation, you should also override Thunarx.Renamer.do_save(). Thunarx.Renamer.do_save do_save settings settings : a dictionary to which the current settings of renamer should be stored as key/value pairs of strings. Thunarx.Renamer.do_get_menu_items do_get_menu_items window files window : a Gtk.Window files : a list of Thunarx.FileInfo objects Returns : the list of ThunarxMenuItems provided by renamer for the given list of files Returns the list of Thunarx.MenuItem objects provided by renamer for the given list of files. By default, this method returns NULL (the empty list), but derived classes may override this method to provide additional actions for files in the bulk renamer dialog list. The returned Thunarx.MenuItem objects will be displayed in the file's context menu of the bulk renamer dialog, when this renamer is active. For example, an ID3-Tag based renamer may add an action "Edit Tags" to the context menus of supported media files and, when activated, display a dialog (which should be transient and modal for window, if not NULL), which allows the users to edit media file tags on-the-fly. Derived classes that override this method should always check first if all the Thunarx.FileInfo objects in the list of files are supported, and only return actions that can be performed on this specific list of files. For example, the ID3-Tag renamer mentioned above, should first check whether all items in files are actually audio files. The Thunarx.FileInfo.has_mime_type() of the Thunarx.FileInfo interface can be used to easily test whether a file in the files list is of a certain MIME type. Some actions may only work properly if only a single file ist selected (for example, the ID3-Tag renamer will probably only supporting editing one file at a time). In this case you have basicly two options: Either you can return NULL here if files does not contain exactly one item, or you can return the actions as usual, but make them insensitive, using: action.set_sensitive(False) The latter has the advantage that the user will still notice the existance of the action and probably realize that it can only be applied to a single item at once. The Thunarx.MenuItem objects returned from this method must be namespaced with the module to avoid collision with internal file manager actions and actions provided by other extensions. For example, the menu action provided by the ID3-Tag renamer mentioned above, should be named TagRenamer::edit-tags (if TagRenamer is the class name). For additional information about the way ThunarxMenuItems should be returned from extensions and the way they are used, read the description of the Thunarx.MenuProvider interface or read the introduction provided with this reference manual. Thunarx.Renamer.do_changed do_changed Returns : This method should be used by derived classes to emit the "changed" signal for renamer. See the documentation of the "changed" signal for details. Active Methods Thunarx.Renamer.get_help_url get_help_url Returns : the URL of the documentation for renamer. Returns the URL of the documentation for renamer or NULL if no specific documentation is available for renamer and the general documentation of the Thunar renamers should be displayed instead. Thunarx.Renamer.set_help_url set_help_url help_url Returns : the new URL for the documentation for renamer. The URL to the documentation of this Thunarx.Renamer. Derived classes can set this property to point to the documentation for the specific renamer. The documentation of the specific renamer in turn should contain a link to the general Thunar renamer documentation. May also be unset, in which case the general Thunar renamer documentation will be shown when the user clicks the "Help" button. Thunarx.Renamer.get_name get_name Returns : the user visible name for renamer. Returns the user visible name for renamer, previously set with Thunarx.Renamer.set_name(). Thunarx.Renamer.set_name set_name name : the new user visible name for renamer. Returns : the new user visible name for renamer. Sets the user visible name for renamer to name. Signal Details The "changed" Thunarx.Renamer Signal Derived classes should emit this signal using the Thunarx.Renamer.do_changed() method whenever the user changed a setting in the renamer GUI. The file manager will then invoke Thunarx.Renamer.do_process() for all files that should be renamed and update the preview.
thunarx-python-thunarx-python-0.5.2/docs/reference/version.xml.in000066400000000000000000000000121400525251300252240ustar00rootroot00000000000000@VERSION@ thunarx-python-thunarx-python-0.5.2/examples/000077500000000000000000000000001400525251300213475ustar00rootroot00000000000000thunarx-python-thunarx-python-0.5.2/examples/Makefile.am000066400000000000000000000004431400525251300234040ustar00rootroot00000000000000docsdir = $(docdir) docs_DATA = README examplesdir = $(docdir)/examples examples_DATA = \ thunarx-preferences-plugin.py \ thunarx-renamer-plugin.py \ thunarx-menu-plugin.py \ thunarx-property-page-plugin.py \ thunarx-submenu-plugin.py EXTRA_DIST = README $(examples_DATA) thunarx-python-thunarx-python-0.5.2/examples/README000066400000000000000000000002631400525251300222300ustar00rootroot00000000000000To install the example plugin, copy to $XDG_DATA_DIR/thunarx-python/extensions where $XDG_DATA_DIR could be /usr/share for a global install or ~/.local/share for a local install. thunarx-python-thunarx-python-0.5.2/examples/thunarx-menu-plugin.py000066400000000000000000000012431400525251300256500ustar00rootroot00000000000000from gi.repository import GObject, Gtk, Thunarx class ThunarxMenuProviderPlugin(GObject.GObject, Thunarx.MenuProvider): def __init__(self): pass def get_file_menu_items(self, window, files): item = Thunarx.MenuItem(name="TMP:TestFileAction", label="Python File Action", tooltip='', icon=Gtk.STOCK_FILE) item.connect("activate", self.__do_something, window) return [item] def get_folder_menu_items(self, window, folder): return [Thunarx.MenuItem(name="TMP:TestFolderAction", label="Python Folder Action", tooltip='', icon=Gtk.STOCK_OPEN)] def __do_something(self, item, window): print "Doing something" thunarx-python-thunarx-python-0.5.2/examples/thunarx-preferences-plugin.py000066400000000000000000000020231400525251300272020ustar00rootroot00000000000000from gi.repository import GObject, Gtk, Thunarx class DialogExample(Gtk.Dialog): def __init__(self, parent): Gtk.Dialog.__init__(self, "My Dialog", parent, 0, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK)) self.set_default_size(150, 100) self.set_transient_for(parent) label = Gtk.Label("This is a dialog to display additional information") box = self.get_content_area() box.add(label) self.show_all() class ThunarxPreferencesPlugin(GObject.GObject, Thunarx.PreferencesProvider): def __init__(self): pass def get_preferences_menu_items(self, window): item = Thunarx.MenuItem(name="TPP:PrefItem", label="My Example Preferences", tooltip=None, icon=None) item.connect("activate", self.__open_preferences, window) return item, def __open_preferences(self, action, window): dialog = DialogExample(window) response = dialog.run() dialog.destroy() thunarx-python-thunarx-python-0.5.2/examples/thunarx-property-page-plugin.py000066400000000000000000000021321400525251300275000ustar00rootroot00000000000000import hashlib # A way to get unquote working with python 2 and 3 try: from urllib import unquote except ImportError: from urllib.parse import unquote from gi.repository import GObject, Gtk, Thunarx class ThunarxPropertyPagePlugin(GObject.GObject, Thunarx.PropertyPageProvider): def __init__(self): pass def get_property_pages(self, files): if len(files) != 1: return file = files[0] if file.get_uri_scheme() != 'file': return if file.is_directory(): return filename = unquote(file.get_uri()[7:]) hbox = Gtk.HBox(0, False) hbox.show() label = Gtk.Label('MD5Sum:') label.show() hbox.pack_start(label, True, True, 0) value_label = Gtk.Label() hbox.pack_start(value_label, True, True, 0) md5sum = hashlib.md5(filename.encode("utf-8")).hexdigest() value_label.set_text(md5sum) value_label.show() page = Thunarx.PropertyPage() page.set_label("MD5") page.add(hbox) return [page] thunarx-python-thunarx-python-0.5.2/examples/thunarx-renamer-plugin.py000066400000000000000000000040341400525251300263360ustar00rootroot00000000000000from gi.repository import GObject, Gtk, Thunarx class ThunarxPythonRenamer(Thunarx.Renamer): __gtype_name__ = "ThunarxPythonRenamer" prefix = GObject.property(type=str) def __init__(self): Thunarx.Renamer.__init__(self) # Set properties to be saved in the settings files self.set_property("prefix", "__") self.set_name("Example Python Renamer 2") self.set_help_url("http://www.google.com") hbox = Gtk.HBox(0, False) label = Gtk.Label("Prefix:") hbox.pack_start(label, False, False, 0) self.entry = Gtk.Entry() self.entry.set_text(self.get_property("prefix")) self.entry.connect("changed", self.entry_changed) hbox.pack_start(self.entry, False, False, 0) label.show() self.entry.show() self.add(hbox) hbox.show() def do_process(self, file, text, index): prefix = self.entry.get_text() return prefix + text def entry_changed(self, widget): self.set_property("prefix", widget.get_text()) # Emitting this will cause the do_process method to be called self.emit("changed") def do_get_menu_items(self, window, files): return [Thunarx.MenuItem(name="TPR:SomeAction", label="Some Action", tooltip=None, icon=Gtk.STOCK_OPEN)] def do_load(self, settings): """ Loads settings saved in ~/.config/Thunar/renamerrc """ if settings.haskey("Prefix"): self.set_property("prefix", settings["Prefix"]) self.entry.set_text(self.get_property("prefix")) def do_save(self, settings): """ If do_save is overriden, you must rebuild the settings dictionary and then return it. """ settings["Prefix"] = self.get_property("prefix") return settings class ThunarxRenamerPlugin(GObject.GObject, Thunarx.RenamerProvider): def __init__(self): pass def get_renamers(self): return [ThunarxPythonRenamer()] thunarx-python-thunarx-python-0.5.2/examples/thunarx-submenu-plugin.py000066400000000000000000000030611400525251300263620ustar00rootroot00000000000000from gi.repository import GObject, Gtk, Thunarx class ThunarxSubMenuProviderPlugin(GObject.GObject, Thunarx.MenuProvider): def __init__(self): pass def get_file_menu_items(self, window, files): item = Thunarx.MenuItem(name="TMP:Item1", label="Python File Action", tooltip='', icon=Gtk.STOCK_FILE) submenu = Thunarx.Menu() subitem1 = Thunarx.MenuItem(name='TMP::Subitem1', label='Subitem1', tooltip='First tip', icon=Gtk.STOCK_DND) subitem1.connect("activate", self.__subitem1_callback, window) submenu.append_item(subitem1) subitem2 = Thunarx.MenuItem(name='TMP::Subitem2', label='Subitem2', tooltip='Second tip', icon=Gtk.STOCK_FULLSCREEN) subitem2.connect("activate", self.__subitem2_callback, window) submenu.append_item(subitem2) item.set_menu(submenu) item2 = Thunarx.MenuItem(name='TMP::Item2', label='Another item', tooltip='', icon=Gtk.STOCK_OK) return item,item2 def __subitem1_callback(self, item, window): print("Subitem1 call") def __subitem2_callback(self, item, window): print("Subitem2 call") thunarx-python-thunarx-python-0.5.2/m4/000077500000000000000000000000001400525251300200515ustar00rootroot00000000000000thunarx-python-thunarx-python-0.5.2/m4/python.m4000066400000000000000000000265621400525251300216470ustar00rootroot00000000000000## this one is commonly used with AM_PATH_PYTHONDIR ... dnl PYG_CHECK_PYMOD(MODNAME [,SYMBOL [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]]) dnl Check if a module containing a given symbol is visible to python. AC_DEFUN([PYG_CHECK_PYMOD], [AC_REQUIRE([AM_PATH_PYTHON]) py_mod_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'` AC_MSG_CHECKING(for ifelse([$2],[],,[$2 in ])python module $1) AC_CACHE_VAL(py_cv_mod_$py_mod_var, [ ifelse([$2],[], [prog=" import sys try: import $1 except ImportError: sys.exit(1) except: sys.exit(0) sys.exit(0)"], [prog=" import $1 $1.$2"]) if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC then eval "py_cv_mod_$py_mod_var=yes" else eval "py_cv_mod_$py_mod_var=no" fi ]) py_val=`eval "echo \`echo '$py_cv_mod_'$py_mod_var\`"` if test "x$py_val" != xno; then AC_MSG_RESULT(yes) ifelse([$3], [],, [$3 ])dnl else AC_MSG_RESULT(no) ifelse([$4], [],, [$4 ])dnl fi ]) # The AC_MULTILIB macro was extracted and modified from # gettext-0.15's AC_LIB_PREPARE_MULTILIB macro in the lib-prefix.m4 file # so that the correct paths can be used for 64-bit libraries. # dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl AC_MULTILIB creates a variable libdirsuffix, containing dnl the suffix of the libdir, either "" or "64". dnl Only do this if the given enable parameter is "yes". AC_DEFUN([AC_MULTILIB], [ dnl There is no formal standard regarding lib and lib64. The current dnl practice is that on a system supporting 32-bit and 64-bit instruction dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit dnl libraries go under $prefix/lib. We determine the compiler's default dnl mode by looking at the compiler's library search path. If at least dnl of its elements ends in /lib64 or points to a directory whose absolute dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the dnl default, namely "lib". enable_lib64="$1" libdirsuffix="" searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` if test "$enable_lib64" = "yes" -a -n "$searchpath"; then save_IFS="${IFS= }"; IFS=":" for searchdir in $searchpath; do if test -d "$searchdir"; then case "$searchdir" in */lib64/ | */lib64 ) libdirsuffix=64 ;; /lib/x86_64-linux-gnu/ | /lib/x86_64-linux-gnu ) libdirsuffix=/x86_64-linux-gnu ;; *) searchdir=`cd "$searchdir" && pwd` case "$searchdir" in */lib64 ) libdirsuffix=64 ;; /lib/x86_64-linux-gnu ) libdirsuffix=/x86_64-linux-gnu ;; esac ;; esac fi done IFS="$save_IFS" else save_IFS="${IFS= }"; IFS=":" for searchdir in $searchpath; do if test -d "$searchdir"; then case "$searchdir" in /lib/i386-linux-gnu/ | /lib/x86_64-linux-gnu ) libdirsuffix=/i386-linux-gnu ;; *) searchdir=`cd "$searchdir" && pwd` case "$searchdir" in /lib/i386-linux-gnu ) libdirsuffix=/i386-linux-gnu ;; esac ;; esac fi done IFS="$save_IFS" fi AC_SUBST(libdirsuffix) ]) dnl a macro to check for ability to create python extensions dnl PYG_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE]) dnl function also defines PYTHON_INCLUDES AC_DEFUN([PYG_CHECK_PYTHON_HEADERS], [AC_REQUIRE([AM_PATH_PYTHON]) AC_MSG_CHECKING(for headers required to compile python extensions) dnl deduce PYTHON_INCLUDES AC_MULTILIB(yes) if test "x$PYTHON_INCLUDES" = x; then PYTHON_CONFIG=`which $PYTHON`-config if test -x "$PYTHON_CONFIG"; then PYTHON_INCLUDES=`$PYTHON_CONFIG --includes 2>/dev/null` else PYTHON_INCLUDES=`$PYTHON -c "import distutils.sysconfig, sys; sys.stdout.write(distutils.sysconfig.get_python_inc(True))"` PYTHON_INCLUDES="-I$PYTHON_INCLUDES" fi fi AC_SUBST(PYTHON_INCLUDES) AC_SUBST(PYTHON_LIB_NAME) dnl check if the headers exist: save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES" AC_TRY_CPP([#include ],dnl [AC_MSG_RESULT(found) $1],dnl [AC_MSG_RESULT(not found) $2]) CPPFLAGS="$save_CPPFLAGS" ]) dnl a macro to check for ability to embed python dnl PYG_CHECK_PYTHON_LIBS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE]) dnl function also defines PYTHON_LIBS AC_DEFUN([PYG_CHECK_PYTHON_LIBS], [AC_REQUIRE([AM_PATH_PYTHON]) AC_MSG_CHECKING(for libraries required to embed python) dnl deduce PYTHON_LIBS py_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"` py_include_path=`$PYTHON -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())"` py_lib_name=`basename $py_include_path` if test "x$PYTHON_LIBS" = x; then PYTHON_CONFIG=`which $PYTHON`-config if test -x "$PYTHON_CONFIG"; then PYTHON_LIBS=`$PYTHON_CONFIG --libs --embed 2>/dev/null` || PYTHON_LIBS=`$PYTHON_CONFIG --libs 2>/dev/null` else PYTHON_LIBS="-L${py_prefix}/lib -lpython${PYTHON_VERSION}" fi fi AC_SUBST(PYTHON_LIBS) if test "x$PYTHON_LIB_LOC" = x; then PYTHON_LIB_LOC="${py_prefix}/lib${libdirsuffix}" fi if test "x$PYTHON_LIB_NAME" = x; then PYTHON_LIB_NAME=$py_lib_name fi AC_SUBST(PYTHON_LIB_LOC) AC_SUBST(PYTHON_LIB_NAME) dnl check if the headers exist: save_LIBS="$LIBS" LIBS="$LIBS $PYTHON_LIBS" AC_TRY_LINK_FUNC(Py_Initialize, dnl [LIBS="$save_LIBS"; AC_MSG_RESULT(yes); $1], dnl [LIBS="$save_LIBS"; AC_MSG_RESULT(no); $2]) ]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # JD_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # --------------------------------------------------------------------------- # Adds support for distributing Python modules and packages. To # install modules, copy them to $(pythondir), using the python_PYTHON # automake variable. To install a package with the same name as the # automake package, install to $(pkgpythondir), or use the # pkgpython_PYTHON automake variable. # # The variables $(pyexecdir) and $(pkgpyexecdir) are provided as # locations to install python extension modules (shared libraries). # Another macro is required to find the appropriate flags to compile # extension modules. # # If your package is configured with a different prefix to python, # users will have to add the install directory to the PYTHONPATH # environment variable, or create a .pth file (see the python # documentation for details). # # If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will # cause an error if the version of python installed on the system # doesn't meet the requirement. MINIMUM-VERSION should consist of # numbers and dots only. AC_DEFUN([JD_PATH_PYTHON], [ dnl Find a Python interpreter. Python versions prior to 2.0 are not dnl supported m4_define_default([_AM_PYTHON_INTERPRETER_LIST], [python3 python3.3 python3.2 python3.1 python2 python2.7 python]) m4_if([$1],[],[ dnl No version check is needed. # Find any Python interpreter. if test -z "$PYTHON"; then AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :) fi am_display_PYTHON=python ], [ dnl A version check is needed. if test -n "$PYTHON"; then # If the user set $PYTHON, use it and don't search something else. AC_MSG_CHECKING([whether $PYTHON version >= $1]) AM_PYTHON_CHECK_VERSION([$PYTHON], [$1], [AC_MSG_RESULT(yes)], [AC_MSG_ERROR(too old)]) am_display_PYTHON=$PYTHON else # Otherwise, try each interpreter until we find one that satisfies # VERSION. AC_CACHE_CHECK([for a Python interpreter with version >= $1], [am_cv_pathless_PYTHON],[ for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do test "$am_cv_pathless_PYTHON" = none && break AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break]) done]) # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. if test "$am_cv_pathless_PYTHON" = none; then PYTHON=: else AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON]) fi am_display_PYTHON=$am_cv_pathless_PYTHON fi ]) if test "$PYTHON" = :; then dnl Run any user-specified action, or abort. m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])]) else dnl Query Python for its version number. Getting [:3] seems to be dnl the best way to do this; it's what "site.py" does in the standard dnl library. AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version], [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`]) AC_SUBST([PYTHON_VERSION], [$am_cv_python_version]) dnl Use the values of $prefix and $exec_prefix for the corresponding dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made dnl distinct variables so they can be overridden if need be. However, dnl general consensus is that you shouldn't need this ability. AC_SUBST([PYTHON_PREFIX], ['${prefix}']) AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}']) dnl At times (like when building shared libraries) you may want dnl to know which OS platform Python thinks this is. AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform], [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`]) AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform]) dnl Set up 4 directories: dnl pythondir -- where to install python scripts. This is the dnl site-packages directory, not the python standard library dnl directory like in previous automake betas. This behavior dnl is more consistent with lispdir.m4 for example. dnl Query distutils for this directory. distutils does not exist in dnl Python 1.5, so we fall back to the hardcoded directory if it dnl doesn't work. AC_CACHE_CHECK([for $am_display_PYTHON script directory], [am_cv_python_pythondir], [am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX'))" 2>/dev/null || echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`]) AC_SUBST([pythondir], [$am_cv_python_pythondir]) dnl pkgpythondir -- $PACKAGE directory under pythondir. Was dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is dnl more consistent with the rest of automake. AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE]) dnl pyexecdir -- directory for installing python extension modules dnl (shared libraries) dnl Query distutils for this directory. distutils does not exist in dnl Python 1.5, so we fall back to the hardcoded directory if it dnl doesn't work. AC_CACHE_CHECK([for $am_display_PYTHON extension module directory], [am_cv_python_pyexecdir], [am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX'))" 2>/dev/null || echo "${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"`]) AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir]) dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE) AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE]) dnl Run any user-specified action. $2 fi ]) thunarx-python-thunarx-python-0.5.2/module.xml000066400000000000000000000012661400525251300215450ustar00rootroot00000000000000 thunarx-python Thunarx Python Bindings Adam Plumb mailto:adamplumb@gmail.com adamplumb thunarx-python-thunarx-python-0.5.2/src/000077500000000000000000000000001400525251300203205ustar00rootroot00000000000000thunarx-python-thunarx-python-0.5.2/src/Makefile.am000066400000000000000000000020501400525251300223510ustar00rootroot00000000000000AM_CPPFLAGS = \ -I$(top_builddir) \ -I$(top_srcdir) \ -DDATADIR=\"$(datadir)\" \ -DG_LOG_DOMAIN=\"thunarx-python\" \ -DEXO_API_SUBJECT_TO_CHANGE \ -DLIBEXECDIR=\"$(libexecdir)\" \ -DPY_LIB_LOC=\"$(PYTHON_LIB_LOC)\" \ -DPYTHON_LIB_NAME=\"$(PYTHON_LIB_NAME)\" \ -DTHUNARX_API_VERSION=$(THUNARX_API_VERSION) \ -DGI_TYPELIB_PATH=\"$(libdir)/girepository-1.0\" extensionsdir = $(libdir)/thunarx-$(THUNARX_API_VERSION) extensions_LTLIBRARIES = \ thunarx-python.la thunarx_python_la_SOURCES = \ thunarx-python.c \ thunarx-python.h \ thunarx-python-object.c \ thunarx-python-object.h thunarx_python_la_CFLAGS = \ $(THUNARX_CFLAGS) \ $(PYTHON_CFLAGS) \ $(PYTHON_INCLUDES) \ $(PYGOBJECT_CFLAGS) thunarx_python_la_LDFLAGS = \ -avoid-version \ -module \ $(THUNARX_LDFLAGS) \ $(PYTHON_LDFLAGS) \ $(PYGOBJECT_CFLAGS) thunarx_python_la_LIBADD = \ $(THUNARX_LIBS) \ $(PYTHON_LIBS) \ $(PYGOBJECT_LIBS) thunarx-python-thunarx-python-0.5.2/src/thunarx-python-object.c000066400000000000000000000436541400525251300247540ustar00rootroot00000000000000/*- * Copyright (c) 2009 Adam Plumb * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include "thunarx-python-object.h" #include "thunarx-python.h" #include #define NO_IMPORT_PYGOBJECT #include #include #define METHOD_PREFIX "" static GObjectClass *parent_class; static void thunarx_python_object_instance_init (ThunarxPythonObject *object); static void thunarx_python_object_finalize (GObject *object); static void thunarx_python_object_class_init (ThunarxPythonObjectClass *klass, gpointer class_data); static void thunarx_python_object_menu_provider_iface_init (ThunarxMenuProviderIface *iface); static GList *thunarx_python_object_get_file_menu_items (ThunarxMenuProvider *provider, GtkWidget *window, GList *files); static GList *thunarx_python_object_get_folder_menu_items (ThunarxMenuProvider *provider, GtkWidget *window, ThunarxFileInfo *folder); static GList *thunarx_python_object_get_dnd_menu_items (ThunarxMenuProvider *provider, GtkWidget *window, ThunarxFileInfo *folder, GList *files); static void thunarx_python_object_property_page_provider_iface_init (ThunarxPropertyPageProviderIface *iface); static GList *thunarx_python_object_get_property_pages (ThunarxPropertyPageProvider *provider, GList *files); static void thunarx_python_object_preferences_provider_iface_init (ThunarxPreferencesProviderIface *iface); static GList *thunarx_python_object_get_preferences_menu_items (ThunarxPreferencesProvider *provider, GtkWidget *window); static void thunarx_python_object_renamer_provider_iface_init (ThunarxRenamerProviderIface *iface); static GList *thunarx_python_object_get_renamers (ThunarxRenamerProvider *provider); static int __PyString_Check(PyObject *obj) { #if PY_MAJOR_VERSION >= 3 return PyUnicode_Check(obj); #else return PyString_Check(obj); #endif } static char *__PyString_AsString(PyObject *obj) { #if PY_MAJOR_VERSION >= 3 return PyUnicode_AsUTF8(obj); #else return PyString_AsString(obj); #endif } /* These macros assumes the following things: * a METHOD_NAME is defined with is a string * a goto label called beach * the return value is called ret */ #define CHECK_METHOD_NAME(self) \ if (!PyObject_HasAttrString(self, METHOD_NAME)) \ goto beach; #define CHECK_OBJECT(object) \ if (object->instance == NULL) \ { \ g_object_unref (object); \ goto beach; \ } \ #define CONVERT_LIST(py_files, files) \ { \ GList *l; \ py_files = PyList_New(0); \ for (l = files; l; l = l->next) \ { \ PyList_Append(py_files, pygobject_new((GObject*)l->data)); \ } \ } #define HANDLE_RETVAL(py_ret) \ if (!py_ret) \ { \ PyErr_Print(); \ goto beach; \ } \ else if (py_ret == Py_None) \ { \ goto beach; \ } #define HANDLE_LIST(py_ret, type, type_name) \ { \ Py_ssize_t i = 0; \ if (!PySequence_Check(py_ret) || __PyString_Check(py_ret)) \ { \ PyErr_SetString(PyExc_TypeError, \ METHOD_NAME " must return a sequence"); \ goto beach; \ } \ for (i = 0; i < PySequence_Size (py_ret); i++) \ { \ PyGObject *py_item; \ py_item = (PyGObject*)PySequence_GetItem (py_ret, i); \ if (!pygobject_check(py_item, &Py##type##_Type)) \ { \ PyErr_SetString(PyExc_TypeError, \ METHOD_NAME \ " must return a sequence of " \ type_name); \ goto beach; \ } \ ret = g_list_append (ret, (type*) g_object_ref(py_item->obj)); \ Py_DECREF(py_item); \ } \ } #define METHOD_NAME "get_file_menu_items" static GList * thunarx_python_object_get_file_menu_items (ThunarxMenuProvider *provider, GtkWidget *window, GList *files) { ThunarxPythonObject *object = (ThunarxPythonObject*)provider; GList *ret = NULL; PyObject *py_ret = NULL, *py_files; PyGILState_STATE state = pyg_gil_state_ensure(); debug_enter(); CHECK_OBJECT(object); CHECK_METHOD_NAME(object->instance); CONVERT_LIST(py_files, files); py_ret = PyObject_CallMethod(object->instance, METHOD_PREFIX METHOD_NAME, "(NN)", pygobject_new((GObject *)window), py_files); HANDLE_RETVAL(py_ret); HANDLE_LIST(py_ret, ThunarxMenuItem, "Thunarx.MenuItem"); beach: if (PyErr_Occurred()) { PyErr_Print(); } Py_XDECREF(py_ret); pyg_gil_state_release(state); return ret; } #undef METHOD_NAME #define METHOD_NAME "get_folder_menu_items" static GList * thunarx_python_object_get_folder_menu_items (ThunarxMenuProvider *provider, GtkWidget *window, ThunarxFileInfo *folder) { ThunarxPythonObject *object = (ThunarxPythonObject*)provider; GList *ret = NULL; PyObject *py_ret = NULL; PyGILState_STATE state = pyg_gil_state_ensure(); debug_enter(); CHECK_OBJECT(object); CHECK_METHOD_NAME(object->instance); py_ret = PyObject_CallMethod(object->instance, METHOD_PREFIX METHOD_NAME, "(NN)", pygobject_new((GObject *)window), pygobject_new((GObject *)folder)); HANDLE_RETVAL(py_ret); HANDLE_LIST(py_ret, ThunarxMenuItem, "Thunarx.MenuItem"); beach: if (PyErr_Occurred()) { PyErr_Print(); } Py_XDECREF(py_ret); pyg_gil_state_release(state); return ret; } #undef METHOD_NAME #define METHOD_NAME "get_dnd_menu_items" static GList * thunarx_python_object_get_dnd_menu_items (ThunarxMenuProvider *provider, GtkWidget *window, ThunarxFileInfo *folder, GList *files) { ThunarxPythonObject *object = (ThunarxPythonObject*)provider; GList *ret = NULL; PyObject *py_ret = NULL, *py_files; PyGILState_STATE state = pyg_gil_state_ensure(); debug_enter(); CHECK_OBJECT(object); CHECK_METHOD_NAME(object->instance); CONVERT_LIST(py_files, files); py_ret = PyObject_CallMethod(object->instance, METHOD_PREFIX METHOD_NAME, "(NN)", pygobject_new((GObject *)window), pygobject_new((GObject *)folder), py_files); HANDLE_RETVAL(py_ret); HANDLE_LIST(py_ret, ThunarxMenuItem, "Thunarx.MenuItem"); beach: if (PyErr_Occurred()) { PyErr_Print(); } Py_XDECREF(py_ret); pyg_gil_state_release(state); return ret; } #undef METHOD_NAME static void thunarx_python_object_menu_provider_iface_init (ThunarxMenuProviderIface *iface) { iface->get_file_menu_items = thunarx_python_object_get_file_menu_items; iface->get_folder_menu_items = thunarx_python_object_get_folder_menu_items; iface->get_dnd_menu_items = thunarx_python_object_get_dnd_menu_items; } #define METHOD_NAME "get_property_pages" static GList * thunarx_python_object_get_property_pages (ThunarxPropertyPageProvider *provider, GList *files) { ThunarxPythonObject *object = (ThunarxPythonObject*)provider; PyObject *py_files, *py_ret = NULL; GList *ret = NULL; PyGILState_STATE state = pyg_gil_state_ensure(); debug_enter(); CHECK_OBJECT(object); CHECK_METHOD_NAME(object->instance); CONVERT_LIST(py_files, files); py_ret = PyObject_CallMethod(object->instance, METHOD_PREFIX METHOD_NAME, "(N)", py_files); HANDLE_RETVAL(py_ret); HANDLE_LIST(py_ret, ThunarxPropertyPage, "Thunarx.PropertyPage"); beach: if (PyErr_Occurred()) { PyErr_Print(); } Py_XDECREF(py_ret); pyg_gil_state_release(state); return ret; } #undef METHOD_NAME #define METHOD_NAME "get_renamers" static GList * thunarx_python_object_get_renamers (ThunarxRenamerProvider *provider) { ThunarxPythonObject *object = (ThunarxPythonObject*)provider; PyObject *py_ret = NULL; GList *ret = NULL; PyGILState_STATE state = pyg_gil_state_ensure(); debug_enter(); CHECK_OBJECT(object); CHECK_METHOD_NAME(object->instance); py_ret = PyObject_CallMethod(object->instance, METHOD_PREFIX METHOD_NAME, ""); HANDLE_RETVAL(py_ret); HANDLE_LIST(py_ret, ThunarxRenamer, "Thunarx.Renamer"); beach: if (PyErr_Occurred()) { PyErr_Print(); } Py_XDECREF(py_ret); pyg_gil_state_release(state); return ret; } #undef METHOD_NAME static void thunarx_python_object_property_page_provider_iface_init (ThunarxPropertyPageProviderIface *iface) { iface->get_pages = thunarx_python_object_get_property_pages; } static void thunarx_python_object_renamer_provider_iface_init (ThunarxRenamerProviderIface *iface) { iface->get_renamers = thunarx_python_object_get_renamers; } #define METHOD_NAME "get_preferences_menu_items" static GList * thunarx_python_object_get_preferences_menu_items (ThunarxPreferencesProvider *provider, GtkWidget *window) { ThunarxPythonObject *object = (ThunarxPythonObject*)provider; PyObject *py_ret = NULL; GList *ret = NULL; PyGILState_STATE state = pyg_gil_state_ensure(); debug_enter(); CHECK_OBJECT(object); CHECK_METHOD_NAME(object->instance); py_ret = PyObject_CallMethod(object->instance, METHOD_PREFIX METHOD_NAME, "(N)", pygobject_new((GObject *)window)); HANDLE_RETVAL(py_ret); HANDLE_LIST(py_ret, ThunarxMenuItem, "Thunarx.MenuItem"); beach: if (PyErr_Occurred()) { PyErr_Print(); } Py_XDECREF(py_ret); pyg_gil_state_release(state); return ret; } #undef METHOD_NAME static void thunarx_python_object_preferences_provider_iface_init (ThunarxPreferencesProviderIface *iface) { iface->get_menu_items = thunarx_python_object_get_preferences_menu_items; } static void thunarx_python_object_instance_init (ThunarxPythonObject *object) { ThunarxPythonObjectClass *class; debug_enter(); class = (ThunarxPythonObjectClass*)(((GTypeInstance*)object)->g_class); object->instance = PyObject_CallObject(class->type, NULL); if (object->instance == NULL) PyErr_Print(); } static void thunarx_python_object_finalize (GObject *object) { debug_enter(); if (((ThunarxPythonObject *)object)->instance != NULL) Py_DECREF(((ThunarxPythonObject *)object)->instance); } static void thunarx_python_object_class_init (ThunarxPythonObjectClass *klass, gpointer class_data) { debug_enter(); parent_class = g_type_class_peek_parent (klass); klass->type = (PyObject*)class_data; G_OBJECT_CLASS (klass)->finalize = thunarx_python_object_finalize; } GType thunarx_python_object_get_type (ThunarxProviderPlugin *plugin, PyObject *type) { GTypeInfo *info; const char *type_name; GType gtype; static const GInterfaceInfo property_page_provider_iface_info = { (GInterfaceInitFunc) thunarx_python_object_property_page_provider_iface_init, NULL, NULL }; static const GInterfaceInfo menu_provider_iface_info = { (GInterfaceInitFunc) thunarx_python_object_menu_provider_iface_init, NULL, NULL }; static const GInterfaceInfo renamer_provider_iface_info = { (GInterfaceInitFunc) thunarx_python_object_renamer_provider_iface_init, NULL, NULL }; static const GInterfaceInfo preferences_provider_iface_info = { (GInterfaceInitFunc) thunarx_python_object_preferences_provider_iface_init, NULL, NULL }; debug_enter_args("type=%s", __PyString_AsString(PyObject_GetAttrString(type, "__name__"))); info = g_new0 (GTypeInfo, 1); info->class_size = sizeof (ThunarxPythonObjectClass); info->class_init = (GClassInitFunc)thunarx_python_object_class_init; info->instance_size = sizeof (ThunarxPythonObject); info->instance_init = (GInstanceInitFunc)thunarx_python_object_instance_init; info->class_data = type; Py_INCREF(type); type_name = g_strdup_printf("%s+ThunarxPython", __PyString_AsString(PyObject_GetAttrString(type, "__name__"))); gtype = thunarx_provider_plugin_register_type (plugin, G_TYPE_OBJECT, type_name, info, 0); if (PyObject_IsSubclass(type, (PyObject*)&PyThunarxPropertyPageProvider_Type)) { thunarx_provider_plugin_add_interface (plugin, gtype, THUNARX_TYPE_PROPERTY_PAGE_PROVIDER, &property_page_provider_iface_info); } if (PyObject_IsSubclass(type, (PyObject*)&PyThunarxMenuProvider_Type)) { thunarx_provider_plugin_add_interface (plugin, gtype, THUNARX_TYPE_MENU_PROVIDER, &menu_provider_iface_info); } if (PyObject_IsSubclass(type, (PyObject*)&PyThunarxRenamerProvider_Type)) { thunarx_provider_plugin_add_interface (plugin, gtype, THUNARX_TYPE_RENAMER_PROVIDER, &renamer_provider_iface_info); } if (PyObject_IsSubclass(type, (PyObject*)&PyThunarxPreferencesProvider_Type)) { thunarx_provider_plugin_add_interface (plugin, gtype, THUNARX_TYPE_PREFERENCES_PROVIDER, &preferences_provider_iface_info); } return gtype; } thunarx-python-thunarx-python-0.5.2/src/thunarx-python-object.h000066400000000000000000000025401400525251300247460ustar00rootroot00000000000000/*- * Copyright (c) 2009 Adam Plumb * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef THUNARX_PYTHON_OBJECT_H #define THUNARX_PYTHON_OBJECT_H #include #include #include G_BEGIN_DECLS typedef struct _ThunarxPythonObject ThunarxPythonObject; typedef struct _ThunarxPythonObjectClass ThunarxPythonObjectClass; struct _ThunarxPythonObject { GObject parent_slot; PyObject *instance; }; struct _ThunarxPythonObjectClass { GObjectClass parent_slot; PyObject *type; }; GType thunarx_python_object_get_type (ThunarxProviderPlugin *plugin, PyObject *type); G_END_DECLS #endif thunarx-python-thunarx-python-0.5.2/src/thunarx-python.c000066400000000000000000000236161400525251300235040ustar00rootroot00000000000000/*- * Copyright (c) 2009 Adam Plumb * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include "thunarx-python.h" #include "thunarx-python-object.h" PyTypeObject *_PyGtkWidget_Type; PyTypeObject *_PyThunarxFileInfo_Type; PyTypeObject *_PyThunarxMenuItem_Type; PyTypeObject *_PyThunarxMenu_Type; PyTypeObject *_PyThunarxMenuProvider_Type; PyTypeObject *_PyThunarxPreferencesProvider_Type; PyTypeObject *_PyThunarxPropertyPage_Type; PyTypeObject *_PyThunarxPropertyPageProvider_Type; PyTypeObject *_PyThunarxProviderPlugin_Type; PyTypeObject *_PyThunarxRenamer_Type; PyTypeObject *_PyThunarxRenamerProvider_Type; static const GDebugKey thunarx_python_debug_keys[] = { {"all", THUNARX_PYTHON_DEBUG_ALL}, }; static const guint thunarx_python_ndebug_keys = sizeof (thunarx_python_debug_keys) / sizeof (GDebugKey); ThunarxPythonDebug thunarx_python_debug; static GArray *all_types = NULL; G_MODULE_EXPORT void thunar_extension_initialize (ThunarxProviderPlugin *plugin); G_MODULE_EXPORT void thunar_extension_shutdown (void); G_MODULE_EXPORT void thunar_extension_list_types (const GType **types, gint *n_types); static gboolean thunarx_python_init_pygobject (void); static gboolean thunarx_python_init_python (void); static inline gboolean thunarx_python_init_pygobject(void) { PyObject *gobject = pygobject_init (3, 0, 0); if (gobject == NULL) { PyErr_Print (); return FALSE; } return TRUE; } static gboolean thunarx_python_init_python (void) { PyObject *thunarx; GModule *libpython; debug_enter(); if (Py_IsInitialized()) return TRUE; debug("Setting GI_TYPELIB_PATH to " GI_TYPELIB_PATH); gchar *typelib_env = g_strdup_printf("GI_TYPELIB_PATH=$GI_TYPELIB_PATH:%s", GI_TYPELIB_PATH); putenv(typelib_env); debug ("g_module_open " PY_LIB_LOC "/lib" PYTHON_LIB_NAME "." G_MODULE_SUFFIX ".1.0"); libpython = g_module_open (PY_LIB_LOC "/lib" PYTHON_LIB_NAME "." G_MODULE_SUFFIX ".1.0", 0); if (!libpython) { g_warning ("g_module_open libpython failed: %s", g_module_error()); } debug ("Py_Initialize"); Py_Initialize(); if (PyErr_Occurred()) { PyErr_Print(); return FALSE; } debug ("PySys_SetArgv"); #if PY_MAJOR_VERSION >= 3 wchar_t *argv[] = { L"thunar", NULL }; #else char *argv[] = { "thunar", NULL }; #endif PySys_SetArgv (1, argv); if (PyErr_Occurred()) { PyErr_Print(); return FALSE; } debug("Sanitize the python search path"); PyRun_SimpleString("import sys; sys.path = [path for path in sys.path if path]"); if (PyErr_Occurred()) { PyErr_Print(); return FALSE; } /* import gobject */ debug("init_pygobject"); if (!thunarx_python_init_pygobject()) { g_warning("pygobject initialization failed"); return FALSE; } g_setenv("INSIDE_THUNARX_PYTHON", "", FALSE); debug("import Thunarx"); PyRun_SimpleString("import gi; gi.require_version('Thunarx', '3.0')"); thunarx = PyImport_ImportModule("gi.repository.Thunarx"); if (!thunarx) { PyErr_Print(); return FALSE; } _PyGtkWidget_Type = pygobject_lookup_class(GTK_TYPE_WIDGET); g_assert(_PyGtkWidget_Type != NULL); #define IMPORT(x, y) \ _PyThunarx##x##_Type = (PyTypeObject *)PyObject_GetAttrString(thunarx, y); \ if (_PyThunarx##x##_Type == NULL) { \ PyErr_Print(); \ return FALSE; \ } IMPORT(FileInfo, "FileInfo"); IMPORT(MenuItem, "MenuItem"); IMPORT(Menu, "Menu"); IMPORT(MenuProvider, "MenuProvider"); IMPORT(PreferencesProvider, "PreferencesProvider"); IMPORT(PropertyPage, "PropertyPage"); IMPORT(PropertyPageProvider, "PropertyPageProvider"); IMPORT(ProviderPlugin, "ProviderPlugin"); IMPORT(Renamer, "Renamer"); IMPORT(RenamerProvider, "RenamerProvider"); #undef IMPORT return TRUE; } static void thunarx_python_load_file (ThunarxProviderPlugin *plugin, const gchar *filename) { PyObject *main_module, *main_locals, *locals, *key, *value; PyObject *module; Py_ssize_t pos = 0; GType new_type; main_module = PyImport_AddModule("__main__"); if (main_module == NULL) { g_warning ("Could not get __main__"); return; } main_locals = PyModule_GetDict(main_module); module = PyImport_ImportModuleEx((char *) filename, main_locals, main_locals, NULL); if (!module) { PyErr_Print(); return; } locals = PyModule_GetDict(module); while (PyDict_Next(locals, &pos, &key, &value)) { if (!PyType_Check(value)) continue; if (PyObject_IsSubclass(value, (PyObject*)&PyThunarxMenuProvider_Type) || PyObject_IsSubclass(value, (PyObject*)&PyThunarxPropertyPageProvider_Type) || PyObject_IsSubclass(value, (PyObject*)&PyThunarxPreferencesProvider_Type) || PyObject_IsSubclass(value, (PyObject*)&PyThunarxRenamerProvider_Type)) { new_type = thunarx_python_object_get_type(plugin, value); g_array_append_val(all_types, new_type); } } } static void thunarx_python_load_dir (ThunarxProviderPlugin *plugin, const char *dirname) { GDir *dir; const char *name; gboolean initialized = FALSE; debug_enter_args("dirname=%s", dirname); dir = g_dir_open (dirname, 0, NULL); if (!dir) return; while ((name = g_dir_read_name(dir))) { if (g_str_has_suffix(name, ".py")) { char *modulename; int len; len = strlen(name) - 3; modulename = g_new0(char, len + 1); strncpy(modulename, name, len); if (!initialized) { PyObject *sys_path, *py_path; /* n-p python part is initialized on demand (or not * at all if no extensions are found) */ if (!thunarx_python_init_python()) { g_warning("thunarx_python_init_python failed"); g_dir_close(dir); } /* sys.path.insert(0, dirname) */ sys_path = PySys_GetObject("path"); #if PY_MAJOR_VERSION >= 3 py_path = PyUnicode_FromString(dirname); #else py_path = PyString_FromString(dirname); #endif PyList_Insert(sys_path, 0, py_path); Py_DECREF(py_path); } thunarx_python_load_file(plugin, modulename); } } } static gint compare_dir(gconstpointer a, gconstpointer b) { return strcmp(a, b); } static GList * add_unique_dir(GList *dirs, char *dir) { if (!g_list_find_custom(dirs, dir, compare_dir)) dirs = g_list_append(dirs, dir); return dirs; } static void thunarx_python_check_all_directories(ThunarxProviderPlugin *plugin) { GList *dirs = NULL; // Check ~/.local/share first dirs = add_unique_dir(dirs, g_build_filename(g_get_user_data_dir(), "thunarx-python", "extensions", NULL)); // If thunar is built in a non-standard prefix // Check that' prefix's DATADIR gchar *prefix_extension_dir = DATADIR "/thunarx-python/extensions"; dirs = add_unique_dir(dirs, prefix_extension_dir); // Check all system data dirs const gchar *const *temp = g_get_system_data_dirs(); while (*temp != NULL) { gchar *dir = g_build_filename(*temp, "thunarx-python", "extensions", NULL); if (dir != prefix_extension_dir) { dirs = add_unique_dir(dirs, dir); } temp++; } dirs = g_list_first(dirs); while (dirs != NULL) { gchar *dir = dirs->data; thunarx_python_load_dir(plugin, dir); dirs = dirs->next; } g_list_free(dirs); } G_MODULE_EXPORT void thunar_extension_initialize (ThunarxProviderPlugin *plugin) { const gchar *mismatch; const gchar *env_string; env_string = g_getenv("THUNARX_PYTHON_DEBUG"); if (env_string != NULL) { thunarx_python_debug = g_parse_debug_string(env_string, thunarx_python_debug_keys, thunarx_python_ndebug_keys); env_string = NULL; } debug_enter(); /* verify that the thunarx versions are compatible */ mismatch = thunarx_check_version (THUNARX_MAJOR_VERSION, THUNARX_MINOR_VERSION, THUNARX_MICRO_VERSION); if (G_UNLIKELY (mismatch != NULL)) { g_warning ("Version mismatch: %s", mismatch); return; } all_types = g_array_new(FALSE, FALSE, sizeof(GType)); thunarx_provider_plugin_set_resident (plugin, TRUE); thunarx_python_check_all_directories(plugin); } G_MODULE_EXPORT void thunar_extension_shutdown (void) { debug_enter(); if (Py_IsInitialized()) Py_Finalize(); g_array_free (all_types, TRUE); } G_MODULE_EXPORT void thunar_extension_list_types (const GType **types, gint *n_types) { debug_enter(); *types = (GType*)all_types->data; *n_types = all_types->len; } thunarx-python-thunarx-python-0.5.2/src/thunarx-python.h000066400000000000000000000056231400525251300235070ustar00rootroot00000000000000/*- * Copyright (c) 2009 Adam Plumb * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef THUNARX_PYTHON_H #define THUNARX_PYTHON_H #include #include #include #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #endif typedef enum { THUNARX_PYTHON_DEBUG_ALL = 1 << 0, } ThunarxPythonDebug; extern ThunarxPythonDebug thunarx_python_debug; #define debug(x) { if (thunarx_python_debug & THUNARX_PYTHON_DEBUG_ALL) \ g_print("thunarx-python: " x "\n"); } #define debug_enter() { if (thunarx_python_debug & THUNARX_PYTHON_DEBUG_ALL) \ g_printf("%s: entered\n", __FUNCTION__); } #define debug_enter_args(x, y) { if (thunarx_python_debug & THUNARX_PYTHON_DEBUG_ALL) \ g_printf("%s: entered " x "\n", __FUNCTION__, y); } extern PyTypeObject *_PyGtkWidget_Type; #define PyGtkWidget_Type (*_PyGtkWidget_Type) extern PyTypeObject *_PyThunarxFileInfo_Type; #define PyThunarxFileInfo_Type (*_PyThunarxFileInfo_Type) extern PyTypeObject *_PyThunarxMenuItem_Type; #define PyThunarxMenuItem_Type (*_PyThunarxMenuItem_Type) extern PyTypeObject *_PyThunarxMenu_Type; #define PyThunarxMenu_Type (*_PyThunarxMenu_Type) extern PyTypeObject *_PyThunarxMenuProvider_Type; #define PyThunarxMenuProvider_Type (*_PyThunarxMenuProvider_Type) extern PyTypeObject *_PyThunarxPreferencesProvider_Type; #define PyThunarxPreferencesProvider_Type (*_PyThunarxPreferencesProvider_Type) extern PyTypeObject *_PyThunarxPropertyPage_Type; #define PyThunarxPropertyPage_Type (*_PyThunarxPropertyPage_Type) extern PyTypeObject *_PyThunarxPropertyPageProvider_Type; #define PyThunarxPropertyPageProvider_Type (*_PyThunarxPropertyPageProvider_Type) extern PyTypeObject *_PyThunarxProviderPlugin_Type; #define PyThunarxProviderPlugin_Type (*_PyThunarxProviderPlugin_Type) extern PyTypeObject *_PyThunarxRenamer_Type; #define PyThunarxRenamer_Type (*_PyThunarxRenamer_Type) extern PyTypeObject *_PyThunarxRenamerProvider_Type; #define PyThunarxRenamerProvider_Type (*_PyThunarxRenamerProvider_Type) #endif /* THUNARX_PYTHON_H */