Initial import for Enlightenment Photo module
This module displays pictures on youre E desktop. Basicly its the replacement of dEvian module picture feature, in a gadconized module. But there are many new features here =) Next one is Rss :) SVN revision: 23739
This commit is contained in:
commit
a97ce5c71f
|
@ -0,0 +1,7 @@
|
|||
Laurent 'kiwi' Ghigonis
|
||||
ooookiwi@free.fr
|
||||
http://oooo.zapto.org
|
||||
|
||||
Icons are
|
||||
- from ETK default theme wich comes from the Tango Project (read data/icons/default/icons/AUTHORS for the full list of the authors of these images).
|
||||
- from Evidence Gant theme
|
|
@ -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,0 +1,5 @@
|
|||
To install Enlightenment Photo module, just do
|
||||
|
||||
./autogen.sh
|
||||
make
|
||||
make install
|
|
@ -0,0 +1,8 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
SUBDIRS = src data
|
||||
|
||||
filesdir = $(datadir)
|
||||
files_DATA = module.eap
|
||||
|
||||
pkgdir = $(datadir)/$(MODULE_ARCH)
|
|
@ -0,0 +1,5 @@
|
|||
Enlightenment Photo Module
|
||||
|
||||
A module to display pictures
|
||||
|
||||
enjoy =)
|
|
@ -0,0 +1,27 @@
|
|||
make install CFLAGS="-g -Wall -DDEBUG -DDEBUG_MAIN -DDEBUG_CONFIG -DDEBUG_ITEM -DDEBUG_PICTURE -DDEBUG_PICTURE_LOCAL -DDEBUG_PICTURE_NET -DDEBUG_POPUP_WARN -DDEBUG_POPUP_INFO"
|
||||
|
||||
----------------------------------------------------
|
||||
BUGS
|
||||
----------------------------------------------------
|
||||
|
||||
|
||||
|
||||
----------------------------------------------------
|
||||
NEEDED
|
||||
----------------------------------------------------
|
||||
|
||||
* add some borders between different item categories
|
||||
in config panels
|
||||
* change item action setbg with
|
||||
e patch edj_gen to e_utils
|
||||
* border around the pictures
|
||||
need to create an object that will contain my edje object
|
||||
so the object with the theme is able to be an oblong
|
||||
* ability to add a dir without reloading all
|
||||
* rethink local load idler to be less heavy
|
||||
|
||||
----------------------------------------------------
|
||||
FUTUR
|
||||
----------------------------------------------------
|
||||
|
||||
* picture net (get from devian's TODO)
|
|
@ -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
|
|
@ -0,0 +1,162 @@
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
# get rid of that stupid cache mechanism
|
||||
rm -f config.cache
|
||||
|
||||
#photo module version
|
||||
version="0.1.0"
|
||||
|
||||
AC_INIT(configure.in)
|
||||
AC_CANONICAL_BUILD
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
AM_INIT_AUTOMAKE(photo, $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-photo.spec
|
||||
Makefile
|
||||
data/Makefile
|
||||
data/theme/Makefile
|
||||
src/Makefile
|
||||
src/module/Makefile
|
||||
],[
|
||||
])
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
SUBDIRS = theme
|
|
@ -0,0 +1,30 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
EDJE_CC = @edje_cc@
|
||||
EDJE_FLAGS = -v \
|
||||
-id images \
|
||||
-fd fonts
|
||||
|
||||
EXTRA_DIST = \
|
||||
photo.edc \
|
||||
photo_item.edc \
|
||||
photo_item_parts.edc \
|
||||
photo_item_programs.edc \
|
||||
photo_popi.edc \
|
||||
photo_popi_parts.edc \
|
||||
photo_popi_programs.edc \
|
||||
photo_popw.edc \
|
||||
photo_popw_parts.edc \
|
||||
photo_popw_programs.edc \
|
||||
photo_icon.edc
|
||||
|
||||
filesdir = $(datadir)
|
||||
files_DATA = photo.edj
|
||||
|
||||
photo.edj: Makefile $(EXTRA_DIST)
|
||||
$(EDJE_CC) $(EDJE_FLAGS) \
|
||||
$(top_srcdir)/data/theme/photo.edc \
|
||||
$(top_builddir)/data/theme/photo.edj
|
||||
|
||||
clean:
|
||||
rm -f photo.edj
|
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.
|
@ -0,0 +1,48 @@
|
|||
/* Enlightenment Eveil Module theme */
|
||||
|
||||
images
|
||||
{
|
||||
//image: "item_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: "popup_info_background.png" COMP;
|
||||
|
||||
image: "icon_infos.png" COMP;
|
||||
image: "icon_next.png" COMP;
|
||||
image: "icon_previous.png" COMP;
|
||||
image: "icon_pause.png" COMP;
|
||||
image: "icon_resume.png" COMP;
|
||||
image: "icon_setbg.png" COMP;
|
||||
image: "icon_viewer.png" COMP;
|
||||
image: "icon_dir_not_loaded.png" COMP;
|
||||
image: "icon_dir_loading.png" COMP;
|
||||
image: "icon_dir_loaded.png" COMP;
|
||||
}
|
||||
|
||||
fonts
|
||||
{
|
||||
font: "Vera.ttf" "Vera";
|
||||
font: "VeraBd.ttf" "VeraBd";
|
||||
}
|
||||
|
||||
data
|
||||
{
|
||||
item: "name" "Default Photo Theme";
|
||||
item: "author" "Laurent Ghigonis";
|
||||
item: "version" "1";
|
||||
}
|
||||
|
||||
collections
|
||||
{
|
||||
/* Groups */
|
||||
|
||||
#include "photo_item.edc"
|
||||
#include "photo_popi.edc"
|
||||
#include "photo_popw.edc"
|
||||
#include "photo_icon.edc"
|
||||
}
|
|
@ -0,0 +1,243 @@
|
|||
/* Icon groups */
|
||||
|
||||
group
|
||||
{
|
||||
name: "modules/photo/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/photo/icon/next";
|
||||
|
||||
parts
|
||||
{
|
||||
part
|
||||
{
|
||||
name: "icon";
|
||||
type: IMAGE;
|
||||
mouse_events: 0;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
aspect: 1.0 1.0;
|
||||
image
|
||||
{
|
||||
normal: "icon_next.png";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
group
|
||||
{
|
||||
name: "modules/photo/icon/previous";
|
||||
|
||||
parts
|
||||
{
|
||||
part
|
||||
{
|
||||
name: "icon";
|
||||
type: IMAGE;
|
||||
mouse_events: 0;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
aspect: 1.0 1.0;
|
||||
image
|
||||
{
|
||||
normal: "icon_previous.png";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
group
|
||||
{
|
||||
name: "modules/photo/icon/pause";
|
||||
|
||||
parts
|
||||
{
|
||||
part
|
||||
{
|
||||
name: "icon";
|
||||
type: IMAGE;
|
||||
mouse_events: 0;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
aspect: 1.0 1.0;
|
||||
image
|
||||
{
|
||||
normal: "icon_pause.png";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
group
|
||||
{
|
||||
name: "modules/photo/icon/resume";
|
||||
|
||||
parts
|
||||
{
|
||||
part
|
||||
{
|
||||
name: "icon";
|
||||
type: IMAGE;
|
||||
mouse_events: 0;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
aspect: 1.0 1.0;
|
||||
image
|
||||
{
|
||||
normal: "icon_resume.png";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
group
|
||||
{
|
||||
name: "modules/photo/icon/setbg";
|
||||
|
||||
parts
|
||||
{
|
||||
part
|
||||
{
|
||||
name: "icon";
|
||||
type: IMAGE;
|
||||
mouse_events: 0;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
aspect: 1.0 1.0;
|
||||
image
|
||||
{
|
||||
normal: "icon_setbg.png";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
group
|
||||
{
|
||||
name: "modules/photo/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/photo/icon/dir/not_loaded";
|
||||
|
||||
parts
|
||||
{
|
||||
part
|
||||
{
|
||||
name: "icon";
|
||||
type: IMAGE;
|
||||
mouse_events: 0;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
aspect: 1.0 1.0;
|
||||
image
|
||||
{
|
||||
normal: "icon_dir_not_loaded.png";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
group
|
||||
{
|
||||
name: "modules/photo/icon/dir/loading";
|
||||
|
||||
parts
|
||||
{
|
||||
part
|
||||
{
|
||||
name: "icon";
|
||||
type: IMAGE;
|
||||
mouse_events: 0;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
aspect: 1.0 1.0;
|
||||
image
|
||||
{
|
||||
normal: "icon_dir_loading.png";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
group
|
||||
{
|
||||
name: "modules/photo/icon/dir/loaded";
|
||||
|
||||
parts
|
||||
{
|
||||
part
|
||||
{
|
||||
name: "icon";
|
||||
type: IMAGE;
|
||||
mouse_events: 0;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
aspect: 1.0 1.0;
|
||||
image
|
||||
{
|
||||
normal: "icon_dir_loaded.png";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/* Item group */
|
||||
|
||||
#define MSG_RECV_LABEL_ALWAYS 0
|
||||
|
||||
group
|
||||
{
|
||||
name: "modules/photo/item";
|
||||
|
||||
script
|
||||
{
|
||||
public label_always;
|
||||
|
||||
public message(Msg_Type: type, id, msg)
|
||||
{
|
||||
if (type == MSG_INT)
|
||||
{
|
||||
if (id == MSG_RECV_LABEL_ALWAYS)
|
||||
{
|
||||
set_int(label_always, getarg(2));
|
||||
if (!get_int(label_always))
|
||||
run_program(PROGRAM:"label_hide_go");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
parts
|
||||
{
|
||||
#include "photo_item_parts.edc"
|
||||
}
|
||||
|
||||
programs
|
||||
{
|
||||
#include "photo_item_programs.edc"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,191 @@
|
|||
/* Pictures */
|
||||
|
||||
part
|
||||
{
|
||||
name: "picture0_clip";
|
||||
type: RECT;
|
||||
mouse_events: 0;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
visible: 0;
|
||||
rel1
|
||||
{
|
||||
relative: 0.0 0.0;
|
||||
to: "picture0";
|
||||
}
|
||||
rel2
|
||||
{
|
||||
relative: 1.0 1.0;
|
||||
to: "picture0";
|
||||
}
|
||||
color: 255 255 255 0;
|
||||
}
|
||||
description
|
||||
{
|
||||
state: "visible" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
color: 255 255 255 255;
|
||||
}
|
||||
}
|
||||
part
|
||||
{
|
||||
name: "picture0";
|
||||
type: SWALLOW;
|
||||
mouse_events: 0;
|
||||
clip_to: "picture0_clip";
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
rel1
|
||||
{
|
||||
relative: 0.0 0.0;
|
||||
offset: 3 3;
|
||||
}
|
||||
rel2
|
||||
{
|
||||
relative: 1.0 1.0;
|
||||
offset: -3 -3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
part
|
||||
{
|
||||
name: "picture1_clip";
|
||||
type: RECT;
|
||||
mouse_events: 0;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
visible: 0;
|
||||
rel1
|
||||
{
|
||||
relative: 0.0 0.0;
|
||||
to: "picture1";
|
||||
}
|
||||
rel2
|
||||
{
|
||||
relative: 1.0 1.0;
|
||||
to: "picture1";
|
||||
}
|
||||
color: 255 255 255 0;
|
||||
}
|
||||
description
|
||||
{
|
||||
state: "visible" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
color: 255 255 255 255;
|
||||
}
|
||||
}
|
||||
part
|
||||
{
|
||||
name: "picture1";
|
||||
type: SWALLOW;
|
||||
mouse_events: 0;
|
||||
clip_to: "picture1_clip";
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
rel1
|
||||
{
|
||||
relative: 0.0 0.0;
|
||||
offset: 3 3;
|
||||
}
|
||||
rel2
|
||||
{
|
||||
relative: 1.0 1.0;
|
||||
offset: -3 -3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Border */
|
||||
|
||||
/*
|
||||
part
|
||||
{
|
||||
name: "border";
|
||||
type: IMAGE;
|
||||
mouse_events: 0;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
rel1
|
||||
{
|
||||
relative: 0.0 0.0;
|
||||
to: "picture0";
|
||||
offset: -9 -9;
|
||||
}
|
||||
rel2
|
||||
{
|
||||
relative: 1.0 1.0;
|
||||
to: "picture0";
|
||||
offset: 9 9;
|
||||
}
|
||||
image
|
||||
{
|
||||
normal: "item_border.png";
|
||||
border: 9 10 9 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/* Label */
|
||||
|
||||
part
|
||||
{
|
||||
name: "label";
|
||||
type: TEXT;
|
||||
effect: SOFT_SHADOW;
|
||||
mouse_events: 0;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
rel1
|
||||
{
|
||||
relative: 0.0 0.0;
|
||||
}
|
||||
rel2
|
||||
{
|
||||
relative: 1.0 1.0;
|
||||
}
|
||||
text
|
||||
{
|
||||
text: "Photo";
|
||||
font: "VeraBd";
|
||||
size: 10;
|
||||
min: 1 1;
|
||||
align: 0.5 1.0;
|
||||
text_class: "module_normal";
|
||||
}
|
||||
color: 0 0 0 0;
|
||||
color2: 0 0 0 0;
|
||||
color3: 0 0 0 0;
|
||||
}
|
||||
description
|
||||
{
|
||||
state: "visible" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
color: 255 255 255 255;
|
||||
color2: 0 0 0 255;
|
||||
color3: 0 0 0 255;
|
||||
}
|
||||
}
|
||||
|
||||
/* Inout */
|
||||
|
||||
part
|
||||
{
|
||||
name: "inout";
|
||||
type: RECT;
|
||||
mouse_events: 1;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
color: 255 255 255 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,171 @@
|
|||
/* Init */
|
||||
|
||||
program
|
||||
{
|
||||
name: "init";
|
||||
signal: "load";
|
||||
source: "";
|
||||
script
|
||||
{
|
||||
/* Init id and name */
|
||||
set_int(label_always, 0);
|
||||
/* Init photo parts */
|
||||
set_state(PART:"picture0_clip", "visible", 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Mouse in/out */
|
||||
|
||||
program
|
||||
{
|
||||
name: "mouse_in";
|
||||
signal: "mouse,in";
|
||||
source: "inout";
|
||||
action: SIGNAL_EMIT "mouseover" "item";
|
||||
}
|
||||
program
|
||||
{
|
||||
name: "mouse_out";
|
||||
signal: "mouse,out";
|
||||
source: "inout";
|
||||
script
|
||||
{
|
||||
if (!get_int(label_always))
|
||||
{
|
||||
run_program(PROGRAM:"label_hide_go");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Label */
|
||||
|
||||
program
|
||||
{
|
||||
name: "label_show_go";
|
||||
source: "program";
|
||||
signal: "label_show";
|
||||
action: STATE_SET "visible" 0.0;
|
||||
transition: LINEAR 0.7;
|
||||
target: "label";
|
||||
}
|
||||
program
|
||||
{
|
||||
name: "label_hide_go";
|
||||
action: STATE_SET "default" 0.0;
|
||||
transition: LINEAR 0.7;
|
||||
target: "label";
|
||||
}
|
||||
|
||||
/* Picture transitions */
|
||||
|
||||
/* Transition 0 to 1 */
|
||||
program
|
||||
{
|
||||
name: "picture_transition_0_1";
|
||||
signal: "picture_transition_0_1_go";
|
||||
script
|
||||
{
|
||||
run_program(PROGRAM:"picture_transition_0_1_a");
|
||||
run_program(PROGRAM:"picture_transition_0_1_b");
|
||||
}
|
||||
}
|
||||
program
|
||||
{
|
||||
name: "picture_transition_0_1_a";
|
||||
action: STATE_SET "visible" 0.0;
|
||||
transition: LINEAR 1;
|
||||
target: "picture1_clip";
|
||||
}
|
||||
program
|
||||
{
|
||||
name: "picture_transition_0_1_b";
|
||||
action: STATE_SET "default" 0.0;
|
||||
transition: LINEAR 1;
|
||||
target: "picture0_clip";
|
||||
after: "picture_transition_0_1_end";
|
||||
}
|
||||
program
|
||||
{
|
||||
name: "picture_transition_q_0_1";
|
||||
signal: "picture_transition_q_0_1_go";
|
||||
script
|
||||
{
|
||||
run_program(PROGRAM:"picture_transition_q_0_1_a");
|
||||
run_program(PROGRAM:"picture_transition_q_0_1_b");
|
||||
}
|
||||
}
|
||||
program
|
||||
{
|
||||
name: "picture_transition_q_0_1_a";
|
||||
action: STATE_SET "visible" 0.0;
|
||||
target: "picture1_clip";
|
||||
}
|
||||
program
|
||||
{
|
||||
name: "picture_transition_q_0_1_b";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "picture0_clip";
|
||||
after: "picture_transition_0_1_end";
|
||||
}
|
||||
|
||||
/* Transition 1 to 0 */
|
||||
program
|
||||
{
|
||||
name: "picture_transition_1_0";
|
||||
signal: "picture_transition_1_0_go";
|
||||
script
|
||||
{
|
||||
run_program(PROGRAM:"picture_transition_1_0_a");
|
||||
run_program(PROGRAM:"picture_transition_1_0_b");
|
||||
}
|
||||
}
|
||||
program
|
||||
{
|
||||
name: "picture_transition_1_0_a";
|
||||
action: STATE_SET "visible" 0.0;
|
||||
transition: LINEAR 1;
|
||||
target: "picture0_clip";
|
||||
}
|
||||
program
|
||||
{
|
||||
name: "picture_transition_1_0_b";
|
||||
action: STATE_SET "default" 0.0;
|
||||
transition: LINEAR 1;
|
||||
target: "picture1_clip";
|
||||
after: "picture_transition_1_0_end";
|
||||
}
|
||||
program
|
||||
{
|
||||
name: "picture_transition_q_1_0";
|
||||
signal: "picture_transition_q_1_0_go";
|
||||
script
|
||||
{
|
||||
run_program(PROGRAM:"picture_transition_q_1_0_a");
|
||||
run_program(PROGRAM:"picture_transition_q_1_0_b");
|
||||
}
|
||||
}
|
||||
program
|
||||
{
|
||||
name: "picture_transition_q_1_0_a";
|
||||
action: STATE_SET "visible" 0.0;
|
||||
target: "picture0_clip";
|
||||
}
|
||||
program
|
||||
{
|
||||
name: "picture_transition_q_1_0_b";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "picture1_clip";
|
||||
after: "picture_transition_1_0_end";
|
||||
}
|
||||
|
||||
/* End transitions */
|
||||
program
|
||||
{
|
||||
name: "picture_transition_0_1_end";
|
||||
action: SIGNAL_EMIT "picture_transition_0_1_end" "picture";
|
||||
}
|
||||
program
|
||||
{
|
||||
name: "picture_transition_1_0_end";
|
||||
action: SIGNAL_EMIT "picture_transition_1_0_end" "picture";
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
/* Popup info group */
|
||||
|
||||
group
|
||||
{
|
||||
name: "modules/photo/popi";
|
||||
|
||||
data
|
||||
{
|
||||
// this tells e the border is shaped
|
||||
item: "shaped" "1";
|
||||
}
|
||||
|
||||
parts
|
||||
{
|
||||
#include "photo_popi_parts.edc"
|
||||
}
|
||||
|
||||
programs
|
||||
{
|
||||
#include "photo_popi_programs.edc"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
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_info_background.png";
|
||||
border: 5 5 5 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
part
|
||||
{
|
||||
name: "icon";
|
||||
type: SWALLOW;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
color: 255 255 255 255;
|
||||
rel1
|
||||
{
|
||||
relative: 0.3 0.0;
|
||||
to_x: "background";
|
||||
offset: 0 18;
|
||||
}
|
||||
rel2
|
||||
{
|
||||
relative: 0.7 0.0;
|
||||
to_x: "background";
|
||||
offset: 0 88;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
part
|
||||
{
|
||||
name: "title";
|
||||
type: TEXT;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
rel1
|
||||
{
|
||||
relative: 0.0 1.0;
|
||||
to_x: "background";
|
||||
to_y: "icon";
|
||||
offset: 0 10;
|
||||
}
|
||||
rel2
|
||||
{
|
||||
relative: 1.0 1.0;
|
||||
to_x: "background";
|
||||
to_y: "icon";
|
||||
offset: 0 22;
|
||||
}
|
||||
color: 0 0 0 255;
|
||||
color2: 0 0 0 255;
|
||||
color3: 255 255 255 255;
|
||||
text
|
||||
{
|
||||
text: "Photo module";
|
||||
font: "Vera";
|
||||
size: 11;
|
||||
align: 0.5 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
part
|
||||
{
|
||||
name: "text";
|
||||
type: SWALLOW;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
rel1
|
||||
{
|
||||
relative: 0.0 1.0;
|
||||
to_x: "background";
|
||||
to_y: "title";
|
||||
offset: 20 10;
|
||||
}
|
||||
rel2
|
||||
{
|
||||
relative: 1.0 1.0;
|
||||
to: "background";
|
||||
offset: -5 -15;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
program
|
||||
{
|
||||
name: "close_click";
|
||||
signal: "mouse,up,1";
|
||||
source: "background";
|
||||
script
|
||||
{
|
||||
emit("close", "popup");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/* Popup warn group */
|
||||
|
||||
#define POPUP_WARN_TYPE_INFO 0
|
||||
#define POPUP_WARN_TYPE_ERROR 1
|
||||
|
||||
#define MSG_RECV_POPUP_WARN_SHOW_DISABLE 0
|
||||
#define MSG_RECV_POPUP_WARN_TYPE 1
|
||||
|
||||
group
|
||||
{
|
||||
name: "modules/photo/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_SHOW_DISABLE)
|
||||
{
|
||||
if (type == MSG_INT)
|
||||
{
|
||||
set_int(show_disabled, getarg(2));
|
||||
set_state(PART:"disable", "visible", 0.0);
|
||||
}
|
||||
}
|
||||
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 "photo_popw_parts.edc"
|
||||
}
|
||||
|
||||
programs
|
||||
{
|
||||
#include "photo_popw_programs.edc"
|
||||
}
|
||||
}
|
|
@ -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: "Photo 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";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
%define module_name photo
|
||||
|
||||
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
|
|
@ -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])
|
||||
])
|
||||
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
SUBDIRS = module
|
|
@ -0,0 +1,40 @@
|
|||
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 \
|
||||
photo_item.c \
|
||||
photo_item.h \
|
||||
photo_config.c \
|
||||
photo_config.h \
|
||||
photo_config_dialog.c \
|
||||
photo_config_dialog.h \
|
||||
photo_config_dialog_dir.c \
|
||||
photo_config_dialog_dir.h \
|
||||
photo_config_dialog_item.c \
|
||||
photo_config_dialog_item.h \
|
||||
photo_menu.c \
|
||||
photo_menu.h \
|
||||
photo_picture.c \
|
||||
photo_picture.h \
|
||||
photo_picture_histo.c \
|
||||
photo_picture_histo.h \
|
||||
photo_picture_local.c \
|
||||
photo_picture_local.h \
|
||||
photo_picture_net.c \
|
||||
photo_picture_net.h \
|
||||
photo_popup_warn.c \
|
||||
photo_popup_warn.h \
|
||||
photo_popup_info.c \
|
||||
photo_popup_info.h \
|
||||
photo_utils.c \
|
||||
photo_utils.h \
|
||||
Photo.h \
|
||||
Photo_includes.h
|
||||
module_la_LIBADD = @e_libs@
|
||||
module_la_LDFLAGS = -module -avoid-version -s
|
||||
module_la_DEPENDENCIES = $(top_builddir)/config.h
|
|
@ -0,0 +1,62 @@
|
|||
#ifndef PHOTO_H
|
||||
#define PHOTO_H
|
||||
|
||||
/* Enlightenment includes */
|
||||
#include <config.h>
|
||||
#include <e.h>
|
||||
#include <E_Lib.h>
|
||||
|
||||
/* Photo includes */
|
||||
#define E_MOD_PHOTO_TYPEDEFS 1
|
||||
#include "Photo_includes.h"
|
||||
#undef E_MOD_PHOTO_TYPEDEFS
|
||||
#include "Photo_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_PICTURE
|
||||
# define DPIC(x) do {printf("PICTURE - %s:%d: ", __FILE__, __LINE__); printf x; printf ("\n"); fflush(stdout);} while (0)
|
||||
#else
|
||||
# define DPIC(x) ((void) 0)
|
||||
#endif
|
||||
#ifdef DEBUG_PICTURE_LOCAL
|
||||
# define DPICL(x) do {printf("PICTURE LOCAL - %s:%d: ", __FILE__, __LINE__); printf x; printf ("\n"); fflush(stdout);} while (0)
|
||||
#else
|
||||
# define DPICL(x) ((void) 0)
|
||||
#endif
|
||||
#ifdef DEBUG_PICTURE_NET
|
||||
# define DPICN(x) do {printf("PICTURE NET - %s:%d: ", __FILE__, __LINE__); printf x; printf ("\n"); fflush(stdout);} while (0)
|
||||
#else
|
||||
# define DPICN(x) ((void) 0)
|
||||
#endif
|
||||
#ifdef DEBUG_POPUP_WARN
|
||||
# define DPOPW(x) do {printf("POPW - %s:%d: ", __FILE__, __LINE__); printf x; printf ("\n"); fflush(stdout);} while (0)
|
||||
#else
|
||||
# define DPOPW(x) ((void) 0)
|
||||
#endif
|
||||
#ifdef DEBUG_POPUP_INFO
|
||||
# define DPOPI(x) do {printf("POPI - %s:%d: ", __FILE__, __LINE__); printf x; printf ("\n"); fflush(stdout);} while (0)
|
||||
#else
|
||||
# define DPOPI(x) ((void) 0)
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,15 @@
|
|||
#include "e_mod_main.h"
|
||||
|
||||
#include "photo_item.h"
|
||||
#include "photo_config.h"
|
||||
#include "photo_config_dialog.h"
|
||||
#include "photo_config_dialog_dir.h"
|
||||
#include "photo_config_dialog_item.h"
|
||||
#include "photo_menu.h"
|
||||
#include "photo_picture.h"
|
||||
#include "photo_picture_histo.h"
|
||||
#include "photo_picture_local.h"
|
||||
#include "photo_picture_net.h"
|
||||
#include "photo_popup_warn.h"
|
||||
#include "photo_popup_info.h"
|
||||
#include "photo_utils.h"
|
|
@ -0,0 +1,266 @@
|
|||
#include "Photo.h"
|
||||
/* module requirements */
|
||||
EAPI E_Module_Api e_modapi =
|
||||
{
|
||||
E_MODULE_API_VERSION,
|
||||
"Photo"
|
||||
};
|
||||
|
||||
/* 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,
|
||||
"photo",
|
||||
{
|
||||
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon
|
||||
}
|
||||
};
|
||||
|
||||
/* photo functions */
|
||||
static int _e_canvas_init(void);
|
||||
static void _e_canvas_shutdown(void);
|
||||
static int _theme_init(void);
|
||||
static void _theme_shutdown(void);
|
||||
|
||||
/*
|
||||
* Module functions
|
||||
*/
|
||||
|
||||
EAPI void *
|
||||
e_modapi_init(E_Module *m)
|
||||
{
|
||||
photo = E_NEW(Photo, 1);
|
||||
photo->module = m;
|
||||
|
||||
DMAIN(("Initialisation ..."));
|
||||
|
||||
if (!_e_canvas_init())
|
||||
{
|
||||
e_module_dialog_show(m, _("Photo Module"), _("E Canvas init failed !"));
|
||||
e_modapi_shutdown(m);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!_theme_init())
|
||||
{
|
||||
e_module_dialog_show(m, _("Photo Module"), _("Theme init failed !"));
|
||||
e_modapi_shutdown(m);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!photo_config_init())
|
||||
{
|
||||
e_module_dialog_show(m, _("Photo Module"), _("Config init failed"));
|
||||
e_modapi_shutdown(m);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!photo_picture_init())
|
||||
{
|
||||
e_module_dialog_show(m, _("Photo Module"), _("Picture subsystem init failed"));
|
||||
e_modapi_shutdown(m);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!photo_popup_warn_init())
|
||||
{
|
||||
e_module_dialog_show(m, _("Photo Module"), _("Popup warn subsystem init failed"));
|
||||
e_modapi_shutdown(m);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!photo_popup_info_init())
|
||||
{
|
||||
e_module_dialog_show(m, _("Photo Module"), _("Popup info subsystem init failed"));
|
||||
e_modapi_shutdown(m);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
e_gadcon_provider_register((E_Gadcon_Client_Class *)&_gadcon_class);
|
||||
|
||||
DMAIN(("Initialisation END"));
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_shutdown(E_Module *m)
|
||||
{
|
||||
if (!photo) return 0;
|
||||
|
||||
e_gadcon_provider_unregister((E_Gadcon_Client_Class *)&_gadcon_class);
|
||||
|
||||
photo_popup_info_shutdown();
|
||||
photo_popup_warn_shutdown();
|
||||
photo_picture_shutdown();
|
||||
photo_config_shutdown();
|
||||
|
||||
if (photo->config_dialog)
|
||||
photo_config_dialog_hide();
|
||||
if (photo->config_dialog_adddir)
|
||||
photo_config_dialog_dir_hide(NULL);
|
||||
|
||||
_theme_shutdown();
|
||||
_e_canvas_shutdown();
|
||||
|
||||
E_FREE(photo);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_save(E_Module *m)
|
||||
{
|
||||
if (!photo) return 0;
|
||||
|
||||
photo_config_save();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_about(E_Module *m)
|
||||
{
|
||||
e_module_dialog_show(m, _("Enlightenment Photo Module - version " MODULE_VERSION),
|
||||
_("Module to display pictures on your desktop<br><br>"
|
||||
"ooookiwi@free.fr<br>"
|
||||
"http://oooo.zapto.org"
|
||||
));
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_config(E_Module *m)
|
||||
{
|
||||
if (!photo) return 0;
|
||||
if (photo->config_dialog) return 0;
|
||||
|
||||
photo_config_dialog_show();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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;
|
||||
Photo_Item *pi;
|
||||
|
||||
DMAIN(("GCC init"));
|
||||
|
||||
o = edje_object_add(gc->evas);
|
||||
gcc = e_gadcon_client_new(gc, name, id, style, o);
|
||||
pi = photo_item_add(gcc, o);
|
||||
gcc->data = pi;
|
||||
|
||||
photo->items = evas_list_append(photo->items, pi);
|
||||
|
||||
return pi->gcc;
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_shutdown(E_Gadcon_Client *gcc)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
|
||||
pi = gcc->data;
|
||||
|
||||
DMAIN(("GCC shutdown"));
|
||||
photo->items = evas_list_remove(photo->items, pi);
|
||||
photo_item_del(pi);
|
||||
}
|
||||
|
||||
static void
|
||||
_gc_orient(E_Gadcon_Client *gcc)
|
||||
{
|
||||
e_gadcon_client_aspect_set(gcc, 16, 16);
|
||||
e_gadcon_client_min_size_set(gcc, 16, 16);
|
||||
}
|
||||
|
||||
static char *
|
||||
_gc_label(void)
|
||||
{
|
||||
return _("Photo");
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_gc_icon(Evas *evas)
|
||||
{
|
||||
Evas_Object *o;
|
||||
char buf[4096];
|
||||
|
||||
o = edje_object_add(evas);
|
||||
snprintf(buf, sizeof(buf), "%s/module.eap",
|
||||
e_module_dir_get(photo->module));
|
||||
edje_object_file_set(o, buf, "icon");
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Photo functions
|
||||
*/
|
||||
|
||||
static int _e_canvas_init(void)
|
||||
{
|
||||
E_Container *c;
|
||||
|
||||
c = e_container_current_get(e_manager_current_get());
|
||||
evas_output_viewport_get(c->bg_evas,
|
||||
NULL, NULL,
|
||||
&photo->canvas_w, &photo->canvas_h);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void _e_canvas_shutdown(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static int _theme_init(void)
|
||||
{
|
||||
char buf[4096];
|
||||
const char *path;
|
||||
const char *version;
|
||||
|
||||
path = e_theme_edje_file_get(PHOTO_THEME_IN_E, PHOTO_THEME_ITEM);
|
||||
if (path && path[0])
|
||||
{
|
||||
version = edje_file_data_get(path, "version");
|
||||
DD(("THEME E path %s version %s", path, version));
|
||||
if ( !version || strcmp(version, PHOTO_THEME_VERSION) )
|
||||
return 0;
|
||||
photo->theme = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s/photo.edj", e_module_dir_get(photo->module));
|
||||
version = edje_file_data_get(buf, "version");
|
||||
DD(("THEME own version %s", version));
|
||||
if ( !version || strcmp(version, PHOTO_THEME_VERSION) )
|
||||
return 0;
|
||||
photo->theme = strdup(buf);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void _theme_shutdown(void)
|
||||
{
|
||||
if (photo->theme)
|
||||
{
|
||||
E_FREE(photo->theme);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
#ifdef E_MOD_PHOTO_TYPEDEFS
|
||||
|
||||
typedef struct _Photo Photo;
|
||||
|
||||
#else
|
||||
|
||||
#ifndef E_MOD_MAIN_H_INCLUDED
|
||||
#define E_MOD_MAIN_H_INCLUDED
|
||||
|
||||
#define PHOTO_THEME_VERSION "1"
|
||||
#define PHOTO_THEME_IN_E "base/theme/modules/photo"
|
||||
#define PHOTO_THEME_ITEM "modules/photo/item"
|
||||
#define PHOTO_THEME_POPI "modules/photo/popi"
|
||||
#define PHOTO_THEME_POPW "modules/photo/popw"
|
||||
#define PHOTO_THEME_ICON_INFOS "modules/photo/icon/infos"
|
||||
#define PHOTO_THEME_ICON_NEXT "modules/photo/icon/next"
|
||||
#define PHOTO_THEME_ICON_PREVIOUS "modules/photo/icon/previous"
|
||||
#define PHOTO_THEME_ICON_PAUSE "modules/photo/icon/pause"
|
||||
#define PHOTO_THEME_ICON_RESUME "modules/photo/icon/resume"
|
||||
#define PHOTO_THEME_ICON_SETBG "modules/photo/icon/setbg"
|
||||
#define PHOTO_THEME_ICON_VIEWER "modules/photo/icon/viewer"
|
||||
#define PHOTO_THEME_ICON_DIR_NOT_LOADED "modules/photo/icon/dir/not_loaded"
|
||||
#define PHOTO_THEME_ICON_DIR_LOADING "modules/photo/icon/dir/loading"
|
||||
#define PHOTO_THEME_ICON_DIR_LOADED "modules/photo/icon/dir/loaded"
|
||||
|
||||
struct _Photo
|
||||
{
|
||||
E_Module *module;
|
||||
|
||||
Photo_Config *config;
|
||||
E_Config_Dialog *config_dialog;
|
||||
E_Config_Dialog *config_dialog_adddir;
|
||||
|
||||
Evas_List *items;
|
||||
Evas_List *setbg_topurge;
|
||||
|
||||
char *theme;
|
||||
|
||||
Evas *e_evas;
|
||||
char *display;
|
||||
int canvas_w, canvas_h;
|
||||
};
|
||||
|
||||
Photo *photo;
|
||||
|
||||
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
|
||||
|
|
@ -0,0 +1,230 @@
|
|||
#include "Photo.h"
|
||||
|
||||
static E_Config_DD *_photo_edd = NULL;
|
||||
static E_Config_DD *_photo_dir_edd = NULL;
|
||||
static E_Config_DD *_photo_item_edd = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* Public functions
|
||||
*/
|
||||
|
||||
int photo_config_init(void)
|
||||
{
|
||||
Evas_List *l;
|
||||
char buf[4096];
|
||||
|
||||
_photo_dir_edd = E_CONFIG_DD_NEW("Photo_Local_Dir", Picture_Local_Dir);
|
||||
#undef T
|
||||
#undef D
|
||||
#define T Picture_Local_Dir
|
||||
#define D _photo_dir_edd
|
||||
E_CONFIG_VAL(D, T, path, STR);
|
||||
E_CONFIG_VAL(D, T, recursive, SHORT);
|
||||
E_CONFIG_VAL(D, T, read_hidden, SHORT);
|
||||
_photo_item_edd = E_CONFIG_DD_NEW("Photo_Item", Photo_Config_Item);
|
||||
#undef T
|
||||
#undef D
|
||||
#define T Photo_Config_Item
|
||||
#define D _photo_item_edd
|
||||
E_CONFIG_VAL(D, T, id, STR);
|
||||
E_CONFIG_VAL(D, T, timer_s, INT);
|
||||
E_CONFIG_VAL(D, T, timer_active, SHORT);
|
||||
E_CONFIG_VAL(D, T, alpha, SHORT);
|
||||
E_CONFIG_VAL(D, T, show_label, SHORT);
|
||||
E_CONFIG_VAL(D, T, action_mouse_over, SHORT);
|
||||
E_CONFIG_VAL(D, T, action_mouse_left, SHORT);
|
||||
E_CONFIG_VAL(D, T, action_mouse_middle, SHORT);
|
||||
_photo_edd = E_CONFIG_DD_NEW("Photo", Photo_Config);
|
||||
#undef T
|
||||
#undef D
|
||||
#define T Photo_Config
|
||||
#define D _photo_edd
|
||||
E_CONFIG_VAL(D, T, version, SHORT);
|
||||
E_CONFIG_VAL(D, T, show_label, SHORT);
|
||||
E_CONFIG_VAL(D, T, nice_trans, SHORT);
|
||||
E_CONFIG_VAL(D, T, pictures_from, SHORT);
|
||||
E_CONFIG_VAL(D, T, pictures_set_bg_purge, SHORT);
|
||||
E_CONFIG_VAL(D, T, pictures_viewer, STR);
|
||||
E_CONFIG_VAL(D, T, pictures_thumb_size, SHORT);
|
||||
E_CONFIG_LIST(D, T, local.dirs, _photo_dir_edd);
|
||||
E_CONFIG_VAL(D, T, local.auto_reload, SHORT);
|
||||
E_CONFIG_VAL(D, T, local.popup, SHORT);
|
||||
E_CONFIG_VAL(D, T, local.thumb_msg, SHORT);
|
||||
E_CONFIG_VAL(D, T, action_mouse_over, SHORT);
|
||||
E_CONFIG_VAL(D, T, action_mouse_left, SHORT);
|
||||
E_CONFIG_VAL(D, T, action_mouse_middle, SHORT);
|
||||
E_CONFIG_LIST(D, T, items, _photo_item_edd);
|
||||
photo->config = e_config_domain_load("module.photo", _photo_edd);
|
||||
|
||||
if (photo->config)
|
||||
{
|
||||
if (photo->config->version < CONFIG_VERSION)
|
||||
{
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("<hilight>Photo module : Configuration Upgraded</hilight><br><br>"
|
||||
"Your configuration of photo module<br>"
|
||||
"has been upgraded<br>"
|
||||
"Your settings were removed<br>"
|
||||
"Sorry for the inconvenience<br><br>"
|
||||
"(%d -> %d)"), photo->config->version, CONFIG_VERSION);
|
||||
e_module_dialog_show(photo->module, _("Photo Module version " MODULE_VERSION), buf);
|
||||
photo->config = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (photo->config->version > CONFIG_VERSION)
|
||||
{
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("<hilight>Photo module : Configuration Downgraded</hilight><br><br>"
|
||||
"Your configuration of Photo module<br>"
|
||||
"has been downgraded<br>"
|
||||
"Your settings were removed<br>"
|
||||
"Sorry for the inconvenience<br><br>"
|
||||
"(%d ->%d)"), photo->config->version, CONFIG_VERSION);
|
||||
e_module_dialog_show(photo->module, _("Photo Module version " MODULE_VERSION), buf);
|
||||
photo->config = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!photo->config)
|
||||
{
|
||||
Photo_Config *c;
|
||||
c = E_NEW(Photo_Config, 1);
|
||||
c->version = CONFIG_VERSION;
|
||||
c->show_label = ITEM_SHOW_LABEL_DEFAULT;
|
||||
c->nice_trans = ITEM_NICE_TRANS_DEFAULT;
|
||||
c->pictures_from = PICTURE_FROM_DEFAULT;
|
||||
c->pictures_set_bg_purge = PICTURE_SET_BG_PURGE_DEFAULT;
|
||||
c->pictures_viewer = evas_stringshare_add(PICTURE_VIEWER_DEFAULT);
|
||||
c->pictures_thumb_size = PICTURE_THUMB_SIZE_DEFAULT;
|
||||
c->local.dirs = evas_list_append(c->local.dirs,
|
||||
photo_picture_local_dir_new((char *)e_module_dir_get(photo->module),
|
||||
1, 0));
|
||||
c->local.auto_reload = PICTURE_LOCAL_AUTO_RELOAD_DEFAULT;
|
||||
c->local.popup = PICTURE_LOCAL_POPUP_DEFAULT;
|
||||
c->local.thumb_msg = 1;
|
||||
c->action_mouse_over = ITEM_MOUSE_OVER_ACTION_DEFAULT;
|
||||
c->action_mouse_left = ITEM_MOUSE_LEFT_ACTION_DEFAULT;
|
||||
c->action_mouse_middle = ITEM_MOUSE_MIDDLE_ACTION_DEFAULT;
|
||||
photo->config = c;
|
||||
}
|
||||
|
||||
E_CONFIG_LIMIT(photo->config->show_label, 0, 1);
|
||||
E_CONFIG_LIMIT(photo->config->nice_trans, 0, 1);
|
||||
E_CONFIG_LIMIT(photo->config->pictures_from, 0, 2);
|
||||
E_CONFIG_LIMIT(photo->config->local.auto_reload, 0, 1);
|
||||
E_CONFIG_LIMIT(photo->config->local.popup, 0, 2);
|
||||
E_CONFIG_LIMIT(photo->config->local.thumb_msg, 0, 1);
|
||||
E_CONFIG_LIMIT(photo->config->pictures_set_bg_purge, 0, 1);
|
||||
|
||||
for (l=photo->config->local.dirs; l; l=evas_list_next(l))
|
||||
{
|
||||
Picture_Local_Dir *dir;
|
||||
dir = evas_list_data(l);
|
||||
|
||||
E_CONFIG_LIMIT(dir->recursive, 0, 1);
|
||||
E_CONFIG_LIMIT(dir->read_hidden, 0, 1);
|
||||
dir->state = PICTURE_LOCAL_DIR_NOT_LOADED;
|
||||
dir->config_dialog = NULL;
|
||||
}
|
||||
|
||||
for (l=photo->config->items; l; l=evas_list_next(l))
|
||||
{
|
||||
Photo_Config_Item *pic;
|
||||
pic = evas_list_data(l);
|
||||
|
||||
E_CONFIG_LIMIT(pic->timer_s, ITEM_TIMER_S_MIN, ITEM_TIMER_S_MAX);
|
||||
E_CONFIG_LIMIT(pic->timer_active, 0, 1);
|
||||
E_CONFIG_LIMIT(pic->alpha, 0, 255);
|
||||
E_CONFIG_LIMIT(pic->show_label, ITEM_SHOW_LABEL_NO, ITEM_SHOW_LABEL_PARENT);
|
||||
E_CONFIG_LIMIT(pic->action_mouse_over, ITEM_ACTION_NO, ITEM_ACTION_PARENT);
|
||||
E_CONFIG_LIMIT(pic->action_mouse_left, ITEM_ACTION_NO, ITEM_ACTION_PARENT);
|
||||
E_CONFIG_LIMIT(pic->action_mouse_middle, ITEM_ACTION_NO, ITEM_ACTION_PARENT);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int photo_config_shutdown(void)
|
||||
{
|
||||
Photo_Config *c;
|
||||
Evas_List *l;
|
||||
|
||||
c = photo->config;
|
||||
for (l=c->local.dirs; l; l=evas_list_next(l))
|
||||
{
|
||||
Picture_Local_Dir *d;
|
||||
d = evas_list_data(l);
|
||||
photo_picture_local_dir_free(d, 1);
|
||||
}
|
||||
evas_list_free(c->local.dirs);
|
||||
for (l=c->items; l; l=evas_list_next(l))
|
||||
{
|
||||
Photo_Config_Item *pic;
|
||||
pic = evas_list_data(l);
|
||||
photo_config_item_free(pic);
|
||||
}
|
||||
evas_list_free(c->items);
|
||||
|
||||
E_FREE(photo->config);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int photo_config_save(void)
|
||||
{
|
||||
e_config_domain_save("module.photo", _photo_edd, photo->config);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
Photo_Config_Item *photo_config_item_new(const char *id)
|
||||
{
|
||||
Photo_Config_Item *pic;
|
||||
Evas_List *l;
|
||||
|
||||
DCONF(("Item new config"));
|
||||
|
||||
/* is there already an item config for this id ? */
|
||||
for (l=photo->config->items; l; l=evas_list_next(l))
|
||||
{
|
||||
pic = evas_list_data(l);
|
||||
if (!strcmp(pic->id, id))
|
||||
{
|
||||
DCONF(("config found ! %s", pic->id));
|
||||
return pic;
|
||||
}
|
||||
}
|
||||
|
||||
DCONF(("config NOT found ! creating new one %s", id));
|
||||
/* no, create a new item config */
|
||||
pic = E_NEW(Photo_Config_Item, 1);
|
||||
pic->id = evas_stringshare_add(id);
|
||||
pic->timer_s = ITEM_TIMER_S_DEFAULT;
|
||||
pic->timer_active = ITEM_TIMER_ACTIVE_DEFAULT;
|
||||
pic->alpha = ITEM_ALPHA_DEFAULT;
|
||||
pic->show_label = ITEM_SHOW_LABEL_PARENT;
|
||||
pic->action_mouse_over = ITEM_ACTION_PARENT;
|
||||
pic->action_mouse_left = ITEM_ACTION_PARENT;
|
||||
pic->action_mouse_middle = ITEM_ACTION_PARENT;
|
||||
|
||||
photo->config->items = evas_list_append(photo->config->items, pic);
|
||||
|
||||
return pic;
|
||||
}
|
||||
|
||||
void photo_config_item_free(Photo_Config_Item *pic)
|
||||
{
|
||||
evas_stringshare_del(pic->id);
|
||||
|
||||
photo->config->items = evas_list_remove(photo->config->items, pic);
|
||||
free(pic);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Private functions
|
||||
*
|
||||
*/
|
|
@ -0,0 +1,67 @@
|
|||
#ifdef E_MOD_PHOTO_TYPEDEFS
|
||||
|
||||
typedef struct _Photo_Config Photo_Config;
|
||||
typedef struct _Photo_Config_Item Photo_Config_Item;
|
||||
|
||||
#else
|
||||
|
||||
#ifndef PHOTO_CONFIG_H_INCLUDED
|
||||
#define PHOTO_CONFIG_H_INCLUDED
|
||||
|
||||
#define CONFIG_VERSION 3
|
||||
|
||||
struct _Photo_Config
|
||||
{
|
||||
int version;
|
||||
|
||||
int show_label;
|
||||
int nice_trans;
|
||||
|
||||
int pictures_from;
|
||||
int pictures_set_bg_purge;
|
||||
const char *pictures_viewer;
|
||||
int pictures_thumb_size;
|
||||
struct
|
||||
{
|
||||
Evas_List *dirs;
|
||||
int auto_reload;
|
||||
int popup;
|
||||
int thumb_msg;
|
||||
} local;
|
||||
struct
|
||||
{
|
||||
|
||||
} net;
|
||||
|
||||
int action_mouse_over;
|
||||
int action_mouse_left;
|
||||
int action_mouse_middle;
|
||||
|
||||
Evas_List *items;
|
||||
};
|
||||
|
||||
struct _Photo_Config_Item
|
||||
{
|
||||
const char *id;
|
||||
|
||||
int timer_s;
|
||||
int timer_active;
|
||||
|
||||
int alpha;
|
||||
int show_label;
|
||||
|
||||
int action_mouse_over;
|
||||
int action_mouse_left;
|
||||
int action_mouse_middle;
|
||||
};
|
||||
|
||||
int photo_config_init(void);
|
||||
int photo_config_shutdown(void);
|
||||
|
||||
int photo_config_save(void);
|
||||
|
||||
Photo_Config_Item *photo_config_item_new(const char *id);
|
||||
void photo_config_item_free(Photo_Config_Item *pic);
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,480 @@
|
|||
#include "Photo.h"
|
||||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
Evas_Object *ilist_local_dirs;
|
||||
Evas_Object *button_local_load_start;
|
||||
Evas_Object *button_local_load_stop;
|
||||
Evas_Object *textblock_local_infos;
|
||||
|
||||
int show_label;
|
||||
int nice_trans;
|
||||
|
||||
int pictures_from;
|
||||
int pictures_set_bg_purge;
|
||||
char *pictures_viewer;
|
||||
int pictures_thumb_size;
|
||||
struct
|
||||
{
|
||||
int auto_reload;
|
||||
int popup;
|
||||
} local;
|
||||
|
||||
int action_mouse_over;
|
||||
int action_mouse_left;
|
||||
int action_mouse_middle;
|
||||
};
|
||||
|
||||
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 void _common_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata, Evas_Object *o);
|
||||
static int _common_apply_data(E_Config_Dialog *cfd, 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 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_dir_list(void *data);
|
||||
static void _cb_dir_add(void *data, void *data2);
|
||||
static void _cb_dir_del(void *data, void *data2);
|
||||
static void _cb_dir_config(void *data, void *data2);
|
||||
static void _cb_dir_reload(void *data, void *data2);
|
||||
static void _cb_dir_stopload(void *data, void *data2);
|
||||
|
||||
/*
|
||||
* Public functions
|
||||
*/
|
||||
|
||||
int photo_config_dialog_show(void)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
char buf[4096];
|
||||
|
||||
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;
|
||||
v->advanced.apply_cfdata = _advanced_apply_data;
|
||||
v->advanced.create_widgets = _advanced_create_widgets;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/module.eap", e_module_dir_get(photo->module));
|
||||
cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()),
|
||||
_("Photo Configuration"), buf, 0, v, NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void photo_config_dialog_hide(void)
|
||||
{
|
||||
e_object_del(E_OBJECT(photo->config_dialog));
|
||||
photo->config_dialog = NULL;
|
||||
}
|
||||
|
||||
void photo_config_dialog_refresh_local_infos(void)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
char buf[100];
|
||||
|
||||
if (!photo->config_dialog) return;
|
||||
cfdata = photo->config_dialog->cfdata;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%d pictures loaded, %d to thumb",
|
||||
photo_picture_local_loaded_nb_get(),
|
||||
photo_picture_local_tothumb_nb_get());
|
||||
e_widget_textblock_plain_set(cfdata->textblock_local_infos, buf);
|
||||
}
|
||||
|
||||
void photo_config_dialog_refresh_local_dirs(void)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
Evas_List *l;
|
||||
Evas_Object *ilist_dirs;
|
||||
int pos;
|
||||
|
||||
if (!photo->config_dialog) return;
|
||||
cfdata = photo->config_dialog->cfdata;
|
||||
|
||||
ilist_dirs = cfdata->ilist_local_dirs;
|
||||
|
||||
pos = e_widget_ilist_selected_get(ilist_dirs);
|
||||
e_widget_ilist_clear(ilist_dirs);
|
||||
|
||||
for(l=photo->config->local.dirs; l; l=evas_list_next(l))
|
||||
{
|
||||
Evas_Object *ic;
|
||||
Picture_Local_Dir *dir;
|
||||
char buf[1024];
|
||||
|
||||
dir = evas_list_data(l);
|
||||
|
||||
ic = e_icon_add(evas_object_evas_get(ilist_dirs));
|
||||
switch(dir->state)
|
||||
{
|
||||
case PICTURE_LOCAL_DIR_NOT_LOADED:
|
||||
photo_util_icon_set(ic, PHOTO_THEME_ICON_DIR_NOT_LOADED);
|
||||
break;
|
||||
case PICTURE_LOCAL_DIR_LOADING:
|
||||
photo_util_icon_set(ic, PHOTO_THEME_ICON_DIR_LOADING);
|
||||
break;
|
||||
case PICTURE_LOCAL_DIR_LOADED:
|
||||
photo_util_icon_set(ic, PHOTO_THEME_ICON_DIR_LOADED);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!dir->recursive)
|
||||
snprintf(buf, sizeof(buf), "%s", dir->path);
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "%s [recursive]", dir->path);
|
||||
|
||||
e_widget_ilist_append(ilist_dirs, ic, buf, _cb_dir_list, cfdata, NULL);
|
||||
}
|
||||
|
||||
if (!evas_list_count(photo->config->local.dirs))
|
||||
e_widget_min_size_set(ilist_dirs, 165, 120);
|
||||
else
|
||||
{
|
||||
int wmw, wmh;
|
||||
e_widget_min_size_get(ilist_dirs, &wmw, &wmh);
|
||||
e_widget_min_size_set(ilist_dirs, wmw, 120);
|
||||
}
|
||||
|
||||
e_widget_ilist_go(ilist_dirs);
|
||||
e_widget_ilist_selected_set(ilist_dirs, pos);
|
||||
}
|
||||
|
||||
void photo_config_dialog_refresh_local_load(void)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
if (!photo->config_dialog) return;
|
||||
cfdata = photo->config_dialog->cfdata;
|
||||
|
||||
if (photo_picture_local_load_state_get())
|
||||
{
|
||||
e_widget_disabled_set(cfdata->button_local_load_start, 1);
|
||||
e_widget_disabled_set(cfdata->button_local_load_stop, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
e_widget_disabled_set(cfdata->button_local_load_start, 0);
|
||||
e_widget_disabled_set(cfdata->button_local_load_stop, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Private functions
|
||||
*
|
||||
*/
|
||||
|
||||
static void *
|
||||
_create_data(E_Config_Dialog *cfd)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
photo->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->pictures_viewer);
|
||||
photo->config_dialog = NULL;
|
||||
free(cfdata);
|
||||
}
|
||||
|
||||
static void
|
||||
_fill_data(E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
cfdata->show_label = photo->config->show_label;
|
||||
cfdata->nice_trans = photo->config->nice_trans;
|
||||
|
||||
cfdata->pictures_from = photo->config->pictures_from;
|
||||
cfdata->pictures_set_bg_purge = photo->config->pictures_set_bg_purge;
|
||||
cfdata->pictures_viewer = strdup(photo->config->pictures_viewer);
|
||||
cfdata->pictures_thumb_size = photo->config->pictures_thumb_size;
|
||||
cfdata->local.auto_reload = photo->config->local.auto_reload;
|
||||
cfdata->local.popup = photo->config->local.popup;
|
||||
|
||||
cfdata->action_mouse_over = photo->config->action_mouse_over;
|
||||
cfdata->action_mouse_left = photo->config->action_mouse_left;
|
||||
cfdata->action_mouse_middle = photo->config->action_mouse_middle;
|
||||
}
|
||||
|
||||
static void
|
||||
_common_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata, Evas_Object *o)
|
||||
{
|
||||
Evas_Object *of, *ob;
|
||||
E_Radio_Group *rg;
|
||||
int wmw, wmh;
|
||||
|
||||
|
||||
of = e_widget_frametable_add(evas, _("Picture directories"), 0);
|
||||
|
||||
ob = e_widget_textblock_add(evas);
|
||||
cfdata->textblock_local_infos = ob;
|
||||
photo_config_dialog_refresh_local_infos();
|
||||
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, 3, 1, 1, 1, 1, 1);
|
||||
|
||||
ob = e_widget_ilist_add(evas, 16, 16, NULL);
|
||||
e_widget_ilist_selector_set(ob, 1);
|
||||
cfdata->ilist_local_dirs = ob;
|
||||
photo_config_dialog_refresh_local_dirs();
|
||||
e_widget_frametable_object_append(of, ob, 0, 1, 3, 1, 1, 1, 1, 1);
|
||||
|
||||
ob = e_widget_button_add(evas, _("Add"), NULL, _cb_dir_add, cfdata, NULL);
|
||||
e_widget_frametable_object_append(of, ob, 0, 2, 1, 1, 1, 1, 1, 1);
|
||||
ob = e_widget_button_add(evas, _("Delete"), NULL, _cb_dir_del, cfdata, NULL);
|
||||
e_widget_frametable_object_append(of, ob, 1, 2, 1, 1, 1, 1, 1, 1);
|
||||
ob = e_widget_button_add(evas, _("Configure"), NULL, _cb_dir_config, cfdata, NULL);
|
||||
e_widget_frametable_object_append(of, ob, 2, 2, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
ob = e_widget_button_add(evas, _("Reload picture directories"), NULL, _cb_dir_reload, cfdata, NULL);
|
||||
cfdata->button_local_load_start = ob;
|
||||
e_widget_frametable_object_append(of, ob, 0, 3, 3, 1, 1, 1, 1, 1);
|
||||
ob = e_widget_button_add(evas, _("Stop loading"), NULL, _cb_dir_stopload, cfdata, NULL);
|
||||
cfdata->button_local_load_stop = ob;
|
||||
e_widget_frametable_object_append(of, ob, 0, 4, 3, 1, 1, 1, 1, 1);
|
||||
photo_config_dialog_refresh_local_load();
|
||||
|
||||
e_widget_table_object_append(o, of, 0, 0, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
of = e_widget_frametable_add(evas, _("Appearance"), 0);
|
||||
|
||||
ob = e_widget_check_add(evas, _("Always show label"), &(cfdata->show_label));
|
||||
e_widget_frametable_object_append(of, ob, 0, 0, 2, 1, 1, 1, 1, 1);
|
||||
ob = e_widget_check_add(evas, _("Nice transitions"), &(cfdata->nice_trans));
|
||||
e_widget_frametable_object_append(of, ob, 0, 1, 2, 1, 1, 1, 1, 1);
|
||||
|
||||
e_widget_table_object_append(o, of, 0, 1, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
|
||||
of = e_widget_frametable_add(evas, _("Mouse actions"), 0);
|
||||
|
||||
ob = e_widget_label_add(evas, _("Over"));
|
||||
e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 1, 1, 1);
|
||||
CONFIG_DIALOG_ACTION_CHOICE(of, 0, 2, cfdata->action_mouse_over, ITEM_ACTION_NO);
|
||||
|
||||
ob = e_widget_label_add(evas, _("Left"));
|
||||
e_widget_frametable_object_append(of, ob, 1, 0, 1, 1, 1, 1, 1, 1);
|
||||
ob = e_widget_label_add(evas, _("click"));
|
||||
e_widget_frametable_object_append(of, ob, 1, 1, 1, 1, 1, 1, 1, 1);
|
||||
CONFIG_DIALOG_ACTION_CHOICE(of, 1, 2, cfdata->action_mouse_left, ITEM_ACTION_NO);
|
||||
|
||||
ob = e_widget_label_add(evas, _("Middle"));
|
||||
e_widget_frametable_object_append(of, ob, 2, 0, 1, 1, 1, 1, 1, 1);
|
||||
ob = e_widget_label_add(evas, _("click"));
|
||||
e_widget_frametable_object_append(of, ob, 2, 1, 1, 1, 1, 1, 1, 1);
|
||||
CONFIG_DIALOG_ACTION_CHOICE(of, 2, 2, cfdata->action_mouse_middle, ITEM_ACTION_NO);
|
||||
CONFIG_DIALOG_ACTION_CHOICE_LABELS(of, 3, 2, _("No"));
|
||||
|
||||
|
||||
e_widget_table_object_append(o, of, 1, 0, 1, 1, 1, 1, 1, 1);
|
||||
}
|
||||
|
||||
static int
|
||||
_common_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
if ( (photo->config->show_label != cfdata->show_label ) ||
|
||||
(photo->config->action_mouse_over != cfdata->action_mouse_over) ||
|
||||
(photo->config->action_mouse_left != cfdata->action_mouse_left) ||
|
||||
(photo->config->action_mouse_middle != cfdata->action_mouse_middle) )
|
||||
{
|
||||
photo->config->show_label = cfdata->show_label;
|
||||
|
||||
photo->config->action_mouse_over = cfdata->action_mouse_over;
|
||||
photo->config->action_mouse_left = cfdata->action_mouse_left;
|
||||
photo->config->action_mouse_middle = cfdata->action_mouse_middle;
|
||||
|
||||
photo_item_label_mode_set(NULL);
|
||||
}
|
||||
|
||||
photo->config->nice_trans = cfdata->nice_trans;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Evas_Object *o;
|
||||
|
||||
o = e_widget_table_add(evas, 0);
|
||||
|
||||
_common_create_widgets(cfd, evas, cfdata, o);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
static int
|
||||
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = _common_apply_data(cfd, cfdata);
|
||||
|
||||
photo_config_save();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_advanced_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_table_add(evas, 0);
|
||||
|
||||
_common_create_widgets(cfd, evas, cfdata, o);
|
||||
|
||||
|
||||
of = e_widget_frametable_add(evas, _("Misc"), 0);
|
||||
|
||||
ob = e_widget_check_add(evas, _("Remove generated backgrounds"),
|
||||
&(cfdata->pictures_set_bg_purge));
|
||||
e_widget_frametable_object_append(of, ob, 0, 0, 2, 1, 1, 1, 1, 1);
|
||||
|
||||
ob = e_widget_label_add(evas, _("Pictures viewer"));
|
||||
e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 1, 1, 1);
|
||||
ob = e_widget_entry_add(evas, &(cfdata->pictures_viewer));
|
||||
e_widget_min_size_set(ob, 80, 25);
|
||||
e_widget_frametable_object_append(of, ob, 1, 1, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
ob = e_widget_label_add(evas, _("Images Quality"));
|
||||
e_widget_frametable_object_append(of, ob, 0, 2, 1, 1, 1, 1, 1, 1);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f pix"),
|
||||
(float)PICTURE_THUMB_SIZE_MIN,
|
||||
(float)PICTURE_THUMB_SIZE_MAX,
|
||||
100.0, 0,
|
||||
NULL, &(cfdata->pictures_thumb_size), 80);
|
||||
e_widget_frametable_object_append(of, ob, 1, 2, 1, 1, 1, 0, 1, 0);
|
||||
|
||||
ob = e_widget_check_add(evas, _("Automaticly reload directories"),
|
||||
&(cfdata->local.auto_reload));
|
||||
e_widget_frametable_object_append(of, ob, 0, 3, 2, 1, 1, 1, 1, 1);
|
||||
ob = e_widget_label_add(evas, _("when add / modify directory list"));
|
||||
e_widget_frametable_object_append(of, ob, 0, 4, 2, 1, 1, 1, 1, 1);
|
||||
|
||||
|
||||
e_widget_table_object_append(o, of, 1, 1, 1, 2, 1, 1, 1, 1);
|
||||
|
||||
|
||||
of = e_widget_frametable_add(evas, _("Popups"), 0);
|
||||
|
||||
ob = e_widget_label_add(evas, _("Picture loader popup"));
|
||||
e_widget_frametable_object_append(of, ob, 0, 0, 2, 1, 1, 1, 1, 1);
|
||||
rg = e_widget_radio_group_new(&(cfdata->local.popup));
|
||||
ob = e_widget_radio_add(evas, _("Never"), PICTURE_LOCAL_POPUP_NEVER, rg);
|
||||
e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 1, 1, 1);
|
||||
ob = e_widget_radio_add(evas, _("Summary"), PICTURE_LOCAL_POPUP_SUM, rg);
|
||||
e_widget_frametable_object_append(of, ob, 1, 1, 1, 1, 1, 1, 1, 1);
|
||||
ob = e_widget_radio_add(evas, _("Verbose"), PICTURE_LOCAL_POPUP_ALWAYS, rg);
|
||||
e_widget_frametable_object_append(of, ob, 2, 1, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
e_widget_table_object_append(o, of, 0, 2, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
static int
|
||||
_advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = _common_apply_data(cfd, cfdata);
|
||||
|
||||
photo->config->pictures_set_bg_purge = cfdata->pictures_set_bg_purge;
|
||||
if (photo->config->pictures_viewer)
|
||||
evas_stringshare_del(photo->config->pictures_viewer);
|
||||
photo->config->pictures_viewer = evas_stringshare_add(cfdata->pictures_viewer);
|
||||
photo->config->pictures_thumb_size = cfdata->pictures_thumb_size;
|
||||
|
||||
photo->config->local.auto_reload = cfdata->local.auto_reload;
|
||||
photo->config->local.popup = cfdata->local.popup;
|
||||
|
||||
photo_config_save();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
_cb_dir_list(void *data)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
cfdata = data;
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_dir_add(void *data, void *data2)
|
||||
{
|
||||
if (photo->config_dialog_adddir) return;
|
||||
|
||||
photo_config_dialog_dir_show(NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_dir_del(void *data, void *data2)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
Picture_Local_Dir *dir;
|
||||
|
||||
cfdata = data;
|
||||
dir = evas_list_nth(photo->config->local.dirs,
|
||||
e_widget_ilist_selected_get(cfdata->ilist_local_dirs));
|
||||
if (!dir || (dir->state == PICTURE_LOCAL_DIR_LOADING))
|
||||
return;
|
||||
|
||||
photo->config->local.dirs = evas_list_remove(photo->config->local.dirs, dir);
|
||||
photo_picture_local_dir_free(dir, 1);
|
||||
|
||||
photo_config_save();
|
||||
|
||||
if (photo->config->local.auto_reload)
|
||||
photo_picture_local_load_start();
|
||||
else
|
||||
photo_config_dialog_refresh_local_dirs();
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_dir_config(void *data, void *data2)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
Picture_Local_Dir *dir;
|
||||
|
||||
cfdata = data;
|
||||
dir = evas_list_nth(photo->config->local.dirs,
|
||||
e_widget_ilist_selected_get(cfdata->ilist_local_dirs));
|
||||
|
||||
if (!dir ||
|
||||
(dir->state == PICTURE_LOCAL_DIR_LOADING) ||
|
||||
dir->config_dialog)
|
||||
return;
|
||||
|
||||
photo_config_dialog_dir_show(dir);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_dir_reload(void *data, void *data2)
|
||||
{
|
||||
photo_picture_local_load_start();
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_dir_stopload(void *data, void *data2)
|
||||
{
|
||||
photo_picture_local_load_stop();
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
#ifdef E_MOD_PHOTO_TYPEDEFS
|
||||
|
||||
|
||||
|
||||
#else
|
||||
|
||||
#ifndef PHOTO_CONFIG_DIALOG_H_INCLUDED
|
||||
#define PHOTO_CONFIG_DIALOG_H_INCLUDED
|
||||
|
||||
|
||||
|
||||
#define CONFIG_DIALOG_ACTION_CHOICE(of, col, line, action_var, first) \
|
||||
rg = e_widget_radio_group_new(&(action_var)); \
|
||||
ob = e_widget_radio_add(evas, "", first, rg); \
|
||||
e_widget_frametable_object_append(of, ob, col, line, 1, 1, 1, 1, 1, 1); \
|
||||
ob = e_widget_radio_add(evas, "", ITEM_ACTION_LABEL, rg); \
|
||||
e_widget_frametable_object_append(of, ob, col, line+1, 1, 1, 1, 1, 1, 1); \
|
||||
ob = e_widget_radio_add(evas, "", ITEM_ACTION_INFOS, rg); \
|
||||
e_widget_frametable_object_append(of, ob, col, line+2, 1, 1, 1, 1, 1, 1); \
|
||||
ob = e_widget_radio_add(evas, "", ITEM_ACTION_PREV, rg); \
|
||||
e_widget_frametable_object_append(of, ob, col, line+3, 1, 1, 1, 1, 1, 1); \
|
||||
ob = e_widget_radio_add(evas, "", ITEM_ACTION_NEXT, rg); \
|
||||
e_widget_frametable_object_append(of, ob, col, line+4, 1, 1, 1, 1, 1, 1); \
|
||||
ob = e_widget_radio_add(evas, "", ITEM_ACTION_PAUSE, rg); \
|
||||
e_widget_frametable_object_append(of, ob, col, line+5, 1, 1, 1, 1, 1, 1); \
|
||||
ob = e_widget_radio_add(evas, "", ITEM_ACTION_SETBG, rg); \
|
||||
e_widget_frametable_object_append(of, ob, col, line+6, 1, 1, 1, 1, 1, 1); \
|
||||
ob = e_widget_radio_add(evas, "", ITEM_ACTION_VIEWER, rg); \
|
||||
e_widget_frametable_object_append(of, ob, col, line+7, 1, 1, 1, 1, 1, 1); \
|
||||
ob = e_widget_radio_add(evas, "", ITEM_ACTION_MENU, rg); \
|
||||
e_widget_frametable_object_append(of, ob, col, line+8, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
#define CONFIG_DIALOG_ACTION_CHOICE_LABELS(of, col, line, first) \
|
||||
ob = e_widget_label_add(evas, first); \
|
||||
e_widget_frametable_object_append(of, ob, col, line, 1, 1, 1, 1, 1, 1); \
|
||||
ob = e_widget_label_add(evas, _("Show label")); \
|
||||
e_widget_frametable_object_append(of, ob, col, line+1, 1, 1, 1, 1, 1, 1); \
|
||||
ob = e_widget_label_add(evas, _("Show informations")); \
|
||||
e_widget_frametable_object_append(of, ob, col, line+2, 1, 1, 1, 1, 1, 1); \
|
||||
ob = e_widget_label_add(evas, _("Previous picture")); \
|
||||
e_widget_frametable_object_append(of, ob, col, line+3, 1, 1, 1, 1, 1, 1); \
|
||||
ob = e_widget_label_add(evas, _("Next picture")); \
|
||||
e_widget_frametable_object_append(of, ob, col, line+4, 1, 1, 1, 1, 1, 1); \
|
||||
ob = e_widget_label_add(evas, _("Pause")); \
|
||||
e_widget_frametable_object_append(of, ob, col, line+5, 1, 1, 1, 1, 1, 1); \
|
||||
ob = e_widget_label_add(evas, _("Set as background")); \
|
||||
e_widget_frametable_object_append(of, ob, col, line+6, 1, 1, 1, 1, 1, 1); \
|
||||
ob = e_widget_label_add(evas, _("Open viewer")); \
|
||||
e_widget_frametable_object_append(of, ob, col, line+7, 1, 1, 1, 1, 1, 1); \
|
||||
ob = e_widget_label_add(evas, _("Show menu")); \
|
||||
e_widget_frametable_object_append(of, ob, col, line+8, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
|
||||
int photo_config_dialog_show(void);
|
||||
void photo_config_dialog_hide(void);
|
||||
|
||||
void photo_config_dialog_refresh_local_infos(void);
|
||||
void photo_config_dialog_refresh_local_dirs(void);
|
||||
void photo_config_dialog_refresh_local_load(void);
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,183 @@
|
|||
#include "Photo.h"
|
||||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
Picture_Local_Dir *dir;
|
||||
|
||||
char *path;
|
||||
int recursive;
|
||||
int read_hidden;
|
||||
};
|
||||
|
||||
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, Picture_Local_Dir *dir);
|
||||
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 photo_config_dialog_dir_show(Picture_Local_Dir *dir)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
char buf[4096];
|
||||
|
||||
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;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/module.eap", e_module_dir_get(photo->module));
|
||||
cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()),
|
||||
_("Photo Directory Configuration"), buf, 0, v, dir);
|
||||
|
||||
if (dir) dir->config_dialog = cfd;
|
||||
else photo->config_dialog_adddir = cfd;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void photo_config_dialog_dir_hide(Picture_Local_Dir *dir)
|
||||
{
|
||||
if (dir)
|
||||
{
|
||||
e_object_del(E_OBJECT(dir->config_dialog));
|
||||
dir->config_dialog = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
e_object_del(E_OBJECT(photo->config_dialog_adddir));
|
||||
photo->config_dialog_adddir = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Private functions
|
||||
*
|
||||
*/
|
||||
|
||||
static void *
|
||||
_create_data(E_Config_Dialog *cfd)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
Picture_Local_Dir *dir;
|
||||
|
||||
dir = cfd->data;
|
||||
|
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
_fill_data(cfdata, dir);
|
||||
cfd->cfdata = cfdata;
|
||||
return cfdata;
|
||||
}
|
||||
|
||||
static void
|
||||
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
free(cfdata->path);
|
||||
if (cfdata->dir)
|
||||
cfdata->dir->config_dialog = NULL;
|
||||
else
|
||||
photo->config_dialog_adddir = NULL;
|
||||
free(cfdata);
|
||||
}
|
||||
|
||||
static void
|
||||
_fill_data(E_Config_Dialog_Data *cfdata, Picture_Local_Dir *dir)
|
||||
{
|
||||
cfdata->dir = dir;
|
||||
|
||||
if (dir)
|
||||
{
|
||||
cfdata->path = strdup(dir->path);
|
||||
cfdata->recursive = dir->recursive;
|
||||
cfdata->read_hidden = dir->read_hidden;
|
||||
}
|
||||
else
|
||||
{
|
||||
cfdata->path = strdup("");
|
||||
cfdata->recursive = PICTURE_LOCAL_DIR_RECURSIVE_DEFAULT;
|
||||
cfdata->read_hidden = PICTURE_LOCAL_DIR_READ_HIDDEN_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;
|
||||
|
||||
o = e_widget_table_add(evas, 0);
|
||||
|
||||
of = e_widget_frametable_add(evas, _("Directory"), 0);
|
||||
|
||||
ob = e_widget_entry_add(evas, &(cfdata->path));
|
||||
e_widget_min_size_set(ob, 250, 25);
|
||||
e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
e_widget_table_object_append(o, of, 0, 0, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
|
||||
of = e_widget_frametable_add(evas, _("Loading options"), 0);
|
||||
|
||||
ob = e_widget_check_add(evas, _("Recursive"), &(cfdata->recursive));
|
||||
e_widget_frametable_object_append(of, ob, 0, 0, 2, 1, 1, 1, 1, 1);
|
||||
ob = e_widget_check_add(evas, _("Read hidden files"), &(cfdata->read_hidden));
|
||||
e_widget_frametable_object_append(of, ob, 0, 1, 2, 1, 1, 1, 1, 1);
|
||||
|
||||
e_widget_table_object_append(o, of, 0, 1, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
static int
|
||||
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Picture_Local_Dir *dir;
|
||||
char buf[4096];
|
||||
|
||||
dir = photo_picture_local_dir_new(cfdata->path,
|
||||
cfdata->recursive, cfdata->read_hidden);
|
||||
if (!dir)
|
||||
return 0;
|
||||
|
||||
if(cfdata->dir)
|
||||
{
|
||||
if (cfdata->dir->state == PICTURE_LOCAL_DIR_LOADING)
|
||||
{
|
||||
snprintf(buf, sizeof(buf),
|
||||
"<hilight>The directory %s is being loaded at the moment !</hilight><br>"
|
||||
"Please wait until the loading is finished to modify its settings",
|
||||
cfdata->dir->path);
|
||||
e_module_dialog_show(photo->module, _("Photo Module Warning"), buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
photo->config->local.dirs = evas_list_remove(photo->config->local.dirs,
|
||||
cfdata->dir);
|
||||
photo_picture_local_dir_free(cfdata->dir, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
photo->config_dialog_adddir = NULL;
|
||||
dir->config_dialog = cfd;
|
||||
}
|
||||
|
||||
photo->config->local.dirs = evas_list_append(photo->config->local.dirs, dir);
|
||||
cfdata->dir = dir;
|
||||
|
||||
if (photo->config->local.auto_reload)
|
||||
photo_picture_local_load_start();
|
||||
|
||||
if (photo->config_dialog)
|
||||
photo_config_dialog_refresh_local_dirs();
|
||||
|
||||
photo_config_save();
|
||||
return 1;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
#ifdef E_MOD_PHOTO_TYPEDEFS
|
||||
|
||||
|
||||
|
||||
#else
|
||||
|
||||
#ifndef PHOTO_CONFIG_DIALOG_DIR_H_INCLUDED
|
||||
#define PHOTO_CONFIG_DIALOG_DIR_H_INCLUDED
|
||||
|
||||
int photo_config_dialog_dir_show(Picture_Local_Dir *dir);
|
||||
void photo_config_dialog_dir_hide(Picture_Local_Dir *dir);
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,260 @@
|
|||
#include "Photo.h"
|
||||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
Photo_Item *pi;
|
||||
|
||||
int timer_s;
|
||||
int timer_active;
|
||||
|
||||
int alpha;
|
||||
int show_label;
|
||||
|
||||
int action_mouse_over;
|
||||
int action_mouse_left;
|
||||
int action_mouse_middle;
|
||||
};
|
||||
|
||||
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, Photo_Item *pi);
|
||||
static void _common_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata, Evas_Object *o);
|
||||
static int _common_apply_data(E_Config_Dialog *cfd, 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 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);
|
||||
|
||||
|
||||
/*
|
||||
* Public functions
|
||||
*/
|
||||
|
||||
int photo_config_dialog_item_show(Photo_Item *pi)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
char buf[4096];
|
||||
|
||||
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;
|
||||
v->advanced.apply_cfdata = _advanced_apply_data;
|
||||
v->advanced.create_widgets = _advanced_create_widgets;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/module.eap", e_module_dir_get(photo->module));
|
||||
cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()),
|
||||
_("Photo Item Configuration"), buf, 0, v, pi);
|
||||
pi->config_dialog = cfd;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void photo_config_dialog_item_hide(Photo_Item *pi)
|
||||
{
|
||||
e_object_del(E_OBJECT(pi->config_dialog));
|
||||
pi->config_dialog = NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Private functions
|
||||
*
|
||||
*/
|
||||
|
||||
static void *
|
||||
_create_data(E_Config_Dialog *cfd)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
Photo_Item *pi;
|
||||
|
||||
pi = cfd->data;
|
||||
|
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
_fill_data(cfdata, pi);
|
||||
cfd->cfdata = cfdata;
|
||||
return cfdata;
|
||||
}
|
||||
|
||||
static void
|
||||
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
cfdata->pi->config_dialog = NULL;
|
||||
free(cfdata);
|
||||
}
|
||||
|
||||
static void
|
||||
_fill_data(E_Config_Dialog_Data *cfdata, Photo_Item *pi)
|
||||
{
|
||||
cfdata->pi = pi;
|
||||
|
||||
cfdata->timer_s = pi->config->timer_s;
|
||||
cfdata->timer_active = pi->config->timer_active;
|
||||
|
||||
cfdata->alpha = pi->config->alpha;
|
||||
cfdata->show_label = pi->config->show_label;
|
||||
|
||||
cfdata->action_mouse_over = pi->config->action_mouse_over;
|
||||
cfdata->action_mouse_left = pi->config->action_mouse_left;
|
||||
cfdata->action_mouse_middle = pi->config->action_mouse_middle;
|
||||
}
|
||||
|
||||
static void
|
||||
_common_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata, Evas_Object *o)
|
||||
{
|
||||
Evas_Object *of, *ob;
|
||||
E_Radio_Group *rg;
|
||||
|
||||
|
||||
of = e_widget_frametable_add(evas, _("Timer between pictures change"), 0);
|
||||
|
||||
ob = e_widget_check_add(evas, _("Activate"), &(cfdata->timer_active));
|
||||
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 seconds"),
|
||||
(float)ITEM_TIMER_S_MIN, (float)ITEM_TIMER_S_MAX,
|
||||
1.0, 0,
|
||||
NULL, &(cfdata->timer_s), 130);
|
||||
e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 0, 1, 0);
|
||||
|
||||
e_widget_table_object_append(o, of, 0, 0, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
|
||||
|
||||
of = e_widget_frametable_add(evas, _("Appearance"), 0);
|
||||
|
||||
ob = e_widget_label_add(evas, _("Alpha"));
|
||||
e_widget_frametable_object_append(of, ob, 0, 0, 2, 1, 1, 1, 1, 1);
|
||||
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 0.0, 255, 1.0, 0,
|
||||
NULL, &(cfdata->alpha), 130);
|
||||
e_widget_frametable_object_append(of, ob, 0, 1, 3, 1, 1, 0, 1, 0);
|
||||
|
||||
ob = e_widget_label_add(evas, _("Always show label"));
|
||||
e_widget_frametable_object_append(of, ob, 0, 2, 3, 1, 1, 1, 1, 1);
|
||||
|
||||
rg = e_widget_radio_group_new(&(cfdata->show_label));
|
||||
ob = e_widget_radio_add(evas, _("Yes"), ITEM_SHOW_LABEL_YES, rg);
|
||||
e_widget_frametable_object_append(of, ob, 0, 3, 1, 1, 1, 1, 1, 1);
|
||||
ob = e_widget_radio_add(evas, _("No"), ITEM_SHOW_LABEL_NO, rg);
|
||||
e_widget_frametable_object_append(of, ob, 1, 3, 1, 1, 1, 1, 1, 1);
|
||||
ob = e_widget_radio_add(evas, _("Default setting"), ITEM_SHOW_LABEL_PARENT, rg);
|
||||
e_widget_frametable_object_append(of, ob, 2, 3, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
e_widget_table_object_append(o, of, 0, 1, 1, 1, 1, 1, 1, 1);
|
||||
}
|
||||
|
||||
static int
|
||||
_common_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
|
||||
pi = cfdata->pi;
|
||||
|
||||
if ((pi->config->timer_s != cfdata->timer_s) ||
|
||||
(pi->config->timer_active != cfdata->timer_active))
|
||||
photo_item_timer_set(pi, cfdata->timer_active, cfdata->timer_s);
|
||||
|
||||
if (pi->config->alpha != cfdata->alpha)
|
||||
{
|
||||
pi->config->alpha = cfdata->alpha;
|
||||
evas_object_color_set(pi->obj, 255, 255, 255, pi->config->alpha);
|
||||
}
|
||||
|
||||
if (pi->config->show_label != cfdata->show_label)
|
||||
{
|
||||
pi->config->show_label = cfdata->show_label;
|
||||
photo_item_label_mode_set(pi);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Evas_Object *o;
|
||||
|
||||
o = e_widget_table_add(evas, 0);
|
||||
|
||||
_common_create_widgets(cfd, evas, cfdata, o);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
static int
|
||||
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
int ret;
|
||||
|
||||
pi = cfdata->pi;
|
||||
ret = _common_apply_data(cfd, cfdata);
|
||||
|
||||
photo_item_label_mode_set(pi);
|
||||
|
||||
photo_config_save();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_advanced_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_table_add(evas, 0);
|
||||
|
||||
_common_create_widgets(cfd, evas, cfdata, o);
|
||||
|
||||
|
||||
of = e_widget_frametable_add(evas, _("Mouse actions"), 0);
|
||||
|
||||
ob = e_widget_label_add(evas, _("Over"));
|
||||
e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 1, 1, 1);
|
||||
CONFIG_DIALOG_ACTION_CHOICE(of, 0, 2, cfdata->action_mouse_over, ITEM_ACTION_PARENT);
|
||||
|
||||
ob = e_widget_label_add(evas, _("Left"));
|
||||
e_widget_frametable_object_append(of, ob, 1, 0, 1, 1, 1, 1, 1, 1);
|
||||
ob = e_widget_label_add(evas, _("click"));
|
||||
e_widget_frametable_object_append(of, ob, 1, 1, 1, 1, 1, 1, 1, 1);
|
||||
CONFIG_DIALOG_ACTION_CHOICE(of, 1, 2, cfdata->action_mouse_left, ITEM_ACTION_PARENT);
|
||||
|
||||
ob = e_widget_label_add(evas, _("Middle"));
|
||||
e_widget_frametable_object_append(of, ob, 2, 0, 1, 1, 1, 1, 1, 1);
|
||||
ob = e_widget_label_add(evas, _("click"));
|
||||
e_widget_frametable_object_append(of, ob, 2, 1, 1, 1, 1, 1, 1, 1);
|
||||
CONFIG_DIALOG_ACTION_CHOICE(of, 2, 2, cfdata->action_mouse_middle, ITEM_ACTION_PARENT);
|
||||
CONFIG_DIALOG_ACTION_CHOICE_LABELS(of, 3, 2, _("Default setting"));
|
||||
|
||||
e_widget_table_object_append(o, of, 1, 0, 1, 2, 1, 1, 1, 1);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
static int
|
||||
_advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
int ret;
|
||||
|
||||
pi = cfdata->pi;
|
||||
ret = _common_apply_data(cfd, cfdata);
|
||||
|
||||
if ( (pi->config->action_mouse_over = cfdata->action_mouse_over) ||
|
||||
(pi->config->action_mouse_left = cfdata->action_mouse_left) ||
|
||||
(pi->config->action_mouse_middle = cfdata->action_mouse_middle) )
|
||||
{
|
||||
pi->config->action_mouse_over = cfdata->action_mouse_over;
|
||||
pi->config->action_mouse_left = cfdata->action_mouse_left;
|
||||
pi->config->action_mouse_middle = cfdata->action_mouse_middle;
|
||||
|
||||
photo_item_label_mode_set(pi);
|
||||
}
|
||||
|
||||
photo_config_save();
|
||||
return ret;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
#ifdef E_MOD_PHOTO_TYPEDEFS
|
||||
|
||||
|
||||
|
||||
#else
|
||||
|
||||
#ifndef PHOTO_CONFIG_DIALOG_ITEM_H_INCLUDED
|
||||
#define PHOTO_CONFIG_DIALOG_ITEM_H_INCLUDED
|
||||
|
||||
int photo_config_dialog_item_show(Photo_Item *pi);
|
||||
void photo_config_dialog_item_hide(Photo_Item *pi);
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,679 @@
|
|||
#include "Photo.h"
|
||||
|
||||
#define PIC_LOCAL_GET() \
|
||||
from_final = PICTURE_LOCAL; \
|
||||
picture = photo_picture_local_get(PICTURE_LOCAL_GET_RANDOM);
|
||||
#define PIC_NET_GET() \
|
||||
from_final = PICTURE_NET;
|
||||
//picture = photo_picture_net_get(PICTURE_NET_GET_RANDOM); //add end line backslash upstairs =)
|
||||
|
||||
#define ITEM_ACTION_CALL(var, parent) \
|
||||
if (UTIL_TEST_PARENT(var, parent, ITEM_ACTION_LABEL , ITEM_ACTION_PARENT)) \
|
||||
photo_item_action_label(pi); \
|
||||
if (UTIL_TEST_PARENT(var, parent, ITEM_ACTION_INFOS , ITEM_ACTION_PARENT)) \
|
||||
photo_item_action_infos(pi); \
|
||||
if (UTIL_TEST_PARENT(var, parent, ITEM_ACTION_PREV , ITEM_ACTION_PARENT)) \
|
||||
photo_item_action_change(pi, -1); \
|
||||
if (UTIL_TEST_PARENT(var, parent, ITEM_ACTION_NEXT , ITEM_ACTION_PARENT)) \
|
||||
photo_item_action_change(pi, 1); \
|
||||
if (UTIL_TEST_PARENT(var, parent, ITEM_ACTION_PAUSE , ITEM_ACTION_PARENT)) \
|
||||
photo_item_action_pause_toggle(pi); \
|
||||
if (UTIL_TEST_PARENT(var, parent, ITEM_ACTION_SETBG , ITEM_ACTION_PARENT)) \
|
||||
photo_item_action_setbg(pi); \
|
||||
if (UTIL_TEST_PARENT(var, parent, ITEM_ACTION_VIEWER , ITEM_ACTION_PARENT)) \
|
||||
photo_item_action_viewer(pi); \
|
||||
if (UTIL_TEST_PARENT(var, parent, ITEM_ACTION_MENU , ITEM_ACTION_PARENT)) \
|
||||
photo_item_action_menu(pi, NULL);
|
||||
|
||||
#define ITEM_TRANSITION_GO(way) \
|
||||
if ( !photo->config->nice_trans ) \
|
||||
{ \
|
||||
edje_object_signal_emit(pi->obj, \
|
||||
STRINGIFY(picture_transition_q_ ## way ## _go), ""); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
edje_object_signal_emit(pi->obj, \
|
||||
STRINGIFY(picture_transition_ ## way ## _go), ""); \
|
||||
}
|
||||
|
||||
#define STRINGIFY(str) #str
|
||||
|
||||
|
||||
static Picture *_picture_new_get(Photo_Item *pi);
|
||||
static void _picture_detach(Photo_Item *pi, int part);
|
||||
|
||||
static int _cb_timer_change(void *data);
|
||||
static void _cb_edje_change(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||
static void _cb_edje_mouseover(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||
static void _cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
static void _cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
static void _cb_popi_close(void *data);
|
||||
|
||||
|
||||
/*
|
||||
* Public functions
|
||||
*/
|
||||
|
||||
Photo_Item *photo_item_add(E_Gadcon_Client *gcc, Evas_Object *obj)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
Photo_Config_Item *pic;
|
||||
|
||||
pi = E_NEW(Photo_Item, 1);
|
||||
|
||||
photo_util_edje_set(obj, PHOTO_THEME_ITEM);
|
||||
|
||||
pic = photo_config_item_new(gcc->id);
|
||||
pi->gcc = gcc;
|
||||
pi->obj = obj;
|
||||
pi->config = pic;
|
||||
|
||||
if(!pic)
|
||||
{
|
||||
DD(("Item add : NULL config !!!"));
|
||||
}
|
||||
|
||||
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_cb_mouse_down, pi);
|
||||
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_OUT,
|
||||
_cb_mouse_out, pi);
|
||||
|
||||
edje_object_signal_callback_add(obj,
|
||||
"mouseover", "item",
|
||||
_cb_edje_mouseover, pi);
|
||||
edje_object_signal_callback_add(obj, "picture_transition_0_1_end", "picture",
|
||||
_cb_edje_change, pi);
|
||||
edje_object_signal_callback_add(obj, "picture_transition_1_0_end", "picture",
|
||||
_cb_edje_change, pi);
|
||||
|
||||
photo_item_timer_set(pi, pic->timer_active, 0);
|
||||
evas_object_color_set(pi->obj, 255, 255, 255, pic->alpha);
|
||||
photo_item_label_mode_set(pi);
|
||||
photo_picture_histo_init(pi);
|
||||
|
||||
photo_item_action_change(pi, 1);
|
||||
|
||||
return pi;
|
||||
}
|
||||
|
||||
void photo_item_del(Photo_Item *pi)
|
||||
{
|
||||
DITEM(("Item del"));
|
||||
|
||||
if (pi->picture0)
|
||||
_picture_detach(pi, 0);
|
||||
if (pi->picture1)
|
||||
_picture_detach(pi, 1);
|
||||
|
||||
evas_object_del(pi->obj);
|
||||
|
||||
photo_config_item_free(pi->config);
|
||||
if (pi->config_dialog)
|
||||
photo_config_dialog_item_hide(pi);
|
||||
if (pi->menu)
|
||||
photo_menu_hide(pi);
|
||||
|
||||
if (pi->timer)
|
||||
ecore_timer_del(pi->timer);
|
||||
|
||||
if (pi->popw)
|
||||
photo_popup_warn_del(pi->popw);
|
||||
if (pi->popi)
|
||||
photo_popup_info_del(pi->popi);
|
||||
|
||||
if (pi->timer)
|
||||
ecore_timer_del(pi->timer);
|
||||
|
||||
photo_picture_histo_shutdown(pi);
|
||||
|
||||
if (pi->local_ev_fill_handler)
|
||||
ecore_event_handler_del(pi->local_ev_fill_handler);
|
||||
if (pi->net_ev_fill_handler)
|
||||
ecore_event_handler_del(pi->net_ev_fill_handler);
|
||||
|
||||
free(pi);
|
||||
}
|
||||
|
||||
void photo_item_timer_set(Photo_Item *pi, int active, int time)
|
||||
{
|
||||
if (time && (time < ITEM_TIMER_S_MIN))
|
||||
return;
|
||||
|
||||
pi->config->timer_active = active;
|
||||
if (!time)
|
||||
time = pi->config->timer_s;
|
||||
else
|
||||
pi->config->timer_s = time;
|
||||
|
||||
photo_config_save();
|
||||
|
||||
if (!active)
|
||||
{
|
||||
if (pi->timer)
|
||||
{
|
||||
ecore_timer_del(pi->timer);
|
||||
pi->timer = NULL;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (pi->timer)
|
||||
ecore_timer_del(pi->timer);
|
||||
pi->timer = ecore_timer_add(time, _cb_timer_change, pi);
|
||||
}
|
||||
|
||||
void photo_item_label_mode_set(Photo_Item *pi)
|
||||
{
|
||||
Photo_Config_Item *pic;
|
||||
Evas_List *l = NULL;
|
||||
int action;
|
||||
|
||||
DD(("Mode set (%d items)", evas_list_count(photo->items)));
|
||||
|
||||
if (!pi)
|
||||
{
|
||||
l = photo->items;
|
||||
pi = evas_list_data(l);
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
pic = pi->config;
|
||||
|
||||
if ( UTIL_TEST_PARENT(pic->show_label, photo->config->show_label,
|
||||
ITEM_SHOW_LABEL_YES, ITEM_SHOW_LABEL_PARENT) )
|
||||
action = 1;
|
||||
else
|
||||
action = 0;
|
||||
|
||||
edje_object_message_send(pi->obj, EDJE_MESSAGE_INT,
|
||||
ITEM_EDJE_MSG_SEND_LABEL_ALWAYS,
|
||||
&action);
|
||||
|
||||
DITEM(("Set label mode %d", action));
|
||||
|
||||
if (action)
|
||||
photo_item_action_label(pi);
|
||||
} while ( l && (l = evas_list_next(l)) && (pi = evas_list_data(l)) );
|
||||
}
|
||||
|
||||
Picture *photo_item_picture_current_get(Photo_Item *pi)
|
||||
{
|
||||
Picture *p = NULL;
|
||||
|
||||
if (!pi->edje_part && pi->picture0)
|
||||
{
|
||||
p = pi->picture0;
|
||||
}
|
||||
if (pi->edje_part && pi->picture1)
|
||||
{
|
||||
p = pi->picture1;
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
Evas_Object *photo_item_picture_object_current_get(Photo_Item *pi)
|
||||
{
|
||||
Evas_Object *p = NULL;
|
||||
|
||||
if (!pi->edje_part && pi->picture0)
|
||||
{
|
||||
p = pi->picture0->picture;
|
||||
}
|
||||
if (pi->edje_part && pi->picture1)
|
||||
{
|
||||
p = pi->picture1->picture;
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
int photo_item_action_label(Photo_Item *pi)
|
||||
{
|
||||
DITEM(("Label show emit !"));
|
||||
|
||||
edje_object_signal_emit(pi->obj, "label_show", "program");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int photo_item_action_infos(Photo_Item *pi)
|
||||
{
|
||||
Picture *p;
|
||||
char *text;
|
||||
|
||||
DITEM(("Action info go"));
|
||||
|
||||
p = photo_item_picture_current_get(pi);
|
||||
if (!p) return 0;
|
||||
|
||||
text = photo_picture_infos_get(p);
|
||||
|
||||
if (pi->popi)
|
||||
photo_popup_info_del(pi->popi);
|
||||
|
||||
pi->popi = photo_popup_info_add(pi, p->infos.name, text, p,
|
||||
ITEM_INFOS_TIMER,
|
||||
POPUP_INFO_PLACEMENT_SHELF,
|
||||
_cb_popi_close, NULL);
|
||||
|
||||
free(text);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int photo_item_action_change(Photo_Item *pi, int position)
|
||||
{
|
||||
Picture *picture;
|
||||
|
||||
DITEM(("picture change %d", position));
|
||||
|
||||
if (!position)
|
||||
return 0;
|
||||
|
||||
/* 1. get the picture to change to */
|
||||
|
||||
if ( (position < 0) || (pi->histo.pos) )
|
||||
{
|
||||
/* from histo */
|
||||
|
||||
picture = photo_picture_histo_change(pi, -position);
|
||||
if (!picture) /* should no append */
|
||||
{
|
||||
DITEM(("Action change : Histo get NULL !!!"));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* from list */
|
||||
|
||||
/* if already waiting for pictures, dont change */
|
||||
if (pi->local_ev_fill_handler || pi->net_ev_fill_handler)
|
||||
return 0;
|
||||
|
||||
picture = _picture_new_get(pi);
|
||||
if (!picture)
|
||||
return 0;
|
||||
|
||||
photo_picture_histo_attach(pi, picture);
|
||||
}
|
||||
|
||||
/* 2. load it */
|
||||
|
||||
photo_picture_load(picture, pi->gcc->gadcon->evas);
|
||||
picture->pi = pi;
|
||||
|
||||
/* 3. set the label */
|
||||
|
||||
edje_object_part_text_set(pi->obj, "label", picture->infos.name);
|
||||
|
||||
/* 4. transition to the new picture */
|
||||
|
||||
if (pi->in_transition)
|
||||
{
|
||||
DITEM(("Already in transition, restarting =)"));
|
||||
_picture_detach(pi, !pi->edje_part);
|
||||
}
|
||||
|
||||
pi->in_transition = 1;
|
||||
if (!pi->edje_part)
|
||||
{
|
||||
pi->edje_part = 1;
|
||||
pi->picture1 = picture;
|
||||
edje_object_part_swallow(pi->obj, "picture1",
|
||||
pi->picture1->picture);
|
||||
evas_object_show(pi->picture1->picture);
|
||||
ITEM_TRANSITION_GO(0_1);
|
||||
}
|
||||
else
|
||||
{
|
||||
pi->edje_part = 0;
|
||||
pi->picture0 = picture;
|
||||
edje_object_part_swallow(pi->obj, "picture0",
|
||||
pi->picture0->picture);
|
||||
evas_object_show(pi->picture0->picture);
|
||||
ITEM_TRANSITION_GO(1_0);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int photo_item_action_pause_toggle(Photo_Item *pi)
|
||||
{
|
||||
photo_item_timer_set(pi, !pi->config->timer_active, 0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int photo_item_action_setbg(Photo_Item *pi)
|
||||
{
|
||||
Picture *p;
|
||||
E_Zone *zone;
|
||||
char *file = NULL;
|
||||
char *name;
|
||||
char buf[4096];
|
||||
|
||||
zone = e_zone_current_get(e_container_current_get(e_manager_current_get()));
|
||||
if (!zone) return 0;
|
||||
|
||||
p = photo_item_picture_current_get(pi);
|
||||
if (!p) return 0;
|
||||
|
||||
file = p->path;
|
||||
name = p->infos.name;
|
||||
|
||||
if (photo->config->pictures_set_bg_purge)
|
||||
photo_picture_setbg_purge(0);
|
||||
|
||||
if (!ecore_file_exists(file))
|
||||
{
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("<hilight>File %s doesnt exists.</hilight><br><br>"
|
||||
"This file is in Photo module picture list, but it seems you removed it from the disk<br>"
|
||||
"It cant be set as background, sorry."), file);
|
||||
e_module_dialog_show(photo->module, _("Photo Module Error"), buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!strstr(file, ".edj"))
|
||||
{
|
||||
if (ecore_file_app_installed("e17setroot"))
|
||||
{
|
||||
Ecore_Exe *exe;
|
||||
|
||||
snprintf(buf, 4096, "e17setroot -s \"%s\"", file);
|
||||
DITEM(("Set background with %s", buf));
|
||||
exe = ecore_exe_pipe_run(buf, ECORE_EXE_USE_SH, NULL);
|
||||
if (exe > 0)
|
||||
{
|
||||
ecore_exe_free(exe);
|
||||
if (photo->config->pictures_set_bg_purge)
|
||||
photo_picture_setbg_add(name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("<hilight>e17setroot needed</hilight><br><br>"
|
||||
"%s is not an edje file !<br>"
|
||||
"Photo module needs e17setroot util from e_utils package to set you're picture as background"
|
||||
"Please install it and try again"), file);
|
||||
e_module_dialog_show(photo->module, _("Photo Module Error"), buf);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DITEM(("Set edje background %s", file));
|
||||
|
||||
if ((zone->container->num == 0) && (zone->num == 0) &&
|
||||
(zone->desk_x_current == 0) && (zone->desk_y_current == 0))
|
||||
{
|
||||
e_lib_background_set(strdup(file));
|
||||
}
|
||||
else
|
||||
{
|
||||
e_lib_desktop_background_del(zone->container->num, zone->num,
|
||||
zone->desk_x_current, zone->desk_y_current);
|
||||
e_lib_desktop_background_add(zone->container->num, zone->num,
|
||||
zone->desk_x_current, zone->desk_y_current,
|
||||
strdup(file));
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int photo_item_action_viewer(Photo_Item *pi)
|
||||
{
|
||||
Picture *p;
|
||||
char *file = NULL;
|
||||
char buf[4096];
|
||||
|
||||
p = photo_item_picture_current_get(pi);
|
||||
if (!p) return 0;
|
||||
|
||||
file = p->path;
|
||||
|
||||
if (!ecore_file_exists(file))
|
||||
{
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("<hilight>File %s doesnt exists !</hilight><br><br>"
|
||||
"This file is in Photo's module picture list, but it seems you removed it from the disk.<br>"
|
||||
"It cant be set opened in a viewer, sorry."), file);
|
||||
e_module_dialog_show(photo->module, _("Photo Module Error"), buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ecore_file_app_installed(photo->config->pictures_viewer))
|
||||
{
|
||||
Ecore_Exe *exe;
|
||||
|
||||
snprintf(buf, 4096, "%s \"%s\"", photo->config->pictures_viewer, file);
|
||||
DITEM(("Action viewer: %s", buf));
|
||||
exe = ecore_exe_pipe_run(buf, ECORE_EXE_USE_SH, NULL);
|
||||
if (exe > 0)
|
||||
ecore_exe_free(exe);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("<hilight>Viewer %s not found !</hilight><br><br>"
|
||||
"You can change the viewer for images in Photo module configuration panel (Advanced view)"),
|
||||
photo->config->pictures_viewer);
|
||||
e_module_dialog_show(photo->module, _("Photo Module Error"), buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int photo_item_action_menu(Photo_Item *pi, Evas_Event_Mouse_Down *ev)
|
||||
{
|
||||
int cx, cy, cw, ch;
|
||||
|
||||
if (pi->menu) return 0;
|
||||
|
||||
if (!photo_menu_show(pi))
|
||||
return 0;
|
||||
|
||||
if (ev)
|
||||
{
|
||||
e_gadcon_canvas_zone_geometry_get(pi->gcc->gadcon,
|
||||
&cx, &cy, &cw, &ch);
|
||||
e_menu_activate_mouse(pi->menu,
|
||||
e_util_zone_current_get(e_manager_current_get()),
|
||||
cx + ev->output.x, cy + ev->output.y, 1, 1,
|
||||
E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
|
||||
evas_event_feed_mouse_up(pi->gcc->gadcon->evas, ev->button,
|
||||
EVAS_BUTTON_NONE, ev->timestamp, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
E_Manager *man;
|
||||
man = e_manager_current_get();
|
||||
ecore_x_pointer_xy_get(man->root, &cx, &cy);
|
||||
e_menu_activate(pi->menu,
|
||||
e_util_zone_current_get(e_manager_current_get()),
|
||||
cx, cy, 1, 1,
|
||||
E_MENU_POP_DIRECTION_DOWN);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Private functions
|
||||
*/
|
||||
|
||||
Picture *_picture_new_get(Photo_Item *pi)
|
||||
{
|
||||
Picture *picture;
|
||||
int from_rand, from_conf, from_final;
|
||||
|
||||
from_conf = photo->config->pictures_from;
|
||||
switch (from_conf)
|
||||
{
|
||||
case PICTURE_BOTH:
|
||||
from_rand = rand()%2;
|
||||
if (!from_rand)
|
||||
{ PIC_LOCAL_GET(); }
|
||||
else
|
||||
{ PIC_NET_GET(); }
|
||||
if (!picture)
|
||||
{
|
||||
if (from_rand)
|
||||
{ PIC_LOCAL_GET(); }
|
||||
else
|
||||
{ PIC_NET_GET(); }
|
||||
}
|
||||
break;
|
||||
|
||||
case PICTURE_LOCAL:
|
||||
PIC_LOCAL_GET();
|
||||
break;
|
||||
|
||||
case PICTURE_NET:
|
||||
PIC_NET_GET();
|
||||
break;
|
||||
}
|
||||
|
||||
/* set fill event handler to catch a picture when it comes */
|
||||
if (!picture)
|
||||
{
|
||||
DITEM(("Can't get a picture ! set fill handler"));
|
||||
switch(from_final)
|
||||
{
|
||||
case PICTURE_LOCAL:
|
||||
photo_picture_local_ev_set(pi);
|
||||
break;
|
||||
case PICTURE_NET:
|
||||
//photo_picture_net_ev_set(pi);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return picture;
|
||||
}
|
||||
|
||||
static void
|
||||
_picture_detach(Photo_Item *pi, int part)
|
||||
{
|
||||
Picture *picture;
|
||||
|
||||
if (!part) picture = pi->picture0;
|
||||
else picture = pi->picture1;
|
||||
|
||||
if (!picture) return;
|
||||
|
||||
evas_object_hide(picture->picture);
|
||||
edje_object_part_unswallow(pi->obj, picture->picture);
|
||||
photo_picture_unload(picture);
|
||||
|
||||
picture->pi = NULL;
|
||||
|
||||
if (!part)
|
||||
pi->picture0 = NULL;
|
||||
else
|
||||
pi->picture1 = NULL;
|
||||
|
||||
photo_picture_local_ev_raise(1);
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_timer_change(void *data)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
|
||||
pi = data;
|
||||
photo_item_action_change(pi, 1);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_edje_change(void *data, Evas_Object *obj, const char *emission, const char *source)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
|
||||
DITEM(("Cb picture change (%s)", emission));
|
||||
|
||||
pi = data;
|
||||
|
||||
pi->in_transition = 0;
|
||||
|
||||
if ( !strcmp(emission, "picture_transition_0_1_end") )
|
||||
{
|
||||
_picture_detach(pi, 0);
|
||||
return;
|
||||
}
|
||||
if ( !strcmp(emission, "picture_transition_1_0_end") )
|
||||
{
|
||||
_picture_detach(pi, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_edje_mouseover(void *data, Evas_Object *obj, const char *emission, const char *source)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
|
||||
DITEM(("Cb edje mouseover"));
|
||||
|
||||
pi = data;
|
||||
ITEM_ACTION_CALL(pi->config->action_mouse_over,
|
||||
photo->config->action_mouse_over);
|
||||
}
|
||||
|
||||
void _cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
Evas_Event_Mouse_Down *ev;
|
||||
|
||||
pi = data;
|
||||
ev = event_info;
|
||||
|
||||
DITEM(("Mouse down %d", ev->button));
|
||||
|
||||
switch(ev->button)
|
||||
{
|
||||
case 1:
|
||||
ITEM_ACTION_CALL(pi->config->action_mouse_left,
|
||||
photo->config->action_mouse_left);
|
||||
break;
|
||||
case 2:
|
||||
ITEM_ACTION_CALL(pi->config->action_mouse_middle,
|
||||
photo->config->action_mouse_middle);
|
||||
break;
|
||||
case 3:
|
||||
if (pi->menu)
|
||||
break;
|
||||
photo_item_action_menu(pi, ev);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void _cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
|
||||
pi = data;
|
||||
|
||||
if (pi->popi)
|
||||
photo_popup_info_del(pi->popi);
|
||||
pi->popi = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_popi_close(void *data)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
|
||||
pi = data;
|
||||
pi->popi = NULL;
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
#ifdef E_MOD_PHOTO_TYPEDEFS
|
||||
|
||||
typedef struct _Photo_Item Photo_Item;
|
||||
|
||||
#else
|
||||
|
||||
#ifndef PHOTO_ITEM_H_INCLUDED
|
||||
#define PHOTO_ITEM_H_INCLUDED
|
||||
|
||||
#define ITEM_EDJE_MSG_SEND_LABEL_ALWAYS 0
|
||||
|
||||
#define ITEM_NICE_TRANS_DEFAULT 1
|
||||
|
||||
#define ITEM_TIMER_S_DEFAULT 30
|
||||
#define ITEM_TIMER_S_MIN 5
|
||||
#define ITEM_TIMER_S_MAX (60*5)
|
||||
#define ITEM_TIMER_ACTIVE_DEFAULT 1
|
||||
|
||||
#define ITEM_ALPHA_DEFAULT 255
|
||||
|
||||
#define ITEM_SHOW_LABEL_DEFAULT 0
|
||||
#define ITEM_SHOW_LABEL_NO 0
|
||||
#define ITEM_SHOW_LABEL_YES 1
|
||||
#define ITEM_SHOW_LABEL_PARENT 2
|
||||
|
||||
#define ITEM_MOUSE_OVER_ACTION_DEFAULT 1
|
||||
#define ITEM_MOUSE_LEFT_ACTION_DEFAULT 2
|
||||
#define ITEM_MOUSE_MIDDLE_ACTION_DEFAULT 7
|
||||
|
||||
#define ITEM_ACTION_NO 0
|
||||
#define ITEM_ACTION_LABEL 1
|
||||
#define ITEM_ACTION_INFOS 2
|
||||
#define ITEM_ACTION_PREV 3
|
||||
#define ITEM_ACTION_NEXT 4
|
||||
#define ITEM_ACTION_PAUSE 5
|
||||
#define ITEM_ACTION_SETBG 6
|
||||
#define ITEM_ACTION_VIEWER 7
|
||||
#define ITEM_ACTION_MENU 8
|
||||
#define ITEM_ACTION_PARENT 10
|
||||
|
||||
#define ITEM_INFOS_TIMER 4
|
||||
|
||||
struct _Photo_Item
|
||||
{
|
||||
E_Gadcon_Client *gcc;
|
||||
Evas_Object *obj;
|
||||
|
||||
Photo_Config_Item *config;
|
||||
E_Config_Dialog *config_dialog;
|
||||
E_Menu *menu;
|
||||
|
||||
Ecore_Timer *timer;
|
||||
|
||||
Picture *picture0;
|
||||
Picture *picture1;
|
||||
int edje_part;
|
||||
int in_transition;
|
||||
|
||||
Popup_Warn *popw;
|
||||
Popup_Info *popi;
|
||||
|
||||
struct
|
||||
{
|
||||
Evas_List *list;
|
||||
int pos;
|
||||
Popup_Info *popi;
|
||||
} histo;
|
||||
|
||||
Ecore_Event_Handler *local_ev_fill_handler;
|
||||
Ecore_Event_Handler *net_ev_fill_handler;
|
||||
};
|
||||
|
||||
|
||||
Photo_Item *photo_item_add(E_Gadcon_Client *gcc, Evas_Object *obj);
|
||||
void photo_item_del(Photo_Item *pi);
|
||||
|
||||
void photo_item_timer_set(Photo_Item *pi, int active, int time);
|
||||
void photo_item_label_mode_set(Photo_Item *pi);
|
||||
|
||||
Picture *photo_item_picture_current_get(Photo_Item *pi);
|
||||
Evas_Object *photo_item_picture_object_current_get(Photo_Item *pi);
|
||||
|
||||
int photo_item_action_label(Photo_Item *pi);
|
||||
int photo_item_action_infos(Photo_Item *pi);
|
||||
int photo_item_action_change(Photo_Item *pi, int position);
|
||||
int photo_item_action_pause_toggle(Photo_Item *pi);
|
||||
int photo_item_action_setbg(Photo_Item *pi);
|
||||
int photo_item_action_viewer(Photo_Item *pi);
|
||||
int photo_item_action_menu(Photo_Item *pi, Evas_Event_Mouse_Down *ev);
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,202 @@
|
|||
#include "Photo.h"
|
||||
|
||||
static void _cb_deactivate_post(void *data, E_Menu *m);
|
||||
static void _cb_picture_info(void *data, E_Menu *m, E_Menu_Item *mi);
|
||||
static void _cb_picture_next(void *data, E_Menu *m, E_Menu_Item *mi);
|
||||
static void _cb_picture_prev(void *data, E_Menu *m, E_Menu_Item *mi);
|
||||
static void _cb_picture_setbg(void *data, E_Menu *m, E_Menu_Item *mi);
|
||||
static void _cb_picture_viewer(void *data, E_Menu *m, E_Menu_Item *mi);
|
||||
static void _cb_pause_toggle(void *data, E_Menu *m, E_Menu_Item *mi);
|
||||
static void _cb_configure_item(void *data, E_Menu *m, E_Menu_Item *mi);
|
||||
static void _cb_configure_general(void *data, E_Menu *m, E_Menu_Item *mi);
|
||||
|
||||
|
||||
/*
|
||||
* Public functions
|
||||
*/
|
||||
|
||||
int photo_menu_show(Photo_Item *pi)
|
||||
{
|
||||
E_Menu *mn, *mn2;
|
||||
E_Menu_Item *mi;
|
||||
|
||||
mn = e_menu_new();
|
||||
e_menu_post_deactivate_callback_set(mn, _cb_deactivate_post, pi);
|
||||
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_label_set(mi, _("Picture informations"));
|
||||
photo_util_menu_icon_set(mi, PHOTO_THEME_ICON_INFOS);
|
||||
e_menu_item_callback_set(mi, _cb_picture_info, pi);
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_label_set(mi, _("Next picture"));
|
||||
photo_util_menu_icon_set(mi, PHOTO_THEME_ICON_NEXT);
|
||||
e_menu_item_callback_set(mi, _cb_picture_next, pi);
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_label_set(mi, _("Previous picture"));
|
||||
photo_util_menu_icon_set(mi, PHOTO_THEME_ICON_PREVIOUS);
|
||||
e_menu_item_callback_set(mi, _cb_picture_prev, pi);
|
||||
mi = e_menu_item_new(mn);
|
||||
if (pi->config->timer_active)
|
||||
{
|
||||
e_menu_item_label_set(mi, _("Pause slideshow"));
|
||||
photo_util_menu_icon_set(mi, PHOTO_THEME_ICON_PAUSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
e_menu_item_label_set(mi, _("Resume slideshow"));
|
||||
photo_util_menu_icon_set(mi, PHOTO_THEME_ICON_RESUME);
|
||||
}
|
||||
e_menu_item_callback_set(mi, _cb_pause_toggle, pi);
|
||||
|
||||
mn2 = e_menu_new();
|
||||
photo_picture_histo_menu_populate(pi, mn2);
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_label_set(mi, _("Historic"));
|
||||
e_menu_item_submenu_set(mi, mn2);
|
||||
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_separator_set(mi, 1);
|
||||
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_label_set(mi, _("Set picture as background"));
|
||||
photo_util_menu_icon_set(mi, PHOTO_THEME_ICON_SETBG);
|
||||
e_menu_item_callback_set(mi, _cb_picture_setbg, pi);
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_label_set(mi, _("See picture in a viewer"));
|
||||
photo_util_menu_icon_set(mi, PHOTO_THEME_ICON_VIEWER);
|
||||
e_menu_item_callback_set(mi, _cb_picture_viewer, pi);
|
||||
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_separator_set(mi, 1);
|
||||
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_label_set(mi, _("Configure this Photo gadget"));
|
||||
e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration");
|
||||
e_menu_item_callback_set(mi, _cb_configure_item, pi);
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_label_set(mi, _("Configure Photo module"));
|
||||
e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration");
|
||||
e_menu_item_callback_set(mi, _cb_configure_general, NULL);
|
||||
|
||||
mn2 = e_menu_new();
|
||||
e_gadcon_client_util_menu_items_append(pi->gcc, mn2, 0);
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_label_set(mi, _("Gadget and Shelf"));
|
||||
e_menu_item_submenu_set(mi, mn2);
|
||||
|
||||
pi->menu = mn;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void photo_menu_hide(Photo_Item *pi)
|
||||
{
|
||||
e_menu_post_deactivate_callback_set(pi->menu, NULL, NULL);
|
||||
_cb_deactivate_post(pi, pi->menu);
|
||||
pi->menu = NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Private functions
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
_cb_deactivate_post(void *data, E_Menu *m)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
|
||||
pi = data;
|
||||
if (!pi) return;
|
||||
if (!pi->menu) return;
|
||||
|
||||
e_object_del(E_OBJECT(pi->menu));
|
||||
pi->menu = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_picture_info(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
|
||||
pi = data;
|
||||
if (!pi) return;
|
||||
|
||||
photo_item_action_infos(pi);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_picture_next(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
|
||||
pi = data;
|
||||
if (!pi) return;
|
||||
|
||||
photo_item_action_change(pi, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_picture_prev(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
|
||||
pi = data;
|
||||
if (!pi) return;
|
||||
|
||||
photo_item_action_change(pi, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_picture_setbg(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
|
||||
pi = data;
|
||||
if (!pi) return;
|
||||
|
||||
photo_item_action_setbg(pi);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_picture_viewer(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
|
||||
pi = data;
|
||||
if (!pi) return;
|
||||
|
||||
photo_item_action_viewer(pi);
|
||||
}
|
||||
|
||||
static void _cb_pause_toggle(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
|
||||
pi = data;
|
||||
if (!pi) return;
|
||||
|
||||
photo_item_action_pause_toggle(pi);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_configure_item(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
|
||||
pi = data;
|
||||
if (!pi) return;
|
||||
if (pi->config_dialog) return;
|
||||
|
||||
photo_config_dialog_item_show(pi);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_configure_general(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
if (!photo) return;
|
||||
if (photo->config_dialog) return;
|
||||
|
||||
photo_config_dialog_show();
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
#ifdef E_MOD_PHOTO_TYPEDEFS
|
||||
|
||||
|
||||
|
||||
#else
|
||||
|
||||
#ifndef PHOTO_MENU_H_INCLUDED
|
||||
#define PHOTO_MENU_H_INCLUDED
|
||||
|
||||
int photo_menu_show(Photo_Item *pi);
|
||||
void photo_menu_hide(Photo_Item *pi);
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,317 @@
|
|||
#include "Photo.h"
|
||||
|
||||
static char *_display_init(void);
|
||||
static void _display_shutdown(void);
|
||||
|
||||
/*
|
||||
* Public functions
|
||||
*/
|
||||
|
||||
int photo_picture_init(void)
|
||||
{
|
||||
E_Container *cont;
|
||||
|
||||
cont = e_container_current_get(e_manager_current_get());
|
||||
photo->e_evas = cont->bg_evas;
|
||||
|
||||
if (!photo_picture_local_init())
|
||||
return 0;
|
||||
//if (!photo_picture_net_init())
|
||||
// return 0;
|
||||
|
||||
if (!_display_init())
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void photo_picture_shutdown(void)
|
||||
{
|
||||
photo_picture_setbg_purge(1);
|
||||
|
||||
_display_shutdown();
|
||||
|
||||
photo_picture_local_shutdown();
|
||||
//photo_picture_net_shutdown();
|
||||
}
|
||||
|
||||
|
||||
int photo_picture_load(Picture *pic, Evas *evas)
|
||||
{
|
||||
Evas_Object *im = NULL;
|
||||
|
||||
if (pic->picture)
|
||||
return 1;
|
||||
|
||||
im = photo_picture_object_get(pic, evas);
|
||||
if (!im)
|
||||
return 0;
|
||||
|
||||
pic->picture = im;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void photo_picture_unload(Picture *pic)
|
||||
{
|
||||
if (!pic->picture)
|
||||
return;
|
||||
|
||||
evas_object_del(pic->picture);
|
||||
pic->picture = NULL;
|
||||
}
|
||||
|
||||
|
||||
int photo_picture_free(Picture *p, int force, int force_now)
|
||||
{
|
||||
if (p->pi)
|
||||
{
|
||||
if (!force) return 0;
|
||||
if (!force_now)
|
||||
{
|
||||
p->delete = 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (p->path) free(p->path);
|
||||
if (p->thumb_path) free(p->thumb_path);
|
||||
if (p->picture) evas_object_del(p->picture);
|
||||
|
||||
if (p->infos.name) free(p->infos.name);
|
||||
if (p->infos.author) free(p->infos.author);
|
||||
if (p->infos.where_from) free(p->infos.where_from);
|
||||
if (p->infos.date) free(p->infos.date);
|
||||
if (p->infos.comments) free(p->infos.comments);
|
||||
|
||||
photo_picture_histo_picture_del(p);
|
||||
|
||||
free(p);
|
||||
return 1;
|
||||
}
|
||||
|
||||
Evas_Object *photo_picture_object_get(Picture *pic, Evas *evas)
|
||||
{
|
||||
Evas_Object *im = NULL;
|
||||
Eet_File *ef;
|
||||
Evas_Coord sw, sh;
|
||||
|
||||
if (!pic) return NULL;
|
||||
|
||||
if (pic->thumb_path)
|
||||
{
|
||||
/* load picture thumb */
|
||||
ef = eet_open(pic->thumb_path, EET_FILE_MODE_READ);
|
||||
if (!ef)
|
||||
{
|
||||
eet_close(ef);
|
||||
return 0;
|
||||
}
|
||||
|
||||
im = e_icon_add(evas);
|
||||
e_icon_file_key_set(im, pic->thumb_path, "/thumbnail/data");
|
||||
|
||||
e_icon_size_get(im, &sw, &sh);
|
||||
evas_object_resize(im, sw, sh);
|
||||
e_icon_fill_inside_set(im, 1);
|
||||
|
||||
/* debug : modify e_icon */
|
||||
/*
|
||||
im = e_icon_add(evas);
|
||||
e_icon_file_key_set(im, pic->thumb_path, "/thumbnail/data");
|
||||
e_icon_size_get(im, &sw, &sh);
|
||||
evas_object_resize(im, pic->original_w, pic->original_h);
|
||||
e_icon_fill_inside_set(im, 1);
|
||||
*/
|
||||
|
||||
/* debug : try without e_icon */
|
||||
/*
|
||||
im = evas_object_image_add(evas);
|
||||
evas_object_image_file_set(im, pic->thumb_path, "/thumbnail/data");
|
||||
evas_object_image_fill_set(im, 0, 0, pic->original_w, pic->original_h);
|
||||
evas_object_resize(im, pic->original_w, pic->original_h);
|
||||
evas_object_move(im, 0, 0);
|
||||
*/
|
||||
|
||||
eet_close(ef);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* load picture */
|
||||
im = e_icon_add(evas);
|
||||
e_icon_file_set(im, pic->path);
|
||||
|
||||
e_icon_size_get(im, &sw, &sh);
|
||||
evas_object_resize(im, sw, sh);
|
||||
e_icon_fill_inside_set(im, 1);
|
||||
}
|
||||
|
||||
return im;
|
||||
}
|
||||
|
||||
char *photo_picture_name_get(char *url)
|
||||
{
|
||||
char buf[4096];
|
||||
char *name, *ext;
|
||||
int name_l;
|
||||
|
||||
name = strrchr(url, '/');
|
||||
if (name)
|
||||
name++;
|
||||
else
|
||||
name = url;
|
||||
|
||||
ext = strrchr(name, '.');
|
||||
if (ext)
|
||||
name_l = strlen(name) - strlen(ext);
|
||||
else
|
||||
name_l = strlen(name);
|
||||
|
||||
strncpy(buf, name, name_l);
|
||||
name[name_l] = '\0';
|
||||
|
||||
return strdup(name);
|
||||
}
|
||||
|
||||
char *photo_picture_infos_get(Picture *p)
|
||||
{
|
||||
char buf[4096];
|
||||
char buf_ext[4096];
|
||||
|
||||
if (ecore_file_exists(p->path))
|
||||
{
|
||||
time_t date;
|
||||
char *date_ascii;
|
||||
|
||||
date = ecore_file_mod_time(p->path);
|
||||
date_ascii = (char *)ctime(&date);
|
||||
date_ascii[strlen(date_ascii) - 1] = ' ';
|
||||
snprintf(buf_ext, sizeof(buf_ext),
|
||||
"<underline=on underline_color=#000>Date :</> %s<br>"
|
||||
"<underline=on underline_color=#000>Size :</> %.2fMo",
|
||||
date_ascii, (float)ecore_file_size(p->path) / 1000000.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buf_ext, sizeof(buf_ext), "This file does not exist anymore on the disk !");
|
||||
}
|
||||
|
||||
snprintf(buf, sizeof(buf),
|
||||
"<underline=on underline_color=#000>Picture path :</> %s<br>"
|
||||
"<br>"
|
||||
"%s",
|
||||
p->path,
|
||||
buf_ext);
|
||||
|
||||
return strdup(buf);
|
||||
}
|
||||
|
||||
void photo_picture_setbg_add(char *name)
|
||||
{
|
||||
char buf[4096];
|
||||
char *home;
|
||||
|
||||
home = e_user_homedir_get();
|
||||
snprintf(buf, sizeof(buf), "%s/.e/e/backgrounds/%s.edj", home, name);
|
||||
free(home);
|
||||
|
||||
photo->setbg_topurge = evas_list_append(photo->setbg_topurge, strdup(buf));
|
||||
}
|
||||
|
||||
void photo_picture_setbg_purge(int shutdown)
|
||||
{
|
||||
char *file;
|
||||
int n = 0;
|
||||
|
||||
while( (file = evas_list_nth(photo->setbg_topurge, n)) )
|
||||
{
|
||||
n++;
|
||||
DMAIN(("set_bg check remove %s", file));
|
||||
if (!e_config->desktop_default_background ||
|
||||
strcmp(e_config->desktop_default_background, file))
|
||||
{
|
||||
DMAIN(("set_bg remove %s !", file));
|
||||
if (ecore_file_exists(file))
|
||||
ecore_file_unlink(file);
|
||||
photo->setbg_topurge = evas_list_remove(photo->setbg_topurge, file);
|
||||
free(file);
|
||||
n--;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (shutdown)
|
||||
free(file);
|
||||
}
|
||||
}
|
||||
|
||||
if (shutdown)
|
||||
evas_list_free(photo->setbg_topurge);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Private functions
|
||||
*
|
||||
*/
|
||||
|
||||
static char *
|
||||
_display_init(void)
|
||||
{
|
||||
char *display = NULL;
|
||||
char *tmp;
|
||||
|
||||
tmp = getenv("DISPLAY");
|
||||
if (tmp)
|
||||
display = strdup(tmp);
|
||||
|
||||
/* make sure the display var is of the form name:0.0 or :0.0 */
|
||||
if (display)
|
||||
{
|
||||
char *p;
|
||||
char buf[1024];
|
||||
|
||||
p = strrchr(display, ':');
|
||||
if (!p)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s:0.0", display);
|
||||
free(display);
|
||||
display = strdup(buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
p = strrchr(p, '.');
|
||||
if (!p)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s.0", display);
|
||||
free(display);
|
||||
display = strdup(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
display = strdup(":0.0");
|
||||
|
||||
/* init e Lib */
|
||||
if (display)
|
||||
e_lib_init(display);
|
||||
else
|
||||
{
|
||||
display = strdup(":0.0");
|
||||
e_lib_init(display);
|
||||
}
|
||||
|
||||
photo->display = display;
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
static void
|
||||
_display_shutdown(void)
|
||||
{
|
||||
if (!photo->display)
|
||||
return;
|
||||
|
||||
E_FREE(photo->display);
|
||||
e_lib_shutdown();
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
#ifdef E_MOD_PHOTO_TYPEDEFS
|
||||
|
||||
typedef struct _Picture Picture;
|
||||
typedef struct _Picture_Event_Fill Picture_Event_Fill;
|
||||
|
||||
#else
|
||||
|
||||
#ifndef PHOTO_PICTURE_H_INCLUDED
|
||||
#define PHOTO_PICTURE_H_INCLUDED
|
||||
|
||||
#define PICTURE_VIEWER_DEFAULT "exhibit"
|
||||
|
||||
#define PICTURE_FROM_DEFAULT 1
|
||||
#define PICTURE_BOTH 0
|
||||
#define PICTURE_LOCAL 1
|
||||
#define PICTURE_NET 2
|
||||
|
||||
#define PICTURE_SET_BG_PURGE_DEFAULT 1
|
||||
|
||||
#define PICTURE_THUMB_SIZE_DEFAULT 300
|
||||
#define PICTURE_THUMB_SIZE_MIN 100
|
||||
#define PICTURE_THUMB_SIZE_MAX 600
|
||||
|
||||
struct _Picture
|
||||
{
|
||||
Photo_Item *pi;
|
||||
|
||||
char *path;
|
||||
char *thumb_path;
|
||||
Evas_Object *picture;
|
||||
|
||||
struct
|
||||
{
|
||||
char *name;
|
||||
char *author;
|
||||
char *where_from;
|
||||
char *date;
|
||||
char *comments;
|
||||
} infos;
|
||||
int delete;
|
||||
int from;
|
||||
int original_w, original_h;
|
||||
|
||||
/*
|
||||
* each photo item where the picture is in the histo
|
||||
* is attached here, only one time
|
||||
*/
|
||||
Evas_List *items_histo;
|
||||
};
|
||||
|
||||
struct _Picture_Event_Fill
|
||||
{
|
||||
int new;
|
||||
int type;
|
||||
};
|
||||
|
||||
int photo_picture_init(void);
|
||||
void photo_picture_shutdown(void);
|
||||
|
||||
int photo_picture_load(Picture *pic, Evas *evas);
|
||||
void photo_picture_unload(Picture *pic);
|
||||
|
||||
int photo_picture_free(Picture *p, int force, int force_now);
|
||||
Evas_Object *photo_picture_object_get(Picture *pic, Evas *evas);
|
||||
char *photo_picture_name_get(char *name);
|
||||
char *photo_picture_infos_get(Picture *p);
|
||||
|
||||
void photo_picture_setbg_add(char *name);
|
||||
void photo_picture_setbg_purge(int shutdown);
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,211 @@
|
|||
#include "Photo.h"
|
||||
|
||||
static void _cb_menu_deactivate_post(void *data, E_Menu *m);
|
||||
static void _cb_menu_pre_select(void *data, E_Menu *m, E_Menu_Item *mi);
|
||||
static void _cb_menu_post_select(void *data, E_Menu *m, E_Menu_Item *mi);
|
||||
static void _cb_menu_select(void *data, E_Menu *m, E_Menu_Item *mi);
|
||||
static void _cb_popi_close(void *data);
|
||||
|
||||
/*
|
||||
* Public functions
|
||||
*/
|
||||
|
||||
int photo_picture_histo_init(Photo_Item *pi)
|
||||
{
|
||||
pi->histo.list = NULL;
|
||||
pi->histo.pos = 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void photo_picture_histo_shutdown(Photo_Item *pi)
|
||||
{
|
||||
Evas_List *l;
|
||||
Picture *p;
|
||||
Photo_Item *pi2;
|
||||
int cur;
|
||||
|
||||
if (pi->histo.list)
|
||||
{
|
||||
for (l=pi->histo.list; l; l=evas_list_next(l))
|
||||
{
|
||||
p = evas_list_data(l);
|
||||
cur = 0;
|
||||
while ( (pi2 = evas_list_nth(p->items_histo, cur)) )
|
||||
{
|
||||
if (pi == pi2)
|
||||
p->items_histo = evas_list_remove(p->items_histo, pi);
|
||||
else
|
||||
cur++;
|
||||
}
|
||||
}
|
||||
evas_list_free(pi->histo.list);
|
||||
pi->histo.list = NULL;
|
||||
}
|
||||
|
||||
pi->histo.pos = 0;
|
||||
|
||||
if (pi->histo.popi)
|
||||
{
|
||||
photo_popup_info_del(pi->histo.popi);
|
||||
pi->histo.popi = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void photo_picture_histo_attach(Photo_Item *pi, Picture *picture)
|
||||
{
|
||||
pi->histo.list = evas_list_prepend(pi->histo.list, picture);
|
||||
|
||||
/* if full and we are not on the last histo item, remove last */
|
||||
if (evas_list_count(pi->histo.list) > PICTURE_HISTO_SIZE_MAX)
|
||||
{
|
||||
Evas_List *l, *l2;
|
||||
l = evas_list_last(pi->histo.list);
|
||||
l2 = evas_list_nth_list(pi->histo.list, pi->histo.pos);
|
||||
if (l != l2)
|
||||
pi->histo.list = evas_list_remove_list(pi->histo.list, l);
|
||||
}
|
||||
|
||||
/* add the pi to the picture's items histo list if not already here */
|
||||
if (!evas_list_find(picture->items_histo, pi))
|
||||
picture->items_histo = evas_list_append(picture->items_histo, pi);
|
||||
}
|
||||
|
||||
Picture *photo_picture_histo_change(Photo_Item *pi, int offset)
|
||||
{
|
||||
Picture *picture;
|
||||
int new_pos;
|
||||
|
||||
new_pos = pi->histo.pos + offset;
|
||||
|
||||
DPIC(("HISTO change from %d to %d (off %d)", pi->histo.pos, new_pos, offset));
|
||||
|
||||
picture = evas_list_nth(pi->histo.list, new_pos);
|
||||
if (picture)
|
||||
pi->histo.pos = new_pos;
|
||||
else
|
||||
DPIC(("HISTO change FAILED !!"));
|
||||
|
||||
return picture;
|
||||
}
|
||||
|
||||
void photo_picture_histo_picture_del(Picture *picture)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
Evas_List *l;
|
||||
|
||||
for (l=picture->items_histo; l; l=evas_list_next(l))
|
||||
{
|
||||
pi = evas_list_data(l);
|
||||
while(evas_list_find(pi->histo.list, picture))
|
||||
pi->histo.list = evas_list_remove(pi->histo.list, picture);
|
||||
}
|
||||
|
||||
evas_list_free(picture->items_histo);
|
||||
}
|
||||
|
||||
void photo_picture_histo_menu_populate(Photo_Item *pi, E_Menu *mn)
|
||||
{
|
||||
E_Menu_Item *mi;
|
||||
Picture *p;
|
||||
int pos;
|
||||
|
||||
e_menu_post_deactivate_callback_set(mn, _cb_menu_deactivate_post, pi);
|
||||
|
||||
pos = evas_list_count(pi->histo.list) - 1;
|
||||
while ( (p=evas_list_nth(pi->histo.list, pos)) )
|
||||
{
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_label_set(mi, p->infos.name);
|
||||
e_menu_item_radio_group_set(mi, 1);
|
||||
e_menu_item_radio_set(mi, 1);
|
||||
if (pi->histo.pos == pos)
|
||||
e_menu_item_toggle_set(mi, 1);
|
||||
|
||||
e_menu_item_submenu_pre_callback_set(mi, _cb_menu_pre_select, pi);
|
||||
e_menu_item_submenu_post_callback_set(mi, _cb_menu_post_select, pi);
|
||||
e_menu_item_callback_set(mi, _cb_menu_select, pi);
|
||||
|
||||
pos--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Private functions
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
_cb_menu_deactivate_post(void *data, E_Menu *m)
|
||||
{
|
||||
e_object_del(E_OBJECT(m));
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_menu_pre_select(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
Picture *p;
|
||||
Photo_Item *pi;
|
||||
char *text;
|
||||
int number;
|
||||
|
||||
pi = data;
|
||||
|
||||
number = (evas_list_count(pi->histo.list) - (e_menu_item_num_get(mi)+1));
|
||||
|
||||
DPIC(("Select %d in histo list", number));
|
||||
|
||||
p = evas_list_nth(pi->histo.list, number);
|
||||
if (!p) return;
|
||||
|
||||
text = photo_picture_infos_get(p);
|
||||
|
||||
if (pi->histo.popi)
|
||||
photo_popup_info_del(pi->histo.popi);
|
||||
|
||||
pi->histo.popi = photo_popup_info_add(pi, p->infos.name, text, p,
|
||||
4,
|
||||
POPUP_INFO_PLACEMENT_CENTERED,
|
||||
_cb_popi_close, NULL);
|
||||
|
||||
free(text);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_menu_post_select(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
|
||||
pi = data;
|
||||
|
||||
DPIC(("Histo menu : Post select callback"));
|
||||
|
||||
if (pi->histo.popi)
|
||||
photo_popup_info_del(pi->histo.popi);
|
||||
pi->histo.popi = NULL;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_cb_menu_select(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
int no;
|
||||
|
||||
pi = data;
|
||||
|
||||
no = e_menu_item_num_get(mi);
|
||||
photo_item_action_change(pi,
|
||||
pi->histo.pos -
|
||||
(evas_list_count(pi->histo.list) - (no+1)));
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_popi_close(void *data)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
|
||||
pi = data;
|
||||
pi->histo.popi = NULL;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
#ifdef E_MOD_PHOTO_TYPEDEFS
|
||||
|
||||
|
||||
|
||||
#else
|
||||
|
||||
#ifndef PHOTO_PICTURE_HISTO_H_INCLUDED
|
||||
#define PHOTO_PICTURE_HISTO_H_INCLUDED
|
||||
|
||||
#define PICTURE_HISTO_SIZE_MAX 7
|
||||
|
||||
int photo_picture_histo_init(Photo_Item *pi);
|
||||
void photo_picture_histo_shutdown(Photo_Item *pi);
|
||||
|
||||
void photo_picture_histo_attach(Photo_Item *pi, Picture *picture);
|
||||
|
||||
Picture *photo_picture_histo_change(Photo_Item *pi, int offset);
|
||||
|
||||
void photo_picture_histo_picture_del(Picture *picture);
|
||||
|
||||
void photo_picture_histo_menu_populate(Photo_Item *pi, E_Menu *mn);
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,741 @@
|
|||
#include "Photo.h"
|
||||
|
||||
#define CACHE_SIZE() (2 + evas_list_count(DEVIANM->devians)*2)
|
||||
|
||||
#define POPUP_LOADING(list, buf, dtime) \
|
||||
if (list->loader.popup) \
|
||||
photo_popup_warn_del(list->loader.popup); \
|
||||
list->loader.popup = \
|
||||
photo_popup_warn_add(POPUP_WARN_TYPE_NEWS, buf, \
|
||||
PICTURE_LOCAL_POPUP_LOADER_TIME + dtime, \
|
||||
_popup_loader_close, _popup_loader_desactivate, \
|
||||
NULL);
|
||||
|
||||
#define POPUP_THUMBNAILING(list, buf, dtime) \
|
||||
if (list->thumb.popup) \
|
||||
photo_popup_warn_del(list->thumb.popup); \
|
||||
list->thumb.popup = \
|
||||
photo_popup_warn_add(POPUP_WARN_TYPE_NEWS, buf, \
|
||||
PICTURE_LOCAL_POPUP_THUMB_TIME + dtime, \
|
||||
_popup_thumb_close, _popup_thumb_desactivate, \
|
||||
NULL);
|
||||
|
||||
|
||||
typedef struct _Picture_Local_List Picture_Local_List;
|
||||
|
||||
struct _Picture_Local_List
|
||||
{
|
||||
Evas_List *pictures;
|
||||
|
||||
/* thumb */
|
||||
struct
|
||||
{
|
||||
Evas_List *pictures;
|
||||
Popup_Warn *popup;
|
||||
int popup_show;
|
||||
} thumb;
|
||||
|
||||
/* ecore idler to load in background */
|
||||
struct
|
||||
{
|
||||
Ecore_Idler *idler;
|
||||
Popup_Warn *popup;
|
||||
|
||||
Picture_Local_Dir *current_dir;
|
||||
|
||||
Evas_List *dirs;
|
||||
Ecore_List *file;
|
||||
} loader;
|
||||
|
||||
/* event to warn photo items wich are waiting for pictures */
|
||||
struct
|
||||
{
|
||||
int id;
|
||||
int nb_clients;
|
||||
} loader_ev;
|
||||
};
|
||||
|
||||
static Picture_Local_List *pictures_local;
|
||||
|
||||
|
||||
static int _picture_new(char *name);
|
||||
static void _pictures_old_del(int force, int force_now);
|
||||
|
||||
static int _load_idler(void *data);
|
||||
static void _load_idler_stop(void);
|
||||
static int _load_cb_ev_fill(void *data, int type, void *event);
|
||||
|
||||
static void _thumb_generate_cb(Evas_Object *obj, void *data);
|
||||
static void _thumb_generate_stop(void);
|
||||
|
||||
static int _popup_loader_close(Popup_Warn *popw, void *data);
|
||||
static void _popup_loader_desactivate(Popup_Warn *popw, void *data);
|
||||
static int _popup_thumb_close(Popup_Warn *popw, void *data);
|
||||
static void _popup_thumb_desactivate(Popup_Warn *popw, void *data);
|
||||
|
||||
|
||||
/*
|
||||
* Public functions
|
||||
*/
|
||||
|
||||
int photo_picture_local_init(void)
|
||||
{
|
||||
Picture_Local_List *list;
|
||||
|
||||
list = E_NEW(Picture_Local_List, 1);
|
||||
list->loader_ev.id = ecore_event_type_new();
|
||||
pictures_local = list;
|
||||
|
||||
photo_picture_local_load_start();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void photo_picture_local_shutdown(void)
|
||||
{
|
||||
photo_picture_local_load_stop();
|
||||
|
||||
_pictures_old_del(1, 1);
|
||||
|
||||
evas_list_free(pictures_local->pictures);
|
||||
pictures_local = NULL;
|
||||
}
|
||||
|
||||
void photo_picture_local_load_start(void)
|
||||
{
|
||||
Evas_List *l;
|
||||
|
||||
photo_picture_local_load_stop();
|
||||
|
||||
/* del old pictures */
|
||||
_pictures_old_del(1, 0);
|
||||
|
||||
/* set all directories to not loaded */
|
||||
for (l=photo->config->local.dirs; l; l=evas_list_next(l))
|
||||
{
|
||||
Picture_Local_Dir *d;
|
||||
d = evas_list_data(l);
|
||||
d->state = PICTURE_LOCAL_DIR_NOT_LOADED;
|
||||
}
|
||||
|
||||
/* load pictures */
|
||||
pictures_local->loader.idler = ecore_idler_add(_load_idler, NULL);
|
||||
|
||||
if (photo->config_dialog)
|
||||
photo_config_dialog_refresh_local_load();
|
||||
}
|
||||
|
||||
void photo_picture_local_load_stop(void)
|
||||
{
|
||||
_load_idler_stop();
|
||||
_thumb_generate_stop();
|
||||
|
||||
if (photo->config_dialog)
|
||||
{
|
||||
photo_config_dialog_refresh_local_infos();
|
||||
photo_config_dialog_refresh_local_dirs();
|
||||
photo_config_dialog_refresh_local_load();
|
||||
}
|
||||
}
|
||||
|
||||
int photo_picture_local_load_state_get(void)
|
||||
{
|
||||
if (pictures_local->thumb.pictures ||
|
||||
pictures_local->loader.idler)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Picture *photo_picture_local_get(int position)
|
||||
{
|
||||
Picture *picture;
|
||||
Evas_List *l, *was_first;
|
||||
Picture_Local_List *pl;
|
||||
|
||||
pl = pictures_local;
|
||||
|
||||
DPICL(("Trying to get a picture, position = %d", position));
|
||||
|
||||
if (!evas_list_count(pl->pictures))
|
||||
return NULL;
|
||||
|
||||
if (position != PICTURE_LOCAL_GET_RANDOM)
|
||||
{
|
||||
/* get the given picture */
|
||||
l = evas_list_nth_list(pl->pictures, position);
|
||||
picture = evas_list_data(l);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* get a random picture */
|
||||
l = evas_list_nth_list(pl->pictures,
|
||||
rand() % evas_list_count(pl->pictures));
|
||||
was_first = l;
|
||||
do
|
||||
{
|
||||
DD(("- Search -"));
|
||||
picture = evas_list_data(l);
|
||||
if (!picture->pi && !picture->delete)
|
||||
return picture;
|
||||
l = evas_list_next(l);
|
||||
if (!l) l = pl->pictures;
|
||||
} while (l != was_first);
|
||||
picture = NULL;
|
||||
}
|
||||
|
||||
return picture;
|
||||
}
|
||||
|
||||
int photo_picture_local_loaded_nb_get(void)
|
||||
{
|
||||
return evas_list_count(pictures_local->pictures);
|
||||
}
|
||||
|
||||
int photo_picture_local_tothumb_nb_get(void)
|
||||
{
|
||||
return evas_list_count(pictures_local->thumb.pictures);
|
||||
}
|
||||
|
||||
void photo_picture_local_ev_set(Photo_Item *pi)
|
||||
{
|
||||
if (pi->local_ev_fill_handler)
|
||||
return;
|
||||
|
||||
DPICL(("Set event fill"));
|
||||
|
||||
pictures_local->loader_ev.nb_clients++;
|
||||
pi->local_ev_fill_handler = ecore_event_handler_add(pictures_local->loader_ev.id,
|
||||
_load_cb_ev_fill,
|
||||
pi);
|
||||
}
|
||||
|
||||
void photo_picture_local_ev_raise(int nb)
|
||||
{
|
||||
Picture_Event_Fill *ev;
|
||||
|
||||
if (!pictures_local->loader_ev.nb_clients) return;
|
||||
|
||||
ev = E_NEW(Picture_Event_Fill, 1);
|
||||
ev->new = nb;
|
||||
ev->type = PICTURE_LOCAL;
|
||||
/* raise event to warn clients : a picture is here for you ! */
|
||||
ecore_event_add(pictures_local->loader_ev.id, ev, NULL, NULL);
|
||||
DPICL(("Loader event RAISED !"));
|
||||
}
|
||||
|
||||
Picture_Local_Dir *photo_picture_local_dir_new(char *path, int recursive, int read_hidden)
|
||||
{
|
||||
Picture_Local_Dir *dir;
|
||||
|
||||
if (!ecore_file_is_dir(path))
|
||||
{
|
||||
char buf[4096];
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("<hilight>Directory %s doesnt exists.</hilight><br><br>"
|
||||
"You can change the picture's folders in main configuration panel<br>"
|
||||
"They can be jpeg or png<br><br>"
|
||||
"After import, if you can remove these files and the pictures still can<br>"
|
||||
"be viewed, but you wont be able to set them as wallpaper anymore<br><br>"),
|
||||
path);
|
||||
e_module_dialog_show(photo->module, _("Photo Module Error"), buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dir = E_NEW(Picture_Local_Dir, 1);
|
||||
dir->path = evas_stringshare_add(path);
|
||||
dir->recursive = recursive;
|
||||
dir->read_hidden = read_hidden;
|
||||
dir->state = PICTURE_LOCAL_DIR_NOT_LOADED;
|
||||
|
||||
DPICL(("New directory created : %s", path));
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
void photo_picture_local_dir_free(Picture_Local_Dir *dir, int del_dialog)
|
||||
{
|
||||
if (dir->config_dialog && del_dialog)
|
||||
photo_config_dialog_dir_hide(dir);
|
||||
evas_stringshare_del(dir->path);
|
||||
free(dir);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Private functions
|
||||
*/
|
||||
|
||||
static int
|
||||
_picture_new(char *name)
|
||||
{
|
||||
Picture_Local_List *pl;
|
||||
Picture *picture;
|
||||
char file[4096];
|
||||
int th_w, th_h;
|
||||
char *file_tmp, *ext;
|
||||
|
||||
pl = pictures_local;
|
||||
|
||||
file_tmp = evas_list_data(pl->loader.dirs);
|
||||
snprintf(file, sizeof(file),
|
||||
"%s/%s", file_tmp, name);
|
||||
|
||||
DD(("File %s", file));
|
||||
|
||||
if (!pl->loader.current_dir->read_hidden && (file[0] == '.'))
|
||||
return 0;
|
||||
|
||||
th_w = photo->config->pictures_thumb_size;
|
||||
th_h = photo->config->pictures_thumb_size;
|
||||
|
||||
if ((file_tmp = ecore_file_readlink(file)))
|
||||
{
|
||||
name = strdup(ecore_file_get_file(file_tmp));
|
||||
strncpy(file, file_tmp, sizeof(file));
|
||||
}
|
||||
|
||||
if (pl->loader.current_dir->recursive &&
|
||||
ecore_file_is_dir(file))
|
||||
{
|
||||
pl->loader.dirs = evas_list_append(pl->loader.dirs, strdup(file));
|
||||
DPICL(("added %s to loader dirs", file));
|
||||
return 0;
|
||||
}
|
||||
|
||||
ext = strrchr(name, '.');
|
||||
if (!ext)
|
||||
return 0;
|
||||
if (strcasecmp(ext, ".jpg") && strcasecmp(ext, ".JPG") &&
|
||||
strcasecmp(ext, ".jpeg") && strcasecmp(ext, ".JPEG") &&
|
||||
strcasecmp(ext, ".png") && strcasecmp(ext, ".PNG"))
|
||||
return 0;
|
||||
|
||||
DPICL(("File %s loading ...", file));
|
||||
|
||||
picture = E_NEW(Picture, 1);
|
||||
picture->path = strdup(file);
|
||||
picture->thumb_path = e_thumb_file_get(picture->path);
|
||||
picture->infos.name = photo_picture_name_get(name);
|
||||
picture->from = PICTURE_LOCAL;
|
||||
|
||||
DPICL(("Thumb %s of %s exists ?", picture->thumb_path, picture->path));
|
||||
if (e_thumb_exists(picture->path))
|
||||
{
|
||||
int w, h;
|
||||
|
||||
e_thumb_geometry_get(picture->thumb_path, &w, &h, 1);
|
||||
DPICL(("THUMB %dx%d (wanted %dx%d)", w, h, th_w, th_h));
|
||||
if ((th_w > w) && (th_h > h))
|
||||
{
|
||||
/* thumb exists, but regen to new size */
|
||||
int i;
|
||||
|
||||
i = ecore_file_unlink(picture->thumb_path);
|
||||
DPICL(("File %s thumb exists (%dx%d), but regen to %dx%d (del old %d)", file, w, h, th_w, th_h, i));
|
||||
pl->thumb.pictures = evas_list_append(pl->thumb.pictures,
|
||||
picture);
|
||||
e_thumb_generate_begin(picture->path, th_w, th_h,
|
||||
photo->e_evas,
|
||||
&picture->picture, _thumb_generate_cb,
|
||||
picture);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* thumb exists and good size */
|
||||
DPICL(("File %s thumb exists and good size, add (%de)", file, evas_list_count(pl->pictures)));
|
||||
picture->original_w = w;
|
||||
picture->original_h = h;
|
||||
pl->pictures = evas_list_append(pl->pictures, picture);
|
||||
if (pl->loader_ev.nb_clients)
|
||||
photo_picture_local_ev_raise(1);
|
||||
if (photo->config_dialog &&
|
||||
!(evas_list_count(pl->pictures)%100))
|
||||
photo_config_dialog_refresh_local_infos();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* thumb doesnt exists so generate it */
|
||||
DPICL(("File %s thumb doesnt exist, gen %dx%d", file, th_w, th_h));
|
||||
pl->thumb.pictures = evas_list_append(pl->thumb.pictures,
|
||||
picture);
|
||||
e_thumb_generate_begin(picture->path, th_w, th_h,
|
||||
photo->e_evas,
|
||||
&picture->picture, _thumb_generate_cb,
|
||||
picture);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_pictures_old_del(int force, int force_now)
|
||||
{
|
||||
Picture *p;
|
||||
int no = 0;
|
||||
|
||||
while ( (p = evas_list_nth(pictures_local->pictures, no)) )
|
||||
{
|
||||
if (photo_picture_free(p, force, force_now))
|
||||
pictures_local->pictures = evas_list_remove(pictures_local->pictures, p);
|
||||
else
|
||||
no++;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
_load_idler(void *data)
|
||||
{
|
||||
Picture_Local_List *pl;
|
||||
Picture_Local_Dir *d;
|
||||
Evas_List *l;
|
||||
char *name;
|
||||
|
||||
pl = pictures_local;
|
||||
|
||||
DD(("o"));
|
||||
|
||||
/* no more dirs in the current_dir */
|
||||
if (!evas_list_count(pl->loader.dirs))
|
||||
{
|
||||
/* find a dir to load in user dir list */
|
||||
if (pl->loader.current_dir)
|
||||
{
|
||||
pl->loader.current_dir->state = PICTURE_LOCAL_DIR_LOADED;
|
||||
pl->loader.current_dir = NULL;
|
||||
if (photo->config_dialog)
|
||||
photo_config_dialog_refresh_local_dirs();
|
||||
}
|
||||
DD(("oo"));
|
||||
for (l=photo->config->local.dirs; l; l=evas_list_next(l))
|
||||
{
|
||||
d = evas_list_data(l);
|
||||
DD(("ooo"));
|
||||
if (d->state == PICTURE_LOCAL_DIR_NOT_LOADED)
|
||||
{
|
||||
d->state = PICTURE_LOCAL_DIR_LOADING;
|
||||
pl->loader.current_dir = d;
|
||||
pl->loader.dirs = evas_list_append(pl->loader.dirs,
|
||||
strdup(d->path));
|
||||
if (pl->loader.file && ecore_list_is_empty(pl->loader.file))
|
||||
ecore_list_destroy(pl->loader.file);
|
||||
pl->loader.file = NULL;
|
||||
DPICL(("Going to read %s", d->path));
|
||||
if (photo->config_dialog)
|
||||
photo_config_dialog_refresh_local_dirs();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/* no more directories to load */
|
||||
if (!pl->loader.current_dir)
|
||||
{
|
||||
if (pl->loader.file)
|
||||
ecore_list_destroy(pl->loader.file);
|
||||
pl->loader.file = NULL;
|
||||
pl->loader.idler = NULL;
|
||||
if (photo->config_dialog)
|
||||
{
|
||||
photo_config_dialog_refresh_local_infos();
|
||||
photo_config_dialog_refresh_local_load();
|
||||
}
|
||||
/* last loading popup message */
|
||||
if (photo->config->local.popup >= PICTURE_LOCAL_POPUP_SUM)
|
||||
{
|
||||
char buf[50];
|
||||
int thumb_nb = evas_list_count(pl->thumb.pictures);
|
||||
snprintf(buf, sizeof(buf), "Scan finished : %d pictures found",
|
||||
evas_list_count(pl->pictures) + thumb_nb);
|
||||
POPUP_LOADING(pl, buf, 3);
|
||||
/* tell how much pictures to thumb */
|
||||
if (thumb_nb)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "Still %d pictures to thumbnail",
|
||||
thumb_nb);
|
||||
POPUP_THUMBNAILING(pl, buf, 3);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* first dir list */
|
||||
if ( !pl->loader.file )
|
||||
pl->loader.file = ecore_file_ls(evas_list_data(pl->loader.dirs));
|
||||
|
||||
/* no more files in the current loader.dirs item */
|
||||
if ( !(name = ecore_list_next(pl->loader.file)) )
|
||||
{
|
||||
DD(("removing %s", (char *)evas_list_data(pl->loader.dirs)));
|
||||
/* go to next dir */
|
||||
ecore_list_destroy(pl->loader.file);
|
||||
pl->loader.file = NULL;
|
||||
free(evas_list_data(pl->loader.dirs));
|
||||
pl->loader.dirs = evas_list_remove_list(pl->loader.dirs,
|
||||
pl->loader.dirs);
|
||||
if (!evas_list_count(pl->loader.dirs))
|
||||
return 1;
|
||||
/* list the new dir */
|
||||
pl->loader.file = ecore_file_ls(evas_list_data(pl->loader.dirs));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* create the picture */
|
||||
if (_picture_new(name))
|
||||
{
|
||||
/* popups */
|
||||
if (photo->config->local.popup == PICTURE_LOCAL_POPUP_ALWAYS)
|
||||
{
|
||||
int nb;
|
||||
|
||||
/* loading popup message */
|
||||
nb = evas_list_count(pl->pictures) + evas_list_count(pl->thumb.pictures);
|
||||
if (nb && ((nb == 1) || !(nb%PICTURE_LOCAL_POPUP_LOADER_MOD)))
|
||||
{
|
||||
char buf[50];
|
||||
|
||||
if (nb == 1)
|
||||
snprintf(buf, sizeof(buf), "Scanning for pictures");
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "%d pictures found", nb);
|
||||
POPUP_LOADING(pl, buf, 0);
|
||||
}
|
||||
|
||||
/* thumbnailing popup message */
|
||||
if (pl->thumb.popup_show && (evas_list_count(pl->thumb.pictures) == 1))
|
||||
{
|
||||
POPUP_THUMBNAILING(pl, "Thumbnailing some pictures", 0);
|
||||
pl->thumb.popup_show = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* thumbnailing message */
|
||||
if (photo->config->local.thumb_msg &&
|
||||
(evas_list_count(pl->thumb.pictures) > 2))
|
||||
{
|
||||
photo->config->local.thumb_msg = 0;
|
||||
e_module_dialog_show(photo->module, _("Photo Module Information"),
|
||||
_("<hilight>Creating thumbs</hilight><br><br>"
|
||||
"Some pictures are being thumbed in a <hilight>background task</hilight>.<br>"
|
||||
"It can take a while, but after, loading will be faster :)<br><br>"
|
||||
"Each time wou will load pictures that haven't been loaded in devian before,<br>"
|
||||
"they will be thumbed"));
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_load_idler_stop(void)
|
||||
{
|
||||
Picture_Local_List *pl;
|
||||
|
||||
pl = pictures_local;
|
||||
|
||||
DPICL(("Idler stop !"));
|
||||
|
||||
if (pl->loader.idler)
|
||||
{
|
||||
ecore_idler_del(pl->loader.idler);
|
||||
pl->loader.idler = NULL;
|
||||
}
|
||||
|
||||
if (pl->loader.popup)
|
||||
{
|
||||
photo_popup_warn_del(pl->loader.popup);
|
||||
pl->loader.popup = NULL;
|
||||
}
|
||||
|
||||
if (pl->loader.current_dir)
|
||||
pl->loader.current_dir->state = PICTURE_LOCAL_DIR_NOT_LOADED;
|
||||
pl->loader.current_dir = NULL;
|
||||
|
||||
if (pl->loader.dirs)
|
||||
{
|
||||
Evas_List *l;
|
||||
|
||||
for(l=pl->loader.dirs; l; l=evas_list_next(l))
|
||||
{
|
||||
char *name;
|
||||
name = evas_list_data(l);
|
||||
free(name);
|
||||
}
|
||||
evas_list_free(pl->loader.dirs);
|
||||
pl->loader.dirs = NULL;
|
||||
}
|
||||
|
||||
if (pl->loader.file)
|
||||
{
|
||||
ecore_list_destroy(pl->loader.file);
|
||||
pl->loader.file = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
_load_cb_ev_fill(void *data, int type, void *event)
|
||||
{
|
||||
Photo_Item *pi;
|
||||
Picture_Event_Fill *ev;
|
||||
|
||||
pi = data;
|
||||
ev = event;
|
||||
|
||||
DPICL(("Loader - EVENT -"));
|
||||
|
||||
ecore_event_handler_del(pi->local_ev_fill_handler);
|
||||
pi->local_ev_fill_handler = NULL;
|
||||
|
||||
photo_item_action_change(pi, 1);
|
||||
|
||||
pictures_local->loader_ev.nb_clients--;
|
||||
DPICL(("Loader event nb_clients : %d", pictures_local->loader_ev.nb_clients));
|
||||
|
||||
ev->new--;
|
||||
if (!ev->new)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_thumb_generate_cb(Evas_Object *obj, void *data)
|
||||
{
|
||||
Picture *picture;
|
||||
Picture_Local_List *pl;
|
||||
|
||||
if (!photo || !data)
|
||||
return;
|
||||
if (!e_module_enabled_get(photo->module))
|
||||
return;
|
||||
|
||||
pl = pictures_local;
|
||||
|
||||
if (!evas_list_count(pl->thumb.pictures))
|
||||
return;
|
||||
|
||||
picture = data;
|
||||
|
||||
pl->thumb.pictures = evas_list_remove(pl->thumb.pictures, picture);
|
||||
if (!evas_list_count(pl->thumb.pictures))
|
||||
{
|
||||
pl->thumb.pictures = NULL;
|
||||
if (photo->config_dialog)
|
||||
photo_config_dialog_refresh_local_load();
|
||||
}
|
||||
|
||||
DPICL(("back from thumb generation of %s", picture->infos.name));
|
||||
|
||||
if (ecore_file_exists(picture->thumb_path))
|
||||
{
|
||||
e_thumb_geometry_get(picture->thumb_path,
|
||||
&picture->original_w, &picture->original_h, 1);
|
||||
DPICL(("thumb generated %dx%d", picture->original_w, picture->original_h));
|
||||
|
||||
pl->pictures = evas_list_append(pl->pictures, picture);
|
||||
|
||||
/* if the pic is loaded, remove it, we dont want it !
|
||||
* moreover it does memleak */
|
||||
if (picture->picture)
|
||||
{
|
||||
evas_object_del(picture->picture);
|
||||
picture->picture = NULL;
|
||||
}
|
||||
|
||||
if (photo->config_dialog)
|
||||
photo_config_dialog_refresh_local_infos();
|
||||
}
|
||||
else
|
||||
{
|
||||
photo_picture_free(picture, 1, 1);
|
||||
}
|
||||
|
||||
if ((photo->config->local.popup >= PICTURE_LOCAL_POPUP_SUM) &&
|
||||
!pl->loader.idler)
|
||||
{
|
||||
if (!evas_list_count(pl->thumb.pictures))
|
||||
{
|
||||
/* Last thumbnailing popup message */
|
||||
POPUP_THUMBNAILING(pl, "Thumbnailing finished :)", 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (photo->config->local.popup == PICTURE_LOCAL_POPUP_ALWAYS)
|
||||
{
|
||||
/* thumbnailing popup message */
|
||||
if (!(evas_list_count(pl->thumb.pictures)%PICTURE_LOCAL_POPUP_THUMB_MOD))
|
||||
{
|
||||
char buf[50];
|
||||
|
||||
snprintf(buf, sizeof(buf), "Still %d pictures to thumbnail",
|
||||
evas_list_count(pl->thumb.pictures));
|
||||
POPUP_THUMBNAILING(pl, buf, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pl->loader_ev.nb_clients)
|
||||
photo_picture_local_ev_raise(1);
|
||||
}
|
||||
|
||||
static void
|
||||
_thumb_generate_stop(void)
|
||||
{
|
||||
Picture_Local_List *pl;
|
||||
Evas_List *l;
|
||||
Picture *picture;
|
||||
|
||||
pl = pictures_local;
|
||||
|
||||
if (pl->thumb.pictures)
|
||||
{
|
||||
for (l=pl->thumb.pictures; l; l=evas_list_next(l))
|
||||
{
|
||||
picture = evas_list_data(l);
|
||||
e_thumb_generate_end(picture->path);
|
||||
photo_picture_free(picture, 1, 1);
|
||||
}
|
||||
evas_list_free(pl->thumb.pictures);
|
||||
}
|
||||
|
||||
pl->thumb.pictures = NULL;
|
||||
|
||||
if (pl->thumb.popup)
|
||||
{
|
||||
photo_popup_warn_del(pl->thumb.popup);
|
||||
pl->thumb.popup = NULL;
|
||||
}
|
||||
|
||||
pl->thumb.popup_show = 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_popup_loader_close(Popup_Warn *popw, void *data)
|
||||
{
|
||||
pictures_local->loader.popup = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_popup_loader_desactivate(Popup_Warn *popw, void *data)
|
||||
{
|
||||
if (photo->config->local.popup != PICTURE_LOCAL_POPUP_NEVER)
|
||||
photo->config->local.popup--;
|
||||
photo_config_save();
|
||||
}
|
||||
|
||||
static int
|
||||
_popup_thumb_close(Popup_Warn *popw, void *data)
|
||||
{
|
||||
pictures_local->thumb.popup = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_popup_thumb_desactivate(Popup_Warn *popw, void *data)
|
||||
{
|
||||
if (photo->config->local.popup != PICTURE_LOCAL_POPUP_NEVER)
|
||||
photo->config->local.popup--;
|
||||
photo_config_save();
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
#ifdef E_MOD_PHOTO_TYPEDEFS
|
||||
|
||||
typedef struct _Picture_Local_Dir Picture_Local_Dir;
|
||||
|
||||
#else
|
||||
|
||||
#ifndef PHOTO_PICTURE_LOCAL_H_INCLUDED
|
||||
#define PHOTO_PICTURE_LOCAL_H_INCLUDED
|
||||
|
||||
#define PICTURE_LOCAL_SHOW_LOGO_DEFAULT 1
|
||||
#define PICTURE_LOCAL_IMPORT_RECURSIVE_DEFAULT 0
|
||||
#define PICTURE_LOCAL_IMPORT_HIDDEN_DEFAULT 0
|
||||
|
||||
#define PICTURE_LOCAL_AUTO_RELOAD_DEFAULT 0
|
||||
|
||||
#define PICTURE_LOCAL_POPUP_LOADER_MOD 500
|
||||
#define PICTURE_LOCAL_POPUP_LOADER_TIME 2
|
||||
#define PICTURE_LOCAL_POPUP_THUMB_MOD 250
|
||||
#define PICTURE_LOCAL_POPUP_THUMB_TIME 2
|
||||
|
||||
#define PICTURE_LOCAL_POPUP_DEFAULT 2
|
||||
#define PICTURE_LOCAL_POPUP_NEVER 0
|
||||
#define PICTURE_LOCAL_POPUP_SUM 1
|
||||
#define PICTURE_LOCAL_POPUP_ALWAYS 2
|
||||
|
||||
#define PICTURE_LOCAL_DIR_NOT_LOADED 0
|
||||
#define PICTURE_LOCAL_DIR_LOADED 1
|
||||
#define PICTURE_LOCAL_DIR_LOADING 2
|
||||
|
||||
#define PICTURE_LOCAL_DIR_RECURSIVE_DEFAULT 0
|
||||
#define PICTURE_LOCAL_DIR_READ_HIDDEN_DEFAULT 0
|
||||
|
||||
#define PICTURE_LOCAL_GET_RANDOM -1
|
||||
|
||||
struct _Picture_Local_Dir
|
||||
{
|
||||
const char *path;
|
||||
int recursive;
|
||||
int read_hidden;
|
||||
int state;
|
||||
|
||||
E_Config_Dialog *config_dialog;
|
||||
};
|
||||
|
||||
|
||||
int photo_picture_local_init(void);
|
||||
void photo_picture_local_shutdown(void);
|
||||
|
||||
void photo_picture_local_load_start(void);
|
||||
void photo_picture_local_load_stop(void);
|
||||
int photo_picture_local_load_state_get(void);
|
||||
|
||||
Picture *photo_picture_local_get(int position);
|
||||
|
||||
int photo_picture_local_loaded_nb_get(void);
|
||||
int photo_picture_local_tothumb_nb_get(void);
|
||||
|
||||
void photo_picture_local_ev_set(Photo_Item *pi);
|
||||
void photo_picture_local_ev_raise(int nb);
|
||||
|
||||
Picture_Local_Dir *photo_picture_local_dir_new(char *path, int recursive, int read_hidden);
|
||||
void photo_picture_local_dir_free(Picture_Local_Dir *dir, int del_dialog);
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,32 @@
|
|||
#include "Photo.h"
|
||||
|
||||
typedef struct _Picture_Net_List Picture_Net_List;
|
||||
|
||||
struct _Picture_Net_List
|
||||
{
|
||||
Evas_List *pictures;
|
||||
int nb_pictures_waiting;
|
||||
};
|
||||
|
||||
static Picture_Net_List *pictures_net;
|
||||
|
||||
|
||||
/*
|
||||
* Public functions
|
||||
*/
|
||||
|
||||
int photo_picture_net_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void photo_picture_net_shutdown(void)
|
||||
{
|
||||
pictures_net = NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Private functions
|
||||
*
|
||||
*/
|
|
@ -0,0 +1,18 @@
|
|||
#ifdef E_MOD_PHOTO_TYPEDEFS
|
||||
|
||||
#else
|
||||
|
||||
#ifndef E_MOD_PICTURE_NET_H_INCLUDED
|
||||
#define E_MOD_PICTURE_NET_H_INCLUDED
|
||||
|
||||
#define PICTURE_NET_GET_RANDOM -1
|
||||
|
||||
int photo_picture_net_init(void);
|
||||
void photo_picture_net_shutdown(void);
|
||||
|
||||
Picture *photo_picture_net_get(int position);
|
||||
|
||||
void photo_picture_net_ev_set(Photo_Item *pi);
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,291 @@
|
|||
#include "Photo.h"
|
||||
|
||||
#define POPI_BORDER 6
|
||||
|
||||
#define POPI_ORIENT_DOWN() \
|
||||
x = (gx+ow/2) - w/2; \
|
||||
y = gh + POPI_BORDER;
|
||||
#define POPI_ORIENT_UP() \
|
||||
x = (gx+ow/2) - w/2; \
|
||||
y = (gy - h) - POPI_BORDER;
|
||||
#define POPI_ORIENT_LEFT() \
|
||||
x = (gx - w) - POPI_BORDER; \
|
||||
y = (gy+oh/2) - h/2;
|
||||
#define POPI_ORIENT_RIGHT() \
|
||||
x = gw + POPI_BORDER; \
|
||||
y = (gy+oh/2) - h/2;
|
||||
#define POPI_ORIENT_CENTER() \
|
||||
x = (ew/2) - (w/2); \
|
||||
y = (eh/2) - (h/2);
|
||||
/* TODO : real orient auto */
|
||||
#define POPI_ORIENT_AUTO() \
|
||||
x = (ew/2) - (w/2); \
|
||||
y = (eh/2) - (h/2);
|
||||
|
||||
|
||||
static Evas_List *_popups_info;
|
||||
|
||||
|
||||
static void _placement(Photo_Item *pi, int placement, int popi_w, int popi_h, int *popi_x, int *popi_y);
|
||||
static void _close(Popup_Info *popi);
|
||||
static int _cb_timer(void *data);;
|
||||
static void _cb_edje_close(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||
|
||||
/*
|
||||
* Public functions
|
||||
*/
|
||||
|
||||
int photo_popup_info_init(void)
|
||||
{
|
||||
_popups_info = NULL;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void photo_popup_info_shutdown(void)
|
||||
{
|
||||
Evas_List *l;
|
||||
|
||||
for (l = _popups_info; l; l = evas_list_next(l))
|
||||
{
|
||||
Popup_Info *p;
|
||||
p = evas_list_data(l);
|
||||
photo_popup_info_del(p);
|
||||
}
|
||||
evas_list_free(_popups_info);
|
||||
_popups_info = NULL;
|
||||
}
|
||||
|
||||
Popup_Info *photo_popup_info_add(Photo_Item *pi, const char *title, const char *text, Picture *picture, int timer, int placement, void (cb_func) (void *data), void *data)
|
||||
{
|
||||
E_Zone *zone;
|
||||
Popup_Info *popi;
|
||||
Evas_Object *tb;
|
||||
Evas_Textblock_Style *tb_style;
|
||||
int fw, fh, tw, th;
|
||||
|
||||
popi = E_NEW(Popup_Info, 1);
|
||||
|
||||
popi->pi = pi;
|
||||
popi->timer_org = timer;
|
||||
|
||||
zone = e_util_zone_current_get(e_manager_current_get());
|
||||
|
||||
/* pop */
|
||||
popi->pop = e_popup_new(zone, 0, 0, 1, 1);
|
||||
if (!popi->pop)
|
||||
{
|
||||
photo_popup_info_del(popi);
|
||||
return 0;
|
||||
}
|
||||
evas_event_freeze(popi->pop->evas);
|
||||
e_popup_layer_set(popi->pop, 255);
|
||||
|
||||
/* textblock */
|
||||
tb = evas_object_textblock_add(popi->pop->evas);
|
||||
tb_style = evas_textblock_style_new();
|
||||
evas_textblock_style_set(tb_style,
|
||||
"DEFAULT='font=Vera font_size=10 align=left color=#000000ff wrap=line'" "br='\n'");
|
||||
evas_object_textblock_style_set(tb, tb_style);
|
||||
evas_textblock_style_free(tb_style);
|
||||
|
||||
evas_object_textblock_clear(tb);
|
||||
evas_object_textblock_text_markup_set(tb, text);
|
||||
evas_object_textblock_size_formatted_get(tb, &tw, &th);
|
||||
evas_object_resize(tb, tw, th);
|
||||
popi->tb = tb;
|
||||
|
||||
/* face, title, icon and text */
|
||||
popi->face = edje_object_add(popi->pop->evas);
|
||||
photo_util_edje_set(popi->face, PHOTO_THEME_POPI);
|
||||
edje_object_part_text_set(popi->face, "title", title);
|
||||
edje_object_part_swallow(popi->face, "text", tb);
|
||||
evas_object_pass_events_set(tb, 1);
|
||||
if (picture)
|
||||
{
|
||||
Evas_Object *im;
|
||||
im = photo_picture_object_get(picture,
|
||||
popi->pop->evas);
|
||||
if (im)
|
||||
{
|
||||
popi->icon = im;
|
||||
edje_object_part_swallow(popi->face, "icon", im);
|
||||
evas_object_pass_events_set(im, 1);
|
||||
}
|
||||
}
|
||||
edje_object_signal_callback_add(popi->face, "close", "popup",
|
||||
_cb_edje_close, popi);
|
||||
edje_object_part_geometry_get(popi->face, "background",
|
||||
NULL, NULL, &fw, &fh);
|
||||
evas_object_move(popi->face, 0, 0);
|
||||
|
||||
/* pos and size */
|
||||
popi->w = fw + tw;
|
||||
popi->h = fh + th + 20;
|
||||
evas_object_resize(popi->face, popi->w, popi->h);
|
||||
_placement(pi, placement, popi->w, popi->h, &popi->x, &popi->y);
|
||||
e_popup_move_resize(popi->pop, popi->x, popi->y, popi->w, popi->h);
|
||||
DPOPI(("New: %dx%d : %dx%d", popi->x, popi->y, popi->w, popi->h));
|
||||
DPOPI(("New face: %dx%d", fw, fh));
|
||||
DPOPI(("New tb: %dx%d", tw, th));
|
||||
|
||||
/* timer */
|
||||
if (timer)
|
||||
popi->timer = ecore_timer_add(timer, _cb_timer, popi);
|
||||
|
||||
/* callback function and data / pi */
|
||||
popi->cb_func = cb_func;
|
||||
popi->data = data;
|
||||
|
||||
/* go ! */
|
||||
evas_object_show(popi->face);
|
||||
e_popup_edje_bg_object_set(popi->pop, popi->face);
|
||||
evas_event_thaw(popi->pop->evas);
|
||||
e_popup_show(popi->pop);
|
||||
|
||||
_popups_info = evas_list_append(_popups_info, popi);
|
||||
|
||||
return popi;
|
||||
}
|
||||
|
||||
void photo_popup_info_del(Popup_Info *popi)
|
||||
{
|
||||
if (popi->timer)
|
||||
ecore_timer_del(popi->timer);
|
||||
if (popi->tb)
|
||||
evas_object_del(popi->tb);
|
||||
if (popi->icon)
|
||||
evas_object_del(popi->icon);
|
||||
if (popi->face)
|
||||
evas_object_del(popi->face);
|
||||
if (popi->pop)
|
||||
e_object_del(E_OBJECT(popi->pop));
|
||||
|
||||
_popups_info = evas_list_remove(_popups_info, popi);
|
||||
|
||||
free(popi);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Private functions
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
_placement(Photo_Item *pi, int placement, int popi_w, int popi_h, int *popi_x, int *popi_y)
|
||||
{
|
||||
int x, y, w, h;
|
||||
int ox, oy, ow, oh;
|
||||
int gx, gy, gw, gh;
|
||||
int ew, eh;
|
||||
|
||||
w = popi_w;
|
||||
h = popi_h;
|
||||
|
||||
ew = photo->canvas_w;
|
||||
eh = photo->canvas_h;
|
||||
|
||||
if (!pi || (placement == POPUP_INFO_PLACEMENT_CENTERED))
|
||||
{
|
||||
POPI_ORIENT_CENTER();
|
||||
*popi_x = x;
|
||||
*popi_y = y;
|
||||
return;
|
||||
}
|
||||
|
||||
evas_object_geometry_get(pi->obj,
|
||||
&ox, &oy, &ow, &oh);
|
||||
e_gadcon_canvas_zone_geometry_get(pi->gcc->gadcon,
|
||||
&gx, &gy, &gw, &gh);
|
||||
gx += ox;
|
||||
gy += oy;
|
||||
|
||||
DPOPI(("Placement pre :\n"
|
||||
"x:%d y:%d w:%d, h:%d\n"
|
||||
"ox:%d oy:%d ow:%d, oh:%d\n"
|
||||
"gx:%d gy:%d gw:%d, gh:%d\n"
|
||||
"ew:%d eh:%d",
|
||||
x, y, w, h,
|
||||
ox, oy, ow, oh,
|
||||
gx, gy, gw, gh,
|
||||
ew, eh));
|
||||
|
||||
switch (pi->gcc->gadcon->orient)
|
||||
{
|
||||
case E_GADCON_ORIENT_TOP:
|
||||
case E_GADCON_ORIENT_CORNER_TL:
|
||||
case E_GADCON_ORIENT_CORNER_TR:
|
||||
POPI_ORIENT_DOWN();
|
||||
break;
|
||||
case E_GADCON_ORIENT_BOTTOM:
|
||||
case E_GADCON_ORIENT_CORNER_BL:
|
||||
case E_GADCON_ORIENT_CORNER_BR:
|
||||
POPI_ORIENT_UP();
|
||||
break;
|
||||
case E_GADCON_ORIENT_LEFT:
|
||||
case E_GADCON_ORIENT_CORNER_LT:
|
||||
case E_GADCON_ORIENT_CORNER_LB:
|
||||
POPI_ORIENT_RIGHT();
|
||||
break;
|
||||
case E_GADCON_ORIENT_RIGHT:
|
||||
case E_GADCON_ORIENT_CORNER_RT:
|
||||
case E_GADCON_ORIENT_CORNER_RB:
|
||||
POPI_ORIENT_LEFT();
|
||||
break;
|
||||
case E_GADCON_ORIENT_FLOAT:
|
||||
case E_GADCON_ORIENT_HORIZ:
|
||||
case E_GADCON_ORIENT_VERT:
|
||||
default:
|
||||
POPI_ORIENT_AUTO();
|
||||
break;
|
||||
}
|
||||
|
||||
if (x<POPI_BORDER) x=POPI_BORDER;
|
||||
if ((x+w)>(ew-POPI_BORDER)) x=(ew-w)-POPI_BORDER;
|
||||
if (y<POPI_BORDER) y=POPI_BORDER;
|
||||
if ((y+h)>(eh-POPI_BORDER)) y=(eh-h)-POPI_BORDER;
|
||||
|
||||
DPOPI(("Placement post :\n"
|
||||
"x:%d y:%d w:%d, h:%d",
|
||||
x, y, w, h));
|
||||
|
||||
*popi_x = x;
|
||||
*popi_y = y;
|
||||
}
|
||||
|
||||
static void
|
||||
_close(Popup_Info *popi)
|
||||
{
|
||||
DPOPI(("close"));
|
||||
|
||||
if(popi->cb_func)
|
||||
{
|
||||
if (popi->data)
|
||||
popi->cb_func(popi->data);
|
||||
else
|
||||
popi->cb_func(popi->pi);
|
||||
}
|
||||
|
||||
photo_popup_info_del(popi);
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_timer(void *data)
|
||||
{
|
||||
Popup_Info *popi;
|
||||
|
||||
popi = data;
|
||||
_close(popi);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_edje_close(void *data, Evas_Object *obj, const char *emission, const char *source)
|
||||
{
|
||||
Popup_Info *popi;
|
||||
|
||||
popi = data;
|
||||
_close(popi);
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
#ifdef E_MOD_PHOTO_TYPEDEFS
|
||||
|
||||
typedef struct _Popup_Info Popup_Info;
|
||||
|
||||
#else
|
||||
|
||||
#ifndef PHOTO_POPUP_INFO_H_INCLUDED
|
||||
#define PHOTO_POPUP_INFO_H_INCLUDED
|
||||
|
||||
#define POPUP_INFO_PLACEMENT_SHELF 0
|
||||
#define POPUP_INFO_PLACEMENT_CENTERED 1
|
||||
|
||||
#define POPUP_INFO_TIMER_DEFAULT 8
|
||||
#define POPUP_INFO_TIMER_MAX 60
|
||||
|
||||
struct _Popup_Info
|
||||
{
|
||||
Photo_Item *pi;
|
||||
|
||||
E_Popup *pop;
|
||||
Evas_Object *face;
|
||||
Evas_Object *tb;
|
||||
Evas_Object *icon;
|
||||
|
||||
Ecore_Timer *timer;
|
||||
int timer_org;
|
||||
int x, y, w, h;
|
||||
|
||||
void (*cb_func) (void *data);
|
||||
void *data;
|
||||
};
|
||||
|
||||
int photo_popup_info_init(void);
|
||||
void photo_popup_info_shutdown(void);
|
||||
|
||||
Popup_Info *photo_popup_info_add(Photo_Item *pi, const char *title, const char *text, Picture *picture, int timer, int placement, void (cb_func) (void *data), void *data);
|
||||
void photo_popup_info_del(Popup_Info *popi);
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,228 @@
|
|||
#include "Photo.h"
|
||||
|
||||
static Evas_List *_popups_warn;
|
||||
|
||||
static void _check_overlap(int *px, int *py, int *pw, int *ph, int tries, int org_x, int org_y);
|
||||
static void _try_close(Popup_Warn *popw);
|
||||
|
||||
static int _cb_timer(void *data);
|
||||
static void _cb_edje_close(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||
static void _cb_edje_desactivate(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||
/*
|
||||
* Public functions
|
||||
*/
|
||||
|
||||
int photo_popup_warn_init(void)
|
||||
{
|
||||
_popups_warn = NULL;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void photo_popup_warn_shutdown(void)
|
||||
{
|
||||
Evas_List *l;
|
||||
|
||||
for (l = _popups_warn; l; l = evas_list_next(l))
|
||||
{
|
||||
Popup_Warn *p;
|
||||
p = evas_list_data(l);
|
||||
photo_popup_warn_del(p);
|
||||
}
|
||||
evas_list_free(_popups_warn);
|
||||
_popups_warn = NULL;
|
||||
}
|
||||
|
||||
Popup_Warn *photo_popup_warn_add(int type, const char *text, int timer, int (*func_close) (Popup_Warn *popw, void *data), void (*func_desactivate) (Popup_Warn *popw, void *data), void *data)
|
||||
{
|
||||
E_Zone *zone;
|
||||
Popup_Warn *popw;
|
||||
int fw, fh;
|
||||
|
||||
popw = E_NEW(Popup_Warn, 1);
|
||||
|
||||
popw->type = type;
|
||||
popw->timer_org = timer;
|
||||
|
||||
zone = e_util_zone_current_get(e_manager_current_get());
|
||||
|
||||
/* pop */
|
||||
popw->pop = e_popup_new(zone, 0, 0, 1, 1);
|
||||
if (!popw->pop)
|
||||
{
|
||||
photo_popup_warn_del(popw);
|
||||
return 0;
|
||||
}
|
||||
evas_event_freeze(popw->pop->evas);
|
||||
e_popup_layer_set(popw->pop, 255);
|
||||
|
||||
|
||||
|
||||
/* face and text */
|
||||
popw->face = edje_object_add(popw->pop->evas);
|
||||
photo_util_edje_set(popw->face, PHOTO_THEME_POPW);
|
||||
edje_object_signal_callback_add(popw->face, "close", "popup",
|
||||
_cb_edje_close, popw);
|
||||
edje_object_signal_callback_add(popw->face, "desactivate", "popup",
|
||||
_cb_edje_desactivate, popw);
|
||||
edje_object_part_text_set(popw->face, "text", text);
|
||||
edje_object_part_geometry_get(popw->face, "text_border",
|
||||
NULL, NULL, &fw, NULL);
|
||||
edje_object_part_geometry_get(popw->face, "background",
|
||||
NULL, NULL, NULL, &fh);
|
||||
evas_object_resize(popw->face, fw, fh);
|
||||
evas_object_move(popw->face, 0, 0);
|
||||
|
||||
/* type */
|
||||
edje_object_message_send(popw->face, EDJE_MESSAGE_INT,
|
||||
POPUP_WARN_EDJE_MESSAGE_TYPE,
|
||||
&type);
|
||||
|
||||
/* pos */
|
||||
popw->x = photo->canvas_w - (fw + 20);;
|
||||
popw->y = photo->canvas_h - (fh + 20);;
|
||||
popw->w = fw;
|
||||
popw->h = fh;
|
||||
|
||||
/* timer */
|
||||
if (timer)
|
||||
popw->timer = ecore_timer_add(timer, _cb_timer, popw);
|
||||
|
||||
/* close and desactivate functions */
|
||||
popw->func_close = func_close;
|
||||
if (func_desactivate)
|
||||
{
|
||||
int show_desactivate = 1;
|
||||
|
||||
popw->func_desactivate = func_desactivate;
|
||||
edje_object_message_send(popw->face, EDJE_MESSAGE_INT,
|
||||
POPUP_WARN_EDJE_MESSAGE_SHOW_DESACTIVATE,
|
||||
&show_desactivate);
|
||||
}
|
||||
|
||||
/* attach data */
|
||||
popw->data = data;
|
||||
|
||||
/* check for popup overlaps */
|
||||
_check_overlap(&popw->x, &popw->y, &popw->w, &popw->h, 0, popw->x, popw->y);
|
||||
e_popup_move_resize(popw->pop, popw->x, popw->y, popw->w, popw->h);
|
||||
DPOPW(("New: %dx%d : %dx%d", popw->x, popw->y, popw->w, popw->h));
|
||||
DPOPW(("New face: %dx%d", fw, fh));
|
||||
|
||||
/* go ! */
|
||||
evas_object_show(popw->face);
|
||||
e_popup_edje_bg_object_set(popw->pop, popw->face);
|
||||
evas_event_thaw(popw->pop->evas);
|
||||
e_popup_show(popw->pop);
|
||||
|
||||
_popups_warn = evas_list_append(_popups_warn, popw);
|
||||
|
||||
return popw;
|
||||
}
|
||||
|
||||
void photo_popup_warn_del(Popup_Warn *popw)
|
||||
{
|
||||
if (popw->timer)
|
||||
ecore_timer_del(popw->timer);
|
||||
if (popw->face)
|
||||
evas_object_del(popw->face);
|
||||
if (popw->pop)
|
||||
e_object_del(E_OBJECT(popw->pop));
|
||||
|
||||
_popups_warn = evas_list_remove(_popups_warn, popw);
|
||||
|
||||
free(popw);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Private functions
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
_check_overlap(int *px, int *py, int *pw, int *ph, int tries, int org_x, int org_y)
|
||||
{
|
||||
Evas_List *l;
|
||||
Popup_Warn *p;
|
||||
int pxw, pyh;
|
||||
int p_xw, p_yh;
|
||||
|
||||
pxw = *px + *pw;
|
||||
pyh = *py + *ph;
|
||||
for (l = _popups_warn; l; l = evas_list_next(l))
|
||||
{
|
||||
p = evas_list_data(l);
|
||||
p_xw = p->x + p->w;
|
||||
p_yh = p->y + p->h;
|
||||
if (((p->x >= *px) && (p->x <= pxw) &&
|
||||
(p->y >= *py) && (p->y <= pyh))
|
||||
||
|
||||
((*px >= p->x) && (*px <= p_xw) &&
|
||||
(*py >= p->y) && (*py <= p_yh)))
|
||||
{
|
||||
/* overlap ! correct coords */
|
||||
/* try upper, and then on the left */
|
||||
/* TODO...: try down and right, maybe placement policy ? */
|
||||
DPOPW(("Overlap !"));
|
||||
*py = p->y - (*ph + POPUP_WARN_OVERLAP_BORDER);
|
||||
if (*py < 0)
|
||||
{
|
||||
*py = org_y;
|
||||
*px = *px - (*px + POPUP_WARN_OVERLAP_BORDER);
|
||||
if (*px < 0) break;
|
||||
}
|
||||
tries++;
|
||||
if (tries > POPUP_WARN_OVERLAP_CHECK_MAX)
|
||||
return;
|
||||
else
|
||||
_check_overlap(px, py, pw, ph, tries, org_x, org_y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_try_close(Popup_Warn *popw)
|
||||
{
|
||||
int del = 1;
|
||||
|
||||
if (popw->func_close)
|
||||
{
|
||||
if (!popw->func_close(popw, popw->data))
|
||||
del = 0;
|
||||
}
|
||||
|
||||
if (del)
|
||||
photo_popup_warn_del(popw);
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_timer(void *data)
|
||||
{
|
||||
Popup_Warn *popw;
|
||||
|
||||
popw = data;
|
||||
_try_close(popw);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_edje_close(void *data, Evas_Object *obj, const char *emission, const char *source)
|
||||
{
|
||||
Popup_Warn *popw;
|
||||
|
||||
popw = data;
|
||||
_try_close(popw);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_edje_desactivate(void *data, Evas_Object *obj, const char *emission, const char *source)
|
||||
{
|
||||
Popup_Warn *popw;
|
||||
|
||||
popw = data;
|
||||
if (popw->func_desactivate)
|
||||
popw->func_desactivate(popw, popw->data);
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
#ifdef E_MOD_PHOTO_TYPEDEFS
|
||||
|
||||
typedef struct _Popup_Warn Popup_Warn;
|
||||
|
||||
#else
|
||||
|
||||
#ifndef PHOTO_POPUP_WARN_H_INCLUDED
|
||||
#define PHOTO_POPUP_WARN_H_INCLUDED
|
||||
|
||||
#define POPUP_WARN_TYPE_NEWS 0
|
||||
#define POPUP_WARN_TYPE_ERROR 1
|
||||
|
||||
#define POPUP_WARN_EDJE_MESSAGE_SHOW_DESACTIVATE 0
|
||||
#define POPUP_WARN_EDJE_MESSAGE_TYPE 1
|
||||
|
||||
#define POPUP_WARN_TIMER_DEFAULT 8
|
||||
#define POPUP_WARN_TIMER_MIN 2
|
||||
#define POPUP_WARN_TIMER_MAX 60
|
||||
|
||||
#define POPUP_WARN_OVERLAP_BORDER 15
|
||||
#define POPUP_WARN_OVERLAP_CHECK_MAX 50
|
||||
|
||||
struct _Popup_Warn
|
||||
{
|
||||
int type;
|
||||
E_Popup *pop;
|
||||
Evas_Object *face;
|
||||
|
||||
Ecore_Timer *timer;
|
||||
int (*func_close) (Popup_Warn *popw, void *data);
|
||||
void (*func_desactivate) (Popup_Warn *popw, void *data);
|
||||
void *data;
|
||||
|
||||
int timer_org;
|
||||
int x, y, w, h;
|
||||
};
|
||||
|
||||
int photo_popup_warn_init(void);
|
||||
void photo_popup_warn_shutdown(void);
|
||||
|
||||
Popup_Warn *photo_popup_warn_add(int type, const char *text, int timer, int (*func_close) (Popup_Warn *popw, void *data), void (func_desactivate) (Popup_Warn *popw, void *data), void *data);
|
||||
void photo_popup_warn_del(Popup_Warn *popw);
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,35 @@
|
|||
#include "Photo.h"
|
||||
|
||||
|
||||
/*
|
||||
* Public functions
|
||||
*/
|
||||
|
||||
void photo_util_edje_set(Evas_Object *obj, char *key)
|
||||
{
|
||||
if (!photo->theme)
|
||||
e_theme_edje_object_set(obj, PHOTO_THEME_IN_E, key);
|
||||
else
|
||||
edje_object_file_set(obj, photo->theme, key);
|
||||
}
|
||||
|
||||
void photo_util_icon_set(Evas_Object *ic, char *key)
|
||||
{
|
||||
if (!photo->theme)
|
||||
e_util_edje_icon_set(ic, key);
|
||||
else
|
||||
e_icon_file_edje_set(ic, photo->theme, key);
|
||||
}
|
||||
|
||||
void photo_util_menu_icon_set(E_Menu_Item *mi, char *key)
|
||||
{
|
||||
if (!photo->theme)
|
||||
e_util_menu_item_edje_icon_set(mi, key);
|
||||
else
|
||||
e_menu_item_icon_edje_set(mi, photo->theme, key);
|
||||
}
|
||||
|
||||
/*
|
||||
* Private functions
|
||||
*
|
||||
*/
|
|
@ -0,0 +1,20 @@
|
|||
#ifdef E_MOD_PHOTO_TYPEDEFS
|
||||
|
||||
|
||||
|
||||
#else
|
||||
|
||||
#ifndef PHOTO_UTILS_H_INCLUDED
|
||||
#define PHOTO_UTILS_H_INCLUDED
|
||||
|
||||
#define UTIL_TEST_PARENT(son, parent, label, default) \
|
||||
( (son == label) || \
|
||||
((son == default) && \
|
||||
(parent == label)) )
|
||||
|
||||
void photo_util_edje_set(Evas_Object *obj, char *key);
|
||||
void photo_util_icon_set(Evas_Object *ic, char *key);
|
||||
void photo_util_menu_icon_set(E_Menu_Item *mi, char *key);
|
||||
|
||||
#endif
|
||||
#endif
|
Loading…
Reference in New Issue