forked from enlightenment/enlightenment
parent
0410c64a87
commit
5546f4109d
354
src/bin/e_bg.c
354
src/bin/e_bg.c
|
@ -14,13 +14,14 @@ static E_Fm2_Mime_Handler *bg_hdl = NULL;
|
||||||
|
|
||||||
struct _E_Bg_Image_Import_Handle
|
struct _E_Bg_Image_Import_Handle
|
||||||
{
|
{
|
||||||
struct {
|
struct
|
||||||
void (*func)(void *data, const char *edje_file);
|
{
|
||||||
|
void (*func)(void *data, const char *edje_file);
|
||||||
void *data;
|
void *data;
|
||||||
} cb;
|
} cb;
|
||||||
E_Dialog *dia;
|
E_Dialog *dia;
|
||||||
E_Util_Image_Import_Handle *importer;
|
E_Util_Image_Import_Handle *importer;
|
||||||
Eina_Bool canceled:1;
|
Eina_Bool canceled : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* externally accessible functions */
|
/* externally accessible functions */
|
||||||
|
@ -32,14 +33,14 @@ e_bg_init(void)
|
||||||
|
|
||||||
/* Register mime handler */
|
/* Register mime handler */
|
||||||
bg_hdl = e_fm2_mime_handler_new(_("Set As Background"),
|
bg_hdl = e_fm2_mime_handler_new(_("Set As Background"),
|
||||||
"preferences-desktop-wallpaper",
|
"preferences-desktop-wallpaper",
|
||||||
e_bg_handler_set, NULL,
|
e_bg_handler_set, NULL,
|
||||||
e_bg_handler_test, NULL);
|
e_bg_handler_test, NULL);
|
||||||
if (bg_hdl)
|
if (bg_hdl)
|
||||||
{
|
{
|
||||||
e_fm2_mime_handler_glob_add(bg_hdl, "*.edj");
|
e_fm2_mime_handler_glob_add(bg_hdl, "*.edj");
|
||||||
e_fm2_mime_handler_mime_add(bg_hdl, "image/png");
|
e_fm2_mime_handler_mime_add(bg_hdl, "image/png");
|
||||||
e_fm2_mime_handler_mime_add(bg_hdl, "image/jpeg");
|
e_fm2_mime_handler_mime_add(bg_hdl, "image/jpeg");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Register files in use */
|
/* Register files in use */
|
||||||
|
@ -48,8 +49,8 @@ e_bg_init(void)
|
||||||
|
|
||||||
EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
|
EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
|
||||||
{
|
{
|
||||||
if (!cfbg) continue;
|
if (!cfbg) continue;
|
||||||
e_filereg_register(cfbg->file);
|
e_filereg_register(cfbg->file);
|
||||||
}
|
}
|
||||||
|
|
||||||
E_EVENT_BG_UPDATE = ecore_event_type_new();
|
E_EVENT_BG_UPDATE = ecore_event_type_new();
|
||||||
|
@ -65,8 +66,8 @@ e_bg_shutdown(void)
|
||||||
/* Deregister mime handler */
|
/* Deregister mime handler */
|
||||||
if (bg_hdl)
|
if (bg_hdl)
|
||||||
{
|
{
|
||||||
e_fm2_mime_handler_glob_del(bg_hdl, "*.edj");
|
e_fm2_mime_handler_glob_del(bg_hdl, "*.edj");
|
||||||
e_fm2_mime_handler_free(bg_hdl);
|
e_fm2_mime_handler_free(bg_hdl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Deregister files in use */
|
/* Deregister files in use */
|
||||||
|
@ -75,8 +76,8 @@ e_bg_shutdown(void)
|
||||||
|
|
||||||
EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
|
EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
|
||||||
{
|
{
|
||||||
if (!cfbg) continue;
|
if (!cfbg) continue;
|
||||||
e_filereg_deregister(cfbg->file);
|
e_filereg_deregister(cfbg->file);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -99,33 +100,37 @@ e_bg_config_get(int container_num, int zone_num, int desk_x, int desk_y)
|
||||||
/* look for desk specific background. */
|
/* look for desk specific background. */
|
||||||
if (container_num >= 0 || zone_num >= 0 || desk_x >= 0 || desk_y >= 0)
|
if (container_num >= 0 || zone_num >= 0 || desk_x >= 0 || desk_y >= 0)
|
||||||
{
|
{
|
||||||
EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
|
EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
|
||||||
{
|
{
|
||||||
int spec;
|
int spec;
|
||||||
|
|
||||||
if (!cfbg) continue;
|
if (!cfbg) continue;
|
||||||
spec = 0;
|
spec = 0;
|
||||||
if (cfbg->container == container_num) spec++;
|
if (cfbg->container == container_num) spec++;
|
||||||
else if (cfbg->container >= 0) continue;
|
else if (cfbg->container >= 0)
|
||||||
if (cfbg->zone == zone_num) spec++;
|
continue;
|
||||||
else if (cfbg->zone >= 0) continue;
|
if (cfbg->zone == zone_num) spec++;
|
||||||
if (cfbg->desk_x == desk_x) spec++;
|
else if (cfbg->zone >= 0)
|
||||||
else if (cfbg->desk_x >= 0) continue;
|
continue;
|
||||||
if (cfbg->desk_y == desk_y) spec++;
|
if (cfbg->desk_x == desk_x) spec++;
|
||||||
else if (cfbg->desk_y >= 0) continue;
|
else if (cfbg->desk_x >= 0)
|
||||||
|
continue;
|
||||||
|
if (cfbg->desk_y == desk_y) spec++;
|
||||||
|
else if (cfbg->desk_y >= 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (spec <= current_spec) continue;
|
if (spec <= current_spec) continue;
|
||||||
bgfile = cfbg->file;
|
bgfile = cfbg->file;
|
||||||
if (bgfile)
|
if (bgfile)
|
||||||
{
|
{
|
||||||
if (bgfile[0] != '/')
|
if (bgfile[0] != '/')
|
||||||
{
|
{
|
||||||
const char *bf;
|
const char *bf;
|
||||||
|
|
||||||
bf = e_path_find(path_backgrounds, bgfile);
|
bf = e_path_find(path_backgrounds, bgfile);
|
||||||
if (bf) bgfile = bf;
|
if (bf) bgfile = bf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (eina_str_has_extension(bgfile, ".edj"))
|
if (eina_str_has_extension(bgfile, ".edj"))
|
||||||
{
|
{
|
||||||
entries = edje_file_collection_list(bgfile);
|
entries = edje_file_collection_list(bgfile);
|
||||||
|
@ -147,7 +152,7 @@ e_bg_config_get(int container_num, int zone_num, int desk_x, int desk_y)
|
||||||
bg = cfbg;
|
bg = cfbg;
|
||||||
current_spec = spec;
|
current_spec = spec;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return bg;
|
return bg;
|
||||||
}
|
}
|
||||||
|
@ -166,31 +171,31 @@ e_bg_file_get(int container_num, int zone_num, int desk_x, int desk_y)
|
||||||
/* fall back to default */
|
/* fall back to default */
|
||||||
if (cfbg)
|
if (cfbg)
|
||||||
{
|
{
|
||||||
bgfile = cfbg->file;
|
bgfile = cfbg->file;
|
||||||
if (bgfile)
|
if (bgfile)
|
||||||
{
|
{
|
||||||
if (bgfile[0] != '/')
|
if (bgfile[0] != '/')
|
||||||
{
|
{
|
||||||
const char *bf;
|
const char *bf;
|
||||||
|
|
||||||
bf = e_path_find(path_backgrounds, bgfile);
|
bf = e_path_find(path_backgrounds, bgfile);
|
||||||
if (bf) bgfile = bf;
|
if (bf) bgfile = bf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bgfile = e_config->desktop_default_background;
|
bgfile = e_config->desktop_default_background;
|
||||||
if (bgfile)
|
if (bgfile)
|
||||||
{
|
{
|
||||||
if (bgfile[0] != '/')
|
if (bgfile[0] != '/')
|
||||||
{
|
{
|
||||||
const char *bf;
|
const char *bf;
|
||||||
|
|
||||||
bf = e_path_find(path_backgrounds, bgfile);
|
bf = e_path_find(path_backgrounds, bgfile);
|
||||||
if (bf) bgfile = bf;
|
if (bf) bgfile = bf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bgfile && eina_str_has_extension(bgfile, ".edj"))
|
if (bgfile && eina_str_has_extension(bgfile, ".edj"))
|
||||||
{
|
{
|
||||||
entries = edje_file_collection_list(bgfile);
|
entries = edje_file_collection_list(bgfile);
|
||||||
|
@ -207,10 +212,11 @@ e_bg_file_get(int container_num, int zone_num, int desk_x, int desk_y)
|
||||||
edje_file_collection_list_free(entries);
|
edje_file_collection_list_free(entries);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((bgfile) && (bgfile[0])) ok = 1;
|
else if ((bgfile) && (bgfile[0]))
|
||||||
if (!ok)
|
ok = 1;
|
||||||
bgfile = e_theme_edje_file_get("base/theme/background",
|
if (!ok)
|
||||||
"e/desktop/background");
|
bgfile = e_theme_edje_file_get("base/theme/background",
|
||||||
|
"e/desktop/background");
|
||||||
}
|
}
|
||||||
|
|
||||||
return bgfile;
|
return bgfile;
|
||||||
|
@ -225,8 +231,10 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
|
||||||
E_Desk *desk;
|
E_Desk *desk;
|
||||||
|
|
||||||
if (transition == E_BG_TRANSITION_START) trans = e_config->transition_start;
|
if (transition == E_BG_TRANSITION_START) trans = e_config->transition_start;
|
||||||
else if (transition == E_BG_TRANSITION_DESK) trans = e_config->transition_desk;
|
else if (transition == E_BG_TRANSITION_DESK)
|
||||||
else if (transition == E_BG_TRANSITION_CHANGE) trans = e_config->transition_change;
|
trans = e_config->transition_desk;
|
||||||
|
else if (transition == E_BG_TRANSITION_CHANGE)
|
||||||
|
trans = e_config->transition_change;
|
||||||
if ((!trans) || (!trans[0])) transition = E_BG_TRANSITION_NONE;
|
if ((!trans) || (!trans[0])) transition = E_BG_TRANSITION_NONE;
|
||||||
|
|
||||||
desk = e_desk_current_get(zone);
|
desk = e_desk_current_get(zone);
|
||||||
|
@ -237,46 +245,46 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
|
||||||
|
|
||||||
if (zone->bg_object)
|
if (zone->bg_object)
|
||||||
{
|
{
|
||||||
const char *pfile = "";
|
const char *pfile = "";
|
||||||
|
|
||||||
edje_object_file_get(zone->bg_object, &pfile, NULL);
|
edje_object_file_get(zone->bg_object, &pfile, NULL);
|
||||||
if (!e_util_strcmp(pfile, bgfile)) return;
|
if (!e_util_strcmp(pfile, bgfile)) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transition == E_BG_TRANSITION_NONE)
|
if (transition == E_BG_TRANSITION_NONE)
|
||||||
{
|
{
|
||||||
if (zone->bg_object)
|
if (zone->bg_object)
|
||||||
{
|
{
|
||||||
evas_object_del(zone->bg_object);
|
evas_object_del(zone->bg_object);
|
||||||
zone->bg_object = NULL;
|
zone->bg_object = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
|
|
||||||
if (zone->bg_object)
|
if (zone->bg_object)
|
||||||
{
|
{
|
||||||
if (zone->prev_bg_object)
|
if (zone->prev_bg_object)
|
||||||
evas_object_del(zone->prev_bg_object);
|
evas_object_del(zone->prev_bg_object);
|
||||||
zone->prev_bg_object = zone->bg_object;
|
zone->prev_bg_object = zone->bg_object;
|
||||||
if (zone->transition_object)
|
if (zone->transition_object)
|
||||||
evas_object_del(zone->transition_object);
|
evas_object_del(zone->transition_object);
|
||||||
zone->transition_object = NULL;
|
zone->transition_object = NULL;
|
||||||
zone->bg_object = NULL;
|
zone->bg_object = NULL;
|
||||||
}
|
}
|
||||||
o = edje_object_add(zone->container->bg_evas);
|
o = edje_object_add(zone->container->bg_evas);
|
||||||
zone->transition_object = o;
|
zone->transition_object = o;
|
||||||
/* FIXME: segv if zone is deleted while up??? */
|
/* FIXME: segv if zone is deleted while up??? */
|
||||||
evas_object_data_set(o, "e_zone", zone);
|
evas_object_data_set(o, "e_zone", zone);
|
||||||
snprintf(buf, sizeof(buf), "e/transitions/%s", trans);
|
snprintf(buf, sizeof(buf), "e/transitions/%s", trans);
|
||||||
e_theme_edje_object_set(o, "base/theme/transitions", buf);
|
e_theme_edje_object_set(o, "base/theme/transitions", buf);
|
||||||
edje_object_signal_callback_add(o, "e,state,done", "*", _e_bg_signal, zone);
|
edje_object_signal_callback_add(o, "e,state,done", "*", _e_bg_signal, zone);
|
||||||
evas_object_move(o, zone->x, zone->y);
|
evas_object_move(o, zone->x, zone->y);
|
||||||
evas_object_resize(o, zone->w, zone->h);
|
evas_object_resize(o, zone->w, zone->h);
|
||||||
evas_object_layer_set(o, -1);
|
evas_object_layer_set(o, -1);
|
||||||
evas_object_clip_set(o, zone->bg_clip_object);
|
evas_object_clip_set(o, zone->bg_clip_object);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
}
|
}
|
||||||
if (eina_str_has_extension(bgfile, ".edj"))
|
if (eina_str_has_extension(bgfile, ".edj"))
|
||||||
{
|
{
|
||||||
|
@ -294,24 +302,24 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
|
||||||
zone->bg_object = o;
|
zone->bg_object = o;
|
||||||
if (transition == E_BG_TRANSITION_NONE)
|
if (transition == E_BG_TRANSITION_NONE)
|
||||||
{
|
{
|
||||||
evas_object_move(o, zone->x, zone->y);
|
evas_object_move(o, zone->x, zone->y);
|
||||||
evas_object_resize(o, zone->w, zone->h);
|
evas_object_resize(o, zone->w, zone->h);
|
||||||
evas_object_layer_set(o, -1);
|
evas_object_layer_set(o, -1);
|
||||||
}
|
}
|
||||||
evas_object_clip_set(o, zone->bg_clip_object);
|
evas_object_clip_set(o, zone->bg_clip_object);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
if (transition != E_BG_TRANSITION_NONE)
|
if (transition != E_BG_TRANSITION_NONE)
|
||||||
{
|
{
|
||||||
edje_extern_object_max_size_set(zone->prev_bg_object, 65536, 65536);
|
edje_extern_object_max_size_set(zone->prev_bg_object, 65536, 65536);
|
||||||
edje_extern_object_min_size_set(zone->prev_bg_object, 0, 0);
|
edje_extern_object_min_size_set(zone->prev_bg_object, 0, 0);
|
||||||
edje_object_part_swallow(zone->transition_object, "e.swallow.bg.old",
|
edje_object_part_swallow(zone->transition_object, "e.swallow.bg.old",
|
||||||
zone->prev_bg_object);
|
zone->prev_bg_object);
|
||||||
edje_extern_object_max_size_set(zone->bg_object, 65536, 65536);
|
edje_extern_object_max_size_set(zone->bg_object, 65536, 65536);
|
||||||
edje_extern_object_min_size_set(zone->bg_object, 0, 0);
|
edje_extern_object_min_size_set(zone->bg_object, 0, 0);
|
||||||
edje_object_part_swallow(zone->transition_object, "e.swallow.bg.new",
|
edje_object_part_swallow(zone->transition_object, "e.swallow.bg.new",
|
||||||
zone->bg_object);
|
zone->bg_object);
|
||||||
edje_object_signal_emit(zone->transition_object, "e,action,start", "e");
|
edje_object_signal_emit(zone->transition_object, "e,action,start", "e");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,20 +334,20 @@ e_bg_default_set(const char *file)
|
||||||
|
|
||||||
if (!changed)
|
if (!changed)
|
||||||
{
|
{
|
||||||
eina_stringshare_del(file);
|
eina_stringshare_del(file);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e_config->desktop_default_background)
|
if (e_config->desktop_default_background)
|
||||||
{
|
{
|
||||||
e_filereg_deregister(e_config->desktop_default_background);
|
e_filereg_deregister(e_config->desktop_default_background);
|
||||||
eina_stringshare_del(e_config->desktop_default_background);
|
eina_stringshare_del(e_config->desktop_default_background);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
e_filereg_register(file);
|
e_filereg_register(file);
|
||||||
e_config->desktop_default_background = file;
|
e_config->desktop_default_background = file;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
e_config->desktop_default_background = NULL;
|
e_config->desktop_default_background = NULL;
|
||||||
|
@ -363,16 +371,16 @@ e_bg_add(int container, int zone, int desk_x, int desk_y, const char *file)
|
||||||
|
|
||||||
EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
|
EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
|
||||||
{
|
{
|
||||||
if ((cfbg) &&
|
if ((cfbg) &&
|
||||||
(cfbg->container == container) &&
|
(cfbg->container == container) &&
|
||||||
(cfbg->zone == zone) &&
|
(cfbg->zone == zone) &&
|
||||||
(cfbg->desk_x == desk_x) &&
|
(cfbg->desk_x == desk_x) &&
|
||||||
(cfbg->desk_y == desk_y) &&
|
(cfbg->desk_y == desk_y) &&
|
||||||
(cfbg->file == file))
|
(cfbg->file == file))
|
||||||
{
|
{
|
||||||
eina_stringshare_del(file);
|
eina_stringshare_del(file);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
e_bg_del(container, zone, desk_x, desk_y);
|
e_bg_del(container, zone, desk_x, desk_y);
|
||||||
|
@ -403,16 +411,16 @@ e_bg_del(int container, int zone, int desk_x, int desk_y)
|
||||||
|
|
||||||
EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
|
EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
|
||||||
{
|
{
|
||||||
if (!cfbg) continue;
|
if (!cfbg) continue;
|
||||||
if ((cfbg->container == container) && (cfbg->zone == zone) &&
|
if ((cfbg->container == container) && (cfbg->zone == zone) &&
|
||||||
(cfbg->desk_x == desk_x) && (cfbg->desk_y == desk_y))
|
(cfbg->desk_x == desk_x) && (cfbg->desk_y == desk_y))
|
||||||
{
|
{
|
||||||
e_config->desktop_backgrounds = eina_list_remove_list(e_config->desktop_backgrounds, l);
|
e_config->desktop_backgrounds = eina_list_remove_list(e_config->desktop_backgrounds, l);
|
||||||
e_filereg_deregister(cfbg->file);
|
e_filereg_deregister(cfbg->file);
|
||||||
if (cfbg->file) eina_stringshare_del(cfbg->file);
|
if (cfbg->file) eina_stringshare_del(cfbg->file);
|
||||||
free(cfbg);
|
free(cfbg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ev = E_NEW(E_Event_Bg_Update, 1);
|
ev = E_NEW(E_Event_Bg_Update, 1);
|
||||||
|
@ -433,13 +441,13 @@ e_bg_update(void)
|
||||||
|
|
||||||
EINA_LIST_FOREACH(e_manager_list(), l, man)
|
EINA_LIST_FOREACH(e_manager_list(), l, man)
|
||||||
{
|
{
|
||||||
EINA_LIST_FOREACH(man->containers, ll, con)
|
EINA_LIST_FOREACH(man->containers, ll, con)
|
||||||
{
|
{
|
||||||
EINA_LIST_FOREACH(con->zones, lll, zone)
|
EINA_LIST_FOREACH(con->zones, lll, zone)
|
||||||
{
|
{
|
||||||
e_zone_bg_reconfigure(zone);
|
e_zone_bg_reconfigure(zone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,11 +509,11 @@ e_bg_image_import(const char *image_file, void (*cb)(void *data, const char *edj
|
||||||
handle->cb.data = (void *)data;
|
handle->cb.data = (void *)data;
|
||||||
|
|
||||||
handle->dia = e_util_image_import_settings_new
|
handle->dia = e_util_image_import_settings_new
|
||||||
(image_file, _e_bg_image_import_dialog_done, handle);
|
(image_file, _e_bg_image_import_dialog_done, handle);
|
||||||
if (!handle->dia)
|
if (!handle->dia)
|
||||||
{
|
{
|
||||||
free(handle);
|
free(handle);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
e_dialog_show(handle->dia);
|
e_dialog_show(handle->dia);
|
||||||
|
|
||||||
|
@ -527,18 +535,18 @@ e_bg_image_import_cancel(E_Bg_Image_Import_Handle *handle)
|
||||||
|
|
||||||
if (handle->cb.func)
|
if (handle->cb.func)
|
||||||
{
|
{
|
||||||
handle->cb.func(handle->cb.data, NULL);
|
handle->cb.func(handle->cb.data, NULL);
|
||||||
handle->cb.func = NULL;
|
handle->cb.func = NULL;
|
||||||
}
|
}
|
||||||
if (handle->dia)
|
if (handle->dia)
|
||||||
{
|
{
|
||||||
e_object_del(E_OBJECT(handle->dia));
|
e_object_del(E_OBJECT(handle->dia));
|
||||||
handle->dia = NULL;
|
handle->dia = NULL;
|
||||||
}
|
}
|
||||||
else if (handle->importer)
|
else if (handle->importer)
|
||||||
{
|
{
|
||||||
e_util_image_import_cancel(handle->importer);
|
e_util_image_import_cancel(handle->importer);
|
||||||
handle->importer = NULL;
|
handle->importer = NULL;
|
||||||
}
|
}
|
||||||
E_FREE(handle);
|
E_FREE(handle);
|
||||||
}
|
}
|
||||||
|
@ -556,19 +564,19 @@ e_bg_handler_set(Evas_Object *obj __UNUSED__, const char *path, void *data __UNU
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
int copy = 1;
|
int copy = 1;
|
||||||
|
|
||||||
E_Container *con = e_container_current_get(e_manager_current_get());
|
E_Container *con = e_container_current_get(e_manager_current_get());
|
||||||
E_Zone *zone = e_zone_current_get(con);
|
E_Zone *zone = e_zone_current_get(con);
|
||||||
E_Desk *desk = e_desk_current_get(zone);
|
E_Desk *desk = e_desk_current_get(zone);
|
||||||
|
|
||||||
/* if not in system dir or user dir, copy to user dir */
|
/* if not in system dir or user dir, copy to user dir */
|
||||||
e_prefix_data_concat_static(buf, "data/backgrounds");
|
e_prefix_data_concat_static(buf, "data/backgrounds");
|
||||||
if (!strncmp(buf, path, strlen(buf)))
|
if (!strncmp(buf, path, strlen(buf)))
|
||||||
copy = 0;
|
copy = 0;
|
||||||
if (copy)
|
if (copy)
|
||||||
{
|
{
|
||||||
e_user_dir_concat_static(buf, "backgrounds");
|
e_user_dir_concat_static(buf, "backgrounds");
|
||||||
if (!strncmp(buf, path, strlen(buf)))
|
if (!strncmp(buf, path, strlen(buf)))
|
||||||
copy = 0;
|
copy = 0;
|
||||||
}
|
}
|
||||||
if (copy)
|
if (copy)
|
||||||
{
|
{
|
||||||
|
@ -587,10 +595,10 @@ e_bg_handler_set(Evas_Object *obj __UNUSED__, const char *path, void *data __UNU
|
||||||
e_bg_add(con->num, zone->num, desk->x, desk->y, buf);
|
e_bg_add(con->num, zone->num, desk->x, desk->y, buf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
e_bg_add(con->num, zone->num, desk->x, desk->y, path);
|
e_bg_add(con->num, zone->num, desk->x, desk->y, path);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
e_bg_add(con->num, zone->num, desk->x, desk->y, path);
|
e_bg_add(con->num, zone->num, desk->x, desk->y, path);
|
||||||
|
|
||||||
e_bg_update();
|
e_bg_update();
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
|
@ -615,13 +623,12 @@ e_bg_handler_set(Evas_Object *obj __UNUSED__, const char *path, void *data __UNU
|
||||||
EAPI int
|
EAPI int
|
||||||
e_bg_handler_test(Evas_Object *obj __UNUSED__, const char *path, void *data __UNUSED__)
|
e_bg_handler_test(Evas_Object *obj __UNUSED__, const char *path, void *data __UNUSED__)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!path) return 0;
|
if (!path) return 0;
|
||||||
|
|
||||||
if (_e_bg_file_edje_check(path))
|
if (_e_bg_file_edje_check(path))
|
||||||
{
|
{
|
||||||
if (edje_file_group_exists(path, "e/desktop/background")) return 1;
|
if (edje_file_group_exists(path, "e/desktop/background")) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* it's image/png or image/jpeg, we'll import it. */
|
/* it's image/png or image/jpeg, we'll import it. */
|
||||||
|
@ -636,13 +643,13 @@ _e_bg_signal(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNU
|
||||||
|
|
||||||
if (zone->prev_bg_object)
|
if (zone->prev_bg_object)
|
||||||
{
|
{
|
||||||
evas_object_del(zone->prev_bg_object);
|
evas_object_del(zone->prev_bg_object);
|
||||||
zone->prev_bg_object = NULL;
|
zone->prev_bg_object = NULL;
|
||||||
}
|
}
|
||||||
if (zone->transition_object)
|
if (zone->transition_object)
|
||||||
{
|
{
|
||||||
evas_object_del(zone->transition_object);
|
evas_object_del(zone->transition_object);
|
||||||
zone->transition_object = NULL;
|
zone->transition_object = NULL;
|
||||||
}
|
}
|
||||||
evas_object_move(zone->bg_object, zone->x, zone->y);
|
evas_object_move(zone->bg_object, zone->x, zone->y);
|
||||||
evas_object_resize(zone->bg_object, zone->w, zone->h);
|
evas_object_resize(zone->bg_object, zone->w, zone->h);
|
||||||
|
@ -684,17 +691,17 @@ _e_bg_image_import_dialog_done(void *data, const char *path, Eina_Bool ok, Eina_
|
||||||
snprintf(buf + off, sizeof(buf) - off, "-%u.edj", num);
|
snprintf(buf + off, sizeof(buf) - off, "-%u.edj", num);
|
||||||
|
|
||||||
handle->importer = e_util_image_import
|
handle->importer = e_util_image_import
|
||||||
(path, buf, "e/desktop/background", external, quality, mode,
|
(path, buf, "e/desktop/background", external, quality, mode,
|
||||||
_e_bg_image_import_done, handle);
|
_e_bg_image_import_done, handle);
|
||||||
if (!handle->importer) goto aborted;
|
if (!handle->importer) goto aborted;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
aborted:
|
aborted:
|
||||||
if (handle->cb.func)
|
if (handle->cb.func)
|
||||||
{
|
{
|
||||||
handle->cb.func(handle->cb.data, NULL);
|
handle->cb.func(handle->cb.data, NULL);
|
||||||
handle->cb.func = NULL;
|
handle->cb.func = NULL;
|
||||||
}
|
}
|
||||||
if (!handle->canceled) E_FREE(handle);
|
if (!handle->canceled) E_FREE(handle);
|
||||||
}
|
}
|
||||||
|
@ -708,8 +715,8 @@ _e_bg_image_import_done(void *data, Eina_Bool ok, const char *image_path __UNUSE
|
||||||
|
|
||||||
if (handle->cb.func)
|
if (handle->cb.func)
|
||||||
{
|
{
|
||||||
handle->cb.func(handle->cb.data, edje_path);
|
handle->cb.func(handle->cb.data, edje_path);
|
||||||
handle->cb.func = NULL;
|
handle->cb.func = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!handle->canceled) E_FREE(handle);
|
if (!handle->canceled) E_FREE(handle);
|
||||||
|
@ -728,3 +735,4 @@ _e_bg_handler_image_imported(void *data __UNUSED__, const char *image_path)
|
||||||
e_bg_update();
|
e_bg_update();
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue