centralise all the bg handling in views...

SVN revision: 5720
This commit is contained in:
Carsten Haitzler 2001-11-18 21:28:35 +00:00
parent 63a1f60f6e
commit 7e0be252dc
4 changed files with 62 additions and 42 deletions

View File

@ -205,13 +205,9 @@ e_desktops_init_file_display(E_Desktop *desk)
/* e_strdup(v->dir, e_file_home()); */
sprintf(buf, "%s/desktop/default", e_config_user_dir());
e_strdup(v->dir, buf);
sprintf(buf, "%s/.e_background.bg.db", v->dir);
v->bg = e_background_load(buf);
if (!v->bg)
{
sprintf(buf, "%s/default.bg.db", e_config_get("backgrounds"));
v->bg = e_background_load(buf);
}
e_view_bg_load(v);
e_view_realize(v);
ecore_window_hint_set_borderless(v->win.base);

View File

@ -867,17 +867,10 @@ e_icon_exec(E_Icon *ic)
v->size.w = 400;
v->size.h = 300;
v->options.back_pixmap = 0;
/* Load default bg then handle bg in metadata */
sprintf(buf, "%s/%s/.e_background.bg.db", ic->view->dir, ic->file);
v->bg = e_background_load(buf);
if (!v->bg)
{
sprintf(buf, "%s/view.bg.db", e_config_get("backgrounds"));
v->bg = e_background_load(buf);
}
sprintf(buf, "%s/%s", ic->view->dir, ic->file);
D("new dir >%s<\n", buf);
v->dir = strdup(buf);
e_view_bg_load(v);
e_view_realize(v);
ecore_window_set_title(v->win.base, ic->file);
ecore_window_set_name_class(v->win.base, "FileView", "E");

View File

@ -2215,6 +2215,8 @@ e_view_handle_fs(EfsdEvent *ev)
{
char buf[PATH_MAX];
IF_FREE(v->bg_file);
v->bg_file = efsd_metadata_get_str(ev);
sprintf(buf, "background_reload:%s", v->dir);
ecore_add_event_timer(buf, 0.5, e_view_bg_reload_timeout, 0, v);
}
@ -2231,7 +2233,8 @@ e_view_handle_fs(EfsdEvent *ev)
E_Border *b;
v->geom_get.busy = 0;
e_background_set_size(v->bg, v->size.w, v->size.h);
if (v->bg)
e_background_set_size(v->bg, v->size.w, v->size.h);
if (v->options.back_pixmap) e_view_update(v);
b = e_border_adopt(v->win.base, 1);
b->client.internal = 1;
@ -2265,17 +2268,58 @@ e_view_handle_fs(EfsdEvent *ev)
D_RETURN;
}
static void
e_view_bg_reload_timeout(int val, void *data)
void
e_view_bg_load(E_View *v)
{
E_View *v;
E_Background *bg;
char buf[PATH_MAX];
D_ENTER;
if (!v->bg_file)
{
e_strdup(v->bg_file, "");
}
bg = e_background_load(v->bg_file);
if (!bg)
{
FREE(v->bg_file);
sprintf(buf, "%s/.e_background.bg.db", v->dir);
e_strdup(v->bg, buf);
bg = e_background_load(v->bg_file);
if (!bg)
{
FREE(v->bg_file);
if (v->is_desktop)
sprintf(buf, "%s/default.bg.db", e_config_get("backgrounds"));
else
sprintf(buf, "%s/view.bg.db", e_config_get("backgrounds"));
e_strdup(v->bg, buf);
bg = e_background_load(v->bg_file);
}
}
if (bg)
{
v->bg = bg;
if (v->evas)
{
e_background_realize(v->bg, v->evas);
e_background_set_scroll(v->bg, v->scroll.x, v->scroll.y);
e_background_set_size(v->bg, v->size.w, v->size.h);
}
}
D_RETURN;
}
static void
e_view_bg_reload_timeout(int val, void *data)
{
E_View *v;
D_ENTER;
v = data;
sprintf(buf, "%s/.e_background.bg.db", v->dir);
if (v->bg)
{
int size;
@ -2290,22 +2334,6 @@ e_view_bg_reload_timeout(int val, void *data)
}
e_db_flush();
}
bg = e_background_load(buf);
if (!bg)
{
sprintf(buf, "%s/default.bg.db", e_config_get("backgrounds"));
bg = e_background_load(buf);
}
if (bg)
{
v->bg = bg;
if (v->evas)
{
e_background_realize(v->bg, v->evas);
e_background_set_scroll(v->bg, v->scroll.x, v->scroll.y);
e_background_set_size(v->bg, v->size.w, v->size.h);
}
}
D_RETURN;
}

View File

@ -52,10 +52,6 @@ struct _E_View
struct {
int x, y;
} location;
struct {
EfsdCmdId x, y, w, h;
int busy;
} geom_get;
struct {
/* +-----------------+
* | Wt |
@ -126,12 +122,17 @@ struct _E_View
double x1, x2, y1, y2;
} extents;
struct {
EfsdCmdId x, y, w, h;
int busy;
} geom_get;
EfsdCmdId getbg;
Evas_Object obj_bg;
char *bg_file;
E_Background *bg;
int getbg;
struct {
E_Scrollbar *h, *v;
} scrollbar;
@ -222,6 +223,8 @@ void e_view_realize(E_View *v);
void e_view_update(E_View *v);
void e_view_bg_load(E_View *v);
void e_view_bg_change(E_View *v, char *file);
#endif