much improved importer - not done yet...
SVN revision: 24481
This commit is contained in:
parent
52616aa57e
commit
8a13f4c078
|
@ -63,6 +63,10 @@ images {
|
|||
image: "e17_icon_screen_normal.png" COMP;
|
||||
image: "e17_icon_screen_right.png" COMP;
|
||||
image: "e17_icon_screen_vflip.png" COMP;
|
||||
|
||||
image: "e17_wallpaper_center.png" COMP;
|
||||
image: "e17_wallpaper_screen.png" COMP;
|
||||
image: "e17_wallpaper_center_flat.png" COMP;
|
||||
}
|
||||
|
||||
group {
|
||||
|
@ -1111,3 +1115,203 @@ group {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
group {
|
||||
name: "icons/enlightenment/wallpaper_stretch";
|
||||
max: 24 24;
|
||||
parts {
|
||||
part {
|
||||
name: "bg";
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
rel1 {
|
||||
to: "screen";
|
||||
}
|
||||
rel2 {
|
||||
to: "screen";
|
||||
}
|
||||
image {
|
||||
normal: "e17_wallpaper_center_flat.png";
|
||||
border: 5 5 5 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "screen";
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
aspect: 1.0 1.0;
|
||||
aspect_preference: BOTH;
|
||||
image {
|
||||
normal: "e17_wallpaper_screen.png";
|
||||
border: 2 2 2 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
group {
|
||||
name: "icons/enlightenment/wallpaper_tile";
|
||||
max: 24 24;
|
||||
parts {
|
||||
part {
|
||||
name: "bg";
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
rel1 {
|
||||
to: "screen";
|
||||
}
|
||||
rel2 {
|
||||
to: "screen";
|
||||
}
|
||||
image {
|
||||
normal: "e17_wallpaper_center_flat.png";
|
||||
border: 5 5 5 5;
|
||||
}
|
||||
fill {
|
||||
size {
|
||||
relative: 0.33 0.33;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "screen";
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
aspect: 1.0 1.0;
|
||||
aspect_preference: BOTH;
|
||||
image {
|
||||
normal: "e17_wallpaper_screen.png";
|
||||
border: 2 2 2 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
group {
|
||||
name: "icons/enlightenment/wallpaper_center";
|
||||
max: 24 24;
|
||||
parts {
|
||||
part {
|
||||
name: "bg";
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
rel1 {
|
||||
to: "screen";
|
||||
}
|
||||
rel2 {
|
||||
to: "screen";
|
||||
}
|
||||
rel1 {
|
||||
relative: 0.125 0.125;
|
||||
}
|
||||
rel2 {
|
||||
relative: 0.875 0.875;
|
||||
}
|
||||
image {
|
||||
normal: "e17_wallpaper_center.png";
|
||||
border: 5 5 5 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "screen";
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
aspect: 1.0 1.0;
|
||||
aspect_preference: BOTH;
|
||||
image {
|
||||
normal: "e17_wallpaper_screen.png";
|
||||
border: 2 2 2 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
group {
|
||||
name: "icons/enlightenment/wallpaper_scale_aspect_in";
|
||||
max: 24 24;
|
||||
parts {
|
||||
part {
|
||||
name: "bg";
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
aspect: 1.5 1.5;
|
||||
aspect_preference: BOTH;
|
||||
rel1 {
|
||||
to: "screen";
|
||||
}
|
||||
rel2 {
|
||||
to: "screen";
|
||||
}
|
||||
image {
|
||||
normal: "e17_wallpaper_center.png";
|
||||
border: 5 5 5 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "screen";
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
aspect: 1.0 1.0;
|
||||
aspect_preference: BOTH;
|
||||
image {
|
||||
normal: "e17_wallpaper_screen.png";
|
||||
border: 2 2 2 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
group {
|
||||
name: "icons/enlightenment/wallpaper_scale_aspect_out";
|
||||
max: 24 24;
|
||||
parts {
|
||||
part {
|
||||
name: "bg";
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
aspect: 1.5 1.5;
|
||||
aspect_preference: NONE;
|
||||
rel1 {
|
||||
to: "screen";
|
||||
}
|
||||
rel2 {
|
||||
to: "screen";
|
||||
}
|
||||
image {
|
||||
normal: "e17_wallpaper_center.png";
|
||||
border: 5 5 5 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "screen";
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
aspect: 1.0 1.0;
|
||||
aspect_preference: BOTH;
|
||||
image {
|
||||
normal: "e17_wallpaper_screen.png";
|
||||
border: 2 2 2 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -461,5 +461,7 @@ e17_busy-5.png \
|
|||
e17_busy-6.png \
|
||||
e17_busy-7.png \
|
||||
e17_busy-8.png \
|
||||
e17_busy-9.png
|
||||
|
||||
e17_busy-9.png \
|
||||
e17_wallpaper_center.png \
|
||||
e17_wallpaper_screen.png \
|
||||
e17_wallpaper_center_flat.png
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 379 B |
Binary file not shown.
After Width: | Height: | Size: 285 B |
Binary file not shown.
After Width: | Height: | Size: 506 B |
|
@ -129,8 +129,6 @@ e_slider.h \
|
|||
e_widget_slider.h \
|
||||
e_int_config_window_manipulation.h \
|
||||
e_int_config_window_display.h \
|
||||
e_int_config_background.h \
|
||||
e_int_config_background_import.h \
|
||||
e_int_config_theme.h \
|
||||
e_int_config_menus.h \
|
||||
e_int_config_keybindings.h \
|
||||
|
@ -274,8 +272,6 @@ e_slider.c \
|
|||
e_widget_slider.c \
|
||||
e_int_config_window_manipulation.c \
|
||||
e_int_config_window_display.c \
|
||||
e_int_config_background.c \
|
||||
e_int_config_background_import.c \
|
||||
e_int_config_theme.c \
|
||||
e_int_config_menus.c \
|
||||
e_int_config_keybindings.c \
|
||||
|
|
|
@ -64,7 +64,6 @@ e_configure_show(E_Container *con)
|
|||
|
||||
/* add items here */
|
||||
e_configure_header_item_add(eco, "enlightenment/appearance", _("Appearance"));
|
||||
// e_configure_standard_item_add(eco, "enlightenment/background", _("Wallpaper"), e_int_config_background);
|
||||
e_configure_standard_item_add(eco, "enlightenment/background", _("Wallpaper"), e_int_config_wallpaper);
|
||||
e_configure_standard_item_add(eco, "enlightenment/themes", _("Theme"), e_int_config_theme);
|
||||
e_configure_standard_item_add(eco, "enlightenment/fonts", _("Fonts"), e_int_config_fonts);
|
||||
|
|
|
@ -102,8 +102,6 @@
|
|||
#include "e_widget_slider.h"
|
||||
#include "e_int_config_window_manipulation.h"
|
||||
#include "e_int_config_window_display.h"
|
||||
#include "e_int_config_background.h"
|
||||
#include "e_int_config_background_import.h"
|
||||
#include "e_int_config_theme.h"
|
||||
#include "e_int_config_menus.h"
|
||||
#include "e_int_config_keybindings.h"
|
||||
|
|
|
@ -1,523 +0,0 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
|
||||
#include "e.h"
|
||||
|
||||
#define BG_SET_DEFAULT_DESK 0
|
||||
#define BG_SET_THIS_DESK 1
|
||||
#define BG_SET_ALL_DESK 2
|
||||
|
||||
static void *_create_data (E_Config_Dialog *cfd);
|
||||
static void _free_data (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static void _fill_data (E_Config_Dialog_Data *cfdata);
|
||||
static int _basic_apply_data (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_basic_create_widgets (E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
static int _advanced_apply_data (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_advanced_create_widgets (E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
static void _load_bgs (E_Config_Dialog *cfd, Evas_Object *il);
|
||||
void _ilist_cb_bg_selected (void *data);
|
||||
static void _bg_config_dialog_cb_import (void *data, void *data2);
|
||||
static int _bg_dialog_close (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static void _bg_file_added (void *data, Ecore_File_Monitor *monitor, Ecore_File_Event event, const char *path);
|
||||
|
||||
static void _import_cb_closed(void *obj);
|
||||
static int import_open = 0;
|
||||
|
||||
static Ecore_File_Monitor *_bg_file_monitor;
|
||||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
char *bg, *current_bg;
|
||||
int bg_method;
|
||||
E_Config_Dialog *cfd;
|
||||
Evas_Object *il;
|
||||
|
||||
E_Win *import;
|
||||
};
|
||||
|
||||
EAPI E_Config_Dialog *
|
||||
e_int_config_background(E_Container *con)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
|
||||
v->create_cfdata = _create_data;
|
||||
v->free_cfdata = _free_data;
|
||||
v->basic.apply_cfdata = _basic_apply_data;
|
||||
v->basic.create_widgets = _basic_create_widgets;
|
||||
v->advanced.apply_cfdata = _advanced_apply_data;
|
||||
v->advanced.create_widgets = _advanced_create_widgets;
|
||||
v->close_cfdata = _bg_dialog_close;
|
||||
v->override_auto_apply = 1;
|
||||
cfd = e_config_dialog_new(con, _("Wallpaper Settings"), "enlightenment/background", 0, v, NULL);
|
||||
return cfd;
|
||||
}
|
||||
|
||||
static void
|
||||
_fill_data(E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
cfdata->bg_method = BG_SET_DEFAULT_DESK;
|
||||
if (e_config->desktop_default_background)
|
||||
cfdata->current_bg = strdup(e_config->desktop_default_background);
|
||||
else
|
||||
cfdata->current_bg = NULL;
|
||||
}
|
||||
|
||||
static void *
|
||||
_create_data(E_Config_Dialog *cfd)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
_fill_data(cfdata);
|
||||
cfd->cfdata = cfdata;
|
||||
cfdata->cfd = cfd;
|
||||
return cfdata;
|
||||
}
|
||||
|
||||
static void
|
||||
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
if (_bg_file_monitor)
|
||||
{
|
||||
ecore_file_monitor_del(_bg_file_monitor);
|
||||
_bg_file_monitor = NULL;
|
||||
}
|
||||
if (cfdata->current_bg) free(cfdata->current_bg);
|
||||
free(cfdata);
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Evas_Object *o, *ot, *il, *im;
|
||||
char path[4096], *homedir;
|
||||
|
||||
ot = e_widget_table_add(evas, 0);
|
||||
il = e_widget_ilist_add(evas, 48, 48, &(cfdata->bg));
|
||||
|
||||
cfdata->il = il;
|
||||
|
||||
e_widget_ilist_selector_set(il, 1);
|
||||
e_widget_min_size_set(il, 160, 40);
|
||||
|
||||
/* Load Bgs */
|
||||
_load_bgs(cfd, il);
|
||||
im = cfd->data;
|
||||
|
||||
/* e_widget_focus_set(il, 1); */
|
||||
e_widget_table_object_append(ot, il, 0, 0, 1, 2, 1, 1, 1, 1);
|
||||
|
||||
/* Add import Button */
|
||||
o = e_widget_button_add(evas, _("Select Another Image"), NULL, _bg_config_dialog_cb_import, cfd, NULL);
|
||||
e_widget_table_object_append(ot, o, 0, 2, 1, 1, 1, 0, 0, 0);
|
||||
|
||||
e_widget_table_object_append(ot, im, 1, 0, 1, 2, 1, 1, 1, 1);
|
||||
|
||||
if (_bg_file_monitor)
|
||||
{
|
||||
ecore_file_monitor_del(_bg_file_monitor);
|
||||
_bg_file_monitor = NULL;
|
||||
}
|
||||
homedir = e_user_homedir_get();
|
||||
if (homedir)
|
||||
{
|
||||
snprintf(path, sizeof(path), "%s/.e/e/backgrounds", homedir);
|
||||
free(homedir);
|
||||
_bg_file_monitor = ecore_file_monitor_add(path, _bg_file_added, cfdata);
|
||||
}
|
||||
return ot;
|
||||
}
|
||||
|
||||
static int
|
||||
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
if (!cfdata->bg) return 1;
|
||||
|
||||
while (e_config->desktop_backgrounds)
|
||||
{
|
||||
E_Config_Desktop_Background *cfbg;
|
||||
cfbg = e_config->desktop_backgrounds->data;
|
||||
e_bg_del(cfbg->container, cfbg->zone, cfbg->desk_x, cfbg->desk_y);
|
||||
}
|
||||
if (e_config->desktop_default_background)
|
||||
evas_stringshare_del(e_config->desktop_default_background);
|
||||
|
||||
if (!cfdata->bg[0]) e_config->desktop_default_background = NULL;
|
||||
else
|
||||
e_config->desktop_default_background = evas_stringshare_add(cfdata->bg);
|
||||
|
||||
e_bg_update();
|
||||
e_config_save_queue();
|
||||
if (cfdata->current_bg) free(cfdata->current_bg);
|
||||
cfdata->current_bg = strdup(cfdata->bg);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Evas_Object *o, *ot, *of, *il, *im, *oc;
|
||||
E_Radio_Group *rg;
|
||||
char path[4096];
|
||||
|
||||
ot = e_widget_table_add(evas, 0);
|
||||
il = e_widget_ilist_add(evas, 48, 48, &(cfdata->bg));
|
||||
cfdata->il = il;
|
||||
e_widget_ilist_selector_set(il, 1);
|
||||
e_widget_min_size_set(il, 160, 40);
|
||||
|
||||
/* Load Bgs */
|
||||
_load_bgs(cfd, il);
|
||||
im = cfd->data;
|
||||
|
||||
e_widget_focus_set(il, 1);
|
||||
e_widget_ilist_go(il);
|
||||
e_widget_table_object_append(ot, il, 0, 0, 1, 3, 1, 1, 1, 1);
|
||||
|
||||
/* Add import Button */
|
||||
o = e_widget_button_add(evas, _("Select Another Image"), NULL, _bg_config_dialog_cb_import, cfd, NULL);
|
||||
e_widget_table_object_append(ot, o, 0, 3, 1, 1, 1, 0, 0, 0);
|
||||
|
||||
e_widget_table_object_append(ot, im, 1, 0, 1, 2, 1, 1, 1, 1);
|
||||
|
||||
rg = e_widget_radio_group_new(&(cfdata->bg_method));
|
||||
of = e_widget_framelist_add(evas, _("Set Wallpaper For"), 0);
|
||||
e_widget_min_size_set(of, 200, 160);
|
||||
|
||||
oc = e_widget_radio_add(evas, _("Default Desktop"), BG_SET_DEFAULT_DESK, rg);
|
||||
e_widget_framelist_object_append(of, oc);
|
||||
oc = e_widget_radio_add(evas, _("This Desktop"), BG_SET_THIS_DESK, rg);
|
||||
e_widget_framelist_object_append(of, oc);
|
||||
oc = e_widget_radio_add(evas, _("All Desktops"), BG_SET_ALL_DESK, rg);
|
||||
e_widget_framelist_object_append(of, oc);
|
||||
|
||||
e_widget_table_object_append(ot, of, 1, 2, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
if (_bg_file_monitor)
|
||||
{
|
||||
ecore_file_monitor_del(_bg_file_monitor);
|
||||
_bg_file_monitor = NULL;
|
||||
}
|
||||
|
||||
snprintf(path, sizeof(path), "%s/.e/e/backgrounds", e_user_homedir_get());
|
||||
_bg_file_monitor = ecore_file_monitor_add(path, _bg_file_added, cfdata);
|
||||
return ot;
|
||||
}
|
||||
|
||||
static int
|
||||
_advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
E_Zone *z;
|
||||
E_Desk *d;
|
||||
int x, y;
|
||||
|
||||
if (!cfdata->bg) return 0;
|
||||
z = e_zone_current_get(cfd->con);
|
||||
d = e_desk_current_get(z);
|
||||
e_desk_xy_get(d, &x, &y);
|
||||
|
||||
switch (cfdata->bg_method)
|
||||
{
|
||||
case BG_SET_DEFAULT_DESK:
|
||||
e_bg_del(-1, -1, -1, -1);
|
||||
e_bg_del(-1, z->num, x, y);
|
||||
e_bg_del(z->container->num, -1, x, y);
|
||||
e_bg_del(z->container->num, z->num, x, y);
|
||||
e_bg_del(-1, z->num, -1, -1);
|
||||
e_bg_del(z->container->num, -1, -1, -1);
|
||||
e_bg_del(z->container->num, z->num, -1, -1);
|
||||
|
||||
if (e_config->desktop_default_background)
|
||||
evas_stringshare_del(e_config->desktop_default_background);
|
||||
|
||||
if (!cfdata->bg[0]) e_config->desktop_default_background = NULL;
|
||||
else
|
||||
e_config->desktop_default_background = evas_stringshare_add(cfdata->bg);
|
||||
|
||||
e_bg_update();
|
||||
e_config_save_queue();
|
||||
break;
|
||||
case BG_SET_THIS_DESK:
|
||||
e_bg_del(-1, -1, -1, -1);
|
||||
e_bg_del(-1, z->num, x, y);
|
||||
e_bg_del(z->container->num, -1, x, y);
|
||||
e_bg_del(z->container->num, z->num, x, y);
|
||||
if (cfdata->bg[0])
|
||||
e_bg_add(z->container->num, z->num, x, y, cfdata->bg);
|
||||
|
||||
e_bg_update();
|
||||
e_config_save_queue();
|
||||
break;
|
||||
case BG_SET_ALL_DESK:
|
||||
while (e_config->desktop_backgrounds)
|
||||
{
|
||||
E_Config_Desktop_Background *cfbg;
|
||||
|
||||
cfbg = e_config->desktop_backgrounds->data;
|
||||
e_bg_del(cfbg->container, cfbg->zone, cfbg->desk_x, cfbg->desk_y);
|
||||
}
|
||||
if (cfdata->bg[0])
|
||||
e_bg_add(-1, -1, -1, -1, cfdata->bg);
|
||||
|
||||
e_bg_update();
|
||||
e_config_save_queue();
|
||||
break;
|
||||
}
|
||||
if (cfdata->current_bg) free(cfdata->current_bg);
|
||||
cfdata->current_bg = strdup(cfdata->bg);
|
||||
return 1; /* Apply was OK */
|
||||
}
|
||||
|
||||
static void
|
||||
_load_bgs(E_Config_Dialog *cfd, Evas_Object *il)
|
||||
{
|
||||
Evas *evas;
|
||||
Evas_Object *ic, *im, *o, *bg_obj;
|
||||
Evas_List *bg_dirs, *bg;
|
||||
Ecore_Evas *eebuf;
|
||||
Evas *evasbuf;
|
||||
char *homedir;
|
||||
|
||||
const char *f;
|
||||
int selnum = -1;
|
||||
int i = 0;
|
||||
|
||||
if (!il) return;
|
||||
|
||||
homedir = e_user_homedir_get();
|
||||
|
||||
evas = evas_object_evas_get(il);
|
||||
bg_obj = edje_object_add(cfd->dia->win->evas);
|
||||
|
||||
/* Load The Theme's Background */
|
||||
eebuf = ecore_evas_buffer_new(1, 1);
|
||||
evasbuf = ecore_evas_get(eebuf);
|
||||
o = edje_object_add(evasbuf);
|
||||
|
||||
e_widget_ilist_header_append(il, NULL, _("Theme"));
|
||||
i++;
|
||||
|
||||
f = e_theme_edje_file_get("base/theme/backgrounds", "desktop/background");
|
||||
if (edje_object_file_set(o, f, "desktop/background"))
|
||||
{
|
||||
Evas_Object *ic = NULL;
|
||||
|
||||
ic = e_thumb_icon_add(cfd->dia->win->evas);
|
||||
e_thumb_icon_file_set(ic, f, "desktop/background");
|
||||
e_thumb_icon_size_set(ic, 64,
|
||||
(64 * e_zone_current_get(cfd->dia->win->container)->h) /
|
||||
e_zone_current_get(cfd->dia->win->container)->w);
|
||||
e_thumb_icon_begin(ic);
|
||||
e_widget_ilist_append(il, ic, _("Theme Wallpaper"), _ilist_cb_bg_selected, cfd, "");
|
||||
if (!e_config->desktop_default_background) selnum = i;
|
||||
i++;
|
||||
}
|
||||
|
||||
im = e_widget_preview_add(cfd->dia->win->evas, 320,
|
||||
(320 * e_zone_current_get(cfd->dia->win->container)->h) /
|
||||
e_zone_current_get(cfd->dia->win->container)->w);
|
||||
e_widget_preview_edje_set(im, f, "desktop/background");
|
||||
evas_object_del(bg_obj);
|
||||
|
||||
evas_object_del(o);
|
||||
ecore_evas_free(eebuf);
|
||||
|
||||
/* Load other backgrounds */
|
||||
bg_dirs = e_path_dir_list_get(path_backgrounds);
|
||||
for (bg = bg_dirs; bg; bg = bg->next)
|
||||
{
|
||||
E_Path_Dir *d;
|
||||
int detected;
|
||||
char *bg_file;
|
||||
Ecore_List *bgs;
|
||||
|
||||
d = bg->data;
|
||||
if (!ecore_file_is_dir(d->dir)) continue;
|
||||
bgs = ecore_file_ls(d->dir);
|
||||
if (!bgs) continue;
|
||||
|
||||
detected = 0;
|
||||
if (homedir)
|
||||
{
|
||||
if (!strncmp(d->dir, homedir, strlen(homedir)))
|
||||
{
|
||||
e_widget_ilist_header_append(il, NULL, _("Personal"));
|
||||
i++;
|
||||
detected = 1;
|
||||
}
|
||||
}
|
||||
if (!detected)
|
||||
{
|
||||
if (!strncmp(d->dir, e_prefix_data_get(), strlen(e_prefix_data_get())))
|
||||
{
|
||||
e_widget_ilist_header_append(il, NULL, _("System"));
|
||||
i++;
|
||||
detected = 1;
|
||||
}
|
||||
}
|
||||
if (!detected)
|
||||
{
|
||||
e_widget_ilist_header_append(il, NULL, _("Other"));
|
||||
i++;
|
||||
detected = 1;
|
||||
}
|
||||
while ((bg_file = ecore_list_next(bgs)))
|
||||
{
|
||||
char full_path[4096], *fl;
|
||||
|
||||
snprintf(full_path, sizeof(full_path), "%s/%s", d->dir, bg_file);
|
||||
if (ecore_file_is_dir(full_path)) continue;
|
||||
if (!e_util_edje_collection_exists(full_path, "desktop/background")) continue;
|
||||
|
||||
ic = e_thumb_icon_add(cfd->dia->win->evas);
|
||||
e_thumb_icon_file_set(ic, full_path, "desktop/background");
|
||||
e_thumb_icon_size_set(ic, 64,
|
||||
(64 * e_zone_current_get(cfd->dia->win->container)->h) /
|
||||
e_zone_current_get(cfd->dia->win->container)->w);
|
||||
e_thumb_icon_begin(ic);
|
||||
fl = ecore_file_strip_ext(bg_file);
|
||||
e_widget_ilist_append(il, ic, fl, _ilist_cb_bg_selected, cfd, full_path);
|
||||
E_FREE(fl);
|
||||
if ((e_config->desktop_default_background) &&
|
||||
(!strcmp(e_config->desktop_default_background, full_path)))
|
||||
{
|
||||
selnum = i;
|
||||
|
||||
evas_object_del(im);
|
||||
im = e_widget_preview_add(cfd->dia->win->evas, 320,
|
||||
(320 * e_zone_current_get(cfd->dia->win->container)->h) /
|
||||
e_zone_current_get(cfd->dia->win->container)->w);
|
||||
e_widget_preview_edje_set(im, e_config->desktop_default_background, "desktop/background");
|
||||
}
|
||||
i++;
|
||||
}
|
||||
free(bg_file);
|
||||
ecore_list_destroy(bgs);
|
||||
}
|
||||
evas_list_free(bg);
|
||||
if (bg_dirs) e_path_dir_list_free(bg_dirs);
|
||||
cfd->data = im;
|
||||
e_widget_ilist_go(il);
|
||||
if (selnum >= 0)
|
||||
e_widget_ilist_selected_set(il, selnum);
|
||||
|
||||
free(homedir);
|
||||
}
|
||||
|
||||
void
|
||||
_ilist_cb_bg_selected(void *data)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
Evas *evas;
|
||||
|
||||
cfd = data;
|
||||
cfdata = cfd->cfdata;
|
||||
evas = cfd->dia->win->evas;
|
||||
|
||||
if (!(cfdata->bg[0]))
|
||||
{
|
||||
const char *theme;
|
||||
|
||||
theme = e_theme_edje_file_get("base/theme/backgrounds", "desktop/background");
|
||||
e_widget_preview_edje_set(cfd->data, theme, "desktop/background");
|
||||
}
|
||||
else
|
||||
{
|
||||
e_widget_preview_edje_set(cfd->data, cfdata->bg, "desktop/background");
|
||||
}
|
||||
|
||||
if (cfdata->current_bg)
|
||||
{
|
||||
if (!strcmp(cfdata->bg, cfdata->current_bg))
|
||||
{
|
||||
e_dialog_button_disable_num_set(cfd->dia, 0, 1);
|
||||
e_dialog_button_disable_num_set(cfd->dia, 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_bg_config_dialog_cb_import(void *data, void *data2)
|
||||
{
|
||||
E_Config_Dialog *parent;
|
||||
E_Win *import;
|
||||
|
||||
parent = data;
|
||||
if (!parent) return;
|
||||
|
||||
import = e_int_config_background_import(parent);
|
||||
if (import)
|
||||
{
|
||||
parent->cfdata->import = import;
|
||||
import_open = 1;
|
||||
e_object_del_attach_func_set(E_OBJECT(import), _import_cb_closed);
|
||||
}
|
||||
else
|
||||
{
|
||||
parent->cfdata->import = NULL;
|
||||
import_open = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_bg_file_added(void *data, Ecore_File_Monitor *monitor, Ecore_File_Event event, const char *path)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
Evas *evas;
|
||||
Evas_Object *il, *ic;
|
||||
char *file;
|
||||
char *noext;
|
||||
|
||||
cfdata = data;
|
||||
if (!cfdata) return;
|
||||
|
||||
il = cfdata->il;
|
||||
if (!il) return;
|
||||
|
||||
cfd = cfdata->cfd;
|
||||
if (!cfd) return;
|
||||
|
||||
evas = e_win_evas_get(cfd->dia->win);
|
||||
|
||||
file = (char *)ecore_file_get_file((char *)path);
|
||||
noext = ecore_file_strip_ext(file);
|
||||
if (event == ECORE_FILE_EVENT_CREATED_FILE)
|
||||
{
|
||||
if (e_util_edje_collection_exists((char *)path, "desktop/background"))
|
||||
{
|
||||
ic = e_thumb_icon_add(cfd->dia->win->evas);
|
||||
e_thumb_icon_file_set(ic, path, "desktop/background");
|
||||
e_thumb_icon_size_set(ic, 64,
|
||||
(64 * e_zone_current_get(cfd->dia->win->container)->h) /
|
||||
e_zone_current_get(cfd->dia->win->container)->w);
|
||||
e_thumb_icon_begin(ic);
|
||||
e_widget_ilist_append(il, ic, noext, _ilist_cb_bg_selected, cfd, (char *)path);
|
||||
}
|
||||
}
|
||||
else if (event == ECORE_FILE_EVENT_DELETED_FILE)
|
||||
e_widget_ilist_remove_label(il, noext);
|
||||
}
|
||||
|
||||
static int
|
||||
_bg_dialog_close(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
if (!cfd) return 0;
|
||||
if (!cfdata) return 0;
|
||||
if (!cfdata->import) return 1;
|
||||
if (!import_open) return 1;
|
||||
|
||||
e_object_del(E_OBJECT(cfdata->import));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_import_cb_closed(void *obj)
|
||||
{
|
||||
import_open = 0;
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
#ifdef E_TYPEDEFS
|
||||
#else
|
||||
#ifndef E_INT_CONFIG_BACKGROUND_H
|
||||
#define E_INT_CONFIG_BACKGROUND_H
|
||||
|
||||
EAPI E_Config_Dialog *e_int_config_background(E_Container *con);
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -1,460 +0,0 @@
|
|||
#include "e.h"
|
||||
|
||||
#define E_BG_SCALE 0
|
||||
#define E_BG_TILE 1
|
||||
#define E_BG_CENTER 2
|
||||
|
||||
/* Personally I hate having to define this twice, but Tileing needs a fill */
|
||||
#define IMG_EDC_TMPL_TILE \
|
||||
"images {\n" \
|
||||
" image: \"%s\" LOSSY 90;\n" \
|
||||
"}\n" \
|
||||
"collections {\n" \
|
||||
" group {\n" \
|
||||
" name: \"desktop/background\";\n" \
|
||||
" max: %d %d;\n" \
|
||||
" parts {\n" \
|
||||
" part {\n" \
|
||||
" name: \"background_image\";\n" \
|
||||
" type: IMAGE;\n" \
|
||||
" mouse_events: 0;\n" \
|
||||
" description {\n" \
|
||||
" state: \"default\" 0.0;\n" \
|
||||
" visible: 1;\n" \
|
||||
" rel1 {\n" \
|
||||
" relative: 0.0 0.0;\n" \
|
||||
" offset: 0 0;\n" \
|
||||
" }\n" \
|
||||
" rel2 {\n" \
|
||||
" relative: 1.0 1.0;\n" \
|
||||
" offset: -1 -1;\n" \
|
||||
" }\n" \
|
||||
" image {\n" \
|
||||
" normal: \"%s\";\n" \
|
||||
" }\n" \
|
||||
" fill {\n" \
|
||||
" size {\n" \
|
||||
" relative: 0.0 0.0;\n" \
|
||||
" offset: %d %d;\n" \
|
||||
" }\n" \
|
||||
" }\n" \
|
||||
" }\n" \
|
||||
" }\n" \
|
||||
" }\n" \
|
||||
" }\n" \
|
||||
"}\n"
|
||||
|
||||
#define IMG_EDC_TMPL \
|
||||
"images {\n" \
|
||||
" image: \"%s\" LOSSY 90;\n" \
|
||||
"}\n" \
|
||||
"collections {\n" \
|
||||
" group {\n" \
|
||||
" name: \"desktop/background\";\n" \
|
||||
" max: %d %d;\n" \
|
||||
" parts {\n" \
|
||||
" part {\n" \
|
||||
" name: \"background_image\";\n" \
|
||||
" type: IMAGE;\n" \
|
||||
" mouse_events: 0;\n" \
|
||||
" description {\n" \
|
||||
" state: \"default\" 0.0;\n" \
|
||||
" visible: 1;\n" \
|
||||
" rel1 {\n" \
|
||||
" relative: 0.0 0.0;\n" \
|
||||
" offset: 0 0;\n" \
|
||||
" }\n" \
|
||||
" rel2 {\n" \
|
||||
" relative: 1.0 1.0;\n" \
|
||||
" offset: -1 -1;\n" \
|
||||
" }\n" \
|
||||
" image {\n" \
|
||||
" normal: \"%s\";\n" \
|
||||
" }\n" \
|
||||
" }\n" \
|
||||
" }\n" \
|
||||
" }\n" \
|
||||
" }\n" \
|
||||
"}\n"
|
||||
|
||||
static Ecore_Event_Handler *_edj_exe_exit_handler = NULL;
|
||||
|
||||
static void _efm_cb_selchange(void *data, Evas_Object *obj);
|
||||
static void _bg_edj_gen (Evas *evas, char *filename, int method);
|
||||
static int _edj_exe_exit_cb (void *data, int type, void *event);
|
||||
|
||||
static void _import_cb_delete(E_Win *win);
|
||||
static void _import_cb_resize(E_Win *win);
|
||||
static void _import_cb_close(void *data, void *data2);
|
||||
static void _import_cb_ok(void *data, void *data2);
|
||||
static void _import_cb_wid_on_focus(void *data, Evas_Object *obj);
|
||||
static void _import_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event);
|
||||
|
||||
typedef struct _Bg_Import_Window Bg_Import_Window;
|
||||
struct _Bg_Import_Window
|
||||
{
|
||||
E_Config_Dialog *parent;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
Evas_Object *bg_obj;
|
||||
Evas_Object *box_obj;
|
||||
Evas_Object *event_obj;
|
||||
Evas_Object *content_obj;
|
||||
Evas_Object *fsel_obj;
|
||||
|
||||
Evas_Object *ok_obj;
|
||||
Evas_Object *close_obj;
|
||||
|
||||
E_Win *win;
|
||||
};
|
||||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
char *file;
|
||||
int method;
|
||||
};
|
||||
|
||||
EAPI E_Win *
|
||||
e_int_config_background_import(E_Config_Dialog *parent)
|
||||
{
|
||||
Evas *evas;
|
||||
E_Win *win;
|
||||
Bg_Import_Window *import;
|
||||
Evas_Object *o, *of, *ofm, *ord;
|
||||
E_Radio_Group *rg;
|
||||
Evas_Coord w, h;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
Evas_Modifier_Mask mask;
|
||||
|
||||
import = E_NEW(Bg_Import_Window, 1);
|
||||
if (!import) return NULL;
|
||||
|
||||
win = e_win_new(parent->con);
|
||||
if (!win)
|
||||
{
|
||||
free(import);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
cfdata->method = 0;
|
||||
import->cfdata = cfdata;
|
||||
import->win = win;
|
||||
|
||||
evas = e_win_evas_get(win);
|
||||
|
||||
import->parent = parent;
|
||||
|
||||
e_win_title_set(win, _("Import An Image"));
|
||||
e_win_delete_callback_set(win, _import_cb_delete);
|
||||
e_win_resize_callback_set(win, _import_cb_resize);
|
||||
e_win_dialog_set(win, 1);
|
||||
e_win_name_class_set(win, "E", "_dialog");
|
||||
|
||||
o = edje_object_add(evas);
|
||||
import->bg_obj = o;
|
||||
e_theme_edje_object_set(o, "base/theme/dialog", "widgets/dialog/main");
|
||||
evas_object_move(o, 0, 0);
|
||||
evas_object_show(o);
|
||||
|
||||
o = e_widget_list_add(evas, 1, 1);
|
||||
e_widget_on_focus_hook_set(o, _import_cb_wid_on_focus, import);
|
||||
import->box_obj = o;
|
||||
edje_object_part_swallow(import->bg_obj, "buttons_swallow", o);
|
||||
|
||||
o = evas_object_rectangle_add(evas);
|
||||
import->event_obj = o;
|
||||
mask = 0;
|
||||
evas_object_key_grab(o, "Tab", mask, ~mask, 0);
|
||||
mask = evas_key_modifier_mask_get(evas, "Shift");
|
||||
evas_object_key_grab(o, "Tab", mask, ~mask, 0);
|
||||
mask = 0;
|
||||
evas_object_key_grab(o, "Return", mask, ~mask, 0);
|
||||
mask = 0;
|
||||
evas_object_key_grab(o, "KP_Enter", mask, ~mask, 0);
|
||||
mask = 0;
|
||||
evas_object_key_grab(o, "Space", mask, ~mask, 0);
|
||||
mask = 0;
|
||||
evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN, _import_cb_key_down, import);
|
||||
|
||||
o = e_widget_list_add(evas, 0, 0);
|
||||
import->content_obj = o;
|
||||
|
||||
ofm = e_widget_fsel_add(evas, "~/", "/", NULL, NULL,
|
||||
_efm_cb_selchange, import,
|
||||
_efm_cb_selchange, import
|
||||
);
|
||||
import->fsel_obj = ofm;
|
||||
e_widget_list_object_append(o, ofm, 1, 1, 0.5);
|
||||
|
||||
of = e_widget_frametable_add(evas, _("Options"), 0);
|
||||
rg = e_widget_radio_group_new(&cfdata->method);
|
||||
ord = e_widget_radio_add(evas, _("Center Image"), E_BG_CENTER, rg);
|
||||
e_widget_frametable_object_append(of, ord, 0, 0, 1, 1, 1, 0, 1, 0);
|
||||
ord = e_widget_radio_add(evas, _("Scale Image"), E_BG_SCALE, rg);
|
||||
e_widget_frametable_object_append(of, ord, 0, 1, 1, 1, 1, 0, 1, 0);
|
||||
ord = e_widget_radio_add(evas, _("Tile Image"), E_BG_TILE, rg);
|
||||
e_widget_frametable_object_append(of, ord, 0, 2, 1, 1, 1, 0, 1, 0);
|
||||
|
||||
e_widget_list_object_append(o, of, 0, 0, 0.5);
|
||||
|
||||
e_widget_min_size_get(o, &w, &h);
|
||||
edje_extern_object_min_size_set(o, w, h);
|
||||
edje_object_part_swallow(import->bg_obj, "content_swallow", o);
|
||||
evas_object_show(o);
|
||||
|
||||
import->ok_obj = e_widget_button_add(evas, _("OK"), NULL, _import_cb_ok, win, cfdata);
|
||||
e_widget_list_object_append(import->box_obj, import->ok_obj, 1, 0, 0.5);
|
||||
|
||||
import->close_obj = e_widget_button_add(evas, _("Cancel"), NULL, _import_cb_close, win, NULL);
|
||||
e_widget_list_object_append(import->box_obj, import->close_obj, 1, 0, 0.5);
|
||||
|
||||
e_win_centered_set(win, 1);
|
||||
|
||||
o = import->box_obj;
|
||||
e_widget_min_size_get(o, &w, &h);
|
||||
edje_extern_object_min_size_set(o, w, h);
|
||||
edje_object_part_swallow(import->bg_obj, "buttons_swallow", o);
|
||||
|
||||
edje_object_size_min_calc(import->bg_obj, &w, &h);
|
||||
evas_object_resize(import->bg_obj, w + 64, h + 128);
|
||||
e_win_resize(win, w + 64, h + 128);
|
||||
e_win_size_min_set(win, w, h);
|
||||
e_win_size_max_set(win, 99999, 99999);
|
||||
e_win_show(win);
|
||||
|
||||
if (!e_widget_focus_get(import->bg_obj))
|
||||
e_widget_focus_set(import->box_obj, 1);
|
||||
|
||||
win->data = import;
|
||||
return win;
|
||||
}
|
||||
|
||||
static void
|
||||
_efm_cb_selchange(void *data, Evas_Object *obj)
|
||||
{
|
||||
Bg_Import_Window *import;
|
||||
const char *path;
|
||||
|
||||
import = data;
|
||||
path = e_widget_fsel_selection_path_get(import->fsel_obj);
|
||||
E_FREE(import->cfdata->file);
|
||||
if (path) import->cfdata->file = strdup(path);
|
||||
}
|
||||
|
||||
static void
|
||||
_bg_edj_gen(Evas *evas, char *filename, int method)
|
||||
{
|
||||
Evas_Object *img;
|
||||
int fd = 0;
|
||||
int w, h;
|
||||
const char *file;
|
||||
char buff[4096], cmd[4096];
|
||||
char ipart[4096];
|
||||
char *imgdir = NULL;
|
||||
static char tmpn[4096];
|
||||
FILE *out = NULL;
|
||||
Ecore_Exe *x;
|
||||
|
||||
if (!filename) return;
|
||||
file = ecore_file_get_file(filename);
|
||||
|
||||
snprintf(buff, sizeof(buff), "%s/.e/e/backgrounds/%s.edj",
|
||||
e_user_homedir_get(),
|
||||
ecore_file_strip_ext(file));
|
||||
strcpy(tmpn, "/tmp/e_bgdlg_new.edc-tmp-XXXXXX");
|
||||
fd = mkstemp(tmpn);
|
||||
if (fd < 0)
|
||||
{
|
||||
printf("Error Creating tmp file: %s\n", strerror(errno));
|
||||
return;
|
||||
}
|
||||
close(fd);
|
||||
|
||||
out = fopen(tmpn, "w");
|
||||
if (!out)
|
||||
{
|
||||
printf("Cannot open %s for writting\n", tmpn);
|
||||
return;
|
||||
}
|
||||
|
||||
imgdir = ecore_file_get_dir(filename);
|
||||
if (!imgdir) ipart[0] = '\0';
|
||||
if (imgdir)
|
||||
{
|
||||
snprintf(ipart, sizeof(ipart), "-id %s", imgdir);
|
||||
free(imgdir);
|
||||
}
|
||||
|
||||
img = evas_object_image_add(evas);
|
||||
evas_object_image_file_set(img, filename, NULL);
|
||||
evas_object_image_size_get(img, &w, &h);
|
||||
evas_object_del(img);
|
||||
|
||||
switch (method)
|
||||
{
|
||||
case E_BG_CENTER:
|
||||
fprintf(out, IMG_EDC_TMPL, file, w, h, file);
|
||||
break;
|
||||
case E_BG_TILE:
|
||||
fprintf(out, IMG_EDC_TMPL_TILE, file, w, h, file, w, h);
|
||||
break;
|
||||
case E_BG_SCALE:
|
||||
fprintf(out, IMG_EDC_TMPL, file, w, h, file);
|
||||
break;
|
||||
}
|
||||
|
||||
fclose(out);
|
||||
|
||||
snprintf(cmd, sizeof(cmd), "edje_cc -v %s %s %s",
|
||||
ipart,
|
||||
tmpn,
|
||||
e_util_filename_escape(buff));
|
||||
|
||||
_edj_exe_exit_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _edj_exe_exit_cb, NULL);
|
||||
x = ecore_exe_run(cmd, tmpn);
|
||||
}
|
||||
|
||||
static int
|
||||
_edj_exe_exit_cb(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_Exe_Event_Del *ev;
|
||||
Ecore_Exe *x;
|
||||
|
||||
ev = event;
|
||||
if (!ev->exe) return 1;
|
||||
|
||||
x = ev->exe;
|
||||
if (!x) return 1;
|
||||
|
||||
x = NULL;
|
||||
ecore_event_handler_del(_edj_exe_exit_handler);
|
||||
_edj_exe_exit_handler = NULL;
|
||||
|
||||
unlink(data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_import_cb_delete(E_Win *win)
|
||||
{
|
||||
Bg_Import_Window *import;
|
||||
|
||||
import = win->data;
|
||||
if (import) free(import);
|
||||
e_object_del(E_OBJECT(win));
|
||||
}
|
||||
|
||||
static void
|
||||
_import_cb_resize(E_Win *win)
|
||||
{
|
||||
Bg_Import_Window *import;
|
||||
|
||||
import = win->data;
|
||||
if (!import) return;
|
||||
evas_object_resize(import->bg_obj, win->w, win->h);
|
||||
}
|
||||
|
||||
static void
|
||||
_import_cb_close(void *data, void *data2)
|
||||
{
|
||||
Bg_Import_Window *import;
|
||||
E_Win *win;
|
||||
|
||||
win = data;
|
||||
import = win->data;
|
||||
if (import) free(import);
|
||||
e_object_del(E_OBJECT(win));
|
||||
}
|
||||
|
||||
static void
|
||||
_import_cb_ok(void *data, void *data2)
|
||||
{
|
||||
Evas *evas;
|
||||
E_Win *win;
|
||||
Bg_Import_Window *import;
|
||||
const char *path;
|
||||
|
||||
win = data;
|
||||
import = win->data;
|
||||
|
||||
path = e_widget_fsel_selection_path_get(import->fsel_obj);
|
||||
E_FREE(import->cfdata->file);
|
||||
if (path) import->cfdata->file = strdup(path);
|
||||
if (import->cfdata->file)
|
||||
{
|
||||
evas = e_win_evas_get(win);
|
||||
_bg_edj_gen(evas, import->cfdata->file, import->cfdata->method);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_import_cb_wid_on_focus(void *data, Evas_Object *obj)
|
||||
{
|
||||
Bg_Import_Window *import;
|
||||
|
||||
import = data;
|
||||
if (obj == import->content_obj)
|
||||
e_widget_focused_object_clear(import->box_obj);
|
||||
else if (import->content_obj)
|
||||
e_widget_focused_object_clear(import->content_obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_import_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event)
|
||||
{
|
||||
Evas_Event_Key_Down *ev;
|
||||
Bg_Import_Window *dia;
|
||||
|
||||
ev = event;
|
||||
dia = data;
|
||||
if (!strcmp(ev->keyname, "Tab"))
|
||||
{
|
||||
if (evas_key_modifier_is_set(evas_key_modifier_get(e_win_evas_get(dia->win)), "Shift"))
|
||||
{
|
||||
if (e_widget_focus_get(dia->box_obj))
|
||||
{
|
||||
if (!e_widget_focus_jump(dia->box_obj, 0))
|
||||
{
|
||||
e_widget_focus_set(dia->content_obj, 0);
|
||||
if (!e_widget_focus_get(dia->content_obj))
|
||||
e_widget_focus_set(dia->box_obj, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!e_widget_focus_jump(dia->content_obj, 0))
|
||||
e_widget_focus_set(dia->box_obj, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e_widget_focus_get(dia->box_obj))
|
||||
{
|
||||
if (!e_widget_focus_jump(dia->box_obj, 1))
|
||||
{
|
||||
e_widget_focus_set(dia->content_obj, 1);
|
||||
if (!e_widget_focus_get(dia->content_obj))
|
||||
e_widget_focus_set(dia->box_obj, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!e_widget_focus_jump(dia->content_obj, 1))
|
||||
e_widget_focus_set(dia->box_obj, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (((!strcmp(ev->keyname, "Return")) ||
|
||||
(!strcmp(ev->keyname, "KP_Enter")) ||
|
||||
(!strcmp(ev->keyname, "space"))))
|
||||
{
|
||||
Evas_Object *o = NULL;
|
||||
|
||||
if ((dia->content_obj) && (e_widget_focus_get(dia->content_obj)))
|
||||
o = e_widget_focused_object_get(dia->content_obj);
|
||||
else
|
||||
o = e_widget_focused_object_get(dia->box_obj);
|
||||
if (o) e_widget_activate(o);
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
#ifdef E_TYPEDEFS
|
||||
#else
|
||||
#ifndef E_INT_CONFIG_BACKGROUND_IMPORT_H
|
||||
#define E_INT_CONFIG_BACKGROUND_IMPORT_H
|
||||
|
||||
EAPI E_Win *e_int_config_background_import(E_Config_Dialog *parent);
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -507,7 +507,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
|||
e_widget_table_object_append(ot, ol, 2, 0, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
il = e_widget_list_add(evas, 0, 0);
|
||||
o = e_widget_check_add(evas, _("Theme Wallpaper"), &cfdata->use_theme_bg);
|
||||
o = e_widget_check_add(evas, _("Use Theme Wallpaper"), &cfdata->use_theme_bg);
|
||||
cfdata->o_theme_bg = o;
|
||||
evas_object_smart_callback_add(o, "changed",
|
||||
_cb_theme_wallpaper, cfdata);
|
||||
|
@ -677,7 +677,7 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
|
|||
e_widget_table_object_append(ot, ol, 2, 0, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
il = e_widget_list_add(evas, 0, 0);
|
||||
o = e_widget_check_add(evas, _("Theme Wallpaper"), &cfdata->use_theme_bg);
|
||||
o = e_widget_check_add(evas, _("Use Theme Wallpaper"), &cfdata->use_theme_bg);
|
||||
cfdata->o_theme_bg = o;
|
||||
evas_object_smart_callback_add(o, "changed",
|
||||
_cb_theme_wallpaper, cfdata);
|
||||
|
|
|
@ -1,87 +1,11 @@
|
|||
#include "e.h"
|
||||
|
||||
/* FIXME: redo this... */
|
||||
|
||||
#define IMPORT_STRETCH 0
|
||||
#define IMPORT_TILE 1
|
||||
#define IMPORT_CENTER 2
|
||||
/* FIXME handle these 2 */
|
||||
#define IMPORT_SCALE_ASPECT_IN 3
|
||||
#define IMPORT_SCALE_ASPECT_OUT 4
|
||||
|
||||
/* Personally I hate having to define this twice, but Tileing needs a fill */
|
||||
#define IMG_EDC_TMPL_TILE \
|
||||
"images {\n" \
|
||||
" image: \"%s\" LOSSY 90;\n" \
|
||||
"}\n" \
|
||||
"collections {\n" \
|
||||
" group {\n" \
|
||||
" name: \"desktop/background\";\n" \
|
||||
" max: %d %d;\n" \
|
||||
" parts {\n" \
|
||||
" part {\n" \
|
||||
" name: \"background_image\";\n" \
|
||||
" type: IMAGE;\n" \
|
||||
" mouse_events: 0;\n" \
|
||||
" description {\n" \
|
||||
" state: \"default\" 0.0;\n" \
|
||||
" visible: 1;\n" \
|
||||
" rel1 {\n" \
|
||||
" relative: 0.0 0.0;\n" \
|
||||
" offset: 0 0;\n" \
|
||||
" }\n" \
|
||||
" rel2 {\n" \
|
||||
" relative: 1.0 1.0;\n" \
|
||||
" offset: -1 -1;\n" \
|
||||
" }\n" \
|
||||
" image {\n" \
|
||||
" normal: \"%s\";\n" \
|
||||
" }\n" \
|
||||
" fill {\n" \
|
||||
" size {\n" \
|
||||
" relative: 0.0 0.0;\n" \
|
||||
" offset: %d %d;\n" \
|
||||
" }\n" \
|
||||
" }\n" \
|
||||
" }\n" \
|
||||
" }\n" \
|
||||
" }\n" \
|
||||
" }\n" \
|
||||
"}\n"
|
||||
|
||||
#define IMG_EDC_TMPL \
|
||||
"images {\n" \
|
||||
" image: \"%s\" LOSSY 90;\n" \
|
||||
"}\n" \
|
||||
"collections {\n" \
|
||||
" group {\n" \
|
||||
" name: \"desktop/background\";\n" \
|
||||
" max: %d %d;\n" \
|
||||
" parts {\n" \
|
||||
" part {\n" \
|
||||
" name: \"background_image\";\n" \
|
||||
" type: IMAGE;\n" \
|
||||
" mouse_events: 0;\n" \
|
||||
" description {\n" \
|
||||
" state: \"default\" 0.0;\n" \
|
||||
" visible: 1;\n" \
|
||||
" rel1 {\n" \
|
||||
" relative: 0.0 0.0;\n" \
|
||||
" offset: 0 0;\n" \
|
||||
" }\n" \
|
||||
" rel2 {\n" \
|
||||
" relative: 1.0 1.0;\n" \
|
||||
" offset: -1 -1;\n" \
|
||||
" }\n" \
|
||||
" image {\n" \
|
||||
" normal: \"%s\";\n" \
|
||||
" }\n" \
|
||||
" }\n" \
|
||||
" }\n" \
|
||||
" }\n" \
|
||||
" }\n" \
|
||||
"}\n"
|
||||
|
||||
typedef struct _Import Import;
|
||||
|
||||
struct _Import
|
||||
|
@ -110,6 +34,8 @@ struct _E_Config_Dialog_Data
|
|||
{
|
||||
char *file;
|
||||
int method;
|
||||
int perfect;
|
||||
double quality;
|
||||
};
|
||||
|
||||
static Ecore_Event_Handler *_import_edje_cc_exit_handler = NULL;
|
||||
|
@ -131,7 +57,7 @@ e_int_config_wallpaper_import(E_Config_Dialog *parent)
|
|||
Evas *evas;
|
||||
E_Win *win;
|
||||
Import *import;
|
||||
Evas_Object *o, *of, *ofm, *ord;
|
||||
Evas_Object *o, *of, *ofm, *ord, *ot;
|
||||
E_Radio_Group *rg;
|
||||
Evas_Coord w, h;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
@ -148,7 +74,9 @@ e_int_config_wallpaper_import(E_Config_Dialog *parent)
|
|||
}
|
||||
|
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
cfdata->method = 0;
|
||||
cfdata->method = IMPORT_STRETCH;
|
||||
cfdata->perfect = 0;
|
||||
cfdata->quality = 90.0;
|
||||
import->cfdata = cfdata;
|
||||
import->win = win;
|
||||
|
||||
|
@ -198,16 +126,30 @@ e_int_config_wallpaper_import(E_Config_Dialog *parent)
|
|||
import->fsel_obj = ofm;
|
||||
e_widget_list_object_append(o, ofm, 1, 1, 0.5);
|
||||
|
||||
of = e_widget_frametable_add(evas, _("Options"), 0);
|
||||
rg = e_widget_radio_group_new(&cfdata->method);
|
||||
ord = e_widget_radio_add(evas, _("Center Image"), IMPORT_CENTER, rg);
|
||||
e_widget_frametable_object_append(of, ord, 0, 0, 1, 1, 1, 0, 1, 0);
|
||||
ord = e_widget_radio_add(evas, _("Scale Image"), IMPORT_STRETCH, rg);
|
||||
e_widget_frametable_object_append(of, ord, 0, 1, 1, 1, 1, 0, 1, 0);
|
||||
ord = e_widget_radio_add(evas, _("Tile Image"), IMPORT_TILE, rg);
|
||||
e_widget_frametable_object_append(of, ord, 0, 2, 1, 1, 1, 0, 1, 0);
|
||||
ot = e_widget_table_add(evas, 0);
|
||||
|
||||
e_widget_list_object_append(o, of, 0, 0, 0.5);
|
||||
of = e_widget_frametable_add(evas, _("Fill and Stretch Options"), 1);
|
||||
rg = e_widget_radio_group_new(&cfdata->method);
|
||||
ord = e_widget_radio_icon_add(evas, _("Stretch"), "enlightenment/wallpaper_stretch", 24, 24, IMPORT_STRETCH, rg);
|
||||
e_widget_frametable_object_append(of, ord, 0, 0, 1, 1, 1, 0, 1, 0);
|
||||
ord = e_widget_radio_icon_add(evas, _("Center"), "enlightenment/wallpaper_center", 24, 24, IMPORT_CENTER, rg);
|
||||
e_widget_frametable_object_append(of, ord, 1, 0, 1, 1, 1, 0, 1, 0);
|
||||
ord = e_widget_radio_icon_add(evas, _("Tile"), "enlightenment/wallpaper_tile", 24, 24, IMPORT_TILE, rg);
|
||||
e_widget_frametable_object_append(of, ord, 2, 0, 1, 1, 1, 0, 1, 0);
|
||||
ord = e_widget_radio_icon_add(evas, _("Within"), "enlightenment/wallpaper_scale_aspect_in", 24, 24, IMPORT_SCALE_ASPECT_IN, rg);
|
||||
e_widget_frametable_object_append(of, ord, 3, 0, 1, 1, 1, 0, 1, 0);
|
||||
ord = e_widget_radio_icon_add(evas, _("Fill"), "enlightenment/wallpaper_scale_aspect_out", 24, 24, IMPORT_SCALE_ASPECT_OUT, rg);
|
||||
e_widget_frametable_object_append(of, ord, 4, 0, 1, 1, 1, 0, 1, 0);
|
||||
e_widget_table_object_append(ot, of, 0, 0, 1, 1, 1, 1, 1, 0);
|
||||
|
||||
of = e_widget_frametable_add(evas, _("File Quality"), 0);
|
||||
ord = e_widget_slider_add(evas, 1, 0, _("%3.0f%%"), 0.0, 100.0, 1.0, 0, &(cfdata->quality), NULL, 150);
|
||||
e_widget_frametable_object_append(of, ord, 0, 0, 1, 1, 1, 0, 1, 0);
|
||||
ord = e_widget_check_add(evas, _("Perfect"), &(cfdata->perfect));
|
||||
e_widget_frametable_object_append(of, ord, 1, 0, 1, 1, 0, 0, 0, 0);
|
||||
e_widget_table_object_append(ot, of, 0, 1, 1, 1, 1, 1, 1, 0);
|
||||
|
||||
e_widget_list_object_append(o, ot, 0, 0, 0.5);
|
||||
|
||||
e_widget_min_size_get(o, &w, &h);
|
||||
edje_extern_object_min_size_set(o, w, h);
|
||||
|
@ -228,8 +170,8 @@ e_int_config_wallpaper_import(E_Config_Dialog *parent)
|
|||
edje_object_part_swallow(import->bg_obj, "buttons_swallow", o);
|
||||
|
||||
edje_object_size_min_calc(import->bg_obj, &w, &h);
|
||||
evas_object_resize(import->bg_obj, w + 64, h + 128);
|
||||
e_win_resize(win, w + 64, h + 128);
|
||||
evas_object_resize(import->bg_obj, w, h + 128);
|
||||
e_win_resize(win, w, h + 128);
|
||||
e_win_size_min_set(win, w, h);
|
||||
e_win_size_max_set(win, 99999, 99999);
|
||||
e_win_show(win);
|
||||
|
@ -280,7 +222,7 @@ _import_edj_gen(Import *import)
|
|||
int fd;
|
||||
int w = 0, h = 0;
|
||||
const char *file;
|
||||
char buf[4096], cmd[4096], tmpn[4096], ipart[4096];
|
||||
char buf[4096], cmd[4096], tmpn[4096], ipart[4096], enc[128];
|
||||
char *imgdir = NULL, *homedir, *fstrip;
|
||||
FILE *f;
|
||||
|
||||
|
@ -326,19 +268,85 @@ _import_edj_gen(Import *import)
|
|||
evas_object_image_size_get(img, &w, &h);
|
||||
evas_object_del(img);
|
||||
|
||||
fstrip = strdup(e_util_filename_escape(file));
|
||||
if (import->cfdata->perfect)
|
||||
snprintf(enc, sizeof(enc), "COMP");
|
||||
else
|
||||
snprintf(enc, sizeof(enc), "LOSSY %1.0f", import->cfdata->quality);
|
||||
switch (import->cfdata->method)
|
||||
{
|
||||
case IMPORT_CENTER:
|
||||
fprintf(f, IMG_EDC_TMPL, file, w, h, file);
|
||||
case IMPORT_STRETCH:
|
||||
fprintf(f,
|
||||
"images { image: \"%s\" %s; }\n"
|
||||
"collections {\n"
|
||||
"group { name: \"desktop/background\";\n"
|
||||
"max: %i %i;\n"
|
||||
"parts { part { name: \"bg\"; mouse_events: 0;\n"
|
||||
"description { state: \"default\" 0.0;\n"
|
||||
"image { normal: \"%s\"; }\n"
|
||||
"} } } } }\n"
|
||||
, fstrip, enc, w, h, fstrip);
|
||||
break;
|
||||
case IMPORT_TILE:
|
||||
fprintf(f, IMG_EDC_TMPL_TILE, file, w, h, file, w, h);
|
||||
fprintf(f,
|
||||
"images { image: \"%s\" %s; }\n"
|
||||
"collections {\n"
|
||||
"group { name: \"desktop/background\";\n"
|
||||
"max: %i %i;\n"
|
||||
"parts { part { name: \"bg\"; mouse_events: 0;\n"
|
||||
"description { state: \"default\" 0.0;\n"
|
||||
"image { normal: \"%s\"; }\n"
|
||||
"fill { size {\n"
|
||||
"relative: 0.0 0.0;\n"
|
||||
"offset: %i %i;\n"
|
||||
"} } } } } } }\n"
|
||||
, fstrip, enc, w, h, fstrip, w, h);
|
||||
break;
|
||||
case IMPORT_STRETCH:
|
||||
fprintf(f, IMG_EDC_TMPL, file, w, h, file);
|
||||
case IMPORT_CENTER:
|
||||
fprintf(f,
|
||||
"images { image: \"%s\" %s; }\n"
|
||||
"collections {\n"
|
||||
"group { name: \"desktop/background\";\n"
|
||||
"max: %i %i;\n"
|
||||
"parts { part { name: \"bg\"; mouse_events: 0;\n"
|
||||
"description { state: \"default\" 0.0;\n"
|
||||
"min: %i %i; max: %i %i\n"
|
||||
"image { normal: \"%s\"; }\n"
|
||||
"} } } } }\n"
|
||||
, fstrip, enc, w, h, w, h, w, h, fstrip);
|
||||
break;
|
||||
case IMPORT_SCALE_ASPECT_IN:
|
||||
fprintf(f,
|
||||
"images { image: \"%s\" %s; }\n"
|
||||
"collections {\n"
|
||||
"group { name: \"desktop/background\";\n"
|
||||
"max: %i %i;\n"
|
||||
"parts { part { name: \"bg\"; mouse_events: 0;\n"
|
||||
"description { state: \"default\" 0.0;\n"
|
||||
"aspect: %1.9f %1.9f; aspect_preference: BOTH;\n"
|
||||
"image { normal: \"%s\"; }\n"
|
||||
"} } } } }\n"
|
||||
, fstrip, enc, w, h, (double)w / (double)h, (double)w / (double)h, fstrip);
|
||||
break;
|
||||
case IMPORT_SCALE_ASPECT_OUT:
|
||||
fprintf(f,
|
||||
"images { image: \"%s\" %s; }\n"
|
||||
"collections {\n"
|
||||
"group { name: \"desktop/background\";\n"
|
||||
"max: %i %i;\n"
|
||||
"parts { part { name: \"bg\"; mouse_events: 0;\n"
|
||||
"description { state: \"default\" 0.0;\n"
|
||||
"aspect: %1.9f %1.9f; aspect_preference: NONE;\n"
|
||||
"image { normal: \"%s\"; }\n"
|
||||
"} } } } }\n"
|
||||
, fstrip, enc, w, h, (double)w / (double)h, (double)w / (double)h, fstrip);
|
||||
break;
|
||||
default:
|
||||
/* won't happen */
|
||||
break;
|
||||
}
|
||||
|
||||
free(fstrip);
|
||||
|
||||
fclose(f);
|
||||
|
||||
snprintf(cmd, sizeof(cmd), "edje_cc -v %s %s %s",
|
||||
|
|
Loading…
Reference in New Issue