diff options
author | Tomas Frydrych <tf@linux.intel.com> | 2011-01-28 09:54:32 +0000 |
---|---|---|
committer | Tomas Frydrych <tf@linux.intel.com> | 2011-01-28 11:50:55 +0000 |
commit | 73969cd9a8d7ae011047edac8fe321424b68ba4c (patch) | |
tree | 0ecef2a3225f9f9e37991ac1393fd0818807bbf6 |
Initial commit
-rw-r--r-- | AUTHORS | 0 | ||||
-rw-r--r-- | COPYING | 504 | ||||
-rw-r--r-- | ChangeLog | 0 | ||||
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | NEWS | 0 | ||||
-rw-r--r-- | README | 0 | ||||
-rwxr-xr-x | autogen.sh | 22 | ||||
-rw-r--r-- | configure.ac | 181 | ||||
-rw-r--r-- | docs/Makefile.am | 1 | ||||
-rw-r--r-- | docs/reference/Makefile.am | 6 | ||||
-rw-r--r-- | docs/reference/ytstenut-glib/Makefile.am | 101 | ||||
-rw-r--r-- | docs/reference/ytstenut-glib/ytstenut-glib-docs.xml.in | 72 | ||||
-rw-r--r-- | ytstenut-glib/Makefile.am | 149 | ||||
-rw-r--r-- | ytstenut-glib/marshal.list | 8 | ||||
-rw-r--r-- | ytstenut-glib/ytsg-debug.h | 80 | ||||
-rw-r--r-- | ytstenut-glib/ytsg-enum-types.c.in | 40 | ||||
-rw-r--r-- | ytstenut-glib/ytsg-enum-types.h.in | 26 | ||||
-rw-r--r-- | ytstenut-glib/ytsg-main.c | 353 | ||||
-rw-r--r-- | ytstenut-glib/ytsg-main.h | 21 | ||||
-rw-r--r-- | ytstenut-glib/ytsg-version.h.in | 78 | ||||
-rw-r--r-- | ytstenut-glib/ytstenut-glib.h | 19 | ||||
-rw-r--r-- | ytstenut-glib/ytstenut-glib.pc.in | 14 |
22 files changed, 1678 insertions, 0 deletions
@@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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/ChangeLog b/ChangeLog new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/ChangeLog diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..5ff2a9d --- /dev/null +++ b/Makefile.am @@ -0,0 +1,3 @@ +SUBDIRS=ytstenut-glib docs + +DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..eb6249a --- /dev/null +++ b/autogen.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# Run this to generate all the initial makefiles, etc. + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +PKG_NAME="ytstenut-glib" +REQUIRED_AUTOMAKE_VERSION=1.10 + +(test -f $srcdir/configure.ac \ + && test -d $srcdir/ytstenut-glib) || { + echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" + echo " top-level ytstenut-glib directory" + exit 1 +} + +which gnome-autogen.sh || { + echo "You need to install gnome-common from GNOME Subversion (or from" + echo "your distribution's package manager)." + exit 1 +} +USE_GNOME2_MACROS=1 USE_COMMON_DOC_BUILD=yes . gnome-autogen.sh diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..48e06e4 --- /dev/null +++ b/configure.ac @@ -0,0 +1,181 @@ +m4_define([ytsg_major_version], [0]) +m4_define([ytsg_minor_version], [1]) +m4_define([ytsg_micro_version], [0]) +m4_define([ytsg_version], + [ytsg_major_version.ytsg_minor_version.ytsg_micro_version]) + +m4_define([ytsg_api_version], [1.0]) + +# increase the interface age of 2 for each release +# set to 0 if the API changes +m4_define([ytsg_interface_age], [0]) +m4_define([ytsg_binary_age], [m4_eval(100 * ytsg_minor_version + ytsg_micro_version)]) + +m4_define([ytsg_lt_current], [m4_eval(100 * ytsg_minor_version + ytsg_micro_version - ytsg_interface_age)]) +m4_define([ytsg_lt_revision], [ytsg_interface_age]) +m4_define([ytsg_lt_age], [m4_eval(ytsg_binary_age - ytsg_interface_age)]) + +# defaults +m4_define([default_enable_cache], [no]) + +AC_PREREQ([2.59]) + +AC_INIT([ytstenut-glib], [ytsg_version], [http://ytstenut.meego.com]) +AC_CONFIG_MACRO_DIR([build/autotools]) + +AC_CONFIG_SRCDIR(ytstenut-glib/ytstenut-glib.h) + +AM_INIT_AUTOMAKE([tar-ustar dist-bzip2]) + +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],[]) + +YTSG_MAJOR_VERSION=ytsg_major_version +YTSG_MINOR_VERSION=ytsg_minor_version +YTSG_MICRO_VERSION=ytsg_micro_version +YTSG_VERSION=ytsg_version +YTSG_API_VERSION=ytsg_api_version +AC_SUBST(YTSG_MAJOR_VERSION) +AC_SUBST(YTSG_MINOR_VERSION) +AC_SUBST(YTSG_MICRO_VERSION) +AC_SUBST(YTSG_VERSION) +AC_SUBST(YTSG_API_VERSION) + +AM_CONFIG_HEADER([config.h]) + +AC_PROG_CC +AM_PROG_CC_C_O +AC_ISC_POSIX +AC_HEADER_STDC +AM_PROG_LIBTOOL + +GTK_DOC_CHECK([1.11], [--flavour no-tmpl]) + +AM_CONDITIONAL([BUILD_GTK_DOC], [test "x$enable_gtk_doc" = "xyes" || test ! -f "autogen.sh"]) + +# prefixes for fixing gtk-doc references +GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`" +AC_SUBST(GLIB_PREFIX) + +TELEPATHY_VERSION=">= 0.11.7" +AC_SUBST(TELEPATHY_VERSION) + +YTSG_PC_MODULES="$YTSG_PC_MODULES telepathy-glib $TELEPATHY_VERSION gio-unix-2.0" + +AC_ARG_ENABLE([docs], + [AC_HELP_STRING([--enable-docs=@<:@no/yes@:>@], + [Build optional documentation.])], + [enable_docs=$enableval], + [enable_docs=no]) + +AM_CONDITIONAL(ENABLE_DOCS, [test "x$enable_docs" = "xyes"]) + +m4_define([debug_default], [m4_if(m4_eval(ytsg_minor_version % 2), [1], [yes], [minimum])]) +AC_ARG_ENABLE([debug], + [AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@], + [Control Ytstenut debugging level @<:@default=debug_default@:>@])], + [], + [enable_debug=debug_default]) + +AS_CASE([$enable_debug], + + [yes], + [ + test "$cflags_set" = set || CFLAGS="$CFLAGS -g -O0" + YTSG_DEBUG_CFLAGS="-DYTSG_ENABLE_DEBUG" + ], + + [minimum], + [YTSG_DEBUG_CFLAGS="-DYTSG_ENABLE_DEBUG -DG_DISABLE_CAST_CHECKS"], + + [no], + [YTSG_DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"], + + [AC_MSG_ERROR([Unknown argument for --enable-debug])] +) + +AC_SUBST(YTSG_DEBUG_CFLAGS) + +have_introspection=no +AC_ARG_WITH(introspection, + AC_HELP_STRING([--with-introspection], + [enable the use of GObject introspection]), + [with_introspection=$withval], + [with_introspection=auto]) + +if test x$with_introspection != xno; then + PKG_CHECK_MODULES(INTROSPECTION, gobject-introspection-1.0, have_introspection=yes, have_introspection=no) + if test x$have_introspection = xyes; then + YTSG_PC_MODULES="$YTSG_PC_MODULES gobject-introspection-1.0" + AC_DEFINE(HAVE_INTROSPECTION, 1, [Define if GObject introspection is available]) + G_IR_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0` + AC_SUBST(G_IR_SCANNER) + G_IR_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0` + AC_SUBST(G_IR_COMPILER) + G_IR_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0` + AC_SUBST(G_IR_GENERATE) + GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0` + AC_SUBST(GIRDIR) + TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)" + AC_SUBST(TYPELIBDIR) + else + if test x$with_introspection = xyes; then + AC_ERROR($INTROSPECTION_PKG_ERRORS) + fi + fi +fi +AM_CONDITIONAL(WITH_INTROSPECTION, test "$have_introspection" = "yes") + +PKG_CHECK_MODULES(YTSG, $YTSG_PC_MODULES) + +AC_ARG_ENABLE([profile], + [AC_HELP_STRING([--enable-profile], + [Enable profiling])], + [], + [enable_profile=no]) + +CFLAGS="$CFLAGS -Wall" + +AS_IF([test "x$enable_profile" = "xyes"], [CFLAGS="$CFLAGS -pg"]) + +# glib-genmarshal +GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` +AC_SUBST(GLIB_GENMARSHAL) +GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` +AC_SUBST(GLIB_MKENUMS) + +YTSG_LT_CURRENT=ytsg_lt_current +YTSG_LT_REV=ytsg_lt_revision +YTSG_AGE=ytsg_lt_age +YTSG_LT_VERSION="$YTSG_LT_CURRENT:$YTSG_LT_REV:$YTSG_LT_AGE" + +YTSG_LT_LDFLAGS="-version-info $YTSG_LT_VERSION" + +AC_SUBST(YTSG_LT_VERSION) +AC_SUBST(YTSG_LT_LDFLAGS) + +AC_OUTPUT([ +Makefile +docs/Makefile +docs/reference/Makefile +docs/reference/ytstenut-glib/Makefile +docs/reference/ytstenut-glib/ytstenut-glib-docs.xml +ytstenut-glib/Makefile +ytstenut-glib/ytsg-version.h +ytstenut-glib/ytstenut-glib.pc +]) + +echo " + ytstenut-glib + =================================================== + + Configuration: + Prefix : ${prefix} + Debug : ${enable_debug} + Profile : ${enable_profile} + API Reference : ${enable_gtk_doc} + Introspection : ${have_introspection} + + CFLAGS: ${CFLAGS} + + Type make to build. +" diff --git a/docs/Makefile.am b/docs/Makefile.am new file mode 100644 index 0000000..d66fc29 --- /dev/null +++ b/docs/Makefile.am @@ -0,0 +1 @@ +SUBDIRS=reference
\ No newline at end of file diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am new file mode 100644 index 0000000..4811c54 --- /dev/null +++ b/docs/reference/Makefile.am @@ -0,0 +1,6 @@ + +SUBDIRS = + +if BUILD_GTK_DOC + SUBDIRS += ytstenut-glib +endif diff --git a/docs/reference/ytstenut-glib/Makefile.am b/docs/reference/ytstenut-glib/Makefile.am new file mode 100644 index 0000000..c396cea --- /dev/null +++ b/docs/reference/ytstenut-glib/Makefile.am @@ -0,0 +1,101 @@ +## Process this file with automake to produce Makefile.in + +# We require automake 1.6 at least. +AUTOMAKE_OPTIONS = 1.6 + +# The name of the module, e.g. 'glib'. +DOC_MODULE=ytstenut-glib + +# Uncomment for versioned docs and specify the version of the module, e.g. '2'. +#DOC_MODULE_VERSION=$(YTSTENUT_VERSION) + + +# The top-level SGML file. You can change this if you want to. +DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml + +# Directories containing the source code, relative to $(srcdir). +DOC_SOURCE_DIR=../../../ytstenut-glib + +# Extra options to pass to gtkdoc-scangobj. Not normally needed. +SCANGOBJ_OPTIONS=--type-init-func="ytsg_init (NULL, NULL)" + +# Extra options to supply to gtkdoc-scan. +# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" +SCAN_OPTIONS= + +# Extra options to supply to gtkdoc-mkdb. +# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml +MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space=mpl + +# 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= \ + --extra-dir=$(GLIB_PREFIX)/share/gtk-doc/html/glib \ + --extra-dir=$(GLIB_PREFIX)/share/gtk-doc/html/gobject + + +# Used for dependencies. The docs will be rebuilt if any of these change. +# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h +# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c +HFILE_GLOB= + +CFILE_GLOB= + +# Extra header to include when scanning, which are not under DOC_SOURCE_DIR +# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h +EXTRA_HFILES= + +# Header files to ignore when scanning. Use base file name, no paths +# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h +IGNORE_HFILES= \ + ns-marshal.h \ + ns-enum-types.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= + +# 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) +INCLUDES=-I$(top_srcdir)/ytstenut-glib $(YTSTENUT_CFLAGS) +GTKDOC_LIBS=$(top_builddir)/ytstenut-glib/libytstenut-glib-@YTSTENUT_API_VERSION@.la $(YTSTENUT_LIBS) + +# This includes the standard gtk-doc make rules, copied by gtkdocize. +include $(top_srcdir)/gtk-doc.make + +# Other files to distribute +# e.g. EXTRA_DIST += version.xml.in +EXTRA_DIST += + +# 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' +if BUILD_GTK_DOC +#TESTS_ENVIRONMENT = cd $(srcsrc) && +#TESTS = $(GTKDOC_CHECK) +endif + +-include $(top_srcdir)/git.mk diff --git a/docs/reference/ytstenut-glib/ytstenut-glib-docs.xml.in b/docs/reference/ytstenut-glib/ytstenut-glib-docs.xml.in new file mode 100644 index 0000000..80e8445 --- /dev/null +++ b/docs/reference/ytstenut-glib/ytstenut-glib-docs.xml.in @@ -0,0 +1,72 @@ +<?xml version="1.0"?> +<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" + "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ +<!ENTITY version "@PLUGIN_VERSION@"> +]> + +<book id="ytsg" xmlns:xi="http://www.w3.org/2003/XInclude"> + <bookinfo> + <title>Ytstenut-glib</title> + <releaseinfo>For ytstenut-glib &version;</releaseinfo> + + <copyright> + <year>2011</year> + <holder>Intel Corporation</holder> + </copyright> + + <legalnotice> + <para> + Permission is granted to copy, distribute and/or modify this + document under the terms of the <citetitle>GNU Free + Documentation License</citetitle>, Version 1.1 or any later + version published by the Free Software Foundation with no + Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. You may obtain a copy of the <citetitle>GNU Free + Documentation License</citetitle> from the Free Software + Foundation by visiting <ulink type="http" + url="http://www.fsf.org">their Web site</ulink> or by writing + to: + + <address> + The Free Software Foundation, Inc., + <street>59 Temple Place</street> - Suite 330, + <city>Boston</city>, <state>MA</state> <postcode>02111-1307</postcode>, + <country>USA</country> + </address> + </para> + </legalnotice> + </bookinfo> + + <!-- <xi:include href="xml/overview.xml"/> --> + + <part id="ytsg-reference"> + + <title>Reference</title> + + <chapter id="ytsg-classes"> + <title>Ytstenut-glib Objects</title> + +<!-- <xi:include href="xml/ns-client.xml"/> --> + + </chapter> + + </part> + + <part id="ytsg-index"> + <title>Index of all symbols</title> + + <xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include> + + </part> + + <part id="ytsg-appendices"> + <title>Appendices</title> + + <appendix id="ytsg-license"> + <title>License</title> + + </appendix> + + </part> + +</book> diff --git a/ytstenut-glib/Makefile.am b/ytstenut-glib/Makefile.am new file mode 100644 index 0000000..22e3c3d --- /dev/null +++ b/ytstenut-glib/Makefile.am @@ -0,0 +1,149 @@ +SUBDIRS= +BUILT_SOURCES= +CLEANFILES= +BUILT_GIRSOURCES= +INCLUDES_FOR_GIR=-I.. + +AM_CPPFLAGS = \ + -DG_DISABLE_DEPRECATED \ + -DG_DISABLE_SINGLE_INCLUDES \ + -DG_LOG_DOMAIN=\"YtstenutGlib\" \ + $(YTSG_DEBUG_CFLAGS) \ + $(NULL) + +AM_CFLAGS = $(YTSG_CFLAGS) + +source_h = \ + $(srcdir)/ytsg-debug.h \ + $(srcdir)/ytsg-main.h \ + $(srcdir)/ytsg-version.h \ + $(NULL) + +source_c = \ + $(srcdir)/ytsg-enum-types.c \ + $(srcdir)/ytsg-main.c \ + $(NULL) + + +private_h = + $(NULL) + +libytstenut_glib_@YTSG_API_VERSION@_la_SOURCES = $(source_h) \ + $(private_h) \ + $(source_c) + +STAMPS = stamp-marshal.h stamp-ytsg-enum-types.h + +ENUMS = ytsg-enum-types.h \ + ytsg-enum-types.c + +ytsg-enum-types.h: stamp-ytsg-enum-types.h + @true +stamp-ytsg-enum-types.h: $(source_h) Makefile + $(QUIET_GEN)( $(GLIB_MKENUMS) \ + --template $(srcdir)/ytsg-enum-types.h.in \ + $(source_h) ) >> xgen-ceth && \ + (cmp -s xgen-ceth ytsg-enum-types.h || cp xgen-ceth ytsg-enum-types.h) && \ + rm -f xgen-ceth && \ + echo timestamp > $(@F) + +ytsg-enum-types.c: ytsg-enum-types.h + $(QUIET_GEN)( $(GLIB_MKENUMS) \ + --template $(srcdir)/ytsg-enum-types.c.in \ + $(source_h) ) >> xgen-cetc && \ + cp xgen-cetc ytsg-enum-types.c && \ + rm -f xgen-cetc + +MARSHALS = ytsg-marshal.c ytsg-marshal.h + +ytsg-marshal.h: stamp-marshal.h + @true +stamp-marshal.h: marshal.list + $(QUIET_GEN)$(GLIB_GENMARSHAL) \ + --prefix=ytsg_marshal \ + --header \ + $(srcdir)/marshal.list > xgen-cmh \ + && (cmp -s xgen-cmh ytsg-marshal.h || cp xgen-cmh ytsg-marshal.h ) \ + && rm -f xgen-cmh \ + && echo timestamp > $(@F) + +ytsg-marshal.c: ytsg-marshal.h Makefile + $(QUIET_GEN)( echo "#include \"ytsg-marshal.h\"" ; \ + $(GLIB_GENMARSHAL) \ + --prefix=ytsg_marshal \ + --body \ + $(srcdir)/marshal.list --body ) >> xgen-cmc \ + && cp xgen-cmc ytsg-marshal.c \ + && rm -f xgen-cmc + +libytstenut_glib_@YTSG_API_VERSION@_la_LDFLAGS = $(YTSG_LT_LDFLAGS) \ + -no-undefined +libytstenut_glib_@YTSG_API_VERSION@_la_LIBADD = $(YTSG_LIBS) + +lib_LTLIBRARIES = libytstenut-glib-@YTSG_API_VERSION@.la + +ytstenutheadersdir = $(includedir)/ytstenut-$(YTSG_API_VERSION)/ytstenut +ytstenutheaders_HEADERS = \ + $(source_h) \ + $(srcdir)/ytsg-enum-types.h \ + $(srcdir)/ytsg-marshal.h \ + $(srcdir)/ytstenut-glib.h \ + $(NULL) + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = ytstenut-glib.pc + +if WITH_INTROSPECTION +Ytsg-@YTSG_API_VERSION@.gir: $(G_IR_SCANNER) libytstenut-glib-@YTSG_API_VERSION@.la + $(QUIET_GEN) $(G_IR_SCANNER) -v \ + --namespace=Ytsg --nsversion=@YTSG_API_VERSION@ \ + --strip-prefix=Ytsg \ + $(INCLUDES_FOR_GIR) \ + $(YTSG_CFLAGS) \ + $(AM_CPPFLAGS) \ + --add-init-section="ytsg_init(0,NULL);"\ + --c-include='ytstenut-glib/ytstenut-glib.h' \ + --include=GObject-2.0 \ + --include=TelepathyGLib-0.12 \ + --library=libytstenut-glib-@YTSG_API_VERSION@.la \ + --libtool="$(top_builddir)/libtool" \ + --pkg gobject-2.0 \ + --output $@ \ + $(ytstenutheaders_HEADERS) \ + $(source_c) + +BUILT_GIRSOURCES += Ytsg-@YTSG_API_VERSION@.gir + +# G_IR_GIRDIR/G_IR_TYPELIBDIR aren't the right place to +# install anything - we need to install inside our prefix. +girdir = $(datadir)/gir-1.0 +gir_DATA = $(BUILT_GIRSOURCES) + +typelibsdir = $(libdir)/girepository-1.0/ + +typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib) + +%.typelib: %.gir $(G_IR_COMPILER) + $(QUIET_GEN) \ + LD_LIBRARY_PATH=.libs$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH} \ + $(G_IR_COMPILER) \ + --includedir=$(srcdir) \ + --includedir=. \ + $(G_IR_COMPILER_OPTS) $< -o $(@F) + +CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA) +endif # HAVE_INTROSPECTION + +BUILT_SOURCES += $(MARSHALS) $(ENUMS) + +CLEANFILES += $(BUILT_SOURCES) $(STAMPS) ytstenut-glib.pc + +EXTRA_DIST = marshal.list \ + ytsg-enum-types.h.in \ + ytsg-enum-types.c.in \ + ytsg-version.h.in \ + ytstenut-glib.pc.in \ + $(NULL) + +DISTCLEANFILES= ytsg-version.h \ + $(NULL) diff --git a/ytstenut-glib/marshal.list b/ytstenut-glib/marshal.list new file mode 100644 index 0000000..fdc3715 --- /dev/null +++ b/ytstenut-glib/marshal.list @@ -0,0 +1,8 @@ +VOID:VOID +VOID:BOXED +VOID:ENUM +VOID:OBJECT +VOID:UINT +VOID:STRING +BOOLEAN:STRING,STRING,UINT64,UINT64,OBJECT +VOID:STRING,STRING,BOOLEAN diff --git a/ytstenut-glib/ytsg-debug.h b/ytstenut-glib/ytsg-debug.h new file mode 100644 index 0000000..59b957c --- /dev/null +++ b/ytstenut-glib/ytsg-debug.h @@ -0,0 +1,80 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +/* + * Copyright (c) 2011 Intel Corp. + * + * Author: Tomas Frydrych <tf@linux.intel.com> + * + * Based on clutter-debug.h + */ + +#ifndef _YTSG_DEBUG_H +#define _YTSG_DEBUG_H + +#include <glib.h> + +G_BEGIN_DECLS + +typedef enum { + YTSG_DEBUG_CLIENT = 0x01, + YTSG_DEBUG_ROSTER = 0x02, + YTSG_DEBUG_STATUS = 0x04, + YTSG_DEBUG_TP = 0x08, + YTSG_DEBUG_MANAGER = 0x10, + YTSG_DEBUG_MESSAGE = 0x20, + YTSG_DEBUG_FILE_TRANSFER = 0x80 +} YtsgDebugFlags; + +#ifdef YTSG_ENABLE_DEBUG + +#ifdef __GNUC__ +#define YTSG_NOTE(type,x,a...) G_STMT_START { \ + if (ytsg_debug_flags & YTSG_DEBUG_##type) \ + { g_message (#type "(" G_STRLOC "): " x, ##a); } \ + } G_STMT_END + +#define YTSG_TIMESTAMP(type,x,a...) G_STMT_START { \ + if (ytsg_debug_flags & YTSG_DEBUG_##type) \ + { g_message ( #type " %li(" G_STRLOC "): " \ + x, ytsg_get_timestamp(), ##a); } \ + } G_STMT_END +#else +/* Try the C99 version; unfortunately, this does not allow us to pass + * empty arguments to the macro, which means we have to + * do an intemediate printf. + */ +#define YTSG_NOTE(type,...) G_STMT_START { \ + if (ytsg_debug_flags & YTSG_DEBUG_##type) \ + { \ + gchar * _fmt = g_strdup_printf (__VA_ARGS__); \ + g_message ( #type "(" G_STRLOC "): %s",_fmt); \ + g_free (_fmt); \ + } \ + } G_STMT_END + +#define YTSG_TIMESTAMP(type,...) G_STMT_START { \ + if (ytsg_debug_flags & YTSG_DEBUG_##type) \ + { \ + gchar * _fmt = g_strdup_printf (__VA_ARGS__); \ + g_message ( #type " %li(" G_STRLOC "): %s", \ + ytsg_get_timestamp(), _fmt); \ + g_free (_fmt); \ + } \ + } G_STMT_END +#endif + +#define YTSG_MARK() YTSG_NOTE(MISC, "== mark ==") + +#else /* !YTSG_ENABLE_DEBUG */ + +#define YTSG_NOTE(type,...) G_STMT_START { } G_STMT_END +#define YTSG_MARK() G_STMT_START { } G_STMT_END +#define YTSG_TIMESTAMP(type,...) G_STMT_START { } G_STMT_END + +#endif /* YTSG_ENABLE_DEBUG */ + +extern guint ytsg_debug_flags; + +G_END_DECLS + +#endif /* _YTSG_DEBUG_H */ diff --git a/ytstenut-glib/ytsg-enum-types.c.in b/ytstenut-glib/ytsg-enum-types.c.in new file mode 100644 index 0000000..ac7f87e --- /dev/null +++ b/ytstenut-glib/ytsg-enum-types.c.in @@ -0,0 +1,40 @@ +/*** BEGIN file-header ***/ +#include "ytsg-enum-types.h" +/*** END file-header ***/ + +/*** BEGIN file-production ***/ + +/* enumerations from "@filename@" */ +#include "@filename@" + +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType +@enum_name@_get_type (void) +{ + static volatile gsize g_enum_type_id__volatile = 0; + + if (g_once_init_enter (&g_enum_type_id__volatile)) + { + static const G@Type@Value values[] = { +/*** END value-header ***/ + +/*** BEGIN value-production ***/ + { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, +/*** END value-production ***/ + +/*** BEGIN value-tail ***/ + { 0, NULL, NULL } + }; + GType g_enum_type_id; + + g_enum_type_id = + g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); + + g_once_init_leave (&g_enum_type_id__volatile, g_enum_type_id); + } + + return g_enum_type_id__volatile; +} +/*** END value-tail ***/ diff --git a/ytstenut-glib/ytsg-enum-types.h.in b/ytstenut-glib/ytsg-enum-types.h.in new file mode 100644 index 0000000..ce461ee --- /dev/null +++ b/ytstenut-glib/ytsg-enum-types.h.in @@ -0,0 +1,26 @@ +/*** BEGIN file-header ***/ +#ifndef __YTSG_ENUM_TYPES_H__ +#define __YTSG_ENUM_TYPES_H__ + +#include <glib-object.h> + +G_BEGIN_DECLS + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* enumerations from "@filename@" */ +/*** END file-production ***/ + +/*** BEGIN file-tail ***/ +G_END_DECLS + +#endif /* !__YTSG_ENUM_TYPES_H__ */ +/*** END file-tail ***/ + +/*** BEGIN value-header ***/ +GType @enum_name@_get_type (void) G_GNUC_CONST; +#define YTSG_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) + +/*** END value-header ***/ + diff --git a/ytstenut-glib/ytsg-main.c b/ytstenut-glib/ytsg-main.c new file mode 100644 index 0000000..597ec4a --- /dev/null +++ b/ytstenut-glib/ytsg-main.c @@ -0,0 +1,353 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +/* + * Copyright (c) 2011 Intel Corp. + * + * Author: Tomas Frydrych <tf@linux.intel.com> + */ + +#define _GNU_SOURCE /* for getresuid(), getresgid() */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <unistd.h> + +#if 0 +#include <glib/gi18n-lib.h> +#else +#define N_(x) x +#define _(x) x +#endif + +#include <locale.h> +#include <glib.h> +#include <glib-object.h> +#include <unistd.h> +#include <string.h> + +#include "ytsg-debug.h" +#include "ytsg-main.h" + +static void ytsg_base_init (void); +static int ytsg_init_real (GError **error); + +gboolean ytsg_is_initialized = FALSE; +static gboolean ytsg_fatal_warnings = FALSE; +static gboolean ytsg_args_parsed = FALSE; + +/* + * Debugging machinery; based on Clutter. + */ +guint ytsg_debug_flags = 0; + +#ifdef YTSG_ENABLE_DEBUG +static const GDebugKey ytsg_debug_keys[] = { + { "client", YTSG_DEBUG_CLIENT }, + { "roster", YTSG_DEBUG_ROSTER }, + { "status", YTSG_DEBUG_STATUS }, + { "tp", YTSG_DEBUG_TP }, + { "manager", YTSG_DEBUG_MANAGER }, + { "message", YTSG_DEBUG_MESSAGE }, + { "file-transfer", YTSG_DEBUG_FILE_TRANSFER }, +}; +#endif /* YTSG_ENABLE_DEBUG */ + +#ifdef YTSG_ENABLE_DEBUG +static gboolean +ytsg_arg_debug_cb (const char *key, const char *value, gpointer user_data) +{ + ytsg_debug_flags |= + g_parse_debug_string (value, + ytsg_debug_keys, + G_N_ELEMENTS (ytsg_debug_keys)); + return TRUE; +} + +static gboolean +ytsg_arg_no_debug_cb (const char *key, const char *value, gpointer user_data) +{ + ytsg_debug_flags &= + ~g_parse_debug_string (value, + ytsg_debug_keys, + G_N_ELEMENTS (ytsg_debug_keys)); + return TRUE; +} +#endif + +static GOptionEntry ytsg_args[] = { + { "g-fatal-warnings", 0, 0, G_OPTION_ARG_NONE, &ytsg_fatal_warnings, + N_("Make all warnings fatal"), NULL }, +#ifdef YTSG_ENABLE_DEBUG + { "ytsg-debug", 0, 0, G_OPTION_ARG_CALLBACK, ytsg_arg_debug_cb, + N_("Ytstenut-glib debugging flags to set"), "FLAGS" }, + { "ytsg-no-debug", 0, 0, G_OPTION_ARG_CALLBACK, ytsg_arg_no_debug_cb, + N_("Ytstenut-glib debugging flags to unset"), "FLAGS" }, +#endif /* YTSG_ENABLE_DEBUG */ + { NULL, }, +}; + +/* pre_parse_hook: initialise variables depending on environment + * variables; these variables might be overridden by the command + * line arguments that are going to be parsed after. + */ +static gboolean +pre_parse_hook (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + const char *env_string; + + if (ytsg_is_initialized) + return TRUE; + + if (setlocale (LC_ALL, "") == NULL) + g_warning ("Locale not supported by C library.\n" + "Using the fallback 'C' locale."); + +#ifdef YTSG_ENABLE_DEBUG + env_string = g_getenv ("YTSG_DEBUG"); + if (env_string != NULL) + { + ytsg_debug_flags = + g_parse_debug_string (env_string, + ytsg_debug_keys, + G_N_ELEMENTS (ytsg_debug_keys)); + env_string = NULL; + } +#endif /* YTSG_ENABLE_DEBUG */ + + return TRUE; +} + +/* + * post_parse_hook -- initialize things that depend on command line arguments + */ +static gboolean +post_parse_hook (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + if (ytsg_is_initialized) + return TRUE; + + ytsg_args_parsed = TRUE; + + if (ytsg_fatal_warnings) + { + GLogLevelFlags fatal_mask; + + fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK); + fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL; + g_log_set_always_fatal (fatal_mask); + } + + return ytsg_init_real (error); +} + +/** + * ytsg_get_option_group: + * + * Returns a #GOptionGroup for the command line arguments recognized + * by Ytstenut-Glib. You should add this group to your #GOptionContext with + * g_option_context_add_group(), if you are using g_option_context_parse() + * to parse your commandline arguments. + * + * Calling g_option_context_parse() with Ytstenut-Glib's #GOptionGroup will + * result in Ytstenut-Glib's initialization. That is, the following code: + * + * |[ + * g_option_context_set_main_group (context, ytsg_get_option_group ()); + * res = g_option_context_parse (context, &argc, &argc, NULL); + * ]| + * + * is functionally equivalent to: + * + * |[ + * ytsg_init (&argc, &argv); + * ]| + * + * After g_option_context_parse() on a #GOptionContext containing the + * Ytstenut-Glib #GOptionGroup has returned %TRUE, Ytstenut-Glib is guaranteed + * to be initialized. + * + * Return value: (transfer full): a #GOptionGroup for the commandline arguments + * recognized by Ytstenut-Glib + * + * Since: 0.1 + */ +GOptionGroup * +ytsg_get_option_group (void) +{ + GOptionGroup *group; + + ytsg_base_init (); + + group = g_option_group_new ("Ytstenut-glib", + _("Ytstenut-glib Options"), + _("Show Ytstenut-glib Options"), + NULL, + NULL); + + g_option_group_set_parse_hooks (group, pre_parse_hook, post_parse_hook); + g_option_group_add_entries (group, ytsg_args); +#if 0 + g_option_group_set_translation_domain (group, GETTEXT_PACKAGE); +#endif + return group; +} + +/* + * The standard GLib log handler is far too verbose. + * + * Keep it simple, send everything we log to stderr. + */ +static void +ytsg_loger (const gchar *domain, + GLogLevelFlags level, + const gchar *message, + gpointer data) +{ + char *s = NULL; + + if (level & G_LOG_LEVEL_ERROR) + s = g_strdup_printf ("Ytsg-Error: %s\n", message); + else if (level & G_LOG_LEVEL_CRITICAL) + s = g_strdup_printf ("Ytsg-Critical: %s\n", message); + else if (level & G_LOG_LEVEL_WARNING) + s = g_strdup_printf ("Ytsg-Warning: %s\n", message); + else if (level & G_LOG_LEVEL_DEBUG) + s = g_strdup_printf ("Ytsg-Debug: %s\n", message); + else + s = g_strdup_printf ("Ytsg: %s\n", message); + + write (STDERR_FILENO, s, strlen (s)); + + g_free (s); +} + +static void +ytsg_base_init (void) +{ + static gboolean initialised = FALSE; + + if (!initialised) + { + uid_t ruid; + uid_t euid; + uid_t suid; + gid_t rgid; + gid_t egid; + gid_t sgid; + gboolean privs_ok = TRUE; + + if (getresuid (&ruid, &euid, &suid) != 0) + { + if (getuid () != geteuid ()) + privs_ok = FALSE; + } + else if (ruid == 0 || ruid != euid || ruid != suid) + privs_ok = FALSE; + + if (getresgid (&rgid, &egid, &sgid) != 0) + { + if (getgid () != getegid ()) + privs_ok = FALSE; + } + else if (rgid == 0 || rgid != egid || rgid != sgid) + privs_ok = FALSE; + + if (!privs_ok) + { + g_error ("Yetstenut applications can only run as regular user; they " + "they cannot be run with escalated privilidges or as root"); + } + + initialised = TRUE; + +#if 0 + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); +#endif + /* initialise GLib type system */ + g_type_init (); + + g_log_set_handler ("YtstenutGlib", + G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL, + ytsg_loger, NULL); + } +} + +static int +ytsg_init_real (GError **error) +{ + ytsg_is_initialized = TRUE; + + return 1; +} + +static gboolean +ytsg_parse_args (int *argc, char ***argv) +{ + GOptionContext *option_context; + GOptionGroup *ytsg_group; + GError *error = NULL; + gboolean ret = TRUE; + + if (ytsg_is_initialized) + return TRUE; + + option_context = g_option_context_new (NULL); + g_option_context_set_ignore_unknown_options (option_context, TRUE); + g_option_context_set_help_enabled (option_context, FALSE); + + ytsg_group = ytsg_get_option_group (); + g_option_context_set_main_group (option_context, ytsg_group); + + if (!g_option_context_parse (option_context, argc, argv, &error)) + { + if (error) + { + g_warning ("%s", error->message); + g_error_free (error); + } + + ret = FALSE; + } + + g_option_context_free (option_context); + + return ret; +} + +/** + * ytsg_init: + * @argc: (inout): The number of arguments in @argv + * @argv: (array length=argc) (inout) (allow-none): A pointer to an array + * of arguments. + * + * Initialises Ytstenut-glib library. + * + * Return value: 1 on success, < 0 on failure. + */ +int +ytsg_init (int *argc, char ***argv) +{ + GError *error = NULL; + + if (ytsg_is_initialized) + return 1; + + ytsg_base_init (); + + if (!ytsg_parse_args (argc, argv)) + { + g_warning ("Failed to parse arguments."); + return 0; + } + + return ytsg_init_real (&error); +} diff --git a/ytstenut-glib/ytsg-main.h b/ytstenut-glib/ytsg-main.h new file mode 100644 index 0000000..e5abedd --- /dev/null +++ b/ytstenut-glib/ytsg-main.h @@ -0,0 +1,21 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +/* + * Copyright (c) 2011 Intel Corp. + * + * Author: Tomas Frydrych <tf@linux.intel.com> + */ + +#ifndef _YTSG_UTIL_H +#define _YTSG_UTIL_H + +#include <glib.h> + +G_BEGIN_DECLS + +int ytsg_init (int *argc, char ***argv); +GOptionGroup *ytsg_get_option_group (void); + +G_END_DECLS + +#endif /* _YTSG_UTIL_H */ diff --git a/ytstenut-glib/ytsg-version.h.in b/ytstenut-glib/ytsg-version.h.in new file mode 100644 index 0000000..d1496c6 --- /dev/null +++ b/ytstenut-glib/ytsg-version.h.in @@ -0,0 +1,78 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +/* + * Copyright (c) 2011 Intel Corp. + * + * Author: Tomas Frydrych <tf@linux.intel.com> + */ + + +#ifndef _YTSG_VERSION_H +#define _YTSG_VERSION_H + +#include <glib.h> + +G_BEGIN_DECLS + +/** + * YTSG_MAJOR_VERSION: + * + * The major version of the Nscreen library (1, if %YTSG_VERSION is 1.2.3) + */ +#define YTSG_MAJOR_VERSION (@YTSG_MAJOR_VERSION@) + +/** + * YTSG_MINOR_VERSION: + * + * The minor version of the Nscreen library (2, if %YTSG_VERSION is 1.2.3) + */ +#define YTSG_MINOR_VERSION (@YTSG_MINOR_VERSION@) + +/** + * YTSG_MICRO_VERSION: + * + * The micro version of the Nscreen library (3, if %YTSG_VERSION is 1.2.3) + */ +#define YTSG_MICRO_VERSION (@YTSG_MICRO_VERSION@) + +/** + * YTSG_VERSION: + * + * The full version of the Nscreen library, like 1.2.3 + */ +#define YTSG_VERSION @YTSG_VERSION@ + +/** + * YTSG_VERSION_S: + * + * The full version of the Nscreen library, in string form (suited for + * string concatenation) + */ +#define YTSG_VERSION_S "@YTSG_VERSION@" + +/** + * YTSG_VERSION_HEX: + * + * Numerically encoded version of the Nscreen library, like 0x010203 + */ +#define YTSG_VERSION_HEX ((YTSG_MAJOR_VERSION << 24) | \ + (YTSG_MINOR_VERSION << 16) | \ + (YTSG_MICRO_VERSION << 8)) + +/** + * YTSG_CHECK_VERSION: + * @major: major version, like 1 in 1.2.3 + * @minor: minor version, like 2 in 1.2.3 + * @micro: micro version, like 3 in 1.2.3 + * + * Evaluates to %TRUE if the version of the Nscreen library is greater + * than @major, @minor and @micro + */ +#define YTSG_CHECK_VERSION(major,minor,micro) \ + (YTSG_MAJOR_VERSION > (major) || \ + (YTSG_MAJOR_VERSION == (major) && YTSG_MINOR_VERSION > (minor)) || \ + (YTSG_MAJOR_VERSION == (major) && YTSG_MINOR_VERSION == (minor) && YTSG_MICRO_VERSION >= (micro))) + +G_END_DECLS + +#endif /* _YTSG_VERSION_H */ diff --git a/ytstenut-glib/ytstenut-glib.h b/ytstenut-glib/ytstenut-glib.h new file mode 100644 index 0000000..2def617 --- /dev/null +++ b/ytstenut-glib/ytstenut-glib.h @@ -0,0 +1,19 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +/* + * Copyright (c) 2011 Intel Corp. + * + * Author: Tomas Frydrych <tf@linux.intel.com> + */ + +#ifndef _YTSG_H +#define _YTSG_H + +#include <ytstenut-glib/ytsg-debug.h> +#include <ytstenut-glib/ytsg-main.h> +#include <ytstenut-glib/ytsg-version.h> + +#include <ytstenut-glib/ytsg-marshal.h> +#include <ytstenut-glib/ytsg-enum-types.h> + +#endif /* _YTSG_H */ diff --git a/ytstenut-glib/ytstenut-glib.pc.in b/ytstenut-glib/ytstenut-glib.pc.in new file mode 100644 index 0000000..f2cb4fb --- /dev/null +++ b/ytstenut-glib/ytstenut-glib.pc.in @@ -0,0 +1,14 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +datarootdir=@datarootdir@ +datadir=@datadir@ +apiversion=@YTSTENUT_API_VERSION@ + +Name: libytstenut-glib +Description: GObject based convenience library for Ytstenut +Requires: telepathy-glib @TELEPATHY_VERSION@ +Version: @YTSTENUT_VERSION@ +Libs: -L${libdir} -lyststenut-glib-${apiversion} +Cflags: -I${includedir}/ytstenut-glib-${apiversion} |