Initial import of News module.

News module displays information feeds like Rss or Atom,
its not finished yet, but its usable and should be stable too.

enjoy =)


SVN revision: 30004
This commit is contained in:
kiwi 2007-05-16 12:06:03 +00:00 committed by kiwi
commit 480a7c0a6e
126 changed files with 11486 additions and 0 deletions

0
ABOUT-NLS Normal file
View File

8
AUTHORS Normal file
View File

@ -0,0 +1,8 @@
Laurent 'kiwi' Ghigonis
ooookiwi@gmail.com
http://oooo.zapto.org
irc.freenode.net, #e.fr, kiwi_
Thanks to <lok> and <watchwolf> from #e.fr, and to Juan J. <udobito>, for their ideas and reports
Feeds icons are from the respective websites, sometimes a bit modified to look better

340
COPYING Normal file
View File

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) 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
this service 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 make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. 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.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the 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 a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE 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.
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
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 2 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, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision 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, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This 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 Library General
Public License instead of this License.

0
ChangeLog Normal file
View File

39
IDEAS Normal file
View File

@ -0,0 +1,39 @@
* Main *
- take from MacOS X spirit
- take from dEvian
- fix charset bugs (look at tmsnc)
- fix proxy bugs (config dialog)
- multiples rss in one rss item, like tabs
general view of all rss feeds wich are inside one item
* Rss general view *
- when one has a news, it goes red
when you click/over one, it switches to it
- autoscroll under mouse option
- view mode : icons, icons and text, text
* Rss headlines view *
- when youre mouse go over one rss, it set all rss of the source as red
- autoscroll under mouse option
- you can configure the font and font size
- view mode : date, date and text, text
* Rss content view *
- popup under the shelf or centered at the middle of the screen
- autoscroll under mouse option
- you can configure the font and font size
* Rss List *
- sort by categories
the user can add his feeds in one category
- the user can move up and down a feed in the list, within a category
- he select the category of a feed in the feed config dialog
- many rss already here by default
- display language for each feed

5
INSTALL Normal file
View File

@ -0,0 +1,5 @@
To install Enlightenment News module, just do
./autogen.sh
make
make install

8
Makefile.am Normal file
View File

@ -0,0 +1,8 @@
MAINTAINERCLEANFILES = Makefile.in
SUBDIRS = src data
filesdir = $(datadir)
files_DATA = module.desktop
pkgdir = $(datadir)/$(MODULE_ARCH)

0
NEWS Normal file
View File

6
README Normal file
View File

@ -0,0 +1,6 @@
Enlightenment News Module
Module to display information feeds like Rss or Atom
on youre Enlightenment desktop
enjoy =)

144
TODO Normal file
View File

@ -0,0 +1,144 @@
make install CFLAGS="-g -Wall -Werror -DDEBUG -DDEBUG_MAIN -DDEBUG_CONFIG -DDEBUG_ITEM -DDEBUG_FEED -DDEBUG_PARSE -DDEBUG_BROWSER -DDEBUG_POPUP_WARN -DDEBUG_VIEWER"
----------------------------------------------------
BUGS
----------------------------------------------------
----------------------------------------------------
NEEDED (to do more or less in this order)
----------------------------------------------------
- feed icons (new file ?)
Evas_Object *news_feed_icon_add(News_Feed *feed)
void news_feed_icon_del(Evas_Object *obj)
void news_feed_icon_refresh(Evas_Object *obj)
evas_object_data_set the feed on the icon
evas_object_event_callback_add(EVAS_CALLBACK_FREE) on the icon, that remove the obj from feed->icons
to get a feeds icon : an edje obj, with icon swallowed
so we can put in menu / item / ilists, to have animated things every where, linked and consistant (state refresh calls news_feed_icon_refresh(feed))
add an "attached" state, to show that the feed is attached to an item. for example, a circle border aroung the icon ?
enable/disable state changes for each icon, with options on the _icon_add() and "can_..." data attached to the icon's evas_object
so mybe then no feed for news_viewer_feed_refresh() and config_dialog_refresh_feed() ...
- feeds option "icon glint on news"
- news_feed_ilist_get(News_Item *item)
+ news_feed_category_ilist_get()
if item is not NULL, get the selected feeds (= feeds of the item)
is NULL, get the whole feeds list (with categories ...)
(implement multi sel everywhere in main dialog, feeds list; usefull for delete feeds)
news_category_ilist_get
- news_viewer_feed_refresh -> refresh label and icon of a feed
news_config_dialog_refresh_feed
news_config_dialog_item_refresh_feed
items_get
while { nth_data_get() == feed }
nth_icon_set
nth_label_set
to avoid refresh the ilist
--- WAIT FOR FEED ICONS ---
- viewer: dont reselect current feed in viewer when a feed has updated with changes
- viewer: when an article goes to "as read" and "feeds first" option, refresh the feeds list but don't reselect the feed, go on top of the list
- use a "changed" attribute to things, to detect what has to be refresh when refresh() is called. to avoid refresh things for nothing, so avoid user ilists changer for nothing
---
[Parse]
- parse html chars (in _item_clean ?)
- reparse infos every time, if changes ... ?
- handle the fact that sometimes we loose feeds (connection timeout ...) so sometimes, keep feeds that are READ, to avoid having feeds marked as unread, but wich where read before
-> compare description of feed just parsed with suspect precedent one
its not that slow (use memcmp, keep description_size)
[Item]
- show as selected the feed selected in viewer
- mouse over -> bump icon a bit
- unread feeds : glint every /10s ? on a global beat ?
- unread feeds : put the red color on top if icon alpha = 0
- item actions on mouse over / left click / wheel, like in photo
- option to have label on each feed icon
- wheel on an item makes the viewer go to next/prev (unread?) article
- loading state
- maybe a BUG with add / remove feeds in an item (MODE_FEED)
it has hang on time, in while(o = e_box_..._first(box)) { unpack }
... needs testing
[Config_Dialog]
- e patch for ilist : e_widget_ilist_selected_set, when there are labels, selects the good feed but the view goes at the end of the ilist
- e patch for ilist : (dialog_item/viewer when refresh and dont selected_set after, the view goes up of one item
- when changing order / modify feeds / categories
in the main config panel, make the state of the
config panel as INCHANGED
= dont enable "ok" and "apply"
- ? dont allow move categories ?
- ? item: category ilist to quickly find a feed ?
- e_config_dialog_find for all config dialogs ...
it needs E patch
- clean config_dialog_data (use sub structs ...)
- ? news_widget_feeds ? an ilist of feeds, sorted ... other things like that ?
- ? dialog: default button for viewer font, needs rewrite some things ... ?
- ? main/item: show language flag in ilist
e patch : add ability to have a 2nd image on the right of ilist items (we can show module activation in modules list. (raster adreed, go!, and send to ml) ?
is it really usefull ? language offen appears in the name, and we have a language selector ...
[Viewer]
- appear with sliding animation in option ?
- when refresh viewer, try not to move the ilist view,
cause when you are watching it at the same time, its very anoying
needs e ilist patch ?
- news viewer refresh position function ?
- ? viewer: instead of having 'own lists', get the pos of feeds/articles via going through ilist items (e_widget_ilist_items_get && e_widget_ilist_nth_data_get), counting and looking data field ?
[Popup_Warn]
- everything
[Feed]
- patch to ecore_con to avoid segv when ecore_con_server_del on a server wich has not astablished connection yet
- popup an error if the feed doesnt want to refresh
(with a timeout timer on waiting reply ...)
- proxy tests
- add default feeds
- save articles on unload ?
- DIDNT FIND BETTER ... :
rethink the stupid system that _detach, but not really.
linked with the Feed_Ref thing
-> ??? detach feeds, feed refs
when shutdown the module, specify if whe want a real delete (done)
but why is it unsur ? we should be able to know is the shutdown call
comes from my code (->detach) or outside ???
[*]
- move some things from .h to .c (private things ...)
- help dialog (mouse on viewer vcontent for example ...)
- fix all TODO and FIXME in the code
[Parse]
- ? charset ? already ok ? i believe not =)
- display feed language
- images
for items :
<enclosure url="..">, look if its an image
for channels :
<image> -> <url>
<rss:image> for <= 1.0
favicon.ico
- get the favicon.ico for the feed icon, or set a genereric icon if not
[Viewer]
- capacitee de suivre des flux d'images, et de sav les images
pour que Photo par exemple les reprenne derriere ds le repertoire où on a save la photo
"mode images" genre entice, pour voir toutes les images d'un coup (cf <lok>) ?
[Config Dialog]
- add an auto attach dialog, when you create a new feed
(disable option)
[Browser]
- possibility to have a little browser window in front of
the shelf, to see a news options to remember, place ...
----------------------------------------------------
FUTUR
----------------------------------------------------
- think about a new way of interaction with the wm
- search info about getting feeds where youre need to be logged

19
autogen.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
rm -Rf aclocal.m4 autom4te.cache/ ltmain.sh config.log config.status config.cache configure configure.scan libtool Makefile \
data/Makefile.in data/Makefile \
data/images/Makefile.in data/images/Makefile \
data/themes/Makefile.in data/themes/Makefile \
data/themes/minimal/Makefile.in data/themes/minimal/Makefile \
src/Makefile src/Makefile.in \
src/module/Makefile src/module/Makefile.in
echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS -I m4 || exit 1
echo "Running autoheader..." ; autoheader || exit 1
echo "Running autoconf..." ; autoconf || exit 1
echo "Running libtoolize..." ; (libtoolize --copy --automake || glibtoolize --automake) || exit 1
echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1
if [ -z "$NOCONFIGURE" ]; then
./configure "$@"
fi

166
configure.in Normal file
View File

@ -0,0 +1,166 @@
dnl Process this file with autoconf to produce a configure script.
# get rid of that stupid cache mechanism
rm -f config.cache
#news module version
version="0.1.0"
AC_INIT(configure.in)
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE(news, $version)
AM_CONFIG_HEADER(config.h)
AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
AC_C_CONST
AM_ENABLE_SHARED
AM_PROG_LIBTOOL
ALL_LINGUAS="fi it ja ru sv"
AC_SUBST(ALL_LINGUAS)
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION(0.14)
MODULE_ARCH="$host_os-$host_cpu"
AC_SUBST(MODULE_ARCH)
AC_DEFINE_UNQUOTED(MODULE_ARCH, "$MODULE_ARCH", "Module architecture")
AC_DEFINE_UNQUOTED(MODULE_VERSION, "$version", "Module version")
if test "x${bindir}" = 'x${exec_prefix}/bin'; then
if test "x${exec_prefix}" = "xNONE"; then
if test "x${prefix}" = "xNONE"; then
bindir="${ac_default_prefix}/bin";
else
bindir="${prefix}/bin";
fi
else
if test "x${prefix}" = "xNONE"; then
bindir="${ac_default_prefix}/bin";
else
bindir="${prefix}/bin";
fi
fi
fi
if test "x${libdir}" = 'x${exec_prefix}/lib'; then
if test "x${exec_prefix}" = "xNONE"; then
if test "x${prefix}" = "xNONE"; then
libdir="${ac_default_prefix}/lib";
else
libdir="${prefix}/lib";
fi
else
if test "x${prefix}" = "xNONE"; then
libdir="${ac_default_prefix}/lib";
else
libdir="${prefix}/lib";
fi
fi
fi
dnl Set PACKAGE_BIN_DIR in config.h.
if test "x${bindir}" = 'xNONE'; then
if test "x${prefix}" = "xNONE"; then
AC_DEFINE_UNQUOTED(PACKAGE_BIN_DIR, "${ac_default_prefix}/bin", "Package installed binaries destination")
else
AC_DEFINE_UNQUOTED(PACKAGE_BIN_DIR, "${prefix}/bin", "Package installed binaries destination")
fi
else
AC_DEFINE_UNQUOTED(PACKAGE_BIN_DIR, "${bindir}", "Package installed binaries destination")
fi
dnl Set PACKAGE_LIB_DIR in config.h.
if test "x${libdir}" = 'xNONE'; then
if test "x${prefix}" = "xNONE"; then
AC_DEFINE_UNQUOTED(PACKAGE_LIB_DIR, "${ac_default_prefix}/lib", "Package installed libraries destination")
else
AC_DEFINE_UNQUOTED(PACKAGE_LIB_DIR, "${prefix}/lib", "Package installed libraries destination")
fi
else
AC_DEFINE_UNQUOTED(PACKAGE_LIB_DIR, "${libdir}", "Package installed libraries destination")
fi
dnl Set PACKAGE_DATA_DIR in config.h.
if test "x${prefix}" = "xNONE"; then
AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${HOME}/.e/e/modules/${PACKAGE}", "Package installed data destination")
datadir="${HOME}/.e/e/modules/${PACKAGE}"
else
AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${prefix}/lib/enlightenment/modules/${PACKAGE}", "Package installed data destination")
datadir="${prefix}/lib/enlightenment/modules/${PACKAGE}"
fi
AC_PREFIX_DEFAULT(${HOME}/.e/e)
if test "x$prefix" = "xNONE"; then
datarootdir=${ac_default_prefix}
else
datarootdir=${prefix}/share
fi
localedir=${datarootdir}/locale
AC_SUBST(LOCALEDIR, "${localedir}")
AC_DEFINE_UNQUOTED(LOCALEDIR, "${localedir}", [Module Locale Directory])
#AC_CHECK_LIB(dl, dlopen, dlopen_libs=-ldl)
#AC_SUBST(dlopen_libs)
AC_ARG_WITH(edje-config,
[ --with-edje-config=EDJE_CONFIG use edje-config specified ],
[
EDJE_CONFIG=$withval;
echo "using "$EDJE_CONFIG" for edje-config";
/
],[
PROG="edje-config";
AC_PATH_PROG(EDJE_CONFIG, $PROG, "", $PATH)
])
edje_cflags=`$EDJE_CONFIG --cflags`
edje_libs=`$EDJE_CONFIG --libs`
AC_SUBST(edje_cflags)
AC_SUBST(edje_libs)
edje_cc="`$EDJE_CONFIG --prefix`/bin/edje_cc"
AC_ARG_WITH(edje-cc,
[ --with-edje-cc=PATH specify a specific path to edje_cc],
[
v=$withval;
edje_cc=$v
echo " Enlightenment edje_cc explicitly set to "$edje_cc;
],[
edje_cc="`$EDJE_CONFIG --prefix`/bin/edje_cc"
])
AC_SUBST(edje_cc)
AC_ARG_WITH(enlightenment-config,
[ --with-enlightenment-config=E_CONFIG use enlightenment-config specified ],
[
E_CONFIG=$withval;
echo "using "$E_CONFIG" for enlightenment-config";
],[
PROG="enlightenment-config";
AC_PATH_PROG(E_CONFIG, $PROG, "", $PATH)
])
e_cflags=`$E_CONFIG --cflags`
e_libs=`$E_CONFIG --libs`
e_modules=`$E_CONFIG --module-dir`
AC_SUBST(e_cflags)
AC_SUBST(e_libs)
AC_SUBST(e_modules)
AC_OUTPUT([
e_modules-news.spec
module.desktop
Makefile
data/Makefile
data/images/Makefile
data/images/feeds/Makefile
data/images/categories/Makefile
data/theme/Makefile
src/Makefile
src/module/Makefile
],[
])

2
data/Makefile.am Normal file
View File

@ -0,0 +1,2 @@
MAINTAINERCLEANFILES = Makefile.in
SUBDIRS = images theme

2
data/images/Makefile.am Normal file
View File

@ -0,0 +1,2 @@
MAINTAINERCLEANFILES = Makefile.in
SUBDIRS = feeds categories

View File

@ -0,0 +1,6 @@
MAINTAINERCLEANFILES = Makefile.in
filesdir = $(datadir)/images/categories
files_DATA = blue.png \
default.png \
red.png

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,22 @@
MAINTAINERCLEANFILES = Makefile.in
filesdir = $(datadir)/images/feeds
files_DATA = afp.png \
barrapunto.png \
bbcworld.png \
bouletcorp.png \
cnn.png \
courrierinternational.png \
default.png \
digg.png \
e_cvs.png \
e_fr.png \
freshmeat.png \
futurasciences.png \
google_fr.png \
google.png \
lemonde.png \
meneame.png \
news.png \
osnews.png \
slashdot.png

BIN
data/images/feeds/afp.png Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
data/images/feeds/cnn.png Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
data/images/feeds/digg.png Normal file

Binary file not shown.

BIN
data/images/feeds/e_cvs.png Normal file

Binary file not shown.

BIN
data/images/feeds/e_fr.png Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
data/images/feeds/news.png Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

36
data/theme/Makefile.am Normal file
View File

@ -0,0 +1,36 @@
MAINTAINERCLEANFILES = Makefile.in
EDJE_CC = @edje_cc@
EDJE_FLAGS = -v \
-id images \
-fd fonts
EXTRA_DIST = \
module.edc \
module_feed.edc \
module_feed_parts.edc \
module_feed_programs.edc \
module_feedone.edc \
module_feedone_parts.edc \
module_feedone_programs.edc \
module_icon.edc \
module_item.edc \
module_item_parts.edc \
module_item_programs.edc \
module_popw.edc \
module_popw_parts.edc \
module_popw_programs.edc \
module_viewer.edc \
module_viewer_parts.edc \
module_viewer_programs.edc
filesdir = $(datadir)
files_DATA = e-module-news.edj
e-module-news.edj: Makefile $(EXTRA_DIST)
$(EDJE_CC) $(EDJE_FLAGS) \
$(top_srcdir)/data/theme/module.edc \
$(top_builddir)/data/theme/e-module-news.edj
clean-local:
rm -f e-module-news.edj

BIN
data/theme/fonts/Vera.ttf Normal file

Binary file not shown.

BIN
data/theme/fonts/VeraBd.ttf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

44
data/theme/module.edc Normal file
View File

@ -0,0 +1,44 @@
/* Enlightenment News Module theme */
images
{
image: "item_border.png" COMP;
image: "item_feed_back.png" COMP;
image: "feed_background_new.png" COMP;
image: "feed_border.png" COMP;
image: "popup_warn_background.png" COMP;
image: "popup_warn_disable_clicked.png" COMP;
image: "popup_warn_disable.png" COMP;
image: "popup_warn_logo_error.png" COMP;
image: "popup_warn_logo_info.png" COMP;
image: "viewer_background.png" COMP;
image: "icon_logo.png" COMP;
image: "icon_infos.png" COMP;
image: "icon_viewer.png" COMP;
image: "icon_article_read.png" COMP;
image: "icon_article_unread.png" COMP;
image: "icon_update.png" COMP;
image: "icon_setasread.png" COMP;
}
fonts
{
font: "Vera.ttf" "Vera";
font: "VeraBd.ttf" "VeraBd";
}
collections
{
/* Groups */
#include "module_item.edc"
#include "module_feed.edc"
#include "module_feedone.edc"
#include "module_popw.edc"
#include "module_viewer.edc"
#include "module_icon.edc"
}

View File

@ -0,0 +1,16 @@
/* Feed group */
group
{
name: "modules/news/feed";
parts
{
#include "module_feed_parts.edc"
}
programs
{
#include "module_feed_programs.edc"
}
}

View File

@ -0,0 +1,155 @@
part
{
name: "background";
type: IMAGE;
mouse_events: 0;
description
{
state: "default" 0.0;
color: 255 255 255 0;
rel1
{
relative: 0.0 0.0;
}
rel2
{
relative: 1.0 1.0;
}
image
{
normal: "feed_background_new.png";
}
}
description
{
state: "new" 0.0;
inherit: "default" 0.0;
color: 255 255 255 255;
}
}
part
{
name: "border";
type: IMAGE;
mouse_events: 0;
description
{
state: "default" 0.0;
visible: 0;
color: 255 255 255 0;
rel1
{
relative: 0.0 0.0;
}
rel2
{
relative: 1.0 1.0;
}
image
{
normal: "feed_border.png";
}
}
description
{
state: "selected" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
}
}
part
{
name: "icon";
type: SWALLOW;
mouse_events: 0;
description
{
state: "default" 0.0;
visible: 1;
align: 0.0 0.5;
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
rel1
{
relative: 0.0 0.0;
offset: 3 3;
}
rel2
{
relative: 1.0 1.0;
offset: -3 -3;
}
}
}
part
{
name: "name";
type: TEXT;
mouse_events: 0;
effect: OUTLINE_SOFT_SHADOW;
description
{
state: "default" 0.0;
visible: 0;
rel1
{
relative: 0.5 1.0;
offset: 0 0;
}
rel2
{
relative: 0.5 1.0;
}
text
{
text: "o Ooo Ooo";
font: "Vera";
align: 0.0 0.5;
fit: 0 1;
}
}
description
{
state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
rel1
{
relative: 0.5 0.5;
}
rel2
{
relative: 0.5 0.5;
}
}
}
/* Inout */
part
{
name: "inout";
type: RECT;
mouse_events: 1;
description
{
state: "default" 0.0;
color: 255 255 255 0;
rel1
{
relative: 0.0 0.0;
to: "icon";
}
rel2
{
relative: 1.0 1.0;
to: "icon";
}
}
}

View File

@ -0,0 +1,61 @@
/* Init */
program
{
name: "init";
signal: "load";
source: "";
script
{
}
}
/* Signals for new state */
program
{
name: "new_set";
signal: "e,state,new,set";
source: "e";
action: STATE_SET "new" 0.0;
target: "background";
transition: SINUSOIDAL 0.5;
}
program
{
name: "new_unset";
signal: "e,state,new,unset";
source: "e";
action: STATE_SET "default" 0.0;
target: "background";
transition: SINUSOIDAL 0.5;
}
/* Mouse in/out */
program
{
name: "mouse_in";
signal: "mouse,in";
source: "inout";
action: STATE_SET "selected" 0.0;
target: "border";
}
program
{
name: "mouse_out";
signal: "mouse,out";
source: "inout";
action: STATE_SET "default" 0.0;
target: "border";
}
program
{
name: "mouse_down";
signal: "mouse,down,1";
source: "inout";
action: SIGNAL_EMIT "e,action,open" "e";
}

View File

@ -0,0 +1,16 @@
/* Feedone group */
group
{
name: "modules/news/feedone";
parts
{
#include "module_feedone_parts.edc"
}
programs
{
#include "module_feedone_programs.edc"
}
}

View File

@ -0,0 +1,143 @@
part
{
name: "background";
type: IMAGE;
mouse_events: 0;
description
{
state: "default" 0.0;
color: 255 255 255 0;
rel1
{
relative: 0.0 0.0;
}
rel2
{
relative: 1.0 1.0;
}
image
{
normal: "feed_background_new.png";
}
}
description
{
state: "new" 0.0;
inherit: "default" 0.0;
color: 255 255 255 255;
}
}
part
{
name: "border";
type: IMAGE;
mouse_events: 0;
description
{
state: "default" 0.0;
visible: 0;
color: 255 255 255 0;
rel1
{
relative: 0.0 0.0;
}
rel2
{
relative: 1.0 1.0;
}
image
{
normal: "feed_border.png";
}
}
description
{
state: "selected" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
}
}
part
{
name: "icon";
type: IMAGE;
mouse_events: 0;
description
{
state: "default" 0.0;
aspect: 1.0 1.0;
rel1
{
relative: 0.1 0.1;
}
rel2
{
relative: 0.9 0.9;
}
image
{
normal: "icon_logo.png";
}
}
}
part
{
name: "name";
type: TEXT;
mouse_events: 0;
effect: OUTLINE_SOFT_SHADOW;
description
{
state: "default" 0.0;
visible: 0;
rel1
{
relative: 0.5 1.0;
offset: 0 0;
}
rel2
{
relative: 0.5 1.0;
}
text
{
text: "o Ooo Ooo";
font: "Vera";
align: 0.0 0.5;
fit: 0 1;
}
}
description
{
state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
rel1
{
relative: 0.5 0.5;
}
rel2
{
relative: 0.5 0.5;
}
}
}
/* Inout */
part
{
name: "inout";
type: RECT;
mouse_events: 1;
description
{
state: "default" 0.0;
color: 255 255 255 0;
}
}

View File

@ -0,0 +1,61 @@
/* Init */
program
{
name: "init";
signal: "load";
source: "";
script
{
}
}
/* Signals for new state */
program
{
name: "new_set";
signal: "e,state,new,set";
source: "e";
action: STATE_SET "new" 0.0;
target: "background";
transition: SINUSOIDAL 0.5;
}
program
{
name: "new_unset";
signal: "e,state,new,unset";
source: "e";
action: STATE_SET "default" 0.0;
target: "background";
transition: SINUSOIDAL 0.5;
}
/* Mouse in/out */
program
{
name: "mouse_in";
signal: "mouse,in";
source: "inout";
action: STATE_SET "selected" 0.0;
target: "border";
}
program
{
name: "mouse_out";
signal: "mouse,out";
source: "inout";
action: STATE_SET "default" 0.0;
target: "border";
}
program
{
name: "mouse_down";
signal: "mouse,down,1";
source: "inout";
action: SIGNAL_EMIT "open" "feed";
}

169
data/theme/module_icon.edc Normal file
View File

@ -0,0 +1,169 @@
/* Icon group */
group
{
name: "icon";
parts
{
part
{
name: "icon";
type: IMAGE;
mouse_events: 0;
description
{
state: "default" 0.0;
aspect: 1.0 1.0;
image
{
normal: "icon_logo.png";
}
}
}
}
}
group
{
name: "modules/news/icon/infos";
parts
{
part
{
name: "icon";
type: IMAGE;
mouse_events: 0;
description
{
state: "default" 0.0;
aspect: 1.0 1.0;
image
{
normal: "icon_infos.png";
}
}
}
}
}
group
{
name: "modules/news/icon/viewer";
parts
{
part
{
name: "icon";
type: IMAGE;
mouse_events: 0;
description
{
state: "default" 0.0;
aspect: 1.0 1.0;
image
{
normal: "icon_viewer.png";
}
}
}
}
}
group
{
name: "modules/news/icon/article_read";
parts
{
part
{
name: "icon";
type: IMAGE;
mouse_events: 0;
description
{
state: "default" 0.0;
aspect: 1.0 1.0;
image
{
normal: "icon_article_read.png";
}
}
}
}
}
group
{
name: "modules/news/icon/article_unread";
parts
{
part
{
name: "icon";
type: IMAGE;
mouse_events: 0;
description
{
state: "default" 0.0;
aspect: 1.0 1.0;
image
{
normal: "icon_article_unread.png";
}
}
}
}
}
group
{
name: "modules/news/icon/update";
parts
{
part
{
name: "icon";
type: IMAGE;
mouse_events: 0;
description
{
state: "default" 0.0;
aspect: 1.0 1.0;
image
{
normal: "icon_update.png";
}
}
}
}
}
group
{
name: "modules/news/icon/setasread";
parts
{
part
{
name: "icon";
type: IMAGE;
mouse_events: 0;
description
{
state: "default" 0.0;
aspect: 1.0 1.0;
image
{
normal: "icon_setasread.png";
}
}
}
}
}

View File

@ -0,0 +1,21 @@
/* Item group */
group
{
name: "modules/news/item";
script
{
}
parts
{
#include "module_item_parts.edc"
}
programs
{
#include "module_item_programs.edc"
}
}

View File

@ -0,0 +1,42 @@
/* Ground */
part
{
name: "ground";
type: RECT;
mouse_events: 1;
description
{
state: "default" 0.0;
color: 0 0 0 0;
rel1
{
relative: 0.0 0.0;
}
rel2
{
relative: 1.0 1.0;
}
}
}
part
{
name: "view";
type: SWALLOW;
mouse_events: 1;
description
{
state: "default" 0.0;
rel1
{
relative: 0.0 0.0;
to: "ground";
}
rel2
{
relative: 1.0 1.0;
to: "ground";
}
}
}

View File

@ -0,0 +1,12 @@
/* Init */
program
{
name: "init";
signal: "load";
source: "";
script
{
}
}

View File

@ -0,0 +1,52 @@
/* Popup warn group */
#define POPUP_WARN_TYPE_INFO 0
#define POPUP_WARN_TYPE_ERROR 1
#define MSG_RECV_POPUP_WARN_TYPE 1
group
{
name: "modules/news/popw";
script
{
public show_disabled;
public popup_type;
public popup_in_update;
/* Message from C code */
public message(Msg_Type: type, id, msg)
{
if (id == MSG_RECV_POPUP_WARN_TYPE){
if (type == MSG_INT){
set_int(popup_type, getarg(2));
if (get_int(popup_type) == POPUP_WARN_TYPE_INFO)
{
if (get_int(popup_in_update))
run_program(PROGRAM:"update_anim_info");
else
set_state(PART:"logo", "default", 0.0);
}
if (get_int(popup_type) == POPUP_WARN_TYPE_ERROR)
{
if (get_int(popup_in_update))
run_program(PROGRAM:"update_anim_error");
else
set_state(PART:"logo", "error", 0.0);
}
}
}
}
}
parts
{
#include "module_popw_parts.edc"
}
programs
{
#include "module_popw_programs.edc"
}
}

View File

@ -0,0 +1,218 @@
part
{
name: "background";
type: IMAGE;
mouse_events: 1;
description
{
state: "default" 0.0;
min: 60 120;
rel1
{
relative: 0.0 0.0;
}
rel2
{
relative: 1.0 1.0;
}
image
{
normal: "popup_warn_background.png";
border: 5 5 5 5;
}
}
}
part
{
name: "logo";
type: IMAGE;
mouse_events: 0;
description
{
state: "default" 0.0;
color: 255 255 255 255;
aspect: 1 1;
rel1
{
relative: 0.1 0.0;
to_x: "background";
offset: 0 18;
}
rel2
{
relative: 0.9 0.0;
to_x: "background";
offset: 0 78;
}
image
{
normal: "popup_warn_logo_info.png";
}
}
description{
state: "error" 0.0;
inherit: "default" 0.0;
image{
normal: "popup_warn_logo_error.png";
}
}
description{
state: "info_hidden" 0.0;
inherit: "default" 0.0;
color: 255 255 255 0;
image{
normal: "popup_warn_logo_info.png";
}
}
description{
state: "error_hidden" 0.0;
inherit: "default" 0.0;
color: 255 255 255 0;
image{
normal: "popup_warn_logo_error.png";
}
}
}
part
{
name: "name";
type: TEXT;
mouse_events: 0;
description
{
state: "default" 0.0;
rel1
{
relative: 0.0 1.0;
to_x: "background";
to_y: "logo";
offset: 6 0;
}
color: 0 0 0 255;
color2: 0 0 0 255;
color3: 255 255 255 255;
text
{
text: "Rss module";
font: "Vera";
size: 11;
align: 0.5 0.0;
}
}
}
part
{
name: "text";
type: TEXT;
mouse_events: 0;
description
{
state: "default" 0.0;
rel1
{
relative: 0.0 0.8;
to: "background";
offset: 0 10;
}
rel2
{
relative: 1.0 0.8;
to: "background";
offset: 0 10;
}
color: 0 0 0 255;
color2: 0 0 0 255;
color3: 255 255 255 255;
text
{
text: "ooOoOo";
font: "VeraBd";
size: 11;
min: 1 1;
align: 0.5 0.0;
}
}
}
part
{
name: "text_border";
type: RECT;
mouse_events: 0;
description
{
state: "default" 0.0;
color: 255 255 255 0;
rel1
{
relative: 0.0 0.0;
to: "text";
offset: -10 0;
}
rel2
{
relative: 1.0 1.0;
to: "text";
offset: 10 0;
}
}
}
part
{
name: "disable";
type: IMAGE;
mouse_events: 1;
description
{
state: "default" 0.0;
visible: 0;
image
{
normal: "popup_warn_disable.png";
}
}
description
{
state: "visible" 0.0;
inherit: "default" 0.0;
color: 255 255 255 255;
visible: 1;
aspect: 1 1;
rel1
{
relative: 1.0 0.0;
to: "background";
offset: -32 8;
}
rel2
{
relative: 1.0 0.0;
to: "background";
offset: -12 28;
}
}
description
{
state: "clicked" 0.0;
inherit: "visible" 0.0;
visible: 1;
rel1
{
relative: 0.0 0.0;
offset: 10 10;
}
rel2
{
relative: 1.0 1.0;
offset: 0 0;
}
image
{
normal: "popup_warn_disable_clicked.png";
}
}
}

View File

@ -0,0 +1,96 @@
program{
name: "init";
signal: "load";
source: "";
script{
set_int(popup_type, POPUP_WARN_TYPE_INFO);
set_int(popup_in_update, 0);
}
}
program
{
name: "disable_click";
signal: "mouse,up,1";
source: "disable";
script
{
emit("desactivate", "popup");
}
after: "disable_click_1";
}
program
{
name: "disable_click_1";
action: STATE_SET "clicked" 0.0;
transition: DECELERATE 1.5;
target: "disable";
after: "close_click";
}
program
{
name: "close_click";
signal: "mouse,up,1";
source: "background";
script
{
emit("close", "popup");
}
}
program{
name: "update_anim";
signal: "update";
source: "devian";
script{
if (get_int(popup_in_update) == 0)
{
set_int(popup_in_update, 1);
if (get_int(popup_type) == POPUP_WARN_TYPE_INFO)
run_program(PROGRAM:"update_anim_info");
if (get_int(popup_type) == POPUP_WARN_TYPE_ERROR)
run_program(PROGRAM:"update_anim_error");
}
}
}
program{
name: "update_anim_info";
action: STATE_SET "info_hidden" 0.0;
transition: DECELERATE 1;
target: "logo";
after: "update_anim_info_1";
after: "update_anim_end";
}
program{
name: "update_anim_info_1";
action: STATE_SET "default" 0.0;
transition: DECELERATE 1;
target: "logo";
}
program{
name: "update_anim_error";
action: STATE_SET "error_hidden" 0.0;
transition: DECELERATE 1;
target: "logo";
after: "update_anim_error_1";
after: "update_anim_end";
}
program{
name: "update_anim_error_1";
action: STATE_SET "error" 0.0;
transition: DECELERATE 1;
target: "logo";
}
program{
name: "update_anim_end";
script{
set_int(popup_in_update, 0);
}
}

View File

@ -0,0 +1,21 @@
/* Viewer group */
group
{
name: "modules/news/viewer";
data
{
item: "shaped" "1";
}
parts
{
#include "module_viewer_parts.edc"
}
programs
{
#include "module_viewer_programs.edc"
}
}

View File

@ -0,0 +1,49 @@
part {
name: "border";
type: RECT;
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
offset: 0 0;
}
rel2 {
offset: -1 -1;
}
color: 0 0 0 255;
}
}
part {
name: "base";
type: RECT;
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
offset: 1 1;
to: "border";
}
rel2 {
offset: -2 -2;
to: "border";
}
color: 221 221 221 255;
}
}
part {
name: "e.swallow.content";
type: SWALLOW;
description {
state: "default" 0.0;
align: 0.5 0.5;
color: 0 0 0 0;
rel1 {
offset: 5 5;
to: "base";
}
rel2 {
offset: -6 -6;
to: "base";
}
}
}

View File

@ -0,0 +1,10 @@
program
{
name: "click_close";
signal: "mouse,up,1";
source: "base";
script
{
emit("close", "viewer");
}
}

50
e_modules-news.spec.in Normal file
View File

@ -0,0 +1,50 @@
%define module_name news
Summary: %{module_name} module for the Enlightenment window manager
Name: e_modules-%{module_name}
Version: @VERSION@
Release: 0.%(date '+%Y%m%d')
License: BSD
Group: User Interface/Desktops
URL: http://www.enlightenment.org/
Source: ftp://ftp.enlightenment.org/pub/enlightenment/%{module_name}-%{version}.tar.gz
Packager: %{?_packager:%{_packager}}%{!?_packager:Michael Jennings <mej@eterm.org>}
Vendor: %{?_vendorinfo:%{_vendorinfo}}%{!?_vendorinfo:The Enlightenment Project (http://www.enlightenment.org/)}
Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}}
BuildRequires: ecore-devel, evas-devel, esmart-devel, edje-bin
BuildRequires: edje-devel, eet-devel, enlightenment-devel >= 0.16.999
Requires: enlightenment >= 0.16.999
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
%{module_name} module for the Enlightenment window manager.
%prep
%setup -q -n %{module_name}-%{version}
%build
%{configure}
%{__make} %{?_smp_mflags} %{?mflags}
%install
%{__make} %{?mflags_install} DESTDIR=$RPM_BUILD_ROOT install
%{find_lang} %{module_name} || true > %{module_name}.lang
%clean
test "x$RPM_BUILD_ROOT" != "x/" && rm -rf $RPM_BUILD_ROOT
%post
/sbin/ldconfig
%postun
/sbin/ldconfig
%files -f %{module_name}.lang
%defattr(-, root, root)
%doc AUTHORS ChangeLog COPYING* INSTALL NEWS README
if "%{module_name}" == "emu"
%{_bindir}/%{module_name}*
endif
%{_libdir}/enlightenment/modules/%{module_name}*
%changelog

138
m4/ac_path_generic.m4 Normal file
View File

@ -0,0 +1,138 @@
dnl @synopsis AC_PATH_GENERIC(LIBRARY [, MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl
dnl Runs a LIBRARY-config script and defines LIBRARY_CFLAGS and LIBRARY_LIBS
dnl
dnl The script must support `--cflags' and `--libs' args.
dnl If MINIMUM-VERSION is specified, the script must also support the
dnl `--version' arg.
dnl If the `--with-library-[exec-]prefix' arguments to ./configure are given,
dnl it must also support `--prefix' and `--exec-prefix'.
dnl (In other words, it must be like gtk-config.)
dnl
dnl For example:
dnl
dnl AC_PATH_GENERIC(Foo, 1.0.0)
dnl
dnl would run `foo-config --version' and check that it is at least 1.0.0
dnl
dnl If so, the following would then be defined:
dnl
dnl FOO_CFLAGS to `foo-config --cflags`
dnl FOO_LIBS to `foo-config --libs`
dnl
dnl At present there is no support for additional "MODULES" (see AM_PATH_GTK)
dnl (shamelessly stolen from gtk.m4 and then hacked around a fair amount)
dnl
dnl @author Angus Lees <gusl@cse.unsw.edu.au>
AC_DEFUN([AC_PATH_GENERIC],
[dnl
dnl we're going to need uppercase, lowercase and user-friendly versions of the
dnl string `LIBRARY'
pushdef([UP], translit([$1], [a-z], [A-Z]))dnl
pushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl
dnl
dnl Get the cflags and libraries from the LIBRARY-config script
dnl
AC_ARG_WITH(DOWN-prefix,
[ --with-]DOWN[-prefix=PFX Prefix where $1 is installed (optional)],
DOWN[]_config_prefix="$withval", DOWN[]_config_prefix="")
AC_ARG_WITH(DOWN-exec-prefix,
[ --with-]DOWN[-exec-prefix=PFX Exec prefix where $1 is installed (optional)],
DOWN[]_config_exec_prefix="$withval", DOWN[]_config_exec_prefix="")
if test x$DOWN[]_config_exec_prefix != x ; then
DOWN[]_config_args="$DOWN[]_config_args --exec-prefix=$DOWN[]_config_exec_prefix"
if test x${UP[]_CONFIG+set} != xset ; then
UP[]_CONFIG=$DOWN[]_config_exec_prefix/bin/DOWN-config
fi
fi
if test x$DOWN[]_config_prefix != x ; then
DOWN[]_config_args="$DOWN[]_config_args --prefix=$DOWN[]_config_prefix"
if test x${UP[]_CONFIG+set} != xset ; then
UP[]_CONFIG=$DOWN[]_config_prefix/bin/DOWN-config
fi
fi
AC_PATH_PROG(UP[]_CONFIG, DOWN-config, no)
ifelse([$2], ,
AC_MSG_CHECKING(for $1),
AC_MSG_CHECKING(for $1 - version >= $2)
)
no_[]DOWN=""
if test "$UP[]_CONFIG" = "no" ; then
no_[]DOWN=yes
else
UP[]_CFLAGS="`$UP[]_CONFIG $DOWN[]_config_args --cflags`"
UP[]_LIBS="`$UP[]_CONFIG $DOWN[]_config_args --libs`"
ifelse([$2], , ,[
DOWN[]_config_major_version=`$UP[]_CONFIG $DOWN[]_config_args \
--version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\1/'`
DOWN[]_config_minor_version=`$UP[]_CONFIG $DOWN[]_config_args \
--version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\2/'`
DOWN[]_config_micro_version=`$UP[]_CONFIG $DOWN[]_config_args \
--version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\3/'`
DOWN[]_wanted_major_version="regexp($2, [\<\([0-9]*\)], [\1])"
DOWN[]_wanted_minor_version="regexp($2, [\<\([0-9]*\)\.\([0-9]*\)], [\2])"
DOWN[]_wanted_micro_version="regexp($2, [\<\([0-9]*\).\([0-9]*\).\([0-9]*\)], [\3])"
# Compare wanted version to what config script returned.
# If I knew what library was being run, i'd probably also compile
# a test program at this point (which also extracted and tested
# the version in some library-specific way)
if test "$DOWN[]_config_major_version" -lt \
"$DOWN[]_wanted_major_version" \
-o \( "$DOWN[]_config_major_version" -eq \
"$DOWN[]_wanted_major_version" \
-a "$DOWN[]_config_minor_version" -lt \
"$DOWN[]_wanted_minor_version" \) \
-o \( "$DOWN[]_config_major_version" -eq \
"$DOWN[]_wanted_major_version" \
-a "$DOWN[]_config_minor_version" -eq \
"$DOWN[]_wanted_minor_version" \
-a "$DOWN[]_config_micro_version" -lt \
"$DOWN[]_wanted_micro_version" \) ; then
# older version found
no_[]DOWN=yes
echo -n "*** An old version of $1 "
echo -n "($DOWN[]_config_major_version"
echo -n ".$DOWN[]_config_minor_version"
echo ".$DOWN[]_config_micro_version) was found."
echo -n "*** You need a version of $1 newer than "
echo -n "$DOWN[]_wanted_major_version"
echo -n ".$DOWN[]_wanted_minor_version"
echo ".$DOWN[]_wanted_micro_version."
echo "***"
echo "*** If you have already installed a sufficiently new version, this error"
echo "*** probably means that the wrong copy of the DOWN-config shell script is"
echo "*** being found. The easiest way to fix this is to remove the old version"
echo "*** of $1, but you can also set the UP[]_CONFIG environment to point to the"
echo "*** correct copy of DOWN-config. (In this case, you will have to"
echo "*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf"
echo "*** so that the correct libraries are found at run-time)"
fi
])
fi
if test "x$no_[]DOWN" = x ; then
AC_MSG_RESULT(yes)
ifelse([$3], , :, [$3])
else
AC_MSG_RESULT(no)
if test "$UP[]_CONFIG" = "no" ; then
echo "*** The DOWN-config script installed by $1 could not be found"
echo "*** If $1 was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the UP[]_CONFIG environment variable to the"
echo "*** full path to DOWN-config."
fi
UP[]_CFLAGS=""
UP[]_LIBS=""
ifelse([$4], , :, [$4])
fi
AC_SUBST(UP[]_CFLAGS)
AC_SUBST(UP[]_LIBS)
popdef([UP])
popdef([DOWN])
])

4
module.desktop.in Normal file
View File

@ -0,0 +1,4 @@
[Desktop Entry]
Type=Link
Name=News
Icon=e-module-news

BIN
module.edj Normal file

Binary file not shown.

2
src/Makefile.am Normal file
View File

@ -0,0 +1,2 @@
MAINTAINERCLEANFILES = Makefile.in
SUBDIRS = module

51
src/module/Makefile.am Normal file
View File

@ -0,0 +1,51 @@
INCLUDES = -I. \
-I$(top_srcdir) \
-I$(includedir) \
@e_cflags@
pkgdir = $(datadir)/$(MODULE_ARCH)
pkg_LTLIBRARIES = module.la
module_la_SOURCES = e_mod_main.c \
e_mod_main.h \
news_config.c \
news_config_dialog.c \
news_config_dialog.h \
news_config_dialog_feeds.c \
news_config_dialog_feeds.h \
news_config_dialog_item.c \
news_config_dialog_item.h \
news_config_dialog_item_content.c \
news_config_dialog_item_content.h \
news_config_dialog_feed.c \
news_config_dialog_feed.h \
news_config_dialog_category.c \
news_config_dialog_category.h \
news_config_dialog_langs.c \
news_config_dialog_langs.h \
news_config.h \
news_feed.c \
news_feed.h \
news_item.c \
news_item.h \
news_menu.c \
news_menu.h \
news_parse.c \
news_parse.h \
news_parse_private.h \
news_parse_atom.c \
news_parse_atom.h \
news_parse_rss.c \
news_parse_rss.h \
news_popup_warn.c \
news_popup_warn.h \
news_theme.c \
news_theme.h \
news_utils.c \
news_utils.h \
news_viewer.c \
news_viewer.h \
News.h \
News_includes.h
module_la_LIBADD = @e_libs@
module_la_LDFLAGS = -module -avoid-version -s
module_la_DEPENDENCIES = $(top_builddir)/config.h

61
src/module/News.h Normal file
View File

@ -0,0 +1,61 @@
#ifndef NEWS_H
#define NEWS_H
/* Enlightenment includes */
#include <config.h>
#include <e.h>
/* News includes */
#define E_MOD_NEWS_TYPEDEFS 1
#include "News_includes.h"
#undef E_MOD_NEWS_TYPEDEFS
#include "News_includes.h"
/* Debugging things */
#ifdef DEBUG
# define DD(x) do {printf("DD - %s:%d: ", __FILE__, __LINE__); printf x; printf("\n"); fflush(stdout);} while (0)
#else
# define DD(x) ((void) 0)
#endif
#ifdef DEBUG_MAIN
# define DMAIN(x) do {printf("MAIN - %s:%d: ", __FILE__, __LINE__); printf x; printf("\n"); fflush(stdout);} while (0)
#else
# define DMAIN(x) ((void) 0)
#endif
#ifdef DEBUG_CONFIG
# define DCONF(x) do {printf("CONFIG - %s:%d: ", __FILE__, __LINE__); printf x; printf ("\n"); fflush(stdout);} while (0)
#else
# define DCONF(x) ((void) 0)
#endif
#ifdef DEBUG_ITEM
# define DITEM(x) do {printf("ITEM - %s:%d: ", __FILE__, __LINE__); printf x; printf ("\n"); fflush(stdout);} while (0)
#else
# define DITEM(x) ((void) 0)
#endif
#ifdef DEBUG_FEED
# define DFEED(x) do {printf("FEED - %s:%d: ", __FILE__, __LINE__); printf x; printf ("\n"); fflush(stdout);} while (0)
#else
# define DFEED(x) ((void) 0)
#endif
#ifdef DEBUG_PARSE
# define DPARSE(x) do {printf("PARSE - %s:%d: ", __FILE__, __LINE__); printf x; printf ("\n"); fflush(stdout);} while (0)
#else
# define DPARSE(x) ((void) 0)
#endif
#ifdef DEBUG_BROWSER
# define DBROWSER(x) do {printf("BROWSER - %s:%d: ", __FILE__, __LINE__); printf x; printf ("\n"); fflush(stdout);} while (0)
#else
# define DBROWSER(x) ((void) 0)
#endif
#ifdef DEBUG_POPUP_WARN
# define DPOPW(x) do {printf("POPUP WARN - %s:%d: ", __FILE__, __LINE__); printf x; printf ("\n"); fflush(stdout);} while (0)
#else
# define DPOPW(x) ((void) 0)
#endif
#ifdef DEBUG_VIEWER
# define DVIEWER(x) do {printf("VIEWER - %s:%d: ", __FILE__, __LINE__); printf x; printf ("\n"); fflush(stdout);} while (0)
#else
# define DVIEWER(x) ((void) 0)
#endif
#endif

View File

@ -0,0 +1,20 @@
#include "e_mod_main.h"
#include "news_item.h"
#include "news_feed.h"
#include "news_parse.h"
#include "news_parse_rss.h"
#include "news_parse_atom.h"
#include "news_viewer.h"
#include "news_popup_warn.h"
#include "news_menu.h"
#include "news_config.h"
#include "news_config_dialog.h"
#include "news_config_dialog_feeds.h"
#include "news_config_dialog_item.h"
#include "news_config_dialog_item_content.h"
#include "news_config_dialog_feed.h"
#include "news_config_dialog_category.h"
#include "news_config_dialog_langs.h"
#include "news_theme.h"
#include "news_utils.h"

233
src/module/e_mod_main.c Normal file
View File

@ -0,0 +1,233 @@
#include "News.h"
#define E_MOD_INIT_FAIL(m, msg) \
{ \
news_util_message_error_show(msg); \
e_modapi_shutdown(m); \
return NULL; \
}
/* module requirements */
EAPI E_Module_Api e_modapi =
{
E_MODULE_API_VERSION,
"News"
};
/* gadcon requirements */
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
static void _gc_shutdown(E_Gadcon_Client *gcc);
static void _gc_orient(E_Gadcon_Client *gcc);
static char *_gc_label(void);
static Evas_Object *_gc_icon(Evas *evas);
static const E_Gadcon_Client_Class _gadcon_class =
{
GADCON_CLIENT_CLASS_VERSION,
"news",
{
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon
},
E_GADCON_CLIENT_STYLE_INSET
};
/*
* Module functions
*/
EAPI void *
e_modapi_init(E_Module *m)
{
news = E_NEW(News, 1);
news->module = m;
DMAIN(("Initialisation ..."));
if (!news_config_init()) E_MOD_INIT_FAIL(m, _("Config init failed"));
if (!news_theme_init()) E_MOD_INIT_FAIL(m, _("Theme init failed"));
if (!news_parse_init()) E_MOD_INIT_FAIL(m, _("Parser init failed"));
if (!news_feed_init()) E_MOD_INIT_FAIL(m, _("Feeds init failed"));
if (!news_viewer_init()) E_MOD_INIT_FAIL(m, _("Viewer init failed"));
if (!news_popup_warn_init()) E_MOD_INIT_FAIL(m, _("Popup warn subsystem init failed"));
e_gadcon_provider_register((E_Gadcon_Client_Class *)&_gadcon_class);
DMAIN(("Initialisation END"));
return m;
}
EAPI int
e_modapi_shutdown(E_Module *m)
{
if (!news) return 0;
DMAIN(("Shutdown"));
e_gadcon_provider_unregister((E_Gadcon_Client_Class *)&_gadcon_class);
if (news->config_dialog)
news_config_dialog_hide();
if (news->config_dialog_feeds)
news_config_dialog_feeds_hide();
if (news->config_dialog_langs)
news_config_dialog_langs_hide();
if (news->config_dialog_feed_new)
news_config_dialog_feed_hide(NULL);
if (news->config_dialog_category_new)
news_config_dialog_category_hide(NULL);
news_popup_warn_shutdown();
news_viewer_shutdown();
news_feed_shutdown();
news_parse_shutdown();
news_theme_shutdown();
news_config_shutdown();
free(news);
return 1;
}
EAPI int
e_modapi_save(E_Module *m)
{
int ret;
if (!news) return 0;
DMAIN(("Save"));
ret = news_config_save();
return ret;
}
EAPI int
e_modapi_about(E_Module *m)
{
news_util_message_show(_("Module to display information feeds<br>"
"like Rss or Atom, on youre desktop<br><br>"
"ooookiwi@gmail.com<br>"
"http://oooo.zapto.org"));
return 1;
}
EAPI int
e_modapi_config(E_Module *m)
{
int ret;
if (!news) return 0;
ret = news_config_dialog_show();
return ret;
}
/*
* Gadcon functions
*/
static E_Gadcon_Client *
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
{
Evas_Object *o;
E_Gadcon_Client *gcc;
News_Item *ni;
DMAIN(("GCC init"));
o = edje_object_add(gc->evas);
gcc = e_gadcon_client_new(gc, name, id, style, o);
ni = news_item_new(gcc, o);
gcc->data = ni;
news->items = evas_list_append(news->items, ni);
return ni->gcc;
}
static void
_gc_shutdown(E_Gadcon_Client *gcc)
{
News_Item *ni;
ni = gcc->data;
DMAIN(("GCC shutdown"));
news->items = evas_list_remove(news->items, ni);
news_item_free(ni);
}
static void
_gc_orient(E_Gadcon_Client *gcc)
{
News_Item *ni;
int nb_feeds;
int gc_min_w = 16;
int gc_min_h = 16;
int gc_aspect_w = 16;
int gc_aspect_h = 16;
int gc_orient_horiz = 0;
ni = gcc->data;
switch (ni->config->view_mode)
{
case NEWS_ITEM_VIEW_MODE_ONE:
nb_feeds = 1;
break;
case NEWS_ITEM_VIEW_MODE_FEED:
nb_feeds = evas_list_count(ni->config->feed_refs);
if (!nb_feeds) nb_feeds = 1;
break;
case NEWS_ITEM_VIEW_MODE_FEED_UNREAD:
nb_feeds = ni->unread_count;
if (!nb_feeds) nb_feeds = 1;
break;
}
switch (gcc->gadcon->orient)
{
case E_GADCON_ORIENT_FLOAT:
case E_GADCON_ORIENT_HORIZ:
case E_GADCON_ORIENT_TOP:
case E_GADCON_ORIENT_BOTTOM:
case E_GADCON_ORIENT_CORNER_TL:
case E_GADCON_ORIENT_CORNER_TR:
case E_GADCON_ORIENT_CORNER_BL:
case E_GADCON_ORIENT_CORNER_BR:
gc_aspect_w = nb_feeds*16;
gc_orient_horiz = 1;
break;
case E_GADCON_ORIENT_VERT:
case E_GADCON_ORIENT_LEFT:
case E_GADCON_ORIENT_RIGHT:
case E_GADCON_ORIENT_CORNER_LT:
case E_GADCON_ORIENT_CORNER_RT:
case E_GADCON_ORIENT_CORNER_LB:
case E_GADCON_ORIENT_CORNER_RB:
gc_aspect_h = nb_feeds*16;
break;
default:
break;
}
e_gadcon_client_aspect_set(gcc, gc_aspect_w, gc_aspect_h);
e_gadcon_client_min_size_set(gcc, gc_min_w, gc_min_h);
news_item_orient_set(ni, gc_orient_horiz);
}
static char *
_gc_label(void)
{
return _("News");
}
static Evas_Object *
_gc_icon(Evas *evas)
{
Evas_Object *o;
o = edje_object_add(evas);
edje_object_file_set(o, news->theme, "icon");
return o;
}

40
src/module/e_mod_main.h Normal file
View File

@ -0,0 +1,40 @@
#ifdef E_MOD_NEWS_TYPEDEFS
typedef struct _News News;
#else
#ifndef E_MOD_MAIN_H_INCLUDED
#define E_MOD_MAIN_H_INCLUDED
struct _News
{
E_Module *module;
char *theme;
News_Config *config;
E_Config_Dialog *config_dialog;
E_Config_Dialog *config_dialog_feeds;
E_Config_Dialog *config_dialog_feed_new;
E_Config_Dialog *config_dialog_category_new;
E_Config_Dialog *config_dialog_langs;
Evas_List *items;
Evas_List *langs;
Ecore_Timer *feeds_timer;
};
News *news;
EAPI extern E_Module_Api e_modapi;
EAPI void *e_modapi_init(E_Module *m);
EAPI int e_modapi_shutdown(E_Module *m);
EAPI int e_modapi_save(E_Module *m);
EAPI int e_modapi_info(E_Module *m);
EAPI int e_modapi_about(E_Module *m);
EAPI int e_modapi_config(E_Module *m);
#endif
#endif

270
src/module/news_config.c Normal file
View File

@ -0,0 +1,270 @@
#include "News.h"
static E_Config_DD *_news_edd = NULL;
static E_Config_DD *_news_feed_edd = NULL;
static E_Config_DD *_news_feed_ref_edd = NULL;
static E_Config_DD *_news_feed_category_edd = NULL;
static E_Config_DD *_news_feed_lang_edd = NULL;
static E_Config_DD *_news_item_edd = NULL;
/*
* Public functions
*/
int
news_config_init(void)
{
_news_feed_edd = E_CONFIG_DD_NEW("News_Feed", News_Feed);
#undef T
#undef D
#define T News_Feed
#define D _news_feed_edd
E_CONFIG_VAL(D, T, name, STR);
E_CONFIG_VAL(D, T, name_ovrw, SHORT);
E_CONFIG_VAL(D, T, language, STR);
E_CONFIG_VAL(D, T, language_ovrw, SHORT);
E_CONFIG_VAL(D, T, description, STR);
E_CONFIG_VAL(D, T, description_ovrw, SHORT);
E_CONFIG_VAL(D, T, url_home, STR);
E_CONFIG_VAL(D, T, url_home_ovrw, SHORT);
E_CONFIG_VAL(D, T, url_feed, STR);
E_CONFIG_VAL(D, T, icon, STR);
E_CONFIG_VAL(D, T, icon_ovrw, SHORT);
E_CONFIG_VAL(D, T, urgent, SHORT);
_news_feed_ref_edd = E_CONFIG_DD_NEW("News_Feed_Ref", News_Feed_Ref);
#undef T
#undef D
#define T News_Feed_Ref
#define D _news_feed_ref_edd
E_CONFIG_VAL(D, T, category, STR);
E_CONFIG_VAL(D, T, name, STR);
_news_feed_category_edd = E_CONFIG_DD_NEW("News_Feed_Category", News_Feed_Category);
#undef T
#undef D
#define T News_Feed_Category
#define D _news_feed_category_edd
E_CONFIG_VAL(D, T, name, STR);
E_CONFIG_VAL(D, T, icon, STR);
E_CONFIG_LIST(D, T, feeds, _news_feed_edd);
_news_feed_lang_edd = E_CONFIG_DD_NEW("News_Feed_Lang", News_Feed_Lang);
#undef T
#undef D
#define T News_Feed_Lang
#define D _news_feed_lang_edd
E_CONFIG_VAL(D, T, key, STR);
E_CONFIG_VAL(D, T, name, STR);
_news_item_edd = E_CONFIG_DD_NEW("News_Item", News_Config_Item);
#undef T
#undef D
#define T News_Config_Item
#define D _news_item_edd
E_CONFIG_VAL(D, T, id, STR);
E_CONFIG_LIST(D, T, feed_refs, _news_feed_ref_edd);
E_CONFIG_VAL(D, T, view_mode, SHORT);
E_CONFIG_VAL(D, T, openmethod, SHORT);
E_CONFIG_VAL(D, T, browser_open_home, SHORT);
_news_edd = E_CONFIG_DD_NEW("News", News_Config);
#undef T
#undef D
#define T News_Config
#define D _news_edd
E_CONFIG_VAL(D, T, version, SHORT);
E_CONFIG_LIST(D, T, feed.categories, _news_feed_category_edd);
E_CONFIG_VAL(D, T, feed.timer_m, INT);
E_CONFIG_VAL(D, T, feed.sort_name, INT);
E_CONFIG_LIST(D, T, feed.langs, _news_feed_lang_edd);
E_CONFIG_VAL(D, T, feed.langs_all, SHORT);
E_CONFIG_VAL(D, T, feed.langs_notset, SHORT);
E_CONFIG_VAL(D, T, proxy.enable, SHORT);
E_CONFIG_VAL(D, T, proxy.host, STR);
E_CONFIG_VAL(D, T, proxy.port, INT);
E_CONFIG_VAL(D, T, browser.wich, SHORT);
E_CONFIG_VAL(D, T, browser.own, STR);
E_CONFIG_VAL(D, T, viewer.vfeeds.unread_first, SHORT);
E_CONFIG_VAL(D, T, viewer.varticles.unread_first, SHORT);
E_CONFIG_VAL(D, T, viewer.varticles.sort_date, SHORT);
E_CONFIG_VAL(D, T, viewer.vcontent.font_size, SHORT);
E_CONFIG_VAL(D, T, viewer.vcontent.font_color, STR);
E_CONFIG_VAL(D, T, viewer.vcontent.font_shadow, SHORT);
E_CONFIG_VAL(D, T, viewer.vcontent.font_shadow_color, STR);
E_CONFIG_VAL(D, T, popup_news.active, SHORT);
E_CONFIG_VAL(D, T, popup_news.timer_s, INT);
E_CONFIG_VAL(D, T, popup_other.on_timeout, SHORT);
E_CONFIG_VAL(D, T, popup_other.timer_s, INT);
E_CONFIG_LIST(D, T, items, _news_item_edd);
news->config = e_config_domain_load("module.news", _news_edd);
if (news->config)
{
if (news->config->version < NEWS_CONFIG_VERSION)
{
news_util_message_show(_("<hilight>News module : Configuration Upgraded</hilight><br><br>"
"Your configuration of news module<br>"
"has been upgraded<br>"
"Your settings were removed<br>"
"Sorry for the inconvenience<br><br>"
"(%d -> %d)"), news->config->version, NEWS_CONFIG_VERSION);
news->config = NULL;
}
else
{
if (news->config->version > NEWS_CONFIG_VERSION)
{
news_util_message_show(_("<hilight>News module : Configuration Downgraded</hilight><br><br>"
"Your configuration of News module<br>"
"has been downgraded<br>"
"Your settings were removed<br>"
"Sorry for the inconvenience<br><br>"
"(%d ->%d)"), news->config->version, NEWS_CONFIG_VERSION);
news->config = NULL;
}
}
}
if (!news->config)
{
News_Config *c;
char buf[4096];
c = E_NEW(News_Config, 1);
news->config = c;
c->version = NEWS_CONFIG_VERSION;
news_feed_all_restore();
c->feed.timer_m = NEWS_FEED_TIMER_DEFAULT;
c->feed.sort_name = NEWS_FEED_SORT_NAME_DEFAULT;
c->feed.langs = news_util_lang_detect();
c->feed.langs_all = NEWS_FEED_LANG_ALL_DEFAULT;
c->feed.langs_notset = 1;
c->proxy.port = NEWS_FEED_PROXY_PORT_DEFAULT;
c->browser.wich = NEWS_UTIL_BROWSER_DEFAULT;
c->viewer.vfeeds.unread_first = NEWS_VIEWER_VFEEDS_UNREAD_FIRST_DEFAULT;
c->viewer.varticles.unread_first = NEWS_VIEWER_VARTICLES_UNREAD_FIRST_DEFAULT;
c->viewer.varticles.sort_date = NEWS_VIEWER_VARTICLES_SORT_DATE_DEFAULT;
c->viewer.vcontent.font_size = NEWS_VIEWER_VCONTENT_FONT_SIZE_DEFAULT;
snprintf(buf, sizeof(buf), "%s", NEWS_VIEWER_VCONTENT_FONT_COLOR_DEFAULT);
c->viewer.vcontent.font_color = evas_stringshare_add(buf);
c->viewer.vcontent.font_shadow = NEWS_VIEWER_VCONTENT_FONT_SHADOW_DEFAULT;
snprintf(buf, sizeof(buf), "%s", NEWS_VIEWER_VCONTENT_FONT_SHADOW_COLOR_DEFAULT);
c->viewer.vcontent.font_shadow_color = evas_stringshare_add(buf);
c->popup_news.active = NEWS_FEED_POPUP_NEWS_ACTIVE_DEFAULT;
c->popup_news.timer_s = NEWS_FEED_POPUP_NEWS_TIMER_S_DEFAULT;
c->popup_other.on_timeout = NEWS_FEED_POPUP_OTHER_ON_TIMEOUT_DEFAULT;
c->popup_other.timer_s = NEWS_FEED_POPUP_OTHER_TIMER_S_DEFAULT;
}
E_CONFIG_LIMIT(news->config->feed.timer_m, NEWS_FEED_TIMER_MIN, NEWS_FEED_TIMER_MAX);
E_CONFIG_LIMIT(news->config->feed.sort_name, 0, 1);
E_CONFIG_LIMIT(news->config->proxy.enable, 0, 1);
E_CONFIG_LIMIT(news->config->proxy.port, 1024, 65535);
E_CONFIG_LIMIT(news->config->viewer.vfeeds.unread_first, 0, 1);
E_CONFIG_LIMIT(news->config->viewer.varticles.unread_first, 0, 1);
E_CONFIG_LIMIT(news->config->viewer.varticles.sort_date, 0, 1);
E_CONFIG_LIMIT(news->config->viewer.vcontent.font_size, NEWS_VIEWER_VCONTENT_FONT_SIZE_MIN, NEWS_VIEWER_VCONTENT_FONT_SIZE_MAX);
E_CONFIG_LIMIT(news->config->viewer.vcontent.font_shadow, 0, 1);
E_CONFIG_LIMIT(news->config->popup_news.timer_s, NEWS_POPUP_WARN_TIMER_S_MIN, NEWS_POPUP_WARN_TIMER_S_MAX);
E_CONFIG_LIMIT(news->config->popup_other.on_timeout, 0, 1);
E_CONFIG_LIMIT(news->config->popup_other.timer_s, NEWS_POPUP_WARN_TIMER_S_MIN, NEWS_POPUP_WARN_TIMER_S_MAX);
return 1;
}
int
news_config_shutdown(void)
{
News_Config *c;
News_Config_Item *nic;
c = news->config;
news_feed_all_delete();
news_feed_lang_list_free(news->config->feed.langs);
if (c->proxy.host) evas_stringshare_del(c->proxy.host);
if (c->browser.own) evas_stringshare_del(c->browser.own);
while ( (nic = evas_list_data(c->items)) )
news_config_item_del(nic);
evas_stringshare_del(c->viewer.vcontent.font_color);
evas_stringshare_del(c->viewer.vcontent.font_shadow_color);
E_FREE(news->config);
E_CONFIG_DD_FREE(_news_edd);
E_CONFIG_DD_FREE(_news_feed_edd);
E_CONFIG_DD_FREE(_news_feed_ref_edd);
E_CONFIG_DD_FREE(_news_feed_category_edd);
E_CONFIG_DD_FREE(_news_item_edd);
return 1;
}
int
news_config_save(void)
{
e_config_domain_save("module.news", _news_edd, news->config);
return 1;
}
News_Config_Item *
news_config_item_add(const char *id)
{
News_Config_Item *nic;
Evas_List *l;
DCONF(("Item new config"));
/* is there already an item config for this id ? */
for (l=news->config->items; l; l=evas_list_next(l))
{
nic = evas_list_data(l);
if (!strcmp(nic->id, id))
{
DCONF(("config found ! %s", nic->id));
return nic;
}
}
DCONF(("config NOT found ! creating new one %s", id));
/* no, create a new item config */
nic = E_NEW(News_Config_Item, 1);
nic->id = evas_stringshare_add(id);
nic->view_mode = NEWS_ITEM_VIEW_MODE_DEFAULT;
nic->openmethod = NEWS_ITEM_OPENMETHOD_DEFAULT;
nic->browser_open_home = NEWS_ITEM_BROWSER_OPEN_HOME_DEFAULT;
news->config->items = evas_list_append(news->config->items, nic);
return nic;
}
void
news_config_item_del(News_Config_Item *nic)
{
evas_stringshare_del(nic->id);
while(evas_list_count(nic->feed_refs))
{
News_Feed_Ref *fr;
fr = evas_list_data(nic->feed_refs);
evas_stringshare_del(fr->name);
nic->feed_refs = evas_list_remove(nic->feed_refs, fr);
}
news->config->items = evas_list_remove(news->config->items, nic);
free(nic);
}
/*
* Private functions
*
*/

98
src/module/news_config.h Normal file
View File

@ -0,0 +1,98 @@
#ifdef E_MOD_NEWS_TYPEDEFS
typedef struct _News_Config News_Config;
typedef struct _News_Config_Item News_Config_Item;
#else
#ifndef NEWS_CONFIG_H_INCLUDED
#define NEWS_CONFIG_H_INCLUDED
#define NEWS_CONFIG_VERSION 12
struct _News_Config
{
int version;
struct
{
Evas_List *categories;
int timer_m;
int sort_name;
Evas_List *langs;
int langs_all;
int langs_notset;
} feed;
struct
{
int enable;
const char *host;
int port;
} proxy;
struct
{
int wich;
const char *own;
} browser;
struct
{
struct
{
int unread_first;
} vfeeds;
struct
{
int unread_first;
int sort_date;
} varticles;
struct
{
int font_size;
const char *font_color;
int font_shadow;
const char *font_shadow_color;
} vcontent;
} viewer;
struct
{
int active;
int timer_s;
} popup_news;
struct
{
int on_timeout;
int timer_s;
} popup_other;
Evas_List *items;
};
struct _News_Config_Item
{
const char *id;
/* list of Feed_Ref */
Evas_List *feed_refs;
int view_mode;
int openmethod;
int browser_open_home;
int apply_to_all;
};
int news_config_init(void);
int news_config_shutdown(void);
int news_config_save(void);
News_Config_Item *news_config_item_add(const char *id);
void news_config_item_del(News_Config_Item *nic);
#endif
#endif

View File

@ -0,0 +1,502 @@
#include "News.h"
#define DIALOG_CLASS "_e_mod_news_config_dialog"
struct _E_Config_Dialog_Data
{
Evas_Object *color_viewer_font;
Evas_Object *color_viewer_font_shadow;
struct
{
int timer_m;
int sort_name;
} feed;
struct
{
int enable;
char *host;
char *port;
} proxy;
struct
{
int wich;
char *own;
} browser;
struct
{
struct
{
int unread_first;
} vfeeds;
struct
{
int unread_first;
int sort_date;
} varticles;
struct
{
int font_size;
E_Color *font_color;
int font_shadow;
E_Color *font_shadow_color;
int color_changed;
} vcontent;
} viewer;
struct
{
int active;
int timer_s;
} popup_news;
struct
{
int on_timeout;
int timer_s;
} popup_other;
};
static void *_create_data(E_Config_Dialog *cfd);
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static void _fill_data(E_Config_Dialog_Data *cfdata);
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static void _cb_color_viewer_font_change(void *data, Evas_Object *obj);
static void _cb_color_viewer_font_shadow_change(void *data, Evas_Object *obj);
/*
* Public functions
*/
int
news_config_dialog_show(void)
{
E_Config_Dialog *cfd;
E_Config_Dialog_View *v;
if (e_config_dialog_find("E", DIALOG_CLASS))
return 0;
v = E_NEW(E_Config_Dialog_View, 1);
v->create_cfdata = _create_data;
v->free_cfdata = _free_data;
v->basic.apply_cfdata = _advanced_apply_data;
v->basic.create_widgets = _basic_create_widgets;
v->advanced.apply_cfdata = _advanced_apply_data;
v->advanced.create_widgets = _advanced_create_widgets;
cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()),
_("News Main Configuration"),
"E", DIALOG_CLASS,
news->theme, 0, v, NULL);
return 1;
}
void
news_config_dialog_hide(void)
{
e_object_del(E_OBJECT(news->config_dialog));
news->config_dialog = NULL;
}
/*
* Private functions
*
*/
static void *
_create_data(E_Config_Dialog *cfd)
{
E_Config_Dialog_Data *cfdata;
news->config_dialog = cfd;
cfdata = E_NEW(E_Config_Dialog_Data, 1);
_fill_data(cfdata);
cfd->cfdata = cfdata;
return cfdata;
}
static void
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
free(cfdata->proxy.host);
free(cfdata->browser.own);
news->config_dialog = NULL;
free(cfdata);
}
static void
_fill_data(E_Config_Dialog_Data *cfdata)
{
News_Config *c;
c = news->config;
cfdata->feed.timer_m = c->feed.timer_m;
cfdata->feed.sort_name = c->feed.sort_name;
cfdata->proxy.enable = c->proxy.enable;
if (c->proxy.host)
cfdata->proxy.host = strdup(c->proxy.host);
else
cfdata->proxy.host = strdup("");
if (c->proxy.port)
{
char buf[6];
snprintf(buf, sizeof(buf), "%d", c->proxy.port);
cfdata->proxy.port = strdup(buf);
}
else
cfdata->proxy.port = strdup("");
cfdata->browser.wich = c->browser.wich;
if (c->browser.own)
cfdata->browser.own = strdup(c->browser.own);
else
cfdata->browser.own = strdup("");
cfdata->viewer.vfeeds.unread_first = c->viewer.vfeeds.unread_first;
cfdata->viewer.varticles.unread_first = c->viewer.varticles.unread_first;
cfdata->viewer.varticles.sort_date = c->viewer.varticles.sort_date;
cfdata->viewer.vcontent.font_size = c->viewer.vcontent.font_size;
cfdata->viewer.vcontent.font_color = E_NEW(E_Color, 1);
sscanf(c->viewer.vcontent.font_color, "#%2x%2x%2x",
&cfdata->viewer.vcontent.font_color->r,
&cfdata->viewer.vcontent.font_color->g,
&cfdata->viewer.vcontent.font_color->b);
cfdata->viewer.vcontent.font_color->a = 255;
e_color_update_rgb(cfdata->viewer.vcontent.font_color);
cfdata->viewer.vcontent.font_shadow = c->viewer.vcontent.font_shadow;
cfdata->viewer.vcontent.font_shadow_color = E_NEW(E_Color, 1);
sscanf(c->viewer.vcontent.font_shadow_color, "#%2x%2x%2x",
&cfdata->viewer.vcontent.font_shadow_color->r,
&cfdata->viewer.vcontent.font_shadow_color->g,
&cfdata->viewer.vcontent.font_shadow_color->b);
cfdata->viewer.vcontent.font_shadow_color->a = 255;
e_color_update_rgb(cfdata->viewer.vcontent.font_shadow_color);
cfdata->viewer.vcontent.color_changed = 0;
cfdata->popup_news.active = c->popup_news.active;
cfdata->popup_news.timer_s = c->popup_news.timer_s;
cfdata->popup_other.on_timeout = c->popup_other.on_timeout;
cfdata->popup_other.timer_s = c->popup_other.timer_s;
}
static Evas_Object *
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{
Evas_Object *o, *of, *ob;
E_Radio_Group *rg;
o = e_widget_list_add(evas, 0, 0);
of = e_widget_frametable_add(evas, _("Feeds"), 0);
ob = e_widget_check_add(evas, _("Sort lists by name"), &(cfdata->feed.sort_name));
e_widget_frametable_object_append(of, ob, 0, 1, 2, 1, 1, 1, 1, 0);
e_widget_list_object_append(o, of, 1, 1, 0.5);
of = e_widget_frametable_add(evas, _("Browser"), 0);
rg = e_widget_radio_group_new(&(cfdata->browser.wich));
ob = e_widget_radio_add(evas, _("Firefox"), NEWS_UTIL_BROWSER_FIREFOX, rg);
e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 1, 0, 1);
ob = e_widget_radio_add(evas, _("Mozilla"), NEWS_UTIL_BROWSER_MOZILLA, rg);
e_widget_frametable_object_append(of, ob, 1, 0, 1, 1, 1, 1, 0, 1);
ob = e_widget_radio_add(evas, _("Opera"), NEWS_UTIL_BROWSER_OPERA, rg);
e_widget_frametable_object_append(of, ob, 2, 0, 1, 1, 1, 1, 0, 1);
ob = e_widget_radio_add(evas, _("Dillo"), NEWS_UTIL_BROWSER_DILLO, rg);
e_widget_frametable_object_append(of, ob, 3, 0, 1, 1, 1, 1, 0, 1);
ob = e_widget_radio_add(evas, _("This one"), NEWS_UTIL_BROWSER_OWN, rg);
e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 1, 0, 1);
ob = e_widget_entry_add(evas, &(cfdata->browser.own));
e_widget_frametable_object_append(of, ob, 1, 1, 3, 1, 1, 1, 1, 1);
e_widget_list_object_append(o, of, 1, 1, 0.5);
of = e_widget_frametable_add(evas, _("News Viewer"), 0);
ob = e_widget_label_add(evas, _("Font size"));
e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 1, 1, 1);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), NEWS_VIEWER_VCONTENT_FONT_SIZE_MIN, NEWS_VIEWER_VCONTENT_FONT_SIZE_MAX, 1.0, 0, NULL, &(cfdata->viewer.vcontent.font_size), 50);
e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 0, 1, 0);
ob = e_widget_label_add(evas, _("Font color"));
e_widget_frametable_object_append(of, ob, 1, 0, 1, 1, 1, 1, 1, 1);
ob = e_widget_color_well_add(evas, cfdata->viewer.vcontent.font_color, 1);
cfdata->color_viewer_font = ob;
e_widget_on_change_hook_set(ob, _cb_color_viewer_font_change, cfdata);
e_widget_frametable_object_append(of, ob, 1, 1, 1, 1, 1, 1, 1, 1);
e_widget_list_object_append(o, of, 1, 1, 1.0);
return o;
}
static Evas_Object *
_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{
Evas_Object *o, *o2, *of, *of2, *ob;
E_Radio_Group *rg;
o = e_widget_table_add(evas, 0);
o2 = e_widget_list_add(evas, 0, 0);
of = e_widget_frametable_add(evas, _("Feeds"), 0);
ob = e_widget_label_add(evas, _("Timer"));
e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 1, 1, 0);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f min"),
(float)NEWS_FEED_TIMER_MIN, (float)NEWS_FEED_TIMER_MAX,
1.0, 0, NULL, &(cfdata->feed.timer_m), 70);
e_widget_frametable_object_append(of, ob, 1, 0, 1, 1, 1, 1, 1, 0);
ob = e_widget_check_add(evas, _("Sort lists by name"), &(cfdata->feed.sort_name));
e_widget_frametable_object_append(of, ob, 0, 1, 2, 1, 1, 1, 1, 0);
e_widget_list_object_append(o2, of, 1, 1, 0.5);
of = e_widget_frametable_add(evas, _("Browser"), 0);
rg = e_widget_radio_group_new(&(cfdata->browser.wich));
ob = e_widget_radio_add(evas, _("Firefox"), NEWS_UTIL_BROWSER_FIREFOX, rg);
e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 1, 0, 1);
ob = e_widget_radio_add(evas, _("Mozilla"), NEWS_UTIL_BROWSER_MOZILLA, rg);
e_widget_frametable_object_append(of, ob, 1, 0, 1, 1, 1, 1, 0, 1);
ob = e_widget_radio_add(evas, _("Opera"), NEWS_UTIL_BROWSER_OPERA, rg);
e_widget_frametable_object_append(of, ob, 2, 0, 1, 1, 1, 1, 0, 1);
ob = e_widget_radio_add(evas, _("Dillo"), NEWS_UTIL_BROWSER_DILLO, rg);
e_widget_frametable_object_append(of, ob, 3, 0, 1, 1, 1, 1, 0, 1);
ob = e_widget_radio_add(evas, _("This one"), NEWS_UTIL_BROWSER_OWN, rg);
e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 1, 0, 1);
ob = e_widget_entry_add(evas, &(cfdata->browser.own));
e_widget_frametable_object_append(of, ob, 1, 1, 3, 1, 1, 1, 1, 1);
e_widget_list_object_append(o2, of, 1, 1, 0.5);
of = e_widget_frametable_add(evas, _("Popup On News"), 0);
rg = e_widget_radio_group_new(&(cfdata->popup_news.active));
ob = e_widget_radio_add(evas, _("Never"),
NEWS_FEED_POPUP_NEWS_ACTIVE_NO, rg);
//TODO: NOT IMPLEMENTED YET
e_widget_radio_toggle_set(ob, 0);
e_widget_disabled_set(ob, 1);
e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 1, 1, 0);
ob = e_widget_radio_add(evas, _("Only on urgent feeds"),
NEWS_FEED_POPUP_NEWS_ACTIVE_URGENT, rg);
//TODO: NOT IMPLEMENTED YET
e_widget_radio_toggle_set(ob, 0);
e_widget_disabled_set(ob, 1);
e_widget_frametable_object_append(of, ob, 1, 0, 1, 1, 1, 1, 1, 0);
ob = e_widget_radio_add(evas, _("On all feeds"),
NEWS_FEED_POPUP_NEWS_ACTIVE_ALL, rg);
//TODO: NOT IMPLEMENTED YET
e_widget_radio_toggle_set(ob, 0);
e_widget_disabled_set(ob, 1);
e_widget_frametable_object_append(of, ob, 1, 1, 1, 1, 1, 1, 1, 0);
ob = e_widget_label_add(evas, _("Timer"));
e_widget_frametable_object_append(of, ob, 0, 2, 1, 1, 1, 1, 1, 0);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f s"),
(float)NEWS_POPUP_WARN_TIMER_S_MIN,
(float)NEWS_POPUP_WARN_TIMER_S_MAX,
1.0, 0, NULL, &(cfdata->popup_news.timer_s), 70);
e_widget_frametable_object_append(of, ob, 1, 2, 1, 1, 1, 1, 1, 0);
e_widget_list_object_append(o2, of, 1, 1, 0.5);
of = e_widget_frametable_add(evas, _("Popup On Warning / Error"), 0);
ob = e_widget_check_add(evas, _("Show on timeout ?"), &(cfdata->popup_other.on_timeout));
e_widget_frametable_object_append(of, ob, 0, 0, 2, 1, 1, 0, 1, 0);
ob = e_widget_label_add(evas, _("Timer"));
e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 1, 1, 0);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f s"),
(float)NEWS_POPUP_WARN_TIMER_S_MIN,
(float)NEWS_POPUP_WARN_TIMER_S_MAX,
1.0, 0, NULL, &(cfdata->popup_other.timer_s), 70);
e_widget_frametable_object_append(of, ob, 1, 1, 1, 1, 1, 1, 1, 0);
e_widget_list_object_append(o2, of, 1, 1, 0.5);
e_widget_table_object_append(o, o2, 0, 0, 1, 1, 1, 1, 1, 1);
o2 = e_widget_list_add(evas, 0, 0);
of = e_widget_frametable_add(evas, _("News Viewer"), 0);
ob = e_widget_check_add(evas, _("Unread feeds first"), &(cfdata->viewer.vfeeds.unread_first));
e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 0, 1, 0);
ob = e_widget_check_add(evas, _("Unread articles first"), &(cfdata->viewer.varticles.unread_first));
e_widget_frametable_object_append(of, ob, 1, 0, 1, 1, 1, 0, 1, 0);
ob = e_widget_check_add(evas, _("Sort articles by date"), &(cfdata->viewer.varticles.sort_date));
e_widget_frametable_object_append(of, ob, 1, 1, 1, 1, 1, 0, 1, 0);
of2 = e_widget_frametable_add(evas, _("Font"), 0);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), NEWS_VIEWER_VCONTENT_FONT_SIZE_MIN, NEWS_VIEWER_VCONTENT_FONT_SIZE_MAX, 1.0, 0, NULL, &(cfdata->viewer.vcontent.font_size), 70);
e_widget_frametable_object_append(of2, ob, 0, 0, 1, 1, 1, 0, 1, 0);
ob = e_widget_color_well_add(evas, cfdata->viewer.vcontent.font_color, 1);
cfdata->color_viewer_font = ob;
e_widget_on_change_hook_set(ob, _cb_color_viewer_font_change, cfdata);
e_widget_frametable_object_append(of2, ob, 0, 1, 1, 1, 1, 0, 1, 0);
ob = e_widget_check_add(evas, _("Font Shadow"), &cfdata->viewer.vcontent.font_shadow);
e_widget_frametable_object_append(of2, ob, 1, 0, 1, 1, 1, 0, 1, 0);
ob = e_widget_color_well_add(evas, cfdata->viewer.vcontent.font_shadow_color, 1);
cfdata->color_viewer_font_shadow = ob;
e_widget_on_change_hook_set(ob, _cb_color_viewer_font_shadow_change, cfdata);
e_widget_frametable_object_append(of2, ob, 1, 1, 1, 1, 1, 0, 1, 0);
e_widget_frametable_object_append(of, of2, 0, 2, 2, 1, 1, 0, 1, 0);
e_widget_list_object_append(o2, of, 1, 1, 0.0);
of = e_widget_frametable_add(evas, _("Proxy"), 0);
ob = e_widget_check_add(evas, _("Enable"), &(cfdata->proxy.enable));
e_widget_frametable_object_append(of, ob, 0, 0, 2, 1, 1, 0, 0, 0);
ob = e_widget_label_add(evas, _("Host"));
e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 0, 0, 0);
ob = e_widget_entry_add(evas, &(cfdata->proxy.host));
e_widget_frametable_object_append(of, ob, 1, 1, 1, 1, 1, 0, 1, 0);
ob = e_widget_label_add(evas, _("Port"));
e_widget_frametable_object_append(of, ob, 0, 2, 1, 1, 1, 0, 0, 0);
ob = e_widget_entry_add(evas, &(cfdata->proxy.port));
e_widget_frametable_object_append(of, ob, 1, 2, 1, 1, 1, 0, 1, 0);
e_widget_list_object_append(o2, of, 1, 1, 1.0);
e_widget_table_object_append(o, o2, 1, 0, 1, 1, 1, 1, 1, 1);
return o;
}
static int
_advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
News_Config *c;
c = news->config;
if (c->feed.timer_m != cfdata->feed.timer_m)
news_feed_timer_set(cfdata->feed.timer_m);
if (c->feed.sort_name != cfdata->feed.sort_name)
{
c->feed.sort_name = cfdata->feed.sort_name;
if (c->feed.sort_name)
news_feed_lists_refresh(1);
}
c->proxy.enable = cfdata->proxy.enable;
if (c->proxy.host)
{
evas_stringshare_del(c->proxy.host);
c->proxy.host = NULL;
}
if (cfdata->proxy.host && cfdata->proxy.host[0])
c->proxy.host = evas_stringshare_add(cfdata->proxy.host);
if (cfdata->proxy.port && cfdata->proxy.port[0])
sscanf(cfdata->proxy.port, "%d", &c->proxy.port);
c->browser.wich = cfdata->browser.wich;
if (c->browser.own)
{
evas_stringshare_del(c->browser.own);
c->browser.own = NULL;
}
if (cfdata->browser.own)
c->browser.own = evas_stringshare_add(cfdata->browser.own);
if ( (c->viewer.vfeeds.unread_first != cfdata->viewer.vfeeds.unread_first) ||
(c->viewer.varticles.unread_first != cfdata->viewer.varticles.unread_first) ||
(c->viewer.varticles.sort_date != cfdata->viewer.varticles.sort_date) ||
(c->viewer.vcontent.font_size != cfdata->viewer.vcontent.font_size) ||
(c->viewer.vcontent.font_shadow != cfdata->viewer.vcontent.font_shadow) ||
(cfdata->viewer.vcontent.color_changed) )
{
int recreate = 0;
char buf[8];
if ( (c->viewer.vcontent.font_size != cfdata->viewer.vcontent.font_size) ||
(c->viewer.vcontent.font_shadow != cfdata->viewer.vcontent.font_shadow) ||
(cfdata->viewer.vcontent.color_changed) )
recreate = 1;
c->viewer.vfeeds.unread_first = cfdata->viewer.vfeeds.unread_first;
c->viewer.varticles.unread_first = cfdata->viewer.varticles.unread_first;
c->viewer.varticles.sort_date = cfdata->viewer.varticles.sort_date;
c->viewer.vcontent.font_size = cfdata->viewer.vcontent.font_size;
if (cfdata->viewer.vcontent.font_color->r < 16) cfdata->viewer.vcontent.font_color->r = 16;
if (cfdata->viewer.vcontent.font_color->g < 16) cfdata->viewer.vcontent.font_color->g = 16;
if (cfdata->viewer.vcontent.font_color->b < 16) cfdata->viewer.vcontent.font_color->b = 16;
snprintf(buf, sizeof(buf), "#%x%x%x",
cfdata->viewer.vcontent.font_color->r,
cfdata->viewer.vcontent.font_color->g,
cfdata->viewer.vcontent.font_color->b);
evas_stringshare_del(news->config->viewer.vcontent.font_color);
news->config->viewer.vcontent.font_color = evas_stringshare_add(buf);
c->viewer.vcontent.font_shadow = cfdata->viewer.vcontent.font_shadow;
if (cfdata->viewer.vcontent.font_shadow_color->r < 16) cfdata->viewer.vcontent.font_shadow_color->r = 16;
if (cfdata->viewer.vcontent.font_shadow_color->g < 16) cfdata->viewer.vcontent.font_shadow_color->g = 16;
if (cfdata->viewer.vcontent.font_shadow_color->b < 16) cfdata->viewer.vcontent.font_shadow_color->b = 16;
snprintf(buf, sizeof(buf), "#%x%x%x",
cfdata->viewer.vcontent.font_shadow_color->r,
cfdata->viewer.vcontent.font_shadow_color->g,
cfdata->viewer.vcontent.font_shadow_color->b);
evas_stringshare_del(news->config->viewer.vcontent.font_shadow_color);
news->config->viewer.vcontent.font_shadow_color = evas_stringshare_add(buf);
news_viewer_all_refresh(1, recreate);
cfdata->viewer.vcontent.color_changed = 0;
}
c->popup_news.active = cfdata->popup_news.active;
c->popup_news.timer_s = cfdata->popup_news.timer_s;
c->popup_other.on_timeout = cfdata->popup_other.on_timeout;
c->popup_other.timer_s = cfdata->popup_other.timer_s;
news_config_save();
return 1;
}
static void
_cb_color_viewer_font_change(void *data, Evas_Object *obj)
{
E_Config_Dialog_Data *cfdata;
cfdata = data;
cfdata->viewer.vcontent.color_changed = 1;
}
static void
_cb_color_viewer_font_shadow_change(void *data, Evas_Object *obj)
{
E_Config_Dialog_Data *cfdata;
cfdata = data;
cfdata->viewer.vcontent.color_changed = 1;
}

View File

@ -0,0 +1,14 @@
#ifdef E_MOD_NEWS_TYPEDEFS
#else
#ifndef NEWS_CONFIG_DIALOG_H_INCLUDED
#define NEWS_CONFIG_DIALOG_H_INCLUDED
int news_config_dialog_show(void);
void news_config_dialog_hide(void);
#endif
#endif

View File

@ -0,0 +1,293 @@
#include "News.h"
struct _E_Config_Dialog_Data
{
struct
{
Evas_Object *button_icon;
Evas_Object *icon;
Evas_Object *icon_sel;
E_Dialog *icon_sel_dia;
} gui;
News_Feed_Category *cat;
char *name;
char *icon;
};
static void *_create_data(E_Config_Dialog *cfd);
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static void _fill_data(E_Config_Dialog_Data *cfdata, News_Feed_Category *cat);
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static void _icon_select(void *data1, void *data2);
static void _icon_select_cb(void *data, Evas_Object *obj);
static void _icon_select_ok(void *data, E_Dialog *dia);
static void _icon_select_cancel(void *data, E_Dialog *dia);
static void _icon_select_changed(void *data);
/*
* Public functions
*/
int
news_config_dialog_category_show(News_Feed_Category *fcat)
{
E_Config_Dialog *cfd;
E_Config_Dialog_View *v;
v = E_NEW(E_Config_Dialog_View, 1);
v->create_cfdata = _create_data;
v->free_cfdata = _free_data;
v->basic.apply_cfdata = _basic_apply_data;
v->basic.create_widgets = _basic_create_widgets;
cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()),
_("News Category Configuration"),
"E", "_e_mod_news_config_dialog_category",
news->theme, 0, v, fcat);
return 1;
}
void
news_config_dialog_category_hide(News_Feed_Category *fcat)
{
if (fcat)
{
e_object_del(E_OBJECT(fcat->config_dialog));
fcat->config_dialog = NULL;
}
else
{
e_object_del(E_OBJECT(news->config_dialog_category_new));
news->config_dialog_category_new = NULL;
}
}
/*
* Private functions
*
*/
static void *
_create_data(E_Config_Dialog *cfd)
{
E_Config_Dialog_Data *cfdata;
News_Feed_Category *cat;
cat = cfd->data;
if (cat) cat->config_dialog = cfd;
else news->config_dialog_category_new = cfd;
cfdata = E_NEW(E_Config_Dialog_Data, 1);
_fill_data(cfdata, cat);
cfd->cfdata = cfdata;
return cfdata;
}
static void
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
free(cfdata->name);
free(cfdata->icon);
if (cfdata->cat)
cfdata->cat->config_dialog = NULL;
else
news->config_dialog_category_new = NULL;
free(cfdata);
}
static void
_fill_data(E_Config_Dialog_Data *cfdata, News_Feed_Category *cat)
{
char buf[4096];
cfdata->cat = cat;
if (cat)
{
if (cat->name) cfdata->name = strdup(cat->name);
if (cat->icon) cfdata->icon = strdup(cat->icon);
}
else
{
cfdata->name = strdup("");
snprintf(buf, sizeof(buf), "%s/%s",
e_module_dir_get(news->module), NEWS_FEED_ITEM_CAT_ICON_DEFAULT);
cfdata->icon = strdup(buf);
}
}
static Evas_Object *
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{
Evas_Object *o, *of, *ob;
o = e_widget_list_add(evas, 0, 0);
of = e_widget_framelist_add(evas, _("Icon"), 0);
ob = e_widget_button_add(evas, "", NULL,
_icon_select, cfdata, NULL);
cfdata->gui.button_icon = ob;
if (cfdata->icon)
_icon_select_changed(cfdata);
e_widget_min_size_set(ob, 48, 48);
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.0);
of = e_widget_framelist_add(evas, _("Name"), 0);
ob = e_widget_entry_add(evas, &(cfdata->name));
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.0);
return o;
}
static int
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
News_Feed_Category *cat;
cat = cfdata->cat;
if (cat)
{
if ( !news_feed_category_edit(cat,
cfdata->name,
cfdata->icon) )
return 0;
}
else
{
cat = news_feed_category_new(cfdata->name,
cfdata->icon);
if (!cat) return 0;
news->config->feed.categories =
evas_list_append(news->config->feed.categories, cat);
cfdata->cat = cat;
news->config_dialog_category_new = NULL;
cat->config_dialog = cfd;
}
news_feed_lists_refresh(1);
return 1;
}
static void
_icon_select(void *data1, void *data2)
{
E_Config_Dialog *cfd;
E_Config_Dialog_Data *cfdata;
E_Dialog *dia;
Evas_Object *o;
Evas_Coord mw, mh;
char *dir = NULL;
cfdata = data1;
if (cfdata->gui.icon_sel) return;
if (cfdata->cat) cfd = cfdata->cat->config_dialog;
else cfd = news->config_dialog_category_new;
dia = e_dialog_new(cfd->con, "E", "_news_category_icon_select_dialog");
if (!dia) return;
e_dialog_title_set(dia, _("Select an Icon"));
dia->data = cfdata;
if (cfdata->icon)
dir = ecore_file_get_dir(cfdata->icon);
if (dir)
{
o = e_widget_fsel_add(dia->win->evas, dir, "/", NULL, NULL,
_icon_select_cb, cfdata,
NULL, cfdata, 1);
free(dir);
}
else
{
o = e_widget_fsel_add(dia->win->evas, "~/", "/", NULL, NULL,
_icon_select_cb, cfdata,
NULL, cfdata, 1);
}
evas_object_show(o);
cfdata->gui.icon_sel = o;
e_widget_min_size_get(o, &mw, &mh);
e_dialog_content_set(dia, o, mw, mh);
/* buttons at the bottom */
e_dialog_button_add(dia, _("OK"), NULL, _icon_select_ok, cfdata);
e_dialog_button_add(dia, _("Cancel"), NULL, _icon_select_cancel, cfdata);
e_dialog_resizable_set(dia, 1);
e_win_centered_set(dia->win, 1);
e_dialog_show(dia);
e_win_resize(dia->win, 475, 341);
cfdata->gui.icon_sel_dia = dia;
}
static void
_icon_select_cb(void *data, Evas_Object *obj)
{
E_Config_Dialog_Data *cfdata;
cfdata = data;
}
static void
_icon_select_ok(void *data, E_Dialog *dia)
{
E_Config_Dialog_Data *cfdata;
const char *file;
cfdata = data;
file = e_widget_fsel_selection_path_get(cfdata->gui.icon_sel);
if (file)
{
if(cfdata->icon) free(cfdata->icon);
cfdata->icon = strdup(file);
_icon_select_changed(cfdata);
}
_icon_select_cancel(data, dia);
}
static void
_icon_select_cancel(void *data, E_Dialog *dia)
{
E_Config_Dialog_Data *cfdata;
cfdata = data;
e_object_del(E_OBJECT(dia));
cfdata->gui.icon_sel = NULL;
cfdata->gui.icon_sel_dia = NULL;
}
static void
_icon_select_changed(void *data)
{
E_Config_Dialog_Data *cfdata;
Evas_Object *ic;
cfdata = data;
if (!cfdata->icon) return;
ic = e_icon_add(evas_object_evas_get(cfdata->gui.button_icon));
e_icon_file_set(ic, cfdata->icon);
e_icon_fill_inside_set(ic, 1);
if (cfdata->gui.icon) evas_object_del(cfdata->gui.icon);
e_widget_button_icon_set(cfdata->gui.button_icon, ic);
cfdata->gui.icon = ic;
}

View File

@ -0,0 +1,14 @@
#ifdef E_MOD_NEWS_TYPEDEFS
#else
#ifndef NEWS_CONFIG_DIALOG_CATEGORY_H_INCLUDED
#define NEWS_CONFIG_DIALOG_CATEGORY_H_INCLUDED
int news_config_dialog_category_show(News_Feed_Category *fcat);
void news_config_dialog_category_hide(News_Feed_Category *fcat);
#endif
#endif

View File

@ -0,0 +1,640 @@
#include "News.h"
struct _E_Config_Dialog_Data
{
struct
{
Evas_Object *ilist_categories;
Evas_Object *ilist_langs;
Evas_Object *button_icon;
Evas_Object *icon;
Evas_Object *icon_sel;
E_Dialog *icon_sel_dia;
int in_advanced;
} gui;
char *name;
int name_ovrw;
char *language;
int language_ovrw;
char *description;
int description_ovrw;
char *url_home;
int url_home_ovrw;
char *url_feed;
char *icon;
int icon_ovrw;
int urgent;
News_Feed_Category *category;
News_Feed *feed;
};
static void *_create_data(E_Config_Dialog *cfd);
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static void _fill_data(E_Config_Dialog_Data *cfdata, News_Feed *f);
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
static void _common_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata, Evas_Object *o);
static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
static int _common_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static void _cb_lang_change(void *data, Evas_Object *obj);
static void _cb_category_list(void *data);
static void _icon_select(void *data1, void *data2);
static void _icon_select_cb(void *data, Evas_Object *obj);
static void _icon_select_ok(void *data, E_Dialog *dia);
static void _icon_select_cancel(void *data, E_Dialog *dia);
static void _icon_select_changed(void *data);
/*
* Public functions
*/
int
news_config_dialog_feed_show(News_Feed *feed)
{
E_Config_Dialog *cfd;
E_Config_Dialog_View *v;
v = E_NEW(E_Config_Dialog_View, 1);
v->create_cfdata = _create_data;
v->free_cfdata = _free_data;
v->basic.apply_cfdata = _common_apply_data;
v->basic.create_widgets = _basic_create_widgets;
v->advanced.apply_cfdata = _common_apply_data;
v->advanced.create_widgets = _advanced_create_widgets;
cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()),
_("News Feed Configuration"),
"E", "_e_mod_news_config_dialog_feed",
news->theme, 0, v, feed);
return 1;
}
void
news_config_dialog_feed_hide(News_Feed *feed)
{
if (feed)
{
e_object_del(E_OBJECT(feed->config_dialog));
feed->config_dialog = NULL;
}
else
{
e_object_del(E_OBJECT(news->config_dialog_feed_new));
news->config_dialog_feed_new = NULL;
}
}
void
news_config_dialog_feed_refresh_categories(News_Feed *feed)
{
E_Config_Dialog_Data *cfdata;
Evas_List *l;
Evas_Object *ilist;
int pos, pos_to_select;
int w;
if (feed)
{
if (!feed->config_dialog) return;
cfdata = feed->config_dialog->cfdata;
}
else
{
if (!news->config_dialog_feed_new) return;
cfdata = news->config_dialog_feed_new->cfdata;
}
if (cfdata->gui.in_advanced) return;
ilist = cfdata->gui.ilist_categories;
e_widget_ilist_freeze(ilist);
e_widget_ilist_clear(ilist);
pos = 0;
pos_to_select = -1;
for(l=news->config->feed.categories; l; l=evas_list_next(l))
{
Evas_Object *ic = NULL;
News_Feed_Category *fc;
char buf[1024];
fc = evas_list_data(l);
if (fc->icon && fc->icon[0])
{
ic = e_icon_add(evas_object_evas_get(ilist));
e_icon_file_set(ic, fc->icon);
}
snprintf(buf, sizeof(buf), "%s",
fc->name);
if (cfdata->category == fc)
pos_to_select = pos;
e_widget_ilist_append(ilist, ic, buf, _cb_category_list, cfdata, NULL);
pos++;
}
e_widget_ilist_go(ilist);
if (pos_to_select != -1)
{
e_widget_ilist_selected_set(ilist, pos_to_select);
_cb_category_list(cfdata);
}
e_widget_min_size_get(ilist, &w, NULL);
e_widget_min_size_set(ilist, w, 110);
e_widget_ilist_thaw(ilist);
}
void
news_config_dialog_feed_refresh_langs(News_Feed *feed)
{
E_Config_Dialog_Data *cfdata;
Evas_Object *ilist;
News_Feed_Lang *lang;
Evas_List *list, *l;
int pos, pos_to_select;
int w;
if (feed)
{
if (!feed->config_dialog) return;
cfdata = feed->config_dialog->cfdata;
}
else
{
if (!news->config_dialog_feed_new) return;
cfdata = news->config_dialog_feed_new->cfdata;
}
if (cfdata->gui.in_advanced) return;
ilist = cfdata->gui.ilist_langs;
e_widget_ilist_freeze(ilist);
e_widget_ilist_clear(ilist);
if (news->config->feed.langs_all)
list = news->langs;
else
list = news->config->feed.langs;
pos = 0;
pos_to_select = -1;
for (l=list; l; l=evas_list_next(l))
{
lang = l->data;
e_widget_ilist_append(ilist, NULL, lang->name, NULL, lang, NULL);
if (cfdata->language && !strcmp(cfdata->language, lang->key))
pos_to_select = pos;
pos++;
}
e_widget_ilist_go(ilist);
if (pos_to_select != -1)
e_widget_ilist_selected_set(ilist, pos_to_select);
else
e_widget_ilist_selected_set(ilist, 0);
e_widget_min_size_get(ilist, &w, NULL);
e_widget_min_size_set(ilist, w, 110);
e_widget_ilist_thaw(ilist);
}
/*
* Private functions
*
*/
static void *
_create_data(E_Config_Dialog *cfd)
{
E_Config_Dialog_Data *cfdata;
News_Feed *feed;
feed = cfd->data;
if (feed) feed->config_dialog = cfd;
else news->config_dialog_feed_new = cfd;
cfdata = E_NEW(E_Config_Dialog_Data, 1);
_fill_data(cfdata, feed);
cfd->cfdata = cfdata;
return cfdata;
}
static void
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
free(cfdata->name);
free(cfdata->language);
free(cfdata->description);
free(cfdata->url_home);
free(cfdata->url_feed);
free(cfdata->icon);
if (cfdata->gui.icon_sel)
e_object_del(E_OBJECT(cfdata->gui.icon_sel));
if (cfdata->feed)
cfdata->feed->config_dialog = NULL;
else
news->config_dialog_feed_new = NULL;
free(cfdata);
}
static void
_fill_data(E_Config_Dialog_Data *cfdata, News_Feed *f)
{
char buf[4096];
cfdata->feed = f;
if (f)
{
fflush(stdout);
cfdata->name = strdup(f->name);
cfdata->name_ovrw = f->name_ovrw;
cfdata->category = f->category;
if (f->language) cfdata->language = strdup(f->language);
else cfdata->language = strdup("");
cfdata->language_ovrw = f->language_ovrw;
if (f->description) cfdata->description = strdup(f->description);
else cfdata->description = strdup("");
cfdata->description_ovrw = f->description_ovrw;
if (f->url_home) cfdata->url_home = strdup(f->url_home);
else cfdata->url_home = strdup("");
cfdata->url_home_ovrw = f->url_home_ovrw;
cfdata->url_feed = strdup(f->url_feed);
if (f->icon) cfdata->icon = strdup(f->icon);
else
{
snprintf(buf, sizeof(buf), "%s/%s",
e_module_dir_get(news->module), NEWS_FEED_ITEM_FEED_ICON_DEFAULT);
cfdata->icon = strdup(buf);
}
cfdata->icon_ovrw = f->icon_ovrw;
cfdata->urgent = f->urgent;
}
else
{
cfdata->name = strdup("");
cfdata->name_ovrw = NEWS_FEED_NAME_OVRW_DEFAULT;
cfdata->category = NULL;
cfdata->language = strdup("");
cfdata->language_ovrw = NEWS_FEED_LANGUAGE_OVRW_DEFAULT;
cfdata->description = strdup("");
cfdata->description_ovrw = NEWS_FEED_DESCRIPTION_OVRW_DEFAULT;
cfdata->url_home = strdup("http://");
cfdata->url_home_ovrw = NEWS_FEED_URL_HOME_OVRW_DEFAULT;
cfdata->url_feed = strdup("http://");
snprintf(buf, sizeof(buf), "%s/%s",
e_module_dir_get(news->module), NEWS_FEED_ITEM_FEED_ICON_DEFAULT);
cfdata->icon = strdup(buf);
cfdata->icon_ovrw = NEWS_FEED_ICON_OVRW_DEFAULT;
}
}
static Evas_Object *
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{
Evas_Object *o;
Evas_Object *of, *ob;
cfdata->gui.in_advanced = 0;
o = e_widget_table_add(evas, 0);
_common_create_widgets(cfd, evas, cfdata, o);
of = e_widget_framelist_add(evas, _("Category"), 0);
ob = e_widget_ilist_add(evas, 16, 16, NULL);
e_widget_ilist_selector_set(ob, 1);
cfdata->gui.ilist_categories = ob;
news_config_dialog_feed_refresh_categories(cfdata->feed);
e_widget_framelist_object_append(of, ob);
e_widget_table_object_append(o, of, 0, 1, 1, 1, 1, 1, 1, 1);
of = e_widget_framelist_add(evas, _("Language"), 0);
ob = e_widget_ilist_add(evas, 16, 16, NULL);
e_widget_ilist_selector_set(ob, 1);
e_widget_on_change_hook_set(ob, _cb_lang_change, cfdata);
cfdata->gui.ilist_langs = ob;
news_config_dialog_feed_refresh_langs(cfdata->feed);
e_widget_framelist_object_append(of, ob);
e_widget_table_object_append(o, of, 1, 1, 1, 1, 1, 1, 1, 1);
e_dialog_resizable_set(cfd->dia, 1);
return o;
}
static void
_common_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata, Evas_Object *o)
{
Evas_Object *of, *ob;
of = e_widget_frametable_add(evas, _("Icon"), 0);
ob = e_widget_button_add(evas, "", NULL,
_icon_select, cfdata, NULL);
cfdata->gui.button_icon = ob;
if (cfdata->icon)
_icon_select_changed(cfdata);
e_widget_min_size_set(ob, 48, 48);
e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 0, 1, 0);
ob = e_widget_check_add(evas, _("Get from the server"), &(cfdata->icon_ovrw));
//TODO: NOT IMPLEMENTED YET
e_widget_check_checked_set(ob, 0);
e_widget_disabled_set(ob, 1);
e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 1, 1, 1);
e_widget_table_object_append(o, of, 0, 0, 1, 1, 1, 1, 1, 0);
of = e_widget_framelist_add(evas, _("Basic informations"), 0);
ob = e_widget_label_add(evas, _("Name :"));
e_widget_framelist_object_append(of, ob);
ob = e_widget_entry_add(evas, &(cfdata->name));
e_widget_framelist_object_append(of, ob);
ob = e_widget_label_add(evas, _("Feed url :"));
e_widget_framelist_object_append(of, ob);
ob = e_widget_entry_add(evas, &(cfdata->url_feed));
e_widget_framelist_object_append(of, ob);
ob = e_widget_check_add(evas, _("Mark as important feed"), &(cfdata->urgent));
//TODO: NOT IMPLEMENTED YET
e_widget_disabled_set(ob, 1);
e_widget_framelist_object_append(of, ob);
e_widget_table_object_append(o, of, 1, 0, 1, 1, 1, 1, 1, 0);
}
static Evas_Object *
_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{
Evas_Object *o;
Evas_Object *of, *ob;
cfdata->gui.in_advanced = 1;
o = e_widget_table_add(evas, 0);
_common_create_widgets(cfd, evas, cfdata, o);
of = e_widget_framelist_add(evas, _("Advanced informations"), 0);
ob = e_widget_label_add(evas, _("Description"));
e_widget_framelist_object_append(of, ob);
ob = e_widget_entry_add(evas, &(cfdata->description));
e_widget_framelist_object_append(of, ob);
ob = e_widget_label_add(evas, _("Home url"));
e_widget_framelist_object_append(of, ob);
ob = e_widget_entry_add(evas, &(cfdata->url_home));
e_widget_framelist_object_append(of, ob);
e_widget_table_object_append(o, of, 0, 2, 2, 1, 1, 1, 1, 1);
of = e_widget_framelist_add(evas, _("Server informations"), 0);
ob = e_widget_label_add(evas, _("Do allow the server to overwrite the informations you entered ?"));
e_widget_framelist_object_append(of, ob);
ob = e_widget_check_add(evas, _("Name"), &(cfdata->name_ovrw));
e_widget_framelist_object_append(of, ob);
ob = e_widget_check_add(evas, _("Language"), &(cfdata->language_ovrw));
e_widget_framelist_object_append(of, ob);
ob = e_widget_check_add(evas, _("Description"), &(cfdata->description_ovrw));
e_widget_framelist_object_append(of, ob);
ob = e_widget_check_add(evas, _("Home url"), &(cfdata->url_home_ovrw));
e_widget_framelist_object_append(of, ob);
e_widget_table_object_append(o, of, 0, 4, 2, 1, 1, 1, 1, 1);
return o;
}
static int
_common_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
News_Feed *f;
f = cfdata->feed;
if (f)
{
News_Feed_Category *old_cat;
old_cat = f->category;
if ( news_feed_edit(f,
cfdata->name, cfdata->name_ovrw,
cfdata->language, cfdata->language_ovrw,
cfdata->description, cfdata->description_ovrw,
cfdata->url_home, cfdata->url_home_ovrw,
cfdata->url_feed,
cfdata->icon, cfdata->icon_ovrw,
cfdata->urgent,
cfdata->category, 0) )
{
if (old_cat != cfdata->category)
{
old_cat->feeds = evas_list_remove(old_cat->feeds, f);
f->category->feeds = evas_list_prepend(f->category->feeds, f);
}
if (f->item && f->item->viewer)
news_viewer_refresh(f->item->viewer);
}
else
{
DD(("FAILED to edit feed ! icon %s", cfdata->icon));
return 0;
}
}
else
{
News_Feed_Category *cat;
cat = cfdata->category;
f = news_feed_new(cfdata->name, cfdata->name_ovrw,
cfdata->language, cfdata->language_ovrw,
cfdata->description, cfdata->description_ovrw,
cfdata->url_home, cfdata->url_home_ovrw,
cfdata->url_feed,
cfdata->icon, cfdata->icon_ovrw,
cfdata->urgent,
cfdata->category);
if (!f)
{
DD(("FAILED to create feed !"));
return 0;
}
cat->feeds = evas_list_append(cat->feeds, f);
cfdata->feed = f;
news->config_dialog_feed_new = NULL;
f->config_dialog = cfd;
}
news_feed_lists_refresh(1);
// TODO config dialog to attach to an item
news_config_save();
return 1;
}
static void
_cb_lang_change(void *data, Evas_Object *obj)
{
E_Config_Dialog_Data *cfdata;
News_Feed_Lang *lang;
int pos;
cfdata = data;
pos = e_widget_ilist_selected_get(cfdata->gui.ilist_langs);
lang = e_widget_ilist_nth_data_get(cfdata->gui.ilist_langs, pos);
if (cfdata->language) free(cfdata->language);
cfdata->language = strdup(lang->key);
}
static void
_cb_category_list(void *data)
{
E_Config_Dialog_Data *cfdata;
cfdata = data;
cfdata->category = evas_list_nth(news->config->feed.categories,
e_widget_ilist_selected_get(cfdata->gui.ilist_categories));
}
static void
_icon_select(void *data1, void *data2)
{
E_Config_Dialog *cfd;
E_Config_Dialog_Data *cfdata;
E_Dialog *dia;
Evas_Object *o;
Evas_Coord mw, mh;
char *dir = NULL;
cfdata = data1;
if (cfdata->gui.icon_sel) return;
if (cfdata->feed) cfd = cfdata->feed->config_dialog;
else cfd = news->config_dialog_feed_new;
dia = e_dialog_new(cfd->con, "E", "_news_feed_icon_select_dialog");
if (!dia) return;
e_dialog_title_set(dia, _("Select an Icon"));
dia->data = cfdata;
if (cfdata->icon)
dir = ecore_file_get_dir(cfdata->icon);
if (dir)
{
o = e_widget_fsel_add(dia->win->evas, dir, "/", NULL, NULL,
_icon_select_cb, cfdata,
NULL, cfdata, 1);
free(dir);
}
else
{
o = e_widget_fsel_add(dia->win->evas, "~/", "/", NULL, NULL,
_icon_select_cb, cfdata,
NULL, cfdata, 1);
}
evas_object_show(o);
cfdata->gui.icon_sel = o;
e_widget_min_size_get(o, &mw, &mh);
e_dialog_content_set(dia, o, mw, mh);
/* buttons at the bottom */
e_dialog_button_add(dia, _("OK"), NULL, _icon_select_ok, cfdata);
e_dialog_button_add(dia, _("Cancel"), NULL, _icon_select_cancel, cfdata);
e_dialog_resizable_set(dia, 1);
e_win_centered_set(dia->win, 1);
e_dialog_show(dia);
e_win_resize(dia->win, 475, 341);
cfdata->gui.icon_sel_dia = dia;
}
static void
_icon_select_cb(void *data, Evas_Object *obj)
{
E_Config_Dialog_Data *cfdata;
cfdata = data;
}
static void
_icon_select_ok(void *data, E_Dialog *dia)
{
E_Config_Dialog_Data *cfdata;
const char *file;
cfdata = data;
file = e_widget_fsel_selection_path_get(cfdata->gui.icon_sel);
if (file)
{
if(cfdata->icon) free(cfdata->icon);
cfdata->icon = strdup(file);
_icon_select_changed(cfdata);
}
_icon_select_cancel(data, dia);
}
static void
_icon_select_cancel(void *data, E_Dialog *dia)
{
E_Config_Dialog_Data *cfdata;
cfdata = data;
e_object_del(E_OBJECT(dia));
cfdata->gui.icon_sel = NULL;
cfdata->gui.icon_sel_dia = NULL;
}
static void
_icon_select_changed(void *data)
{
E_Config_Dialog_Data *cfdata;
Evas_Object *ic;
cfdata = data;
if (!cfdata->icon) return;
ic = e_icon_add(evas_object_evas_get(cfdata->gui.button_icon));
e_icon_file_set(ic, cfdata->icon);
e_icon_fill_inside_set(ic, 1);
if (cfdata->gui.icon) evas_object_del(cfdata->gui.icon);
e_widget_button_icon_set(cfdata->gui.button_icon, ic);
cfdata->gui.icon = ic;
}

View File

@ -0,0 +1,17 @@
#ifdef E_MOD_NEWS_TYPEDEFS
#else
#ifndef NEWS_CONFIG_DIALOG_FEED_H_INCLUDED
#define NEWS_CONFIG_DIALOG_FEED_H_INCLUDED
int news_config_dialog_feed_show(News_Feed *feed);
void news_config_dialog_feed_hide(News_Feed *feed);
void news_config_dialog_feed_refresh_categories(News_Feed *feed);
void news_config_dialog_feed_refresh_langs(News_Feed *feed);
#endif
#endif

View File

@ -0,0 +1,760 @@
#include "News.h"
#define DIALOG_CLASS "_e_mod_news_config_dialog_feeds"
struct _E_Config_Dialog_Data
{
Evas_Object *ilist_feeds;
Evas_Object *ilist_categories;
Evas_Object *textblock_feed_infos;
News_Feed *selected_feed;
News_Feed_Category *selected_category;
Evas_Object *button_feed_del;
Evas_Object *button_feed_conf;
Evas_Object *button_cat_del;
Evas_Object *button_cat_conf;
Evas_Object *button_langs;
E_Confirm_Dialog *cd;
int langs_all;
};
static void *_create_data(E_Config_Dialog *cfd);
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static void _fill_data(E_Config_Dialog_Data *cfdata);
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static void _cb_feed_up(void *data, void *data2);
static void _cb_feed_down(void *data, void *data2);
static void _cb_feed_list(void *data);
static void _cb_feed_add(void *data, void *data2);
static void _cb_feed_del(void *data, void *data2);
static void _cb_feed_config(void *data, void *data2);
static void _cb_category_up(void *data, void *data2);
static void _cb_category_down(void *data, void *data2);
static void _cb_category_list(void *data);
static void _cb_category_add(void *data, void *data2);
static void _cb_category_del(void *data, void *data2);
static void _cb_category_config(void *data, void *data2);
static void _cb_langs_all_change(void *data, Evas_Object *obj);
static void _cb_langs_config(void *data, void *data2);
static void _cb_empty(void *data, void *data2);
static void _cb_empty_yes(void *data);
static void _cb_reset(void *data, void *data2);
static void _cb_reset_yes(void *data);
static void _cb_confirm_dialog_destroy(void *data);
/*
* Public functions
*/
int
news_config_dialog_feeds_show(void)
{
E_Config_Dialog *cfd;
E_Config_Dialog_View *v;
if (e_config_dialog_find("E", DIALOG_CLASS))
return 0;
v = E_NEW(E_Config_Dialog_View, 1);
v->create_cfdata = _create_data;
v->free_cfdata = _free_data;
v->basic.apply_cfdata = _basic_apply_data;
v->basic.create_widgets = _basic_create_widgets;
cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()),
_("News Feeds Configuration"),
"E", DIALOG_CLASS,
news->theme, 0, v, NULL);
if (news->config->feed.langs_notset)
{
news_config_dialog_langs_show();
news->config->feed.langs_notset = 0;
news_config_save();
}
return 1;
}
void
news_config_dialog_feeds_hide(void)
{
e_object_del(E_OBJECT(news->config_dialog_feeds));
news->config_dialog_feeds = NULL;
}
void
news_config_dialog_feeds_refresh_feeds(void)
{
E_Config_Dialog_Data *cfdata;
Evas_List *l, *lcat;
Evas_Object *ilist;
int pos, pos_to_select;
if (!news->config_dialog_feeds) return;
cfdata = news->config_dialog_feeds->cfdata;
ilist = cfdata->ilist_feeds;
e_widget_ilist_freeze(ilist);
e_widget_ilist_clear(ilist);
if (cfdata->button_feed_del)
e_widget_disabled_set(cfdata->button_feed_del, 1);
if (cfdata->button_feed_conf)
e_widget_disabled_set(cfdata->button_feed_conf, 1);
pos = -1;
pos_to_select = -1;
for (lcat=news->config->feed.categories; lcat; lcat=evas_list_next(lcat))
{
News_Feed_Category *cat;
Evas_Object *iccat = NULL;
cat = evas_list_data(lcat);
if (!cat->feeds_visible)
continue;
if (cat->icon)
{
iccat = e_icon_add(evas_object_evas_get(ilist));
e_icon_file_set(iccat, cat->icon);
}
e_widget_ilist_header_append(ilist, iccat, cat->name);
pos++;
for (l=cat->feeds_visible; l; l=evas_list_next(l))
{
Evas_Object *ic = NULL;
News_Feed *f;
char buf[1024];
f = evas_list_data(l);
if (f->icon && f->icon[0])
{
ic = e_icon_add(evas_object_evas_get(ilist));
e_icon_file_set(ic, f->icon);
}
snprintf(buf, sizeof(buf), "%s", f->name);
// TODO : better display of each feed
e_widget_ilist_append(ilist, ic, buf, _cb_feed_list, f, NULL);
pos++;
if (cfdata->selected_feed == f)
pos_to_select = pos;
}
}
e_widget_ilist_go(ilist);
/* select a feed */
if (pos_to_select != -1)
{
e_widget_ilist_selected_set(ilist, pos_to_select);
_cb_feed_list(cfdata->selected_feed);
}
/* ilist size */
if (pos == -1)
e_widget_min_size_set(ilist, 165, 120);
else
{
int wmw, wmh;
e_widget_min_size_get(ilist, &wmw, &wmh);
e_widget_min_size_set(ilist, wmw, 180);
}
e_widget_ilist_thaw(ilist);
}
void
news_config_dialog_feeds_refresh_categories(void)
{
E_Config_Dialog_Data *cfdata;
Evas_List *l;
Evas_Object *ilist;
int pos, pos_to_select;
if (!news->config_dialog_feeds) return;
cfdata = news->config_dialog_feeds->cfdata;
ilist = cfdata->ilist_categories;
e_widget_ilist_freeze(ilist);
e_widget_ilist_clear(ilist);
if (cfdata->button_cat_del)
e_widget_disabled_set(cfdata->button_cat_del, 1);
if (cfdata->button_cat_conf)
e_widget_disabled_set(cfdata->button_cat_conf, 1);
pos = -1;
pos_to_select = -1;
for (l=news->config->feed.categories; l; l=evas_list_next(l))
{
Evas_Object *ic = NULL;
News_Feed_Category *fc;
char buf[1024];
fc = evas_list_data(l);
if (fc->icon && fc->icon[0])
{
ic = e_icon_add(evas_object_evas_get(ilist));
e_icon_file_set(ic, fc->icon);
}
snprintf(buf, sizeof(buf), "%s", fc->name);
// TODO : better display of each category
e_widget_ilist_append(ilist, ic, buf, _cb_category_list, fc, NULL);
pos++;
if (cfdata->selected_category == fc)
pos_to_select = pos;
}
if (pos_to_select != -1)
{
e_widget_ilist_selected_set(ilist, pos_to_select);
_cb_category_list(cfdata->selected_category);
}
if (pos == -1)
e_widget_min_size_set(ilist, 165, 120);
else
{
int wmw, wmh;
e_widget_min_size_get(ilist, &wmw, &wmh);
e_widget_min_size_set(ilist, wmw, 120);
}
e_widget_ilist_go(ilist);
e_widget_ilist_thaw(ilist);
}
/*
* Private functions
*
*/
static void *
_create_data(E_Config_Dialog *cfd)
{
E_Config_Dialog_Data *cfdata;
news->config_dialog_feeds = cfd;
cfdata = E_NEW(E_Config_Dialog_Data, 1);
_fill_data(cfdata);
cfd->cfdata = cfdata;
return cfdata;
}
static void
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
if (cfdata->cd) e_object_del(E_OBJECT(cfdata->cd));
news->config_dialog_feeds = NULL;
free(cfdata);
}
static void
_fill_data(E_Config_Dialog_Data *cfdata)
{
News_Config *c;
c = news->config;
cfdata->langs_all = c->feed.langs_all;
}
static Evas_Object *
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{
Evas_Object *o, *o2, *o3, *o4;
Evas_Object *of, *ob;
int wmw, wmh;
o = e_widget_list_add(evas, 1, 1);
o2 = e_widget_list_add(evas, 0, 0);
of = e_widget_frametable_add(evas, _("Categories"), 0);
cfdata->selected_category = NULL;
ob = e_widget_ilist_add(evas, 16, 16, NULL);
e_widget_ilist_selector_set(ob, 1);
cfdata->ilist_categories = ob;
news_config_dialog_feeds_refresh_categories();
e_widget_frametable_object_append(of, ob, 1, 0, 3, 4, 1, 1, 1, 1);
if (!news->config->feed.sort_name)
{
ob = e_widget_button_add(evas, "", "widget/up_arrow", _cb_category_up, cfdata, NULL);
e_widget_frametable_object_append(of, ob, 4, 1, 1, 1, 0, 0, 0, 0);
ob = e_widget_button_add(evas, "", "widget/down_arrow", _cb_category_down, cfdata, NULL);
e_widget_frametable_object_append(of, ob, 4, 2, 1, 1, 0, 0, 0, 0);
}
ob = e_widget_button_add(evas, _("Add"), NULL, _cb_category_add, cfdata, NULL);
e_widget_frametable_object_append(of, ob, 1, 4, 1, 1, 1, 0, 1, 0);
ob = e_widget_button_add(evas, _("Delete"), NULL, _cb_category_del, cfdata, NULL);
e_widget_disabled_set(ob, 1);
cfdata->button_cat_del = ob;
e_widget_frametable_object_append(of, ob, 2, 4, 1, 1, 1, 0, 1, 0);
ob = e_widget_button_add(evas, _("Configure"), NULL, _cb_category_config, cfdata, NULL);
e_widget_disabled_set(ob, 1);
cfdata->button_cat_conf = ob;
e_widget_frametable_object_append(of, ob, 3, 4, 1, 1, 1, 0, 1, 0);
e_widget_list_object_append(o2, of, 1, 1, 0.5);
o3 = e_widget_list_add(evas, 0, 1);
of = e_widget_framelist_add(evas, _("Languages"), 1);
ob = e_widget_check_add(evas, _("All"), &(cfdata->langs_all));
e_widget_on_change_hook_set(ob, _cb_langs_all_change, cfdata);
e_widget_framelist_object_append(of, ob);
ob = e_widget_button_add(evas, _("Select"), NULL, _cb_langs_config, cfdata, NULL);
if (cfdata->langs_all)
e_widget_disabled_set(ob, 1);
cfdata->button_langs = ob;
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o3, of, 1, 0, 0.5);
o4 = e_widget_list_add(evas, 0, 0);
ob = e_widget_button_add(evas, _("Empty the lists"), "enlightenment/e", _cb_empty, cfdata, NULL);
e_widget_list_object_append(o4, ob, 1, 0, 0.5);
ob = e_widget_button_add(evas, _("Restore default lists"), "enlightenment/e", _cb_reset, cfdata, NULL);
e_widget_list_object_append(o4, ob, 1, 0, 0.5);
e_widget_list_object_append(o3, o4, 1, 1, 0.5);
e_widget_list_object_append(o2, o3, 0, 0, 0.5);
e_widget_list_object_append(o, o2, 1, 1, 0.5);
of = e_widget_frametable_add(evas, _("Feeds"), 0);
ob = e_widget_textblock_add(evas);
cfdata->textblock_feed_infos = ob;
e_widget_min_size_get(ob, &wmw, &wmh);
e_widget_min_size_set(ob, wmw, 40);
e_widget_frametable_object_append(of, ob, 0, 0, 4, 1, 1, 1, 0, 0);
cfdata->selected_feed = NULL;
ob = e_widget_ilist_add(evas, 16, 16, NULL);
e_widget_ilist_selector_set(ob, 1);
cfdata->ilist_feeds = ob;
news_config_dialog_feeds_refresh_feeds();
e_widget_frametable_object_append(of, ob, 0, 1, 3, 4, 1, 1, 1, 1);
ob = e_widget_button_add(evas, _("Add"), NULL, _cb_feed_add, cfdata, NULL);
e_widget_frametable_object_append(of, ob, 0, 5, 1, 1, 1, 0, 1, 0);
ob = e_widget_button_add(evas, _("Delete"), NULL, _cb_feed_del, cfdata, NULL);
e_widget_disabled_set(ob, 1);
cfdata->button_feed_del = ob;
e_widget_frametable_object_append(of, ob, 1, 5, 1, 1, 1, 0, 1, 0);
ob = e_widget_button_add(evas, _("Configure"), NULL, _cb_feed_config, cfdata, NULL);
e_widget_disabled_set(ob, 1);
cfdata->button_feed_conf = ob;
e_widget_frametable_object_append(of, ob, 2, 5, 1, 1, 1, 0, 1, 0);
if (!news->config->feed.sort_name)
{
ob = e_widget_button_add(evas, "", "widget/up_arrow", _cb_feed_up, cfdata, NULL);
e_widget_frametable_object_append(of, ob, 3, 2, 1, 1, 0, 0, 0, 0);
ob = e_widget_button_add(evas, "", "widget/down_arrow", _cb_feed_down, cfdata, NULL);
e_widget_frametable_object_append(of, ob, 3, 3, 1, 1, 0, 0, 0, 0);
}
e_widget_list_object_append(o, of, 1, 1, 0.5);
e_dialog_resizable_set(cfd->dia, 1);
return o;
}
static int
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
news_config_save();
return 1;
}
static void
_cb_feed_up(void *data, void *data2)
{
E_Config_Dialog_Data *cfdata;
News_Feed_Category *cat;
News_Feed *f, *f_prev;
Evas_List *l, *l_prev;
if (news->config->feed.sort_name) return;
cfdata = data;
f = cfdata->selected_feed;
cat = f->category;
l = evas_list_find_list(cat->feeds_visible, f);
l_prev = evas_list_prev(l);
f_prev = evas_list_data(l_prev);
if (!l_prev) return;
cat->feeds = evas_list_remove(cat->feeds, f);
cat->feeds = evas_list_prepend_relative(cat->feeds, f, f_prev);
news_feed_lists_refresh(0);
}
static void
_cb_feed_down(void *data, void *data2)
{
E_Config_Dialog_Data *cfdata;
News_Feed_Category *cat;
News_Feed *f, *f_next;
Evas_List *l, *l_next;
if (news->config->feed.sort_name) return;
cfdata = data;
f = cfdata->selected_feed;
cat = f->category;
l = evas_list_find_list(cat->feeds, f);
l_next = evas_list_next(l);
f_next = evas_list_data(l_next);
if (!l_next) return;
cat->feeds = evas_list_remove(cat->feeds, f);
cat->feeds = evas_list_append_relative(cat->feeds, f, f_next);
news_feed_lists_refresh(0);
}
static void
_cb_feed_list(void *data)
{
E_Config_Dialog_Data *cfdata;
News_Feed *f;
char buf[4096];
f = data;
cfdata = news->config_dialog_feeds->cfdata;
if (cfdata->button_feed_del)
e_widget_disabled_set(cfdata->button_feed_del, 0);
if (cfdata->button_feed_conf)
e_widget_disabled_set(cfdata->button_feed_conf, 0);
cfdata->selected_feed = f;
snprintf(buf, sizeof(buf),
"%s",
f->description ? f->description : "No description for the selected feed");
e_widget_textblock_markup_set(cfdata->textblock_feed_infos, buf);
}
static void
_cb_feed_add(void *data, void *data2)
{
if (news->config_dialog_feed_new) return;
news_config_dialog_feed_show(NULL);
}
static void
_cb_feed_del(void *data, void *data2)
{
E_Config_Dialog_Data *cfdata;
News_Feed_Category *cat;
News_Feed *f;
News_Viewer *nv = NULL;
int pos;
cfdata = data;
f = cfdata->selected_feed;
if (!f) return;
if (f->item && f->item->viewer)
nv = f->item->viewer;
cat = f->category;
cat->feeds = evas_list_remove(cat->feeds, f);
news_feed_free(f);
cfdata->selected_feed = NULL;
pos = e_widget_ilist_selected_get(cfdata->ilist_feeds);
news_feed_lists_refresh(0);
/* trick to call the callback in selected_set */
e_widget_ilist_selector_set(cfdata->ilist_feeds, 0);
e_widget_ilist_selected_set(cfdata->ilist_feeds, pos);
e_widget_ilist_selector_set(cfdata->ilist_feeds, 1);
if (nv) news_viewer_refresh(nv);
news_config_save();
}
static void
_cb_feed_config(void *data, void *data2)
{
E_Config_Dialog_Data *cfdata;
News_Feed *f;
cfdata = data;
f = cfdata->selected_feed;
if (!f) return;
if (f->config_dialog) return;
news_config_dialog_feed_show(f);
}
static void
_cb_category_up(void *data, void *data2)
{
E_Config_Dialog_Data *cfdata;
News_Feed_Category *cat;
Evas_List *l, *l_prev;
if (news->config->feed.sort_name) return;
cfdata = data;
cat = cfdata->selected_category;
if (!cat) return;
l = evas_list_find_list(news->config->feed.categories, cat);
l_prev = evas_list_prev(l);
if (!l_prev) return;
news->config->feed.categories =
evas_list_remove_list(news->config->feed.categories, l);
news->config->feed.categories =
evas_list_prepend_relative_list(news->config->feed.categories, cat, l_prev);
news_feed_lists_refresh(0);
}
static void
_cb_category_down(void *data, void *data2)
{
E_Config_Dialog_Data *cfdata;
News_Feed_Category *cat;
Evas_List *l, *l_next;
if (news->config->feed.sort_name) return;
cfdata = data;
cat = cfdata->selected_category;
if (!cat) return;
l = evas_list_find_list(news->config->feed.categories, cat);
l_next = evas_list_next(l);
if (!l_next) return;
news->config->feed.categories =
evas_list_remove_list(news->config->feed.categories, l);
news->config->feed.categories =
evas_list_append_relative_list(news->config->feed.categories, cat, l_next);
news_feed_lists_refresh(0);
}
static void
_cb_category_list(void *data)
{
E_Config_Dialog_Data *cfdata;
News_Feed_Category *c;
const char *label;
int pos;
c = data;
cfdata = news->config_dialog_feeds->cfdata;
if (cfdata->button_cat_del)
e_widget_disabled_set(cfdata->button_cat_del, 0);
if (cfdata->button_cat_conf)
e_widget_disabled_set(cfdata->button_cat_conf, 0);
cfdata->selected_category = c;
/* select the first feed in this category */
if (c->feeds_visible)
{
pos = 0;
while ((label = e_widget_ilist_nth_label_get(cfdata->ilist_feeds, pos)))
{
if (e_widget_ilist_nth_is_header(cfdata->ilist_feeds, pos))
{
if (!strcmp(label, c->name))
{
/* trick to call the callback in selected_set */
e_widget_ilist_selector_set(cfdata->ilist_feeds, 0);
e_widget_ilist_selected_set(cfdata->ilist_feeds, pos+1);
e_widget_ilist_selector_set(cfdata->ilist_feeds, 1);
break;
}
}
pos++;
}
}
}
static void
_cb_category_add(void *data, void *data2)
{
if (news->config_dialog_category_new) return;
news_config_dialog_category_show(NULL);
}
static void
_cb_category_del(void *data, void *data2)
{
E_Config_Dialog_Data *cfdata;
News_Feed_Category *c;
int pos;
cfdata = data;
c = cfdata->selected_category;
if (!c) return;
if (c->feeds && evas_list_count(c->feeds))
{
news_util_message_error_show(_("There are <hilight>feeds</hilight> in this category.<br>"
"You have to <hilight>remove them first</hilight>"));
return;
}
news_feed_category_free(c);
news->config->feed.categories = evas_list_remove(news->config->feed.categories, c);
cfdata->selected_category = NULL;
pos = e_widget_ilist_selected_get(cfdata->ilist_categories);
news_feed_lists_refresh(1);
/* trick to call the callback in selected_set */
e_widget_ilist_selector_set(cfdata->ilist_categories, 0);
e_widget_ilist_selected_set(cfdata->ilist_categories, pos);
e_widget_ilist_selector_set(cfdata->ilist_categories, 1);
news_config_save();
}
static void
_cb_category_config(void *data, void *data2)
{
E_Config_Dialog_Data *cfdata;
News_Feed_Category *c;
cfdata = data;
c = cfdata->selected_category;
if (!c) return;
if (c->config_dialog) return;
news_config_dialog_category_show(c);
}
static void
_cb_langs_all_change(void *data, Evas_Object *obj)
{
E_Config_Dialog_Data *cfdata;
cfdata = data;
news->config->feed.langs_all = cfdata->langs_all;
if (news->config->feed.langs_all)
e_widget_disabled_set(cfdata->button_langs, 1);
else
e_widget_disabled_set(cfdata->button_langs, 0);
/* refreshes ! */
news_feed_lang_list_refresh();
news_feed_lists_refresh(0);
}
static void
_cb_langs_config(void *data, void *data2)
{
E_Config_Dialog_Data *cfdata;
cfdata = data;
news_config_dialog_langs_show();
}
static void
_cb_empty(void *data, void *data2)
{
E_Config_Dialog_Data *cfdata;
E_Confirm_Dialog *cd = NULL;
cfdata = data;
if (cfdata->cd) return;
cd = e_confirm_dialog_show(_("News Module - Are you sure ?"), "enlightenment/e",
"<hilight>Empty the lists</hilight><br>"
"It will delete all the categories and feeds<br><br>"
"<hilight>Confirm ?</hilight>",
NULL, NULL, _cb_empty_yes, NULL, NULL, NULL,
_cb_confirm_dialog_destroy, cfdata);
if (!cd) return;
cfdata->cd = cd;
}
static void
_cb_empty_yes(void *data)
{
news_feed_all_delete();
news_viewer_all_refresh(0, 0);
}
static void
_cb_reset(void *data, void *data2)
{
E_Config_Dialog_Data *cfdata;
E_Confirm_Dialog *cd = NULL;
cfdata = data;
if (cfdata->cd) return;
cd = e_confirm_dialog_show(_("News Module - Are you sure ?"), "enlightenment/e",
"<hilight>Restore default lists</hilight><br>"
"It will delete all the categories and feeds,<br>"
"and restore the default ones<br><br>"
"<hilight>Confirm ?</hilight>",
NULL, NULL, _cb_reset_yes, NULL, NULL, NULL,
_cb_confirm_dialog_destroy, cfdata);
if (!cd) return;
cfdata->cd = cd;
}
static void
_cb_reset_yes(void *data)
{
news_feed_all_restore();
news_viewer_all_refresh(0, 0);
}
static void
_cb_confirm_dialog_destroy(void *data)
{
E_Config_Dialog_Data *cfdata;
cfdata = data;
cfdata->cd = NULL;
}

View File

@ -0,0 +1,17 @@
#ifdef E_MOD_NEWS_TYPEDEFS
#else
#ifndef NEWS_CONFIG_DIALOG_FEEDS_H_INCLUDED
#define NEWS_CONFIG_DIALOG_FEEDS_H_INCLUDED
int news_config_dialog_feeds_show(void);
void news_config_dialog_feeds_hide(void);
void news_config_dialog_feeds_refresh_feeds(void);
void news_config_dialog_feeds_refresh_categories(void);
#endif
#endif

View File

@ -0,0 +1,177 @@
#include "News.h"
#define DIALOG_CLASS "_e_mod_news_config_dialog_item"
struct _E_Config_Dialog_Data
{
int view_mode;
int openmethod;
int browser_open_home;
int apply_to_all;
News_Item *ni;
};
static void *_create_data(E_Config_Dialog *cfd);
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static void _fill_data(E_Config_Dialog_Data *cfdata, News_Item *pi);
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
/*
* Public functions
*/
int
news_config_dialog_item_show(News_Item *ni)
{
E_Config_Dialog *cfd;
E_Config_Dialog_View *v;
v = E_NEW(E_Config_Dialog_View, 1);
v->create_cfdata = _create_data;
v->free_cfdata = _free_data;
v->basic.apply_cfdata = _basic_apply_data;
v->basic.create_widgets = _basic_create_widgets;
cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()),
_("News Gadget Configuration"),
"E", DIALOG_CLASS,
news->theme, 0, v, ni);
return 1;
}
void
news_config_dialog_item_hide(News_Item *ni)
{
e_object_del(E_OBJECT(ni->config_dialog));
ni->config_dialog = NULL;
}
/*
* Private functions
*
*/
static void *
_create_data(E_Config_Dialog *cfd)
{
E_Config_Dialog_Data *cfdata;
News_Item *ni;
ni = cfd->data;
ni->config_dialog = cfd;
cfdata = E_NEW(E_Config_Dialog_Data, 1);
_fill_data(cfdata, ni);
cfd->cfdata = cfdata;
return cfdata;
}
static void
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
cfdata->ni->config_dialog = NULL;
free(cfdata);
}
static void
_fill_data(E_Config_Dialog_Data *cfdata, News_Item *ni)
{
News_Config_Item *nic;
nic = ni->config;
cfdata->ni = ni;
cfdata->view_mode = nic->view_mode;
cfdata->openmethod = nic->openmethod;
cfdata->browser_open_home = nic->browser_open_home;
cfdata->apply_to_all = nic->apply_to_all;
}
static Evas_Object *
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{
Evas_Object *o;
Evas_Object *of, *ob;
E_Radio_Group *rg;
o = e_widget_list_add(evas, 0, 0);
of = e_widget_framelist_add(evas, _("View Mode"), 0);
rg = e_widget_radio_group_new(&(cfdata->view_mode));
ob = e_widget_radio_add(evas, _("Show one icon for all feeds"), NEWS_ITEM_VIEW_MODE_ONE, rg);
e_widget_framelist_object_append(of, ob);
ob = e_widget_radio_add(evas, _("Show each feed"), NEWS_ITEM_VIEW_MODE_FEED, rg);
e_widget_framelist_object_append(of, ob);
ob = e_widget_radio_add(evas, _("Show unread feeds only"), NEWS_ITEM_VIEW_MODE_FEED_UNREAD, rg);
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.0);
of = e_widget_framelist_add(evas, _("Feed open in"), 0);
rg = e_widget_radio_group_new(&(cfdata->openmethod));
ob = e_widget_radio_add(evas, _("the feed viewer"), NEWS_ITEM_OPENMETHOD_VIEWER, rg);
e_widget_framelist_object_append(of, ob);
ob = e_widget_radio_add(evas, _("my favorite browser"), NEWS_ITEM_OPENMETHOD_BROWSER, rg);
e_widget_framelist_object_append(of, ob);
ob = e_widget_check_add(evas, _("Browser opens home url"), &(cfdata->browser_open_home));
e_widget_framelist_object_append(of, ob);
ob = e_widget_label_add(evas, _("instead of feed url"));
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.0);
ob = e_widget_label_add(evas, _(""));
e_widget_list_object_append(o, ob, 1, 1, 0.0);
ob = e_widget_check_add(evas, _("Apply this to all News gadgets"), &(cfdata->apply_to_all));
e_widget_list_object_append(o, ob, 1, 1, 0.0);
return o;
}
static int
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
News_Config_Item *nic, *nic2;
News_Item *ni, *ni2;
Evas_List *l;
ni = cfdata->ni;
nic = ni->config;
if (!cfdata->apply_to_all)
{
nic->openmethod = cfdata->openmethod;
nic->browser_open_home = cfdata->browser_open_home;
if (nic->view_mode != cfdata->view_mode)
{
nic->view_mode = cfdata->view_mode;
news_item_refresh(ni, 1, 0, 1);
}
}
else
{
for (l=news->items; l; l=evas_list_next(l))
{
ni2 = l->data;
nic2 = ni2->config;
nic2->openmethod = cfdata->openmethod;
nic2->browser_open_home = cfdata->browser_open_home;
if (nic2->view_mode != cfdata->view_mode)
{
nic2->view_mode = cfdata->view_mode;
news_item_refresh(ni2, 1, 0, 1);
}
}
}
nic->apply_to_all = cfdata->apply_to_all;
news_config_save();
return 1;
}

Some files were not shown because too many files have changed in this diff Show More