Add config for illume2 module (for kbd slide duration, etc).

SVN revision: 43932
This commit is contained in:
Christopher Michael 2009-11-23 17:26:51 +00:00
parent fba7f5ecf7
commit 8a4bb00bec
5 changed files with 111 additions and 13 deletions

View File

@ -18,14 +18,16 @@ INCLUDES = -I. \
@e_cflags@
pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH)
pkg_LTLIBRARIES = module.la
module_la_SOURCES = e_mod_main.c \
e_mod_main.h \
module_la_SOURCES = e_mod_main.h \
e_mod_main.c \
e_mod_layout.h \
e_mod_layout.c \
e_mod_layout_illume.c \
e_mod_layout_illume.h \
e_mod_layout_illume.c \
e_kbd.h \
e_kbd.c
e_kbd.c \
e_mod_config.h \
e_mod_config.c
module_la_LIBADD = @e_libs@ @dlopen_libs@
module_la_LDFLAGS = -module -avoid-version

View File

@ -1,6 +1,7 @@
#include "e.h"
#include "e_kbd.h"
#include "e_mod_layout.h"
#include "e_mod_config.h"
static Eina_List *handlers = NULL;
static Eina_List *kbds = NULL;
@ -133,8 +134,7 @@ static void
_e_kbd_hide(E_Kbd *kbd)
{
if (kbd->visible) return;
#if 0
if (illume_cfg->sliding.kbd.duration <= 0)
if (il_cfg->sliding.kbd.duration <= 0)
{
_e_kbd_border_hide(kbd->border);
kbd->actually_visible = kbd->visible;
@ -142,8 +142,7 @@ _e_kbd_hide(E_Kbd *kbd)
_e_kbd_layout_send(kbd);
}
else
_e_kbd_slide(kbd, 0, (double)illume_cfg->sliding.kbd.duration / 1000.0);
#endif
_e_kbd_slide(kbd, 0, (double)il_cfg->sliding.kbd.duration / 1000.0);
}
static int
@ -1023,8 +1022,7 @@ e_kbd_show(E_Kbd *kbd)
if (kbd->disabled) return;
kbd->actually_visible = kbd->visible;
_e_kbd_layout_send(kbd);
#if 0
if (illume_cfg->sliding.kbd.duration <= 0)
if (il_cfg->sliding.kbd.duration <= 0)
{
if (kbd->border)
{
@ -1041,9 +1039,8 @@ e_kbd_show(E_Kbd *kbd)
e_border_fx_offset(kbd->border, 0, kbd->border->h - kbd->adjust);
_e_kbd_border_show(kbd, kbd->border);
}
_e_kbd_slide(kbd, 1, (double)illume_cfg->sliding.kbd.duration / 1000.0);
_e_kbd_slide(kbd, 1, (double)il_cfg->sliding.kbd.duration / 1000.0);
}
#endif
}
EAPI void

View File

@ -0,0 +1,59 @@
#include "e.h"
#include "e_mod_main.h"
#include "e_mod_config.h"
/* local variables */
EAPI Il_Config *il_cfg = NULL;
static E_Config_DD *conf_edd = NULL;
/* public functions */
EAPI int
il_config_init(E_Module *m)
{
conf_edd = E_CONFIG_DD_NEW("Illume_Cfg", Il_Config);
#undef T
#undef D
#define T Il_Config
#define D conf_edd
E_CONFIG_VAL(D, T, version, INT);
E_CONFIG_VAL(D, T, sliding.kbd.duration, INT);
E_CONFIG_VAL(D, T, sliding.softkey.duration, INT);
il_cfg = e_config_domain_load("module.illume2", conf_edd);
if ((il_cfg) &&
((il_cfg->version >> 16) < IL_CONFIG_MAJ))
{
E_FREE(il_cfg);
il_cfg = NULL;
}
if (!il_cfg)
{
il_cfg = E_NEW(Il_Config, 1);
il_cfg->version = 0;
il_cfg->sliding.kbd.duration = 1000;
il_cfg->sliding.softkey.duration = 1000;
}
if (il_cfg)
{
/* Add new config variables here */
/* if ((il_cfg->version & 0xffff) < 1) */
il_cfg->version = (IL_CONFIG_MAJ << 16) | IL_CONFIG_MIN;
}
il_cfg->mod_dir = eina_stringshare_add(m->dir);
return 1;
}
EAPI int
il_config_shutdown(void)
{
if (il_cfg->mod_dir) eina_stringshare_del(il_cfg->mod_dir);
E_FREE(il_cfg);
return 1;
}
EAPI int
il_config_save(void)
{
e_config_domain_save("module.illume2", conf_edd, il_cfg);
return 1;
}

View File

@ -0,0 +1,32 @@
#ifndef E_MOD_CONFIG_H
# define E_MOD_CONFIG_H
# define IL_CONFIG_MIN 0
# define IL_CONFIG_MAJ 0
typedef struct _Il_Config Il_Config;
struct _Il_Config
{
int version;
struct
{
struct
{
int duration;
} kbd, softkey;
} sliding;
// Not User Configurable. Placeholders
const char *mod_dir;
E_Config_Dialog *cfd;
};
EAPI int il_config_init(E_Module *m);
EAPI int il_config_shutdown(void);
EAPI int il_config_save(void);
extern EAPI Il_Config *il_cfg;
#endif

View File

@ -1,5 +1,6 @@
#include "e.h"
#include "e_mod_main.h"
#include "e_mod_config.h"
#include "e_mod_layout.h"
#include "e_kbd.h"
@ -13,9 +14,15 @@ EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Illume2" };
EAPI void *
e_modapi_init(E_Module *m)
{
/* init the config system */
if (!il_config_init(m)) return NULL;
/* set up the virtual keyboard */
e_kbd_init(m);
/* init the layout system */
e_mod_layout_init(m);
return m; /* return NULL on failure, anything else on success. the pointer
* returned will be set as m->data for convenience tracking */
}
@ -26,6 +33,7 @@ e_modapi_shutdown(E_Module *m)
{
e_mod_layout_shutdown();
e_kbd_shutdown();
il_config_shutdown();
return 1; /* 1 for success, 0 for failure */
}
@ -33,5 +41,5 @@ e_modapi_shutdown(E_Module *m)
EAPI int
e_modapi_save(E_Module *m)
{
return 1; /* 1 for success, 0 for failure */
return il_config_save();
}