diff options
55 files changed, 21 insertions, 6374 deletions
diff --git a/COPYING.LGPL.2.1 b/COPYING.LGPL.2.1 deleted file mode 100644 index 2d2d780..0000000 --- a/COPYING.LGPL.2.1 +++ /dev/null @@ -1,510 +0,0 @@ - - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations -below. - - When we speak of free software, we are referring to freedom of use, -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 this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it -becomes a de-facto standard. To achieve this, non-free programs must -be allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control -compilation and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at least - three years, to give the same user the materials specified in - Subsection 6a, above, for a charge no more than the cost of - performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -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 -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply, and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License -may add an explicit geographical distribution limitation excluding those -countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser 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 Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "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 -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY 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 -LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms -of the ordinary General Public License). - - To apply these terms, attach the following notices to the library. -It is safest to attach them to the start of each source file to most -effectively convey the exclusion of warranty; and each file should -have at least the "copyright" line and a pointer to where the full -notice is found. - - - <one line to give the library's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or -your school, if any, to sign a "copyright disclaimer" for the library, -if necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James - Random Hacker. - - <signature of Ty Coon>, 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/COPYING.LGPL.3 b/COPYING.LGPL.3 deleted file mode 100644 index fc8a5de..0000000 --- a/COPYING.LGPL.3 +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser 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 -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/Makefile.am b/Makefile.am index 98e4a88..335efc6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,21 +1,11 @@ SUBDIRS = data \ src \ - bindings \ - example \ - tests \ - docs + tests EXTRA_DIST = \ - m4/introspection.m4 \ - gtk-doc.make \ - omf.make \ - xmldocs.make \ - autogen.sh \ - COPYING.LGPL.2.1 \ - COPYING.LGPL.3 \ ChangeLog -DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-localinstall --enable-introspection +DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall dist-hook: @if test -d "$(top_srcdir)/.bzr"; \ @@ -8,5 +8,4 @@ which gnome-autogen.sh || { } USE_GNOME2_MACROS=1 \ -USE_COMMON_DOC_BUILD=yes \ -gnome-autogen.sh --enable-gtk-doc $@ +gnome-autogen.sh $@ diff --git a/bindings/Makefile.am b/bindings/Makefile.am deleted file mode 100644 index 71abb6c..0000000 --- a/bindings/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -SUBDIRS = \ - mono \ - python diff --git a/bindings/mono/ApplicationIndicator.custom b/bindings/mono/ApplicationIndicator.custom deleted file mode 100644 index fcc52d7..0000000 --- a/bindings/mono/ApplicationIndicator.custom +++ /dev/null @@ -1,26 +0,0 @@ -[DllImport ("appindicator.dll")] -static extern int app_indicator_get_status (IntPtr i); - -[DllImport ("appindicator.dll")] -static extern int app_indicator_get_category (IntPtr i); - -[DllImport ("appindicator.dll")] -static extern void app_indicator_set_status (IntPtr i, int s); - - [GLib.Property ("status")] - public Status Status { - get { - return (Status) app_indicator_get_status (Handle); - } - - set { - app_indicator_set_status (Handle, (int) value); - } - } - - [GLib.Property ("category")] - public Category Category { - get { - return (Category) app_indicator_get_category (Handle); - } - } diff --git a/bindings/mono/AssemblyInfo.cs b/bindings/mono/AssemblyInfo.cs deleted file mode 100644 index 0417db6..0000000 --- a/bindings/mono/AssemblyInfo.cs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2010 Canonical Ltd. - * - * 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 <http://www.gnu.org/licenses/>. - * - * Authors: - * Cody Russell <cody.russell@canonical.com> - */ - -using System.Reflection; - -[assembly: AssemblyTitle ("Application Indicators")] -[assembly: AssemblyDescription ("Ubuntu Application Indicators")] -[assembly: AssemblyConfiguration ("")] -[assembly: AssemblyCompany ("Canonical, Ltd.")] -[assembly: AssemblyProduct ("Ubuntu")] -[assembly: AssemblyCopyright ("© 2010 Canonical, Ltd.")] -[assembly: AssemblyTrademark ("")] -[assembly: AssemblyCulture ("")] -[assembly: AssemblyVersion ("0.2")] diff --git a/bindings/mono/Makefile.am b/bindings/mono/Makefile.am deleted file mode 100644 index dfaa41f..0000000 --- a/bindings/mono/Makefile.am +++ /dev/null @@ -1,146 +0,0 @@ -SUBDIRS = . examples - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = appindicator-sharp-0.1.pc - -TEST = AppIndicator.Test.dll - -API = libappindicator-api.xml -MIDDLE_API = libappindicator-api.middle -RAW_API = libappindicator-api.raw -METADATA = libappindicator-api.metadata -ASSEMBLY_NAME = appindicator-sharp -ASSEMBLY_VERSION = 0.2.0.0 -ASSEMBLY = $(ASSEMBLY_NAME).dll -POLICY = policy.$(POLICY_VERSION).$(ASSEMBLY_NAME) -POLICY_VERSION = 0.0 -DLLPOLICY = $(POLICY).dll -POLICY1 = policy.$(POLICY1_VERSION).$(ASSEMBLY_NAME) -POLICY1_VERSION = 0.1 -DLLPOLICY1 = $(POLICY1).dll -WRAPPER_FREE_BINDING_SRC = $(top_srcdir)/src/app-indicator.c -WRAPPER_FREE_BINDING = app-indicator.c - -TARGET = \ - $(ASSEMBLY) \ - $(ASSEMBLY).config \ - $(DLLPOLICY) \ - $(POLICY).config \ - $(DLLPOLICY1) \ - $(POLICY1).config - -assemblydir = $(libdir)/cli/appindicator-sharp-0.1 -assembly_DATA = $(TARGET) - -CLEANFILES = \ - $(ASSEMBLY) \ - $(ASSEMBLY).mdb \ - generated-stamp \ - generated/*.cs \ - $(API) \ - $(MIDDLE_API) \ - $(RAW_API) \ - $(TEST) \ - $(DLLPOLICY) \ - $(DLLPOLICY1) \ - $(WRAPPER_FREE_BINDING) \ - $(POLICY).config \ - $(POLICY1).config - -DISTCLEANFILES = $(ASSEMBLY).config -TEST_SOURCES = TestIndicator.cs -customs = ApplicationIndicator.custom -EXTRA_DIST = \ - AssemblyInfo.cs \ - $(RAW_API) \ - $(METADATA) \ - appindicator-sharp-0.1.pc.in \ - appindicator-sharp.dll.config.in \ - app-indicator.sources.xml \ - $(ASSEMBLY_NAME).snk \ - $(POLICY).config.in \ - $(POLICY1).config.in \ - $(customs) \ - $(TEST_SOURCES) - -GACUTIL_FLAGS=-package $(ASSEMBLY_NAME) -root $(DESTDIR)$(prefix)/lib - -references = $(GTK_SHARP_LIBS) -test_references = $(GTK_SHARP_LIBS) $(NUNIT_LIBS) -r:$(ASSEMBLY) - -$(RAW_API): app-indicator.sources.xml $(WRAPPER_FREE_BINDING) - $(GAPI_PARSER) $(srcdir)/app-indicator.sources.xml - -$(WRAPPER_FREE_BINDING): $(WRAPPER_FREE_BINDING_SRC) - sed '/signals\[X_NEW_LABEL\] /,+6d' $(WRAPPER_FREE_BINDING_SRC) > $(WRAPPER_FREE_BINDING) - -$(MIDDLE_API): $(METADATA) $(RAW_API) - cp $(srcdir)/$(RAW_API) $(MIDDLE_API) - chmod u+w $(MIDDLE_API) - @if test -n '$(METADATA)'; then \ - echo "$(GAPI_FIXUP) --api=$(MIDDLE_API) --metadata=$(srcdir)/$(METADATA)"; \ - $(GAPI_FIXUP) --api=$(MIDDLE_API) --metadata=$(srcdir)/$(METADATA); \ - fi - -$(API): $(MIDDLE_API) Makefile.am - sed -e "s|PROP_ID_S|id|" \ - -e "s|PROP_STATUS_S|status|" \ - -e "s|PROP_CATEGORY_S|category|" \ - -e "s|PROP_ICON_NAME_S|icon-name|" \ - -e "s|PROP_ATTENTION_ICON_NAME_S|attention-icon-name|" \ - -e "s|PROP_ICON_THEME_PATH_S|icon-theme-path|" \ - -e "s|PROP_MENU_S|menu|" \ - -e "s|PROP_CONNECTED_S|connected|" \ - -e "s|PROP_LABEL_S|label|" \ - -e "s|PROP_LABEL_GUIDE_S|label-guide|" \ - -e "s|PROP_ORDERING_INDEX_S|ordering-index|" \ - $< > $@ - -api_includes = $(GTK_SHARP_CFLAGS) - -build_customs = $(addprefix $(srcdir)/, $(customs)) - -generated-stamp: $(API) $(build_customs) - rm -f generated/* && \ - $(GAPI_CODEGEN) --generate $(API) $(api_includes) \ - --customdir=$(srcdir) \ - --outdir=generated --assembly-name=$(ASSEMBLY_NAME) \ - && touch generated-stamp - -$(ASSEMBLY): generated-stamp $(srcdir)/AssemblyInfo.cs - @rm -f $(ASSEMBLY).mdb - $(CSC) $(CSFLAGS) -keyfile:$(srcdir)/$(ASSEMBLY_NAME).snk -nowarn:0169,0612,0618 -unsafe -out:$(ASSEMBLY) -target:library $(references) $(builddir)/$(GENERATED_SOURCES) $(srcdir)/AssemblyInfo.cs - -install-data-local: - echo "$(GACUTIL) -i $(ASSEMBLY_NAME).dll $(GACUTIL_FLAGS)"; \ - $(GACUTIL) -i $(ASSEMBLY_NAME).dll $(GACUTIL_FLAGS) || exit 1; - echo "$(GACUTIL) -i $(DLLPOLICY) $(GACUTIL_FLAGS)"; \ - $(GACUTIL) -i $(DLLPOLICY) $(GACUTIL_FLAGS) || exit 1; - -uninstall-local: - echo "$(GACUTIL) -u $(ASSEMBLY_NAME) $(GACUTIL_FLAGS)"; \ - $(GACUTIL) -u $(ASSEMBLY_NAME) $(GACUTIL_FLAGS) || exit 1; - echo "$(GACUTIL) -u $(DLLPOLICY) $(GACUTIL_FLAGS)"; \ - $(GACUTIL) -u $(POLICY) $(GACUTIL_FLAGS) || exit 1; - -$(TEST): $(ASSEMBLY) $(TEST_SOURCES) - $(CSC) -out:$(TEST) -target:library $(test_references) $(srcdir)/$(TEST_SOURCES) - -all: $(TEST) - -$(POLICY).config: $(POLICY).config.in Makefile - sed -e "s|@ASSEMBLY_NAME@|$(ASSEMBLY_NAME)|" \ - -e "s|@ASSEMBLY_VERSION@|$(ASSEMBLY_VERSION)|g" \ - $< > $@ - -$(DLLPOLICY): $(POLICY).config $(ASSEMBLY_NAME).snk Makefile - $(AL) -link:$(POLICY).config -out:$(DLLPOLICY) -keyfile:$(srcdir)/$(ASSEMBLY_NAME).snk - - -$(POLICY1).config: $(POLICY1).config.in Makefile - sed -e "s|@ASSEMBLY_NAME@|$(ASSEMBLY_NAME)|" \ - -e "s|@ASSEMBLY_VERSION@|$(ASSEMBLY_VERSION)|g" \ - $< > $@ - -$(DLLPOLICY1): $(POLICY1).config $(ASSEMBLY_NAME).snk Makefile - $(AL) -link:$(POLICY1).config -out:$(DLLPOLICY1) -keyfile:$(srcdir)/$(ASSEMBLY_NAME).snk diff --git a/bindings/mono/TestIndicator.cs b/bindings/mono/TestIndicator.cs deleted file mode 100644 index 3127342..0000000 --- a/bindings/mono/TestIndicator.cs +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2009 Canonical Ltd. - * - * 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 <http://www.gnu.org/licenses/>. - * - * Authors: - * Cody Russell <cody.russell@canonical.com> - */ - -using System; -using GLib; -using Gtk; -using AppIndicator; - -using NUnit.Framework; - -namespace Ayatana.AppIndicator.Test -{ - [TestFixture] - public class IndicatorTest - { - ApplicationIndicator indicator; - - private void Update () - { - while (MainContext.Pending ()) - MainContext.Iteration(true); - } - - [SetUp] - public void Init () - { - Application.Init (); - - Console.WriteLine ("Init()"); - - indicator = new ApplicationIndicator ("my-id", "my-name", Category.ApplicationStatus); - - Console.WriteLine ("Created indicator"); - - Update(); - } - - [Test] - public void TestProperties () - { - Console.WriteLine ("TestProperties()"); - - Assert.AreNotSame (indicator, null); - - Assert.AreEqual (indicator.IconName, "my-name"); - Assert.AreEqual (indicator.ID, "my-id"); - Assert.AreEqual (indicator.Status, Category.ApplicationStatus); - - Console.WriteLine ("End.."); - } - - [Test] - public void TestSetProperties () - { - Console.WriteLine ("TestSetProperties"); - - indicator.Status = Status.Attention; - indicator.AttentionIconName = "my-attention-name"; - - Assert.AreEqual (indicator.Status, Status.Attention); - Assert.AreEqual (indicator.AttentionIconName, "my-attention-name"); - - Console.WriteLine ("End.."); - } - } -}
\ No newline at end of file diff --git a/bindings/mono/app-indicator.sources.xml b/bindings/mono/app-indicator.sources.xml deleted file mode 100644 index 6cf28e9..0000000 --- a/bindings/mono/app-indicator.sources.xml +++ /dev/null @@ -1,12 +0,0 @@ -<gapi-parser-input> - <api filename="libappindicator-api.raw"> - <library name="appindicator.dll"> - <namespace name="AppIndicator"> - <file>app-indicator.c</file> - <file>../../src/app-indicator-enum-types.c</file> - <file>../../src/app-indicator-enum-types.h</file> - <file>../../src/app-indicator.h</file> - </namespace> - </library> - </api> -</gapi-parser-input> diff --git a/bindings/mono/appindicator-sharp-0.1.pc.in b/bindings/mono/appindicator-sharp-0.1.pc.in deleted file mode 100644 index 11ae719..0000000 --- a/bindings/mono/appindicator-sharp-0.1.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -assemblies_dir=${libdir}/cli/appindicator-sharp-0.1 - -Name: appindicator-sharp -Description: application indicators for .NET -Version: @VERSION@ -Libraries: ${assemblies_dir}/appindicator-sharp.dll ${assemblies_dir}/appindicator-sharp.dll.config -Requires: gtk-sharp-2.0 -Cflags: -Libs: -r:${assemblies_dir}/appindicator-sharp.dll diff --git a/bindings/mono/appindicator-sharp.dll.config.in b/bindings/mono/appindicator-sharp.dll.config.in deleted file mode 100644 index 2d21d00..0000000 --- a/bindings/mono/appindicator-sharp.dll.config.in +++ /dev/null @@ -1,7 +0,0 @@ -<configuration> - <dllmap dll="appindicator.dll" target="libappindicator@LIB_PREFIX@.1@LIB_SUFFIX@"/> - <dllmap dll="libgtk-2.0-0.dll" target="libgtk-2.0@LIB_PREFIX@.0@LIB_SUFFIX@"/> - <dllmap dll="libglib-2.0-0.dll" target="libglib-2.0@LIB_PREFIX@.0@LIB_SUFFIX@"/> - <dllmap dll="libgobject-2.0-0.dll" target="libgobject-2.0@LIB_PREFIX@.0@LIB_SUFFIX@"/> - <dllmap dll="libgthread-2.0-0.dll" target="libgthread-2.0@LIB_PREFIX@.0@LIB_SUFFIX@"/> -</configuration> diff --git a/bindings/mono/appindicator-sharp.snk b/bindings/mono/appindicator-sharp.snk Binary files differdeleted file mode 100644 index efb62d0..0000000 --- a/bindings/mono/appindicator-sharp.snk +++ /dev/null diff --git a/bindings/mono/examples/IndicatorExample.cs b/bindings/mono/examples/IndicatorExample.cs deleted file mode 100644 index c18a665..0000000 --- a/bindings/mono/examples/IndicatorExample.cs +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2009 Canonical Ltd. - * - * 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 <http://www.gnu.org/licenses/>. - * - * Authors: - * Cody Russell <cody.russell@canonical.com> - */ - -using Gtk; -using AppIndicator; - -public class IndicatorExample -{ - public static void Main () - { - Application.Init (); - - Window win = new Window ("Test"); - win.Resize (200, 200); - - Label label = new Label (); - label.Text = "Hello, world!"; - - win.Add (label); - - ApplicationIndicator indicator = new ApplicationIndicator ("Example", - "applications-microblogging-panel", - Category.ApplicationStatus); - - indicator.Status = Status.Attention; - - Menu menu = new Menu (); - menu.Append (new MenuItem ("Foo")); - menu.Append (new MenuItem ("Bar")); - - indicator.Menu = menu; - indicator.Menu.ShowAll (); - - win.ShowAll (); - - Application.Run (); - } -} diff --git a/bindings/mono/examples/Makefile.am b/bindings/mono/examples/Makefile.am deleted file mode 100644 index b929492..0000000 --- a/bindings/mono/examples/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -ASSEMBLY = IndicatorExample.exe -CSFILES = IndicatorExample.cs -CLEANFILES = $(ASSEMBLY) - -EXTRA_DIST = $(CSFILES) - -references = $(GTK_SHARP_LIBS) -r:$(top_builddir)/bindings/mono/appindicator-sharp.dll - -$(ASSEMBLY): $(CSFILES) Makefile.am - $(CSC) $(CSFLAGS) -out:$(ASSEMBLY) -target:exe $(references) $(srcdir)/$(CSFILES) - -all: $(ASSEMBLY) diff --git a/bindings/mono/examples/indicator-example.in b/bindings/mono/examples/indicator-example.in deleted file mode 100755 index 3eca155..0000000 --- a/bindings/mono/examples/indicator-example.in +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -MONO_PATH=@top_builddir@/bindings/mono @top_builddir@/bindings/mono/examples/IndicatorExample.exe diff --git a/bindings/mono/libappindicator-api.metadata b/bindings/mono/libappindicator-api.metadata deleted file mode 100644 index ccf58f1..0000000 --- a/bindings/mono/libappindicator-api.metadata +++ /dev/null @@ -1,58 +0,0 @@ -<?xml version="1.0"?> -<metadata> - <attr path="/api/namespace/object[@cname='AppIndicator']" name="name">ApplicationIndicator</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_attention_icon']" name="name">NewAttentionIcon</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_attention_icon']" name="cname">new-attention-icon</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_status']" name="name">NewStatus</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_status']" name="cname">new-status</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_label']" name="name">NewLabel</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_label']" name="cname">new-label</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='connection_changed']" name="name">ConnectionChanged</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='connection_changed']" name="cname">connection-changed</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_icon']" name="name">NewIcon</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_icon']" name="cname">new-icon</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_icon_theme_path']" name="name">NewIconThemePath</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_icon_theme_path']" name="cname">new-icon-theme-path</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_ID_S']" name="name">ID</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_CATEGORY_S']" name="hidden">true</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_STATUS_S']" name="hidden">true</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_ICON_NAME_S']" name="name">IconName</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_ATTENTION_ICON_NAME_S']" name="name">AttentionIconName</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_ICON_THEME_PATH_S']" name="name">IconThemePath</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_MENU_S']" name="name">Menu</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_MENU_S']" name="type">GtkMenu*</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_CONNECTED_S']" name="name">Connected</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_LABEL_S']" name="name">Label</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_LABEL_GUIDE_S']" name="name">LabelGuide</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_ORDERING_INDEX_S']" name="name">OrderingIndex</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/method[@name='SetMenu']" name="name">SetMenu</attr> - - <attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new']/*/*[@name='id']" name="property_name">id</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new']/*/*[@name='icon_name']" name="property_name">icon-name</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new']/*/*[@name='category']" name="property_name">category</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new_with_path']/*/*[@name='id']" name="property_name">id</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new_with_path']/*/*[@name='icon_name']" name="property_name">icon-name</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new_with_path']/*/*[@name='category']" name="property_name">category</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new_with_path']/*/*[@name='icon_theme_path']" name="property_name">icon-theme-path</attr> - - <remove-node path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_X_LABEL_S']" /> - <remove-node path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_X_LABEL_GUIDE_S']" /> - <remove-node path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_X_ORDERING_INDEX_S']" /> - - <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_id']" /> - <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_status']" /> - <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_icon']" /> - <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_icon_theme_path']" /> - <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_category']" /> - <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_attention_icon']" /> - <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_label']" /> - <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_label_guide']" /> - <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_ordering_index']" /> - - <remove-node path="/api/namespace/object/method[@cname='app_indicator_set_status']" /> - <remove-node path="/api/namespace/object/method[@cname='app_indicator_set_icon']" /> - <remove-node path="/api/namespace/object/method[@cname='app_indicator_set_icon_theme_path']" /> - <remove-node path="/api/namespace/object/method[@cname='app_indicator_set_attention_icon']" /> - <remove-node path="/api/namespace/object/method[@cname='app_indicator_set_label']" /> - <remove-node path="/api/namespace/object/method[@cname='app_indicator_set_ordering_index']" /> -</metadata> diff --git a/bindings/mono/policy.0.0.appindicator-sharp.config.in b/bindings/mono/policy.0.0.appindicator-sharp.config.in deleted file mode 100644 index e1fe0db..0000000 --- a/bindings/mono/policy.0.0.appindicator-sharp.config.in +++ /dev/null @@ -1,10 +0,0 @@ -<configuration> - <runtime> - <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> - <dependentAssembly> - <assemblyIdentity name="@ASSEMBLY_NAME@" publicKeyToken="bcae265d1c7ab4c2" /> - <bindingRedirect oldVersion="0.0.0.0-0.1.0.0" newVersion="@ASSEMBLY_VERSION@"/> - </dependentAssembly> - </assemblyBinding> - </runtime> -</configuration> diff --git a/bindings/mono/policy.0.1.appindicator-sharp.config.in b/bindings/mono/policy.0.1.appindicator-sharp.config.in deleted file mode 100644 index 0a8f9b1..0000000 --- a/bindings/mono/policy.0.1.appindicator-sharp.config.in +++ /dev/null @@ -1,10 +0,0 @@ -<configuration> - <runtime> - <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> - <dependentAssembly> - <assemblyIdentity name="@ASSEMBLY_NAME@" publicKeyToken="bcae265d1c7ab4c2" /> - <bindingRedirect oldVersion="0.1.0.0-@ASSEMBLY_VERSION@" newVersion="@ASSEMBLY_VERSION@"/> - </dependentAssembly> - </assemblyBinding> - </runtime> -</configuration> diff --git a/bindings/python/Makefile.am b/bindings/python/Makefile.am deleted file mode 100644 index 0b606db..0000000 --- a/bindings/python/Makefile.am +++ /dev/null @@ -1,40 +0,0 @@ -defsdir = $(datadir)/pygtk/2.0/defs -defs_DATA = appindicator.defs - -#CFLAGS = -Wall -Werror -INCLUDES = \ - -I$(top_srcdir)/src \ - -DG_LOG_DOMAIN=\"appindicator-python\" \ - -DDATADIR=\"$(datadir)\" \ - -DLIBDIR=\"$(libdir)\" \ - $(APPINDICATOR_PYTHON_CFLAGS) \ - $(PYTHON_INCLUDES) - -pkgpythondir = $(pyexecdir) -pkgpyexecdir = $(pyexecdir) - -pkgappindicatordir = $(pkgpythondir)/appindicator -pkgappindicator_PYTHON = __init__.py - -appindicatordir = $(pkgpyexecdir)/appindicator -appindicator_LTLIBRARIES = _appindicator.la - -_appindicator_la_LDFLAGS = -module -avoid-version -export-symbols-regex init_appindicator -lpyglib-2.0-python2.6 -_appindicator_la_LIBADD = $(APPINDICATOR_PYTHON_LIBS) -L$(top_builddir)/src/.libs -lappindicator -_appindicator_la_SOURCES = appindicatormodule.c -nodist__appindicator_la_SOURCES = appindicator.c - -CLEANFILES = appindicator.c -EXTRA_DIST = appindicator.override appindicator-arg-types.py $(defs_DATA) -appindicator.c: $(defs_DATA) appindicator.override - -%.c: %.defs - (cd $(srcdir) \ - && $(PYGTK_CODEGEN) \ - --register $(PYGTK_DEFSDIR)/gtk-types.defs \ - --register $(PYGTK_DEFSDIR)/gdk-types.defs \ - --load-types appindicator-arg-types.py \ - --override $*.override \ - --prefix py$* $*.defs) > gen-$*.c \ - && cp gen-$*.c $*.c \ - && rm -f gen-$*.c diff --git a/bindings/python/__init__.py b/bindings/python/__init__.py deleted file mode 100644 index 20e2140..0000000 --- a/bindings/python/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# Python bindings for libappindicator. -# -# Copyright 2009 Canonical Ltd. -# -# Authors: -# Eitan Isaacson <eitan@ascender.com> -# Neil Jagdish Patel <neil.patel@canonical.com> -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of either or both of the following licenses: -# -# 1) the GNU Lesser General Public License version 3, as published by the -# Free Software Foundation; and/or -# 2) the GNU Lesser General Public License version 2.1, 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 applicable version of the GNU Lesser General Public -# License for more details. -# -# You should have received a copy of both the GNU Lesser General Public -# License version 3 and version 2.1 along with this program. If not, see -# <http://www.gnu.org/licenses/> - -from _appindicator import * diff --git a/bindings/python/appindicator-arg-types.py b/bindings/python/appindicator-arg-types.py deleted file mode 100644 index 9d74aa0..0000000 --- a/bindings/python/appindicator-arg-types.py +++ /dev/null @@ -1,27 +0,0 @@ -# Python bindings for libappindicator. -# -# Copyright 2009 Canonical Ltd. -# -# Authors: -# Eitan Isaacson <eitan@ascender.com> -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of either or both of the following licenses: -# -# 1) the GNU Lesser General Public License version 3, as published by the -# Free Software Foundation; and/or -# 2) the GNU Lesser General Public License version 2.1, 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 applicable version of the GNU Lesser General Public -# License for more details. -# -# You should have received a copy of both the GNU Lesser General Public -# License version 3 and version 2.1 along with this program. If not, see -# <http://www.gnu.org/licenses/> - -import argtypes - diff --git a/bindings/python/appindicator.defs b/bindings/python/appindicator.defs deleted file mode 100644 index 5027a6d..0000000 --- a/bindings/python/appindicator.defs +++ /dev/null @@ -1,173 +0,0 @@ -;; -*- scheme -*- -; object definitions ... -(define-object Indicator - (in-module "App") - (parent "GObject") - (c-name "AppIndicator") - (gtype-id "APP_TYPE_INDICATOR") -) - -;; Enumerations and flags ... - -(define-enum IndicatorCategory - (in-module "App") - (c-name "AppIndicatorCategory") - (gtype-id "APP_INDICATOR_TYPE_INDICATOR_CATEGORY") - (values - '("ApplicationStatus" "APP_INDICATOR_CATEGORY_APPLICATION_STATUS") - '("Communications" "APP_INDICATOR_CATEGORY_COMMUNICATIONS") - '("SystemServices" "APP_INDICATOR_CATEGORY_SYSTEM_SERVICES") - '("Hardware" "APP_INDICATOR_CATEGORY_HARDWARE") - '("Other" "APP_INDICATOR_CATEGORY_OTHER") - ) -) - -(define-enum IndicatorStatus - (in-module "App") - (c-name "AppIndicatorStatus") - (gtype-id "APP_INDICATOR_TYPE_INDICATOR_STATUS") - (values - '("Passive" "APP_INDICATOR_STATUS_PASSIVE") - '("Active" "APP_INDICATOR_STATUS_ACTIVE") - '("NeedsAttention" "APP_INDICATOR_STATUS_ATTENTION") - ) -) - - -;; From app-indicator.h - -(define-function app_indicator_get_type - (c-name "app_indicator_get_type") - (return-type "GType") -) - -(define-function app_indicator_new_with_path - (c-name "app_indicator_new_with_path") - (is-constructor-of "AppIndicator") - (return-type "AppIndicator*") - (parameters - '("const-gchar*" "id") - '("const-gchar*" "icon_name") - '("AppIndicatorCategory" "category") - '("const-gchar*" "icon_theme_path" (null-ok) (default "NULL")) - ) -) - -(define-method set_status - (of-object "AppIndicator") - (c-name "app_indicator_set_status") - (return-type "none") - (parameters - '("AppIndicatorStatus" "status") - ) -) - -(define-method set_label - (of-object "AppIndicator") - (c-name "app_indicator_set_label") - (return-type "none") - (parameters - '("const-gchar*" "label" (null-ok)) - '("const-gchar*" "guide" (null-ok) (default "NULL")) - ) -) - -(define-method set_ordering_index - (of-object "AppIndicator") - (c-name "app_indicator_set_ordering_index") - (parameters - '("guint32" "ordering_index") - ) -) - -(define-method set_attention_icon - (of-object "AppIndicator") - (c-name "app_indicator_set_attention_icon") - (return-type "none") - (parameters - '("const-gchar*" "icon_name") - ) -) - -(define-method set_menu - (of-object "AppIndicator") - (c-name "app_indicator_set_menu") - (return-type "none") - (parameters - '("GtkMenu*" "menu") - ) -) - -(define-method set_icon - (of-object "AppIndicator") - (c-name "app_indicator_set_icon") - (return-type "none") - (parameters - '("const-gchar*" "icon_name") - ) -) - -(define-method set_icon_theme_path - (of-object "AppIndicator") - (c-name "app_indicator_set_icon_theme_path") - (return-type "none") - (parameters - '("const-gchar*" "icon_theme_path" (null-ok)) - ) -) - -(define-method get_id - (of-object "AppIndicator") - (c-name "app_indicator_get_id") - (return-type "const-gchar*") -) - -(define-method get_category - (of-object "AppIndicator") - (c-name "app_indicator_get_category") - (return-type "AppIndicatorCategory") -) - -(define-method get_status - (of-object "AppIndicator") - (c-name "app_indicator_get_status") - (return-type "AppIndicatorStatus") -) - -(define-method get_label - (of-object "AppIndicator") - (c-name "app_indicator_get_label") - (return-type "const-gchar*") -) - -(define-method get_label_guide - (of-object "AppIndicator") - (c-name "app_indicator_get_label_guide") - (return-type "const-gchar*") -) - -(define-method get_ordering_index - (of-object "AppIndicator") - (c-name "app_indicator_get_ordering_index") - (return-type "guint32") -) - -(define-method get_icon - (of-object "AppIndicator") - (c-name "app_indicator_get_icon") - (return-type "const-gchar*") -) - -(define-method get_icon_theme_path - (of-object "AppIndicator") - (c-name "app_indicator_get_icon_theme_path") - (return-type "const-gchar*") -) - -(define-method get_attention_icon - (of-object "AppIndicator") - (c-name "app_indicator_get_attention_icon") - (return-type "const-gchar*") -) - - diff --git a/bindings/python/appindicator.override b/bindings/python/appindicator.override deleted file mode 100644 index b252994..0000000 --- a/bindings/python/appindicator.override +++ /dev/null @@ -1,65 +0,0 @@ -/* -Python bindings for libappindicator. - -Copyright 2009 Canonical Ltd. - -Authors: - Eitan Isaacson <eitan@ascender.com> (original) - Neil Jagdish Patel <neil.patel@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of either or both of the following licenses: - -1) the GNU Lesser General Public License version 3, as published by the -Free Software Foundation; and/or -2) the GNU Lesser General Public License version 2.1, 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 applicable version of the GNU Lesser General Public -License for more details. - -You should have received a copy of both the GNU Lesser General Public -License version 3 and version 2.1 along with this program. If not, see -<http://www.gnu.org/licenses/> -*/ -%% -headers -#include <Python.h> -#include "../src/app-indicator.h" -#include "../src/app-indicator-enum-types.h" -#include <glib.h> -#include "pygobject.h" -#include "pyglib.h" -#include <pygtk/pygtk.h> - -typedef PyObject* (*to_pyobject_func) (gpointer data); - -#define APP_TYPE_INDICATOR APP_INDICATOR_TYPE - -void -_appindicator_add_constants(PyObject *module, const gchar *strip_prefix) -{ -#ifdef VERSION - PyModule_AddStringConstant(module, "__version__", VERSION); -#endif - pyg_enum_add(module, - "IndicatorCategory", - strip_prefix, - APP_INDICATOR_TYPE_INDICATOR_CATEGORY); - - pyg_enum_add(module, - "IndicatorStatus", - strip_prefix, - APP_INDICATOR_TYPE_INDICATOR_STATUS); - - if (PyErr_Occurred()) - PyErr_Print(); -} -%% -modulename appindicator -%% -import gobject.GObject as PyGObject_Type -import gtk.Menu as PyGtkMenu_Type diff --git a/bindings/python/appindicatormodule.c b/bindings/python/appindicatormodule.c deleted file mode 100644 index b66639c..0000000 --- a/bindings/python/appindicatormodule.c +++ /dev/null @@ -1,49 +0,0 @@ -/* -Python bindings for libappindicator. - -Copyright 2009 Canonical Ltd. - -Authors: - Eitan Isaacson <eitan@ascender.com> - Neil Jagdish Patel <neil.patel@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of either or both of the following licenses: - -1) the GNU Lesser General Public License version 3, as published by the -Free Software Foundation; and/or -2) the GNU Lesser General Public License version 2.1, 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 applicable version of the GNU Lesser General Public -License for more details. - -You should have received a copy of both the GNU Lesser General Public -License version 3 and version 2.1 along with this program. If not, see -<http://www.gnu.org/licenses/> -*/ -#include <pygobject.h> - -void pyappindicator_register_classes (PyObject *d); -extern PyMethodDef pyappindicator_functions[]; - -DL_EXPORT(void) -init_appindicator(void) -{ - PyObject *m, *d; - - init_pygobject (); - - m = Py_InitModule ("_appindicator", pyappindicator_functions); - d = PyModule_GetDict (m); - - pyappindicator_register_classes (d); - - _appindicator_add_constants (m, "APP_INDICATOR_"); - if (PyErr_Occurred ()) { - Py_FatalError ("can't initialise module appindicator"); - } -} diff --git a/configure.ac b/configure.ac index a35ca6f..09aef9b 100644 --- a/configure.ac +++ b/configure.ac @@ -26,14 +26,6 @@ AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal]) PKG_PROG_PKG_CONFIG ########################### -# GTK Doc -########################### - -GTK_DOC_CHECK([1.9]) -AC_CONFIG_MACRO_DIR(m4) - - -########################### # Dependencies ########################### @@ -72,75 +64,17 @@ AS_IF([test "x$with_gtk" = x3], ) AM_CONDITIONAL(USE_GTK3, [test "x$with_gtk" = x3]) -########################### -# GObject Introspection -########################### - -GOBJECT_INTROSPECTION_CHECK([0.6.7]) +LIBAPPINDICATOR_REQUIRED_VERSION=0.2.9 -########################### -# Vala API Generation -########################### - -AC_PATH_PROG([VALA_API_GEN], [vapigen]) - -########################### -# Check for Mono support -########################### +PKG_CHECK_MODULES(TEST, appindicator-0.1 >= $LIBAPPINDICATOR_REQUIRED_VERSION) -MONO_REQUIRED_VERSION=1.0 -PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false) - -AC_PATH_PROG(AL, al, no) -if test "x$AL" = "xno" ; then - AC_MSG_ERROR([No al tool found. You need to install Mono.]) -fi +AC_SUBST(TEST_CFLAGS) +AC_SUBST(TEST_LIBS) -if test "x$has_mono" = "xtrue" ; then - GENERATED_SOURCES=generated/*.cs - AC_PATH_PROG(RUNTIME, mono, no) +APP_INDICATOR_INCLUDE_BASE=`$PKG_CONFIG --variable=includedir appindicator-0.1` +APP_INDICATOR_INCLUDE="$APP_INDICATOR_INCLUDE_BASE/libappindicator-0.1/" - if test "x$RUNTIME" != "no" ; then - RUNTIME=mono - fi - - AC_PATH_PROG(CSC, gmcs, no) - LIB_PREFIX=.so - LIB_SUFFIX= -fi - -if test "x$CSC" = "xno" ; then - AC_MSG_ERROR([No Mono compiler found.]) -fi - -AC_PATH_PROG(GACUTIL, gacutil, no) -if test "x$GACUTIL" = "xno" ; then - AC_MSG_ERROR([No gacutil tool found]) -fi - -AC_SUBST(RUNTIME) -AC_SUBST(CSC) -AC_SUBST(GACUTIL) -AC_SUBST(LIB_PREFIX) -AC_SUBST(LIB_SUFFIX) -AC_SUBST(GENERATED_SOURCES) - -GLIB_SHARP_REQ_VERSION=2.12.1 -GTK_SHARP_REQ_VERSION=2.12 -PKG_CHECK_MODULES(GTK_SHARP, gtk-sharp-2.0 >= $GTK_SHARP_REQ_VERSION) -AC_SUBST(GTK_SHARP_LIBS) -AC_SUBST(GTK_SHARP_CFLAGS) - -PKG_CHECK_MODULES(GAPI, gapi-2.0 >= $GLIB_SHARP_REQ_VERSION) -AC_PATH_PROG(GAPI_PARSER, gapi2-parser, no) -AC_SUBST(GAPI_PARSER) -AC_PATH_PROG(GAPI_CODEGEN, gapi2-codegen, no) -AC_SUBST(GAPI_CODEGEN) -AC_PATH_PROG(GAPI_FIXUP, gapi2-fixup, no) -AC_SUBST(GAPI_FIXUP) - -PKG_CHECK_MODULES(NUNIT, nunit >= 2.4.7) -AC_SUBST(NUNIT_LIBS) +AC_SUBST(APP_INDICATOR_INCLUDE) ########################### # Check to see if we're local @@ -175,57 +109,14 @@ fi AC_SUBST(DBUSSERVICEDIR) ########################### -# Python -########################### - -PYGTK_REQUIRED=2.14.0 -PYGOBJECT_REQUIRED=0.22 - -AM_PATH_PYTHON(2.3.5) -AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)]) - -PKG_CHECK_MODULES(APPINDICATOR_PYTHON, - [ - pygtk-2.0 >= $PYGTK_REQUIRED - gtk+-2.0 >= $GTK_REQUIRED_VERSION - pygobject-2.0 >= $PYGOBJECT_REQUIRED - ]) -AC_SUBST(APPINDICATOR_PYTHON_CFLAGS) -AC_SUBST(APPINDICATOR_PYTHON_LIBS) - -AC_MSG_CHECKING(for pygtk defs) -PYGTK_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygtk-2.0` -AC_SUBST(PYGTK_DEFSDIR) -AC_MSG_RESULT($PYGTK_DEFSDIR) - -AC_MSG_CHECKING(for pygtk codegen) -PYGTK_CODEGEN="$PYTHON `$PKG_CONFIG --variable=codegendir pygtk-2.0`/codegen.py" -AC_SUBST(PYGTK_CODEGEN) -AC_MSG_RESULT($PYGTK_CODEGEN) - -########################### # Files ########################### AC_OUTPUT([ Makefile src/Makefile -src/appindicator-0.1.pc -src/appindicator3-0.1.pc -bindings/Makefile -bindings/mono/Makefile -bindings/mono/appindicator-sharp.dll.config -bindings/mono/appindicator-sharp-0.1.pc -bindings/mono/examples/Makefile -bindings/mono/examples/indicator-example -bindings/python/Makefile data/Makefile tests/Makefile -example/Makefile -docs/Makefile -docs/reference/Makefile -docs/reference/version.xml -docs/reference/libappindicator-docs.sgml ]) ########################### diff --git a/docs/Makefile.am b/docs/Makefile.am deleted file mode 100644 index f3ddc22..0000000 --- a/docs/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = reference diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am deleted file mode 100644 index 63606f9..0000000 --- a/docs/reference/Makefile.am +++ /dev/null @@ -1,117 +0,0 @@ -## Process this file with automake to produce Makefile.in - -# We require automake 1.6 at least. -AUTOMAKE_OPTIONS = 1.6 - -# This is a blank Makefile.am for using gtk-doc. -# Copy this to your project's API docs directory and modify the variables to -# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples -# of using the various options. - -# The name of the module, e.g. 'glib'. -DOC_MODULE=libappindicator - -# Uncomment for versioned docs and specify the version of the module, e.g. '2'. -#DOC_MODULE_VERSION=2 - - -# The top-level SGML file. You can change this if you want to. -DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml - -# The directory containing the source code. Relative to $(srcdir). -# gtk-doc will search all .c & .h files beneath here for inline comments -# documenting the functions and macros. -# e.g. DOC_SOURCE_DIR=../../../gtk -DOC_SOURCE_DIR=../../src - -# Extra options to pass to gtkdoc-scangobj. Not normally needed. -SCANGOBJ_OPTIONS=--nogtkinit --type-init-func="g_type_init()" - -# Extra options to supply to gtkdoc-scan. -# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" -#SCAN_OPTIONS=--rebuild-types --rebuild-sections -SCAN_OPTIONS= - -# Extra options to supply to gtkdoc-mkdb. -# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml -MKDB_OPTIONS=--sgml-mode --output-format=xml - -# Extra options to supply to gtkdoc-mktmpl -# e.g. MKTMPL_OPTIONS=--only-section-tmpl -MKTMPL_OPTIONS= - -# Extra options to supply to gtkdoc-mkhtml -MKHTML_OPTIONS= - -# Extra options to supply to gtkdoc-fixref. Not normally needed. -# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html -FIXXREF_OPTIONS= - -# Used for dependencies. The docs will be rebuilt if any of these change. -# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h -# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c -HFILE_GLOB=$(top_srcdir)/src/app-indicator*.h -CFILE_GLOB=$(top_srcdir)/src/app-indicator*.c - -# Header files to ignore when scanning. -# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h -IGNORE_HFILES= \ - app-indicator-enum-types.h \ - application-service-appstore.h \ - application-service-client.h \ - application-service-lru-file.h \ - application-service-marshal.h \ - application-service-server.h \ - application-service-watcher.h \ - dbus-properties-client.h \ - dbus-properties-server.h \ - dbus-shared.h \ - generate-id.h \ - notification-item-client.h \ - notification-item-server.h \ - notification-watcher-client.h \ - notification-watcher-server.h - -# Images to copy into HTML directory. -# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png -HTML_IMAGES= - -# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). -# e.g. content_files=running.sgml building.sgml changes-2.0.sgml -content_files=version.xml - -# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded -# These files must be listed here *and* in content_files -# e.g. expand_content_files=running.sgml -expand_content_files= - -# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. -# Only needed if you are using gtkdoc-scangobj to dynamically query widget -# signals and properties. -# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) -# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) -GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_srcdir)/src -I$(top_srcdir)/src $(INDICATOR_CFLAGS) -GTKDOC_LIBS=$(top_builddir)/src/libappindicator.la $(top_builddir)/src/libapplication.la $(INDICATOR_LIBS) - -# This includes the standard gtk-doc make rules, copied by gtkdocize. -include $(top_srcdir)/gtk-doc.local.make - -# Other files to distribute -# e.g. EXTRA_DIST += version.xml.in -EXTRA_DIST += version.xml.in libappindicator-docs.sgml.in - -# Files not to distribute -# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types -# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt -#DISTCLEANFILES += - -# Comment this out if you want your docs-status tested during 'make check' -TESTS = gtkdoc-in-srcdir - -gtkdoc-in-srcdir: Makefile.am - @echo "#!/bin/sh" > $@ - @echo "cd \"$(srcdir)\"" >> $@ - @echo "$(GTKDOC_CHECK)" >> $@ - @chmod +x $@ -DISTCLEANFILES = gtkdoc-in-srcdir - diff --git a/docs/reference/libappindicator-docs.sgml.in b/docs/reference/libappindicator-docs.sgml.in deleted file mode 100644 index 3a8e5de..0000000 --- a/docs/reference/libappindicator-docs.sgml.in +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" - "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" -[ - <!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'"> -]> -<book id="index"> - <bookinfo> - <title>libappindicator Reference Manual</title> - <releaseinfo> - for libappindicator @VERSION@ - </releaseinfo> - </bookinfo> - - <chapter> - <title>Base Classes for Applications</title> - <xi:include href="xml/app-indicator.xml"/> - - </chapter> - <chapter id="object-tree"> - <title>Object Hierarchy</title> - <xi:include href="xml/tree_index.sgml"/> - </chapter> - <index id="api-index-full"> - <title>API Index</title> - <xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include> - </index> - - <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include> -</book> diff --git a/docs/reference/libappindicator-sections.txt b/docs/reference/libappindicator-sections.txt deleted file mode 100644 index e0effd1..0000000 --- a/docs/reference/libappindicator-sections.txt +++ /dev/null @@ -1,42 +0,0 @@ -<SECTION> -<FILE>app-indicator</FILE> -APP_INDICATOR_TYPE -APP_INDICATOR -APP_INDICATOR_CLASS -IS_APP_INDICATOR -IS_APP_INDICATOR_CLASS -APP_INDICATOR_GET_CLASS -APP_INDICATOR_SIGNAL_NEW_ICON -APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON -APP_INDICATOR_SIGNAL_NEW_STATUS -APP_INDICATOR_SIGNAL_NEW_LABEL -APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH -APP_INDICATOR_SIGNAL_CONNECTION_CHANGED -AppIndicatorCategory -AppIndicatorStatus -AppIndicatorPrivate -<TITLE>AppIndicator</TITLE> -AppIndicator -AppIndicatorClass -app_indicator_get_type -app_indicator_new -app_indicator_new_with_path -app_indicator_set_status -app_indicator_set_attention_icon -app_indicator_set_menu -app_indicator_set_icon -app_indicator_set_icon_theme_path -app_indicator_set_label -app_indicator_set_ordering_index -app_indicator_get_id -app_indicator_get_category -app_indicator_get_status -app_indicator_get_icon -app_indicator_get_icon_theme_path -app_indicator_get_attention_icon -app_indicator_get_menu -app_indicator_get_label -app_indicator_get_label_guide -app_indicator_get_ordering_index -</SECTION> - diff --git a/docs/reference/libappindicator.types b/docs/reference/libappindicator.types deleted file mode 100644 index 5000a2d..0000000 --- a/docs/reference/libappindicator.types +++ /dev/null @@ -1 +0,0 @@ -app_indicator_get_type diff --git a/docs/reference/tmpl/libappindicator-unused.sgml b/docs/reference/tmpl/libappindicator-unused.sgml deleted file mode 100644 index 1428b51..0000000 --- a/docs/reference/tmpl/libappindicator-unused.sgml +++ /dev/null @@ -1,6 +0,0 @@ -<!-- ##### ARG AppIndicator:icon-path ##### --> -<para> - -</para> - - diff --git a/docs/reference/version.xml.in b/docs/reference/version.xml.in deleted file mode 100644 index d78bda9..0000000 --- a/docs/reference/version.xml.in +++ /dev/null @@ -1 +0,0 @@ -@VERSION@ diff --git a/example/Makefile.am b/example/Makefile.am deleted file mode 100644 index f4f2ab2..0000000 --- a/example/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ - -check_PROGRAMS = \ - simple-client - -######################################### -## simple-client -######################################### - -simple_client_SOURCES = \ - simple-client.c - -simple_client_CFLAGS = \ - $(INDICATOR_CFLAGS) \ - -Wall -Werror \ - -I$(top_srcdir)/src - -simple_client_LDADD = \ - $(INDICATOR_LIBS) \ - $(top_builddir)/src/libappindicator.la diff --git a/example/simple-client.c b/example/simple-client.c deleted file mode 100644 index f2fac6f..0000000 --- a/example/simple-client.c +++ /dev/null @@ -1,201 +0,0 @@ -/* -A small piece of sample code demonstrating a very simple application -with an indicator. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -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 <http://www.gnu.org/licenses/>. -*/ - -#include "app-indicator.h" -#include "libdbusmenu-glib/server.h" -#include "libdbusmenu-glib/menuitem.h" - -GMainLoop * mainloop = NULL; -static gboolean active = TRUE; -static gboolean can_haz_label = TRUE; - -static void -label_toggle_cb (GtkWidget * widget, gpointer data) -{ - can_haz_label = !can_haz_label; - - if (can_haz_label) { - gtk_menu_item_set_label(GTK_MENU_ITEM(widget), "Hide label"); - } else { - gtk_menu_item_set_label(GTK_MENU_ITEM(widget), "Show label"); - } - - return; -} - -static void -activate_clicked_cb (GtkWidget *widget, gpointer data) -{ - AppIndicator * ci = APP_INDICATOR(data); - - if (active) { - app_indicator_set_status (ci, APP_INDICATOR_STATUS_ATTENTION); - gtk_menu_item_set_label(GTK_MENU_ITEM(widget), "I'm okay now"); - active = FALSE; - } else { - app_indicator_set_status (ci, APP_INDICATOR_STATUS_ACTIVE); - gtk_menu_item_set_label(GTK_MENU_ITEM(widget), "Get Attention"); - active = TRUE; - } - -} - -static void -item_clicked_cb (GtkWidget *widget, gpointer data) -{ - const gchar *text = (const gchar *)data; - - g_print ("%s clicked!\n", text); -} - -static void -toggle_sensitivity_cb (GtkWidget *widget, gpointer data) -{ - GtkWidget *target = (GtkWidget *)data; - - gtk_widget_set_sensitive (target, !GTK_WIDGET_IS_SENSITIVE (target)); -} - -static void -image_clicked_cb (GtkWidget *widget, gpointer data) -{ - gtk_image_set_from_stock (GTK_IMAGE (GTK_IMAGE_MENU_ITEM (widget)->image), - GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU); -} - -static void -append_submenu (GtkWidget *item) -{ - GtkWidget *menu; - GtkWidget *mi; - GtkWidget *prev_mi; - - menu = gtk_menu_new (); - - mi = gtk_menu_item_new_with_label ("Sub 1"); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); - g_signal_connect (mi, "activate", - G_CALLBACK (item_clicked_cb), "Sub 1"); - - prev_mi = mi; - mi = gtk_menu_item_new_with_label ("Sub 2"); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); - g_signal_connect (mi, "activate", - G_CALLBACK (toggle_sensitivity_cb), prev_mi); - - mi = gtk_menu_item_new_with_label ("Sub 3"); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); - g_signal_connect (mi, "activate", - G_CALLBACK (item_clicked_cb), "Sub 3"); - - gtk_widget_show_all (menu); - - gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu); -} - -guint percentage = 0; - -static gboolean -percent_change (gpointer user_data) -{ - percentage = (percentage + 1) % 100; - if (can_haz_label) { - gchar * percentstr = g_strdup_printf("%d%%", percentage + 1); - app_indicator_set_label (APP_INDICATOR(user_data), percentstr, "100%"); - g_free(percentstr); - } else { - app_indicator_set_label (APP_INDICATOR(user_data), NULL, NULL); - } - return TRUE; -} - -int -main (int argc, char ** argv) -{ - GtkWidget *menu = NULL; - AppIndicator *ci = NULL; - - gtk_init (&argc, &argv); - - ci = app_indicator_new ("example-simple-client", - "indicator-messages", - APP_INDICATOR_CATEGORY_APPLICATION_STATUS); - - g_assert (IS_APP_INDICATOR (ci)); - g_assert (G_IS_OBJECT (ci)); - - app_indicator_set_status (ci, APP_INDICATOR_STATUS_ACTIVE); - app_indicator_set_attention_icon(ci, "indicator-messages-new"); - app_indicator_set_label (ci, "1%", "100%"); - - g_timeout_add_seconds(1, percent_change, ci); - - menu = gtk_menu_new (); - GtkWidget *item = gtk_check_menu_item_new_with_label ("1"); - g_signal_connect (item, "activate", - G_CALLBACK (item_clicked_cb), "1"); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - gtk_widget_show (item); - - item = gtk_radio_menu_item_new_with_label (NULL, "2"); - g_signal_connect (item, "activate", - G_CALLBACK (item_clicked_cb), "2"); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - gtk_widget_show (item); - - item = gtk_menu_item_new_with_label ("3"); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - append_submenu (item); - gtk_widget_show (item); - - GtkWidget *toggle_item = gtk_menu_item_new_with_label ("Toggle 3"); - g_signal_connect (toggle_item, "activate", - G_CALLBACK (toggle_sensitivity_cb), item); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), toggle_item); - gtk_widget_show(toggle_item); - - item = gtk_image_menu_item_new_from_stock (GTK_STOCK_NEW, NULL); - g_signal_connect (item, "activate", - G_CALLBACK (image_clicked_cb), NULL); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - gtk_widget_show(item); - - item = gtk_menu_item_new_with_label ("Get Attention"); - g_signal_connect (item, "activate", - G_CALLBACK (activate_clicked_cb), ci); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - gtk_widget_show(item); - - item = gtk_menu_item_new_with_label ("Show label"); - label_toggle_cb(item, ci); - g_signal_connect (item, "activate", - G_CALLBACK (label_toggle_cb), ci); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - gtk_widget_show(item); - - app_indicator_set_menu (ci, GTK_MENU (menu)); - - mainloop = g_main_loop_new(NULL, FALSE); - g_main_loop_run(mainloop); - - return 0; -} diff --git a/gtk-doc.local.make b/gtk-doc.local.make deleted file mode 100644 index 3dcda60..0000000 --- a/gtk-doc.local.make +++ /dev/null @@ -1,194 +0,0 @@ -# -*- mode: makefile -*- - -#################################### -# Everything below here is generic # -#################################### - -if GTK_DOC_USE_LIBTOOL -GTKDOC_CC = $(LIBTOOL) --mode=compile $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -GTKDOC_LD = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -GTKDOC_RUN = $(LIBTOOL) --mode=execute -else -GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -GTKDOC_RUN = sh -c -endif - -# We set GPATH here; this gives us semantics for GNU make -# which are more like other make's VPATH, when it comes to -# whether a source that is a target of one rule is then -# searched for in VPATH/GPATH. -# -GPATH = $(srcdir) - -TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE) - -EXTRA_DIST = \ - $(content_files) \ - $(HTML_IMAGES) \ - $(DOC_MAIN_SGML_FILE) - -DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \ - $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp - -SCANOBJ_FILES = \ - $(DOC_MODULE).args \ - $(DOC_MODULE).hierarchy \ - $(DOC_MODULE).interfaces \ - $(DOC_MODULE).prerequisites \ - $(DOC_MODULE).signals - -REPORT_FILES = \ - $(DOC_MODULE)-undocumented.txt \ - $(DOC_MODULE)-undeclared.txt \ - $(DOC_MODULE)-unused.txt - -CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) - -if ENABLE_GTK_DOC -all-local: html-build.stamp -else -all-local: -endif - -docs: html-build.stamp - -$(REPORT_FILES): sgml-build.stamp - -#### scan #### - -scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) - @echo 'gtk-doc: Scanning header files' - @-chmod -R u+w $(srcdir) - cd $(srcdir) && \ - gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES) - if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \ - CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \ - else \ - cd $(srcdir) ; \ - for i in $(SCANOBJ_FILES) ; do \ - test -f $$i || touch $$i ; \ - done \ - fi - touch scan-build.stamp - -$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp - @true - -#### templates #### - -tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt - @echo 'gtk-doc: Rebuilding template files' - @-chmod -R u+w $(srcdir) - cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS) - touch tmpl-build.stamp - -tmpl.stamp: tmpl-build.stamp - @true - -tmpl/*.sgml: - @true - - -#### xml #### - -sgml-build.stamp: tmpl.stamp $(HFILE_GLOB) $(CFILE_GLOB) $(DOC_MODULE)-sections.txt $(srcdir)/tmpl/*.sgml $(expand_content_files) - @echo 'gtk-doc: Building XML' - @-chmod -R u+w $(srcdir) - cd $(srcdir) && \ - gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $(MKDB_OPTIONS) - touch sgml-build.stamp - -sgml.stamp: sgml-build.stamp - @true - -#### html #### - -html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) - @echo 'gtk-doc: Building HTML' - @-chmod -R u+w $(srcdir) - rm -rf $(srcdir)/html - mkdir $(srcdir)/html - mkhtml_options=""; \ - gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \ - if test "$(?)" = "0"; then \ - mkhtml_options=--path="$(srcdir)"; \ - fi - cd $(srcdir)/html && gtkdoc-mkhtml $(mkhtml_options) $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) - test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html ) - @echo 'gtk-doc: Fixing cross-references' - cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) - touch html-build.stamp - -############## - -clean-local: - rm -f *~ *.bak - rm -rf .libs - -distclean-local: - cd $(srcdir) && \ - rm -rf xml $(REPORT_FILES) \ - $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt - -maintainer-clean-local: clean - cd $(srcdir) && rm -rf xml html - -install-data-local: - installfiles=`echo $(srcdir)/html/*`; \ - if test "$$installfiles" = '$(srcdir)/html/*'; \ - then echo '-- Nothing to install' ; \ - else \ - if test -n "$(DOC_MODULE_VERSION)"; then \ - installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \ - else \ - installdir="$(DESTDIR)$(TARGET_DIR)"; \ - fi; \ - $(mkinstalldirs) $${installdir} ; \ - for i in $$installfiles; do \ - echo '-- Installing '$$i ; \ - $(INSTALL_DATA) $$i $${installdir}; \ - done; \ - if test -n "$(DOC_MODULE_VERSION)"; then \ - mv -f $${installdir}/$(DOC_MODULE).devhelp2 \ - $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \ - mv -f $${installdir}/$(DOC_MODULE).devhelp \ - $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp; \ - fi; \ - ! which gtkdoc-rebase >/dev/null 2>&1 || \ - gtkdoc-rebase --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir} ; \ - fi - -uninstall-local: - if test -n "$(DOC_MODULE_VERSION)"; then \ - installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \ - else \ - installdir="$(DESTDIR)$(TARGET_DIR)"; \ - fi; \ - rm -rf $${installdir} - -# -# Require gtk-doc when making dist -# -if ENABLE_GTK_DOC -dist-check-gtkdoc: -else -dist-check-gtkdoc: - @echo "*** gtk-doc must be installed and enabled in order to make dist" - @false -endif - -dist-hook: dist-check-gtkdoc dist-hook-local - mkdir $(distdir)/tmpl - mkdir $(distdir)/xml - mkdir $(distdir)/html - -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl - -cp $(srcdir)/xml/*.xml $(distdir)/xml - -cp $(srcdir)/html/* $(distdir)/html - -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/ - -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/ - cd $(distdir) && rm -f $(DISTCLEANFILES) - ! which gtkdoc-rebase >/dev/null 2>&1 || \ - gtkdoc-rebase --online --relative --html-dir=$(distdir)/html - -.PHONY : dist-hook-local docs diff --git a/m4/introspection.m4 b/m4/introspection.m4 deleted file mode 100644 index 589721c..0000000 --- a/m4/introspection.m4 +++ /dev/null @@ -1,94 +0,0 @@ -dnl -*- mode: autoconf -*- -dnl Copyright 2009 Johan Dahlin -dnl -dnl This file is free software; the author(s) gives unlimited -dnl permission to copy and/or distribute it, with or without -dnl modifications, as long as this notice is preserved. -dnl - -# serial 1 - -m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL], -[ - AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first - AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first - AC_BEFORE([LT_INIT],[$0])dnl setup libtool first - - dnl enable/disable introspection - m4_if([$2], [require], - [dnl - enable_introspection=yes - ],[dnl - AC_ARG_ENABLE(introspection, - AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]], - [Enable introspection for this build]),, - [enable_introspection=auto]) - ])dnl - - AC_MSG_CHECKING([for gobject-introspection]) - - dnl presence/version checking - AS_CASE([$enable_introspection], - [no], [dnl - found_introspection="no (disabled, use --enable-introspection to enable)" - ],dnl - [yes],[dnl - PKG_CHECK_EXISTS([gobject-introspection-1.0],, - AC_MSG_ERROR([gobject-introspection-1.0 is not installed])) - PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], - found_introspection=yes, - AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME])) - ],dnl - [auto],[dnl - PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no) - ],dnl - [dnl - AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@]) - ])dnl - - AC_MSG_RESULT([$found_introspection]) - - INTROSPECTION_SCANNER= - INTROSPECTION_COMPILER= - INTROSPECTION_GENERATE= - INTROSPECTION_GIRDIR= - INTROSPECTION_TYPELIBDIR= - if test "x$found_introspection" = "xyes"; then - INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0` - INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0` - INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0` - INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0` - INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)" - INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0` - INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0` - INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection - fi - AC_SUBST(INTROSPECTION_SCANNER) - AC_SUBST(INTROSPECTION_COMPILER) - AC_SUBST(INTROSPECTION_GENERATE) - AC_SUBST(INTROSPECTION_GIRDIR) - AC_SUBST(INTROSPECTION_TYPELIBDIR) - AC_SUBST(INTROSPECTION_CFLAGS) - AC_SUBST(INTROSPECTION_LIBS) - AC_SUBST(INTROSPECTION_MAKEFILE) - - AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes") -]) - - -dnl Usage: -dnl GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version]) - -AC_DEFUN([GOBJECT_INTROSPECTION_CHECK], -[ - _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1]) -]) - -dnl Usage: -dnl GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version]) - - -AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE], -[ - _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require]) -]) diff --git a/src/AppIndicator-0.1.metadata b/src/AppIndicator-0.1.metadata deleted file mode 100644 index e4d068e..0000000 --- a/src/AppIndicator-0.1.metadata +++ /dev/null @@ -1 +0,0 @@ -AppIndicator name="AppIndicator" diff --git a/src/Makefile.am b/src/Makefile.am index 9e58943..23f5727 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,22 +1,13 @@ if USE_GTK3 VER=3 -lib_LTLIBRARIES = libappindicator3.la -GTKGIR = Gtk-3.0 -GTKVAPI = gtk+-3.0 else VER= -lib_LTLIBRARIES = libappindicator.la -GTKGIR = Gtk-2.0 -GTKVAPI = gtk+-2.0 endif CLEANFILES = DISTCLEANFILES = BUILT_SOURCES = -EXTRA_DIST = \ - appindicator-0.1.pc.in \ - appindicator3-0.1.pc.in \ - AppIndicator-0.1.metadata +EXTRA_DIST = include $(top_srcdir)/Makefile.am.enum include $(top_srcdir)/Makefile.am.marshal @@ -69,75 +60,23 @@ indicator_application_service_SOURCES = \ indicator_application_service_CFLAGS = \ $(INDICATOR_CFLAGS) \ + -I$(APP_INDICATOR_INCLUDE) \ -DDATADIR="\"$(pkgdatadir)\"" \ -Wall -Werror \ -DG_LOG_DOMAIN=\"indicator-application-service\" indicator_application_service_LDADD = \ - $(INDICATOR_LIBS) \ - libappindicator$(VER).la + $(INDICATOR_LIBS) glib_marshal_list = application-service-marshal.list glib_marshal_prefix = _application_service_marshal -################################## -# Library -################################## - -pkgconfig_DATA = appindicator$(VER)-0.1.pc -pkgconfigdir = $(libdir)/pkgconfig - glib_enum_h = app-indicator-enum-types.h glib_enum_c = app-indicator-enum-types.c -glib_enum_headers = $(addprefix $(srcdir)/, $(libappindicator_headers)) +glib_enum_headers = $(wildcard $(APP_INDICATOR_INCLUDE)/libappindicator/*.h) DISTCLEANFILES += app-indicator-enum-types.c -libappindicatorincludedir=$(includedir)/libappindicator$(VER)-0.1/libappindicator - -libappindicator_headers = \ - app-indicator.h - -libappindicatorinclude_HEADERS = \ - $(libappindicator_headers) \ - $(glib_enum_h) - -BUILT_SOURCES += \ - notification-watcher-client.h \ - notification-item-server.h - -libappindicator_la_SOURCES = \ - $(libappindicator_headers) \ - app-indicator-enum-types.c \ - app-indicator.c \ - application-service-marshal.c \ - generate-id.h \ - generate-id.c - -libappindicator_la_LDFLAGS = \ - -version-info 1:0:0 \ - -no-undefined \ - -export-symbols-regex "^[^_d].*" - -libappindicator_la_CFLAGS = \ - $(INDICATOR_CFLAGS) \ - -Wall -Werror \ - -DG_LOG_DOMAIN=\"libappindicator\" - -libappindicator_la_LIBADD = \ - $(INDICATOR_LIBS) - -# We duplicate these here because Automake won't let us use $(VER) on the left hand side. -# Since we carefully use $(VER) in the right hand side above, we can assign the same values. -# Only one version of the library is every compiled at the same time, so it is safe to reuse -# the right hand sides like this. -libappindicator3includedir = $(libappindicatorincludedir) -libappindicator3include_HEADERS = $(libappindicatorinclude_HEADERS) -libappindicator3_la_SOURCES = $(libappindicator_la_SOURCES) -libappindicator3_la_LDFLAGS = $(libappindicator_la_LDFLAGS) -libappindicator3_la_CFLAGS = $(libappindicator_la_CFLAGS) -libappindicator3_la_LIBADD = $(libappindicator_la_LIBADD) - ################################## # DBus Specs ################################## @@ -170,66 +109,3 @@ BUILT_SOURCES += \ CLEANFILES += $(BUILT_SOURCES) EXTRA_DIST += $(DBUS_SPECS) - -######################### -# GObject Introsepction -######################### - --include $(INTROSPECTION_MAKEFILE) -INTROSPECTION_GIRS = -INTROSPECTION_SCANNER_ARGS = \ - --add-include-path=$(srcdir) \ - $(addprefix --c-include=src/, $(introspection_sources)) \ - --symbol-prefix=app \ - --identifier-prefix=App -INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir) - -if HAVE_INTROSPECTION - -introspection_sources = \ - $(addprefix $(srcdir)/,$(libappindicator_headers)) - -AppIndicator$(VER)-0.1.gir: libappindicator$(VER).la -AppIndicator_0_1_gir_INCLUDES = \ - GObject-2.0 \ - $(GTKGIR) -AppIndicator_0_1_gir_CFLAGS = $(INDICATOR_CFLAGS) -I$(srcdir) -I$(top_builddir)/src -AppIndicator_0_1_gir_LIBS = libappindicator$(VER).la -AppIndicator_0_1_gir_FILES = $(introspection_sources) - -AppIndicator3_0_1_gir_INCLUDES = $(AppIndicator_0_1_gir_INCLUDES) -AppIndicator3_0_1_gir_CFLAGS = $(AppIndicator_0_1_gir_CFLAGS) -AppIndicator3_0_1_gir_LIBS = $(AppIndicator_0_1_gir_LIBS) -AppIndicator3_0_1_gir_FILES = $(AppIndicator_0_1_gir_FILES) - -INTROSPECTION_GIRS += AppIndicator$(VER)-0.1.gir - -girdir = $(datadir)/gir-1.0 -gir_DATA = $(INTROSPECTION_GIRS) - -typelibdir = $(libdir)/girepository-1.0 -typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) - -CLEANFILES += $(gir_DATA) $(typelib_DATA) - -endif - -######################### -# VAPI Files -######################### - -if HAVE_INTROSPECTION - -vapidir = $(datadir)/vala/vapi -vapi_DATA = AppIndicator$(VER)-0.1.vapi - -AppIndicator$(VER)-0.1.vapi: AppIndicator$(VER)-0.1.gir Makefile.am - $(VALA_API_GEN) --library=AppIndicator$(VER)-0.1 \ - --pkg $(GTKVAPI) \ - --vapidir=$(top_builddir)/src \ - $< - -CLEANFILES += $(vapi_DATA) - -endif - diff --git a/src/app-indicator.c b/src/app-indicator.c deleted file mode 100644 index 98663c1..0000000 --- a/src/app-indicator.c +++ /dev/null @@ -1,2118 +0,0 @@ -/* -An object to represent the application as an application indicator -in the system panel. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - Cody Russell <cody.russell@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of either or both of the following licenses: - -1) the GNU Lesser General Public License version 3, as published by the - Free Software Foundation; and/or -2) the GNU Lesser General Public License version 2.1, 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 applicable version of the GNU Lesser General Public -License for more details. - -You should have received a copy of both the GNU Lesser General Public -License version 3 and version 2.1 along with this program. If not, see -<http://www.gnu.org/licenses/> -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-bindings.h> - -#include <libdbusmenu-glib/server.h> -#ifdef HAVE_GTK3 -#include <libdbusmenu-gtk3/client.h> -#else -#include <libdbusmenu-gtk/client.h> -#endif - -#include "app-indicator.h" -#include "app-indicator-enum-types.h" -#include "application-service-marshal.h" - -#include "notification-item-server.h" -#include "notification-watcher-client.h" - -#include "dbus-shared.h" -#include "generate-id.h" - -#define PANEL_ICON_SUFFIX "panel" - -/** - AppIndicatorPrivate: - - All of the private data in an instance of a - application indicator. -*/ -/* Private Fields - @id: The ID of the indicator. Maps to AppIndicator:id. - @category: Which category the indicator is. Maps to AppIndicator:category. - @status: The status of the indicator. Maps to AppIndicator:status. - @icon_name: The name of the icon to use. Maps to AppIndicator:icon-name. - @attention_icon_name: The name of the attention icon to use. Maps to AppIndicator:attention-icon-name. - @menu: The menu for this indicator. Maps to AppIndicator:menu - @watcher_proxy: The proxy connection to the watcher we're connected to. If we're not connected to one this will be %NULL. -*/ -struct _AppIndicatorPrivate { - /*< Private >*/ - /* Properties */ - gchar *id; - gchar *clean_id; - AppIndicatorCategory category; - AppIndicatorStatus status; - gchar *icon_name; - gchar *attention_icon_name; - gchar *icon_theme_path; - DbusmenuServer *menuservice; - GtkWidget *menu; - guint32 ordering_index; - gchar * label; - gchar * label_guide; - guint label_change_idle; - - GtkStatusIcon * status_icon; - gint fallback_timer; - - /* Fun stuff */ - DBusGProxy *watcher_proxy; - DBusGConnection *connection; - DBusGProxy * dbus_proxy; -}; - -/* Signals Stuff */ -enum { - NEW_ICON, - NEW_ATTENTION_ICON, - NEW_STATUS, - NEW_LABEL, - X_NEW_LABEL, - CONNECTION_CHANGED, - NEW_ICON_THEME_PATH, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - -/* Enum for the properties so that they can be quickly - found and looked up. */ -enum { - PROP_0, - PROP_ID, - PROP_CATEGORY, - PROP_STATUS, - PROP_ICON_NAME, - PROP_ATTENTION_ICON_NAME, - PROP_ICON_THEME_PATH, - PROP_MENU, - PROP_CONNECTED, - PROP_LABEL, - PROP_LABEL_GUIDE, - PROP_X_LABEL, - PROP_X_LABEL_GUIDE, - PROP_ORDERING_INDEX, - PROP_X_ORDERING_INDEX -}; - -/* The strings so that they can be slowly looked up. */ -#define PROP_ID_S "id" -#define PROP_CATEGORY_S "category" -#define PROP_STATUS_S "status" -#define PROP_ICON_NAME_S "icon-name" -#define PROP_ATTENTION_ICON_NAME_S "attention-icon-name" -#define PROP_ICON_THEME_PATH_S "icon-theme-path" -#define PROP_MENU_S "menu" -#define PROP_CONNECTED_S "connected" -#define PROP_LABEL_S "label" -#define PROP_LABEL_GUIDE_S "label-guide" -#define PROP_X_LABEL_S ("x-ayatana-" PROP_LABEL_S) -#define PROP_X_LABEL_GUIDE_S ("x-ayatana-" PROP_LABEL_GUIDE_S) -#define PROP_ORDERING_INDEX_S "ordering-index" -#define PROP_X_ORDERING_INDEX_S ("x-ayatana-" PROP_ORDERING_INDEX_S) - -/* Private macro, shhhh! */ -#define APP_INDICATOR_GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), APP_INDICATOR_TYPE, AppIndicatorPrivate)) - -/* Signal wrapper */ -#define APP_INDICATOR_SIGNAL_X_NEW_LABEL ("x-ayatana-" APP_INDICATOR_SIGNAL_NEW_LABEL) - -/* Default Path */ -#define DEFAULT_ITEM_PATH "/org/ayatana/NotificationItem" - -/* More constants */ -#define DEFAULT_FALLBACK_TIMER 100 /* in milliseconds */ - -/* Boiler plate */ -static void app_indicator_class_init (AppIndicatorClass *klass); -static void app_indicator_init (AppIndicator *self); -static void app_indicator_dispose (GObject *object); -static void app_indicator_finalize (GObject *object); -/* Property functions */ -static void app_indicator_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); -static void app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -/* Other stuff */ -static void signal_label_change (AppIndicator * self); -static void check_connect (AppIndicator * self); -static void register_service_cb (DBusGProxy * proxy, GError * error, gpointer data); -static void start_fallback_timer (AppIndicator * self, gboolean disable_timeout); -static gboolean fallback_timer_expire (gpointer data); -static GtkStatusIcon * fallback (AppIndicator * self); -static void status_icon_status_wrapper (AppIndicator * self, const gchar * status, gpointer data); -static void status_icon_changes (AppIndicator * self, gpointer data); -static void status_icon_activate (GtkStatusIcon * icon, gpointer data); -static void unfallback (AppIndicator * self, GtkStatusIcon * status_icon); -static gchar * append_panel_icon_suffix (const gchar * icon_name); -static void watcher_proxy_destroyed (GObject * object, gpointer data); -static void client_menu_changed (GtkWidget *widget, GtkWidget *child, AppIndicator *indicator); -static void submenu_changed (GtkWidget *widget, GtkWidget *child, gpointer data); - -static void theme_changed_cb (GtkIconTheme * theme, gpointer user_data); - -/* GObject type */ -G_DEFINE_TYPE (AppIndicator, app_indicator, G_TYPE_OBJECT); - -static void -app_indicator_class_init (AppIndicatorClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - g_type_class_add_private (klass, sizeof (AppIndicatorPrivate)); - - /* Clean up */ - object_class->dispose = app_indicator_dispose; - object_class->finalize = app_indicator_finalize; - - /* Property funcs */ - object_class->set_property = app_indicator_set_property; - object_class->get_property = app_indicator_get_property; - - /* Our own funcs */ - klass->fallback = fallback; - klass->unfallback = unfallback; - - /* Properties */ - - /** - AppIndicator:id: - - The ID for this indicator, which should be unique, but used consistently - by this program and its indicator. - */ - g_object_class_install_property (object_class, - PROP_ID, - g_param_spec_string(PROP_ID_S, - "The ID for this indicator", - "An ID that should be unique, but used consistently by this program and its indicator.", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY)); - - /** - AppIndicator:category: - - The type of indicator that this represents. Please don't use 'Other'. - Defaults to 'ApplicationStatus'. - */ - g_object_class_install_property (object_class, - PROP_CATEGORY, - g_param_spec_string (PROP_CATEGORY_S, - "Indicator Category", - "The type of indicator that this represents. Please don't use 'other'. Defaults to 'ApplicationStatus'.", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY)); - - /** - AppIndicator:status: - - Whether the indicator is shown or requests attention. Defaults to - 'Passive'. - */ - g_object_class_install_property (object_class, - PROP_STATUS, - g_param_spec_string (PROP_STATUS_S, - "Indicator Status", - "Whether the indicator is shown or requests attention. Defaults to 'Passive'.", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - /** - AppIndicator:icon-name: - - The name of the regular icon that is shown for the indicator. - */ - g_object_class_install_property(object_class, - PROP_ICON_NAME, - g_param_spec_string (PROP_ICON_NAME_S, - "An icon for the indicator", - "The default icon that is shown for the indicator.", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT)); - - /** - AppIndicator:attention-icon-name: - - If the indicator sets it's status to %APP_INDICATOR_STATUS_ATTENTION - then this icon is shown. - */ - g_object_class_install_property (object_class, - PROP_ATTENTION_ICON_NAME, - g_param_spec_string (PROP_ATTENTION_ICON_NAME_S, - "An icon to show when the indicator request attention.", - "If the indicator sets it's status to 'attention' then this icon is shown.", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - AppIndicator:icon-theme-path: - - An additional place to look for icon names that may be installed by the - application. - */ - g_object_class_install_property(object_class, - PROP_ICON_THEME_PATH, - g_param_spec_string (PROP_ICON_THEME_PATH_S, - "An additional path for custom icons.", - "An additional place to look for icon names that may be installed by the application.", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT)); - - /** - AppIndicator:menu: - - A method for getting the menu path as a string for DBus. - */ - g_object_class_install_property(object_class, - PROP_MENU, - g_param_spec_boxed (PROP_MENU_S, - "The object path of the menu on DBus.", - "A method for getting the menu path as a string for DBus.", - DBUS_TYPE_G_OBJECT_PATH, - G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - - /** - AppIndicator:connected: - - Pretty simple, %TRUE if we have a reasonable expectation of being - displayed through this object. You should hide your TrayIcon if so. - */ - g_object_class_install_property (object_class, - PROP_CONNECTED, - g_param_spec_boolean (PROP_CONNECTED_S, - "Whether we're conneced to a watcher", - "Pretty simple, true if we have a reasonable expectation of being displayed through this object. You should hide your TrayIcon if so.", - FALSE, - G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - /** - AppIndicator:label: - - A label that can be shown next to the string in the application - indicator. The label will not be shown unless there is an icon - as well. The label is useful for numerical and other frequently - updated information. In general, it shouldn't be shown unless a - user requests it as it can take up a significant amount of space - on the user's panel. This may not be shown in all visualizations. - */ - g_object_class_install_property(object_class, - PROP_LABEL, - g_param_spec_string (PROP_LABEL_S, - "A label next to the icon", - "A label to provide dynamic information.", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - AppIndicator:label-guide: - - An optional string to provide guidance to the panel on how big - the #AppIndicator:label string could get. If this is set correctly - then the panel should never 'jiggle' as the string adjusts through - out the range of options. For instance, if you were providing a - percentage like "54% thrust" in #AppIndicator:label you'd want to - set this string to "100% thrust" to ensure space when Scotty can - get you enough power. - */ - g_object_class_install_property(object_class, - PROP_LABEL_GUIDE, - g_param_spec_string (PROP_LABEL_GUIDE_S, - "A string to size the space available for the label.", - "To ensure that the label does not cause the panel to 'jiggle' this string should provide information on how much space it could take.", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - AppIndicator:ordering-index: - - The ordering index is an odd parameter, and if you think you don't need - it you're probably right. In general, the application indicator try - to place the applications in a recreatable place taking into account - which category they're in to try and group them. But, there are some - cases where you'd want to ensure indicators are next to each other. - To do that you can override the generated ordering index and replace it - with a new one. Again, you probably don't want to be doing this, but - in case you do, this is the way. - */ - g_object_class_install_property(object_class, - PROP_ORDERING_INDEX, - g_param_spec_uint (PROP_ORDERING_INDEX_S, - "The location that this app indicator should be in the list.", - "A way to override the default ordering of the applications by providing a very specific idea of where this entry should be placed.", - 0, G_MAXUINT32, 0, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - AppIndicator:x-ayatana-ordering-index: - - A wrapper for #AppIndicator:ordering-index so that it can match the - dbus interface currently. It will hopefully be retired, please don't - use it anywhere. - */ - g_object_class_install_property(object_class, - PROP_X_ORDERING_INDEX, - g_param_spec_uint (PROP_X_ORDERING_INDEX_S, - "A wrapper, please don't use.", - "A wrapper, please don't use.", - 0, G_MAXUINT32, 0, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - /** - AppIndicator:x-ayatana-label: - - Wrapper for #AppIndicator:label. Please use that in all of your - code. - */ - g_object_class_install_property(object_class, - PROP_X_LABEL, - g_param_spec_string (PROP_X_LABEL_S, - "A wrapper, please don't use.", - "A wrapper, please don't use.", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - AppIndicator:x-ayatana-label-guide: - - Wrapper for #AppIndicator:label-guide. Please use that in all of your - code. - */ - g_object_class_install_property(object_class, - PROP_X_LABEL_GUIDE, - g_param_spec_string (PROP_X_LABEL_GUIDE_S, - "A wrapper, please don't use.", - "A wrapper, please don't use.", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - /* Signals */ - - /** - AppIndicator::new-icon: - @arg0: The #AppIndicator object - - Emitted when #AppIndicator:icon-name is changed - */ - signals[NEW_ICON] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_ICON, - G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (AppIndicatorClass, new_icon), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0, G_TYPE_NONE); - - /** - AppIndicator::new-attention-icon: - @arg0: The #AppIndicator object - - Emitted when #AppIndicator:attention-icon-name is changed - */ - signals[NEW_ATTENTION_ICON] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON, - G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (AppIndicatorClass, new_attention_icon), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0, G_TYPE_NONE); - - /** - AppIndicator::new-status: - @arg0: The #AppIndicator object - @arg1: The string value of the #AppIndicatorStatus enum. - - Emitted when #AppIndicator:status is changed - */ - signals[NEW_STATUS] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_STATUS, - G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (AppIndicatorClass, new_status), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); - - /** - AppIndicator::new-label: - @arg0: The #AppIndicator object - @arg1: The string for the label - @arg1: The string for the guide - - Emitted when either #AppIndicator:label or #AppIndicator:label-guide are - changed. - */ - signals[NEW_LABEL] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_LABEL, - G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (AppIndicatorClass, new_label), - NULL, NULL, - _application_service_marshal_VOID__STRING_STRING, - G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); - - /** - AppIndicator::x-ayatana-new-label: - @arg0: The #AppIndicator object - @arg1: The string for the label - @arg1: The string for the guide - - Wrapper for #AppIndicator::new-label, please don't use this signal - use the other one. - */ - signals[X_NEW_LABEL] = g_signal_new (APP_INDICATOR_SIGNAL_X_NEW_LABEL, - G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (AppIndicatorClass, new_label), - NULL, NULL, - _application_service_marshal_VOID__STRING_STRING, - G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); - - /** - AppIndicator::connection-changed: - @arg0: The #AppIndicator object - @arg1: Whether we're connected or not - - Signaled when we connect to a watcher, or when it drops away. - */ - signals[CONNECTION_CHANGED] = g_signal_new (APP_INDICATOR_SIGNAL_CONNECTION_CHANGED, - G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (AppIndicatorClass, connection_changed), - NULL, NULL, - g_cclosure_marshal_VOID__BOOLEAN, - G_TYPE_NONE, 1, G_TYPE_BOOLEAN, G_TYPE_NONE); - - /** - AppIndicator::new-icon-theme-path: - @arg0: The #AppIndicator object - - Signaled when there is a new icon set for the - object. - */ - signals[NEW_ICON_THEME_PATH] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH, - G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (AppIndicatorClass, new_icon_theme_path), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, G_TYPE_STRING); - - /* Initialize the object as a DBus type */ - dbus_g_object_type_install_info(APP_INDICATOR_TYPE, - &dbus_glib__notification_item_server_object_info); - - return; -} - -static void -app_indicator_init (AppIndicator *self) -{ - AppIndicatorPrivate * priv = APP_INDICATOR_GET_PRIVATE(self); - - priv->id = NULL; - priv->clean_id = NULL; - priv->category = APP_INDICATOR_CATEGORY_OTHER; - priv->status = APP_INDICATOR_STATUS_PASSIVE; - priv->icon_name = NULL; - priv->attention_icon_name = NULL; - priv->icon_theme_path = NULL; - priv->menu = NULL; - priv->menuservice = NULL; - priv->ordering_index = 0; - priv->label = NULL; - priv->label_guide = NULL; - priv->label_change_idle = 0; - - priv->watcher_proxy = NULL; - priv->connection = NULL; - priv->dbus_proxy = NULL; - - priv->status_icon = NULL; - priv->fallback_timer = 0; - - /* Put the object on DBus */ - GError * error = NULL; - priv->connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error); - if (error != NULL) { - g_error("Unable to connect to the session bus when creating application indicator: %s", error->message); - g_error_free(error); - return; - } - dbus_g_connection_ref(priv->connection); - - g_signal_connect(G_OBJECT(gtk_icon_theme_get_default()), - "changed", G_CALLBACK(theme_changed_cb), self); - - self->priv = priv; - - return; -} - -/* Free all objects, make sure that all the dbus - signals are sent out before we shut this down. */ -static void -app_indicator_dispose (GObject *object) -{ - AppIndicator *self = APP_INDICATOR (object); - AppIndicatorPrivate *priv = self->priv; - - if (priv->status != APP_INDICATOR_STATUS_PASSIVE) { - app_indicator_set_status(self, APP_INDICATOR_STATUS_PASSIVE); - } - - if (priv->status_icon != NULL) { - AppIndicatorClass * class = APP_INDICATOR_GET_CLASS(object); - if (class->unfallback != NULL) { - class->unfallback(self, priv->status_icon); - } - priv->status_icon = NULL; - } - - if (priv->fallback_timer != 0) { - g_source_remove(priv->fallback_timer); - priv->fallback_timer = 0; - } - - if (priv->label_change_idle != 0) { - g_source_remove(priv->label_change_idle); - priv->label_change_idle = 0; - } - - if (priv->menu != NULL) { - g_signal_handlers_disconnect_by_func (G_OBJECT (priv->menu), - client_menu_changed, - self); - g_object_unref(G_OBJECT(priv->menu)); - priv->menu = NULL; - } - - if (priv->menuservice != NULL) { - g_object_unref (priv->menuservice); - } - - if (priv->dbus_proxy != NULL) { - g_object_unref(G_OBJECT(priv->dbus_proxy)); - priv->dbus_proxy = NULL; - } - - if (priv->watcher_proxy != NULL) { - dbus_g_connection_flush(priv->connection); - g_signal_handlers_disconnect_by_func(G_OBJECT(priv->watcher_proxy), watcher_proxy_destroyed, self); - g_object_unref(G_OBJECT(priv->watcher_proxy)); - priv->watcher_proxy = NULL; - - /* Emit the AppIndicator::connection-changed signal*/ - g_signal_emit (self, signals[CONNECTION_CHANGED], 0, FALSE); - } - - if (priv->connection != NULL) { - dbus_g_connection_unref(priv->connection); - priv->connection = NULL; - } - - G_OBJECT_CLASS (app_indicator_parent_class)->dispose (object); - return; -} - -/* Free all of the memory that we could be using in - the object. */ -static void -app_indicator_finalize (GObject *object) -{ - AppIndicator * self = APP_INDICATOR(object); - AppIndicatorPrivate *priv = self->priv; - - if (priv->status != APP_INDICATOR_STATUS_PASSIVE) { - g_warning("Finalizing Application Status with the status set to: %d", priv->status); - } - - if (priv->id != NULL) { - g_free(priv->id); - priv->id = NULL; - } - - if (priv->clean_id != NULL) { - g_free(priv->clean_id); - priv->clean_id = NULL; - } - - if (priv->icon_name != NULL) { - g_free(priv->icon_name); - priv->icon_name = NULL; - } - - if (priv->attention_icon_name != NULL) { - g_free(priv->attention_icon_name); - priv->attention_icon_name = NULL; - } - - if (priv->icon_theme_path != NULL) { - g_free(priv->icon_theme_path); - priv->icon_theme_path = NULL; - } - - if (priv->label != NULL) { - g_free(priv->label); - priv->label = NULL; - } - - if (priv->label_guide != NULL) { - g_free(priv->label_guide); - priv->label_guide = NULL; - } - - G_OBJECT_CLASS (app_indicator_parent_class)->finalize (object); - return; -} - -#define WARN_BAD_TYPE(prop, value) g_warning("Can not work with property '%s' with value of type '%s'.", prop, G_VALUE_TYPE_NAME(value)) - -/* Set some properties */ -static void -app_indicator_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) -{ - AppIndicator *self = APP_INDICATOR (object); - AppIndicatorPrivate *priv = self->priv; - GEnumValue *enum_val; - - switch (prop_id) { - case PROP_ID: - if (priv->id != NULL) { - g_warning ("Resetting ID value when I already had a value of: %s", priv->id); - break; - } - - priv->id = g_strdup (g_value_get_string (value)); - - priv->clean_id = g_strdup(priv->id); - gchar * cleaner; - for (cleaner = priv->clean_id; *cleaner != '\0'; cleaner++) { - if (!g_ascii_isalnum(*cleaner)) { - *cleaner = '_'; - } - } - - check_connect (self); - break; - - case PROP_CATEGORY: - enum_val = g_enum_get_value_by_nick ((GEnumClass *) g_type_class_ref (APP_INDICATOR_TYPE_INDICATOR_CATEGORY), - g_value_get_string (value)); - - if (priv->category != enum_val->value) - { - priv->category = enum_val->value; - } - - break; - - case PROP_STATUS: - enum_val = g_enum_get_value_by_nick ((GEnumClass *) g_type_class_ref (APP_INDICATOR_TYPE_INDICATOR_STATUS), - g_value_get_string (value)); - - app_indicator_set_status (APP_INDICATOR (object), - enum_val->value); - break; - - case PROP_ICON_NAME: - app_indicator_set_icon (APP_INDICATOR (object), - g_value_get_string (value)); - check_connect (self); - break; - - case PROP_ATTENTION_ICON_NAME: - app_indicator_set_attention_icon (APP_INDICATOR (object), - g_value_get_string (value)); - break; - - case PROP_ICON_THEME_PATH: - app_indicator_set_icon_theme_path (APP_INDICATOR (object), - g_value_get_string (value)); - check_connect (self); - break; - - case PROP_X_LABEL: - case PROP_LABEL: { - gchar * oldlabel = priv->label; - priv->label = g_value_dup_string(value); - - if (g_strcmp0(oldlabel, priv->label) != 0) { - signal_label_change(APP_INDICATOR(object)); - } - - if (priv->label != NULL && priv->label[0] == '\0') { - g_free(priv->label); - priv->label = NULL; - } - - if (oldlabel != NULL) { - g_free(oldlabel); - } - break; - } - case PROP_X_LABEL_GUIDE: - case PROP_LABEL_GUIDE: { - gchar * oldguide = priv->label_guide; - priv->label_guide = g_value_dup_string(value); - - if (g_strcmp0(oldguide, priv->label_guide) != 0) { - signal_label_change(APP_INDICATOR(object)); - } - - if (priv->label_guide != NULL && priv->label_guide[0] == '\0') { - g_free(priv->label_guide); - priv->label_guide = NULL; - } - - if (oldguide != NULL) { - g_free(oldguide); - } - break; - } - case PROP_X_ORDERING_INDEX: - case PROP_ORDERING_INDEX: - priv->ordering_index = g_value_get_uint(value); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } - - return; -} - -/* Function to fill our value with the property it's requesting. */ -static void -app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) -{ - AppIndicator *self = APP_INDICATOR (object); - AppIndicatorPrivate *priv = self->priv; - GEnumValue *enum_value; - - switch (prop_id) { - case PROP_ID: - g_value_set_string (value, priv->id); - break; - - case PROP_CATEGORY: - enum_value = g_enum_get_value ((GEnumClass *) g_type_class_ref (APP_INDICATOR_TYPE_INDICATOR_CATEGORY), priv->category); - g_value_set_string (value, enum_value->value_nick); - break; - - case PROP_STATUS: - enum_value = g_enum_get_value ((GEnumClass *) g_type_class_ref (APP_INDICATOR_TYPE_INDICATOR_STATUS), priv->status); - g_value_set_string (value, enum_value->value_nick); - break; - - case PROP_ICON_NAME: - g_value_set_string (value, priv->icon_name); - break; - - case PROP_ATTENTION_ICON_NAME: - g_value_set_string (value, priv->attention_icon_name); - break; - - case PROP_ICON_THEME_PATH: - g_value_set_string (value, priv->icon_theme_path); - break; - - case PROP_MENU: - if (priv->menuservice != NULL) { - GValue strval = { 0 }; - g_value_init(&strval, G_TYPE_STRING); - g_object_get_property (G_OBJECT (priv->menuservice), DBUSMENU_SERVER_PROP_DBUS_OBJECT, &strval); - g_value_set_boxed(value, g_value_get_string(&strval)); - g_value_unset(&strval); - } - break; - - case PROP_CONNECTED: - g_value_set_boolean (value, priv->watcher_proxy != NULL ? TRUE : FALSE); - break; - - case PROP_X_LABEL: - case PROP_LABEL: - g_value_set_string (value, priv->label); - break; - - case PROP_X_LABEL_GUIDE: - case PROP_LABEL_GUIDE: - g_value_set_string (value, priv->label_guide); - break; - - case PROP_X_ORDERING_INDEX: - case PROP_ORDERING_INDEX: - g_value_set_uint(value, priv->ordering_index); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } - - return; -} - -/* Sends the label changed signal and resets the source ID */ -static gboolean -signal_label_change_idle (gpointer user_data) -{ - AppIndicator * self = (AppIndicator *)user_data; - AppIndicatorPrivate *priv = self->priv; - - g_signal_emit(G_OBJECT(self), signals[NEW_LABEL], 0, - priv->label != NULL ? priv->label : "", - priv->label_guide != NULL ? priv->label_guide : "", - TRUE); - g_signal_emit(G_OBJECT(self), signals[X_NEW_LABEL], 0, - priv->label != NULL ? priv->label : "", - priv->label_guide != NULL ? priv->label_guide : "", - TRUE); - - priv->label_change_idle = 0; - - return FALSE; -} - -/* Sets up an idle function to send the label changed signal - so that we don't send it too many times. */ -static void -signal_label_change (AppIndicator * self) -{ - AppIndicatorPrivate *priv = self->priv; - - /* don't set it twice */ - if (priv->label_change_idle != 0) { - return; - } - - priv->label_change_idle = g_idle_add(signal_label_change_idle, self); - return; -} - -/* This function is used to see if we have enough information to - connect to things. If we do, and we're not connected, it - connects for us. */ -static void -check_connect (AppIndicator *self) -{ - AppIndicatorPrivate *priv = self->priv; - - /* We're alreadying connecting or trying to connect. */ - if (priv->watcher_proxy != NULL) return; - - /* Do we have enough information? */ - if (priv->menu == NULL) return; - if (priv->icon_name == NULL) return; - if (priv->id == NULL) return; - - gchar * path = g_strdup_printf(DEFAULT_ITEM_PATH "/%s", priv->clean_id); - - dbus_g_connection_register_g_object(priv->connection, - path, - G_OBJECT(self)); - - GError * error = NULL; - priv->watcher_proxy = dbus_g_proxy_new_for_name_owner(priv->connection, - NOTIFICATION_WATCHER_DBUS_ADDR, - NOTIFICATION_WATCHER_DBUS_OBJ, - NOTIFICATION_WATCHER_DBUS_IFACE, - &error); - if (error != NULL) { - /* Unable to get proxy, but we're handling that now so - it's not a warning anymore. */ - g_error_free(error); - dbus_g_connection_unregister_g_object(priv->connection, - G_OBJECT(self)); - start_fallback_timer(self, FALSE); - g_free(path); - return; - } - - g_signal_connect(G_OBJECT(priv->watcher_proxy), "destroy", G_CALLBACK(watcher_proxy_destroyed), self); - org_kde_StatusNotifierWatcher_register_status_notifier_item_async(priv->watcher_proxy, path, register_service_cb, self); - g_free(path); - - /* Emit the AppIndicator::connection-changed signal*/ - g_signal_emit (self, signals[CONNECTION_CHANGED], 0, TRUE); - - return; -} - -/* A function that gets called when the watcher dies. Like - dies dies. Not our friend anymore. */ -static void -watcher_proxy_destroyed (GObject * object, gpointer data) -{ - AppIndicator * self = APP_INDICATOR(data); - g_return_if_fail(self != NULL); - - dbus_g_connection_unregister_g_object(self->priv->connection, - G_OBJECT(self)); - self->priv->watcher_proxy = NULL; - - /* Emit the AppIndicator::connection-changed signal*/ - g_signal_emit (self, signals[CONNECTION_CHANGED], 0, FALSE); - - start_fallback_timer(self, FALSE); - return; -} - -/* Responce from the DBus command to register a service - with a NotificationWatcher. */ -static void -register_service_cb (DBusGProxy * proxy, GError * error, gpointer data) -{ - g_return_if_fail(IS_APP_INDICATOR(data)); - AppIndicatorPrivate * priv = APP_INDICATOR(data)->priv; - - if (error != NULL) { - /* They didn't respond, ewww. Not sure what they could - be doing */ - g_warning("Unable to connect to the Notification Watcher: %s", error->message); - dbus_g_connection_unregister_g_object(priv->connection, - G_OBJECT(data)); - g_object_unref(G_OBJECT(priv->watcher_proxy)); - priv->watcher_proxy = NULL; - start_fallback_timer(APP_INDICATOR(data), TRUE); - } - - if (priv->status_icon) { - AppIndicatorClass * class = APP_INDICATOR_GET_CLASS(data); - if (class->unfallback != NULL) { - class->unfallback(APP_INDICATOR(data), priv->status_icon); - priv->status_icon = NULL; - } - } - - return; -} - -/* A helper function to get the nick out of a given - category enum value. */ -static const gchar * -category_from_enum (AppIndicatorCategory category) -{ - GEnumValue *value; - - value = g_enum_get_value ((GEnumClass *)g_type_class_ref (APP_INDICATOR_TYPE_INDICATOR_CATEGORY), category); - return value->value_nick; -} - -/* Watching the dbus owner change events to see if someone - we care about pops up! */ -static void -dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, gpointer data) -{ - if (new == NULL || new[0] == '\0') { - /* We only care about folks coming on the bus. Exit quickly otherwise. */ - return; - } - - if (g_strcmp0(name, NOTIFICATION_WATCHER_DBUS_ADDR)) { - /* We only care about this address, reject all others. */ - return; - } - - /* Woot, there's a new notification watcher in town. */ - - AppIndicatorPrivate * priv = APP_INDICATOR_GET_PRIVATE(data); - - if (priv->fallback_timer != 0) { - /* Stop a timer */ - g_source_remove(priv->fallback_timer); - - /* Stop listening to bus events */ - g_object_unref(G_OBJECT(priv->dbus_proxy)); - priv->dbus_proxy = NULL; - } - - /* Let's start from the very beginning */ - check_connect(APP_INDICATOR(data)); - - return; -} - -/* Checking to see if someone already has the name we're looking for */ -static void -check_owner_cb (DBusGProxy *proxy, gboolean exists, GError *error, gpointer userdata) -{ - if (error != NULL) { - g_warning("Unable to check for '" NOTIFICATION_WATCHER_DBUS_ADDR "' on DBus. No worries, but concerning."); - return; - } - - if (exists) { - g_debug("Woah, we actually has a race condition with dbus"); - dbus_owner_change(proxy, NOTIFICATION_WATCHER_DBUS_ADDR, NULL, "Non NULL", userdata); - } - - return; -} - -/* This is an idle function to create the proxy. This is mostly - because start_fallback_timer can get called in the distruction - of a proxy and thus the proxy manager gets confused when creating - a new proxy as part of destroying an old one. This function being - on idle means that we'll just do it outside of the same stack where - the previous proxy is being destroyed. */ -static gboolean -setup_name_owner_proxy (gpointer data) -{ - g_return_val_if_fail(IS_APP_INDICATOR(data), FALSE); - AppIndicatorPrivate * priv = APP_INDICATOR(data)->priv; - - if (priv->dbus_proxy == NULL) { - priv->dbus_proxy = dbus_g_proxy_new_for_name(priv->connection, - DBUS_SERVICE_DBUS, - DBUS_PATH_DBUS, - DBUS_INTERFACE_DBUS); - dbus_g_proxy_add_signal(priv->dbus_proxy, "NameOwnerChanged", - G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_INVALID); - dbus_g_proxy_connect_signal(priv->dbus_proxy, "NameOwnerChanged", - G_CALLBACK(dbus_owner_change), data, NULL); - - /* Check to see if anyone has the name we're looking for - just incase we missed it changing. */ - - org_freedesktop_DBus_name_has_owner_async(priv->dbus_proxy, NOTIFICATION_WATCHER_DBUS_ADDR, check_owner_cb, data); - } - - return FALSE; -} - -/* A function that will start the fallback timer if it's not - already started. It sets up the DBus watcher to see if - there is a change. Also, provides an override mode for cases - where it's unlikely that a timer will help anything. */ -static void -start_fallback_timer (AppIndicator * self, gboolean disable_timeout) -{ - g_return_if_fail(IS_APP_INDICATOR(self)); - AppIndicatorPrivate * priv = APP_INDICATOR(self)->priv; - - if (priv->fallback_timer != 0) { - /* The timer is set, let's just be happy with the one - we've already got running */ - return; - } - - if (priv->status_icon != NULL) { - /* We're already fallen back. Let's not do it again. */ - return; - } - - if (priv->dbus_proxy == NULL) { - /* NOTE: Read the comment on setup_name_owner_proxy */ - g_idle_add(setup_name_owner_proxy, self); - } - - if (disable_timeout) { - fallback_timer_expire(self); - } else { - priv->fallback_timer = g_timeout_add(DEFAULT_FALLBACK_TIMER, fallback_timer_expire, self); - } - - return; -} - -/* A function that gets executed when we want to change the - state of the fallback. */ -static gboolean -fallback_timer_expire (gpointer data) -{ - g_return_val_if_fail(IS_APP_INDICATOR(data), FALSE); - - AppIndicatorPrivate * priv = APP_INDICATOR(data)->priv; - AppIndicatorClass * class = APP_INDICATOR_GET_CLASS(data); - - if (priv->status_icon == NULL) { - if (class->fallback != NULL) { - priv->status_icon = class->fallback(APP_INDICATOR(data)); - } - } else { - if (class->unfallback != NULL) { - class->unfallback(APP_INDICATOR(data), priv->status_icon); - priv->status_icon = NULL; - } else { - g_warning("No 'unfallback' function but the 'fallback' function returned a non-NULL result."); - } - } - - priv->fallback_timer = 0; - return FALSE; -} - -/* emit a NEW_ICON signal in response for the theme change */ -static void -theme_changed_cb (GtkIconTheme * theme, gpointer user_data) -{ - g_signal_emit (user_data, signals[NEW_ICON], 0, TRUE); -} - -/* Creates a StatusIcon that can be used when the application - indicator area isn't available. */ -static GtkStatusIcon * -fallback (AppIndicator * self) -{ - GtkStatusIcon * icon = gtk_status_icon_new(); - - gtk_status_icon_set_title(icon, app_indicator_get_id(self)); - - g_signal_connect(G_OBJECT(self), APP_INDICATOR_SIGNAL_NEW_STATUS, - G_CALLBACK(status_icon_status_wrapper), icon); - g_signal_connect(G_OBJECT(self), APP_INDICATOR_SIGNAL_NEW_ICON, - G_CALLBACK(status_icon_changes), icon); - g_signal_connect(G_OBJECT(self), APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON, - G_CALLBACK(status_icon_changes), icon); - - status_icon_changes(self, icon); - - g_signal_connect(G_OBJECT(icon), "activate", G_CALLBACK(status_icon_activate), self); - - return icon; -} - -/* A wrapper as the status update prototype is a little - bit different, but we want to handle it the same. */ -static void -status_icon_status_wrapper (AppIndicator * self, const gchar * status, gpointer data) -{ - return status_icon_changes(self, data); -} - -/* This tracks changes to either the status or the icons - that are associated with the app indicator */ -static void -status_icon_changes (AppIndicator * self, gpointer data) -{ - GtkStatusIcon * icon = GTK_STATUS_ICON(data); - GIcon *themed_icon = NULL; - gchar *longname = NULL; - - switch (app_indicator_get_status(self)) { - case APP_INDICATOR_STATUS_PASSIVE: - longname = append_panel_icon_suffix(app_indicator_get_icon(self)); - themed_icon = g_themed_icon_new_with_default_fallbacks (longname); - gtk_status_icon_set_visible(icon, FALSE); - gtk_status_icon_set_from_gicon(icon, themed_icon); - break; - case APP_INDICATOR_STATUS_ACTIVE: - longname = append_panel_icon_suffix(app_indicator_get_icon(self)); - themed_icon = g_themed_icon_new_with_default_fallbacks (longname); - gtk_status_icon_set_from_gicon(icon, themed_icon); - gtk_status_icon_set_visible(icon, TRUE); - break; - case APP_INDICATOR_STATUS_ATTENTION: - longname = append_panel_icon_suffix(app_indicator_get_attention_icon(self)); - themed_icon = g_themed_icon_new_with_default_fallbacks (longname); - gtk_status_icon_set_from_gicon(icon, themed_icon); - gtk_status_icon_set_visible(icon, TRUE); - break; - }; - - if (themed_icon) { - g_object_unref (themed_icon); - } - - if (longname) { - g_free(longname); - } - - return; -} - -/* Handles the activate action by the status icon by showing - the menu in a popup. */ -static void -status_icon_activate (GtkStatusIcon * icon, gpointer data) -{ - GtkMenu * menu = app_indicator_get_menu(APP_INDICATOR(data)); - if (menu == NULL) - return; - - gtk_menu_popup(menu, - NULL, /* Parent Menu */ - NULL, /* Parent item */ - gtk_status_icon_position_menu, - icon, - 1, /* Button */ - gtk_get_current_event_time()); - - return; -} - -/* Removes the status icon as the application indicator area - is now up and running again. */ -static void -unfallback (AppIndicator * self, GtkStatusIcon * status_icon) -{ - g_signal_handlers_disconnect_by_func(G_OBJECT(self), status_icon_status_wrapper, status_icon); - g_signal_handlers_disconnect_by_func(G_OBJECT(self), status_icon_changes, status_icon); - gtk_status_icon_set_visible(status_icon, FALSE); - g_object_unref(G_OBJECT(status_icon)); - return; -} - -/* A helper function that appends PANEL_ICON_SUFFIX to the given icon name - if it's missing. */ -static gchar * -append_panel_icon_suffix (const gchar *icon_name) -{ - gchar * long_name = NULL; - - if (!g_str_has_suffix (icon_name, PANEL_ICON_SUFFIX)) { - long_name = - g_strdup_printf("%s-%s", icon_name, PANEL_ICON_SUFFIX); - } else { - long_name = g_strdup (icon_name); - } - - return long_name; -} - - -/* ************************* */ -/* Public Functions */ -/* ************************* */ - -/** - app_indicator_new: - @id: The unique id of the indicator to create. - @icon_name: The icon name for this indicator - @category: The category of indicator. - - Creates a new #AppIndicator setting the properties: - #AppIndicator:id with @id, #AppIndicator:category - with @category and #AppIndicator:icon-name with - @icon_name. - - Return value: A pointer to a new #AppIndicator object. - */ -AppIndicator * -app_indicator_new (const gchar *id, - const gchar *icon_name, - AppIndicatorCategory category) -{ - AppIndicator *indicator = g_object_new (APP_INDICATOR_TYPE, - PROP_ID_S, id, - PROP_CATEGORY_S, category_from_enum (category), - PROP_ICON_NAME_S, icon_name, - NULL); - - return indicator; -} - -/** - app_indicator_new_with_path: - @id: The unique id of the indicator to create. - @icon_name: The icon name for this indicator - @category: The category of indicator. - @icon_theme_path: A custom path for finding icons. - - Creates a new #AppIndicator setting the properties: - #AppIndicator:id with @id, #AppIndicator:category - with @category, #AppIndicator:icon-name with - @icon_name and #AppIndicator:icon-theme-path with @icon_theme_path. - - Return value: A pointer to a new #AppIndicator object. - */ -AppIndicator * -app_indicator_new_with_path (const gchar *id, - const gchar *icon_name, - AppIndicatorCategory category, - const gchar *icon_theme_path) -{ - AppIndicator *indicator = g_object_new (APP_INDICATOR_TYPE, - PROP_ID_S, id, - PROP_CATEGORY_S, category_from_enum (category), - PROP_ICON_NAME_S, icon_name, - PROP_ICON_THEME_PATH_S, icon_theme_path, - NULL); - - return indicator; -} - -/** - app_indicator_get_type: - - Generates or returns the unique #GType for #AppIndicator. - - Return value: A unique #GType for #AppIndicator objects. -*/ - -/** - app_indicator_set_status: - @self: The #AppIndicator object to use - @status: The status to set for this indicator - - Wrapper function for property #AppIndicator:status. -*/ -void -app_indicator_set_status (AppIndicator *self, AppIndicatorStatus status) -{ - g_return_if_fail (IS_APP_INDICATOR (self)); - - if (self->priv->status != status) - { - GEnumValue *value = g_enum_get_value ((GEnumClass *) g_type_class_ref (APP_INDICATOR_TYPE_INDICATOR_STATUS), status); - - self->priv->status = status; - g_signal_emit (self, signals[NEW_STATUS], 0, value->value_nick); - } -} - -/** - app_indicator_set_attention_icon: - @self: The #AppIndicator object to use - @icon_name: The name of the attention icon to set for this indicator - - Wrapper function for property #AppIndicator:attention-icon-name. -*/ -void -app_indicator_set_attention_icon (AppIndicator *self, const gchar *icon_name) -{ - g_return_if_fail (IS_APP_INDICATOR (self)); - g_return_if_fail (icon_name != NULL); - - if (g_strcmp0 (self->priv->attention_icon_name, icon_name) != 0) - { - if (self->priv->attention_icon_name) - g_free (self->priv->attention_icon_name); - - self->priv->attention_icon_name = g_strdup(icon_name); - - g_signal_emit (self, signals[NEW_ATTENTION_ICON], 0, TRUE); - } - - return; -} - -/** - app_indicator_set_icon: - @self: The #AppIndicator object to use - @icon_name: The icon name to set. - - Sets the default icon to use when the status is active but - not set to attention. In most cases, this should be the - application icon for the program. - Wrapper function for property #AppIndicator:icon-name. -**/ -void -app_indicator_set_icon (AppIndicator *self, const gchar *icon_name) -{ - g_return_if_fail (IS_APP_INDICATOR (self)); - g_return_if_fail (icon_name != NULL); - - if (g_strcmp0 (self->priv->icon_name, icon_name) != 0) - { - if (self->priv->icon_name) - g_free (self->priv->icon_name); - - self->priv->icon_name = g_strdup(icon_name); - - g_signal_emit (self, signals[NEW_ICON], 0, TRUE); - } - - return; -} - -/** - app_indicator_set_label: - @self: The #AppIndicator object to use - @label: The label to show next to the icon. - @guide: A guide to size the label correctly. - - This is a wrapper function for the #AppIndicator:label and - #AppIndicator:guide properties. This function can take #NULL - as either @label or @guide and will clear the entries. -*/ -void -app_indicator_set_label (AppIndicator *self, const gchar * label, const gchar * guide) -{ - g_return_if_fail (IS_APP_INDICATOR (self)); - /* Note: The label can be NULL, it's okay */ - /* Note: The guide can be NULL, it's okay */ - - g_object_set(G_OBJECT(self), - PROP_LABEL_S, label == NULL ? "" : label, - PROP_LABEL_GUIDE_S, guide == NULL ? "" : guide, - NULL); - - return; -} - -/** - app_indicator_set_icon_theme_path: - @self: The #AppIndicator object to use - @icon_theme_path: The icon theme path to set. - - Sets the path to use when searching for icons. -**/ -void -app_indicator_set_icon_theme_path (AppIndicator *self, const gchar *icon_theme_path) -{ - g_return_if_fail (IS_APP_INDICATOR (self)); - - if (g_strcmp0 (self->priv->icon_theme_path, icon_theme_path) != 0) - { - if (self->priv->icon_theme_path != NULL) - g_free(self->priv->icon_theme_path); - - self->priv->icon_theme_path = g_strdup(icon_theme_path); - - g_signal_emit (self, signals[NEW_ICON_THEME_PATH], 0, g_strdup(self->priv->icon_theme_path)); - } - - return; -} - -static void -activate_menuitem (DbusmenuMenuitem *mi, guint timestamp, gpointer user_data) -{ - GtkWidget *widget = (GtkWidget *)user_data; - - gtk_menu_item_activate (GTK_MENU_ITEM (widget)); -} - -static void -widget_toggled (GtkWidget *widget, DbusmenuMenuitem *mi) -{ - dbusmenu_menuitem_property_set_int (mi, - DBUSMENU_MENUITEM_PROP_TOGGLE_STATE, - gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget)) ? DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED : DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED); -} - -static void -menuitem_iterate (GtkWidget *widget, - gpointer data) -{ - if (GTK_IS_LABEL (widget)) - { - DbusmenuMenuitem *child = (DbusmenuMenuitem *)data; - - dbusmenu_menuitem_property_set (child, - DBUSMENU_MENUITEM_PROP_LABEL, - gtk_label_get_text (GTK_LABEL (widget))); - } -} - -static gboolean -should_show_image (GtkImage *image) -{ - GtkWidget *item; - - item = gtk_widget_get_ancestor (GTK_WIDGET (image), - GTK_TYPE_IMAGE_MENU_ITEM); - - if (item) - { - GtkSettings *settings; - gboolean gtk_menu_images; - - settings = gtk_widget_get_settings (item); - - g_object_get (settings, "gtk-menu-images", >k_menu_images, NULL); - - if (gtk_menu_images) - return TRUE; - - return gtk_image_menu_item_get_always_show_image (GTK_IMAGE_MENU_ITEM (item)); - } - - return FALSE; -} - -static void -update_icon_name (DbusmenuMenuitem *menuitem, - GtkImage *image) -{ - const gchar *icon_name = NULL; - - if (gtk_image_get_storage_type (image) != GTK_IMAGE_ICON_NAME) - return; - - gtk_image_get_icon_name (image, &icon_name, NULL); - - if (should_show_image (image)) - dbusmenu_menuitem_property_set (menuitem, - DBUSMENU_MENUITEM_PROP_ICON_NAME, - icon_name); - else - dbusmenu_menuitem_property_remove (menuitem, - DBUSMENU_MENUITEM_PROP_ICON_NAME); -} - -/* return value specifies whether the label is set or not */ -static gboolean -update_stock_item (DbusmenuMenuitem *menuitem, - GtkImage *image) -{ - GtkStockItem stock; - gchar *stock_id = NULL; - - if (gtk_image_get_storage_type (image) != GTK_IMAGE_STOCK) - return FALSE; - - gtk_image_get_stock (image, &stock_id, NULL); - gtk_stock_lookup (stock_id, &stock); - - if (should_show_image (image)) - dbusmenu_menuitem_property_set (menuitem, - DBUSMENU_MENUITEM_PROP_ICON_NAME, - stock_id); - else - dbusmenu_menuitem_property_remove (menuitem, - DBUSMENU_MENUITEM_PROP_ICON_NAME); - - const gchar * label = dbusmenu_menuitem_property_get (menuitem, - DBUSMENU_MENUITEM_PROP_LABEL); - - if (stock.label != NULL && label != NULL) - { - dbusmenu_menuitem_property_set (menuitem, - DBUSMENU_MENUITEM_PROP_LABEL, - stock.label); - - return TRUE; - } - - return FALSE; -} - -static void -image_notify_cb (GtkWidget *widget, - GParamSpec *pspec, - gpointer data) -{ - DbusmenuMenuitem *child = (DbusmenuMenuitem *)data; - GtkImage *image = GTK_IMAGE (widget); - - if (pspec->name == g_intern_static_string ("stock")) - { - update_stock_item (child, image); - } - else if (pspec->name == g_intern_static_string ("icon-name")) - { - update_icon_name (child, image); - } -} - -static void -widget_notify_cb (GtkWidget *widget, - GParamSpec *pspec, - gpointer data) -{ - DbusmenuMenuitem *child = (DbusmenuMenuitem *)data; - - if (pspec->name == g_intern_static_string ("sensitive")) - { - dbusmenu_menuitem_property_set_bool (child, - DBUSMENU_MENUITEM_PROP_ENABLED, - gtk_widget_is_sensitive (widget)); - } - else if (pspec->name == g_intern_static_string ("label")) - { - dbusmenu_menuitem_property_set (child, - DBUSMENU_MENUITEM_PROP_LABEL, - gtk_menu_item_get_label (GTK_MENU_ITEM (widget))); - } - else if (pspec->name == g_intern_static_string ("visible")) - { - dbusmenu_menuitem_property_set_bool (child, - DBUSMENU_MENUITEM_PROP_VISIBLE, - gtk_widget_get_visible (widget)); - } -} - -static void -action_notify_cb (GtkAction *action, - GParamSpec *pspec, - gpointer data) -{ - DbusmenuMenuitem *child = (DbusmenuMenuitem *)data; - - if (pspec->name == g_intern_static_string ("active")) - { - dbusmenu_menuitem_property_set_bool (child, - DBUSMENU_MENUITEM_PROP_TOGGLE_STATE, - gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))); - } - - if (pspec->name == g_intern_static_string ("label")) - { - dbusmenu_menuitem_property_set (child, - DBUSMENU_MENUITEM_PROP_LABEL, - gtk_action_get_label (action)); - } -} - -static void -container_iterate (GtkWidget *widget, - gpointer data) -{ - DbusmenuMenuitem *root = (DbusmenuMenuitem *)data; - DbusmenuMenuitem *child; - GtkWidget *submenu = NULL; - const gchar *label = NULL; - gboolean label_set = FALSE; - - if (GTK_IS_TEAROFF_MENU_ITEM(widget)) { - return; - } - - child = dbusmenu_menuitem_new (); - - if (GTK_IS_SEPARATOR_MENU_ITEM (widget)) - { - dbusmenu_menuitem_property_set (child, - "type", - DBUSMENU_CLIENT_TYPES_SEPARATOR); - } - else - { - if (GTK_IS_CHECK_MENU_ITEM (widget)) - { - GtkCheckMenuItem *check; - - check = GTK_CHECK_MENU_ITEM (widget); - label = gtk_menu_item_get_label (GTK_MENU_ITEM (widget)); - - dbusmenu_menuitem_property_set (child, - DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE, - GTK_IS_RADIO_MENU_ITEM (widget) ? DBUSMENU_MENUITEM_TOGGLE_RADIO : DBUSMENU_MENUITEM_TOGGLE_CHECK); - - dbusmenu_menuitem_property_set (child, - DBUSMENU_MENUITEM_PROP_LABEL, - label); - - label_set = TRUE; - - dbusmenu_menuitem_property_set_int (child, - DBUSMENU_MENUITEM_PROP_TOGGLE_STATE, - gtk_check_menu_item_get_active (check) ? DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED : DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED); - - g_signal_connect (widget, - "toggled", - G_CALLBACK (widget_toggled), - child); - } - else if (GTK_IS_IMAGE_MENU_ITEM (widget)) - { - GtkWidget *image; - GtkImageType image_type; - - image = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (widget)); - image_type = gtk_image_get_storage_type (GTK_IMAGE (image)); - - g_signal_connect (image, - "notify", - G_CALLBACK (image_notify_cb), - child); - - if (image_type == GTK_IMAGE_STOCK) - { - label_set = update_stock_item (child, GTK_IMAGE (image)); - } - else if (image_type == GTK_IMAGE_ICON_NAME) - { - update_icon_name (child, GTK_IMAGE (image)); - } - } - } - - if (!label_set) - { - if (label != NULL) - { - dbusmenu_menuitem_property_set (child, - DBUSMENU_MENUITEM_PROP_LABEL, - label); - } - else - { - /* find label child widget */ - gtk_container_forall (GTK_CONTAINER (widget), - menuitem_iterate, - child); - } - } - - if (GTK_IS_MENU_ITEM (widget)) - { - submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget)); - if (submenu != NULL) - { - gtk_container_foreach (GTK_CONTAINER (submenu), - container_iterate, - child); - g_signal_connect_object (submenu, - "child-added", - G_CALLBACK (submenu_changed), - child, - 0); - g_signal_connect_object (submenu, - "child-removed", - G_CALLBACK (submenu_changed), - child, - 0); - } - } - - dbusmenu_menuitem_property_set_bool (child, - DBUSMENU_MENUITEM_PROP_ENABLED, - gtk_widget_is_sensitive (widget)); - dbusmenu_menuitem_property_set_bool (child, - DBUSMENU_MENUITEM_PROP_VISIBLE, - gtk_widget_get_visible (widget)); - - g_signal_connect (widget, "notify", - G_CALLBACK (widget_notify_cb), child); - - if (GTK_IS_ACTIVATABLE (widget)) - { - GtkActivatable *activatable = GTK_ACTIVATABLE (widget); - - if (gtk_activatable_get_use_action_appearance (activatable)) - { - GtkAction *action = gtk_activatable_get_related_action (activatable); - - if (action) - { - g_signal_connect_object (action, "notify", - G_CALLBACK (action_notify_cb), - child, - G_CONNECT_AFTER); - } - } - } - - g_signal_connect (G_OBJECT (child), - DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, - G_CALLBACK (activate_menuitem), widget); - dbusmenu_menuitem_child_append (root, child); - - /* Get rid of initial ref now that the root is - holding the object */ - g_object_unref(child); - - return; -} - -static void -submenu_changed (GtkWidget *widget, - GtkWidget *child, - gpointer data) -{ - DbusmenuMenuitem *root = (DbusmenuMenuitem *)data; - GList *children, *l; - children = dbusmenu_menuitem_get_children (root); - - for (l = children; l;) - { - DbusmenuMenuitem *c = (DbusmenuMenuitem *)l->data; - l = l->next; - dbusmenu_menuitem_child_delete (root, c); - } - - gtk_container_foreach (GTK_CONTAINER (widget), - container_iterate, - root); -} - -static void -setup_dbusmenu (AppIndicator *self) -{ - AppIndicatorPrivate *priv; - DbusmenuMenuitem *root; - - priv = self->priv; - root = dbusmenu_menuitem_new (); - - if (priv->menu) - { - gtk_container_foreach (GTK_CONTAINER (priv->menu), - container_iterate, - root); - } - - if (priv->menuservice == NULL) - { - gchar * path = g_strdup_printf(DEFAULT_ITEM_PATH "/%s/Menu", priv->clean_id); - priv->menuservice = dbusmenu_server_new (path); - g_free(path); - } - - dbusmenu_server_set_root (priv->menuservice, root); - - return; -} - -static void -client_menu_changed (GtkWidget *widget, - GtkWidget *child, - AppIndicator *indicator) -{ - setup_dbusmenu (indicator); -} - -/** - app_indicator_set_menu: - @self: The #AppIndicator - @menu: A #GtkMenu to set - - Sets the menu that should be shown when the Application Indicator - is clicked on in the panel. An application indicator will not - be rendered unless it has a menu. - - Wrapper function for property #AppIndicator:menu. -**/ -void -app_indicator_set_menu (AppIndicator *self, GtkMenu *menu) -{ - AppIndicatorPrivate *priv; - - g_return_if_fail (IS_APP_INDICATOR (self)); - g_return_if_fail (GTK_IS_MENU (menu)); - g_return_if_fail (self->priv->clean_id != NULL); - - priv = self->priv; - - if (priv->menu != NULL) - { - g_object_unref (priv->menu); - } - - priv->menu = GTK_WIDGET (menu); - g_object_ref (priv->menu); - - setup_dbusmenu (self); - - check_connect (self); - - g_signal_connect (menu, - "child-added", - G_CALLBACK (client_menu_changed), - self); - g_signal_connect (menu, - "child-removed", - G_CALLBACK (client_menu_changed), - self); -} - -/** - app_indicator_set_ordering_index: - @self: The #AppIndicator - @ordering_index: A value for the ordering of this app indicator - - Sets the ordering index for the app indicator which effects the - placement of it on the panel. For almost all app indicator - this is not the function you're looking for. - - Wrapper function for property #AppIndicator:ordering-index. -**/ -void -app_indicator_set_ordering_index (AppIndicator *self, guint32 ordering_index) -{ - g_return_if_fail (IS_APP_INDICATOR (self)); - - self->priv->ordering_index = ordering_index; - - return; -} - -/** - app_indicator_get_id: - @self: The #AppIndicator object to use - - Wrapper function for property #AppIndicator:id. - - Return value: The current ID -*/ -const gchar * -app_indicator_get_id (AppIndicator *self) -{ - g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); - - return self->priv->id; -} - -/** - app_indicator_get_category: - @self: The #AppIndicator object to use - - Wrapper function for property #AppIndicator:category. - - Return value: The current category. -*/ -AppIndicatorCategory -app_indicator_get_category (AppIndicator *self) -{ - g_return_val_if_fail (IS_APP_INDICATOR (self), APP_INDICATOR_CATEGORY_APPLICATION_STATUS); - - return self->priv->category; -} - -/** - app_indicator_get_status: - @self: The #AppIndicator object to use - - Wrapper function for property #AppIndicator:status. - - Return value: The current status. -*/ -AppIndicatorStatus -app_indicator_get_status (AppIndicator *self) -{ - g_return_val_if_fail (IS_APP_INDICATOR (self), APP_INDICATOR_STATUS_PASSIVE); - - return self->priv->status; -} - -/** - app_indicator_get_icon: - @self: The #AppIndicator object to use - - Wrapper function for property #AppIndicator:icon-name. - - Return value: The current icon name. -*/ -const gchar * -app_indicator_get_icon (AppIndicator *self) -{ - g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); - - return self->priv->icon_name; -} - -/** - app_indicator_get_icon_theme_path: - @self: The #AppIndicator object to use - - Wrapper function for property #AppIndicator:icon-theme-path. - - Return value: The current icon theme path. -*/ -const gchar * -app_indicator_get_icon_theme_path (AppIndicator *self) -{ - g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); - - return self->priv->icon_theme_path; -} - -/** - app_indicator_get_attention_icon: - @self: The #AppIndicator object to use - - Wrapper function for property #AppIndicator:attention-icon-name. - - Return value: The current attention icon name. -*/ -const gchar * -app_indicator_get_attention_icon (AppIndicator *self) -{ - g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); - - return self->priv->attention_icon_name; -} - -/** - app_indicator_get_menu: - @self: The #AppIndicator object to use - - Gets the menu being used for this application indicator. - Wrapper function for property #AppIndicator:menu. - - Return value: A #GtkMenu object or %NULL if one hasn't been set. -*/ -GtkMenu * -app_indicator_get_menu (AppIndicator *self) -{ - AppIndicatorPrivate *priv; - - g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); - - priv = self->priv; - - return GTK_MENU(priv->menu); -} - -/** - app_indicator_get_label: - @self: The #AppIndicator object to use - - Wrapper function for property #AppIndicator:label. - - Return value: The current label. -*/ -const gchar * -app_indicator_get_label (AppIndicator *self) -{ - g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); - - return self->priv->label; -} - -/** - app_indicator_get_label_guide: - @self: The #AppIndicator object to use - - Wrapper function for property #AppIndicator:label-guide. - - Return value: The current label guide. -*/ -const gchar * -app_indicator_get_label_guide (AppIndicator *self) -{ - g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); - - return self->priv->label_guide; -} - -/** - app_indicator_get_ordering_index: - @self: The #AppIndicator object to use - - Wrapper function for property #AppIndicator:ordering-index. - - Return value: The current ordering index. -*/ -guint32 -app_indicator_get_ordering_index (AppIndicator *self) -{ - g_return_val_if_fail (IS_APP_INDICATOR (self), 0); - - if (self->priv->ordering_index == 0) { - return generate_id(self->priv->category, self->priv->id); - } else { - return self->priv->ordering_index; - } -} - diff --git a/src/app-indicator.h b/src/app-indicator.h deleted file mode 100644 index ce152bb..0000000 --- a/src/app-indicator.h +++ /dev/null @@ -1,302 +0,0 @@ -/* -An object to represent the application as an application indicator -in the system panel. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - Cody Russell <cody.russell@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of either or both of the following licenses: - -1) the GNU Lesser General Public License version 3, as published by the - Free Software Foundation; and/or -2) the GNU Lesser General Public License version 2.1, 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 applicable version of the GNU Lesser General Public -License for more details. - -You should have received a copy of both the GNU Lesser General Public -License version 3 and version 2.1 along with this program. If not, see -<http://www.gnu.org/licenses/> -*/ - -#ifndef __APP_INDICATOR_H__ -#define __APP_INDICATOR_H__ - -#include <gtk/gtk.h> - -G_BEGIN_DECLS - -/** - APP_INDICATOR_TYPE: - - Get the #GType for a #AppIndicator. -*/ -/** - APP_INDICATOR: - @obj: The object to convert - - Safely convert a #GObject into an #AppIndicator. -*/ -/** - APP_INDICATOR_CLASS: - @klass: #GObjectClass based class to convert. - - Safely convert a #GObjectClass into a #AppIndicatorClass. -*/ -/** - IS_APP_INDICATOR: - @obj: An #GObject to check - - Checks to see if @obj is in the object hierarchy of #AppIndicator. -*/ -/** - IS_APP_INDICATOR_CLASS: - @klass: An #GObjectClass to check - - Checks to see if @klass is in the object class hierarchy of #AppIndicatorClass. -*/ -/** - APP_INDICATOR_GET_CLASS: - @obj: A #GObject in the class hierarchy of #AppIndicator. - - Gets a pointer to the #AppIndicatorClass for the object @obj. -*/ - -#define APP_INDICATOR_TYPE (app_indicator_get_type ()) -#define APP_INDICATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APP_INDICATOR_TYPE, AppIndicator)) -#define APP_INDICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APP_INDICATOR_TYPE, AppIndicatorClass)) -#define IS_APP_INDICATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APP_INDICATOR_TYPE)) -#define IS_APP_INDICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), APP_INDICATOR_TYPE)) -#define APP_INDICATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), APP_INDICATOR_TYPE, AppIndicatorClass)) - -/** - APP_INDICATOR_SIGNAL_NEW_ICON: - - String identifier for the #AppIndicator::new-icon signal. -*/ -/** - APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON: - - String identifier for the #AppIndicator::new-attention-icon signal. -*/ -/** - APP_INDICATOR_SIGNAL_NEW_STATUS: - - String identifier for the #AppIndicator::new-status signal. -*/ -/** - APP_INDICATOR_SIGNAL_NEW_LABEL: - - String identifier for the #AppIndicator::new-label signal. -*/ -/** - APP_INDICATOR_SIGNAL_CONNECTION_CHANGED: - - String identifier for the #AppIndicator::connection-changed signal. -*/ -/** - APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH: - - String identifier for the #AppIndicator::new-icon-theme-path signal. -*/ -#define APP_INDICATOR_SIGNAL_NEW_ICON "new-icon" -#define APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON "new-attention-icon" -#define APP_INDICATOR_SIGNAL_NEW_STATUS "new-status" -#define APP_INDICATOR_SIGNAL_NEW_LABEL "new-label" -#define APP_INDICATOR_SIGNAL_CONNECTION_CHANGED "connection-changed" -#define APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH "new-icon-theme-path" - -/** - AppIndicatorCategory: - @APP_INDICATOR_CATEGORY_APPLICATION_STATUS: The indicator is used to display the status of the application. - @APP_INDICATOR_CATEGORY_COMMUNICATIONS: The application is used for communication with other people. - @APP_INDICATOR_CATEGORY_SYSTEM_SERVICES: A system indicator relating to something in the user's system. - @APP_INDICATOR_CATEGORY_HARDWARE: An indicator relating to the user's hardware. - @APP_INDICATOR_CATEGORY_OTHER: Something not defined in this enum, please don't use unless you really need it. - - The category provides grouping for the indicators so that - users can find indicators that are similar together. -*/ -typedef enum { /*< prefix=APP_INDICATOR_CATEGORY >*/ - APP_INDICATOR_CATEGORY_APPLICATION_STATUS, /*< nick=ApplicationStatus >*/ - APP_INDICATOR_CATEGORY_COMMUNICATIONS, /*< nick=Communications >*/ - APP_INDICATOR_CATEGORY_SYSTEM_SERVICES, /*< nick=SystemServices >*/ - APP_INDICATOR_CATEGORY_HARDWARE, /*< nick=Hardware >*/ - APP_INDICATOR_CATEGORY_OTHER /*< nick=Other >*/ -} AppIndicatorCategory; - -/** - AppIndicatorStatus: - @APP_INDICATOR_STATUS_PASSIVE: The indicator should not be shown to the user. - @APP_INDICATOR_STATUS_ACTIVE: The indicator should be shown in it's default state. - @APP_INDICATOR_STATUS_ATTENTION: The indicator should show it's attention icon. - - These are the states that the indicator can be on in - the user's panel. The indicator by default starts - in the state @APP_INDICATOR_STATUS_PASSIVE and can be - shown by setting it to @APP_INDICATOR_STATUS_ACTIVE. -*/ -typedef enum { /*< prefix=APP_INDICATOR_STATUS >*/ - APP_INDICATOR_STATUS_PASSIVE, /*< nick=Passive >*/ - APP_INDICATOR_STATUS_ACTIVE, /*< nick=Active >*/ - APP_INDICATOR_STATUS_ATTENTION /*< nick=NeedsAttention >*/ -} AppIndicatorStatus; - -typedef struct _AppIndicator AppIndicator; -typedef struct _AppIndicatorClass AppIndicatorClass; -typedef struct _AppIndicatorPrivate AppIndicatorPrivate; - -/** - AppIndicatorClass: - @parent_class: Mia familia - @new_icon: Slot for #AppIndicator::new-icon. - @new_attention_icon: Slot for #AppIndicator::new-attention-icon. - @new_status: Slot for #AppIndicator::new-status. - @new_icon_theme_path: Slot for #AppIndicator::new-icon-theme-path - @new_label: Slot for #AppIndicator::new-label. - @connection_changed: Slot for #AppIndicator::connection-changed. - @app_indicator_reserved_sw: Reserved for future use. - @app_indicator_reserved_ats: Reserved for future use. - @fallback: Function that gets called to make a #GtkStatusIcon when - there is no Application Indicator area available. - @unfallback: The function that gets called if an Application - Indicator area appears after the fallback has been created. - @app_indicator_reserved_1: Reserved for future use. - @app_indicator_reserved_2: Reserved for future use. - @app_indicator_reserved_3: Reserved for future use. - @app_indicator_reserved_4: Reserved for future use. - @app_indicator_reserved_5: Reserved for future use. - @app_indicator_reserved_6: Reserved for future use. - - The signals and external functions that make up the #AppIndicator - class object. -*/ -struct _AppIndicatorClass { - /* Parent */ - GObjectClass parent_class; - - /* DBus Signals */ - void (* new_icon) (AppIndicator *indicator, - gpointer user_data); - void (* new_attention_icon) (AppIndicator *indicator, - gpointer user_data); - void (* new_status) (AppIndicator *indicator, - const gchar *status, - gpointer user_data); - void (* new_icon_theme_path) (AppIndicator *indicator, - const gchar *icon_theme_path, - gpointer user_data); - void (* new_label) (AppIndicator *indicator, - const gchar *label, - const gchar *guide, - gpointer user_data); - - /* Local Signals */ - void (* connection_changed) (AppIndicator * indicator, - gboolean connected, - gpointer user_data); - void (*app_indicator_reserved_sw)(void); - void (*app_indicator_reserved_ats)(void); - - /* Overridable Functions */ - GtkStatusIcon * (*fallback) (AppIndicator * indicator); - void (*unfallback) (AppIndicator * indicator, - GtkStatusIcon * status_icon); - - /* Reserved */ - void (*app_indicator_reserved_1)(void); - void (*app_indicator_reserved_2)(void); - void (*app_indicator_reserved_3)(void); - void (*app_indicator_reserved_4)(void); - void (*app_indicator_reserved_5)(void); - void (*app_indicator_reserved_6)(void); -}; - -/** - AppIndicator: - - A application indicator represents the values that are needed to show a - unique status in the panel for an application. In general, applications - should try to fit in the other indicators that are available on the - panel before using this. But, sometimes it is necissary. -*/ -/* Private fields - @parent: Parent object. - @priv: Internal data. -*/ -struct _AppIndicator { - /*< Private >*/ - GObject parent; - - /*< Private >*/ - AppIndicatorPrivate *priv; -}; - -/* GObject Stuff */ -GType app_indicator_get_type (void) G_GNUC_CONST; - -AppIndicator *app_indicator_new (const gchar *id, - const gchar *icon_name, - AppIndicatorCategory category); -AppIndicator *app_indicator_new_with_path (const gchar *id, - const gchar *icon_name, - AppIndicatorCategory category, - const gchar *icon_theme_path); - -/* Set properties */ -void app_indicator_set_status (AppIndicator *self, - AppIndicatorStatus status); -void app_indicator_set_attention_icon (AppIndicator *self, - const gchar *icon_name); -void app_indicator_set_menu (AppIndicator *self, - GtkMenu *menu); -void app_indicator_set_icon (AppIndicator *self, - const gchar *icon_name); -void app_indicator_set_label (AppIndicator *self, - const gchar *label, - const gchar *guide); -void app_indicator_set_icon_theme_path(AppIndicator *self, - const gchar *icon_theme_path); -void app_indicator_set_ordering_index (AppIndicator *self, - guint32 ordering_index); - -/* Get properties */ -const gchar * app_indicator_get_id (AppIndicator *self); -AppIndicatorCategory app_indicator_get_category (AppIndicator *self); -AppIndicatorStatus app_indicator_get_status (AppIndicator *self); -const gchar * app_indicator_get_icon (AppIndicator *self); -const gchar * app_indicator_get_icon_theme_path(AppIndicator *self); -const gchar * app_indicator_get_attention_icon (AppIndicator *self); -GtkMenu * app_indicator_get_menu (AppIndicator *self); -const gchar * app_indicator_get_label (AppIndicator *self); -const gchar * app_indicator_get_label_guide (AppIndicator *self); -guint32 app_indicator_get_ordering_index (AppIndicator *self); - -G_END_DECLS - -/** - SECTION:app-indicator - @short_description: An object to put application information - into the panel. - @stability: Unstable - @include: libappindicator/app-indicator.h - - An application indicator is a way for an application to put - a menu into the panel on the user's screen. This allows the - user to interact with the application even though it might - not be visible to the user at the time. In most cases this - is not a good solution as there are other ways to inform the - user. It should only be use if persistence is a desired - feature for the user (not for your marketing purpose of - having your logo in the panel). -*/ - -#endif diff --git a/src/appindicator-0.1.pc.in b/src/appindicator-0.1.pc.in deleted file mode 100644 index b80fded..0000000 --- a/src/appindicator-0.1.pc.in +++ /dev/null @@ -1,14 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -bindir=@bindir@ -includedir=@includedir@ - -Cflags: -I${includedir}/libappindicator-0.1 -Requires: dbusmenu-glib gtk+-2.0 -Libs: -L${libdir} -lappindicator - -Name: appindicator-0.1 -Description: Application indicators -Version: @VERSION@ - diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index e3befff..6e05739 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -25,7 +25,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #endif #include <dbus/dbus-glib.h> -#include "app-indicator.h" +#include "libappindicator/app-indicator.h" #include "app-indicator-enum-types.h" #include "application-service-appstore.h" #include "application-service-marshal.h" diff --git a/src/generate-id.h b/src/generate-id.h index 9d3167d..4c26da2 100644 --- a/src/generate-id.h +++ b/src/generate-id.h @@ -23,7 +23,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #define __GENERATE_ID_H__ #include <glib.h> -#include "app-indicator.h" +#include "libappindicator/app-indicator.h" guint32 generate_id (const AppIndicatorCategory category, const gchar * id); diff --git a/tests/Makefile.am b/tests/Makefile.am index f2bdbb2..cef1eda 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,103 +1,13 @@ check_PROGRAMS = \ - test-approver \ - test-libappindicator \ - test-libappindicator-dbus-client \ - test-libappindicator-dbus-server \ - test-libappindicator-status-client \ - test-libappindicator-status-server \ - test-libappindicator-fallback-watcher \ - test-libappindicator-fallback-item \ - test-simple-app + test-approver TESTS = DISTCLEANFILES = $(TESTS) EXTRA_DIST = run-xvfb.sh -######################################### -## test-libappindicator -######################################### - -test_libappindicator_SOURCES = \ - test-libappindicator.c - -test_libappindicator_CFLAGS = \ - $(INDICATOR_CFLAGS) \ - -Wall -Werror \ - -I$(top_srcdir)/src - -test_libappindicator_LDADD = \ - $(INDICATOR_LIBS) \ - $(top_builddir)/src/libappindicator.la - -######################################### -## test-libappindicator-dbus-client -######################################### - -test_libappindicator_dbus_client_SOURCES = \ - test-defines.h \ - test-libappindicator-dbus-client.c - -test_libappindicator_dbus_client_CFLAGS = \ - $(INDICATOR_CFLAGS) \ - -Wall -Werror \ - -I$(top_srcdir)/src - -test_libappindicator_dbus_client_LDADD = \ - $(INDICATOR_LIBS) \ - $(top_builddir)/src/libappindicator.la - -######################################### -## test-libappindicator-dbus-server -######################################### - -test_libappindicator_dbus_server_SOURCES = \ - test-defines.h \ - test-libappindicator-dbus-server.c - -test_libappindicator_dbus_server_CFLAGS = \ - $(INDICATOR_CFLAGS) \ - -Wall -Werror \ - -I$(top_srcdir)/src - -test_libappindicator_dbus_server_LDADD = \ - $(INDICATOR_LIBS) \ - $(top_builddir)/src/libappindicator.la - -######################################### -## test-libappindicator-status-client -######################################### - -test_libappindicator_status_client_SOURCES = \ - test-defines.h \ - test-libappindicator-status-client.c - -test_libappindicator_status_client_CFLAGS = \ - $(INDICATOR_CFLAGS) \ - -Wall -Werror \ - -I$(top_srcdir)/src - -test_libappindicator_status_client_LDADD = \ - $(INDICATOR_LIBS) \ - $(top_builddir)/src/libappindicator.la - -######################################### -## test-libappindicator-status-server -######################################### - -test_libappindicator_status_server_SOURCES = \ - test-defines.h \ - test-libappindicator-status-server.c - -test_libappindicator_status_server_CFLAGS = \ - $(INDICATOR_CFLAGS) \ - -Wall -Werror \ - -I$(top_srcdir)/src - -test_libappindicator_status_server_LDADD = \ - $(INDICATOR_LIBS) \ - $(top_builddir)/src/libappindicator.la +DBUS_RUNNER=dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf ######################################### ## test-approver @@ -108,13 +18,14 @@ test_approver_SOURCES = \ test_approver_CFLAGS = \ $(INDICATOR_CFLAGS) \ + $(TEST_CFLAGS) \ -Wall -Werror \ -I$(top_srcdir)/src \ -I$(top_builddir)/src test_approver_LDADD = \ $(INDICATOR_LIBS) \ - $(top_builddir)/src/libappindicator.la + $(TEST_LIBS) test-approver-tester: test-approver Makefile.am @echo "#!/bin/bash" > $@ @@ -126,95 +37,3 @@ test-approver-tester: test-approver Makefile.am TESTS += test-approver-tester -######################################### -## test-libappindicator-fallback -######################################### - -test_libappindicator_fallback_watcher_SOURCES = \ - test-libappindicator-fallback-watcher.c - -test_libappindicator_fallback_watcher_CFLAGS = \ - $(INDICATOR_CFLAGS) \ - -Wall -Werror \ - -I$(top_srcdir)/src - -test_libappindicator_fallback_watcher_LDADD = \ - $(INDICATOR_LIBS) \ - $(top_builddir)/src/libappindicator.la - -test_libappindicator_fallback_item_SOURCES = \ - test-libappindicator-fallback-item.c - -test_libappindicator_fallback_item_CFLAGS = \ - $(INDICATOR_CFLAGS) \ - -Wall -Werror \ - -I$(top_srcdir)/src - -test_libappindicator_fallback_item_LDADD = \ - $(INDICATOR_LIBS) \ - $(top_builddir)/src/libappindicator.la - -test-libappindicator-fallback: test-libappindicator-fallback-watcher test-libappindicator-fallback-item Makefile.am - @echo "#!/bin/bash" > $@ - @echo . $(srcdir)/run-xvfb.sh >> $@ - @echo $(DBUS_RUNNER) --task ./test-libappindicator-fallback-watcher --task-name Watcher --ignore-return --task ./test-libappindicator-fallback-item --task-name Item >> $@ - @chmod +x $@ - -TESTS += test-libappindicator-fallback - -######################################### -## Actual tests -######################################### - -XML_REPORT = libappindicator-check-results.xml -HTML_REPORT = libappindicator-check-results.html - -libappindicator-tests: libappindicator-tests-gtester Makefile.am - @echo "#!/bin/bash" > $@ - @echo . $(srcdir)/run-xvfb.sh >> $@ - @echo $(DBUS_RUNNER) --task ./libappindicator-tests-gtester >> $@ - @chmod +x $@ - -libappindicator-tests-gtester: test-libappindicator Makefile.am - @echo "#!/bin/sh" > $@ - @echo gtester -k --verbose -o=$(XML_REPORT) ./test-libappindicator >> $@ - @chmod +x $@ - -TESTS += libappindicator-tests -DISTCLEANFILES += $(XML_REPORT) $(HTML_REPORT) libappindicator-tests-gtester - - -DBUS_RUNNER=dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf - -test-libappindicator-dbus: test-libappindicator-dbus-client test-libappindicator-dbus-server Makefile.am - @echo "#!/bin/bash" > test-libappindicator-dbus - @echo . $(srcdir)/run-xvfb.sh >> $@ - @echo $(DBUS_RUNNER) --task ./test-libappindicator-dbus-client --task-name Client --task ./test-libappindicator-dbus-server --task-name Server --ignore-return >> test-libappindicator-dbus - @chmod +x test-libappindicator-dbus - -TESTS += test-libappindicator-dbus - -test-libappindicator-status: test-libappindicator-status-client test-libappindicator-status-server Makefile.am - @echo "#!/bin/bash" > test-libappindicator-status - @echo . $(srcdir)/run-xvfb.sh >> $@ - @echo $(DBUS_RUNNER) --task ./test-libappindicator-status-client --task-name Client --task ./test-libappindicator-status-server --task-name Server --ignore-return >> test-libappindicator-status - @chmod +x test-libappindicator-status - -TESTS += test-libappindicator-status - -######################################### -## test-simple-app -######################################### - -test_simple_app_SOURCES = \ - test-simple-app.c - -test_simple_app_CFLAGS = \ - $(INDICATOR_CFLAGS) \ - -Wall -Werror \ - -I$(top_srcdir)/src - -test_simple_app_LDADD = \ - $(INDICATOR_LIBS) \ - $(top_builddir)/src/libappindicator.la - diff --git a/tests/test-approver.c b/tests/test-approver.c index 2665505..adad4a7 100644 --- a/tests/test-approver.c +++ b/tests/test-approver.c @@ -5,7 +5,7 @@ #include "notification-watcher-client.h" #include "dbus-shared.h" -#include "app-indicator.h" +#include "libappindicator/app-indicator.h" #define APPROVER_PATH "/my/approver" diff --git a/tests/test-defines.h b/tests/test-defines.h deleted file mode 100644 index 2baf728..0000000 --- a/tests/test-defines.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -Testing defines to be shared between various tests. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -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 <http://www.gnu.org/licenses/>. -*/ - -#define TEST_ID "my-id" -#define TEST_ICON_NAME "my-icon-name" -#define TEST_ATTENTION_ICON_NAME "my-attention-icon-name" -#define TEST_STATE APP_INDICATOR_STATUS_ACTIVE -#define TEST_STATE_S "Active" -#define TEST_CATEGORY APP_INDICATOR_CATEGORY_APPLICATION_STATUS -#define TEST_CATEGORY_S "ApplicationStatus" -#define TEST_OBJECT "/an/object/path/to/use" - diff --git a/tests/test-libappindicator-dbus-client.c b/tests/test-libappindicator-dbus-client.c deleted file mode 100644 index 1500213..0000000 --- a/tests/test-libappindicator-dbus-client.c +++ /dev/null @@ -1,292 +0,0 @@ -/* -Tests for the libappindicator library that are over DBus. This is -the client side of those tests. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -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 <http://www.gnu.org/licenses/>. -*/ - - -#include <glib.h> -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-bindings.h> -#include <dbus/dbus-glib-lowlevel.h> -#include <app-indicator.h> -#include "test-defines.h" - -#include "../src/dbus-shared.h" - -static GMainLoop * mainloop = NULL; -static gboolean passed = TRUE; -static int propcount = 0; - -static void -check_propcount (void) -{ - if (propcount >= 5) { - g_main_loop_quit(mainloop); - } - return; -} - - -static void -prop_id_cb (DBusGProxy * proxy, DBusGProxyCall * call, void * data) -{ - propcount++; - - GError * error = NULL; - GValue value = {0}; - - if (!dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_VALUE, &value, G_TYPE_INVALID)) { - g_warning("Getting ID failed: %s", error->message); - g_error_free(error); - passed = FALSE; - check_propcount(); - return; - } - - if (g_strcmp0(TEST_ID, g_value_get_string(&value))) { - g_debug("Property ID Returned: FAILED"); - passed = FALSE; - } else { - g_debug("Property ID Returned: PASSED"); - } - - check_propcount(); - return; -} - -static void -prop_category_cb (DBusGProxy * proxy, DBusGProxyCall * call, void * data) -{ - propcount++; - - GError * error = NULL; - GValue value = {0}; - - if (!dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_VALUE, &value, G_TYPE_INVALID)) { - g_warning("Getting category failed: %s", error->message); - g_error_free(error); - passed = FALSE; - check_propcount(); - return; - } - - if (g_strcmp0(TEST_CATEGORY_S, g_value_get_string(&value))) { - g_debug("Property category Returned: FAILED"); - passed = FALSE; - } else { - g_debug("Property category Returned: PASSED"); - } - - check_propcount(); - return; -} - -static void -prop_status_cb (DBusGProxy * proxy, DBusGProxyCall * call, void * data) -{ - propcount++; - - GError * error = NULL; - GValue value = {0}; - - if (!dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_VALUE, &value, G_TYPE_INVALID)) { - g_warning("Getting status failed: %s", error->message); - g_error_free(error); - passed = FALSE; - check_propcount(); - return; - } - - if (g_strcmp0(TEST_STATE_S, g_value_get_string(&value))) { - g_debug("Property status Returned: FAILED"); - passed = FALSE; - } else { - g_debug("Property status Returned: PASSED"); - } - - check_propcount(); - return; -} - -static void -prop_icon_name_cb (DBusGProxy * proxy, DBusGProxyCall * call, void * data) -{ - propcount++; - - GError * error = NULL; - GValue value = {0}; - - if (!dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_VALUE, &value, G_TYPE_INVALID)) { - g_warning("Getting icon name failed: %s", error->message); - g_error_free(error); - passed = FALSE; - check_propcount(); - return; - } - - if (g_strcmp0(TEST_ICON_NAME, g_value_get_string(&value))) { - g_debug("Property icon name Returned: FAILED"); - passed = FALSE; - } else { - g_debug("Property icon name Returned: PASSED"); - } - - check_propcount(); - return; -} - -static void -prop_attention_icon_name_cb (DBusGProxy * proxy, DBusGProxyCall * call, void * data) -{ - propcount++; - - GError * error = NULL; - GValue value = {0}; - - if (!dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_VALUE, &value, G_TYPE_INVALID)) { - g_warning("Getting attention icon name failed: %s", error->message); - g_error_free(error); - passed = FALSE; - check_propcount(); - return; - } - - if (g_strcmp0(TEST_ATTENTION_ICON_NAME, g_value_get_string(&value))) { - g_debug("Property attention icon name Returned: FAILED"); - passed = FALSE; - } else { - g_debug("Property attention icon name Returned: PASSED"); - } - - check_propcount(); - return; -} - -gboolean -kill_func (gpointer userdata) -{ - g_main_loop_quit(mainloop); - g_warning("Forced to Kill"); - passed = FALSE; - return FALSE; -} - -static DBusHandlerResult -dbus_filter (DBusConnection * connection, DBusMessage * message, void * user_data) -{ - if (dbus_message_is_method_call(message, NOTIFICATION_WATCHER_DBUS_ADDR, "RegisterStatusNotifierItem")) { - DBusMessage * reply = dbus_message_new_method_return(message); - dbus_connection_send(connection, reply, NULL); - dbus_message_unref(reply); - return DBUS_HANDLER_RESULT_HANDLED; - } - - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; -} - -gint -main (gint argc, gchar * argv[]) -{ - g_type_init(); - - g_usleep(500000); - - GError * error = NULL; - DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); - if (error != NULL) { - g_error("Unable to get session bus: %s", error->message); - return 1; - } - - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(session_bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - guint nameret = 0; - - if (!org_freedesktop_DBus_request_name(bus_proxy, NOTIFICATION_WATCHER_DBUS_ADDR, 0, &nameret, &error)) { - g_error("Unable to call to request name"); - return 1; - } - - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } - - dbus_connection_add_filter(dbus_g_connection_get_connection(session_bus), dbus_filter, NULL, NULL); - - DBusGProxy * props = dbus_g_proxy_new_for_name_owner(session_bus, - ":1.0", - "/org/ayatana/NotificationItem/my_id", - DBUS_INTERFACE_PROPERTIES, - &error); - if (error != NULL) { - g_error("Unable to get property proxy: %s", error->message); - return 1; - } - - dbus_g_proxy_begin_call (props, - "Get", - prop_id_cb, - NULL, NULL, - G_TYPE_STRING, "org.ayatana.indicator.application.NotificationItem", - G_TYPE_STRING, "Id", - G_TYPE_INVALID); - dbus_g_proxy_begin_call (props, - "Get", - prop_category_cb, - NULL, NULL, - G_TYPE_STRING, "org.ayatana.indicator.application.NotificationItem", - G_TYPE_STRING, "Category", - G_TYPE_INVALID); - dbus_g_proxy_begin_call (props, - "Get", - prop_status_cb, - NULL, NULL, - G_TYPE_STRING, "org.ayatana.indicator.application.NotificationItem", - G_TYPE_STRING, "Status", - G_TYPE_INVALID); - dbus_g_proxy_begin_call (props, - "Get", - prop_icon_name_cb, - NULL, NULL, - G_TYPE_STRING, "org.ayatana.indicator.application.NotificationItem", - G_TYPE_STRING, "IconName", - G_TYPE_INVALID); - dbus_g_proxy_begin_call (props, - "Get", - prop_attention_icon_name_cb, - NULL, NULL, - G_TYPE_STRING, "org.ayatana.indicator.application.NotificationItem", - G_TYPE_STRING, "AttentionIconName", - G_TYPE_INVALID); - - g_timeout_add_seconds(2, kill_func, NULL); - - mainloop = g_main_loop_new(NULL, FALSE); - g_main_loop_run(mainloop); - - if (passed) { - g_debug("Quiting"); - return 0; - } else { - g_debug("Quiting as we're a failure"); - return 1; - } - return 0; -} diff --git a/tests/test-libappindicator-dbus-server.c b/tests/test-libappindicator-dbus-server.c deleted file mode 100644 index 995d49b..0000000 --- a/tests/test-libappindicator-dbus-server.c +++ /dev/null @@ -1,66 +0,0 @@ -/* -Tests for the libappindicator library that are over DBus. This is -the server side of those tests. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -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 <http://www.gnu.org/licenses/>. -*/ - - -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-lowlevel.h> -#include <gtk/gtk.h> -#include <app-indicator.h> -#include "test-defines.h" - -static GMainLoop * mainloop = NULL; - -gboolean -kill_func (gpointer userdata) -{ - g_main_loop_quit(mainloop); - return FALSE; -} - -gint -main (gint argc, gchar * argv[]) -{ - gtk_init(&argc, &argv); - - g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, NULL)))); - - AppIndicator * ci = app_indicator_new (TEST_ID, TEST_ICON_NAME, TEST_CATEGORY); - - app_indicator_set_status (ci, TEST_STATE); - app_indicator_set_attention_icon (ci, TEST_ATTENTION_ICON_NAME); - - GtkMenu * menu = GTK_MENU(gtk_menu_new()); - GtkMenuItem * item = GTK_MENU_ITEM(gtk_menu_item_new_with_label("Label")); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), GTK_WIDGET(item)); - - app_indicator_set_menu(ci, menu); - - g_timeout_add_seconds(2, kill_func, NULL); - - mainloop = g_main_loop_new(NULL, FALSE); - g_main_loop_run(mainloop); - - g_object_unref(G_OBJECT(ci)); - g_debug("Quiting"); - - return 0; -} diff --git a/tests/test-libappindicator-fallback-item.c b/tests/test-libappindicator-fallback-item.c deleted file mode 100644 index 418b779..0000000 --- a/tests/test-libappindicator-fallback-item.c +++ /dev/null @@ -1,153 +0,0 @@ -#include <glib.h> -#include <glib-object.h> -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-bindings.h> -#include <app-indicator.h> - -#define TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE (test_libappindicator_fallback_item_get_type ()) -#define TEST_LIBAPPINDICATOR_FALLBACK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE, TestLibappindicatorFallbackItem)) -#define TEST_LIBAPPINDICATOR_FALLBACK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE, TestLibappindicatorFallbackItemClass)) -#define IS_TEST_LIBAPPINDICATOR_FALLBACK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE)) -#define IS_TEST_LIBAPPINDICATOR_FALLBACK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE)) -#define TEST_LIBAPPINDICATOR_FALLBACK_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE, TestLibappindicatorFallbackItemClass)) - -typedef struct _TestLibappindicatorFallbackItem TestLibappindicatorFallbackItem; -typedef struct _TestLibappindicatorFallbackItemClass TestLibappindicatorFallbackItemClass; - -struct _TestLibappindicatorFallbackItemClass { - AppIndicatorClass parent_class; - -}; - -struct _TestLibappindicatorFallbackItem { - AppIndicator parent; - -}; - -GType test_libappindicator_fallback_item_get_type (void); - -#define TEST_LIBAPPINDICATOR_FALLBACK_ITEM_GET_PRIVATE(o) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((o), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE, TestLibappindicatorFallbackItemPrivate)) - -static void test_libappindicator_fallback_item_class_init (TestLibappindicatorFallbackItemClass *klass); -static void test_libappindicator_fallback_item_init (TestLibappindicatorFallbackItem *self); -static GtkStatusIcon * fallback (AppIndicator * indicator); -static void unfallback (AppIndicator * indicator, GtkStatusIcon * status_icon); - -G_DEFINE_TYPE (TestLibappindicatorFallbackItem, test_libappindicator_fallback_item, APP_INDICATOR_TYPE); - -static void -test_libappindicator_fallback_item_class_init (TestLibappindicatorFallbackItemClass *klass) -{ - AppIndicatorClass * aiclass = APP_INDICATOR_CLASS(klass); - - aiclass->fallback = fallback; - aiclass->unfallback = unfallback; -} - -static void -test_libappindicator_fallback_item_init (TestLibappindicatorFallbackItem *self) -{ -} - -GMainLoop * mainloop = NULL; -gboolean passed = FALSE; - -enum { - STATE_INIT, - STATE_FALLBACK, - STATE_UNFALLBACK, - STATE_REFALLBACK, - STATE_REUNFALLBACK -}; - -gint state = STATE_INIT; - -static GtkStatusIcon * -fallback (AppIndicator * indicator) -{ - g_debug("Fallback"); - if (state == STATE_INIT) { - state = STATE_FALLBACK; - } else if (state == STATE_UNFALLBACK) { - state = STATE_REFALLBACK; - } else { - g_debug("Error, fallback in state: %d", state); - passed = FALSE; - } - return (GtkStatusIcon *)5; -} - -static void -unfallback (AppIndicator * indicator, GtkStatusIcon * status_icon) -{ - g_debug("Unfallback"); - if (state == STATE_FALLBACK) { - state = STATE_UNFALLBACK; - } else if (state == STATE_REFALLBACK) { - state = STATE_REUNFALLBACK; - passed = TRUE; - g_main_loop_quit(mainloop); - } else { - g_debug("Error, unfallback in state: %d", state); - passed = FALSE; - } - return; -} - -gboolean -kill_func (gpointer data) -{ - g_debug("Kill Function"); - g_main_loop_quit(mainloop); - return FALSE; -} - -int -main (int argc, char ** argv) -{ - gtk_init(&argc, &argv); - - GError * error = NULL; - DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); - if (error != NULL) { - g_error("Unable to get session bus: %s", error->message); - return 1; - } - - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(session_bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - - guint nameret = 0; - - if (!org_freedesktop_DBus_request_name(bus_proxy, "org.test", 0, &nameret, NULL)) { - g_error("Unable to call to request name"); - return 1; - } - - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } - - TestLibappindicatorFallbackItem * item = g_object_new(TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE, - "id", "test-id", - "category", "Other", - "icon-name", "bob", - NULL); - - GtkWidget * menu = gtk_menu_new(); - app_indicator_set_menu(APP_INDICATOR(item), GTK_MENU(menu)); - - g_timeout_add_seconds(2, kill_func, NULL); - - mainloop = g_main_loop_new(NULL, FALSE); - g_main_loop_run(mainloop); - - g_object_unref(G_OBJECT(item)); - - if (passed) { - return 0; - } else { - return 1; - } -} diff --git a/tests/test-libappindicator-fallback-watcher.c b/tests/test-libappindicator-fallback-watcher.c deleted file mode 100644 index 5494082..0000000 --- a/tests/test-libappindicator-fallback-watcher.c +++ /dev/null @@ -1,117 +0,0 @@ -/* -This puts the NotificationWatcher on the bus, kinda. Enough to -trick the Item into unfalling back. - -Copyright 2010 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -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 <http://www.gnu.org/licenses/>. -*/ - -#include <glib.h> -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-bindings.h> -#include <dbus/dbus-glib-lowlevel.h> - -#include "../src/dbus-shared.h" - -gboolean kill_func (gpointer userdata); - -static GMainLoop * mainloop = NULL; - -static DBusHandlerResult -dbus_filter (DBusConnection * connection, DBusMessage * message, void * user_data) -{ - if (dbus_message_is_method_call(message, NOTIFICATION_WATCHER_DBUS_ADDR, "RegisterStatusNotifierItem")) { - DBusMessage * reply = dbus_message_new_method_return(message); - dbus_connection_send(connection, reply, NULL); - dbus_message_unref(reply); - - /* Let the messages get out, but we're done at this point */ - g_timeout_add(50, kill_func, NULL); - - return DBUS_HANDLER_RESULT_HANDLED; - } - - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; -} - -gboolean -kill_func (gpointer userdata) -{ - g_main_loop_quit(mainloop); - return FALSE; -} - -int -main (int argv, char ** argc) -{ - g_type_init(); - - g_debug("Waiting to init."); - - - GError * error = NULL; - DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); - if (error != NULL) { - g_error("Unable to get session bus: %s", error->message); - return 1; - } - - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(session_bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - - gboolean has_owner = FALSE; - gint owner_count = 0; - while (!has_owner && owner_count < 10000) { - org_freedesktop_DBus_name_has_owner(bus_proxy, "org.test", &has_owner, NULL); - owner_count++; - } - - if (owner_count == 10000) { - g_error("Unable to get name owner after 10000 tries"); - return 1; - } - - g_usleep(500000); - - g_debug("Initing"); - - guint nameret = 0; - - if (!org_freedesktop_DBus_request_name(bus_proxy, NOTIFICATION_WATCHER_DBUS_ADDR, 0, &nameret, &error)) { - g_error("Unable to call to request name"); - return 1; - } - - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } - - dbus_connection_add_filter(dbus_g_connection_get_connection(session_bus), dbus_filter, NULL, NULL); - - /* This is the final kill function. It really shouldn't happen - unless we get an error. */ - g_timeout_add(2000, kill_func, NULL); - - g_debug("Entering Mainloop"); - - mainloop = g_main_loop_new(NULL, FALSE); - g_main_loop_run(mainloop); - - g_debug("Exiting"); - - return 0; -} diff --git a/tests/test-libappindicator-status-client.c b/tests/test-libappindicator-status-client.c deleted file mode 100644 index 9e39ed8..0000000 --- a/tests/test-libappindicator-status-client.c +++ /dev/null @@ -1,153 +0,0 @@ -/* -Tests for the libappindicator library that are over DBus. This is -the client side of those tests. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -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 <http://www.gnu.org/licenses/>. -*/ - - -#include <glib.h> -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-bindings.h> -#include <dbus/dbus-glib-lowlevel.h> -#include "../src/dbus-shared.h" - -static GMainLoop * mainloop = NULL; -static gboolean passed = TRUE; -static gboolean watchdog_hit = TRUE; -static gboolean active = FALSE; -static guint toggle_count = 0; - -#define PASSIVE_STR "Passive" -#define ACTIVE_STR "Active" -#define ATTN_STR "NeedsAttention" - -static DBusHandlerResult -dbus_reg_filter (DBusConnection * connection, DBusMessage * message, void * user_data) -{ - if (dbus_message_is_method_call(message, NOTIFICATION_WATCHER_DBUS_ADDR, "RegisterStatusNotifierItem")) { - DBusMessage * reply = dbus_message_new_method_return(message); - dbus_connection_send(connection, reply, NULL); - dbus_message_unref(reply); - return DBUS_HANDLER_RESULT_HANDLED; - } - - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; -} - - -static DBusHandlerResult -dbus_filter (DBusConnection * connection, DBusMessage * message, void * user_data) -{ - if (!dbus_message_is_signal(message, NOTIFICATION_ITEM_DBUS_IFACE, "NewStatus")) { - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - - gchar * string; - - DBusError derror; - dbus_error_init(&derror); - if (!dbus_message_get_args(message, &derror, - DBUS_TYPE_STRING, &string, - DBUS_TYPE_INVALID)) { - g_warning("Couldn't get parameters"); - dbus_error_free(&derror); - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - - watchdog_hit = TRUE; - - if (g_strcmp0(string, ACTIVE_STR) == 0) { - if (active) { - g_warning("Got active when already active"); - passed = FALSE; - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - active = TRUE; - } else { - active = FALSE; - } - - toggle_count++; - - if (toggle_count == 100) { - g_main_loop_quit(mainloop); - } - - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; -} - -gboolean -kill_func (gpointer userdata) -{ - if (watchdog_hit == FALSE) { - g_main_loop_quit(mainloop); - g_warning("Forced to Kill"); - g_warning("Toggle count: %d", toggle_count); - passed = FALSE; - return FALSE; - } - watchdog_hit = FALSE; - return TRUE; -} - -gint -main (gint argc, gchar * argv[]) -{ - g_type_init(); - - GError * error = NULL; - DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); - if (error != NULL) { - g_error("Unable to get session bus: %s", error->message); - return 1; - } - - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(session_bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - guint nameret = 0; - - if (!org_freedesktop_DBus_request_name(bus_proxy, NOTIFICATION_WATCHER_DBUS_ADDR, 0, &nameret, &error)) { - g_error("Unable to call to request name"); - return 1; - } - - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } - - dbus_connection_add_filter(dbus_g_connection_get_connection(session_bus), dbus_reg_filter, NULL, NULL); - - dbus_connection_add_filter(dbus_g_connection_get_connection(session_bus), dbus_filter, NULL, NULL); - dbus_bus_add_match(dbus_g_connection_get_connection(session_bus), "type='signal',interface='" NOTIFICATION_ITEM_DBUS_IFACE "',member='NewStatus'", NULL); - - watchdog_hit = TRUE; - g_timeout_add(1000, kill_func, NULL); - - mainloop = g_main_loop_new(NULL, FALSE); - g_main_loop_run(mainloop); - - if (passed) { - g_debug("Quiting"); - return 0; - } else { - g_debug("Quiting as we're a failure"); - return 1; - } - return 0; -} diff --git a/tests/test-libappindicator-status-server.c b/tests/test-libappindicator-status-server.c deleted file mode 100644 index 8cd5571..0000000 --- a/tests/test-libappindicator-status-server.c +++ /dev/null @@ -1,82 +0,0 @@ -/* -Tests for the libappindicator library that are over DBus. This is -the server side of those tests. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -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 <http://www.gnu.org/licenses/>. -*/ - - -#include <stdlib.h> -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-lowlevel.h> -#include <glib.h> -#include <app-indicator.h> - -static GMainLoop * mainloop = NULL; -static gboolean active = FALSE; -static guint toggle_count = 0; - -gboolean -toggle (gpointer userdata) -{ - if (active) { - app_indicator_set_status (APP_INDICATOR(userdata), APP_INDICATOR_STATUS_ATTENTION); - active = FALSE; - } else { - app_indicator_set_status (APP_INDICATOR(userdata), APP_INDICATOR_STATUS_ACTIVE); - active = TRUE; - } - - toggle_count++; - - if (toggle_count == 100) { - g_main_loop_quit(mainloop); - return FALSE; - } - - return TRUE; -} - -gint -main (gint argc, gchar * argv[]) -{ - gtk_init(&argc, &argv); - - g_usleep(100000); - - g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, NULL)))); - - AppIndicator * ci = app_indicator_new ("my-id", "my-icon-name", APP_INDICATOR_CATEGORY_APPLICATION_STATUS); - app_indicator_set_attention_icon (ci, "my-attention-icon"); - - GtkMenu * menu = GTK_MENU(gtk_menu_new()); - GtkMenuItem * item = GTK_MENU_ITEM(gtk_menu_item_new_with_label("Label")); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), GTK_WIDGET(item)); - - app_indicator_set_menu(ci, menu); - - g_timeout_add(50, toggle, ci); - - mainloop = g_main_loop_new(NULL, FALSE); - g_main_loop_run(mainloop); - - g_object_unref(G_OBJECT(ci)); - g_debug("Quiting"); - - return 0; -} diff --git a/tests/test-libappindicator.c b/tests/test-libappindicator.c deleted file mode 100644 index 8d12ac5..0000000 --- a/tests/test-libappindicator.c +++ /dev/null @@ -1,320 +0,0 @@ -/* -Tests for the libappindicator library. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -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 <http://www.gnu.org/licenses/>. -*/ - - -#include <glib.h> -#include <glib-object.h> - -#include <app-indicator.h> - -void -test_libappindicator_prop_signals_status_helper (AppIndicator * ci, gchar * status, gboolean * signalactivated) -{ - *signalactivated = TRUE; - return; -} - -void -test_libappindicator_prop_signals_helper (AppIndicator * ci, gboolean * signalactivated) -{ - *signalactivated = TRUE; - return; -} - -void -test_libappindicator_prop_signals (void) -{ - AppIndicator * ci = app_indicator_new ("test-app-indicator", - "indicator-messages", - APP_INDICATOR_CATEGORY_APPLICATION_STATUS); - - g_assert(ci != NULL); - - gboolean signaled = FALSE; - gulong handlerid; - - handlerid = 0; - handlerid = g_signal_connect(G_OBJECT(ci), "new-icon", G_CALLBACK(test_libappindicator_prop_signals_helper), &signaled); - g_assert(handlerid != 0); - - handlerid = 0; - handlerid = g_signal_connect(G_OBJECT(ci), "new-attention-icon", G_CALLBACK(test_libappindicator_prop_signals_helper), &signaled); - g_assert(handlerid != 0); - - handlerid = 0; - handlerid = g_signal_connect(G_OBJECT(ci), "new-status", G_CALLBACK(test_libappindicator_prop_signals_status_helper), &signaled); - g_assert(handlerid != 0); - - - signaled = FALSE; - app_indicator_set_icon(ci, "bob"); - g_assert(signaled); - - signaled = FALSE; - app_indicator_set_icon(ci, "bob"); - g_assert(!signaled); - - signaled = FALSE; - app_indicator_set_icon(ci, "al"); - g_assert(signaled); - - - signaled = FALSE; - app_indicator_set_attention_icon(ci, "bob"); - g_assert(signaled); - - signaled = FALSE; - app_indicator_set_attention_icon(ci, "bob"); - g_assert(!signaled); - - signaled = FALSE; - app_indicator_set_attention_icon(ci, "al"); - g_assert(signaled); - - - signaled = FALSE; - app_indicator_set_status(ci, APP_INDICATOR_STATUS_PASSIVE); - g_assert(!signaled); - - signaled = FALSE; - app_indicator_set_status(ci, APP_INDICATOR_STATUS_ACTIVE); - g_assert(signaled); - - signaled = FALSE; - app_indicator_set_status(ci, APP_INDICATOR_STATUS_ACTIVE); - g_assert(!signaled); - - signaled = FALSE; - app_indicator_set_status(ci, APP_INDICATOR_STATUS_ATTENTION); - g_assert(signaled); - - return; -} - -void -test_libappindicator_init_set_props (void) -{ - AppIndicator * ci = app_indicator_new ("my-id", - "my-name", - APP_INDICATOR_CATEGORY_APPLICATION_STATUS); - - g_assert(ci != NULL); - - app_indicator_set_status(ci, APP_INDICATOR_STATUS_ACTIVE); - app_indicator_set_attention_icon(ci, "my-attention-name"); - - g_assert(!g_strcmp0("my-id", app_indicator_get_id(ci))); - g_assert(!g_strcmp0("my-name", app_indicator_get_icon(ci))); - g_assert(!g_strcmp0("my-attention-name", app_indicator_get_attention_icon(ci))); - g_assert(app_indicator_get_status(ci) == APP_INDICATOR_STATUS_ACTIVE); - g_assert(app_indicator_get_category(ci) == APP_INDICATOR_CATEGORY_APPLICATION_STATUS); - - g_object_unref(G_OBJECT(ci)); - return; -} - -void -test_libappindicator_init_with_props (void) -{ - AppIndicator * ci = app_indicator_new ("my-id", - "my-name", - APP_INDICATOR_CATEGORY_APPLICATION_STATUS); - - app_indicator_set_status (ci, APP_INDICATOR_STATUS_ACTIVE); - app_indicator_set_attention_icon (ci, "my-attention-name"); - - g_assert(ci != NULL); - - g_assert(!g_strcmp0("my-id", app_indicator_get_id(ci))); - g_assert(!g_strcmp0("my-name", app_indicator_get_icon(ci))); - g_assert(!g_strcmp0("my-attention-name", app_indicator_get_attention_icon(ci))); - g_assert(app_indicator_get_status(ci) == APP_INDICATOR_STATUS_ACTIVE); - g_assert(app_indicator_get_category(ci) == APP_INDICATOR_CATEGORY_APPLICATION_STATUS); - - g_object_unref(G_OBJECT(ci)); - return; -} - -void -test_libappindicator_init (void) -{ - AppIndicator * ci = app_indicator_new ("my-id", "my-name", APP_INDICATOR_CATEGORY_APPLICATION_STATUS); - g_assert(ci != NULL); - g_object_unref(G_OBJECT(ci)); - return; -} - -void -test_libappindicator_set_label (void) -{ - AppIndicator * ci = app_indicator_new ("my-id", - "my-name", - APP_INDICATOR_CATEGORY_APPLICATION_STATUS); - - g_assert(ci != NULL); - g_assert(app_indicator_get_label(ci) == NULL); - g_assert(app_indicator_get_label_guide(ci) == NULL); - - /* First check all the clearing modes, this is important as - we're going to use them later, we need them to work. */ - app_indicator_set_label(ci, NULL, NULL); - - g_assert(app_indicator_get_label(ci) == NULL); - g_assert(app_indicator_get_label_guide(ci) == NULL); - - app_indicator_set_label(ci, "", NULL); - - g_assert(app_indicator_get_label(ci) == NULL); - g_assert(app_indicator_get_label_guide(ci) == NULL); - - app_indicator_set_label(ci, NULL, ""); - - g_assert(app_indicator_get_label(ci) == NULL); - g_assert(app_indicator_get_label_guide(ci) == NULL); - - app_indicator_set_label(ci, "", ""); - - g_assert(app_indicator_get_label(ci) == NULL); - g_assert(app_indicator_get_label_guide(ci) == NULL); - - app_indicator_set_label(ci, "label", ""); - - g_assert(g_strcmp0(app_indicator_get_label(ci), "label") == 0); - g_assert(app_indicator_get_label_guide(ci) == NULL); - - app_indicator_set_label(ci, NULL, NULL); - - g_assert(app_indicator_get_label(ci) == NULL); - g_assert(app_indicator_get_label_guide(ci) == NULL); - - app_indicator_set_label(ci, "label", "guide"); - - g_assert(g_strcmp0(app_indicator_get_label(ci), "label") == 0); - g_assert(g_strcmp0(app_indicator_get_label_guide(ci), "guide") == 0); - - app_indicator_set_label(ci, "label2", "guide"); - - g_assert(g_strcmp0(app_indicator_get_label(ci), "label2") == 0); - g_assert(g_strcmp0(app_indicator_get_label_guide(ci), "guide") == 0); - - app_indicator_set_label(ci, "trick-label", "trick-guide"); - - g_assert(g_strcmp0(app_indicator_get_label(ci), "trick-label") == 0); - g_assert(g_strcmp0(app_indicator_get_label_guide(ci), "trick-guide") == 0); - - g_object_unref(G_OBJECT(ci)); - return; -} - -void -label_signals_cb (AppIndicator * appindicator, gchar * label, gchar * guide, gpointer user_data) -{ - gint * label_signals_count = (gint *)user_data; - (*label_signals_count)++; - return; -} - -void -label_signals_check (void) -{ - while (g_main_context_pending(NULL)) { - g_main_context_iteration(NULL, TRUE); - } - - return; -} - -void -test_libappindicator_label_signals (void) -{ - gint label_signals_count = 0; - AppIndicator * ci = app_indicator_new ("my-id", - "my-name", - APP_INDICATOR_CATEGORY_APPLICATION_STATUS); - - g_assert(ci != NULL); - g_assert(app_indicator_get_label(ci) == NULL); - g_assert(app_indicator_get_label_guide(ci) == NULL); - - g_signal_connect(G_OBJECT(ci), APP_INDICATOR_SIGNAL_NEW_LABEL, G_CALLBACK(label_signals_cb), &label_signals_count); - - /* Shouldn't be a signal as it should be stuck in idle */ - app_indicator_set_label(ci, "label", "guide"); - g_assert(label_signals_count == 0); - - /* Should show up after idle processing */ - label_signals_check(); - g_assert(label_signals_count == 1); - - /* Shouldn't signal with no change */ - label_signals_count = 0; - app_indicator_set_label(ci, "label", "guide"); - label_signals_check(); - g_assert(label_signals_count == 0); - - /* Change one, we should get one signal */ - app_indicator_set_label(ci, "label2", "guide"); - label_signals_check(); - g_assert(label_signals_count == 1); - - /* Change several times, one signal */ - label_signals_count = 0; - app_indicator_set_label(ci, "label1", "guide0"); - app_indicator_set_label(ci, "label1", "guide1"); - app_indicator_set_label(ci, "label2", "guide2"); - app_indicator_set_label(ci, "label3", "guide3"); - label_signals_check(); - g_assert(label_signals_count == 1); - - /* Clear should signal too */ - label_signals_count = 0; - app_indicator_set_label(ci, NULL, NULL); - label_signals_check(); - g_assert(label_signals_count == 1); - - return; -} - -void -test_libappindicator_props_suite (void) -{ - g_test_add_func ("/indicator-application/libappindicator/init", test_libappindicator_init); - g_test_add_func ("/indicator-application/libappindicator/init_props", test_libappindicator_init_with_props); - g_test_add_func ("/indicator-application/libappindicator/init_set_props", test_libappindicator_init_set_props); - g_test_add_func ("/indicator-application/libappindicator/prop_signals", test_libappindicator_prop_signals); - g_test_add_func ("/indicator-application/libappindicator/set_label", test_libappindicator_set_label); - g_test_add_func ("/indicator-application/libappindicator/label_signals", test_libappindicator_label_signals); - - return; -} - -gint -main (gint argc, gchar * argv[]) -{ - gtk_init(&argc, &argv); - g_test_init(&argc, &argv, NULL); - - /* Test suites */ - test_libappindicator_props_suite(); - - - return g_test_run (); -} diff --git a/tests/test-simple-app.c b/tests/test-simple-app.c deleted file mode 100644 index d60d9b9..0000000 --- a/tests/test-simple-app.c +++ /dev/null @@ -1,54 +0,0 @@ -/* -Test that creates a small test app which links with libappindicator. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -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 <http://www.gnu.org/licenses/>. -*/ - - -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-lowlevel.h> -#include <glib.h> -#include <libdbusmenu-glib/server.h> -#include <app-indicator.h> - -static GMainLoop * mainloop = NULL; - -int -main (int argc, char ** argv) -{ - g_type_init(); - - DbusmenuServer * dms = dbusmenu_server_new("/menu"); - DbusmenuMenuitem * dmi = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(dmi, "label", "Bob"); - - AppIndicator * ci = APP_INDICATOR(g_object_new(APP_INDICATOR_TYPE, - "id", "test-application", - "status-enum", APP_INDICATOR_STATUS_ACTIVE, - "icon-name", "system-shutdown", - "menu-object", dms, - NULL)); - - mainloop = g_main_loop_new(NULL, FALSE); - g_main_loop_run(mainloop); - - g_object_unref(G_OBJECT(ci)); - g_debug("Quiting"); - - return 0; -} |