wallpaper2: Update wallpaper2 module to work again with Enlightenment

Elementary changes

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2015-01-13 13:41:33 -05:00
parent 968c123fdc
commit 4e9444e1eb
1 changed files with 37 additions and 48 deletions

View File

@ -15,7 +15,8 @@ typedef struct _Item Item;
struct _Info
{
E_Win *win;
Evas *evas;
Evas_Object *win;
Evas_Object *bg, *preview, *mini, *button, *box, *sframe, *span;
Eina_Stringshare *bg_file;
int iw, ih;
@ -954,20 +955,6 @@ _pan_file_add(Evas_Object *obj, const char *file, Eina_Bool remote, Eina_Bool th
////////
static void
_resize(E_Win *wn)
{
Info *info = wn->data;
evas_object_resize(info->bg, wn->w, wn->h);
}
static void
_delete(E_Win *wn EINA_UNUSED)
{
e_object_del(E_OBJECT(global_info->win));
}
static void
_bg_clicked(void *data, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
{
@ -1117,7 +1104,7 @@ Info *
wp_browser_new(E_Comp *comp)
{
Info *info;
E_Win *win;
Evas_Object *win;
E_Zone *zone;
E_Desk *desk;
const E_Config_Desktop_Background *cfbg;
@ -1156,49 +1143,48 @@ wp_browser_new(E_Comp *comp)
info->iw = (120 * e_scale);
info->ih = (zone->h * info->iw) / (zone->w);
win = e_win_new(comp);
win = e_elm_win_add(NULL, NULL, ELM_WIN_BASIC);
if (!win)
{
eina_stringshare_del(info->bg_file);
free(info);
return NULL;
}
info->evas = evas_object_evas_get(win);
info->win = win;
win->data = info;
e_user_dir_concat_static(buf, "backgrounds");
info->dirs = eina_list_append(info->dirs, strdup(buf));
e_prefix_data_concat_static(buf, "data/backgrounds");
info->dirs = eina_list_append(info->dirs, strdup(buf));
e_win_title_set(win, D_("Wallpaper Settings"));
e_win_name_class_set(win, "E", "_config::appearance/wallpaper2");
e_win_resize_callback_set(win, _resize);
e_win_delete_callback_set(win, _delete);
elm_win_title_set(win, D_("Wallpaper Settings"));
ecore_evas_name_class_set(e_win_ee_get(win), "E", "_config::appearance/wallpaper2");
// bg + manager
info->bg = edje_object_add(info->win->evas);
info->bg = edje_object_add(info->evas);
elm_win_resize_object_add(win, info->bg);
e_theme_edje_object_set(info->bg, "base/theme/widgets",
"e/conf/wallpaper/main/window");
edje_object_signal_callback_add(info->bg, "e,action,click", "e",
_bg_clicked, info);
info->box = e_widget_list_add(info->win->evas, 1, 1);
info->box = e_widget_list_add(info->evas, 1, 1);
// ok button
info->button = e_widget_button_add(info->win->evas, D_("OK"), NULL,
info->button = e_widget_button_add(info->evas, D_("OK"), NULL,
_ok, info, NULL);
evas_object_show(info->button);
e_widget_list_object_append(info->box, info->button, 1, 0, 0.5);
// apply button
info->button = e_widget_button_add(info->win->evas, D_("Apply"), NULL,
info->button = e_widget_button_add(info->evas, D_("Apply"), NULL,
_apply, info, NULL);
evas_object_show(info->button);
e_widget_list_object_append(info->box, info->button, 1, 0, 0.5);
// close button
info->button = e_widget_button_add(info->win->evas, D_("Close"), NULL,
info->button = e_widget_button_add(info->evas, D_("Close"), NULL,
_close, info, NULL);
evas_object_show(info->button);
e_widget_list_object_append(info->box, info->button, 1, 0, 0.5);
@ -1209,7 +1195,7 @@ wp_browser_new(E_Comp *comp)
evas_object_show(info->box);
// preview
info->preview = e_livethumb_add(info->win->evas);
info->preview = e_livethumb_add(info->evas);
e_livethumb_vsize_set(info->preview, zone->w, zone->h);
edje_extern_object_aspect_set(info->preview, EDJE_ASPECT_CONTROL_NEITHER,
zone->w, zone->h);
@ -1230,11 +1216,11 @@ wp_browser_new(E_Comp *comp)
}
// scrolled thumbs
info->span = _pan_add(info->win->evas);
info->span = _pan_add(info->evas);
_pan_info_set(info->span, info);
// the scrollframe holding the scrolled thumbs
info->sframe = e_scrollframe_add(info->win->evas);
info->sframe = e_scrollframe_add(info->evas);
e_scrollframe_custom_theme_set(info->sframe, "base/theme/widgets",
"e/conf/wallpaper/main/scrollframe");
e_scrollframe_extern_pan_set(info->sframe, info->span,
@ -1244,23 +1230,23 @@ wp_browser_new(E_Comp *comp)
evas_object_show(info->sframe);
evas_object_show(info->span);
ob = e_widget_list_add(info->win->evas, 0, 1);
ob = e_widget_list_add(info->evas, 0, 1);
o = e_widget_list_add(info->win->evas, 1, 0);
o = e_widget_list_add(info->evas, 1, 0);
rg = e_widget_radio_group_new(&(info->mode));
o2 = e_widget_radio_add(info->win->evas, D_("All Desktops"), 0, rg);
o2 = e_widget_radio_add(info->evas, D_("All Desktops"), 0, rg);
evas_object_smart_callback_add(o2, "changed", _wp_changed, info);
e_widget_list_object_append(o, o2, 1, 0, 0.5);
e_widget_disabled_set(o2, (e_util_comp_desk_count_get(comp) < 2));
evas_object_show(o2);
o2 = e_widget_radio_add(info->win->evas, D_("This Desktop"), 1, rg);
o2 = e_widget_radio_add(info->evas, D_("This Desktop"), 1, rg);
evas_object_smart_callback_add(o2, "changed", _wp_changed, info);
e_widget_list_object_append(o, o2, 1, 0, 0.5);
evas_object_show(o2);
o2 = e_widget_radio_add(info->win->evas, D_("This Screen"), 2, rg);
o2 = e_widget_radio_add(info->evas, D_("This Screen"), 2, rg);
evas_object_smart_callback_add(o2, "changed", _wp_changed, info);
e_widget_list_object_append(o, o2, 1, 0, 0.5);
if (!(e_util_comp_zone_number_get(0, 1) ||
@ -1271,14 +1257,14 @@ wp_browser_new(E_Comp *comp)
e_widget_list_object_append(ob, o, 1, 0, 0.5);
evas_object_show(o);
o = e_widget_list_add(info->win->evas, 1, 0);
o = e_widget_list_add(info->evas, 1, 0);
o2 = e_widget_button_add(info->win->evas, D_("Add"), NULL,
o2 = e_widget_button_add(info->evas, D_("Add"), NULL,
_wp_add, info, NULL);
e_widget_list_object_append(o, o2, 1, 0, 0.5);
evas_object_show(o2);
o2 = e_widget_button_add(info->win->evas, D_("Delete"), NULL,
o2 = e_widget_button_add(info->evas, D_("Delete"), NULL,
_wp_delete, info, NULL);
e_widget_list_object_append(o, o2, 1, 0, 0.5);
evas_object_show(o2);
@ -1293,16 +1279,19 @@ wp_browser_new(E_Comp *comp)
// min size calc
edje_object_size_min_calc(info->bg, &mw, &mh);
e_win_size_min_set(win, mw, mh);
evas_object_size_hint_min_set(win, mw, mh);
e_util_win_auto_resize_fill(win);
if ((zone->w / 4) > mw) mw = (zone->w / 4);
if ((zone->h / 4) > mh) mh = (zone->h / 4);
e_win_resize(win, mw, mh);
e_win_centered_set(win, 1);
e_win_show(win);
evas_object_resize(win, mw, mh);
elm_win_center(win, 1, 1);
evas_object_show(info->bg);
evas_object_show(win);
e_win_client_icon_set(win, "preferences-desktop-wallpaper");
evas_object_resize(info->bg, info->win->w, info->win->h);
evas_object_show(info->bg);
evas_object_resize(info->bg, mw, mh);
// add theme bg
_pan_file_add(info->span, NULL, 0, 1);
@ -1329,14 +1318,14 @@ wp_broser_free(Info *info)
}
E_Config_Dialog *
wp_conf_show(E_Comp *comp, const char *params EINA_UNUSED)
wp_conf_show(Evas_Object *parent EINA_UNUSED, const char *params EINA_UNUSED)
{
if (global_info)
{
e_win_show(global_info->win);
e_win_raise(global_info->win);
evas_object_show(global_info->win);
evas_object_raise(global_info->win);
}
global_info = wp_browser_new(comp);
global_info = wp_browser_new(e_comp);
return NULL;
}