indicator-appmenu.git/0000775000000000000000000000000015154240054012147 5ustar indicator-appmenu.git/AUTHORS0000664000000000000000000000003015154240054013210 0ustar # Generate by Makefile indicator-appmenu.git/COPYING0000664000000000000000000010437415154240054013213 0ustar 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 . indicator-appmenu.git/ChangeLog0000664000000000000000000000003015154240054013712 0ustar # Generated by Makefile indicator-appmenu.git/Makefile.am0000664000000000000000000000237315154240054014210 0ustar ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} SUBDIRS = \ data \ po \ src if BUILD_TESTS SUBDIRS += \ scripts \ tests \ tools endif tests: src DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-localinstall --enable-deprecations dist-hook: @if test -d "$(top_srcdir)/.bzr"; \ then \ echo Creating ChangeLog && \ ( cd "$(top_srcdir)" && \ echo '# Generated by Makefile. Do not edit.'; echo; \ $(top_srcdir)/missing --run bzr log --gnu-changelog ) > ChangeLog.tmp \ && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \ || (rm -f ChangeLog.tmp; \ echo Failed to generate ChangeLog >&2 ); \ else \ echo Failed to generate ChangeLog: not a branch >&2; \ fi @if test -d "$(top_srcdir)/.bzr"; \ then \ echo Creating AUTHORS && \ ( cd "$(top_srcdir)" && \ echo '# Generated by Makefile. Do not edit.'; echo; \ $(top_srcdir)/missing --run bzr log --long --levels=0 | grep -e "^\s*author:" -e "^\s*committer:" | cut -d ":" -f 2 | cut -d "<" -f 1 | sort -u) > AUTHORS.tmp \ && mv -f AUTHORS.tmp $(top_distdir)/AUTHORS \ || (rm -f AUTHORS.tmp; \ echo Failed to generate AUTHORS >&2 ); \ else \ echo Failed to generate AUTHORS: not a branch >&2; \ fi include $(top_srcdir)/Makefile.am.coverage indicator-appmenu.git/Makefile.am.coverage0000664000000000000000000000250515154240054015777 0ustar # Coverage targets .PHONY: clean-gcno clean-gcda \ coverage-html generate-coverage-html clean-coverage-html \ coverage-gcovr generate-coverage-gcovr clean-coverage-gcovr clean-local: clean-gcno clean-coverage-html clean-coverage-gcovr if HAVE_GCOV clean-gcno: @echo Removing old coverage instrumentation -find -name '*.gcno' -print | xargs -r rm clean-gcda: @echo Removing old coverage results -find -name '*.gcda' -print | xargs -r rm coverage-html: clean-gcda -$(MAKE) $(AM_MAKEFLAGS) -k check $(MAKE) $(AM_MAKEFLAGS) generate-coverage-html generate-coverage-html: @echo Collecting coverage data $(LCOV) --directory $(top_builddir) --capture --output-file coverage.info --no-checksum --compat-libtool LANG=C $(GENHTML) --prefix $(top_builddir) --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info clean-coverage-html: clean-gcda -$(LCOV) --directory $(top_builddir) -z -rm -rf coverage.info coveragereport if HAVE_GCOVR coverage-gcovr: clean-gcda -$(MAKE) $(AM_MAKEFLAGS) -k check $(MAKE) $(AM_MAKEFLAGS) generate-coverage-gcovr generate-coverage-gcovr: @echo Generating coverage GCOVR report $(GCOVR) -x -r $(top_builddir) -o $(top_builddir)/coverage.xml clean-coverage-gcovr: clean-gcda -rm -rf $(top_builddir)/coverage.xml endif # HAVE_GCOVR endif # HAVE_GCOV indicator-appmenu.git/Makefile.am.marshal0000664000000000000000000000223615154240054015634 0ustar # Rules for generating marshal files using glib-genmarshal # # Define: # glib_marshal_list = marshal list file # glib_marshal_prefix = prefix for marshal functions # # before including Makefile.am.marshal. You will also need to have # the following targets already defined: # # CLEANFILES # DISTCLEANFILES # BUILT_SOURCES # EXTRA_DIST # # Author: Emmanuele Bassi marshal_h = $(glib_marshal_list:.list=.h) marshal_c = $(glib_marshal_list:.list=.c) CLEANFILES += stamp-marshal DISTCLEANFILES += $(marshal_h) $(marshal_c) BUILT_SOURCES += $(marshal_h) $(marshal_c) EXTRA_DIST += $(glib_marshal_list) stamp-marshal: $(glib_marshal_list) $(QUIET_GEN)$(GLIB_GENMARSHAL) \ --prefix=$(glib_marshal_prefix) \ --header \ $(srcdir)/$(glib_marshal_list) > xgen-mh \ && (cmp -s xgen-mh $(marshal_h) || cp -f xgen-mh $(marshal_h)) \ && rm -f xgen-mh \ && echo timestamp > $(@F) $(marshal_h): stamp-marshal @true $(marshal_c): $(marshal_h) $(QUIET_GEN)(echo "#include \"$(marshal_h)\"" ; \ $(GLIB_GENMARSHAL) \ --prefix=$(glib_marshal_prefix) \ --body \ $(srcdir)/$(glib_marshal_list)) > xgen-mc \ && cp xgen-mc $(marshal_c) \ && rm -f xgen-mc indicator-appmenu.git/NEWS0000664000000000000000000000113215154240054012643 0ustar 12.10.3 - add the hud awareness protocol, an efficient way to notify applications that the HUD will open - fix hud match highlighting (lp #961000) 12.10.2 - support indicators based on gmenumodel (lp #1042824) - fix crash (lp #913324) 12.10.1 - add webapp support - port appmenu indicator to gtk_widget_insert_action_group() 12.10.0 - merge lp:~desrt/indicator-appmenu/no-zero-indicator-penalty to improve HUD's scoring algorithm - merge lp:~allanlesage/indicator-appmenu/TDD-fixes for gcov fixes, including docs fixes which broke linking. - raise GTK minimum to 3.0 indicator-appmenu.git/README0000664000000000000000000000000015154240054013015 0ustar indicator-appmenu.git/autogen.sh0000775000000000000000000000032315154240054014146 0ustar #!/bin/sh PKG_NAME="indicator-appmenu" which gnome-autogen.sh || { echo "You need gnome-common from GNOME SVN" exit 1 } USE_GNOME2_MACROS=1 \ USE_COMMON_DOC_BUILD=yes \ gnome-autogen.sh --enable-gtk-doc $@ indicator-appmenu.git/configure.ac0000664000000000000000000001431415154240054014440 0ustar AC_INIT([indicator-appmenu], [15.02.0], [http://bugs.launchpad.net/indicator-appmenu], [indicator-appmenu], [http://launchpad.net/indicator-appmenu]) AC_COPYRIGHT([Copyright 2010 Canonical]) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) AC_CONFIG_SRCDIR([configure.ac]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([1.11 -Wall foreign subdir-objects]) AM_MAINTAINER_MODE([enable]) AM_SILENT_RULES([yes]) # Check for programs AC_PROG_CC AM_PROG_CC_C_O AM_PROG_VALAC([]) # Initialize libtool LT_PREREQ([2.2.6]) LT_INIT AC_PATH_PROG([GLIB_MKENUMS], [glib-mkenums]) AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal]) PKG_PROG_PKG_CONFIG AC_ARG_ENABLE([deprecations], [AS_HELP_STRING([--enable-deprecations], [allow deprecated API usage @<:@default=yes@:>@])], [], [enable_deprecations=yes]) AS_IF([test "x$enable_deprecations" = xno], [CFLAGS="$CFLAGS -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGSEAL_ENABLE -DGTK_DISABLE_SINGLE_INCLUDES"] ) ########################### # GTK Doc ########################### GTK_DOC_CHECK([1.9], [--flavour=no-tmpl]) ########################### # GLib GSettings ########################### GLIB_GSETTINGS ########################### # Dependencies ########################### GLIB_REQUIRED_VERSION=2.35.4 GIO_REQUIRED_VERSION=2.26 GTK_REQUIRED_VERSION=3.0 INDICATOR_REQUIRED_VERSION=0.3.90 DBUSMENUGTK_REQUIRED_VERSION=0.5.90 BAMF_REQUIRED_VERSION=0.5.2 PKG_CHECK_MODULES(gtk, gtk+-3.0 >= $GTK_REQUIRED_VERSION) PKG_CHECK_MODULES(INDICATOR, glib-2.0 >= $GLIB_REQUIRED_VERSION gio-2.0 >= $GIO_REQUIRED_VERSION gtk+-3.0 >= $GTK_REQUIRED_VERSION indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION libbamf3 >= $BAMF_REQUIRED_VERSION) AC_SUBST(INDICATOR_CFLAGS) AC_SUBST(INDICATOR_LIBS) ########################### # CLI Dependencies ########################### AC_CHECK_HEADER("readline/readline.h", [has_readline_h="yes"]) AC_CHECK_HEADER("readline/history.h", [has_history_h="yes"]) AC_CHECK_HEADER("curses.h", [has_curses_h="yes"]) AM_CONDITIONAL([BUILD_CLI], [test "x$has_readline_h" == "xyes" && test "x$has_history_h" == "xyes" && test "x$has_curses_h" == "xyes"]), ########################### # Test Dependencies ########################### DBUSMENU_JSONLOADER_REQUIRED_VERSION=0.3.3 LIBAPPINDICATOR_REQUIRED_VERSION=0.0.0 AC_ARG_ENABLE([tests], AC_HELP_STRING([--disable-tests], [Disable test scripts and tools]),, [enable_tests=auto]) if test x"$enable_tests" != x"no" ; then PKG_CHECK_MODULES(INDICATORTEST, dbusmenu-jsonloader-0.4 >= $DBUSMENU_JSONLOADER_REQUIRED_VERSION appindicator3-0.1 >= $LIBAPPINDICATOR_REQUIRED_VERSION, [have_dbusmenu_jsonloader=yes], [have_dbusmenu_jsonloader=no] ) if test x${enable_tests} = xyes && test x${have_dbusmenu_jsonloader} = xno; then AC_MSG_ERROR([Test scripts and tools configured but dbusmenu-jsonloader not found]) fi else have_dbusmenu-jsonloader=no fi AM_CONDITIONAL(BUILD_TESTS, test x${have_dbusmenu_jsonloader} = xyes) AC_SUBST(INDICATORTEST_CFLAGS) AC_SUBST(INDICATORTEST_LIBS) ########################### # gcov coverage reporting ########################### m4_include([m4/gcov.m4]) AC_TDD_GCOV AM_CONDITIONAL([HAVE_GCOV], [test "x$ac_cv_check_gcov" = xyes]) AM_CONDITIONAL([HAVE_LCOV], [test "x$ac_cv_check_lcov" = xyes]) AM_CONDITIONAL([HAVE_GCOVR], [test "x$ac_cv_check_gcovr" = xyes]) AC_SUBST(COVERAGE_CFLAGS) AC_SUBST(COVERAGE_CXXFLAGS) AC_SUBST(COVERAGE_LDFLAGS) ########################### # XSLT Processor ########################### AC_PATH_PROG([XSLT_PROC], [xsltproc]) ########################### # Check to see if we're local ########################### with_localinstall="no" AC_ARG_ENABLE(localinstall, AS_HELP_STRING([--enable-localinstall], [install all of the files localy instead of system directories (for distcheck)]), with_localinstall=$enableval, with_localinstall=no) ########################### # Indicator Info ########################### if test "x$with_localinstall" = "xyes"; then INDICATORDIR="${libdir}/indicators/3/" INDICATORICONSDIR="${datadir}/libindicate/icons/" elif test "x$with_gtk" = x2; then INDICATORDIR=`$PKG_CONFIG --variable=indicatordir indicator-0.4` INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir indicator-0.4` else INDICATORDIR=`$PKG_CONFIG --variable=indicatordir indicator3-0.4` INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir indicator3-0.4` fi AC_SUBST(INDICATORDIR) AC_SUBST(INDICATORICONSDIR) ########################### # DBus Service Info ########################### if test "x$with_localinstall" = "xyes"; then DBUSSERVICEDIR="${datadir}/dbus-1/services/" else DBUSSERVICEDIR=`$PKG_CONFIG --variable=session_bus_services_dir dbus-1` fi AC_SUBST(DBUSSERVICEDIR) ############################## # Custom Junk ############################## AC_DEFUN([AC_DEFINE_PATH], [ test "x$prefix" = xNONE && prefix="$ac_default_prefix" test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' ac_define_path=`eval echo [$]$2` ac_define_path=`eval echo [$]ac_define_path` $1="$ac_define_path" AC_SUBST($1) ifelse($3, , AC_DEFINE_UNQUOTED($1, "$ac_define_path"), AC_DEFINE_UNQUOTED($1, "$ac_define_path", $3)) ]) ########################### # Internationalization ########################### GETTEXT_PACKAGE=indicator-appmenu IT_PROG_INTLTOOL([0.50.2]) AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Define to the gettext package name.]) AC_DEFINE_PATH(GNOMELOCALEDIR, "${datadir}/locale", [locale directory]) ########################### # Files ########################### AC_OUTPUT([ Makefile src/Makefile scripts/Makefile data/Makefile tools/Makefile po/Makefile.in tests/Makefile tests/manual/Makefile ]) ########################### # Results ########################### AC_MSG_NOTICE([ App Menu Indicator Configuration: Prefix: $prefix Indicator Dir: $INDICATORDIR gcov: $use_gcov Local Install: $with_localinstall Test tools: $have_dbusmenu_jsonloader ]) indicator-appmenu.git/data/0000775000000000000000000000000015154240054013060 5ustar indicator-appmenu.git/data/Makefile.am0000664000000000000000000000020015154240054015104 0ustar gsettings_SCHEMAS = \ com.canonical.indicator.appmenu.gschema.xml @GSETTINGS_RULES@ EXTRA_DIST = \ $(gsettings_SCHEMAS) indicator-appmenu.git/data/com.canonical.indicator.appmenu.gschema.xml0000664000000000000000000000105015154240054023327 0ustar 'global' Where the menu is displayed. Controls the menu display location. indicator-appmenu.git/debian/0000775000000000000000000000000015154240054013371 5ustar indicator-appmenu.git/debian/changelog0000664000000000000000000011330615154240054015247 0ustar indicator-appmenu (15.02.0+20.10.20260311-0ubuntu1) resolute; urgency=medium * replace dependency on unity-gtk3-module with counterpart appmenu-gtk3-module -- Rahammetoela Toekiman Wed, 11 Mar 2026 13:13:00 +0300 indicator-appmenu (15.02.0+20.10.20200617.2-0ubuntu5) resolute; urgency=medium * No-change mass rebuild for Ubuntu 26.04 (LP: #2132257) -- Graham Inggs Mon, 15 Dec 2025 19:55:17 +0000 indicator-appmenu (15.02.0+20.10.20200617.2-0ubuntu4) noble; urgency=medium * No-change rebuild for CVE-2024-3094 -- Steve Langasek Sun, 31 Mar 2024 08:58:26 +0000 indicator-appmenu (15.02.0+20.10.20200617.2-0ubuntu3) noble; urgency=high * No change rebuild against libbamf3-2t64. -- Julian Andres Klode Fri, 22 Mar 2024 17:34:44 +0100 indicator-appmenu (15.02.0+20.10.20200617.2-0ubuntu2) noble; urgency=medium * No-change rebuild against libglib2.0-0t64 -- Steve Langasek Fri, 08 Mar 2024 05:08:48 +0000 indicator-appmenu (15.02.0+20.10.20200617.2-0ubuntu1) groovy; urgency=medium [ Dmitry Shachnev ] * Depend on bamfdaemon, it is needed to fetch windows paths. (LP: #1883423) [ Khurshid Alam ] * Fix deprecation warnings; do not track menus for desktop windows. (LP: #1827411) -- Dmitry Shachnev Wed, 17 Jun 2020 15:11:51 +0000 indicator-appmenu (15.02.0+16.10.20160927-0ubuntu5) focal; urgency=medium * No-change rebuild with fixed binutils on arm64. -- Matthias Klose Sat, 08 Feb 2020 11:04:21 +0000 indicator-appmenu (15.02.0+16.10.20160927-0ubuntu4) focal; urgency=medium * Don't use Werror to fix the build with newer glib versions -- Sebastien Bacher Tue, 14 Jan 2020 09:32:32 +0100 indicator-appmenu (15.02.0+16.10.20160927-0ubuntu3) artful; urgency=medium * debian/control, debian/rules: - use dh_translations -- Sebastien Bacher Wed, 06 Sep 2017 15:30:19 +0200 indicator-appmenu (15.02.0+16.10.20160927-0ubuntu2) artful; urgency=medium * debian/control: use 'X-Ubuntu-Use-Langpack: yes' since the indicator is now in universe, this way the translations are still available on launchpad and exported to the langpacks -- Sebastien Bacher Tue, 29 Aug 2017 10:59:11 +0200 indicator-appmenu (15.02.0+16.10.20160927-0ubuntu1) yakkety; urgency=medium * Drop appmenu-qt5 recommendation. (LP: #1612767) -- Dmitry Shachnev Tue, 27 Sep 2016 12:50:20 +0000 indicator-appmenu (15.02.0+16.04.20151104-0ubuntu1) xenial; urgency=medium [ CI Train Bot ] * New rebuild forced. [ Marco Trevisan (Treviño) ] * IndicatorAppmenu: depend on bamf 0.5.2 and use new API -- Marco Trevisan (Treviño) Wed, 04 Nov 2015 17:08:59 +0000 indicator-appmenu (15.02.0+15.10.20151002-0ubuntu1) wily; urgency=medium * IndicatorAppmenu: only emit snow-now-changed signal for menus belonging to the window that requested (LP: #1501837) -- Marco Trevisan (Treviño) Fri, 02 Oct 2015 00:32:10 +0000 indicator-appmenu (15.02.0+15.10.20150627-0ubuntu1) wily; urgency=medium [ CI Train Bot ] * New rebuild forced. [ Marco Trevisan (Treviño) ] * IndicatorAppmenu: make sure we call window_menu_entry_activate also in AllMenus mode (LP: #1430059) -- CI Train Bot Sat, 27 Jun 2015 04:42:19 +0000 indicator-appmenu (15.02.0+15.04.20150302-0ubuntu1) vivid; urgency=medium [ Marco Trevisan (Treviño) ] * IndicatorAppmenu: ensure we emit "entry-added/removed" signals after/before creating/destroying WindowMenu (LP: #1423855) -- CI Train Bot Mon, 02 Mar 2015 22:36:54 +0000 indicator-appmenu (15.02.0+15.04.20150219.2-0ubuntu1) vivid; urgency=medium [ Marco Trevisan (Treviño) ] * Bump indicator-appmenu version to 15.02 [ CI Train Bot ] * New rebuild forced. -- CI Train Bot Thu, 19 Feb 2015 19:32:07 +0000 indicator-appmenu (13.01.0+15.04.20150120-0ubuntu1) vivid; urgency=low [ Dmitry Shachnev ] * Look for dbusmenu-dumper in correct location -- Ubuntu daily release Tue, 20 Jan 2015 22:02:20 +0000 indicator-appmenu (13.01.0+15.04.20150114-0ubuntu1) vivid; urgency=low [ Didier Roche ] * Recommending jayatana for java appmenu integration -- Ubuntu daily release Wed, 14 Jan 2015 15:02:27 +0000 indicator-appmenu (13.01.0+14.04.20140404-0ubuntu1) trusty; urgency=low [ Ted Gould ] * Fix the apport hook -- Ubuntu daily release Fri, 04 Apr 2014 14:54:48 +0000 indicator-appmenu (13.01.0+14.04.20140403-0ubuntu1) trusty; urgency=low [ Sebastien Bacher ] * Clean leftover hud files, it has its own source now. Drop depends as well (LP: #1295593) -- Ubuntu daily release Thu, 03 Apr 2014 14:03:27 +0000 indicator-appmenu (13.01.0+14.04.20140320-0ubuntu1) trusty; urgency=low [ Charles Kerr ] * Don't dereference a NULL WindowMenu pointer. (LP: #1294545) -- Ubuntu daily release Thu, 20 Mar 2014 09:03:45 +0000 indicator-appmenu (13.01.0+14.04.20140318-0ubuntu1) trusty; urgency=low [ Charles Kerr ] * Check for PROP_LABEL to be non-null before passing it a long to gtk_label_set_text_with_mnemonic(). * When pruning libtool/static libraries in debian/rules' override_dh_install, use a matching pattern that actually finds the files we want to prune. (LP: #1281659) * Minor copyediting of schema key's summary/description. (LP: #970903) -- Ubuntu daily release Tue, 18 Mar 2014 09:52:58 +0000 indicator-appmenu (13.01.0+14.04.20131125-0ubuntu1) trusty; urgency=low [ Charles Kerr ] * If we can't get the bus, exit instead of stacking g_bus_own_name() calls on top of each other, leaking GSources. (LP: #1244250) [ Sebastien Bacher ] * Build with -Wno-error=deprecated-declarations. [ Lars Uebernickel ] * Call gtk_widget_destroy() to break potential ref cycles Calling g_object_unref() is not enough for many of gtk's widgets. * window-menu-model: disconnect entry signal handlers by func instead of id entry_object_free disconnected signal handlers by id. This throws warnings when entry_object_free is called when disposing an object, because signals are already disconnected at that point. This patch uses g_signal_handlers_disconnect_by_func(), which works both when the entry is alive and being disposed. * WindowMenuModel: insert action groups on the toplevel menus Inserting them on the menu items was a workaround for the long-fixed cloaking-bug in libindicator. It's not supported in gtk 3.10 anymore, because the menu tracker in gtk doesn't allow action groups on menu items. That's for good reasons: it's more efficient and consumers of that api should not modify the created menu hierarchy. [ Ubuntu daily release ] * Automatic snapshot from revision 251 -- Ubuntu daily release Mon, 25 Nov 2013 03:55:37 +0000 indicator-appmenu (13.01.0+13.10.20130930-0ubuntu1) saucy; urgency=low [ Stephen M. Webb ] * don't add a circular self-ref in IndicatorAppmenu objects (lp: #1231218). (LP: #1231218) [ Ubuntu daily release ] * Automatic snapshot from revision 245 -- Ubuntu daily release Mon, 30 Sep 2013 06:32:57 +0000 indicator-appmenu (13.01.0+13.10.20130812-0ubuntu1) saucy; urgency=low * New rebuild forced * Automatic snapshot from revision 243 -- Ubuntu daily release Mon, 12 Aug 2013 11:28:23 +0000 indicator-appmenu (13.01.0+13.10.20130731-0ubuntu1) saucy; urgency=low [ Jeremy Bicha ] * Don't build-depend on gnome-doc-utils. [ Ubuntu daily release ] * Automatic snapshot from revision 242 -- Ubuntu daily release Wed, 31 Jul 2013 02:02:52 +0000 indicator-appmenu (13.01.0daily13.06.07-0ubuntu1) saucy; urgency=low [ Łukasz 'sil2100' Zemczak ] * Switch recommends from appmenu-gtk* to unity-gtk*-module, since we're deprecating the former. [ Ubuntu daily release ] * Automatic snapshot from revision 240 -- Ubuntu daily release Fri, 07 Jun 2013 02:02:41 +0000 indicator-appmenu (13.01.0daily13.05.23.1-0ubuntu1) saucy; urgency=low [ William Hua ] * Adds 'unity' action group. This is needed because applications in general may already be using the 'application' and 'window' action groups for their own purposes, and unity-gtk-module should try to avoid using these if they're already being used. (LP: #1176154) [ Ubuntu daily release ] * Automatic snapshot from revision 238 -- Ubuntu daily release Thu, 23 May 2013 16:59:28 +0000 indicator-appmenu (13.01.0daily13.03.28-0ubuntu1) raring; urgency=low [ Łukasz 'sil2100' Zemczak ] * debian/control: - We're recommending the installation of appmenu-qt5 now, which is safe [ Ubuntu daily release ] * Automatic snapshot from revision 236 -- Ubuntu daily release Thu, 28 Mar 2013 20:27:03 +0000 indicator-appmenu (13.01.0daily13.02.20-0ubuntu1) raring; urgency=low [ Mathieu Trudel-Lapierre ] * Artificially bump upstream major version to please hud. [ Automatic PS uploader ] * Automatic snapshot from revision 234 -- Automatic PS uploader Wed, 20 Feb 2013 09:41:54 +0000 indicator-appmenu (12.10.4daily13.02.13-0ubuntu1) raring; urgency=low [ Mathieu Trudel-Lapierre ] * Coverity CHECKED_RETURN - CID 11391 (LP: #1112844) [ Automatic PS uploader ] * Automatic snapshot from revision 231 -- Automatic PS uploader Wed, 13 Feb 2013 02:02:13 +0000 indicator-appmenu (12.10.4daily13.01.25-0ubuntu1) raring; urgency=low [ Charles Kerr ] * indicators call deprecated glib function g_type_init() (LP: #1103087) [ Automatic PS uploader ] * Automatic snapshot from revision 229 -- Automatic PS uploader Fri, 25 Jan 2013 02:01:11 +0000 indicator-appmenu (12.10.4daily13.01.11-0ubuntu1) raring; urgency=low * Automatic snapshot from revision 227 -- Automatic PS uploader Fri, 11 Jan 2013 02:02:14 +0000 indicator-appmenu (12.10.4daily12.12.14-0ubuntu1) raring; urgency=low [ Lars Uebernickel ] * Hidden, non-existent 'empty' menu/indicator entries exported through DBus (LP: #1089997) [ Automatic PS uploader ] * Automatic snapshot from revision 225 -- Automatic PS uploader Fri, 14 Dec 2012 02:01:28 +0000 indicator-appmenu (12.10.4daily12.11.23-0ubuntu1) raring; urgency=low [ Mathieu Trudel-Lapierre ] * debian/control: - Reorganize Build-Depends for clarity. - Adjust style to be consistent with other indicator packages. - Drop Build-Depends on cdbs. - Bump debhelper Build-Depends to (>= 9). - Add gnome-common to Build-Depends. - Update Vcs-Bzr, Vcs-Browser and add notice to uploaders. - Add gtk-doc-tools to Build-Depends. * debian/compat: bump compat level to 9. * debian/rules: - Convert to using the dh sequencer. - Make sure the build fails if there are files not listed in install files when building the packages. - Override dh_autoreconf to call autogen.sh and not run configure. - Temporarily disable tests due to missing dependencies. * debian/indicator-appmenu.install, debian/indicator-appmenu-tools.install: update paths to install private binaries to the /usr/lib/ paths. [ Didier Roche ] * Automatic snapshot from revision 219 (bootstrap): - Adds childless menu support to the Unity menu panel. (LP: #773101) - add pot template * Unity global menu bar hides childless menu items (LP: #773101) [ Automatic PS uploader ] * Automatic snapshot from revision 221 -- Automatic PS uploader Fri, 23 Nov 2012 07:39:58 +0000 indicator-appmenu (12.10.3-0ubuntu3) raring; urgency=low * Backported r218, should fix menus not working when an application is closed and restarted directly (lp: #1075263) -- Sebastien Bacher Mon, 12 Nov 2012 17:16:17 +0100 indicator-appmenu (12.10.3-0ubuntu2) quantal-proposed; urgency=low * Backport an upstream fix: - Many LibreOffice menu items don't show up in the HUD (LP: #1068546) -- Didier Roche Fri, 19 Oct 2012 12:03:58 +0200 indicator-appmenu (12.10.3-0ubuntu1) quantal; urgency=low * New upstream release. - add the hud awareness protocol, an efficient way to notify applications that the HUD will open (required for libreoffice) - fix hud match highlighting (lp #961000) -- Sebastien Bacher Thu, 04 Oct 2012 20:06:45 +0200 indicator-appmenu (12.10.2-0ubuntu1) quantal; urgency=low * New upstream release: - Implement HUD support for gmenumodel based indicators (lp: #1042824) -- Sebastien Bacher Tue, 02 Oct 2012 23:02:39 +0200 indicator-appmenu (12.10.1-0ubuntu1) quantal; urgency=low * New upstream release. - Support for webapps in the indicator-appmenu (LP: #1048992) - Port appmenu indicator to gtk_widget_insert_action_group() -- Ken VanDine Wed, 19 Sep 2012 15:02:13 -0400 indicator-appmenu (12.10.0-0ubuntu2) quantal; urgency=low * Backport lp:~desrt/indicator-appmenu/insert-action-group should fix some segfault issues with nautilus and libreoffice -- Sebastien Bacher Thu, 23 Aug 2012 18:24:45 +0200 indicator-appmenu (12.10.0-0ubuntu1) quantal; urgency=low * New upstream release. * debian/control.in: - drop deprecated conflicts * debian/control.in, debian/rules: - drop gtk2 build, only gtk3 is supported in the current version -- Sebastien Bacher Wed, 11 Jul 2012 22:16:11 +0200 indicator-appmenu (0.3.97-0ubuntu1) precise; urgency=low * New upstream release. * Faster searches and better search results. (lp: #947283, lp: #972354) * Don't submit searches with zero tokens. (lp: #973203) * Propertly emit the WindowUnregistered signal when windows go away. * Improvements to the gcov automake rules. * Fix bootstrap error in tests. -- Charles Kerr Thu, 05 Apr 2012 11:58:41 -0500 indicator-appmenu (0.3.96-0ubuntu3) precise; urgency=low * Backport desrt's performance improvement work: - reduce hud cpu usage and DoS on long strings (lp: #938584, lp: #948820) - should stop stripping issues (lp: #937020) - fixes a small leak (lp: #972354) -- Sebastien Bacher Tue, 03 Apr 2012 17:59:03 +0200 indicator-appmenu (0.3.96-0ubuntu2) precise; urgency=low * Backport desrt's fix for a leak in the icon code (lp: #967879) -- Sebastien Bacher Mon, 02 Apr 2012 15:03:25 +0200 indicator-appmenu (0.3.96-0ubuntu1) precise; urgency=low [ Charles Kerr ] * New upstream release. * Fix icon support. * Fix a pair of memory leaks (LP: #965497) * Added tests to benchmark dbus message traffic. [ Ken VanDine ] * tests/Makefile.am - Don't run the test-dbus-message-count test, it requires bustle which is in universe -- Ken VanDine Thu, 29 Mar 2012 10:53:14 -0400 indicator-appmenu (0.3.95-0ubuntu2) precise; urgency=low * Backport desrt's hud icons work (lp: #960931) -- Sebastien Bacher Fri, 23 Mar 2012 16:58:35 +0100 indicator-appmenu (0.3.95-0ubuntu1) precise; urgency=low * New upstream release. * Adding GMenuModel menu support (LP: #950084) * Support for XUL applications in the hud (LP: #921231) * Init translation, fix system indicator names not translated in the HUD (LP: #955880) * Fix an hud-service assertion error (LP: #955937) * Highlight hits in GMenuModel HUD (LP: #950079) * Several Coverity bugs (LP: #957420, #957414, #957412, #957415) -- Ted Gould Wed, 21 Mar 2012 13:45:19 -0500 indicator-appmenu (0.3.94-0ubuntu4) precise; urgency=low * Rebase on desrt's r238, including: - support for xul applications in the hud (lp: #921231) - should fix an hud-service assertion error (lp: #955937) * debian/control: - build depends on vala for hud-gtk * debian/indicator-appmenu-tools.install: - install hud-gtk with the tools -- Sebastien Bacher Tue, 20 Mar 2012 13:47:35 +0100 indicator-appmenu (0.3.94-0ubuntu3) precise; urgency=low * Backport r180 to fix unity-panel-service segfaults when unsetting the menuproxy variable to disable menus export (lp: #953479, #958048) -- Sebastien Bacher Mon, 19 Mar 2012 11:36:10 +0100 indicator-appmenu (0.3.94-0ubuntu2) precise; urgency=low * Init translation, fix system indicator names not translated in the hud (lp: #955880) -- Sebastien Bacher Thu, 15 Mar 2012 19:42:30 +0100 indicator-appmenu (0.3.94-0ubuntu1) precise; urgency=low * New upstream release. -- Sebastien Bacher Wed, 14 Mar 2012 20:47:58 +0100 indicator-appmenu (0.3.92-0ubuntu2) precise; urgency=low * Backport desrt's r216, r217, r218, should fix: - "don't setup usage data for disable items or those without labels" (lp: #953579) - "remove all items from the dbusmenucollector on free" (lp: #953771) - "check the window title from bamf for being NULL before comparing on it" (lp: #953620) -- Sebastien Bacher Tue, 13 Mar 2012 16:07:06 +0100 indicator-appmenu (0.3.92-0ubuntu1) precise; urgency=low * Backport r175 to fix sync issues * Backport desrt's current work to add back hud syntax highlight and hud usage tracking, fixes a segfault as well (lp: #950402) [ Ted Gould ] * New upstream release. * Docbook parsing build error (LP: #931777) * Ensure variants get valid strings (LP: #934429) * Typos in translator comments (LP: #945445) * Add GMenuModel support to HUD -- Sebastien Bacher Mon, 12 Mar 2012 21:02:50 +0100 indicator-appmenu (0.3.91-0ubuntu2) precise; urgency=low * Backport r165 to fix a segfault in the hud service which gets quite some duplicates (lp: #934429) -- Sebastien Bacher Mon, 27 Feb 2012 12:29:34 +0100 indicator-appmenu (0.3.91-0ubuntu1) precise; urgency=low * debian/control: - drop scrollkeeper build-depends, that source is deprecated and not need to build the indicator [ Ted Gould ] * New upstream release. * Fix resize in HUD CLI (LP: #921284) * Remove extranious g_errors (LP: #921288) * Making usage of usage data more fair (LP: #923999) * Ensure property exists before evaluating on it (LP: #930059) * Protect against improperly parsed messages (LP: #931219) * Fix UTF-8 handling in distance algorithms (LP: #930065) * Correct name of dash in blacklist (LP: #932530) * Add support of AppIndicator title changes -- Sebastien Bacher Wed, 15 Feb 2012 20:58:01 +0100 indicator-appmenu (0.3.90-0ubuntu2) precise; urgency=low * Backport upstream work for better matching of utf8 strings (lp: #930065) -- Sebastien Bacher Tue, 14 Feb 2012 17:58:13 +0100 indicator-appmenu (0.3.90-0ubuntu1) precise; urgency=low [ Ted Gould ] * New upstream release. * Make the focusing blacklist an environment variable * Updating to new indicator-application API and using the title * Add a visible/enable property for custom items * Add support for entry_activate_window to switch focus when passed an XID * Supporting what BAMF calls Unity-2d * Include the build directory for tests * Removing debug interfaces we're not using * Don't build a found object if we're already over max * Updating to use DBusmenu 0.5.90 * Rename dbusmenu collector to avoid namespace collitions * Use indexes in the database and make the creation easier to modify * Add in the HUD feature * Fixing the libexec path for OpenSuSE * Add a setting for the menu mode * Making the test tools optional * Adding code coverage output * debian/control: * Increasing the dep on libindicator version * Add a dep in tools on sqlite3 (LP: #921274) * Adding xvfb * Added autoreconf * Adding appindicator test build dependencies on the application indicator stuff. * Adding build deps on new libraries for CLI tool * Adding sqlite and dbus-test-runner deps * Updating dbusmenu dep to 0.5.90 * Ensuring we don't get installed with an indicator-application version less than 0.4.90 * Making the builddep require 0.4.90 of indicator-application so the test suite builds * debian/indicator-appmenu.install: * Adding GSchemas * Grabbing the dbus service too * Adding in the HUD components to the various packages. * debian/indicator-appmenu-tools.install: * Adding man pages * Move tools to /usr/bin * Adding in the HUD components to the various packages. * debian/rules: * Adding in autoreconf.mk * Adding autopoint * Adding make check [ Ken VanDine ] * debian/rules * ensure $DISPLAY isn't set, it makes the tests fail in pbuilder -- Ken VanDine Thu, 09 Feb 2012 13:13:35 -0500 indicator-appmenu (0.3.2-0ubuntu3) precise; urgency=low * src/indicator-appmenu.c - set menu visibility, fixes the disappearing menus with libindicator >= 0.4.90 -- Ken VanDine Thu, 26 Jan 2012 00:20:24 -0500 indicator-appmenu (0.3.2-0ubuntu2) precise; urgency=low * no change rebuild for libindicator7 -- Ken VanDine Wed, 25 Jan 2012 09:51:34 -0500 indicator-appmenu (0.3.2-0ubuntu1) precise; urgency=low * New upstream release. * debian/patches/double-ref-of-entry-label.patch: included in the new version -- Sebastien Bacher Tue, 13 Dec 2011 10:45:03 +0100 indicator-appmenu (0.3.2-0ubuntu1~ppa1) oneiric; urgency=low * New upstream release. * Ensure that the label is ref'd using a ref_sink() * Drop debian/patches/double-ref-of-entry-label.patch: Upstream -- Ted Gould Thu, 13 Oct 2011 13:38:29 -0500 indicator-appmenu (0.3.1-0ubuntu2) oneiric; urgency=low * debian/patches/double-ref-of-entry-label.patch: - Don't leak GtkLabels by adding a second ref on top of the floating ref. Instead, sink the floating ref. Part of bug 835646. -- Michael Terry Thu, 06 Oct 2011 10:19:08 -0400 indicator-appmenu (0.3.1-0ubuntu1) oneiric; urgency=low * New upstream release. * Fix reference leak -- Ted Gould Thu, 29 Sep 2011 10:26:10 -0500 indicator-appmenu (0.3.0-0ubuntu1) oneiric; urgency=low * New upstream release. * Version Bump -- Ted Gould Wed, 28 Sep 2011 13:54:23 -0500 indicator-appmenu (0.2.91-0ubuntu4) oneiric; urgency=low [ Didier Roche ] * debian/rules: - stripping gtk from list of build-dep isn't needed on those components [ Sebastien Bacher ] * debian/conrol.in: - recommends appmenu-gtk as well it's still needed -- Sebastien Bacher Tue, 02 Aug 2011 21:39:58 +0200 indicator-appmenu (0.2.91-0ubuntu2) oneiric; urgency=low * debian/rules: - avoid making indicator-appmenu* depends on gtk2/3 by dpkg-shlibdeps. The library doesn't hurt if gtk isn't installed and that enable pre-installlation of the indicator stack without requiring the full gtk stack being there without any gtk app installed. -- Didier Roche Mon, 25 Jul 2011 18:19:47 +0200 indicator-appmenu (0.2.91-0ubuntu1) oneiric; urgency=low [ Ted Gould ] * New upstream release. * libindicator 0.4 migration [ Ken VanDine ] * bumped build depends for libindicator to >= 0.3.90 -- Ken VanDine Fri, 08 Jul 2011 11:30:22 -0400 indicator-appmenu (0.2.90-0ubuntu3) oneiric; urgency=low * Rebuild for libdbusmenu-gtk3-4 * debian/control - Dropped build depends on indicator-appmenu-gtk2 -- Ken VanDine Tue, 28 Jun 2011 09:03:44 -0400 indicator-appmenu (0.2.90-0ubuntu2) oneiric; urgency=low * debian/control - Make indicator-appmenu recommend appmenu-gtk3 (LP: #791735) -- Ken VanDine Wed, 22 Jun 2011 23:31:46 -0400 indicator-appmenu (0.2.90-0ubuntu1) oneiric; urgency=low [ Ted Gould ] * New upstream release. - When freeing existing entries, don't skip every other one - When an entry gets inserted mid-menu (instead of at the end), place it in the correct place instead of assuming the end - When a new entry gets added with an empty submenu, actually watch the submenu for new items instead of dropping it on the floor - GTK 3 Port * debian/indicator-appmenu.install: Installing the GTK3 indicator [ Ken VanDine ] * debian/control - Bumped standards version to 3.9.2 - Add new binary for indicator-appmenu-gtk2 - Make indicator-appmenu recommend indicator-appmenu-gtk2 (until unity can load gtk3 indicators) - indicator-appmenu-gtk2 replaces indicator-appmenu << 0.2.90 - Added build depends for libdbusmenu-gtk3-dev, libindicator3-dev and libbamf3-dev * debian/rules - build for both gtk2 and gtk3 -- Ken VanDine Wed, 22 Jun 2011 12:59:36 -0400 indicator-appmenu (0.2.1-0ubuntu3) oneiric; urgency=low * debian/control: - get indicator-appmenu recommends appmenu-qt as it's toolkit agnostic -- Didier Roche Fri, 27 May 2011 11:26:19 +0200 indicator-appmenu (0.2.1-0ubuntu2) natty; urgency=low * Backport bug fixes from trunk: - When freeing existing entries, don't skip every other one - When an entry gets inserted mid-menu (instead of at the end), place it in the correct place instead of assuming the end - When a new entry gets added with an empty submenu, actually watch the submenu for new items instead of dropping it on the floor -- Michael Terry Fri, 15 Apr 2011 16:21:17 -0400 indicator-appmenu (0.2.1-0ubuntu1) natty; urgency=low * New upstream release. ∘ Protect props_cb() with a reference and check for cancellation (LP: #741488) -- Ted Gould Thu, 14 Apr 2011 16:19:16 -0500 indicator-appmenu (0.2.0-0ubuntu1) natty; urgency=low * New upstream release. ∘ Adding a check of the indicator environment to hide the menu stubs under Unity (LP: #703555) ∘ Send about-to-show on menus that don't have any children currently (LP: #619811) ∘ Work around bugs in signaling by delaying the destruction of menu caches for five seconds (LP: #718926) ∘ Disconnecting client signal handlers on displose (LP: #738561) ∘ Remove menuitem signals on root changes (LP: #743404) -- Ted Gould Thu, 07 Apr 2011 11:01:06 -0500 indicator-appmenu (0.1.97-0ubuntu1) natty; urgency=low * New upstream release. ∘ Support Unregistering menus from DBus (LP: #734880) -- Ted Gould Wed, 16 Mar 2011 14:37:43 -0500 indicator-appmenu (0.1.96-0ubuntu1) natty; urgency=low * New upstream release. ∘ Fix to match DBusmenu API changes ∘ Pass signal through libindicator to show menu items on Alt -- Ted Gould Thu, 10 Mar 2011 14:30:06 -0600 indicator-appmenu (0.1.95-0ubuntu1) natty; urgency=low * New upstream release. * Accessible description support * debian/control: Updating libindicator to 0.3.19 -- Ted Gould Thu, 17 Feb 2011 14:26:34 -0600 indicator-appmenu (0.1.94-0ubuntu1) natty; urgency=low * New upstream release. * Removing the unused 'destroy' signal on window menus * Removing g_error's in the .so * Use the menus_destroyed() function instead of removing from the hashtable. (LP: #714531) -- Ted Gould Fri, 11 Feb 2011 10:05:47 -0600 indicator-appmenu (0.1.93-0ubuntu2) natty; urgency=low * src/indicator-appmenu.c - Using the destroy() function instead of just removing from the hashtable as it handles more details of switching windows. Then we have to unref as the destroy function does not. (LP: #714531) -- Ken VanDine Mon, 07 Feb 2011 12:44:20 -0500 indicator-appmenu (0.1.93-0ubuntu1) natty; urgency=low * New upstream release. * Remove the signals on menu items we're no longer caring about (LP: #706941) * Close open menus when switching windows (LP: #709305) * Find the correct entry to remove when removing entries * Watch window closing at the indicator level instead of the window level to make it less racy -- Ted Gould Thu, 03 Feb 2011 14:44:17 -0600 indicator-appmenu (0.1.92-0ubuntu1) natty; urgency=low * New upstream release. * Stopping a crash when menus disappear * Check to make sure we're signaled with a BamfWindow and ignore other BAMF signals. * Check to ensure that what we get back from BAMF is non-NULL before connecting to it. -- Ted Gould Thu, 27 Jan 2011 16:16:21 -0600 indicator-appmenu (0.1.91-0ubuntu1) natty; urgency=low * New upstream release. * Using BAMF to watch for window destruction (LP: #703769) -- Ted Gould Thu, 20 Jan 2011 08:49:37 -0600 indicator-appmenu (0.1.90-0ubuntu1) natty; urgency=low [ Ted Gould ] * New upstream release. * GDBus Port * Migration from ayatana.org to canonical.com * debian/patches/01-shortcut-fix.patch: Merged upstream [ Ken VanDine ] * debian/control - Bumped build depends for dbusmenu to >= 0.3.91 - Bumped build depends for libindicator to >= 0.3.16 - Dropped build depends for libdbus-glib-1-dev -- Ken VanDine Fri, 14 Jan 2011 12:22:13 -0600 indicator-appmenu (0.0.13-0ubuntu4) natty; urgency=low * debian/patches/01-shortcut-fix.patch: Fix the handling of showing the menus so it works with all menus in an application. (LP: #688018) -- Ted Gould Fri, 10 Dec 2010 20:17:44 -0600 indicator-appmenu (0.0.13-0ubuntu3) natty; urgency=low * debian/control - Bump build depends for libdbusmenu-* to >= 0.3.90 -- Ken VanDine Thu, 09 Dec 2010 11:36:38 -0500 indicator-appmenu (0.0.13-0ubuntu2) natty; urgency=low * Upstream Merge * Add Eclipse to the blacklist (LP: #633828) -- Ted Gould Mon, 27 Sep 2010 12:04:29 -0500 indicator-appmenu (0.0.13-0ubuntu2~ppa3) natty; urgency=low * Upstream Merge * Fixing counting of menus for GEdit and others. -- Ted Gould Fri, 10 Dec 2010 16:34:34 -0600 indicator-appmenu (0.0.13-0ubuntu2~ppa2) natty; urgency=low * Upstream Merge * Fixing signaling -- Ted Gould Fri, 10 Dec 2010 14:50:30 -0600 indicator-appmenu (0.0.13-0ubuntu2~ppa1) maverick; urgency=low * Upstream Merge * Add Eclipse to the blacklist (LP: #633828) -- Ted Gould Mon, 27 Sep 2010 12:04:29 -0500 indicator-appmenu (0.0.13-0ubuntu1) maverick; urgency=low * New upstream release. * Using the BAMF closed windows interface to detect short lived windows. (LP: #645355) * Tracking BAMF windows differently and caching stubs * Droping Chrome from the blacklist of stubs (LP: #646136) * Removing the Edit menu from the stubs (LP: #646136) * debian/patches/01_bzr_fix_race_condition.patch: (merged upstream) -- Ted Gould Thu, 23 Sep 2010 12:43:39 -0500 indicator-appmenu (0.0.12-0ubuntu1) maverick; urgency=low * New upstream realease: - Fix Action for top-level dropdown menu item not activated (LP: #637692) * debian/control: - depends on latest libindicator-dev for ABI change - depends on latest bamf with distro patch * debian/rules: - add a patch system * debian/patches/01_bzr_fix_race_condition.patch: - This patch ensures that windows which are already closed according to bamf are not passed on for processing in mutter. (Jason Smith) (LP: #645355) -- Didier Roche Wed, 22 Sep 2010 20:09:47 +0200 indicator-appmenu (0.0.11-0ubuntu3) maverick; urgency=low * Cherry pick fix to blacklist chrome and chromium -- Ken VanDine Thu, 16 Sep 2010 11:31:02 -0400 indicator-appmenu (0.0.11-0ubuntu2) maverick; urgency=low * Cherry pick fix for maximized windows getting closed (LP: #637108) -- Ken VanDine Thu, 16 Sep 2010 08:59:12 -0400 indicator-appmenu (0.0.11-0ubuntu1) maverick; urgency=low * New upstream release. * Check to see if an app wants stubs shown (LP: #633211) * Adding a blacklist of known desktop files (LP: #633211) * debian/control * Bumped build depends for libbamf-dev to 0.2.50 -- Ted Gould Wed, 15 Sep 2010 15:07:36 -0500 indicator-appmenu (0.0.10-0ubuntu1) maverick; urgency=low * New upstream release * Detect and show the menus on desktop windows (LP: #591168) * Have the close item in the default menu work * Handle event errors * Only restoring if WindowMenus are involved [Ken VanDine] * debian/control - Bumped build depends for libbamf-dev to 0.2.46 -- Ted Gould Thu, 09 Sep 2010 11:16:48 -0500 indicator-appmenu (0.0.9-0ubuntu1) maverick; urgency=low * New upstream release. - DBus name change, s/WindowMenu/AppMenu/g -- Ken VanDine Thu, 22 Jul 2010 15:15:25 +0200 indicator-appmenu (0.0.8-0ubuntu2~ppa1) lucid; urgency=low * Merge upstream * Adding in a debug interface for getting JSON data from the applet directly. -- Ted Gould Mon, 12 Jul 2010 17:09:24 -0500 indicator-appmenu (0.0.8-0ubuntu1) maverick; urgency=low * New upstream release. * Adding a new utility to make a mock application * Fixing menus that are added after a window is shown * Tracking the root item so that we can disconnect signals * Switching to using stock menu items * debian/control: Adding build dep on dbusmenu-jsonloader-dev * debian/indicator-appmenu-tools.install: Adding to the new mock-json-app binary into the package. -- Ted Gould Thu, 01 Jul 2010 09:18:52 -0500 indicator-appmenu (0.0.7-0ubuntu2) maverick; urgency=low * Backport upstream change to fix crash issues -- Sebastien Bacher Tue, 29 Jun 2010 23:27:06 +0200 indicator-appmenu (0.0.7-0ubuntu1) maverick; urgency=low * New upstream release. * Accelerator support (LP: #586978) * Setting the window ID and debug check * debian/control: Updating libdbusmenu*-dev to 0.3.3 -- Ted Gould Thu, 24 Jun 2010 10:54:52 -0500 indicator-appmenu (0.0.6-0ubuntu1) maverick; urgency=low * debian/control: Updating libbamf-dev to 0.2.30 [Ted Gould] * debian/control: Updating libbamf-dev to 0.2.28 * New upstream release. * Adding support for default window menus and a dummy desktop menu. * Transient detection on new windows * Look for transient windows on window switching. * Fix visiblity and enable defaults * Watching for applications dropping off the bus and removing their windows. * Adding indicator-appmenu-crashdb.conf and source_indicator-appmenu.py so that bugs reported with ubuntu-bug will go to the upstream project if the package is gotten from a PPA. -- Ken VanDine Thu, 17 Jun 2010 16:27:04 -0400 indicator-appmenu (0.0.5-0ubuntu1) maverick; urgency=low * New upstream release * Supporting for visibility and enable properties. -- Ted Gould Thu, 10 Jun 2010 12:10:35 -0500 indicator-appmenu (0.0.4-0ubuntu1~ppa2) maverick; urgency=low * debian/control - Fixed typo in description -- Ken VanDine Thu, 10 Jun 2010 09:21:12 -0400 indicator-appmenu (0.0.4-0ubuntu1~ppa1) maverick; urgency=low * New upstream release. * Application switching using BAMF * Adding a debug interface and scripts * debian/control: Requiring libbamf-dev to build * debian/control, debian/indicator-appmenu.install and debian/indicator-appmenu-tools.install: Breaking out the tools into their own package as most users won't need them. -- Ted Gould Fri, 04 Jun 2010 09:42:16 -0500 indicator-appmenu (0.0.3-0ubuntu1~ppa1) maverick; urgency=low * New upstream release. * Dynamic menu items * debian/control: Increasing dbusmenu reqs to 0.3.0 [Ken VanDine] * debian/watch added * debian/control - Added Homepage and Vcs -- Ted Gould Thu, 27 May 2010 12:15:24 -0500 indicator-appmenu (0.0.2-0ubuntu1~ppa1) lucid; urgency=low * New upstream release. * Updates to the demo at UDS. -- Ted Gould Thu, 13 May 2010 14:33:12 +0200 indicator-appmenu (0.0.1-0ubuntu1~ppa4) lucid; urgency=low * Upstream Merge * Fixes and Qt integration fixes. -- Ted Gould Mon, 10 May 2010 18:13:06 +0200 indicator-appmenu (0.0.1-0ubuntu1~ppa3) lucid; urgency=low * Upstream Merge * Making it so we don't track window IDs at all -- Ted Gould Fri, 07 May 2010 17:25:28 +0200 indicator-appmenu (0.0.1-0ubuntu1~ppa2) lucid; urgency=low * Upstream Merge * Building the menus at a demo quality * Autogen -- Ted Gould Fri, 07 May 2010 16:04:54 +0200 indicator-appmenu (0.0.1-0ubuntu1~ppa1) lucid; urgency=low * New upstream release. * Now it allows registering things. -- Ted Gould Wed, 05 May 2010 11:21:33 +0200 indicator-appmenu (0.0.0-0ubuntu1~ppa1) lucid; urgency=low * Initial release -- Ted Gould Mon, 19 Apr 2010 12:56:43 -0500 indicator-appmenu.git/debian/compat0000664000000000000000000000000215154240054014567 0ustar 9 indicator-appmenu.git/debian/control0000664000000000000000000000361215154240054014776 0ustar Source: indicator-appmenu Section: gnome Priority: optional Maintainer: Ubuntu Desktop Team Build-Depends: debhelper (>= 9), dh-autoreconf, dh-translations, libglib2.0-dev (>= 2.35.4), libgtk-3-dev, gtk-doc-tools, gnome-common, intltool, dbus-test-runner, xvfb, libindicator3-dev (>= 0.4.90), libdbusmenu-glib-dev (>= 0.5.90), libdbusmenu-gtk3-dev (>= 0.5.90), libdbusmenu-jsonloader-dev (>= 0.5.90), libbamf3-dev (>= 0.5.2~bzr0), libappindicator3-dev, indicator-application (>= 0.4.90), Standards-Version: 3.9.2 Homepage: http://launchpad.net/indicator-appmenu # If you aren't a member of ~indicator-applet-developers but need to upload # packaging changes, just go ahead. ~indicator-applet-developers will notice # and sync up the code again. Vcs-Bzr: https://code.launchpad.net/~indicator-applet-developers/indicator-appmenu/trunk.13.04 Vcs-Browser: https://bazaar.launchpad.net/~indicator-applet-developers/indicator-appmenu/trunk.13.04/files X-Ubuntu-Use-Langpack: yes Package: indicator-appmenu Architecture: any Depends: bamfdaemon, ${shlibs:Depends}, ${misc:Depends}, Recommends: indicator-applet | indicator-renderer, appmenu-gtk3-module, appmenu-qt, jayatana, Description: Indicator for application menus. . This package provides support for application menus. Package: indicator-appmenu-tools Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, indicator-appmenu (= ${binary:Version}), libdbusmenu-tools (>= 12.10.3daily13.02.01), Description: Tools for debuging application menus. . This package provides tools for supporting application menus. indicator-appmenu.git/debian/copyright0000664000000000000000000000222615154240054015326 0ustar This package was debianized by Ted Gould on Wed, 11 Feb 2009 15:41:06 -0600. It was downloaded from Upstream Author: Ted Gould Copyright: Copyright (C) 2010 Canonical Ltd. License: 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, version 3 of the License. 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, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA On Debian systems, the complete text of the GNU General Public License can be found in `/usr/share/common-licenses/GPL-3'. The Debian packaging is (C) 2009, Canonical Ltd. and is licensed under the GPLv3, see `/usr/share/common-licenses/GPL-3'. indicator-appmenu.git/debian/indicator-appmenu-crashdb.conf0000664000000000000000000000015315154240054021262 0ustar indicator_appmenu = { 'impl': 'launchpad', 'project': 'indicator-appmenu', 'bug_pattern_base': None, } indicator-appmenu.git/debian/indicator-appmenu-tools.install0000664000000000000000000000014715154240054021540 0ustar debian/tmp/usr/lib/*/current-menu* debian/tmp/usr/lib/*/menu-pusher debian/tmp/usr/lib/*/mock-json-app indicator-appmenu.git/debian/indicator-appmenu.install0000664000000000000000000000033115154240054020375 0ustar debian/tmp/usr/lib/indicators3 /usr/lib debian/source_indicator-appmenu.py /usr/share/apport/package-hooks/ debian/indicator-appmenu-crashdb.conf /etc/apport/crashdb.conf.d/ debian/tmp/usr/share/glib-2.0/ /usr/share/ indicator-appmenu.git/debian/rules0000775000000000000000000000073515154240054014456 0ustar #!/usr/bin/make -f LDFLAGS += -Wl,-z,defs -Wl,--as-needed %: dh $@ --with autoreconf,translations override_dh_autoreconf: NOCONFIGURE=1 dh_autoreconf ./autogen.sh override_dh_auto_configure: dh_auto_configure -- \ --disable-static override_dh_install: find debian/tmp -name \*.la -delete find debian/tmp -name \*.a -delete dh_install --fail-missing override_dh_auto_test: # Tests temporarily disabled: bustle-dbus-monitor can't be found, needs deps in universe. indicator-appmenu.git/debian/source_indicator-appmenu.py0000664000000000000000000000033115154240054020737 0ustar from apport.hookutils import * import os.path def add_info(report): if not apport.packaging.is_distro_package(report['Package'].split()[0]): report['ThirdParty'] = 'True' report['CrashDB'] = 'indicator_appmenu' indicator-appmenu.git/debian/watch0000664000000000000000000000014315154240054014420 0ustar version=3 http://launchpad.net/indicator-appmenu/+download .*/indicator-appmenu-([0-9.]+)\.tar\.gz indicator-appmenu.git/m4/0000775000000000000000000000000015154240054012467 5ustar indicator-appmenu.git/m4/gcov.m40000664000000000000000000000472415154240054013676 0ustar # Checks for existence of coverage tools: # * gcov # * lcov # * genhtml # * gcovr # # Sets ac_cv_check_gcov to yes if tooling is present # and reports the executables to the variables LCOV, GCOVR and GENHTML. AC_DEFUN([AC_TDD_GCOV], [ AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov], [enable coverage testing with gcov]), [use_gcov=$enableval], [use_gcov=no]) if test "x$use_gcov" = "xyes"; then # we need gcc: if test "$GCC" != "yes"; then AC_MSG_ERROR([GCC is required for --enable-gcov]) fi # Check if ccache is being used AC_CHECK_PROG(SHTOOL, shtool, shtool) case `$SHTOOL path $CC` in *ccache*[)] gcc_ccache=yes;; *[)] gcc_ccache=no;; esac if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.]) fi lcov_version_list="1.6 1.7 1.8 1.9 1.10 1.11 1.12" AC_CHECK_PROG(LCOV, lcov, lcov) AC_CHECK_PROG(GENHTML, genhtml, genhtml) if test "$LCOV"; then AC_CACHE_CHECK([for lcov version], glib_cv_lcov_version, [ glib_cv_lcov_version=invalid lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'` for lcov_check_version in $lcov_version_list; do if test "$lcov_version" = "$lcov_check_version"; then glib_cv_lcov_version="$lcov_check_version (ok)" fi done ]) else lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list" AC_MSG_ERROR([$lcov_msg]) fi case $glib_cv_lcov_version in ""|invalid[)] lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)." AC_MSG_ERROR([$lcov_msg]) LCOV="exit 0;" ;; esac if test -z "$GENHTML"; then AC_MSG_ERROR([Could not find genhtml from the lcov package]) fi ac_cv_check_gcov=yes ac_cv_check_lcov=yes # Remove all optimization flags from CFLAGS changequote({,}) CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'` changequote([,]) # Add the special gcc flags COVERAGE_CFLAGS="-O0 -fprofile-arcs -ftest-coverage" COVERAGE_CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage" COVERAGE_LDFLAGS="-lgcov" # Check availability of gcovr AC_CHECK_PROG(GCOVR, gcovr, gcovr) if test -z "$GCOVR"; then ac_cv_check_gcovr=no else ac_cv_check_gcovr=yes fi fi ]) # AC_TDD_GCOV indicator-appmenu.git/po/0000775000000000000000000000000015154240054012565 5ustar indicator-appmenu.git/po/POTFILES.in0000664000000000000000000000024115154240054014337 0ustar data/com.canonical.indicator.appmenu.gschema.xml src/gdk-get-func.c src/indicator-appmenu.c src/window-menu.c src/window-menu-dbusmenu.c src/window-menu-model.c indicator-appmenu.git/po/POTFILES.skip0000664000000000000000000000020115154240054014673 0ustar src/create-db.c src/gen-application-menu-registrar.xml.c src/gen-application-menu-renderer.xml.c src/indicator-appmenu-marshal.c indicator-appmenu.git/po/indicator-appmenu.pot0000664000000000000000000000156115154240054016733 0ustar # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2014-03-21 11:22+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #: ../data/com.canonical.indicator.appmenu.gschema.xml.h:1 msgid "Where the menu is displayed." msgstr "" #: ../data/com.canonical.indicator.appmenu.gschema.xml.h:2 msgid "Controls the menu display location." msgstr "" #: ../src/window-menu-model.c:170 msgid "Unknown Application Name" msgstr "" indicator-appmenu.git/scripts/0000775000000000000000000000000015154240054013636 5ustar indicator-appmenu.git/scripts/Makefile.am0000664000000000000000000000031415154240054015670 0ustar libexec_PROGRAMS = menu-pusher menu_pusher_SOURCES = \ menu-pusher.c menu_pusher_CFLAGS = \ $(INDICATOR_CFLAGS) \ -Wall \ -Wno-error=deprecated-declarations menu_pusher_LDADD = \ $(INDICATOR_LIBS) indicator-appmenu.git/scripts/menu-pusher.c0000664000000000000000000000647215154240054016263 0ustar /* A test menu pusher to the appmenu. Copyright 2010 Canonical Ltd. Authors: Ted Gould This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, SATISFACTORY QUALITY, 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 . */ #include #include #include #include #include #include "../src/dbus-shared.h" int main (int argv, char ** argc) { gtk_init(&argv, &argc); DbusmenuMenuitem * root = dbusmenu_menuitem_new(); DbusmenuMenuitem * firstlevel = dbusmenu_menuitem_new(); dbusmenu_menuitem_property_set(firstlevel, DBUSMENU_MENUITEM_PROP_LABEL, "File"); dbusmenu_menuitem_child_append(root, firstlevel); DbusmenuMenuitem * secondlevel = dbusmenu_menuitem_new(); dbusmenu_menuitem_property_set(secondlevel, DBUSMENU_MENUITEM_PROP_LABEL, "Open"); dbusmenu_menuitem_property_set_shortcut_string(secondlevel, "O"); dbusmenu_menuitem_child_append(firstlevel, secondlevel); secondlevel = dbusmenu_menuitem_new(); dbusmenu_menuitem_property_set(secondlevel, DBUSMENU_MENUITEM_PROP_LABEL, "Save"); dbusmenu_menuitem_property_set_shortcut_string(secondlevel, "S"); dbusmenu_menuitem_child_append(firstlevel, secondlevel); secondlevel = dbusmenu_menuitem_new(); dbusmenu_menuitem_property_set(secondlevel, DBUSMENU_MENUITEM_PROP_LABEL, "Exit"); dbusmenu_menuitem_child_append(firstlevel, secondlevel); firstlevel = dbusmenu_menuitem_new(); dbusmenu_menuitem_property_set(firstlevel, DBUSMENU_MENUITEM_PROP_LABEL, "Edit"); dbusmenu_menuitem_child_append(root, firstlevel); secondlevel = dbusmenu_menuitem_new(); dbusmenu_menuitem_property_set(secondlevel, DBUSMENU_MENUITEM_PROP_LABEL, "Copy"); dbusmenu_menuitem_child_append(firstlevel, secondlevel); secondlevel = dbusmenu_menuitem_new(); dbusmenu_menuitem_property_set(secondlevel, DBUSMENU_MENUITEM_PROP_LABEL, "Paste"); dbusmenu_menuitem_child_append(firstlevel, secondlevel); secondlevel = dbusmenu_menuitem_new(); dbusmenu_menuitem_property_set(secondlevel, DBUSMENU_MENUITEM_PROP_LABEL, "Cut"); dbusmenu_menuitem_child_append(firstlevel, secondlevel); DbusmenuServer * server = dbusmenu_server_new("/this/is/a/long/object/path"); dbusmenu_server_set_root(server, root); GDBusProxy * proxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, NULL, DBUS_NAME, REG_OBJECT, REG_IFACE, NULL, NULL); g_return_val_if_fail(proxy != NULL, 1); g_dbus_proxy_call_sync(proxy, "RegisterWindow", g_variant_new("(uo)", 0, "/this/is/a/long/object/path"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL); gtk_main(); return 0; } indicator-appmenu.git/src/0000775000000000000000000000000015154240054012736 5ustar indicator-appmenu.git/src/Makefile.am0000664000000000000000000000402715154240054014775 0ustar CLEANFILES = DISTCLEANFILES = BUILT_SOURCES = EXTRA_DIST = include $(top_srcdir)/Makefile.am.marshal ###################################### # Building the indicator ###################################### appmenulibdir = $(INDICATORDIR) appmenulib_LTLIBRARIES = libappmenu.la libappmenu_la_SOURCES = \ dbus-shared.h \ gdk-get-func.h \ gdk-get-func.c \ MwmUtil.h \ indicator-appmenu.c \ indicator-appmenu-marshal.c \ window-menu.c \ window-menu.h \ window-menu-dbusmenu.c \ window-menu-dbusmenu.h \ window-menu-model.c \ window-menu-model.h \ gen-application-menu-renderer.xml.c \ gen-application-menu-renderer.xml.h \ gen-application-menu-registrar.xml.c \ gen-application-menu-registrar.xml.h libappmenu_la_CFLAGS = \ $(INDICATOR_CFLAGS) \ $(COVERAGE_CFLAGS) \ -Wall -Wl,-Bsymbolic-functions -Wl,-z,defs -Wl,--as-needed -Wno-error=deprecated-declarations -DG_LOG_DOMAIN=\"Indicator-Appmenu\" libappmenu_la_LIBADD = $(INDICATOR_LIBS) -lX11 libappmenu_la_LDFLAGS = \ $(COVERAGE_LDFLAGS) \ -module -avoid-version ###################################### # Build your own marshaller ###################################### glib_marshal_list = indicator-appmenu-marshal.list glib_marshal_prefix = _indicator_appmenu_marshal ###################################### # DBus Love ###################################### DBUS_SPECS = \ application-menu-renderer.xml \ application-menu-registrar.xml gen-%.xml.c: %.xml @echo "Building $@ from $<" @echo "const char * _$(subst -,_,$(subst .,_,$(basename $(notdir $<)))) = " > $@ @$(XSLT_PROC) $(srcdir)/clean-namespaces.xslt $< | \ sed -e "s:\":\\\\\":g" -e s:^:\": -e s:\$$:\\\\n\": >> $@ @echo ";" >> $@ gen-%.xml.h: %.xml @echo "Building $@ from $<" @echo "extern const char * _$(subst -,_,$(subst .,_,$(basename $(notdir $<))));" > $@ BUILT_SOURCES += \ gen-application-menu-renderer.xml.c \ gen-application-menu-renderer.xml.h \ gen-application-menu-registrar.xml.c \ gen-application-menu-registrar.xml.h CLEANFILES += $(BUILT_SOURCES) EXTRA_DIST += $(DBUS_SPECS) clean-namespaces.xslt indicator-appmenu.git/src/MwmUtil.h0000664000000000000000000000730015154240054014505 0ustar /* * * $Id$ * * Copyright (C) 1995 Free Software Foundation, Inc. * * This file is part of the GNU LessTif Library. * * 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. * * * * Feb 21 1999 - George Lebl (jirka@5z.com) * Owen Taylor (otaylor@redhat.com) * * Modified so that the MotifWmHints structure defined here * is suitable for client side use on 64-bit architectures. * X expects fields with a format of 32 to be longs, even * when sizeof(long) == 8. */ #ifndef MWMUTIL_H_INCLUDED #define MWMUTIL_H_INCLUDED #include G_BEGIN_DECLS typedef struct { unsigned long flags; unsigned long functions; unsigned long decorations; long input_mode; unsigned long status; } MotifWmHints, MwmHints; #define MWM_HINTS_FUNCTIONS (1L << 0) #define MWM_HINTS_DECORATIONS (1L << 1) #define MWM_HINTS_INPUT_MODE (1L << 2) #define MWM_HINTS_STATUS (1L << 3) #define MWM_FUNC_ALL (1L << 0) #define MWM_FUNC_RESIZE (1L << 1) #define MWM_FUNC_MOVE (1L << 2) #define MWM_FUNC_MINIMIZE (1L << 3) #define MWM_FUNC_MAXIMIZE (1L << 4) #define MWM_FUNC_CLOSE (1L << 5) #define MWM_DECOR_ALL (1L << 0) #define MWM_DECOR_BORDER (1L << 1) #define MWM_DECOR_RESIZEH (1L << 2) #define MWM_DECOR_TITLE (1L << 3) #define MWM_DECOR_MENU (1L << 4) #define MWM_DECOR_MINIMIZE (1L << 5) #define MWM_DECOR_MAXIMIZE (1L << 6) #define MWM_INPUT_MODELESS 0 #define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1 #define MWM_INPUT_SYSTEM_MODAL 2 #define MWM_INPUT_FULL_APPLICATION_MODAL 3 #define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL #define MWM_TEAROFF_WINDOW (1L<<0) /* * atoms */ #define _XA_MOTIF_BINDINGS "_MOTIF_BINDINGS" #define _XA_MOTIF_WM_HINTS "_MOTIF_WM_HINTS" #define _XA_MOTIF_WM_MESSAGES "_MOTIF_WM_MESSAGES" #define _XA_MOTIF_WM_OFFSET "_MOTIF_WM_OFFSET" #define _XA_MOTIF_WM_MENU "_MOTIF_WM_MENU" #define _XA_MOTIF_WM_INFO "_MOTIF_WM_INFO" #define _XA_MWM_HINTS _XA_MOTIF_WM_HINTS #define _XA_MWM_MESSAGES _XA_MOTIF_WM_MESSAGES #define _XA_MWM_MENU _XA_MOTIF_WM_MENU #define _XA_MWM_INFO _XA_MOTIF_WM_INFO /* * _MWM_INFO property */ typedef struct { long flags; Window wm_window; } MotifWmInfo; typedef MotifWmInfo MwmInfo; #define MWM_INFO_STARTUP_STANDARD (1L<<0) #define MWM_INFO_STARTUP_CUSTOM (1L<<1) /* * _MWM_HINTS property */ typedef struct { unsigned long flags; unsigned long functions; unsigned long decorations; long inputMode; unsigned long status; } PropMotifWmHints; typedef PropMotifWmHints PropMwmHints; #define PROP_MOTIF_WM_HINTS_ELEMENTS 5 #define PROP_MWM_HINTS_ELEMENTS PROP_MOTIF_WM_HINTS_ELEMENTS /* * _MWM_INFO property, slight return */ typedef struct { unsigned long flags; unsigned long wmWindow; } PropMotifWmInfo; typedef PropMotifWmInfo PropMwmInfo; #define PROP_MOTIF_WM_INFO_ELEMENTS 2 #define PROP_MWM_INFO_ELEMENTS PROP_MOTIF_WM_INFO_ELEMENTS G_END_DECLS #endif /* MWMUTIL_H_INCLUDED */ indicator-appmenu.git/src/application-menu-registrar.xml0000664000000000000000000000733215154240054020732 0ustar An interface to register a menu from an application's window to be displayed in another window.  This manages that association between XWindow Window IDs and the dbus address and object that provides the menu using the dbusmenu dbus interface. The XWindow ID of the window The object on the dbus interface implementing the dbusmenu interface A method to allow removing a window from the database. Windows will also be removed when the client drops off DBus so this is not required. It is polite though. And important for testing. The XWindow ID of the window Gets the registered menu for a given window ID. The XWindow ID of the window to get The address of the connection on DBus (e.g. :1.23 or org.example.service) The path to the object which implements the com.canonical.dbusmenu interface. Gets the information on all menus that the registrar knows about. This is useful for debugging or bringing up a new renderer. An array of structures containing the same parameters as @GetMenuForWindow. Window ID, Service and ObjectPath. Signals when the registrar gets a new menu registered The XWindow ID of the window The address of the connection on DBus (e.g. :1.23 or org.example.service) The path to the object which implements the com.canonical.dbusmenu interface. Signals when the registrar removes a menu registration The XWindow ID of the window indicator-appmenu.git/src/application-menu-renderer.xml0000664000000000000000000000563115154240054020536 0ustar An interface to register a menu from an application's window to be displayed in another window.  This manages that association between XWindow Window IDs and the dbus address and object that provides the menu using the dbusmenu dbus interface. Get the location of the menu currently being displayed to the user. The address of the connection on DBus (e.g. :1.23 or org.example.service) The path to the object which implements the com.canonical.dbusmenu interface. Activate menus via DBus An array of indexes of how to get to the menu item to activate. The list only includes menu items that are visible to the user. So if the array was something like [1, 2] it would be the first submenu, second item as if you looked at the menu using a mouse. Turns the currently displayed menu into a JSON representation JSON describing the menu structure rendered by the renderer. The format is described in the website https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationMenuXdTests#JSON%20format Dumps JSON data describing the menus from a specific window. The XWindow ID of the window to get JSON describing the menu structure rendered by the renderer. Look at @DumpCurrentMenu for more information. indicator-appmenu.git/src/clean-namespaces.xslt0000664000000000000000000000067615154240054017062 0ustar indicator-appmenu.git/src/dbus-shared.h0000664000000000000000000000177015154240054015315 0ustar /* An implementation of indicator object showing menus from applications. Copyright 2010 Canonical Ltd. Authors: Ted Gould This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, SATISFACTORY QUALITY, 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 . */ #define DBUS_NAME "com.canonical.AppMenu.Registrar" #define REG_IFACE "com.canonical.AppMenu.Registrar" #define REG_OBJECT "/com/canonical/AppMenu/Registrar" #define DEBUG_IFACE "com.canonical.AppMenu.Renderer" #define DEBUG_OBJECT "/com/canonical/AppMenu/Renderer" indicator-appmenu.git/src/gdk-get-func.c0000664000000000000000000000713715154240054015365 0ustar /* GDK - The GIMP Drawing Kit * Copyright (C) 1995-2007 Peter Mattis, Spencer Kimball, * Josh MacDonald, Ryan Lortie * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser 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. */ /* * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS * file for a list of people on the GTK+ Team. See the ChangeLog * files for a list of changes. These files are distributed with * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ #include "config.h" #include #include #include /* #ifdef HAVE_XKB #include #endif #include #include */ #include #include #include "MwmUtil.h" /* #include "gdkwindowimpl.h" #include "gdkasync.h" #include "gdkinputprivate.h" #include "gdkdisplay-x11.h" #include "gdkprivate-x11.h" #include "gdkregion.h" #include "gdkinternals.h" #include "gdkwindow-x11.h" #include "gdkalias.h" #include #include #include #include #ifdef HAVE_XCOMPOSITE #include #endif #ifdef HAVE_XFIXES #include #endif #ifdef HAVE_XDAMAGE #include #endif */ #define WINDOW_IS_TOPLEVEL_OR_FOREIGN(window) \ (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && \ GDK_WINDOW_TYPE (window) != GDK_WINDOW_OFFSCREEN) static MotifWmHints * gdk_xid_get_mwm_hints (Window window) { GdkDisplay *display; Atom hints_atom = None; guchar *data = NULL; Atom type; gint format; gulong nitems; gulong bytes_after; int ret = 0; display = gdk_display_get_default (); hints_atom = gdk_x11_get_xatom_by_name_for_display (display, _XA_MOTIF_WM_HINTS); gdk_x11_display_error_trap_push (display); XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), window, hints_atom, 0, sizeof (MotifWmHints)/sizeof (long), False, AnyPropertyType, &type, &format, &nitems, &bytes_after, &data); gdk_display_flush (display); if ((ret = gdk_x11_display_error_trap_pop (display))) { g_warning ("%s: Unable to get hints for %u: Error Code: %d", G_STRFUNC, (guint32)window, ret); return NULL; } if (type == None) return NULL; return (MotifWmHints *)data; } /** * gdk_window_get_functions: * @window: The toplevel #X11Window to get the functions for * @functions: The window functions will be written here * * Returns the functions set on the GdkWindow with #gdk_window_set_functions * Returns: TRUE if the window has functions set, FALSE otherwise. **/ gboolean egg_xid_get_functions (Window window, GdkWMFunction *functions) { MotifWmHints *hints; gboolean result = FALSE; hints = gdk_xid_get_mwm_hints (window); if (hints) { if (hints->flags & MWM_HINTS_FUNCTIONS) { if (functions) *functions = hints->functions; result = TRUE; } XFree (hints); } return result; } indicator-appmenu.git/src/gdk-get-func.h0000664000000000000000000000011215154240054015354 0ustar gboolean egg_xid_get_functions (Window window, GdkWMFunction *functions); indicator-appmenu.git/src/indicator-appmenu-marshal.list0000664000000000000000000000010715154240054020675 0ustar VOID: UINT, STRING, BOXED VOID: UINT VOID: POINTER, UINT VOID: POINTER indicator-appmenu.git/src/indicator-appmenu.c0000664000000000000000000013143515154240054016530 0ustar /* An implementation of indicator object showing menus from applications. Copyright 2010-2013 Canonical Ltd. Authors: Ted Gould Marco Trevisan This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, SATISFACTORY QUALITY, 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 . */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* exit() */ #include #include #include #include #include #include #include #include #include "gen-application-menu-registrar.xml.h" #include "gen-application-menu-renderer.xml.h" #include "indicator-appmenu-marshal.h" #include "window-menu.h" #include "window-menu-dbusmenu.h" #include "window-menu-model.h" #include "dbus-shared.h" #include "gdk-get-func.h" /********************** Indicator Object **********************/ #define INDICATOR_APPMENU_TYPE (indicator_appmenu_get_type ()) #define INDICATOR_APPMENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_APPMENU_TYPE, IndicatorAppmenu)) #define INDICATOR_APPMENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), INDICATOR_APPMENU_TYPE, IndicatorAppmenuClass)) #define IS_INDICATOR_APPMENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), INDICATOR_APPMENU_TYPE)) #define IS_INDICATOR_APPMENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), INDICATOR_APPMENU_TYPE)) #define INDICATOR_APPMENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), INDICATOR_APPMENU_TYPE, IndicatorAppmenuClass)) GType indicator_appmenu_get_type (void); INDICATOR_SET_VERSION INDICATOR_SET_TYPE(INDICATOR_APPMENU_TYPE) typedef struct _IndicatorAppmenu IndicatorAppmenu; typedef struct _IndicatorAppmenuClass IndicatorAppmenuClass; typedef struct _IndicatorAppmenuDebug IndicatorAppmenuDebug; typedef struct _IndicatorAppmenuDebugClass IndicatorAppmenuDebugClass; typedef enum _ActiveStubsState ActiveStubsState; enum _ActiveStubsState { STUBS_UNKNOWN, STUBS_SHOW, STUBS_HIDE }; typedef enum _AppmenuMode AppmenuMode; enum _AppmenuMode { MODE_STANDARD, MODE_UNITY, MODE_UNITY_ALL_MENUS }; struct _IndicatorAppmenuClass { IndicatorObjectClass parent_class; }; struct _IndicatorAppmenu { IndicatorObject parent; AppmenuMode mode; WindowMenu * default_app; GHashTable * apps; BamfMatcher * matcher; BamfWindow * active_window; ActiveStubsState active_stubs; GtkMenuItem * close_item; GArray * window_menus; GHashTable * desktop_windows; WindowMenu * desktop_menu; GDBusConnection * bus; guint owner_id; guint dbus_registration; }; /********************** Debug Proxy **********************/ #define INDICATOR_APPMENU_DEBUG_TYPE (indicator_appmenu_debug_get_type ()) #define INDICATOR_APPMENU_DEBUG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_APPMENU_DEBUG_TYPE, IndicatorAppmenuDebug)) #define INDICATOR_APPMENU_DEBUG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), INDICATOR_APPMENU_DEBUG_TYPE, IndicatorAppmenuDebugClass)) #define IS_INDICATOR_APPMENU_DEBUG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), INDICATOR_APPMENU_DEBUG_TYPE)) #define IS_INDICATOR_APPMENU_DEBUG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), INDICATOR_APPMENU_DEBUG_TYPE)) #define INDICATOR_APPMENU_DEBUG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), INDICATOR_APPMENU_DEBUG_TYPE, IndicatorAppmenuDebugClass)) GType indicator_appmenu_debug_get_type (void); struct _IndicatorAppmenuDebugClass { GObjectClass parent_class; }; struct _IndicatorAppmenuDebug { GObject parent; IndicatorAppmenu * appmenu; GCancellable * bus_cancel; GDBusConnection * bus; guint dbus_registration; }; /********************** Prototypes **********************/ static gboolean indicator_appmenu_delayed_init (IndicatorAppmenu * iapp); static void indicator_appmenu_dispose (GObject *object); static void indicator_appmenu_finalize (GObject *object); static void build_window_menus (IndicatorAppmenu * iapp); static GList * get_entries (IndicatorObject * io); static guint get_location (IndicatorObject * io, IndicatorObjectEntry * entry); static void entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp); static void entry_activate_window (IndicatorObject * io, IndicatorObjectEntry * entry, guint windowid, guint timestamp); static void switch_default_app (IndicatorAppmenu * iapp, WindowMenu * newdef, BamfWindow * active_window); static void find_relevant_windows (IndicatorAppmenu * iapp); static void new_window (BamfMatcher * matcher, BamfView * view, gpointer user_data); static void old_window (BamfMatcher * matcher, BamfView * view, gpointer user_data); static void window_entry_added (WindowMenu * mw, IndicatorObjectEntry * entry, IndicatorAppmenu * iapp); static void window_entry_removed (WindowMenu * mw, IndicatorObjectEntry * entry, IndicatorAppmenu * iapp); static void window_status_changed (WindowMenu * mw, DbusmenuStatus status, IndicatorAppmenu * iapp); static void window_show_menu (WindowMenu * mw, IndicatorObjectEntry * entry, guint timestamp, gpointer user_data); static void window_a11y_update (WindowMenu * mw, IndicatorObjectEntry * entry, gpointer user_data); static void active_window_changed (BamfMatcher * matcher, BamfView * oldview, BamfView * newview, gpointer user_data); static WindowMenu * update_active_window (IndicatorAppmenu * appmenu, BamfWindow *window); static GQuark error_quark (void); static void bus_method_call (GDBusConnection * connection, const gchar * sender, const gchar * object_path, const gchar * interface, const gchar * method, GVariant * params, GDBusMethodInvocation * invocation, gpointer user_data); static void on_bus_acquired (GDBusConnection * connection, const gchar * name, gpointer user_data); static void on_name_lost (GDBusConnection * connection, const gchar * name, gpointer user_data); static WindowMenu * ensure_menus (IndicatorAppmenu * iapp, BamfWindow * window); static GVariant * unregister_window (IndicatorAppmenu * iapp, guint windowid); static void connect_to_menu_signals (IndicatorAppmenu * iapp, WindowMenu * menus); /* Unique error codes for debug interface */ enum { ERROR_NO_APPLICATIONS, ERROR_NO_DEFAULT_APP, ERROR_WINDOW_NOT_FOUND }; /********************** DBus Interfaces **********************/ static GDBusNodeInfo * node_info = NULL; static GDBusInterfaceInfo * interface_info = NULL; static GDBusInterfaceVTable interface_table = { method_call: bus_method_call, get_property: NULL, /* No properties */ set_property: NULL /* No properties */ }; G_DEFINE_TYPE (IndicatorAppmenu, indicator_appmenu, INDICATOR_OBJECT_TYPE); /* One time init */ static void indicator_appmenu_class_init (IndicatorAppmenuClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = indicator_appmenu_dispose; object_class->finalize = indicator_appmenu_finalize; IndicatorObjectClass * ioclass = INDICATOR_OBJECT_CLASS(klass); ioclass->get_entries = get_entries; ioclass->get_location = get_location; ioclass->entry_activate = entry_activate; ioclass->entry_activate_window = entry_activate_window; /* Setting up the DBus interfaces */ if (node_info == NULL) { GError * error = NULL; node_info = g_dbus_node_info_new_for_xml(_application_menu_registrar, &error); if (error != NULL) { g_critical("Unable to parse Application Menu Interface description: %s", error->message); g_error_free(error); } } if (interface_info == NULL) { interface_info = g_dbus_node_info_lookup_interface(node_info, REG_IFACE); if (interface_info == NULL) { g_critical("Unable to find interface '" REG_IFACE "'"); } } return; } /* Per instance Init */ static void indicator_appmenu_init (IndicatorAppmenu *self) { self->apps = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_object_unref); self->mode = MODE_STANDARD; self->active_stubs = STUBS_UNKNOWN; /* Setup the cache of windows with possible desktop entries */ self->desktop_windows = g_hash_table_new(g_direct_hash, g_direct_equal); g_idle_add((GSourceFunc) indicator_appmenu_delayed_init, self); } /* Delayed Init, this is done so it can happen after that the mode has been set */ static gboolean indicator_appmenu_delayed_init (IndicatorAppmenu *self) { if (indicator_object_check_environment(INDICATOR_OBJECT(self), "unity-all-menus")) { self->mode = MODE_UNITY_ALL_MENUS; } else if (indicator_object_check_environment(INDICATOR_OBJECT(self), "unity")) { self->mode = MODE_UNITY; } if (self->mode != MODE_STANDARD) self->active_stubs = STUBS_HIDE; if (self->active_stubs != STUBS_HIDE) build_window_menus(self); /* Get the default BAMF matcher */ self->matcher = bamf_matcher_get_default(); if (self->matcher == NULL) { /* we don't want to exit out of Unity -- but this should really never happen */ g_warning("Unable to get BAMF matcher, can not watch applications switch!"); } else { g_signal_connect(G_OBJECT(self->matcher), "active-window-changed", G_CALLBACK(active_window_changed), self); /* Desktop window tracking */ g_signal_connect(G_OBJECT(self->matcher), "view-opened", G_CALLBACK(new_window), self); g_signal_connect(G_OBJECT(self->matcher), "view-closed", G_CALLBACK(old_window), self); } find_relevant_windows(self); /* Request a name so others can find us */ self->owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, DBUS_NAME, G_BUS_NAME_OWNER_FLAGS_NONE, on_bus_acquired, NULL, on_name_lost, self, NULL); return G_SOURCE_REMOVE; } static void on_bus_acquired (GDBusConnection * connection, const gchar * name, gpointer user_data) { IndicatorAppmenu * iapp = INDICATOR_APPMENU(user_data); GError * error = NULL; if (connection == NULL) { g_critical ("Unable to get session bus."); exit (0); } iapp->bus = connection; /* Now register our object on our new connection */ iapp->dbus_registration = g_dbus_connection_register_object(connection, REG_OBJECT, interface_info, &interface_table, user_data, NULL, &error); if (error != NULL) { g_critical("Unable to register the object to DBus: %s", error->message); g_error_free(error); } } static void on_name_lost (GDBusConnection * connection, const gchar * name, gpointer user_data) { IndicatorAppmenu * iapp = INDICATOR_APPMENU(user_data); if (connection == NULL) { g_critical("OMG! Unable to get a connection to DBus"); } else { g_critical("Unable to claim the name %s", DBUS_NAME); } /* We can rest assured no one will register with us, but let's just ensure we're not showing anything. */ switch_default_app(iapp, NULL, NULL); } /* Object refs decrement */ static void indicator_appmenu_dispose (GObject *object) { IndicatorAppmenu * iapp = INDICATOR_APPMENU(object); if (iapp->dbus_registration != 0) { g_dbus_connection_unregister_object(iapp->bus, iapp->dbus_registration); /* Don't care if it fails, there's nothing we can do */ iapp->dbus_registration = 0; } g_clear_object(&iapp->bus); if (iapp->owner_id != 0) { g_bus_unown_name(iapp->owner_id); iapp->owner_id = 0; } /* bring down the matcher before resetting to no menu so we don't get match signals */ g_clear_object(&iapp->matcher); /* No specific ref */ switch_default_app(iapp, NULL, NULL); g_clear_pointer(&iapp->apps, g_hash_table_destroy); g_clear_pointer(&iapp->desktop_windows, g_hash_table_destroy); if (iapp->desktop_menu != NULL) { /* Wait, nothing here? Yup. We're not referencing the menus here they're already attached to the window ID. We're just keeping an efficient pointer to them. */ iapp->desktop_menu = NULL; } G_OBJECT_CLASS (indicator_appmenu_parent_class)->dispose (object); return; } /* Free memory */ static void indicator_appmenu_finalize (GObject *object) { IndicatorAppmenu * iapp = INDICATOR_APPMENU(object); if (iapp->window_menus != NULL) { g_signal_handlers_disconnect_by_data(iapp->close_item, iapp); gint i; for (i = 0; i < iapp->window_menus->len; ++i) { IndicatorObjectEntry *entry = &g_array_index(iapp->window_menus, IndicatorObjectEntry, i); g_clear_object(&(entry->label)); g_clear_object(&(entry->menu)); } g_array_free(iapp->window_menus, TRUE); } g_signal_handlers_disconnect_by_data(iapp->matcher, iapp); G_OBJECT_CLASS (indicator_appmenu_parent_class)->finalize (object); return; } static void emit_signal (IndicatorAppmenu * iapp, const gchar * name, GVariant * variant) { GError * error = NULL; g_dbus_connection_emit_signal (iapp->bus, NULL, REG_OBJECT, REG_IFACE, name, variant, &error); if (error != NULL) { g_critical("Unable to send %s signal: %s", name, error->message); g_error_free(error); return; } return; } /* Close the current application using magic */ static void close_current (GtkMenuItem * mi, gpointer user_data) { GdkDisplay *display; IndicatorAppmenu * iapp = INDICATOR_APPMENU(user_data); if (!BAMF_IS_WINDOW (iapp->active_window) || bamf_view_is_closed (BAMF_VIEW (iapp->active_window))) { g_warning("Can't close a window we don't have. Window is either non-existent or recently closed."); return; } guint32 xid = bamf_window_get_xid(iapp->active_window); guint timestamp = gdk_event_get_time(NULL); XEvent xev; xev.xclient.type = ClientMessage; xev.xclient.serial = 0; xev.xclient.send_event = True; xev.xclient.display = gdk_x11_get_default_xdisplay (); xev.xclient.window = xid; xev.xclient.message_type = gdk_x11_atom_to_xatom (gdk_atom_intern ("_NET_CLOSE_WINDOW", TRUE)); xev.xclient.format = 32; xev.xclient.data.l[0] = timestamp; xev.xclient.data.l[1] = 2; /* Client type pager, so it listens to us */ xev.xclient.data.l[2] = 0; xev.xclient.data.l[3] = 0; xev.xclient.data.l[4] = 0; display = gdk_display_get_default (); gdk_x11_display_error_trap_push (display); XSendEvent (gdk_x11_get_default_xdisplay (), gdk_x11_get_default_root_xwindow (), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev); gdk_display_flush (display); gdk_x11_display_error_trap_pop_ignored (display); return; } /* Create the default window menus */ static void build_window_menus (IndicatorAppmenu * iapp) { IndicatorObjectEntry entries[1] = {{0}}; GtkAccelGroup * agroup = gtk_accel_group_new(); GtkMenuItem * mi = NULL; GtkStockItem stockitem; /* Setup the entries for the fallbacks */ iapp->window_menus = g_array_sized_new(FALSE, FALSE, sizeof(IndicatorObjectEntry), 2); G_GNUC_BEGIN_IGNORE_DEPRECATIONS /* File Menu */ if (!gtk_stock_lookup(GTK_STOCK_FILE, &stockitem)) { g_warning("Unable to find the file menu stock item"); stockitem.label = "_File"; } G_GNUC_END_IGNORE_DEPRECATIONS entries[0].label = GTK_LABEL(gtk_label_new_with_mnemonic(stockitem.label)); g_object_ref(G_OBJECT(entries[0].label)); gtk_widget_show(GTK_WIDGET(entries[0].label)); entries[0].menu = GTK_MENU(gtk_menu_new()); g_object_ref(G_OBJECT(entries[0].menu)); G_GNUC_BEGIN_IGNORE_DEPRECATIONS mi = GTK_MENU_ITEM(gtk_image_menu_item_new_from_stock(GTK_STOCK_CLOSE, agroup)); G_GNUC_END_IGNORE_DEPRECATIONS gtk_widget_set_sensitive(GTK_WIDGET(mi), FALSE); g_signal_connect(G_OBJECT(mi), "activate", G_CALLBACK(close_current), iapp); gtk_widget_show(GTK_WIDGET(mi)); gtk_menu_shell_append(GTK_MENU_SHELL(entries[0].menu), GTK_WIDGET(mi)); iapp->close_item = mi; gtk_widget_show(GTK_WIDGET(entries[0].menu)); /* Copy the entries on the stack into the array */ g_array_insert_vals(iapp->window_menus, 0, entries, 1); } /* Determine which windows should be used as the desktop menus. */ static void determine_new_desktop (IndicatorAppmenu * iapp) { GList * keys = g_hash_table_get_keys(iapp->desktop_windows); GList * key; for (key = keys; key != NULL; key = g_list_next(key)) { guint xid = GPOINTER_TO_UINT(key->data); gpointer pwm = g_hash_table_lookup(iapp->apps, GUINT_TO_POINTER(xid)); if (pwm != NULL) { g_debug("Setting Desktop Menus to: %X", xid); iapp->desktop_menu = WINDOW_MENU(pwm); break; } } g_list_free(keys); return; } /* Puts all the windows we care about into the hash table so that we can have a nice list of them. */ static void find_relevant_windows (IndicatorAppmenu * iapp) { GList * windows = bamf_matcher_get_windows(iapp->matcher); GList * lwindow; for (lwindow = windows; lwindow != NULL; lwindow = g_list_next(lwindow)) { BamfView * view = BAMF_VIEW(lwindow->data); new_window(iapp->matcher, view, iapp); } g_list_free(windows); return; } /* When new windows are born, we check to see if they're desktop windows. */ static void new_window (BamfMatcher * matcher, BamfView * view, gpointer user_data) { if (!BAMF_IS_WINDOW(view)) { return; } BamfWindow * window = BAMF_WINDOW(view); IndicatorAppmenu * iapp = INDICATOR_APPMENU(user_data); guint32 xid = bamf_window_get_xid(window); if (iapp->mode == MODE_UNITY_ALL_MENUS) { ensure_menus(iapp, window); return; } if (bamf_window_get_window_type(window) != BAMF_WINDOW_DESKTOP) { return; } g_hash_table_insert(iapp->desktop_windows, GUINT_TO_POINTER(xid), GINT_TO_POINTER(TRUE)); g_debug("New Desktop Window: %X", xid); gpointer pwm = g_hash_table_lookup(iapp->apps, GUINT_TO_POINTER(xid)); if (pwm != NULL) { WindowMenu * wm = WINDOW_MENU(pwm); iapp->desktop_menu = wm; g_debug("Setting Desktop Menus to: %X", xid); if (iapp->active_window == NULL && iapp->default_app == NULL) { switch_default_app(iapp, NULL, NULL); } } } /* When windows leave us, this function gets called */ static void old_window (BamfMatcher * matcher, BamfView * view, gpointer user_data) { if (!BAMF_IS_WINDOW(view)) { return; } IndicatorAppmenu * iapp = INDICATOR_APPMENU(user_data); BamfWindow * window = BAMF_WINDOW(view); guint32 xid = bamf_window_get_xid(window); unregister_window(iapp, xid); return; } /* List of desktop files that shouldn't have menu stubs. */ const static gchar * stubs_blacklist[] = { /* Firefox */ "/firefox.desktop", /* Thunderbird */ "/thunderbird.desktop", /* Open Office */ "/openoffice.org-base.desktop", "/openoffice.org-impress.desktop", "/openoffice.org-calc.desktop", "/openoffice.org-math.desktop", "/openoffice.org-draw.desktop", "/openoffice.org-writer.desktop", /* Blender */ "/blender-fullscreen.desktop", "/blender-windowed.desktop", /* Eclipse */ "/eclipse.desktop", NULL }; /* Check with BAMF, and then check the blacklist of desktop files to see if any are there. Otherwise, show the stubs. */ gboolean show_menu_stubs (BamfApplication * app) { if (bamf_application_get_show_menu_stubs(app) == FALSE) { return FALSE; } const gchar * desktop_file = bamf_application_get_desktop_file(app); if (desktop_file == NULL || desktop_file[0] == '\0') { return TRUE; } int i; for (i = 0; stubs_blacklist[i] != NULL; i++) { if (g_str_has_suffix(desktop_file, stubs_blacklist[i]) == 0) { return FALSE; } } return TRUE; } /* Get the current set of entries */ static GList * get_entries (IndicatorObject * io) { g_return_val_if_fail(IS_INDICATOR_APPMENU(io), NULL); IndicatorAppmenu * iapp = INDICATOR_APPMENU(io); GHashTableIter iter; gpointer value; GList* entries = NULL; if (iapp->mode == MODE_UNITY_ALL_MENUS) { g_hash_table_iter_init(&iter, iapp->apps); while (g_hash_table_iter_next(&iter, NULL, &value)) { GList *app_entries = window_menu_get_entries(WINDOW_MENU (value)); entries = g_list_concat(app_entries, entries); } return entries; } /* If we have a focused app with menus, use it's windows */ if (iapp->default_app != NULL) { return window_menu_get_entries(iapp->default_app); } /* Else, let's go with desktop windows if there isn't a focused window */ if (iapp->active_window == NULL) { if (iapp->desktop_menu == NULL) { return NULL; } else { return window_menu_get_entries(iapp->desktop_menu); } } /* Oh, now we're looking at stubs. */ if (iapp->active_stubs == STUBS_UNKNOWN) { iapp->active_stubs = STUBS_SHOW; BamfApplication * app = bamf_matcher_get_application_for_window(iapp->matcher, iapp->active_window); if (app != NULL) { /* First check to see if we can find an app, then if we can check to see if it has an opinion on whether we should show the stubs or not. */ if (show_menu_stubs(app) == FALSE) { /* If it blocks them, fall out. */ iapp->active_stubs = STUBS_HIDE; } } } if (iapp->active_stubs == STUBS_HIDE) { return NULL; } /* There is only one item in window_menus now, but there was more, and there is likely to be more in the future so we're leaving this here to avoid a possible bug. */ int i; for (i = 0; i < iapp->window_menus->len; i++) { entries = g_list_append(entries, &g_array_index(iapp->window_menus, IndicatorObjectEntry, i)); } return entries; } /* Grabs the location of the entry */ static guint get_location (IndicatorObject * io, IndicatorObjectEntry * entry) { guint count = 0; IndicatorAppmenu * iapp = INDICATOR_APPMENU(io); if (iapp->mode == MODE_UNITY_ALL_MENUS) { GHashTableIter iter; gpointer value; g_hash_table_iter_init(&iter, iapp->apps); while (g_hash_table_iter_next(&iter, NULL, &value)) { count = window_menu_get_location(WINDOW_MENU (value), entry); if (count != G_MAXUINT) return count; } return 0; } if (iapp->default_app != NULL) { /* Find the location in the app */ count = window_menu_get_location(iapp->default_app, entry); } else if (iapp->active_window != NULL && iapp->window_menus) { /* Find the location in the window menus */ for (count = 0; count < iapp->window_menus->len; count++) { if (entry == &g_array_index(iapp->window_menus, IndicatorObjectEntry, count)) { break; } } if (count == iapp->window_menus->len) { g_warning("Unable to find entry in default window menus"); count = G_MAXUINT; } } else { /* Find the location in the desktop menu */ if (iapp->desktop_menu != NULL) { count = window_menu_get_location(iapp->desktop_menu, entry); } } return (count == G_MAXUINT) ? 0 : count; } /* Responds to a menuitem being activated on the panel. */ static void entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp) { return entry_activate_window(io, entry, 0, timestamp); } /* Find the BAMF Window that is associated with that XID. Unfortunately this requires a bit of searching, don't do it too often */ static BamfWindow * xid_to_bamf_window (IndicatorAppmenu * iapp, guint xid) { BamfWindow * newwindow = bamf_matcher_get_window_for_xid(iapp->matcher, xid); if (BAMF_IS_WINDOW(newwindow)) return newwindow; BamfApplication *application = bamf_matcher_get_application_for_xid(iapp->matcher, xid); GList * children = bamf_view_peek_children (BAMF_VIEW (application)); GList * l; for (l = children; l; l = l->next) { if (!BAMF_IS_WINDOW(l->data)) { continue; } BamfWindow * testwindow = BAMF_WINDOW(l->data); if (xid == bamf_window_get_xid(testwindow)) { newwindow = testwindow; break; } } return newwindow; } /* Responds to a menuitem being activated on the panel. */ static void entry_activate_window (IndicatorObject * io, IndicatorObjectEntry * entry, guint windowid, guint timestamp) { WindowMenu * menus = NULL; IndicatorAppmenu * iapp = INDICATOR_APPMENU(io); /* We need to force a focus change in this case as we probably just haven't gotten the signal from BAMF yet */ if (windowid != 0) { BamfWindow * newwindow = xid_to_bamf_window(iapp, windowid); if (newwindow != NULL) { menus = update_active_window(iapp, newwindow); } } if (iapp->mode != MODE_UNITY_ALL_MENUS && iapp->default_app != NULL) { menus = iapp->default_app; if (!menus && iapp->active_window == NULL) { menus = iapp->desktop_menu; } } if (menus) { window_menu_entry_activate(menus, entry, timestamp); } } /* Checks to see we cared about a window that's going away, so that we can deal with that */ static void window_finalized_is_active (gpointer user_data, GObject * old_window) { g_return_if_fail(IS_INDICATOR_APPMENU(user_data)); IndicatorAppmenu * iapp = INDICATOR_APPMENU(user_data); /* Pointer comparison as we can't really trust any of the pointers to do any dereferencing */ if ((gpointer)iapp->active_window != (gpointer)old_window) { /* Ah, no issue, we weren't caring about this one anyway. */ return; } /* We're going to a state where we don't know what the active window is, hopefully BAMF will save us */ active_window_changed(iapp->matcher, NULL, NULL, iapp); return; } /* A helper for switch_default_app that takes care of the switching of the active window variable */ static void switch_active_window (IndicatorAppmenu * iapp, BamfWindow * active_window) { if (iapp->active_window == active_window || iapp->mode == MODE_UNITY_ALL_MENUS) { return; } if (iapp->active_window != NULL) { g_object_weak_unref(G_OBJECT(iapp->active_window), window_finalized_is_active, iapp); } iapp->active_window = active_window; if (iapp->mode == MODE_STANDARD) iapp->active_stubs = STUBS_UNKNOWN; /* Close any existing open menu by showing a null entry */ window_show_menu(iapp->default_app, NULL, gtk_get_current_event_time(), iapp); if (active_window != NULL) { g_object_weak_ref(G_OBJECT(active_window), window_finalized_is_active, iapp); } if (iapp->close_item == NULL) { g_warning("No close item!?!?!"); return; } gtk_widget_set_sensitive(GTK_WIDGET(iapp->close_item), FALSE); if (iapp->active_window == NULL) { return; } guint32 xid = bamf_window_get_xid(iapp->active_window); if (xid == 0 || bamf_view_is_closed (BAMF_VIEW (iapp->active_window))) { return; } GdkWMFunction functions; if (!egg_xid_get_functions(xid, &functions)) { g_debug("Unable to get MWM functions for: %d", xid); functions = GDK_FUNC_ALL; } if (functions & GDK_FUNC_ALL || functions & GDK_FUNC_CLOSE) { gtk_widget_set_sensitive(GTK_WIDGET(iapp->close_item), TRUE); } return; } static void connect_to_menu_signals (IndicatorAppmenu * iapp, WindowMenu * menus) { g_return_if_fail(G_IS_OBJECT(menus)); /* Connect signals */ g_signal_connect(menus, WINDOW_MENU_SIGNAL_ENTRY_ADDED, G_CALLBACK(window_entry_added), iapp); g_signal_connect(menus, WINDOW_MENU_SIGNAL_ENTRY_REMOVED, G_CALLBACK(window_entry_removed), iapp); g_signal_connect(menus, WINDOW_MENU_SIGNAL_STATUS_CHANGED, G_CALLBACK(window_status_changed), iapp); g_signal_connect(menus, WINDOW_MENU_SIGNAL_SHOW_MENU, G_CALLBACK(window_show_menu), iapp); g_signal_connect(menus, WINDOW_MENU_SIGNAL_A11Y_UPDATE, G_CALLBACK(window_a11y_update), iapp); } /* Switch applications, remove all the entires for the previous one and add them for the new application */ static void switch_default_app (IndicatorAppmenu * iapp, WindowMenu * newdef, BamfWindow * active_window) { if (iapp->mode == MODE_UNITY_ALL_MENUS) { return; } if (iapp->default_app == newdef && iapp->default_app != NULL) { /* We've got an app with menus and it hasn't changed. */ /* Keep active window up-to-date, though we're probably not using it much. */ switch_active_window(iapp, active_window); return; } if (iapp->default_app == NULL && iapp->active_window == active_window && newdef == NULL) { /* There's no application menus, but the active window hasn't changed. So there's no change. */ return; } /* hide the entries that we're swapping out */ indicator_object_set_visible (INDICATOR_OBJECT(iapp), FALSE); if (iapp->default_app) { /* Disconnect signals */ g_signal_handlers_disconnect_by_data(iapp->default_app, iapp); /* Default App is NULL, let's see if it needs replacement */ iapp->default_app = NULL; } /* Update the active window pointer -- may be NULL */ switch_active_window(iapp, active_window); /* If we're putting up a new window, let's do that now. */ if (newdef != NULL) { /* Switch */ iapp->default_app = newdef; connect_to_menu_signals(iapp, iapp->default_app); } /* show the entries that we're swapping in */ indicator_object_set_visible (INDICATOR_OBJECT(iapp), TRUE); /* Set up initial state for new entries if needed */ if (iapp->default_app != NULL && window_menu_get_status (iapp->default_app) != WINDOW_MENU_STATUS_NORMAL) { window_status_changed(iapp->default_app, window_menu_get_status (iapp->default_app), iapp); } return; } static void track_menus (IndicatorAppmenu * iapp, guint xid, WindowMenu * menus) { g_return_if_fail(IS_WINDOW_MENU(menus)); g_hash_table_insert(iapp->apps, GUINT_TO_POINTER(xid), menus); if (iapp->mode == MODE_UNITY_ALL_MENUS) { GList *entries, *l; WindowMenuStatus status; connect_to_menu_signals(iapp, menus); entries = window_menu_get_entries(menus); status = window_menu_get_status(menus); for (l = entries; l; l = l->next) { window_entry_added(menus, l->data, iapp); } if (status != WINDOW_MENU_STATUS_ACTIVE) { window_status_changed(menus, status, iapp); } g_list_free(entries); } } static WindowMenu * ensure_menus (IndicatorAppmenu * iapp, BamfWindow * window) { WindowMenu * menus = NULL; guint32 xid = 0; while (window != NULL && menus == NULL) { xid = bamf_window_get_xid(window); menus = g_hash_table_lookup(iapp->apps, GUINT_TO_POINTER(xid)); /* First look to see if we can get these from the GMenuModel access */ if (menus == NULL) { gchar * uniquename = bamf_window_get_utf8_prop (window, "_GTK_UNIQUE_BUS_NAME"); if (uniquename != NULL && bamf_window_get_window_type (window) != BAMF_WINDOW_DESKTOP) { BamfApplication * app = bamf_matcher_get_application_for_window(iapp->matcher, window); menus = WINDOW_MENU(window_menu_model_new(app, window)); track_menus(iapp, xid, menus); } g_free(uniquename); } if (menus == NULL) { g_debug("Looking for parent window on XID %d", xid); window = bamf_window_get_transient(window); } } return menus; } /* Recieve the signal that the window being shown has now changed. */ static void active_window_changed (BamfMatcher * matcher, BamfView * oldview, BamfView * newview, gpointer user_data) { update_active_window(INDICATOR_APPMENU(user_data), (BamfWindow *) newview); } static WindowMenu * update_active_window (IndicatorAppmenu * appmenu, BamfWindow *window) { WindowMenu * menus = NULL; if (window != NULL) { if (!BAMF_IS_WINDOW(window)) { window = NULL; g_warning("Active window changed to View thats not a window."); } } else { g_debug("Active window is: NULL"); } if (appmenu->mode == MODE_UNITY_ALL_MENUS) { if (window != NULL) { menus = ensure_menus(appmenu, window); } return menus; } if (window != NULL && bamf_window_get_window_type(window) == BAMF_WINDOW_DESKTOP) { g_debug("Switching to menus from desktop"); switch_default_app(appmenu, NULL, NULL); return menus; } g_debug("Switching to menus from XID %d", window ? bamf_window_get_xid(window) : 0); menus = ensure_menus(appmenu, window); switch_default_app(appmenu, menus, window); return menus; } /* Respond to the menus being destroyed. We need to deregister and make sure we weren't being shown. */ static void menus_destroyed (IndicatorAppmenu * iapp, guint windowid) { gboolean reload_menus = FALSE; WindowMenu * wm = g_hash_table_lookup(iapp->apps, GUINT_TO_POINTER(windowid)); g_return_if_fail (IS_WINDOW_MENU(wm)); g_hash_table_steal(iapp->apps, GUINT_TO_POINTER(windowid)); g_signal_handlers_disconnect_by_data(wm, iapp); g_debug("Removing menus for %d", windowid); if (iapp->desktop_menu == wm) { iapp->desktop_menu = NULL; determine_new_desktop(iapp); if (iapp->default_app == NULL && iapp->active_window == NULL) { reload_menus = TRUE; } } /* If we're it, let's remove ourselves and BAMF will probably give us a new entry in a bit. */ if (iapp->default_app == wm) { reload_menus = TRUE; } if (reload_menus) { switch_default_app(iapp, NULL, NULL); } if (iapp->mode == MODE_UNITY_ALL_MENUS) { GList * entries, * l; entries = window_menu_get_entries(wm); for (l = entries; l; l = l->next) { window_entry_removed(wm, l->data, iapp); } g_list_free(entries); } g_object_unref(wm); } /* A new window wishes to register it's windows with us */ static GVariant * register_window (IndicatorAppmenu * iapp, guint windowid, const gchar * objectpath, const gchar * sender) { g_debug("Registering window ID %d with path %s from %s", windowid, objectpath, sender); if (g_hash_table_lookup(iapp->apps, GUINT_TO_POINTER(windowid)) == NULL && windowid != 0) { WindowMenu * wm = WINDOW_MENU(window_menu_dbusmenu_new(windowid, sender, objectpath)); g_return_val_if_fail(wm != NULL, FALSE); track_menus(iapp, windowid, wm); emit_signal(iapp, "WindowRegistered", g_variant_new("(uso)", windowid, sender, objectpath)); gpointer pdesktop = g_hash_table_lookup(iapp->desktop_windows, GUINT_TO_POINTER(windowid)); if (pdesktop != NULL) { determine_new_desktop(iapp); } /* Note: Does not cause ref */ BamfWindow * win = bamf_matcher_get_active_window(iapp->matcher); update_active_window(iapp, win); } else { if (windowid == 0) { g_warning("Can't build windows for a NULL window ID %d with path %s from %s", windowid, objectpath, sender); } else { g_warning("Already have a menu for window ID %d with path %s from %s, unregistering that one", windowid, objectpath, sender); unregister_window(iapp, windowid); /* NOTE: So we're doing a lookup here. That seems pretty useless now doesn't it. It's for a good reason. We're going recursive with a pretty complex set of functions we want to ensure that we're not going to end up infinitely recursive otherwise things could go really bad. */ if (g_hash_table_lookup(iapp->apps, GUINT_TO_POINTER(windowid)) == NULL) { return register_window(iapp, windowid, objectpath, sender); } g_warning("Unable to unregister window!"); } } return g_variant_new("()"); } /* Kindly remove an entry from our DB */ static GVariant * unregister_window (IndicatorAppmenu * iapp, guint windowid) { g_debug("Unregistering: %d", windowid); g_return_val_if_fail(IS_INDICATOR_APPMENU(iapp), NULL); g_return_val_if_fail(iapp->matcher != NULL, NULL); /* If it's a desktop window remove it from that table as well */ g_hash_table_remove(iapp->desktop_windows, GUINT_TO_POINTER(windowid)); emit_signal(iapp, "WindowUnregistered", g_variant_new ("(u)", windowid)); menus_destroyed(iapp, windowid); return NULL; } /* Grab the menu information for a specific window */ static GVariant * get_menu_for_window (IndicatorAppmenu * iapp, guint windowid, GError ** error) { WindowMenu * wm = NULL; if (windowid == 0) { wm = iapp->default_app; } else { wm = WINDOW_MENU(g_hash_table_lookup(iapp->apps, GUINT_TO_POINTER(windowid))); } if (wm == NULL) { g_set_error_literal(error, error_quark(), ERROR_WINDOW_NOT_FOUND, "Window not found"); return NULL; } GVariantBuilder builder; g_variant_builder_init(&builder, G_VARIANT_TYPE_TUPLE); if (IS_WINDOW_MENU_DBUSMENU(wm)) { gchar * address = window_menu_dbusmenu_get_address(WINDOW_MENU_DBUSMENU(wm)); gchar * path = window_menu_dbusmenu_get_path(WINDOW_MENU_DBUSMENU(wm)); g_variant_builder_add_value(&builder, g_variant_new_string(address)); g_variant_builder_add_value(&builder, g_variant_new_object_path(path)); g_free(path); g_free(address); } else { g_variant_builder_add_value(&builder, g_variant_new_string("")); g_variant_builder_add_value(&builder, g_variant_new_object_path("/")); } return g_variant_builder_end(&builder); } /* Get all the menus we have */ static GVariant * get_menus (IndicatorAppmenu * iapp, GError ** error) { if (iapp->apps == NULL) { g_set_error_literal(error, error_quark(), ERROR_NO_APPLICATIONS, "No applications are registered"); return NULL; } GVariantBuilder builder; GHashTableIter hash_iter; gpointer value; g_variant_builder_init (&builder, G_VARIANT_TYPE("a(uso)")); g_hash_table_iter_init (&hash_iter, iapp->apps); while (g_hash_table_iter_next (&hash_iter, NULL, &value)) { if (value != NULL) { WindowMenu * wm = WINDOW_MENU(value); if (IS_WINDOW_MENU_DBUSMENU(wm)) { gchar * address = window_menu_dbusmenu_get_address(WINDOW_MENU_DBUSMENU(wm)); gchar * path = window_menu_dbusmenu_get_path(WINDOW_MENU_DBUSMENU(wm)); g_variant_builder_add (&builder, "(uso)", window_menu_get_xid(wm), address, path); g_free(path); g_free(address); } else { g_variant_builder_add (&builder, "(uso)", window_menu_get_xid(wm), "", "/"); } } } return g_variant_new ("(a(uso))", &builder); } /* A method has been called from our dbus inteface. Figure out what it is and dispatch it. */ static void bus_method_call (GDBusConnection * connection, const gchar * sender, const gchar * object_path, const gchar * interface, const gchar * method, GVariant * params, GDBusMethodInvocation * invocation, gpointer user_data) { IndicatorAppmenu * iapp = INDICATOR_APPMENU(user_data); GVariant * retval = NULL; GError * error = NULL; if (g_strcmp0(method, "RegisterWindow") == 0) { guint32 xid; const gchar * path; g_variant_get(params, "(u&o)", &xid, &path); retval = register_window(iapp, xid, path, sender); } else if (g_strcmp0(method, "UnregisterWindow") == 0) { guint32 xid; g_variant_get(params, "(u)", &xid); retval = unregister_window(iapp, xid); } else if (g_strcmp0(method, "GetMenuForWindow") == 0) { guint32 xid; g_variant_get(params, "(u)", &xid); retval = get_menu_for_window(iapp, xid, &error); } else if (g_strcmp0(method, "GetMenus") == 0) { retval = get_menus(iapp, &error); } else { g_warning("Calling method '%s' on the indicator service and it's unknown", method); } if (error != NULL) { g_dbus_method_invocation_return_dbus_error(invocation, "com.canonical.AppMenu.Error", error->message); g_error_free(error); } else { g_dbus_method_invocation_return_value(invocation, retval); } return; } /* Pass up the entry added event */ static void window_entry_added (WindowMenu * mw, IndicatorObjectEntry * entry, IndicatorAppmenu * iapp) { entry->parent_object = INDICATOR_OBJECT(iapp); g_signal_emit_by_name(G_OBJECT(iapp), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED, entry); } /* Pass up the entry removed event */ static void window_entry_removed (WindowMenu * mw, IndicatorObjectEntry * entry, IndicatorAppmenu * iapp) { entry->parent_object = INDICATOR_OBJECT(iapp); g_signal_emit_by_name(G_OBJECT(iapp), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED, entry); } /* Pass up the status changed event */ static void window_status_changed (WindowMenu * mw, DbusmenuStatus status, IndicatorAppmenu * iapp) { gboolean show_now = (status == DBUSMENU_STATUS_NOTICE); GList * l, * window_entries = window_menu_get_entries(mw); for (l = window_entries; l; l = l->next) { IndicatorObjectEntry * entry = l->data; g_signal_emit(G_OBJECT(iapp), INDICATOR_OBJECT_SIGNAL_SHOW_NOW_CHANGED_ID, 0, entry, show_now); } g_list_free (window_entries); } /* Pass up the show menu event */ static void window_show_menu (WindowMenu * mw, IndicatorObjectEntry * entry, guint timestamp, gpointer user_data) { g_signal_emit_by_name(G_OBJECT(user_data), INDICATOR_OBJECT_SIGNAL_MENU_SHOW, entry, timestamp); } /* Pass up the accessible string update */ static void window_a11y_update (WindowMenu * mw, IndicatorObjectEntry * entry, gpointer user_data) { g_signal_emit_by_name(G_OBJECT(user_data), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE, entry); } /********************** DEBUG INTERFACE **********************/ /* Builds the error quark if we need it, otherwise just returns the same value */ static GQuark error_quark (void) { static GQuark error_quark = 0; if (error_quark == 0) { error_quark = g_quark_from_static_string("indicator-appmenu"); } return error_quark; } indicator-appmenu.git/src/window-menu-dbusmenu.c0000664000000000000000000007141715154240054017205 0ustar /* An implementation of indicator object showing menus from applications. Copyright 2010 Canonical Ltd. Authors: Ted Gould This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, SATISFACTORY QUALITY, 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 . */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "window-menu-dbusmenu.h" #include "indicator-appmenu-marshal.h" /* Private parts */ typedef struct _WindowMenuDbusmenuPrivate WindowMenuDbusmenuPrivate; struct _WindowMenuDbusmenuPrivate { guint windowid; DbusmenuGtkClient * client; DbusmenuMenuitem * root; GCancellable * props_cancel; GDBusProxy * props; GArray * entries; gboolean error_state; guint retry_timer; }; typedef struct _WMEntry WMEntry; struct _WMEntry { IndicatorObjectEntry ioentry; gboolean disabled; gboolean hidden; DbusmenuMenuitem * mi; WindowMenuDbusmenu * wm; GVariant * vaccessible_desc; }; #define WINDOW_MENU_DBUSMENU_GET_PRIVATE(o) \ (window_menu_dbusmenu_get_instance_private (WINDOW_MENU_DBUSMENU(o))) /* Prototypes */ static void window_menu_dbusmenu_dispose (GObject *object); static void root_changed (DbusmenuClient * client, DbusmenuMenuitem * new_root, gpointer user_data); static void event_status (DbusmenuClient * client, DbusmenuMenuitem * mi, gchar * event, GVariant * evdata, guint timestamp, GError * error, gpointer user_data); static void item_activate (DbusmenuClient * client, DbusmenuMenuitem * item, guint timestamp, gpointer user_data); static void status_changed (DbusmenuClient * client, GParamSpec * pspec, gpointer user_data); static void menu_entry_added (DbusmenuMenuitem * root, DbusmenuMenuitem * newentry, guint position, gpointer user_data); static void menu_entry_removed (DbusmenuMenuitem * root, DbusmenuMenuitem * oldentry, gpointer user_data); static void menu_entry_realized (DbusmenuMenuitem * newentry, gpointer user_data); static void menu_entry_realized_child_added (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint position, gpointer user_data); static void menu_prop_changed (DbusmenuMenuitem * item, const gchar * property, GVariant * value, gpointer user_data); static void menu_child_realized (DbusmenuMenuitem * child, gpointer user_data); static void props_cb (GObject * object, GAsyncResult * res, gpointer user_data); static GList * get_entries (WindowMenu * wm); static guint get_location (WindowMenu * wm, IndicatorObjectEntry * entry); static guint get_xid (WindowMenu * wm); static gboolean get_error_state (WindowMenu * wm); static WindowMenuStatus get_status (WindowMenu * wm); static void entry_restore (WindowMenu * wm, IndicatorObjectEntry * entry); static void entry_activate (WindowMenu * wm, IndicatorObjectEntry * entry, guint timestamp); G_DEFINE_TYPE_WITH_PRIVATE (WindowMenuDbusmenu, window_menu_dbusmenu, WINDOW_MENU_TYPE); /* Build the one-time class */ static void window_menu_dbusmenu_class_init (WindowMenuDbusmenuClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = window_menu_dbusmenu_dispose; WindowMenuClass * menu_class = WINDOW_MENU_CLASS(klass); menu_class->get_entries = get_entries; menu_class->get_location = get_location; menu_class->get_xid = get_xid; menu_class->get_error_state = get_error_state; menu_class->get_status = get_status; menu_class->entry_restore = entry_restore; menu_class->entry_activate = entry_activate; return; } /* Initialize the per-instance data */ static void window_menu_dbusmenu_init (WindowMenuDbusmenu *self) { WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(self); priv->client = NULL; priv->props_cancel = NULL; priv->props = NULL; priv->root = NULL; priv->error_state = FALSE; priv->entries = g_array_new(FALSE, FALSE, sizeof(WMEntry *)); return; } static void entry_free(IndicatorObjectEntry * entry) { g_return_if_fail(entry != NULL); WMEntry * wmentry = (WMEntry *)entry; if (wmentry->mi != NULL) { g_signal_handlers_disconnect_by_func(wmentry->mi, G_CALLBACK(menu_prop_changed), &wmentry->ioentry); g_object_unref(G_OBJECT(wmentry->mi)); wmentry->mi = NULL; } if (entry->label != NULL) { g_object_unref(entry->label); entry->label = NULL; } if (entry->accessible_desc != NULL) { entry->accessible_desc = NULL; } g_clear_pointer(&wmentry->vaccessible_desc, g_variant_unref); if (entry->image != NULL) { g_object_unref(entry->image); entry->image = NULL; } if (entry->menu != NULL) { g_signal_handlers_disconnect_by_func(entry->menu, G_CALLBACK(gtk_widget_destroyed), &entry->menu); g_object_unref(entry->menu); entry->menu = NULL; } g_free(entry); } static void free_entries(GObject *object, gboolean should_signal) { g_return_if_fail(IS_WINDOW_MENU_DBUSMENU(object)); WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(object); if (priv->entries != NULL) { while (priv->entries->len > 0) { IndicatorObjectEntry * entry; entry = g_array_index(priv->entries, IndicatorObjectEntry *, 0); g_array_remove_index(priv->entries, 0); if (should_signal) { g_signal_emit_by_name(object, WINDOW_MENU_SIGNAL_ENTRY_REMOVED, entry, TRUE); } entry_free(entry); } } } /* Destroy objects */ static void window_menu_dbusmenu_dispose (GObject *object) { WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(object); free_entries(object, FALSE); if (priv->entries != NULL) { g_array_free(priv->entries, TRUE); priv->entries = NULL; } if (priv->root != NULL) { root_changed(DBUSMENU_CLIENT(priv->client), NULL, object); g_warn_if_fail(priv->root == NULL); } if (priv->client != NULL) { g_signal_handlers_disconnect_by_data(priv->client, object); g_object_unref(G_OBJECT(priv->client)); priv->client = NULL; } if (priv->props != NULL) { g_object_unref(G_OBJECT(priv->props)); priv->props = NULL; } if (priv->props_cancel != NULL) { g_cancellable_cancel(priv->props_cancel); g_object_unref(priv->props_cancel); priv->props_cancel = NULL; } if (priv->retry_timer != 0) { g_source_remove(priv->retry_timer); priv->retry_timer = 0; } G_OBJECT_CLASS (window_menu_dbusmenu_parent_class)->dispose (object); return; } /* Retry the event sending to the server to see if we can get things working again. */ static gboolean retry_event (gpointer user_data) { g_debug("Retrying event"); g_return_val_if_fail(IS_WINDOW_MENU_DBUSMENU(user_data), FALSE); WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(user_data); dbusmenu_menuitem_handle_event(dbusmenu_client_get_root(DBUSMENU_CLIENT(priv->client)), "x-appmenu-retry-ping", NULL, 0); priv->retry_timer = 0; return FALSE; } /* Listen to whether our events are successfully sent */ static void event_status (DbusmenuClient * client, DbusmenuMenuitem * mi, gchar * event, GVariant * evdata, guint timestamp, GError * error, gpointer user_data) { g_return_if_fail(IS_WINDOW_MENU_DBUSMENU(user_data)); WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(user_data); /* We don't care about status where there are no errors when we're in a happy state, just let them go. */ if (error == NULL && priv->error_state == FALSE) { return; } int i; /* Oh, things are working now! */ if (error == NULL) { g_debug("Error state repaired"); priv->error_state = FALSE; g_signal_emit_by_name(G_OBJECT(user_data), WINDOW_MENU_SIGNAL_ERROR_STATE, priv->error_state, TRUE); for (i = 0; i < priv->entries->len; i++) { IndicatorObjectEntry * entry = g_array_index(priv->entries, IndicatorObjectEntry *, i); entry_restore(WINDOW_MENU(user_data), entry); } if (priv->retry_timer != 0) { g_source_remove(priv->retry_timer); priv->retry_timer = 0; } return; } /* Uhg, means that events are breaking, now we need to try and handle that case. */ priv->error_state = TRUE; g_signal_emit_by_name(G_OBJECT(user_data), WINDOW_MENU_SIGNAL_ERROR_STATE, priv->error_state, TRUE); for (i = 0; i < priv->entries->len; i++) { IndicatorObjectEntry * entry = g_array_index(priv->entries, IndicatorObjectEntry *, i); if (entry->label != NULL) { gtk_widget_set_sensitive(GTK_WIDGET(entry->label), FALSE); } if (entry->image != NULL) { gtk_widget_set_sensitive(GTK_WIDGET(entry->image), FALSE); } } if (priv->retry_timer == 0) { g_debug("Setting up retry timer"); priv->retry_timer = g_timeout_add_seconds(1, retry_event, user_data); } return; } static IndicatorObjectEntry * get_entry(WindowMenuDbusmenu *wm, DbusmenuMenuitem * item, guint *index) { WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(wm); guint position = 0; for (position = 0; position < priv->entries->len; ++position) { WMEntry * entry = g_array_index(priv->entries, WMEntry *, position); if (entry->mi == item) { if (index != NULL) { *index = position; } return &entry->ioentry; } } /* Not found */ return NULL; } /* Called when a menu item wants to be displayed. We need to see if it's one of our root items and pass it up if so. */ static void item_activate (DbusmenuClient * client, DbusmenuMenuitem * item, guint timestamp, gpointer user_data) { g_return_if_fail(IS_WINDOW_MENU_DBUSMENU(user_data)); WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(user_data); if (priv->root == NULL) { return; } IndicatorObjectEntry * entry = get_entry(WINDOW_MENU_DBUSMENU(user_data), item, NULL); if (entry == NULL) { /* Not found */ return; } g_signal_emit_by_name(G_OBJECT(user_data), WINDOW_MENU_SIGNAL_SHOW_MENU, entry, timestamp, TRUE); return; } /* Called when the client changes its status. Used to show panel if requested. (Say, by an Alt press.) */ static void status_changed (DbusmenuClient * client, GParamSpec * pspec, gpointer user_data) { g_signal_emit_by_name(G_OBJECT(user_data), WINDOW_MENU_SIGNAL_STATUS_CHANGED, dbusmenu_client_get_status (client)); } WindowMenuStatus dbusmenu_status_table[] = { [DBUSMENU_STATUS_NORMAL] = WINDOW_MENU_STATUS_NORMAL, [DBUSMENU_STATUS_NOTICE] = WINDOW_MENU_STATUS_ACTIVE }; static WindowMenuStatus get_status (WindowMenu * wm) { g_return_val_if_fail(IS_WINDOW_MENU_DBUSMENU(wm), DBUSMENU_STATUS_NORMAL); WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(wm); return dbusmenu_status_table[dbusmenu_client_get_status (DBUSMENU_CLIENT (priv->client))]; } /* Build a new window menus object and attach to the signals to build up the representative menu. */ WindowMenuDbusmenu * window_menu_dbusmenu_new (const guint windowid, const gchar * dbus_addr, const gchar * dbus_object) { g_debug("Creating new windows menu: %X, %s, %s", windowid, dbus_addr, dbus_object); g_return_val_if_fail(windowid != 0, NULL); g_return_val_if_fail(dbus_addr != NULL, NULL); g_return_val_if_fail(dbus_object != NULL, NULL); WindowMenuDbusmenu * newmenu = WINDOW_MENU_DBUSMENU(g_object_new(WINDOW_MENU_DBUSMENU_TYPE, NULL)); WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(newmenu); priv->windowid = windowid; /* Build the service proxy */ priv->props_cancel = g_cancellable_new(); g_object_ref(newmenu); /* Take a ref for the async callback */ g_dbus_proxy_new_for_bus(G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, NULL, dbus_addr, dbus_object, "org.freedesktop.DBus.Properties", priv->props_cancel, props_cb, newmenu); priv->client = dbusmenu_gtkclient_new((gchar *)dbus_addr, (gchar *)dbus_object); GtkAccelGroup * agroup = gtk_accel_group_new(); dbusmenu_gtkclient_set_accel_group(priv->client, agroup); g_object_unref(agroup); g_signal_connect(G_OBJECT(priv->client), DBUSMENU_GTKCLIENT_SIGNAL_ROOT_CHANGED, G_CALLBACK(root_changed), newmenu); g_signal_connect(G_OBJECT(priv->client), DBUSMENU_CLIENT_SIGNAL_EVENT_RESULT, G_CALLBACK(event_status), newmenu); g_signal_connect(G_OBJECT(priv->client), DBUSMENU_CLIENT_SIGNAL_ITEM_ACTIVATE, G_CALLBACK(item_activate), newmenu); g_signal_connect(G_OBJECT(priv->client), "notify::" DBUSMENU_CLIENT_PROP_STATUS, G_CALLBACK(status_changed), newmenu); DbusmenuMenuitem * root = dbusmenu_client_get_root(DBUSMENU_CLIENT(priv->client)); if (root != NULL) { root_changed(DBUSMENU_CLIENT(priv->client), root, newmenu); } return newmenu; } /* Callback from trying to create the proxy for the service, this could include starting the service. */ static void props_cb (GObject * object, GAsyncResult * res, gpointer user_data) { GError * error = NULL; GDBusProxy * proxy = g_dbus_proxy_new_for_bus_finish(res, &error); if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { g_error_free (error); return; // Must exit before accessing freed memory } WindowMenuDbusmenu * self = WINDOW_MENU_DBUSMENU(user_data); g_return_if_fail(self != NULL); WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(self); if (priv->props_cancel != NULL) { g_object_unref(priv->props_cancel); priv->props_cancel = NULL; } if (error != NULL) { g_warning("Could not grab DBus proxy for window %u: %s", priv->windowid, error->message); g_error_free(error); goto out; } /* Okay, we're good to grab the proxy at this point, we're sure that it's ours. */ priv->props = proxy; out: g_object_unref(G_OBJECT(self)); return; } /* Get the location of this entry */ static guint get_location (WindowMenu * wm, IndicatorObjectEntry * entry) { g_return_val_if_fail(IS_WINDOW_MENU_DBUSMENU(wm), 0); if (entry == NULL) { return G_MAXUINT; } guint i; WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(wm); for (i = 0; i < priv->entries->len; i++) { if (entry == g_array_index(priv->entries, IndicatorObjectEntry *, i)) { break; } } if (i == priv->entries->len) { return G_MAXUINT; } return i; } /* Get the entries that we have */ static GList * get_entries (WindowMenu * wm) { g_return_val_if_fail(IS_WINDOW_MENU_DBUSMENU(wm), NULL); WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(wm); int i; GList * output = NULL; for (i = 0; i < priv->entries->len; i++) { output = g_list_prepend(output, g_array_index(priv->entries, IndicatorObjectEntry *, i)); } if (output != NULL) { output = g_list_reverse(output); } return output; } /* Goes through the items in the root node and adds them to the flock */ static void new_root_helper (DbusmenuMenuitem * item, gpointer user_data) { WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(user_data); menu_entry_added(dbusmenu_client_get_root(DBUSMENU_CLIENT(priv->client)), item, priv->entries->len, user_data); return; } /* Remove the various signals that we attach to menuitems to ensure they don't pop up later. */ static void remove_menuitem_signals (DbusmenuMenuitem * mi, gpointer user_data) { g_signal_handlers_disconnect_by_func(G_OBJECT(mi), G_CALLBACK(menu_entry_realized), user_data); g_signal_handlers_disconnect_by_func(G_OBJECT(mi), G_CALLBACK(menu_entry_realized_child_added), user_data); g_signal_handlers_disconnect_matched(mi, G_SIGNAL_MATCH_FUNC, 0, 0, 0, menu_child_realized, NULL); g_signal_handlers_disconnect_matched(mi, G_SIGNAL_MATCH_FUNC, 0, 0, 0, menu_prop_changed, NULL); return; } /* Respond to the root menu item on our client changing */ static void root_changed (DbusmenuClient * client, DbusmenuMenuitem * new_root, gpointer user_data) { g_return_if_fail(IS_WINDOW_MENU_DBUSMENU(user_data)); WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(user_data); /* Remove the old entries */ free_entries(G_OBJECT(user_data), TRUE); if (priv->root != NULL) { dbusmenu_menuitem_foreach(priv->root, remove_menuitem_signals, user_data); g_signal_handlers_disconnect_by_data(priv->root, user_data); g_object_unref(priv->root); } priv->root = new_root; /* See if we've got new entries */ if (new_root == NULL) { return; } g_object_ref(priv->root); /* Set up signals */ g_signal_connect(G_OBJECT(new_root), DBUSMENU_MENUITEM_SIGNAL_CHILD_ADDED, G_CALLBACK(menu_entry_added), user_data); g_signal_connect(G_OBJECT(new_root), DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED, G_CALLBACK(menu_entry_removed), user_data); /* TODO: Child Moved */ /* Add the new entries */ GList * children = dbusmenu_menuitem_get_children(new_root); while (children != NULL) { new_root_helper(DBUSMENU_MENUITEM(children->data), user_data); children = g_list_next(children); } return; } /* Respond to an entry getting added to the menu */ static void menu_entry_added (DbusmenuMenuitem * root, DbusmenuMenuitem * newentry, guint position, gpointer user_data) { g_return_if_fail(IS_WINDOW_MENU_DBUSMENU(user_data)); WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(user_data); g_signal_connect(G_OBJECT(newentry), DBUSMENU_MENUITEM_SIGNAL_REALIZED, G_CALLBACK(menu_entry_realized), user_data); GtkMenuItem * mi = dbusmenu_gtkclient_menuitem_get(priv->client, newentry); if (mi != NULL) { menu_entry_realized(newentry, user_data); } return; } /* A small clean up function to ensure that the data gets free'd and the ref lost in all cases. */ static void child_realized_data_cleanup (gpointer user_data, GClosure * closure) { gpointer * data = (gpointer *)user_data; g_object_unref(data[1]); g_free(user_data); return; } /* This is the callback for when we're done waiting for a new entry to have children */ static void menu_entry_realized_child_added (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint position, gpointer user_data) { /* Child added may be called more than once, so make sure we only handle it once by disconnecting. */ g_signal_handlers_disconnect_by_func(G_OBJECT(parent), G_CALLBACK(menu_entry_realized_child_added), user_data); menu_entry_realized (parent, user_data); } /* React to the menuitem when we know that it's got all the data that we really need. */ static void menu_entry_realized (DbusmenuMenuitem * newentry, gpointer user_data) { g_return_if_fail(IS_WINDOW_MENU_DBUSMENU(user_data)); WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(user_data); GtkMenu * menu = dbusmenu_gtkclient_menuitem_get_submenu(priv->client, newentry); /* Check to see if we have any children, if we don't let's see if we can scare some up for fun. */ GList * children = dbusmenu_menuitem_get_children(newentry); if (children == NULL && g_strcmp0(DBUSMENU_MENUITEM_CHILD_DISPLAY_SUBMENU, dbusmenu_menuitem_property_get(newentry, DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY)) == 0) { dbusmenu_menuitem_send_about_to_show(newentry, NULL, NULL); } if (menu == NULL) { if (children != NULL) { gpointer * data = g_new(gpointer, 2); data[0] = user_data; data[1] = (DbusmenuMenuitem*)g_object_ref(newentry); g_signal_connect_data(G_OBJECT(children->data), DBUSMENU_MENUITEM_SIGNAL_REALIZED, G_CALLBACK(menu_child_realized), data, child_realized_data_cleanup, 0); } else { /* Menu entry has no children */ gpointer * data = g_new(gpointer, 2); data[0] = user_data; data[1] = (DbusmenuMenuitem*)g_object_ref(newentry); /* Make sure the menu item gets displayed on the menu bar */ menu_child_realized(NULL, data); g_free (data); g_signal_connect(G_OBJECT(newentry), DBUSMENU_MENUITEM_SIGNAL_CHILD_ADDED, G_CALLBACK(menu_entry_realized_child_added), user_data); } } else { gpointer * data = g_new(gpointer, 2); data[0] = user_data; data[1] = newentry; menu_child_realized(NULL, data); g_free (data); } return; } /* Respond to properties changing on the menu item so that we can properly hide and show them. */ static void menu_prop_changed (DbusmenuMenuitem * item, const gchar * property, GVariant * value, gpointer user_data) { IndicatorObjectEntry * entry = (IndicatorObjectEntry *)user_data; WMEntry * wmentry = (WMEntry *)user_data; if (!g_strcmp0(property, DBUSMENU_MENUITEM_PROP_VISIBLE)) { if (g_variant_get_boolean(value)) { gtk_widget_show(GTK_WIDGET(entry->label)); wmentry->hidden = FALSE; } else { gtk_widget_hide(GTK_WIDGET(entry->label)); wmentry->hidden = TRUE; } } else if (!g_strcmp0(property, DBUSMENU_MENUITEM_PROP_ENABLED)) { gtk_widget_set_sensitive(GTK_WIDGET(entry->label), g_variant_get_boolean(value)); wmentry->disabled = !g_variant_get_boolean(value); } else if (!g_strcmp0(property, DBUSMENU_MENUITEM_PROP_LABEL)) { const gchar* str = g_variant_get_string(value, NULL); if(str != NULL) gtk_label_set_text_with_mnemonic(entry->label, str); g_clear_pointer(&wmentry->vaccessible_desc, g_variant_unref); entry->accessible_desc = g_variant_get_string(value, NULL); wmentry->vaccessible_desc = g_variant_ref(value); if (wmentry->wm != NULL) { g_signal_emit_by_name(G_OBJECT(wmentry->wm), WINDOW_MENU_SIGNAL_A11Y_UPDATE, entry, TRUE); } } return; } /* We can't go until we have some kids. Really, it's important. */ static void menu_child_realized (DbusmenuMenuitem * child, gpointer user_data) { /* Grab our values out to stack variables */ DbusmenuMenuitem * newentry = DBUSMENU_MENUITEM(((gpointer *)user_data)[1]); WindowMenuDbusmenu * wm = WINDOW_MENU_DBUSMENU(((gpointer *)user_data)[0]); g_return_if_fail(newentry != NULL); g_return_if_fail(wm != NULL); /* Disconnection below will drop the ref for this signal handler, let's make sure that's not a problem */ g_object_ref(G_OBJECT(newentry)); /* Only care about the first */ /* This will cause the cleanup function attached to the signal handler to be run. */ if (child != NULL) { g_signal_handlers_disconnect_by_func(G_OBJECT(child), menu_child_realized, user_data); } WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(wm); WMEntry * wmentry = g_new0(WMEntry, 1); wmentry->wm = wm; IndicatorObjectEntry * entry = &wmentry->ioentry; entry->parent_window = priv->windowid; wmentry->mi = newentry; g_object_ref(G_OBJECT(wmentry->mi)); entry->label = GTK_LABEL(gtk_label_new_with_mnemonic(dbusmenu_menuitem_property_get(newentry, DBUSMENU_MENUITEM_PROP_LABEL))); if (entry->label != NULL) { g_object_ref_sink(entry->label); } g_clear_pointer(&wmentry->vaccessible_desc, g_variant_unref); wmentry->vaccessible_desc = g_variant_ref(dbusmenu_menuitem_property_get_variant(newentry, DBUSMENU_MENUITEM_PROP_LABEL)); entry->accessible_desc = g_variant_get_string(wmentry->vaccessible_desc, NULL); entry->menu = dbusmenu_gtkclient_menuitem_get_submenu(priv->client, newentry); if (entry->menu == NULL) { g_debug("Submenu for %s is NULL", dbusmenu_menuitem_property_get(newentry, DBUSMENU_MENUITEM_PROP_LABEL)); } else { g_object_ref(entry->menu); gtk_menu_detach(entry->menu); g_signal_connect(entry->menu, "destroy", G_CALLBACK(gtk_widget_destroyed), &entry->menu); } g_signal_connect(G_OBJECT(newentry), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(menu_prop_changed), entry); if (dbusmenu_menuitem_property_get_variant(newentry, DBUSMENU_MENUITEM_PROP_VISIBLE) != NULL && dbusmenu_menuitem_property_get_bool(newentry, DBUSMENU_MENUITEM_PROP_VISIBLE) == FALSE) { gtk_widget_hide(GTK_WIDGET(entry->label)); wmentry->hidden = TRUE; } else { gtk_widget_show(GTK_WIDGET(entry->label)); wmentry->hidden = FALSE; } if (dbusmenu_menuitem_property_get_variant (newentry, DBUSMENU_MENUITEM_PROP_ENABLED) != NULL) { gboolean sensitive = dbusmenu_menuitem_property_get_bool(newentry, DBUSMENU_MENUITEM_PROP_ENABLED); gtk_widget_set_sensitive(GTK_WIDGET(entry->label), sensitive); wmentry->disabled = !sensitive; } g_array_append_val(priv->entries, wmentry); g_signal_emit_by_name(G_OBJECT(wm), WINDOW_MENU_SIGNAL_ENTRY_ADDED, entry, TRUE); g_object_unref(newentry); guint pos = dbusmenu_menuitem_get_position (newentry, dbusmenu_menuitem_get_parent (newentry)); if (pos < priv->entries->len - 1) { /* Our entry added signals that we pass up don't have position information, so we can only add to the end of the list of entries. So when we get an inserted-in-the-middle entry, we fake a root change to remove all entries and add them back up again */ g_object_ref(priv->root); root_changed(DBUSMENU_CLIENT(priv->client), priv->root, wm); g_object_unref(priv->root); } return; } /* Respond to an entry getting removed from the menu */ static void menu_entry_removed (DbusmenuMenuitem * root, DbusmenuMenuitem * oldentry, gpointer user_data) { g_return_if_fail(IS_WINDOW_MENU_DBUSMENU(user_data)); g_return_if_fail(DBUSMENU_IS_MENUITEM(oldentry)); WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(user_data); if (priv->entries == NULL || priv->entries->len == 0) { return; } guint position; IndicatorObjectEntry * entry = get_entry(WINDOW_MENU_DBUSMENU(user_data), oldentry, &position); if (entry != NULL) { g_array_remove_index(priv->entries, position); g_signal_emit_by_name(G_OBJECT(user_data), WINDOW_MENU_SIGNAL_ENTRY_REMOVED, entry, TRUE); entry_free(entry); } else { /* We've been called before menu_child_realized fired, * so there isn't a WMEntry yet. Don't be going ahead * and creating one if this menu item continues to live! */ g_signal_handlers_disconnect_by_func(G_OBJECT(oldentry), G_CALLBACK(menu_entry_realized), user_data); g_signal_handlers_disconnect_by_func(G_OBJECT(oldentry), G_CALLBACK(menu_entry_realized_child_added), user_data); } return; } /* Get the XID of this window */ static guint get_xid (WindowMenu * wm) { g_return_val_if_fail(IS_WINDOW_MENU_DBUSMENU(wm), 0); WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(wm); return priv->windowid; } /* Get the path for this object */ gchar * window_menu_dbusmenu_get_path (WindowMenuDbusmenu * wm) { g_return_val_if_fail(IS_WINDOW_MENU_DBUSMENU(wm), NULL); WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(wm); GValue obj = {0}; g_value_init(&obj, G_TYPE_STRING); g_object_get_property(G_OBJECT(priv->client), DBUSMENU_CLIENT_PROP_DBUS_OBJECT, &obj); gchar * retval = g_value_dup_string(&obj); g_value_unset(&obj); return retval; } /* Get the address of this object */ gchar * window_menu_dbusmenu_get_address (WindowMenuDbusmenu * wm) { g_return_val_if_fail(IS_WINDOW_MENU_DBUSMENU(wm), NULL); WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(wm); GValue obj = {0}; g_value_init(&obj, G_TYPE_STRING); g_object_get_property(G_OBJECT(priv->client), DBUSMENU_CLIENT_PROP_DBUS_NAME, &obj); gchar * retval = g_value_dup_string(&obj); g_value_unset(&obj); return retval; } /* Return whether we're in an error state or not */ static gboolean get_error_state (WindowMenu * wm) { g_return_val_if_fail(IS_WINDOW_MENU_DBUSMENU(wm), TRUE); WindowMenuDbusmenuPrivate * priv = WINDOW_MENU_DBUSMENU_GET_PRIVATE(wm); return priv->error_state; } /* Regain whether we're supposed to be hidden or disabled, we want to keep that if that's the case, otherwise bring back to the base state */ static void entry_restore (WindowMenu * wm, IndicatorObjectEntry * entry) { g_return_if_fail(IS_WINDOW_MENU_DBUSMENU(wm)); WMEntry * wmentry = (WMEntry *)entry; if (entry->label != NULL) { gtk_widget_set_sensitive(GTK_WIDGET(entry->label), !wmentry->disabled); if (wmentry->hidden) { gtk_widget_hide(GTK_WIDGET(entry->label)); } else { gtk_widget_show(GTK_WIDGET(entry->label)); } } if (entry->image != NULL) { gtk_widget_set_sensitive(GTK_WIDGET(entry->image), !wmentry->disabled); if (wmentry->hidden) { gtk_widget_hide(GTK_WIDGET(entry->image)); } else { gtk_widget_show(GTK_WIDGET(entry->image)); } } return; } /* Signaled when the menu item is activated on the panel so we can pass it down the stack. */ static void entry_activate (WindowMenu * wm, IndicatorObjectEntry * entry, guint timestamp) { g_return_if_fail(IS_WINDOW_MENU_DBUSMENU(wm)); g_return_if_fail(entry != NULL); WMEntry * wme = (WMEntry *)entry; /* If entry is a childless menu item, activate the entry. */ if (entry->menu == NULL) { dbusmenu_menuitem_handle_event(wme->mi, DBUSMENU_MENUITEM_EVENT_ACTIVATED, NULL, 0); /* Otherwise, show the menu */ } else { dbusmenu_menuitem_send_about_to_show(wme->mi, NULL, NULL); } return; } indicator-appmenu.git/src/window-menu-dbusmenu.h0000664000000000000000000000407515154240054017206 0ustar /* An implementation of indicator object showing menus from applications. Copyright 2010 Canonical Ltd. Authors: Ted Gould This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, SATISFACTORY QUALITY, 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 . */ #ifndef __WINDOW_MENU_DBUSMENU_H__ #define __WINDOW_MENU_DBUSMENU_H__ #include "window-menu.h" G_BEGIN_DECLS #define WINDOW_MENU_DBUSMENU_TYPE (window_menu_dbusmenu_get_type ()) #define WINDOW_MENU_DBUSMENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WINDOW_MENU_DBUSMENU_TYPE, WindowMenuDbusmenu)) #define WINDOW_MENU_DBUSMENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WINDOW_MENU_DBUSMENU_TYPE, WindowMenuDbusmenuClass)) #define IS_WINDOW_MENU_DBUSMENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WINDOW_MENU_DBUSMENU_TYPE)) #define IS_WINDOW_MENU_DBUSMENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WINDOW_MENU_DBUSMENU_TYPE)) #define WINDOW_MENU_DBUSMENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WINDOW_MENU_DBUSMENU_TYPE, WindowMenuDbusmenuClass)) typedef struct _WindowMenuDbusmenu WindowMenuDbusmenu; typedef struct _WindowMenuDbusmenuClass WindowMenuDbusmenuClass; struct _WindowMenuDbusmenuClass { WindowMenuClass parent_class; }; struct _WindowMenuDbusmenu { WindowMenu parent; }; GType window_menu_dbusmenu_get_type (void); WindowMenuDbusmenu * window_menu_dbusmenu_new (const guint windowid, const gchar * dbus_addr, const gchar * dbus_object); gchar * window_menu_dbusmenu_get_path (WindowMenuDbusmenu * wm); gchar * window_menu_dbusmenu_get_address (WindowMenuDbusmenu * wm); G_END_DECLS #endif indicator-appmenu.git/src/window-menu-model.c0000664000000000000000000004377115154240054016465 0ustar /* * Copyright © 2012 Canonical Limited * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the licence, 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . * * Author: Ted Gould */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include "window-menu-model.h" struct _WindowMenuModelPrivate { guint xid; GtkAccelGroup * accel_group; GActionGroup * app_actions; GActionGroup * win_actions; GActionGroup * unity_actions; /* Application Menu */ GDBusMenuModel * app_menu_model; IndicatorObjectEntry application_menu; gboolean has_application_menu; /* Window Menus */ GDBusMenuModel * win_menu_model; GtkMenuBar * win_menu; }; #define WINDOW_MENU_MODEL_GET_PRIVATE(o) \ (window_menu_model_get_instance_private (WINDOW_MENU_MODEL(o))) /* Base class stuff */ static void window_menu_model_class_init (WindowMenuModelClass *klass); static void window_menu_model_init (WindowMenuModel *self); static void window_menu_model_dispose (GObject *object); /* Window Menu subclassin' */ static GList * get_entries (WindowMenu * wm); static guint get_location (WindowMenu * wm, IndicatorObjectEntry * entry); static WindowMenuStatus get_status (WindowMenu * wm); static gboolean get_error_state (WindowMenu * wm); static guint get_xid (WindowMenu * wm); /* GLib boilerplate */ G_DEFINE_TYPE_WITH_PRIVATE (WindowMenuModel, window_menu_model, WINDOW_MENU_TYPE); /* Prefixes to the action muxer */ #define ACTION_MUX_PREFIX_APP "app" #define ACTION_MUX_PREFIX_WIN "win" #define ACTION_MUX_PREFIX_UNITY "unity" /* Entry data on the menuitem */ #define ENTRY_DATA "window-menu-model-menuitem-entry" static void window_menu_model_class_init (WindowMenuModelClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = window_menu_model_dispose; WindowMenuClass * wm_class = WINDOW_MENU_CLASS(klass); wm_class->get_entries = get_entries; wm_class->get_location = get_location; wm_class->get_status = get_status; wm_class->get_error_state = get_error_state; wm_class->get_xid = get_xid; return; } static void window_menu_model_init (WindowMenuModel *self) { self->priv = WINDOW_MENU_MODEL_GET_PRIVATE(self); self->priv->accel_group = gtk_accel_group_new(); return; } static void window_menu_model_dispose (GObject *object) { WindowMenuModel * menu = WINDOW_MENU_MODEL(object); if (menu->priv->has_application_menu) { g_signal_emit_by_name(menu, WINDOW_MENU_SIGNAL_ENTRY_REMOVED, &menu->priv->application_menu); menu->priv->has_application_menu = FALSE; } g_clear_object(&menu->priv->accel_group); /* Application Menu */ g_clear_object(&menu->priv->app_menu_model); g_clear_object(&menu->priv->application_menu.label); g_clear_object(&menu->priv->application_menu.menu); /* Window Menus */ g_clear_object(&menu->priv->win_menu_model); if (menu->priv->win_menu) { g_signal_handlers_disconnect_by_data(menu->priv->win_menu, menu); gtk_widget_destroy (GTK_WIDGET (menu->priv->win_menu)); g_object_unref (menu->priv->win_menu); menu->priv->win_menu = NULL; } g_clear_object(&menu->priv->unity_actions); g_clear_object(&menu->priv->win_actions); g_clear_object(&menu->priv->app_actions); G_OBJECT_CLASS (window_menu_model_parent_class)->dispose (object); return; } /* Adds the application menu and turns the whole thing into an object entry that can be used elsewhere */ static void add_application_menu (WindowMenuModel * menu, const gchar * appname, GMenuModel * model) { g_return_if_fail(G_IS_MENU_MODEL(model)); menu->priv->app_menu_model = (GDBusMenuModel*)g_object_ref(model); menu->priv->application_menu.parent_window = menu->priv->xid; if (appname != NULL) { menu->priv->application_menu.label = GTK_LABEL(gtk_label_new(appname)); } else { menu->priv->application_menu.label = GTK_LABEL(gtk_label_new(_("Unknown Application Name"))); } g_object_ref_sink(menu->priv->application_menu.label); gtk_widget_show(GTK_WIDGET(menu->priv->application_menu.label)); menu->priv->application_menu.menu = GTK_MENU(gtk_menu_new_from_model(model)); if (menu->priv->app_actions) { gtk_widget_insert_action_group(GTK_WIDGET(menu->priv->application_menu.menu), ACTION_MUX_PREFIX_APP, menu->priv->app_actions); } if (menu->priv->win_actions) { gtk_widget_insert_action_group(GTK_WIDGET(menu->priv->application_menu.menu), ACTION_MUX_PREFIX_WIN, menu->priv->win_actions); } if (menu->priv->unity_actions) { gtk_widget_insert_action_group(GTK_WIDGET(menu->priv->application_menu.menu), ACTION_MUX_PREFIX_UNITY, menu->priv->unity_actions); } gtk_widget_show(GTK_WIDGET(menu->priv->application_menu.menu)); g_object_ref_sink(menu->priv->application_menu.menu); menu->priv->has_application_menu = TRUE; g_signal_emit_by_name(menu, WINDOW_MENU_SIGNAL_ENTRY_ADDED, &menu->priv->application_menu); } /* Find the label in a GTK MenuItem */ GtkLabel * mi_find_label (GtkWidget * mi) { if (GTK_IS_LABEL(mi)) { return GTK_LABEL(mi); } GtkLabel * retval = NULL; if (GTK_IS_CONTAINER(mi)) { GList * children = gtk_container_get_children(GTK_CONTAINER(mi)); GList * child = children; while (child != NULL && retval == NULL) { if (GTK_IS_WIDGET(child->data)) { retval = mi_find_label(GTK_WIDGET(child->data)); } child = g_list_next(child); } g_list_free(children); } return retval; } /* Find the icon in a GTK MenuItem */ GtkImage * mi_find_icon (GtkWidget * mi) { if (GTK_IS_IMAGE(mi)) { return GTK_IMAGE(mi); } GtkImage * retval = NULL; if (GTK_IS_CONTAINER(mi)) { GList * children = gtk_container_get_children(GTK_CONTAINER(mi)); GList * child = children; while (child != NULL && retval == NULL) { if (GTK_IS_WIDGET(child->data)) { retval = mi_find_icon(GTK_WIDGET(child->data)); } child = g_list_next(child); } g_list_free(children); } return retval; } /* Check the menu and make sure we return it if it's a menu all proper like that */ GtkMenu * mi_find_menu (GtkMenuItem * mi) { GtkWidget * retval = gtk_menu_item_get_submenu(mi); if (GTK_IS_MENU(retval)) { return GTK_MENU(retval); } else { return NULL; } } typedef struct _WindowMenuEntry WindowMenuEntry; struct _WindowMenuEntry { IndicatorObjectEntry entry; GtkMenuItem * gmi; }; /* Sync the menu label changing to the label object */ static void entry_label_notify (GObject * obj, GParamSpec * pspec, gpointer user_data) { g_return_if_fail(GTK_IS_MENU_ITEM(obj)); GtkMenuItem * gmi = GTK_MENU_ITEM(obj); WindowMenuEntry * entry = (WindowMenuEntry *)user_data; if (entry->entry.label != NULL) { const gchar * label = gtk_menu_item_get_label(gmi); gtk_label_set_label(entry->entry.label, label); } return; } /* Watch for visible changes and ensure they can be picked up by the indicator object host */ static void entry_visible_notify (GObject * obj, GParamSpec * pspec, gpointer user_data) { g_return_if_fail(GTK_IS_WIDGET(obj)); GtkWidget * widget = GTK_WIDGET(obj); WindowMenuEntry * entry = (WindowMenuEntry *)user_data; gboolean visible = gtk_widget_get_visible(widget); if (entry->entry.label != NULL) { gtk_widget_set_visible(GTK_WIDGET(entry->entry.label), visible); } if (entry->entry.image != NULL) { gtk_widget_set_visible(GTK_WIDGET(entry->entry.image), visible); } return; } /* Watch for sensitive changes and ensure they can be picked up by the indicator object host */ static void entry_sensitive_notify (GObject * obj, GParamSpec * pspec, gpointer user_data) { g_return_if_fail(GTK_IS_WIDGET(obj)); GtkWidget * widget = GTK_WIDGET(obj); WindowMenuEntry * entry = (WindowMenuEntry *)user_data; gboolean sensitive = gtk_widget_get_sensitive(widget); if (entry->entry.label != NULL) { gtk_widget_set_sensitive(GTK_WIDGET(entry->entry.label), sensitive); } if (entry->entry.image != NULL) { gtk_widget_set_sensitive(GTK_WIDGET(entry->entry.image), sensitive); } return; } /* Destroy and unref the items of the object entry */ static void entry_object_free (gpointer inentry) { WindowMenuEntry * entry = (WindowMenuEntry *)inentry; g_signal_handlers_disconnect_by_data(entry->gmi, entry); g_clear_object(&entry->entry.label); g_clear_object(&entry->entry.image); g_clear_object(&entry->entry.menu); g_free(entry); return; } /* Put an entry on a menu item */ static void entry_on_menuitem (WindowMenuModel * menu, GtkMenuItem * gmi) { WindowMenuEntry * entry = g_new0(WindowMenuEntry, 1); entry->gmi = gmi; entry->entry.parent_window = menu->priv->xid; entry->entry.label = mi_find_label(GTK_WIDGET(gmi)); entry->entry.image = mi_find_icon(GTK_WIDGET(gmi)); entry->entry.menu = mi_find_menu(gmi); if (entry->entry.label == NULL && entry->entry.image == NULL) { const gchar * label = gtk_menu_item_get_label(gmi); if (label == NULL) { g_warning("Item doesn't have a label or an image, aborting"); return; } entry->entry.label = GTK_LABEL(gtk_label_new(label)); gtk_widget_show(GTK_WIDGET(entry->entry.label)); g_signal_connect(G_OBJECT(gmi), "notify::label", G_CALLBACK(entry_label_notify), entry); } if (entry->entry.label != NULL) { g_object_ref_sink(entry->entry.label); } if (entry->entry.image != NULL) { g_object_ref_sink(entry->entry.image); } if (entry->entry.menu != NULL) { g_object_ref_sink(entry->entry.menu); } g_signal_connect(G_OBJECT(gmi), "notify::sensitive", G_CALLBACK(entry_sensitive_notify), entry); g_signal_connect(G_OBJECT(gmi), "notify::visible", G_CALLBACK(entry_visible_notify), entry); g_object_set_data_full(G_OBJECT(gmi), ENTRY_DATA, entry, entry_object_free); return; } /* A child item was added to a menu we're watching. Let's try to integrate it. */ static void item_inserted_cb (GtkContainer *menu, GtkWidget *widget, gint position, gpointer data) { if (g_object_get_data(G_OBJECT(widget), ENTRY_DATA) == NULL) { entry_on_menuitem(WINDOW_MENU_MODEL(data), GTK_MENU_ITEM(widget)); } if (g_object_get_data(G_OBJECT(widget), ENTRY_DATA) != NULL) { g_signal_emit_by_name(data, WINDOW_MENU_SIGNAL_ENTRY_ADDED, g_object_get_data(G_OBJECT(widget), ENTRY_DATA)); } return; } /* A child item was removed from a menu we're watching. */ static void item_removed_cb (GtkContainer *menu, GtkWidget *widget, gpointer data) { g_signal_emit_by_name(data, WINDOW_MENU_SIGNAL_ENTRY_REMOVED, g_object_get_data(G_OBJECT(widget), ENTRY_DATA)); } /* Adds the window menu and turns it into a set of IndicatorObjectEntries that can be used elsewhere */ static void add_window_menu (WindowMenuModel * menu, GMenuModel * model) { menu->priv->win_menu_model = (GDBusMenuModel*)g_object_ref(model); menu->priv->win_menu = GTK_MENU_BAR(gtk_menu_bar_new_from_model(model)); g_assert(menu->priv->win_menu != NULL); g_object_ref_sink(menu->priv->win_menu); if (menu->priv->app_actions) gtk_widget_insert_action_group(GTK_WIDGET(menu->priv->win_menu), ACTION_MUX_PREFIX_APP, menu->priv->app_actions); if (menu->priv->win_actions) gtk_widget_insert_action_group(GTK_WIDGET(menu->priv->win_menu), ACTION_MUX_PREFIX_WIN, menu->priv->win_actions); if (menu->priv->unity_actions) gtk_widget_insert_action_group(GTK_WIDGET(menu->priv->win_menu), ACTION_MUX_PREFIX_UNITY, menu->priv->unity_actions); g_signal_connect(G_OBJECT(menu->priv->win_menu), "insert", G_CALLBACK (item_inserted_cb), menu); g_signal_connect(G_OBJECT(menu->priv->win_menu), "remove", G_CALLBACK (item_removed_cb), menu); GList * children = gtk_container_get_children(GTK_CONTAINER(menu->priv->win_menu)); GList * child; for (child = children; child != NULL; child = g_list_next(child)) { GtkMenuItem * gmi = GTK_MENU_ITEM(child->data); if (gmi == NULL) { continue; } entry_on_menuitem(menu, gmi); } g_list_free(children); return; } /* Builds the menu model from the window for the application */ WindowMenuModel * window_menu_model_new (BamfApplication * app, BamfWindow * window) { g_return_val_if_fail(BAMF_IS_APPLICATION(app), NULL); g_return_val_if_fail(BAMF_IS_WINDOW(window), NULL); WindowMenuModel * menu = g_object_new(WINDOW_MENU_MODEL_TYPE, NULL); menu->priv->xid = bamf_window_get_xid(window); gchar *unique_bus_name; gchar *app_menu_object_path; gchar *menubar_object_path; gchar *application_object_path; gchar *window_object_path; gchar *unity_object_path; GDBusConnection *session; unique_bus_name = bamf_window_get_utf8_prop (window, "_GTK_UNIQUE_BUS_NAME"); if (unique_bus_name == NULL) { /* If this isn't set, we won't get very far... */ return NULL; } app_menu_object_path = bamf_window_get_utf8_prop (window, "_GTK_APP_MENU_OBJECT_PATH"); menubar_object_path = bamf_window_get_utf8_prop (window, "_GTK_MENUBAR_OBJECT_PATH"); application_object_path = bamf_window_get_utf8_prop (window, "_GTK_APPLICATION_OBJECT_PATH"); window_object_path = bamf_window_get_utf8_prop (window, "_GTK_WINDOW_OBJECT_PATH"); unity_object_path = bamf_window_get_utf8_prop (window, "_UNITY_OBJECT_PATH"); session = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); /* Setup actions */ if (application_object_path != NULL) { menu->priv->app_actions = G_ACTION_GROUP(g_dbus_action_group_get (session, unique_bus_name, application_object_path)); } if (window_object_path != NULL) { menu->priv->win_actions = G_ACTION_GROUP(g_dbus_action_group_get (session, unique_bus_name, window_object_path)); } if (unity_object_path != NULL) { menu->priv->unity_actions = G_ACTION_GROUP(g_dbus_action_group_get (session, unique_bus_name, unity_object_path)); } /* Build us some menus */ if (app_menu_object_path != NULL) { const gchar * desktop_path = bamf_application_get_desktop_file(app); gchar * app_name = NULL; if (desktop_path != NULL) { GDesktopAppInfo * desktop = g_desktop_app_info_new_from_filename(desktop_path); if (desktop != NULL) { app_name = g_strdup(g_app_info_get_name(G_APP_INFO(desktop))); g_object_unref(desktop); } } GMenuModel * model = G_MENU_MODEL(g_dbus_menu_model_get (session, unique_bus_name, app_menu_object_path)); add_application_menu(menu, app_name, model); g_object_unref(model); g_free(app_name); } if (menubar_object_path != NULL) { GMenuModel * model = G_MENU_MODEL(g_dbus_menu_model_get (session, unique_bus_name, menubar_object_path)); add_window_menu(menu, model); g_object_unref(model); } /* when the action groups change, we could end up having items * enabled/disabled. how to deal with that? */ g_free (unique_bus_name); g_free (app_menu_object_path); g_free (menubar_object_path); g_free (application_object_path); g_free (window_object_path); g_free (unity_object_path); g_object_unref (session); return menu; } /* Get the list of entries */ static GList * get_entries (WindowMenu * wm) { g_return_val_if_fail(IS_WINDOW_MENU_MODEL(wm), NULL); WindowMenuModel * menu = WINDOW_MENU_MODEL(wm); GList * ret = NULL; if (menu->priv->has_application_menu) { ret = g_list_append(ret, &menu->priv->application_menu); } if (menu->priv->win_menu != NULL) { GList * children = gtk_container_get_children(GTK_CONTAINER(menu->priv->win_menu)); GList * child; for (child = children; child != NULL; child = g_list_next(child)) { gpointer entry = g_object_get_data(child->data, ENTRY_DATA); if (entry == NULL) { /* Try to build the entry, it is possible (but unlikely) that we could beat the signal that this isn't created. So we'll just handle that race here */ entry_on_menuitem(menu, GTK_MENU_ITEM(child->data)); entry = g_object_get_data(child->data, ENTRY_DATA); } if (entry != NULL) { ret = g_list_append(ret, entry); } } g_list_free(children); } return ret; } /* Find the location of an entry */ static guint get_location (WindowMenu * wm, IndicatorObjectEntry * entry) { g_return_val_if_fail(IS_WINDOW_MENU_MODEL(wm), 0); WindowMenuModel * menu = WINDOW_MENU_MODEL(wm); gboolean found = FALSE; guint pos = 0; if (menu->priv->has_application_menu) { if (entry == &menu->priv->application_menu) { pos = 0; found = TRUE; } else { /* We need to put a shift in if there is an application menu and we're not looking for that one */ pos = 1; } } if (menu->priv->win_menu != NULL) { GList * children = gtk_container_get_children(GTK_CONTAINER(menu->priv->win_menu)); GList * child; for (child = children; child != NULL; child = g_list_next(child), pos++) { gpointer lentry = g_object_get_data(child->data, ENTRY_DATA); if (entry == lentry) { found = TRUE; break; } } g_list_free(children); } if (!found) { /* NOTE: Not printing any of the values here because there's a pretty good chance that they're not valid. Let's not crash things here. */ pos = G_MAXUINT; g_warning("Unable to find entry: %p", entry); } return pos; } /* Get's the status of the application to whether underlines should be shown to the application. GMenuModel doesn't give us this info. */ static WindowMenuStatus get_status (WindowMenu * wm) { return WINDOW_MENU_STATUS_NORMAL; } /* Says whether the application is in error, GMenuModel doesn't give us this information on the app */ static gboolean get_error_state (WindowMenu * wm) { return FALSE; } /* Get the XID of this guy */ static guint get_xid (WindowMenu * wm) { g_return_val_if_fail(IS_WINDOW_MENU_MODEL(wm), 0); return WINDOW_MENU_MODEL(wm)->priv->xid; } indicator-appmenu.git/src/window-menu-model.h0000664000000000000000000000403215154240054016455 0ustar /* * Copyright © 2012 Canonical Limited * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the licence, 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . * * Author: Ted Gould */ #ifndef __WINDOW_MENU_MODEL_H__ #define __WINDOW_MENU_MODEL_H__ #include #include #include #include "window-menu.h" G_BEGIN_DECLS #define WINDOW_MENU_MODEL_TYPE (window_menu_model_get_type ()) #define WINDOW_MENU_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WINDOW_MENU_MODEL_TYPE, WindowMenuModel)) #define WINDOW_MENU_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WINDOW_MENU_MODEL_TYPE, WindowMenuModelClass)) #define IS_WINDOW_MENU_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WINDOW_MENU_MODEL_TYPE)) #define IS_WINDOW_MENU_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WINDOW_MENU_MODEL_TYPE)) #define WINDOW_MENU_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WINDOW_MENU_MODEL_TYPE, WindowMenuModelClass)) typedef struct _WindowMenuModel WindowMenuModel; typedef struct _WindowMenuModelClass WindowMenuModelClass; typedef struct _WindowMenuModelPrivate WindowMenuModelPrivate; struct _WindowMenuModelClass { WindowMenuClass parent_class; }; struct _WindowMenuModel { WindowMenu parent; WindowMenuModelPrivate * priv; }; GType window_menu_model_get_type (void); WindowMenuModel * window_menu_model_new (BamfApplication * app, BamfWindow * window); G_END_DECLS #endif indicator-appmenu.git/src/window-menu.c0000664000000000000000000001535315154240054015362 0ustar /* * Copyright © 2012 Canonical Limited * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the licence, 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . * * Author: Ted Gould */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "window-menu.h" #include "indicator-appmenu-marshal.h" /* Signals */ enum { ENTRY_ADDED, ENTRY_REMOVED, ERROR_STATE, STATUS_CHANGED, SHOW_MENU, A11Y_UPDATE, LAST_SIGNAL }; static guint signals[LAST_SIGNAL] = { 0 }; /* Prototypes */ static void window_menu_class_init (WindowMenuClass *klass); static void window_menu_init (WindowMenu *self); static void window_menu_dispose (GObject *object); static void window_menu_finalize (GObject *object); G_DEFINE_TYPE (WindowMenu, window_menu, G_TYPE_OBJECT); static void window_menu_class_init (WindowMenuClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = window_menu_dispose; object_class->finalize = window_menu_finalize; /* Signals */ signals[ENTRY_ADDED] = g_signal_new(WINDOW_MENU_SIGNAL_ENTRY_ADDED, G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (WindowMenuClass, entry_added), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); signals[ENTRY_REMOVED] = g_signal_new(WINDOW_MENU_SIGNAL_ENTRY_REMOVED, G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (WindowMenuClass, entry_removed), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); signals[ERROR_STATE] = g_signal_new(WINDOW_MENU_SIGNAL_ERROR_STATE, G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (WindowMenuClass, error_state), NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN, G_TYPE_NONE); signals[STATUS_CHANGED] = g_signal_new(WINDOW_MENU_SIGNAL_STATUS_CHANGED, G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (WindowMenuClass, status_changed), NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT, G_TYPE_NONE); signals[SHOW_MENU] = g_signal_new(WINDOW_MENU_SIGNAL_SHOW_MENU, G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (WindowMenuClass, show_menu), NULL, NULL, _indicator_appmenu_marshal_VOID__POINTER_UINT, G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_UINT, G_TYPE_NONE); signals[A11Y_UPDATE] = g_signal_new(WINDOW_MENU_SIGNAL_A11Y_UPDATE, G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (WindowMenuClass, a11y_update), NULL, NULL, _indicator_appmenu_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER, G_TYPE_NONE); return; } static void window_menu_init (WindowMenu *self) { return; } static void window_menu_dispose (GObject *object) { G_OBJECT_CLASS (window_menu_parent_class)->dispose (object); return; } static void window_menu_finalize (GObject *object) { G_OBJECT_CLASS (window_menu_parent_class)->finalize (object); return; } /************************** API **************************/ GList * window_menu_get_entries (WindowMenu * wm) { g_return_val_if_fail (IS_WINDOW_MENU(wm), NULL); WindowMenuClass * class = WINDOW_MENU_GET_CLASS(wm); if (class->get_entries != NULL) { return class->get_entries(wm); } else { return NULL; } } guint window_menu_get_location (WindowMenu * wm, IndicatorObjectEntry * entry) { g_return_val_if_fail (IS_WINDOW_MENU(wm), G_MAXUINT); WindowMenuClass * class = WINDOW_MENU_GET_CLASS(wm); if (class->get_location != NULL) { return class->get_location(wm, entry); } else { return G_MAXUINT; } } guint window_menu_get_xid (WindowMenu * wm) { g_return_val_if_fail (IS_WINDOW_MENU(wm), 0); WindowMenuClass * class = WINDOW_MENU_GET_CLASS(wm); if (class->get_xid != NULL) { return class->get_xid(wm); } else { return 0; } } gboolean window_menu_get_error_state (WindowMenu * wm) { g_return_val_if_fail (IS_WINDOW_MENU(wm), FALSE); WindowMenuClass * class = WINDOW_MENU_GET_CLASS(wm); if (class->get_error_state != NULL) { return class->get_error_state(wm); } else { return TRUE; } } WindowMenuStatus window_menu_get_status (WindowMenu * wm) { g_return_val_if_fail (IS_WINDOW_MENU(wm), WINDOW_MENU_STATUS_NORMAL); WindowMenuClass * class = WINDOW_MENU_GET_CLASS(wm); if (class->get_status != NULL) { return class->get_status(wm); } else { return WINDOW_MENU_STATUS_NORMAL; } } void window_menu_entry_restore (WindowMenu * wm, IndicatorObjectEntry * entry) { g_return_if_fail (IS_WINDOW_MENU(wm)); WindowMenuClass * class = WINDOW_MENU_GET_CLASS(wm); if (class->entry_restore != NULL) { return class->entry_restore(wm, entry); } else { return; } } void window_menu_entry_activate (WindowMenu * wm, IndicatorObjectEntry * entry, guint timestamp) { g_return_if_fail (IS_WINDOW_MENU(wm)); WindowMenuClass * class = WINDOW_MENU_GET_CLASS(wm); if (class->entry_activate != NULL) { return class->entry_activate(wm, entry, timestamp); } else { return; } } indicator-appmenu.git/src/window-menu.h0000664000000000000000000000723515154240054015367 0ustar /* An implementation of indicator object showing menus from applications. Copyright 2012 Canonical Ltd. Authors: Ted Gould This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, SATISFACTORY QUALITY, 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 . */ #ifndef __WINDOW_MENU_H__ #define __WINDOW_MENU_H__ #include #include G_BEGIN_DECLS #define WINDOW_MENU_TYPE (window_menu_get_type ()) #define WINDOW_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WINDOW_MENU_TYPE, WindowMenu)) #define WINDOW_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WINDOW_MENU_TYPE, WindowMenuClass)) #define IS_WINDOW_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WINDOW_MENU_TYPE)) #define IS_WINDOW_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WINDOW_MENU_TYPE)) #define WINDOW_MENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WINDOW_MENU_TYPE, WindowMenuClass)) #define WINDOW_MENU_SIGNAL_ENTRY_ADDED "entry-added" #define WINDOW_MENU_SIGNAL_ENTRY_REMOVED "entry-removed" #define WINDOW_MENU_SIGNAL_ERROR_STATE "error-state" #define WINDOW_MENU_SIGNAL_STATUS_CHANGED "status-changed" #define WINDOW_MENU_SIGNAL_SHOW_MENU "show-menu" #define WINDOW_MENU_SIGNAL_A11Y_UPDATE "a11y-update" typedef enum _WindowMenuStatus WindowMenuStatus; enum _WindowMenuStatus { WINDOW_MENU_STATUS_NORMAL, WINDOW_MENU_STATUS_ACTIVE }; typedef struct _WindowMenu WindowMenu; typedef struct _WindowMenuClass WindowMenuClass; struct _WindowMenuClass { GObjectClass parent_class; /* Virtual Funcs */ GList * (*get_entries) (WindowMenu * wm); guint (*get_location) (WindowMenu * wm, IndicatorObjectEntry * entry); guint (*get_xid) (WindowMenu * wm); gboolean (*get_error_state) (WindowMenu * wm); WindowMenuStatus (*get_status) (WindowMenu * wm); void (*entry_restore) (WindowMenu * wm, IndicatorObjectEntry * entry); void (*entry_activate) (WindowMenu * wm, IndicatorObjectEntry * entry, guint timestamp); /* Signals */ void (*entry_added) (WindowMenu * wm, IndicatorObjectEntry * entry, gpointer user_data); void (*entry_removed) (WindowMenu * wm, IndicatorObjectEntry * entry, gpointer user_data); void (*error_state) (WindowMenu * wm, gboolean state, gpointer user_data); void (*status_changed) (WindowMenu * wm, WindowMenuStatus status, gpointer user_data); void (*show_menu) (WindowMenu * wm, IndicatorObjectEntry * entry, guint timestamp, gpointer user_data); void (*a11y_update) (WindowMenu * wm, IndicatorObjectEntry * entry, gpointer user_data); }; struct _WindowMenu { GObject parent; }; GType window_menu_get_type (void); GList * window_menu_get_entries (WindowMenu * wm); guint window_menu_get_location (WindowMenu * wm, IndicatorObjectEntry * entry); guint window_menu_get_xid (WindowMenu * wm); gboolean window_menu_get_error_state (WindowMenu * wm); WindowMenuStatus window_menu_get_status (WindowMenu * wm); void window_menu_entry_restore (WindowMenu * wm, IndicatorObjectEntry * entry); void window_menu_entry_activate (WindowMenu * wm, IndicatorObjectEntry * entry, guint timestamp); G_END_DECLS #endif indicator-appmenu.git/tests/0000775000000000000000000000000015154240054013311 5ustar indicator-appmenu.git/tests/Makefile.am0000664000000000000000000000002515154240054015342 0ustar SUBDIRS = \ manual indicator-appmenu.git/tests/autopilot/0000775000000000000000000000000015154240054015331 5ustar indicator-appmenu.git/tests/autopilot/tests/0000775000000000000000000000000015154240054016473 5ustar indicator-appmenu.git/tests/autopilot/tests/__init__.py0000664000000000000000000000000015154240054020572 0ustar indicator-appmenu.git/tests/autopilot/tests/test_gedit.py0000664000000000000000000000335515154240054021206 0ustar from unity.emulators.unity import Unity from unity.tests import UnityTestCase from testtools.matchers import NotEquals, Equals from autopilot.matchers import Eventually from autopilot.introspection.gtk import GtkIntrospectionTestMixin class GeditTestCase(UnityTestCase, GtkIntrospectionTestMixin): def setUp(self): super(GeditTestCase, self).setUp() self.panel_controller = Unity.get_root_instance().panels self.app = self.launch_test_application('gedit') def guess_quit_location(self, file_menu): """Returns an (x, y) location on which to click the 'Quit' menu item.""" # TODO autopilot-gtk could grok location of GtkImageMenuItem geometry = file_menu.menu_geometry lower_margin_click_offset = 20 return (geometry[0] + int(0.5 * geometry[2]), geometry[1] + geometry[3] - lower_margin_click_offset) def test_file_quit(self): """Clicking on 'Quit' exits the application.""" # open the file menu panel = self.panel_controller.get_active_panel() file_menu = lambda : panel.menus.get_menu_by_label('_File') self.assertThat(file_menu, Eventually(NotEquals(None))) file_menu = panel.menus.get_menu_by_label('_File') file_menu.mouse_click() # click on 'Quit' file_menu_is_open = lambda : file_menu.menu_geometry != (0, 0, 0, 0) self.assertThat(file_menu_is_open, Eventually(Equals(True))) location = self.guess_quit_location(file_menu) self.mouse.move(location[0], location[1]) self.mouse.click() # make sure we exited app_is_running = lambda : self.app_is_running('Text Editor') self.assertThat(app_is_running, Eventually(Equals(False))) indicator-appmenu.git/tests/manual/0000775000000000000000000000000015154240054014566 5ustar indicator-appmenu.git/tests/manual/Makefile.am0000664000000000000000000000017715154240054016627 0ustar EXTRA_DIST = \ appmenu-eog.txt \ appmenu-evince.txt \ appmenu-firefox.txt \ appmenu-gedit.txt \ appmenu-thunderbird.txt indicator-appmenu.git/tests/manual/appmenu-eog.txt0000664000000000000000000000120715154240054017544 0ustar Eye of GNOME Menus ================== These tests ensure that the menus work in Eye of GNOME Test About Item --------------- #. Start Image Viewer #. Select Help > About Outcome A small window should appear with the Image View logo and version in it Test Toolbar visibility ----------------------- #. Start Image Viewer #. Open the View menu #. Ensure that the Toolbar item is checked #. Select the Toolbar item Outcome The Image Viewer window should be visible without a toolbar Test Open Dialog ---------------- #. Start Image Viewer #. Select Image > Open Outcome A new dialog should appear that allows you to select a file to open indicator-appmenu.git/tests/manual/appmenu-evince.txt0000664000000000000000000000143015154240054020241 0ustar Test Evince Menus ================= These tests ensure that the menus are working in Evince Test About Item --------------- #. Open the Document Viewer #. Select Help > About Outcome A small dialog should appear with the Evince logo and the version number Test Fullscreen Item -------------------- #. Open the Document Viewer #. Select View > Fullscreen Outcome The screen should be entirely covered with the Document Viewer application Test Sidebar Item -------------------- #. Open the Document Viewer #. Open a PDF file using File > Open #. Verify there is a thumbnails pane on the left hand side #. Open the View menu #. Verify there is a check next to "Side Pane" #. Select "Side Pane" Outcome The thumbnails sidebar on the left hand side of the application should disappear indicator-appmenu.git/tests/manual/appmenu-firefox.txt0000664000000000000000000000252515154240054020440 0ustar Test Firefox Menus ================== These test show that the Firefox menus work in indicator-appmenu Test About Item --------------- #. Start Firefox #. Select Help > About Firefox Outcome A small window should appear with the Firefox logo and version in it Test Bookmark ------------- #. Start Firefox #. Navigate to http://ubuntu.com #. Select Bookmarks > Bookmark this Page Outcome A small dialog should appear with the option to bookmark this page Test Bookmarking ---------------- #. Start Firefox #. Ensure there is no "Homepage | Ubuntu" entry in the Bookmarks menu #. Navigate to http://ubuntu.com #. Select Bookmarks > Bookmark this Page #. Click on "Done" in this dialog #. Open the "Bookmarks" menu Outcome An entry for "Homepage | Ubuntu" should now appear in the Bookmarks menu Test History ---------------- #. Start Firefox #. Navigate to http://canonical.com #. Click on "About Canonical" #. Click on "About Ubuntu" #. Click on "Enterprise Services" #. Click on "Engineering Services" #. Click on "Consumer Services" #. Click on "Partners" #. Open the "History" menu Outcome The history menu should contain entries, from top to bottom, that are "Partners", "Consumer Services", "Engineering Services", "Enterprise Services", "About Ubuntu", "About Canonical" and "Canonical Homepage". All entries should have the Canonical logo. indicator-appmenu.git/tests/manual/appmenu-gedit.txt0000664000000000000000000000153215154240054020067 0ustar Test GEdit Menus ================ These tests show that the GEdit menus are working Test About Item --------------- #. Open Text Editor #. Select Help > About Outcome A small window should appear with the GEdit logo and version in it Test Syntax Selection --------------------- #. Open Text Editor #. Type "int foo;" into the editor #. Select View > Highlight Mode > Sources > C Outcome The text 'int' should change color from black Test Undo/Redo Items -------------------- #. Open Text Editor #. Type in "foo" #. Select Edit > Undo #. Select Edit > Redo Outcome The text "foo" should appear when typed. Disappear when selecting to undo it. And then repear when selecting redo. Test Close Item --------------- #. Open Text Editor #. Select File > Close Outcome The window should stay open but the default document tab should be closed. indicator-appmenu.git/tests/manual/appmenu-thunderbird.txt0000664000000000000000000000066515154240054021313 0ustar Test Thunderbird Menus ====================== These test validate the menus in Thunderbird Test About Item --------------- #. Open Thunderbird #. Select Help > About Thunderbird Outcome A small window should appear with the Thunderbird logo and version in it Test New Message Item --------------------- #. Open Thunderbird #. Select Message > New Message Outcome A small window should appear with the ability to write an e-mail indicator-appmenu.git/tools/0000775000000000000000000000000015154240054013307 5ustar indicator-appmenu.git/tools/Makefile.am0000664000000000000000000000101015154240054015333 0ustar libexec_SCRIPTS = \ current-menu \ current-menu-dump libexec_PROGRAMS = \ mock-json-app current-menu-dump: current-menu-dump.in sed \ -e s:@LIBEXECDIR@:$(libexecdir):g \ $< > $@ chmod +x $@ mock_json_app_SOURCES = \ mock-json-app.c mock_json_app_CFLAGS = \ $(INDICATOR_CFLAGS) \ $(INDICATORTEST_CFLAGS) \ -Wall -Wno-error=deprecated-declarations mock_json_app_LDADD = \ $(INDICATOR_LIBS) \ $(INDICATORTEST_LIBS) EXTRA_DIST = \ current-menu \ current-menu-dump.in CLEANFILES = \ current-menu-dump indicator-appmenu.git/tools/current-menu0000775000000000000000000000077415154240054015671 0ustar #!/bin/sh BAMFWINDOW=`gdbus call --session --dest org.ayatana.bamf --object-path /org/ayatana/bamf/matcher --method org.ayatana.bamf.matcher.ActiveWindow | cut -d "'" -f 2` WINDOWID=`gdbus call --session --dest org.ayatana.bamf --object-path $BAMFWINDOW --method org.ayatana.bamf.window.GetXid | cut -d "," -f 1 | cut -d " " -f 2` gdbus call --session --dest com.canonical.AppMenu.Registrar --object-path /com/canonical/AppMenu/Registrar --method com.canonical.AppMenu.Registrar.GetMenuForWindow $WINDOWID indicator-appmenu.git/tools/current-menu-dump.in0000775000000000000000000000056715154240054017241 0ustar #!/bin/sh TMPFILE=`mktemp` CURMENU="@LIBEXECDIR@/current-menu" DBUSDUMP="@LIBEXECDIR@/dbusmenu-dumper" $CURMENU > $TMPFILE OBPATH=`cat $TMPFILE | cut -d " " -f 3 | cut -d "'" -f 2` echo -n "Path: " echo $OBPATH OBADDR=`cat $TMPFILE | cut -d " " -f 1 | cut -d "'" -f 2` echo -n "Addr: " echo $OBADDR rm -f $TMPFILE $DBUSDUMP --dbus-name $OBADDR --dbus-object $OBPATH indicator-appmenu.git/tools/mock-json-app.c0000664000000000000000000000705715154240054016142 0ustar /* A little utility to make a mock application using the JSON menu description. Copyright 2010 Canonical Ltd. Authors: Ted Gould This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, SATISFACTORY QUALITY, 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 . */ #include #include #include #include #include #include "../src/dbus-shared.h" #define MENU_PATH "/mock/json/app/menu" GtkWidget * window = NULL; DbusmenuServer * server = NULL; GDBusProxy * registrar = NULL; static void dbus_owner_change (GObject *gobject, GParamSpec *pspec, gpointer user_data) { GDBusProxy * proxy = G_DBUS_PROXY(gobject); gchar * owner = g_dbus_proxy_get_name_owner(proxy); if (owner == NULL || owner[0] == '\0') { /* We only care about folks coming on the bus. Exit quickly otherwise. */ g_free(owner); return; } if (g_strcmp0(owner, DBUS_NAME)) { /* We only care about this address, reject all others. */ g_free(owner); return; } GError * error = NULL; g_dbus_proxy_call_sync(registrar, "RegisterWindow", g_variant_new("(uo)", GDK_WINDOW_XID (gtk_widget_get_window (window)), MENU_PATH), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL); if (error != NULL) { g_warning("Unable to register: %s", error->message); g_error_free(error); } g_free(owner); return; } static gboolean idle_func (gpointer user_data) { DbusmenuMenuitem * root = dbusmenu_json_build_from_file((const gchar *)user_data); g_return_val_if_fail(root != NULL, FALSE); DbusmenuServer * server = dbusmenu_server_new(MENU_PATH); dbusmenu_server_set_root(server, root); registrar = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, NULL, DBUS_NAME, REG_OBJECT, REG_IFACE, NULL, NULL); g_return_val_if_fail(registrar != NULL, FALSE); GError * error = NULL; g_dbus_proxy_call_sync(registrar, "RegisterWindow", g_variant_new("(uo)", GDK_WINDOW_XID (gtk_widget_get_window (window)), MENU_PATH), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error); if (error != NULL) { g_warning("Unable to register: %s", error->message); g_error_free(error); } g_signal_connect(registrar, "notify::g-name-owner", G_CALLBACK(dbus_owner_change), NULL); return FALSE; } static void destroy_cb (void) { gtk_main_quit(); return; } int main (int argv, char ** argc) { if (argv != 2) { g_print("'%s ' is how you should use this program.\n", argc[0]); return 1; } gtk_init(&argv, &argc); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(destroy_cb), NULL); gtk_widget_show(window); g_idle_add(idle_func, argc[1]); gtk_main(); return 0; }