Disable 'This Screen' if multiple zones don't exist.

Fix formatting & Whitespace Removal.



SVN revision: 50723
This commit is contained in:
Christopher Michael 2010-07-31 23:08:10 +00:00
parent 1619df704e
commit 298c126c3d
1 changed files with 97 additions and 78 deletions

View File

@ -10,7 +10,6 @@
// need after select on delete an ok/cancel if file or "ok to remove whole online source" if online // need after select on delete an ok/cancel if file or "ok to remove whole online source" if online
// need to make "exchange" wallpapers have a different look // need to make "exchange" wallpapers have a different look
// bug: animated wp doesnt workon first show // bug: animated wp doesnt workon first show
// need to disable "this screen" if multiple containers/zones dont exist
// need to disable "this desktop vs all desktops" if only 1 desk exists // need to disable "this desktop vs all desktops" if only 1 desk exists
// need to be able to "type name to search/filter" // need to be able to "type name to search/filter"
@ -30,9 +29,7 @@ struct _Info
Ecore_Idler *idler; Ecore_Idler *idler;
int scans; int scans;
int con_num, zone_num, desk_x, desk_y; int con_num, zone_num, desk_x, desk_y;
int use_theme_bg; int use_theme_bg;
int mode; int mode;
}; };
@ -101,6 +98,7 @@ static void
_pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) _pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
{ {
Smart_Data *sd = evas_object_smart_data_get(obj); Smart_Data *sd = evas_object_smart_data_get(obj);
if (x) if (x)
{ {
if (sd->w < sd->cw) *x = sd->cw - sd->w; if (sd->w < sd->cw) *x = sd->cw - sd->w;
@ -117,6 +115,7 @@ static void
_pan_child_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) _pan_child_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
{ {
Smart_Data *sd = evas_object_smart_data_get(obj); Smart_Data *sd = evas_object_smart_data_get(obj);
if (w) *w = sd->cw; if (w) *w = sd->cw;
if (h) *h = sd->ch; if (h) *h = sd->ch;
} }
@ -145,11 +144,11 @@ _e_smart_reconfigure_do(void *data)
if (sd->cy < 0) sd->cy = 0; if (sd->cy < 0) sd->cy = 0;
iw = sd->w / 4; iw = sd->w / 4;
if (iw > (120 * e_scale)) iw = 120 * e_scale; if (iw > (120 * e_scale)) iw = (120 * e_scale);
else else
{ {
if (iw < (60 * e_scale)) iw = sd->w / 3; if (iw < (60 * e_scale)) iw = (sd->w / 3);
if (iw < (60 * e_scale)) iw = sd->w / 2; if (iw < (60 * e_scale)) iw = (sd->w / 2);
if (iw < (60 * e_scale)) iw = sd->w; if (iw < (60 * e_scale)) iw = sd->w;
} }
x = 0; x = 0;
@ -224,8 +223,7 @@ _e_smart_reconfigure_do(void *data)
Evas_Coord dx, dy, vw, vh; Evas_Coord dx, dy, vw, vh;
dx = dy = 0; dx = dy = 0;
if ((sd->sx >= 0) && if ((sd->sx >= 0) && (sd->selmove > 0.0)
(sd->selmove > 0.0)
/* && /* &&
((it->x + it->w) > sd->cx) && ((it->x + it->w) > sd->cx) &&
@ -338,21 +336,24 @@ _e_smart_reconfigure_do(void *data)
evas_object_smart_callback_add(it->image, "e_thumb_gen", _thumb_gen, it); evas_object_smart_callback_add(it->image, "e_thumb_gen", _thumb_gen, it);
if (it->theme) if (it->theme)
{ {
const char *f = e_theme_edje_file_get("base/theme/backgrounds", const char *f;
"e/desktop/background");
e_thumb_icon_file_set(it->image, f, "e/desktop/background"); f = e_theme_edje_file_get("base/theme/backgrounds",
"e/desktop/background");
e_thumb_icon_file_set(it->image, f,
"e/desktop/background");
} }
else else
e_thumb_icon_file_set(it->image, it->file, "e/desktop/background"); e_thumb_icon_file_set(it->image, it->file,
e_thumb_icon_size_set(it->image, sd->info->iw, sd->info->ih); "e/desktop/background");
e_thumb_icon_size_set(it->image, sd->info->iw,
sd->info->ih);
evas_object_show(it->image); evas_object_show(it->image);
e_thumb_icon_begin(it->image); e_thumb_icon_begin(it->image);
} }
} }
evas_object_move(it->frame, evas_object_move(it->frame, xx + dx, yy + dy);
xx + dx,
yy + dy);
evas_object_resize(it->frame, it->w, it->h); evas_object_resize(it->frame, it->w, it->h);
evas_object_show(it->frame); evas_object_show(it->frame);
it->visible = EINA_TRUE; it->visible = EINA_TRUE;
@ -422,6 +423,7 @@ static void
_e_smart_reconfigure(Evas_Object *obj) _e_smart_reconfigure(Evas_Object *obj)
{ {
Smart_Data *sd = evas_object_smart_data_get(obj); Smart_Data *sd = evas_object_smart_data_get(obj);
if (sd->idle_enter) return; if (sd->idle_enter) return;
sd->idle_enter = ecore_idle_enterer_before_add(_e_smart_reconfigure_do, obj); sd->idle_enter = ecore_idle_enterer_before_add(_e_smart_reconfigure_do, obj);
} }
@ -430,6 +432,7 @@ static void
_e_smart_add(Evas_Object *obj) _e_smart_add(Evas_Object *obj)
{ {
Smart_Data *sd = calloc(1, sizeof(Smart_Data)); Smart_Data *sd = calloc(1, sizeof(Smart_Data));
if (!sd) return; if (!sd) return;
sd->x = sd->y = sd->w = sd->h = 0; sd->x = sd->y = sd->w = sd->h = 0;
sd->sx = sd->sy = -1; sd->sx = sd->sy = -1;
@ -441,6 +444,7 @@ _e_smart_del(Evas_Object *obj)
{ {
Smart_Data *sd = evas_object_smart_data_get(obj); Smart_Data *sd = evas_object_smart_data_get(obj);
Item *it; Item *it;
if (sd->seltimer) if (sd->seltimer)
ecore_timer_del(sd->seltimer); ecore_timer_del(sd->seltimer);
if (sd->idle_enter) if (sd->idle_enter)
@ -465,6 +469,7 @@ static void
_e_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) _e_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
{ {
Smart_Data *sd = evas_object_smart_data_get(obj); Smart_Data *sd = evas_object_smart_data_get(obj);
sd->x = x; sd->x = x;
sd->y = y; sd->y = y;
_e_smart_reconfigure(obj); _e_smart_reconfigure(obj);
@ -474,6 +479,7 @@ static void
_e_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) _e_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
{ {
Smart_Data *sd = evas_object_smart_data_get(obj); Smart_Data *sd = evas_object_smart_data_get(obj);
sd->w = w; sd->w = w;
sd->h = h; sd->h = h;
_e_smart_reconfigure(obj); _e_smart_reconfigure(obj);
@ -545,10 +551,10 @@ static void
_pan_info_set(Evas_Object *obj, Info *info) _pan_info_set(Evas_Object *obj, Info *info)
{ {
Smart_Data *sd = evas_object_smart_data_get(obj); Smart_Data *sd = evas_object_smart_data_get(obj);
sd->info = info; sd->info = info;
} }
static Eina_Bool static Eina_Bool
_sel_anim(void *data) _sel_anim(void *data)
{ {
@ -558,6 +564,7 @@ _sel_anim(void *data)
double len = 1.0; double len = 1.0;
double p = t / len; double p = t / len;
double d; double d;
if (p > 1.0) p = 1.0; if (p > 1.0) p = 1.0;
if (!sd->selin) if (!sd->selin)
{ {
@ -618,6 +625,7 @@ _sel_timer(void *data)
{ {
Evas_Object *obj = data; Evas_Object *obj = data;
Smart_Data *sd = evas_object_smart_data_get(obj); Smart_Data *sd = evas_object_smart_data_get(obj);
if (!sd->animator) if (!sd->animator)
{ {
sd->seltime = ecore_time_get(); sd->seltime = ecore_time_get();
@ -646,6 +654,7 @@ _pan_hilight(Evas_Object *obj, Item *it)
Eina_List *l; Eina_List *l;
Item *it2; Item *it2;
Smart_Data *sd = evas_object_smart_data_get(obj); Smart_Data *sd = evas_object_smart_data_get(obj);
if (it->hilighted) return; if (it->hilighted) return;
EINA_LIST_FOREACH(sd->items, l, it2) EINA_LIST_FOREACH(sd->items, l, it2)
{ {
@ -668,6 +677,7 @@ static void
_pan_sel(Evas_Object *obj, Item *it) _pan_sel(Evas_Object *obj, Item *it)
{ {
Smart_Data *sd = evas_object_smart_data_get(obj); Smart_Data *sd = evas_object_smart_data_get(obj);
if (sd->selmove > 0.0) return; if (sd->selmove > 0.0) return;
edje_object_signal_emit(it->frame, "e,state,selected", "e"); edje_object_signal_emit(it->frame, "e,state,selected", "e");
evas_object_raise(it->frame); evas_object_raise(it->frame);
@ -686,6 +696,7 @@ _pan_sel(Evas_Object *obj, Item *it)
if (it->file) if (it->file)
{ {
char *name = NULL, *p; char *name = NULL, *p;
sd->info->use_theme_bg = 0; sd->info->use_theme_bg = 0;
sd->info->bg_file = strdup(it->file); sd->info->bg_file = strdup(it->file);
edje_object_file_set(sd->info->mini, sd->info->bg_file, edje_object_file_set(sd->info->mini, sd->info->bg_file,
@ -705,11 +716,12 @@ _pan_sel(Evas_Object *obj, Item *it)
{ {
const char *f = e_theme_edje_file_get("base/theme/backgrounds", const char *f = e_theme_edje_file_get("base/theme/backgrounds",
"e/desktop/background"); "e/desktop/background");
edje_object_file_set(sd->info->mini, f,
"e/desktop/background"); edje_object_file_set(sd->info->mini, f, "e/desktop/background");
sd->info->use_theme_bg = 1; sd->info->use_theme_bg = 1;
sd->info->bg_file = NULL; sd->info->bg_file = NULL;
edje_object_part_text_set(sd->info->bg, "e.text.filename", _("Theme Wallpaper")); edje_object_part_text_set(sd->info->bg, "e.text.filename",
_("Theme Wallpaper"));
} }
evas_object_show(sd->info->mini); evas_object_show(sd->info->mini);
} }
@ -721,6 +733,7 @@ static void
_pan_sel_up(Evas_Object *obj) _pan_sel_up(Evas_Object *obj)
{ {
Smart_Data *sd = evas_object_smart_data_get(obj); Smart_Data *sd = evas_object_smart_data_get(obj);
if (sd->selmove == 0.0) return; if (sd->selmove == 0.0) return;
if (!sd->animator) if (!sd->animator)
{ {
@ -739,6 +752,7 @@ static int
_sort_cb(const void *d1, const void *d2) _sort_cb(const void *d1, const void *d2)
{ {
const Item *it1 = d1, *it2 = d2; const Item *it1 = d1, *it2 = d2;
if ((!it1->sort_id) || (!it2->sort_id)) return 0; if ((!it1->sort_id) || (!it2->sort_id)) return 0;
return strcmp(it1->sort_id, it2->sort_id); return strcmp(it1->sort_id, it2->sort_id);
} }
@ -774,25 +788,24 @@ _item_sort(Item *it)
} }
if (it2) if (it2)
e_scrollframe_child_region_show(sd->info->sframe, e_scrollframe_child_region_show(sd->info->sframe,
it2->x, it2->y, it2->x, it2->y, it2->w, it2->h);
it2->w, it2->h);
sd->jump2hi = 1; sd->jump2hi = 1;
} }
} }
if (sd->info->scans == 0) if (sd->info->scans == 0)
{ edje_object_signal_emit(sd->info->bg, "e,state,busy,off", "e");
edje_object_signal_emit(sd->info->bg, "e,state,busy,off", "e");
}
} }
static void static void
_thumb_gen(void *data, Evas_Object *obj, void *event_info) _thumb_gen(void *data, Evas_Object *obj, void *event_info)
{ {
Item *it = data; Item *it = data;
edje_object_signal_emit(it->frame, "e,action,thumb,gen", "e"); edje_object_signal_emit(it->frame, "e,action,thumb,gen", "e");
if (!it->sort_id) if (!it->sort_id)
{ {
const char *id = e_thumb_sort_id_get(it->image); const char *id = e_thumb_sort_id_get(it->image);
if (id) if (id)
{ {
it->sort_id = strdup(id); it->sort_id = strdup(id);
@ -827,6 +840,7 @@ _item_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
{ {
Evas_Event_Mouse_Up *ev = event_info; Evas_Event_Mouse_Up *ev = event_info;
Item *it = data; Item *it = data;
if (ev->button == 1) if (ev->button == 1)
{ {
if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)) if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
@ -843,6 +857,7 @@ _pan_file_add(Evas_Object *obj, const char *file, Eina_Bool remote, Eina_Bool th
{ {
Smart_Data *sd = evas_object_smart_data_get(obj); Smart_Data *sd = evas_object_smart_data_get(obj);
Item *it = calloc(1, sizeof(Item)); Item *it = calloc(1, sizeof(Item));
if (!it) return; if (!it) return;
sd->items = eina_list_append(sd->items, it); sd->items = eina_list_append(sd->items, it);
it->obj = obj; it->obj = obj;
@ -879,6 +894,7 @@ _pan_file_add(Evas_Object *obj, const char *file, Eina_Bool remote, Eina_Bool th
{ {
const char *f = e_theme_edje_file_get("base/theme/backgrounds", const char *f = e_theme_edje_file_get("base/theme/backgrounds",
"e/desktop/background"); "e/desktop/background");
e_thumb_icon_file_set(it->image, f, "e/desktop/background"); e_thumb_icon_file_set(it->image, f, "e/desktop/background");
} }
else else
@ -895,7 +911,8 @@ _pan_file_add(Evas_Object *obj, const char *file, Eina_Bool remote, Eina_Bool th
if (sd->info->use_theme_bg) if (sd->info->use_theme_bg)
{ {
_pan_hilight(it->obj, it); _pan_hilight(it->obj, it);
edje_object_part_text_set(sd->info->bg, "e.text.filename", _("Theme Wallpaper")); edje_object_part_text_set(sd->info->bg, "e.text.filename",
_("Theme Wallpaper"));
} }
} }
else else
@ -961,6 +978,7 @@ static void
_ok(void *data, void *data2) _ok(void *data, void *data2)
{ {
Info *info = data; Info *info = data;
if (info->mode == 0) if (info->mode == 0)
{ {
/* all desktops */ /* all desktops */
@ -1074,7 +1092,8 @@ _scan(Info *info)
{ {
info->scans = 0; info->scans = 0;
edje_object_signal_emit(info->bg, "e,state,busy,on", "e"); edje_object_signal_emit(info->bg, "e,state,busy,on", "e");
edje_object_part_text_set(info->bg, "e.text.busy_label", _("Loading files...")); edje_object_part_text_set(info->bg, "e.text.busy_label",
_("Loading files..."));
} }
if (info->curdir) free(info->curdir); if (info->curdir) free(info->curdir);
info->curdir = info->dirs->data; info->curdir = info->dirs->data;
@ -1106,14 +1125,13 @@ wp_browser_new(E_Container *con)
info->zone_num = zone->id; info->zone_num = zone->id;
info->desk_x = desk->x; info->desk_x = desk->x;
info->desk_y = desk->y; info->desk_y = desk->y;
info->mode = 0; info->mode = 0;
cfbg = e_bg_config_get(con->num, zone->id, desk->x, desk->y); cfbg = e_bg_config_get(con->num, zone->id, desk->x, desk->y);
if (cfbg) if (cfbg)
{ {
if ((cfbg->container >= 0) && (cfbg->zone >= 0)) if ((cfbg->container >= 0) && (cfbg->zone >= 0))
{ {
if (cfbg->desk_x >= 0 && cfbg->desk_y >= 0) if ((cfbg->desk_x >= 0) && (cfbg->desk_y >= 0))
info->mode = 1; info->mode = 1;
else else
info->mode = 2; info->mode = 2;
@ -1121,15 +1139,11 @@ wp_browser_new(E_Container *con)
info->bg_file = strdup(cfbg->file); info->bg_file = strdup(cfbg->file);
} }
if ((!info->bg_file) && (e_config->desktop_default_background)) if ((!info->bg_file) && (e_config->desktop_default_background))
{ info->bg_file = strdup(e_config->desktop_default_background);
info->bg_file = strdup(e_config->desktop_default_background);
}
else else
{ info->use_theme_bg = 1;
info->use_theme_bg = 1;
}
info->iw = 120 * e_scale; info->iw = (120 * e_scale);
info->ih = (zone->h * info->iw) / (zone->w); info->ih = (zone->h * info->iw) / (zone->w);
win = e_win_new(con); win = e_win_new(con);
@ -1176,7 +1190,8 @@ wp_browser_new(E_Container *con)
// preview // preview
info->preview = e_livethumb_add(info->win->evas); info->preview = e_livethumb_add(info->win->evas);
e_livethumb_vsize_set(info->preview, zone->w, zone->h); 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); edje_extern_object_aspect_set(info->preview, EDJE_ASPECT_CONTROL_NEITHER,
zone->w, zone->h);
edje_object_part_swallow(info->bg, "e.swallow.preview", info->preview); edje_object_part_swallow(info->bg, "e.swallow.preview", info->preview);
evas_object_show(info->preview); evas_object_show(info->preview);
@ -1189,6 +1204,7 @@ wp_browser_new(E_Container *con)
{ {
const char *f = e_theme_edje_file_get("base/theme/backgrounds", const char *f = e_theme_edje_file_get("base/theme/backgrounds",
"e/desktop/background"); "e/desktop/background");
edje_object_file_set(info->mini, f, "e/desktop/background"); edje_object_file_set(info->mini, f, "e/desktop/background");
} }
@ -1225,6 +1241,9 @@ wp_browser_new(E_Container *con)
o2 = e_widget_radio_add(info->win->evas, _("This Screen"), 2, rg); o2 = e_widget_radio_add(info->win->evas, _("This Screen"), 2, rg);
evas_object_smart_callback_add(o2, "changed", _wp_changed, info); evas_object_smart_callback_add(o2, "changed", _wp_changed, info);
e_widget_list_object_append(o, o2, 1, 0, 0.5); e_widget_list_object_append(o, o2, 1, 0, 0.5);
if (!(e_util_container_zone_number_get(0, 1) ||
(e_util_container_zone_number_get(1, 0))))
e_widget_disabled_set(o2, EINA_TRUE);
evas_object_show(o2); evas_object_show(o2);
e_widget_list_object_append(ob, o, 1, 0, 0.5); e_widget_list_object_append(ob, o, 1, 0, 0.5);
@ -1250,7 +1269,6 @@ wp_browser_new(E_Container *con)
edje_object_part_swallow(info->bg, "e.swallow.extras", ob); edje_object_part_swallow(info->bg, "e.swallow.extras", ob);
evas_object_show(ob); evas_object_show(ob);
// min size calc // min size calc
edje_object_size_min_calc(info->bg, &mw, &mh); edje_object_size_min_calc(info->bg, &mw, &mh);
e_win_size_min_set(win, mw, mh); e_win_size_min_set(win, mw, mh);
@ -1274,6 +1292,7 @@ void
wp_broser_free(Info *info) wp_broser_free(Info *info)
{ {
char *s; char *s;
if (!info) return; if (!info) return;
e_object_del(E_OBJECT(info->win)); e_object_del(E_OBJECT(info->win));
if (info->dir) closedir(info->dir); if (info->dir) closedir(info->dir);