pax_global_header00006660000000000000000000000064141705503310014511gustar00rootroot0000000000000052 comment=0e8f6ef68b53b29a158b7264034d2d1783eee64e lunar-calendar-3.0.1/000077500000000000000000000000001417055033100144025ustar00rootroot00000000000000lunar-calendar-3.0.1/.travis.yml000066400000000000000000000051561417055033100165220ustar00rootroot00000000000000# vim: set ts=2 sts=2 sw=2 expandtab : dist: xenial sudo: required language: bash services: - docker before_install: - sudo apt-get install -y python3-pip python3-setuptools - sudo pip3 install --upgrade pip - sudo pip install PyGithub - curl -Ls -o docker-build https://github.com/mate-desktop/mate-dev-scripts/raw/master/travis/docker-build - chmod +x docker-build install: - ./docker-build --name ${DISTRO} --config .travis.yml --install script: - ./docker-build --name ${DISTRO} --verbose --config .travis.yml --build meson deploy: provider: script script: ./docker-build --name ${DISTRO} --verbose --config .travis.yml --release skip_cleanup: true on: tags: true condition: "$TRAVIS_TAG =~ ^v.*$ && $DISTRO == fedora:rawhide" env: - DISTRO="archlinux/base" #- DISTRO="debian:sid" - DISTRO="fedora:rawhide" #- DISTRO="ubuntu:19.04" ########################################################## # THE FOLLOWING LINES IS USED BY docker-build ########################################################## requires: archlinux: - gettext - git - gobject-introspection - gtk3 - meson - vala debian: - git - gobject-introspection - gtk-doc-tools - intltool - libgirepository1.0-dev - libglib2.0-dev - libglib2.0-dev - libgtk-3-dev - libx11-dev - meson - valac fedora: - gcc - gettext - git - gobject-introspection-devel - gtk-doc - gtk3-devel - meson - ninja-build - redhat-rpm-config - vala - vala-devel ubuntu: - git - gobject-introspection - gtk-doc-tools - intltool - libgirepository1.0-dev - libglib2.0-dev - libgtk-3-dev - libglib2.0-dev - libx11-dev - meson - valac variables: - CFLAGS="-Wall -Werror=format-security" # Remove the comment if you need special parameters configures: meson: - --prefix /usr - -Denable_gtk_doc=true - -Dwith_introspection=true - -Dwith_vala=true - -Denable_tests=true # Remove the comment if you need some thing do before build. before_scripts: - cd ${START_DIR} - git clone --depth 1 https://github.com/yetist/lunar-date.git lunar-date-build - cd lunar-date-build - if [ -d _build ]; then - rm -rf _build - fi - meson _build --prefix /usr -Denable_gtk_doc=true -Dwith_introspection=true -Dwith_vala=true -Denable_tests=true - ninja -C _build - ninja -C _build install after_scripts: - cd ${BUILD_DIR} - ninja dist releases: draft: False prerelease: False checksum: False base_version: 3.0.0 file_glob: True files: _build/meson-dist/lunar-calendar-*.tar.xz* lunar-calendar-3.0.1/COPYING000066400000000000000000000636421417055033100154500ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, 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. Copyright (C) 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 Street, 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. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! lunar-calendar-3.0.1/NEWS000066400000000000000000000011431417055033100151000ustar00rootroot00000000000000### lunar-calendar 3.0.1 * 修复一些小bug,支持尽可能多的应用自动显示农历。 ### lunar-calendar 2.2.5 * 修复一些小bug. ### lunar-calendar 2.2.4 * 修复2.2.3中引入的一个小bug. ### lunar-calendar 2.2.3 * 清理共享库的导出符号。 ### lunar-calendar 2.2.2 * 增加lunar-calendar preload.so, 以便在运行时切换农历日历显示。 ### lunar-calendar 2.2.1 * 增加工具提示 * 支持长格式的节日 * 增加环境变量 LIBLUNAR_GTK_IGNORE_NON_CHINESE 支持,以让非中文环境的用户忽略农历。 ### lunar-calendar 2.2.0 * first release. lunar-calendar-3.0.1/README.md000066400000000000000000000025401417055033100156620ustar00rootroot00000000000000# 农历日历 [![Build Status](https://travis-ci.org/yetist/lunar-calendar.svg?branch=master)](https://travis-ci.org/yetist/lunar-calendar) ![](docs/images/lunar-calendar.png) ## 编译安装 ``` meson build -Dprefix=/usr ninja -C build sudo ninja -C build install ``` 编译依赖于 [LunarDate](https://github.com/yetist/lunar-date), 更多编译选项见 [meson_options.txt](meson_options.txt)。 ## FAQ 1. **GTK 应用如何自动显示农历?** 运行应用时,设置环境变量 `GTK3_MODULES=lunar-calendar-module`,对于 GTK2 应用来说,应该设置环境变量 `GTK_MODULES=lunar-calendar-module`。 如果希望自动对所有 GTK3 应用生效,可以将环境变量设置在 Xorg 启动时执行的脚本中。 不同发行版 Xorg 启动时的脚本路径不同,在 Archlinux 上可如下设置: 新建文件 `/etc/X11/xinit/xinitrc.d/70-lunar-calendar.sh` ,并增加可执行权限, 内容为: ``` export GTK3_MODULES=lunar-calendar-module ``` 重新注销、登录系统,会发现所有使用日历的 GTK3 应用都会自动显示出农历来,如:mate-panel、gtk3-widget-factory等等。 2. **非中文环境不想显示拼音怎么办?** 在非中文环境下会显示为带声调的拼音,如果不想显示拼音,可以给应用程序设置环境 `LUNAR_CALENDAR_IGNORE_NON_CHINESE=1` 以关闭拼音显示。 lunar-calendar-3.0.1/docs/000077500000000000000000000000001417055033100153325ustar00rootroot00000000000000lunar-calendar-3.0.1/docs/images/000077500000000000000000000000001417055033100165775ustar00rootroot00000000000000lunar-calendar-3.0.1/docs/images/lunar-calendar.png000066400000000000000000000652171417055033100222100ustar00rootroot00000000000000PNG  IHDRY)M pHYs.#.#x?vtIME;rOtEXtCommentCreated with GIMPW IDATx]w@S?/;!$@Xa-T\hq^mm֪.[u_NK;jjպ% {MdaI|}~9{.roի˖-۲e CQo8(u!oNKK"xD`0TUUDǓ "T* (N8p8 Co^ϔ;)2 ~K|; C{r;K}iEcy{/w@8pZ18HM8sEQ:˗/ =D"{{{TWW;l6ۚRUU;DDDp8\Ip ̧7 g:V,BOH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MKd뉎 DZieB׏~Q?)nkv90'OFvliF*O+uT(Ց>|AvFON Dz ! M܂bA;hхmJ5"'L٧H4MzO^+DhX/^.E oͼ 5zڻ-*S}͎4 M{TڮigdTɿΙx͝J#*q}AF@u:[U\mB))U7PuPXŹVWZcwc~ 6vR6ǩi,e#t6p[w1,*=y@5 ]/N8y6) }\FuuV]Y%+9\3t2]QW+փRg2ɥ ,@}e o&h*I3ʯabSTKcU~+;\/ӢV*\YVbBݾ|Lelm*3@Ɛ09Pr+{Vϟĵ>B |K#[}$~!W&!(] -䄗X8oÜ8PS \dMeM0`8O 䓁 |6U9xEy]H jSE=^,EZ(2 uwVww[%"'$&_ȴ+=Z {@f/ixhcVWg)+1=[C͕.`lTVKiiRY ]> LunarCalendar Reference Manual for LunarCalendar &version; API Reference Object Hierarchy API Index Index of deprecated API lunar-calendar-3.0.1/docs/meson.build000066400000000000000000000022031417055033100174710ustar00rootroot00000000000000conf = configuration_data() conf.set('PACKAGE_VERSION', meson.project_version()) version_xml = configure_file(input: 'version.xml.in', output: 'version.xml', configuration: conf) private_headers = [ 'config.h', 'lunar-calendar-private.h', 'lunar-calendar-utils.h', ] glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix') glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html') docpath = join_paths(get_option('datadir'), 'gtk-doc', 'html') gnome.gtkdoc( 'lunar-calendar', main_xml : 'lunar-calendar-docs.xml', src_dir: [ join_paths(meson.source_root(), 'lunar-calendar'), join_paths(meson.build_root(), 'lunar-calendar'), ], dependencies: liblunar_calendar_deps, gobject_typesfile: 'lunar-calendar.types', scan_args: [ '--rebuild-types', '--ignore-headers=' + ' '.join(private_headers), ], fixxref_args: [ '--html-dir=@0@'.format(docpath), '--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')), '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')), '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')), ], html_assets : 'images/lunar-calendar.png', install : true ) lunar-calendar-3.0.1/docs/version.xml.in000066400000000000000000000000221417055033100201400ustar00rootroot00000000000000@PACKAGE_VERSION@ lunar-calendar-3.0.1/example/000077500000000000000000000000001417055033100160355ustar00rootroot00000000000000lunar-calendar-3.0.1/example/calendar.vala000066400000000000000000000007711417055033100204600ustar00rootroot00000000000000/* * compilation: * valac --pkg lunar-calendar-3.0 calendar.vala * * configure: * $ ./configure --enable-vala-bindings ... * */ using Gtk; using Lunar; public class MyApplication : Gtk.Application { protected override void activate () { var window = new Gtk.ApplicationWindow (this); window.set_title ("Lunar Calendar"); var calendar = new Lunar.Calendar (); window.add (calendar); window.show_all (); } } public int main (string[] args) { return new MyApplication ().run (args); } lunar-calendar-3.0.1/example/gjs.js000077500000000000000000000013601417055033100171610ustar00rootroot00000000000000#!/usr/bin/env gjs-console const Gtk = imports.gi.Gtk; const LunarCalendar = imports.gi.LunarCalendar; class Application { constructor() { this.application = new Gtk.Application(); this.application.connect('activate', this._onActivate.bind(this)); this.application.connect('startup', this._onStartup.bind(this)); } _buildUI() { this._window = new Gtk.ApplicationWindow({ application: this.application, title: "Lunar Calendar" }); this.cal = new LunarCalendar.Calendar(); this._window.add(this.cal); } _onActivate() { this._window.show_all(); } _onStartup() { this._buildUI(); } }; let app = new Application(); app.application.run(ARGV); lunar-calendar-3.0.1/example/python.py000077500000000000000000000014701417055033100177350ustar00rootroot00000000000000#!/usr/bin/env python # -*- encoding:utf-8 -*- # FileName: python.py import gi gi.require_version('Gtk', '3.0') gi.require_version('LunarCalendar', '3.0') from gi.repository import Gtk from gi.repository import LunarCalendar import sys class CalWindow(Gtk.ApplicationWindow): def __init__(self, app): Gtk.Window.__init__(self, title="Lunar Calendar", application=app) calendar = LunarCalendar.Calendar() self.add(calendar) class CalApplication(Gtk.Application): def __init__(self): Gtk.Application.__init__(self) def do_activate(self): win = CalWindow(self) win.show_all() def do_startup(self): Gtk.Application.do_startup(self) if __name__ == '__main__': app = CalApplication() exit_status = app.run(sys.argv) sys.exit(exit_status) lunar-calendar-3.0.1/lunar-calendar/000077500000000000000000000000001417055033100172725ustar00rootroot00000000000000lunar-calendar-3.0.1/lunar-calendar/lunar-calendar-version.c000066400000000000000000000071051417055033100240140ustar00rootroot00000000000000/* vi: set sw=4 ts=4: */ /* * lunar-version.c: This file is part of lunar-calendar. * * Copyright (C) 2009-2022 yetist * * 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, see . * */ #if HAVE_CONFIG_H #include #endif #include /** * SECTION:lunar-calendar-version * @Short_description: Variables and functions to check the LunarCalendar version * @Title: Version Information * @include: lunar-calendar/lunar-calendar-version.h * @stability: Stable * * LunarCalendar provides version information, primarily useful in * configure checks for builds that have a configure script. * Applications will not typically use the features described here. */ const guint lunar_calendar_major_version = LUNAR_CALENDAR_MAJOR_VERSION; const guint lunar_calendar_minor_version = LUNAR_CALENDAR_MINOR_VERSION; const guint lunar_calendar_micro_version = LUNAR_CALENDAR_MICRO_VERSION; /** * lunar_calendar_check_version: * @required_major: the required major version. * @required_minor: the required minor version. * @required_micro: the required micro version. * * Checks that the LunarCalendar library in use is compatible with the * given version. Generally you would pass in the constants * #LUNAR_CALENDAR_MAJOR_VERSION, #LUNAR_CALENDAR_MINOR_VERSION, #LUNAR_CALENDAR_MICRO_VERSION * as the three arguments to this function; that produces * a check that the library in use is compatible with * the version of LunarCalendar the application or module was compiled * against. * * Compatibility is defined by two things: first the version * of the running library is newer than the version * @required_major.required_minor.@required_micro. Second * the running library must be binary compatible with the * version @required_major.required_minor.@required_micro * (same major version.) * * Return value: %NULL if the LunarCalendar library is compatible with the * given version, or a string describing the version mismatch. * The returned string is owned by LunarCalendar and must not be modified * or freed. * * Since: 2.4.0 **/ const gchar * lunar_calendar_check_version (guint required_major, guint required_minor, guint required_micro) { gint lunar_effective_micro = 100 * LUNAR_CALENDAR_MINOR_VERSION + LUNAR_CALENDAR_MICRO_VERSION; gint required_effective_micro = 100 * required_minor + required_micro; if (required_major > LUNAR_CALENDAR_MAJOR_VERSION) return "LunarCalendar version too old (major mismatch)"; if (required_major < LUNAR_CALENDAR_MAJOR_VERSION) return "LunarCalendar version too new (major mismatch)"; if (required_effective_micro < lunar_effective_micro - LUNAR_CALENDAR_BINARY_AGE) return "LunarCalendar version too new (micro mismatch)"; if (required_effective_micro > lunar_effective_micro) return "LunarCalendar version too old (micro mismatch)"; return NULL; } lunar-calendar-3.0.1/lunar-calendar/lunar-calendar-version.h.in000066400000000000000000000064761417055033100244400ustar00rootroot00000000000000/* vi: set sw=4 ts=4: */ /* * lunar-calendar-version.h: This file is part of lunar-calendar. * * Copyright (C) 2009-2022 yetist * * 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, see . * */ #ifndef __LUNAR_CALENDAR_VERSION_H__ #define __LUNAR_CALENDAR_VERSION_H__ 1 #include G_BEGIN_DECLS /** * LUNAR_CALENDAR_MAJOR_VERSION: * * The major version number of the LunarCalendar library * (e.g. in version 2.4.0 this is 2). * * Since: 2.4.0 */ #define LUNAR_CALENDAR_MAJOR_VERSION @LUNAR_CALENDAR_MAJOR_VERSION@ /** * LUNAR_CALENDAR_MINOR_VERSION: * * The minor version number of the LunarCalendar library * (e.g. in version 2.4.0 this is 4). * * Since: 2.4.0 */ #define LUNAR_CALENDAR_MINOR_VERSION @LUNAR_CALENDAR_MINOR_VERSION@ /** * LUNAR_CALENDAR_MICRO_VERSION: * * The macro version number of the LunarCalendar library * (e.g. in version 2.4.0 this is 0). * * Since: 2.4.0 */ #define LUNAR_CALENDAR_MICRO_VERSION @LUNAR_CALENDAR_MICRO_VERSION@ /** * lunar_calendar_major_version: * * The major version number of the LunarCalendar library * (e.g. in version 2.4.0 this is 2). Used for runtime. * * Since: 2.4.0 */ extern const guint lunar_calendar_major_version; /** * lunar_calendar_minor_version: * * The minor version number of the LunarCalendar library * (e.g. in version 2.4.0 this is 4). Used for runtime. * * Since: 2.4.0 */ extern const guint lunar_calendar_minor_version; /** * lunar_calendar_micro_version: * * The micro version number of the LunarCalendar library * (e.g. in version 2.4.0 this is 0). Used for runtime. * * Since: 2.4.0 */ extern const guint lunar_calendar_micro_version; const gchar * lunar_calendar_check_version (guint required_major, guint required_minor, guint required_micro); /** * LUNAR_CALENDAR_CHECK_VERSION: * @major: required major version * @minor: required minor version * @micro: required micro version * * Checks the version of the LunarCalendar library. * * Checking the version of the LunarCalendar library: * |[ * if (!LUNAR_CALENDAR_CHECK_VERSION (2, 4, 0)) * g_error ("LunarCalendar version 2.4.0 or above is needed"); * ]| * * Returns: %TRUE if the version of the LunarCalendar header files is the same * as or newer than the passed-in version. * * Since: 2.4.0 */ #define LUNAR_CALENDAR_CHECK_VERSION(major,minor,micro) \ (LUNAR_MAJOR_VERSION > (major) || \ (LUNAR_MAJOR_VERSION == (major) && LUNAR_MINOR_VERSION > (minor)) || \ (LUNAR_MAJOR_VERSION == (major) && LUNAR_MINOR_VERSION == (minor) && \ LUNAR_MICRO_VERSION >= (micro))) G_END_DECLS #endif /* __LUNAR_CALENDAR_VERSION_H__ */ /* vi:ts=4:wrap:ai: */ lunar-calendar-3.0.1/lunar-calendar/lunar-calendar.c000066400000000000000000000260111417055033100223260ustar00rootroot00000000000000/* vi: set sw=4 ts=4: */ /* * lunar-calendar.c: This file is part of lunar-calendar. * * Copyright (C) 2009-2022 yetist * * 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, see . * */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include "lunar-calendar.h" /** * SECTION:lunar-calendar * @Short_description: Chinese Lunar Calendar widget for GTK+ * @Title: LunarCalendar * * The #LunarCalendar provide Chinese lunar Calendar Wieget for GTK+ . */ enum { ACTIVATE, LAST_SIGNAL }; enum { PROP_0, }; typedef struct _LunarCalendarPrivate LunarCalendarPrivate; struct _LunarCalendarPrivate { GtkCalendar object; LunarDate *date; GdkRGBA *rgba; }; static guint calendar_signals[LAST_SIGNAL] = { 0 }; static void lunar_calendar_init_i18n (void); static void lunar_calendar_day_selected (GtkCalendar *gcalendar); static gchar* calendar_detail_cb (GtkCalendar *gcalendar, guint year, guint month, guint day, gpointer data); G_DEFINE_TYPE_WITH_PRIVATE (LunarCalendar, lunar_calendar, GTK_TYPE_CALENDAR); static gchar *color_to_string (const GdkColor *color) { PangoColor pango_color; pango_color.red = color->red; pango_color.green = color->green; pango_color.blue = color->blue; return pango_color_to_string (&pango_color); } static gchar *rgba_to_string (const GdkRGBA *rgba) { PangoColor pango_color; pango_color.red = 0xffff * rgba->red; pango_color.green = 0xffff * rgba->green; pango_color.blue = 0xffff * rgba->blue; return pango_color_to_string (&pango_color); } static void lunar_calendar_finalize (GObject *gobject) { LunarCalendar *calendar; LunarCalendarPrivate *priv; calendar = LUNAR_CALENDAR (gobject); priv = lunar_calendar_get_instance_private (calendar); if (priv->date != NULL) { lunar_date_free(priv->date); } if (priv->rgba != NULL) gdk_rgba_free (priv->rgba); G_OBJECT_CLASS (lunar_calendar_parent_class)->finalize (gobject); } static gboolean locale_is_chinese (void) { gboolean chinese = FALSE; const gchar* const * langs = g_get_language_names (); if (langs[0] && langs[0][0] != '\0') { if (g_str_has_prefix (langs[0], "zh_")) { chinese = TRUE; } } return chinese; } static void lunar_calendar_day_selected (GtkCalendar *gcalendar) { guint year, month, day; GError *error = NULL; LunarCalendar *calendar; LunarCalendarPrivate *priv; gchar *holiday, *format, *strtime, *color; calendar = LUNAR_CALENDAR (gcalendar); priv = lunar_calendar_get_instance_private (calendar); if (getenv ("LUNAR_CALENDAR_IGNORE_NON_CHINESE") != NULL) { if (!locale_is_chinese ()) { g_object_set (gcalendar, "show-details", FALSE, NULL); return; } } else { g_object_set (gcalendar, "show-details", TRUE, NULL); } gtk_calendar_get_date (gcalendar, &year, &month, &day); lunar_date_set_solar_date (priv->date, year, month + 1, day, 3, &error); if (error != NULL) { g_clear_error (&error); return; } color = rgba_to_string (priv->rgba); holiday = lunar_date_get_holiday (priv->date, "\n"); if (holiday != NULL) { format = g_strdup_printf ("%s\n%s\n%s\n%s\n%s", _("%(year)-%(month)-%(day)"), _("%(YUE)yue%(RI)"), _("%(Y60)nian%(M60)yue%(D60)ri"), _("shengxiao: %(shengxiao)"), color, holiday); } else { format = g_strdup_printf ("%s\n%s\n%s\n%s", _("%(year)-%(month)-%(day)"), _("%(YUE)yue%(RI)"), _("%(Y60)nian%(M60)yue%(D60)ri"), _("shengxiao: %(shengxiao)")); } strtime = lunar_date_strftime (priv->date, format); g_free (color); g_free (holiday); g_free (format); gtk_widget_set_tooltip_markup (GTK_WIDGET(gcalendar), strtime); g_free (strtime); if (year > 0 && month > 0 && day > 0) g_signal_emit (calendar, calendar_signals[ACTIVATE], 0); } static void lunar_calendar_class_init (LunarCalendarClass *klass) { GObjectClass *gobject_class; GtkWidgetClass *widget_class; GtkCalendarClass *gcalendar_class; gobject_class = G_OBJECT_CLASS (klass); widget_class = GTK_WIDGET_CLASS (klass); gcalendar_class = GTK_CALENDAR_CLASS (klass); gobject_class->finalize = lunar_calendar_finalize; gcalendar_class->day_selected = lunar_calendar_day_selected; #if GTK_CHECK_VERSION(3, 20, 0) gtk_widget_class_set_css_name (widget_class, "calendar"); #endif /** * LunarCalendar::activate: * @widget: the object which received the signal. * * The ::activate signal on LunarCalendar is an action signal and * emitting it causes the calendar selected day. * Applications should never connect to this signal, but use the * #LunarCalendar::activate signal. */ calendar_signals[ACTIVATE] = g_signal_new ("activate", G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (LunarCalendarClass, activate), NULL, NULL, NULL, G_TYPE_NONE, 0); } static void lunar_calendar_init (LunarCalendar *calendar) { GdkRGBA rgba; LunarCalendarPrivate *priv; priv = lunar_calendar_get_instance_private (calendar); priv->date = lunar_date_new (); gdk_rgba_parse (&rgba, "blue"); priv->rgba = gdk_rgba_copy (&rgba); /* FIXME: here we can setup the locale info, but it looks like not a good idea */ lunar_calendar_init_i18n (); if (gtk_calendar_get_display_options (GTK_CALENDAR(calendar)) & GTK_CALENDAR_SHOW_DETAILS) gtk_calendar_set_detail_func (GTK_CALENDAR (calendar), calendar_detail_cb, calendar, NULL); } /** * lunar_calendar_new: * * Creates a new lunar calendar, with the current date being selected. * * Return value: a newly #LunarCalendar widget **/ GtkWidget* lunar_calendar_new (void) { return g_object_new (LUNAR_TYPE_CALENDAR, NULL); } /** * lunar_calendar_set_holiday_rgba: * @calendar: a #LunarCalendar * @rgba: the holiday rgba. * * Setup the holiday color. * **/ void lunar_calendar_set_holiday_rgba (LunarCalendar *calendar, const GdkRGBA *rgba) { LunarCalendarPrivate *priv; priv = lunar_calendar_get_instance_private (calendar); if (priv->rgba != NULL) { if (gdk_rgba_equal ((gconstpointer) priv->rgba, (gconstpointer) rgba)) { return; } gdk_rgba_free(priv->rgba); } priv->rgba = gdk_rgba_copy (rgba); gtk_widget_queue_draw (GTK_WIDGET(calendar)); } /** * lunar_calendar_set_jieri_color: * @calendar: a #LunarCalendar * @color: the holiday color. * * Setup the holiday(jieri) color. * **/ void lunar_calendar_set_jieri_color (LunarCalendar *calendar, const GdkColor *color) { gchar *spec; GdkRGBA rgba; spec = color_to_string (color); rgba.red = color->red / 65535; rgba.green = color->green / 65535; rgba.blue = color->blue / 65535; rgba.alpha = 1; lunar_calendar_set_holiday_rgba (calendar, &rgba); gtk_widget_queue_draw (GTK_WIDGET (calendar)); g_free (spec); } static gchar* widget_color_string(LunarCalendar *widget) { GtkStyleContext *context; GtkStateFlags state = 0; GdkRGBA color; gchar *value; context = gtk_widget_get_style_context (GTK_WIDGET(widget)); state = gtk_widget_get_state_flags (GTK_WIDGET(widget)); state &= ~(GTK_STATE_FLAG_INCONSISTENT | GTK_STATE_FLAG_ACTIVE | GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_DROP_ACTIVE); state |= GTK_STATE_FLAG_INCONSISTENT; gtk_style_context_get_color (context, state, &color); value = g_strdup_printf ("#%02X%02X%02X%02X", (guint)(color.red * 255), (guint)(color.green * 255), (guint)(color.blue * 255), (guint)(color.alpha * 255) ); return value; } static gchar* calendar_detail_cb (GtkCalendar *gcalendar, guint year, guint month, guint day, gpointer data) { GError *error = NULL; gchar *value, *holiday; LunarCalendar *calendar; LunarCalendarPrivate *priv; gboolean show_detail; guint current_month; calendar = LUNAR_CALENDAR (data); priv = lunar_calendar_get_instance_private (calendar); g_object_get (calendar, "month", ¤t_month, NULL); g_object_get (calendar, "show-details", &show_detail, NULL); if (! show_detail) return NULL; lunar_date_set_solar_date (priv->date, year, month + 1, day, 0, &error); if (error != NULL) { g_clear_error (&error); return NULL; } if (getenv ("LUNAR_CALENDAR_IGNORE_NON_CHINESE") != NULL) { if (!locale_is_chinese ()) { g_object_set (calendar, "show-details", FALSE, NULL); return NULL; } } holiday = lunar_date_get_calendar (priv->date, 3); if (current_month == month) { value = g_strdup_printf ("%s", holiday); } else { gchar* color = widget_color_string (calendar); value = g_strdup_printf ("%s", color, holiday); g_free (color); } g_free (holiday); return value; } static void lunar_calendar_init_i18n (void) { static gboolean _lunar_calendar_gettext_initialized = FALSE; if (!_lunar_calendar_gettext_initialized) { bindtextdomain (GETTEXT_PACKAGE, LUNAR_CALENDAR_LOCALEDIR); #ifdef HAVE_BIND_TEXTDOMAIN_CODESET bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); #endif _lunar_calendar_gettext_initialized = TRUE; } } lunar-calendar-3.0.1/lunar-calendar/lunar-calendar.h000066400000000000000000000046111417055033100223350ustar00rootroot00000000000000/* vi: set sw=4 ts=4: */ /* * lunar-calendar.h: This file is part of lunar-calendar. * * Copyright (C) 2009-2022 yetist * * 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, see . * */ #ifndef __LUNAR_CALENDAR_H__ #define __LUNAR_CALENDAR_H__ 1 #include #include G_BEGIN_DECLS #define LUNAR_TYPE_CALENDAR (lunar_calendar_get_type ()) #if GLIB_CHECK_VERSION(2, 44, 0) G_DECLARE_DERIVABLE_TYPE (LunarCalendar, lunar_calendar, LUNAR, CALENDAR, GtkCalendar) struct _LunarCalendarClass { GtkCalendarClass parent_class; void (*activate) (LunarCalendar *calendar); }; #else #define LUNAR_CALENDAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LUNAR_TYPE_CALENDAR, LunarCalendar)) #define LUNAR_CALENDAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LUNAR_TYPE_CALENDAR, LunarCalendarClass)) #define LUNAR_IS_CALENDAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LUNAR_TYPE_CALENDAR)) #define LUNAR_IS_CALENDAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LUNAR_TYPE_CALENDAR)) #define LUNAR_CALENDAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LUNAR_TYPE_CALENDAR, LunarCalendarClass)) typedef struct _LunarCalendar LunarCalendar; typedef struct _LunarCalendarClass LunarCalendarClass; struct _LunarCalendarClass { GtkCalendarClass parent_class; void (*activate) (LunarCalendar *calendar); }; #endif GtkWidget* lunar_calendar_new (void); void lunar_calendar_set_holiday_rgba (LunarCalendar *calendar, const GdkRGBA *rgba); GLIB_DEPRECATED_FOR(lunar_calendar_set_holiday_rgba) void lunar_calendar_set_jieri_color (LunarCalendar *calendar, const GdkColor *color); G_END_DECLS #endif /* __LUNAR_CALENDAR_H__ */ lunar-calendar-3.0.1/lunar-calendar/meson.build000066400000000000000000000036631417055033100214440ustar00rootroot00000000000000gnome = import('gnome') pkg = import('pkgconfig') version_h = configure_file( input: 'lunar-calendar-version.h.in', output : 'lunar-calendar-version.h', configuration : conf ) source_h = [ 'lunar-calendar.h', version_h, ] source_c = [ 'lunar-calendar.c', 'lunar-calendar-version.c', ] install_headers(source_h, subdir : join_paths('lunar-calendar-3.0', 'lunar-calendar')) liblunar_calendar = shared_library('lunar-calendar-3.0', source_c, soversion: soversion, version: libversion, dependencies: [gtk_dep, lunar_date_dep], include_directories: top_srcdir, install : true, install_dir : get_option('libdir') ) liblunar_calendar_deps = declare_dependency(sources: source_h, include_directories: [top_srcdir, include_directories('.')], dependencies: [gtk_dep, lunar_date_dep], link_with: liblunar_calendar) cc = meson.get_compiler('c') dl_dep = cc.find_library('dl') pkg.generate( name: 'lunar-calendar-3.0', version: meson.project_version(), description: 'Chinese Lunar Calendar Widget Library', requires: ['gtk+-3.0', 'lunar-date-3.0'], filebase: 'lunar-calendar-@0@'.format(api_version), libraries: [liblunar_calendar], subdirs: 'lunar-calendar-3.0', ) if get_option('introspection') liblunar_calendar_gir = gnome.generate_gir(liblunar_calendar, sources: [source_h, source_c], nsversion : api_version, namespace : 'LunarCalendar', symbol_prefix : 'lunar', identifier_prefix : 'Lunar', link_with: liblunar_calendar, includes : ['Gtk-3.0', 'LunarDate-3.0'], install : true, install_dir_gir: girdir, install_dir_typelib: typelibdir, extra_args: [ '--c-include=lunar-calendar/lunar-calendar.h' ], ) if get_option('vapi') lunar_date_vapi = gnome.generate_vapi('lunar-calendar-' + api_version, sources: liblunar_calendar_gir[0], packages: ['gtk+-3.0', 'lunar-date-3.0'], install: true, install_dir: vapidir, ) endif endif lunar-calendar-3.0.1/meson.build000066400000000000000000000113001417055033100165370ustar00rootroot00000000000000project('lunar-calendar', 'c', version : '3.0.1', license : 'LGPLv2.1+', meson_version : '>=0.46.0', default_options : [ 'warning_level=1', 'buildtype=debugoptimized', 'c_std=gnu11'], ) # Versionning version_arr = meson.project_version().split('.') lunar_calendar_version_major = version_arr[0].to_int() lunar_calendar_version_minor = version_arr[1].to_int() lunar_calendar_version_micro = version_arr[2].to_int() api_version = '3.0' soversion = 1 if lunar_calendar_version_minor.is_odd() lunar_calendar_interface_age = 0 else lunar_calendar_interface_age = lunar_calendar_version_micro endif # maintaining compatibility with the previous libtool versioning # current = minor * 100 + micro - interface # revision = interface current = lunar_calendar_version_minor * 100 + lunar_calendar_version_micro - lunar_calendar_interface_age revision = lunar_calendar_interface_age libversion = '@0@.@1@.@2@'.format(soversion, current, revision) # Compiler & Project arguments add_project_arguments([ '-DHAVE_CONFIG_H', '-I' + meson.build_root(), ], language: 'c') # get suported warning flags test_args = [ '-fstack-protector-strong', '-Waggregate-return', '-Warray-bounds', '-Wcast-align', '-Wclobbered', '-Wdeclaration-after-statement', '-Wempty-body', '-Wformat=2', '-Wformat-nonliteral', '-Wformat-security', '-Wformat-signedness', '-Wignored-qualifiers', '-Wimplicit-function-declaration', '-Winit-self', '-Winline', '-Wmissing-declarations', '-Wmissing-format-attribute', '-Wmissing-include-dirs', '-Wmissing-noreturn', '-Wmissing-parameter-type', '-Wmissing-prototypes', '-Wnested-externs', '-Wno-discarded-qualifiers', '-Wno-missing-field-initializers', '-Wno-strict-aliasing', '-Wno-suggest-attribute=format', '-Wno-unused-parameter', '-Wold-style-definition', '-Woverride-init', '-Wpacked', '-Wpointer-arith', '-Wredundant-decls', '-Wreturn-type', '-Wshadow', '-Wsign-compare', '-Wstrict-aliasing', '-Wstrict-prototypes', '-Wswitch-default', '-Wtype-limits', '-Wundef', '-Wuninitialized', '-Wunused-but-set-variable', '-Wwrite-strings' ] cc = meson.get_compiler('c') foreach arg: test_args if cc.has_argument(arg) add_project_arguments(arg, language : 'c') endif endforeach # enable full RELRO where possible # FIXME: until https://github.com/mesonbuild/meson/issues/1140 is fixed global_link_args = [] test_link_args = [ '-Wl,-z,relro', '-Wl,-z,now', ] foreach arg: test_link_args if cc.has_link_argument(arg) global_link_args += arg endif endforeach add_global_link_arguments( global_link_args, language: 'c' ) # Dependencies gtk_req_version = '>= 3.0.0' lunar_date_req_version = '>= 2.9.0' gtk_dep = dependency('gtk+-3.0', version: gtk_req_version) lunar_date_dep = dependency('lunar-date-3.0', version: lunar_date_req_version) # Configure data conf = configuration_data() conf.set('LUNAR_CALENDAR_MAJOR_VERSION', lunar_calendar_version_major) conf.set('LUNAR_CALENDAR_MINOR_VERSION', lunar_calendar_version_minor) conf.set('LUNAR_CALENDAR_MICRO_VERSION', lunar_calendar_version_micro) conf.set('LUNAR_CALENDAR_BINARY_AGE', lunar_calendar_interface_age) conf.set_quoted('VERSION', meson.project_version()) conf.set_quoted('PACKAGE_NAME', meson.project_name()) conf.set_quoted('PACKAGE_VERSION', meson.project_version()) conf.set_quoted('GETTEXT_PACKAGE', meson.project_name()) conf.set_quoted('LUNAR_CALENDAR_LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir'))) conf.set_quoted('DATADIR', join_paths(get_option('prefix'), get_option('datadir'))) conf.set_quoted('LIBDIR', join_paths(get_option('prefix'), get_option('libdir'))) conf.set_quoted('BINDIR', join_paths(get_option('prefix'), get_option('bindir'))) conf.set_quoted('SYSCONFDIR', join_paths(get_option('prefix'), get_option('sysconfdir'))) conf.set_quoted('LOCALSTATEDIR', join_paths(get_option('prefix'), get_option('localstatedir'))) conf.set_quoted('LIBEXECDIR', join_paths(get_option('prefix'), get_option('libexecdir'))) configure_file( output : 'config.h', configuration : conf ) # Setup various paths that subdirectory meson.build files need package_subdir = get_option('package_subdir') girdir = join_paths(get_option('datadir'), package_subdir, 'gir-1.0') typelibdir = join_paths(get_option('libdir'), package_subdir, 'girepository-1.0') libdir = join_paths(get_option('libdir'), package_subdir) if package_subdir != '' vapidir = join_paths(get_option('datadir'), package_subdir, 'vapi') else vapidir = join_paths(get_option('datadir'), 'vala', 'vapi') endif top_srcdir = include_directories('.') subdir('po') subdir('lunar-calendar') subdir('modules') if get_option('docs') subdir('docs') endif if get_option('tests') subdir('tests') endif lunar-calendar-3.0.1/meson_options.txt000066400000000000000000000011271417055033100200400ustar00rootroot00000000000000option('introspection', type: 'boolean', value : false, description: 'Build with GObject Introspection support') option('vapi', type: 'boolean', value: false, description: 'Build to generation vala vapi file') option('docs', type : 'boolean', value : false, description: 'Enable generating the API reference (depends on GTK-Doc)') option('tests', type : 'boolean', value : false, description : 'Enable test programs (default: no)') # For subproject usage option('package_subdir', type: 'string', description: 'Private sub-directory used when built as a subproject' ) lunar-calendar-3.0.1/modules/000077500000000000000000000000001417055033100160525ustar00rootroot00000000000000lunar-calendar-3.0.1/modules/README.md000066400000000000000000000007321417055033100173330ustar00rootroot00000000000000# 说明 通过使用 Gtk Module, 可以让系统中使用显示日历的地方,自动带农历显示。 ## 编译 使用 `meson configure -Denable_gtk_modules=true`,来编译出 gtk3 的module. ## 使用 通过环境变量运行: ``` GTK3_MODULES=lunar-calendar-module gtk3-widget-factory ``` 让系统全局生效: 编写文件 `/etc/profile.d/lunar-calendar.sh`, 内容为: ``` export GTK3_MODULES=lunar-calendar-module ``` 注销,重新登录。 lunar-calendar-3.0.1/modules/meson.build000066400000000000000000000004141417055033100202130ustar00rootroot00000000000000liblunar_calendar_module = shared_library('lunar-calendar-module', 'module.c', dependencies: [gtk_dep, liblunar_calendar_deps, dl_dep], include_directories: top_srcdir, install : true, install_dir : join_paths(get_option('libdir'), 'gtk-3.0', 'modules') ) lunar-calendar-3.0.1/modules/module.c000066400000000000000000000040241417055033100175030ustar00rootroot00000000000000/* vi: set sw=4 ts=4 wrap ai: */ /* * module.c: This file is part of lunar-calendar. * * Copyright (C) 2018-2022 yetist * * 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, see . * */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include void gtk_module_init(gint *argc, gchar ***argv); static GObject* (*pre_hijacked_calendar_constructor) (GType type, guint n_construct_properties, GObjectConstructParam *construct_params); static GObject* hijacked_calendar_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_params) { GObject *object; static gboolean _lunar_calendar_gettext_initialized = FALSE; if (!_lunar_calendar_gettext_initialized) { bindtextdomain (GETTEXT_PACKAGE, LUNAR_CALENDAR_LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); _lunar_calendar_gettext_initialized = TRUE; } type = lunar_calendar_get_type (); object = (*pre_hijacked_calendar_constructor) (type, n_construct_properties, construct_params); return object; } G_MODULE_EXPORT void gtk_module_init (gint *argc, gchar ***argv) { GObjectClass *calendar_class; calendar_class = g_type_class_ref (GTK_TYPE_CALENDAR); pre_hijacked_calendar_constructor = calendar_class->constructor; calendar_class->constructor = hijacked_calendar_constructor; } lunar-calendar-3.0.1/po/000077500000000000000000000000001417055033100150205ustar00rootroot00000000000000lunar-calendar-3.0.1/po/ChangeLog000066400000000000000000000005061417055033100165730ustar00rootroot000000000000002008-02-01 yetist * zh_CN.po: update chinese translate. 2008-01-21 yetist * zh_CN.po: update chinese translate. 2007-04-14 yetist * zh_CN.po: update chinese translate. 2007-04-02 yetist * zh_CN.po: update chinese translate. lunar-calendar-3.0.1/po/LINGUAS000066400000000000000000000001451417055033100160450ustar00rootroot00000000000000# lunar-applet translations # # please keep this list sorted alphabetically # zh_CN zh_TW zh_HK lunar-calendar-3.0.1/po/POTFILES.in000066400000000000000000000001331417055033100165720ustar00rootroot00000000000000# List of source files which contain translatable strings. lunar-calendar/lunar-calendar.c lunar-calendar-3.0.1/po/meson.build000066400000000000000000000001121417055033100171540ustar00rootroot00000000000000i18n = import('i18n') i18n.gettext(meson.project_name(), preset: 'glib',) lunar-calendar-3.0.1/po/zh_CN.po000066400000000000000000000031521417055033100163620ustar00rootroot00000000000000# liblunar package simplified Chinese translation file. # Copyright (C) 2008 yetist . # This file is distributed under the same license as the liblunar package. # yetist , 2008. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: liblunar\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-04-14 21:15+0800\n" "PO-Revision-Date: 2011-05-07 20:28+0800\n" "Last-Translator: yetist \n" "Language-Team: yetist@gmail.com \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Poedit-Language: Chinese\n" "X-Poedit-Country: CHINA\n" #: lunar-calendar/lunar-calendar.c:135 msgid "%(year)-%(month)-%(day)" msgstr "公历:%(year)年%(month)月%(day)日" #: lunar-calendar/lunar-calendar.c:136 msgid "%(YUE)yue%(RI)" msgstr "农历:%(YUE)月%(RI)日" #: lunar-calendar/lunar-calendar.c:137 msgid "%(Y60)nian%(M60)yue%(D60)ri" msgstr "干支:%(Y60)年%(M60)月%(D60)日" #: lunar-calendar/lunar-calendar.c:138 msgid "shengxiao: %(shengxiao)" msgstr "生肖: %(shengxiao)" #~ msgid "" #~ "%(year)-%(month)-%(day)\n" #~ "Lunar:%(YUE)Month%(RI)Day\n" #~ "Ganzhi:%(Y60)Year%(M60)Month%(D60)Day\n" #~ "Bazi:%(Y8)Year%(M8)Month%(D8)Day\n" #~ "Shengxiao:%(shengxiao)\n" #~ "%s\n" #~ msgstr "" #~ "%(year)年%(month)月%(day)日\n" #~ "农历:%(YUE)月%(RI)日\n" #~ "干支:%(Y60)年%(M60)月%(D60)日\n" #~ "八字:%(Y8)年%(M8)月%(D8)日\n" #~ "生肖:%(shengxiao)\n" #~ "%s\n" lunar-calendar-3.0.1/po/zh_HK.po000066400000000000000000000030011417055033100163550ustar00rootroot00000000000000# liblunar package simplified Chinese translation file. # Copyright (C) 2008 yetist . # This file is distributed under the same license as the liblunar package. # yetist , 2008. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: liblunar\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-04-14 21:15+0800\n" "PO-Revision-Date: 2011-05-07 20:28+0800\n" "Last-Translator: yetist \n" "Language-Team: yetist@gmail.com \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Poedit-Language: Chinese\n" "X-Poedit-Country: CHINA\n" #: lunar-calendar/lunar-calendar.c:135 msgid "%(year)-%(month)-%(day)" msgstr "" #: lunar-calendar/lunar-calendar.c:136 #, fuzzy msgid "%(YUE)yue%(RI)" msgstr "%(YUE)月" #: lunar-calendar/lunar-calendar.c:137 msgid "%(Y60)nian%(M60)yue%(D60)ri" msgstr "" #: lunar-calendar/lunar-calendar.c:138 msgid "shengxiao: %(shengxiao)" msgstr "" #~ msgid "" #~ "%(year)-%(month)-%(day)\n" #~ "Lunar:%(YUE)Month%(RI)Day\n" #~ "Ganzhi:%(Y60)Year%(M60)Month%(D60)Day\n" #~ "Bazi:%(Y8)Year%(M8)Month%(D8)Day\n" #~ "Shengxiao:%(shengxiao)\n" #~ "%s\n" #~ msgstr "" #~ "%(year)年%(month)月%(day)日\n" #~ "农历:%(YUE)月%(RI)日\n" #~ "干支:%(Y60)年%(M60)月%(D60)日\n" #~ "八字:%(Y8)年%(M8)月%(D8)日\n" #~ "生肖:%(shengxiao)\n" #~ "%s\n" lunar-calendar-3.0.1/po/zh_TW.po000066400000000000000000000030011417055033100164050ustar00rootroot00000000000000# liblunar package simplified Chinese translation file. # Copyright (C) 2008 yetist . # This file is distributed under the same license as the liblunar package. # yetist , 2008. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: liblunar\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-04-14 21:15+0800\n" "PO-Revision-Date: 2011-05-07 20:28+0800\n" "Last-Translator: yetist \n" "Language-Team: yetist@gmail.com \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Poedit-Language: Chinese\n" "X-Poedit-Country: CHINA\n" #: lunar-calendar/lunar-calendar.c:135 msgid "%(year)-%(month)-%(day)" msgstr "" #: lunar-calendar/lunar-calendar.c:136 #, fuzzy msgid "%(YUE)yue%(RI)" msgstr "%(YUE)月" #: lunar-calendar/lunar-calendar.c:137 msgid "%(Y60)nian%(M60)yue%(D60)ri" msgstr "" #: lunar-calendar/lunar-calendar.c:138 msgid "shengxiao: %(shengxiao)" msgstr "" #~ msgid "" #~ "%(year)-%(month)-%(day)\n" #~ "Lunar:%(YUE)Month%(RI)Day\n" #~ "Ganzhi:%(Y60)Year%(M60)Month%(D60)Day\n" #~ "Bazi:%(Y8)Year%(M8)Month%(D8)Day\n" #~ "Shengxiao:%(shengxiao)\n" #~ "%s\n" #~ msgstr "" #~ "%(year)年%(month)月%(day)日\n" #~ "农历:%(YUE)月%(RI)日\n" #~ "干支:%(Y60)年%(M60)月%(D60)日\n" #~ "八字:%(Y8)年%(M8)月%(D8)日\n" #~ "生肖:%(shengxiao)\n" #~ "%s\n" lunar-calendar-3.0.1/sanity_check000077500000000000000000000014221417055033100167730ustar00rootroot00000000000000#!/bin/sh VERSION=$1 if [ ! -f liblunar-gtk-$VERSION.tar.gz ]; then echo "ERROR: liblunar-gtk-$VERSION.tar.gz does not exist..." exit 1 fi echo "" echo "Checking liblunar-gtk-$VERSION.tar.gz..." tar xfz liblunar-gtk-$VERSION.tar.gz for file in NEWS README do echo -n "$file... " if [ "x`grep $VERSION liblunar-gtk-$VERSION/$file | wc -l | awk -F' ' '{print $1}'`" = "x0" ]; then echo "failed." #exit 1 else echo "ok" fi done echo -n "INSTALL..." if [ "x`grep $VERSION liblunar-gtk-$VERSION/INSTALL | wc -l | awk -F' ' '{print $1}'`" = "x2" ]; then echo "ok" else echo "failed." exit 1 fi echo "" echo "Number of lines in created documentation files:" LC_ALL=C wc -l liblunar-gtk-$VERSION/docs/reference/html/*.html | grep total rm -rf liblunar-gtk-$VERSION lunar-calendar-3.0.1/tests/000077500000000000000000000000001417055033100155445ustar00rootroot00000000000000lunar-calendar-3.0.1/tests/meson.build000066400000000000000000000002301417055033100177010ustar00rootroot00000000000000t=executable('testing', sources : 'test-calendar.c', dependencies : liblunar_calendar_deps, install : false, ) test('lunar-calendar-testing', t) lunar-calendar-3.0.1/tests/test-calendar.c000066400000000000000000000500271417055033100204420ustar00rootroot00000000000000/* example-start calendar calendar.c */ /* * Copyright (C) 1998 Cesar Miquel, Shawn T. Amundson, Mattias Grnlund * Copyright (C) 2000 Tony Gale * * 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 program. If not, see . */ #include "config.h" #include #include #include #include #define DEF_PAD 12 #define DEF_PAD_SMALL 6 #define TM_YEAR_BASE 1900 typedef struct _CalendarData { GtkWidget *calendar_widget; GtkWidget *flag_checkboxes[6]; gboolean settings[6]; GtkWidget *font_dialog; GtkWidget *window; GtkWidget *prev2_sig; GtkWidget *prev_sig; GtkWidget *last_sig; GtkWidget *month; GHashTable *details_table; GtkTextBuffer *details_buffer; gulong details_changed; } CalendarData; enum { calendar_show_header, calendar_show_days, calendar_month_change, calendar_show_week, calendar_monday_first }; /* * GtkCalendar */ void calendar_select_color (GtkWidget *button, CalendarData *calendar); void calendar_select_font (GtkWidget *button, CalendarData *calendar); static void calendar_date_to_string (CalendarData *data, char *buffer, gint buff_len) { GDate *date; guint year, month, day; gtk_calendar_get_date (GTK_CALENDAR(data->window), &year, &month, &day); if (g_date_valid_dmy (day, month + 1, year)) { date = g_date_new_dmy (day, month + 1, year); g_date_strftime (buffer, buff_len-1, "%x", date); g_date_free (date); } else { g_snprintf (buffer, buff_len - 1, "%u/%u/%u (invalid)", month + 1, day, year); } } static void calendar_set_signal_strings (char *sig_str, CalendarData *data) { const gchar *prev_sig; prev_sig = gtk_label_get_text (GTK_LABEL (data->prev_sig)); gtk_label_set_text (GTK_LABEL (data->prev2_sig), prev_sig); prev_sig = gtk_label_get_text (GTK_LABEL (data->last_sig)); gtk_label_set_text (GTK_LABEL (data->prev_sig), prev_sig); gtk_label_set_text (GTK_LABEL (data->last_sig), sig_str); } static void calendar_month_changed (GtkWidget *widget, CalendarData *data) { char buffer[256] = "month_changed: "; calendar_date_to_string (data, buffer+15, 256-15); calendar_set_signal_strings (buffer, data); } static void calendar_day_selected (GtkWidget *widget, CalendarData *data) { char buffer[256] = "day_selected: "; calendar_date_to_string (data, buffer+14, 256-14); calendar_set_signal_strings (buffer, data); //calendar_update_details (data); } static void calendar_day_selected_double_click (GtkWidget *widget, CalendarData *data) { char buffer[256] = "day_selected_double_click: "; guint day; calendar_date_to_string (data, buffer+27, 256-27); calendar_set_signal_strings (buffer, data); gtk_calendar_get_date (GTK_CALENDAR (data->window), NULL, NULL, &day); // if (gtk_calendar_get_day_is_marked (GTK_CALENDAR (data->window), day)) // gtk_calendar_unmark_day (GTK_CALENDAR (data->window), day); // else // gtk_calendar_mark_day (GTK_CALENDAR (data->window), day); } static void calendar_prev_month (GtkWidget *widget, CalendarData *data) { char buffer[256] = "prev_month: "; calendar_date_to_string (data, buffer+12, 256-12); calendar_set_signal_strings (buffer, data); } static void calendar_next_month (GtkWidget *widget, CalendarData *data) { char buffer[256] = "next_month: "; calendar_date_to_string (data, buffer+12, 256-12); calendar_set_signal_strings (buffer, data); } static void calendar_prev_year (GtkWidget *widget, CalendarData *data) { char buffer[256] = "prev_year: "; calendar_date_to_string (data, buffer+11, 256-11); calendar_set_signal_strings (buffer, data); } static void calendar_next_year (GtkWidget *widget, CalendarData *data) { char buffer[256] = "next_year: "; calendar_date_to_string (data, buffer+11, 256-11); calendar_set_signal_strings (buffer, data); } static void calendar_set_flags (CalendarData *calendar) { gint options = 0; guint i; for (i = 0; i < G_N_ELEMENTS (calendar->settings); i++) if (calendar->settings[i]) options=options + (1 << i); if (calendar->window) gtk_calendar_set_display_options (GTK_CALENDAR (calendar->window), options); } static void calendar_toggle_flag (GtkWidget *toggle, CalendarData *calendar) { guint i; for (i = 0; i < G_N_ELEMENTS (calendar->flag_checkboxes); i++) if (calendar->flag_checkboxes[i] == toggle) calendar->settings[i] = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)); calendar_set_flags(calendar); } void calendar_select_color (GtkWidget *button, CalendarData *calendar) { GdkRGBA rgba; gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER(button), &rgba); lunar_calendar_set_holiday_rgba(LUNAR_CALENDAR(calendar->calendar_widget), &rgba); } void calendar_select_font (GtkWidget *button, CalendarData *calendar) { const char *font = NULL; GtkCssProvider *provider; gchar *data; if (calendar->window) { provider = g_object_get_data (G_OBJECT (calendar->window), "css-provider"); if (!provider) { provider = gtk_css_provider_new (); gtk_style_context_add_provider (gtk_widget_get_style_context (calendar->window), GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_set_data_full (G_OBJECT (calendar->window), "css-provider", provider, g_object_unref); } font = gtk_font_chooser_get_font (GTK_FONT_CHOOSER(button)); data = g_strdup_printf ("calendar { font: %s; }", font); gtk_css_provider_load_from_data (provider, data, -1, NULL); g_free (data); } } static GtkWidget* create_expander (const char *caption, GtkWidget *child, GtkAlign halign, GtkAlign valign) { GtkWidget *expander = gtk_expander_new (""); GtkWidget *label = gtk_expander_get_label_widget (GTK_EXPANDER (expander)); g_object_set (child, "margin-top", 6, "margin-bottom", 0, "margin-start", 18, "margin-end", 0, "halign", halign, "valign", valign, NULL); gtk_label_set_markup (GTK_LABEL (label), caption); gtk_container_add (GTK_CONTAINER (expander), child); return expander; } static GtkWidget* create_frame (const char *caption, GtkWidget *child, GtkAlign halign, GtkAlign valign) { GtkWidget *frame = gtk_frame_new (""); GtkWidget *label = gtk_frame_get_label_widget (GTK_FRAME (frame)); g_object_set (child, "margin-top", 6, "margin-bottom", 0, "margin-start", 18, "margin-end", 0, "halign", halign, "valign", valign, NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE); gtk_label_set_markup (GTK_LABEL (label), caption); gtk_container_add (GTK_CONTAINER (frame), child); return frame; } static void detail_width_changed (GtkSpinButton *button, CalendarData *data) { gint value = (gint) gtk_spin_button_get_value (button); gtk_calendar_set_detail_width_chars (GTK_CALENDAR (data->calendar_widget), value); } static void detail_height_changed (GtkSpinButton *button, CalendarData *data) { gint value = (gint) gtk_spin_button_get_value (button); gtk_calendar_set_detail_height_rows (GTK_CALENDAR (data->calendar_widget), value); } static void create_calendar(void) { static CalendarData calendar_data; GtkWidget *window, *hpaned, *vbox, *rpane, *hbox; GtkWidget *calendar, *toggle, *button; GtkWidget *frame, *label, *bbox; GtkSizeGroup *size; GtkStyleContext *context; PangoFontDescription *font_desc; gchar *font; guint i; GdkRGBA rgba; struct { gboolean init; char *label; } flags[] = { { TRUE, "Show _Heading" }, { TRUE, "Show Day _Names" }, { FALSE, "No Month _Change" }, { TRUE, "Show _Week Numbers" }, { FALSE, "Week Start _Monday" }, { TRUE, "Show De_tails" }, }; calendar_data.window = NULL; calendar_data.font_dialog = NULL; calendar_data.details_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); for (i = 0; i < G_N_ELEMENTS (calendar_data.settings); i++) calendar_data.settings[i] = 0; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), "LunarCalendar Example"); gtk_container_set_border_width (GTK_CONTAINER (window), 12); g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); g_signal_connect (window, "delete-event", G_CALLBACK (gtk_false), NULL); hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); /* Calendar widget */ calendar = lunar_calendar_new (); calendar_data.calendar_widget = calendar; frame = create_frame ("Calendar", calendar, GTK_ALIGN_CENTER, GTK_ALIGN_CENTER); gtk_paned_pack1 (GTK_PANED (hpaned), frame, TRUE, FALSE); calendar_data.window = calendar; calendar_set_flags(&calendar_data); gtk_calendar_mark_day (GTK_CALENDAR (calendar), 19); g_signal_connect (calendar, "month_changed", G_CALLBACK (calendar_month_changed), &calendar_data); g_signal_connect (calendar, "day_selected", G_CALLBACK (calendar_day_selected), &calendar_data); g_signal_connect (calendar, "day_selected_double_click", G_CALLBACK (calendar_day_selected_double_click), &calendar_data); g_signal_connect (calendar, "prev_month", G_CALLBACK (calendar_prev_month), &calendar_data); g_signal_connect (calendar, "next_month", G_CALLBACK (calendar_next_month), &calendar_data); g_signal_connect (calendar, "prev_year", G_CALLBACK (calendar_prev_year), &calendar_data); g_signal_connect (calendar, "next_year", G_CALLBACK (calendar_next_year), &calendar_data); rpane = gtk_box_new (GTK_ORIENTATION_VERTICAL, DEF_PAD_SMALL); gtk_paned_pack2 (GTK_PANED (hpaned), rpane, FALSE, FALSE); /* Build the right font-button */ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, DEF_PAD_SMALL); frame = create_frame ("Options", vbox, GTK_ALIGN_FILL, GTK_ALIGN_CENTER); gtk_box_pack_start (GTK_BOX (rpane), frame, FALSE, TRUE, 0); size = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); context = gtk_widget_get_style_context (calendar); gtk_style_context_get (context, GTK_STATE_FLAG_NORMAL, GTK_STYLE_PROPERTY_FONT, &font_desc, NULL); font = pango_font_description_to_string (font_desc); button = gtk_font_button_new_with_font (font); g_free (font); pango_font_description_free (font_desc); g_signal_connect (button, "font-set", G_CALLBACK(calendar_select_font), &calendar_data); label = gtk_label_new_with_mnemonic ("_Font:"); gtk_label_set_mnemonic_widget (GTK_LABEL (label), button); gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_valign (label, GTK_ALIGN_CENTER); gtk_size_group_add_widget (size, label); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, DEF_PAD_SMALL); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); /* Color button */ gdk_rgba_parse(&rgba, "rgba(255, 0, 0, 1.0)"); button = gtk_color_button_new_with_rgba (&rgba); lunar_calendar_set_holiday_rgba(LUNAR_CALENDAR(calendar), &rgba); g_signal_connect (button, "color-set", G_CALLBACK(calendar_select_color), &calendar_data); label = gtk_label_new_with_mnemonic ("Holiday _Color:"); gtk_label_set_mnemonic_widget (GTK_LABEL (label), button); gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_valign (label, GTK_ALIGN_CENTER); gtk_size_group_add_widget (size, label); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, DEF_PAD_SMALL); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); /* Build the width entry */ button = gtk_spin_button_new_with_range (0, 127, 1); gtk_spin_button_set_value (GTK_SPIN_BUTTON (button), gtk_calendar_get_detail_width_chars (GTK_CALENDAR (calendar))); g_signal_connect (button, "value-changed", G_CALLBACK (detail_width_changed), &calendar_data); label = gtk_label_new_with_mnemonic ("Details W_idth:"); gtk_label_set_mnemonic_widget (GTK_LABEL (label), button); gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_valign (label, GTK_ALIGN_CENTER); gtk_size_group_add_widget (size, label); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, DEF_PAD_SMALL); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); /* Build the height entry */ button = gtk_spin_button_new_with_range (0, 127, 1); gtk_spin_button_set_value (GTK_SPIN_BUTTON (button), gtk_calendar_get_detail_height_rows (GTK_CALENDAR (calendar))); g_signal_connect (button, "value-changed", G_CALLBACK (detail_height_changed), &calendar_data); label = gtk_label_new_with_mnemonic ("Details H_eight:"); gtk_label_set_mnemonic_widget (GTK_LABEL (label), button); gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_valign (label, GTK_ALIGN_CENTER); gtk_size_group_add_widget (size, label); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, DEF_PAD_SMALL); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); #if 0 /* Build the right details frame */ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, DEF_PAD_SMALL); frame = create_frame ("Details", vbox, GTK_ALIGN_FILL, GTK_ALIGN_FILL); gtk_box_pack_start (GTK_BOX (rpane), frame, FALSE, TRUE, 0); details = gtk_text_view_new(); calendar_data.details_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (details)); calendar_data.details_changed = g_signal_connect (calendar_data.details_buffer, "changed", G_CALLBACK (calendar_details_changed), &calendar_data); scroller = gtk_scrolled_window_new (NULL, NULL); gtk_container_add (GTK_CONTAINER (scroller), details); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroller), GTK_SHADOW_IN); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroller), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_box_pack_start (GTK_BOX (vbox), scroller, FALSE, TRUE, 0); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, DEF_PAD_SMALL); gtk_widget_set_halign (hbox, GTK_ALIGN_START); gtk_widget_set_valign (hbox, GTK_ALIGN_CENTER); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); button = gtk_button_new_with_mnemonic ("Demonstrate _Details"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (demonstrate_details), &calendar_data); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0); button = gtk_button_new_with_mnemonic ("_Reset Details"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (reset_details), &calendar_data); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0); toggle = gtk_check_button_new_with_mnemonic ("_Use Details"); g_signal_connect (toggle, "toggled", G_CALLBACK(calendar_toggle_details), &calendar_data); gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, TRUE, 0); #endif /* Build the Right frame with the flags in */ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); frame = create_expander ("Flags", vbox, GTK_ALIGN_FILL, GTK_ALIGN_CENTER); gtk_box_pack_start (GTK_BOX (rpane), frame, TRUE, TRUE, 0); for (i = 0; i < G_N_ELEMENTS (calendar_data.settings); i++) { toggle = gtk_check_button_new_with_mnemonic(flags[i].label); gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, TRUE, 0); calendar_data.flag_checkboxes[i] = toggle; g_signal_connect (toggle, "toggled", G_CALLBACK (calendar_toggle_flag), &calendar_data); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), flags[i].init); } /* * Build the Signal-event part. */ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, DEF_PAD_SMALL); gtk_box_set_homogeneous (GTK_BOX (vbox), TRUE); frame = create_frame ("Signal Events", vbox, GTK_ALIGN_FILL, GTK_ALIGN_CENTER); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); label = gtk_label_new ("Signal:"); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); calendar_data.last_sig = gtk_label_new (""); gtk_box_pack_start (GTK_BOX (hbox), calendar_data.last_sig, FALSE, TRUE, 0); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); label = gtk_label_new ("Previous signal:"); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); calendar_data.prev_sig = gtk_label_new (""); gtk_box_pack_start (GTK_BOX (hbox), calendar_data.prev_sig, FALSE, TRUE, 0); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); label = gtk_label_new ("Second previous signal:"); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); calendar_data.prev2_sig = gtk_label_new (""); gtk_box_pack_start (GTK_BOX (hbox), calendar_data.prev2_sig, FALSE, TRUE, 0); /* * Glue everything together */ bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); button = gtk_button_new_with_label ("Close"); g_signal_connect (button, "clicked", G_CALLBACK (gtk_main_quit), NULL); gtk_container_add (GTK_CONTAINER (bbox), button); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, DEF_PAD_SMALL); gtk_box_pack_start (GTK_BOX (vbox), hpaned, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, TRUE, 0); gtk_container_add (GTK_CONTAINER (window), vbox); gtk_widget_set_can_default (button, TRUE); gtk_widget_grab_default (button); gtk_window_set_default_size (GTK_WINDOW (window), 600, 0); gtk_widget_show_all (window); } int main(int argc, char *argv[] ) { gtk_init (&argc, &argv); if (g_getenv ("GTK_RTL")) gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL); create_calendar(); gtk_main(); return(0); } /* example-end */