diff -Nru tickr-0.5.5/ChangeLog tickr-0.6.0/ChangeLog --- tickr-0.5.5/ChangeLog 2011-12-18 00:21:19.000000000 +0100 +++ tickr-0.6.0/ChangeLog 2012-03-07 02:01:00.000000000 +0100 @@ -1,3 +1,87 @@ +tickr version 0.6.0 +------------------- + +- Complete quick_feed_picker() stuff in tickr_quickfeedpicker.c. + (March 7 2012) + +- Swap win32 log files every hour to prevent generating huge ones. + Finally fix an old bug on win32. (March 5 2012) + +- Several little improvements/fixes in tickr_feedpicker.c. (March 5 2012) + +- New type FList (feed doubly-linked list) and associated functions + f_list_*() in tickr_list.c. Will replace confusing: char url_array[] / + char *p_url[] / char **p_url stuff in: tickr_main.c, tickr_feedpicker.c, + tickr_opml.c and tickr_resource.c. (March 5 2012) + +- Renaming 2 src files: + - tickr_rss.c -> tickr_feedparser.c + - tickr_rsswin.c -> tickr_feedpicker.c + (Feb 16 2012) + +- Add new func: win_with_progress_bar() (in tickr_otherwins.c) and use + it in feed list import thing (in tickr_opml.c) instead of + not-spinning-as-expected win_with_spinner(). (Feb 15 2012) + +- When opening the feed picker dialog, highlight and scroll to current + feed, plus several extra fixes and tweaks (in tickr_rsswin.c.) + (Feb 14 2012) + +- Add new func: highlight_and_go_to_row() (in tickr_quickfeedpicker.c.) + (Feb 14 2012) + +- Add new func: get_feed_index_in_selection() (in tickr_resource.c.) + (Feb 14 2012) + +- Add new module and func: tickr_quickfeedpicker.c: quick_feed_picker(). + (Feb 13 2012) + +- Add new func: question_win_at(). (Feb 13 2012) + +- Move 'Import/Export Preferences' from 'File' to 'Edit' in menu layout. + (Feb 13 2012) + +- Check/improve tickr_socket.c code and move typedefs, prototypes, error + codes, ... for tickr_socket.c into tickr_socket.h for modularity sake. + (Feb 12 2012) + +- Pause tickr (on mouse-over AND) when popup menu is opened. + (Feb 12 2012) + +- Change big_error() function (and prototype in libetm-0-4.3) to handle + variable number of args / change warning() the same way. + (Feb 12 2012) + +- Add new func: try_str_to_utf8() in tickr_rss.c + -> try to fix string when utf-8 validation fails. (Feb 9 2012) + +- Add new func: remove_trailing_whitespaces_from_str(char *) in + libetm-0.4.3/str_mem.c. (Feb 5 2012) + +- Change SEND_RECV_TIMEOUT to SEND_RECV_TIMEOUT_SEC and + SEND_RECV_TIMEOUT_USEC. (Feb 3 2012) + +- Change main window title: + 'app name and version num | feed title / file name' + -> + 'feed title / file name | app name and version num' + (Jan 21 2012) + +- In libetm-0.4.3: + - Compile with win32_specific.c only on win32 (fix empty unit + warning.) + - get_libetm_version() (function name modified.) (Jan 19 2012) + +- Fix a typo in debian/control Build-Depends: + 'debhelper (>= 7.O.50~)' instead of 'debhelper (>= 7.0.50~)' + which only shows up when trying to build for Lucid. (Dec 30 2011) + +- Split tickr_http.c into tickr_http.c and tickr_socket.c. (Dec 19 2011) + +- libetm-0.4.2 -> libetm-0.4.3: + Replace KB, MB, GB, TB with KiB, MiB, GiB, TiB. (Dec 18 2011) + + tickr version 0.5.5 ------------------- @@ -23,7 +107,7 @@ read them.) (Dec 16 2011) - 'HTTPS not supported' handling/warning added in tickr_http.c (fix bug: - program freezes whith HTTP redirects to HTTPS.) + program freezes with HTTP redirects to HTTPS.) (Dec 14 2011) - xml 'quick check' in tickr_http.c:format_quick_check() don't reject diff -Nru tickr-0.5.5/configure tickr-0.6.0/configure --- tickr-0.5.5/configure 2011-12-18 00:23:00.000000000 +0100 +++ tickr-0.6.0/configure 2012-03-07 02:01:00.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67 for tickr 0.5.5. +# Generated by GNU Autoconf 2.67 for tickr 0.6.0. # # Report bugs to . # @@ -552,8 +552,8 @@ # Identity of this package. PACKAGE_NAME='tickr' PACKAGE_TARNAME='tickr' -PACKAGE_VERSION='0.5.5' -PACKAGE_STRING='tickr 0.5.5' +PACKAGE_VERSION='0.6.0' +PACKAGE_STRING='tickr 0.6.0' PACKAGE_BUGREPORT='manutm007@gmail.com' PACKAGE_URL='' @@ -1252,7 +1252,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures tickr 0.5.5 to adapt to many kinds of systems. +\`configure' configures tickr 0.6.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1322,7 +1322,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of tickr 0.5.5:";; + short | recursive ) echo "Configuration of tickr 0.6.0:";; esac cat <<\_ACEOF @@ -1424,7 +1424,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -tickr configure 0.5.5 +tickr configure 0.6.0 generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1847,7 +1847,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by tickr $as_me 0.5.5, which was +It was created by tickr $as_me 0.6.0, which was generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -2662,7 +2662,7 @@ # Define the identity of the package. PACKAGE='tickr' - VERSION='0.5.5' + VERSION='0.6.0' cat >>confdefs.h <<_ACEOF @@ -4984,7 +4984,7 @@ fi -ac_config_files="$ac_config_files Makefile src/Makefile src/tickr/Makefile src/libetm-0.4.2/Makefile" +ac_config_files="$ac_config_files Makefile src/Makefile src/tickr/Makefile src/libetm-0.4.3/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -5508,7 +5508,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by tickr $as_me 0.5.5, which was +This file was extended by tickr $as_me 0.6.0, which was generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5574,7 +5574,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -tickr config.status 0.5.5 +tickr config.status 0.6.0 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" @@ -5708,7 +5708,7 @@ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/tickr/Makefile") CONFIG_FILES="$CONFIG_FILES src/tickr/Makefile" ;; - "src/libetm-0.4.2/Makefile") CONFIG_FILES="$CONFIG_FILES src/libetm-0.4.2/Makefile" ;; + "src/libetm-0.4.3/Makefile") CONFIG_FILES="$CONFIG_FILES src/libetm-0.4.3/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; esac diff -Nru tickr-0.5.5/configure.ac tickr-0.6.0/configure.ac --- tickr-0.5.5/configure.ac 2011-12-12 00:04:26.000000000 +0100 +++ tickr-0.6.0/configure.ac 2012-03-07 02:01:00.000000000 +0100 @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.67]) -AC_INIT([tickr], [0.5.5], [manutm007@gmail.com]) +AC_INIT([tickr], [0.6.0], [manutm007@gmail.com]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([config.h.in]) AC_CONFIG_HEADERS([config.h]) @@ -34,5 +34,5 @@ AC_CONFIG_FILES([Makefile src/Makefile src/tickr/Makefile - src/libetm-0.4.2/Makefile]) + src/libetm-0.4.3/Makefile]) AC_OUTPUT diff -Nru tickr-0.5.5/debian/changelog tickr-0.6.0/debian/changelog --- tickr-0.5.5/debian/changelog 2011-12-18 01:08:50.000000000 +0100 +++ tickr-0.6.0/debian/changelog 2012-03-07 02:01:00.000000000 +0100 @@ -1,3 +1,78 @@ +tickr (0.6.0-2) unstable; urgency=low + + * Complete quick_feed_picker() stuff in tickr_quickfeedpicker.c. + + * Swap win32 log files every hour to prevent generating huge ones. + Finally fix an old bug on win32. + + * Several little improvements/fixes in tickr_feedpicker.c. + + * New type FList (feed doubly-linked list) and associated functions + f_list_*() in tickr_list.c. Will replace confusing: char url_array[] / + char *p_url[] / char **p_url stuff in: tickr_main.c, tickr_feedpicker.c, + tickr_opml.c and tickr_resource.c. + + * Renaming 2 src files: + - tickr_rss.c -> tickr_feedparser.c + - tickr_rsswin.c -> tickr_feedpicker.c + + * Add new func: win_with_progress_bar() (in tickr_otherwins.c) and use + it in feed list import thing (in tickr_opml.c) instead of + not-spinning-as-expected win_with_spinner(). + + * When opening the feed picker dialog, highlight and scroll to current + feed, plus several extra fixes and tweaks (in tickr_rsswin.c.) + + * Add new func: highlight_and_go_to_row() (in tickr_quickfeedpicker.c.) + + * Add new func: get_feed_index_in_selection() (in tickr_resource.c.) + + * Add new module and func: tickr_quickfeedpicker.c: quick_feed_picker(). + + * Add new func: question_win_at(). + + * Move 'Import/Export Preferences' from 'File' to 'Edit' in menu layout. + + * Check/improve tickr_socket.c code and move typedefs, prototypes, + error codes, ... for tickr_socket.c into tickr_socket.h for + modularity sake. + + * Pause tickr (on mouse-over AND) when popup menu is opened. + + * Change big_error() function (and prototype in libetm-0-4.3) to + handle variable number of args / change warning() the same way. + + * Add new func: try_str_to_utf8() in tickr_rss.c + -> try to fix string when utf-8 validation fails. + + * Add new func: remove_trailing_whitespaces_from_str(char *) in + libetm-0.4.3/str_mem.c. + + * Change SEND_RECV_TIMEOUT to SEND_RECV_TIMEOUT_SEC and + SEND_RECV_TIMEOUT_USEC. + + * Change main window title: + 'app name and version num | feed title / file name' + -> + 'feed title / file name | app name and version num' + + * In libetm-0.4.3: + - Compile with win32_specific.c only on win32 (fix empty unit + warning.) + - get_libetm_version() (function name modified.) + + * Fix a typo in debian/control Build-Depends: + 'debhelper (>= 7.O.50~)' instead of 'debhelper (>= 7.0.50~)' + which only shows up when trying to build for Lucid. + + * Split tickr_http.c into tickr_http.c and tickr_socket.c. + + * libetm-0.4.2 -> libetm-0.4.3: + Replace KB, MB, GB, TB with KiB, MiB, GiB, TiB. + + -- Emmanuel Thomas-Maurin Wed, 07 Mar 2012 00:48:53 +0100 + + tickr (0.5.5-1) unstable; urgency=low * Implement new parameter: -Build-Depends: debhelper (>= 7.O.50~), autotools-dev, libgtk2.0-dev, libxml2-dev -Standards-Version: 3.9.2 +Build-Depends: debhelper (>= 7.0.50~), autotools-dev, libgtk2.0-dev, libxml2-dev +Standards-Version: 3.9.3 Homepage: http://www.newsrssticker.com Package: tickr Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} -Description: GTK-based highly graphically-customizable RSS Ticker - Tickr is a GTK-based RSS Reader that displays feeds as a smooth scrolling - line on your Desktop, as known from TV stations. Open feed links in your - favourite Browser. Graphics are highly customizable. +Description: GTK-based highly graphically-customizable Feed Ticker + Tickr is a GTK-based RSS/Atom Reader that displays feeds as a smooth + scrolling line on your Desktop, as known from TV stations. Open feed + links in your favourite Browser. Graphics are highly customizable. diff -Nru tickr-0.5.5/debian/copyright tickr-0.6.0/debian/copyright --- tickr-0.5.5/debian/copyright 2011-08-27 14:15:47.000000000 +0200 +++ tickr-0.6.0/debian/copyright 2012-03-07 02:01:00.000000000 +0100 @@ -1,11 +1,11 @@ -Format: http://anonscm.debian.org/viewvc/dep/web/deps/dep5.mdwn?revision=174&view=co +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: tickr Upstream-Contact: Emmanuel Thomas-Maurin Source: http://www.newsrssticker.com/unstable-debian/ Files: * -Copyright: 2009-2011 Emmanuel Thomas-Maurin -License: GPL-3 +Copyright: 2009-2012 Emmanuel Thomas-Maurin +License: GPL-3+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or diff -Nru tickr-0.5.5/debian/watch tickr-0.6.0/debian/watch --- tickr-0.5.5/debian/watch 2011-09-10 14:16:26.000000000 +0200 +++ tickr-0.6.0/debian/watch 2012-03-07 02:01:00.000000000 +0100 @@ -1,2 +1,2 @@ version=3 -http://www.newsrssticker.com/unstable-debian (.*)\.tar\.gz +http://www.newsrssticker.com/unstable-debian/ (.*)\.tar\.gz Binary files /tmp/LURWdlF6UT/tickr-0.5.5/images/other/news_icon0.png and /tmp/auHuAv9540/tickr-0.6.0/images/other/news_icon0.png differ Binary files /tmp/LURWdlF6UT/tickr-0.5.5/images/other/news_icon1.png and /tmp/auHuAv9540/tickr-0.6.0/images/other/news_icon1.png differ Binary files /tmp/LURWdlF6UT/tickr-0.5.5/images/other/news_logo1.png and /tmp/auHuAv9540/tickr-0.6.0/images/other/news_logo1.png differ Binary files /tmp/LURWdlF6UT/tickr-0.5.5/images/other/news_logo.png and /tmp/auHuAv9540/tickr-0.6.0/images/other/news_logo.png differ Binary files /tmp/LURWdlF6UT/tickr-0.5.5/images/other/NRT-logo.png and /tmp/auHuAv9540/tickr-0.6.0/images/other/NRT-logo.png differ Binary files /tmp/LURWdlF6UT/tickr-0.5.5/images/screenshots/news-maverick.png and /tmp/auHuAv9540/tickr-0.6.0/images/screenshots/news-maverick.png differ Binary files /tmp/LURWdlF6UT/tickr-0.5.5/images/screenshots/news-maverick.thumb.png and /tmp/auHuAv9540/tickr-0.6.0/images/screenshots/news-maverick.thumb.png differ Binary files /tmp/LURWdlF6UT/tickr-0.5.5/images/tickr-logo0.png and /tmp/auHuAv9540/tickr-0.6.0/images/tickr-logo0.png differ Binary files /tmp/LURWdlF6UT/tickr-0.5.5/images/tickr-logo.png and /tmp/auHuAv9540/tickr-0.6.0/images/tickr-logo.png differ Binary files /tmp/LURWdlF6UT/tickr-0.5.5/images/unused/tickr-logo2.png and /tmp/auHuAv9540/tickr-0.6.0/images/unused/tickr-logo2.png differ Binary files /tmp/LURWdlF6UT/tickr-0.5.5/images/website_logo/NRT-logo.png and /tmp/auHuAv9540/tickr-0.6.0/images/website_logo/NRT-logo.png differ diff -Nru tickr-0.5.5/install-on-win32 tickr-0.6.0/install-on-win32 --- tickr-0.5.5/install-on-win32 2011-12-11 23:52:36.000000000 +0100 +++ tickr-0.6.0/install-on-win32 2012-03-07 02:01:00.000000000 +0100 @@ -1,26 +1,33 @@ #! /bin/bash runtime="gtk2-win32-full-runtime" -if [ -e "$runtime" ]; then +dlls="dlls" - cp win32_install_stuff/Makefile-libetm-win32 src/libetm-0.4.2/Makefile +if [ ! -e "$runtime" ]; then + echo "You must copy "$runtime" under tickr-0.6.x/" + exit 1 +elif [ ! -e "win32_install_stuff/$dlls" ]; then + echo "You must copy "$dlls" under tickr-0.6.x/win32_install_stuff/" + exit 2 +else + cp win32_install_stuff/Makefile-libetm-win32 src/libetm-0.4.3/Makefile cp win32_install_stuff/Makefile-tickr-win32 src/tickr/Makefile - cp win32_install_stuff/build-win32-installer src/tickr/build-win32-installer - cp win32_install_stuff/installer.iss ./installer.iss - cd src/libetm-0.4.2 + cp win32_install_stuff/build-win32-installer src/tickr/ + cp win32_install_stuff/installer.iss ./ + cp win32_install_stuff/LICENSE ./ + cd src/libetm-0.4.3 make cd ../tickr make ./build-win32-installer make clean - cd ../libetm-0.4.2 + cd ../libetm-0.4.3 make clean cd ../.. - rm src/libetm-0.4.2/Makefile + rm src/libetm-0.4.3/Makefile rm src/tickr/Makefile rm src/tickr/build-win32-installer rm installer.iss - -else - echo "You must copy "$runtime" under tickr-0.5.x/" + rm LICENSE + exit 0 fi diff -Nru tickr-0.5.5/README tickr-0.6.0/README --- tickr-0.5.5/README 2011-09-10 00:20:30.000000000 +0200 +++ tickr-0.6.0/README 2012-03-07 02:01:00.000000000 +0100 @@ -1,7 +1,7 @@ 1 - BUILDING TICKER FROM SOURCES -on Linux: ---------- +on Linux +-------- Required packages are GTK+ and Libxml2 (development ones.) Then do: @@ -11,8 +11,8 @@ (make clean) -on Windows: ------------ +on Windows +---------- You will have to install MinGW and GTK development stuff (headers and libs.) You will also need inno setup and reshacker (reshacker.exe must @@ -38,7 +38,16 @@ (it will build the win32 installer.) -2 - APPLICATION NAME +2 - INSTALL DIRS DEFINED IN + +- tickr.desktop +- debian/install +- debian/menu +- src/tickr/tickr.h +- src/tickr/Makefile.am + + +3 - APPLICATION NAME source/binary package name and command @@ -48,18 +57,18 @@ new name: tickr first released version: 0.5.3 -in src/tickr: all source files still begin with news_ and are unlikely -to be renamed +in src/tickr: all source files have now been renamed: +news_*.c/h -> tickr_*/c/h app name and dirs are all (?) defined in news.h (at least they should be) -3 - UBUNTU KARMIC AND JAUNTY +4 - UBUNTU KARMIC AND JAUNTY compile with #define WITHOUT_GTK_SPINNER -4 - WIDGET PACKING +5 - WIDGET PACKING now: diff -Nru tickr-0.5.5/run_bug tickr-0.6.0/run_bug --- tickr-0.5.5/run_bug 2011-12-13 03:07:29.000000000 +0100 +++ tickr-0.6.0/run_bug 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -#! /bin/bash -x -src/tickr/tickr http://www.linux.com/news/software/linux-kernel?format=feed&type=rss diff -Nru tickr-0.5.5/src/libetm-0.4.2/COPYING tickr-0.6.0/src/libetm-0.4.2/COPYING --- tickr-0.5.5/src/libetm-0.4.2/COPYING 2011-04-14 06:02:33.000000000 +0200 +++ tickr-0.6.0/src/libetm-0.4.2/COPYING 1970-01-01 01:00:00.000000000 +0100 @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff -Nru tickr-0.5.5/src/libetm-0.4.2/error.c tickr-0.6.0/src/libetm-0.4.2/error.c --- tickr-0.5.5/src/libetm-0.4.2/error.c 2011-05-08 16:52:13.000000000 +0200 +++ tickr-0.6.0/src/libetm-0.4.2/error.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,65 +0,0 @@ -/* - * libetm-0.4 / error.c - Copyright (C) Emmanuel Thomas-Maurin 2008-2011 - * - * - * - error handling - - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include -#include "libetm.h" - -/* - * "critical" error handler for lib that will call big_error() function defined in app - * so that appropiate behaviour can be choosen (would it be better to implement a variadic func?) - */ -int big_error_in_lib(lib_error_code error_code, const char *str) -{ - /* only call big_error() in app */ - /*if (error_code > LIBETM_OK && error_code < LIBETM_LASTERRORCODE) - fprintf(stderr, "CRITICAL ERROR: Libetm:%s: %s\n", str, get_lib_error_str(error_code));*/ - big_error(error_code, str, "", "", ""); - return error_code; -} - -const char *get_lib_error_str(lib_error_code error_code) -{ - /* - * *** make sure this array matches the lib errors enum *** - */ - static char *lib_error_str[] = { - "OK", - "Out of memory", - "Zero requested size", - /*"Negative requested size",*/ - "Null destination string", - "Source string = destination string", - "Strings overlap", - "Attempting to free a null pointer", -#ifdef WIN32_V - "Can't find Win32 Registry Key", - "Can't create Win32 Registry Key", - "Can't save Win32 Registry Key", - "Win32 Registry Key error (undetermined)", -#endif - "OK" - }; - - if (error_code <= LIBETM_LASTERRORCODE) - return (const char *)lib_error_str[error_code]; - else - return ""; -} diff -Nru tickr-0.5.5/src/libetm-0.4.2/error.h tickr-0.6.0/src/libetm-0.4.2/error.h --- tickr-0.5.5/src/libetm-0.4.2/error.h 2011-11-24 19:52:58.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.2/error.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,58 +0,0 @@ -/* - * libetm-0.4 / error.h - Copyright (C) Emmanuel Thomas-Maurin 2008-2011 - * . - */ - -#ifndef INC_LIBETM_ERROR_H -#define INC_LIBETM_ERROR_H - -typedef enum { - LIBETM_OK, - OUT_OF_MEMORY, - ZERO_RQ_SIZE, - /*NEG_RQ_SIZE,*/ - NULL_DEST, - SRC_EQ_DEST, - STR_OVERLAP, - NULL_POINTER_FREE, - RNDSTR_UNKNOWN_MODE, -#ifdef WIN32_V - WIN32REGKEY_NOT_FOUND, - WIN32REGKEY_CREATE_ERROR, - WIN32REGKEY_SAVE_ERROR, - WIN32REGKEY_OTHER_ERROR, -#endif - LIBETM_LASTERRORCODE -} lib_error_code; - -/* - * app defined "fatal" error handler prototype - * error code from app should enum above LIB_LASTERRORCODE - */ -int big_error(int, const char *, const char *, const char *, const char *); - -/* - * this will call big_error() function defined in app - */ -int big_error_in_lib(lib_error_code, const char *); - -/* - * if error code > LIBETM_LASTERRORCODE, returns "" - */ -const char *get_lib_error_str(lib_error_code); -#endif /* INC_LIBETM_ERROR_H */ diff -Nru tickr-0.5.5/src/libetm-0.4.2/error_handler_example.c tickr-0.6.0/src/libetm-0.4.2/error_handler_example.c --- tickr-0.5.5/src/libetm-0.4.2/error_handler_example.c 2011-05-08 16:58:16.000000000 +0200 +++ tickr-0.6.0/src/libetm-0.4.2/error_handler_example.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,39 +0,0 @@ -/* - * this func's prototype is in libetm / error.h - * this func is not defined in libetm but in app and it handles errors - * from libetm and app - */ -int big_error(int error_code, const char *str1, const char *str2, const char *str3, const char *str4) -{ - char error_str[64 * 6 + 1]; - - str_n_cpy(error_str, "FATAL ERROR: ", 16); - if (error_code >= LIBETM_OK && error_code <= LIBETM_LASTERRORCODE) - str_n_cat(error_str, "Libetm:", 16); - else - str_n_cat(error_str, "App:", 16); - if (str1[0] != '\0') { - str_n_cat(error_str, " ", 1); - str_n_cat(error_str, str1, 63); - } - if (str2[0] != '\0') { - str_n_cat(error_str, " ", 1); - str_n_cat(error_str, str2, 63); - } - if (str3[0] != '\0') { - str_n_cat(error_str, " ", 1); - str_n_cat(error_str, str3, 63); - } - if (str4[0] != '\0') { - str_n_cat(error_str, " ", 1); - str_n_cat(error_str, str4, 63); - } - if (error_code >= LIBETM_OK && error_code <= LIBETM_LASTERRORCODE) { - str_n_cat(error_str, ": ", 2); - str_n_cat(error_str, get_lib_error_str(error_code), 62); - } - str_n_cat(error_str, " - Will quit now", 32); - - fprintf(stderr, "%s\n", error_str); - exit(error_code); -} diff -Nru tickr-0.5.5/src/libetm-0.4.2/libetm.h tickr-0.6.0/src/libetm-0.4.2/libetm.h --- tickr-0.5.5/src/libetm-0.4.2/libetm.h 2011-11-29 18:33:30.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.2/libetm.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,72 +0,0 @@ -/* - * libetm-0.4 / libetm.h - Copyright (C) Emmanuel Thomas-Maurin 2008-2011 - * - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef INC_LIBETM_H -#define INC_LIBETM_H - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif -#ifndef _ISOC99_SOURCE -#define _ISOC99_SOURCE -#endif - -#ifndef FALSE -# ifndef TRUE -# define FALSE (0) -# define TRUE (!FALSE) -# endif -#endif - -/* would it be better like that? -#undef FALSE -#undef TRUE -typedef enum { - FALSE = (0), TRUE = (!FALSE) -} boolean;*/ - -#define YES (1) -#define NO (0) - -#ifndef MAX -# define MAX(x,y) ((x) > (y) ? (x) : (y)) -#endif - -#ifndef MIN -# define MIN(x,y) ((x) < (y) ? (x) : (y)) -#endif - -#ifndef ABS -# define ABS(x) ((x) > 0 ? (x) : -(x)) -#endif - -/* do more testing for these following 2 */ -#ifndef SIGN -# define SIGN(x) ((x) != 0 ? ((x) > 0 ? 1 : -1) : 0) -#endif - -/* only if f > 0 */ -#ifndef APPROX -# define APPROX(f) (ABS(((f) - (int)(f)) > 0.5) ? (int)(f) + SIGN((f)) : (int)(f)) -#endif - -#include "str_mem.h" -#include "misc.h" -#include "error.h" -#include "win32_specific.h" -#endif /* INC_LIBETM_H */ diff -Nru tickr-0.5.5/src/libetm-0.4.2/Makefile.am tickr-0.6.0/src/libetm-0.4.2/Makefile.am --- tickr-0.5.5/src/libetm-0.4.2/Makefile.am 2011-11-30 13:10:17.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.2/Makefile.am 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ -libs_LIBRARIES = libetm.a -libetm_a_SOURCES = str_mem.c error.c misc.c win32_specific.c -libetm_a_CFLAGS = -O2 -Wall -Wextra -Wunused-parameter -Wshadow\ - -Wpointer-arith -ffast-math -pedantic -libsdir = .. diff -Nru tickr-0.5.5/src/libetm-0.4.2/Makefile.in tickr-0.6.0/src/libetm-0.4.2/Makefile.in --- tickr-0.5.5/src/libetm-0.4.2/Makefile.in 2011-12-12 00:05:02.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.2/Makefile.in 1970-01-01 01:00:00.000000000 +0100 @@ -1,544 +0,0 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -subdir = src/libetm-0.4.2 -DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - COPYING -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__installdirs = "$(DESTDIR)$(libsdir)" -LIBRARIES = $(libs_LIBRARIES) -AR = ar -ARFLAGS = cru -libetm_a_AR = $(AR) $(ARFLAGS) -libetm_a_LIBADD = -am_libetm_a_OBJECTS = libetm_a-str_mem.$(OBJEXT) \ - libetm_a-error.$(OBJEXT) libetm_a-misc.$(OBJEXT) \ - libetm_a-win32_specific.$(OBJEXT) -libetm_a_OBJECTS = $(am_libetm_a_OBJECTS) -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libetm_a_SOURCES) -DIST_SOURCES = $(libetm_a_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -GREP = @GREP@ -GTK2_CFLAGS = @GTK2_CFLAGS@ -GTK2_LIBS = @GTK2_LIBS@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XMKMF = @XMKMF@ -XML2_CFLAGS = @XML2_CFLAGS@ -XML2_LIBS = @XML2_LIBS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build_alias = @build_alias@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host_alias = @host_alias@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -libs_LIBRARIES = libetm.a -libetm_a_SOURCES = str_mem.c error.c misc.c win32_specific.c -libetm_a_CFLAGS = -O2 -Wall -Wextra -Wunused-parameter -Wshadow\ - -Wpointer-arith -ffast-math -pedantic - -libsdir = .. -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/libetm-0.4.2/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/libetm-0.4.2/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -install-libsLIBRARIES: $(libs_LIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(libsdir)" || $(MKDIR_P) "$(DESTDIR)$(libsdir)" - @list='$(libs_LIBRARIES)'; test -n "$(libsdir)" || list=; \ - list2=; for p in $$list; do \ - if test -f $$p; then \ - list2="$$list2 $$p"; \ - else :; fi; \ - done; \ - test -z "$$list2" || { \ - echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(libsdir)'"; \ - $(INSTALL_DATA) $$list2 "$(DESTDIR)$(libsdir)" || exit $$?; } - @$(POST_INSTALL) - @list='$(libs_LIBRARIES)'; test -n "$(libsdir)" || list=; \ - for p in $$list; do \ - if test -f $$p; then \ - $(am__strip_dir) \ - echo " ( cd '$(DESTDIR)$(libsdir)' && $(RANLIB) $$f )"; \ - ( cd "$(DESTDIR)$(libsdir)" && $(RANLIB) $$f ) || exit $$?; \ - else :; fi; \ - done - -uninstall-libsLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(libs_LIBRARIES)'; test -n "$(libsdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(libsdir)' && rm -f "$$files" )"; \ - cd "$(DESTDIR)$(libsdir)" && rm -f $$files - -clean-libsLIBRARIES: - -test -z "$(libs_LIBRARIES)" || rm -f $(libs_LIBRARIES) -libetm.a: $(libetm_a_OBJECTS) $(libetm_a_DEPENDENCIES) - -rm -f libetm.a - $(libetm_a_AR) libetm.a $(libetm_a_OBJECTS) $(libetm_a_LIBADD) - $(RANLIB) libetm.a - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libetm_a-error.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libetm_a-misc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libetm_a-str_mem.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libetm_a-win32_specific.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -libetm_a-str_mem.o: str_mem.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -MT libetm_a-str_mem.o -MD -MP -MF $(DEPDIR)/libetm_a-str_mem.Tpo -c -o libetm_a-str_mem.o `test -f 'str_mem.c' || echo '$(srcdir)/'`str_mem.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libetm_a-str_mem.Tpo $(DEPDIR)/libetm_a-str_mem.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='str_mem.c' object='libetm_a-str_mem.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -c -o libetm_a-str_mem.o `test -f 'str_mem.c' || echo '$(srcdir)/'`str_mem.c - -libetm_a-str_mem.obj: str_mem.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -MT libetm_a-str_mem.obj -MD -MP -MF $(DEPDIR)/libetm_a-str_mem.Tpo -c -o libetm_a-str_mem.obj `if test -f 'str_mem.c'; then $(CYGPATH_W) 'str_mem.c'; else $(CYGPATH_W) '$(srcdir)/str_mem.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libetm_a-str_mem.Tpo $(DEPDIR)/libetm_a-str_mem.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='str_mem.c' object='libetm_a-str_mem.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -c -o libetm_a-str_mem.obj `if test -f 'str_mem.c'; then $(CYGPATH_W) 'str_mem.c'; else $(CYGPATH_W) '$(srcdir)/str_mem.c'; fi` - -libetm_a-error.o: error.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -MT libetm_a-error.o -MD -MP -MF $(DEPDIR)/libetm_a-error.Tpo -c -o libetm_a-error.o `test -f 'error.c' || echo '$(srcdir)/'`error.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libetm_a-error.Tpo $(DEPDIR)/libetm_a-error.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='error.c' object='libetm_a-error.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -c -o libetm_a-error.o `test -f 'error.c' || echo '$(srcdir)/'`error.c - -libetm_a-error.obj: error.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -MT libetm_a-error.obj -MD -MP -MF $(DEPDIR)/libetm_a-error.Tpo -c -o libetm_a-error.obj `if test -f 'error.c'; then $(CYGPATH_W) 'error.c'; else $(CYGPATH_W) '$(srcdir)/error.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libetm_a-error.Tpo $(DEPDIR)/libetm_a-error.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='error.c' object='libetm_a-error.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -c -o libetm_a-error.obj `if test -f 'error.c'; then $(CYGPATH_W) 'error.c'; else $(CYGPATH_W) '$(srcdir)/error.c'; fi` - -libetm_a-misc.o: misc.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -MT libetm_a-misc.o -MD -MP -MF $(DEPDIR)/libetm_a-misc.Tpo -c -o libetm_a-misc.o `test -f 'misc.c' || echo '$(srcdir)/'`misc.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libetm_a-misc.Tpo $(DEPDIR)/libetm_a-misc.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc.c' object='libetm_a-misc.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -c -o libetm_a-misc.o `test -f 'misc.c' || echo '$(srcdir)/'`misc.c - -libetm_a-misc.obj: misc.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -MT libetm_a-misc.obj -MD -MP -MF $(DEPDIR)/libetm_a-misc.Tpo -c -o libetm_a-misc.obj `if test -f 'misc.c'; then $(CYGPATH_W) 'misc.c'; else $(CYGPATH_W) '$(srcdir)/misc.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libetm_a-misc.Tpo $(DEPDIR)/libetm_a-misc.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc.c' object='libetm_a-misc.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -c -o libetm_a-misc.obj `if test -f 'misc.c'; then $(CYGPATH_W) 'misc.c'; else $(CYGPATH_W) '$(srcdir)/misc.c'; fi` - -libetm_a-win32_specific.o: win32_specific.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -MT libetm_a-win32_specific.o -MD -MP -MF $(DEPDIR)/libetm_a-win32_specific.Tpo -c -o libetm_a-win32_specific.o `test -f 'win32_specific.c' || echo '$(srcdir)/'`win32_specific.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libetm_a-win32_specific.Tpo $(DEPDIR)/libetm_a-win32_specific.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='win32_specific.c' object='libetm_a-win32_specific.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -c -o libetm_a-win32_specific.o `test -f 'win32_specific.c' || echo '$(srcdir)/'`win32_specific.c - -libetm_a-win32_specific.obj: win32_specific.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -MT libetm_a-win32_specific.obj -MD -MP -MF $(DEPDIR)/libetm_a-win32_specific.Tpo -c -o libetm_a-win32_specific.obj `if test -f 'win32_specific.c'; then $(CYGPATH_W) 'win32_specific.c'; else $(CYGPATH_W) '$(srcdir)/win32_specific.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libetm_a-win32_specific.Tpo $(DEPDIR)/libetm_a-win32_specific.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='win32_specific.c' object='libetm_a-win32_specific.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -c -o libetm_a-win32_specific.obj `if test -f 'win32_specific.c'; then $(CYGPATH_W) 'win32_specific.c'; else $(CYGPATH_W) '$(srcdir)/win32_specific.c'; fi` - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - set x; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(libsdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libsLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-libsLIBRARIES - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-libsLIBRARIES - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libsLIBRARIES ctags distclean distclean-compile \ - distclean-generic distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-libsLIBRARIES install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-libsLIBRARIES - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru tickr-0.5.5/src/libetm-0.4.2/Makefile-libetm-linux tickr-0.6.0/src/libetm-0.4.2/Makefile-libetm-linux --- tickr-0.5.5/src/libetm-0.4.2/Makefile-libetm-linux 2011-11-30 13:12:43.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.2/Makefile-libetm-linux 1970-01-01 01:00:00.000000000 +0100 @@ -1,33 +0,0 @@ -# Makefile for libetm-0.4 - Linux version - -src = str_mem.c error.c misc.c win32_specific.c -obj = $(src:.c=.o) -headers = libetm.h $(src:.c=.h) - -CC = gcc - -CFLAGS = -O2 -Wall -Wextra -Wunused-parameter -Wshadow -Wpointer-arith\ - -ffast-math -pedantic - -all: libetm.a - -$(obj): $(src) $(headers) Makefile - $(CC) $(CFLAGS) -c $(src) - -libetm.a: $(obj) - ar -r libetm.a $(obj) - -.PHONY: install -install: - mkdir -p /usr/local/include/libetm - cp $(headers) /usr/local/include/libetm/ - cp libetm.a /usr/local/lib/ - -.PHONY: uninstall -uninstall: - rm /usr/local/include/libetm/$(headers) - rm /usr/local/lib/libetm.a - -.PHONY: clean -clean: - rm $(obj) libetm.a diff -Nru tickr-0.5.5/src/libetm-0.4.2/Makefile-libetm-win32 tickr-0.6.0/src/libetm-0.4.2/Makefile-libetm-win32 --- tickr-0.5.5/src/libetm-0.4.2/Makefile-libetm-win32 2011-12-11 23:51:13.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.2/Makefile-libetm-win32 1970-01-01 01:00:00.000000000 +0100 @@ -1,28 +0,0 @@ -# Makefile for libetm-0.4.2 - win32 version - -src = str_mem.c error.c misc.c win32_specific.c -obj = $(src:.c=.o) -headers = libetm.h $(src:.c=.h) - -CC = gcc - -CFLAGS = -O2 -Wall -Wextra -Wunused-parameter -Wshadow -Wpointer-arith\ - -ffast-math -pedantic -D WIN32_V - -all: libetm.a - -$(obj): $(src) $(headers) Makefile - $(CC) $(CFLAGS) -c $(src) - -libetm.a: $(obj) - ar -r libetm.a $(obj) - -.PHONY: install -install: - mkdir -p /usr/local/include/libetm - cp $(headers) /usr/local/include/libetm/ - cp libetm.a /usr/local/lib/ - -.PHONY: clean -clean: - rm $(obj) libetm.a diff -Nru tickr-0.5.5/src/libetm-0.4.2/misc.c tickr-0.6.0/src/libetm-0.4.2/misc.c --- tickr-0.5.5/src/libetm-0.4.2/misc.c 2011-05-12 12:00:24.000000000 +0200 +++ tickr-0.6.0/src/libetm-0.4.2/misc.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,59 +0,0 @@ -/* - * libetm-0.4 / misc.c - Copyright (C) Emmanuel Thomas-Maurin 2008-2011 - * - * - * - misc functions - - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include -#include "libetm.h" - -#define LIBETM_VERSION "Libetm-0.4" - -const char *lib_version(unsigned int i) -{ - static const char *libv[] = { - LIBETM_VERSION, - "Copyright (C) Emmanuel Thomas-Maurin 2008-2011\nmanutm007@gmail.com\n" - "This program comes with ABSOLUTELY NO WARRANTY. This is free software, and\n" - "you are welcome to redistribute it under certain conditions; see COPYING for\n" - "details.", - "Compiled on "__DATE__" - "__TIME__, - }; - - if (i < sizeof(libv) / sizeof(libv[0])) - return (const char *)libv[i]; - else - return NULL; -} - -int question(const char *str) -{ - int i, c; - - while (1) { - printf("%s [y/n] ? ", str); - i = fgetc(stdin); - c = tolower(i); - while (i != '\n' && i != EOF) - (i = fgetc(stdin)); - if (c == 'y') - return TRUE; - else if (c == 'n') - return FALSE; - } -} diff -Nru tickr-0.5.5/src/libetm-0.4.2/misc.h tickr-0.6.0/src/libetm-0.4.2/misc.h --- tickr-0.5.5/src/libetm-0.4.2/misc.h 2011-11-24 19:54:21.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.2/misc.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -/* - * libetm-0.4 / misc.h - Copyright (C) Emmanuel Thomas-Maurin 2008-2011 - * - * - * - misc functions - - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef INC_LIBETM_MISC_H -#define INC_LIBETM_MISC_H - -const char *lib_version(unsigned int); -int question(const char *); -#endif /* INC_LIBETM_MISC_H */ diff -Nru tickr-0.5.5/src/libetm-0.4.2/README tickr-0.6.0/src/libetm-0.4.2/README --- tickr-0.5.5/src/libetm-0.4.2/README 2011-04-14 06:00:48.000000000 +0200 +++ tickr-0.6.0/src/libetm-0.4.2/README 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -This is only a tiny lib with a few functions I use a lot. diff -Nru tickr-0.5.5/src/libetm-0.4.2/str_mem.c tickr-0.6.0/src/libetm-0.4.2/str_mem.c --- tickr-0.5.5/src/libetm-0.4.2/str_mem.c 2011-12-12 00:13:44.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.2/str_mem.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,325 +0,0 @@ -/* - * libetm-0.4 / str_mem.c - Copyright (C) Emmanuel Thomas-Maurin 2008-2011 - * - * - * - some strings and memory management functions - - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include -#include -#include -#include "libetm.h" - -/* - * copy n bytes max from src to dest then add '\0' at the end of dest - */ -char *str_n_cpy(char *dest, const char *src, size_t length) -{ - char *dest_bak = dest; - - if (dest == NULL) - big_error_in_lib(NULL_DEST, "str_n_cpy()"); - - while (length-- > 0 && *src != '\0') - *dest++ = *src++; - - *dest = '\0'; - - return dest_bak; -} - -/* - * concanate n bytes max of src to dest then add '\0' at the end of dest - * strings may not be identical and should not overlap - */ -char *str_n_cat(char *dest, const char *src, size_t length) -{ - char *dest_bak = dest; - - if (dest == NULL) - big_error_in_lib(NULL_DEST, "str_n_cat()"); - else if (src == dest) - big_error_in_lib(SRC_EQ_DEST, "str_n_cat()"); - - while (*dest++ != '\0'); - - str_n_cpy(dest - 1, src, length); - - return dest_bak; -} - -/* - * create new_l_str (allocate memory) and copy str (can be NULL) to new_l_str - */ -char *l_str_new(const char *str) -{ - char *new_l_str; - size_t str_len; - - if (str == NULL) - str_len = 0; - else - str_len = strlen(str); - - new_l_str = malloc2(sizeof(char) * (str_len + 1)); - - return str_n_cpy(new_l_str, str, str_len); -} - -/* - * append l_str_src (can be NULL) to l_str_dest (re-allocate memory as necessary) - * l_str_dest must have been created by l_str_new - strings may overlap - */ -char *l_str_cat(char *l_str_dest, const char *l_str_src) -{ - char *new_l_str, *l_str_src2; - size_t src_len, dest_len; - - if (l_str_dest == NULL) - big_error_in_lib(NULL_DEST, "l_str_cat()"); - else if (l_str_src == NULL) - return l_str_dest; - - l_str_src2 = l_str_new(l_str_src); - src_len = strlen(l_str_src); - if (src_len == 0) - return l_str_dest; - dest_len = strlen(l_str_dest); - - new_l_str = realloc2(l_str_dest, sizeof(char) * (dest_len + src_len + 1)); - new_l_str = str_n_cat(new_l_str, l_str_src2, src_len); - l_str_free(l_str_src2); - - return new_l_str; -} - -/* - * free string created by l_str_new() or l_str_cat() - */ -void l_str_free(char *l_str) -{ - if (l_str != NULL) - free(l_str); - else - big_error_in_lib(NULL_POINTER_FREE, "l_str_free()"); - l_str = NULL; -} - -/* - * wrappers for malloc(), realloc(), calloc() and free() which check returned value - */ -void *malloc2(size_t size) -{ - void *free_block = NULL; - - if (size == 0) - big_error_in_lib(ZERO_RQ_SIZE, "malloc2()"); - /*else if (size < 0) - big_error_in_lib(NEG_RQ_SIZE, "malloc2()");*/ - else if ((free_block = malloc(size)) == NULL) - big_error_in_lib(OUT_OF_MEMORY, "malloc2()"); - - return free_block; -} - -void *realloc2(void *free_block, size_t size) -{ - void *tmp = free_block; - - if (size == 0) - big_error_in_lib(ZERO_RQ_SIZE, "realloc2()"); - /*else if (size < 0) - big_error_in_lib(NEG_RQ_SIZE, "realloc2()");*/ - else if ((free_block = realloc(free_block, size)) == NULL) { - free2(tmp); - big_error_in_lib(OUT_OF_MEMORY, "realloc2()"); - } - - return free_block; -} - -void *calloc2(size_t n_elements, size_t element_size) -{ - void *free_block = NULL; - size_t size = n_elements * element_size; - - if (size == 0) - big_error_in_lib(ZERO_RQ_SIZE, "calloc2()"); - /*else if (size < 0) - big_error_in_lib(NEG_RQ_SIZE, "calloc2()");*/ - else if ((free_block = malloc2(size)) != NULL) - memset(free_block, 0, size); - - return free_block; -} - -void free2(void *free_block) -{ - if (free_block != NULL) - free(free_block); - else - big_error_in_lib(NULL_POINTER_FREE, "free2()"); - - free_block = NULL; -} - -/* - * return size in readable format (KB, MB, GB, TB) - * *** allow up to 16 simultaneous calls *** - * convention: we assume 2.5 MB = 2 MB + [0.5 x 1024 = 512] KB, not 500 KB - * otherwise, there is no way to express a value in the range 1000 - 1023 - * so x.y MB = x MB + 0.y MB, that is: not y x 100 KB but y x 102.4 KB - * (isn't this a bit confusing?) - */ -const char *readable_size(double size_bytes) -{ - /* we use an array of 16 strings to store the returned string in order - * to allow 16 simultaneous calls (should be enough in most cases?) - * otherwise, sth like: - * printf("size1 = %s / size2 = %s\n", readable_size(size1), readable_size(size2)) - * would produce unpredictable / false results (like readable sizes are - * equal whereas sizes are different - */ - static char lib_static_str[16][128]; - unsigned long size_KB, size_MB, size_GB, size_TB; - static int count = -1; - - count++; - count &= 15; - - size_KB = (unsigned long)(size_bytes / 1024); - size_MB = size_KB / 1024; - size_GB = size_MB / 1024; - size_TB = size_GB / 1024; - - if (size_TB >= 1) - snprintf(lib_static_str[count], 128, "%ld.%ld TB", - size_TB, ((size_GB - size_TB * 1024) * 10) / 1024); - else if (size_GB >= 1) - snprintf(lib_static_str[count], 128, "%ld.%ld GB", - size_GB, ((size_MB - size_GB * 1024) * 10) / 1024); - else if (size_MB >= 1) - snprintf(lib_static_str[count], 128, "%ld.%ld MB", - size_MB, ((size_KB - size_MB * 1024) * 10) / 1024); - else if (size_KB >= 1) - snprintf(lib_static_str[count], 128, "%ld.%ld KB", - size_KB, (unsigned long)((size_bytes - size_KB * 1024) * 10) / 1024); - else - snprintf(lib_static_str[count], 128, "%.0f bytes", size_bytes); - - return (const char *)lib_static_str[count]; -} - -/* - * itoa() is not ansi c so this one could be useful - * *** allow up to 16 simultaneous calls *** - */ -const char *itoa2(long int n) -{ - /* array of 16 strings (like for readable_size() - see above) */ - static char lib_static_str[16][128]; - static int count = -1; - - count++; - count &= 15; - snprintf(lib_static_str[count], 128, "%ld", n); - return (const char *)lib_static_str[count]; -} - -void remove_char_from_str(char *str, char c) -{ - int i, len = strlen(str); - - for (i = 0; i < len && str[i] != '\0';) { - if (str[i] == c) - str_n_cpy(str + i, (const char *)(str + i + 1), len - i); - else - i++; - } -} - -/* - * very basic xor sym encryption for small strings (up to 511 chars) - * *** key must be ascii / if 2 chars match (in str and key) the string is cut *** - * *** allow up to 16 simultaneous calls *** - * works with ascii strings, probably not otherwise so don't try with - * exotic things... - */ -const char *str_crypt(const char *str, const char *key) -{ - /* array of 16 strings (like for readable_size() - see above) */ - static char str2[16][512]; - static int count = -1; - int i, j; - - count++; - count &= 15; - for (i = 0, j = 0; i < 511 && str[i] != '\0'; i++) { - if (key[j] == '\0') - j = 0; - str2[count][i] = str[i] ^ key[j++]; - } - str2[count][i] = '\0'; - return (const char *)str2[count]; -} - -/* - * very basic crypto hash - */ -unsigned long str_crypto_hash(const char *str, const char* salt) -{ - char *str2; - unsigned long hash = 0; - int i = 0; - - str2 = (char *)str_crypt(str, salt); - while (str2[i] != '\0') { - hash += str2[i] * 1024 + (str2[i] + 128) * (32 + i) + str2[i] - 1; - i ++; - } - return hash; -} - -/* - * generate a random string up to 1023 chars long - * mode = a -> alpha / d -> digits / b -> both - */ -const char *rnd_str(char mode, int length) -{ - static char str[1024]; - char str_a[65] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijkl"; - char str_d[17] = "1234567890123456"; - char str_b[65] = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ00"; - int i = 0; - - if (length > 1023) - length = 1023; - srand(time(0)); - if (mode == 'a') { - while (i < length) - str[i++] = str_a[rand() & 63]; - } else if (mode == 'd') { - while (i < length) - str[i++] = str_d[rand() & 15]; - } else if (mode == 'b') { - while (i < length) - str[i++] = str_b[rand() & 63]; - } else - big_error_in_lib(RNDSTR_UNKNOWN_MODE, "rnd_str()"); - str[i] = '\0'; - return str; -} diff -Nru tickr-0.5.5/src/libetm-0.4.2/str_mem.h tickr-0.6.0/src/libetm-0.4.2/str_mem.h --- tickr-0.5.5/src/libetm-0.4.2/str_mem.h 2011-12-12 00:13:35.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.2/str_mem.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,96 +0,0 @@ -/* - * libetm-0.4 / str_mem.h - Copyright (C) Emmanuel Thomas-Maurin 2008-2011 - * - * - * - some strings and memory management functions - - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef INC_LIBETM_STR_MEM_H -#define INC_LIBETM_STR_MEM_H - -/* - * copy n bytes max from src to dest then add '\0' at the end of dest - */ -char *str_n_cpy(char *, const char *, size_t); - -/* - * concanate n bytes max of src to dest then add '\0' at the end of dest - * strings may not be identical and should not overlap - */ -char *str_n_cat(char *, const char *, size_t); - -/* - * create new_l_str (allocate memory) and copy str (can be NULL) to new_l_str - */ -char *l_str_new(const char *str); - -/* - * append l_str_src (can be NULL) to l_str_dest (re-allocate memory as necessary) - * l_str_dest must have been created by l_str_new - strings may overlap - */ -char *l_str_cat(char *, const char *); - -/* - * free string created by l_str_new() or l_str_cat() - */ -void l_str_free(char *); - -/* - * wrappers for malloc(), realloc(), calloc() and free() which check returned value - */ -void *malloc2(size_t); -void *realloc2(void *, size_t); -void *calloc2(size_t, size_t); -void free2(void *); - -/* - * return size in readable format (KB, MB, GB, TB) - * *** allow up to 16 simultaneous calls *** - * convention: we assume 2.5 MB = 2 MB + [0.5 x 1024 = 512] KB, not 500 KB - * otherwise, there is no way to express a value in the range 1000 - 1023 - * so x.y MB = x MB + 0.y MB, that is: not y x 100 KB but y x 102.4 KB - * (isn't this a bit confusing?) - */ -const char *readable_size(double); - -/* - * itoa() is not ansi c so this one could be useful - * *** allow up to 16 simultaneous calls *** - */ -const char *itoa2(long int); - -void remove_char_from_str(char *, char); - -/* - * very basic xor sym encryption for small strings (up to 511 chars) - * *** key must be ascii / if 2 chars match (in str and key) the string is cut *** - * *** allow up to 16 simultaneous calls *** - * works with ascii strings, probably not otherwise so don't try with - * exotic things... - */ -const char *str_crypt(const char *, const char *); - -/* - * very basic crypto hash - */ -unsigned long str_crypto_hash(const char *, const char*); - -/* - * generate a random string up to 1023 chars long - * mode = a -> alpha / d -> digits / b -> both - */ -const char *rnd_str(char, int); -#endif /* INC_LIBETM_STR_MEM_H */ diff -Nru tickr-0.5.5/src/libetm-0.4.2/win32_specific.c tickr-0.6.0/src/libetm-0.4.2/win32_specific.c --- tickr-0.5.5/src/libetm-0.4.2/win32_specific.c 2011-10-24 15:05:59.000000000 +0200 +++ tickr-0.6.0/src/libetm-0.4.2/win32_specific.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,196 +0,0 @@ -/* - * libetm-0.4 / win32_specific.c - Copyright (C) Emmanuel Thomas-Maurin 2008-2011 - * - * - * - win32 specific functions - - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifdef WIN32_V - -#include -#include -#include -#include -#include -#include -#include -#include "libetm.h" - -#define APP_WIN32REG_KEYPATH "app_win32_registry_keypath" /* or whatever */ - -/* return NULL if error */ -const char *get_appdata_dir() -{ - static TCHAR appdata_dir[MAX_PATH]; - static int i = 0; - - if (i == 0) { - i++; - if (SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, appdata_dir) != S_OK) - i++; - } - if (i == 1) - return (const char *)appdata_dir; - else - return NULL; -} - -/* return NULL if error */ -const char *get_progfiles_dir() -{ - static TCHAR progfiles_dir[MAX_PATH]; - static int i = 0; - - if (i == 0) { - i++; - if (SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, 0, progfiles_dir) != S_OK) - i++; - } - if (i == 1) - return (const char *)progfiles_dir; - else - return NULL; -} - -/* key_value must be able to store 255 chars */ -int get_key_value_from_win32registry(const char *key_name, char *key_value) -{ - char news_win32regkey_full[128]; - HKEY hkey; - DWORD type = REG_SZ, buf_size = 256; - LONG result; - - str_n_cpy(news_win32regkey_full, APP_WIN32REG_KEYPATH, 64); - str_n_cat(news_win32regkey_full, key_name, 63); - - if ((result = RegOpenKeyEx(HKEY_CURRENT_USER, news_win32regkey_full, - 0L, KEY_QUERY_VALUE, &hkey)) == ERROR_SUCCESS) { - if (RegQueryValueEx(hkey, NULL, NULL, &type, (unsigned char*)key_value, - &buf_size) == ERROR_SUCCESS) { - RegCloseKey(hkey); - return LIBETM_OK; - } else { - RegCloseKey(hkey); - return WIN32REGKEY_NOT_FOUND; - } - } else { - if (result == ERROR_FILE_NOT_FOUND) - return WIN32REGKEY_NOT_FOUND; - else - return WIN32REGKEY_OTHER_ERROR; - } -} - -int save_key_value_into_win32registry(const char *key_name, const char *key_value) -{ - char news_win32regkey_full[128]; - HKEY hkey; - DWORD disp = 0; - - str_n_cpy(news_win32regkey_full, APP_WIN32REG_KEYPATH, 64); - str_n_cat(news_win32regkey_full, key_name, 63); - - if (RegCreateKeyEx(HKEY_CURRENT_USER, news_win32regkey_full, 0L, - NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hkey, &disp) - == ERROR_SUCCESS) { - if (RegSetValueEx(hkey, NULL, 0L, REG_SZ, (unsigned char *)TEXT(key_value), - 256) == ERROR_SUCCESS) { - RegCloseKey(hkey); - return LIBETM_OK; - } else { - RegCloseKey(hkey); - return WIN32REGKEY_SAVE_ERROR; - } - } else - return WIN32REGKEY_CREATE_ERROR; -} - -/* return NULL if error */ -const char *get_default_browser_from_win32registry() -{ - static char browser_cmd[512]; - HKEY hkey; - DWORD type = REG_SZ, buf_size = 512; - LONG result; - - if ((result = RegOpenKeyEx(HKEY_CLASSES_ROOT, "http\\shell\\open\\command", - 0L, KEY_QUERY_VALUE, &hkey)) == ERROR_SUCCESS) { - if (RegQueryValueEx(hkey, NULL, NULL, &type, (unsigned char*)browser_cmd, - &buf_size) == ERROR_SUCCESS) { - RegCloseKey(hkey); - return (const char *)browser_cmd; - } else { - RegCloseKey(hkey); - return NULL; - } - } else - return NULL; -} - -/* return -1 if error */ -int get_win32_taskbar_height() -{ - HWND hwnd; - RECT r; - LPRECT lpRect = &r; - - if ((hwnd = FindWindow("Shell_traywnd", "")) != NULL) { - if (GetWindowRect(hwnd, lpRect)) - return (int) (lpRect->bottom - lpRect->top); - } - return -1; -} - -/* find up to 15 mac addresses for this computer - * return NULL if error */ -/*const char **find_mac_addresses() -{ - IP_ADAPTER_INFO *adapter_info; - ULONG buf_len = sizeof(adapter_info); - PIP_ADAPTER_INFO p_adapter_info; - static char macaddr[16][256], tmp[3]; - static char *p_macaddr[16]; - unsigned int i, j = 0; - - adapter_info = (IP_ADAPTER_INFO *)malloc2(sizeof(IP_ADAPTER_INFO)); - buf_len = sizeof(IP_ADAPTER_INFO); - // initial call is supposed to fail - if (GetAdaptersInfo(adapter_info, &buf_len) != ERROR_SUCCESS) { - free2(adapter_info); - adapter_info = (IP_ADAPTER_INFO *)malloc2(buf_len); - } - // 2nd call - if (GetAdaptersInfo(adapter_info, &buf_len) != ERROR_SUCCESS) { - free2(adapter_info); - return NULL; - } else { - p_adapter_info = (PIP_ADAPTER_INFO)adapter_info; - while (p_adapter_info && j < 15) { - macaddr[j][0] = '\0'; - for (i = 0; i < 127 && i < p_adapter_info->AddressLength; i++) { - snprintf(tmp, 3, "%02X", p_adapter_info->Address[i]); - str_n_cat(macaddr[j], tmp, 2); - } - p_macaddr[j] = macaddr[j]; - j++; - p_adapter_info = p_adapter_info->Next; - } - free2(adapter_info); - p_macaddr[j] = NULL; - } - return (const char **)p_macaddr; -}*/ -#endif diff -Nru tickr-0.5.5/src/libetm-0.4.2/win32_specific.h tickr-0.6.0/src/libetm-0.4.2/win32_specific.h --- tickr-0.5.5/src/libetm-0.4.2/win32_specific.h 2011-11-24 19:55:44.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.2/win32_specific.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,39 +0,0 @@ -/* - * libetm-0.4 / win32_specific.h - Copyright (C) Emmanuel Thomas-Maurin 2008-2011 - * - * - * - win32 specific functions - - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef INC_LIBETM_WIN32_SPECIFIC_H -#define INC_LIBETM_WIN32_SPECIFIC_H - -#ifdef WIN32_V -/* return NULL if error */ -const char *get_appdata_dir(); -const char *get_progfiles_dir(); -/* key_value must be able to store 255 chars */ -int get_key_value_from_win32registry(const char *, char *); -int save_key_value_into_win32registry(const char *, const char *); -/* return NULL if error */ -const char *get_default_browser_from_win32registry(); -/* return -1 if error */ -int get_win32_taskbar_height(); -/* find up to 15 mac addresses for this computer - * return NULL if error */ -/*const char **find_mac_addresses();*/ -#endif -#endif /* INC_LIBETM_WIN32_SPECIFIC_H */ diff -Nru tickr-0.5.5/src/libetm-0.4.3/COPYING tickr-0.6.0/src/libetm-0.4.3/COPYING --- tickr-0.5.5/src/libetm-0.4.3/COPYING 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.3/COPYING 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff -Nru tickr-0.5.5/src/libetm-0.4.3/error.c tickr-0.6.0/src/libetm-0.4.3/error.c --- tickr-0.5.5/src/libetm-0.4.3/error.c 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.3/error.c 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1,63 @@ +/* + * libetm-0.4 / error.c - Copyright (C) Emmanuel Thomas-Maurin 2008-2012 + * + * + * - error handling - + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include +#include "libetm.h" + +/* + * critical error handler for lib that will call big_error() function defined in app + * so that appropiate behaviour can be choosen + */ +int big_error_in_lib(lib_error_code error_code, const char *str) +{ + /* only call big_error() in app */ + big_error(error_code, 4, LIBETM_NAME"-"LIBETM_VERSION_NUM": ", str, ": ", get_lib_error_str(error_code)); + return error_code; +} + +const char *get_lib_error_str(lib_error_code error_code) +{ + /* + * *** make sure this array matches the lib errors enum *** + */ + static char *lib_error_str[] = { + "OK", + "Out of memory", + "Zero requested size", + /*"Negative requested size",*/ + "Null destination string", + "Source string = destination string", + "Strings overlap", + "Attempting to free a null pointer", +#ifdef WIN32_V + "Can't find Win32 Registry Key", + "Can't create Win32 Registry Key", + "Can't save Win32 Registry Key", + "Win32 Registry Key error (undetermined)", +#endif + "OK" + }; + + if (error_code <= LIBETM_LASTERRORCODE) + return (const char *)lib_error_str[error_code]; + else + return ""; +} diff -Nru tickr-0.5.5/src/libetm-0.4.3/error.h tickr-0.6.0/src/libetm-0.4.3/error.h --- tickr-0.5.5/src/libetm-0.4.3/error.h 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.3/error.h 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1,58 @@ +/* + * libetm-0.4 / error.h - Copyright (C) Emmanuel Thomas-Maurin 2008-2012 + * . + */ + +#ifndef INC_LIBETM_ERROR_H +#define INC_LIBETM_ERROR_H + +typedef enum { + LIBETM_OK, + OUT_OF_MEMORY, + ZERO_RQ_SIZE, + /*NEG_RQ_SIZE,*/ + NULL_DEST, + SRC_EQ_DEST, + STR_OVERLAP, + NULL_POINTER_FREE, + RNDSTR_UNKNOWN_MODE, +#ifdef WIN32_V + WIN32REGKEY_NOT_FOUND, + WIN32REGKEY_CREATE_ERROR, + WIN32REGKEY_SAVE_ERROR, + WIN32REGKEY_OTHER_ERROR, +#endif + LIBETM_LASTERRORCODE +} lib_error_code; + +/* + * app defined critical error handler prototype + * error code from app should enum above LIB_LASTERRORCODE + */ +int big_error(int, int, ...); + +/* + * this will call big_error() function defined in app + */ +int big_error_in_lib(lib_error_code, const char *); + +/* + * if error code > LIBETM_LASTERRORCODE, returns "" + */ +const char *get_lib_error_str(lib_error_code); +#endif /* INC_LIBETM_ERROR_H */ diff -Nru tickr-0.5.5/src/libetm-0.4.3/error_handler_example.c tickr-0.6.0/src/libetm-0.4.3/error_handler_example.c --- tickr-0.5.5/src/libetm-0.4.3/error_handler_example.c 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.3/error_handler_example.c 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1,32 @@ +/* + * this func's prototype is in libetm / error.h + * this func is not defined in libetm but in app and it handles errors + * from libetm and app + * + * max number of strings = N_STR_MAX, max string length = STR_MAXLEN + * outstanding stuff (strings and chars) will be ignored + */ +int big_error(int big_error_code, int n_str, ...) +{ +#define N_STR_MAX 8 +#define STR_MAXLEN 128 + + char error_str[32 + 32 + (N_STR_MAX * STR_MAXLEN) + 32 + 1]; + va_list str; + int i; + + error_str[0] = '\0'; + str_n_cpy(error_str, "CRITICAL ERROR: ", 32); + if (big_error_code > LIBETM_LASTERRORCODE) + str_n_cat(error_str, APP_NAME": ", 32); + n_str = MIN(n_str, N_STR_MAX); + va_start(str, n_str); + for (i = 0; i < n_str ; i++) + str_n_cat(error_str, va_arg(str, char *), STR_MAXLEN); + va_end(str); + str_n_cat(error_str, " - Will quit now", 32); + + fprintf(STD_ERR, "%s\n", error_str); + fflush(NULL); + exit(big_error_code); +} diff -Nru tickr-0.5.5/src/libetm-0.4.3/libetm.h tickr-0.6.0/src/libetm-0.4.3/libetm.h --- tickr-0.5.5/src/libetm-0.4.3/libetm.h 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.3/libetm.h 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1,75 @@ +/* + * libetm-0.4 / libetm.h - Copyright (C) Emmanuel Thomas-Maurin 2008-2012 + * + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef INC_LIBETM_H +#define INC_LIBETM_H + +#define LIBETM_NAME "Libetm" +#define LIBETM_VERSION_NUM "0.4.3" + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#ifndef _ISOC99_SOURCE +#define _ISOC99_SOURCE +#endif + +#ifndef FALSE +# ifndef TRUE +# define FALSE (0) +# define TRUE (!FALSE) +# endif +#endif + +/* would it be better like that? +#undef FALSE +#undef TRUE +typedef enum { + FALSE = (0), TRUE = (!FALSE) +} boolean;*/ + +#define YES (1) +#define NO (0) + +#ifndef MAX +# define MAX(x,y) ((x) > (y) ? (x) : (y)) +#endif + +#ifndef MIN +# define MIN(x,y) ((x) < (y) ? (x) : (y)) +#endif + +#ifndef ABS +# define ABS(x) ((x) > 0 ? (x) : -(x)) +#endif + +/* do more testing for these following 2 */ +#ifndef SIGN +# define SIGN(x) ((x) != 0 ? ((x) > 0 ? 1 : -1) : 0) +#endif + +/* only if f > 0 */ +#ifndef APPROX +# define APPROX(f) (ABS(((f) - (int)(f)) > 0.5) ? (int)(f) + SIGN((f)) : (int)(f)) +#endif + +#include "str_mem.h" +#include "misc.h" +#include "error.h" +#include "win32_specific.h" +#endif /* INC_LIBETM_H */ diff -Nru tickr-0.5.5/src/libetm-0.4.3/Makefile.am tickr-0.6.0/src/libetm-0.4.3/Makefile.am --- tickr-0.5.5/src/libetm-0.4.3/Makefile.am 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.3/Makefile.am 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1,5 @@ +libs_LIBRARIES = libetm.a +libetm_a_SOURCES = str_mem.c error.c misc.c #win32_specific.c +libetm_a_CFLAGS = -O2 -Wall -Wextra -Wunused-parameter -Wshadow\ + -Wpointer-arith -ffast-math -pedantic +libsdir = .. diff -Nru tickr-0.5.5/src/libetm-0.4.3/Makefile.in tickr-0.6.0/src/libetm-0.4.3/Makefile.in --- tickr-0.5.5/src/libetm-0.4.3/Makefile.in 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.3/Makefile.in 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1,528 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +subdir = src/libetm-0.4.3 +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + COPYING +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libsdir)" +LIBRARIES = $(libs_LIBRARIES) +AR = ar +ARFLAGS = cru +libetm_a_AR = $(AR) $(ARFLAGS) +libetm_a_LIBADD = +am_libetm_a_OBJECTS = libetm_a-str_mem.$(OBJEXT) \ + libetm_a-error.$(OBJEXT) libetm_a-misc.$(OBJEXT) +libetm_a_OBJECTS = $(am_libetm_a_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libetm_a_SOURCES) +DIST_SOURCES = $(libetm_a_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GREP = @GREP@ +GTK2_CFLAGS = @GTK2_CFLAGS@ +GTK2_LIBS = @GTK2_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMKMF = @XMKMF@ +XML2_CFLAGS = @XML2_CFLAGS@ +XML2_LIBS = @XML2_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +libs_LIBRARIES = libetm.a +libetm_a_SOURCES = str_mem.c error.c misc.c #win32_specific.c +libetm_a_CFLAGS = -O2 -Wall -Wextra -Wunused-parameter -Wshadow\ + -Wpointer-arith -ffast-math -pedantic + +libsdir = .. +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/libetm-0.4.3/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/libetm-0.4.3/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libsLIBRARIES: $(libs_LIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libsdir)" || $(MKDIR_P) "$(DESTDIR)$(libsdir)" + @list='$(libs_LIBRARIES)'; test -n "$(libsdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(libsdir)'"; \ + $(INSTALL_DATA) $$list2 "$(DESTDIR)$(libsdir)" || exit $$?; } + @$(POST_INSTALL) + @list='$(libs_LIBRARIES)'; test -n "$(libsdir)" || list=; \ + for p in $$list; do \ + if test -f $$p; then \ + $(am__strip_dir) \ + echo " ( cd '$(DESTDIR)$(libsdir)' && $(RANLIB) $$f )"; \ + ( cd "$(DESTDIR)$(libsdir)" && $(RANLIB) $$f ) || exit $$?; \ + else :; fi; \ + done + +uninstall-libsLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(libs_LIBRARIES)'; test -n "$(libsdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libsdir)' && rm -f "$$files" )"; \ + cd "$(DESTDIR)$(libsdir)" && rm -f $$files + +clean-libsLIBRARIES: + -test -z "$(libs_LIBRARIES)" || rm -f $(libs_LIBRARIES) +libetm.a: $(libetm_a_OBJECTS) $(libetm_a_DEPENDENCIES) + -rm -f libetm.a + $(libetm_a_AR) libetm.a $(libetm_a_OBJECTS) $(libetm_a_LIBADD) + $(RANLIB) libetm.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libetm_a-error.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libetm_a-misc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libetm_a-str_mem.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +libetm_a-str_mem.o: str_mem.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -MT libetm_a-str_mem.o -MD -MP -MF $(DEPDIR)/libetm_a-str_mem.Tpo -c -o libetm_a-str_mem.o `test -f 'str_mem.c' || echo '$(srcdir)/'`str_mem.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libetm_a-str_mem.Tpo $(DEPDIR)/libetm_a-str_mem.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='str_mem.c' object='libetm_a-str_mem.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -c -o libetm_a-str_mem.o `test -f 'str_mem.c' || echo '$(srcdir)/'`str_mem.c + +libetm_a-str_mem.obj: str_mem.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -MT libetm_a-str_mem.obj -MD -MP -MF $(DEPDIR)/libetm_a-str_mem.Tpo -c -o libetm_a-str_mem.obj `if test -f 'str_mem.c'; then $(CYGPATH_W) 'str_mem.c'; else $(CYGPATH_W) '$(srcdir)/str_mem.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libetm_a-str_mem.Tpo $(DEPDIR)/libetm_a-str_mem.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='str_mem.c' object='libetm_a-str_mem.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -c -o libetm_a-str_mem.obj `if test -f 'str_mem.c'; then $(CYGPATH_W) 'str_mem.c'; else $(CYGPATH_W) '$(srcdir)/str_mem.c'; fi` + +libetm_a-error.o: error.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -MT libetm_a-error.o -MD -MP -MF $(DEPDIR)/libetm_a-error.Tpo -c -o libetm_a-error.o `test -f 'error.c' || echo '$(srcdir)/'`error.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libetm_a-error.Tpo $(DEPDIR)/libetm_a-error.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='error.c' object='libetm_a-error.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -c -o libetm_a-error.o `test -f 'error.c' || echo '$(srcdir)/'`error.c + +libetm_a-error.obj: error.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -MT libetm_a-error.obj -MD -MP -MF $(DEPDIR)/libetm_a-error.Tpo -c -o libetm_a-error.obj `if test -f 'error.c'; then $(CYGPATH_W) 'error.c'; else $(CYGPATH_W) '$(srcdir)/error.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libetm_a-error.Tpo $(DEPDIR)/libetm_a-error.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='error.c' object='libetm_a-error.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -c -o libetm_a-error.obj `if test -f 'error.c'; then $(CYGPATH_W) 'error.c'; else $(CYGPATH_W) '$(srcdir)/error.c'; fi` + +libetm_a-misc.o: misc.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -MT libetm_a-misc.o -MD -MP -MF $(DEPDIR)/libetm_a-misc.Tpo -c -o libetm_a-misc.o `test -f 'misc.c' || echo '$(srcdir)/'`misc.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libetm_a-misc.Tpo $(DEPDIR)/libetm_a-misc.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc.c' object='libetm_a-misc.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -c -o libetm_a-misc.o `test -f 'misc.c' || echo '$(srcdir)/'`misc.c + +libetm_a-misc.obj: misc.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -MT libetm_a-misc.obj -MD -MP -MF $(DEPDIR)/libetm_a-misc.Tpo -c -o libetm_a-misc.obj `if test -f 'misc.c'; then $(CYGPATH_W) 'misc.c'; else $(CYGPATH_W) '$(srcdir)/misc.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libetm_a-misc.Tpo $(DEPDIR)/libetm_a-misc.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc.c' object='libetm_a-misc.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libetm_a_CFLAGS) $(CFLAGS) -c -o libetm_a-misc.obj `if test -f 'misc.c'; then $(CYGPATH_W) 'misc.c'; else $(CYGPATH_W) '$(srcdir)/misc.c'; fi` + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(libsdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libsLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-libsLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libsLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libsLIBRARIES ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libsLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-libsLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -Nru tickr-0.5.5/src/libetm-0.4.3/Makefile-libetm-linux tickr-0.6.0/src/libetm-0.4.3/Makefile-libetm-linux --- tickr-0.5.5/src/libetm-0.4.3/Makefile-libetm-linux 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.3/Makefile-libetm-linux 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1,33 @@ +# Makefile for libetm-0.4 - Linux version + +src = str_mem.c error.c misc.c #win32_specific.c +obj = $(src:.c=.o) +headers = libetm.h $(src:.c=.h) + +CC = gcc + +CFLAGS = -O2 -Wall -Wextra -Wunused-parameter -Wshadow -Wpointer-arith\ + -ffast-math -pedantic + +all: libetm.a + +$(obj): $(src) $(headers) Makefile + $(CC) $(CFLAGS) -c $(src) + +libetm.a: $(obj) + ar -r libetm.a $(obj) + +.PHONY: install +install: + mkdir -p /usr/local/include/libetm + cp $(headers) /usr/local/include/libetm/ + cp libetm.a /usr/local/lib/ + +.PHONY: uninstall +uninstall: + rm /usr/local/include/libetm/$(headers) + rm /usr/local/lib/libetm.a + +.PHONY: clean +clean: + rm $(obj) libetm.a diff -Nru tickr-0.5.5/src/libetm-0.4.3/Makefile-libetm-win32 tickr-0.6.0/src/libetm-0.4.3/Makefile-libetm-win32 --- tickr-0.5.5/src/libetm-0.4.3/Makefile-libetm-win32 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.3/Makefile-libetm-win32 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1,28 @@ +# Makefile for libetm-0.4.3 - win32 version + +src = str_mem.c error.c misc.c win32_specific.c +obj = $(src:.c=.o) +headers = libetm.h $(src:.c=.h) + +CC = gcc + +CFLAGS = -O2 -Wall -Wextra -Wunused-parameter -Wshadow -Wpointer-arith\ + -ffast-math -pedantic -DWIN32_V + +all: libetm.a + +$(obj): $(src) $(headers) Makefile + $(CC) $(CFLAGS) -c $(src) + +libetm.a: $(obj) + ar -r libetm.a $(obj) + +.PHONY: install +install: + mkdir -p /usr/local/include/libetm + cp $(headers) /usr/local/include/libetm/ + cp libetm.a /usr/local/lib/ + +.PHONY: clean +clean: + rm $(obj) libetm.a diff -Nru tickr-0.5.5/src/libetm-0.4.3/misc.c tickr-0.6.0/src/libetm-0.4.3/misc.c --- tickr-0.5.5/src/libetm-0.4.3/misc.c 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.3/misc.c 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1,71 @@ +/* + * libetm-0.4 / misc.c - Copyright (C) Emmanuel Thomas-Maurin 2008-2012 + * + * + * - misc functions - + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include +#include "libetm.h" + +/* get_libetm_version( O ) = version num + * 1 = copyright + * 2 = license 1/3 + * 3 = license 2/3 + * 4 = license 3/3 + * 5 = compiled date + * > 5 = NULL + */ +const char *get_libetm_version(unsigned int i) +{ + static const char *libv[] = { + LIBETM_NAME" version "LIBETM_VERSION_NUM, + "Copyright (C) Emmanuel Thomas-Maurin 2008-2012 ", + LIBETM_NAME" is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.", + LIBETM_NAME" is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.", + "You should have received a copy of the GNU General Public License\n" + "along with this program. If not, see ", + "Compiled on "__DATE__" - "__TIME__ + }; + if (i < sizeof(libv) / sizeof(libv[0])) + return (const char *)libv[i]; + else + return NULL; +} + +int question(const char *str) +{ + int i, c; + + while (1) { + printf("%s [y/n] ? ", str); + i = fgetc(stdin); + c = tolower(i); + while (i != '\n' && i != EOF) + (i = fgetc(stdin)); + if (c == 'y') + return TRUE; + else if (c == 'n') + return FALSE; + } +} diff -Nru tickr-0.5.5/src/libetm-0.4.3/misc.h tickr-0.6.0/src/libetm-0.4.3/misc.h --- tickr-0.5.5/src/libetm-0.4.3/misc.h 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.3/misc.h 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1,34 @@ +/* + * libetm-0.4 / misc.h - Copyright (C) Emmanuel Thomas-Maurin 2008-2012 + * + * + * - misc functions - + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef INC_LIBETM_MISC_H +#define INC_LIBETM_MISC_H + +/* get_libetm_version( O ) = version num + * 1 = copyright + * 2 = license 1/3 + * 3 = license 2/3 + * 4 = license 3/3 + * 5 = compiled date + * > 5 = NULL + */ +const char *get_libetm_version(unsigned int); +int question(const char *); +#endif /* INC_LIBETM_MISC_H */ diff -Nru tickr-0.5.5/src/libetm-0.4.3/README tickr-0.6.0/src/libetm-0.4.3/README --- tickr-0.5.5/src/libetm-0.4.3/README 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.3/README 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1 @@ +This is only a tiny lib with a few functions I use a lot. diff -Nru tickr-0.5.5/src/libetm-0.4.3/str_mem.c tickr-0.6.0/src/libetm-0.4.3/str_mem.c --- tickr-0.5.5/src/libetm-0.4.3/str_mem.c 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.3/str_mem.c 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1,345 @@ +/* + * libetm-0.4 / str_mem.c - Copyright (C) Emmanuel Thomas-Maurin 2008-2012 + * + * + * - some strings and memory management functions - + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include +#include +#include "libetm.h" + +/* + * copy n bytes max from src to dest then add '\0' at the end of dest + */ +char *str_n_cpy(char *dest, const char *src, size_t length) +{ + char *dest_bak = dest; + + if (dest == NULL) + big_error_in_lib(NULL_DEST, "str_n_cpy()"); + + while (length-- > 0 && *src != '\0') + *dest++ = *src++; + + *dest = '\0'; + + return dest_bak; +} + +/* + * concanate n bytes max of src to dest then add '\0' at the end of dest + * strings may not be identical and should not overlap + */ +char *str_n_cat(char *dest, const char *src, size_t length) +{ + char *dest_bak = dest; + + if (dest == NULL) + big_error_in_lib(NULL_DEST, "str_n_cat()"); + else if (src == dest) + big_error_in_lib(SRC_EQ_DEST, "str_n_cat()"); + + while (*dest++ != '\0'); + + str_n_cpy(dest - 1, src, length); + + return dest_bak; +} + +/* + * create new_l_str (allocate memory) and copy str (can be NULL) to new_l_str + */ +char *l_str_new(const char *str) +{ + char *new_l_str; + size_t str_len; + + if (str == NULL) + str_len = 0; + else + str_len = strlen(str); + + new_l_str = malloc2(sizeof(char) * (str_len + 1)); + + return str_n_cpy(new_l_str, str, str_len); +} + +/* + * append l_str_src (can be NULL) to l_str_dest (re-allocate memory as necessary) + * l_str_dest must have been created by l_str_new - strings may overlap + */ +char *l_str_cat(char *l_str_dest, const char *l_str_src) +{ + char *new_l_str, *l_str_src2; + size_t src_len, dest_len; + + if (l_str_dest == NULL) + big_error_in_lib(NULL_DEST, "l_str_cat()"); + else if (l_str_src == NULL) + return l_str_dest; + + l_str_src2 = l_str_new(l_str_src); + src_len = strlen(l_str_src); + if (src_len == 0) + return l_str_dest; + dest_len = strlen(l_str_dest); + + new_l_str = realloc2(l_str_dest, sizeof(char) * (dest_len + src_len + 1)); + new_l_str = str_n_cat(new_l_str, l_str_src2, src_len); + l_str_free(l_str_src2); + + return new_l_str; +} + +/* + * free string created by l_str_new() or l_str_cat() + */ +void l_str_free(char *l_str) +{ + if (l_str != NULL) + free(l_str); + else + big_error_in_lib(NULL_POINTER_FREE, "l_str_free()"); + /* CODE WITH NO EFFECT + l_str = NULL;*/ +} + +/* + * wrappers for malloc(), realloc(), calloc() and free() which check returned value + */ +void *malloc2(size_t size) +{ + void *free_block = NULL; + + if (size == 0) + big_error_in_lib(ZERO_RQ_SIZE, "malloc2()"); + /*else if (size < 0) + big_error_in_lib(NEG_RQ_SIZE, "malloc2()");*/ + else if ((free_block = malloc(size)) == NULL) + big_error_in_lib(OUT_OF_MEMORY, "malloc2()"); + + return free_block; +} + +void *realloc2(void *free_block, size_t size) +{ + void *tmp = free_block; + + if (size == 0) + big_error_in_lib(ZERO_RQ_SIZE, "realloc2()"); + /*else if (size < 0) + big_error_in_lib(NEG_RQ_SIZE, "realloc2()");*/ + else if ((free_block = realloc(free_block, size)) == NULL) { + free2(tmp); + big_error_in_lib(OUT_OF_MEMORY, "realloc2()"); + } + + return free_block; +} + +void *calloc2(size_t n_elements, size_t element_size) +{ + void *free_block = NULL; + size_t size = n_elements * element_size; + + if (size == 0) + big_error_in_lib(ZERO_RQ_SIZE, "calloc2()"); + /*else if (size < 0) + big_error_in_lib(NEG_RQ_SIZE, "calloc2()");*/ + else if ((free_block = malloc2(size)) != NULL) + memset(free_block, 0, size); + + return free_block; +} + +void free2(void *free_block) +{ + if (free_block != NULL) + free(free_block); + else + big_error_in_lib(NULL_POINTER_FREE, "free2()"); + + /* CODE WITH NO EFFECT + free_block = NULL;*/ +} + +/* + * return size in readable format (KiB, MiB, GiB, TiB) + * *** allow up to 16 simultaneous calls *** + * convention: we assume 2.5 MiB = 2 MiB + [0.5 x 1024 = 512] KiB, not 500 KiB + * otherwise, there is no way to express a value in the range 1000 - 1023 + * so x.y MiB = x MiB + 0.y MiB, that is: not y x 100 KiB but y x 102.4 KiB + * (isn't this a bit confusing?) + */ +const char *readable_size(double size_bytes) +{ + /* we use an array of 16 strings to store the returned string in order + * to allow 16 simultaneous calls (should be enough in most cases?) + * otherwise, sth like: + * printf("size1 = %s / size2 = %s\n", readable_size(size1), readable_size(size2)) + * would produce unpredictable / false results (like readable sizes are + * equal whereas sizes are different + */ + static char lib_static_str[16][128]; + unsigned long size_KiB, size_MiB, size_GiB, size_TiB; + static int count = -1; + + count++; + count &= 15; + + size_KiB = (unsigned long)(size_bytes / 1024); + size_MiB = size_KiB / 1024; + size_GiB = size_MiB / 1024; + size_TiB = size_GiB / 1024; + + if (size_TiB >= 1) + snprintf(lib_static_str[count], 128, "%ld.%ld TiB", + size_TiB, ((size_GiB - size_TiB * 1024) * 10) / 1024); + else if (size_GiB >= 1) + snprintf(lib_static_str[count], 128, "%ld.%ld GiB", + size_GiB, ((size_MiB - size_GiB * 1024) * 10) / 1024); + else if (size_MiB >= 1) + snprintf(lib_static_str[count], 128, "%ld.%ld MiB", + size_MiB, ((size_KiB - size_MiB * 1024) * 10) / 1024); + else if (size_KiB >= 1) + snprintf(lib_static_str[count], 128, "%ld.%ld KiB", + size_KiB, (unsigned long)((size_bytes - size_KiB * 1024) * 10) / 1024); + else + snprintf(lib_static_str[count], 128, "%.0f bytes", size_bytes); + + return (const char *)lib_static_str[count]; +} + +/* + * itoa() is not ansi c so this one could be useful + * *** allow up to 16 simultaneous calls *** + */ +const char *itoa2(long int n) +{ + /* array of 16 strings (like for readable_size() - see above) */ + static char lib_static_str[16][128]; + static int count = -1; + + count++; + count &= 15; + snprintf(lib_static_str[count], 128, "%ld", n); + return (const char *)lib_static_str[count]; +} + +/* + * modify string in place + */ +char *remove_char_from_str(char *str, char c) +{ + int i, len = strlen(str); + + for (i = 0; i < len && str[i] != '\0';) { + if (str[i] == c) + str_n_cpy(str + i, (const char *)(str + i + 1), len - i); + else + i++; + } + return str; +} + +/* + * modify string in place + */ +char *remove_trailing_whitespaces_from_str(char *str) +{ + int i = strlen(str) - 1; + + while (isspace((int)str[i]) && i >= 0) + i--; + str[i + 1] = '\0'; + return str; +} + +/* + * very basic xor sym encryption for small strings (up to 511 chars) + * *** key must be ascii / if 2 chars match (in str and key) the string is cut *** + * *** allow up to 16 simultaneous calls *** + * works with ascii strings, probably not otherwise so don't try with + * exotic things... + */ +const char *str_crypt(const char *str, const char *key) +{ + /* array of 16 strings (like for readable_size() - see above) */ + static char str2[16][512]; + static int count = -1; + int i, j; + + count++; + count &= 15; + for (i = 0, j = 0; i < 511 && str[i] != '\0'; i++) { + if (key[j] == '\0') + j = 0; + str2[count][i] = str[i] ^ key[j++]; + } + str2[count][i] = '\0'; + return (const char *)str2[count]; +} + +/* + * very basic crypto hash + */ +unsigned long str_crypto_hash(const char *str, const char* salt) +{ + char *str2; + unsigned long hash = 0; + int i = 0; + + str2 = (char *)str_crypt(str, salt); + while (str2[i] != '\0') { + hash += str2[i] * 1024 + (str2[i] + 128) * (32 + i) + str2[i] - 1; + i ++; + } + return hash; +} + +/* + * generate a random string up to 1023 chars long + * mode = a -> alpha / d -> digits / b -> both + */ +const char *rnd_str(char mode, int length) +{ + static char str[1024]; + char str_a[65] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijkl"; + char str_d[17] = "1234567890123456"; + char str_b[65] = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ00"; + int i = 0; + + if (length > 1023) + length = 1023; + srand(time(0)); + if (mode == 'a') { + while (i < length) + str[i++] = str_a[rand() & 63]; + } else if (mode == 'd') { + while (i < length) + str[i++] = str_d[rand() & 15]; + } else if (mode == 'b') { + while (i < length) + str[i++] = str_b[rand() & 63]; + } else + big_error_in_lib(RNDSTR_UNKNOWN_MODE, "rnd_str()"); + str[i] = '\0'; + return str; +} diff -Nru tickr-0.5.5/src/libetm-0.4.3/str_mem.h tickr-0.6.0/src/libetm-0.4.3/str_mem.h --- tickr-0.5.5/src/libetm-0.4.3/str_mem.h 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.3/str_mem.h 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1,104 @@ +/* + * libetm-0.4 / str_mem.h - Copyright (C) Emmanuel Thomas-Maurin 2008-2012 + * + * + * - some strings and memory management functions - + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef INC_LIBETM_STR_MEM_H +#define INC_LIBETM_STR_MEM_H + +/* + * copy n bytes max from src to dest then add '\0' at the end of dest + */ +char *str_n_cpy(char *, const char *, size_t); + +/* + * concanate n bytes max of src to dest then add '\0' at the end of dest + * strings may not be identical and should not overlap + */ +char *str_n_cat(char *, const char *, size_t); + +/* + * create new_l_str (allocate memory) and copy str (can be NULL) to new_l_str + */ +char *l_str_new(const char *str); + +/* + * append l_str_src (can be NULL) to l_str_dest (re-allocate memory as necessary) + * l_str_dest must have been created by l_str_new - strings may overlap + */ +char *l_str_cat(char *, const char *); + +/* + * free string created by l_str_new() or l_str_cat() + */ +void l_str_free(char *); + +/* + * wrappers for malloc(), realloc(), calloc() and free() which check returned value + */ +void *malloc2(size_t); +void *realloc2(void *, size_t); +void *calloc2(size_t, size_t); +void free2(void *); + +/* + * return size in readable format (KiB, MiB, GiB, TiB) + * *** allow up to 16 simultaneous calls *** + * convention: we assume 2.5 MiB = 2 MiB + [0.5 x 1024 = 512] KiB, not 500 KiB + * otherwise, there is no way to express a value in the range 1000 - 1023 + * so x.y MiB = x MiB + 0.y MiB, that is: not y x 100 KiB but y x 102.4 KiB + * (isn't this a bit confusing?) + */ +const char *readable_size(double); + +/* + * itoa() is not ansi c so this one could be useful + * *** allow up to 16 simultaneous calls *** + */ +const char *itoa2(long int); + +/* + * modify string in place + */ +char *remove_char_from_str(char *, char); + +/* + * modify string in place + */ +char *remove_trailing_whitespaces_from_str(char *); + +/* + * very basic xor sym encryption for small strings (up to 511 chars) + * *** key must be ascii / if 2 chars match (in str and key) the string is cut *** + * *** allow up to 16 simultaneous calls *** + * works with ascii strings, probably not otherwise so don't try with + * exotic things... + */ +const char *str_crypt(const char *, const char *); + +/* + * very basic crypto hash + */ +unsigned long str_crypto_hash(const char *, const char*); + +/* + * generate a random string up to 1023 chars long + * mode = a -> alpha / d -> digits / b -> both + */ +const char *rnd_str(char, int); +#endif /* INC_LIBETM_STR_MEM_H */ diff -Nru tickr-0.5.5/src/libetm-0.4.3/win32_specific.c tickr-0.6.0/src/libetm-0.4.3/win32_specific.c --- tickr-0.5.5/src/libetm-0.4.3/win32_specific.c 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.3/win32_specific.c 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1,196 @@ +/* + * libetm-0.4 / win32_specific.c - Copyright (C) Emmanuel Thomas-Maurin 2008-2012 + * + * + * - win32 specific functions - + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifdef WIN32_V + +#include +#include +#include +#include +#include +#include +#include +#include "libetm.h" + +#define APP_WIN32REG_KEYPATH "app_win32_registry_keypath" /* or whatever */ + +/* return NULL if error */ +const char *get_appdata_dir() +{ + static TCHAR appdata_dir[MAX_PATH + 1]; + static int i = 0; + + if (i == 0) { + i++; + if (SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, appdata_dir) != S_OK) + i++; + } + if (i == 1) + return (const char *)appdata_dir; + else + return NULL; +} + +/* return NULL if error */ +const char *get_progfiles_dir() +{ + static TCHAR progfiles_dir[MAX_PATH + 1]; + static int i = 0; + + if (i == 0) { + i++; + if (SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, 0, progfiles_dir) != S_OK) + i++; + } + if (i == 1) + return (const char *)progfiles_dir; + else + return NULL; +} + +/* key_value must be able to store 255 chars */ +int get_key_value_from_win32registry(const char *key_name, char *key_value) +{ + char app_win32regkey_full[128]; + HKEY hkey; + DWORD type = REG_SZ, buf_size = 256; + LONG result; + + str_n_cpy(app_win32regkey_full, APP_WIN32REG_KEYPATH, 64); + str_n_cat(app_win32regkey_full, key_name, 63); + + if ((result = RegOpenKeyEx(HKEY_CURRENT_USER, app_win32regkey_full, + 0L, KEY_QUERY_VALUE, &hkey)) == ERROR_SUCCESS) { + if (RegQueryValueEx(hkey, NULL, NULL, &type, (unsigned char*)key_value, + &buf_size) == ERROR_SUCCESS) { + RegCloseKey(hkey); + return LIBETM_OK; + } else { + RegCloseKey(hkey); + return WIN32REGKEY_NOT_FOUND; + } + } else { + if (result == ERROR_FILE_NOT_FOUND) + return WIN32REGKEY_NOT_FOUND; + else + return WIN32REGKEY_OTHER_ERROR; + } +} + +int save_key_value_into_win32registry(const char *key_name, const char *key_value) +{ + char app_win32regkey_full[128]; + HKEY hkey; + DWORD disp = 0; + + str_n_cpy(app_win32regkey_full, APP_WIN32REG_KEYPATH, 64); + str_n_cat(app_win32regkey_full, key_name, 63); + + if (RegCreateKeyEx(HKEY_CURRENT_USER, app_win32regkey_full, 0L, + NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hkey, &disp) + == ERROR_SUCCESS) { + if (RegSetValueEx(hkey, NULL, 0L, REG_SZ, (unsigned char *)TEXT(key_value), + 256) == ERROR_SUCCESS) { + RegCloseKey(hkey); + return LIBETM_OK; + } else { + RegCloseKey(hkey); + return WIN32REGKEY_SAVE_ERROR; + } + } else + return WIN32REGKEY_CREATE_ERROR; +} + +/* return NULL if error */ +const char *get_default_browser_from_win32registry() +{ + static char browser_cmd[512]; + HKEY hkey; + DWORD type = REG_SZ, buf_size = 512; + LONG result; + + if ((result = RegOpenKeyEx(HKEY_CLASSES_ROOT, "http\\shell\\open\\command", + 0L, KEY_QUERY_VALUE, &hkey)) == ERROR_SUCCESS) { + if (RegQueryValueEx(hkey, NULL, NULL, &type, (unsigned char*)browser_cmd, + &buf_size) == ERROR_SUCCESS) { + RegCloseKey(hkey); + return (const char *)browser_cmd; + } else { + RegCloseKey(hkey); + return NULL; + } + } else + return NULL; +} + +/* return -1 if error */ +int get_win32_taskbar_height() +{ + HWND hwnd; + RECT r; + LPRECT lpRect = &r; + + if ((hwnd = FindWindow("Shell_traywnd", "")) != NULL) { + if (GetWindowRect(hwnd, lpRect)) + return (int) (lpRect->bottom - lpRect->top); + } + return -1; +} + +/* find up to 15 mac addresses for this computer + * return NULL if error */ +/*const char **find_mac_addresses() +{ + IP_ADAPTER_INFO *adapter_info; + ULONG buf_len = sizeof(adapter_info); + PIP_ADAPTER_INFO p_adapter_info; + static char macaddr[16][256], tmp[3]; + static char *p_macaddr[16]; + unsigned int i, j = 0; + + adapter_info = (IP_ADAPTER_INFO *)malloc2(sizeof(IP_ADAPTER_INFO)); + buf_len = sizeof(IP_ADAPTER_INFO); + // initial call is supposed to fail + if (GetAdaptersInfo(adapter_info, &buf_len) != ERROR_SUCCESS) { + free2(adapter_info); + adapter_info = (IP_ADAPTER_INFO *)malloc2(buf_len); + } + // 2nd call + if (GetAdaptersInfo(adapter_info, &buf_len) != ERROR_SUCCESS) { + free2(adapter_info); + return NULL; + } else { + p_adapter_info = (PIP_ADAPTER_INFO)adapter_info; + while (p_adapter_info && j < 15) { + macaddr[j][0] = '\0'; + for (i = 0; i < 127 && i < p_adapter_info->AddressLength; i++) { + snprintf(tmp, 3, "%02X", p_adapter_info->Address[i]); + str_n_cat(macaddr[j], tmp, 2); + } + p_macaddr[j] = macaddr[j]; + j++; + p_adapter_info = p_adapter_info->Next; + } + free2(adapter_info); + p_macaddr[j] = NULL; + } + return (const char **)p_macaddr; +}*/ +#endif diff -Nru tickr-0.5.5/src/libetm-0.4.3/win32_specific.h tickr-0.6.0/src/libetm-0.4.3/win32_specific.h --- tickr-0.5.5/src/libetm-0.4.3/win32_specific.h 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/src/libetm-0.4.3/win32_specific.h 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1,45 @@ +/* + * libetm-0.4 / win32_specific.h - Copyright (C) Emmanuel Thomas-Maurin 2008-2012 + * + * + * - win32 specific functions - + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef INC_LIBETM_WIN32_SPECIFIC_H +#define INC_LIBETM_WIN32_SPECIFIC_H + +#ifdef G_OS_WIN32 +# ifndef WIN32_V +# define WIN32_V +# endif +#endif + +#ifdef WIN32_V +/* return NULL if error */ +const char *get_appdata_dir(); +const char *get_progfiles_dir(); +/* key_value must be able to store 255 chars */ +int get_key_value_from_win32registry(const char *, char *); +int save_key_value_into_win32registry(const char *, const char *); +/* return NULL if error */ +const char *get_default_browser_from_win32registry(); +/* return -1 if error */ +int get_win32_taskbar_height(); +/* find up to 15 mac addresses for this computer + * return NULL if error */ +/*const char **find_mac_addresses();*/ +#endif +#endif /* INC_LIBETM_WIN32_SPECIFIC_H */ diff -Nru tickr-0.5.5/src/Makefile.am tickr-0.6.0/src/Makefile.am --- tickr-0.5.5/src/Makefile.am 2011-12-11 23:47:44.000000000 +0100 +++ tickr-0.6.0/src/Makefile.am 2012-03-07 02:01:00.000000000 +0100 @@ -1 +1 @@ -SUBDIRS = libetm-0.4.2 tickr +SUBDIRS = libetm-0.4.3 tickr diff -Nru tickr-0.5.5/src/Makefile.in tickr-0.6.0/src/Makefile.in --- tickr-0.5.5/src/Makefile.in 2011-12-12 00:05:02.000000000 +0100 +++ tickr-0.6.0/src/Makefile.in 2012-03-07 02:01:00.000000000 +0100 @@ -179,7 +179,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = libetm-0.4.2 tickr +SUBDIRS = libetm-0.4.3 tickr all: all-recursive .SUFFIXES: diff -Nru tickr-0.5.5/src/tickr/Makefile.am tickr-0.6.0/src/tickr/Makefile.am --- tickr-0.5.5/src/tickr/Makefile.am 2011-12-11 23:46:55.000000000 +0100 +++ tickr-0.6.0/src/tickr/Makefile.am 2012-03-07 02:01:00.000000000 +0100 @@ -12,23 +12,25 @@ tickr_render.c\ tickr_params.c\ tickr_clock.c \ - tickr_rss.c\ + tickr_feedparser.c\ tickr_list.c\ - tickr_rsswin.c\ + tickr_feedpicker.c\ tickr_prefwin.c\ tickr_otherwins.c\ tickr_misc.c\ tickr_helptext.c\ tickr_opml.c\ tickr_http.c\ - tickr_connectwin.c + tickr_socket.c\ + tickr_connectwin.c\ + tickr_quickfeedpicker.c tickr_CFLAGS = -O2 -Wall -Wextra -Wunused-parameter -Wshadow -Wpointer-arith -ffast-math\ -pedantic $(GTK2_CFLAGS) $(XML2_CFLAGS) -tickr_LDFLAGS = ../libetm-0.4.2/libetm.a +tickr_LDFLAGS = ../libetm-0.4.3/libetm.a -tickr_LDADD = ../libetm-0.4.2/libetm.a $(GTK2_LIBS) $(XML2_LIBS) +tickr_LDADD = ../libetm-0.4.3/libetm.a $(GTK2_LIBS) $(XML2_LIBS) tickr_DATA = ../../images/tickr-icon.png ../../images/tickr-logo.png\ ../../images/tickr-rss-icon.png ../../images/tickr-icon.xpm diff -Nru tickr-0.5.5/src/tickr/Makefile.in tickr-0.6.0/src/tickr/Makefile.in --- tickr-0.5.5/src/tickr/Makefile.in 2011-12-12 00:05:02.000000000 +0100 +++ tickr-0.6.0/src/tickr/Makefile.in 2012-03-07 02:01:00.000000000 +0100 @@ -49,14 +49,16 @@ am_tickr_OBJECTS = tickr-tickr_main.$(OBJEXT) \ tickr-tickr_resource.$(OBJEXT) tickr-tickr_render.$(OBJEXT) \ tickr-tickr_params.$(OBJEXT) tickr-tickr_clock.$(OBJEXT) \ - tickr-tickr_rss.$(OBJEXT) tickr-tickr_list.$(OBJEXT) \ - tickr-tickr_rsswin.$(OBJEXT) tickr-tickr_prefwin.$(OBJEXT) \ + tickr-tickr_feedparser.$(OBJEXT) tickr-tickr_list.$(OBJEXT) \ + tickr-tickr_feedpicker.$(OBJEXT) tickr-tickr_prefwin.$(OBJEXT) \ tickr-tickr_otherwins.$(OBJEXT) tickr-tickr_misc.$(OBJEXT) \ tickr-tickr_helptext.$(OBJEXT) tickr-tickr_opml.$(OBJEXT) \ - tickr-tickr_http.$(OBJEXT) tickr-tickr_connectwin.$(OBJEXT) + tickr-tickr_http.$(OBJEXT) tickr-tickr_socket.$(OBJEXT) \ + tickr-tickr_connectwin.$(OBJEXT) \ + tickr-tickr_quickfeedpicker.$(OBJEXT) tickr_OBJECTS = $(am_tickr_OBJECTS) am__DEPENDENCIES_1 = -tickr_DEPENDENCIES = ../libetm-0.4.2/libetm.a $(am__DEPENDENCIES_1) \ +tickr_DEPENDENCIES = ../libetm-0.4.3/libetm.a $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) tickr_LINK = $(CCLD) $(tickr_CFLAGS) $(CFLAGS) $(tickr_LDFLAGS) \ $(LDFLAGS) -o $@ @@ -196,22 +198,24 @@ tickr_render.c\ tickr_params.c\ tickr_clock.c \ - tickr_rss.c\ + tickr_feedparser.c\ tickr_list.c\ - tickr_rsswin.c\ + tickr_feedpicker.c\ tickr_prefwin.c\ tickr_otherwins.c\ tickr_misc.c\ tickr_helptext.c\ tickr_opml.c\ tickr_http.c\ - tickr_connectwin.c + tickr_socket.c\ + tickr_connectwin.c\ + tickr_quickfeedpicker.c tickr_CFLAGS = -O2 -Wall -Wextra -Wunused-parameter -Wshadow -Wpointer-arith -ffast-math\ -pedantic $(GTK2_CFLAGS) $(XML2_CFLAGS) -tickr_LDFLAGS = ../libetm-0.4.2/libetm.a -tickr_LDADD = ../libetm-0.4.2/libetm.a $(GTK2_LIBS) $(XML2_LIBS) +tickr_LDFLAGS = ../libetm-0.4.3/libetm.a +tickr_LDADD = ../libetm-0.4.3/libetm.a $(GTK2_LIBS) $(XML2_LIBS) tickr_DATA = ../../images/tickr-icon.png ../../images/tickr-logo.png\ ../../images/tickr-rss-icon.png ../../images/tickr-icon.xpm @@ -298,6 +302,8 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tickr-tickr_clock.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tickr-tickr_connectwin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tickr-tickr_feedparser.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tickr-tickr_feedpicker.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tickr-tickr_helptext.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tickr-tickr_http.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tickr-tickr_list.Po@am__quote@ @@ -307,10 +313,10 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tickr-tickr_otherwins.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tickr-tickr_params.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tickr-tickr_prefwin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tickr-tickr_quickfeedpicker.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tickr-tickr_render.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tickr-tickr_resource.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tickr-tickr_rss.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tickr-tickr_rsswin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tickr-tickr_socket.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -396,19 +402,19 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -c -o tickr-tickr_clock.obj `if test -f 'tickr_clock.c'; then $(CYGPATH_W) 'tickr_clock.c'; else $(CYGPATH_W) '$(srcdir)/tickr_clock.c'; fi` -tickr-tickr_rss.o: tickr_rss.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -MT tickr-tickr_rss.o -MD -MP -MF $(DEPDIR)/tickr-tickr_rss.Tpo -c -o tickr-tickr_rss.o `test -f 'tickr_rss.c' || echo '$(srcdir)/'`tickr_rss.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tickr-tickr_rss.Tpo $(DEPDIR)/tickr-tickr_rss.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tickr_rss.c' object='tickr-tickr_rss.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -c -o tickr-tickr_rss.o `test -f 'tickr_rss.c' || echo '$(srcdir)/'`tickr_rss.c - -tickr-tickr_rss.obj: tickr_rss.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -MT tickr-tickr_rss.obj -MD -MP -MF $(DEPDIR)/tickr-tickr_rss.Tpo -c -o tickr-tickr_rss.obj `if test -f 'tickr_rss.c'; then $(CYGPATH_W) 'tickr_rss.c'; else $(CYGPATH_W) '$(srcdir)/tickr_rss.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tickr-tickr_rss.Tpo $(DEPDIR)/tickr-tickr_rss.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tickr_rss.c' object='tickr-tickr_rss.obj' libtool=no @AMDEPBACKSLASH@ +tickr-tickr_feedparser.o: tickr_feedparser.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -MT tickr-tickr_feedparser.o -MD -MP -MF $(DEPDIR)/tickr-tickr_feedparser.Tpo -c -o tickr-tickr_feedparser.o `test -f 'tickr_feedparser.c' || echo '$(srcdir)/'`tickr_feedparser.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tickr-tickr_feedparser.Tpo $(DEPDIR)/tickr-tickr_feedparser.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tickr_feedparser.c' object='tickr-tickr_feedparser.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -c -o tickr-tickr_feedparser.o `test -f 'tickr_feedparser.c' || echo '$(srcdir)/'`tickr_feedparser.c + +tickr-tickr_feedparser.obj: tickr_feedparser.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -MT tickr-tickr_feedparser.obj -MD -MP -MF $(DEPDIR)/tickr-tickr_feedparser.Tpo -c -o tickr-tickr_feedparser.obj `if test -f 'tickr_feedparser.c'; then $(CYGPATH_W) 'tickr_feedparser.c'; else $(CYGPATH_W) '$(srcdir)/tickr_feedparser.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tickr-tickr_feedparser.Tpo $(DEPDIR)/tickr-tickr_feedparser.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tickr_feedparser.c' object='tickr-tickr_feedparser.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -c -o tickr-tickr_rss.obj `if test -f 'tickr_rss.c'; then $(CYGPATH_W) 'tickr_rss.c'; else $(CYGPATH_W) '$(srcdir)/tickr_rss.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -c -o tickr-tickr_feedparser.obj `if test -f 'tickr_feedparser.c'; then $(CYGPATH_W) 'tickr_feedparser.c'; else $(CYGPATH_W) '$(srcdir)/tickr_feedparser.c'; fi` tickr-tickr_list.o: tickr_list.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -MT tickr-tickr_list.o -MD -MP -MF $(DEPDIR)/tickr-tickr_list.Tpo -c -o tickr-tickr_list.o `test -f 'tickr_list.c' || echo '$(srcdir)/'`tickr_list.c @@ -424,19 +430,19 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -c -o tickr-tickr_list.obj `if test -f 'tickr_list.c'; then $(CYGPATH_W) 'tickr_list.c'; else $(CYGPATH_W) '$(srcdir)/tickr_list.c'; fi` -tickr-tickr_rsswin.o: tickr_rsswin.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -MT tickr-tickr_rsswin.o -MD -MP -MF $(DEPDIR)/tickr-tickr_rsswin.Tpo -c -o tickr-tickr_rsswin.o `test -f 'tickr_rsswin.c' || echo '$(srcdir)/'`tickr_rsswin.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tickr-tickr_rsswin.Tpo $(DEPDIR)/tickr-tickr_rsswin.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tickr_rsswin.c' object='tickr-tickr_rsswin.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -c -o tickr-tickr_rsswin.o `test -f 'tickr_rsswin.c' || echo '$(srcdir)/'`tickr_rsswin.c - -tickr-tickr_rsswin.obj: tickr_rsswin.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -MT tickr-tickr_rsswin.obj -MD -MP -MF $(DEPDIR)/tickr-tickr_rsswin.Tpo -c -o tickr-tickr_rsswin.obj `if test -f 'tickr_rsswin.c'; then $(CYGPATH_W) 'tickr_rsswin.c'; else $(CYGPATH_W) '$(srcdir)/tickr_rsswin.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tickr-tickr_rsswin.Tpo $(DEPDIR)/tickr-tickr_rsswin.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tickr_rsswin.c' object='tickr-tickr_rsswin.obj' libtool=no @AMDEPBACKSLASH@ +tickr-tickr_feedpicker.o: tickr_feedpicker.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -MT tickr-tickr_feedpicker.o -MD -MP -MF $(DEPDIR)/tickr-tickr_feedpicker.Tpo -c -o tickr-tickr_feedpicker.o `test -f 'tickr_feedpicker.c' || echo '$(srcdir)/'`tickr_feedpicker.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tickr-tickr_feedpicker.Tpo $(DEPDIR)/tickr-tickr_feedpicker.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tickr_feedpicker.c' object='tickr-tickr_feedpicker.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -c -o tickr-tickr_feedpicker.o `test -f 'tickr_feedpicker.c' || echo '$(srcdir)/'`tickr_feedpicker.c + +tickr-tickr_feedpicker.obj: tickr_feedpicker.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -MT tickr-tickr_feedpicker.obj -MD -MP -MF $(DEPDIR)/tickr-tickr_feedpicker.Tpo -c -o tickr-tickr_feedpicker.obj `if test -f 'tickr_feedpicker.c'; then $(CYGPATH_W) 'tickr_feedpicker.c'; else $(CYGPATH_W) '$(srcdir)/tickr_feedpicker.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tickr-tickr_feedpicker.Tpo $(DEPDIR)/tickr-tickr_feedpicker.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tickr_feedpicker.c' object='tickr-tickr_feedpicker.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -c -o tickr-tickr_rsswin.obj `if test -f 'tickr_rsswin.c'; then $(CYGPATH_W) 'tickr_rsswin.c'; else $(CYGPATH_W) '$(srcdir)/tickr_rsswin.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -c -o tickr-tickr_feedpicker.obj `if test -f 'tickr_feedpicker.c'; then $(CYGPATH_W) 'tickr_feedpicker.c'; else $(CYGPATH_W) '$(srcdir)/tickr_feedpicker.c'; fi` tickr-tickr_prefwin.o: tickr_prefwin.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -MT tickr-tickr_prefwin.o -MD -MP -MF $(DEPDIR)/tickr-tickr_prefwin.Tpo -c -o tickr-tickr_prefwin.o `test -f 'tickr_prefwin.c' || echo '$(srcdir)/'`tickr_prefwin.c @@ -522,6 +528,20 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -c -o tickr-tickr_http.obj `if test -f 'tickr_http.c'; then $(CYGPATH_W) 'tickr_http.c'; else $(CYGPATH_W) '$(srcdir)/tickr_http.c'; fi` +tickr-tickr_socket.o: tickr_socket.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -MT tickr-tickr_socket.o -MD -MP -MF $(DEPDIR)/tickr-tickr_socket.Tpo -c -o tickr-tickr_socket.o `test -f 'tickr_socket.c' || echo '$(srcdir)/'`tickr_socket.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tickr-tickr_socket.Tpo $(DEPDIR)/tickr-tickr_socket.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tickr_socket.c' object='tickr-tickr_socket.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -c -o tickr-tickr_socket.o `test -f 'tickr_socket.c' || echo '$(srcdir)/'`tickr_socket.c + +tickr-tickr_socket.obj: tickr_socket.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -MT tickr-tickr_socket.obj -MD -MP -MF $(DEPDIR)/tickr-tickr_socket.Tpo -c -o tickr-tickr_socket.obj `if test -f 'tickr_socket.c'; then $(CYGPATH_W) 'tickr_socket.c'; else $(CYGPATH_W) '$(srcdir)/tickr_socket.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tickr-tickr_socket.Tpo $(DEPDIR)/tickr-tickr_socket.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tickr_socket.c' object='tickr-tickr_socket.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -c -o tickr-tickr_socket.obj `if test -f 'tickr_socket.c'; then $(CYGPATH_W) 'tickr_socket.c'; else $(CYGPATH_W) '$(srcdir)/tickr_socket.c'; fi` + tickr-tickr_connectwin.o: tickr_connectwin.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -MT tickr-tickr_connectwin.o -MD -MP -MF $(DEPDIR)/tickr-tickr_connectwin.Tpo -c -o tickr-tickr_connectwin.o `test -f 'tickr_connectwin.c' || echo '$(srcdir)/'`tickr_connectwin.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tickr-tickr_connectwin.Tpo $(DEPDIR)/tickr-tickr_connectwin.Po @@ -535,6 +555,20 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tickr_connectwin.c' object='tickr-tickr_connectwin.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -c -o tickr-tickr_connectwin.obj `if test -f 'tickr_connectwin.c'; then $(CYGPATH_W) 'tickr_connectwin.c'; else $(CYGPATH_W) '$(srcdir)/tickr_connectwin.c'; fi` + +tickr-tickr_quickfeedpicker.o: tickr_quickfeedpicker.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -MT tickr-tickr_quickfeedpicker.o -MD -MP -MF $(DEPDIR)/tickr-tickr_quickfeedpicker.Tpo -c -o tickr-tickr_quickfeedpicker.o `test -f 'tickr_quickfeedpicker.c' || echo '$(srcdir)/'`tickr_quickfeedpicker.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tickr-tickr_quickfeedpicker.Tpo $(DEPDIR)/tickr-tickr_quickfeedpicker.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tickr_quickfeedpicker.c' object='tickr-tickr_quickfeedpicker.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -c -o tickr-tickr_quickfeedpicker.o `test -f 'tickr_quickfeedpicker.c' || echo '$(srcdir)/'`tickr_quickfeedpicker.c + +tickr-tickr_quickfeedpicker.obj: tickr_quickfeedpicker.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -MT tickr-tickr_quickfeedpicker.obj -MD -MP -MF $(DEPDIR)/tickr-tickr_quickfeedpicker.Tpo -c -o tickr-tickr_quickfeedpicker.obj `if test -f 'tickr_quickfeedpicker.c'; then $(CYGPATH_W) 'tickr_quickfeedpicker.c'; else $(CYGPATH_W) '$(srcdir)/tickr_quickfeedpicker.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tickr-tickr_quickfeedpicker.Tpo $(DEPDIR)/tickr-tickr_quickfeedpicker.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tickr_quickfeedpicker.c' object='tickr-tickr_quickfeedpicker.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tickr_CFLAGS) $(CFLAGS) -c -o tickr-tickr_quickfeedpicker.obj `if test -f 'tickr_quickfeedpicker.c'; then $(CYGPATH_W) 'tickr_quickfeedpicker.c'; else $(CYGPATH_W) '$(srcdir)/tickr_quickfeedpicker.c'; fi` install-tickrDATA: $(tickr_DATA) @$(NORMAL_INSTALL) test -z "$(tickrdir)" || $(MKDIR_P) "$(DESTDIR)$(tickrdir)" diff -Nru tickr-0.5.5/src/tickr/Makefile-tickr-linux tickr-0.6.0/src/tickr/Makefile-tickr-linux --- tickr-0.5.5/src/tickr/Makefile-tickr-linux 2011-11-30 18:56:03.000000000 +0100 +++ tickr-0.6.0/src/tickr/Makefile-tickr-linux 2012-03-07 02:01:00.000000000 +0100 @@ -1,18 +1,21 @@ -# Makefile for TICKR - GTK-based RSS Ticker - Linux version +# Makefile for TICKR - GTK-based Feed Reader - Linux version -src = tickr_main.c tickr_resource.c tickr_render.c tickr_params.c tickr_clock.c\ - tickr_rss.c tickr_list.c tickr_rsswin.c tickr_prefwin.c tickr_otherwins.c\ - tickr_misc.c tickr_helptext.c tickr_opml.c tickr_http.c tickr_connectwin.c +src = tickr_main.c tickr_resource.c tickr_render.c tickr_params.c\ + tickr_clock.c tickr_feedparser.c tickr_list.c tickr_feedpicker.c\ + tickr_prefwin.c tickr_otherwins.c tickr_misc.c tickr_helptext.c\ + tickr_opml.c tickr_http.c tickr_socket.c tickr_connectwin.c\ + tickr_quickfeedpicker.c obj = $(src:.c=.o) CC = gcc -CFLAGS = -O2 -Wall -Wextra -Wunused-parameter -Wshadow -Wpointer-arith -ffast-math\ - -pedantic `pkg-config --cflags gtk+-2.0` `xml2-config --cflags`\ - -I/usr/local/include +CFLAGS = -O2 -Wall -Wextra -Wunused-parameter -Wshadow -Wpointer-arith\ + -ffast-math -pedantic `pkg-config --cflags gtk+-2.0`\ + xml2-config --cflags` -I/usr/local/include -LIBS = /usr/local/lib/libetm.a `pkg-config --libs gtk+-2.0` `xml2-config --libs` +LIBS = ../libetm-0.4.3/libetm.a `pkg-config --libs gtk+-2.0`\ + `xml2-config --libs` all: tickr diff -Nru tickr-0.5.5/src/tickr/Makefile-tickr-win32 tickr-0.6.0/src/tickr/Makefile-tickr-win32 --- tickr-0.5.5/src/tickr/Makefile-tickr-win32 2011-12-01 17:47:23.000000000 +0100 +++ tickr-0.6.0/src/tickr/Makefile-tickr-win32 2012-03-07 02:01:00.000000000 +0100 @@ -1,18 +1,22 @@ -# Makefile for TICKR - GTK-based RSS Ticker - win32 version +# Makefile for TICKR - GTK-based Feed Reader - win32 version -src = tickr_main.c tickr_resource.c tickr_render.c tickr_params.c tickr_clock.c\ - tickr_rss.c tickr_list.c tickr_rsswin.c tickr_prefwin.c tickr_otherwins.c\ - tickr_misc.c tickr_helptext.c tickr_opml.c tickr_http.c tickr_connectwin.c +src = tickr_main.c tickr_resource.c tickr_render.c tickr_params.c\ + tickr_clock.c tickr_feedparser.c tickr_list.c tickr_feedpicker.c\ + tickr_prefwin.c tickr_otherwins.c tickr_misc.c tickr_helptext.c\ + tickr_opml.c tickr_http.c tickr_socket.c tickr_connectwin.c\ + tickr_quickfeedpicker.c obj = $(src:.c=.o) CC = gcc -CFLAGS = -O2 -Wall -Wextra -Wunused-parameter -Wshadow -Wpointer-arith -ffast-math -pedantic\ - `pkg-config --cflags gtk+-2.0` -I/usr/local/include/libxml2 -D WIN32_V - -LIBS = --mms-bitfields -mwindows -lwinmm -lrpcrt4 -liphlpapi -lws2_32 /usr/local/lib/libetm.a\ - `pkg-config --libs gtk+-2.0` -static /usr/local/lib/libxml2.dll.a +CFLAGS = -O2 -Wall -Wextra -Wunused-parameter -Wshadow -Wpointer-arith\ + -ffast-math -pedantic `pkg-config --cflags gtk+-2.0`\ + -I/usr/local/include/libxml2 -DWIN32_V + +LIBS = --mms-bitfields -mwindows -lwinmm -lrpcrt4 -liphlpapi -lws2_32\ + ../libetm-0.4.3/libetm.a `pkg-config --libs gtk+-2.0`\ + -static ../../win32_install_stuff/dlls/libxml2.dll.a all: tickr diff -Nru tickr-0.5.5/src/tickr/tickr_clock.c tickr-0.6.0/src/tickr/tickr_clock.c --- tickr-0.5.5/src/tickr/tickr_clock.c 2011-11-30 18:51:42.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr_clock.c 2012-03-07 02:01:00.000000000 +0100 @@ -1,5 +1,5 @@ /* - * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2011 + * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2012 * * * This program is free software: you can redistribute it and/or modify diff -Nru tickr-0.5.5/src/tickr/tickr_connectwin.c tickr-0.6.0/src/tickr/tickr_connectwin.c --- tickr-0.5.5/src/tickr/tickr_connectwin.c 2011-12-11 17:04:41.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr_connectwin.c 2012-03-07 02:01:00.000000000 +0100 @@ -1,5 +1,5 @@ /* - * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2011 + * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2012 * * * This program is free software: you can redistribute it and/or modify @@ -55,11 +55,9 @@ } #if USE_GUI -static gint enter_key_pressed_in_entry(GtkWidget *widget, GdkEvent *event, gpointer unused) +static gint enter_key_pressed_in_entry(GtkWidget *widget) { widget = widget; - event = event; - unused = unused; gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); return TRUE; } @@ -89,29 +87,23 @@ gtk_widget_set_sensitive(entry_proxy_psw, state); } -static gint check_but1_toggled(GtkWidget *check_button, GdkEvent *event, gpointer unused) +static gint check_but1_toggled(GtkWidget *check_button) { - event = event; - unused = unused; auth->use_authentication = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button)); set_entries_sensitive1(auth->use_authentication); return TRUE; } -static gint check_but2_toggled(GtkWidget *check_button, GdkEvent *event, gpointer unused) +static gint check_but2_toggled(GtkWidget *check_button) { - event = event; - unused = unused; proxy->use_proxy = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button)); set_entries_sensitive2(proxy->use_proxy); set_entries_sensitive3(proxy->use_proxy && proxy->use_proxy_authentication); return TRUE; } -static gint check_but3_toggled(GtkWidget *check_button, GdkEvent *event, gpointer unused) +static gint check_but3_toggled(GtkWidget *check_button) { - event = event; - unused = unused; proxy->use_proxy_authentication = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button)); set_entries_sensitive3(proxy->use_proxy && proxy->use_proxy_authentication); return TRUE; @@ -174,7 +166,7 @@ GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); - set_news_icon_to_dialog(GTK_WINDOW(dialog)); + set_tickr_icon_to_dialog(GTK_WINDOW(dialog)); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); /* * fill structs from params diff -Nru tickr-0.5.5/src/tickr/tickr_feedparser.c tickr-0.6.0/src/tickr/tickr_feedparser.c --- tickr-0.5.5/src/tickr/tickr_feedparser.c 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr_feedparser.c 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1,426 @@ +/* + * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2012 + * + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "tickr.h" + +#ifdef G_OS_WIN32 +extern FILE *stdout_fp, *stderr_fp; +#endif + +static int depth; +static xmlNode *item_element, *entry_element; +static int n; +static int counter; + +/* + * here, 'rss' is sometimes used as a synonym of 'feed' and sometimes + * used by opposition to 'atom' (this can be confusing) + */ + +/* + * look for url and, if valid, parse it then dump result into + * '/'TICKR_DIR_NAME/XMLDUMP' + * if url not valid, only set error code and return + */ +int get_feed(Resource *resrc, const Params *prm) +{ + char feed_title[FEED_TITLE_MAXLEN + 1]; + char feed_link[FILE_NAME_MAXLEN + 1]; + char feed_ttl[32]; + char file_name[FILE_NAME_MAXLEN + 1]; + char url[FILE_NAME_MAXLEN + 1]; + int suspend_rq_bak, exit_status, i; + + suspend_rq_bak = get_ticker_env()->suspend_rq; + get_ticker_env()->suspend_rq = TRUE; + + resrc->rss_ttl = prm->rss_refresh; + str_n_cpy(resrc->xml_dump, get_datafile_full_name_from_name(XML_DUMP), FILE_NAME_MAXLEN); + if (resrc->fp != NULL) + fclose(resrc->fp); + resrc->fp = open_new_datafile_with_name(XML_DUMP, "wb"); + str_n_cpy(file_name, get_datafile_full_name_from_name(RESOURCE_DUMP), FILE_NAME_MAXLEN); + + /* we replace resrc->id with modified url, file_name = downloaded resource */ + if ((exit_status = fetch_resource((const char *)resrc->id, (const char *)file_name, url)) == OK) +#ifdef VERBOSE_OUTPUT + fprintf(STD_OUT, "Resource fetched: %s\n", (const char *)resrc->id); +#endif + else if (exit_status == FEED_FORMAT_ERROR) { + warning(get_ticker_env()->selection_mode == MULTIPLE, 2, + "Feed format error (RSS2.0/Atom) in: ", resrc->id); + return FEED_FORMAT_ERROR; + } else if (exit_status == CONNECT_TOO_MANY_ERRORS) { + return CONNECT_TOO_MANY_ERRORS; + } else { + warning(get_ticker_env()->selection_mode == MULTIPLE, 2, + "Can't fetch resource: ", resrc->id); + return FEED_DOWNLOAD_ERROR; + } + for (i = 0; i < NFEEDLINKANDOFFSETMAX; i++) { + resrc->link_and_offset[i].offset_in_surface = 0; + (resrc->link_and_offset[i].url)[0] = '\0'; + } + resrc->format = RSS_2_0; + /* we use file_name instead of resrc->id */ + if ((exit_status = parse_rss20_xml_file(resrc->fp, file_name, + resrc->link_and_offset, prm)) == RSS_NO_ITEM_ELEMENT) { + resrc->format = RSS_ATOM; + for (i = 0; i < NFEEDLINKANDOFFSETMAX; i++) { + resrc->link_and_offset[i].offset_in_surface = 0; + (resrc->link_and_offset[i].url)[0] = '\0'; + } + /* we use file_name instead of resrc->id */ + if ((exit_status = parse_atom_xml_file(resrc->fp, file_name, + resrc->link_and_offset, prm)) == ATOM_NO_ENTRY_ELEMENT) + warning(get_ticker_env()->selection_mode == MULTIPLE, 3, + "No 'Item' or 'Entry' element found in: ", resrc->id, + "\nIs feed format RSS 2.0 or Atom?" + "\n(RSS 1.0 format is not currently supported)"); + } + if (exit_status != OK) { + resrc->format = RSS_FORMAT_UNDETERMINED; + return exit_status; + } + fclose(resrc->fp); + resrc->fp = open_new_datafile_with_name(XML_DUMP, "rb"); + + /* we use file_name instead of resrc->id */ + get_feed_info(file_name, feed_title, feed_link, feed_ttl); + str_n_cpy(resrc->feed_title, feed_title, FEED_TITLE_MAXLEN); + if (feed_ttl[0] != '\0') + resrc->rss_ttl = atoi(feed_ttl); + + get_ticker_env()->suspend_rq = suspend_rq_bak; + return OK; +} + +/* + * must be utf-8 encoded + */ +int parse_rss20_xml_file(FILE *fp, const char* file_name, FeedLinkAndOffset *link_and_offset, const Params *prm) +{ + xmlDoc *doc; + xmlNode *root_element; + +#ifdef VERBOSE_OUTPUT + fprintf(STD_OUT, "Parsing XML file ... "); +#endif + if ((doc = xmlParseFile(file_name)) == NULL) { + warning(get_ticker_env()->selection_mode == MULTIPLE, 2, + "XML parser error: ", xmlGetLastError()->message); + return FEED_UNPARSABLE; + } + if ((root_element = xmlDocGetRootElement(doc)) == NULL) { + xmlFreeDoc(doc); + warning(get_ticker_env()->selection_mode == MULTIPLE, 2, + "Empty XML document: ", file_name); + return FEED_EMPTY; + } + + depth = 0; + item_element = NULL; + n = 1; + counter = 0; + + get_rss20_selected_elements1(root_element, doc); + if (item_element != NULL) + get_rss20_selected_elements2(item_element, doc, fp, link_and_offset, prm); + else { + xmlFreeDoc(doc); + return RSS_NO_ITEM_ELEMENT; + } + xmlFreeDoc(doc); +#ifdef VERBOSE_OUTPUT + fprintf(STD_OUT, "Done\n"); +#endif + return OK; +} + +/* + * must be utf-8 encoded + */ +int parse_atom_xml_file(FILE *fp, const char* file_name, FeedLinkAndOffset *link_and_offset, const Params *prm) +{ + xmlDoc *doc; + xmlNode *root_element; + +#ifdef VERBOSE_OUTPUT + fprintf(STD_OUT, "Parsing XML file ... "); +#endif + if ((doc = xmlParseFile(file_name)) == NULL) { + warning(get_ticker_env()->selection_mode == MULTIPLE, 2, + "XML parser error: ", xmlGetLastError()->message); + return FEED_UNPARSABLE; + } + if ((root_element = xmlDocGetRootElement(doc)) == NULL) { + xmlFreeDoc(doc); + warning(get_ticker_env()->selection_mode == MULTIPLE, 2, + "Empty XML document: ", file_name); + return FEED_EMPTY; + } + + depth = 0; + entry_element = NULL; + n = 1; + counter = 0; + + get_atom_selected_elements1(root_element, doc); + if (entry_element != NULL) + get_atom_selected_elements2(entry_element, doc, fp, link_and_offset, prm); + else { + xmlFreeDoc(doc); + return ATOM_NO_ENTRY_ELEMENT; + } + xmlFreeDoc(doc); +#ifdef VERBOSE_OUTPUT + fprintf(STD_OUT, "Done\n"); +#endif + return OK; +} + +/* + * for every link found, we insert in text LINK_TAG_CHAR"00n" + * with n = link rank and we fill link_and_offset with url + * this is used later in render_stream_to_surface() + */ +void get_rss20_selected_elements1(xmlNode *some_element, xmlDoc *doc) +{ + xmlNode *cur_node; + + for (cur_node = some_element; cur_node != NULL; cur_node = cur_node->next) { + if (item_element != NULL) + return; + + if (xmlStrcmp(cur_node->name, (const xmlChar *)"rss") == 0 && depth == 0) + depth = 1; + else if (xmlStrcmp(cur_node->name, (const xmlChar *)"channel") == 0 && depth == 1) + depth = 2; + else if (xmlStrcmp(cur_node->name, (const xmlChar *)"item") == 0 && depth == 2) + depth = 3; + + if (depth == 3) + item_element = cur_node; + else + get_rss20_selected_elements1(cur_node->children, doc); + } +} + +void get_rss20_selected_elements2(xmlNode *some_element, xmlDoc *doc, + FILE *fp, FeedLinkAndOffset *link_and_offset, const Params *prm) +{ + xmlNode *cur_node, *cur_node_bak; + xmlChar *str; + + for (cur_node = some_element; cur_node != NULL; cur_node = cur_node->next) { + if (xmlStrcmp(cur_node->name, (const xmlChar *)"item") == 0) { + cur_node_bak = cur_node; + cur_node = cur_node->children; + for (; cur_node != NULL; cur_node = cur_node->next) { + if (prm->rss_title == 'y' && xmlStrcmp(cur_node->name, (const xmlChar *)"title") == 0) { + if ((str = xmlNodeListGetString(doc, cur_node->children, 1)) != NULL) { + /* we remove any LINK_TAG_CHAR from str because it will be used in "link tag" */ + remove_char_from_str((char *)str, LINK_TAG_CHAR); + fprintf(fp, "%s%s\n", str, prm->rss_title_delimiter); + xmlFree(str); + } + } else if (prm->rss_description == 'y' && xmlStrcmp(cur_node->name, (const xmlChar *)"description") == 0) { + if ((str = xmlNodeListGetString(doc, cur_node->children, 1)) != NULL) { + /* we remove any LINK_TAG_CHAR from str because it will be used in "link tag" */ + remove_char_from_str((char *)str, LINK_TAG_CHAR); + fprintf(fp, "%s%s\n", str, prm->rss_description_delimiter); + xmlFree(str); + } + } + } + cur_node = cur_node_bak; + cur_node = cur_node->children; + for (; cur_node != NULL; cur_node = cur_node->next) { + if (xmlStrcmp(cur_node->name, (const xmlChar *)"link") == 0) { + if ((str = xmlNodeListGetString(doc, cur_node->children, 1)) != NULL) { + if (n < NFEEDLINKANDOFFSETMAX + 1) { + str_n_cpy((link_and_offset + n)->url, (const char *)str, + FILE_NAME_MAXLEN); + fprintf(fp, "%c%03d\n", LINK_TAG_CHAR, n++); + } + xmlFree(str); + } + } + } + cur_node = cur_node_bak; + if (prm->n_items_per_feed != 0) + if (++counter >= prm->n_items_per_feed) + break; + } + } +} + +/* + * for every link found, we insert in text LINK_TAG_CHAR"00n" + * with n = link rank and we fill link_and_offset with url + * this is used later in render_stream_to_surface() + */ +void get_atom_selected_elements1(xmlNode *some_element, xmlDoc *doc) +{ + xmlNode *cur_node; + + for (cur_node = some_element; cur_node != NULL; cur_node = cur_node->next) { + if (entry_element != NULL) + return; + + if (xmlStrcmp(cur_node->name, (const xmlChar *)"feed") == 0)/* &&\ + xmlStrcmp(xmlGetProp(cur_node, (const xmlChar *)"xmlns"),\ + (const xmlChar *)"http://www.w3.org/2005/Atom") == 0 && depth == 0)*/ + depth = 1; + else if (xmlStrcmp(cur_node->name, (const xmlChar *)"entry") == 0 && depth == 1) + depth = 2; + + if (depth == 2) + entry_element = cur_node; + else + get_atom_selected_elements1(cur_node->children, doc); + } +} + +void get_atom_selected_elements2(xmlNode *some_element, xmlDoc *doc, + FILE *fp, FeedLinkAndOffset *link_and_offset, const Params *prm) +{ + xmlNode *cur_node, *cur_node_bak; + xmlChar *str; + + for (cur_node = some_element; cur_node != NULL; cur_node = cur_node->next) { + if (xmlStrcmp(cur_node->name, (const xmlChar *)"entry") == 0) { + cur_node_bak = cur_node; + cur_node = cur_node->children; + for (; cur_node != NULL; cur_node = cur_node->next) { + if (prm->rss_title == 'y' && xmlStrcmp(cur_node->name, (const xmlChar *)"title") == 0) { + if ((str = xmlNodeListGetString(doc, cur_node->children, 1)) != NULL) { + /* we remove any LINK_TAG_CHAR from str because it will be used in "link tag" */ + remove_char_from_str((char *)str, LINK_TAG_CHAR); + fprintf(fp, "%s%s\n", str, prm->rss_title_delimiter); + xmlFree(str); + } + } else if (prm->rss_description == 'y' && xmlStrcmp(cur_node->name, (const xmlChar *)"summary") == 0) { + if ((str = xmlNodeListGetString(doc, cur_node->children, 1)) != NULL) { + /* we remove any LINK_TAG_CHAR from str because it will be used in "link tag" */ + remove_char_from_str((char *)str, LINK_TAG_CHAR); + fprintf(fp, "%s%s\n", str, prm->rss_description_delimiter); + xmlFree(str); + } + } + } + cur_node = cur_node_bak; + cur_node = cur_node->children; + for (; cur_node != NULL; cur_node = cur_node->next) { + if (xmlStrcmp(cur_node->name, (const xmlChar *)"link") == 0) { + /* node attribute instead of node content (atom/rss) */ + if ((str = xmlGetProp(cur_node, (const xmlChar *)"href")) != NULL) { + /*if ((str = xmlNodeListGetString(doc, cur_node->children, 1)) != NULL) {*/ + if (n < NFEEDLINKANDOFFSETMAX + 1) { + str_n_cpy((link_and_offset + n)->url, (const char *)str,\ + FILE_NAME_MAXLEN); + fprintf(fp, "%c%03d\n", LINK_TAG_CHAR, n++); + } + xmlFree(str); + } + } + } + cur_node = cur_node_bak; + if (prm->n_items_per_feed != 0) + if (++counter >= prm->n_items_per_feed) + break; + } + } +} + +static const char *try_str_to_utf8(const char *str) +{ + static char str2[1024]; + int i; + + str_n_cpy(str2, str, 1023); + for (i = strlen(str2); i > 0; i--) { + str2[i - 1] = '\0'; + if (g_utf8_validate(str2, -1, NULL)) + break; + } + if (i == 0) + str_n_cpy(str2, "(not UTF-8 encoded)", 1023); + return (const char *)str2; +} + +/* *********************************** + * TODO: DOCUMENT BETTER THIS FUNC + * ***********************************/ +/* + * info is 4 strings 255 chars long each + * feed_* can be NULL + */ +int get_feed_info(const char *file_name, char *feed_title, char *feed_link, char *feed_ttl) +{ + xmlDoc *doc; + xmlNode *root_element; + + if (feed_title != NULL) + feed_title[0] = '\0'; + if (feed_link != NULL) + feed_link[0] = '\0'; + if (feed_ttl != NULL) + feed_ttl[0] = '\0'; + + if ((doc = xmlParseFile(file_name)) == NULL) { + return FEED_UNPARSABLE; + } else { + if ((root_element = xmlDocGetRootElement(doc)) == NULL) { + xmlFreeDoc(doc); + return FEED_EMPTY; + } else { + if (feed_title != NULL) + get_xml_first_element(root_element->children, doc, + "title", feed_title, FEED_TITLE_MAXLEN); + if (feed_link != NULL) + get_xml_first_element(root_element->children, doc, + "link", feed_link, FILE_NAME_MAXLEN); + if (feed_ttl != NULL) + get_xml_first_element(root_element->children, doc, + "ttl", feed_ttl, 31); + xmlFreeDoc(doc); + if (!g_utf8_validate(feed_title, -1, NULL)) + str_n_cpy(feed_title, try_str_to_utf8(feed_title), 255); + return OK; + } + } +} + +void get_xml_first_element(xmlNode *some_element, xmlDoc *doc, char *name, char *string, int length) +{ + xmlNode *cur_node; + xmlChar *str; + + for (cur_node = some_element; cur_node != NULL; cur_node = cur_node->next) { + if (xmlStrcmp(cur_node->name, (const xmlChar *)name) == 0) { + if ((str = xmlNodeListGetString(doc, cur_node->children, 1)) != NULL) { + str_n_cpy(string, (const char *)str, length); + xmlFree(str); + } else + string[0] = '\0'; + break; + } + get_xml_first_element(cur_node->children, doc, name, string, length); + } +} diff -Nru tickr-0.5.5/src/tickr/tickr_feedpicker.c tickr-0.6.0/src/tickr/tickr_feedpicker.c --- tickr-0.5.5/src/tickr/tickr_feedpicker.c 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr_feedpicker.c 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1,480 @@ +/* + * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2012 + * + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "tickr.h" + +#if USE_GUI +#define URL_ENTRY_LENGTH 100 +#define SC_WIN_HEIGHT 350 + +/* predefined GTK_RESPONSE_ are < 0, those ones are app level defined and >= 0 */ +enum { + GTK_RESPONSE_SELECT_ALL, GTK_RESPONSE_UNSELECT_ALL, GTK_RESPONSE_TOP, GTK_RESPONSE_HOME, + GTK_RESPONSE_REMOVE, GTK_RESPONSE_ADD, GTK_RESPONSE_SINGLE, GTK_RESPONSE_SELECTION +}; + +enum {COLUMN_INT, COLUMN_BOOLEAN_CHECKED, COLUMN_STRING_TITLE, COLUMN_STRING_URL, N_COLUMNS}; + +static GtkWidget *dialog, *entry_url; +static FList *flist; +static int f_index; /* starting at 0 (row starts at 1) */ +static gchar home_feed[FILE_NAME_MAXLEN + 1]; + +static gint esc_key_pressed(GtkWidget *dialog2, GdkEventKey *event) +{ + if (event->keyval == GDK_Escape) { + gtk_dialog_response(GTK_DIALOG(dialog2), GTK_RESPONSE_CLOSE); + return TRUE; + } else + return FALSE; +} + +static void force_quit_dialog(GtkWidget *dialog2) +{ + gtk_dialog_response(GTK_DIALOG(dialog2), GTK_RESPONSE_CLOSE); +} + +/* tree selection callback - update f_index and copy selected url to entry_url (override) */ +static gint tree_selection_changed(GtkTreeSelection *selection) +{ + GtkTreeModel *tree_model = NULL; + GtkTreeIter iter; + gchar *str_url; + + if (gtk_tree_selection_get_selected(selection, &tree_model, &iter)) { + gtk_tree_model_get(tree_model, &iter, + COLUMN_INT, &f_index, + COLUMN_STRING_URL, &str_url, + -1); + gtk_entry_set_text(GTK_ENTRY(entry_url), str_url); + if (IS_FLIST(flist)) + if ((f_index = f_list_search(flist, str_url)) > -1) + flist = f_list_nth(flist, f_index + 1); + g_free(str_url); + } + return TRUE; +} + +/* catch double-click on tree view */ +static gint double_click_on_tree_view(GtkTreeView *tree_view, GtkTreePath *tree_path) +{ + GtkTreeModel *tree_model = NULL; + GtkTreeIter iter; + gchar *str_url; + + tree_model = gtk_tree_view_get_model(tree_view); + if (gtk_tree_model_get_iter(tree_model, &iter, tree_path)) { + gtk_tree_model_get(tree_model, &iter, + COLUMN_INT, &f_index, + COLUMN_STRING_URL, &str_url, + -1); + gtk_entry_set_text(GTK_ENTRY(entry_url), str_url); + if (IS_FLIST(flist)) + if ((f_index = f_list_search(flist, str_url)) > -1) + flist = f_list_nth(flist, f_index + 1); + g_free(str_url); + } + gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_SINGLE); + return TRUE; +} + +static gint enter_key_pressed_in_entry(GtkWidget *widget) +{ + widget = widget; + gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_SINGLE); + return TRUE; +} + +static gint clear_entry(GtkWidget *widget) +{ + widget = widget; + gtk_entry_set_text(GTK_ENTRY(entry_url), ""); + gtk_widget_grab_focus(GTK_WIDGET(entry_url)); + return TRUE; +} + +static gint checkbox_toggled(GtkCellRendererToggle *renderer, gchar *path_str, gpointer tree_view) +{ + GtkTreeModel *tree_model; + GtkTreeIter iter; + FList *flist2; + gboolean checked; + + renderer = renderer; + tree_model = gtk_tree_view_get_model(GTK_TREE_VIEW(tree_view)); + if (gtk_tree_model_get_iter_from_string(tree_model, &iter, path_str)) { + gtk_tree_model_get(tree_model, &iter, + COLUMN_INT, &f_index, + COLUMN_BOOLEAN_CHECKED, &checked, + -1); + checked = !checked; + gtk_list_store_set(GTK_LIST_STORE(tree_model), &iter, + COLUMN_BOOLEAN_CHECKED, checked, + -1); + if (IS_FLIST(flist)) { + flist2 = f_list_nth(flist, f_index + 1); + if (IS_FLIST(flist2)) + flist2->selected = checked; + } + } + return TRUE; +} + +static void select_all(GtkTreeView *tree_view) +{ + GtkTreeModel *tree_model; + GtkTreeIter iter; + FList *flist2; + + tree_model = gtk_tree_view_get_model(tree_view); + if (gtk_tree_model_get_iter_first(tree_model, &iter)) { + do + gtk_list_store_set(GTK_LIST_STORE(tree_model), &iter, + COLUMN_BOOLEAN_CHECKED, TRUE, + -1); + while (gtk_tree_model_iter_next(tree_model, &iter)); + if (IS_FLIST(flist)) + for (flist2 = f_list_first(flist); IS_FLIST(flist2); flist2 = flist2->next) + flist2->selected = TRUE; + } +} + +static void unselect_all(GtkTreeView *tree_view) +{ + GtkTreeModel *tree_model; + GtkTreeIter iter; + FList *flist2; + + tree_model = gtk_tree_view_get_model(tree_view); + if (gtk_tree_model_get_iter_first(tree_model, &iter)) { + do + gtk_list_store_set(GTK_LIST_STORE(tree_model), &iter, + COLUMN_BOOLEAN_CHECKED, FALSE, + -1); + while (gtk_tree_model_iter_next(tree_model, &iter)); + if (IS_FLIST(flist)) + for (flist2 = f_list_first(flist); IS_FLIST(flist2); flist2 = flist2->next) + flist2->selected = FALSE; + } +} + +/* select and scroll to row */ +void highlight_and_go_to_row(GtkTreeView *tree_view, GtkTreeSelection *selection, int row) +{ + GtkTreeModel *tree_model; + GtkTreePath *tree_path; + GtkTreeIter iter; + int i = 0; + + if (row > 0) { + tree_model = gtk_tree_view_get_model(tree_view); + tree_path = gtk_tree_path_new_first(); + if (gtk_tree_model_get_iter_first(tree_model, &iter)) { + while (gtk_tree_model_iter_next(tree_model, &iter) && i++ < row - 1) + gtk_tree_path_next(tree_path); + gtk_tree_selection_select_path(selection, tree_path); + gtk_tree_view_set_cursor_on_cell(tree_view, tree_path, NULL, NULL, FALSE); + gtk_tree_view_scroll_to_cell(tree_view, tree_path, NULL, FALSE, 0.5, 0); + } + } +} + +/* clear the list before filling it */ +static void fill_list_store_from_flnode(GtkListStore *list_store) +{ + FList *flist2; + GtkTreeIter iter; + int i = 0; + + gtk_list_store_clear(list_store); + if (IS_FLIST(flist)) + for (flist2 = f_list_first(flist); IS_FLIST(flist2); flist2 = flist2->next) { + gtk_list_store_append(list_store, &iter); + gtk_list_store_set(list_store, &iter, + COLUMN_INT, i, + COLUMN_BOOLEAN_CHECKED, flist2->selected, + COLUMN_STRING_TITLE, flist2->title, + COLUMN_STRING_URL, flist2->url, + -1); + i++; + } +} + +static int add_feed_to_flnode_and_list_store(Resource *resrc, GtkListStore *list_store) +{ + int rss_status; + char rss_feed_title[FEED_TITLE_MAXLEN + 1]; + char rss_feed_link[FILE_NAME_MAXLEN + 1]; + char rss_feed_ttl[32]; + + str_n_cpy(resrc->id, (char *)gtk_entry_get_text(GTK_ENTRY(entry_url)), FILE_NAME_MAXLEN); + if ((rss_status = get_feed(resrc, get_params())) == OK) { + if (IS_FLIST(flist)) + flist = f_list_last(flist); + if (get_feed_info(resrc->id, rss_feed_title, rss_feed_link, rss_feed_ttl) == OK) + /* added url is set unselected */ + flist = f_list_add_at_end(flist, resrc->id, rss_feed_title, FALSE); + else + flist = f_list_add_at_end(flist, resrc->id, "", FALSE); + flist = f_list_sort(flist); + fill_list_store_from_flnode(list_store); + } + return rss_status; +} + +/* + * open a dialog with a list of urls to choose from and an url entry + * + * entry format in url list file: + * ["*" (selected) or "-" (unselected) + url [+ ">" + title] + '\n'] + * + * entry max length = FILE_NAME_MAXLEN + * see also: (UN)SELECTED_URL_CHAR in tickr.h + */ +void get_new_url(Resource *resrc) +{ + TickerEnv *env; + GtkWidget *vbox, *sc_win, *hbox, *label[3]; + GtkWidget *cancel_but, *selectall_but, *unselectall_but; + GtkWidget *top_but, *home_but, *remove_but, *add_but; + GtkWidget *single_but, *selection_but, *clear_but; + GtkTreeView *tree_view = NULL; + GtkListStore *list_store = NULL; + GtkTreeModel *tree_model = NULL; + GtkTreeIter iter; + GtkCellRenderer *renderer1 = NULL, *renderer2 = NULL, *renderer3 = NULL; + GtkTreeViewColumn *column1 = NULL, *column2 = NULL, *column3 = NULL; + GtkTreeSelection *selection = NULL; + FList *flist2 = NULL; + Resource resrc_bak; + gint response; + gint cursor_position; + + env = get_ticker_env(); + env->suspend_rq = TRUE; + gtk_window_set_keep_above(GTK_WINDOW(env->win), FALSE); + + dialog = gtk_dialog_new_with_buttons( + "Feed Picker (RSS/Atom)", GTK_WINDOW(env->win), + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + NULL); + + cancel_but = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); + selectall_but = gtk_dialog_add_button(GTK_DIALOG(dialog), "Select All", GTK_RESPONSE_SELECT_ALL); + unselectall_but = gtk_dialog_add_button(GTK_DIALOG(dialog), "Unselect All", GTK_RESPONSE_UNSELECT_ALL); + top_but = gtk_dialog_add_button(GTK_DIALOG(dialog), "Top", GTK_RESPONSE_TOP); + home_but = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_HOME, GTK_RESPONSE_HOME); + remove_but = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_REMOVE, GTK_RESPONSE_REMOVE); + add_but = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_ADD, GTK_RESPONSE_ADD); + single_but = gtk_dialog_add_button(GTK_DIALOG(dialog), "OK (Single)", GTK_RESPONSE_SINGLE); + selection_but = gtk_dialog_add_button(GTK_DIALOG(dialog), "OK (Selec)", GTK_RESPONSE_SELECTION); + clear_but = gtk_button_new_with_label("Clear"); + + cancel_but = cancel_but; /* to get rid of one compiler warning */ + selectall_but = selectall_but; + unselectall_but = unselectall_but; + top_but = top_but; + home_but = home_but; + remove_but = remove_but; + add_but = add_but; + single_but = single_but; + selection_but = selection_but; + clear_but = clear_but; /* until here */ + + set_tickr_icon_to_dialog(GTK_WINDOW(dialog)); + gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ALWAYS); + + vbox = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), vbox, FALSE, TRUE, 0); + gtk_container_set_border_width(GTK_CONTAINER(GTK_BOX(vbox)), 15); + + str_n_cpy(home_feed, get_params()->homefeed, FILE_NAME_MAXLEN); + list_store = gtk_list_store_new(N_COLUMNS, G_TYPE_INT, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING); + + if (IS_FLIST(get_feed_list())) + f_list_free_all(get_feed_list()); + if (f_list_load_from_file(&flist, NULL) == OK) { + flist = f_list_sort(flist); + fill_list_store_from_flnode(list_store); + } else + flist = NULL; + set_feed_list(flist); + + tree_view = GTK_TREE_VIEW(gtk_tree_view_new_with_model(GTK_TREE_MODEL(list_store))); + + renderer1 = gtk_cell_renderer_toggle_new(); + gtk_cell_renderer_toggle_set_radio(GTK_CELL_RENDERER_TOGGLE(renderer1), FALSE); + column1 = gtk_tree_view_column_new_with_attributes(NULL, renderer1, + "active", COLUMN_BOOLEAN_CHECKED, NULL); + gtk_tree_view_append_column(tree_view, column1); + + renderer2 = gtk_cell_renderer_text_new(); + column2 = gtk_tree_view_column_new_with_attributes("Feed Title", renderer2, + "text", COLUMN_STRING_TITLE, NULL); + gtk_tree_view_append_column(tree_view, column2); + + renderer3 = gtk_cell_renderer_text_new(); + column3 = gtk_tree_view_column_new_with_attributes("Feed URL", renderer3, + "text", COLUMN_STRING_URL, NULL); + gtk_tree_view_append_column(tree_view, column3); + + sc_win = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sc_win), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_widget_set_size_request(sc_win, -1, SC_WIN_HEIGHT); + + gtk_container_add(GTK_CONTAINER(vbox), sc_win); + gtk_container_add(GTK_CONTAINER(sc_win), GTK_WIDGET(tree_view)); + + label[0] = gtk_label_new(""); + gtk_container_add(GTK_CONTAINER(vbox), label[0]); + + selection = gtk_tree_view_get_selection(tree_view); + gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE); + + g_signal_connect(G_OBJECT(selection), "changed", G_CALLBACK(tree_selection_changed), NULL); + g_signal_connect(G_OBJECT(tree_view), "row_activated", G_CALLBACK(double_click_on_tree_view), NULL); + g_signal_connect(G_OBJECT(renderer1), "toggled", G_CALLBACK(checkbox_toggled), tree_view); + + hbox = gtk_hbox_new(FALSE, 0); + label[1] = gtk_label_new("Enter new URL:"); + gtk_box_pack_start(GTK_BOX(hbox), label[1], FALSE, FALSE, 0); + label[2] = gtk_label_new(" "); + gtk_box_pack_start(GTK_BOX(hbox), label[2], TRUE, FALSE, 0); + entry_url = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(entry_url), FILE_NAME_MAXLEN); + gtk_entry_set_width_chars(GTK_ENTRY(entry_url), URL_ENTRY_LENGTH); + gtk_box_pack_start(GTK_BOX(hbox), entry_url, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox), clear_but, FALSE, FALSE, 0); + gtk_container_add(GTK_CONTAINER(vbox), hbox); + + g_signal_connect(G_OBJECT(entry_url), "activate", G_CALLBACK(enter_key_pressed_in_entry), NULL); + g_signal_connect(G_OBJECT(clear_but), "clicked", G_CALLBACK(clear_entry), NULL); + g_signal_connect(G_OBJECT(dialog), "key-press-event", G_CALLBACK(esc_key_pressed), NULL); + g_signal_connect(G_OBJECT(dialog), "delete_event", G_CALLBACK(force_quit_dialog), NULL); + + gtk_widget_show_all(dialog); + gtk_widget_set_size_request(sc_win, -1, SC_WIN_HEIGHT); + + /* backup last valid opened resource (if any) */ + str_n_cpy(resrc_bak.id, resrc->id, FILE_NAME_MAXLEN); + /* is it better like that ? */ + if (IS_FLIST(flist) && resrc->id[0] != '\0') + if ((f_index = f_list_search(flist, resrc->id)) > -1) + highlight_and_go_to_row(tree_view, selection, f_index + 1); + gtk_widget_grab_focus(GTK_WIDGET(tree_view)); + + while ((response = gtk_dialog_run(GTK_DIALOG(dialog))) != GTK_RESPONSE_CLOSE) { + if (response == GTK_RESPONSE_SELECT_ALL) { + if (question_win("Select all URLs ?") == YES) + select_all(tree_view); + } else if (response == GTK_RESPONSE_UNSELECT_ALL) { + if (question_win("Unselect all URLs ?") == YES) + unselect_all(tree_view); + } else if (response == GTK_RESPONSE_TOP) { + highlight_and_go_to_row(tree_view, selection, 1); + } else if (response == GTK_RESPONSE_HOME) { + gtk_entry_set_text(GTK_ENTRY(entry_url), (const gchar *)home_feed); + if (IS_FLIST(flist)) { + if ((f_index = f_list_search(flist, + gtk_entry_get_text(GTK_ENTRY(entry_url)))) > -1) + highlight_and_go_to_row(tree_view, selection, f_index + 1); + } + } else if (response == GTK_RESPONSE_REMOVE) { + if (IS_FLIST(flist) && f_index > -1) { + if (gtk_tree_selection_get_selected(selection, &tree_model, &iter) && + question_win("Remove selected URL from list ?") == YES) { + gtk_list_store_remove(list_store, &iter); + flist = f_list_remove(flist); + if (f_list_count(flist) > 0) + set_feed_list(f_list_first(flist)); + else + set_feed_list(NULL); + f_index = -1; + gtk_entry_set_text(GTK_ENTRY(entry_url), ""); + } + } else + warning(FALSE, 1, "You must select an URL first"); + } else if (response == GTK_RESPONSE_ADD) { + if (gtk_entry_get_text(GTK_ENTRY(entry_url))[0] != '\0') { + cursor_position = gtk_editable_get_position(GTK_EDITABLE(entry_url)); + str_n_cpy(resrc->id, gtk_entry_get_text(GTK_ENTRY(entry_url)), FILE_NAME_MAXLEN); + if (add_feed_to_flnode_and_list_store(resrc, list_store) == OK) { + if ((f_index = f_list_search(flist, + gtk_entry_get_text(GTK_ENTRY(entry_url)))) > -1) + highlight_and_go_to_row(tree_view, selection, f_index + 1); + /* backup last valid opened resource (if any) */ + str_n_cpy(resrc_bak.id, resrc->id, FILE_NAME_MAXLEN); + } else { + /* restore last valid opened resource (if any) */ + str_n_cpy(resrc->id, resrc_bak.id, FILE_NAME_MAXLEN); + gtk_widget_grab_focus(GTK_WIDGET(entry_url)); + gtk_editable_set_position(GTK_EDITABLE(entry_url), cursor_position); + continue; + } + } else { + warning(FALSE, 1, "You must enter an URL first"); + gtk_widget_grab_focus(GTK_WIDGET(entry_url)); + continue; + } + } else if (response == GTK_RESPONSE_SINGLE) { + if (f_index > -1 && gtk_entry_get_text(GTK_ENTRY(entry_url))[0] == '\0') + tree_selection_changed(selection); + if (gtk_entry_get_text(GTK_ENTRY(entry_url))[0] != '\0') { + if (add_feed_to_flnode_and_list_store(resrc, list_store) == OK) { + env->selection_mode = SINGLE; + env->reload_rq = TRUE; + break; + } else + /* restore last valid opened resource (if any) */ + str_n_cpy(resrc->id, resrc_bak.id, FILE_NAME_MAXLEN); + } else + warning(FALSE, 1, "You must enter or select an URL first"); + } else if (response == GTK_RESPONSE_SELECTION) { + if (IS_FLIST(flist)) { + for (flist2 = f_list_first(flist); IS_FLIST(flist2); flist2 = flist2->next) + if (flist2->selected) + break; + if (IS_FLIST(flist2)) { + if (flist2->selected) { + env->selection_mode = MULTIPLE; + env->reload_rq = TRUE; + break; + } + } + warning(FALSE, 1, "Selection is empty"); + } else + warning(FALSE, 1, "URL list is empty"); + } + gtk_widget_grab_focus(GTK_WIDGET(tree_view)); + } + if (list_store != NULL) + g_object_unref(list_store); + if (IS_FLIST(flist)) { + flist = f_list_first(flist); + f_list_save_to_file(flist, NULL); + set_feed_list(flist); + build_feed_selection_from_feed_list(); + if (IS_FLIST(get_feed_selection()) && response == GTK_RESPONSE_SELECTION) + first_feed(); + } + gtk_widget_destroy(dialog); + check_main_win_always_on_top(); + env->suspend_rq = FALSE; +} +#endif diff -Nru tickr-0.5.5/src/tickr/tickr.h tickr-0.6.0/src/tickr/tickr.h --- tickr-0.5.5/src/tickr/tickr.h 2011-12-18 01:08:28.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr.h 2012-03-07 02:01:00.000000000 +0100 @@ -1,5 +1,5 @@ /* - * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2011 + * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2012 * * * This program is free software: you can redistribute it and/or modify @@ -16,13 +16,16 @@ * along with this program. If not, see . */ +#ifndef INC_TICKR_H +#define INC_TICKR_H + #define APP_NAME "Tickr" #define APP_CMD "tickr" -#define APP_VERSION_NUMBER "0.5.5" +#define APP_VERSION_NUMBER "0.6.0" #define APP_WEBSITE "http://www.newsrssticker.com" #define APP_SUPPORT_WEBSITE "http://www.newsrssticker.com/help.php" #define APP_DOWNLOAD_WEBSITE "http://www.newsrssticker.com/download.php" -#define APP_SUPPORT_EMAIL "newsrssticker@gmail.com"/*"contact@newsrssticker.com"*/ +#define APP_SUPPORT_EMAIL "tickrfeedreader@gmail.com"/*"contact@newsrssticker.com"*/ #define _GNU_SOURCE #define _ISOC99_SOURCE @@ -61,8 +64,9 @@ # include # include #else -/*# include */ -# define _WIN32_WINNT 0x0501 /* win version = xp or higher */ +/* win version = xp or higher */ +# define WINVER 0x0501 +# define _WIN32_WINNT 0x0501 # include # include # include @@ -77,7 +81,9 @@ #endif #include #include -#include "../libetm-0.4.2/libetm.h" +#include "../libetm-0.4.3/libetm.h" +#include "tickr_socket.h" +#include "tickr_list.h" #define USE_GUI TRUE /* to implement or not gui/menu features at compile time * otherwise, cli only app */ @@ -103,10 +109,10 @@ #define OPTION_NAME_MAXLEN 31 #define OPTION_VALUE_MAXLEN MAX(MAX(FILE_NAME_MAXLEN, FONT_MAXLEN), DELIMITER_MAXLEN) #define OPTION_MAXLEN OPTION_NAME_MAXLEN + OPTION_VALUE_MAXLEN + 4 /* -name="value" */ -#define NOPTIONSMAX 64 /* max number of options */ -#define NURLMAX 512 /* max number of url's */ +#define N_OPTION_MAX 64 /* max number of options */ +#define N_URL_MAX 1024 /* max number of url's */ #define NFEEDLINKANDOFFSETMAX 256 /* max number of "open-able" links per feed */ -#define LINKTAG_CHAR '^' /* ascii 5E - char used internally for links, removed from feed text */ +#define LINK_TAG_CHAR '^' /* ascii 5E - char used internally for links, removed from feed text */ #define TMPSTR_SIZE (2 * 1024 - 1) /* used for most tmp strings - must be large enough */ #ifndef G_OS_WIN32 # define SEPARATOR_CHAR '/' @@ -126,7 +132,7 @@ #define XPIXMAP_MAXWIDTH (32 * 1024 - 1) /* 32 K - 1 = max supported width for xpixmaps * (not 64 k - 1 as sometimes uncorrectly specified) */ -#define LINE_MAXLEN 128 /* max length of a single line (see news_render.c) */ +#define LINE_MAXLEN 128 /* max length of a single line (see tickr_render.c) */ #define WORD_MAXLEN 32 /* max length of a word that won't get cut off */ #if (LINE_MAXLEN <= WORD_MAXLEN) # error LINE_MAXLEN must be > WORD_MAXLEN @@ -141,18 +147,18 @@ * /usr/share/APP_CMD/pixmpas/ * /home//.APP_CMD/ * - * win32 version: C:\Program files\APP_NAME (also location for pixmaps) - * C:\...\Application Data\APP_NAME + * win32 version: C:\Program files\APP_NAME\ (also location for pixmaps) + * C:\...\Application Data\APP_NAME\ */ #ifndef G_OS_WIN32 -# define NEWS_DIR_NAME "."APP_CMD +# define TICKR_DIR_NAME "."APP_CMD #else -# define NEWS_DIR_NAME APP_NAME +# define TICKR_DIR_NAME APP_NAME #endif -#define CONFIGFILE APP_CMD"-conf" -#define URLLIST APP_CMD"-url-list" -#define RESOURCEDUMP APP_CMD"-resrc-dump" -#define XMLDUMP APP_CMD"-xml-dump" +#define CONFIG_FILE APP_CMD"-conf" +#define URL_LIST_FILE APP_CMD"-url-list" +#define RESOURCE_DUMP APP_CMD"-resrc-dump" +#define XML_DUMP APP_CMD"-xml-dump" #define TMP1 "tmp1" #define TMP2 "tmp2" #ifndef G_OS_WIN32 @@ -160,9 +166,11 @@ # define STD_ERR stderr #else # define STD_OUT stdout_fp -# define STDOUT_FILENAME "stdout.txt" +# define STDOUT_FILENAME1 "stdout1.txt" +# define STDOUT_FILENAME2 "stdout2.txt" # define STD_ERR stderr_fp -# define STDERR_FILENAME "stderr.txt" +# define STDERR_FILENAME1 "stderr1.txt" +# define STDERR_FILENAME2 "stderr2.txt" #endif #ifndef G_OS_WIN32 # define INSTALL_PATH "/usr/share/"APP_CMD @@ -170,8 +178,8 @@ #else # define IMAGES_PATH APP_NAME /* actually not a path but a dir name */ #endif -#define NEWS_ICON APP_CMD"-icon.png" -#define NEWS_LOGO APP_CMD"-logo.png" +#define TICKR_ICON APP_CMD"-icon.png" +#define TICKR_LOGO APP_CMD"-logo.png" #define RSS_ICON APP_CMD"-rss-icon.png" /* default config values */ @@ -210,7 +218,6 @@ #define RSSDESCRIPTION 'n' #define RSSDESCRIPTIONDELIMITER " - " #define NITEMSPERFEED 5 -/*#define READINLOOP 'y'*/ #define STRIPHTMLTAGS 'y' #define UPPERCASETEXT 'n' #define HOMEFEED "http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml" @@ -273,7 +280,13 @@ typedef enum { WIN_WITH_SPINNER_OPEN, WIN_WITH_SPINNER_CLOSE -} spinner_win_mode; +} win_with_spinner_mode; + +typedef enum { + WIN_WITH_PROGRESS_BAR_OPEN, + WIN_WITH_PROGRESS_BAR_PULSE, + WIN_WITH_PROGRESS_BAR_CLOSE +} win_with_progress_bar_mode; typedef enum { AUTH_PAGE, @@ -382,7 +395,6 @@ char rss_description; char rss_description_delimiter[DELIMITER_MAXLEN + 1]; int n_items_per_feed; - /*char read_in_loop;*/ char strip_html_tags; char upper_case_text; char homefeed[FILE_NAME_MAXLEN + 1]; @@ -412,7 +424,7 @@ /* error codes */ typedef enum { - OK = LIBETM_LASTERRORCODE + 1, + OK = SOCKET_LASTERRORCODE + 1, RESOURCE_ERROR, RESOURCE_UNSPECIFIED, @@ -433,8 +445,6 @@ FEED_ERROR, FEED_EMPTY, FEED_UNPARSABLE, - FEED_CANTCREATEXMLDUMP, - FEED_CANTREADXMLDUMP, RSS_NO_ITEM_ELEMENT, ATOM_NO_ENTRY_ELEMENT, FEED_DOWNLOAD_ERROR, @@ -449,7 +459,9 @@ RENDER_CREATE_CAIRO_IMAGE_SURFACE_ERROR, RENDER_OTHER_ERROR, + FLIST_ERROR, LOAD_URL_LIST_ERROR, + LOAD_URL_LIST_EMPTY_LIST, SAVE_URL_LIST_ERROR, CREATE_FILE_ERROR, @@ -461,18 +473,6 @@ OPML_ERROR, - SOCK_ERROR, - SOCK_CANT_CONNECT, - SOCK_SHOULD_BE_CLOSED, - - SELECT_ERROR, - SELECT_TIMED_OUT, - SELECT_TRUE, - SELECT_FALSE, - - SEND_ERROR, - RECV_ERROR, - CONNECTION_CLOSED_BY_SERVER, CONNECT_TOO_MANY_ERRORS, HTTP_ERROR, @@ -497,33 +497,36 @@ WIN32V_ERROR } tickr_error_code; -/* news_main.c */ -void check_main_win_always_on_top(); -gboolean params_have_been_changed(Params *, int); -void check_time_load_resource(); +/* tickr_main.c */ TickerEnv *get_ticker_env(); Resource *get_resource(); +FList *get_feed_list(); +void set_feed_list(FList *); +FList *get_feed_selection(); +void set_feed_selection(FList *); Params *get_params(); -char **get_get_selected_url(); int get_instance_id(); +void check_main_win_always_on_top(); +gboolean params_have_been_changed(Params *, int); gint update_everything(); -/* news_resource.c */ +/* tickr_resource.c */ +int build_feed_selection_from_feed_list(); void current_feed(); -gboolean previous_feed(); -gboolean next_feed(); void first_feed(); void last_feed(); -int load_resource(Resource *, char **); +gboolean previous_feed(); +gboolean next_feed(); +int load_resource(Resource *, FList *); int format_resource(Resource *); -void set_news_icon_to_dialog(GtkWindow *); +void set_tickr_icon_to_dialog(GtkWindow *); FILE *open_new_datafile_with_name(const char *, const char *); -const char *get_datafile_full_name_from_name(const char *); -const char *get_imagefile_full_name_from_name(const char *); -const char *get_datadir_full_path(); -const char *usr_home_dir(); +char *get_datafile_full_name_from_name(const char *); +char *get_imagefile_full_name_from_name(const char *); +char *get_datadir_full_path(); +char *usr_home_dir(); -/* news_render.c */ +/* tickr_render.c */ cairo_surface_t *render_stream_to_surface(FILE *, FeedLinkAndOffset *, const Params *, int *); char *stream_to_htext(FILE *, char *, PangoLayout *, const Params *, int *); char *void_stream_to_htext(char *, PangoLayout *); @@ -533,7 +536,7 @@ gint get_layout_height(PangoLayout *, const char *); void pango_layout_get_pixel_size2(PangoLayout *, int *, int *); -/* news_params.c */ +/* tickr_params.c */ void set_default_options(Params *); int get_config_file_options(Params *); int parse_options_array(Params *, int, const char *[]); @@ -544,11 +547,11 @@ void split_font(const char *, char *, char *); void compact_font(char *, const char *, const char *); -/* news_clock.c */ +/* tickr_clock.c */ void display_time(const Params *); gint get_clock_width(const Params *); -/* news_rss.c */ +/* tickr_feedparser.c */ int get_feed(Resource *, const Params *); int parse_rss20_xml_file(FILE *, const char *, FeedLinkAndOffset *link_and_offset,\ const Params *); @@ -568,44 +571,32 @@ int get_feed_info(const char *, char *, char *, char *); void get_xml_first_element(xmlNode *, xmlDoc *, char *, char *, int); -/* news_list.c */ -char **init_url_list(); -char **init_selected_url_list(); -char **get_url_list(); -char **get_selected_url_list(); -int load_selected_url_list(char **); -int load_url_list(char **); -void sort_url_list(char **, int); -int save_url_list(char **); -void remove_url_from_list(char **, int); -int search_in_url_list(char **, const char *); -gboolean str_has_title(char *); -char *str_without_title(char *); - -/* news_rsswin.c */ +/* tickr_feedpicker.c */ +void highlight_and_go_to_row(GtkTreeView *, GtkTreeSelection *, int); void get_new_url(Resource *); -/* news_prefwin.c */ +/* tickr_prefwin.c */ int modify_params(Params *); -/* news_otherwins.c */ +/* tickr_otherwins.c */ void open_new_txt_file(Resource *resrc); void help_win(); void about_win(); void info_win(const char *, const char *, info_type, gboolean); void info_win_wait(const char *, int); int question_win(const char *); -int question_win_always_on_top(const char *); -void win_with_spinner(spinner_win_mode, const char *); +int question_win_at(const char *, int); +void win_with_spinner(win_with_spinner_mode, const char *); +void win_with_progress_bar(win_with_progress_bar_mode, const char *); -/* news_misc.c */ +/* tickr_misc.c */ void import_params(); void export_params(); void online_help(); -void warning(const char *, const char*, const char*, const char *, gboolean); +void warning(gboolean, int, ...); void dump_font_list(); -/* news_hlptxt.c */ +/* tickr_hlptxt.c */ #if USE_GUI const char **get_help_str0(); #endif @@ -613,25 +604,21 @@ const char **get_license_str1(); const char *get_license_str2(); -/* news_ompl.c */ +/* tickr_ompl.c */ void import_opml_file(); char *pick_opml_file(); int parse_opml_xml_file(const char *); void get_opml_selected_element(xmlNode *, const char *, const char *); void export_opml_file(); -char *create_opml_str_from_url_list(char **); +char *create_opml_str_from_feed_list_node(FList *); int save_str_as_opml_file(const char *); -/* news_http.c */ -#ifndef G_OS_WIN32 -int connect_with_url(int *, char *); -#else -int connect_with_url(SOCKET *, char *); -#endif +/* tickr_http.c */ +int connect_with_url(sockt *, char *); int fetch_resource(const char *, const char *, char *); const char *build_http_request(const char *, const char *, const char *,\ const char *); -int get_http_response(int, const char *, const char *, const char *,\ +int get_http_response(sockt, const char *, const char *, const char *,\ char **, char **, int *); int get_http_status_code(const char *); const char *get_http_header_value(const char *, const char *); @@ -641,21 +628,11 @@ const char *get_scheme_from_url(const char*); const char *get_host_from_url(const char*); const char *get_path_from_url(const char*); -#ifndef G_OS_WIN32 -int connect_to_host(const char *, const char *); -int writable_data_is_available_on_socket(int); -int readable_data_is_available_on_socket(int); -int send_full(int, const char *); -char *recv_full(int, int *, int *); -#else -SOCKET connect_to_host(const char *, const char *); -int writable_data_is_available_on_socket(SOCKET); -int readable_data_is_available_on_socket(SOCKET); -int send_full(SOCKET, const char *); -char *recv_full(SOCKET, int *, int *); -#endif -/* news_connectwin.c */ +/* tickr_socket.c */ +/* proto moved into tickr_socket.h */ + +/* tickr_connectwin.c */ void init_authentication(); void init_proxy(); void compute_auth_and_proxy_str(); @@ -675,3 +652,7 @@ char *get_proxy_auth_user(); char *get_proxy_auth_psw(); char *get_proxy_auth_str(); + +/* tickr_quickfeedpicker.c */ +void quick_feed_picker(int); +#endif /* INC_TICKR_H */ diff -Nru tickr-0.5.5/src/tickr/tickr_helptext.c tickr-0.6.0/src/tickr/tickr_helptext.c --- tickr-0.5.5/src/tickr/tickr_helptext.c 2011-12-17 21:20:50.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr_helptext.c 2012-03-07 02:01:00.000000000 +0100 @@ -1,5 +1,5 @@ /* - * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2011 + * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2012 * * * This program is free software: you can redistribute it and/or modify @@ -26,14 +26,14 @@ "- To open a link in your Browser, left-click on the text.\n\n", -"Basically, you will use 'File > Open RSS Feed' to choose a feed from a list\n", +"Basically, you will use 'File > Open Feed (RSS|Atom)' to choose a feed from a list\n", "or to subscribe to a new one and 'Edit > Preferences' to tweak the ticker\n", "appearance as well as other settings.\n\n", "***ONLY*** in case you're using the ticker inside a ***decorated*** window,\n", "you can use keyboard shortcuts:\n\n", -"- R to open the RSS Feed Picker window (to choose a feed or to\n", +"- R to open the Feed Picker window (to choose a feed or to\n", " subscribe to a new one.)\n\n", "- T to open a text file.\n\n", @@ -76,11 +76,11 @@ #endif static const char *help_str1[] = { - APP_NAME"-"APP_VERSION_NUMBER" - GTK-based highly graphically-customizable RSS Ticker\n", - "Copyright (C) 2009-2011 Emmanuel Thomas-Maurin \n\n", - APP_NAME" is a GTK-based RSS Reader that displays feeds as a smooth scrolling line\n", - "on your Desktop, as known from TV stations. Open feed links in your favourite\n", - "Browser. Graphics are highly customizable.\n\n", + APP_NAME"-"APP_VERSION_NUMBER" - GTK-based highly graphically-customizable Feed Ticker\n", + "Copyright (C) 2009-2012 Emmanuel Thomas-Maurin \n\n", + APP_NAME" is a GTK-based RSS/Atom Reader that displays feeds as a smooth\n" + "scrolling line on your Desktop, as known from TV stations. Open feed\n" + "links in your favourite Browser. Graphics are highly customizable.\n\n" "Usage:\n", " "APP_CMD" [-help / -version / -license / -instance-id=n / -dumpfontlist]\n", " [options (-name[=value])...] [resource (file name or URL)]\n\n", @@ -123,7 +123,6 @@ " rssdescription=[y/n] Show or hide description\n\n", " rssdescriptiondelimiter='str' String to be appended after description\n\n", " nitemsperfeed=n Read N items max per feed\n\n", -/* " readinloop=[y/n] Read in loop / read only once\n\n",*/ " rmtags=[y/n] Strip html tags\n\n", " uppercasetext=[y/n] Set all text to upper case\n\n", " homefeed='str' Set URL as 'homefeed' = homepage\n", @@ -167,10 +166,10 @@ APP_NAME" parses command line arguments and looks for option(s) then for one\n", "resource, the rest of the line is ignored. It reads too configuration file\n", #ifndef G_OS_WIN32 - "'"APP_CMD"-conf' located in /home//"NEWS_DIR_NAME"/ if it exists (or\n", + "'"APP_CMD"-conf' located in /home//"TICKR_DIR_NAME"/ if it exists (or\n", "'"APP_CMD"-conf' if an instance id has been set to n.)\n\n", #else - "'"APP_CMD"-conf' located in "NEWS_DIR_NAME"/ if it exists (or\n", + "'"APP_CMD"-conf' located in "TICKR_DIR_NAME"/ if it exists (or\n", "'"APP_CMD"-conf' if an instance id has been set to n.)\n\n", #endif "Command line options override configuration file ones which override default\n", @@ -180,7 +179,7 @@ NULL}; static const char *license_str1[] = { - APP_NAME" version "APP_VERSION_NUMBER" - Copyright (C) Emmanuel Thomas-Maurin 2009-2011\n\n", + APP_NAME" version "APP_VERSION_NUMBER" - Copyright (C) Emmanuel Thomas-Maurin 2009-2012\n\n", APP_NAME" is free software: you can redistribute it and/or modify\n", "it under the terms of the GNU General Public License as published by\n", "the Free Software Foundation, either version 3 of the License, or\n", diff -Nru tickr-0.5.5/src/tickr/tickr_html_entities.h tickr-0.6.0/src/tickr/tickr_html_entities.h --- tickr-0.5.5/src/tickr/tickr_html_entities.h 2011-11-07 18:29:06.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr_html_entities.h 2012-03-07 02:01:00.000000000 +0100 @@ -1,5 +1,5 @@ /* - * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2011 + * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2012 * * * This program is free software: you can redistribute it and/or modify @@ -18,7 +18,7 @@ char *html_entity[] = { /* - * special entities 1/2 (very used ones) + * special entities 1/2 (most common ones) */ """, """, "\"", "&", "&", "&", diff -Nru tickr-0.5.5/src/tickr/tickr_http.c tickr-0.6.0/src/tickr/tickr_http.c --- tickr-0.5.5/src/tickr/tickr_http.c 2011-12-16 04:52:45.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr_http.c 2012-03-07 02:01:00.000000000 +0100 @@ -1,5 +1,5 @@ /* - * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2011 + * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2012 * * * This program is free software: you can redistribute it and/or modify @@ -20,27 +20,17 @@ #ifdef G_OS_WIN32 extern FILE *stdout_fp, *stderr_fp; -static gchar *error_msg; - #endif /* are these values ok? */ #define HTTP_REQUEST_MAXLEN (8 * 1024 - 1) #define HTTP_HEADER_FIELD_MAXLEN (2 * 1024 - 1) -#define RECV_CHUNK_LEN (16 * 1024 - 1) -#define CONNECT_TIMEOUT 5 -#define SEND_RECV_TIMEOUT 1 #define MAX_HTTP_REDIRECT 8 #define DEFAULT_HTTP_PORT_STR "80" #define DEFAULT_HTTPS_PORT_STR "443" #define PORT_STR_MAXLEN PROXY_PORT_MAXLEN #define TAB '\x09' -#ifndef G_OS_WIN32 -# define CLOSE_SOCK close(sock) -#else -# define CLOSE_SOCK closesocket(sock) -#endif /* S_MOD -> true in multiple selection mode / false otherwise */ #define S_MOD (get_ticker_env()->selection_mode == MULTIPLE) @@ -106,15 +96,10 @@ } /* get host from url but if connecting through proxy */ -#ifndef G_OS_WIN32 -int connect_with_url(int *sock, char *url) -#else -int connect_with_url(SOCKET *sock, char *url) -#endif +int connect_with_url(sockt *sock, char *url) { char host[FILE_NAME_MAXLEN + 1]; char port_num[PORT_STR_MAXLEN + 1]; - char tmp[256]; static int connect_fail_count = 0; if (!get_use_proxy()) { @@ -124,17 +109,16 @@ /* https is not supported so far */ else if (strcmp(get_scheme_from_url(url), "https") == 0) { /*str_n_cpy(port_num, DEFAULT_HTTPS_PORT_STR, PORT_STR_MAXLEN);*/ - warning(url, ":\nHTTPS protocol not currently supported", - "", "", S_MOD); + warning(S_MOD, 2, url, ":\nHTTPS protocol not currently supported"); return HTTP_UNSUPPORTED_SCHEME; } else if (strcmp(get_scheme_from_url(url), "file") == 0) ;/* do nothing here */ else if (get_scheme_from_url(url)[0] == '\0') { - warning("No scheme found in URL:", url, "", "", S_MOD); + warning(S_MOD, 2, "No scheme found in URL: ", url); return HTTP_UNSUPPORTED_SCHEME; } else { - warning("Unsupported or unknown scheme in URL:", - get_scheme_from_url(url), "", "", S_MOD); + warning(S_MOD, 2, "Unsupported or unknown scheme in URL: ", + get_scheme_from_url(url)); return HTTP_UNSUPPORTED_SCHEME; } } else { @@ -142,22 +126,17 @@ str_n_cpy(host, get_proxy_host(), FILE_NAME_MAXLEN); str_n_cpy(port_num, get_proxy_port(), PORT_STR_MAXLEN); } -#ifndef G_OS_WIN32 - if ((*sock = connect_to_host(host, port_num)) > -1) { - -#else - if ((*sock = connect_to_host(host, port_num)) != INVALID_SOCKET) { -#endif + if ((*sock = connect_to_host(host, port_num)) != SOCK_CREATE_ERROR) { connect_fail_count = 0; return OK; } else { if (get_use_proxy()) { - snprintf(tmp, 256, "%s:%s", get_proxy_host(), get_proxy_port()); - warning("Can't connect to proxy:", tmp, "", "", FALSE); + warning(FALSE, 4, "Can't connect to proxy: ", + get_proxy_host(),":", get_proxy_port()); current_feed(); connection_settings(PROXY_PAGE); } else if (get_ticker_env()->selection_mode == SINGLE) - warning("Can't connect to host:", host, "", "", FALSE); + warning(FALSE, 2, "Can't connect to host: ", host); else fprintf(STD_ERR, "Can't connect to host: %s\n", host); if (++connect_fail_count >= CONNECT_FAIL_MAX) { @@ -168,14 +147,15 @@ } } +/* *********************************** + * TODO: DOCUMENT BETTER THIS FUNC + * ***********************************/ /* we replace resrc->id with modified url and file_name = downloaded resource * maxlen of file_name, url, new_url = FILE_NAME_MAXLEN */ int fetch_resource(const char *resrc_id, const char *file_name, char *url) { -#ifndef G_OS_WIN32 - int sock; -#else - SOCKET sock; + sockt sock; +#ifdef G_OS_WIN32 gchar *win32_filename; #endif int status, recv_status; @@ -211,10 +191,10 @@ } else { g_free(response); if (error != NULL) { - warning(error->message, "", "", "", FALSE); + warning(FALSE, 1, error->message); g_error_free(error); } else - warning("Can't create file:", file_name, "", "", FALSE); + warning(FALSE, 2, "Can't create file: ", file_name); return CREATE_FILE_ERROR; } } else { @@ -226,10 +206,10 @@ g_free(win32_filename); #endif if (error != NULL) { - warning(error->message, "", "", "", S_MOD); + warning(S_MOD, 1, error->message); g_error_free(error); } else - warning("Can't open file:", url + i, "", "", S_MOD); + warning(S_MOD, 2, "Can't open file: ", url + i); return OPEN_FILE_ERROR; } } else @@ -239,7 +219,7 @@ if ((status = get_http_response(sock, "GET", "", url, &new_url, &response, &recv_status)) == SEND_ERROR || status == RECV_ERROR) { if (recv_status == CONNECTION_CLOSED_BY_SERVER || recv_status == SOCK_SHOULD_BE_CLOSED) - CLOSE_SOCK; + CLOSE_SOCK(sock); return i; } } else @@ -253,11 +233,11 @@ continue; } else if (status == HTTP_SWITCH_PROTO) { if (strcmp(get_http_header_value("Upgrade", response), "HTTP") == 0) - warning(url, ":\nSwitching to HTTP protocol requested for this connection", - "-", "Request currently not supported", S_MOD); + warning(S_MOD, 2, url, ":\nSwitching to HTTP protocol requested for this connection" + " - Request currently not supported"); else if (strcmp(get_http_header_value("Upgrade", response), "HTTPS") == 0) - warning(url, ":\nSwitching to HTTPS protocol requested for this connection", - "-", "Request currently not supported", S_MOD); + warning(S_MOD, 2, url, ":\nSwitching to HTTPS protocol requested for this connection" + " - Request currently not supported"); return status; } else if (status == OK) { if (strcmp(get_http_header_value("Transfer-Encoding", response), "chunked") == 0) { @@ -284,14 +264,13 @@ fprintf(fp, "%s", response + i); fclose(fp); free2(response); - CLOSE_SOCK; + CLOSE_SOCK(sock); return OK; } else { - warning("Can't create file:", file_name, - "", "", FALSE); + warning(FALSE, 2, "Can't create file: ", file_name); fclose(fp); free2(response); - CLOSE_SOCK; + CLOSE_SOCK(sock); return CREATE_FILE_ERROR; } } else if (status == HTTP_MOVED) { @@ -301,10 +280,10 @@ if (strcmp(get_http_header_value("Connection", response), "close") == 0 ||\ strcmp(get_scheme_from_url(url), "https") == 0) { free2(response); - CLOSE_SOCK; + CLOSE_SOCK(sock); if (strcmp(get_scheme_from_url(url), "https") == 0) { - warning(resrc_id, ":\nHTTPS protocol requested for this connection", - "(following HTTP moved) -", "Not currently supported", S_MOD); + warning(S_MOD, 2, resrc_id, ":\nHTTPS protocol requested for this connection" + " (following HTTP moved) - Not currently supported"); return HTTP_ERROR; /* ???? */ } if ((j = connect_with_url(&sock, url)) != OK) @@ -317,24 +296,24 @@ if (status != HTTP_MOVED && i <= MAX_HTTP_REDIRECT) continue; else { - warning(resrc_id, ":\nToo many HTTP redirects", "", "", S_MOD); + warning(S_MOD, 2, resrc_id, ":\nToo many HTTP redirects"); free2(response); - CLOSE_SOCK; + CLOSE_SOCK(sock); return HTTP_TOO_MANY_REDIRECTS; } } else if (status == HTTP_USE_PROXY) { - warning("Resource: ", url, "\nmust be accessed through proxy.\nProxy host:", - new_url, FALSE); + warning(FALSE, 4, "Resource: ", url, "\nmust be accessed through proxy.\nProxy host: ", + new_url); str_n_cpy(get_proxy_host(), new_url, PROXY_HOST_MAXLEN); free2(response); - CLOSE_SOCK; + CLOSE_SOCK(sock); connection_settings(PROXY_PAGE); current_feed(); return status; } else if (status == HTTP_PROXY_AUTH_REQUIRED) { /* proxy authentication */ free2(response); - CLOSE_SOCK; + CLOSE_SOCK(sock); if (get_use_proxy_auth()) { if ((i = connect_with_url(&sock, url)) != OK) return i; @@ -343,10 +322,9 @@ get_proxy_auth_str()); if ((status = get_http_response(sock, "GET", header_field, url, &new_url, &response, &recv_status)) == HTTP_PROXY_AUTH_REQUIRED) { - warning("Proxy authentication failed for:", - get_proxy_host(), "", "", FALSE); + warning(FALSE, 2, "Proxy authentication failed for: ", get_proxy_host()); free2(response); - CLOSE_SOCK; + CLOSE_SOCK(sock); if (connection_settings(PROXY_PAGE) == GTK_RESPONSE_OK) { if ((i = connect_with_url(&sock, url)) != OK) return i; @@ -357,8 +335,7 @@ } continue; } else { - warning("Proxy authentication required for:", - get_proxy_host(), "", "", FALSE); + warning(FALSE, 2, "Proxy authentication required for: ", get_proxy_host()); if (connection_settings(PROXY_PAGE) == GTK_RESPONSE_OK &&\ get_use_proxy_auth()) { if ((i = connect_with_url(&sock, url)) != OK) @@ -375,7 +352,7 @@ } else if (status == HTTP_UNAUTHORIZED) { /* http authentication - only basic so far */ free2(response); - CLOSE_SOCK; + CLOSE_SOCK(sock); if (get_use_authentication()) { if ((i = connect_with_url(&sock, url)) != OK) return i; @@ -384,9 +361,9 @@ get_http_auth_str()); if ((status = get_http_response(sock, "GET", header_field, url, &new_url, &response, &recv_status)) == HTTP_UNAUTHORIZED) { - warning("HTTP authentication failed for:", url, "", "", FALSE); + warning(FALSE, 2, "HTTP authentication failed for: ", url); free2(response); - CLOSE_SOCK; + CLOSE_SOCK(sock); if (connection_settings(AUTH_PAGE) == GTK_RESPONSE_OK) { if ((i = connect_with_url(&sock, url)) != OK) return i; @@ -397,8 +374,7 @@ } continue; } else { - warning("HTTP authentication required for:", - url, "", "", FALSE); + warning(FALSE, 2, "HTTP authentication required for: ", url); if (connection_settings(AUTH_PAGE) == GTK_RESPONSE_OK &&\ get_use_authentication()) { if ((i = connect_with_url(&sock, url)) != OK) @@ -413,38 +389,36 @@ return HTTP_NO_AUTH_CREDENTIALS; } } else if (status == HTTP_BAD_REQUEST) { - warning(url, ":\nBad Request", "", "", S_MOD); + warning(S_MOD, 2, url, ":\nBad Request"); free2(response); - CLOSE_SOCK; + CLOSE_SOCK(sock); return status; } else if (status == HTTP_FORBIDDEN) { - warning(url, ":\nForbidden", "", "", S_MOD); + warning(S_MOD, 2, url, ":\nForbidden"); free2(response); - CLOSE_SOCK; + CLOSE_SOCK(sock); return status; } else if (status == HTTP_NOT_FOUND) { - warning(url, ":\nNot found", "", "", S_MOD); + warning(S_MOD, 2, url, ":\nNot found"); free2(response); - CLOSE_SOCK; + CLOSE_SOCK(sock); return status; } else if (status == HTTP_INT_SERVER_ERROR) { - warning(url, ":\nInternal server error", "", "", - S_MOD); + warning(S_MOD, 2, url, ":\nInternal server error"); free2(response); - CLOSE_SOCK; + CLOSE_SOCK(sock); return status; } else if (status == HTTP_NO_STATUS_CODE) { - warning(url, ":\nNo HTTP status code returned", - "", "", S_MOD); + warning(S_MOD, 2, url, ":\nNo HTTP status code returned"); free2(response); - CLOSE_SOCK; + CLOSE_SOCK(sock); return status; } else { - warning(url, ":\nHTTP response status code: ", - itoa2(status - 1000), "", S_MOD); + warning(S_MOD, 3, url, ":\nHTTP response status code: ", + itoa2(status - 1000)); if (response != NULL) free2(response); - CLOSE_SOCK; + CLOSE_SOCK(sock); return HTTP_ERROR; } } @@ -469,7 +443,7 @@ * rq_str may contain header field(s) separated and ended by "\r\n" * must 'free2' response afterwards */ -int get_http_response(int sock, const char *rq_method, const char *rq_str, +int get_http_response(sockt sock, const char *rq_method, const char *rq_str, const char *rq_url, char **new_rq_url, char **response, int *recv_status) { char *str; @@ -704,413 +678,3 @@ str[0] = '\0'; return (const char *)str; } - -#ifndef G_OS_WIN32 -/* can use IPv4 or IPv6 */ -static void *get_in_addr(struct sockaddr *s_a) -{ - if (s_a->sa_family == AF_INET) - return &(((struct sockaddr_in *)s_a)->sin_addr); - else - return &(((struct sockaddr_in6 *)s_a)->sin6_addr); -} -#endif - -/* return socket fd (> 0) / -1 if error */ -#ifndef G_OS_WIN32 -int connect_to_host(const char *host, const char *portnum_str) -#else -SOCKET connect_to_host(const char *host, const char *portnum_str) -#endif -{ -#ifndef G_OS_WIN32 - int sock; - char ipa_str[INET6_ADDRSTRLEN]; -#else - SOCKET sock; - u_long i_mode = 1; /* != 0 to enable non-blocking mode */ -#endif - struct addrinfo hints, *server_info, *ptr; - fd_set readset, writeset; - struct timeval timeout; - int s_opt_value; - socklen_t s_opt_len = sizeof(int); - int i; - - /* addrinfo stuff */ - memset(&hints, 0, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; -/*#ifdef VERBOSE_OUTPUT - fprintf(STD_OUT, "Resolving %s ... ", host); -#endif*/ - if ((i = getaddrinfo(host, portnum_str, &hints, &server_info)) != 0) { - if (get_use_proxy() || get_ticker_env()->selection_mode == SINGLE) { -#ifndef G_OS_WIN32 - warning("getaddrinfo() error:", host, ":", gai_strerror(i), FALSE); -#else - error_msg = g_win32_error_message(WSAGetLastError()); - warning("getaddrinfo() error:", host, ":", error_msg, FALSE); - g_free(error_msg); -#endif - } else { -#ifndef G_OS_WIN32 - fprintf(STD_ERR, "getaddrinfo() error: %s: %s\n", host, gai_strerror(i)); -#else - error_msg = g_win32_error_message(WSAGetLastError()); - fprintf(STD_ERR, "getaddrinfo() error: %s: %s\n", host, error_msg); - g_free(error_msg); -#endif - } - return -1; - } -/*#ifdef VERBOSE_OUTPUT - fprintf(STD_OUT, "Done\n"); -#endif*/ - /* we get a list */ - for (ptr = server_info; ptr != NULL; ptr = ptr->ai_next) { - /* create socket */ -#ifndef G_OS_WIN32 - if ((sock = socket(ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol)) == -1) { - fprintf(STD_ERR, "Error: %s\n", strerror(errno)); -#else - if ((sock = socket(ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol)) == INVALID_SOCKET) { - error_msg = g_win32_error_message(WSAGetLastError()); - fprintf(STD_ERR, "Error: %s\n", error_msg); - g_free(error_msg); -#endif - continue; - } - /* set socket in non-blocking mode */ -#ifndef G_OS_WIN32 - if ((i = fcntl(sock, F_GETFL, 0)) == -1) { - fprintf(STD_ERR, "fcntl() error: %s\n", strerror(errno)); - close(sock); - break; - } else if (fcntl(sock, F_SETFL, i | O_NONBLOCK) == -1) { - fprintf(STD_ERR, "fcntl() error: %s\n", strerror(errno)); - close(sock); - break; - } -#else - if (ioctlsocket(sock, FIONBIO, &i_mode) != NO_ERROR) { - error_msg = g_win32_error_message(WSAGetLastError()); - fprintf(STD_ERR, "ioctlsocket() error %s\n", error_msg); - g_free(error_msg); - closesocket(sock); - break; - } -#endif - /* get IP addr from server_info */ -#ifdef VERBOSE_OUTPUT -#ifndef G_OS_WIN32 - inet_ntop(ptr->ai_family, get_in_addr((struct sockaddr *)ptr->ai_addr), - ipa_str, sizeof(ipa_str)); - fprintf(STD_OUT, "Connecting to %s (%s) ... ", ipa_str, host); -#else - /* available only on vista and above but we don't really need that (do we?) so disabled - InetNtop(ptr->ai_family, get_in_addr((struct sockaddr *)ptr->ai_addr), s, sizeof(s));*/ - fprintf(STD_OUT, "Connecting to %s ... ", host); -#endif - fflush(stdout); -#endif - /* connect */ -#ifndef G_OS_WIN32 - if ((i = connect(sock, ptr->ai_addr, ptr->ai_addrlen)) == -1 && errno == EINPROGRESS) { -#else - if ((i = connect(sock, ptr->ai_addr, ptr->ai_addrlen)) == SOCKET_ERROR &&\ - WSAGetLastError() == WSAEWOULDBLOCK) { -#endif - /* as socket is in non-blocking mode, we must use select() */ - FD_ZERO(&readset); - FD_ZERO(&writeset); - FD_SET(sock, &readset); - FD_SET(sock, &writeset); - timeout.tv_sec = CONNECT_TIMEOUT; - timeout.tv_usec = 0; -#ifndef G_OS_WIN32 - if ((i = select(sock + 1, &readset, &writeset, NULL, &timeout)) == -1) { - fprintf(STD_ERR, "select() error: %s\n", strerror(errno)); -#else - if ((i = select(sock + 1, &readset, &writeset, NULL, &timeout)) == SOCKET_ERROR) { - error_msg = g_win32_error_message(WSAGetLastError()); - fprintf(STD_ERR, "select() error: %s\n", error_msg); - g_free(error_msg); - -#endif - } else if (i == 0) { - fprintf(STD_ERR, "Timed out\n"); - } else if (FD_ISSET(sock, &readset) || FD_ISSET(sock, &writeset)) { -#ifndef G_OS_WIN32 - if (getsockopt(sock, SOL_SOCKET, SO_ERROR, - (void *)(&s_opt_value), &s_opt_len) == -1) { - fprintf(STD_ERR, "getsockopt() error: %s\n", strerror(errno)); -#else - if (getsockopt(sock, SOL_SOCKET, SO_ERROR, - (void *)(&s_opt_value), &s_opt_len) == SOCKET_ERROR) { - error_msg = g_win32_error_message(WSAGetLastError()); - fprintf(STD_ERR, "getsockopt() error: %s\n", error_msg); - g_free(error_msg); -#endif - } else if (s_opt_value == 0) { -#ifdef VERBOSE_OUTPUT - fprintf(STD_OUT, "OK\n"); -#endif - freeaddrinfo(server_info); - return sock; - } -#ifndef G_OS_WIN32 - fprintf(STD_ERR, "getsockopt(): %s\n", strerror(s_opt_value)); -#else - error_msg = g_win32_error_message(s_opt_value); - fprintf(STD_ERR, "getsockopt(): %s\n", error_msg); - g_free(error_msg); -#endif - CLOSE_SOCK; - break; - } - CLOSE_SOCK; - break; - } else if (i == 0) { -#ifdef VERBOSE_OUTPUT - fprintf(STD_OUT, "OK\n"); -#endif - freeaddrinfo(server_info); - return sock; - } else { - -#ifndef G_OS_WIN32 - fprintf(STD_ERR, "connect() error: %s\n", strerror(errno)); -#else - error_msg = g_win32_error_message(WSAGetLastError()); - fprintf(STD_ERR, "connect() error: %s\n", error_msg); - g_free(error_msg); -#endif - CLOSE_SOCK; - /*redundant - continue;*/ - } - } - freeaddrinfo(server_info); - return -1; -} - -#ifndef G_OS_WIN32 -int writable_data_is_available_on_socket(int sock) -#else -int writable_data_is_available_on_socket(SOCKET sock) -#endif -{ - fd_set writeset; - struct timeval timeout; - int i; - - FD_ZERO(&writeset); - FD_SET(sock, &writeset); - timeout.tv_sec = SEND_RECV_TIMEOUT; - timeout.tv_usec = 0; -#ifndef G_OS_WIN32 - if ((i = select(sock + 1, NULL, &writeset, NULL, &timeout)) == -1) { - fprintf(STD_ERR, "select() error: %s\n", strerror(errno)); -#else - if ((i = select(sock + 1, NULL, &writeset, NULL, &timeout)) == SOCKET_ERROR) { - error_msg = g_win32_error_message(WSAGetLastError()); - fprintf(STD_ERR, "select() error: %s\n", error_msg); - g_free(error_msg); -#endif - return SELECT_ERROR; - } else if (i == 0) { - return SELECT_TIMED_OUT; - } else { - if (FD_ISSET(sock, &writeset)) - return SELECT_TRUE; - else - return SELECT_FALSE; - } -} - -#ifndef G_OS_WIN32 -int readable_data_is_available_on_socket(int sock) -#else -int readable_data_is_available_on_socket(SOCKET sock) -#endif -{ - fd_set readset; - struct timeval timeout; - int i; - - FD_ZERO(&readset); - FD_SET(sock, &readset); - timeout.tv_sec = SEND_RECV_TIMEOUT; - timeout.tv_usec = 0; -#ifndef G_OS_WIN32 - if ((i = select(sock + 1, &readset, NULL, NULL, &timeout)) == -1) { - fprintf(STD_ERR, "select() error: %s\n", strerror(errno)); -#else - if ((i = select(sock + 1, &readset, NULL, NULL, &timeout)) == SOCKET_ERROR) { - error_msg = g_win32_error_message(WSAGetLastError()); - fprintf(STD_ERR, "select() error: %s\n", error_msg); - g_free(error_msg); -#endif - return SELECT_ERROR; - } else if (i == 0) { - return SELECT_TIMED_OUT; - } else { - if (FD_ISSET(sock, &readset)) - return SELECT_TRUE; - else - return SELECT_FALSE; - } -} - -/* return n bytes sent or -1 if error (connection closed by server or ?) */ -#ifndef G_OS_WIN32 -int send_full(int sock, const char *str) -{ - int len = strlen(str), i, j = 0; - - while (writable_data_is_available_on_socket(sock) == SELECT_TRUE) { - if ((i = send(sock, str + j, len, 0)) > 0) { - j += i; - len -= i; - if (len == 0) - break; - } else if (i == 0) { - /* something to do? */ - } else if (i == -1) { - j = -1; - if (errno == EPIPE) { -#ifdef VERBOSE_OUTPUT - fprintf(STD_ERR, "Connection closed by server\n"); -#endif - } else - fprintf(STD_ERR, "send() error: %s\n", strerror(errno)); - break; - } - } - return j; -} -#else -int send_full(SOCKET sock, const char *str) -{ - int len = strlen(str), i, j = 0; - - while (writable_data_is_available_on_socket(sock) == SELECT_TRUE) { - if ((i = send(sock, str + j, len, 0)) != SOCKET_ERROR) { - if (i > 0) { - j += i; - len -= i; - if (len == 0) - break; - } else { - /* something to do? */ - } - } else { - j = -1; - if ((i = WSAGetLastError()) == WSAECONNRESET || i == WSAECONNABORTED ||\ - i == WSAESHUTDOWN) { -#ifdef VERBOSE_OUTPUT - fprintf(STD_ERR, "Connection closed by server\n"); -#endif - } else { - error_msg = g_win32_error_message(i); - fprintf(STD_ERR, "send() error: %s\n", error_msg); - g_free(error_msg); - } - break; - } - } - return j; -} -#endif - -/* - * return response = recv_full(socket, &bytes_received, &status) or NULL if error - * -> status = ok, connection_closed_by_server or recv_error - * -> allocate memory for response (must be freed afterwards with free2() if != NULL) - */ -#ifndef G_OS_WIN32 -char *recv_full(int sock, int *bytes_received, int *status) -{ - char *response, *full_response; - int i; - - *bytes_received = 0; - *status = RECV_ERROR; - response = malloc2(RECV_CHUNK_LEN + 1); - response[0] = '\0'; - full_response = l_str_new(response); - while (readable_data_is_available_on_socket(sock) == SELECT_TRUE) { - if ((i = recv(sock, response, RECV_CHUNK_LEN, 0)) > 0) { - response[MIN(i, RECV_CHUNK_LEN)] = '\0'; - full_response = l_str_cat(full_response, response); - *bytes_received += i; - *status = OK; - } else if (i == 0) { - *status = CONNECTION_CLOSED_BY_SERVER; -#ifdef VERBOSE_OUTPUT - fprintf(STD_ERR, "Connection closed by server\n"); -#endif - break; - } else if (i == -1) { - *status = RECV_ERROR; - l_str_free(full_response); - full_response = NULL; -#ifdef VERBOSE_OUTPUT - fprintf(STD_ERR, "recv() error: %s\n", strerror(errno)); -#endif - break; - } - } - free2(response); - return full_response; -} -#else -char *recv_full(SOCKET sock, int *bytes_received, int *status) -{ - char *response, *full_response; - int i; - - *bytes_received = 0; - *status = RECV_ERROR; - response = malloc2(RECV_CHUNK_LEN + 1); - response[0] = '\0'; - full_response = l_str_new(response); - while (readable_data_is_available_on_socket(sock) == SELECT_TRUE) { - if ((i = recv(sock, response, RECV_CHUNK_LEN, 0)) != SOCKET_ERROR) { - if (i > 0) { - response[MIN(i, RECV_CHUNK_LEN)] = '\0'; - full_response = l_str_cat(full_response, response); - *bytes_received += i; - *status = OK; - } else { - *status = CONNECTION_CLOSED_BY_SERVER; -#ifdef VERBOSE_OUTPUT - fprintf(STD_ERR, "Connection closed by server\n"); -#endif - break; - } - } else { - if ((i = WSAGetLastError()) == WSAECONNRESET || i == WSAECONNABORTED ||\ - i == WSAESHUTDOWN) { - *status = SOCK_SHOULD_BE_CLOSED; -#ifdef VERBOSE_OUTPUT - fprintf(STD_ERR, "Connection closed by server\n"); -#endif - } else { - *status = RECV_ERROR; - l_str_free(full_response); - full_response = NULL; -#ifdef VERBOSE_OUTPUT - error_msg = g_win32_error_message(i); - fprintf(STD_ERR, "recv() error: %s\n", error_msg); - g_free(error_msg); -#endif - } - break; - } - } - free2(response); - return full_response; -} -#endif diff -Nru tickr-0.5.5/src/tickr/tickr_list.c tickr-0.6.0/src/tickr/tickr_list.c --- tickr-0.5.5/src/tickr/tickr_list.c 2011-12-17 00:35:40.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr_list.c 2012-03-07 02:01:00.000000000 +0100 @@ -1,5 +1,5 @@ /* - * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2011 + * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2012 * * * This program is free software: you can redistribute it and/or modify @@ -17,283 +17,475 @@ */ #include "tickr.h" +#include "tickr_list.h" + +#ifdef G_OS_WIN32 +extern FILE *stdout_fp, *stderr_fp; +#endif #if USE_GUI +/* TODO: more testing of these funcs */ +FList *f_list_new(const char *url, const char *title, gboolean selected) +{ + FList *node = malloc2(sizeof(FList)); + /*int url_len, title_len;*/ + + node->url = malloc2(FLIST_URL_MAXLEN + 1); + str_n_cpy(node->url, url, FLIST_URL_MAXLEN); + + node->title = malloc2(FLIST_TITLE_MAXLEN + 1); + str_n_cpy(node->title, title, FLIST_TITLE_MAXLEN); + + /* + * if we want to use the following code (which save memory use), + * we must implement funcs that reallocate memory when modifying + * data and we must never modify it directly + */ + /*url_len = MIN(strlen(url), FLIST_URL_MAXLEN); + node->url = malloc2(url_len + 1); + str_n_cpy(node->url, url, url_len); + + title_len = MIN(strlen(title), FLIST_TITLE_MAXLEN); + node->title = malloc2(title_len + 1); + str_n_cpy(node->title, title, title_len);*/ + + node->selected = selected; + + node->prev = NULL; + node->next = NULL; + + str_n_cpy(node->sig, FLIST_SIG, FLIST_SIG_LEN); + return node; +} -static char url_array[NURLMAX][FILE_NAME_MAXLEN + 1]; -static char *url[NURLMAX + 1]; -static char selected_url_array[NURLMAX][FILE_NAME_MAXLEN + 1]; -static char *selected_url[NURLMAX + 1]; - -/* (re)assign all pointers to all array elements as pointer list is NULL - * terminated - don't modify array content */ -char **init_url_list() +/* + * free allocated memory + */ +void f_list_free(FList *node) { - int i = 0; + CHECK_IS_FLIST(node, "f_list_free()") - for (i = 0; i < NURLMAX; i++) - url[i] = url_array[i]; - url[NURLMAX] = NULL; - return (char **)url; + memset(node->sig, 0, FLIST_SIG_LEN); + free2(node->url); + free2(node->title); + free2(node); } -/* (re)assign all pointers to all array elements as pointer list is NULL - * terminated - don't modify array content */ -char **init_selected_url_list() +/* + * free allocated memory + */ +void f_list_free_all(FList *some_node) { - int i = 0; + FList *node; + + CHECK_IS_FLIST(some_node, "f_list_free_all()") - for (i = 0; i < NURLMAX; i++) - selected_url[i] = selected_url_array[i]; - selected_url[NURLMAX] = NULL; - return (char **)selected_url; + for (node = f_list_first(some_node); IS_FLIST(node); node = node->next) + f_list_free(node); } -char **get_url_list() +FList *f_list_first(FList *node) { - return (char **)url; + CHECK_IS_FLIST(node, "f_list_first()") + + while (IS_FLIST(node->prev)) + node = node->prev; + return node; } -char **get_selected_url_list() +FList *f_list_last(FList *node) { - return (char **)selected_url; + CHECK_IS_FLIST(node, "f_list_last()") + + while (IS_FLIST(node->next)) + node = node->next; + return node; } /* - * fill selected_url_array[NURLMAX][FILE_NAME_MAXLEN + 1] with lines from - * url list file + * return NULL if no previous node + */ +FList *f_list_prev(FList *node) +{ + CHECK_IS_FLIST(node, "f_list_prev()") - * entry format in url list file: - * ["*" (selected) or "-" (unselected) + url [+ ">" + title] + '\n'] - * - * entry max length = FILE_NAME_MAXLEN - * see also: (UN)SELECTED_URL_CHAR in tickr.h - * - * we pass a reference to (char **)selected_p_url[NURLMAX + 1] which has been - * set as p_selected_url[i] = selected_url_array[i] and p_selected_url[NURLMAX] = NULL + if (IS_FLIST(node->prev)) + return node->prev; + else + return NULL; +} + +/* + * return NULL if no next node */ -int load_selected_url_list(char **p_selected_url) +FList *f_list_next(FList *node) { - char tmp[FILE_NAME_MAXLEN + 1]; - int i, j; + CHECK_IS_FLIST(node, "f_list_next()") - if (load_url_list(p_selected_url) == OK) { - for (i = 0; i < NURLMAX && p_selected_url[i] != NULL; i++) { - if (p_selected_url[i][0] == SELECTED_URL_CHAR) { - str_n_cpy(tmp, str_without_title(p_selected_url[i]), FILE_NAME_MAXLEN); - for (j = 0; j < FILE_NAME_MAXLEN; j++) { - if (tmp[j] == '\n') { - tmp[0] = '\0'; - break; - } - } - str_n_cpy(p_selected_url[i], tmp + 1, FILE_NAME_MAXLEN); - } else - p_selected_url[i][0] = '\0'; - } - p_selected_url[i] = NULL; - sort_url_list(p_selected_url, 0); /* tmp + 1 -> we compare after 1 char (* or -) */ - if (p_selected_url[0] != NULL) - return OK; - else - return SELECTION_EMPTY; - } else { - p_selected_url[0] = NULL; - return SELECTION_ERROR; - } + if (IS_FLIST(node->next)) + return node->next; + else + return NULL; } /* - * fill url_array[NURLMAX][FILE_NAME_MAXLEN + 1] with lines from url list file - * - * entry format in url list file: - * ["*" (selected) or "-" (unselected) + url [+ ">" + title] + '\n'] - * - * entry max length = FILE_NAME_MAXLEN - * see also: (UN)SELECTED_URL_CHAR in tickr.h - * - * we pass a reference to (char **)p_url[NURLMAX + 1] which has been set as - * p_url[i] = url_array[i] and p_url[NURLMAX] = NULL + * return NULL if out of range */ -int load_url_list(char **p_url) +FList *f_list_nth(FList *some_node, int n) { - char *listfname, listfname1[TMPSTR_SIZE + 1], listfname2[TMPSTR_SIZE + 1]; - FILE *fp; - char *tmp1, tmp2[TMPSTR_SIZE + 1]; - size_t tmp1_size = FILE_NAME_MAXLEN + 1; - int i, j; + FList *node; + int count, i = 1; - str_n_cpy(listfname1, get_datafile_full_name_from_name(URLLIST), TMPSTR_SIZE); -#ifndef G_OS_WIN32 - snprintf(listfname2, TMPSTR_SIZE + 1, "%s%c%s", INSTALL_PATH, SEPARATOR_CHAR, URLLIST); -#else - snprintf(listfname2, TMPSTR_SIZE + 1, "%s%c%s%c%s", - get_progfiles_dir(), SEPARATOR_CHAR, NEWS_DIR_NAME, SEPARATOR_CHAR, URLLIST); -#endif - listfname = listfname1; + CHECK_IS_FLIST(some_node, "f_list_nth()") - if ((fp = g_fopen(listfname, "rb")) == NULL) { - if (question_win("No URL list has been saved yet. Use sample one ?") == YES) - listfname = listfname2; + node = f_list_first(some_node); + count = f_list_count(node); + if (n > count) { + fprintf(STD_ERR, "f_list_nth(): %d is out of range\n", n); + return NULL; + } else { + while (IS_FLIST(node->next) && i++ < n) + node = node->next; + if (IS_FLIST(node)) + return node; else - return LOAD_URL_LIST_ERROR; + return NULL; } - if ((fp = g_fopen(listfname, "rb")) != NULL) { - tmp1 = malloc2(tmp1_size * sizeof(char)); - i = 0; -#ifndef G_OS_WIN32 - while (getline(&tmp1, &tmp1_size, fp) != EOF && i < NURLMAX) { -#else - while (fgets(tmp1, tmp1_size, fp) != NULL && i < NURLMAX) { -#endif - for (j = 0; j < FILE_NAME_MAXLEN; j++) - if (tmp1[j] == '\n') { - tmp1[j] = '\0'; - break; - } - if (tmp1[0] != '\0') - str_n_cpy(p_url[i++], tmp1, FILE_NAME_MAXLEN); - } - p_url[i] = NULL; - if (i >= NURLMAX) { - snprintf(tmp2, TMPSTR_SIZE + 1, "Max number of URL's (= %d) is reached.\n" - "(You may set NURLMAX to a higher value in tickr.h and recompile.)", - NURLMAX); - warning(tmp2, "", "", "", FALSE); +} + +/* + * return index if found (starting at 0) / -1 otherwise + */ +int f_list_index(FList *some_node) +{ + FList *node; + int count, node_index = 0; + + if (IS_FLIST(some_node)) { + node = f_list_first(some_node); + count = f_list_count(node); + for (; IS_FLIST(node) && node_index < count + 1; node = node->next) { + if (node == some_node) + return node_index; + node_index++; } - free2(tmp1); - fclose(fp); - return OK; - } else { - warning("Can't load URL list:", listfname, "-", strerror(errno), - FALSE); - return LOAD_URL_LIST_ERROR; } + return -1; +} + +int f_list_count(FList *some_node) +{ + FList *node; + int counter = 0; + + if (IS_FLIST(some_node)) + for (node = f_list_first(some_node); IS_FLIST(node); node = node->next) + counter++; + /*else + fprintf(STD_ERR, "f_list_count(): List is empty\n");*/ + return counter; } /* - * sort list then remove empty and duplicated entries - * we compare after chars + * create and add node at start of list + * some_node may be any node in the list or NULL -> when creating list */ -void sort_url_list(char **p_url, int shift) +FList *f_list_add_at_start(FList *some_node, const char *url, const char *title, gboolean selected) { - char *p_url2[NURLMAX + 1], *tmp, empty_str[] = ""; - int list_len, min, i, j; + FList *instance; - /* - * copy p_url[] to p_url2[] - */ - for (i = 0; i < NURLMAX && p_url[i] != NULL; i++) - p_url2[i] = p_url[i]; - list_len = i; - /* - * sort array (selection sort) - */ - for (i = 0; i < list_len; i++) { - min = i; - for (j = i + 1; j < list_len; j++) { - /* + shift because we compare after shift chars */ - if (strcmp(p_url2[min] + shift, p_url2[j] + shift) > 0) - min = j; - } - tmp = p_url2[i]; - p_url2[i] = p_url2[min]; - p_url2[min] = tmp; + instance = f_list_new(url, title, selected); /* ->prev = ->next = NULL*/ + if (IS_FLIST(some_node)) { + some_node = f_list_first(some_node); + instance->next = some_node; + some_node->prev = instance; } - /* - * remove duplicated and empty entries - * as we can have one entry with title (url + title) and the same without title - * (url only), we use str_without_title() to compare strings because we want to - * keep entries with title and remove similar entries without title - */ - for (i = 0; i < list_len; i++) - for (j = i + 1; j < list_len; j++) { - /* + shift because we compare after shift chars */ - if (strcmp(str_without_title(p_url2[i] + shift), str_without_title(p_url2[j] + shift)) == 0) { - if (!str_has_title(p_url2[i])) - p_url2[i] = empty_str; - else - p_url2[j] = empty_str; - } - } + return instance; +} - for (i = 0, j = 0; i < list_len; i++) - if (p_url2[i][0] != '\0' && p_url2[i] != empty_str) - p_url[j++] = p_url2[i]; - p_url[j] = NULL; +/* + * create and add node at end of list + * some_node may be any node in the list or NULL -> when creating list + */ +FList *f_list_add_at_end(FList *some_node, const char *url, const char *title, gboolean selected) +{ + FList *instance; + + instance = f_list_new(url, title, selected); /* ->prev = ->next = NULL*/ + if (IS_FLIST(some_node)) { + some_node = f_list_last(some_node); + instance->prev = some_node; + some_node->next = instance; + } + return instance; } -int save_url_list(char **p_url) +/* + * create and insert node before some_node + */ +FList *f_list_insert_before(FList *some_node, const char *url, const char *title, gboolean selected) { - char *listfname, tmp[FILE_NAME_MAXLEN + 1]; - FILE *fp; - int i, j; + FList *instance; - listfname = (char *)get_datafile_full_name_from_name(URLLIST); - if ((fp = g_fopen(listfname, "wb")) != NULL) { - for (i = 0, j = 0; p_url[i] != NULL && j < NURLMAX; i++) { - str_n_cpy(tmp, p_url[i], FILE_NAME_MAXLEN); - if (tmp[0] != '\0') { - fprintf(fp, "%s\n", tmp); - j++; - } - } - fclose(fp); - return OK; - } else { - warning("Can't save URL list:", listfname, "-", strerror(errno), - FALSE); - return SAVE_URL_LIST_ERROR; + CHECK_IS_FLIST(some_node, "f_list_insert_before()") + + instance = f_list_new(url, title, selected); /* ->prev = ->next = NULL*/ + if (IS_FLIST(some_node->prev)) { + instance->prev = some_node->prev; + some_node->prev->next = instance; } + instance->next = some_node; + some_node->prev = instance; + return instance; } /* - * actually set entry as empty instead of removing it - * -> need to sort list afterwards + * create and insert node after some_node */ -void remove_url_from_list(char **p_url, int rank) +FList *f_list_insert_after(FList *some_node, const char *url, const char *title, gboolean selected) { - if (rank >= 0 && rank < NURLMAX) - p_url[rank][0] = '\0'; + FList *instance; + + CHECK_IS_FLIST(some_node, "f_list_insert_after()") + + instance = f_list_new(url, title, selected); /* ->prev = ->next = NULL*/ + instance->prev = some_node; + if (IS_FLIST(some_node->next)) { + instance->next = some_node->next; + some_node->next->prev = instance; + } + instance->prev = some_node; + some_node->next = instance; + return instance; } -/* return index in list / -1 if not found */ -int search_in_url_list(char **url_list, const char *raw_url) +/* + * remove then return first node or NULL if empty + */ +FList *f_list_remove(FList *node) { - int i; + FList *prev = NULL, *next = NULL, *node2 = NULL; + + CHECK_IS_FLIST(node, "f_list_remove()") + + if (IS_FLIST(node->prev)) { + prev = node->prev; + prev->next = node->next; + node2 = prev; + } + if (IS_FLIST(node->next)) { + next = node->next; + next->prev = node->prev; + node2 = next; + } + f_list_free(node); + if (IS_FLIST(node2)) + return f_list_first(node2); + else + return NULL; +} + +void f_list_swap(FList *node1, FList *node2) +{ + FList tmp; + + CHECK_IS_FLIST(node1, "f_list_swap()"); + CHECK_IS_FLIST(node2, "f_list_swap()"); + + (&tmp)->prev = node1->prev; + (&tmp)->next = node1->next; + node1->prev = node2->prev; + node1->next = node2->next; + node2->prev = (&tmp)->prev; + node2->next = (&tmp)->next; +} - for (i = 0; i < NURLMAX && url_list[i] != NULL; i++) { - if (strcmp(raw_url, str_without_title(url_list[i] + 1)) == 0) +/* + * sort by node->url then remove duplicated and empty entries + * then return first node + */ +FList *f_list_sort(FList *some_node) +{ + FList *node1, *node2 = NULL, *node_i[N_FLIST_MAX], *tmp; + int list_len, min, i, j; + + CHECK_IS_FLIST(some_node, "f_list_sort()") + + node1 = f_list_first(some_node); + for (i = 0; i < N_FLIST_MAX; i++) { + if (IS_FLIST(node1)) { + node_i[i] = node1; + node1 = node1->next; + } else + break; + } + list_len = i; + /* selection sort */ + for (i = 0; i < list_len; i++) { + min = i; + for (j = i + 1; j < list_len; j++) + if (strcmp(node_i[min]->url, node_i[j]->url) > 0) + min = j; + tmp = node_i[i]; + node_i[i] = node_i[min]; + node_i[min] = tmp; + } + /* remove duplicated entries */ + for (i = 0; i < list_len; i++) + for (j = i + 1; j < list_len; j++) + if (strcmp(node_i[i]->url, node_i[j]->url) == 0) { + if (node_i[j]->title[0] == '\0') /* if no title in the second entry */ + node_i[j]->url[0] = '\0'; /* (ie the last added), we keep the */ + else /* first one */ + node_i[i]->url[0] = '\0'; + if (node_i[i]->selected || node_i[j]->selected) { + node_i[i]->selected = TRUE; + node_i[j]->selected = TRUE; + } + } + /* remove empty entries */ + for (i = 0; i < list_len; i++) + if (node_i[i]->url[0] != '\0') + node2 = f_list_add_at_end(node2, node_i[i]->url, node_i[i]->title, node_i[i]->selected); + node2 = f_list_first(node2); + f_list_free_all(some_node); + return node2; +} + +/* + * search by node->url and return index if found (starting at 0) / -1 otherwise + */ +int f_list_search(FList *some_node, const char *str) +{ + FList *node; + int i = 0; + + CHECK_IS_FLIST(some_node, "f_list_search()") + + for (node = f_list_first(some_node); IS_FLIST(node); node = node->next) { + if (strcmp(str, node->url) == 0) return i; + else + i++; } return -1; } -gboolean str_has_title(char *str) +/* + * use provided file_name if not NULL / default file name (URL_LIST_FILE) otherwise + * create new f_list + * + * entry format in url list file: + * ["*" (selected) or "-" (unselected) + url [+ ">" + title] + '\n'] + * + * entry max length = FILE_NAME_MAXLEN + * see also: (UN)SELECTED_URL_CHAR in tickr.h + * + * return OK (and first node of list) or LOAD_URL_LIST_ERROR + */ +int f_list_load_from_file(FList **new_node, const char *file_name) { - int i; + char *listfname, listfname1[TMPSTR_SIZE + 1], listfname2[TMPSTR_SIZE + 1]; + FILE *fp; + char *tmp; + FList *node; + size_t tmp_size = FILE_NAME_MAXLEN + 1; + gboolean selected; + int title_shift, i; - for (i = 0; i < FILE_NAME_MAXLEN && str[i] != '\0'; i++) - if (str[i] == TITLE_TAG_CHAR) - return TRUE; - return FALSE; + if (file_name == NULL) { + str_n_cpy(listfname1, get_datafile_full_name_from_name(URL_LIST_FILE), TMPSTR_SIZE); +#ifndef G_OS_WIN32 + snprintf(listfname2, TMPSTR_SIZE + 1, "%s%c%s", INSTALL_PATH, SEPARATOR_CHAR, URL_LIST_FILE); +#else + snprintf(listfname2, TMPSTR_SIZE + 1, "%s%c%s%c%s", + get_progfiles_dir(), SEPARATOR_CHAR, TICKR_DIR_NAME, SEPARATOR_CHAR, URL_LIST_FILE); +#endif + listfname = listfname1; + if ((fp = g_fopen(listfname, "rb")) == NULL) { + if (question_win("No URL list has been saved yet. Use sample one ?") == YES) + listfname = listfname2; + else + return LOAD_URL_LIST_ERROR; + } + } else + listfname = (char *)file_name; + node = NULL; + if ((fp = g_fopen(listfname, "rb")) != NULL) { + tmp = malloc2(tmp_size * sizeof(char)); +#ifndef G_OS_WIN32 + while (getline(&tmp, &tmp_size, fp) != EOF) { +#else + while (fgets(tmp, tmp_size, fp) != NULL) { +#endif + if (tmp[0] == SELECTED_URL_CHAR || tmp[0] == UNSELECTED_URL_CHAR) { + selected = (tmp[0] == SELECTED_URL_CHAR) ? TRUE : FALSE; + title_shift = -1; + for (i = 0; i < FILE_NAME_MAXLEN; i++) { + if (tmp[i] == TITLE_TAG_CHAR) { + title_shift = i + 1; + tmp[i] = '\0'; + } else if (tmp[i] == '\n') { + tmp[i] = '\0'; + break; + } + } + node = f_list_add_at_end( + node, tmp + 1, (title_shift != -1) ? tmp + title_shift : "", selected); + } + } + free2(tmp); + fclose(fp); + if (node != NULL) { + *new_node = f_list_first(node); + return OK; + } else { + warning(FALSE, 3, "URL list '", listfname, "' is empty"); + return LOAD_URL_LIST_EMPTY_LIST; + } + } else { + warning(FALSE, 4, "Can't load URL list ", listfname, ": ", strerror(errno)); + return LOAD_URL_LIST_ERROR; + } } -char *str_without_title(char *str) +/* + * use provided file_name if not NULL / default file name (URL_LIST_FILE) otherwise + * + * entry format in url list file: + * ["*" (selected) or "-" (unselected) + url [+ ">" + title] + '\n'] + * + * entry max length = FILE_NAME_MAXLEN + * see also: (UN)SELECTED_URL_CHAR in tickr.h + * + * return OK (and first node of list) or SAVE_URL_LIST_ERROR + */ +int f_list_save_to_file(FList *node, const char *file_name) { - static char str2[16][FILE_NAME_MAXLEN + 1]; - static int count = -1; - int i; - - count++; - count &= 15; + char *listfname; + FILE *fp; - str_n_cpy(str2[count], str, FILE_NAME_MAXLEN); - for (i = 0; i < FILE_NAME_MAXLEN && str2[count][i] != '\0'; i++) - if (str2[count][i] == TITLE_TAG_CHAR) { - str2[count][i] = '\0'; - break; + if (file_name == NULL) + listfname = l_str_new(get_datafile_full_name_from_name(URL_LIST_FILE)); + else + listfname = l_str_new(file_name); + if ((fp = g_fopen(listfname, "wb")) != NULL) { + if (IS_FLIST(node)) { + for(node = f_list_first(node); IS_FLIST(node); node = node->next) { + fprintf(fp, "%c%s%s%s\n", + node->selected ? SELECTED_URL_CHAR : UNSELECTED_URL_CHAR, + node->url, + (node->title[0] != '\0') ? TITLE_TAG_STR : "", + (node->title[0] != '\0') ? node->title : ""); + } } - return str2[count]; + fclose(fp); + l_str_free(listfname); + return OK; + } else { + l_str_free(listfname); + warning(FALSE, 4, "Can't save URL list ", listfname, ": ", strerror(errno)); + return SAVE_URL_LIST_ERROR; + } } #endif diff -Nru tickr-0.5.5/src/tickr/tickr_list.h tickr-0.6.0/src/tickr/tickr_list.h --- tickr-0.5.5/src/tickr/tickr_list.h 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr_list.h 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1,65 @@ +/* + * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2012 + * + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef INC_TICKR_LIST_H +#define INC_TICKR_LIST_H + +#define FLIST_URL_MAXLEN FILE_NAME_MAXLEN +#define FLIST_TITLE_MAXLEN FEED_TITLE_MAXLEN +#define N_FLIST_MAX (32 * 1024) /* to prevent infinite loops - adjust as necessary */ +#define FLIST_SIG "fl_node" +#define FLIST_SIG_LEN 7 /* check FLIST_SIG_LEN = strlen(FLIST_SIG) */ + +#define IS_FLIST(node)\ + (node != NULL && strcmp(node->sig, FLIST_SIG) == 0) + +#define CHECK_IS_FLIST(node, func)\ + if (!IS_FLIST(node)) {\ + big_error(FLIST_ERROR, 2, func, ": Invalid node in list");\ + } + +typedef struct FeedListNode0 { + char *url; + char *title; + gboolean selected; + struct FeedListNode0 *prev; + struct FeedListNode0 *next; + char sig[FLIST_SIG_LEN + 1]; +} FList; + +FList *f_list_new(const char *, const char *, gboolean); +void f_list_free(FList *); +void f_list_free_all(FList *); +FList *f_list_first(FList *); +FList *f_list_last(FList *); +FList *f_list_prev(FList *); +FList *f_list_next(FList *); +FList *f_list_nth(FList *, int); +int f_list_index(FList *); +int f_list_count(FList *); +FList *f_list_add_at_start(FList *, const char *, const char *, gboolean); +FList *f_list_add_at_end(FList *, const char *, const char *, gboolean); +FList *f_list_insert_before(FList *, const char *, const char *, gboolean); +FList *f_list_insert_after(FList *, const char *, const char *, gboolean); +FList *f_list_remove(FList *); +void f_list_swap(FList *, FList *); +FList *f_list_sort(FList *); +int f_list_search(FList *, const char *); +int f_list_load_from_file(FList **, const char *); +int f_list_save_to_file(FList *, const char *); +#endif /* INC_TICKR_LIST_H */ diff -Nru tickr-0.5.5/src/tickr/tickr_main.c tickr-0.6.0/src/tickr/tickr_main.c --- tickr-0.5.5/src/tickr/tickr_main.c 2011-12-17 21:10:38.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr_main.c 2012-03-07 02:01:00.000000000 +0100 @@ -1,5 +1,5 @@ /* - * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2011 + * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2012 * * * This program is free software: you can redistribute it and/or modify @@ -18,9 +18,16 @@ #include "tickr.h" +#ifdef G_OS_WIN32 +FILE *stdout_fp, *stderr_fp; +#endif + static TickerEnv *env; static Resource *resrc; +static FList *feed_list; +static FList *feed_selection; static Params *prm; +static int instance_id = 0; static int shift_counter = 0; #if USE_GUI static GtkWidget *popup_menu; @@ -31,16 +38,66 @@ static GtkWidget *main_hbox, *vbox_ticker, *vbox_clock; static int speed_up_flag = FALSE; static int speed_down_flag = FALSE; -static int instance_id = 0; -#ifdef G_OS_WIN32 -FILE *stdout_fp, *stderr_fp; -#endif +#define START_PAUSE_TICKER_WHILE_OPENING\ + int suspend_rq_bak;\ + char disable_popups_bak;\ + suspend_rq_bak = env->suspend_rq;\ + env->suspend_rq = TRUE;\ + disable_popups_bak = get_params()->disable_popups;\ + get_params()->disable_popups = 'n'; -/* prototypes for some static funcs */ +#define END_PAUSE_TICKER_WHILE_OPENING \ + get_params()->disable_popups = disable_popups_bak;\ + env->suspend_rq = suspend_rq_bak; + +/* prototypes for a few static funcs */ static gint shift2left_callback(); +static void check_time_load_resource(check_time_mode); -#if USE_GUI +TickerEnv *get_ticker_env() +{ + return env; +} + +Resource *get_resource() +{ + return resrc; +} + +FList *get_feed_list() +{ + return feed_list; +} + +void set_feed_list(FList *list) +{ + feed_list = list; +} + +FList *get_feed_selection() +{ + return feed_selection; +} + +void set_feed_selection(FList *list) +{ + feed_selection = list; +} + +Params *get_params() +{ + return prm; +} + +int get_instance_id() +{ + return instance_id; +} + +#if USE_GUI /* maybe this compile #if should be removed because + * it has been there and ***unused*** for a long time + * and it probably breaks compile anyways */ void toggle_speed_up_flag() { speed_up_flag = TRUE; @@ -55,9 +112,9 @@ void check_main_win_always_on_top() { if (prm->always_on_top == 'y') - gtk_window_set_keep_above(GTK_WINDOW(get_ticker_env()->win), TRUE); + gtk_window_set_keep_above(GTK_WINDOW(env->win), TRUE); else - gtk_window_set_keep_above(GTK_WINDOW(get_ticker_env()->win), FALSE); + gtk_window_set_keep_above(GTK_WINDOW(env->win), FALSE); } #if USE_GUI @@ -66,49 +123,126 @@ */ static void get_new_url2() { + START_PAUSE_TICKER_WHILE_OPENING get_new_url(resrc); + END_PAUSE_TICKER_WHILE_OPENING } static void open_new_txt_file2() { + START_PAUSE_TICKER_WHILE_OPENING open_new_txt_file(resrc); + END_PAUSE_TICKER_WHILE_OPENING +} + +static void import_opml_file2() +{ + START_PAUSE_TICKER_WHILE_OPENING + import_opml_file(); + END_PAUSE_TICKER_WHILE_OPENING +} + +static void export_opml_file2() +{ + START_PAUSE_TICKER_WHILE_OPENING + export_opml_file(); + END_PAUSE_TICKER_WHILE_OPENING +} + +static void show_resource_info() +{ +#define INFO_OPEN_TAG "" /*""*/ +#define INFO_CLOSE_TAG "" /*""*/ + char tmp[512]; + + START_PAUSE_TICKER_WHILE_OPENING + /* TODO: improve layout - use a table? */ + if (resrc->type == RESRC_URL) { + snprintf(tmp, 511, "\n" + "Resource type: "INFO_OPEN_TAG"%s Feed"INFO_CLOSE_TAG"\n\n" + "Feed title: "INFO_OPEN_TAG"%s"INFO_CLOSE_TAG"\n\n" + "Feed URL: "INFO_OPEN_TAG"%s"INFO_CLOSE_TAG"\n", + (resrc->format == RSS_2_0 ? "RSS 2.0" : (resrc->format == RSS_ATOM ? "Atom" : "RSS 1.0")), + resrc->feed_title, resrc->id); + info_win("Resource Properties", tmp, INFO, TRUE); + } else if (resrc->type == RESRC_FILE) { + snprintf(tmp, 511, "\n" + "Resource type: "INFO_OPEN_TAG"File"INFO_CLOSE_TAG"\n\n" + "File name: "INFO_OPEN_TAG"%s"INFO_CLOSE_TAG"\n", + resrc->id); + info_win("Resource Properties", tmp, INFO, TRUE); + } else + info_win("Resource Properties", "\nNo information available\n", INFO_ERROR, FALSE); + END_PAUSE_TICKER_WHILE_OPENING } static void modify_params2() { + START_PAUSE_TICKER_WHILE_OPENING if (modify_params(prm) == 1) /* 1 means we want to reopen the dialog */ modify_params2(prm); + END_PAUSE_TICKER_WHILE_OPENING } static void connection_settings2() { - int suspend_rq_bak; - char disable_popups_bak; - - suspend_rq_bak = get_ticker_env()->suspend_rq; - get_ticker_env()->suspend_rq = TRUE; - disable_popups_bak = get_params()->disable_popups; /* IS THIS ANY */ - get_params()->disable_popups = 'n'; /* BETTER? */ - if (connection_settings(AUTH_PAGE) == GTK_RESPONSE_OK) { + START_PAUSE_TICKER_WHILE_OPENING + if (connection_settings(AUTH_PAGE) == GTK_RESPONSE_OK) current_feed(); - get_ticker_env()->reload_rq = TRUE; + END_PAUSE_TICKER_WHILE_OPENING +} + +static void import_params2() +{ + START_PAUSE_TICKER_WHILE_OPENING + import_params(); + END_PAUSE_TICKER_WHILE_OPENING +} + +static void export_params2() +{ + START_PAUSE_TICKER_WHILE_OPENING + export_params(); + END_PAUSE_TICKER_WHILE_OPENING +} + +static void pause_on_mouseover_enabled_warning_once() +{ + static int first_run = -1; + + if (prm->pause_on_mouseover == 'y') { + if (first_run == -1) + warning(FALSE, 1, + "Setting 'Pause ticker on mouse-over' is enabled. When so, playing/pausing\n" + "is always controlled by mouse pointer motions as well."); + first_run++; + first_run &= 1; } - get_params()->disable_popups = disable_popups_bak; - get_ticker_env()->suspend_rq = suspend_rq_bak; } -static void first_feed2() +static void ticker_play() { - if (env->selection_mode == MULTIPLE) - first_feed(); - else - info_win_wait("Single selection mode", INFO_WIN_WAIT_TIMEOUT); + env->suspend_rq = FALSE; + pause_on_mouseover_enabled_warning_once(); } -static void last_feed2() +static void ticker_pause() +{ + env->suspend_rq = TRUE; + pause_on_mouseover_enabled_warning_once(); +} + +static void ticker_reload() +{ + current_feed(); + env->reload_rq = TRUE; + env->suspend_rq = FALSE; +} + +static void first_feed2() { if (env->selection_mode == MULTIPLE) - last_feed(); + first_feed(); else info_win_wait("Single selection mode", INFO_WIN_WAIT_TIMEOUT); } @@ -129,37 +263,12 @@ info_win_wait("Single selection mode", INFO_WIN_WAIT_TIMEOUT); } -static void show_resource_info() +static void last_feed2() { -#define INFO_OPEN_TAG "" /*""*/ -#define INFO_CLOSE_TAG "" /*""*/ - char tmp[512]; - int suspend_rq_bak; - char disable_popups_bak; - - /* TODO: improve layout - use a table? */ - suspend_rq_bak = get_ticker_env()->suspend_rq; - get_ticker_env()->suspend_rq = TRUE; - disable_popups_bak = get_params()->disable_popups; - get_params()->disable_popups = 'n'; - if (resrc->type == RESRC_URL) { - snprintf(tmp, 511, "\n" - "Resource type: "INFO_OPEN_TAG"%s Feed"INFO_CLOSE_TAG"\n\n" - "Feed title: "INFO_OPEN_TAG"%s"INFO_CLOSE_TAG"\n\n" - "Feed URL: "INFO_OPEN_TAG"%s"INFO_CLOSE_TAG"\n", - (resrc->format == RSS_2_0 ? "RSS 2.0" : (resrc->format == RSS_ATOM ? "Atom" : "RSS 1.0")), - resrc->feed_title, resrc->id); - info_win("Resource Properties", tmp, INFO, TRUE); - } else if (resrc->type == RESRC_FILE) { - snprintf(tmp, 511, "\n" - "Resource type: "INFO_OPEN_TAG"File"INFO_CLOSE_TAG"\n\n" - "File name: "INFO_OPEN_TAG"%s"INFO_CLOSE_TAG"\n", - resrc->id); - info_win("Resource Properties", tmp, INFO, TRUE); - } else - info_win("Resource Properties", "\nNo information available\n", INFO_ERROR, FALSE); - get_params()->disable_popups = disable_popups_bak; - get_ticker_env()->suspend_rq = suspend_rq_bak; + if (env->selection_mode == MULTIPLE) + last_feed(); + else + info_win_wait("Single selection mode", INFO_WIN_WAIT_TIMEOUT); } #ifdef G_OS_WIN32 @@ -210,23 +319,6 @@ } #endif -static void ticker_play() -{ - env->suspend_rq = FALSE; -} - -static void ticker_pause() -{ - env->suspend_rq = TRUE; -} - -static void ticker_reload() -{ - current_feed(); - env->reload_rq = TRUE; - env->suspend_rq = FALSE; -} - static int get_visible_link() { int i, location_on_surface; @@ -256,23 +348,21 @@ if (prm->open_link_cmd[0] == '\0') { #ifndef G_OS_WIN32 /* TODO: should look for default browser */ - warning("Can't launch Browser: no command is defined.\n" - "Please set the 'Open in Browser' option in the Preferences window.", - "", "", "", FALSE); + warning(FALSE, 2, "Can't launch Browser: no command is defined.\n", + "Please set the 'Open in Browser' option in the Preferences window."); return; #else easily_link_with_browser(); if (prm->open_link_cmd[0] == '\0') { - warning("Can't launch Browser: no command is defined.\n" - "Please set the 'Open in Browser' option in the Preferences window.", - "", "", "", FALSE); + warning(FALSE, 2, "Can't launch Browser: no command is defined.\n", + "Please set the 'Open in Browser' option in the Preferences window."); return; } #endif } if (env->active_link [0] == '\0') { - warning("No link found", "", "", "", FALSE); + warning(FALSE, 1, "No link found"); return; } @@ -297,7 +387,7 @@ argv[j] = env->active_link; argv[j + 1] = NULL; if (!g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &pid, &error)) { - warning(APP_NAME": Can't create process ", argv[0], " - ", error->message, FALSE); + warning(FALSE, 3, APP_NAME": Can't create process ", argv[0], " - ", error->message); #ifndef G_OS_WIN32 info_win(APP_NAME" - Warning", "Please check the 'Open in Browser' option in the Preferences window.", INFO_WARNING, FALSE); @@ -316,10 +406,9 @@ open_link(); } -static gint left_click_on_drawing_area(GtkWidget *widget, GdkEventButton *event, gpointer unused) +static gint left_click_on_drawing_area(GtkWidget *widget, GdkEventButton *event) { widget = widget; - unused = unused; if (event->type == GDK_BUTTON_PRESS && event->button == 1) { /* 1 = mouse left button */ /* get pointer x location on drawing_area */ position_x_in_drwa = event->x; @@ -330,10 +419,9 @@ return FALSE; } -static gint right_click_on_drawing_area(GtkWidget *widget, GdkEventButton *event, gpointer unused) +static gint right_click_on_drawing_area(GtkWidget *widget, GdkEventButton *event) { widget = widget; - unused = unused; if (event->type == GDK_BUTTON_PRESS && event->button == 3) { /* 3 = mouse right button */ /* popup main menu */ gtk_menu_popup(GTK_MENU(popup_menu), NULL, NULL, NULL, NULL, event->button, event->time); @@ -342,43 +430,81 @@ return FALSE; } -/* pause ticker on mouseover */ -static gint mouse_over_drawing_area(GtkWidget *widget, GdkEvent *event, gpointer unused) +static const char *get_win_title_tooltip_text() +{ + static char tmp1[2][256 + 64], tmp2[2][64]; + static int i = -1; + + /* to allow 2 simultaneous calls */ + i++; + i &= 1; + + if (resrc->type == RESRC_URL) + str_n_cpy(tmp1[i], resrc->feed_title, 256); + else if (resrc->type == RESRC_FILE) + str_n_cpy(tmp1[i], resrc->id, 256); + else + str_n_cpy(tmp1[i], "No resource", 256); + snprintf(tmp2[i], 64, " | %s-%s", APP_NAME, APP_VERSION_NUMBER); + return (const char *)str_n_cat(tmp1[i], tmp2[i], 63); +} + +/* pause ticker when mouse pointer is over (opened) popup menu */ +static gint mouse_over_opened_popup_menu(GtkWidget *widget, GdkEvent *event) { widget = widget; - unused = unused; if (prm->pause_on_mouseover == 'y') { - if (event->type == GDK_ENTER_NOTIFY) + if (event->type == GDK_EXPOSE) env->suspend_rq = TRUE; else if (event->type == GDK_LEAVE_NOTIFY) env->suspend_rq = FALSE; } - if (resrc->type == RESRC_URL) - gtk_widget_set_tooltip_text(widget, resrc->feed_title); - else if (resrc->type == RESRC_FILE) - gtk_widget_set_tooltip_text(widget, resrc->id); - return TRUE; + return FALSE; +} + +/* pause ticker on mouseover */ +static gint mouse_over_drawing_area(GtkWidget *widget, GdkEvent *event) +{ + widget = widget; + if (event->type == GDK_ENTER_NOTIFY || event->type == GDK_LEAVE_NOTIFY) { + if (prm->pause_on_mouseover == 'y') { + if (event->type == GDK_ENTER_NOTIFY) + env->suspend_rq = TRUE; + else if (event->type == GDK_LEAVE_NOTIFY) + env->suspend_rq = FALSE; + } + gtk_widget_set_tooltip_text(widget, get_win_title_tooltip_text()); + gtk_tooltip_trigger_tooltip_query(gdk_display_get_default()); + return TRUE; + } else + return FALSE; } -static gint mouse_wheel_scroll_on_drawing_area(GtkWidget *widget, GdkEvent *event, gpointer unused) +static gint mouse_wheel_scroll_on_drawing_area(GtkWidget *widget, GdkEvent *event) { widget = widget; - unused = unused; if (event->type == GDK_SCROLL) { - env->suspend_rq = FALSE; - if (event->scroll.direction == GDK_SCROLL_UP) { - if (prm->mouse_wheel_scroll == 's') + if (prm->mouse_wheel_scroll == 's') { + if (event->scroll.direction == GDK_SCROLL_UP) toggle_speed_up_flag(); - else if (prm->mouse_wheel_scroll == 'f') - next_feed2(); - } else if (event->scroll.direction == GDK_SCROLL_DOWN) { - if (prm->mouse_wheel_scroll == 's') + else if (event->scroll.direction == GDK_SCROLL_DOWN) toggle_speed_down_flag(); - else if (prm->mouse_wheel_scroll == 'f') - previous_feed2(); + env->suspend_rq = FALSE; + return TRUE; + } else if (prm->mouse_wheel_scroll == 'f') { + if (env->selection_mode == MULTIPLE) { + if (event->scroll.direction == GDK_SCROLL_UP) + quick_feed_picker(GDK_SCROLL_UP); + else if (event->scroll.direction == GDK_SCROLL_DOWN) + quick_feed_picker(GDK_SCROLL_DOWN); + env->suspend_rq = FALSE; + } else + warning(FALSE, 2, "Single selection mode\n", + "(You have set 'Mouse wheel scrolling apply to: Feed')"); + return TRUE; } } - return TRUE; + return FALSE; } /* @@ -395,15 +521,9 @@ {"/File/sep", NULL, NULL, 0, "", NULL}, - {"/File/_Import Feed List (OPML)", "I", import_opml_file, 0, NULL, NULL}, - - {"/File/_Export Feed List (OPML)", "E", export_opml_file, 0, NULL, NULL}, - - {"/File/sep", NULL, NULL, 0, "", NULL}, - - {"/File/Import Preferences", "", import_params, 0, NULL, NULL}, + {"/File/_Import Feed List (OPML)", "I", import_opml_file2, 0, NULL, NULL}, - {"/File/Export Preferences", "", export_params, 0, NULL, NULL}, + {"/File/_Export Feed List (OPML)", "E", export_opml_file2, 0, NULL, NULL}, {"/File/sep", NULL, NULL, 0, "", NULL}, @@ -423,6 +543,12 @@ {"/Edit/Connection Settings", "", connection_settings2, 0, "", (gconstpointer)GTK_STOCK_CONNECT}, + {"/Edit/sep", NULL, NULL, 0, "", NULL}, + + {"/Edit/Import Preferences", "", import_params2, 0, NULL, NULL}, + + {"/Edit/Export Preferences", "", export_params2, 0, NULL, NULL}, + {"/_Control", NULL, NULL, 0, "", NULL}, {"/Control/Open Link in _Browser", "B", open_link2, 0, "", @@ -535,7 +661,6 @@ char cfname[FONT_NAME_MAXLEN + 1], cfsize[FONT_SIZE_MAXLEN + 1]; gint height1, height2; int size, render_exit_status, i; - char tmp[80]; gtk_window_set_keep_above(GTK_WINDOW(env->win), FALSE); gtk_window_set_skip_taskbar_hint(GTK_WINDOW(env->win), FALSE); @@ -597,29 +722,30 @@ if (render_exit_status != OK && render_exit_status != RENDER_NO_RESOURCE) { switch(render_exit_status) { case RENDER_NULL_ENDINGSTR: - warning("render_stream_to_surface():", "ending string = NULL", "", "", FALSE); + warning(FALSE, 1, "render_stream_to_surface(): ending string = NULL"); break; case RENDER_GETLINE_ERROR: - warning("render_stream_to_surface():", "getline() error", "", "", FALSE); + warning(FALSE, 1, "render_stream_to_surface(): getline() error"); break; case RENDER_LINE_TOO_LONG: - warning("render_stream_to_surface():", "line too long\n", "", "", FALSE); + warning(FALSE, 1, "render_stream_to_surface(): line too long\n"); break; case RENDER_CAIRO_IMAGE_SURFACE_TOO_WIDE: - big_error(RENDER_CAIRO_IMAGE_SURFACE_TOO_WIDE, "render_stream_to_surface():", - "cairo image surface too wide (> 32 K pixels)", "", ""); + big_error(RENDER_CAIRO_IMAGE_SURFACE_TOO_WIDE, 1, "render_stream_to_surface(): " + "cairo image surface too wide (> 32 K pixels)"); break; case RENDER_CREATE_CAIRO_IMAGE_SURFACE_ERROR: - big_error(RENDER_CREATE_CAIRO_IMAGE_SURFACE_ERROR, "render_stream_to_surface():", - "can't create cairo image surface", "", ""); + big_error(RENDER_CREATE_CAIRO_IMAGE_SURFACE_ERROR, 1, "render_stream_to_surface(): " + "can't create cairo image surface"); break; - default: warning("render_stream_to_surface():", "unknown error", "", "", FALSE); + default: warning(FALSE, 2, "render_stream_to_surface(): unknown error ", + itoa2(render_exit_status)); break; } } if (env->c_surf == NULL) - big_error(render_exit_status, - "render_stream_to_surface():", "cairo image surface = NULL", "", ""); + big_error(render_exit_status, 1, + "render_stream_to_surface(): cairo image surface = NULL"); env->surf_width = cairo_image_surface_get_width(env->c_surf); env->surf_height = cairo_image_surface_get_height(env->c_surf); env->drwa_height = (MIN(env->surf_height, env->screen_h)); @@ -627,13 +753,7 @@ * window layout stuff */ /* win title */ - if (resrc->type == RESRC_URL) - snprintf(tmp, 80, "%s-%s | %s", APP_NAME, APP_VERSION_NUMBER, resrc->feed_title); - else if (resrc->type == RESRC_FILE) - snprintf(tmp, 80, "%s-%s | %s", APP_NAME, APP_VERSION_NUMBER, resrc->id); - else - snprintf(tmp, 80, "%s-%s | %s", APP_NAME, APP_VERSION_NUMBER, "No resource"); - gtk_window_set_title(GTK_WINDOW(env->win), tmp); + gtk_window_set_title(GTK_WINDOW(env->win), get_win_title_tooltip_text()); /* * when window-always-on-top is disabled, the following code needs to be run * only twice at program startup (ie once after gtk_widget_show_all() has been @@ -769,7 +889,7 @@ if (env->selection_mode == SINGLE && env->reload_rq) load_resource(resrc, NULL); else { - while ((i = load_resource(resrc, get_selected_url_list())) != OK) { + while ((i = load_resource(resrc, feed_selection)) != OK) { if (i == CONNECT_TOO_MANY_ERRORS && env->selection_mode == MULTIPLE) { if (get_params()->disable_popups == 'n') { snprintf(tmp, 256, @@ -830,7 +950,7 @@ /* * reload stuff every rss_ttl * 60> seconds */ -void check_time_load_resource(check_time_mode mode) +static void check_time_load_resource(check_time_mode mode) { static unsigned long elapsed_time_in_sec; @@ -846,27 +966,12 @@ } } -gint check_time_load_resource2() +static gint check_time_load_resource2() { check_time_load_resource(TIME_CHECK); return TRUE; } -TickerEnv *get_ticker_env() -{ - return env; -} - -Resource *get_resource() -{ - return resrc; -} - -Params *get_params() -{ - return prm; -} - static void quit_with_cli_info(tickr_error_code error_code) { if (resrc->fp != NULL) @@ -902,26 +1007,24 @@ fprintf(STD_OUT, "%s\n", get_license_str2()); } -int get_instance_id() -{ - return instance_id; -} - /* reload resource as soon as scrolling has started to update all display params - * TODO: reset open stream to begining and recompute instead of reload (which - * is useless) -> must 1st make sure this doesn't break anything + * TODO: reset open stream to begining and recompute instead of reloading (which + * is useless) -> must first make sure this doesn't break anything */ gint update_everything() { if (shift_counter > 4) { - current_feed(); + if (env->selection_mode == MULTIPLE) + current_feed(); + else + env->reload_rq = TRUE; return FALSE; } else return TRUE; } #ifdef G_OS_WIN32 -/* this is meant to be used with the new gtk runtime */ +/* this is meant to be used with the new GTK/GLib-win32 runtime */ static int init_win32_mmtimer() { TIMECAPS tc; @@ -937,6 +1040,54 @@ return -1; } } + +static void create_win32_logfiles() +{ + time_t time2 = time(NULL); + + STD_OUT = open_new_datafile_with_name(STDOUT_FILENAME1, "wb"); + STD_ERR = open_new_datafile_with_name(STDERR_FILENAME1, "wb"); + fprintf(STD_OUT, "%s", ctime(&time2)); + fprintf(STD_ERR, "%s", ctime(&time2)); +} + +/* swap win32 log files every hour to prevent generating huge ones */ +static gint swap_win32_logfiles() +{ + static unsigned long elapsed_time_in_sec = 0; + static int counter = 0; + int suspend_rq_bak; + time_t time2 = time(NULL); + + if ((++elapsed_time_in_sec) >= (unsigned long)3600) { + elapsed_time_in_sec = 0; + counter++; + counter &= 1; + suspend_rq_bak = env->suspend_rq; + env->suspend_rq = TRUE; + if (STD_OUT != NULL) { + if (fclose(STD_OUT) != 0) + big_error(WIN32V_ERROR, 2, "Can't close STD_OUT: ", strerror(errno)); + STD_OUT = NULL; + } + if (STD_ERR != NULL) { + if (fclose(STD_ERR) != 0) + big_error(WIN32V_ERROR, 2, "Can't close STD_ERR: ", strerror(errno)); + STD_ERR = NULL; + } + if (counter == 0) { + STD_OUT = open_new_datafile_with_name(STDOUT_FILENAME1, "wb"); + STD_ERR = open_new_datafile_with_name(STDERR_FILENAME1, "wb"); + } else { + STD_OUT = open_new_datafile_with_name(STDOUT_FILENAME2, "wb"); + STD_ERR = open_new_datafile_with_name(STDERR_FILENAME2, "wb"); + } + fprintf(STD_OUT, "%s", ctime(&time2)); + fprintf(STD_ERR, "%s", ctime(&time2)); + env->suspend_rq = suspend_rq_bak; + } + return TRUE; +} #endif int main(int argc, char *argv[]) @@ -983,26 +1134,25 @@ #ifdef G_OS_WIN32 if ((i = WSAStartup(MAKEWORD(2, 2), &wsadata)) != 0) - big_error(WIN32V_ERROR, "WSAStartup() error ", itoa2(i), "", ""); + big_error(WIN32V_ERROR, 2, "WSAStartup() error ", itoa2(i)); else if (LOBYTE(wsadata.wVersion) != 2 || HIBYTE(wsadata.wVersion) != 2) { WSACleanup(); - big_error(WIN32V_ERROR, "Couldn't find a usable version of Winsock.dll", "", "", ""); + big_error(WIN32V_ERROR, 1, "Couldn't find a usable version of Winsock.dll"); } else if (get_progfiles_dir() == NULL) - big_error(WIN32V_ERROR, "Can't find Program Files directory", "", "", ""); + big_error(WIN32V_ERROR, 1, "Can't find Program Files directory"); else if (get_appdata_dir() == NULL) - big_error(WIN32V_ERROR, "Can't find Application Data directory", "", "", ""); + big_error(WIN32V_ERROR, 1, "Can't find Application Data directory"); else if (init_win32_mmtimer() != 0) if (question_win("Can't initialize win32 multimedia timer. " "Scrolling may be very slow. Continue ?") == NO) exit(WIN32V_ERROR); #endif /* - * create news dir in user home dir if it doesn't exist + * create dir in user home dir if it doesn't exist */ g_mkdir(get_datadir_full_path(), S_IRWXU); #ifdef G_OS_WIN32 - STD_OUT = open_new_datafile_with_name(STDOUT_FILENAME, "wb+"); - STD_ERR = open_new_datafile_with_name(STDERR_FILENAME, "wb+"); + create_win32_logfiles(); #endif /* * get help, show license, set instance id or check available system fonts @@ -1028,7 +1178,7 @@ dump_font_list(); return 0; } - set_news_icon_to_dialog(GTK_WINDOW(env->win)); + set_tickr_icon_to_dialog(GTK_WINDOW(env->win)); /* * create rss icon */ @@ -1108,21 +1258,25 @@ quit_with_cli_info(RESOURCE_NONE); } compute_auth_and_proxy_str(); - init_url_list(); - if ((i = load_url_list(get_url_list())) == OK) - save_url_list(get_url_list()); - init_selected_url_list(); - j = load_selected_url_list(get_selected_url_list()); + /* + * feed list stuff + */ + if ((i = f_list_load_from_file(&feed_list, NULL)) == OK) { + feed_list = f_list_sort(feed_list); + feed_list = f_list_first(feed_list); + f_list_save_to_file(feed_list, NULL); + } + j = build_feed_selection_from_feed_list(); if (n_resources == 0 && env->selection_mode == MULTIPLE && i == OK && j == OK) fprintf(STD_OUT, "Will use feed selection\n"); else { if (env->selection_mode == MULTIPLE && (i != OK || j != OK)) { if (j == SELECTION_EMPTY) - warning("No feed selected", "-", - "Switching to single selection mode", "", TRUE); + warning(TRUE, 1, "No feed selected - " + "Switching to single selection mode"); else if (j == SELECTION_ERROR) - warning("No feed selection available", "-", - "Switching to single selection mode", "", TRUE); + warning(TRUE, 1, "No feed selection available - " + "Switching to single selection mode"); } env->selection_mode = SINGLE; if (n_resources == 0) { @@ -1137,7 +1291,7 @@ } } first_feed(); - if (load_resource(resrc, get_selected_url_list()) != OK) + if (load_resource(resrc, feed_selection) != OK) if (RESOURCE_NONE_QUIT) quit_with_cli_info(RESOURCE_NONE); resrc->rss_ttl = prm->rss_refresh; @@ -1166,6 +1320,8 @@ g_signal_connect(G_OBJECT(env->drw_a), "button-press-event", G_CALLBACK(right_click_on_drawing_area), NULL); g_signal_connect(G_OBJECT(env->drw_a), "enter-notify-event", G_CALLBACK(mouse_over_drawing_area), NULL); g_signal_connect(G_OBJECT(env->drw_a), "leave-notify-event", G_CALLBACK(mouse_over_drawing_area), NULL); + g_signal_connect(G_OBJECT(popup_menu), "expose-event", G_CALLBACK(mouse_over_opened_popup_menu), NULL); + g_signal_connect(G_OBJECT(popup_menu), "leave-notify-event", G_CALLBACK(mouse_over_opened_popup_menu), NULL); g_signal_connect(G_OBJECT(env->drw_a), "scroll-event", G_CALLBACK(mouse_wheel_scroll_on_drawing_area), NULL); #endif vbox_ticker = gtk_vbox_new(FALSE, 0); /* vbox_ticker is only used to have a v-centered ticker */ @@ -1201,6 +1357,12 @@ g_timeout_add_full(G_PRIORITY_DEFAULT, 500, update_win_dims, NULL, NULL); g_timeout_add_full(G_PRIORITY_DEFAULT, 100, update_everything, NULL, NULL); + /* + * check every sec until elapsed time >= 1 hour then swap win32 log files to prevent generating huge ones + */ +#ifdef G_OS_WIN32 + g_timeout_add_full(G_PRIORITY_DEFAULT, 1000, swap_win32_logfiles, NULL, NULL); +#endif env->suspend_rq = FALSE; env->compute_rq = FALSE; diff -Nru tickr-0.5.5/src/tickr/tickr_misc.c tickr-0.6.0/src/tickr/tickr_misc.c --- tickr-0.5.5/src/tickr/tickr_misc.c 2011-12-16 18:39:45.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr_misc.c 2012-03-07 02:01:00.000000000 +0100 @@ -1,5 +1,5 @@ /* - * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2011 + * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2012 * * * This program is free software: you can redistribute it and/or modify @@ -23,9 +23,8 @@ #endif #if USE_GUI -static gint esc_key_pressed(GtkWidget *dialog2, GdkEventKey *event, gpointer unused) +static gint esc_key_pressed(GtkWidget *dialog2, GdkEventKey *event) { - unused = unused; if (event->keyval == GDK_Escape) { gtk_dialog_response(GTK_DIALOG(dialog2), GTK_RESPONSE_CANCEL); return TRUE; @@ -46,7 +45,6 @@ char tmp[TMPSTR_SIZE + 1]; int c; - get_ticker_env()->suspend_rq = TRUE; gtk_window_set_keep_above(GTK_WINDOW(get_ticker_env()->win), FALSE); dialog = gtk_file_chooser_dialog_new("Import Preferences", GTK_WINDOW(get_ticker_env()->win), @@ -55,7 +53,7 @@ GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); - set_news_icon_to_dialog(GTK_WINDOW(dialog)); + set_tickr_icon_to_dialog(GTK_WINDOW(dialog)); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); g_signal_connect(G_OBJECT(dialog), "key-press-event", G_CALLBACK(esc_key_pressed), NULL); @@ -70,7 +68,7 @@ "Preferences are about to be imported from file: %s. " "Continue ?", file_name); if (question_win(tmp) == YES) { - if ((fp2 = g_fopen(get_datafile_full_name_from_name(CONFIGFILE), + if ((fp2 = g_fopen(get_datafile_full_name_from_name(CONFIG_FILE), "wb")) != NULL) { while ((c = fgetc(fp1)) != (int)EOF) fputc((int)c, fp2); @@ -78,18 +76,17 @@ current_feed(); get_ticker_env()->reload_rq = TRUE; } else - warning("Can't save Preferences to file:", - file_name, ":", strerror(errno), FALSE); + warning(FALSE, 4, "Can't save Preferences to file ", + file_name, ": ", strerror(errno)); } fclose(fp1); } else - warning("Can't open:", file_name, ":", strerror(errno), FALSE); + warning(FALSE, 4, "Can't open ", file_name, ": ", strerror(errno)); g_free(file_name); } } gtk_widget_destroy(dialog); check_main_win_always_on_top(); - get_ticker_env()->suspend_rq = FALSE; } void export_params() @@ -101,12 +98,11 @@ char tmp[TMPSTR_SIZE + 1]; int c; - if ((fp1 = g_fopen(get_datafile_full_name_from_name(CONFIGFILE), "rb")) == NULL) { - warning("Can't open file:", file_name, ":", strerror(errno), FALSE); + if ((fp1 = g_fopen(get_datafile_full_name_from_name(CONFIG_FILE), "rb")) == NULL) { + warning(FALSE, 4, "Can't open file ", file_name, ": ", strerror(errno)); return; } - get_ticker_env()->suspend_rq = TRUE; gtk_window_set_keep_above(GTK_WINDOW(get_ticker_env()->win), FALSE); dialog = gtk_file_chooser_dialog_new("Export Preferences", GTK_WINDOW(get_ticker_env()->win), @@ -115,7 +111,7 @@ GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); - set_news_icon_to_dialog(GTK_WINDOW(dialog)); + set_tickr_icon_to_dialog(GTK_WINDOW(dialog)); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); g_signal_connect(G_OBJECT(dialog), "key-press-event", G_CALLBACK(esc_key_pressed), NULL); @@ -124,7 +120,7 @@ gtk_widget_show_all(dialog); /*gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), "~");*/ - gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), CONFIGFILE); + gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), CONFIG_FILE); gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE); if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) { @@ -135,13 +131,12 @@ fclose(fp2); exit_status = OK; } else - warning("Can't save Preferences to file:", - file_name, ":", strerror(errno), FALSE); + warning(FALSE, 4, "Can't save Preferences to file ", + file_name, ": ", strerror(errno)); } } fclose(fp1); gtk_widget_destroy(dialog); - get_ticker_env()->suspend_rq = FALSE; if (exit_status == OK) { snprintf(tmp, TMPSTR_SIZE + 1, "\nPreferences have been exported to file: %s\n", file_name); @@ -163,9 +158,8 @@ if (get_params()->open_link_cmd[0] == '\0') { /* TODO: should look for default browser */ - warning("Can't launch Browser: no command is defined.\n" - "Please set the 'Open in Browser' option in the Preferences window.", - "", "", "", FALSE); + warning(FALSE, 2, "Can't launch Browser: no command is defined.\n", + "Please set the 'Open in Browser' option in the Preferences window."); return; } fprintf(STD_OUT, "Spawning: %s %s\n", get_params()->open_link_cmd, help_url); @@ -174,7 +168,7 @@ argv[1] = help_url; argv[2] = NULL; if (!g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &pid, &error)) { - warning(APP_NAME": Can't create process ", argv[0], " - ", error->message, FALSE); + warning(FALSE, 4, APP_NAME": Can't create process ", argv[0], " - ", error->message); info_win("Warning", "Please check the 'Open in Browser' option in the Preferences window.", INFO_WARNING, FALSE); } else @@ -210,8 +204,8 @@ argv[2] = NULL; if (!g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &pid, &error)) - warning(APP_NAME": Can't create process ", argv[0], - " - ", error->message, FALSE); + warning(FALSE, 4, APP_NAME": Can't create process ", argv[0], + " - ", error->message); else g_spawn_close_pid(pid); } @@ -219,48 +213,36 @@ # endif #endif -/* message max len = 511 */ -static const char *message_str(const char *str1, const char *str2, const char *str3, const char *str4) -{ - static char m_str[127 + (128 * 3) + 1]; - - m_str[0] = '\0'; - if (str1[0] != '\0') - str_n_cat(m_str, str1, 127); - if (str2[0] != '\0') { - str_n_cat(m_str, " ", 1); - str_n_cat(m_str, str2, 127); - } - if (str3[0] != '\0') { - str_n_cat(m_str, " ", 1); - str_n_cat(m_str, str3, 127); - } - if (str4[0] != '\0') { - str_n_cat(m_str, " ", 1); - str_n_cat(m_str, str4, 127); - } - return (const char *)m_str; -} - /* * this func's prototype is in libetm / error.h * this func is not defined in libetm but in app and it handles errors * from libetm and app + * + * max number of strings = N_STR_MAX, max string length = STR_MAXLEN + * outstanding stuff (strings and chars) will be ignored */ -int big_error(int error_code, const char *str1, const char *str2, const char *str3, const char *str4) +int big_error(int big_error_code, int n_str, ...) { - char error_str[16 + 16 + 512 + 32 + 1]; +#define N_STR_MAX 8 +#define STR_MAXLEN 128 + + char error_str[32 + 32 + (N_STR_MAX * STR_MAXLEN) + 32 + 1]; + va_list str; + int i; get_ticker_env()->suspend_rq = TRUE; - str_n_cpy(error_str, "CRITICAL ERROR: ", 16); - if (error_code >= LIBETM_OK && error_code <= LIBETM_LASTERRORCODE) { - str_n_cat(error_str, "Libetm: ", 16); - str_n_cat(error_str, get_lib_error_str(error_code), 126); - } else { - str_n_cat(error_str, APP_NAME": ", 16); - str_n_cat(error_str, message_str(str1, str2, str3, str4), 512); - } + + error_str[0] = '\0'; + str_n_cpy(error_str, "CRITICAL ERROR: ", 32); + if (big_error_code > LIBETM_LASTERRORCODE) + str_n_cat(error_str, APP_NAME": ", 32); + n_str = MIN(n_str, N_STR_MAX); + va_start(str, n_str); + for (i = 0; i < n_str ; i++) + str_n_cat(error_str, va_arg(str, char *), STR_MAXLEN); + va_end(str); str_n_cat(error_str, " - Will quit now", 32); + if (STD_ERR != NULL) { fprintf(STD_ERR, "%s\n", error_str); fflush(NULL); @@ -273,17 +255,28 @@ free2(get_ticker_env()); free2(get_resource()); free2(get_params()); - exit(error_code); + exit(big_error_code); } /* wait for INFO_WIN_WAIT_TIMEOUT ms if true */ -void warning(const char *str1, const char *str2, const char *str3, const char *str4, gboolean wait) +void warning(gboolean wait, int n_str, ...) { - char warning_str[512]; +#define N_STR_MAX 8 +#define STR_MAXLEN 128 + + char warning_str[N_STR_MAX * STR_MAXLEN + 1]; + va_list str; + int i; warning_str[0] = '\0'; - str_n_cat(warning_str, message_str(str1, str2, str3, str4), 511); + n_str = MIN(n_str, N_STR_MAX); + va_start(str, n_str); + for (i = 0; i < n_str ; i++) + str_n_cat(warning_str, va_arg(str, char *), STR_MAXLEN); + va_end(str); + fprintf(STD_ERR, "%s\n", warning_str); + fflush(STD_ERR); #if USE_GUI if (!wait) info_win(APP_NAME" - Warning", warning_str, INFO_WARNING, FALSE); diff -Nru tickr-0.5.5/src/tickr/tickr_opml.c tickr-0.6.0/src/tickr/tickr_opml.c --- tickr-0.5.5/src/tickr/tickr_opml.c 2011-12-16 08:04:49.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr_opml.c 2012-03-07 02:01:00.000000000 +0100 @@ -1,5 +1,5 @@ /* - * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2011 + * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2012 * * * This program is free software: you can redistribute it and/or modify @@ -23,10 +23,10 @@ extern FILE *stdout_fp, *stderr_fp; #endif static char *opml_str_global; +static char tmp_url[FILE_NAME_MAXLEN + 1], tmp_str[256]; -static gint esc_key_pressed(GtkWidget *dialog2, GdkEventKey *event, gpointer unused) +static gint esc_key_pressed(GtkWidget *dialog2, GdkEventKey *event) { - unused = unused; if (event->keyval == GDK_Escape) { gtk_dialog_response(GTK_DIALOG(dialog2), GTK_RESPONSE_CANCEL); return TRUE; @@ -43,52 +43,77 @@ * importing */ +static int *get_feed_counter() +{ + static int feed_counter; + + return &feed_counter; +} + +static void zero_feed_counter() +{ + *get_feed_counter() = 0; +} + +static void inc_feed_counter() +{ + *get_feed_counter() += 1; +} + void import_opml_file() { - char *file_name, *listfname; - FILE *fp; - /* same as stuff in news_rsswin.c */ - char url_array[NURLMAX][FILE_NAME_MAXLEN + 1]; - char *p_url[NURLMAX + 1]; - int suspend_rq_bak, i; - - if ((file_name = pick_opml_file())[0] != '\0') { - listfname = (char *)get_datafile_full_name_from_name(URLLIST); - if ((fp = g_fopen(listfname, "rb")) != NULL) { + char *opml_file_name, *url_list_file_name; + FList *node; + FILE *fp; + int status = OPML_ERROR; + + if ((opml_file_name = pick_opml_file())[0] != '\0') { + url_list_file_name = l_str_new(get_datafile_full_name_from_name(URL_LIST_FILE)); + if ((fp = g_fopen(url_list_file_name, "rb")) != NULL) { fclose(fp); if (question_win("Imported URLs will be merged with currently saved ones. " - "Continue ?") == NO) + "Continue ?") == NO) { + l_str_free(url_list_file_name); return; + } + } else if ((fp = g_fopen(url_list_file_name, "wb")) != NULL) + fclose(fp); + else { + warning(FALSE, 4, "Can't create URL list ", url_list_file_name, ": ", strerror(errno)); + return; } - suspend_rq_bak = get_ticker_env()->suspend_rq; - get_ticker_env()->suspend_rq = TRUE; - win_with_spinner(WIN_WITH_SPINNER_OPEN, - "Importing data from OPML file, please wait...\n" - "(updating may take some time)"); + win_with_progress_bar(WIN_WITH_PROGRESS_BAR_OPEN, + " Importing (and updating) data from OPML file, please wait... "); + zero_feed_counter(); + get_ticker_env()->selection_mode = MULTIPLE; opml_str_global = l_str_new(NULL); - if (parse_opml_xml_file(file_name) == OK) { - if ((fp = g_fopen(listfname, "ab")) != NULL) { + if (parse_opml_xml_file(opml_file_name) == OK) + if ((fp = g_fopen(url_list_file_name, "ab")) != NULL) { fprintf(fp, "\n%s\n", opml_str_global); fclose(fp); - for (i = 0; i < NURLMAX; i++) - p_url[i] = url_array[i]; - p_url[NURLMAX] = NULL; - if (load_url_list(p_url) == OK) { - sort_url_list(p_url, 1); - save_url_list(p_url); - load_selected_url_list(init_selected_url_list()); - l_str_free(opml_str_global); - win_with_spinner(WIN_WITH_SPINNER_CLOSE, NULL); - get_ticker_env()->suspend_rq = suspend_rq_bak; - info_win(APP_NAME, "\nFeed list has been imported\n", - INFO, FALSE); - return; + if (f_list_load_from_file(&node, NULL) == OK) { + node = f_list_sort(node); + if (f_list_save_to_file(node, NULL) == OK) { + if (IS_FLIST(get_feed_list())) + f_list_free_all(get_feed_list()); + set_feed_list(node); + status = OK; + } } } - } + l_str_free(url_list_file_name); l_str_free(opml_str_global); - win_with_spinner(WIN_WITH_SPINNER_CLOSE, NULL); - get_ticker_env()->suspend_rq = suspend_rq_bak; + win_with_progress_bar(WIN_WITH_PROGRESS_BAR_CLOSE, NULL); + if (status == OK) { + /*snprintf(tmp_str, 256, "\nFeed list (%d URLs) has been imported\n", + *get_feed_counter()); + info_win(APP_NAME, tmp_str, INFO, FALSE);*/ + /* ok like that ? */ + snprintf(tmp_str, 256, "\nFeed list (%d URLs) has been imported. " + "Open the Feed Picker window ?\n", *get_feed_counter()); + if (question_win(tmp_str) == YES) + get_new_url(get_resource()); + } } } @@ -107,7 +132,7 @@ GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); - set_news_icon_to_dialog(GTK_WINDOW(dialog)); + set_tickr_icon_to_dialog(GTK_WINDOW(dialog)); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); g_signal_connect(G_OBJECT(dialog), "key-press-event", G_CALLBACK(esc_key_pressed), NULL); @@ -140,15 +165,14 @@ fprintf(STD_OUT, "Parsing OPML file... "); if ((doc = xmlParseFile(file_name)) == NULL) { - warning("Can't parse XML file:", xmlGetLastError()->message, - "", "", FALSE); + warning(FALSE, 2, "Can't parse XML file: ", xmlGetLastError()->message); return XML_UNPARSABLE; } else if ((cur_node = xmlDocGetRootElement(doc)) == NULL) { - warning("Empty XML document:", file_name, "", "", FALSE); + warning(FALSE, 2, "Empty XML document: ", file_name); xmlFreeDoc(doc); return XML_EMPTY; } else if (xmlStrcmp(cur_node->name, (const xmlChar *)"opml") != 0) { - warning("Not an OPML document:", file_name, "", "", FALSE); + warning(FALSE, 2, "Not an OPML document: ", file_name); xmlFreeDoc(doc); return OPML_ERROR; } @@ -169,12 +193,12 @@ } if (body_element == YES && outline_element == YES) { get_opml_selected_element(cur_node_start, "outline", "type"); - fprintf(STD_OUT, "done\n"); + fprintf(STD_OUT, "Done\n"); xmlFreeDoc(doc); return OK; } else { - warning("Couldn't find all required OPML elements in:", - file_name, "", "", FALSE); + warning(FALSE, 2, "Couldn't find all required OPML elements in: ", + file_name); xmlFreeDoc(doc); return OPML_ERROR; } @@ -201,13 +225,23 @@ unesc_str = g_uri_unescape_string((const char *)str2, NULL); opml_str_global = l_str_cat(opml_str_global, (const char*)unesc_str); /* get feed title from feed url - ok like that? */ - if (get_feed_info((const char *)unesc_str, feed_title, NULL, NULL) == OK) { - if (feed_title[0] != '\0') { - opml_str_global = l_str_cat(opml_str_global, TITLE_TAG_STR); - opml_str_global = l_str_cat(opml_str_global, feed_title); - } - } + str_n_cpy(tmp_url, unesc_str, FILE_NAME_MAXLEN); +/* TODO: double-check following 2 lines hack */ + if (fetch_resource(tmp_url, get_datafile_full_name_from_name(TMP1), + tmp_url) == OK) + if (get_feed_info(get_datafile_full_name_from_name(TMP1), + feed_title, NULL, NULL) == OK) + if (feed_title[0] != '\0') { + opml_str_global = l_str_cat(opml_str_global, + TITLE_TAG_STR); + opml_str_global = l_str_cat(opml_str_global, + feed_title); + } opml_str_global = l_str_cat(opml_str_global, "\n"); + inc_feed_counter(); + snprintf(tmp_str, 256, "%d feeds imported so far, please wait...", + *get_feed_counter()); + win_with_progress_bar(WIN_WITH_PROGRESS_BAR_PULSE, tmp_str); g_free(unesc_str); xmlFree(str2); } @@ -224,28 +258,22 @@ */ void export_opml_file() { - /* same as stuff in news_rsswin.c */ - char url_array[NURLMAX + 1][FILE_NAME_MAXLEN + 1]; - char *p_url[NURLMAX + 1]; + FList *node; char *str; - int i; - for (i = 0; i < NURLMAX - 1; i++) - p_url[i] = url_array[i]; - p_url[NURLMAX] = NULL; - - if (load_url_list(p_url) == OK) { - str = create_opml_str_from_url_list(p_url); + if (f_list_load_from_file(&node, NULL) == OK) { + str = create_opml_str_from_feed_list_node(node); save_str_as_opml_file(str); l_str_free(str); + f_list_free_all(node); } } /* must l_str_free() opml_str afterwards */ -char *create_opml_str_from_url_list(char **url_list) +char *create_opml_str_from_feed_list_node(FList *node) { -#define OPML_TITLE APP_NAME" Feed List" -#define STR_SIZE (8 * 1024) +#define OPML_TITLE APP_NAME"-"APP_VERSION_NUMBER" Feed List" +#define STR_SIZE (4 * 1024) char *opml_header = "\n" @@ -259,37 +287,21 @@ char *opml_footer = " \n" "\n"; - char *opml_str, feed_title[FEED_TITLE_MAXLEN + 1], tmp[STR_SIZE]; - gchar *p, *esc_str; - int i; + char *opml_str, tmp[STR_SIZE]; + gchar *esc_str1, *esc_str2; snprintf(tmp, STR_SIZE, opml_header, OPML_TITLE); opml_str = l_str_new(tmp); - - /* TODO: is escape stuff good? / should title be searched again for each feed? - */ - for (i = 0; i < NURLMAX && url_list[i] != NULL; i++) { - url_list[i] = url_list[i] + 1; /* we skip 1st char = (UN)SELECTED_URL_CHAR */ - if (!g_utf8_validate(url_list[i], -1, NULL)) { - warning("Non UTF-8 encoded string:", url_list[i], - "-", "Skipped", FALSE); + for (; node != NULL; node = node->next) { + if (!g_utf8_validate(node->url, -1, NULL)) { + warning(FALSE, 3, "Non UTF-8 encoded string: ", node->url, " - Skipped"); continue; } - feed_title[0] = '\0'; - for (p = url_list[i]; p < url_list[i] + FILE_NAME_MAXLEN - 1; p = g_utf8_find_next_char(p, NULL)) { - if (*p == TITLE_TAG_CHAR) { - esc_str = g_uri_escape_string(g_utf8_find_next_char(p, NULL), - " AÄääàçéèêÖöôÜüùà'()[]-_|{}/.,;:?!%€£$*+=", TRUE); - str_n_cpy(feed_title, esc_str, FEED_TITLE_MAXLEN); - g_free(esc_str); - *p = '\0'; - break; - } else if (*p == '\0') - break; - } - esc_str = g_uri_escape_string(url_list[i], G_URI_RESERVED_CHARS_GENERIC_DELIMITERS, TRUE); - snprintf(tmp, STR_SIZE, opml_item, feed_title, esc_str); - g_free(esc_str); + esc_str1 = g_uri_escape_string(node->title, " AÄääàçéèêÖöôÜüùà'()[]-_|{}/.,;:?!%€£$*+=", TRUE); + esc_str2 = g_uri_escape_string(node->url, G_URI_RESERVED_CHARS_GENERIC_DELIMITERS, TRUE); + snprintf(tmp, STR_SIZE, opml_item, esc_str1, esc_str2); + g_free(esc_str1); + g_free(esc_str2); opml_str = l_str_cat(opml_str, tmp); } return l_str_cat(opml_str, opml_footer); @@ -311,7 +323,7 @@ GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); - set_news_icon_to_dialog(GTK_WINDOW(dialog)); + set_tickr_icon_to_dialog(GTK_WINDOW(dialog)); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); g_signal_connect(G_OBJECT(dialog), "key-press-event", G_CALLBACK(esc_key_pressed), NULL); @@ -330,8 +342,8 @@ fclose(fp); exit_status = OK; } else - warning("Can't save OPML file:", file_name, "-", - strerror(errno), FALSE); + warning(FALSE, 3, "Can't save OPML file ", file_name, ": ", + strerror(errno)); } } gtk_widget_destroy(dialog); diff -Nru tickr-0.5.5/src/tickr/tickr_otherwins.c tickr-0.6.0/src/tickr/tickr_otherwins.c --- tickr-0.5.5/src/tickr/tickr_otherwins.c 2011-11-30 18:53:27.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr_otherwins.c 2012-03-07 02:01:00.000000000 +0100 @@ -1,5 +1,5 @@ /* - * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2011 + * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2012 * * * This program is free software: you can redistribute it and/or modify @@ -19,9 +19,8 @@ #include "tickr.h" #if USE_GUI -static gint esc_key_pressed(GtkWidget *dialog2, GdkEventKey *event, gpointer unused) +static gint esc_key_pressed(GtkWidget *dialog2, GdkEventKey *event) { - unused = unused; if (event->keyval == GDK_Escape) { gtk_dialog_response(GTK_DIALOG(dialog2), GTK_RESPONSE_CLOSE); return TRUE; @@ -55,7 +54,7 @@ GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); - set_news_icon_to_dialog(GTK_WINDOW(dialog)); + set_tickr_icon_to_dialog(GTK_WINDOW(dialog)); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); g_signal_connect(G_OBJECT(dialog), "key-press-event", G_CALLBACK(esc_key_pressed), NULL); @@ -72,11 +71,9 @@ str_n_cpy(resrc->id, file_name2, FILE_NAME_MAXLEN); g_free(file_name2); - env->suspend_rq = TRUE; get_ticker_env()->selection_mode = SINGLE; if ((resource_flag = load_resource(resrc, NULL)) == OK) { env->reload_rq = TRUE; - env->suspend_rq = FALSE; break; } else { snprintf(tmp, TMPSTR_SIZE + 1, "load_resource() error %d", resource_flag); @@ -84,7 +81,6 @@ str_n_cpy(resrc->id, resrc_bak.id, FILE_NAME_MAXLEN); get_ticker_env()->selection_mode = selection_mode_bak; load_resource(resrc, NULL); - env->suspend_rq = FALSE; } } gtk_widget_destroy(dialog); @@ -129,7 +125,7 @@ GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); - set_news_icon_to_dialog(GTK_WINDOW(dialog)); + set_tickr_icon_to_dialog(GTK_WINDOW(dialog)); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); g_signal_connect(G_OBJECT(dialog), "key-press-event", G_CALLBACK(esc_key_pressed), NULL); @@ -211,7 +207,7 @@ GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); - set_news_icon_to_dialog(GTK_WINDOW(dialog)); + set_tickr_icon_to_dialog(GTK_WINDOW(dialog)); gtk_container_set_border_width(GTK_CONTAINER(dialog), 15); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_NONE); @@ -260,8 +256,9 @@ license_but = gtk_dialog_add_button(GTK_DIALOG(dialog), "License", GTK_RESPONSE_NONE); close_but = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); + close_but = close_but; /* to get rid of one compiler warning */ - set_news_icon_to_dialog(GTK_WINDOW(dialog)); + set_tickr_icon_to_dialog(GTK_WINDOW(dialog)); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); g_signal_connect(G_OBJECT(license_but), "clicked", G_CALLBACK(license_win), NULL); @@ -273,13 +270,13 @@ gtk_container_set_border_width(GTK_CONTAINER(table), 15); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), table); - image = gtk_image_new_from_file(get_imagefile_full_name_from_name(NEWS_LOGO)); + image = gtk_image_new_from_file(get_imagefile_full_name_from_name(TICKR_LOGO)); gtk_table_attach_defaults(GTK_TABLE(table), image, 0, 1, 0, 1); - label[0] = gtk_label_new("\n"APP_NAME" version "APP_VERSION_NUMBER" - RSS Feed Reader"); + label[0] = gtk_label_new("\n"APP_NAME" version "APP_VERSION_NUMBER" - Feed Reader"); gtk_label_set_use_markup(GTK_LABEL(label[0]), TRUE); gtk_table_attach_defaults(GTK_TABLE(table), label[0], 0, 1, 1, 2); - label[1] = gtk_label_new("Copyright (C) Emmanuel Thomas-Maurin 2009-2011"); + label[1] = gtk_label_new("Copyright (C) Emmanuel Thomas-Maurin 2009-2012"); gtk_label_set_use_markup(GTK_LABEL(label[1]), TRUE); gtk_table_attach_defaults(GTK_TABLE(table), label[1], 0, 1, 2, 3); label[2] = gtk_label_new(""APP_SUPPORT_EMAIL""); @@ -299,7 +296,7 @@ /* * info, warning or error - * === should format txt in case it's a long string === + * === should format text in case it's a long string === */ void info_win(const char *title, const char *txt, info_type info, gboolean selectable) { @@ -316,8 +313,9 @@ GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); - set_news_icon_to_dialog(GTK_WINDOW(dialog)); + set_tickr_icon_to_dialog(GTK_WINDOW(dialog)); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); + gtk_window_set_keep_above(GTK_WINDOW(dialog), TRUE); g_signal_connect(G_OBJECT(dialog), "key-press-event", G_CALLBACK(esc_key_pressed), NULL); g_signal_connect(G_OBJECT(dialog), "delete_event", G_CALLBACK(force_quit_dialog), NULL); @@ -376,8 +374,9 @@ win = gtk_window_new(GTK_WINDOW_POPUP); - set_news_icon_to_dialog(GTK_WINDOW(win)); + set_tickr_icon_to_dialog(GTK_WINDOW(win)); gtk_window_set_position(GTK_WINDOW(win), INFO_WIN_WAIT_POS); + gtk_window_set_keep_above(GTK_WINDOW(win), TRUE); table = gtk_table_new(1, 3, FALSE); gtk_table_set_col_spacings(GTK_TABLE(table), 10); @@ -412,8 +411,14 @@ check_main_win_always_on_top(); } +/* win centered */ int question_win(const char *txt) { + return question_win_at(txt, GTK_WIN_POS_CENTER); +} + +int question_win_at(const char *txt, int win_pos) +{ GtkWidget *dialog, *table, *image, *label[2]; gint response; @@ -426,8 +431,9 @@ GTK_STOCK_YES, GTK_RESPONSE_YES, NULL); - set_news_icon_to_dialog(GTK_WINDOW(dialog)); - gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); + set_tickr_icon_to_dialog(GTK_WINDOW(dialog)); + gtk_window_set_position(GTK_WINDOW(dialog), win_pos); + gtk_window_set_keep_above(GTK_WINDOW(dialog), TRUE); /* why always no? gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_NO);*/ @@ -452,7 +458,8 @@ return ((response == GTK_RESPONSE_YES) ? YES : NO); } -void win_with_spinner(spinner_win_mode mode, const char *txt) +/* this one is buggy as the spinner don't always spin as expected (hmm...) */ +void win_with_spinner(win_with_spinner_mode mode, const char *txt) { static GtkWidget *win; GtkWidget *hbox, *label; @@ -466,7 +473,7 @@ gtk_window_set_keep_above(GTK_WINDOW(get_ticker_env()->win), FALSE); win = gtk_window_new(GTK_WINDOW_POPUP); - set_news_icon_to_dialog(GTK_WINDOW(win)); + set_tickr_icon_to_dialog(GTK_WINDOW(win)); gtk_window_set_position(GTK_WINDOW(win), GTK_WIN_POS_CENTER); gtk_window_set_keep_above(GTK_WINDOW(win), TRUE); @@ -506,6 +513,46 @@ gtk_widget_destroy(win); check_main_win_always_on_top(); } else - warning("win_with_spinner():", "Invalid mode", "", "", FALSE); + warning(FALSE, 1, "win_with_spinner(): Invalid mode"); +} + +void win_with_progress_bar(win_with_progress_bar_mode mode, const char *txt) +{ + static GtkWidget *win, *hbox, *progress_bar; + + if (mode == WIN_WITH_PROGRESS_BAR_OPEN) { + gtk_window_set_keep_above(GTK_WINDOW(get_ticker_env()->win), FALSE); + + win = gtk_window_new(GTK_WINDOW_POPUP); + set_tickr_icon_to_dialog(GTK_WINDOW(win)); + gtk_window_set_position(GTK_WINDOW(win), GTK_WIN_POS_CENTER); + gtk_window_set_keep_above(GTK_WINDOW(win), TRUE); + + hbox = gtk_hbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(GTK_WINDOW(win)), hbox); + progress_bar = gtk_progress_bar_new(); + gtk_container_add(GTK_CONTAINER(GTK_BOX(hbox)), progress_bar); + gtk_container_set_border_width(GTK_CONTAINER(GTK_BOX(hbox)), 15); + + gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress_bar), txt); + gtk_progress_bar_set_pulse_step(GTK_PROGRESS_BAR(progress_bar), 0.2); + + gtk_widget_show_all(win); + + /* so that win will popup immediately */ + while (gtk_events_pending()) + gtk_main_iteration(); + } else if (mode == WIN_WITH_PROGRESS_BAR_PULSE) { + if (txt != NULL) + gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress_bar), txt); + gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progress_bar)); + + while (gtk_events_pending()) + gtk_main_iteration(); + } else if (mode == WIN_WITH_PROGRESS_BAR_CLOSE) { + gtk_widget_destroy(win); + check_main_win_always_on_top(); + } else + warning(FALSE, 1, "win_with_spinner(): Invalid mode"); } #endif diff -Nru tickr-0.5.5/src/tickr/tickr_params.c tickr-0.6.0/src/tickr/tickr_params.c --- tickr-0.5.5/src/tickr/tickr_params.c 2011-12-17 21:11:43.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr_params.c 2012-03-07 02:01:00.000000000 +0100 @@ -1,5 +1,5 @@ /* - * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2011 + * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2012 * * * This program is free software: you can redistribute it and/or modify @@ -97,16 +97,16 @@ /* * load conf file if any & set up - returns 0 if ok * store options in a string array and initialize a ptr arrays that matches strings - * we assume we have up to NOPTIONSMAX options, OPTION_MAXLEN char long max each + * we assume we have up to N_OPTION_MAX options, OPTION_MAXLEN char long max each */ int get_config_file_options(Params *prm) { FILE *conf_fp; - char options_array[NOPTIONSMAX][OPTION_MAXLEN + 2], tmp[TMPSTR_SIZE + 1]; - char *ptr[NOPTIONSMAX + 1]; + char options_array[N_OPTION_MAX][OPTION_MAXLEN + 2]; + char *ptr[N_OPTION_MAX + 1]; int i, j = 0; - if ((conf_fp = g_fopen(get_datafile_full_name_from_name(CONFIGFILE), "rb")) != NULL) { + if ((conf_fp = g_fopen(get_datafile_full_name_from_name(CONFIG_FILE), "rb")) != NULL) { /* * parse conf file */ @@ -115,13 +115,12 @@ * here fgets() read OPTION_MAXLEN + 1 char max including * '\n' then add '\0' (if I'm right...) */ - if (i >= NOPTIONSMAX) { + if (i >= N_OPTION_MAX) { ptr[i] = NULL; - snprintf(tmp, TMPSTR_SIZE + 1, - "Too many lines in configuration file: %s " - "(max = %d)\nWon't parse further than limit\n", - get_datafile_full_name_from_name(CONFIGFILE), NOPTIONSMAX); - warning(tmp, "", "", "", FALSE); + warning(FALSE, 5, "Too many lines in configuration file: ", + get_datafile_full_name_from_name(CONFIG_FILE), + "(max = ", itoa2(N_OPTION_MAX), ")" + "\nWon't parse further than limit\n"); break; } if (fgets(options_array[i], OPTION_MAXLEN + 2, conf_fp) == NULL) { @@ -140,23 +139,23 @@ fclose(conf_fp); } else fprintf(STD_ERR, "Can't read configuration file: %s - %s\n", - get_datafile_full_name_from_name(CONFIGFILE), strerror(errno)); + get_datafile_full_name_from_name(CONFIG_FILE), strerror(errno)); return j; } /* * options array parser (NULL terminated ptrs array) - * we assume we have up to NOPTIONSMAX options, OPTION_MAXLEN char long max each + * we assume we have up to N_OPTION_MAX options, OPTION_MAXLEN char long max each */ int parse_options_array(Params *prm, int n_options, const char *option[]) { int i, exit_status = OK; - if (n_options > NOPTIONSMAX) { - n_options = NOPTIONSMAX; + if (n_options > N_OPTION_MAX) { + n_options = N_OPTION_MAX; fprintf(STD_ERR, "Too many options (max = %d) - Won't parse further than limit\n", - NOPTIONSMAX); + N_OPTION_MAX); exit_status = OPTION_TOO_MANY; } for (i = 0; i < n_options && option[i] != NULL; i++) @@ -463,12 +462,11 @@ void save_to_config_file(const Params *prm) { FILE *conf_fp; - /*char str1[9 + 1], str2[9 + 1], str3[9 + 1], str4[9 + 1];*/ char fname[FONT_NAME_MAXLEN + 1], fsize[FONT_SIZE_MAXLEN + 1]; char cfname[FONT_NAME_MAXLEN + 1], cfsize[FONT_SIZE_MAXLEN + 1]; char tmp[2 * 1024]; - if ((conf_fp = g_fopen(get_datafile_full_name_from_name(CONFIGFILE), "wb")) != NULL) { + if ((conf_fp = g_fopen(get_datafile_full_name_from_name(CONFIG_FILE), "wb")) != NULL) { split_font(prm->font_n_s, fname, fsize); split_font(prm->clock_font_n_s, cfname, cfsize); snprintf(tmp, 2 * 1024, "%s%s%s", @@ -499,7 +497,6 @@ "-rssdescription=%c\n" "-rssdescriptiondelimiter=%s\n" "-nitemsperfeed=%d\n" - /*"-readinloop=%c\n"*/ "-rmtags=%c\n" "-uppercasetext=%c\n" "-homefeed=%s\n" @@ -551,7 +548,6 @@ prm->rss_description, prm->rss_description_delimiter, prm->n_items_per_feed, - /*prm->read_in_loop,*/ prm->strip_html_tags, prm->upper_case_text, prm->homefeed, @@ -578,9 +574,9 @@ ); fclose(conf_fp); } else - warning("Can't save configuration file:", - get_datafile_full_name_from_name(CONFIGFILE), "-", - strerror(errno), FALSE); + warning(FALSE, 4, "Can't save configuration file ", + get_datafile_full_name_from_name(CONFIG_FILE), ": ", + strerror(errno)); } /* diff -Nru tickr-0.5.5/src/tickr/tickr_prefwin.c tickr-0.6.0/src/tickr/tickr_prefwin.c --- tickr-0.5.5/src/tickr/tickr_prefwin.c 2011-12-17 21:15:32.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr_prefwin.c 2012-03-07 02:01:00.000000000 +0100 @@ -1,5 +1,5 @@ /* - * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2011 + * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2012 * * * This program is free software: you can redistribute it and/or modify @@ -41,9 +41,8 @@ static GtkWidget *checkbut_spchars; static GtkWidget *font_but, *clock_font_but; static GtkWidget *fg_color_but, *bg_color_but, *clock_fg_color_but, *clock_bg_color_but; -/*static GtkWidget *rbut_box1, *radio_but1_1, *radio_but1_2;*/ +static GtkWidget *rbut_box1, *radio_but1_1, *radio_but1_2, *radio_but1_3; static GtkWidget *rbut_box2, *radio_but2_1, *radio_but2_2, *radio_but2_3; -static GtkWidget *rbut_box3, *radio_but3_1, *radio_but3_2, *radio_but3_3; static GtkWidget *entry_newpagech, *entry_tabch, *entry_rsstitledel; static GtkWidget *entry_rssdesdel, *entry_linedel, *entry_cutlinedel; static GtkWidget *entry_openlinkcmd, *entry_openlinkargs; @@ -52,9 +51,8 @@ static GtkObject *adj_shadowoffsety, *adj_rssrefresh; static GtkObject *adj_wintransparency, *adj_nitemsperfeed; -static gint esc_key_pressed(GtkWidget *dialog2, GdkEventKey *event, gpointer unused) +static gint esc_key_pressed(GtkWidget *dialog2, GdkEventKey *event) { - unused = unused; if (event->keyval == GDK_Escape) { gtk_dialog_response(GTK_DIALOG(dialog2), GTK_RESPONSE_CANCEL); return TRUE; @@ -70,14 +68,11 @@ /* * ***to be fixed: we want widgets system colors, not these ones*** */ -static gint use_system_fg_color_ticker(GtkWidget *button, GdkEventKey *event, gpointer unused) +static gint use_system_fg_color_ticker(GtkWidget *widget) { GdkColor color; - button = button; - event = event; - unused = unused; - + widget = widget; color = gtk_widget_get_default_style()->fg[0]; /*color = gtk_widget_get_style(env->win)->fg[0];*/ gtk_color_button_set_color(GTK_COLOR_BUTTON(fg_color_but), &color); @@ -86,14 +81,11 @@ return TRUE; } -static gint use_system_bg_color_ticker(GtkWidget *button, GdkEventKey *event, gpointer unused) +static gint use_system_bg_color_ticker(GtkWidget *widget) { GdkColor color; - button = button; - event = event; - unused = unused; - + widget = widget; color = gtk_widget_get_default_style()->bg[0]; /*color = gtk_widget_get_style(env->win)->bg[0];*/ gtk_color_button_set_color(GTK_COLOR_BUTTON(bg_color_but), &color); @@ -102,14 +94,11 @@ return TRUE; } -static gint use_system_fg_color_clock(GtkWidget *button, GdkEventKey *event, gpointer unused) +static gint use_system_fg_color_clock(GtkWidget *widget) { GdkColor color; - button = button; - event = event; - unused = unused; - + widget = widget; color = gtk_widget_get_default_style()->fg[0]; /*color = gtk_widget_get_style(env->win)->fg[0];*/ gtk_color_button_set_color(GTK_COLOR_BUTTON(clock_fg_color_but), &color); @@ -118,14 +107,11 @@ return TRUE; } -static gint use_system_bg_color_clock(GtkWidget *button, GdkEventKey *event, gpointer unused) +static gint use_system_bg_color_clock(GtkWidget *widget) { GdkColor color; - button = button; - event = event; - unused = unused; - + widget = widget; color = gtk_widget_get_default_style()->bg[0]; /*color = gtk_widget_get_style(env->win)->bg[0];*/ gtk_color_button_set_color(GTK_COLOR_BUTTON(clock_bg_color_but), &color); @@ -134,26 +120,20 @@ return TRUE; } -static gint move_to_top(GtkWidget *button, GdkEventKey *event, gpointer unused) +static gint move_to_top(GtkWidget *widget) { - button = button; - event = event; - unused = unused; - + widget = widget; gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbut_winy), 0); return TRUE; } -static gint move_to_bottom(GtkWidget *button, GdkEventKey *event, gpointer unused) +static gint move_to_bottom(GtkWidget *widget) { char font_n_s[FONT_MAXLEN + 1]; char fname[FONT_NAME_MAXLEN + 1], fsize[FONT_SIZE_MAXLEN + 1]; gint requested_font_size, requested_h, y_bottom; - button = button; - event = event; - unused = unused; - + widget = widget; /* we need to know requested ticker height */ requested_h = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(spinbut_winh)); if (requested_h > 0 && requested_h < DRWA_HEIGHT_MIN) @@ -172,17 +152,15 @@ y_bottom = env->screen_h - requested_h; #ifndef G_OS_WIN32 /* how to get taskbar height on linux? */ - /*info_win_wait("Taskbar height: Will use 25 pixels arbitrary value - " - "Please adjust as necessary afterwards", INFO_WIN_WAIT_TIMEOUT);*/ - warning("Taskbar height: Will use 25 pixels arbitrary value - ", - "Please adjust as necessary afterwards", "", "", FALSE); + warning(FALSE, 1, "Taskbar height: Will use 25 pixels arbitrary value - " + "Please adjust as necessary afterwards"); y_bottom -= 25; #else if (get_win32_taskbar_height() != -1) y_bottom -= get_win32_taskbar_height(); else { - warning("Couldn't compute Taskbar height:", "Will use 25 pixels arbitrary value", - "-", "Please adjust as necessary afterwards", FALSE); + warning(FALSE, 1, "Couldn't compute Taskbar height: Will use 25 pixels arbitrary value" + " - Please adjust as necessary afterwards"); y_bottom -= 25; } #endif @@ -190,24 +168,18 @@ return TRUE; } -static gint set_full_width(GtkWidget *button, GdkEventKey *event, gpointer unused) +static gint set_full_width(GtkWidget *widget) { - button = button; - event = event; - unused = unused; - + widget = widget; gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbut_winw), env->screen_w); - /* will also locate ticker in left corner */ + /* will also push ticker in left corner */ gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbut_winx), 0); return TRUE; } -static gint get_current_url(GtkWidget *button, GdkEventKey *event, gpointer unused) +static gint get_current_url(GtkWidget *widget) { - button = button; - event = event; - unused = unused; - + widget = widget; gtk_entry_set_text(GTK_ENTRY(entry_homefeed), current_url); return TRUE; } @@ -233,7 +205,7 @@ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, NULL); - set_news_icon_to_dialog(GTK_WINDOW(dialog)); + set_tickr_icon_to_dialog(GTK_WINDOW(dialog)); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); g_signal_connect(G_OBJECT(dialog), "key-press-event", G_CALLBACK(esc_key_pressed), NULL); @@ -378,7 +350,6 @@ * win_h */ label[i] = gtk_label_new("Height (Pixels - Override font size if > 0): "); - /*label[i] = gtk_label_new("Height (Pixels - Override font size): ");*/ gtk_label_set_use_markup(GTK_LABEL(label[i]), TRUE); gtk_misc_set_alignment(GTK_MISC(label[i]), 0, 0.5); gtk_table_attach_defaults(GTK_TABLE(table), label[i], COLUMN1, i, i + 1); @@ -417,12 +388,11 @@ /* * window transparency */ - /*label[i] = gtk_label_new("Window transparency (Actually opacity x 10): ");*/ label[i] = gtk_label_new("Window opacity (x 10): "); gtk_label_set_use_markup(GTK_LABEL(label[i]), TRUE); gtk_misc_set_alignment(GTK_MISC(label[i]), 0, 0.5); gtk_table_attach_defaults(GTK_TABLE(table), label[i], COLUMN1, i, i + 1); - /* transparency set from gui ranges from 1 (0.1) to 10 (1.0) / 0 is kind of "useless" */ + /* transparency set from gui ranges from 1 (0.1) to 10 (1.0) / 0.0 (invisible!) is kind of "useless" */ adj_wintransparency = gtk_adjustment_new(prm->win_transparency * 10, 1, 10, 1, 2, 0); spinbut_wintransparency = gtk_spin_button_new(GTK_ADJUSTMENT(adj_wintransparency), 0.0, 0); gtk_table_attach_defaults(GTK_TABLE(table), spinbut_wintransparency, COLUMN2, i, i + 1); @@ -540,7 +510,6 @@ /* * rss refresh */ - /*label[i] = gtk_label_new("RSS refresh (Minutes - If no TTL / Always apply for files): ");*/ label[i] = gtk_label_new("Reload delay (Minutes - If no TTL or if text file): "); gtk_label_set_use_markup(GTK_LABEL(label[i]), TRUE); gtk_misc_set_alignment(GTK_MISC(label[i]), 0, 0.5); @@ -613,24 +582,6 @@ gtk_table_attach_defaults(GTK_TABLE(table), spinbut_nitemsperfeed, COLUMN2, i, i + 1); i++; /* - * read selection in loop / once - */ - /*label[i] = gtk_label_new("Read selected feed(s): "); - gtk_label_set_use_markup(GTK_LABEL(label[i]), TRUE); - gtk_misc_set_alignment(GTK_MISC(label[i]), 0, 0.5); - gtk_table_attach_defaults(GTK_TABLE(table), label[i], COLUMN1, i, i + 1); - radio_but1_1 = gtk_radio_button_new_with_label(NULL, "In loop"); - radio_but1_2 = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(radio_but1_1), "Once"); - rbut_box1 = gtk_hbox_new(TRUE, 2); - gtk_box_pack_start(GTK_BOX(rbut_box1), radio_but1_1, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(rbut_box1), radio_but1_2, TRUE, TRUE, 0); - if (prm->read_in_loop == 'y') - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_but1_1), TRUE); - else if (prm->read_in_loop == 'n') - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_but1_2), TRUE); - gtk_table_attach_defaults(GTK_TABLE(table), rbut_box1, COLUMN2, i, i + 1); - i++;*/ - /* * remove html tags */ label[i] = gtk_label_new("Strip html tags: "); @@ -662,7 +613,6 @@ * homefeed / set current feed as homefeed */ hbox5 = gtk_hbox_new(FALSE, 0); - /*label[i] = gtk_label_new("'Homefeed' (= Homepage): ");*/ label[i] = gtk_label_new("Default feed ('Homefeed'): "); gtk_label_set_use_markup(GTK_LABEL(label[i]), TRUE); gtk_misc_set_alignment(GTK_MISC(label[i]), 0, 0.5); @@ -679,7 +629,6 @@ /* * "open in browser" command line */ - /*label[i] = gtk_label_new("'Open in Browser' command line (May require path): ");*/ label[i] = gtk_label_new("'Open in Browser' command line: "); gtk_label_set_use_markup(GTK_LABEL(label[i]), TRUE); gtk_misc_set_alignment(GTK_MISC(label[i]), 0, 0.5); @@ -708,20 +657,20 @@ gtk_label_set_use_markup(GTK_LABEL(label[i]), TRUE); gtk_misc_set_alignment(GTK_MISC(label[i]), 0, 0.5); gtk_table_attach_defaults(GTK_TABLE(table), label[i], COLUMN1, i, i + 1); - radio_but2_1 = gtk_radio_button_new_with_label(NULL, "Left"); - radio_but2_2 = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(radio_but2_1), "Right"); - radio_but2_3 = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(radio_but2_1), "None"); - rbut_box2 = gtk_hbox_new(TRUE, 2); - gtk_box_pack_start(GTK_BOX(rbut_box2), radio_but2_1, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(rbut_box2), radio_but2_2, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(rbut_box2), radio_but2_3, TRUE, TRUE, 0); + radio_but1_1 = gtk_radio_button_new_with_label(NULL, "Left"); + radio_but1_2 = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(radio_but1_1), "Right"); + radio_but1_3 = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(radio_but1_1), "None"); + rbut_box1 = gtk_hbox_new(TRUE, 2); + gtk_box_pack_start(GTK_BOX(rbut_box1), radio_but1_1, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(rbut_box1), radio_but1_2, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(rbut_box1), radio_but1_3, TRUE, TRUE, 0); if (prm->clock == 'l') - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_but2_1), TRUE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_but1_1), TRUE); else if (prm->clock == 'r') - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_but2_2), TRUE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_but1_2), TRUE); else - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_but2_3), TRUE); - gtk_table_attach_defaults(GTK_TABLE(table), rbut_box2, COLUMN2, i, i + 1); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_but1_3), TRUE); + gtk_table_attach_defaults(GTK_TABLE(table), rbut_box1, COLUMN2, i, i + 1); i++; /* * clock_font @@ -782,9 +731,9 @@ gtk_table_attach_defaults(GTK_TABLE(table), checkbut_nopopups, COLUMN2, i, i + 1); i++; /* - * pause on mouseover + * pause on mouse-over */ - label[i] = gtk_label_new("Pause ticker on mouseover: "); + label[i] = gtk_label_new("Pause ticker on mouse-over: "); gtk_label_set_use_markup(GTK_LABEL(label[i]), TRUE); gtk_misc_set_alignment(GTK_MISC(label[i]), 0, 0.5); gtk_table_attach_defaults(GTK_TABLE(table), label[i], COLUMN1, i, i + 1); @@ -802,22 +751,22 @@ gtk_label_set_use_markup(GTK_LABEL(label[i]), TRUE); gtk_misc_set_alignment(GTK_MISC(label[i]), 0, 0.5); gtk_table_attach_defaults(GTK_TABLE(table), label[i], COLUMN1, i, i + 1); - radio_but3_1 = gtk_radio_button_new_with_label(NULL, "Speed"); - radio_but3_2 = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(radio_but3_1), "Feed"); - radio_but3_3 = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(radio_but3_1), "None"); - rbut_box3 = gtk_hbox_new(TRUE, 2); - gtk_box_pack_start(GTK_BOX(rbut_box3), radio_but3_1, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(rbut_box3), radio_but3_2, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(rbut_box3), radio_but3_3, TRUE, TRUE, 0); + radio_but2_1 = gtk_radio_button_new_with_label(NULL, "Speed"); + radio_but2_2 = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(radio_but2_1), "Feed"); + radio_but2_3 = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(radio_but2_1), "None"); + rbut_box2 = gtk_hbox_new(TRUE, 2); + gtk_box_pack_start(GTK_BOX(rbut_box2), radio_but2_1, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(rbut_box2), radio_but2_2, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(rbut_box2), radio_but2_3, TRUE, TRUE, 0); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_but3_1), TRUE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_but2_1), TRUE); if (prm->mouse_wheel_scroll == 's') - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_but3_1), TRUE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_but2_1), TRUE); else if (prm->mouse_wheel_scroll == 'f') - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_but3_2), TRUE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_but2_2), TRUE); else - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_but3_3), TRUE); - gtk_table_attach_defaults(GTK_TABLE(table), rbut_box3, COLUMN2, i, i + 1); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_but2_3), TRUE); + gtk_table_attach_defaults(GTK_TABLE(table), rbut_box2, COLUMN2, i, i + 1); i++; /* * special chars @@ -983,12 +932,6 @@ /* read n items max per feed */ prm->n_items_per_feed = (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(spinbut_nitemsperfeed)); - /* read selection in loop / once */ - /*if ((gboolean)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_but1_1))) - prm->read_in_loop = 'y'; - else if ((gboolean)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_but1_2))) - prm->read_in_loop = 'n';*/ - /* strip html tags */ if ((gboolean)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbut_striptags))) prm->strip_html_tags = 'y'; @@ -1014,9 +957,9 @@ (char *)gtk_entry_get_text(GTK_ENTRY(entry_openlinkargs)), FILE_NAME_MAXLEN); /* clock */ - if ((gboolean)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_but2_1))) + if ((gboolean)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_but1_1))) prm->clock = 'l'; - else if ((gboolean)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_but2_2))) + else if ((gboolean)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_but1_2))) prm->clock = 'r'; else prm->clock = 'n'; @@ -1039,16 +982,16 @@ else prm->disable_popups = 'n'; - /* pause on mouseover */ + /* pause on mouse-over */ if ((gboolean)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbut_mouseover))) prm->pause_on_mouseover = 'y'; else prm->pause_on_mouseover = 'n'; /* mouse wheel scrolling behaviour */ - if ((gboolean)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_but3_1))) + if ((gboolean)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_but2_1))) prm->mouse_wheel_scroll = 's'; - else if ((gboolean)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_but3_2))) + else if ((gboolean)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_but2_2))) prm->mouse_wheel_scroll = 'f'; else prm->mouse_wheel_scroll = 'n'; diff -Nru tickr-0.5.5/src/tickr/tickr_quickfeedpicker.c tickr-0.6.0/src/tickr/tickr_quickfeedpicker.c --- tickr-0.5.5/src/tickr/tickr_quickfeedpicker.c 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr_quickfeedpicker.c 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1,187 @@ +/* + * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2012 + * + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "tickr.h" + +#if USE_GUI + +static GtkWidget *dialog, *sc_win; +static FList *flist; +static int f_index; /* starting at 0 (row starts at 1) */ +static char url[FILE_NAME_MAXLEN + 1]; + +enum {COLUMN_INT, COLUMN_STRING_TITLE, COLUMN_STRING_URL, N_COLUMNS}; + +static gint esc_key_pressed(GtkWidget *dialog2, GdkEventKey *event) +{ + if (event->keyval == GDK_Escape) { + gtk_dialog_response(GTK_DIALOG(dialog2), GTK_RESPONSE_CLOSE); + return TRUE; + } else + return FALSE; +} + +static gint enter_key_pressed(GtkWidget *dialog2, GdkEventKey *event) +{ + if (event->keyval == GDK_Return) { + gtk_dialog_response(GTK_DIALOG(dialog2), GTK_RESPONSE_OK); + return TRUE; + } else + return FALSE; +} + +static void force_quit_dialog(GtkWidget *dialog2) +{ + gtk_dialog_response(GTK_DIALOG(dialog2), GTK_RESPONSE_CLOSE); +} + +/* tree selection callback - get url */ +static gint tree_selection_changed(GtkTreeSelection *selection) +{ + GtkTreeModel *tree_model; + GtkTreeIter iter; + gchar *str_url; + + if (gtk_tree_selection_get_selected(selection, &tree_model, &iter)) { + gtk_tree_model_get(tree_model, &iter, + COLUMN_INT, &f_index, + COLUMN_STRING_URL, &str_url, + -1); + str_n_cpy(url, (const char *)str_url, FILE_NAME_MAXLEN); + g_free(str_url); + } + gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_NONE); + return TRUE; +} + +/* catch double-click on tree view */ +static gint double_click_on_tree_view(GtkTreeView *tree_view, GtkTreePath *tree_path) +{ + GtkTreeModel *tree_model; + GtkTreeIter iter; + gchar *str_url; + + tree_model = gtk_tree_view_get_model(tree_view); + if (gtk_tree_model_get_iter(tree_model, &iter, tree_path)) { + gtk_tree_model_get(tree_model, &iter, + COLUMN_INT, &f_index, + COLUMN_STRING_URL, &str_url, + -1); + str_n_cpy(url, (const char *)str_url, FILE_NAME_MAXLEN); + g_free(str_url); + } + gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); + return TRUE; +} + +/* clear the list before filling it */ +static void fill_list_store_from_flnode(GtkListStore *list_store) +{ + FList *flist2; + GtkTreeIter iter; + int i = 0; + + gtk_list_store_clear(list_store); + if (IS_FLIST(flist)) + for (flist2 = f_list_first(flist); IS_FLIST(flist2); flist2 = flist2->next) { + gtk_list_store_append(list_store, &iter); + gtk_list_store_set(list_store, &iter, + COLUMN_INT, i, + COLUMN_STRING_TITLE, flist2->title, + COLUMN_STRING_URL, flist2->url, + -1); + i++; + } +} + +/* actually ***selected feed*** picker */ +void quick_feed_picker(int up_or_down) +{ + GtkTreeView *tree_view; + GtkListStore *list_store; + GtkCellRenderer *renderer1, *renderer2; + GtkTreeViewColumn *column1, *column2; + GtkTreeSelection *selection; + gint response; + + up_or_down = up_or_down; /* unused so far */ + + dialog = gtk_dialog_new_with_buttons( + "Selected Feed Picker", GTK_WINDOW(get_ticker_env()->win), + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + NULL); + + set_tickr_icon_to_dialog(GTK_WINDOW(dialog)); + gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE); + gtk_container_set_border_width(GTK_CONTAINER(dialog), 0); + gtk_widget_set_size_request(dialog, 450, 200); + + sc_win = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sc_win), GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), sc_win); + + list_store = gtk_list_store_new(N_COLUMNS, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING); + if (IS_FLIST(get_feed_selection())) { + flist = f_list_first(get_feed_selection()); + fill_list_store_from_flnode(list_store); + } else { + warning(FALSE, 2, "No feed selection available\n", + "(You have set 'Mouse wheel scrolling apply to: Feed' and\n" + "either there is no feed list or no feed has been selected)"); + gtk_widget_destroy(dialog); + return; + } + + tree_view = GTK_TREE_VIEW(gtk_tree_view_new_with_model(GTK_TREE_MODEL(list_store))); + renderer1 = gtk_cell_renderer_text_new(); + column1 = gtk_tree_view_column_new_with_attributes("Selected Feed Title", renderer1, + "text", COLUMN_STRING_TITLE, NULL); + gtk_tree_view_append_column(tree_view, column1); + renderer2 = gtk_cell_renderer_text_new(); + column2 = gtk_tree_view_column_new_with_attributes("Selected Feed URL", renderer2, + "text", COLUMN_STRING_URL, NULL); + gtk_tree_view_append_column(tree_view, column2); + gtk_container_add(GTK_CONTAINER(sc_win), GTK_WIDGET(tree_view)); + + selection = gtk_tree_view_get_selection(tree_view); + gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE); + + g_signal_connect(G_OBJECT(dialog), "key-press-event", G_CALLBACK(esc_key_pressed), NULL); + g_signal_connect(G_OBJECT(dialog), "key-press-event", G_CALLBACK(enter_key_pressed), NULL); + g_signal_connect(G_OBJECT(dialog), "delete_event", G_CALLBACK(force_quit_dialog), NULL); + g_signal_connect(G_OBJECT(selection), "changed", G_CALLBACK(tree_selection_changed), NULL); + g_signal_connect(G_OBJECT(tree_view), "row_activated", G_CALLBACK(double_click_on_tree_view), NULL); + + gtk_widget_show_all(dialog); + if (IS_FLIST(flist) && (get_resource()->id)[0] != '\0') + if ((f_index = f_list_search(flist, (get_resource()->id))) > -1) + highlight_and_go_to_row(tree_view, selection, f_index + 1); + while ((response = gtk_dialog_run(GTK_DIALOG(dialog))) != GTK_RESPONSE_CANCEL &&\ + response != GTK_RESPONSE_CLOSE) { + if (response == GTK_RESPONSE_OK) { + if ((f_index = f_list_search(flist, url)) > -1) { + set_feed_selection(f_list_nth(flist, f_index + 1)); + get_ticker_env()->reload_rq = TRUE; + } + break; + } + } + gtk_widget_destroy(dialog); +} +#endif diff -Nru tickr-0.5.5/src/tickr/tickr_render.c tickr-0.6.0/src/tickr/tickr_render.c --- tickr-0.5.5/src/tickr/tickr_render.c 2011-11-30 18:54:48.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr_render.c 2012-03-07 02:01:00.000000000 +0100 @@ -1,5 +1,5 @@ /* - * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2011 + * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2012 * * * This program is free software: you can redistribute it and/or modify @@ -81,7 +81,7 @@ /* * translate link ranks inside (eventually splitted) text into offsets in surface * - * scan text for "00n" and get + * scan text for "00n" and get * offset = layout_width(< text from start to tag >), * for every rss item found * then remove tags and fill an array of FeedLinkAndOffset's @@ -90,7 +90,7 @@ for (i = 0; i < NFEEDLINKANDOFFSETMAX; i++) /* we reset all offsets to 0 */ (link_and_offset + i)->offset_in_surface = 0; for (i = 0; txt_str[i] != '\0'; i++) { - if (txt_str[i] == LINKTAG_CHAR) { + if (txt_str[i] == LINK_TAG_CHAR) { str_n_cpy(tmp ,txt_str + i + 1, 3); j = atoi(tmp); txt_str[i] = '\0'; @@ -284,7 +284,7 @@ if ((size_t)j >= tmp2_size - strlen(prm->cutline_delimiter) - 1) { str_n_cpy(&tmp2[j], prm->cutline_delimiter, OPTION_VALUE_MAXLEN); j += strlen(prm->cutline_delimiter); - warning("stream_to_htext():", "Line is too long", "", "", FALSE); + warning(FALSE, 1, "stream_to_htext(): Line is too long"); *render_exit_status = RENDER_LINE_TOO_LONG; break; } diff -Nru tickr-0.5.5/src/tickr/tickr_resource.c tickr-0.6.0/src/tickr/tickr_resource.c --- tickr-0.5.5/src/tickr/tickr_resource.c 2011-12-16 02:12:09.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr_resource.c 2012-03-07 02:01:00.000000000 +0100 @@ -1,5 +1,5 @@ /* - * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2011 + * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2012 * * * This program is free software: you can redistribute it and/or modify @@ -22,79 +22,118 @@ #ifdef G_OS_WIN32 extern FILE *stdout_fp, *stderr_fp; #endif -static int counter = 0; -/* these funcs do nothing in single selection mode -> is that ok? */ +/* + * build selection f_list from full feed f_list + * + * always use get/set_feed_list() and get/set_feed_selection() to access + * FList *feed_list and FList *feed_selection defined in tickr_main.c + */ +int build_feed_selection_from_feed_list() +{ + FList *new_selection = NULL, *node = get_feed_list(); + + if (IS_FLIST(node)) { + for (node = f_list_first(node); IS_FLIST(node); node = node->next) + if (node->selected) + new_selection = f_list_add_at_end(new_selection, node->url, node->title, TRUE); + if (IS_FLIST(new_selection)) { + new_selection = f_list_first(new_selection); + set_feed_selection(new_selection); + return OK; + } else { + set_feed_selection(NULL); + return SELECTION_EMPTY; + } + } else { + set_feed_selection(NULL); + return SELECTION_ERROR; + } +} + +/* + * feed_index_in_selection starts at 0 + * (these funcs do nothing in single selection mode) + */ +/* always reload -> ok like that ? */ void current_feed() { + FList *selection = get_feed_selection(); + int f_index; + if (get_ticker_env()->selection_mode == MULTIPLE) { - if (counter > 0 ) - counter--; + if ((f_index = f_list_index(selection)) == 0) + set_feed_selection(f_list_last(selection)); + else if (f_index > 0) + set_feed_selection(f_list_nth(selection, f_index /* (rank = f_index + 1) - 1 */)); get_ticker_env()->reload_rq = TRUE; } } +/* always reload -> ok like that ? */ void first_feed() { if (get_ticker_env()->selection_mode == MULTIPLE) { - counter = 0; + set_feed_selection(f_list_first(get_feed_selection())); get_ticker_env()->reload_rq = TRUE; } } +/* always reload -> ok like that ? */ void last_feed() { if (get_ticker_env()->selection_mode == MULTIPLE) { - while (get_selected_url_list()[counter] != NULL) - counter++; - counter--; + set_feed_selection(f_list_last(get_feed_selection())); get_ticker_env()->reload_rq = TRUE; } } gboolean previous_feed() { + FList *selection = get_feed_selection(); + int f_index; + if (get_ticker_env()->selection_mode == MULTIPLE) { - if (counter >= 2 ) { - counter -= 2; + if ((f_index = f_list_index(selection)) > 1 || f_index == 0) { + if (f_index > 1) + set_feed_selection(f_list_nth(selection, f_index - 1)); + else if (f_index == 0) + set_feed_selection(f_list_nth(selection, f_list_count(selection) - 1)); get_ticker_env()->reload_rq = TRUE; return TRUE; - } else { - info_win_wait("This is already the first Feed", INFO_WIN_WAIT_TIMEOUT); - return FALSE; - } - } else - return FALSE; + } else if (f_index == 1) + info_win_wait("This is already the first feed", INFO_WIN_WAIT_TIMEOUT); + } + return FALSE; } gboolean next_feed() { + FList *selection = get_feed_selection(); + int f_index; + if (get_ticker_env()->selection_mode == MULTIPLE) { - if (get_selected_url_list()[counter] != NULL) { + if ((f_index = f_list_index(selection)) > 0) { get_ticker_env()->reload_rq = TRUE; return TRUE; - } else { - info_win_wait("This is already the last Feed", INFO_WIN_WAIT_TIMEOUT); - return FALSE; - } - } else - return FALSE; + } else + info_win_wait("This is already the last feed", INFO_WIN_WAIT_TIMEOUT); + } + return FALSE; } /* - * - single mode: (re)load text file if it exists or rss feed if valid - * - multiple mode: load sequentially all rss feeds in selected_url[] + * - single mode: (re)load resrc->id = text file if it exists or rss feed if valid + * - multiple mode: load sequentially all selected feeds in feed list * * in case of url: load_resource() -> get_feed() -> parse_rss20/rss10/atom_xml_file() */ -int load_resource(Resource *resrc, char **selected_urls) +int load_resource(Resource *resrc, FList *feed_selection) { #ifdef G_OS_WIN32 gchar *win32_filename; #endif int rss_status, exit_status; - char tmp[256]; - int i; if (resrc->fp != NULL) { fclose(resrc->fp); @@ -105,27 +144,22 @@ resrc->format = RSS_FORMAT_UNDETERMINED; if (get_ticker_env()->selection_mode == MULTIPLE) { - if (selected_urls[counter] != NULL) { - str_n_cpy(resrc->id, selected_urls[counter], FILE_NAME_MAXLEN); - counter++; + if (IS_FLIST(feed_selection)) { + str_n_cpy(resrc->id, feed_selection->url, FILE_NAME_MAXLEN); + if (IS_FLIST(feed_selection->next)) + feed_selection = feed_selection->next; + else if (IS_FLIST(f_list_first(feed_selection))) + feed_selection = f_list_first(feed_selection); + set_feed_selection(feed_selection); } else { - counter = 0; - /* we must re-init selected_urls before loading */ - selected_urls = init_selected_url_list(); - if ((i = load_selected_url_list((char **)selected_urls)) == SELECTION_ERROR) { - warning("No feed selection available", "-", - "Switching to single selection mode", "", TRUE); - get_ticker_env()->selection_mode = SINGLE; - resrc->id[0] = '\0'; - } else if (i == SELECTION_EMPTY) { - warning("No feed selected", "-", - "Switching to single selection mode", "", TRUE); - get_ticker_env()->selection_mode = SINGLE; - resrc->id[0] = '\0'; - } else { - str_n_cpy(resrc->id, selected_urls[counter], FILE_NAME_MAXLEN); - counter++; - } + warning(TRUE, 1, "No feed selected - ", + "Switching to single selection mode"); + get_ticker_env()->selection_mode = SINGLE; + resrc->id[0] = '\0'; + /*warning(TRUE, 1, "No feed selection available - " + "Switching to single selection mode"); + get_ticker_env()->selection_mode = SINGLE; + resrc->id[0] = '\0';*/ } } @@ -154,9 +188,8 @@ rss_status != FEED_DOWNLOAD_ERROR &&\ rss_status != FEED_FORMAT_ERROR &&\ rss_status != CONNECT_TOO_MANY_ERRORS) { - snprintf(tmp, 256, "get_feed() error %d", rss_status); - warning(tmp, "", "", "", - get_ticker_env()->selection_mode == MULTIPLE); + warning(get_ticker_env()->selection_mode == MULTIPLE, + 2, "get_feed() error ", itoa2(rss_status)); } resrc->id[0] ='\0'; if (rss_status == CONNECT_TOO_MANY_ERRORS) @@ -178,8 +211,7 @@ if (exit_status == OK) { if (format_resource(resrc) == RESOURCE_FORMAT_ERROR) { - big_error(RESOURCE_FORMAT_ERROR, - "format_resource() error", "", "", ""); + big_error(RESOURCE_FORMAT_ERROR, 1, "format_resource() error"); exit_status = RESOURCE_FORMAT_ERROR; } } @@ -249,7 +281,7 @@ fseek(resrc->fp, 0, SEEK_SET); /* check for lines longer than LINE_MAXLEN and insert newline's if any */ - tmp_fp = open_new_datafile_with_name(XMLDUMP, "wb+"); + tmp_fp = open_new_datafile_with_name(XML_DUMP, "wb+"); str1 = malloc2(str1_size * sizeof(char)); str2 = l_str_new(NULL); #ifndef G_OS_WIN32 @@ -287,9 +319,9 @@ /* * *** file names, paths and dirs stuff *** */ -void set_news_icon_to_dialog(GtkWindow *dialog) +void set_tickr_icon_to_dialog(GtkWindow *dialog) { - gtk_window_set_icon_from_file(dialog, get_imagefile_full_name_from_name(NEWS_ICON), NULL); + gtk_window_set_icon_from_file(dialog, get_imagefile_full_name_from_name(TICKR_ICON), NULL); } /* open/create file in data dir from name @@ -312,9 +344,9 @@ #endif if ((fp = g_fopen(file_name, mode_str)) == NULL) { if (mode_str[0] == 'w') - big_error(CREATE_FILE_ERROR, "Error creating file:", file_name, " - ", strerror(errno)); + big_error(CREATE_FILE_ERROR, 4, "Error creating file ", file_name, ": ", strerror(errno)); else if (mode_str[0] == 'r') - big_error(OPEN_FILE_ERROR, "Error opening file:", file_name, " - ", strerror(errno)); + big_error(OPEN_FILE_ERROR, 4, "Error opening file ", file_name, ": ", strerror(errno)); } return fp; } @@ -322,7 +354,7 @@ /* get full path and name for file in data dir from name * data dir = config files, not images files */ -const char *get_datafile_full_name_from_name(const char *name) +char *get_datafile_full_name_from_name(const char *name) { static char file_name[FILE_NAME_MAXLEN + 1]; #ifdef G_OS_WIN32 @@ -338,11 +370,11 @@ g_free(win32_filename); } #endif - return (const char *)file_name; + return file_name; } /* now, image files */ -const char *get_imagefile_full_name_from_name(const char *name) +char *get_imagefile_full_name_from_name(const char *name) { static char file_name[FILE_NAME_MAXLEN + 1]; #ifdef G_OS_WIN32 @@ -359,29 +391,29 @@ g_free(win32_filename); } #endif - return (const char *)file_name; + return file_name; } /* data dir = config files, not images files */ -const char *get_datadir_full_path() +char *get_datadir_full_path() { static char full_path[TMPSTR_SIZE + 1]; #ifndef G_OS_WIN32 - snprintf(full_path, TMPSTR_SIZE + 1, "%s%c%s", usr_home_dir(), SEPARATOR_CHAR, NEWS_DIR_NAME); + snprintf(full_path, TMPSTR_SIZE + 1, "%s%c%s", usr_home_dir(), SEPARATOR_CHAR, TICKR_DIR_NAME); #else - snprintf(full_path, TMPSTR_SIZE + 1, "%s%c%s", get_appdata_dir(), SEPARATOR_CHAR, NEWS_DIR_NAME); + snprintf(full_path, TMPSTR_SIZE + 1, "%s%c%s", get_appdata_dir(), SEPARATOR_CHAR, TICKR_DIR_NAME); #endif - return (const char *)full_path; + return full_path; } -const char *usr_home_dir() +char *usr_home_dir() { static char str[TMPSTR_SIZE+ 1] = ""; #ifndef G_OS_WIN32 - return (const char *)str_n_cpy(str, getpwuid(getuid())->pw_dir, TMPSTR_SIZE); + return str_n_cpy(str, getpwuid(getuid())->pw_dir, TMPSTR_SIZE); #endif /* for win32 version, no home dir - see win32 specific funcs in libetm */ - return (const char *)str; + return str; } diff -Nru tickr-0.5.5/src/tickr/tickr_rss.c tickr-0.6.0/src/tickr/tickr_rss.c --- tickr-0.5.5/src/tickr/tickr_rss.c 2011-12-14 00:10:56.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr_rss.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,404 +0,0 @@ -/* - * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2011 - * - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "tickr.h" - -#ifdef G_OS_WIN32 -extern FILE *stdout_fp, *stderr_fp; -#endif - -static int depth; -static xmlNode *item_element, *entry_element; -static int n; -static int counter; - -/* - * here, 'rss' is sometimes used as a synonym of 'feed' and sometimes - * used by opposition to 'atom' (this can be confusing) - */ - -/* - * look for url and, if valid, parse it then dump result into - * '/'NEWS_DIR_NAME/XMLDUMP' - * if url not valid, only set error code and return - */ -int get_feed(Resource *resrc, const Params *prm) -{ - char feed_title[FEED_TITLE_MAXLEN + 1]; - char feed_link[FILE_NAME_MAXLEN + 1]; - char feed_ttl[32]; - char file_name[FILE_NAME_MAXLEN + 1]; - char url[FILE_NAME_MAXLEN + 1]; - int exit_status, i; - - get_ticker_env()->suspend_rq = TRUE; - - resrc->rss_ttl = prm->rss_refresh; - str_n_cpy(resrc->xml_dump, get_datafile_full_name_from_name(XMLDUMP), FILE_NAME_MAXLEN); - if (resrc->fp != NULL) - fclose(resrc->fp); - resrc->fp = open_new_datafile_with_name(XMLDUMP, "wb"); - str_n_cpy(file_name, get_datafile_full_name_from_name(RESOURCEDUMP), FILE_NAME_MAXLEN); - - /* we replace resrc->id with modified url, file_name = downloaded resource */ - if ((exit_status = fetch_resource((const char *)resrc->id, (const char *)file_name, url)) == OK) -#ifdef VERBOSE_OUTPUT - fprintf(STD_OUT, "Resource fetched: %s\n", (const char *)resrc->id); -#endif - else if (exit_status == FEED_FORMAT_ERROR) { - warning("Feed format error (RSS2.0/Atom) in:", (const char *)resrc->id, "", "", - get_ticker_env()->selection_mode == MULTIPLE); - return FEED_FORMAT_ERROR; - } else if (exit_status == CONNECT_TOO_MANY_ERRORS) { - return CONNECT_TOO_MANY_ERRORS; - } else { - warning("Can't fetch resource:", (const char *)resrc->id, "", "", - get_ticker_env()->selection_mode == MULTIPLE); - return FEED_DOWNLOAD_ERROR; - } - for (i = 0; i < NFEEDLINKANDOFFSETMAX; i++) { - resrc->link_and_offset[i].offset_in_surface = 0; - (resrc->link_and_offset[i].url)[0] = '\0'; - } - resrc->format = RSS_2_0; - /* we use file_name instead of resrc->id */ - if ((exit_status = parse_rss20_xml_file(resrc->fp, file_name, - resrc->link_and_offset, prm)) == RSS_NO_ITEM_ELEMENT) { - resrc->format = RSS_ATOM; - for (i = 0; i < NFEEDLINKANDOFFSETMAX; i++) { - resrc->link_and_offset[i].offset_in_surface = 0; - (resrc->link_and_offset[i].url)[0] = '\0'; - } - /* we use file_name instead of resrc->id */ - if ((exit_status = parse_atom_xml_file(resrc->fp, file_name, - resrc->link_and_offset, prm)) == ATOM_NO_ENTRY_ELEMENT) - warning("No 'Item' or 'Entry' element found in:", resrc->id, - "\nIs feed format RSS 2.0 or Atom?", - "\n(RSS 1.0 format is not currently supported)", - get_ticker_env()->selection_mode == MULTIPLE); - } - if (exit_status != OK) { - resrc->format = RSS_FORMAT_UNDETERMINED; - return exit_status; - } - fclose(resrc->fp); - resrc->fp = open_new_datafile_with_name(XMLDUMP, "rb"); - - /* we use file_name instead of resrc->id */ - get_feed_info(file_name, feed_title, feed_link, feed_ttl); - str_n_cpy(resrc->feed_title, feed_title, FEED_TITLE_MAXLEN); - if (feed_ttl[0] != '\0') - resrc->rss_ttl = atoi(feed_ttl); - - get_ticker_env()->suspend_rq = FALSE; - return OK; -} - -/* - * must be utf-8 encoded - */ -int parse_rss20_xml_file(FILE *fp, const char* file_name, FeedLinkAndOffset *link_and_offset, const Params *prm) -{ - xmlDoc *doc; - xmlNode *root_element; - -#ifdef VERBOSE_OUTPUT - fprintf(STD_OUT, "Parsing XML file ... "); -#endif - if ((doc = xmlParseFile(file_name)) == NULL) { - warning("XML parser error:", xmlGetLastError()->message, "", "", - get_ticker_env()->selection_mode == MULTIPLE); - return FEED_UNPARSABLE; - } - if ((root_element = xmlDocGetRootElement(doc)) == NULL) { - xmlFreeDoc(doc); - warning("Empty XML document:", file_name, "", "", - get_ticker_env()->selection_mode == MULTIPLE); - return FEED_EMPTY; - } - - depth = 0; - item_element = NULL; - n = 1; - counter = 0; - - get_rss20_selected_elements1(root_element, doc); - if (item_element != NULL) - get_rss20_selected_elements2(item_element, doc, fp, link_and_offset, prm); - else { - xmlFreeDoc(doc); - return RSS_NO_ITEM_ELEMENT; - } - xmlFreeDoc(doc); -#ifdef VERBOSE_OUTPUT - fprintf(STD_OUT, "Done\n"); -#endif - return OK; -} - -/* - * must be utf-8 encoded - */ -int parse_atom_xml_file(FILE *fp, const char* file_name, FeedLinkAndOffset *link_and_offset, const Params *prm) -{ - xmlDoc *doc; - xmlNode *root_element; - -#ifdef VERBOSE_OUTPUT - fprintf(STD_OUT, "Parsing XML file ... "); -#endif - if ((doc = xmlParseFile(file_name)) == NULL) { - warning("XML parser error:", xmlGetLastError()->message, "", "", - get_ticker_env()->selection_mode == MULTIPLE); - return FEED_UNPARSABLE; - } - if ((root_element = xmlDocGetRootElement(doc)) == NULL) { - xmlFreeDoc(doc); - warning("Empty XML document:", file_name, "", "", - get_ticker_env()->selection_mode == MULTIPLE); - return FEED_EMPTY; - } - - depth = 0; - entry_element = NULL; - n = 1; - counter = 0; - - get_atom_selected_elements1(root_element, doc); - if (entry_element != NULL) - get_atom_selected_elements2(entry_element, doc, fp, link_and_offset, prm); - else { - xmlFreeDoc(doc); - return ATOM_NO_ENTRY_ELEMENT; - } - xmlFreeDoc(doc); -#ifdef VERBOSE_OUTPUT - fprintf(STD_OUT, "Done\n"); -#endif - return OK; -} - -/* - * for every link found, we insert in text LINKTAG_CHAR"00n" - * with n = link rank and we fill link_and_offset with url - * this is used later in render_stream_to_surface() - */ -void get_rss20_selected_elements1(xmlNode *some_element, xmlDoc *doc) -{ - xmlNode *cur_node; - - for (cur_node = some_element; cur_node != NULL; cur_node = cur_node->next) { - if (item_element != NULL) - return; - - if (xmlStrcmp(cur_node->name, (const xmlChar *)"rss") == 0 && depth == 0) - depth = 1; - else if (xmlStrcmp(cur_node->name, (const xmlChar *)"channel") == 0 && depth == 1) - depth = 2; - else if (xmlStrcmp(cur_node->name, (const xmlChar *)"item") == 0 && depth == 2) - depth = 3; - - if (depth == 3) - item_element = cur_node; - else - get_rss20_selected_elements1(cur_node->children, doc); - } -} - -void get_rss20_selected_elements2(xmlNode *some_element, xmlDoc *doc, - FILE *fp, FeedLinkAndOffset *link_and_offset, const Params *prm) -{ - xmlNode *cur_node, *cur_node_bak; - xmlChar *str; - - for (cur_node = some_element; cur_node != NULL; cur_node = cur_node->next) { - if (xmlStrcmp(cur_node->name, (const xmlChar *)"item") == 0) { - cur_node_bak = cur_node; - cur_node = cur_node->children; - for (; cur_node != NULL; cur_node = cur_node->next) { - if (prm->rss_title == 'y' && xmlStrcmp(cur_node->name, (const xmlChar *)"title") == 0) { - if ((str = xmlNodeListGetString(doc, cur_node->children, 1)) != NULL) { - /* we remove any LINKTAG_CHAR from str because it will be used in "link tag" */ - remove_char_from_str((char *)str, LINKTAG_CHAR); - fprintf(fp, "%s%s\n", str, prm->rss_title_delimiter); - xmlFree(str); - } - } else if (prm->rss_description == 'y' && xmlStrcmp(cur_node->name, (const xmlChar *)"description") == 0) { - if ((str = xmlNodeListGetString(doc, cur_node->children, 1)) != NULL) { - /* we remove any LINKTAG_CHAR from str because it will be used in "link tag" */ - remove_char_from_str((char *)str, LINKTAG_CHAR); - fprintf(fp, "%s%s\n", str, prm->rss_description_delimiter); - xmlFree(str); - } - } - } - cur_node = cur_node_bak; - cur_node = cur_node->children; - for (; cur_node != NULL; cur_node = cur_node->next) { - if (xmlStrcmp(cur_node->name, (const xmlChar *)"link") == 0) { - if ((str = xmlNodeListGetString(doc, cur_node->children, 1)) != NULL) { - if (n < NFEEDLINKANDOFFSETMAX + 1) { - str_n_cpy((link_and_offset + n)->url, (const char *)str, - FILE_NAME_MAXLEN); - fprintf(fp, "%c%03d\n", LINKTAG_CHAR, n++); - } - xmlFree(str); - } - } - } - cur_node = cur_node_bak; - if (prm->n_items_per_feed != 0) - if (++counter >= prm->n_items_per_feed) - break; - } - } -} - -/* - * for every link found, we insert in text LINKTAG_CHAR"00n" - * with n = link rank and we fill link_and_offset with url - * this is used later in render_stream_to_surface() - */ -void get_atom_selected_elements1(xmlNode *some_element, xmlDoc *doc) -{ - xmlNode *cur_node; - - for (cur_node = some_element; cur_node != NULL; cur_node = cur_node->next) { - if (entry_element != NULL) - return; - - if (xmlStrcmp(cur_node->name, (const xmlChar *)"feed") == 0)/* &&\ - xmlStrcmp(xmlGetProp(cur_node, (const xmlChar *)"xmlns"),\ - (const xmlChar *)"http://www.w3.org/2005/Atom") == 0 && depth == 0)*/ - depth = 1; - else if (xmlStrcmp(cur_node->name, (const xmlChar *)"entry") == 0 && depth == 1) - depth = 2; - - if (depth == 2) - entry_element = cur_node; - else - get_atom_selected_elements1(cur_node->children, doc); - } -} - -void get_atom_selected_elements2(xmlNode *some_element, xmlDoc *doc, - FILE *fp, FeedLinkAndOffset *link_and_offset, const Params *prm) -{ - xmlNode *cur_node, *cur_node_bak; - xmlChar *str; - - for (cur_node = some_element; cur_node != NULL; cur_node = cur_node->next) { - if (xmlStrcmp(cur_node->name, (const xmlChar *)"entry") == 0) { - cur_node_bak = cur_node; - cur_node = cur_node->children; - for (; cur_node != NULL; cur_node = cur_node->next) { - if (prm->rss_title == 'y' && xmlStrcmp(cur_node->name, (const xmlChar *)"title") == 0) { - if ((str = xmlNodeListGetString(doc, cur_node->children, 1)) != NULL) { - /* we remove any LINKTAG_CHAR from str because it will be used in "link tag" */ - remove_char_from_str((char *)str, LINKTAG_CHAR); - fprintf(fp, "%s%s\n", str, prm->rss_title_delimiter); - xmlFree(str); - } - } else if (prm->rss_description == 'y' && xmlStrcmp(cur_node->name, (const xmlChar *)"summary") == 0) { - if ((str = xmlNodeListGetString(doc, cur_node->children, 1)) != NULL) { - /* we remove any LINKTAG_CHAR from str because it will be used in "link tag" */ - remove_char_from_str((char *)str, LINKTAG_CHAR); - fprintf(fp, "%s%s\n", str, prm->rss_description_delimiter); - xmlFree(str); - } - } - } - cur_node = cur_node_bak; - cur_node = cur_node->children; - for (; cur_node != NULL; cur_node = cur_node->next) { - if (xmlStrcmp(cur_node->name, (const xmlChar *)"link") == 0) { - /* node attribute instead of node content (atom/rss) */ - if ((str = xmlGetProp(cur_node, (const xmlChar *)"href")) != NULL) { - /*if ((str = xmlNodeListGetString(doc, cur_node->children, 1)) != NULL) {*/ - if (n < NFEEDLINKANDOFFSETMAX + 1) { - str_n_cpy((link_and_offset + n)->url, (const char *)str,\ - FILE_NAME_MAXLEN); - fprintf(fp, "%c%03d\n", LINKTAG_CHAR, n++); - } - xmlFree(str); - } - } - } - cur_node = cur_node_bak; - if (prm->n_items_per_feed != 0) - if (++counter >= prm->n_items_per_feed) - break; - } - } -} - -/* - * info is 4 strings 255 chars long each - * feed_* can be NULL - */ -int get_feed_info(const char *file_name, char *feed_title, char *feed_link, char *feed_ttl) -{ - xmlDoc *doc; - xmlNode *root_element; - - if (feed_title != NULL) - feed_title[0] = '\0'; - if (feed_link != NULL) - feed_link[0] = '\0'; - if (feed_ttl != NULL) - feed_ttl[0] = '\0'; - - if ((doc = xmlParseFile(file_name)) == NULL) { - return FEED_UNPARSABLE; - } else { - if ((root_element = xmlDocGetRootElement(doc)) == NULL) { - xmlFreeDoc(doc); - return FEED_EMPTY; - } else { - if (feed_title != NULL) - get_xml_first_element(root_element->children, doc, - "title", feed_title, FEED_TITLE_MAXLEN); - if (feed_link != NULL) - get_xml_first_element(root_element->children, doc, - "link", feed_link, FILE_NAME_MAXLEN); - if (feed_ttl != NULL) - get_xml_first_element(root_element->children, doc, - "ttl", feed_ttl, 31); - xmlFreeDoc(doc); - return OK; - } - } -} - -void get_xml_first_element(xmlNode *some_element, xmlDoc *doc, char *name, char *string, int length) -{ - xmlNode *cur_node; - xmlChar *str; - - for (cur_node = some_element; cur_node != NULL; cur_node = cur_node->next) { - if (xmlStrcmp(cur_node->name, (const xmlChar *)name) == 0) { - if ((str = xmlNodeListGetString(doc, cur_node->children, 1)) != NULL) { - str_n_cpy(string, (const char *)str, length); - xmlFree(str); - } else - string[0] = '\0'; - break; - } - get_xml_first_element(cur_node->children, doc, name, string, length); - } -} diff -Nru tickr-0.5.5/src/tickr/tickr_rsswin.c tickr-0.6.0/src/tickr/tickr_rsswin.c --- tickr-0.5.5/src/tickr/tickr_rsswin.c 2011-12-17 05:19:57.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr_rsswin.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,475 +0,0 @@ -/* - * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2011 - * - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "tickr.h" - -#if USE_GUI -#define URL_ENTRY_LENGTH 100 - -/* predefined GTK_RESPONSE_ are < 0, those ones are app level defined and >= 0 -*/ -enum { - GTK_RESPONSE_SELECT_ALL, GTK_RESPONSE_UNSELECT_ALL, GTK_RESPONSE_REMOVE, - GTK_RESPONSE_ADD, GTK_RESPONSE_HOME, GTK_RESPONSE_SINGLE, GTK_RESPONSE_SELECTION -}; - -enum {COLUMN_INT, COLUMN_BOOLEAN_CHECKED, COLUMN_STRING_TITLE, COLUMN_STRING_URL, N_COLUMNS}; - -static GtkWidget *dialog, *entry_url; -static TickerEnv *env; -static char **p_url; -static int rank; -static gchar home_feed[FILE_NAME_MAXLEN + 1]; - -static gint esc_key_pressed(GtkWidget *dialog2, GdkEventKey *event, gpointer unused) -{ - unused = unused; - if (event->keyval == GDK_Escape) { - gtk_dialog_response(GTK_DIALOG(dialog2), GTK_RESPONSE_CLOSE); - return TRUE; - } else - return FALSE; -} - -static void force_quit_dialog(GtkWidget *dialog2) -{ - gtk_dialog_response(GTK_DIALOG(dialog2), GTK_RESPONSE_CLOSE); -} - -/* tree selection callback - copy selected url to entry_url (override) */ -static gint tree_selection_changed(GtkTreeSelection *selection, GdkEventAny *event, gpointer unused) -{ - GtkTreeModel *tree_model = NULL; - GtkTreeIter iter; - gchar *str_url; - - event = event; - unused = unused; - if (gtk_tree_selection_get_selected(selection, &tree_model, &iter)) { - gtk_tree_model_get(tree_model, &iter, - COLUMN_INT, &rank, - COLUMN_STRING_URL, &str_url, - -1); - gtk_entry_set_text(GTK_ENTRY(entry_url), str_url); - g_free(str_url); - } - gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_NONE); - return TRUE; -} - -/* catch double-click on tree view */ -static gint double_click_on_tree_view(GtkTreeView *tree_view, GtkTreePath *tree_path, gpointer unused) -{ - GtkTreeModel *tree_model = NULL; - GtkTreeIter iter; - gchar *str_url; - - unused = unused; - tree_model = gtk_tree_view_get_model(tree_view); - if (gtk_tree_model_get_iter(tree_model, &iter, tree_path)) { - gtk_tree_model_get(tree_model, &iter, - COLUMN_INT, &rank, - COLUMN_STRING_URL, &str_url, - -1); - gtk_entry_set_text(GTK_ENTRY(entry_url), str_url); - g_free(str_url); - } - gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_SINGLE); - return TRUE; -} - -static gint enter_key_pressed_in_entry(GtkWidget *widget, GdkEvent *event, gpointer unused) -{ - widget = widget; - event = event; - unused = unused; - gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_SINGLE); - return TRUE; -} - -static gint checkbox_toggled(GtkCellRendererToggle *renderer, gchar *path_str, gpointer tree_view) -{ - GtkTreeModel *tree_model; - GtkTreeIter iter; - gboolean checked; - - renderer = renderer; - tree_model = gtk_tree_view_get_model(GTK_TREE_VIEW(tree_view)); - if (gtk_tree_model_get_iter_from_string(tree_model, &iter, path_str)) { - gtk_tree_model_get(tree_model, &iter, - COLUMN_INT, &rank, - COLUMN_BOOLEAN_CHECKED, &checked, - -1); - checked = !checked; - gtk_list_store_set(GTK_LIST_STORE(tree_model), &iter, - COLUMN_BOOLEAN_CHECKED, checked, - -1); - } - if (checked) - p_url[rank][0] = SELECTED_URL_CHAR; - else - p_url[rank][0] = UNSELECTED_URL_CHAR; - gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_NONE); - return TRUE; -} - -static void select_all(GtkTreeView *tree_view) -{ - GtkTreeModel *tree_model; - GtkTreeIter iter; - int i = 0; - - tree_model = gtk_tree_view_get_model(tree_view); - if (gtk_tree_model_get_iter_first(tree_model, &iter)) { - do - gtk_list_store_set(GTK_LIST_STORE(tree_model), &iter, - COLUMN_BOOLEAN_CHECKED, TRUE, - -1); - while (gtk_tree_model_iter_next(tree_model, &iter)); - while (p_url[i] != NULL) - p_url[i++][0] = SELECTED_URL_CHAR; - } -} - -static void unselect_all(GtkTreeView *tree_view) -{ - GtkTreeModel *tree_model; - GtkTreeIter iter; - int i = 0; - - tree_model = gtk_tree_view_get_model(tree_view); - if (gtk_tree_model_get_iter_first(tree_model, &iter)) { - do - gtk_list_store_set(GTK_LIST_STORE(tree_model), &iter, - COLUMN_BOOLEAN_CHECKED, FALSE, - -1); - while (gtk_tree_model_iter_next(tree_model, &iter)); - while (p_url[i] != NULL) - p_url[i++][0] = UNSELECTED_URL_CHAR; - } -} - -static void highlight_row(GtkTreeView *tree_view, GtkTreeSelection *selection, int row) -{ - GtkTreeModel *tree_model; - GtkTreePath *tree_path; - GtkTreeIter iter; - int i = 0; - - tree_model = gtk_tree_view_get_model(tree_view); - tree_path = gtk_tree_path_new_first(); - if (gtk_tree_model_get_iter_first(tree_model, &iter)) { - while (gtk_tree_model_iter_next(tree_model, &iter) && i++ < row) - gtk_tree_path_next(tree_path); - gtk_tree_view_scroll_to_cell(tree_view, tree_path, NULL, FALSE, 0.5, 0); - gtk_tree_selection_select_path(selection, tree_path); - } -} - -/* clear the list before filling it */ -static void fill_list_store_from_array(GtkListStore *list_store, char **url) -{ - GtkTreeIter iter; - gboolean rss_feed_checked; - char rss_feed_url[FILE_NAME_MAXLEN + 1]; - char rss_feed_title[FEED_TITLE_MAXLEN + 1]; - int i, j; - - gtk_list_store_clear(list_store); - for (i = 0; i < NURLMAX && url[i] != NULL; i++) { - gtk_list_store_append(list_store, &iter); - /* store feed checked status, url and title (if any) in list_store */ - if (url[i][0] == SELECTED_URL_CHAR) - rss_feed_checked = TRUE; - else - rss_feed_checked = FALSE; - str_n_cpy(rss_feed_url, url[i] + 1, FILE_NAME_MAXLEN); - for (j = 0; j < FILE_NAME_MAXLEN; j++) { - if (rss_feed_url[j] == '\0' || rss_feed_url[j] == '\n') { - rss_feed_title[0] = '\0'; - break; - } else if (rss_feed_url[j] == TITLE_TAG_CHAR) { - str_n_cpy(rss_feed_title, rss_feed_url + j + 1, - FEED_TITLE_MAXLEN); - rss_feed_url[j] = '\0'; - break; - } - } - gtk_list_store_set(list_store, &iter, - COLUMN_INT, i, - COLUMN_BOOLEAN_CHECKED, rss_feed_checked, - COLUMN_STRING_TITLE, rss_feed_title, - COLUMN_STRING_URL, rss_feed_url, - -1); - } -} - -static void remove_feed_from_array_and_list_store(GtkListStore *list_store, GtkTreeIter *iter) -{ - remove_url_from_list(p_url, rank); - sort_url_list(p_url, 1); - gtk_list_store_remove(list_store, iter); - rank = -1; -} - -static int add_feed_to_array_and_list_store(Resource *resrc, GtkListStore *list_store) -{ - int rss_status; - char rss_feed_title[FEED_TITLE_MAXLEN + 1]; - char rss_feed_link[FILE_NAME_MAXLEN + 1]; - char rss_feed_ttl[32]; - char tmp[TMPSTR_SIZE + 1]; - int i; - - str_n_cpy(resrc->id, (char *)gtk_entry_get_text(GTK_ENTRY(entry_url)), FILE_NAME_MAXLEN); - if ((rss_status = get_feed(resrc, get_params())) == OK) { - /* locate last array entry */ - for (i = 0; i < NURLMAX && p_url[i] != NULL; i++); - /* we need to re-init p_url because list is NULL terminated */ - p_url = init_url_list(); - if (i < NURLMAX) { - if (get_feed_info(resrc->id, rss_feed_title, rss_feed_link, rss_feed_ttl) == OK) - /* is it ok to 'select' all new urls? */ - snprintf(p_url[i], FILE_NAME_MAXLEN + 1, "%c%s%c%s", - SELECTED_URL_CHAR, resrc->id, TITLE_TAG_CHAR, rss_feed_title); - else - snprintf(p_url[i], FILE_NAME_MAXLEN + 1, "%c%s", - SELECTED_URL_CHAR, resrc->id); - p_url[i + 1] = NULL; - sort_url_list(p_url, 1); - fill_list_store_from_array(list_store, p_url); - } else { - snprintf(tmp, TMPSTR_SIZE + 1, "You can't save more than %d URLs.\n" - "(You may set NURLMAX to a higher value in tickr.h and recompile.)", - NURLMAX); - warning(tmp, "", "", "", FALSE); - } - } - return rss_status; -} - -/* - * open a dialog with a list of urls to choose from and an entry_url - * (with feed titles) - * - * entry format in url list file: - * ["*" (selected) or "-" (unselected) + url [+ ">" + title] + '\n'] - * - * entry max length = FILE_NAME_MAXLEN - * see also: (UN)SELECTED_URL_CHAR in tickr.h - */ -void get_new_url(Resource *resrc) -{ - GtkWidget *vbox, *hbox, *label[2], *sc_win; - GtkWidget *cancel_but, *remove_but, *add_but, *home_but; - GtkWidget *single_but, *selection_but; - GtkWidget *selectall_but, *unselectall_but; - GtkTreeView *tree_view = NULL; - GtkListStore *list_store = NULL; - GtkTreeModel *tree_model = NULL; - GtkTreeIter iter; - GtkCellRenderer *renderer1 = NULL, *renderer2 = NULL, *renderer3 = NULL; - GtkTreeViewColumn *column1 = NULL, *column2 = NULL, *column3 = NULL; - GtkTreeSelection *selection = NULL; - GtkRequisition req; - gint list_height; - gint response; - Resource resrc_bak; - int i; - - env = get_ticker_env(); - env->suspend_rq = TRUE; - gtk_window_set_keep_above(GTK_WINDOW(env->win), FALSE); - - dialog = gtk_dialog_new_with_buttons( - "Feed Picker (RSS/Atom)", GTK_WINDOW(env->win), - GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, - NULL); - - cancel_but = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); - selectall_but = gtk_dialog_add_button(GTK_DIALOG(dialog), "Select All", GTK_RESPONSE_SELECT_ALL); - unselectall_but = gtk_dialog_add_button(GTK_DIALOG(dialog), "Unselect All", GTK_RESPONSE_UNSELECT_ALL); - home_but = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_HOME, GTK_RESPONSE_HOME); - remove_but = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_REMOVE, GTK_RESPONSE_REMOVE); - add_but = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_ADD, GTK_RESPONSE_ADD); - single_but = gtk_dialog_add_button(GTK_DIALOG(dialog), "OK (Single)", GTK_RESPONSE_SINGLE); - selection_but = gtk_dialog_add_button(GTK_DIALOG(dialog), "OK (Selec)", GTK_RESPONSE_SELECTION); - - set_news_icon_to_dialog(GTK_WINDOW(dialog)); - gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); - - vbox = gtk_vbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), vbox, FALSE, TRUE, 0); - gtk_container_set_border_width(GTK_CONTAINER(GTK_BOX(vbox)), 15); - - str_n_cpy(home_feed, get_params()->homefeed, FILE_NAME_MAXLEN); - p_url = init_url_list(); - list_store = gtk_list_store_new(N_COLUMNS, G_TYPE_INT, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING); - - /* init pointers then load url list from file into array */ - if (load_url_list(p_url) == OK) { - sort_url_list(p_url, 1); - fill_list_store_from_array(list_store, p_url); - - tree_view = GTK_TREE_VIEW(gtk_tree_view_new_with_model(GTK_TREE_MODEL(list_store))); - - renderer1 = gtk_cell_renderer_toggle_new(); - gtk_cell_renderer_toggle_set_radio(GTK_CELL_RENDERER_TOGGLE(renderer1), FALSE); - column1 = gtk_tree_view_column_new_with_attributes(NULL, renderer1, - "active", COLUMN_BOOLEAN_CHECKED, NULL); - gtk_tree_view_append_column(tree_view, column1); - - renderer2 = gtk_cell_renderer_text_new(); - column2 = gtk_tree_view_column_new_with_attributes("Feed Title", renderer2, - "text", COLUMN_STRING_TITLE, NULL); - gtk_tree_view_append_column(tree_view, column2); - - renderer3 = gtk_cell_renderer_text_new(); - column3 = gtk_tree_view_column_new_with_attributes("Feed URL", renderer3, - "text", COLUMN_STRING_URL, NULL); - gtk_tree_view_append_column(tree_view, column3); - - sc_win = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sc_win), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_container_add(GTK_CONTAINER(vbox), sc_win); - gtk_container_add(GTK_CONTAINER(sc_win), GTK_WIDGET(tree_view)); - label[0] = gtk_label_new(""); - gtk_container_add(GTK_CONTAINER(vbox), label[0]); - - selection = gtk_tree_view_get_selection(tree_view); - gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE); - gtk_widget_size_request(GTK_WIDGET(tree_view), &req); - list_height = (req.height > 380) ? 380 : req.height; - gtk_widget_set_size_request(sc_win, -1, list_height); - - g_signal_connect(G_OBJECT(selection), "changed", G_CALLBACK(tree_selection_changed), NULL); - g_signal_connect(G_OBJECT(tree_view), "row_activated", G_CALLBACK(double_click_on_tree_view), NULL); - g_signal_connect(G_OBJECT(renderer1), "toggled", G_CALLBACK(checkbox_toggled), tree_view); - } else - p_url[0] = NULL; - - hbox = gtk_hbox_new(FALSE, 0); - label[1] = gtk_label_new("Enter new URL: "); - gtk_box_pack_start(GTK_BOX(hbox), label[1], FALSE, FALSE, 0); - entry_url = gtk_entry_new(); - gtk_entry_set_max_length(GTK_ENTRY(entry_url), FILE_NAME_MAXLEN); - gtk_entry_set_width_chars(GTK_ENTRY(entry_url), URL_ENTRY_LENGTH); - gtk_box_pack_start(GTK_BOX(hbox), entry_url, FALSE, FALSE, 0); - gtk_container_add(GTK_CONTAINER(vbox), hbox); - - g_signal_connect(G_OBJECT(entry_url), "activate", G_CALLBACK(enter_key_pressed_in_entry), NULL); - g_signal_connect(G_OBJECT(dialog), "key-press-event", G_CALLBACK(esc_key_pressed), NULL); - g_signal_connect(G_OBJECT(dialog), "delete_event", G_CALLBACK(force_quit_dialog), NULL); - - gtk_widget_show_all(dialog); - gtk_widget_grab_focus(GTK_WIDGET(tree_view)); - - /* backup last valid opened resource (if any) */ - str_n_cpy(resrc_bak.id, resrc->id, FILE_NAME_MAXLEN); - gtk_entry_set_text(GTK_ENTRY(entry_url), ""); - rank = -1; - - while ((response = gtk_dialog_run(GTK_DIALOG(dialog))) != GTK_RESPONSE_CLOSE) { - if (response == GTK_RESPONSE_SELECT_ALL) { - if (question_win("Select all URLs ?") == YES) { - select_all(tree_view); - } - } else if (response == GTK_RESPONSE_UNSELECT_ALL) { - if (question_win("Unselect all URLs ?") == YES) { - unselect_all(tree_view); - } - } else if (response == GTK_RESPONSE_HOME) - gtk_entry_set_text(GTK_ENTRY(entry_url), (const gchar *)home_feed); - else if (response == GTK_RESPONSE_REMOVE) { - if (rank > -1) { - if (gtk_tree_selection_get_selected(selection, &tree_model, &iter) && - question_win("Remove selected URL from list ?") == YES) { - remove_feed_from_array_and_list_store(list_store, &iter); - save_url_list(p_url); - gtk_entry_set_text(GTK_ENTRY(entry_url), ""); - } - } else - warning("You must select an URL first", - "", "", "", FALSE); - } else if (response == GTK_RESPONSE_ADD) { - if (gtk_entry_get_text(GTK_ENTRY(entry_url))[0] != '\0') { - if (add_feed_to_array_and_list_store(resrc, list_store) == OK) { - save_url_list(p_url); - /* highlight newly added */ - if ((rank = search_in_url_list(p_url, - gtk_entry_get_text(GTK_ENTRY(entry_url)))) > -1) - highlight_row(tree_view, selection, rank); - else - gtk_entry_set_text(GTK_ENTRY(entry_url), ""); - } else { - /* restore last valid opened resource (if any) */ - str_n_cpy(resrc->id, resrc_bak.id, FILE_NAME_MAXLEN); - /* re-init pointers then re-load url list from file into array */ - if (load_url_list(p_url) == OK) { - sort_url_list(p_url, 1); - /* also re-fill list_store */ - fill_list_store_from_array(list_store, p_url); - } else - p_url[0] = NULL; - } - } else - warning("You must enter an URL first", - "", "", "", FALSE); - } else if (response == GTK_RESPONSE_SINGLE) { - env->selection_mode = SINGLE; - if (gtk_entry_get_text(GTK_ENTRY(entry_url))[0] != '\0' || rank > -1) { - if (add_feed_to_array_and_list_store(resrc, list_store) == OK) { - save_url_list(p_url); - env->reload_rq = TRUE; - break; - } else { - /* restore last valid opened resource (if any) */ - str_n_cpy(resrc->id, resrc_bak.id, FILE_NAME_MAXLEN); - /* re-init pointers then re-load url list from file into array */ - if (load_url_list(p_url) == OK) { - sort_url_list(p_url, 1); - current_feed(); - } else - p_url[0] = NULL; - } - } else - warning("You must enter or select an URL first", - "", "", "", FALSE); - } else if (response == GTK_RESPONSE_SELECTION) { - env->selection_mode = MULTIPLE; - save_url_list(p_url); - if ((i = load_selected_url_list(init_selected_url_list())) == OK) { - first_feed(); - env->reload_rq = TRUE; - break; - } else if (i == SELECTION_EMPTY) - warning("Selection is empty", "", "", "", FALSE); - else - warning("Selection error", "", "", "", FALSE); - } - } - /* update url selection */ - load_selected_url_list(init_selected_url_list()); - if (list_store != NULL) - g_object_unref(list_store); - gtk_widget_destroy(dialog); - check_main_win_always_on_top(); - env->suspend_rq = FALSE; -} -#endif diff -Nru tickr-0.5.5/src/tickr/tickr_socket.c tickr-0.6.0/src/tickr/tickr_socket.c --- tickr-0.5.5/src/tickr/tickr_socket.c 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr_socket.c 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1,345 @@ +/* + * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2012 + * + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "tickr.h" +#include "tickr_socket.h" + +#ifdef G_OS_WIN32 +extern FILE *stdout_fp, *stderr_fp; +#endif + +/* + *can use IPv4 or IPv6 + */ +#ifndef G_OS_WIN32 +static void *get_in_addr(struct sockaddr *s_a) +{ + if (s_a->sa_family == AF_INET) + return &(((struct sockaddr_in *)s_a)->sin_addr); + else + return &(((struct sockaddr_in6 *)s_a)->sin6_addr); +} +#endif + +/* + * open stream socket in non-blocking mode and connect to host + * return socket fd (> 0) / SOCK_CREATE_ERROR (-1 on Linux) if error + */ +sockt connect_to_host(const char *host, const char *portnum_str) +{ + sockt sock; +#ifndef G_OS_WIN32 + char ipa_str[INET6_ADDRSTRLEN]; +#else + u_long i_mode = 1; /* != 0 to enable non-blocking mode */ +#endif + struct addrinfo hints, *server_info, *ptr; + fd_set read_set, write_set; + struct timeval timeout; + int s_opt_value; + socklen_t s_opt_len = sizeof(sockt); + int i; + + /* addrinfo stuff */ + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; +/*#ifdef VERBOSE_OUTPUT + FPRINTF_FFLUSH_3(STD_OUT, "Resolving %s ... ", host); + FPRINTF_FFLUSH_3(STD_OUT, "Resolving %s ...\n", host); +#endif*/ + if ((i = getaddrinfo(host, portnum_str, &hints, &server_info)) != 0) { + if (USE_PROXY_FLAG) { +#ifndef G_OS_WIN32 + WARNING(FALSE, 4, "getaddrinfo() error: ", host, ": ", gai_strerror(i)); +#else + WARNING(FALSE, 4, "getaddrinfo() error: ", host, ": ", sock_error_message()); +#endif + } else { +#ifndef G_OS_WIN32 + FPRINTF_FFLUSH_4(STD_ERR, "getaddrinfo() error: %s: %s\n", host, gai_strerror(i)); +#else + FPRINTF_FFLUSH_4(STD_ERR, "getaddrinfo() error: %s: %s\n", host, sock_error_message()); +#endif + } + return -1; + } +/*#ifdef VERBOSE_OUTPUT + FPRINTF_FFLUSH_2(STD_OUT, "Done\n"); +#endif*/ + /* we get a list */ + for (ptr = server_info; ptr != NULL; ptr = ptr->ai_next) { + /* create socket */ + if ((sock = socket(ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol)) == SOCK_CREATE_ERROR) { + FPRINTF_FFLUSH_3(STD_ERR, "Error: %s\n", sock_error_message()); + continue; + } + /* set socket in non-blocking mode */ +#ifndef G_OS_WIN32 + if ((i = fcntl(sock, F_GETFL, 0)) == SOCK_FUNC_ERROR) { + FPRINTF_FFLUSH_3(STD_ERR, "fcntl() error: %s\n", sock_error_message()); + CLOSE_SOCK(sock); + break; + } else if (fcntl(sock, F_SETFL, i | O_NONBLOCK) == SOCK_FUNC_ERROR) { + FPRINTF_FFLUSH_3(STD_ERR, "fcntl() error: %s\n", sock_error_message()); + CLOSE_SOCK(sock); + break; + } +#else + if (ioctlsocket(sock, FIONBIO, &i_mode) == SOCK_FUNC_ERROR) { + FPRINTF_FFLUSH_3(STD_ERR, "ioctlsocket() error %s\n", sock_error_message()); + CLOSE_SOCK(sock); + break; + } +#endif + /* get IP addr from server_info */ +#ifdef VERBOSE_OUTPUT +#ifndef G_OS_WIN32 + inet_ntop(ptr->ai_family, get_in_addr((struct sockaddr *)ptr->ai_addr), + ipa_str, sizeof(ipa_str)); + /*FPRINTF_FFLUSH_4(STD_OUT, "Connecting to %s (%s) ...\n", ipa_str, host);*/ + FPRINTF_FFLUSH_4(STD_OUT, "Connecting to %s (%s) ... ", ipa_str, host); +#else + /* available only on vista and above but we don't really need that (do we?) so disabled + InetNtop(ptr->ai_family, get_in_addr((struct sockaddr *)ptr->ai_addr), s, sizeof(s));*/ + /*FPRINTF_FFLUSH_3(STD_OUT, "Connecting to %s ...\n", host);*/ + FPRINTF_FFLUSH_3(STD_OUT, "Connecting to %s ... ", host); +#endif +#endif + /* connect */ + if ((i = connect(sock, ptr->ai_addr, ptr->ai_addrlen)) == SOCK_FUNC_ERROR && +#ifndef G_OS_WIN32 + errno == EINPROGRESS) { +#else + WSAGetLastError() == WSAEWOULDBLOCK) { +#endif + /* as socket is in non-blocking mode, we must use select() */ + FD_ZERO(&read_set); + FD_ZERO(&write_set); + FD_SET(sock, &read_set); + FD_SET(sock, &write_set); + timeout.tv_sec = CONNECT_TIMEOUT; + timeout.tv_usec = 0; + if ((i = select(sock + 1, &read_set, &write_set, NULL, &timeout)) == SOCK_FUNC_ERROR) { + FPRINTF_FFLUSH_3(STD_ERR, "select() error: %s\n", sock_error_message()); + } else if (i == 0){ + FPRINTF_FFLUSH_2(STD_ERR, "Timed out\n"); + } else if (FD_ISSET(sock, &read_set) || FD_ISSET(sock, &write_set)) { + if (getsockopt(sock, SOL_SOCKET, SO_ERROR, + (void *)(&s_opt_value), &s_opt_len) == SOCK_FUNC_ERROR) { + FPRINTF_FFLUSH_3(STD_ERR, "getsockopt() error: %s\n", sock_error_message()); + } else if (s_opt_value == 0) { +#ifdef VERBOSE_OUTPUT + FPRINTF_FFLUSH_2(STD_OUT, "OK\n"); +#endif + freeaddrinfo(server_info); + return sock; + } +#ifndef G_OS_WIN32 + FPRINTF_FFLUSH_3(STD_ERR, "getsockopt(): %s\n", strerror(s_opt_value)); +#else + FPRINTF_FFLUSH_3(STD_ERR, "getsockopt(): %s\n", win32_error_msg(s_opt_value)); +#endif + CLOSE_SOCK(sock); + break; + } + CLOSE_SOCK(sock); + break; + } else if (i == 0) { +#ifdef VERBOSE_OUTPUT + FPRINTF_FFLUSH_2(STD_OUT, "OK\n"); +#endif + freeaddrinfo(server_info); + return sock; + } else { + FPRINTF_FFLUSH_3(STD_ERR, "connect() error: %s\n", sock_error_message()); + CLOSE_SOCK(sock); + } + } + freeaddrinfo(server_info); + return -1; +} + +int writable_data_is_available_on_socket(sockt sock) +{ + fd_set write_set; + struct timeval timeout; + int i; + + FD_ZERO(&write_set); + FD_SET(sock, &write_set); + timeout.tv_sec = SEND_RECV_TIMEOUT_SEC; + timeout.tv_usec = SEND_RECV_TIMEOUT_USEC; + if ((i = select(sock + 1, NULL, &write_set, NULL, &timeout)) == SOCK_FUNC_ERROR) { + FPRINTF_FFLUSH_3(STD_ERR, "select() error: %s\n", sock_error_message()); + return SELECT_ERROR; + } else if (i == 0) { + return SELECT_TIMED_OUT; + } else { + if (FD_ISSET(sock, &write_set)) + return SELECT_TRUE; + else + return SELECT_FALSE; + } +} + +int readable_data_is_available_on_socket(sockt sock) +{ + fd_set read_set; + struct timeval timeout; + int i; + + FD_ZERO(&read_set); + FD_SET(sock, &read_set); + timeout.tv_sec = SEND_RECV_TIMEOUT_SEC; + timeout.tv_usec = SEND_RECV_TIMEOUT_USEC; + if ((i = select(sock + 1, &read_set, NULL, NULL, &timeout)) == SOCK_FUNC_ERROR) { + FPRINTF_FFLUSH_3(STD_ERR, "select() error: %s\n", sock_error_message()); + return SELECT_ERROR; + } else if (i == 0) { + return SELECT_TIMED_OUT; + } else { + if (FD_ISSET(sock, &read_set)) + return SELECT_TRUE; + else + return SELECT_FALSE; + } +} + +/* + * return n bytes sent or SOCK_FUNC_ERROR (-1 on Linux) if error (connection + * closed by server or ?) + */ +int send_full(sockt sock, const char *str) +{ + int len = strlen(str), i, j = 0; + + while (writable_data_is_available_on_socket(sock) == SELECT_TRUE) { + if ((i = send(sock, str + j, len, 0)) != SOCK_FUNC_ERROR) { + if (i > 0) { + j += i; + len -= i; + if (len == 0) + break; + } else { + /* something to do? */ + } + } else { + j = SOCK_FUNC_ERROR; +#ifndef G_OS_WIN32 + if (errno == EPIPE) { +#else + if ((i = WSAGetLastError()) == WSAECONNRESET || i == WSAECONNABORTED ||\ + i == WSAESHUTDOWN) { +#endif +#ifdef VERBOSE_OUTPUT + FPRINTF_FFLUSH_2(STD_ERR, "Connection closed by server\n"); +#endif + } else { + FPRINTF_FFLUSH_3(STD_ERR, "send() error: %s\n", sock_error_message()); + } + break; + } + } + return j; +} + +/* + * return response = recv_full(socket, &bytes_received, &status) or NULL if error + * -> status = SOCK_OK, CONNECTION_CLOSED_BY_SERVER, RECV_ERROR or SOCK_SHOULD_BE_CLOSED + * -> allocate memory for response (must be freed afterwards with free2() if != NULL) + */ +char *recv_full(sockt sock, int *bytes_received, int *status) +{ + char *response, *full_response; + int i; + + *bytes_received = 0; + *status = RECV_ERROR; + response = malloc2(RECV_CHUNK_LEN + 1); + response[0] = '\0'; + full_response = l_str_new(response); + while (readable_data_is_available_on_socket(sock) == SELECT_TRUE) { + if ((i = recv(sock, response, RECV_CHUNK_LEN, 0)) != SOCK_FUNC_ERROR) { + if (i > 0) { + response[MIN(i, RECV_CHUNK_LEN)] = '\0'; + full_response = l_str_cat(full_response, response); + *bytes_received += i; + *status = SOCK_OK; + } else if (i == 0) { + *status = CONNECTION_CLOSED_BY_SERVER; +#ifdef VERBOSE_OUTPUT + FPRINTF_FFLUSH_2(STD_ERR, "Connection closed by server\n"); +#endif + break; + } + } else { +#ifndef G_OS_WIN32 + *status = RECV_ERROR; + l_str_free(full_response); + full_response = NULL; +#ifdef VERBOSE_OUTPUT + FPRINTF_FFLUSH_3(STD_ERR, "recv() error: %s\n", sock_error_message()); +#endif +#else + if ((i = WSAGetLastError()) == WSAECONNRESET || i == WSAECONNABORTED ||\ + i == WSAESHUTDOWN) { + *status = SOCK_SHOULD_BE_CLOSED; +#ifdef VERBOSE_OUTPUT + FPRINTF_FFLUSH_2(STD_ERR, "Connection closed by server\n"); +#endif + } else { + *status = RECV_ERROR; + l_str_free(full_response); + full_response = NULL; +#ifdef VERBOSE_OUTPUT + FPRINTF_FFLUSH_3(STD_ERR, "recv() error: %s\n", win32_error_msg(i)); +#endif + } +#endif + break; + } + } + free2(response); + return full_response; +} + +#ifdef G_OS_WIN32 +const char *win32_error_msg(int i) +{ + static char str[1024]; + gchar *win32_str; + + win32_str = g_win32_error_message(i); + str_n_cpy(str, (const char *)win32_str, 1023); + g_free(win32_str); + return (const char *)str; +} +#endif + +const char *sock_error_message() +{ + static char str[1024]; + +#ifndef G_OS_WIN32 + str_n_cpy(str, strerror(errno), 1023); +#else + str_n_cpy(str, win32_error_msg(WSAGetLastError()), 1023); +#endif + return (const char *)str; +} diff -Nru tickr-0.5.5/src/tickr/tickr_socket.h tickr-0.6.0/src/tickr/tickr_socket.h --- tickr-0.5.5/src/tickr/tickr_socket.h 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/src/tickr/tickr_socket.h 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1,122 @@ +/* + * TICKR - GTK-based Feed Reader - Copyright (C) Emmanuel Thomas-Maurin 2009-2012 + * + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef INC_TICKR_SOCKET_H +#define INC_TICKR_SOCKET_H + +#define USE_PROXY_FLAG get_use_proxy() +#define WARNING(a1, a2, a3, a4, a5, a6) warning(a1, a2, a3, a4, a5, a6) +#define SOCK_OK OK + +/* check these 2 values - need more testing (1s / 0.5s / 0.1.s) */ +#define SEND_RECV_TIMEOUT_SEC 1 +#define SEND_RECV_TIMEOUT_USEC 0 + +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef G_OS_WIN32 +# include +# include +# include +# include +# include +# include +#else +# define _WIN32_WINNT 0x0501 /* win version = xp or higher */ +# include +# include +# include +# include +# include +# include +#endif +#include "../libetm-0.4.3/libetm.h" + +#define CONNECT_TIMEOUT 5 +#define RECV_CHUNK_LEN (16 * 1024 - 1) + +#ifndef G_OS_WIN32 +typedef int sockt; +# define SOCK_CREATE_ERROR -1 /* socket() */ +# define SOCK_FUNC_ERROR -1 /* setsockopt(), bind(), listen(), select(), connect(), + * send(), recv(), fnctl(), ioctlsocket() */ +# define CLOSE_SOCK(s) close(s) +#else +typedef SOCKET sockt; +# define SOCK_CREATE_ERROR INVALID_SOCKET +# define SOCK_FUNC_ERROR SOCKET_ERROR +# define CLOSE_SOCK(s) closesocket(s) +#endif + +typedef enum { + SOCK_ERROR = LIBETM_LASTERRORCODE + 1, + SOCK_CANT_CONNECT, + SOCK_SHOULD_BE_CLOSED, + + SELECT_ERROR, + SELECT_TIMED_OUT, + SELECT_TRUE, + SELECT_FALSE, + + SEND_ERROR, + RECV_ERROR, + + CONNECTION_CLOSED_BY_SERVER, + + SOCKET_LASTERRORCODE +} socket_error_code; + +#define FPRINTF_FFLUSH_2(a1, a2); {fprintf(a1, a2);fflush(a1);} +#define FPRINTF_FFLUSH_3(a1, a2, a3); {fprintf(a1, a2, a3);fflush(a1);} +#define FPRINTF_FFLUSH_4(a1, a2, a3, a4); {fprintf(a1, a2, a3, a4);fflush(a1);} + +/* + * open stream socket in non-blocking mode and connect to host + * return socket fd (> 0) / SOCK_CREATE_ERROR (-1 on Linux) if error + */ +sockt connect_to_host(const char *, const char *); + +int writable_data_is_available_on_socket(sockt); + +int readable_data_is_available_on_socket(sockt); + +/* + * return n bytes sent or SOCK_FUNC_ERROR (-1 on Linux) if error (connection + * closed by server or ?) + */ +int send_full(sockt, const char *); + +/* + * return response = recv_full(socket, &bytes_received, &status) or NULL if error + * -> status = SOCK_OK, CONNECTION_CLOSED_BY_SERVER, RECV_ERROR or SOCK_SHOULD_BE_CLOSED + * -> allocate memory for response (must be freed afterwards with free2() if != NULL) + */ +char *recv_full(sockt, int *, int *); + +#ifdef G_OS_WIN32 +const char *win32_error_msg(int); +#endif + +const char *sock_error_message(); +#endif /* INC_TICKR_SOCKET_H */ diff -Nru tickr-0.5.5/tickr.1 tickr-0.6.0/tickr.1 --- tickr-0.5.5/tickr.1 2011-12-17 21:23:06.000000000 +0100 +++ tickr-0.6.0/tickr.1 2012-03-07 02:01:00.000000000 +0100 @@ -1,16 +1,16 @@ .TH TICKR 1 "August 19, 2011" .SH NAME .B Tickr -\- GTK-based highly graphically-customizable RSS Feed Ticker. +\- GTK-based highly graphically-customizable Feed Ticker. .SH SYNOPSIS .B tickr [\-help / \-version / \-license / \-instance-\id=n / \-dumpfontlist] [options (\-name[=value])...] [resource (file name or URL)] .SH DESCRIPTION .B Tickr -is a GTK-based RSS Reader that displays feeds as a smooth scrolling line -on your Desktop, as known from TV stations. Open feed links in your favourite -Browser. Graphics are highly customizable. +is a GTK-based RSS/Atom Reader that displays feeds as a smooth +scrolling line on your Desktop, as known from TV stations. Open feed +links in your favourite Browser. Graphics are highly customizable. .SH OPTIONS .TP .B help @@ -150,7 +150,7 @@ Pause ticker on mouseover .TP .B mousewheelscroll=[s/f/n] -Mouse wheel scrolling apply to: (ticker-)speed / feed(-in-list) / none +Mouse wheel scrolling apply to: (ticker\-)speed / feed(\-in\-list) / none .TP .B specialchars=[y/n] Enable or disable special characters. This is only useful when resource diff -Nru tickr-0.5.5/tickr.desktop tickr-0.6.0/tickr.desktop --- tickr-0.5.5/tickr.desktop 2011-08-27 16:25:01.000000000 +0200 +++ tickr-0.6.0/tickr.desktop 2012-03-07 02:01:00.000000000 +0100 @@ -3,9 +3,9 @@ Version=1.0 Type=Application Terminal=false -Name=Tickr - RSS Feed Reader +Name=Tickr - Feed Reader Icon=/usr/share/tickr/pixmaps/tickr-icon.xpm Exec=/usr/bin/tickr -Comment=GTK-based highly graphically-customizable RSS Ticker +Comment=GTK-based highly graphically-customizable Feed Ticker Categories=GNOME;GTK;Network;News -Name[en_US]=Tickr - RSS Feed Reader +Name[en_US]=Tickr - Feed Reader diff -Nru tickr-0.5.5/TODO tickr-0.6.0/TODO --- tickr-0.5.5/TODO 2011-12-17 23:41:18.000000000 +0100 +++ tickr-0.6.0/TODO 2012-03-07 02:01:00.000000000 +0100 @@ -1,17 +1,10 @@ bug list -------- -- focus issues with unity on ubuntu -> program 'steal' focus every time - a feed is loaded +- issues with unity on ubuntu -> program 'steals' focus every time a + feed is loaded / doesn't show on all desktops whereas it should -- when importing opml file, check urls without connection settings - (auth credentials) so doesn't select a few ones -> fix that or? - -> at the moment, only select feeds that are loadable - -- win32 isssues: - - program hangs after running for several days - - trouble with exotic user names in appdata path - - win7 64-bit issues -> ???? +- win32 issues: trouble with exotic user names in appdata path stuff to implement and requests for new features @@ -26,18 +19,40 @@ - filters / search (option to filter feed items with publication date, 'word match alert', ability to undisplay one feed, ...) -- upload translation templates on launchpad +- in feed picker: selection start from beginning -> from selected feed ? (nothing decided yet about stuff below) +- when importing opml file, check urls without connection settings + (auth credentials) so doesn't select a few ones -> fix that or? + -> at the moment, only select feeds that are loadable + +- win height (for big wins) = MIN(k% screen height, height limit) / win + border decreased + +- should check/implement utf8 compliance everywhere + +- check memory leaks for win32 v + +- implement SEND_RECV_TIMEOUT_SEC and SEND_RECV_TIMEOUT_USEC as a + setting user can tweak, depending on his connection speed/bandwidth + +- remove #define USE_GUI or change it into an option ? + +- run socket code in a separate thread ? + +- upload translation templates on launchpad + +- add feed title [] (before rss title [] and rss description []) + - improve file i/o code consistency - rss description ballon (actually gtk tooltip) on mouse-over -- add an option to show passwords in connection settings window? +- add an option to show passwords in connection settings window ? -- option to not show again already read items? +- option to not show again already read items ? - add 'open (indep floating) control win' line in control menu -> control win = feed title /info / ...? and buttons @@ -45,27 +60,25 @@ speed up / speed down / move win / resize win / ...? -> could be really handy -- add feed title [] (before rss title [] and rss description []) - -- handle to drag window +- handles to drag window - win always-on-top unchecked issue when compiz disabled -> fix with xlib functions? - 12h time format / show seconds option -- read feed(s) in loop / once only? +- read feed(s) in loop / once only ? -- reading feed selection randomly? +- reading feed selection randomly ? -- color-coded feeds? +- color-coded feeds ? -- background gradient colors? +- background gradient colors ? - use extra widgets: search entry, ... -- new cli args: attop, atbottom, fullwidth? +- new cli args: attop, atbottom, fullwidth ? -- sort url list by title, not by url? +- sort url list by title, not by url ? -- check connection state, retry if not connected? +- check connection state, retry if not connected ? diff -Nru tickr-0.5.5/win32_install_stuff/build-win32-installer tickr-0.6.0/win32_install_stuff/build-win32-installer --- tickr-0.5.5/win32_install_stuff/build-win32-installer 2011-08-27 14:25:13.000000000 +0200 +++ tickr-0.6.0/win32_install_stuff/build-win32-installer 2012-03-07 02:01:00.000000000 +0100 @@ -16,6 +16,7 @@ cp tickr.exe $BIN_DIR/ cp $IMAGES_DIR/tickr-*.png $BIN_DIR/ cp $DLLS_DIR/*.dll $BIN_DIR/ +cp $DLLS_DIR/*.dll.a $BIN_DIR/ cp $TXT_FILES_DIR/LICENSE $BIN_DIR/ cp $TXT_FILES_DIR/COPYING $BIN_DIR/ cp $TXT_FILES_DIR/README $BIN_DIR/ diff -Nru tickr-0.5.5/win32_install_stuff/installer.iss tickr-0.6.0/win32_install_stuff/installer.iss --- tickr-0.5.5/win32_install_stuff/installer.iss 2011-11-23 15:30:11.000000000 +0100 +++ tickr-0.6.0/win32_install_stuff/installer.iss 2012-03-07 02:01:00.000000000 +0100 @@ -9,8 +9,8 @@ ; previous app id (for News): AppId={{4C30F291-1B7B-4E53-AB2E-8F515B8F99E5} AppId={{A3E7BF61-5796-451F-8DC4-753E4BA6B048} AppName=Tickr -AppVersion=0.5.5 -;AppVerName=Tickr 0.5.5 +AppVersion=0.6.0 +;AppVerName=Tickr 0.6.0 AppPublisher=ETMSoftware AppPublisherURL=http://www.newsrssticker.com AppSupportURL=http://www.newsrssticker.com @@ -19,10 +19,10 @@ DisableDirPage=no DefaultGroupName=Tickr DisableProgramGroupPage=no -LicenseFile=C:\MinGW\msys\1.0\home\manutm\src\tickr-0.5.5\src\tickr\tickr-win32-bin\LICENSE +LicenseFile=C:\MinGW\msys\1.0\home\manutm\src\tickr-0.6.0\src\tickr\tickr-win32-bin\LICENSE OutputDir=C:\Documents and Settings\manutm\Bureau\binaries -OutputBaseFilename=Tickr-0.5.5-Setup -SetupIconFile=C:\MinGW\msys\1.0\home\manutm\src\tickr-0.5.5\images\tickr-icon.ico +OutputBaseFilename=Tickr-0.6.0-Setup +SetupIconFile=C:\MinGW\msys\1.0\home\manutm\src\tickr-0.6.0\images\tickr-icon.ico Compression=lzma SolidCompression=yes @@ -54,7 +54,7 @@ Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1 [Files] -Source: "C:\MinGW\msys\1.0\home\manutm\src\tickr-0.5.5\src\tickr\tickr-win32-bin\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "C:\MinGW\msys\1.0\home\manutm\src\tickr-0.6.0\src\tickr\tickr-win32-bin\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons] diff -Nru tickr-0.5.5/win32_install_stuff/LICENSE tickr-0.6.0/win32_install_stuff/LICENSE --- tickr-0.5.5/win32_install_stuff/LICENSE 1970-01-01 01:00:00.000000000 +0100 +++ tickr-0.6.0/win32_install_stuff/LICENSE 2012-03-07 02:01:00.000000000 +0100 @@ -0,0 +1,16 @@ +====== TICKR LICENSE ====== + +Tickr version 0.6.0 - Copyright (C) Emmanuel Thomas-Maurin 2009-2012 + +Tickr is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Tickr is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . diff -Nru tickr-0.5.5/win32_install_stuff/Makefile-libetm-win32 tickr-0.6.0/win32_install_stuff/Makefile-libetm-win32 --- tickr-0.5.5/win32_install_stuff/Makefile-libetm-win32 2011-12-11 23:51:13.000000000 +0100 +++ tickr-0.6.0/win32_install_stuff/Makefile-libetm-win32 2012-03-07 02:01:00.000000000 +0100 @@ -1,4 +1,4 @@ -# Makefile for libetm-0.4.2 - win32 version +# Makefile for libetm-0.4.3 - win32 version src = str_mem.c error.c misc.c win32_specific.c obj = $(src:.c=.o) @@ -7,7 +7,7 @@ CC = gcc CFLAGS = -O2 -Wall -Wextra -Wunused-parameter -Wshadow -Wpointer-arith\ - -ffast-math -pedantic -D WIN32_V + -ffast-math -pedantic -DWIN32_V all: libetm.a diff -Nru tickr-0.5.5/win32_install_stuff/Makefile-tickr-win32 tickr-0.6.0/win32_install_stuff/Makefile-tickr-win32 --- tickr-0.5.5/win32_install_stuff/Makefile-tickr-win32 2011-12-01 17:47:23.000000000 +0100 +++ tickr-0.6.0/win32_install_stuff/Makefile-tickr-win32 2012-03-07 02:01:00.000000000 +0100 @@ -1,18 +1,22 @@ -# Makefile for TICKR - GTK-based RSS Ticker - win32 version +# Makefile for TICKR - GTK-based Feed Reader - win32 version -src = tickr_main.c tickr_resource.c tickr_render.c tickr_params.c tickr_clock.c\ - tickr_rss.c tickr_list.c tickr_rsswin.c tickr_prefwin.c tickr_otherwins.c\ - tickr_misc.c tickr_helptext.c tickr_opml.c tickr_http.c tickr_connectwin.c +src = tickr_main.c tickr_resource.c tickr_render.c tickr_params.c\ + tickr_clock.c tickr_feedparser.c tickr_list.c tickr_feedpicker.c\ + tickr_prefwin.c tickr_otherwins.c tickr_misc.c tickr_helptext.c\ + tickr_opml.c tickr_http.c tickr_socket.c tickr_connectwin.c\ + tickr_quickfeedpicker.c obj = $(src:.c=.o) CC = gcc -CFLAGS = -O2 -Wall -Wextra -Wunused-parameter -Wshadow -Wpointer-arith -ffast-math -pedantic\ - `pkg-config --cflags gtk+-2.0` -I/usr/local/include/libxml2 -D WIN32_V - -LIBS = --mms-bitfields -mwindows -lwinmm -lrpcrt4 -liphlpapi -lws2_32 /usr/local/lib/libetm.a\ - `pkg-config --libs gtk+-2.0` -static /usr/local/lib/libxml2.dll.a +CFLAGS = -O2 -Wall -Wextra -Wunused-parameter -Wshadow -Wpointer-arith\ + -ffast-math -pedantic `pkg-config --cflags gtk+-2.0`\ + -I/usr/local/include/libxml2 -DWIN32_V + +LIBS = --mms-bitfields -mwindows -lwinmm -lrpcrt4 -liphlpapi -lws2_32\ + ../libetm-0.4.3/libetm.a `pkg-config --libs gtk+-2.0`\ + -static ../../win32_install_stuff/dlls/libxml2.dll.a all: tickr diff -Nru tickr-0.5.5/win32_install_stuff/required_dlls tickr-0.6.0/win32_install_stuff/required_dlls --- tickr-0.5.5/win32_install_stuff/required_dlls 2011-08-22 12:51:22.000000000 +0200 +++ tickr-0.6.0/win32_install_stuff/required_dlls 2012-03-07 02:01:00.000000000 +0100 @@ -1 +1 @@ -libxml2-2.dll version 2.7.8 +libxml2-2.dll.a version 2.7.8