entrance: merge of my work, I still need to push some code. But I think it's a first step to unbork entrance...

What's in this patch ?
theme rewriting, only a really basic theme is available for time.
you can now set up the wallpaper in the login screen or in the conf
authentication is more secure.
xephyr support
Add some tux
Many bug fix
This commit is contained in:
Michael Bouchaud 2013-09-03 20:08:37 +02:00
parent 7fd0458b5a
commit b262e33eee
73 changed files with 2848 additions and 639 deletions

View File

@ -47,21 +47,32 @@ AC_MSG_RESULT([${enable_pam}])
# Grub2
AC_ARG_ENABLE([grub2],
[AC_HELP_STRING([--enable-grub2], [enable grub2 support. @<:@default=disabled@:>@])],
[AC_HELP_STRING([--disable-grub2], [disable grub2 support. @<:@default=enabled@:>@])],
[
if test "x${enableval}" = "xyes" ; then
enable_grub2="yes"
else
if test "x${disableval}" = "xyes" ; then
enable_grub2="no"
else
enable_grub2="yes"
fi
],
[enable_grub2="no"])
[enable_grub2="yes"])
AC_MSG_CHECKING([whether to support grub2 reboot features])
AC_MSG_RESULT([${enable_grub2}])
if test "x${enable_grub2}" = "xyes" ; then
AC_DEFINE([HAVE_GRUB2], [1], [Set to 1 if grub is enabled.])
fi
# Ekbd
AC_ARG_ENABLE([ekbd],
[AC_HELP_STRING([--disable-ekbd], [disable virtual keyboard. @<:@default=enabled@:>@])],
[
if test "x${disableval}" = "xyes" ; then
enable_ekbd="no"
else
enable_ekbd="yes"
fi
],
[enable_ekbd="yes"])
AC_MSG_CHECKING([whether to support virtual keyboard features])
AC_MSG_RESULT([${enable_grub2}])
# consolekit
AC_ARG_ENABLE([consolekit],
@ -105,6 +116,21 @@ AC_C___ATTRIBUTE__
PKG_CHECK_MODULES([ENTRANCE], [efreet >= 1.0.0 eina >= 1.0.0 eet >= 1.4.0 ecore-con >= 1.0.0 ecore >= 1.0.0 ecore-file >= 1.0.0 xcb >= 1.0.0])
PKG_CHECK_MODULES([ENTRANCE_CLIENT], [eet >= 1.4.0 edje >= 1.0.0 elementary >= 0.5.0.0 ecore-evas >= 1.0.0 evas >= 1.0.0 ecore-con >= 1.0.0 ecore >= 1.0.0 ecore-x >= 1.0.0 eina >= 1.0.0])
# Grub2
if test "x${enable_grub2}" = "xyes" ; then
AC_DEFINE([HAVE_GRUB2], [1], [Set to 1 if grub is enabled.])
fi
# Ekbd
if test "x${enable_consolekit}" = "xyes" ; then
PKG_CHECK_MODULES([ENTRANCE_EKBD], [ekbd], [enable_ekbd="yes"], [enable_ekbd="no"])
fi
AM_CONDITIONAL(HAVE_CONSOLEKIT, [test "x${enable_ekbd}" = "xyes"])
if test "x${enable_ekbd}" = "xyes" ; then
AC_DEFINE([HAVE_EKBD], [1], [Set to 1 if ekbd is enabled.])
fi
# Consolekit
if test "x${enable_consolekit}" = "xyes" ; then
PKG_CHECK_MODULES([ENTRANCE_CK], [dbus-1 ck-connector], [enable_consolekit="yes"], [enable_consolekit="no"])
@ -161,8 +187,10 @@ src/bin/Makefile
src/daemon/Makefile
data/Makefile
data/themes/Makefile
data/themes/old/Makefile
data/themes/beaumonts/Makefile
data/themes/default/Makefile
data/themes/fade/Makefile
data/themes/old/Makefile
])
@ -180,6 +208,7 @@ echo "Configuration Options Summary:"
echo
echo " pam..................: ${have_pam}"
echo " grub2................: ${enable_grub2}"
echo " ekbd.................: ${enable_ekbd}"
echo " consolekit...........: ${enable_consolekit}"
echo
echo " edje_cc..............: ${edje_cc}"

View File

@ -32,7 +32,7 @@ group "Entrance_Config" struct {
* 1 = True, 0 = False */
value "daemonize" uchar: 1;
/* Enable numlock */
/* Enable numlock TODO support it */
value "numlock" uchar: 1;
/** Bool to determine if entrance must login user with the session_login command
@ -54,6 +54,20 @@ group "Entrance_Config" struct {
/* Log file */
value "logfile" string: "/var/log/entrance.log";
/* Theme to use */
/* Theme to use. This one could be overided if you permit setting below */
value "theme" string: "default";
/* Allow settings in gui, who overides this one until it's updated */
value "custom_conf" uchar: 1;
/* background */
value "background_path" string: "";
/* if it's an edj file */
value "background_group" string: "";
/* Elementary profile */
value "elementary_profile" string: "default";
/* Use a virtual keyboard */
value "virtual_keyboard" uchar: 0;
}

View File

@ -1,4 +1,4 @@
MAINTAINERCLEANFILES = Makefile.in
SUBDIRS = beaumonts old
SUBDIRS = default

View File

@ -0,0 +1,20 @@
AUTOMAKE_OPTIONS = 1.4 foreign
MAINTAINERCLEANFILES = Makefile.in
EDJE_CC = @edje_cc@
EDJE_FLAGS = -v -id $(top_srcdir)/data/themes/default/images -fd $(top_srcdir)/data/themes/default/fonts
filesdir = $(datadir)/entrance/themes/
files_DATA = default.edj
EXTRA_DIST = default.edc
default.edj: Makefile $(EXTRA_DIST)
$(EDJE_CC) $(EDJE_FLAGS) \
$(top_srcdir)/data/themes/default/default.edc \
$(top_builddir)/data/themes/default/default.edj
clean-local:
rm -f *.edj

View File

@ -0,0 +1,499 @@
/*
* Default theme for Entrance
* By Michael Bouchaud
* Licence CC-By-Sa
* Photo by Philippe Caseiro
* Licence CC-By-Sa
*/
externals {
external: "elm";
}
collections {
group {
name: "entrance/background/default";
images {
image: "entrance_background.jpg" LOSSY 90;
}
parts {
part { name: "base";
type: IMAGE;
description { state: "default" 0.0;
image {
normal: "entrance_background.jpg";
scale_hint: STATIC;
}
}
}
}
}
group {
name: "entrance/background";
data.item: "items" "default";
}
group {
name: "entrance/wallpaper/default";
parts {
part { name: "base";
type: RECT;
description { state: "default" 0.0;
color: 255 255 255 0;
}
}
part { name: "clip1";
type: RECT;
description { state: "default" 0.0;
visible: 1;
color: 255 255 255 255;
rel2 {
to: "cur";
relative: 0.0 1.0;
}
}
}
part { name: "clip2";
type: RECT;
description { state: "default" 0.0;
visible: 1;
color: 255 255 255 255;
rel1 {
to: "cur";
relative: 1.0 0.0;
}
}
}
part { name: "cur";
type: RECT;
description { state: "default" 0.0;
min: 1 0;
max: 1 99999;
visible: 0;
align: 1.0 0.5;
}
description { state: "user" 0.0;
inherit: "default" 0.0;
align: 0.0 0.5;
}
}
part { name: "entrance.wallpaper.default";
clip_to: "clip1";
type: SWALLOW;
description { state: "default" 0.0;
visible: 1;
}
}
part { name: "entrance.wallpaper.user";
clip_to: "clip2";
type: SWALLOW;
description { state: "default" 0.0;
visible: 1;
}
}
part { name: "entrance.login";
type: SWALLOW;
description { state: "default" 0.0;
visible: 1;
}
}
}
programs {
program { name: "wallpaper_user";
signal: "entrance,wallpaper,user";
source: "";
action: STATE_SET "user" 0.0;
target: "cur";
}
program { name: "wallpaper_default";
signal: "entrance,wallpaper,default";
source: "";
action: STATE_SET "default" 0.0;
target: "cur";
}
}
}
group {
name : "entrance";
images {
}
parts {
part { name: "clip";
type: RECT;
description { state: "default" 0.0;
color: 255 255 255 255;
//color: 255 255 255 0;
}
description { state: "show" 0.0;
color: 255 255 255 255;
}
}
part { name: "entrance.login";
clip_to: "clip";
type: SWALLOW;
description { state: "default" 0.0;
visible: 1;
max: 0 0;
}
}
part { name: "entrance.users";
type: EXTERNAL;
// source: "elm/list";
// source: "elm/genlist";
source: "elm/gengrid";
description { state: "default" 0.0;
rel1.relative: 0.0 0.2;
rel2.relative: 0.0 0.8;
rel2.to_x: "entrance.login";
visible: 1;
params {
bool: "horizontal" 0;
double: "vertical page relative" 0.0;
int: "horizontal item size" 96;
int: "vertical item size" 120;
}
}
}
part { name: "entrance.actions";
type: EXTERNAL;
source: "elm/hoversel";
description { state: "default" 0.0;
fixed: 1 1;
visible: 0;
max: 0 0;
align: 1.0 1.0;
params {
string: "label" "action";
}
}
description { state: "enabled" 0.0;
inherit: "default" 0.0;
visible: 1;
}
}
part { name: "entrance.conf";
type: EXTERNAL;
source: "elm/button";
description { state: "default" 0.0;
fixed: 1 1;
visible: 1;
max: 0 0;
align: 1.0 1.0;
rel2.to_x: "entrance.actions";
rel2.relative: 0.0 1.0;
params {
string: "label" "Settings";
}
}
description { state: "enabled" 0.0;
inherit: "default" 0.0;
visible: 1;
}
}
/*
part { name: "entrance.error";
type: TEXT;
mouse_events: 0;
effect: SOFT_SHADOW;
scale: 1;
description { state: "default" 0.0;
color: 255 255 255 0;
fixed: 1 1;
rel1.to_y: "entrance.xsessions";
rel1.relative: 0.0 1.0;
align: 0.5 0.0;
text {
text: "Error on login ! Maybe wrong password ?";
font: "Sans";
size: 18;
min: 1 1;
align: 0.5 0.5;
}
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
rel1.offset: 0 50;
rel2.offset: 0 50;
color: 255 255 255 255;
}
}
*/
}
programs {
program {
name: "action_enabled";
signal: "entrance,action,enabled";
source: "";
action: STATE_SET "enabled" 0.0;
target: "entrance.actions";
}
program {
name: "action_disabled";
signal: "entrance,action,disabled";
source: "";
action: STATE_SET "default" 0.0;
target: "entrance.actions";
}
program {
name: "user_enabled";
signal: "entrance,users,enabled";
source: "";
action: STATE_SET "enabled" 0.0;
target: "entrance.users";
}
program {
name: "user_disabled";
signal: "entrance,users,disabled";
source: "";
action: STATE_SET "default" 0.0;
target: "entrance.users";
}
program {
name: "conf_enabled";
signal: "entrance,custom_conf,enabled";
source: "";
action: STATE_SET "enabled" 0.0;
target: "entrance.conf";
}
program {
name: "conf_disabled";
signal: "entrance,custom_conf,disabled";
source: "";
action: STATE_SET "default" 0.0;
target: "entrance.conf";
}
}
}
group {
name : "entrance/login";
parts {
part {
name: "entrance.login";
type: SWALLOW;
repeat_events: 0;
description {
state: "default" 0.0;
min: 140 0;
max: 0 0;
align: 0.5 1.0;
rel2.to_y: "entrance.password";
rel2.relative: 1.0 0.0;
visible: 1;
}
}
part {
name: "entrance.password";
type: SWALLOW;
repeat_events: 0;
source: "entrance/entry/password";
description {
state: "default" 0.0;
min: 140 0;
max: 0 0;
align: 0.5 0.5;
visible: 1;
}
}
part { name: "entrance.xsessions";
type: SWALLOW;
description { state: "default" 0.0;
max: 0 0;
rel1.to_y: "entrance.password";
rel1.relative: 0.0 1.0;
align: 0.5 0.0;
//visible: 0;
}
description { state: "enabled" 0.0;
inherit: "default" 0.0;
visible: 1;
}
}
/*
* PROGRAMS
*/
programs {
program {
name: "xsession_enabled";
signal: "entrance,xsession,enabled";
source: "";
action: STATE_SET "enabled" 0.0;
target: "entrance.xsessions";
}
program {
name: "xsession_disabled";
signal: "entrance,xsession,disabled";
source: "";
action: STATE_SET "default" 0.0;
target: "entrance.xsessions";
}
}
/*
*
* PROGRAMS
*
programs {
program {
name: "login_error";
signal: "entrance,auth,error";
source: "";
action: STATE_SET "visible" 0.0;
transition: DECELERATE 0.2;
target: "entrance.error";
}
program {
name: "login_change";
signal: "entrance.auth.change";
source: "";
action: STATE_SET "default" 0.0;
transition: ACCELERATE 0.4;
target: "entrance.error";
}
program {
name: "auth_enable";
signal: "entrance.auth.enable";
source: "";
action: STATE_SET "auth" 0.0;
transition: ACCELERATE 0.8;
target: "entrance.users";
target: "entrance.password";
target: "entrance.xsessions";
}
program {
name: "auth_disable";
signal: "entrance.auth.disable";
source: "";
action: STATE_SET "default" 0.0;
transition: LINEAR 0.5;
target: "entrance.users";
target: "entrance.password";
target: "entrance.xsessions";
}
program {
name: "login";
signal: "entrance.auth.valid";
source: "";
action: STATE_SET "default" 0.0;
transition: LINEAR 0.7;
target: "clip";
}
program {
name: "login_valid";
signal: "mouse,down,*";
source: "valid";
action: SIGNAL_EMIT "entrance.auth.request" "";
}
*/
}
}
group { name: "entrance/conf/login";
parts {
alias: "entrance.login" "login:entrance.login";
alias: "entrance.password" "login:entrance.password";
alias: "entrance.xsessions" "login:entrance.xsessions";
part { name: "base";
type: RECT;
description { state: "default" 0.0;
visible: 0;
}
}
part { name: "entrance.conf";
type: SWALLOW;
description { state: "default" 0.0;
visible: 1;
}
}
part { name: "hover";
type: RECT;
mouse_events: 1;
repeat_events: 0;
description { state: "default" 0.0;
color: 0 0 0 196;
}
description { state: "hidden" 0.0;
visible: 0;
}
}
part { name: "login";
type: GROUP;
description { state: "default" 0.0;
visible: 1;
}
description { state: "hidden" 0.0;
visible: 0;
}
}
}
}
group { name: "entrance/user";
data.item: "items" "adrielhernandez-cmyk-tux brunocb-tux-1-euro cisoun-tux-coup-de-soleil eliaden-tux-marin fcys14-tux-breton fcys14-tux-croco fcys14-tux-pompier fcys14-yoshi-tux m4r10-tux-crema mybob-calimetux overlord59-astro-tux overlord59-dj-tux-mix-platine overlord59-magic-tux overlord59-tux-pianiste touko-tux-pirate";
parts {
part {
name: "entrance.icon";
type: SWALLOW;
mouse_events: 0;
description { state: "default" 0.0;
min: 96 96;
visible: 1;
//aspect : 1.0 1.0;
//aspect_preference : BOTH;
}
}
}
}
#define ADD_USER_ICON(NAME) \
group { name: "entrance/user/"NAME; \
images { \
image: NAME".png" COMP; \
} \
parts { \
part { name: "base"; \
type: RECT; \
description { state: "default" 0.0; \
visible: 0; \
} \
} \
part { name: "icon"; \
type: IMAGE; \
description { \
image { \
normal: NAME".png"; \
scale_hint: STATIC; \
} \
} \
} \
} \
}
ADD_USER_ICON("adrielhernandez-cmyk-tux")
ADD_USER_ICON("brunocb-tux-1-euro")
ADD_USER_ICON("cisoun-tux-coup-de-soleil")
ADD_USER_ICON("eliaden-tux-marin")
ADD_USER_ICON("fcys14-tux-breton")
ADD_USER_ICON("fcys14-tux-croco")
ADD_USER_ICON("fcys14-tux-pompier")
ADD_USER_ICON("fcys14-yoshi-tux")
ADD_USER_ICON("m4r10-tux-crema")
ADD_USER_ICON("mybob-calimetux")
ADD_USER_ICON("overlord59-astro-tux")
ADD_USER_ICON("overlord59-dj-tux-mix-platine")
ADD_USER_ICON("overlord59-magic-tux")
ADD_USER_ICON("overlord59-tux-pianiste")
ADD_USER_ICON("touko-tux-pirate")
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 963 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 509 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -16,10 +16,14 @@ entrance_client_SOURCES = \
../event/entrance_event.c \
entrance_client.h \
entrance_client.c \
entrance_conf.h \
entrance_conf.c \
entrance_connect.h \
entrance_connect.c \
entrance_fill.h \
entrance_fill.c \
entrance_login.h \
entrance_login.c \
entrance_gui.h \
entrance_gui.c

View File

@ -27,20 +27,6 @@ static const Ecore_Getopt options =
}
};
int
entrance_client_main(const char *theme)
{
PT("client init\n");
if (entrance_gui_init(theme)) return EXIT_FAILURE;
PT("client run\n");
entrance_connect_init();
elm_run();
entrance_connect_shutdown();
PT("_client: client shutdown\n");
entrance_gui_shutdown();
return EXIT_SUCCESS;
}
int
main(int argc, char **argv)
{
@ -70,12 +56,23 @@ main(int argc, char **argv)
}
eina_init();
ecore_init();
ecore_x_init(NULL);
ecore_x_init(display);
elm_init(argc, argv);
entrance_client_main(theme);
PT("login init\n");
entrance_login_init();
PT("client init\n");
if (!entrance_gui_init(theme)) return EXIT_FAILURE;
PT("client run\n");
entrance_connect_init();
elm_run();
entrance_connect_shutdown();
PT("_client: client shutdown\n");
entrance_gui_shutdown();
entrance_login_shutdown();
elm_shutdown();
ecore_x_shutdown();
ecore_shutdown();
eina_shutdown();
return EXIT_SUCCESS;
}

View File

@ -9,14 +9,16 @@
#include <Elementary.h>
#include "../event/entrance_event.h"
#include "entrance_gui.h"
#include "entrance_conf.h"
#include "entrance_connect.h"
#include "entrance_client.h"
#include "entrance_gui.h"
#include "entrance_fill.h"
#include "../event/entrance_event.h"
#include "entrance_login.h"
#define PT(x) \
#define PT(f, x...) \
do \
{ \
current_time = time(NULL); \
@ -24,7 +26,7 @@ do \
memset(entrance_time_d, 0, sizeof(entrance_time_d)); \
strftime(entrance_time_d, sizeof(entrance_time_d), \
"%b %_2d %T", local_time); \
fprintf(stderr, "(%s) "PACKAGE"_client: %s", entrance_time_d, x); \
fprintf(stderr, "(%s) "PACKAGE"_client: "f, entrance_time_d, ##x); \
} while (0)
extern time_t current_time;

591
src/bin/entrance_conf.c Normal file
View File

<
@ -0,0 +1,591 @@
#include "entrance_client.h"
typedef struct Entrance_Conf_Background_
{
const char *path;
const char *group;
const char *name;
} Entrance_Conf_Background;
typedef struct Entrance_Int_Conf_
{
struct
{
Evas_Object *preview;
const char *path;
const char *group;
} bg;
const char *theme;
const char *elm_profile;
Eina_Bool vkbd_enabled : 1;
double scale;
struct
{
const char *user;
struct
{
Evas_Object *preview;
const char *path;
const char *group;
} bg;
Eina_Bool remember_session : 1;
} user;
struct
{
Evas_Object *btn_ok;
Evas_Object *btn_apply;
} gui;
} Entrance_Int_Conf;
static void _entrance_conf_init(void);
static void _entrance_conf_shutdown(void);
static char *_entrance_conf_bg_text_get(void *data, Evas_Object *obj, const char *part);
static Evas_Object *_entrance_conf_bg_content_get(void *data, Evas_Object *obj, const char *part);
static Eina_Bool _entrance_conf_bg_state_get(void *data, Evas_Object *obj, const char *part);
static void _entrance_conf_bg_sel(void *data, Evas_Object *obj, void *event_info);
static void _entrance_conf_changed();
static void _entrance_conf_apply();
static Entrance_Fill *_entrance_background_fill = NULL;
static Entrance_Int_Conf *_entrance_int_conf = NULL;
static char *
_entrance_conf_bg_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
{
Entrance_Conf_Background *cbg;
cbg = data;
return strdup(cbg->name);
}
static Evas_Object *
_entrance_conf_bg_content_get(void *data, Evas_Object *obj, const char *part)
{
Entrance_Conf_Background *cbg;
Evas_Object *o = NULL;
cbg = data;
if (part && !strcmp("elm.swallow.icon", part))
{
o = elm_image_add(obj);
elm_image_file_set(o, cbg->path, cbg->group);
elm_image_smooth_set(o, EINA_FALSE);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
evas_object_show(o);
}
return o;
}
static Eina_Bool
_entrance_conf_bg_state_get(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
{
return EINA_FALSE;
}
static void
_entrance_conf_bg_del(void *data, Evas_Object *obj EINA_UNUSED)
{
Entrance_Conf_Background *cbg;
cbg = data;
eina_stringshare_del(cbg->name);
eina_stringshare_del(cbg->path);
eina_stringshare_del(cbg->group);
free(cbg);
}
static void
_entrance_conf_bg_sel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Entrance_Conf_Background *cbg;
cbg = elm_object_item_data_get(event_info);
fprintf(stderr, "%s %s\n", cbg->path, cbg->group);
if (!elm_layout_file_set(_entrance_int_conf->bg.preview,
cbg->path, cbg->group))
{
PT("Error on loading ");
fprintf(stderr, "%s %s\n", cbg->path, cbg->group);
}
_entrance_int_conf->bg.path = cbg->path;
_entrance_int_conf->bg.group = cbg->group;
_entrance_conf_changed();
}
/* vkbd */
static void
_entrance_conf_vkbd_changed(void *data EINA_UNUSED, Evas_Object *obj, void *event EINA_UNUSED)
{
Elm_Actionslider_Pos p;
PT("User change vkbd state\n");
p = elm_actionslider_indicator_pos_get(obj);
_entrance_int_conf->vkbd_enabled = !!(p == ELM_ACTIONSLIDER_RIGHT);
_entrance_conf_changed();
}
/* scale */
static void
_entrance_conf_scale_changed(void *data EINA_UNUSED, Evas_Object *obj, void *event EINA_UNUSED)
{
_entrance_int_conf->scale = elm_spinner_value_get(obj);
_entrance_conf_changed();
}
/* Buttons Cb */
static void
_entrance_conf_ok_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
{
_entrance_conf_apply();
evas_object_del(data);
_entrance_conf_shutdown();
}
static void
_entrance_conf_apply_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
{
_entrance_conf_apply();
_entrance_conf_changed();
}
static void
_entrance_conf_close_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
{
evas_object_del(data);
_entrance_conf_shutdown();
}
static Eina_List *
_entrance_conf_backgrounds_get(Evas_Object *obj, const char *user)
{
Evas_Object *o, *edj;
Eina_List *list, *l, *nl = NULL;
Entrance_Conf_Background *cbg;
const char *str;
const char *path;
char buf[PATH_MAX];
Eina_Iterator *it;
o = entrance_gui_theme_get(obj, "entrance/background");
edj = elm_layout_edje_get(o);
edje_object_file_get(edj, &path, NULL);
list = entrance_gui_stringlist_get(edje_object_data_get(edj, "items"));
EINA_LIST_FOREACH(list, l, str)
{
cbg = calloc(1, sizeof(Entrance_Conf_Background));
snprintf(buf, sizeof(buf),
"entrance/background/%s", str);
cbg->path = eina_stringshare_add(path);
cbg->group = eina_stringshare_add(buf);
cbg->name = eina_stringshare_add(str);
nl = eina_list_append(nl, cbg);
}
entrance_gui_stringlist_free(list);
evas_object_del(o);
//TODO parse share/entrance/background
it = eina_file_ls(PACKAGE_DATA_DIR"/backgrounds");
EINA_ITERATOR_FOREACH(it, str)
{
int len;
len = strlen(str);
if (len < 4) continue;
if (!strcmp(&str[len-4], ".edj"))
{
cbg = calloc(1, sizeof(Entrance_Conf_Background));
snprintf(buf, sizeof(buf),
"entrance/background/%s", str);
cbg->path = str;
cbg->group = eina_stringshare_add("e/desktop/background");
{
char *name, *p;
name = strrchr(str, '/');
if (name)
{
name++;
name = strdupa(name);
p = strrchr(name, '.');
if (p) *p = '\0';
}
cbg->name = eina_stringshare_add(name);
}
nl = eina_list_append(nl, cbg);
}
else
eina_stringshare_del(str);
}
eina_iterator_free(it);
return nl;
}
static void
_entrance_conf_apply()
{
Entrance_Conf_Gui_Event conf;
conf.bg.path = _entrance_int_conf->bg.path;
conf.bg.group = _entrance_int_conf->bg.group;
conf.vkbd_enabled = _entrance_int_conf->vkbd_enabled;
entrance_gui_conf_set(&conf);
entrance_connect_conf_send(&conf);
}
/* Build it */
static Evas_Object *
_entrance_conf_build(Evas_Object *obj)
{
Evas_Object *t, *bx, *hbx, *o;
Eina_List *l;
int j = 0;
t = elm_table_add(obj);
elm_table_padding_set(t, 5 , 5);
evas_object_size_hint_weight_set(t, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
/* Background */
o = elm_label_add(t);
elm_object_text_set(o, "Background");
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(t, o, 0, j, 1, 1);
evas_object_show(o);
++j;
hbx = elm_box_add(t);
elm_box_horizontal_set(hbx, EINA_TRUE);
elm_table_pack(t, hbx, 0, j, 2, 3);
evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(hbx, EVAS_HINT_FILL, EVAS_HINT_FILL);
o = elm_genlist_add(hbx);
elm_scroller_bounce_set(o, EINA_FALSE, EINA_TRUE);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
l = _entrance_conf_backgrounds_get(o, NULL);
entrance_fill(o, _entrance_background_fill,
l, _entrance_conf_bg_sel, o);
eina_list_free(l);
elm_box_pack_end(hbx, o);
evas_object_show(o);
bx = elm_box_add(hbx);
elm_box_pack_end(hbx, bx);
evas_object_show(bx);
o = elm_layout_add(hbx);
elm_box_pack_end(bx, o);
_entrance_int_conf->bg.preview = o;
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(o);
o = evas_object_rectangle_add(hbx);
evas_object_color_set(o, 0, 0, 0, 0);
evas_object_size_hint_min_set(o, 256, 0);
elm_box_pack_end(bx, o);
evas_object_show(o);
evas_object_show(hbx);
j += 3;
/* Touch Screen */
o = elm_label_add(t);
elm_object_text_set(o, "Use a virtual keyboard");
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(t, o, 0, j, 1, 1);
evas_object_show(o);
o = elm_actionslider_add(t);
elm_object_style_set(o, "bar");
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_part_text_set(o, "left", "Disabled");
elm_object_part_text_set(o, "right", "Enabled");
elm_actionslider_magnet_pos_set(o, ELM_ACTIONSLIDER_LEFT);
elm_actionslider_enabled_pos_set(o, ELM_ACTIONSLIDER_LEFT |
ELM_ACTIONSLIDER_RIGHT);
evas_object_smart_callback_add(o, "selected",
_entrance_conf_vkbd_changed, NULL);
if (_entrance_int_conf->vkbd_enabled)
elm_actionslider_indicator_pos_set(o, ELM_ACTIONSLIDER_RIGHT);
else
elm_actionslider_indicator_pos_set(o, ELM_ACTIONSLIDER_LEFT);
elm_table_pack(t, o, 1, j, 1, 1);
evas_object_show(o);
++j;
/* Elementary Profile */
o = elm_label_add(t);
elm_object_text_set(o, "elementary profile");
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(t, o, 0, j, 1, 1);
evas_object_show(o);
o = elm_button_add(t);
elm_object_text_set(o, _entrance_int_conf->elm_profile);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(t, o, 1, j, 1, 1);
evas_object_show(o);
++j;
/* Scaling */
o = elm_label_add(t);
elm_object_text_set(o, "Scaling");
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(t, o, 0, j, 1, 1);
evas_object_show(o);
o = elm_spinner_add(t);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_smart_callback_add(o, "changed",
_entrance_conf_scale_changed, NULL);
elm_spinner_value_set(o, _entrance_int_conf->scale);
elm_spinner_min_max_set(o, 0.25, 5.0);
elm_spinner_step_set(o, 0.15);
elm_spinner_label_format_set(o, "%.2f");
elm_table_pack(t, o, 1, j, 1, 1);
evas_object_show(o);
++j;
o = evas_object_rectangle_add(o);
evas_object_color_set(o, 0, 0, 0, 0);
evas_object_size_hint_min_set(o, 128, 0);
elm_table_pack(t, o, 1, j, 1, 1);
evas_object_show(t);
return t;
}
static Evas_Object *
_entrance_conf_user_build(Evas_Object *obj)
{
Evas_Object *t, *bx, *o, *ly;
int j = 0;
ly = entrance_gui_theme_get(obj, "entrance/conf/login");
evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(ly);
t = elm_table_add(obj);
elm_object_part_content_set(ly, "entrance.conf", t);
elm_table_padding_set(t, 5 , 5);
/* Background */
o = elm_label_add(t);
elm_object_text_set(o, "Background");
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(t, o, 0, j, 1, 1);
evas_object_show(o);
++j;
o = elm_gengrid_add(t);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(t, o, 0, j, 2, 3);
elm_gengrid_item_size_set(o, 80, 50);
elm_gengrid_align_set(o, 0.0, 0.0);
evas_object_show(o);
j += 3;
/* Session to autoselect */
o = elm_label_add(t);
elm_object_text_set(o, "Session to use");
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(t, o, 0, j, 1, 1);
evas_object_show(o);
o = elm_hoversel_add(t);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(o, "Session");
elm_table_pack(t, o, 1, j, 1, 1);
evas_object_show(o);
++j;
/* Remember last session */
o = elm_label_add(t);
elm_object_text_set(o, "Remember last session");
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(t, o, 0, j, 1, 1);
evas_object_show(o);
o = elm_actionslider_add(t);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_part_text_set(o, "left", "Enabled");
elm_object_part_text_set(o, "right", "Disabled");
elm_table_pack(t, o, 1, j, 1, 1);
evas_object_show(o);
++j;
evas_object_show(t);
return ly;
}
static void
_entrance_conf_control_changed(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
{
Elm_Object_Item *it;
it = event;
elm_naviframe_item_promote(elm_object_item_data_get(it));
}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
static void
_entrance_conf_changed(void)
{
const char *bg_path;
const char *bg_group;
entrance_gui_background_get(&bg_path, &bg_group);
if ((_entrance_int_conf->theme != entrance_gui_theme_name_get())
|| (_entrance_int_conf->bg.path != bg_path)
|| (_entrance_int_conf->bg.group != bg_group)
|| (_entrance_int_conf->scale != elm_config_scale_get())
|| (_entrance_int_conf->elm_profile != elm_config_profile_get())
|| (_entrance_int_conf->vkbd_enabled != entrance_gui_vkbd_enabled_get()))
{
elm_object_disabled_set(_entrance_int_conf->gui.btn_ok, EINA_FALSE);
elm_object_disabled_set(_entrance_int_conf->gui.btn_apply, EINA_FALSE);
}
else
{
elm_object_disabled_set(_entrance_int_conf->gui.btn_ok, EINA_TRUE);
elm_object_disabled_set(_entrance_int_conf->gui.btn_apply, EINA_TRUE);
}
}
static void
_entrance_conf_init(void)
{
PT("conf init\n");
_entrance_background_fill =
entrance_fill_new("default",
_entrance_conf_bg_text_get,
_entrance_conf_bg_content_get,
_entrance_conf_bg_state_get,
_entrance_conf_bg_del);
_entrance_int_conf = calloc(1, sizeof(Entrance_Int_Conf));
_entrance_int_conf->theme = entrance_gui_theme_name_get();
entrance_gui_background_get(&(_entrance_int_conf->bg.path),
&(_entrance_int_conf->bg.group));
_entrance_int_conf->vkbd_enabled = entrance_gui_vkbd_enabled_get();
_entrance_int_conf->scale = elm_config_scale_get();
_entrance_int_conf->elm_profile = elm_config_profile_get();
}
static void
_entrance_conf_shutdown(void)
{
PT("conf shutdown\n");
entrance_fill_del(_entrance_background_fill);
free(_entrance_int_conf);
}