New MPD Module to show MPD status in the shelf.

SVN revision: 33073
This commit is contained in:
Sthithaprajna Garapaty 2007-12-10 02:43:23 +00:00 committed by Sthithaprajna Garapaty
commit 6ad3c03937
18 changed files with 1593 additions and 0 deletions

218
ABOUT-NLS Normal file
View File

@ -0,0 +1,218 @@
Notes on the Free Translation Project
*************************************
Free software is going international! The Free Translation Project
is a way to get maintainers of free software, translators, and users all
together, so that will gradually become able to speak many languages.
A few packages already provide translations for their messages.
If you found this `ABOUT-NLS' file inside a distribution, you may
assume that the distributed package does use GNU `gettext' internally,
itself available at your nearest GNU archive site. But you do _not_
need to install GNU `gettext' prior to configuring, installing or using
this package with messages translated.
Installers will find here some useful hints. These notes also
explain how users should proceed for getting the programs to use the
available translations. They tell how people wanting to contribute and
work at translations should contact the appropriate team.
When reporting bugs in the `intl/' directory or bugs which may be
related to internationalization, you should tell about the version of
`gettext' which is used. The information can be found in the
`intl/VERSION' file, in internationalized packages.
Quick configuration advice
==========================
If you want to exploit the full power of internationalization, you
should configure it using
./configure --with-included-gettext
to force usage of internationalizing routines provided within this
package, despite the existence of internationalizing capabilities in the
operating system where this package is being installed. So far, only
the `gettext' implementation in the GNU C library version 2 provides as
many features (such as locale alias, message inheritance, automatic
charset conversion or plural form handling) as the implementation here.
It is also not possible to offer this additional functionality on top
of a `catgets' implementation. Future versions of GNU `gettext' will
very likely convey even more functionality. So it might be a good idea
to change to GNU `gettext' as soon as possible.
So you need _not_ provide this option if you are using GNU libc 2 or
you have installed a recent copy of the GNU gettext package with the
included `libintl'.
INSTALL Matters
===============
Some packages are "localizable" when properly installed; the
programs they contain can be made to speak your own native language.
Most such packages use GNU `gettext'. Other packages have their own
ways to internationalization, predating GNU `gettext'.
By default, this package will be installed to allow translation of
messages. It will automatically detect whether the system already
provides the GNU `gettext' functions. If not, the GNU `gettext' own
library will be used. This library is wholly contained within this
package, usually in the `intl/' subdirectory, so prior installation of
the GNU `gettext' package is _not_ required. Installers may use
special options at configuration time for changing the default
behaviour. The commands:
./configure --with-included-gettext
./configure --disable-nls
will respectively bypass any pre-existing `gettext' to use the
internationalizing routines provided within this package, or else,
_totally_ disable translation of messages.
When you already have GNU `gettext' installed on your system and run
configure without an option for your new package, `configure' will
probably detect the previously built and installed `libintl.a' file and
will decide to use this. This might be not what is desirable. You
should use the more recent version of the GNU `gettext' library. I.e.
if the file `intl/VERSION' shows that the library which comes with this
package is more recent, you should use
./configure --with-included-gettext
to prevent auto-detection.
The configuration process will not test for the `catgets' function
and therefore it will not be used. The reason is that even an
emulation of `gettext' on top of `catgets' could not provide all the
extensions of the GNU `gettext' library.
Internationalized packages have usually many `po/LL.po' files, where
LL gives an ISO 639 two-letter code identifying the language. Unless
translations have been forbidden at `configure' time by using the
`--disable-nls' switch, all available translations are installed
together with the package. However, the environment variable `LINGUAS'
may be set, prior to configuration, to limit the installed set.
`LINGUAS' should then contain a space separated list of two-letter
codes, stating which languages are allowed.
Using This Package
==================
As a user, if your language has been installed for this package, you
only have to set the `LANG' environment variable to the appropriate
`LL_CC' combination. Here `LL' is an ISO 639 two-letter language code,
and `CC' is an ISO 3166 two-letter country code. For example, let's
suppose that you speak German and live in Germany. At the shell
prompt, merely execute `setenv LANG de_DE' (in `csh'),
`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash').
This can be done from your `.login' or `.profile' file, once and for
all.
You might think that the country code specification is redundant.
But in fact, some languages have dialects in different countries. For
example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The
country code serves to distinguish the dialects.
The locale naming convention of `LL_CC', with `LL' denoting the
language and `CC' denoting the country, is the one use on systems based
on GNU libc. On other systems, some variations of this scheme are
used, such as `LL' or `LL_CC.ENCODING'. You can get the list of
locales supported by your system for your country by running the command
`locale -a | grep '^LL''.
Not all programs have translations for all languages. By default, an
English message is shown in place of a nonexistent translation. If you
understand other languages, you can set up a priority list of languages.
This is done through a different environment variable, called
`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG'
for the purpose of message handling, but you still need to have `LANG'
set to the primary language; this is required by other parts of the
system libraries. For example, some Swedish users who would rather
read translations in German than English for when Swedish is not
available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'.
In the `LANGUAGE' environment variable, but not in the `LANG'
environment variable, `LL_CC' combinations can be abbreviated as `LL'
to denote the language's main dialect. For example, `de' is equivalent
to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT'
(Portuguese as spoken in Portugal) in this context.
Translating Teams
=================
For the Free Translation Project to be a success, we need interested
people who like their own language and write it well, and who are also
able to synergize with other translators speaking the same language.
Each translation team has its own mailing list. The up-to-date list of
teams can be found at the Free Translation Project's homepage,
`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams"
area.
If you'd like to volunteer to _work_ at translating messages, you
should become a member of the translating team for your own language.
The subscribing address is _not_ the same as the list itself, it has
`-request' appended. For example, speakers of Swedish can send a
message to `sv-request@li.org', having this message body:
subscribe
Keep in mind that team members are expected to participate
_actively_ in translations, or at solving translational difficulties,
rather than merely lurking around. If your team does not exist yet and
you want to start one, or if you are unsure about what to do or how to
get started, please write to `translation@iro.umontreal.ca' to reach the
coordinator for all translator teams.
The English team is special. It works at improving and uniformizing
the terminology in use. Proven linguistic skill are praised more than
programming skill, here.
Available Packages
==================
Languages are not equally supported in all packages. The following
matrix shows the current state of internationalization, as of April
2005. The matrix shows, in regard of each package, for which languages
PO files have been submitted to translation coordination, with a
translation percentage of at least 50%.
Ready PO files en fr ja de bg es fi pl pt ru
+-------------------------------+
enlightenment | [] [] [] [] [] [] [] [] [] [] |
Some counters in the preceding matrix are higher than the number of
visible blocks let us expect. This is because a few extra PO files are
used for implementing regional variants of languages, or language
dialects.
For a PO file in the matrix above to be effective, the package to
which it applies should also have been internationalized and
distributed as such by its maintainer. There might be an observable
lag between the mere existence a PO file and its wide availability in a
distribution.
If August 2002 seems to be old, you may fetch a more recent copy of
this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date
matrix with full percentage details can be found at
`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'.
Using `gettext' in new packages
===============================
If you are writing a freely available program and want to
internationalize it you are welcome to use GNU `gettext' in your
package. Of course you have to respect the GNU Library General Public
License which covers the use of the GNU `gettext' library. This means
in particular that even non-free programs can use `libintl' as a shared
library, whereas only free software can use `libintl' as a static
library or use modified versions of `libintl'.
Once the sources are changed appropriately and the setup can handle
to use of `gettext' the only thing missing are the translations. The
Free Translation Project is also available for packages which are not
developed inside the GNU project. Therefore the information given above
applies also for every other Free Software Project. Contact
`translation@iro.umontreal.ca' to make the `.pot' files available to
the translation teams.

1
AUTHORS Normal file
View File

@ -0,0 +1 @@
iamsthitha

28
COPYING Normal file
View File

@ -0,0 +1,28 @@
Copyright (C) 2007 Sthithaprajna Garapaty and various contributors (see AUTHORS)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies of the Software and its Copyright notices. In addition publicly
documented acknowledgment must be given that this software has been used if no
source code of this software is made available publicly. This includes
acknowledgments in either Copyright notices, Manuals, Publicity and Marketing
documents or any documentation provided with any product containing this
software. This License does not apply to any software that links to the
libraries provided by this software (statically or dynamically), but only to
the software provided.
Please see the COPYING.PLAIN for a plain-english explanation of this notice
and it's intent.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

2
ChangeLog Normal file
View File

@ -0,0 +1,2 @@
09/06/2005 Christopher Michael <devilhorns@comcast.net>
* Added Support For Virtual Desktops

229
INSTALL Normal file
View File

@ -0,0 +1,229 @@
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. (Caching is
disabled by default to prevent problems with accidental use of stale
cache files.)
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You only need
`configure.ac' if you want to change it or regenerate `configure' using
a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. Run `./configure --help'
for details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not support the `VPATH'
variable, you have to compile the package for one architecture at a
time in the source code directory. After you have installed the
package for one architecture, use `make distclean' before reconfiguring
for another architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
_same_ architectures, `configure' can figure that out, but if it prints
a message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the `--target=TYPE' option to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
will cause the specified gcc to be used as the C compiler (unless it is
overridden in the site shell script).
`configure' Invocation
======================
`configure' recognizes the following options to control how it
operates.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

41
Makefile.am Normal file
View File

@ -0,0 +1,41 @@
MAINTAINERCLEANFILES = Makefile.in
SUBDIRS =
EDJE_CC = @edje_cc@
EDJE_FLAGS = -v \
-id $(top_srcdir) \
-fd $(top_srcdir)
filesdir = $(datadir)
files_DATA = e-module-mpdule.edj \
module.desktop \
mpdule.edj
EXTRA_DIST = $(files_DATA) \
e_modules-mpdule.spec \
mpdule.edc \
VeraMono.ttf
CONFIG_CLEAN_FILES = e_modules-mpdule.spec mpdule.edj
# the module .so file
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 \
e_mod_config.c
module_la_LIBADD = @e_libs@
module_la_LDFLAGS = -module -avoid-version
module_la_DEPENDENCIES = $(top_builddir)/config.h $(top_builddir)/mpdule.edj
%.edj: %.edc
$(EDJE_CC) $(EDJE_FLAGS) $< $@
clean-local:
rm -rf *.edj *~

0
NEWS Normal file
View File

5
README Normal file
View File

@ -0,0 +1,5 @@
Simple MPD module
Load it into your shelf. Set it to: Able to be Resized, and resize to a good size for best experience.
To see more than just the artist and title, edit the theme (See comments in the theme for more info).

BIN
VeraMono.ttf Normal file

Binary file not shown.

17
autogen.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
rm -rf autom4te.cache
rm -f aclocal.m4 ltmain.sh
touch README
echo "Running autopoint..." ; autopoint -f || :
echo "Running aclocal..." ; aclocal -I m4 $ACLOCAL_FLAGS || 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

105
configure.in Normal file
View File

@ -0,0 +1,105 @@
dnl Process this file with autoconf to produce a configure script.
# get rid of that stupid cache mechanism
rm -f config.cache
AC_INIT(configure.in)
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE(mpdule, 0.0.1)
AM_CONFIG_HEADER(config.h)
AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
AC_HEADER_TIME
AC_CHECK_HEADERS(sys/time.h libmpd/libmpdclient.h)
AC_C_CONST
AM_ENABLE_SHARED
AM_PROG_LIBTOOL
ALL_LINGUAS=""
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")
CPPFLAGS="`enlightenment-config --cflags` `pkg-config libmpd --cflags`"
LDFLAGS="`enlightenment-config --libs` `pkg-config libmpd --libs`"
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, "${libdir}/enlightenment/modules/${PACKAGE}", "Package installed data destination")
datadir="${libdir}/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([
Makefile
e_modules-mpdule.spec
],[
])

BIN
e-module-mpdule.edj Normal file

Binary file not shown.

136
e_mod_config.c Normal file
View File

@ -0,0 +1,136 @@
#include <e.h>
#include "e_mod_main.h"
struct _E_Config_Dialog_Data
{
int poll_time;
char *hostname;
char *port;
};
/* Protos */
static void *_create_data (E_Config_Dialog * cfd);
static void _free_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 void onTimeCheckChange (void *data, Evas_Object * obj);
static void onDateCheckChange (void *data, Evas_Object * obj);
void
_config_mpdule_module (Config_Item * ci)
{
E_Config_Dialog *cfd;
E_Config_Dialog_View *v;
E_Container *con;
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/e-module-mpdule.edj",
e_module_dir_get (mpdule_config->module));
con = e_container_current_get (e_manager_current_get ());
cfd = e_config_dialog_new (con, D_ ("MPDule Configuration"), "MPDule", "_e_modules_mpdule_config_dialog", buf, 0, v, ci);
mpdule_config->config_dialog = cfd;
}
static void
_fill_data (Config_Item * ci, E_Config_Dialog_Data * cfdata)
{
char buf[128];
cfdata->poll_time = ci->poll_time;
cfdata->hostname = strdup(ci->hostname);
snprintf(buf, sizeof(buf), "%d", ci->port);
cfdata->port = strdup(buf);
}
static void *
_create_data (E_Config_Dialog * cfd)
{
E_Config_Dialog_Data *cfdata;
Config_Item *ci;
ci = cfd->data;
cfdata = E_NEW (E_Config_Dialog_Data, 1);
_fill_data (ci, cfdata);
return cfdata;
}
static void
_free_data (E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata)
{
if (!mpdule_config)
return;
mpdule_config->config_dialog = NULL;
free(cfdata->hostname);
E_FREE(cfdata);
}
static Evas_Object *
_basic_create_widgets (E_Config_Dialog * cfd, Evas * evas,
E_Config_Dialog_Data * cfdata)
{
Evas_Object *o, *of, *ob, *time_entry, *time_check, *hostname_entry, *port_entry;
E_Radio_Group *rg;
o = e_widget_list_add (evas, 0, 0);
of = e_widget_frametable_add (evas, D_ ("Configuration"), 1);
ob = e_widget_label_add (evas, D_ ("Poll Time:"));
e_widget_frametable_object_append (of, ob, 0, 0, 1, 1, 1, 0, 1, 0);
ob = e_widget_slider_add (evas, 1, 0, D_ ("%1.0f seconds"), 1, 60, 1, 0, NULL, &(cfdata->poll_time), 100);
e_widget_frametable_object_append (of, ob, 0, 1, 1, 1, 1, 0, 1, 0);
ob = e_widget_label_add (evas, D_ ("Hostname:"));
e_widget_frametable_object_append (of, ob, 0, 2, 1, 1, 1, 0, 1, 0);
hostname_entry = e_widget_entry_add (evas, &cfdata->hostname, NULL, NULL, NULL);
e_widget_min_size_set (hostname_entry, 150, 1);
e_widget_frametable_object_append (of, hostname_entry, 0, 3, 1, 1, 1, 0, 1, 0);
ob = e_widget_label_add (evas, D_ ("Port:"));
e_widget_frametable_object_append (of, ob, 0, 4, 1, 1, 1, 0, 1, 0);
port_entry = e_widget_entry_add (evas, &cfdata->port, NULL, NULL, NULL);
e_widget_min_size_set (hostname_entry, 150, 1);
e_widget_frametable_object_append (of, port_entry, 0, 5, 1, 1, 1, 0, 1, 0);
e_widget_list_object_append (o, of, 1, 1, 0.5);
return o;
}
static int
_basic_apply_data (E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata)
{
Config_Item *ci;
ci = cfd->data;
ci->poll_time = cfdata->poll_time;
if (ci->hostname)
evas_stringshare_del(ci->hostname);
ci->hostname = evas_stringshare_add(cfdata->hostname);
ci->port = atoi(cfdata->port);
e_config_save_queue ();
_mpdule_config_updated (ci);
return 1;
}
static void
onTimeCheckChange (void *data, Evas_Object * obj)
{
int checked = e_widget_check_checked_get (obj);
e_widget_disabled_set (data, !checked);
}
static void
onDateCheckChange (void *data, Evas_Object * obj)
{
int checked = e_widget_check_checked_get (obj);
e_widget_disabled_set (data, !checked);
}

557
e_mod_main.c Normal file
View File

@ -0,0 +1,557 @@
#include <e.h>
#include "e_mod_main.h"
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
#include <libmpd/libmpdclient.h>
#define MAX_SONG_LENGTH 255
/* Func Proto Requirements for Gadcon */
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 char *_gc_id_new(void);
/* Module Protos */
static void _mpdule_cb_mouse_down (void *data, Evas * e, Evas_Object * obj,
void *event_info);
static void _mpdule_menu_cb_configure (void *data, E_Menu * m,
E_Menu_Item * mi);
static void _mpdule_menu_cb_post (void *data, E_Menu * m);
static int _mpdule_cb_check (void *data);
static Config_Item *_mpdule_config_item_get (const char *id);
static E_Config_DD *conf_edd = NULL;
static E_Config_DD *conf_item_edd = NULL;
Config *mpdule_config = NULL;
/* Define the class and gadcon functions this module provides */
static const E_Gadcon_Client_Class _gc_class = {
GADCON_CLIENT_CLASS_VERSION,
"mpdule", {_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL},
E_GADCON_CLIENT_STYLE_PLAIN
};
typedef struct _Instance Instance;
struct _Instance
{
E_Gadcon_Client *gcc;
Evas_Object *mpdule;
mpd_Connection *mpd;
Ecore_Timer *update_timer;
Config_Item *ci;
};
static void _mpdule_connect (Instance * inst);
static void _mpdule_disconnect (Instance * inst);
static void _mpdule_update_song (Instance * inst);
static void _mpdule_update_song_cb (void *data);
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;
Instance *inst;
char buf[4096];
inst = E_NEW (Instance, 1);
inst->ci = _mpdule_config_item_get (id);
if (!inst->ci->id)
inst->ci->id = evas_stringshare_add (id);
o = edje_object_add (gc->evas);
snprintf (buf, sizeof (buf), "%s/mpdule.edj",
e_module_dir_get (mpdule_config->module));
if (!e_theme_edje_object_set
(o, "base/theme/modules/mpdule", "modules/mpdule/main"))
edje_object_file_set (o, buf, "modules/mpdule/main");
evas_object_show (o);
gcc = e_gadcon_client_new (gc, name, id, style, o);
gcc->data = inst;
inst->gcc = gcc;
inst->mpdule = o;
evas_object_event_callback_add (o, EVAS_CALLBACK_MOUSE_DOWN,
_mpdule_cb_mouse_down, inst);
_mpdule_connect(inst);
_mpdule_update_song(inst);
inst->update_timer = ecore_timer_add((double)inst->ci->poll_time,
_mpdule_update_song_cb, inst);
mpdule_config->instances =
evas_list_append (mpdule_config->instances, inst);
return gcc;
}
static void
_gc_shutdown (E_Gadcon_Client * gcc)
{
Instance *inst;
inst = gcc->data;
if (inst->update_timer)
ecore_timer_del(inst->update_timer);
_mpdule_disconnect(inst);
mpdule_config->instances =
evas_list_remove (mpdule_config->instances, inst);
evas_object_event_callback_del (inst->mpdule, EVAS_CALLBACK_MOUSE_DOWN,
_mpdule_cb_mouse_down);
evas_object_del (inst->mpdule);
free (inst);
inst = NULL;
}
static void
_gc_orient (E_Gadcon_Client * gcc)
{
Instance *inst;
Evas_Coord mw, mh;
inst = gcc->data;
edje_object_size_min_calc (inst->mpdule, &mw, &mh);
e_gadcon_client_min_size_set (gcc, mw, mh);
}
static char *
_gc_label (void)
{
return D_ ("MPDule");
}
static Evas_Object *
_gc_icon (Evas * evas)
{
Evas_Object *o;
char buf[4096];
o = edje_object_add (evas);
snprintf (buf, sizeof (buf), "%s/e-module-mpdule.edj",
e_module_dir_get (mpdule_config->module));
edje_object_file_set (o, buf, "icon");
return o;
}
static const char *
_gc_id_new(void)
{
Config_Item *ci;
ci = _mpdule_config_item_get(NULL);
return ci->id;
}
static void
_mpdule_cb_mouse_down (void *data, Evas * e, Evas_Object * obj,
void *event_info)
{
Instance *inst;
Evas_Event_Mouse_Down *ev;
inst = data;
ev = event_info;
if ((ev->button == 3) && (!mpdule_config->menu))
{
E_Menu *mn;
E_Menu_Item *mi;
int x, y, w, h;
mn = e_menu_new ();
e_menu_post_deactivate_callback_set (mn, _mpdule_menu_cb_post, inst);
mpdule_config->menu = mn;
mi = e_menu_item_new (mn);
e_menu_item_label_set (mi, D_ ("Configuration"));
e_util_menu_item_edje_icon_set (mi, "enlightenment/configuration");
e_menu_item_callback_set (mi, _mpdule_menu_cb_configure, inst);
mi = e_menu_item_new (mn);
e_menu_item_separator_set (mi, 1);
e_gadcon_client_util_menu_items_append (inst->gcc, mn, 0);
e_gadcon_canvas_zone_geometry_get (inst->gcc->gadcon, &x, &y, &w, &h);
e_menu_activate_mouse (mn,
e_util_zone_current_get (e_manager_current_get
()), x + ev->output.x,
y + ev->output.y, 1, 1,
E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
evas_event_feed_mouse_up (inst->gcc->gadcon->evas, ev->button,
EVAS_BUTTON_NONE, ev->timestamp, NULL);
}
}
static void
_mpdule_menu_cb_post (void *data, E_Menu * m)
{
if (!mpdule_config->menu)
return;
e_object_del (E_OBJECT (mpdule_config->menu));
mpdule_config->menu = NULL;
}
static void
_mpdule_menu_cb_configure (void *data, E_Menu * m, E_Menu_Item * mi)
{
Instance *inst;
inst = data;
_config_mpdule_module (inst->ci);
}
void
_mpdule_config_updated (Config_Item *ci)
{
Evas_List *l;
if (!mpdule_config)
return;
for (l = mpdule_config->instances; l; l = l->next)
{
Instance *inst;
inst = l->data;
if (!inst->ci != ci)
continue;
_mpdule_disconnect(inst);
_mpdule_connect(inst);
_mpdule_update_song(inst);
if (inst->update_timer)
ecore_timer_interval_set (inst->update_timer,
(double) ci->poll_time);
else
inst->update_timer =
ecore_timer_add ((double) ci->poll_time, _mpdule_update_song_cb,
inst);
break;
}
}
static Config_Item *
_mpdule_config_item_get (const char *id)
{
Evas_List *l;
Config_Item *ci;
char buf[128];
if (!id)
{
int num = 0;
/* Create id */
if (mpdule_config->items)
{
const char *p;
ci = evas_list_last(mpdule_config->items)->data;
p = strrchr(ci->id, '.');
if (p) num = atoi(p + 1) + 1;
}
snprintf(buf, sizeof(buf), "%s.%d", _gc_class.name, num);
id = buf;
}
else
{
for (l = mpdule_config->items; l; l = l->next)
{
ci = l->data;
if (!ci->id)
continue;
if (!strcmp (ci->id, id))
return ci;
}
}
ci = E_NEW (Config_Item, 1);
ci->id = evas_stringshare_add (id);
ci->poll_time = 1.0;
ci->hostname = evas_stringshare_add ("localhost");
ci->port = 6600;
mpdule_config->items = evas_list_append (mpdule_config->items, ci);
return ci;
}
EAPI E_Module_Api e_modapi = {
E_MODULE_API_VERSION,
"MPDule"
};
static void
_mpdule_connect(Instance *inst)
{
mpd_Connection *mpd;
Config_Item *ci;
ci = inst->ci;
mpd = mpd_newConnection(ci->hostname, ci->port, 3.0);
inst->mpd = mpd;
}
static void
_mpdule_disconnect(Instance *inst)
{
if (inst->mpd) {
mpd_closeConnection(inst->mpd);
inst->mpd = NULL;
}
}
static void
_mpdule_update_song_cb(void *data)
{
Instance *inst;
inst = data;
_mpdule_update_song(inst);
return 0;
}
static void
_mpdule_update_song(Instance *inst)
{
mpd_Connection *mpd;
Evas_Object *mpdule;
if (!inst->mpd)
return;
mpd = inst->mpd;
mpdule = inst->mpdule;
mpd_sendStatusCommand(mpd);
if (mpd->error == 0)
{
mpd_Status *status = mpd_getStatus(mpd);
if (status)
{
if (status->state == MPD_STATUS_STATE_UNKNOWN)
{
edje_object_part_text_set (mpdule, "mpdule.status", D_ ("Unknown"));
}
else if (status->state == MPD_STATUS_STATE_STOP)
{
edje_object_part_text_set (mpdule, "mpdule.status", D_ ("Stopped"));
}
else if (status->state == MPD_STATUS_STATE_PLAY)
{
edje_object_part_text_set (mpdule, "mpdule.status", D_ ("Playing"));
}
else if (status->state == MPD_STATUS_STATE_PAUSE)
{
edje_object_part_text_set (mpdule, "mpdule.status", D_ ("Paused"));
}
if (status->state > MPD_STATUS_STATE_STOP)
{
mpd_sendCurrentSongCommand(mpd);
mpd_InfoEntity *entity = NULL;
while ( (entity = mpd_getNextInfoEntity(mpd)) )
{
if ( entity->type == MPD_INFO_ENTITY_TYPE_SONG &&
entity->info.song->id == status->songid )
{
mpd_Song *song = entity->info.song;
if (song->artist)
{
edje_object_part_text_set (mpdule, "mpdule.artist", song->artist);
}
else
{
edje_object_part_text_set (mpdule, "mpdule.artist", "");
}
if (song->title)
{
edje_object_part_text_set (mpdule, "mpdule.title", song->title);
}
else
{
edje_object_part_text_set (mpdule, "mpdule.title", "");
}
if (song->album)
{
edje_object_part_text_set (mpdule, "mpdule.album", song->album);
}
else
{
edje_object_part_text_set (mpdule, "mpdule.album", "");
}
if (song->track)
{
edje_object_part_text_set (mpdule, "mpdule.track", song->track);
}
else
{
edje_object_part_text_set (mpdule, "mpdule.track", "");
}
if (song->date)
{
edje_object_part_text_set (mpdule, "mpdule.date", song->date);
}
else
{
edje_object_part_text_set (mpdule, "mpdule.date", "");
}
if (song->genre)
{
edje_object_part_text_set (mpdule, "mpdule.genre", song->genre);
}
else
{
edje_object_part_text_set (mpdule, "mpdule.genre", "");
}
if (song->composer)
{
edje_object_part_text_set (mpdule, "mpdule.composer", song->composer);
}
else
{
edje_object_part_text_set (mpdule, "mpdule.composer", "");
}
if (song->time)
{
char * songtime;
sprintf(songtime, "%i", song->time);
edje_object_part_text_set (mpdule, "mpdule.time", songtime);
}
else
{
edje_object_part_text_set (mpdule, "mpdule.time", "");
}
if (song->file)
{
edje_object_part_text_set (mpdule, "mpdule.file", song->file);
}
else
{
edje_object_part_text_set (mpdule, "mpdule.file", "");
}
}
mpd_freeInfoEntity(entity);
}
}
mpd_freeStatus(status);
}
}
else
{
_mpdule_disconnect(inst);
_mpdule_connect(inst);
}
}
EAPI void *
e_modapi_init (E_Module * m)
{
bindtextdomain (PACKAGE, LOCALEDIR);
bind_textdomain_codeset (PACKAGE, "UTF-8");
conf_item_edd = E_CONFIG_DD_NEW ("MPDule_Config_Item", Config_Item);
#undef T
#undef D
#define T Config_Item
#define D conf_item_edd
E_CONFIG_VAL (D, T, id, STR);
E_CONFIG_VAL (D, T, poll_time, DOUBLE);
E_CONFIG_VAL (D, T, hostname, STR);
E_CONFIG_VAL (D, T, port, INT);
conf_edd = E_CONFIG_DD_NEW ("MPDule_Config", Config);
#undef T
#undef D
#define T Config
#define D conf_edd
E_CONFIG_LIST (D, T, items, conf_item_edd);
mpdule_config = e_config_domain_load ("module.mpdule", conf_edd);
if (!mpdule_config)
{
Config_Item *ci;
mpdule_config = E_NEW (Config, 1);
ci = E_NEW (Config_Item, 1);
ci->id = evas_stringshare_add ("0");
ci->poll_time = 1.0;
ci->hostname = evas_stringshare_add ("localhost");
ci->port = 6600;
mpdule_config->items = evas_list_append (mpdule_config->items, ci);
}
mpdule_config->module = m;
e_gadcon_provider_register (&_gc_class);
return m;
}
EAPI int
e_modapi_shutdown (E_Module * m)
{
mpdule_config->module = NULL;
e_gadcon_provider_unregister (&_gc_class);
if (mpdule_config->config_dialog)
e_object_del (E_OBJECT (mpdule_config->config_dialog));
if (mpdule_config->menu)
{
e_menu_post_deactivate_callback_set (mpdule_config->menu, NULL, NULL);
e_object_del (E_OBJECT (mpdule_config->menu));
mpdule_config->menu = NULL;
}
while (mpdule_config->items)
{
Config_Item *ci;
ci = mpdule_config->items->data;
mpdule_config->items =
evas_list_remove_list (mpdule_config->items, mpdule_config->items);
if (ci->id)
evas_stringshare_del (ci->id);
free (ci);
ci = NULL;
}
free (mpdule_config);
mpdule_config = NULL;
E_CONFIG_DD_FREE (conf_item_edd);
E_CONFIG_DD_FREE (conf_edd);
return 1;
}
EAPI int
e_modapi_save (E_Module * m)
{
e_config_domain_save ("module.mpdule", conf_edd, mpdule_config);
return 1;
}

39
e_mod_main.h Normal file
View File

@ -0,0 +1,39 @@
#define D_(str) dgettext(PACKAGE, str)
#ifndef E_MOD_MAIN_H
#define E_MOD_MAIN_H
#define RESOLUTION_MINUTE 0
#define RESOLUTION_SECOND 1
typedef struct _Config Config;
typedef struct _Config_Item Config_Item;
struct _Config
{
E_Module *module;
E_Config_Dialog *config_dialog;
E_Menu *menu;
Evas_List *instances;
Evas_List *items;
};
struct _Config_Item
{
const char *id;
double poll_time;
const char *hostname;
int port;
};
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);
void _config_mpdule_module(Config_Item *ci);
void _mpdule_config_updated(Config_Item *ci);
extern Config *mpdule_config;
#endif

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

@ -0,0 +1,50 @@
%define module_name mpdule
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

6
module.desktop Normal file
View File

@ -0,0 +1,6 @@
[Desktop Entry]
Type=Link
Name=Mixer
Icon=e-module-mixer
Comment=<hilight>Mixer Gadget</hilight><br>Allows you to control your system<br>volume.
Comment[it]=<hilight>Modulo Mixer</hilight><br>Permette di controllare il volume<br>dell'audio del sistema.

159
mpdule.edc Normal file
View File

@ -0,0 +1,159 @@
fonts {
font: "VeraMono.ttf" "VeraMono";
}
/*
Available labels:
mpdule.status
mpdule.artist
mpdule.title
mpdule.album
mpdule.track
mpdule.date
mpdule.genre
mpdule.composer
mpdule.time
mpdule.file
*/
collections
{
group
{
name: "modules/mpdule/main";
parts
{
part
{
name: "base";
type: RECT;
mouse_events: 0;
description {
state: "default" 0.0;
color: 255 255 255 255;
rel1 {
relative: 0.0 0.0;
}
rel2 {
relative: 1.0 1.0;
}
}
}
part
{
name: "item_clip";
type: RECT;
mouse_events: 1;
description {
state: "default" 0.0;
color: 255 255 255 0;
rel1 {
relative: 0.0 0.0;
}
rel2 {
relative: 1.0 1.0;
}
}
}
part
{
name: "mpdule.artist";
type: TEXT;
effect: OUTLINE_SOFT_SHADOW;
clip_to: "base";
mouse_events: 1;
description
{
state: "default" 0.0;
visible: 1;
align: 0.5 0.5;
rel1
{
relative: 0.0 0.0;
offset: 0 4;
}
rel2
{
relative: 1.0 0.5;
offset: -1 -3;
}
color: 255 255 255 255;
color2: 0 0 0 96;
color3: 0 0 0 32;
text {
text: "";
font: "VeraMono";
size: 10;
min: 1 1;
align: 0.5 0.5;
text_class: "mpdule";
}
}
description
{
state: "hidden" 0.0;
inherit: "default" 0.0;
visible: 0;
}
description
{
state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
}
}
part
{
name: "mpdule.title";
type: TEXT;
clip_to: "base";
effect: OUTLINE_SOFT_SHADOW;
mouse_events: 1;
description
{
state: "default" 0.0;
visible: 1;
align: 0.5 0.5;
rel1
{
relative: 0.0 0.5;
offset: 0 4;
}
rel2
{
relative: 1.0 1.0;
offset: -1 -3;
}
color: 255 255 255 255;
color2: 0 0 0 96;
color3: 0 0 0 32;
text {
text: "";
font: "VeraMono";
size: 9;
min: 1 1;
align: 0.5 0.5;
text_class: "mpdule";
}
}
description
{
state: "hidden" 0.0;
inherit: "default" 0.0;
visible: 0;
}
description
{
state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
}
}
}
/* Close Parts */
programs
{
}
/* Close Programs */
}
/* Close Group */
}
/* Close Coll */