ok. another big one. I'll write to e-devel about the details.
SVN revision: 6055
This commit is contained in:
parent
609b356400
commit
31292642c3
|
@ -81,6 +81,7 @@ enlightenment_SOURCES = \
|
|||
e_dir.h e_dir.c \
|
||||
e_view_machine.h e_view_machine.c \
|
||||
view_layout.h view_layout.c \
|
||||
e_view_look.h e_view_look.c \
|
||||
e.h
|
||||
|
||||
enlightenment_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ @efsd_libs@ @ebg_libs@ @ferite_libs@ -lm -lc $(INTLLIBS)
|
||||
|
|
|
@ -1837,7 +1837,7 @@ e_act_max_start(E_Object * object, E_Action * a, void *data, int x, int y,
|
|||
b->current.requested.w = b->current.w;
|
||||
b->current.requested.h = b->current.h;
|
||||
|
||||
e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_UNMAXIMIZE);
|
||||
e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_UNMAXIMIZE, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1857,7 +1857,7 @@ e_act_max_start(E_Object * object, E_Action * a, void *data, int x, int y,
|
|||
b->current.requested.w = b->current.w;
|
||||
b->current.requested.h = b->current.h;
|
||||
|
||||
e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_MAXIMIZE);
|
||||
e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_MAXIMIZE, NULL);
|
||||
}
|
||||
|
||||
D_RETURN;
|
||||
|
|
10
src/border.c
10
src/border.c
|
@ -476,7 +476,7 @@ e_focus_in(Ecore_Event * ev)
|
|||
e_border_focus_grab_ended();
|
||||
b->current.selected = 1;
|
||||
b->changed = 1;
|
||||
e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_FOCUS_IN);
|
||||
e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_FOCUS_IN, NULL);
|
||||
g = b->click_grab;
|
||||
if (g)
|
||||
{
|
||||
|
@ -1272,7 +1272,7 @@ e_border_cleanup(E_Border * b)
|
|||
|
||||
e_match_save_props(b);
|
||||
D("before notify\n");
|
||||
e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_DELETE);
|
||||
e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_DELETE, NULL);
|
||||
D("after notify\n");
|
||||
while (b->menus)
|
||||
{
|
||||
|
@ -1835,7 +1835,7 @@ e_border_new(void)
|
|||
|
||||
borders = evas_list_prepend(borders, b);
|
||||
|
||||
e_observee_notify_all_observers(E_OBSERVEE(b), E_EVENT_BORDER_NEW);
|
||||
e_observee_notify_all_observers(E_OBSERVEE(b), E_EVENT_BORDER_NEW, NULL);
|
||||
|
||||
D_RETURN_(b);
|
||||
}
|
||||
|
@ -1849,7 +1849,7 @@ e_border_iconify(E_Border * b)
|
|||
e_icccm_state_iconified(b->win.client);
|
||||
b->changed = 1;
|
||||
e_border_update(b);
|
||||
e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_ICONIFY);
|
||||
e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_ICONIFY, NULL);
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
@ -1865,7 +1865,7 @@ e_border_uniconify(E_Border * b)
|
|||
e_border_update(b);
|
||||
e_border_raise(b);
|
||||
|
||||
e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_UNICONIFY);
|
||||
e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_UNICONIFY, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -33,7 +33,7 @@ e_delayed_action_new(E_Event_Type event, double delay, E_Delay_Func delay_func)
|
|||
}
|
||||
|
||||
void
|
||||
e_delayed_action_start(E_Observer * obs, E_Observee * obj, E_Event_Type event)
|
||||
e_delayed_action_start(E_Observer * obs, E_Observee * obj, E_Event_Type event, void *data)
|
||||
{
|
||||
char event_name[PATH_MAX];
|
||||
E_Delayed_Action *eda = (E_Delayed_Action *) obs;
|
||||
|
|
|
@ -20,7 +20,7 @@ E_Delayed_Action *e_delayed_action_new(E_Event_Type event,
|
|||
double delay, E_Delay_Func delay_func);
|
||||
|
||||
void e_delayed_action_start(E_Observer * obs, E_Observee * obj,
|
||||
E_Event_Type event);
|
||||
E_Event_Type event, void *data);
|
||||
void e_delayed_action_cancel(E_Delayed_Action * eda);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -205,9 +205,11 @@ e_desktops_init_file_display(E_Desktop * desk)
|
|||
/* e_strdup(v->dir, e_file_home()); */
|
||||
snprintf(buf, PATH_MAX, "%s/desktop/default", e_config_user_dir());
|
||||
|
||||
e_view_set_dir(v, buf, 1);
|
||||
e_view_set_dir(v, buf);
|
||||
v->is_desktop = 1;
|
||||
e_view_realize(v);
|
||||
e_view_populate(v);
|
||||
e_view_set_look(v, NULL);
|
||||
|
||||
ecore_window_hint_set_borderless(v->win.base);
|
||||
ecore_window_hint_set_sticky(v->win.base, 1);
|
||||
|
@ -425,7 +427,7 @@ e_desktops_goto(int d, int ax, int ay)
|
|||
desk->desk.area.y = ay;
|
||||
e_icccm_set_desk_area(0, desk->desk.area.x, desk->desk.area.y);
|
||||
e_icccm_set_desk(0, desk->desk.desk);
|
||||
e_observee_notify_observers(E_OBSERVEE(desk), E_EVENT_DESKTOP_SWITCH);
|
||||
e_observee_notify_observers(E_OBSERVEE(desk), E_EVENT_DESKTOP_SWITCH, NULL);
|
||||
}
|
||||
|
||||
D_RETURN;
|
||||
|
|
251
src/e_dir.c
251
src/e_dir.c
|
@ -17,8 +17,6 @@ static void e_dir_handle_efsd_event_reply_getfiletype(EfsdEvent * ev);
|
|||
static void e_dir_handle_efsd_event_reply_getmeta(EfsdEvent * ev);
|
||||
|
||||
static void e_dir_cleanup(E_Dir * d);
|
||||
static void e_dir_bg_reload_timeout(int val, void *data);
|
||||
static void e_dir_set_default_background(E_Dir * d);
|
||||
|
||||
void
|
||||
e_dir_init(void)
|
||||
|
@ -58,60 +56,14 @@ e_dir_new(void)
|
|||
d = NEW(E_Dir, 1);
|
||||
ZERO(d, E_Dir, 1);
|
||||
d->dir = NULL;
|
||||
d->views = NULL;
|
||||
|
||||
e_object_init(E_OBJECT(d), (E_Cleanup_Func) e_dir_cleanup);
|
||||
e_observee_init(E_OBSERVEE(d),
|
||||
(E_Cleanup_Func) e_dir_cleanup);
|
||||
|
||||
e_view_machine_register_dir(d);
|
||||
D_RETURN_(d);
|
||||
}
|
||||
|
||||
void
|
||||
e_dir_register_view(E_Dir * d, E_View * v)
|
||||
{
|
||||
D_ENTER;
|
||||
v->dir = d;
|
||||
d->views = evas_list_append(d->views, v);
|
||||
/* dont ref the first time */
|
||||
if (d->views->next)
|
||||
e_object_ref(E_OBJECT(v->dir));
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_dir_unregister_view(E_View * v)
|
||||
{
|
||||
D_ENTER;
|
||||
v->dir->views = evas_list_remove(v->dir->views, v);
|
||||
e_object_unref(E_OBJECT(v->dir));
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
static void
|
||||
e_dir_set_default_background(E_Dir * d)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
|
||||
D_ENTER;
|
||||
|
||||
if (!d)
|
||||
D_RETURN;
|
||||
|
||||
IF_FREE(d->bg_file);
|
||||
|
||||
if (d->is_desktop)
|
||||
snprintf(buf, PATH_MAX, "%s/default.bg.db", e_config_get("backgrounds"));
|
||||
else
|
||||
snprintf(buf, PATH_MAX, "%s/view.bg.db", e_config_get("backgrounds"));
|
||||
|
||||
e_strdup(d->bg_file, buf);
|
||||
snprintf(buf, PATH_MAX, "background_reload:%s", d->dir);
|
||||
|
||||
ecore_add_event_timer(buf, 0.5, e_dir_bg_reload_timeout, 0, d);
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
static void
|
||||
e_dir_handle_fs_restart(void *data)
|
||||
{
|
||||
|
@ -147,17 +99,16 @@ e_dir_set_dir(E_Dir * d, char *dir)
|
|||
if (!d)
|
||||
D_RETURN;
|
||||
|
||||
/* stop monitoring old dir */
|
||||
/* stop monitoring old dir */
|
||||
if ((d->dir) && (d->monitor_id))
|
||||
{
|
||||
efsd_stop_monitor(e_fs_get_connection(), d->dir, TRUE);
|
||||
d->monitor_id = 0;
|
||||
}
|
||||
|
||||
IF_FREE(d->dir);
|
||||
d->dir = e_file_realpath(dir);
|
||||
|
||||
/* start monitoring new dir */
|
||||
|
||||
/* start monitoring new dir */
|
||||
d->restarter = e_fs_add_restart_handler(e_dir_handle_fs_restart, d);
|
||||
if (e_fs_get_connection())
|
||||
{
|
||||
|
@ -226,7 +177,6 @@ e_dir_handle_efsd_event_reply_getfiletype(EfsdEvent * ev)
|
|||
{
|
||||
E_File *f;
|
||||
char *file = NULL;
|
||||
Evas_List l;
|
||||
E_Dir *dir;
|
||||
|
||||
char *m, *p;
|
||||
|
@ -245,9 +195,9 @@ e_dir_handle_efsd_event_reply_getfiletype(EfsdEvent * ev)
|
|||
file = e_file_get_file(file);
|
||||
}
|
||||
dir = e_dir_find_by_monitor_id(efsd_event_id(ev));
|
||||
|
||||
f = e_file_get_by_name(dir->files, file);
|
||||
/* if its not in the list we care about, its filetype is meaningless */
|
||||
|
||||
/* if its not in the list we care about, its filetype is meaningless */
|
||||
if (!f)
|
||||
D_RETURN;
|
||||
|
||||
|
@ -266,19 +216,11 @@ e_dir_handle_efsd_event_reply_getfiletype(EfsdEvent * ev)
|
|||
strcpy(mime, "unknown");
|
||||
}
|
||||
e_file_set_mime(f, base, mime);
|
||||
|
||||
for (l = dir->views; l; l = l->next)
|
||||
{
|
||||
E_View *v = (E_View *) l->data;
|
||||
E_Icon *ic = e_icon_find_by_file(v, f->file);
|
||||
|
||||
/* Try to update the GUI.
|
||||
* It's just a try because we need to have the file's stat
|
||||
* info as well. --cK.
|
||||
*/
|
||||
e_icon_update_state(ic);
|
||||
e_icon_initial_show(ic);
|
||||
}
|
||||
/* Try to update the GUI.
|
||||
* It's just a try because we need to have the file's stat
|
||||
* info as well. --cK.
|
||||
*/
|
||||
e_observee_notify_observers(E_OBSERVEE(dir), E_EVENT_FILE_INFO, f);
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
|
@ -287,7 +229,6 @@ e_dir_handle_efsd_event_reply_stat(EfsdEvent * ev)
|
|||
{
|
||||
E_Dir *d;
|
||||
E_File *f;
|
||||
Evas_List l;
|
||||
|
||||
D_ENTER;
|
||||
|
||||
|
@ -308,15 +249,8 @@ e_dir_handle_efsd_event_reply_stat(EfsdEvent * ev)
|
|||
* It's just a try because we need to have received the filetype
|
||||
* info too. --cK. */
|
||||
f->stat = *((struct stat *)efsd_event_data(ev));
|
||||
for (l = d->views; l; l = l->next)
|
||||
{
|
||||
E_View *v = (E_View *) l->data;
|
||||
E_Icon *ic = e_icon_find_by_file(v, f->file);
|
||||
|
||||
e_icon_update_state(ic);
|
||||
e_icon_initial_show(ic);
|
||||
}
|
||||
|
||||
e_observee_notify_observers(E_OBSERVEE(d), E_EVENT_FILE_INFO, f);
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
|
@ -325,7 +259,6 @@ e_dir_handle_efsd_event_reply_readlink(EfsdEvent * ev)
|
|||
{
|
||||
E_Dir *d;
|
||||
E_File *f;
|
||||
Evas_List l;
|
||||
|
||||
D_ENTER;
|
||||
|
||||
|
@ -341,14 +274,7 @@ e_dir_handle_efsd_event_reply_readlink(EfsdEvent * ev)
|
|||
{
|
||||
e_file_set_link(f, (char *)efsd_event_data(ev));
|
||||
}
|
||||
for (l = d->views; l; l = l->next)
|
||||
{
|
||||
E_View *v = (E_View *) l->data;
|
||||
E_Icon *ic = e_icon_find_by_file(v, f->file);
|
||||
|
||||
e_icon_update_state(ic);
|
||||
e_icon_initial_show(ic);
|
||||
}
|
||||
e_observee_notify_observers(E_OBSERVEE(d), E_EVENT_FILE_INFO, f);
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
@ -371,7 +297,7 @@ e_dir_handle_efsd_event_reply_getmeta(EfsdEvent * ev)
|
|||
|
||||
v = l->data;
|
||||
/* ignore metadata for desktops */
|
||||
if (v->dir->is_desktop)
|
||||
if (v->is_desktop)
|
||||
continue;
|
||||
if (v->geom_get.x == cmd)
|
||||
{
|
||||
|
@ -418,27 +344,6 @@ e_dir_handle_efsd_event_reply_getmeta(EfsdEvent * ev)
|
|||
v->size.h = 401;
|
||||
}
|
||||
}
|
||||
/* FIXME currently, the bg info is not set via metadata */
|
||||
/*
|
||||
* else if (v->getbg == cmd)
|
||||
* {
|
||||
* v->getbg = 0;
|
||||
* if (efsd_metadata_get_type(ev) == EFSD_STRING)
|
||||
* {
|
||||
* if (ev->efsd_reply_event.errorcode == 0)
|
||||
* {
|
||||
* char buf[PATH_MAX];
|
||||
*
|
||||
* IF_FREE(v->dir->bg_file);
|
||||
* e_strdup(v->dir->bg_file, efsd_metadata_get_str(ev));
|
||||
* snprintf(buf, PATH_MAX, "background_reload:%s", v->dir->dir);
|
||||
* ecore_add_event_timer(buf, 0.5, e_dir_bg_reload_timeout, 0, v->dir);
|
||||
* }
|
||||
* else
|
||||
* e_dir_set_default_background(v->dir);
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
/* We have received all metadata we need, display the view */
|
||||
if ((!v->geom_get.x) &&
|
||||
(!v->geom_get.y) &&
|
||||
|
@ -515,52 +420,12 @@ e_dir_handle_efsd_event_reply(EfsdEvent * ev)
|
|||
}
|
||||
D_RETURN;
|
||||
}
|
||||
static void
|
||||
e_dir_ib_reload_timeout(int val, void *data)
|
||||
{
|
||||
Evas_List l;
|
||||
E_View *v;
|
||||
E_Dir *d;
|
||||
|
||||
D_ENTER;
|
||||
d = data;
|
||||
|
||||
for (l = d->views; l; l = l->next)
|
||||
{
|
||||
v = (E_View *) l->data;
|
||||
e_view_ib_reload(v);
|
||||
}
|
||||
D_RETURN;
|
||||
UN(val);
|
||||
}
|
||||
|
||||
static void
|
||||
e_dir_bg_reload_timeout(int val, void *data)
|
||||
{
|
||||
Evas_List l;
|
||||
E_View *v;
|
||||
E_Dir *d;
|
||||
|
||||
D_ENTER;
|
||||
d = data;
|
||||
|
||||
for (l = d->views; l; l = l->next)
|
||||
{
|
||||
v = (E_View *) l->data;
|
||||
e_view_bg_reload(v);
|
||||
}
|
||||
D_RETURN;
|
||||
UN(val);
|
||||
}
|
||||
|
||||
void
|
||||
e_dir_file_added(int id, char *file)
|
||||
{
|
||||
Evas_List l;
|
||||
E_Dir *d;
|
||||
E_View *v;
|
||||
E_File *f;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
D_ENTER;
|
||||
|
||||
|
@ -568,31 +433,12 @@ e_dir_file_added(int id, char *file)
|
|||
if (!file || file[0] == '/')
|
||||
D_RETURN;
|
||||
d = e_dir_find_by_monitor_id(id);
|
||||
|
||||
if (!strcmp(file, ".e_background.bg.db"))
|
||||
{
|
||||
IF_FREE(d->bg_file);
|
||||
snprintf(buf, PATH_MAX, "%s/%s", d->dir, file);
|
||||
e_strdup(d->bg_file, buf);
|
||||
snprintf(buf, PATH_MAX, "background_reload:%s", d->dir);
|
||||
ecore_add_event_timer(buf, 0.5, e_dir_bg_reload_timeout, 0, d);
|
||||
}
|
||||
/*else if ((!strcmp(".e_iconbar.db", file)) ||
|
||||
* (!strcmp(".e_iconbar.bits.db", file)))
|
||||
* {
|
||||
* snprintf(buf, PATH_MAX, "iconbar_reload:%s", m->dir);
|
||||
* ecore_add_event_timer(buf, 0.5, e_dir_ib_reload_timeout, 0, m);
|
||||
* } */
|
||||
else if (file[0] != '.')
|
||||
if (file[0] != '.')
|
||||
{
|
||||
f = e_file_new(file);
|
||||
d->files = evas_list_append(d->files, f);
|
||||
/* tell all views for this dir about the new file */
|
||||
for (l = d->views; l; l = l->next)
|
||||
{
|
||||
v = l->data;
|
||||
e_view_file_add(v, f);
|
||||
}
|
||||
e_observee_notify_observers(E_OBSERVEE(d), E_EVENT_FILE_ADD, f);
|
||||
}
|
||||
D_RETURN;
|
||||
}
|
||||
|
@ -600,7 +446,6 @@ e_dir_file_added(int id, char *file)
|
|||
void
|
||||
e_dir_file_deleted(int id, char *file)
|
||||
{
|
||||
Evas_List l;
|
||||
E_File *f;
|
||||
E_Dir *d;
|
||||
|
||||
|
@ -613,29 +458,9 @@ e_dir_file_deleted(int id, char *file)
|
|||
f = e_file_get_by_name(d->files, file);
|
||||
d->files = evas_list_remove(d->files, f);
|
||||
|
||||
if (!strcmp(file, ".e_background.bg.db"))
|
||||
if (file[0] != '.')
|
||||
{
|
||||
e_dir_set_default_background(d);
|
||||
}
|
||||
/*else if ((!strcmp(".e_iconbar.db", file)) ||
|
||||
* (!strcmp(".e_iconbar.bits.db", file)))
|
||||
* {
|
||||
* for (l = m->views; l; l = l->next)
|
||||
* {
|
||||
* E_View *v = (E_View *) l->data;
|
||||
*
|
||||
* e_object_unref(E_OBJECT(v->iconbar));
|
||||
* v->iconbar = NULL;
|
||||
* }
|
||||
* } */
|
||||
else if (file[0] != '.')
|
||||
{
|
||||
for (l = d->views; l; l = l->next)
|
||||
{
|
||||
E_View *v = (E_View *) l->data;
|
||||
|
||||
e_view_file_delete(v, f);
|
||||
}
|
||||
e_observee_notify_observers(E_OBSERVEE(d), E_EVENT_FILE_DELETE, f);
|
||||
}
|
||||
D_RETURN;
|
||||
}
|
||||
|
@ -643,11 +468,8 @@ e_dir_file_deleted(int id, char *file)
|
|||
void
|
||||
e_dir_file_changed(int id, char *file)
|
||||
{
|
||||
Evas_List l;
|
||||
E_Dir *d;
|
||||
E_File *f;
|
||||
E_View *v;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
D_ENTER;
|
||||
|
||||
|
@ -655,27 +477,9 @@ e_dir_file_changed(int id, char *file)
|
|||
D_RETURN;
|
||||
d = e_dir_find_by_monitor_id(id);
|
||||
f = e_file_get_by_name(d->files, file);
|
||||
if (!strcmp(file, ".e_background.bg.db"))
|
||||
if (file[0] != '.')
|
||||
{
|
||||
IF_FREE(d->bg_file);
|
||||
snprintf(buf, PATH_MAX, "%s/%s", d->dir, file);
|
||||
e_strdup(d->bg_file, buf);
|
||||
snprintf(buf, PATH_MAX, "background_reload:%s", d->dir);
|
||||
ecore_add_event_timer(buf, 0.5, e_dir_bg_reload_timeout, 0, d);
|
||||
}
|
||||
else if ((!strcmp(".e_iconbar.db", file)) ||
|
||||
(!strcmp(".e_iconbar.bits.db", file)))
|
||||
{
|
||||
snprintf(buf, PATH_MAX, "iconbar_reload:%s", d->dir);
|
||||
ecore_add_event_timer(buf, 0.5, e_dir_ib_reload_timeout, 0, d);
|
||||
}
|
||||
else if (file[0] != '.')
|
||||
{
|
||||
for (l = d->views; l; l = l->next)
|
||||
{
|
||||
v = l->data;
|
||||
e_view_file_changed(v, f);
|
||||
}
|
||||
e_observee_notify_observers(E_OBSERVEE(d), E_EVENT_FILE_DELETE, f);
|
||||
}
|
||||
D_RETURN;
|
||||
}
|
||||
|
@ -683,7 +487,6 @@ e_dir_file_changed(int id, char *file)
|
|||
void
|
||||
e_dir_file_moved(int id, char *file)
|
||||
{
|
||||
Evas_List l;
|
||||
E_Dir *d;
|
||||
|
||||
D_ENTER;
|
||||
|
@ -691,16 +494,6 @@ e_dir_file_moved(int id, char *file)
|
|||
if (!file || file[0] == '/')
|
||||
D_RETURN;
|
||||
d = e_dir_find_by_monitor_id(id);
|
||||
for (l = d->views; l; l = l->next)
|
||||
{
|
||||
E_View *v = (E_View *) l->data;
|
||||
E_Icon *ic;
|
||||
|
||||
ic = e_icon_find_by_file(v, file);
|
||||
if (ic)
|
||||
{
|
||||
}
|
||||
}
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
|
|
24
src/e_dir.h
24
src/e_dir.h
|
@ -1,8 +1,9 @@
|
|||
#ifndef E_VIEW_MODEL_H
|
||||
#define E_VIEW_MODEL_H
|
||||
#ifndef E_DIR_H
|
||||
#define E_DIR_H
|
||||
|
||||
#include "fs.h"
|
||||
#include "iconbar.h"
|
||||
#include "observer.h"
|
||||
#include <Evas.h>
|
||||
|
||||
#ifndef E_VIEW_TYPEDEF
|
||||
|
@ -15,32 +16,31 @@ typedef struct _E_View E_View;
|
|||
typedef struct _E_Icon E_Icon;
|
||||
#endif
|
||||
|
||||
#ifndef E_VIEW_MODEL_TYPEDEF
|
||||
#define E_VIEW_MODEL_TYPEDEF
|
||||
#ifndef E_DIR_TYPEDEF
|
||||
#define E_DIR_TYPEDEF
|
||||
typedef struct _E_Dir E_Dir;
|
||||
#endif
|
||||
|
||||
struct _E_Dir
|
||||
{
|
||||
E_Object o;
|
||||
E_Observee o;
|
||||
|
||||
/* The realpath of the view's directory */
|
||||
char *dir;
|
||||
|
||||
Evas_List files;
|
||||
|
||||
Evas_Object obj_bg;
|
||||
|
||||
char *bg_file;
|
||||
/*
|
||||
* Evas_Object obj_bg;
|
||||
*
|
||||
* char *bg_file;
|
||||
*/
|
||||
|
||||
E_FS_Restarter *restarter;
|
||||
|
||||
int monitor_id;
|
||||
|
||||
/* A list of all the views for which an E_Dir is sharing data */
|
||||
Evas_List views;
|
||||
|
||||
int is_desktop;
|
||||
// int is_desktop;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Ecore.h>
|
||||
#include "e_view_machine.h"
|
||||
#include "e_dir.h"
|
||||
#include "e_view_look.h"
|
||||
#include "util.h"
|
||||
#include "globals.h"
|
||||
#include "file.h"
|
||||
|
@ -15,6 +16,7 @@ e_view_machine_init()
|
|||
VM = NEW(E_Dir, 1);
|
||||
VM->views = NULL;
|
||||
VM->dirs = NULL;
|
||||
VM->looks = NULL;
|
||||
e_view_init();
|
||||
e_dir_init();
|
||||
}
|
||||
|
@ -54,6 +56,22 @@ e_view_machine_unregister_view(E_View * v)
|
|||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_view_machine_register_look(E_View_Look * l)
|
||||
{
|
||||
D_ENTER;
|
||||
VM->looks = evas_list_append(VM->looks, l);
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_view_machine_unregister_look(E_View_Look * l)
|
||||
{
|
||||
D_ENTER;
|
||||
VM->looks = evas_list_remove(VM->looks, l);
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_view_machine_close_all_views(void)
|
||||
{
|
||||
|
@ -100,6 +118,37 @@ e_view_machine_dir_lookup(char *path)
|
|||
D_RETURN_(NULL);
|
||||
}
|
||||
|
||||
E_View_Look *
|
||||
e_view_machine_look_lookup(char *path)
|
||||
{
|
||||
E_View_Look *vl;
|
||||
Evas_List l;
|
||||
char *realpath = NULL;
|
||||
|
||||
D_ENTER;
|
||||
|
||||
if (!path)
|
||||
D_RETURN_(NULL);
|
||||
|
||||
realpath = e_file_realpath(path);
|
||||
|
||||
for (l = VM->looks; l; l = l->next)
|
||||
{
|
||||
vl = l->data;
|
||||
if (!strcmp(vl->dir->dir, realpath))
|
||||
{
|
||||
D("E_Dir for this dir already exists\n");
|
||||
|
||||
IF_FREE(realpath);
|
||||
D_RETURN_(vl);
|
||||
}
|
||||
}
|
||||
|
||||
IF_FREE(realpath);
|
||||
D_RETURN_(NULL);
|
||||
}
|
||||
|
||||
|
||||
E_View *
|
||||
e_view_machine_get_view_by_main_window(Window win)
|
||||
{
|
||||
|
@ -131,3 +180,5 @@ e_view_machine_get_view_by_base_window(Window win)
|
|||
}
|
||||
D_RETURN_(NULL);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ struct _e_view_machine
|
|||
{
|
||||
Evas_List views;
|
||||
Evas_List dirs;
|
||||
Evas_List looks;
|
||||
|
||||
};
|
||||
typedef struct _e_view_machine E_View_Machine;
|
||||
|
||||
|
@ -14,9 +16,12 @@ void e_view_machine_register_view(E_View * v);
|
|||
void e_view_machine_unregister_view(E_View * v);
|
||||
void e_view_machine_register_dir(E_Dir * d);
|
||||
void e_view_machine_unregister_dir(E_Dir * d);
|
||||
void e_view_machine_register_look(E_View_Look * l);
|
||||
void e_view_machine_unregister_look(E_View_Look * l);
|
||||
|
||||
void e_view_machine_close_all_views(void);
|
||||
E_Dir *e_view_machine_dir_lookup(char *path);
|
||||
E_View_Look *e_view_machine_look_lookup(char *path);
|
||||
E_View *e_view_machine_get_view_by_main_window(Window win);
|
||||
E_View *e_view_machine_get_view_by_base_window(Window win);
|
||||
|
||||
|
|
|
@ -236,10 +236,14 @@ e_iconbar_new(E_View * v)
|
|||
|
||||
D_ENTER;
|
||||
|
||||
D("new iconbar\n");
|
||||
D("new iconbar for view: %s\n", v->name);
|
||||
if(!v || !v->look || !v->look->obj
|
||||
|| !v->look->obj->icb || !v->look->obj->icb_bits)
|
||||
D_RETURN_(NULL);
|
||||
|
||||
/* first we want to load the iconbar data itself - ie the config info */
|
||||
/* for what icons we have and what they execute */
|
||||
snprintf(buf, PATH_MAX, "%s/.e_layout/iconbar.db", v->dir->dir);
|
||||
snprintf(buf, PATH_MAX, "%s", v->look->obj->icb);
|
||||
/* use the config system to simply load up the db and start making */
|
||||
/* structs and lists and stuff for us... we told it how to in init */
|
||||
ib = e_config_load(buf, "", cf_iconbar);
|
||||
|
@ -289,7 +293,7 @@ e_iconbar_new(E_View * v)
|
|||
|
||||
/* now we need to load up a bits file that tells us where in the view the */
|
||||
/* iconbar is meant to go. same place. just a slightly different name */
|
||||
snprintf(buf, PATH_MAX, "%s/.e_layout/iconbar.bits.db", v->dir->dir);
|
||||
snprintf(buf, PATH_MAX, "%s", ib->view->look->obj->icb_bits);
|
||||
ib->bit = ebits_load(buf);
|
||||
|
||||
/* we didn't find one? */
|
||||
|
@ -383,6 +387,8 @@ e_iconbar_realize(E_Iconbar * ib)
|
|||
{
|
||||
Evas_List l;
|
||||
|
||||
if (!ib) D_RETURN;
|
||||
|
||||
D_ENTER;
|
||||
D("realize iconbar\n");
|
||||
/* create clip object */
|
||||
|
@ -399,8 +405,8 @@ e_iconbar_realize(E_Iconbar * ib)
|
|||
/* the path of the key to the image memebr - that is actually */
|
||||
/* a lump of image data inlined in the iconbar db - so the icons */
|
||||
/* themselves follow the iconbar wherever it goes */
|
||||
snprintf(buf, PATH_MAX, "%s/.e_layout/iconbar.db:%s",
|
||||
ib->view->dir->dir, ic->image_path);
|
||||
snprintf(buf, PATH_MAX, "%s:%s",
|
||||
ib->view->look->obj->icb, ic->image_path);
|
||||
/* add the icon image object */
|
||||
ic->image = evas_add_image_from_file(ib->view->evas, buf);
|
||||
/* add an imlib image so we can save it later */
|
||||
|
@ -514,16 +520,13 @@ e_iconbar_fix(E_Iconbar * ib)
|
|||
double ix, iy, aw, ah;
|
||||
|
||||
D_ENTER;
|
||||
|
||||
x = y = w = h = 0;
|
||||
/* get geometry from layout */
|
||||
if (!e_view_layout_get_element_geometry(ib->view->layout, "Iconbar",
|
||||
&x, &y, &w, &h))
|
||||
{
|
||||
D("Error: no geometry for iconbar, must not exist, clean it up.\n");
|
||||
e_object_unref(E_OBJECT (ib));
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
D("iconbar fix: %f, %f, %f, %f\n", x, y, w, h);
|
||||
/* move and resize iconbar to geometry specified in layout */
|
||||
ebits_move(ib->bit, x, y);
|
||||
|
@ -668,33 +671,6 @@ e_iconbar_fix(E_Iconbar * ib)
|
|||
D_RETURN;
|
||||
}
|
||||
|
||||
/**
|
||||
* e_iconbar_file_delete - Function to remove a file from an iconbox.
|
||||
* @v: The view in which a file is removed
|
||||
* @file: Name of the removed file
|
||||
*
|
||||
* This function is called whenever a file is deleted from a view.
|
||||
*/
|
||||
void
|
||||
e_iconbar_file_delete(E_View * v, char *file)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
/* is the file of interest */
|
||||
if ((!strcmp("iconbar.db", file)) || (!strcmp("iconbar.bits.db", file)))
|
||||
{
|
||||
/* if we have an iconbar.. delete it - because its files have been */
|
||||
/* nuked. no need to keep it around. */
|
||||
if (v->iconbar)
|
||||
{
|
||||
e_object_unref(E_OBJECT(v->iconbar));
|
||||
v->iconbar = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
/**
|
||||
* e_iconbar_save_out_final - save out final state of iconbar back to disk
|
||||
* @ib: The iconbar
|
||||
|
@ -877,12 +853,12 @@ ib_timeout(int val, void *data)
|
|||
ic->hi.start = ecore_get_time();
|
||||
/* no hilite (animation) image */
|
||||
if (!ic->hi.image)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
|
||||
/* figure out its path */
|
||||
snprintf(buf, PATH_MAX, "%s/.e_iconbar.db:%s",
|
||||
ic->iconbar->view->dir->dir, ic->image_path);
|
||||
snprintf(buf, PATH_MAX, "%s:%s",
|
||||
ic->iconbar->view->look->obj->icb, ic->image_path);
|
||||
/* add it */
|
||||
ic->hi.image = evas_add_image_from_file(ic->iconbar->view->evas,
|
||||
buf);
|
||||
|
@ -1560,8 +1536,6 @@ e_iconbar_dnd_add_files(E_View * v, E_View * source, int num_files,
|
|||
int i;
|
||||
|
||||
D_ENTER;
|
||||
|
||||
#if 0
|
||||
D("add files: %s\n", source->dir->dir);
|
||||
for (i = 0; i < num_files; i++)
|
||||
{
|
||||
|
@ -1570,8 +1544,8 @@ e_iconbar_dnd_add_files(E_View * v, E_View * source, int num_files,
|
|||
|
||||
if (ic)
|
||||
{
|
||||
D("icon mime.base: %s\n", ic->info.mime.base);
|
||||
if (!strcmp(ic->info.mime.base, "db"))
|
||||
D("icon mime.base: %s\n", ic->file->info.mime.base);
|
||||
if (!strcmp(ic->file->info.mime.base, "db"))
|
||||
{
|
||||
/* if its an icon db, set the icon */
|
||||
D("db!\n");
|
||||
|
@ -1594,7 +1568,7 @@ e_iconbar_dnd_add_files(E_View * v, E_View * source, int num_files,
|
|||
{
|
||||
D("over icon: %s\n", ibic->exec);
|
||||
snprintf(buf, PATH_MAX, "%s/%s:/icon/normal",
|
||||
ic->view->dir->dir, ic->file);
|
||||
ic->view->dir->dir, ic->file->file);
|
||||
D("set icon: %s\n", buf);
|
||||
|
||||
ibic->imlib_image = imlib_load_image(buf);
|
||||
|
@ -1607,7 +1581,7 @@ e_iconbar_dnd_add_files(E_View * v, E_View * source, int num_files,
|
|||
}
|
||||
break;
|
||||
}
|
||||
else if (e_file_can_exec(&ic->stat))
|
||||
else if (e_file_can_exec(&ic->file->stat))
|
||||
{
|
||||
execs = evas_list_append(execs, ic);
|
||||
}
|
||||
|
@ -1639,13 +1613,13 @@ e_iconbar_dnd_add_files(E_View * v, E_View * source, int num_files,
|
|||
D("x: %f, v-dir: %s, ib-dir: %s\n", ibic->iconbar->icon_area.x,
|
||||
v->dir->dir, ibic->iconbar->view->dir->dir);
|
||||
|
||||
if (!ic->info.icon)
|
||||
if (!ic->file->info.icon)
|
||||
D_RETURN;
|
||||
snprintf(buf, PATH_MAX, "%s:/icon/normal", ic->info.icon);
|
||||
snprintf(buf, PATH_MAX, "%s:/icon/normal", ic->file->info.icon);
|
||||
ibic->image = evas_add_image_from_file(v->evas, buf);
|
||||
ibic->imlib_image = imlib_load_image(buf);
|
||||
ibic->image_path = strdup(ic->info.icon);
|
||||
snprintf(buf, PATH_MAX, "%s/%s", ic->view->dir->dir, ic->file);
|
||||
ibic->image_path = strdup(ic->file->info.icon);
|
||||
snprintf(buf, PATH_MAX, "%s/%s", ic->view->dir->dir, ic->file->file);
|
||||
ibic->exec = strdup(buf);
|
||||
|
||||
evas_set_clip(v->evas, ibic->image, v->iconbar->clip);
|
||||
|
@ -1668,8 +1642,6 @@ e_iconbar_dnd_add_files(E_View * v, E_View * source, int num_files,
|
|||
/* this adds the icon to the correct place in the list and saves */
|
||||
e_iconbar_icon_move(ibic, v->iconbar->dnd.x, v->iconbar->dnd.y);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/* called when child processes exit */
|
||||
|
@ -1721,21 +1693,6 @@ ib_child_handle(Ecore_Event * ev)
|
|||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_iconbar_update_geometry(E_Iconbar * ib)
|
||||
{
|
||||
double x, y, w, h;
|
||||
|
||||
D_ENTER;
|
||||
if (e_view_layout_get_element_geometry(ib->view->layout, "Iconbar",
|
||||
&x, &y, &w, &h))
|
||||
{
|
||||
ebits_move(ib->bit, x, y);
|
||||
ebits_resize(ib->bit, w, h);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
E_Rect *
|
||||
e_iconbar_get_resist_rect(E_Iconbar * ib)
|
||||
{
|
||||
|
|
|
@ -927,9 +927,10 @@ e_icon_exec(E_Icon * ic)
|
|||
v->options.back_pixmap = 0;
|
||||
snprintf(buf, PATH_MAX, "%s/%s", ic->view->dir->dir, ic->file->file);
|
||||
D("new dir >%s<\n", buf);
|
||||
e_view_set_dir(v, buf, 0);
|
||||
e_view_set_dir(v, buf);
|
||||
e_view_realize(v);
|
||||
e_view_populate(v);
|
||||
e_view_set_look(v, NULL);
|
||||
|
||||
e_view_bg_reload(v);
|
||||
ecore_window_set_title(v->win.base, ic->file->file);
|
||||
|
|
|
@ -95,7 +95,7 @@ e_observee_init(E_Observee * obs, E_Cleanup_Func cleanup_func)
|
|||
}
|
||||
|
||||
void
|
||||
e_observee_notify_observers(E_Observee * o, E_Event_Type event)
|
||||
e_observee_notify_observers(E_Observee * o, E_Event_Type event, void *data)
|
||||
{
|
||||
Evas_List obs_list = NULL;
|
||||
E_Observer *obs = NULL;
|
||||
|
@ -112,7 +112,7 @@ e_observee_notify_observers(E_Observee * o, E_Event_Type event)
|
|||
/* check bit mask */
|
||||
if (obs->event & event)
|
||||
{
|
||||
obs->notify_func(obs, o, event);
|
||||
obs->notify_func(obs, o, event, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ e_observee_notify_observers(E_Observee * o, E_Event_Type event)
|
|||
}
|
||||
|
||||
void
|
||||
e_observee_notify_all_observers(E_Observee * o, E_Event_Type event)
|
||||
e_observee_notify_all_observers(E_Observee * o, E_Event_Type event, void *data)
|
||||
{
|
||||
Evas_List obs_list = NULL;
|
||||
E_Observer *obs = NULL;
|
||||
|
@ -137,7 +137,7 @@ e_observee_notify_all_observers(E_Observee * o, E_Event_Type event)
|
|||
/* check bit mask */
|
||||
if (obs->event & event)
|
||||
{
|
||||
obs->notify_func(obs, o, event);
|
||||
obs->notify_func(obs, o, event, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,15 @@ typedef enum _e_event_type
|
|||
E_EVENT_DESKTOP_DELETE = 1 << 11,
|
||||
E_EVENT_DESKTOP_SWITCH = 1 << 12,
|
||||
|
||||
E_EVENT_FILE_ADD = 1 << 13,
|
||||
E_EVENT_FILE_CHANGE = 1 << 14,
|
||||
E_EVENT_FILE_DELETE = 1 << 15,
|
||||
E_EVENT_FILE_INFO = 1 << 16,
|
||||
|
||||
E_EVENT_BG_CHANGED = 1 << 17,
|
||||
E_EVENT_ICB_CHANGED = 1 << 18,
|
||||
E_EVENT_LAYOUT_CHANGED = 1 << 19,
|
||||
|
||||
/* meta event types */
|
||||
E_EVENT_BORDER_ALL = E_EVENT_BORDER_NEW |
|
||||
E_EVENT_BORDER_DELETE | E_EVENT_BORDER_FOCUS_IN |
|
||||
|
@ -44,7 +53,8 @@ E_Event_Type;
|
|||
|
||||
typedef void (*E_Notify_Func) (E_Observer * observer,
|
||||
E_Observee * observee,
|
||||
E_Event_Type event);
|
||||
E_Event_Type event,
|
||||
void *data);
|
||||
|
||||
struct _e_observer
|
||||
{
|
||||
|
@ -130,13 +140,16 @@ void e_observee_cleanup(E_Observee * obs);
|
|||
* e_observee_notify_observers - Notify observers of a given Ecore event
|
||||
* @o: The observee which notifies its observers
|
||||
* @event: The event by which to filter the observers
|
||||
* @data: arbitrary data attached to the event
|
||||
*
|
||||
* This function scans the registered observers in the observee
|
||||
* and calls the notify_func() of the observers that are
|
||||
* responsible for the given @event.
|
||||
*/
|
||||
void e_observee_notify_observers(E_Observee * o,
|
||||
E_Event_Type event);
|
||||
E_Event_Type event,
|
||||
void *data
|
||||
);
|
||||
|
||||
/**
|
||||
* e_observee_notify_all_observers - Notify all observers of a given E event
|
||||
|
@ -144,6 +157,7 @@ void e_observee_notify_observers(E_Observee * o,
|
|||
*
|
||||
* @o: The observee which notifies the observers
|
||||
* @event: The event by which to filter the observers
|
||||
* @data: arbitrary data attached to the event
|
||||
*
|
||||
* This function scans ALL observers in the observee
|
||||
* and calls the notify_func() of the observers that are
|
||||
|
@ -153,5 +167,6 @@ void e_observee_notify_observers(E_Observee * o,
|
|||
* it as a legitimate observee.
|
||||
*/
|
||||
void e_observee_notify_all_observers(E_Observee * o,
|
||||
E_Event_Type event);
|
||||
E_Event_Type event,
|
||||
void *data);
|
||||
#endif
|
||||
|
|
494
src/view.c
494
src/view.c
|
@ -913,91 +913,54 @@ e_configure(Ecore_Event * ev)
|
|||
D_ENTER;
|
||||
|
||||
e = ev->event;
|
||||
if (e && e->win)
|
||||
{
|
||||
v = e_view_machine_get_view_by_base_window(e->win);
|
||||
if (v)
|
||||
{
|
||||
/* win, root, x, y, w, h, wm_generated */
|
||||
D("Configure for view: %s\n", v->name);
|
||||
if (e->wm_generated)
|
||||
{
|
||||
D("wm generated %i %i, %ix%i\n", e->x, e->y, e->w, e->h);
|
||||
if ((e->x != v->location.x) || (e->y != v->location.y))
|
||||
{
|
||||
D("new spot!\n");
|
||||
v->location.x = e->x;
|
||||
v->location.y = e->y;
|
||||
/* FIXME */
|
||||
//e_view_queue_geometry_record(v);
|
||||
}
|
||||
}
|
||||
D("size %ix%i\n", e->w, e->h);
|
||||
if ((e->w != v->size.w) || (e->h != v->size.h) || (v->size.force))
|
||||
{
|
||||
v->size.force = 0;
|
||||
D("... a new size!\n");
|
||||
v->size.w = e->w;
|
||||
v->size.h = e->h;
|
||||
if (v->pmap)
|
||||
ecore_pixmap_free(v->pmap);
|
||||
v->pmap = 0;
|
||||
ecore_window_resize(v->win.main, v->size.w, v->size.h);
|
||||
if (v->options.back_pixmap)
|
||||
{
|
||||
v->pmap =
|
||||
ecore_pixmap_new(v->win.main, v->size.w, v->size.h,
|
||||
0);
|
||||
evas_set_output(v->evas, ecore_display_get(), v->pmap,
|
||||
evas_get_visual(v->evas),
|
||||
evas_get_colormap(v->evas));
|
||||
ecore_window_set_background_pixmap(v->win.main, v->pmap);
|
||||
ecore_window_clear(v->win.main);
|
||||
}
|
||||
if (v->bg)
|
||||
e_bg_resize(v->bg, v->size.w, v->size.h);
|
||||
D("evas_set_output_viewpor(%p)\n", v->evas);
|
||||
evas_set_output_viewport(v->evas, 0, 0, v->size.w, v->size.h);
|
||||
evas_set_output_size(v->evas, v->size.w, v->size.h);
|
||||
e_view_scroll_to(v, v->scroll.x, v->scroll.y);
|
||||
e_view_arrange(v);
|
||||
if (v->layout)
|
||||
e_view_layout_update(v->layout);
|
||||
/* FIXME */
|
||||
//e_view_queue_geometry_record(v);
|
||||
|
||||
{
|
||||
double x, y, w, h;
|
||||
|
||||
if (e_view_layout_get_element_geometry(v->layout,
|
||||
"Scrollbar_H",
|
||||
&x, &y, &w, &h))
|
||||
{
|
||||
e_scrollbar_move(v->scrollbar.h, x, y);
|
||||
e_scrollbar_resize(v->scrollbar.h, w, h);
|
||||
}
|
||||
if (e_view_layout_get_element_geometry(v->layout,
|
||||
"Scrollbar_V",
|
||||
&x, &y, &w, &h))
|
||||
{
|
||||
e_scrollbar_move(v->scrollbar.v, x, y);
|
||||
e_scrollbar_resize(v->scrollbar.v, w, h);
|
||||
}
|
||||
}
|
||||
|
||||
e_scrollbar_move(v->scrollbar.v,
|
||||
v->size.w - v->scrollbar.v->w, 0);
|
||||
e_scrollbar_resize(v->scrollbar.v, v->scrollbar.v->w,
|
||||
v->size.h - v->scrollbar.h->h);
|
||||
e_scrollbar_move(v->scrollbar.h, 0,
|
||||
v->size.h - v->scrollbar.h->h);
|
||||
e_scrollbar_resize(v->scrollbar.h,
|
||||
v->size.w - v->scrollbar.v->w,
|
||||
v->scrollbar.h->h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!e || !e->win)
|
||||
D_RETURN;
|
||||
v = e_view_machine_get_view_by_base_window(e->win);
|
||||
if (!v)
|
||||
D_RETURN;
|
||||
/* win, root, x, y, w, h, wm_generated */
|
||||
D("Configure for view: %s\n", v->name);
|
||||
if (e->wm_generated)
|
||||
{
|
||||
D("wm generated %i %i, %ix%i\n", e->x, e->y, e->w, e->h);
|
||||
if ((e->x != v->location.x) || (e->y != v->location.y))
|
||||
{
|
||||
D("new spot!\n");
|
||||
v->location.x = e->x;
|
||||
v->location.y = e->y;
|
||||
}
|
||||
}
|
||||
D("size %ix%i\n", e->w, e->h);
|
||||
if ((e->w != v->size.w) || (e->h != v->size.h) || (v->size.force))
|
||||
{
|
||||
v->size.force = 0;
|
||||
D("... a new size!\n");
|
||||
v->size.w = e->w;
|
||||
v->size.h = e->h;
|
||||
if (v->pmap)
|
||||
ecore_pixmap_free(v->pmap);
|
||||
v->pmap = 0;
|
||||
ecore_window_resize(v->win.main, v->size.w, v->size.h);
|
||||
if (v->options.back_pixmap)
|
||||
{
|
||||
v->pmap =
|
||||
ecore_pixmap_new(v->win.main, v->size.w, v->size.h,
|
||||
0);
|
||||
evas_set_output(v->evas, ecore_display_get(), v->pmap,
|
||||
evas_get_visual(v->evas),
|
||||
evas_get_colormap(v->evas));
|
||||
ecore_window_set_background_pixmap(v->win.main, v->pmap);
|
||||
ecore_window_clear(v->win.main);
|
||||
}
|
||||
if (v->bg)
|
||||
e_bg_resize(v->bg, v->size.w, v->size.h);
|
||||
D("evas_set_output_viewpor(%p)\n", v->evas);
|
||||
evas_set_output_viewport(v->evas, 0, 0, v->size.w, v->size.h);
|
||||
evas_set_output_size(v->evas, v->size.w, v->size.h);
|
||||
e_view_scroll_to(v, v->scroll.x, v->scroll.y);
|
||||
e_view_arrange(v);
|
||||
e_view_layout_update(v->layout);
|
||||
}
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
|
@ -1352,7 +1315,7 @@ e_mouse_in(Ecore_Event * ev)
|
|||
{
|
||||
if ((v = e_view_machine_get_view_by_main_window(e->win)))
|
||||
{
|
||||
if (v->dir->is_desktop)
|
||||
if (v->is_desktop)
|
||||
{
|
||||
evas_event_enter(v->evas);
|
||||
}
|
||||
|
@ -1564,6 +1527,39 @@ e_view_resort_timeout(int val, void *data)
|
|||
UN(val);
|
||||
}
|
||||
|
||||
static void
|
||||
e_view_layout_reload_timeout(int val, void *data)
|
||||
{
|
||||
E_View *v;
|
||||
D_ENTER;
|
||||
v = data;
|
||||
e_view_layout_reload(v);
|
||||
D_RETURN;
|
||||
UN(val);
|
||||
}
|
||||
|
||||
static void
|
||||
e_view_bg_reload_timeout(int val, void *data)
|
||||
{
|
||||
E_View *v;
|
||||
D_ENTER;
|
||||
v = data;
|
||||
e_view_bg_reload(v);
|
||||
D_RETURN;
|
||||
UN(val);
|
||||
}
|
||||
|
||||
static void
|
||||
e_view_ib_reload_timeout(int val, void *data)
|
||||
{
|
||||
E_View *v;
|
||||
D_ENTER;
|
||||
v = data;
|
||||
e_view_ib_reload(v);
|
||||
D_RETURN;
|
||||
UN(val);
|
||||
}
|
||||
|
||||
void
|
||||
e_view_queue_resort(E_View * v)
|
||||
{
|
||||
|
@ -1610,7 +1606,9 @@ e_view_cleanup(E_View * v)
|
|||
ecore_del_event_timer(name);
|
||||
|
||||
/* unregister with the underlying dir and the global list of views */
|
||||
e_dir_unregister_view(v);
|
||||
e_observer_unregister_observee(E_OBSERVER(v), E_OBSERVEE(v->dir));
|
||||
e_object_unref(E_OBJECT(v->dir));
|
||||
v->dir = NULL;
|
||||
e_view_machine_unregister_view(v);
|
||||
/* FIXME: clean up the rest!!! this leaks ... */
|
||||
|
||||
|
@ -1619,6 +1617,43 @@ e_view_cleanup(E_View * v)
|
|||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_view_file_event_handler(E_Observer *obs, E_Observee *o, E_Event_Type event, void *data)
|
||||
{
|
||||
E_View *v = (E_View *) obs;
|
||||
E_File *f = (E_File *) data;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
D_ENTER;
|
||||
|
||||
if (event & E_EVENT_FILE_ADD)
|
||||
e_view_file_add(v, f);
|
||||
else if (event & E_EVENT_FILE_DELETE)
|
||||
e_view_file_delete(v, f);
|
||||
else if (event & E_EVENT_FILE_CHANGE)
|
||||
e_view_file_changed(v, f);
|
||||
else if (event & E_EVENT_FILE_INFO)
|
||||
e_view_file_try_to_show(v, f);
|
||||
else if (event & E_EVENT_BG_CHANGED)
|
||||
{
|
||||
snprintf(buf, PATH_MAX, "background_reload:%s", v->name);
|
||||
ecore_add_event_timer(buf, 0.5, e_view_bg_reload_timeout, 0, v);
|
||||
}
|
||||
else if (event & E_EVENT_ICB_CHANGED)
|
||||
{
|
||||
snprintf(buf, PATH_MAX, "iconbar_reload:%s", v->name);
|
||||
ecore_add_event_timer(buf, 0.5, e_view_ib_reload_timeout, 0, v);
|
||||
}
|
||||
else if (event & E_EVENT_LAYOUT_CHANGED)
|
||||
{
|
||||
snprintf(buf, PATH_MAX, "layout_reload:%s", v->name);
|
||||
ecore_add_event_timer(buf, 0.5, e_view_layout_reload_timeout, 0, v);
|
||||
}
|
||||
|
||||
D_RETURN;
|
||||
UN(o);
|
||||
}
|
||||
|
||||
E_View *
|
||||
e_view_new(void)
|
||||
{
|
||||
|
@ -1629,8 +1664,14 @@ e_view_new(void)
|
|||
v = NEW(E_View, 1);
|
||||
ZERO(v, E_View, 1);
|
||||
|
||||
e_object_init(E_OBJECT(v), (E_Cleanup_Func) e_view_cleanup);
|
||||
e_observer_init(E_OBSERVER(v),
|
||||
E_EVENT_FILE_ADD | E_EVENT_FILE_DELETE | E_EVENT_FILE_CHANGE
|
||||
| E_EVENT_FILE_INFO | E_EVENT_BG_CHANGED | E_EVENT_ICB_CHANGED
|
||||
| E_EVENT_LAYOUT_CHANGED ,
|
||||
(E_Notify_Func) e_view_file_event_handler,
|
||||
(E_Cleanup_Func) e_view_cleanup);
|
||||
|
||||
|
||||
#define SOFT_DESK
|
||||
/* #define X_DESK */
|
||||
/* #define GL_DESK */
|
||||
|
@ -1674,11 +1715,60 @@ _member.r = _r; _member.g = _g; _member.b = _b; _member.a = _a;
|
|||
|
||||
e_view_machine_register_view(v);
|
||||
|
||||
|
||||
D_RETURN_(v);
|
||||
}
|
||||
|
||||
void
|
||||
e_view_set_dir(E_View * v, char *path, int is_desktop)
|
||||
e_view_set_look(E_View * v, char *path)
|
||||
{
|
||||
E_View_Look *l = NULL;
|
||||
char buf[PATH_MAX];
|
||||
D_ENTER;
|
||||
|
||||
if (v->look)
|
||||
e_object_unref(E_OBJECT(v->look));
|
||||
|
||||
if(!path)
|
||||
{
|
||||
/*
|
||||
* no path specified, lets look in the view's dir. If
|
||||
* there is a e_layout dir there, use whats in there.
|
||||
* Otherwise use the default dir.
|
||||
*/
|
||||
snprintf(buf, PATH_MAX, "%s/.e_layout", v->dir->dir);
|
||||
if (e_file_exists(buf) && e_file_is_dir(buf))
|
||||
path = buf;
|
||||
else
|
||||
{
|
||||
snprintf(buf, PATH_MAX, "%s/appearance", e_config_user_dir());
|
||||
path = buf;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !(l=e_view_machine_look_lookup(path)) )
|
||||
{
|
||||
v->look = e_view_look_new();
|
||||
e_view_look_set_dir (v->look, path);
|
||||
}
|
||||
else
|
||||
{
|
||||
v->look = l;
|
||||
e_object_ref(E_OBJECT(v->look));
|
||||
}
|
||||
if(v->look)
|
||||
{
|
||||
e_observer_register_observee(E_OBSERVER(v), E_OBSERVEE(v->look->obj));
|
||||
|
||||
e_view_bg_reload(v);
|
||||
e_view_layout_reload(v);
|
||||
e_view_ib_reload(v);
|
||||
}
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_view_set_dir(E_View * v, char *path)
|
||||
{
|
||||
E_Dir *d = NULL;
|
||||
char buf[PATH_MAX];
|
||||
|
@ -1691,34 +1781,18 @@ e_view_set_dir(E_View * v, char *path, int is_desktop)
|
|||
if (!(d = e_view_machine_dir_lookup(path)))
|
||||
{
|
||||
D("Model for this dir doesn't exist, make a new one\n");
|
||||
|
||||
d = e_dir_new();
|
||||
e_dir_set_dir(d, path);
|
||||
|
||||
snprintf(buf, PATH_MAX, "%s/.e_background.bg.db", d->dir);
|
||||
if (!e_file_exists(buf))
|
||||
{
|
||||
if (is_desktop)
|
||||
{
|
||||
snprintf(buf, PATH_MAX, "%s/default.bg.db",
|
||||
e_config_get("backgrounds"));
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buf, PATH_MAX, "%s/view.bg.db",
|
||||
e_config_get("backgrounds"));
|
||||
}
|
||||
}
|
||||
e_strdup(d->bg_file, buf);
|
||||
d->is_desktop = is_desktop;
|
||||
}
|
||||
else
|
||||
e_object_ref(E_OBJECT(d));
|
||||
|
||||
if (d)
|
||||
{
|
||||
e_dir_register_view(d, v);
|
||||
v->dir = d;
|
||||
e_observer_register_observee(E_OBSERVER(v), E_OBSERVEE(d));
|
||||
/* FIXME do a real naming scheme here */
|
||||
snprintf(buf, PATH_MAX, "%s:%d", v->dir->dir,
|
||||
e_object_get_usecount(E_OBJECT(v->dir)));
|
||||
snprintf(buf, PATH_MAX, "%s:%d", v->dir->dir, e_object_get_usecount(E_OBJECT(v->dir)));
|
||||
e_strdup(v->name, buf);
|
||||
D("assigned name to view: %s\n", v->name);
|
||||
|
||||
|
@ -1731,16 +1805,11 @@ e_view_set_dir(E_View * v, char *path, int is_desktop)
|
|||
"/view/w", v->dir->dir, EFSD_INT);
|
||||
v->geom_get.h = efsd_get_metadata(e_fs_get_connection(),
|
||||
"/view/h", v->dir->dir, EFSD_INT);
|
||||
/* FIXME currently, we dont use this anyway */
|
||||
/*
|
||||
* * v->getbg = efsd_get_metadata(e_fs_get_connection(),
|
||||
* * "/view/background", v->dir->dir, EFSD_STRING);
|
||||
*/
|
||||
v->geom_get.busy = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME error handling */
|
||||
D("Couldnt set dir for view! Bad!");
|
||||
}
|
||||
D_RETURN;
|
||||
}
|
||||
|
@ -1782,40 +1851,6 @@ e_view_realize(E_View * v)
|
|||
evas_get_visual(v->evas), evas_get_colormap(v->evas));
|
||||
ecore_window_set_background_pixmap(v->win.main, v->pmap);
|
||||
}
|
||||
if (v->bg)
|
||||
{
|
||||
e_bg_add_to_evas(v->bg, v->evas);
|
||||
e_bg_set_scroll(v->bg, v->scroll.x, v->scroll.y);
|
||||
e_bg_set_layer(v->bg, 100);
|
||||
e_bg_resize(v->bg, v->size.w, v->size.h);
|
||||
|
||||
e_bg_callback_add(v->bg, CALLBACK_MOUSE_UP, e_bg_up_cb, v);
|
||||
e_bg_callback_add(v->bg, CALLBACK_MOUSE_DOWN, e_bg_down_cb, v);
|
||||
e_bg_callback_add(v->bg, CALLBACK_MOUSE_MOVE, e_bg_move_cb, v);
|
||||
|
||||
e_bg_show(v->bg);
|
||||
}
|
||||
|
||||
/* load the layout */
|
||||
v->layout = e_view_layout_new(v);
|
||||
if (v->layout)
|
||||
e_view_layout_realize(v->layout);
|
||||
|
||||
/* set the file area spacing, if in layout */
|
||||
/* FIXME: the icon layout should probably be totally redone */
|
||||
{
|
||||
double x, y, w, h;
|
||||
|
||||
if (e_view_layout_get_element_geometry(v->layout, "Icons",
|
||||
&x, &y, &w, &h))
|
||||
{
|
||||
v->spacing.window.l = x;
|
||||
v->spacing.window.r = v->size.w - (x + w);
|
||||
v->spacing.window.t = y;
|
||||
v->spacing.window.b = v->size.h - (y + h);
|
||||
}
|
||||
}
|
||||
|
||||
v->scrollbar.v = e_scrollbar_new(v);
|
||||
e_scrollbar_set_change_func(v->scrollbar.v, e_view_scrollbar_v_change_cb, v);
|
||||
e_scrollbar_set_direction(v->scrollbar.v, 1);
|
||||
|
@ -1834,39 +1869,10 @@ e_view_realize(E_View * v)
|
|||
e_scrollbar_set_range(v->scrollbar.h, 1.0);
|
||||
e_scrollbar_set_max(v->scrollbar.h, 1.0);
|
||||
|
||||
{
|
||||
double x, y, w, h;
|
||||
|
||||
if (e_view_layout_get_element_geometry(v->layout, "Scrollbar_H",
|
||||
&x, &y, &w, &h))
|
||||
{
|
||||
e_scrollbar_move(v->scrollbar.h, x, y);
|
||||
e_scrollbar_resize(v->scrollbar.h, w, h);
|
||||
}
|
||||
|
||||
if (e_view_layout_get_element_geometry(v->layout, "Scrollbar_V",
|
||||
&x, &y, &w, &h))
|
||||
{
|
||||
e_scrollbar_move(v->scrollbar.v, x, y);
|
||||
e_scrollbar_resize(v->scrollbar.v, w, h);
|
||||
}
|
||||
}
|
||||
|
||||
/* I support dnd */
|
||||
ecore_window_dnd_advertise(v->win.base);
|
||||
|
||||
ecore_window_show(v->win.main);
|
||||
|
||||
if (!v->iconbar)
|
||||
v->iconbar = e_iconbar_new(v);
|
||||
if (v->iconbar)
|
||||
{
|
||||
e_iconbar_realize(v->iconbar);
|
||||
/*e_iconbar_set_view_window_spacing(v->iconbar); */
|
||||
}
|
||||
|
||||
e_view_bg_reload(v);
|
||||
/* e_epplet_load_from_layout(v);*/
|
||||
v->changed = 1;
|
||||
D_RETURN;
|
||||
}
|
||||
|
@ -1882,18 +1888,12 @@ e_view_populate(E_View * v)
|
|||
for (l = v->dir->files; l; l = l->next)
|
||||
{
|
||||
E_File *f = (E_File *) l->data;
|
||||
E_Icon *ic;
|
||||
|
||||
e_view_file_add(v, f);
|
||||
/* try to show the icons for the file. If this is not the first for
|
||||
* the dir this will succeed because filetype and stat info have
|
||||
* already been received. If not, it'll be shown when those arrive. */
|
||||
ic = e_icon_find_by_file(v, f->file);
|
||||
if (ic)
|
||||
{
|
||||
e_icon_update_state(ic);
|
||||
e_icon_initial_show(ic);
|
||||
}
|
||||
e_view_file_try_to_show(v, f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2001,6 +2001,23 @@ e_view_file_changed(E_View * v, E_File * f)
|
|||
ic = e_icon_find_by_file(v, f->file);
|
||||
if (ic)
|
||||
{
|
||||
e_icon_update_state(ic);
|
||||
}
|
||||
v->changed = 1;
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_view_file_try_to_show(E_View * v, E_File * f)
|
||||
{
|
||||
E_Icon *ic;
|
||||
|
||||
D_ENTER;
|
||||
ic = e_icon_find_by_file(v, f->file);
|
||||
if (ic)
|
||||
{
|
||||
e_icon_update_state(ic);
|
||||
e_icon_initial_show(ic);
|
||||
}
|
||||
v->changed = 1;
|
||||
D_RETURN;
|
||||
|
@ -2013,14 +2030,12 @@ e_view_file_delete(E_View * v, E_File * f)
|
|||
|
||||
D_ENTER;
|
||||
|
||||
e_iconbar_file_delete(v, f->file);
|
||||
|
||||
ic = e_icon_find_by_file(v, f->file);
|
||||
if (ic)
|
||||
{
|
||||
e_icon_hide(ic);
|
||||
e_object_unref(E_OBJECT(ic));
|
||||
v->icons = evas_list_remove(v->icons, ic);
|
||||
e_object_unref(E_OBJECT(ic));
|
||||
v->changed = 1;
|
||||
v->extents.valid = 0;
|
||||
e_view_queue_resort(v);
|
||||
|
@ -2028,23 +2043,44 @@ e_view_file_delete(E_View * v, E_File * f)
|
|||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_view_layout_reload(E_View * v)
|
||||
{
|
||||
D_ENTER;
|
||||
if (!v || !v->look)
|
||||
D_RETURN;
|
||||
|
||||
if (e_object_unref(E_OBJECT(v->layout)) == 0)
|
||||
v->layout = NULL;
|
||||
|
||||
/* try load a new layout */
|
||||
v->layout = e_view_layout_new(v);
|
||||
|
||||
/* if the layout loaded and theres an evas - we're realized */
|
||||
/* so realize the layout */
|
||||
if ((v->layout) && (v->evas))
|
||||
e_view_layout_realize(v->layout);
|
||||
|
||||
e_view_layout_update(v->layout);
|
||||
|
||||
v->changed = 1;
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
e_view_ib_reload(E_View * v)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
/*
|
||||
* D ("check if jsut saved:\n");
|
||||
* if (v->iconbar->just_saved)
|
||||
* {
|
||||
* D ("just saved\n");
|
||||
* v->iconbar->just_saved = 0;
|
||||
* D_RETURN;
|
||||
* }
|
||||
*/
|
||||
|
||||
|
||||
/* if we have an iconbar.. well nuke it */
|
||||
if (e_object_unref(E_OBJECT(v->iconbar)) == 0)
|
||||
v->iconbar = NULL;
|
||||
|
||||
/* no iconbar in our look */
|
||||
if(!v->look->obj->icb || !v->look->obj->icb_bits)
|
||||
D_RETURN;
|
||||
|
||||
/* try load a new iconbar */
|
||||
if (!v->iconbar)
|
||||
|
@ -2061,13 +2097,17 @@ e_view_ib_reload(E_View * v)
|
|||
void
|
||||
e_view_bg_reload(E_View * v)
|
||||
{
|
||||
E_Background bg;
|
||||
E_Background bg = NULL;
|
||||
|
||||
/* This should only be called if the background did really
|
||||
* change in the underlying dir. We dont check again
|
||||
* here. */
|
||||
D_ENTER;
|
||||
|
||||
if (!v || !v->look)
|
||||
D_RETURN;
|
||||
|
||||
/* nuke the old one */
|
||||
if (v->bg)
|
||||
{
|
||||
int size;
|
||||
|
@ -2075,33 +2115,45 @@ e_view_bg_reload(E_View * v)
|
|||
e_bg_free(v->bg);
|
||||
v->bg = NULL;
|
||||
if (v->evas)
|
||||
{
|
||||
size = evas_get_image_cache(v->evas);
|
||||
evas_set_image_cache(v->evas, 0);
|
||||
evas_set_image_cache(v->evas, size);
|
||||
}
|
||||
{
|
||||
size = evas_get_image_cache(v->evas);
|
||||
evas_set_image_cache(v->evas, 0);
|
||||
evas_set_image_cache(v->evas, size);
|
||||
}
|
||||
e_db_flush();
|
||||
}
|
||||
if(v->look->obj->bg)
|
||||
{
|
||||
bg = e_bg_load(v->look->obj->bg);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Our look doesnt provide a bg, falls back */
|
||||
char buf[PATH_MAX];
|
||||
if(v->is_desktop)
|
||||
snprintf(buf, PATH_MAX, "%s/default.bg.db", e_config_get("backgrounds"));
|
||||
else
|
||||
snprintf(buf, PATH_MAX, "%s/view.bg.db", e_config_get("backgrounds"));
|
||||
|
||||
bg = e_bg_load(v->dir->bg_file);
|
||||
|
||||
bg = e_bg_load(buf);
|
||||
}
|
||||
if (bg)
|
||||
{
|
||||
v->bg = bg;
|
||||
if (v->evas)
|
||||
{
|
||||
e_bg_add_to_evas(v->bg, v->evas);
|
||||
e_bg_set_scroll(v->bg, v->scroll.x, v->scroll.y);
|
||||
e_bg_set_layer(v->bg, 100);
|
||||
e_bg_resize(v->bg, v->size.w, v->size.h);
|
||||
{
|
||||
v->bg = bg;
|
||||
if (v->evas)
|
||||
{
|
||||
e_bg_add_to_evas(v->bg, v->evas);
|
||||
e_bg_set_scroll(v->bg, v->scroll.x, v->scroll.y);
|
||||
e_bg_set_layer(v->bg, 100);
|
||||
e_bg_resize(v->bg, v->size.w, v->size.h);
|
||||
|
||||
e_bg_callback_add(v->bg, CALLBACK_MOUSE_UP, e_bg_up_cb, v);
|
||||
e_bg_callback_add(v->bg, CALLBACK_MOUSE_DOWN, e_bg_down_cb, v);
|
||||
e_bg_callback_add(v->bg, CALLBACK_MOUSE_MOVE, e_bg_move_cb, v);
|
||||
e_bg_callback_add(v->bg, CALLBACK_MOUSE_UP, e_bg_up_cb, v);
|
||||
e_bg_callback_add(v->bg, CALLBACK_MOUSE_DOWN, e_bg_down_cb, v);
|
||||
e_bg_callback_add(v->bg, CALLBACK_MOUSE_MOVE, e_bg_move_cb, v);
|
||||
|
||||
e_bg_show(v->bg);
|
||||
}
|
||||
}
|
||||
e_bg_show(v->bg);
|
||||
}
|
||||
}
|
||||
v->changed = 1;
|
||||
D_RETURN;
|
||||
}
|
||||
|
|
31
src/view.h
31
src/view.h
|
@ -7,9 +7,11 @@
|
|||
#include "fs.h"
|
||||
#include "iconbar.h"
|
||||
#include "object.h"
|
||||
#include "e_view_look.h"
|
||||
#include "e_dir.h"
|
||||
#include "e_file.h"
|
||||
#include "view_layout.h"
|
||||
#include "observer.h"
|
||||
|
||||
#ifndef E_VIEW_TYPEDEF
|
||||
#define E_VIEW_TYPEDEF
|
||||
|
@ -26,8 +28,8 @@ typedef struct _E_Icon E_Icon;
|
|||
typedef struct _E_Iconbar E_Iconbar;
|
||||
#endif
|
||||
|
||||
#ifndef E_VIEW_MODEL_TYPEDEF
|
||||
#define E_VIEW_MODEL_TYPEDEF
|
||||
#ifndef E_DIR_TYPEDEF
|
||||
#define E_DIR_TYPEDEF
|
||||
typedef struct _E_Dir E_Dir;
|
||||
#endif
|
||||
|
||||
|
@ -42,6 +44,13 @@ typedef struct _E_View_Layout_Element E_View_Layout_Element;
|
|||
typedef struct _E_Scrollbar E_Scrollbar;
|
||||
#endif
|
||||
|
||||
#ifndef E_VIEW_LOOK_TYPEDEF
|
||||
#define E_VIEW_LOOK_TYPEDEF
|
||||
typedef struct _E_View_Look E_View_Look;
|
||||
typedef struct _E_View_Look_Objects E_View_Look_Objects;
|
||||
#endif
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_DND_NONE,
|
||||
|
@ -57,7 +66,7 @@ E_dnd_enum;
|
|||
|
||||
struct _E_View
|
||||
{
|
||||
E_Object o;
|
||||
E_Observer o;
|
||||
|
||||
char *name;
|
||||
|
||||
|
@ -225,6 +234,8 @@ struct _E_View
|
|||
|
||||
Evas_List epplet_contexts;
|
||||
Ebits_Object epplet_layout;
|
||||
|
||||
E_View_Look *look;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -272,13 +283,21 @@ E_View *e_view_new(void);
|
|||
* e_view_set_dir - Sets view to a given directory
|
||||
* @v The view for which to set the directory
|
||||
* @dir The directory to set the view to
|
||||
* @is_desktop Inidicates wether the view is a desktop
|
||||
*
|
||||
* This function sets a view to a directory, loading the
|
||||
* view's metadata (view window coordinates etc). If a dir already
|
||||
* exists for this dir, it is reused, otherwise a new on is created.
|
||||
*/
|
||||
void e_view_set_dir(E_View * v, char *dir, int is_desktop);
|
||||
void e_view_set_dir(E_View * v, char *dir);
|
||||
|
||||
/**
|
||||
* e_view_set_look - Sets view to a given look
|
||||
* @v The view for which to set the directory
|
||||
* @dir The directory that contains the look
|
||||
*
|
||||
* This function sets a directory containing layout information and background
|
||||
* and iconbar dbs for the view. */
|
||||
void e_view_set_look(E_View * v, char *dir);
|
||||
|
||||
/**
|
||||
* e_view_populate - Draws icons for all files in view
|
||||
|
@ -309,10 +328,12 @@ void e_view_update(E_View * v);
|
|||
|
||||
void e_view_bg_reload(E_View * v);
|
||||
void e_view_ib_reload(E_View * v);
|
||||
void e_view_layout_reload(E_View * v);
|
||||
|
||||
void e_view_file_add(E_View * v, E_File * file);
|
||||
void e_view_file_changed(E_View * v, E_File * file);
|
||||
void e_view_file_delete(E_View * v, E_File * file);
|
||||
void e_view_file_try_to_show(E_View * v, E_File * file);
|
||||
|
||||
void e_view_close_all(void);
|
||||
|
||||
|
|
|
@ -44,10 +44,6 @@ e_view_layout_cleanup(E_View_Layout *layout)
|
|||
|
||||
/* free the bits */
|
||||
if (layout->bits) ebits_free(layout->bits);
|
||||
|
||||
IF_FREE(layout->file);
|
||||
IF_FREE(layout->prev_file);
|
||||
|
||||
/* cleanup the base object */
|
||||
e_object_cleanup(E_OBJECT(layout));
|
||||
|
||||
|
@ -59,32 +55,24 @@ e_view_layout_realize(E_View_Layout *layout)
|
|||
{
|
||||
Ebits_Object bits;
|
||||
Evas_List l;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
if (!layout) D_RETURN;
|
||||
|
||||
D_ENTER;
|
||||
|
||||
/* check for custom layout bits */
|
||||
snprintf(buf, PATH_MAX, "%s/.e_layout/layout.bits.db",
|
||||
layout->view->dir->dir);
|
||||
/* keep track of file loaded */
|
||||
IF_FREE(layout->file);
|
||||
e_strdup(layout->file, buf);
|
||||
bits = ebits_load(layout->file);
|
||||
|
||||
/* if custom doesn't exist, load default layout */
|
||||
if (!bits)
|
||||
|
||||
if (layout->view->look->obj->layout)
|
||||
bits = ebits_load(layout->view->look->obj->layout);
|
||||
else
|
||||
{
|
||||
if (layout->view->dir->is_desktop)
|
||||
snprintf(buf, PATH_MAX, "%s/desktop.bits.db", e_config_get("layout"));
|
||||
/* Our look doesnt provide a layout, falls back */
|
||||
char buf[PATH_MAX];
|
||||
if(layout->view->is_desktop)
|
||||
snprintf(buf, PATH_MAX, "%sdesktop.bits.db", e_config_get("layout"));
|
||||
else
|
||||
snprintf(buf, PATH_MAX, "%s/view.bits.db", e_config_get("layout"));
|
||||
/* keep track of which file was loaded */
|
||||
IF_FREE(layout->file);
|
||||
e_strdup(layout->file, buf);
|
||||
bits = ebits_load(layout->file);
|
||||
snprintf(buf, PATH_MAX, "%sview.bits.db", e_config_get("layout"));
|
||||
|
||||
bits = ebits_load(buf);
|
||||
}
|
||||
|
||||
D("loaded layout: %s\n", layout->file);
|
||||
if (bits)
|
||||
{
|
||||
D("layout bits loaded!\n")
|
||||
|
@ -108,10 +96,6 @@ e_view_layout_realize(E_View_Layout *layout)
|
|||
{
|
||||
D("ERROR: can't load layout\n");
|
||||
}
|
||||
|
||||
IF_FREE(layout->prev_file);
|
||||
e_strdup(layout->prev_file, layout->prev_file);
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
|
@ -183,37 +167,36 @@ e_view_layout_get_element_geometry(E_View_Layout *layout, char *name,
|
|||
double *x, double *y, double *w, double *h)
|
||||
{
|
||||
Evas_List l;
|
||||
|
||||
D_ENTER;
|
||||
|
||||
for (l = layout->elements; l; l = l->next)
|
||||
if (layout && name)
|
||||
{
|
||||
E_View_Layout_Element *el = l->data;
|
||||
|
||||
if (!strcmp(name, el->name))
|
||||
for (l = layout->elements; l; l = l->next)
|
||||
{
|
||||
E_View_Layout_Element *el = l->data;
|
||||
|
||||
if (x) *x = el->x;
|
||||
if (y) *y = el->y;
|
||||
if (w) *w = el->w;
|
||||
if (h) *h = el->h;
|
||||
if (!strcmp(name, el->name))
|
||||
{
|
||||
|
||||
if (x) *x = el->x;
|
||||
if (y) *y = el->y;
|
||||
if (w) *w = el->w;
|
||||
if (h) *h = el->h;
|
||||
|
||||
D_RETURN(1);
|
||||
D_RETURN_(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
D_RETURN(0);
|
||||
D_RETURN_(0);
|
||||
}
|
||||
|
||||
void
|
||||
e_view_layout_update(E_View_Layout *layout)
|
||||
{
|
||||
Evas_List l;
|
||||
|
||||
double x, y, w, h;
|
||||
D_ENTER;
|
||||
|
||||
if (!layout->bits)
|
||||
|
||||
if (!layout || !layout->bits)
|
||||
D_RETURN;
|
||||
/* move/resize bits */
|
||||
ebits_move(layout->bits, 0, 0);
|
||||
|
@ -234,5 +217,30 @@ e_view_layout_update(E_View_Layout *layout)
|
|||
el->h = h;
|
||||
}
|
||||
|
||||
/* FIXME: the icon layout should probably be totally redone */
|
||||
if (e_view_layout_get_element_geometry(layout, "Icons",
|
||||
&x, &y, &w, &h))
|
||||
{
|
||||
layout->view->spacing.window.l = x;
|
||||
layout->view->spacing.window.r = layout->view->size.w - (x + w);
|
||||
layout->view->spacing.window.t = y;
|
||||
layout->view->spacing.window.b = layout->view->size.h - (y + h);
|
||||
}
|
||||
if (e_view_layout_get_element_geometry(layout, "Scrollbar_H",
|
||||
&x, &y, &w, &h))
|
||||
{
|
||||
e_scrollbar_move(layout->view->scrollbar.h, x, y);
|
||||
e_scrollbar_resize(layout->view->scrollbar.h, w, h);
|
||||
}
|
||||
|
||||
if (e_view_layout_get_element_geometry(layout, "Scrollbar_V",
|
||||
&x, &y, &w, &h))
|
||||
{
|
||||
e_scrollbar_move(layout->view->scrollbar.v, x, y);
|
||||
e_scrollbar_resize(layout->view->scrollbar.v, w, h);
|
||||
}
|
||||
|
||||
if (layout->view->iconbar)
|
||||
e_iconbar_fix(layout->view->iconbar);
|
||||
D_RETURN;
|
||||
}
|
||||
|
|
|
@ -23,9 +23,6 @@ struct _E_View_Layout
|
|||
|
||||
E_View *view;
|
||||
|
||||
char *file;
|
||||
char *prev_file;
|
||||
|
||||
Ebits_Object bits;
|
||||
|
||||
Evas_List elements;
|
||||
|
|
Loading…
Reference in New Issue