New module 'diskio': Visualize disk activity, green = read, red = write

SVN revision: 36642
This commit is contained in:
Miculcy Brian 2008-10-13 23:23:28 +00:00
commit ab2dd491cb
28 changed files with 1990 additions and 0 deletions

29
.cvsignore Normal file
View File

@ -0,0 +1,29 @@
.deps
.libs
Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.guess
config.h
config.h.in
config.log
config.rpath
config.status
config.sub
configure
depcomp
install-sh
libtool
m4
missing
mkinstalldirs
ltmain.sh
stamp-h1
*.lo
*.la
*.edj
*.spec
*.tar.gz
module.desktop
INSTALL

2
AUTHORS Normal file
View File

@ -0,0 +1,2 @@
Code: Brian 'morlenxus' Miculcy <morlenxus@gmx.net>
Theme: Simon 'jf_simon' Tischer <simon@jesusfreaks-herrenberg.de>

28
COPYING Normal file
View File

@ -0,0 +1,28 @@
Copyright (C) 2000 Brian 'morlenxus' Miculcy 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.

33
COPYING-PLAIN Normal file
View File

@ -0,0 +1,33 @@
Plain English Copyright Notice
This file is not intended to be the actual License. The reason this file
exists is that we here are programmers and engineers. We aren't lawyers. We
provide licenses that we THINK say the right things, but we have our own
intentions at heart. This is a plain-english explanation of what those
intentions are, and if you follow them you will be within the "spirit" of
the license.
The intent is for us to enjoy writing software that is useful to us (the
AUTHORS) and allow others to use it freely and also benefit from the work we
put into making it. We don't want to restrict others using it. They should
not *HAVE* to make the source code of the applications they write that
simply link to these libraries (be that statically or dynamically), or for
them to be limited as to what license they choose to use (be it open, closed
or anything else). But we would like to know you are using these libraries.
We simply would like to know that it has been useful to someone. This is why
we ask for acknowledgement of some sort.
You can do what you want with the source of this software - it doesn't
matter. We still have it here for ourselves and it is open and free to use
and download and play with. It can't be taken away. We don't really mind what
you do with the source to your software. We would simply like to know that
you are using it - especially if it makes it to a commerical product. If you
simply e-mail all the AUTHORS (see COPYING and AUTHORS files) telling us, and
then make sure you include a paragraph or page in the manual for the product
with the copyright notice and state that you used this software, we will be
very happy. If you want to contribute back modifications and fixes you may have
made we will welcome those too with open arms (generally). If you want help
with changes needed, ports needed or features to be added, arrangements can
be easily made with some dialogue.
Brian 'morlenxus' Miculcy <morlenxus@gmx.net>

0
ChangeLog Normal file
View File

237
INSTALL Normal file
View File

@ -0,0 +1,237 @@
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006, 2007 Free Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package.
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 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.
Running `configure' might take a while. 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.
6. Often, you can also type `make uninstall' to remove the installed
files again.
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=c99 CFLAGS=-g 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 can use 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 `..'.
With a non-GNU `make', it is safer 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' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' 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 option `--target=TYPE' 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
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf bug. Until the bug is fixed you can use this workaround:
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
`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.

28
Makefile.am Normal file
View File

@ -0,0 +1,28 @@
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
config.sub configure depcomp install-sh ltmain.sh \
missing module.desktop
SUBDIRS = src
EDJE_FLAGS = -v \
-id $(top_srcdir)/images \
-fd $(top_srcdir)/fonts
# data files for the module
filesdir = $(datadir)
files_DATA = module.desktop \
e-module-diskio.edj
EXTRA_DIST = $(files_DATA) \
images/module_icon.png \
fonts/VeraBd.ttf
%.edj: %.edc
$(EDJE_CC) $(EDJE_FLAGS) $< $@
clean-local:
rm -rf e-module-diskio.edj module.desktop *~
uninstall:
rm -rf $(DESTDIR)$(datadir)

0
NEWS Normal file
View File

0
README Normal file
View File

14
ac_attribute.m4 Normal file
View File

@ -0,0 +1,14 @@
AC_DEFUN([AC_C___ATTRIBUTE__],
[
AC_MSG_CHECKING(for __attribute__)
AC_CACHE_VAL(ac_cv___attribute__, [
AC_TRY_COMPILE([#include <stdlib.h>],
[int func(int x); int foo(int x __attribute__ ((unused))) { exit(1); }],
ac_cv___attribute__=yes, ac_cv___attribute__=no)])
if test "$ac_cv___attribute__" = "yes"; then
AC_DEFINE(HAVE___ATTRIBUTE__, 1, [Define to 1 if your compiler has __attribute__])
fi
AC_MSG_RESULT($ac_cv___attribute__)
])

16
autogen.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
rm -rf autom4te.cache
rm -f aclocal.m4 ltmain.sh
touch README
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

53
configure.in Normal file
View File

@ -0,0 +1,53 @@
dnl Process this file with autoconf to produce a configure script.
# get rid of that stupid cache mechanism
rm -f config.cache
AC_INIT(diskio, 0.0.1, morlenxus@gmx.net)
AC_PREREQ(2.52)
AC_CONFIG_SRCDIR(configure.in)
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_ISC_POSIX
AM_INIT_AUTOMAKE(1.8)
AM_CONFIG_HEADER(config.h)
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
AC_C_CONST
AC_C___ATTRIBUTE__
define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
AC_PROG_LIBTOOL
#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_PATH_PROG(EDJE_CC, "edje_cc", "", $PATH)
AC_PATH_PROG(E_CONFIG, "enlightenment-config", "", $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)
datadir="${e_modules}/${PACKAGE}"
AC_ARG_ENABLE(homedir-install,
AS_HELP_STRING([--enable-homedir-install], [Install module in homedir]),
[ datadir="${HOME}/.e/e/modules/${PACKAGE}" ]
)
AC_OUTPUT([
Makefile
src/Makefile
module.desktop
], [
])

169
e-module-diskio.edc Normal file
View File

@ -0,0 +1,169 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
fonts
{
font: "VeraBd.ttf" "VeraBd";
}
images
{
image: "module_icon.png" COMP;
image: "module_icon_r.png" COMP;
image: "module_icon_w.png" COMP;
}
collections
{
group
{
name: "icon";
max: 24 24;
parts
{
part
{
name: "image";
mouse_events: 0;
type: IMAGE;
description
{
state: "default" 0.0;
image.normal: "module_icon.png";
}
}
}
}
group
{
name: "modules/diskio/main";
max: 128 128;
parts
{
part
{
name: "icon";
mouse_events: 1;
type: IMAGE;
description
{
state: "default" 0.0;
aspect: 1.0 1.0;
aspect_preference: BOTH;
image.normal: "module_icon.png";
}
}
part
{
name: "read";
type: IMAGE;
description
{
state: "off" 0.0;
aspect: 1.0 1.0;
aspect_preference: BOTH;
image.normal: "module_icon_r.png";
color: 0 0 0 0;
}
description
{
state: "on" 0.0;
aspect: 1.0 1.0;
aspect_preference: BOTH;
color: 255 255 255 255;
}
}
part
{
name: "write";
type: IMAGE;
description
{
state: "off" 0.0;
aspect: 1.0 1.0;
aspect_preference: BOTH;
image.normal: "module_icon_w.png";
color: 0 0 0 0;
}
description
{
state: "on" 0.0;
aspect: 1.0 1.0;
aspect_preference: BOTH;
color: 255 255 255 255;
}
}
/////////////
part {
name: "e.text.display_name";
type: TEXT;
effect: OUTLINE_SOFT_SHADOW;
mouse_events: 0;
description
{
state: "default" 0.0;
rel1
{
relative: 0.0 0.2;
offset: 0 0;
to_x: "icon";
}
rel2
{
relative: 0.95 0.95;
offset: -1 -1;
}
color: 255 255 255 255;
color2: 0 0 0 96;
color3: 0 0 0 32;
color_class: "module_label";
text
{
text: "???";
font: "VeraBold";
size: 8;
min: 1 1;
align: 0.5 0.5;
text_class: "module_small";
}
}
///////////////////
}
}
programs
{
program
{
name: "read_off";
signal: "read,off";
source: "";
action: STATE_SET "off" 0.0;
target: "read";
}
program
{
name: "read_on";
signal: "read,on";
source: "";
action: STATE_SET "on" 0.0;
target: "read";
}
program
{
name: "write_off";
signal: "write,off";
source: "";
action: STATE_SET "off" 0.0;
target: "write";
}
program
{
name: "write_on";
signal: "write,on";
source: "";
action: STATE_SET "on" 0.0;
target: "write";
}
}
}
}

28
fonts/.cvsignore Normal file
View File

@ -0,0 +1,28 @@
.deps
.libs
Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.guess
config.h
config.h.in
config.log
config.rpath
config.status
config.sub
configure
depcomp
install-sh
libtool
m4
missing
mkinstalldirs
ltmain.sh
stamp-h1
*.lo
*.la
*.edj
*.spec
*.tar.gz
module.desktop

BIN
fonts/VeraBd.ttf Normal file

Binary file not shown.

28
images/.cvsignore Normal file
View File

@ -0,0 +1,28 @@
.deps
.libs
Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.guess
config.h
config.h.in
config.log
config.rpath
config.status
config.sub
configure
depcomp
install-sh
libtool
m4
missing
mkinstalldirs
ltmain.sh
stamp-h1
*.lo
*.la
*.edj
*.spec
*.tar.gz
module.desktop

BIN
images/module_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
images/module_icon_r.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
images/module_icon_w.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

28
m4/.cvsignore Normal file
View File

@ -0,0 +1,28 @@
.deps
.libs
Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.guess
config.h
config.h.in
config.log
config.rpath
config.status
config.sub
configure
depcomp
install-sh
libtool
m4
missing
mkinstalldirs
ltmain.sh
stamp-h1
*.lo
*.la
*.edj
*.spec
*.tar.gz
module.desktop

14
m4/ac_attribute.m4 Normal file
View File

@ -0,0 +1,14 @@
AC_DEFUN([AC_C___ATTRIBUTE__],
[
AC_MSG_CHECKING(for __attribute__)
AC_CACHE_VAL(ac_cv___attribute__, [
AC_TRY_COMPILE([#include <stdlib.h>],
[int func(int x); int foo(int x __attribute__ ((unused))) { exit(1); }],
ac_cv___attribute__=yes, ac_cv___attribute__=no)])
if test "$ac_cv___attribute__" = "yes"; then
AC_DEFINE(HAVE___ATTRIBUTE__, 1, [Define to 1 if your compiler has __attribute__])
fi
AC_MSG_RESULT($ac_cv___attribute__)
])

5
module.desktop.in Normal file
View File

@ -0,0 +1,5 @@
[Desktop Entry]
Type=Link
Name=DiskIO
Icon=e-module-diskio
Comment=<hilight>DiskIO Module Gadget:</hilight><br><br>Visualize disk i/o.

28
src/.cvsignore Normal file
View File

@ -0,0 +1,28 @@
.deps
.libs
Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.guess
config.h
config.h.in
config.log
config.rpath
config.status
config.sub
configure
depcomp
install-sh
libtool
m4
missing
mkinstalldirs
ltmain.sh
stamp-h1
*.lo
*.la
*.edj
*.spec
*.tar.gz
module.desktop

19
src/Makefile.am Normal file
View File

@ -0,0 +1,19 @@
MAINTAINERCLEANFILES = Makefile.in
INCLUDES = -I. \
-I$(top_srcdir) \
-I$(includedir) \
@e_cflags@
pkgdir = $(datadir)/$(MODULE_ARCH)
pkg_LTLIBRARIES = module.la
module_la_SOURCES = e_mod_main.h \
e_mod_main.c \
e_mod_config.c
module_la_LIBADD = @e_libs@
module_la_LDFLAGS = -module -avoid-version
module_la_DEPENDENCIES = $(top_builddir)/config.h
clean-local:
rm -rf *~

490
src/Makefile.in Normal file
View File

@ -0,0 +1,490 @@
# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(pkgdir)"
pkgLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(pkg_LTLIBRARIES)
am_module_la_OBJECTS = e_mod_main.lo e_mod_config.lo
module_la_OBJECTS = $(am_module_la_OBJECTS)
module_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(module_la_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(module_la_SOURCES)
DIST_SOURCES = $(module_la_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EDJE_CC = @EDJE_CC@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
E_CONFIG = @E_CONFIG@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
MODULE_ARCH = @MODULE_ARCH@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
e_cflags = @e_cflags@
e_libs = @e_libs@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
MAINTAINERCLEANFILES = Makefile.in
INCLUDES = -I. \
-I$(top_srcdir) \
-I$(includedir) \
@e_cflags@
pkgdir = $(datadir)/$(MODULE_ARCH)
pkg_LTLIBRARIES = module.la
module_la_SOURCES = e_mod_main.h \
e_mod_main.c \
e_mod_config.c
module_la_LIBADD = @e_libs@
module_la_LDFLAGS = -module -avoid-version
module_la_DEPENDENCIES = $(top_builddir)/config.h
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu src/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(pkgdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdir)"
@list='$(pkg_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \
else :; fi; \
done
uninstall-pkgLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(pkg_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \
done
clean-pkgLTLIBRARIES:
-test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES)
@list='$(pkg_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
module.la: $(module_la_OBJECTS) $(module_la_DEPENDENCIES)
$(module_la_LINK) -rpath $(pkgdir) $(module_la_OBJECTS) $(module_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/e_mod_config.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/e_mod_main.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
for dir in "$(DESTDIR)$(pkgdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am
clean-am: clean-generic clean-libtool clean-local clean-pkgLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-pkgLTLIBRARIES
install-dvi: install-dvi-am
install-exec-am:
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-pkgLTLIBRARIES
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool clean-local clean-pkgLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-pkgLTLIBRARIES install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-pkgLTLIBRARIES
clean-local:
rm -rf *~
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

138
src/e_mod_config.c Normal file
View File

@ -0,0 +1,138 @@
#include <e.h>
#include "e_mod_main.h"
struct _E_Config_Dialog_Data
{
Ecore_List *disks;
int diskpos;
};
/* Local Function Prototypes */
static void *_create_data(E_Config_Dialog *cfd);
static void _fill_data(Config_Item * ci, E_Config_Dialog_Data *cfdata);
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static Evas_Object *_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
static int _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
/* External Functions */
EAPI E_Config_Dialog *
e_int_config_diskio_module(E_Container *con, Config_Item *ci)
{
E_Config_Dialog *cfd = NULL;
E_Config_Dialog_View *v = NULL;
char buf[4096];
/* is this config dialog already visible ? */
if (e_config_dialog_find("DiskIO", "_e_module_diskio_cfg_dlg")) return NULL;
v = E_NEW(E_Config_Dialog_View, 1);
if (!v) return NULL;
v->create_cfdata = _create_data;
v->free_cfdata = _free_data;
v->basic.create_widgets = _basic_create;
v->basic.apply_cfdata = _basic_apply;
/* Icon in the theme */
snprintf(buf, sizeof(buf), "%s/e-module-diskio.edj", diskio_conf->module->dir);
/* create new config dialog */
cfd = e_config_dialog_new(con, "DiskIO Module", "DiskIO",
"_e_module_diskio_cfg_dlg", buf, 0, v, ci);
e_dialog_resizable_set(cfd->dia, 1);
diskio_conf->cfd = cfd;
return cfd;
}
/* Local Functions */
static void *
_create_data(E_Config_Dialog *cfd)
{
E_Config_Dialog_Data *cfdata = NULL;
Config_Item *ci;
ci = cfd->data;
cfdata = E_NEW(E_Config_Dialog_Data, 1);
_fill_data(ci, cfdata);
return cfdata;
}
static void
_fill_data(Config_Item * ci, E_Config_Dialog_Data *cfdata)
{
// load available disk devices
cfdata->disks = ecore_file_ls("/sys/block");
}
static void
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
diskio_conf->cfd = NULL;
E_FREE(cfdata);
}
static Evas_Object *
_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{
Config_Item *ci;
Evas_Object *o = NULL, *of = NULL, *ob = NULL;
E_Radio_Group *rg;
char path[128], *disk;
int pos = -1;
ci = cfd->data;
o = e_widget_list_add(evas, 0, 0);
of = e_widget_framelist_add(evas, "Disk", 0);
e_widget_framelist_content_align_set(of, 0.0, 0.0);
rg = e_widget_radio_group_new (&(cfdata->diskpos));
if (cfdata->disks)
{
while ((disk = ecore_list_next(cfdata->disks)))
{
pos++;
snprintf (path, sizeof (path), "/sys/block/%s/device", disk);
if (!ecore_file_exists(path)) continue;
ob = e_widget_radio_add (evas, disk, pos, rg);
if (strcmp(disk, ci->disk)==0) e_widget_radio_toggle_set(ob, 1);
e_widget_framelist_object_append(of, ob);
}
}
e_widget_list_object_append(o, of, 1, 1, 0.5);
return o;
}
static int
_basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
Config_Item *ci;
char *disk;
int pos = -1;
ci = cfd->data;
ecore_list_first_goto(cfdata->disks);
while ((disk = ecore_list_next(cfdata->disks)))
{
pos++;
if (pos == cfdata->diskpos)
{
if (ci->disk) evas_stringshare_del(ci->disk);
ci->disk = evas_stringshare_add(disk);
break;
}
}
e_config_save_queue();
return 1;
}

544
src/e_mod_main.c Normal file
View File

@ -0,0 +1,544 @@
#include <e.h>
#include "e_mod_main.h"
/* Local Function Prototypes */
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 const char *_gc_id_new(void);
static void _gc_id_del(const char *id);
static Evas_Object *_gc_icon(Evas *evas);
static void _diskio_conf_new(void);
static void _diskio_conf_free(void);
static int _diskio_conf_timer(void *data);
static Config_Item *_diskio_conf_item_get(const char *id);
static void _diskio_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event);
static void _diskio_cb_menu_post(void *data, E_Menu *menu);
static void _diskio_cb_menu_configure(void *data, E_Menu *mn, E_Menu_Item *mi);
static int _diskio_set(void *data);
/* Local Structures */
typedef struct _Instance Instance;
struct _Instance
{
/* pointer to this gadget's container */
E_Gadcon_Client *gcc;
/* evas_object used to display */
Evas_Object *o_diskio;
/* popup anyone ? */
E_Menu *menu;
/* Config_Item structure. Every gadget should have one :) */
Config_Item *conf_item;
/* diskstat update timer */
Ecore_Timer *timer;
unsigned long bytes_r;
unsigned long bytes_w;
};
/* Local Variables */
static int uuid = 0;
static Evas_List *instances = NULL;
static E_Config_DD *conf_edd = NULL;
static E_Config_DD *conf_item_edd = NULL;
Config *diskio_conf = NULL;
static const E_Gadcon_Client_Class _gc_class =
{
GADCON_CLIENT_CLASS_VERSION, "diskio",
{_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon,
_gc_id_new, _gc_id_del},
E_GADCON_CLIENT_STYLE_PLAIN
};
EAPI E_Module_Api e_modapi = {E_MODULE_API_VERSION, "DiskIO"};
/*
* Module Functions
*/
EAPI void *
e_modapi_init(E_Module *m)
{
char buf[4096];
/* Location of theme to load for this module */
snprintf(buf, sizeof(buf), "%s/e-module-diskio.edj", m->dir);
/* Define EET Data Storage */
conf_item_edd = E_CONFIG_DD_NEW("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, disk, STR);
conf_edd = E_CONFIG_DD_NEW("Config", Config);
#undef T
#undef D
#define T Config
#define D conf_edd
E_CONFIG_VAL(D, T, version, INT);
E_CONFIG_LIST(D, T, conf_items, conf_item_edd); /* the list */
/* Tell E to find any existing module data. First run ? */
diskio_conf = e_config_domain_load("module.diskio", conf_edd);
if (diskio_conf)
{
/* Check config version */
if ((diskio_conf->version >> 16) < MOD_CONFIG_FILE_EPOCH)
{
/* config too old */
_diskio_conf_free();
ecore_timer_add(1.0, _diskio_conf_timer,
"DiskIO Module Configuration data needed "
"upgrading. Your old configuration<br> has been"
" wiped and a new set of defaults initialized. "
"This<br>will happen regularly during "
"development, so don't report a<br>bug. "
"This simply means the module needs "
"new configuration<br>data by default for "
"usable functionality that your old<br>"
"configuration simply lacks. This new set of "
"defaults will fix<br>that by adding it in. "
"You can re-configure things now to your<br>"
"liking. Sorry for the inconvenience.<br>");
}
/* Ardvarks */
else if (diskio_conf->version > MOD_CONFIG_FILE_VERSION)
{
/* config too new...wtf ? */
_diskio_conf_free();
ecore_timer_add(1.0, _diskio_conf_timer,
"Your DiskIO Module configuration is NEWER "
"than the module version. This is "
"very<br>strange. This should not happen unless"
" you downgraded<br>the module or "
"copied the configuration from a place where"
"<br>a newer version of the module "
"was running. This is bad and<br>as a "
"precaution your configuration has been now "
"restored to<br>defaults. Sorry for the "
"inconvenience.<br>");
}
}
/* if we don't have a config yet, or it got erased above,
* then create a default one */
if (!diskio_conf) _diskio_conf_new();
/* create a link from the modules config to the module
* this is not written */
diskio_conf->module = m;
/* Tell any gadget containers (shelves, etc) that we provide a module
* for the user to enjoy */
e_gadcon_provider_register(&_gc_class);
/* Give E the module */
return m;
}
/*
* Function to unload the module
*/
EAPI int
e_modapi_shutdown(E_Module *m)
{
/* Kill the config dialog */
if (diskio_conf->cfd) e_object_del(E_OBJECT(diskio_conf->cfd));
diskio_conf->cfd = NULL;
/* Tell E the module is now unloaded. Gets removed from shelves, etc. */
diskio_conf->module = NULL;
e_gadcon_provider_unregister(&_gc_class);
/* Cleanup our item list */
while (diskio_conf->conf_items)
{
Config_Item *ci = NULL;
/* Grab an item from the list */
ci = diskio_conf->conf_items->data;
/* remove it */
diskio_conf->conf_items =
evas_list_remove_list(diskio_conf->conf_items,
diskio_conf->conf_items);
/* cleanup stringshares !! ) */
if (ci->id) evas_stringshare_del(ci->id);
/* keep the planet green */
E_FREE(ci);
}
/* Cleanup the main config structure */
E_FREE(diskio_conf);
/* Clean EET */
E_CONFIG_DD_FREE(conf_item_edd);
E_CONFIG_DD_FREE(conf_edd);
return 1;
}
/*
* Function to Save the modules config
*/
EAPI int
e_modapi_save(E_Module *m)
{
e_config_domain_save("module.diskio", conf_edd, diskio_conf);
return 1;
}
/* Local Functions */
/* Called when Gadget_Container says go */
static E_Gadcon_Client *
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
{
Instance *inst = NULL;
char buf[4096];
/* theme file */
snprintf(buf, sizeof(buf), "%s/e-module-diskio.edj",
diskio_conf->module->dir);
/* New visual instance, any config ? */
inst = E_NEW(Instance, 1);
inst->conf_item = _diskio_conf_item_get(id);
if (inst->conf_item->disk) evas_stringshare_add(inst->conf_item->disk);
/* create on-screen object */
inst->o_diskio = edje_object_add(gc->evas);
/* we have a theme ? */
if (!e_theme_edje_object_set(inst->o_diskio, "base/theme/modules/diskio",
"modules/diskio/main"))
edje_object_file_set(inst->o_diskio, buf, "modules/diskio/main");
/* Start loading our module on screen via container */
inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->o_diskio);
inst->gcc->data = inst;
/* hook a mouse down. we want/have a popup menu, right ? */
evas_object_event_callback_add(inst->o_diskio, EVAS_CALLBACK_MOUSE_DOWN,
_diskio_cb_mouse_down, inst);
/* add to list of running instances so we can cleanup later */
instances = evas_list_append(instances, inst);
inst->timer = ecore_timer_add(0.1, _diskio_set, inst);
/* return the Gadget_Container Client */
return inst->gcc;
}
/* Set disk i/o */
static int
_diskio_set(void *data)
{
FILE *statfile;
Instance *inst = NULL;
char buffer[128];
char dummy[16];
char path[128];
unsigned long dummy0, dummy1, dummy2, dummy3, dummy4, dummy5,
dummy6, dummy7, dummy8, bytes_r_new=0, bytes_w_new=0;
inst = data;
if (!inst) return 0;
if (!inst->conf_item) return 0;
edje_object_part_text_set(inst->o_diskio, "e.text.display_name",
inst->conf_item->disk);
snprintf (path, sizeof (path), "/sys/block/%s/stat", inst->conf_item->disk);
statfile = fopen(path, "r");
if (!statfile)
{
edje_object_signal_emit(inst->o_diskio, "read,off", "");
edje_object_signal_emit(inst->o_diskio, "write,off", "");
return 0;
}
fgets(buffer, sizeof(buffer), statfile);
sscanf(buffer, "%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu", &dummy0, &dummy1, &bytes_r_new, &dummy2, &dummy3, &dummy4, &bytes_w_new, &dummy5, &dummy6, &dummy7, &dummy8);
fclose (statfile);
if (!bytes_r_new && !bytes_w_new)
{
edje_object_signal_emit(inst->o_diskio, "read,off", "");
edje_object_signal_emit(inst->o_diskio, "write,off", "");
return 1;
}
if (inst->bytes_r != bytes_r_new)
{
edje_object_signal_emit(inst->o_diskio, "read,on", "");
inst->bytes_r = bytes_r_new;
}
else
edje_object_signal_emit(inst->o_diskio, "read,off", "");
if (inst->bytes_w != bytes_w_new)
{
edje_object_signal_emit(inst->o_diskio, "write,on", "");
inst->bytes_w = bytes_w_new;
}
else
edje_object_signal_emit(inst->o_diskio, "write,off", "");
return 1;
}
/* Called when Gadget_Container says stop */
static void
_gc_shutdown(E_Gadcon_Client *gcc)
{
Instance *inst = NULL;
if (!(inst = gcc->data)) return;
instances = evas_list_remove(instances, inst);
/* Delete diskstat update timer */
if (inst->timer) ecore_timer_del(inst->timer);
/* kill popup menu */
if (inst->menu)
{
e_menu_post_deactivate_callback_set(inst->menu, NULL, NULL);
e_object_del(E_OBJECT(inst->menu));
inst->menu = NULL;
}
/* delete the visual */
if (inst->o_diskio)
{
/* remove mouse down callback hook */
evas_object_event_callback_del(inst->o_diskio, EVAS_CALLBACK_MOUSE_DOWN,
_diskio_cb_mouse_down);
evas_object_del(inst->o_diskio);
}
E_FREE(inst);
}
/* For for when container says we are changing position */
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);
}
/* Gadget/Module label */
static char *
_gc_label(void)
{
return "DiskIO";
}
/* so E can keep a unique instance per-container */
static const char *
_gc_id_new(void)
{
Config_Item *ci = NULL;
ci = _diskio_conf_item_get(NULL);
return ci->id;
}
/* gets called when container says remove this item */
static void
_gc_id_del(const char *id)
{
Config_Item *ci = NULL;
if (!(ci = _diskio_conf_item_get(id))) return;
/* cleanup !! */
if (ci->id) evas_stringshare_del(ci->id);
if (ci->disk) evas_stringshare_del(ci->disk);
diskio_conf->conf_items = evas_list_remove(diskio_conf->conf_items, ci);
E_FREE(ci);
}
static Evas_Object *
_gc_icon(Evas *evas)
{
Evas_Object *o = NULL;
char buf[4096];
/* theme */
snprintf(buf, sizeof(buf), "%s/e-module-diskio.edj", diskio_conf->module->dir);
/* create icon object */
o = edje_object_add(evas);
/* load icon from theme */
edje_object_file_set(o, buf, "icon");
return o;
}
/* new module needs a new config :), or config too old and we need one anyway */
static void
_diskio_conf_new(void)
{
Config_Item *ci = NULL;
char buf[128];
diskio_conf = E_NEW(Config, 1);
diskio_conf->version = (MOD_CONFIG_FILE_EPOCH << 16);
#define IFMODCFG(v) if ((diskio_conf->version & 0xffff) < v) {
#define IFMODCFGEND }
/* setup defaults */
IFMODCFG(0x008d);
_diskio_conf_item_get(NULL);
IFMODCFGEND;
/* update the version */
diskio_conf->version = MOD_CONFIG_FILE_VERSION;
/* setup limits on the config properties here (if needed) */
/* save the config to disk */
e_config_save_queue();
}
static void
_diskio_conf_free(void)
{
/* cleanup any stringshares here */
while (diskio_conf->conf_items)
{
Config_Item *ci = NULL;
ci = diskio_conf->conf_items->data;
diskio_conf->conf_items =
evas_list_remove_list(diskio_conf->conf_items,
diskio_conf->conf_items);
/* EPA */
if (ci->id) evas_stringshare_del(ci->id);
if (ci->disk) evas_stringshare_del(ci->disk);
E_FREE(ci);
}
E_FREE(diskio_conf);
}
/* timer for the config oops dialog */
static int
_diskio_conf_timer(void *data)
{
e_util_dialog_show("DiskIO Configuration Updated", data);
return 0;
}
/* function to search for any Config_Item struct for this Item
* create if needed */
static Config_Item *
_diskio_conf_item_get(const char *id)
{
Evas_List *l = NULL;
Config_Item *ci = NULL;
char buf[128];
if (!id)
{
/* nothing passed, return a new id */
snprintf(buf, sizeof(buf), "%s.%d", _gc_class.name, ++uuid);
id = buf;
}
else
{
for (l = diskio_conf->conf_items; l; l = l->next)
{
if (!(ci = l->data)) continue;
if ((ci->id) && (!strcmp(ci->id, id))) return ci;
}
}
ci = E_NEW(Config_Item, 1);
ci->id = evas_stringshare_add(id);
ci->disk = evas_stringshare_add("???");
diskio_conf->conf_items = evas_list_append(diskio_conf->conf_items, ci);
return ci;
}
/* Pants On */
static void
_diskio_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event)
{
Instance *inst = NULL;
Evas_Event_Mouse_Down *ev;
E_Zone *zone = NULL;
E_Menu_Item *mi = NULL;
int x, y;
if (!(inst = data)) return;
ev = event;
if ((ev->button == 3) && (!inst->menu))
{
/* grab current zone */
zone = e_util_zone_current_get(e_manager_current_get());
/* create popup menu */
inst->menu = e_menu_new();
e_menu_post_deactivate_callback_set(inst->menu, _diskio_cb_menu_post,
inst);
mi = e_menu_item_new(inst->menu);
e_menu_item_label_set(mi, "Configuration");
e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration");
e_menu_item_callback_set(mi, _diskio_cb_menu_configure, inst);
mi = e_menu_item_new(inst->menu);
e_menu_item_separator_set(mi, 1);
/* Each Gadget Client has a utility menu from the Container */
e_gadcon_client_util_menu_items_append(inst->gcc, inst->menu, 0);
e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &x, &y,
NULL, NULL);
/* show the menu relative to gadgets position */
e_menu_activate_mouse(inst->menu, zone, (x + ev->output.x),
(y + ev->output.y), 1, 1,
E_MENU_POP_DIRECTION_AUTO, ev->timestamp);
evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button,
EVAS_BUTTON_NONE, ev->timestamp, NULL);
}
}
/* popup menu closing, cleanup */
static void
_diskio_cb_menu_post(void *data, E_Menu *menu)
{
Instance *inst = NULL;
if (!(inst = data)) return;
if (!inst->menu) return;
e_object_del(E_OBJECT(inst->menu));
inst->menu = NULL;
}
/* call configure from popup */
static void
_diskio_cb_menu_configure(void *data, E_Menu *mn, E_Menu_Item *mi)
{
Instance *inst = NULL;
inst = data;
if (!inst) return;
if (!diskio_conf) return;
if (diskio_conf->cfd) return;
e_int_config_diskio_module(mn->zone->container, inst->conf_item);
}

59
src/e_mod_main.h Normal file
View File

@ -0,0 +1,59 @@
#ifndef E_MOD_MAIN_H
#define E_MOD_MAIN_H
/* Macros used for config file versioning */
#define MOD_CONFIG_FILE_EPOCH 0x0001
#define MOD_CONFIG_FILE_GENERATION 0x008d
#define MOD_CONFIG_FILE_VERSION \
((MOD_CONFIG_FILE_EPOCH << 16) | MOD_CONFIG_FILE_GENERATION)
typedef struct _Config Config;
typedef struct _Config_Item Config_Item;
/* Base config struct. Store Item Count, etc
*
* *module (not written to disk) (E Interaction)
* *cfd (not written to disk) (config dialog)
*
* Store list of your items that you want to keep. (sorting)
* Can define per-module config properties here.
*
* Version used to know when user config too old */
struct _Config
{
E_Module *module;
E_Config_Dialog *cfd;
/* The list; their location on screen ? */
Evas_List *conf_items;
/* config file version */
int version;
};
/* This struct used to hold config for individual items from above list */
struct _Config_Item
{
/* unique id */
const char *id;
/* selected disk */
const char *disk;
};
/* Setup the E Module Version, Needed to check if module can run. */
EAPI extern E_Module_Api e_modapi;
/* E API Module Interface Declarations
*
* Need to initialize, shutdown, save the module */
EAPI void *e_modapi_init(E_Module *m);
EAPI int e_modapi_shutdown(E_Module *m);
EAPI int e_modapi_save(E_Module *m);
/* Function for calling the modules config dialog */
EAPI E_Config_Dialog *e_int_config_diskio_module(E_Container *con, Config_Item *ci);
extern Config *diskio_conf;
#endif