summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTill Adam <tillsan@users.sourceforge.net>2002-03-10 17:23:43 +0000
committerTill Adam <tillsan@users.sourceforge.net>2002-03-10 17:23:43 +0000
commit31292642c35284219656ca0697f5e0e3deee6d88 (patch)
tree753982f6fd9ffdd351aa4aa216e79fd54adf6262
parent609b356400d514d4d27418e65672e4fdf983b540 (diff)
ok. another big one. I'll write to e-devel about the details.
SVN revision: 6055
-rw-r--r--src/Makefile.am1
-rw-r--r--src/actions.c4
-rw-r--r--src/border.c10
-rw-r--r--src/delayed.c2
-rw-r--r--src/delayed.h2
-rw-r--r--src/desktops.c6
-rw-r--r--src/e_dir.c251
-rw-r--r--src/e_dir.h24
-rw-r--r--src/e_view_machine.c51
-rw-r--r--src/e_view_machine.h5
-rw-r--r--src/iconbar.c91
-rw-r--r--src/icons.c3
-rw-r--r--src/observer.c8
-rw-r--r--src/observer.h21
-rw-r--r--src/view.c500
-rw-r--r--src/view.h31
-rw-r--r--src/view_layout.c98
-rw-r--r--src/view_layout.h3
18 files changed, 507 insertions, 604 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 769fe51db..af42de34f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -81,6 +81,7 @@ enlightenment_SOURCES = \
81 e_dir.h e_dir.c \ 81 e_dir.h e_dir.c \
82 e_view_machine.h e_view_machine.c \ 82 e_view_machine.h e_view_machine.c \
83 view_layout.h view_layout.c \ 83 view_layout.h view_layout.c \
84 e_view_look.h e_view_look.c \
84 e.h 85 e.h
85 86
86enlightenment_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ @efsd_libs@ @ebg_libs@ @ferite_libs@ -lm -lc $(INTLLIBS) 87enlightenment_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ @efsd_libs@ @ebg_libs@ @ferite_libs@ -lm -lc $(INTLLIBS)
diff --git a/src/actions.c b/src/actions.c
index 7abb8e8c7..9edde1b86 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1837,7 +1837,7 @@ e_act_max_start(E_Object * object, E_Action * a, void *data, int x, int y,
1837 b->current.requested.w = b->current.w; 1837 b->current.requested.w = b->current.w;
1838 b->current.requested.h = b->current.h; 1838 b->current.requested.h = b->current.h;
1839 1839
1840 e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_UNMAXIMIZE); 1840 e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_UNMAXIMIZE, NULL);
1841 } 1841 }
1842 else 1842 else
1843 { 1843 {
@@ -1857,7 +1857,7 @@ e_act_max_start(E_Object * object, E_Action * a, void *data, int x, int y,
1857 b->current.requested.w = b->current.w; 1857 b->current.requested.w = b->current.w;
1858 b->current.requested.h = b->current.h; 1858 b->current.requested.h = b->current.h;
1859 1859
1860 e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_MAXIMIZE); 1860 e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_MAXIMIZE, NULL);
1861 } 1861 }
1862 1862
1863 D_RETURN; 1863 D_RETURN;
diff --git a/src/border.c b/src/border.c
index df556677a..cfec339bd 100644
--- a/src/border.c
+++ b/src/border.c
@@ -476,7 +476,7 @@ e_focus_in(Ecore_Event * ev)
476 e_border_focus_grab_ended(); 476 e_border_focus_grab_ended();
477 b->current.selected = 1; 477 b->current.selected = 1;
478 b->changed = 1; 478 b->changed = 1;
479 e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_FOCUS_IN); 479 e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_FOCUS_IN, NULL);
480 g = b->click_grab; 480 g = b->click_grab;
481 if (g) 481 if (g)
482 { 482 {
@@ -1272,7 +1272,7 @@ e_border_cleanup(E_Border * b)
1272 1272
1273 e_match_save_props(b); 1273 e_match_save_props(b);
1274 D("before notify\n"); 1274 D("before notify\n");
1275 e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_DELETE); 1275 e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_DELETE, NULL);
1276 D("after notify\n"); 1276 D("after notify\n");
1277 while (b->menus) 1277 while (b->menus)
1278 { 1278 {
@@ -1835,7 +1835,7 @@ e_border_new(void)
1835 1835
1836 borders = evas_list_prepend(borders, b); 1836 borders = evas_list_prepend(borders, b);
1837 1837
1838 e_observee_notify_all_observers(E_OBSERVEE(b), E_EVENT_BORDER_NEW); 1838 e_observee_notify_all_observers(E_OBSERVEE(b), E_EVENT_BORDER_NEW, NULL);
1839 1839
1840 D_RETURN_(b); 1840 D_RETURN_(b);
1841} 1841}
@@ -1849,7 +1849,7 @@ e_border_iconify(E_Border * b)
1849 e_icccm_state_iconified(b->win.client); 1849 e_icccm_state_iconified(b->win.client);
1850 b->changed = 1; 1850 b->changed = 1;
1851 e_border_update(b); 1851 e_border_update(b);
1852 e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_ICONIFY); 1852 e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_ICONIFY, NULL);
1853 1853
1854 D_RETURN; 1854 D_RETURN;
1855} 1855}
@@ -1865,7 +1865,7 @@ e_border_uniconify(E_Border * b)
1865 e_border_update(b); 1865 e_border_update(b);
1866 e_border_raise(b); 1866 e_border_raise(b);
1867 1867
1868 e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_UNICONIFY); 1868 e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_UNICONIFY, NULL);
1869} 1869}
1870 1870
1871void 1871void
diff --git a/src/delayed.c b/src/delayed.c
index df0637ec8..956250033 100644
--- a/src/delayed.c
+++ b/src/delayed.c
@@ -33,7 +33,7 @@ e_delayed_action_new(E_Event_Type event, double delay, E_Delay_Func delay_func)
33} 33}
34 34
35void 35void
36e_delayed_action_start(E_Observer * obs, E_Observee * obj, E_Event_Type event) 36e_delayed_action_start(E_Observer * obs, E_Observee * obj, E_Event_Type event, void *data)
37{ 37{
38 char event_name[PATH_MAX]; 38 char event_name[PATH_MAX];
39 E_Delayed_Action *eda = (E_Delayed_Action *) obs; 39 E_Delayed_Action *eda = (E_Delayed_Action *) obs;
diff --git a/src/delayed.h b/src/delayed.h
index c6c3a0f16..831f4cee9 100644
--- a/src/delayed.h
+++ b/src/delayed.h
@@ -20,7 +20,7 @@ E_Delayed_Action *e_delayed_action_new(E_Event_Type event,
20 double delay, E_Delay_Func delay_func); 20 double delay, E_Delay_Func delay_func);
21 21
22void e_delayed_action_start(E_Observer * obs, E_Observee * obj, 22void e_delayed_action_start(E_Observer * obs, E_Observee * obj,
23 E_Event_Type event); 23 E_Event_Type event, void *data);
24void e_delayed_action_cancel(E_Delayed_Action * eda); 24void e_delayed_action_cancel(E_Delayed_Action * eda);
25 25
26#endif 26#endif
diff --git a/src/desktops.c b/src/desktops.c
index 8a5349de6..732db6edd 100644
--- a/src/desktops.c
+++ b/src/desktops.c
@@ -205,9 +205,11 @@ e_desktops_init_file_display(E_Desktop * desk)
205 /* e_strdup(v->dir, e_file_home()); */ 205 /* e_strdup(v->dir, e_file_home()); */
206 snprintf(buf, PATH_MAX, "%s/desktop/default", e_config_user_dir()); 206 snprintf(buf, PATH_MAX, "%s/desktop/default", e_config_user_dir());
207 207
208 e_view_set_dir(v, buf, 1); 208 e_view_set_dir(v, buf);
209 v->is_desktop = 1;
209 e_view_realize(v); 210 e_view_realize(v);
210 e_view_populate(v); 211 e_view_populate(v);
212 e_view_set_look(v, NULL);
211 213
212 ecore_window_hint_set_borderless(v->win.base); 214 ecore_window_hint_set_borderless(v->win.base);
213 ecore_window_hint_set_sticky(v->win.base, 1); 215 ecore_window_hint_set_sticky(v->win.base, 1);
@@ -425,7 +427,7 @@ e_desktops_goto(int d, int ax, int ay)
425 desk->desk.area.y = ay; 427 desk->desk.area.y = ay;
426 e_icccm_set_desk_area(0, desk->desk.area.x, desk->desk.area.y); 428 e_icccm_set_desk_area(0, desk->desk.area.x, desk->desk.area.y);
427 e_icccm_set_desk(0, desk->desk.desk); 429 e_icccm_set_desk(0, desk->desk.desk);
428 e_observee_notify_observers(E_OBSERVEE(desk), E_EVENT_DESKTOP_SWITCH); 430 e_observee_notify_observers(E_OBSERVEE(desk), E_EVENT_DESKTOP_SWITCH, NULL);
429 } 431 }
430 432
431 D_RETURN; 433 D_RETURN;
diff --git a/src/e_dir.c b/src/e_dir.c
index f64b80f6e..af8122396 100644
--- a/src/e_dir.c
+++ b/src/e_dir.c
@@ -17,8 +17,6 @@ static void e_dir_handle_efsd_event_reply_getfiletype(EfsdEvent * ev);
17static void e_dir_handle_efsd_event_reply_getmeta(EfsdEvent * ev); 17static void e_dir_handle_efsd_event_reply_getmeta(EfsdEvent * ev);
18 18
19static void e_dir_cleanup(E_Dir * d); 19static void e_dir_cleanup(E_Dir * d);
20static void e_dir_bg_reload_timeout(int val, void *data);
21static void e_dir_set_default_background(E_Dir * d);
22 20
23void 21void
24e_dir_init(void) 22e_dir_init(void)
@@ -58,60 +56,14 @@ e_dir_new(void)
58 d = NEW(E_Dir, 1); 56 d = NEW(E_Dir, 1);
59 ZERO(d, E_Dir, 1); 57 ZERO(d, E_Dir, 1);
60 d->dir = NULL; 58 d->dir = NULL;
61 d->views = NULL;
62 59
63 e_object_init(E_OBJECT(d), (E_Cleanup_Func) e_dir_cleanup); 60 e_observee_init(E_OBSERVEE(d),
61 (E_Cleanup_Func) e_dir_cleanup);
64 62
65 e_view_machine_register_dir(d); 63 e_view_machine_register_dir(d);
66 D_RETURN_(d); 64 D_RETURN_(d);
67} 65}
68 66
69void
70e_dir_register_view(E_Dir * d, E_View * v)
71{
72 D_ENTER;
73 v->dir = d;
74 d->views = evas_list_append(d->views, v);
75/* dont ref the first time */
76 if (d->views->next)
77 e_object_ref(E_OBJECT(v->dir));
78 D_RETURN;
79}
80
81void
82e_dir_unregister_view(E_View * v)
83{
84 D_ENTER;
85 v->dir->views = evas_list_remove(v->dir->views, v);
86 e_object_unref(E_OBJECT(v->dir));
87 D_RETURN;
88}
89
90static void
91e_dir_set_default_background(E_Dir * d)
92{
93 char buf[PATH_MAX];
94
95 D_ENTER;
96
97 if (!d)
98 D_RETURN;
99
100 IF_FREE(d->bg_file);
101
102 if (d->is_desktop)
103 snprintf(buf, PATH_MAX, "%s/default.bg.db", e_config_get("backgrounds"));
104 else
105 snprintf(buf, PATH_MAX, "%s/view.bg.db", e_config_get("backgrounds"));
106
107 e_strdup(d->bg_file, buf);
108 snprintf(buf, PATH_MAX, "background_reload:%s", d->dir);
109
110 ecore_add_event_timer(buf, 0.5, e_dir_bg_reload_timeout, 0, d);
111
112 D_RETURN;
113}
114
115static void 67static void
116e_dir_handle_fs_restart(void *data) 68e_dir_handle_fs_restart(void *data)
117{ 69{
@@ -147,17 +99,16 @@ e_dir_set_dir(E_Dir * d, char *dir)
147 if (!d) 99 if (!d)
148 D_RETURN; 100 D_RETURN;
149 101
150/* stop monitoring old dir */ 102 /* stop monitoring old dir */
151 if ((d->dir) && (d->monitor_id)) 103 if ((d->dir) && (d->monitor_id))
152 { 104 {
153 efsd_stop_monitor(e_fs_get_connection(), d->dir, TRUE); 105 efsd_stop_monitor(e_fs_get_connection(), d->dir, TRUE);
154 d->monitor_id = 0; 106 d->monitor_id = 0;
155 } 107 }
156
157 IF_FREE(d->dir); 108 IF_FREE(d->dir);
158 d->dir = e_file_realpath(dir); 109 d->dir = e_file_realpath(dir);
159 110
160/* start monitoring new dir */ 111 /* start monitoring new dir */
161 d->restarter = e_fs_add_restart_handler(e_dir_handle_fs_restart, d); 112 d->restarter = e_fs_add_restart_handler(e_dir_handle_fs_restart, d);
162 if (e_fs_get_connection()) 113 if (e_fs_get_connection())
163 { 114 {
@@ -226,7 +177,6 @@ e_dir_handle_efsd_event_reply_getfiletype(EfsdEvent * ev)
226{ 177{
227 E_File *f; 178 E_File *f;
228 char *file = NULL; 179 char *file = NULL;
229 Evas_List l;
230 E_Dir *dir; 180 E_Dir *dir;
231 181
232 char *m, *p; 182 char *m, *p;
@@ -245,9 +195,9 @@ e_dir_handle_efsd_event_reply_getfiletype(EfsdEvent * ev)
245 file = e_file_get_file(file); 195 file = e_file_get_file(file);
246 } 196 }
247 dir = e_dir_find_by_monitor_id(efsd_event_id(ev)); 197 dir = e_dir_find_by_monitor_id(efsd_event_id(ev));
248
249 f = e_file_get_by_name(dir->files, file); 198 f = e_file_get_by_name(dir->files, file);
250/* if its not in the list we care about, its filetype is meaningless */ 199
200 /* if its not in the list we care about, its filetype is meaningless */
251 if (!f) 201 if (!f)
252 D_RETURN; 202 D_RETURN;
253 203
@@ -266,19 +216,11 @@ e_dir_handle_efsd_event_reply_getfiletype(EfsdEvent * ev)
266 strcpy(mime, "unknown"); 216 strcpy(mime, "unknown");
267 } 217 }
268 e_file_set_mime(f, base, mime); 218 e_file_set_mime(f, base, mime);
269 219 /* Try to update the GUI.
270 for (l = dir->views; l; l = l->next) 220 * It's just a try because we need to have the file's stat
271 { 221 * info as well. --cK.
272 E_View *v = (E_View *) l->data; 222 */
273 E_Icon *ic = e_icon_find_by_file(v, f->file); 223 e_observee_notify_observers(E_OBSERVEE(dir), E_EVENT_FILE_INFO, f);
274
275 /* Try to update the GUI.
276 * It's just a try because we need to have the file's stat
277 * info as well. --cK.
278 */
279 e_icon_update_state(ic);
280 e_icon_initial_show(ic);
281 }
282 D_RETURN; 224 D_RETURN;
283} 225}
284 226
@@ -287,7 +229,6 @@ e_dir_handle_efsd_event_reply_stat(EfsdEvent * ev)
287{ 229{
288 E_Dir *d; 230 E_Dir *d;
289 E_File *f; 231 E_File *f;
290 Evas_List l;
291 232
292 D_ENTER; 233 D_ENTER;
293 234
@@ -308,15 +249,8 @@ e_dir_handle_efsd_event_reply_stat(EfsdEvent * ev)
308 * It's just a try because we need to have received the filetype 249 * It's just a try because we need to have received the filetype
309 * info too. --cK. */ 250 * info too. --cK. */
310 f->stat = *((struct stat *)efsd_event_data(ev)); 251 f->stat = *((struct stat *)efsd_event_data(ev));
311 for (l = d->views; l; l = l->next) 252 e_observee_notify_observers(E_OBSERVEE(d), E_EVENT_FILE_INFO, f);
312 { 253
313 E_View *v = (E_View *) l->data;
314 E_Icon *ic = e_icon_find_by_file(v, f->file);
315
316 e_icon_update_state(ic);
317 e_icon_initial_show(ic);
318 }
319
320 D_RETURN; 254 D_RETURN;
321} 255}
322 256
@@ -325,7 +259,6 @@ e_dir_handle_efsd_event_reply_readlink(EfsdEvent * ev)
325{ 259{
326 E_Dir *d; 260 E_Dir *d;
327 E_File *f; 261 E_File *f;
328 Evas_List l;
329 262
330 D_ENTER; 263 D_ENTER;
331 264
@@ -341,14 +274,7 @@ e_dir_handle_efsd_event_reply_readlink(EfsdEvent * ev)
341 { 274 {
342 e_file_set_link(f, (char *)efsd_event_data(ev)); 275 e_file_set_link(f, (char *)efsd_event_data(ev));
343 } 276 }
344 for (l = d->views; l; l = l->next) 277 e_observee_notify_observers(E_OBSERVEE(d), E_EVENT_FILE_INFO, f);
345 {
346 E_View *v = (E_View *) l->data;
347 E_Icon *ic = e_icon_find_by_file(v, f->file);
348
349 e_icon_update_state(ic);
350 e_icon_initial_show(ic);
351 }
352 278
353 D_RETURN; 279 D_RETURN;
354} 280}
@@ -371,7 +297,7 @@ e_dir_handle_efsd_event_reply_getmeta(EfsdEvent * ev)
371 297
372 v = l->data; 298 v = l->data;
373 /* ignore metadata for desktops */ 299 /* ignore metadata for desktops */
374 if (v->dir->is_desktop) 300 if (v->is_desktop)
375 continue; 301 continue;
376 if (v->geom_get.x == cmd) 302 if (v->geom_get.x == cmd)
377 { 303 {
@@ -418,27 +344,6 @@ e_dir_handle_efsd_event_reply_getmeta(EfsdEvent * ev)
418 v->size.h = 401; 344 v->size.h = 401;
419 } 345 }
420 } 346 }
421 /* FIXME currently, the bg info is not set via metadata */
422/*
423 * else if (v->getbg == cmd)
424 * {
425 * v->getbg = 0;
426 * if (efsd_metadata_get_type(ev) == EFSD_STRING)
427 * {
428 * if (ev->efsd_reply_event.errorcode == 0)
429 * {
430 * char buf[PATH_MAX];
431 *
432 * IF_FREE(v->dir->bg_file);
433 * e_strdup(v->dir->bg_file, efsd_metadata_get_str(ev));
434 * snprintf(buf, PATH_MAX, "background_reload:%s", v->dir->dir);
435 * ecore_add_event_timer(buf, 0.5, e_dir_bg_reload_timeout, 0, v->dir);
436 * }
437 * else
438 * e_dir_set_default_background(v->dir);
439 * }
440 * }
441 */
442 /* We have received all metadata we need, display the view */ 347 /* We have received all metadata we need, display the view */
443 if ((!v->geom_get.x) && 348 if ((!v->geom_get.x) &&
444 (!v->geom_get.y) && 349 (!v->geom_get.y) &&
@@ -515,52 +420,12 @@ e_dir_handle_efsd_event_reply(EfsdEvent * ev)
515 } 420 }
516 D_RETURN; 421 D_RETURN;
517} 422}
518static void
519e_dir_ib_reload_timeout(int val, void *data)
520{
521 Evas_List l;
522 E_View *v;
523 E_Dir *d;
524
525 D_ENTER;
526 d = data;
527
528 for (l = d->views; l; l = l->next)
529 {
530 v = (E_View *) l->data;
531 e_view_ib_reload(v);
532 }
533 D_RETURN;
534 UN(val);
535}
536
537static void
538e_dir_bg_reload_timeout(int val, void *data)
539{
540 Evas_List l;
541 E_View *v;
542 E_Dir *d;
543
544 D_ENTER;
545 d = data;
546
547 for (l = d->views; l; l = l->next)
548 {
549 v = (E_View *) l->data;
550 e_view_bg_reload(v);
551 }
552 D_RETURN;
553 UN(val);
554}
555 423
556void 424void
557e_dir_file_added(int id, char *file) 425e_dir_file_added(int id, char *file)
558{ 426{
559 Evas_List l;
560 E_Dir *d; 427 E_Dir *d;
561 E_View *v;
562 E_File *f; 428 E_File *f;
563 char buf[PATH_MAX];
564 429
565 D_ENTER; 430 D_ENTER;
566 431
@@ -568,31 +433,12 @@ e_dir_file_added(int id, char *file)
568 if (!file || file[0] == '/') 433 if (!file || file[0] == '/')
569 D_RETURN; 434 D_RETURN;
570 d = e_dir_find_by_monitor_id(id); 435 d = e_dir_find_by_monitor_id(id);
571 436 if (file[0] != '.')
572 if (!strcmp(file, ".e_background.bg.db"))
573 {
574 IF_FREE(d->bg_file);
575 snprintf(buf, PATH_MAX, "%s/%s", d->dir, file);
576 e_strdup(d->bg_file, buf);
577 snprintf(buf, PATH_MAX, "background_reload:%s", d->dir);
578 ecore_add_event_timer(buf, 0.5, e_dir_bg_reload_timeout, 0, d);
579 }
580 /*else if ((!strcmp(".e_iconbar.db", file)) ||
581 * (!strcmp(".e_iconbar.bits.db", file)))
582 * {
583 * snprintf(buf, PATH_MAX, "iconbar_reload:%s", m->dir);
584 * ecore_add_event_timer(buf, 0.5, e_dir_ib_reload_timeout, 0, m);
585 * } */
586 else if (file[0] != '.')
587 { 437 {
588 f = e_file_new(file); 438 f = e_file_new(file);
589 d->files = evas_list_append(d->files, f); 439 d->files = evas_list_append(d->files, f);
590 /* tell all views for this dir about the new file */ 440 /* tell all views for this dir about the new file */
591 for (l = d->views; l; l = l->next) 441 e_observee_notify_observers(E_OBSERVEE(d), E_EVENT_FILE_ADD, f);
592 {
593 v = l->data;
594 e_view_file_add(v, f);
595 }
596 } 442 }
597 D_RETURN; 443 D_RETURN;
598} 444}
@@ -600,7 +446,6 @@ e_dir_file_added(int id, char *file)
600void 446void
601e_dir_file_deleted(int id, char *file) 447e_dir_file_deleted(int id, char *file)
602{ 448{
603 Evas_List l;
604 E_File *f; 449 E_File *f;
605 E_Dir *d; 450 E_Dir *d;
606 451
@@ -613,29 +458,9 @@ e_dir_file_deleted(int id, char *file)
613 f = e_file_get_by_name(d->files, file); 458 f = e_file_get_by_name(d->files, file);
614 d->files = evas_list_remove(d->files, f); 459 d->files = evas_list_remove(d->files, f);
615 460
616 if (!strcmp(file, ".e_background.bg.db")) 461 if (file[0] != '.')
617 {
618 e_dir_set_default_background(d);
619 }
620 /*else if ((!strcmp(".e_iconbar.db", file)) ||
621 * (!strcmp(".e_iconbar.bits.db", file)))
622 * {
623 * for (l = m->views; l; l = l->next)
624 * {
625 * E_View *v = (E_View *) l->data;
626 *
627 * e_object_unref(E_OBJECT(v->iconbar));
628 * v->iconbar = NULL;
629 * }
630 * } */
631 else if (file[0] != '.')
632 { 462 {
633 for (l = d->views; l; l = l->next) 463 e_observee_notify_observers(E_OBSERVEE(d), E_EVENT_FILE_DELETE, f);
634 {
635 E_View *v = (E_View *) l->data;
636
637 e_view_file_delete(v, f);
638 }
639 } 464 }
640 D_RETURN; 465 D_RETURN;
641} 466}
@@ -643,11 +468,8 @@ e_dir_file_deleted(int id, char *file)
643void 468void
644e_dir_file_changed(int id, char *file) 469e_dir_file_changed(int id, char *file)
645{ 470{
646 Evas_List l;
647 E_Dir *d; 471 E_Dir *d;
648 E_File *f; 472 E_File *f;
649 E_View *v;
650 char buf[PATH_MAX];
651 473
652 D_ENTER; 474 D_ENTER;
653 475
@@ -655,27 +477,9 @@ e_dir_file_changed(int id, char *file)
655 D_RETURN; 477 D_RETURN;
656 d = e_dir_find_by_monitor_id(id); 478 d = e_dir_find_by_monitor_id(id);
657 f = e_file_get_by_name(d->files, file); 479 f = e_file_get_by_name(d->files, file);
658 if (!strcmp(file, ".e_background.bg.db")) 480 if (file[0] != '.')
659 { 481 {
660 IF_FREE(d->bg_file); 482 e_observee_notify_observers(E_OBSERVEE(d), E_EVENT_FILE_DELETE, f);
661 snprintf(buf, PATH_MAX, "%s/%s", d->dir, file);
662 e_strdup(d->bg_file, buf);
663 snprintf(buf, PATH_MAX, "background_reload:%s", d->dir);
664 ecore_add_event_timer(buf, 0.5, e_dir_bg_reload_timeout, 0, d);
665 }
666 else if ((!strcmp(".e_iconbar.db", file)) ||
667 (!strcmp(".e_iconbar.bits.db", file)))
668 {
669 snprintf(buf, PATH_MAX, "iconbar_reload:%s", d->dir);
670 ecore_add_event_timer(buf, 0.5, e_dir_ib_reload_timeout, 0, d);
671 }
672 else if (file[0] != '.')
673 {
674 for (l = d->views; l; l = l->next)
675 {
676 v = l->data;
677 e_view_file_changed(v, f);
678 }
679 } 483 }
680 D_RETURN; 484 D_RETURN;
681} 485}
@@ -683,7 +487,6 @@ e_dir_file_changed(int id, char *file)
683void 487void
684e_dir_file_moved(int id, char *file) 488e_dir_file_moved(int id, char *file)
685{ 489{
686 Evas_List l;
687 E_Dir *d; 490 E_Dir *d;
688 491
689 D_ENTER; 492 D_ENTER;
@@ -691,16 +494,6 @@ e_dir_file_moved(int id, char *file)
691 if (!file || file[0] == '/') 494 if (!file || file[0] == '/')
692 D_RETURN; 495 D_RETURN;
693 d = e_dir_find_by_monitor_id(id); 496 d = e_dir_find_by_monitor_id(id);
694 for (l = d->views; l; l = l->next)
695 {
696 E_View *v = (E_View *) l->data;
697 E_Icon *ic;
698
699 ic = e_icon_find_by_file(v, file);
700 if (ic)
701 {
702 }
703 }
704 D_RETURN; 497 D_RETURN;
705} 498}
706 499
diff --git a/src/e_dir.h b/src/e_dir.h
index a37adc494..4cfba5b44 100644
--- a/src/e_dir.h
+++ b/src/e_dir.h
@@ -1,8 +1,9 @@
1#ifndef E_VIEW_MODEL_H 1#ifndef E_DIR_H
2#define E_VIEW_MODEL_H 2#define E_DIR_H
3 3
4#include "fs.h" 4#include "fs.h"
5#include "iconbar.h" 5#include "iconbar.h"
6#include "observer.h"
6#include <Evas.h> 7#include <Evas.h>
7 8
8#ifndef E_VIEW_TYPEDEF 9#ifndef E_VIEW_TYPEDEF
@@ -15,32 +16,31 @@ typedef struct _E_View E_View;
15typedef struct _E_Icon E_Icon; 16typedef struct _E_Icon E_Icon;
16#endif 17#endif
17 18
18#ifndef E_VIEW_MODEL_TYPEDEF 19#ifndef E_DIR_TYPEDEF
19#define E_VIEW_MODEL_TYPEDEF 20#define E_DIR_TYPEDEF
20typedef struct _E_Dir E_Dir; 21typedef struct _E_Dir E_Dir;
21#endif 22#endif
22 23
23struct _E_Dir 24struct _E_Dir
24{ 25{
25 E_Object o; 26 E_Observee o;
26 27
27 /* The realpath of the view's directory */ 28 /* The realpath of the view's directory */
28 char *dir; 29 char *dir;
29 30
30 Evas_List files; 31 Evas_List files;
31 32
32 Evas_Object obj_bg; 33/*
33 34 * Evas_Object obj_bg;
34 char *bg_file; 35 *
36 * char *bg_file;
37 */
35 38
36 E_FS_Restarter *restarter; 39 E_FS_Restarter *restarter;
37 40
38 int monitor_id; 41 int monitor_id;
39 42
40 /* A list of all the views for which an E_Dir is sharing data */ 43 // int is_desktop;
41 Evas_List views;
42
43 int is_desktop;
44}; 44};
45 45
46/** 46/**
diff --git a/src/e_view_machine.c b/src/e_view_machine.c
index 946f61154..06ab83b45 100644
--- a/src/e_view_machine.c
+++ b/src/e_view_machine.c
@@ -1,6 +1,7 @@
1#include <Ecore.h> 1#include <Ecore.h>
2#include "e_view_machine.h" 2#include "e_view_machine.h"
3#include "e_dir.h" 3#include "e_dir.h"
4#include "e_view_look.h"
4#include "util.h" 5#include "util.h"
5#include "globals.h" 6#include "globals.h"
6#include "file.h" 7#include "file.h"
@@ -15,6 +16,7 @@ e_view_machine_init()
15 VM = NEW(E_Dir, 1); 16 VM = NEW(E_Dir, 1);
16 VM->views = NULL; 17 VM->views = NULL;
17 VM->dirs = NULL; 18 VM->dirs = NULL;
19 VM->looks = NULL;
18 e_view_init(); 20 e_view_init();
19 e_dir_init(); 21 e_dir_init();
20 } 22 }
@@ -55,6 +57,22 @@ e_view_machine_unregister_view(E_View * v)
55} 57}
56 58
57void 59void
60e_view_machine_register_look(E_View_Look * l)
61{
62 D_ENTER;
63 VM->looks = evas_list_append(VM->looks, l);
64 D_RETURN;
65}
66
67void
68e_view_machine_unregister_look(E_View_Look * l)
69{
70 D_ENTER;
71 VM->looks = evas_list_remove(VM->looks, l);
72 D_RETURN;
73}
74
75void
58e_view_machine_close_all_views(void) 76e_view_machine_close_all_views(void)
59{ 77{
60 Evas_List l; 78 Evas_List l;
@@ -100,6 +118,37 @@ e_view_machine_dir_lookup(char *path)
100 D_RETURN_(NULL); 118 D_RETURN_(NULL);
101} 119}
102 120
121E_View_Look *
122e_view_machine_look_lookup(char *path)
123{
124 E_View_Look *vl;
125 Evas_List l;
126 char *realpath = NULL;
127
128 D_ENTER;
129
130 if (!path)
131 D_RETURN_(NULL);
132
133 realpath = e_file_realpath(path);
134
135 for (l = VM->looks; l; l = l->next)
136 {
137 vl = l->data;
138 if (!strcmp(vl->dir->dir, realpath))
139 {
140 D("E_Dir for this dir already exists\n");
141
142 IF_FREE(realpath);
143 D_RETURN_(vl);
144 }
145 }
146
147 IF_FREE(realpath);
148 D_RETURN_(NULL);
149}
150
151
103E_View * 152E_View *
104e_view_machine_get_view_by_main_window(Window win) 153e_view_machine_get_view_by_main_window(Window win)
105{ 154{
@@ -131,3 +180,5 @@ e_view_machine_get_view_by_base_window(Window win)
131 } 180 }
132 D_RETURN_(NULL); 181 D_RETURN_(NULL);
133} 182}
183
184
diff --git a/src/e_view_machine.h b/src/e_view_machine.h
index 0c0547ad8..cce00b9da 100644
--- a/src/e_view_machine.h
+++ b/src/e_view_machine.h
@@ -6,6 +6,8 @@ struct _e_view_machine
6{ 6{
7 Evas_List views; 7 Evas_List views;
8 Evas_List dirs; 8 Evas_List dirs;
9 Evas_List looks;
10
9}; 11};
10typedef struct _e_view_machine E_View_Machine; 12typedef struct _e_view_machine E_View_Machine;
11 13
@@ -14,9 +16,12 @@ void e_view_machine_register_view(E_View * v);
14void e_view_machine_unregister_view(E_View * v); 16void e_view_machine_unregister_view(E_View * v);
15void e_view_machine_register_dir(E_Dir * d); 17void e_view_machine_register_dir(E_Dir * d);
16void e_view_machine_unregister_dir(E_Dir * d); 18void e_view_machine_unregister_dir(E_Dir * d);
19void e_view_machine_register_look(E_View_Look * l);
20void e_view_machine_unregister_look(E_View_Look * l);
17 21
18void e_view_machine_close_all_views(void); 22void e_view_machine_close_all_views(void);
19E_Dir *e_view_machine_dir_lookup(char *path); 23E_Dir *e_view_machine_dir_lookup(char *path);
24E_View_Look *e_view_machine_look_lookup(char *path);
20E_View *e_view_machine_get_view_by_main_window(Window win); 25E_View *e_view_machine_get_view_by_main_window(Window win);
21E_View *e_view_machine_get_view_by_base_window(Window win); 26E_View *e_view_machine_get_view_by_base_window(Window win);
22 27
diff --git a/src/iconbar.c b/src/iconbar.c
index 40dff31d3..fe1880d4c 100644
--- a/src/iconbar.c
+++ b/src/iconbar.c
@@ -236,10 +236,14 @@ e_iconbar_new(E_View * v)
236 236
237 D_ENTER; 237 D_ENTER;
238 238
239 D("new iconbar\n"); 239 D("new iconbar for view: %s\n", v->name);
240 if(!v || !v->look || !v->look->obj
241 || !v->look->obj->icb || !v->look->obj->icb_bits)
242 D_RETURN_(NULL);
243
240 /* first we want to load the iconbar data itself - ie the config info */ 244 /* first we want to load the iconbar data itself - ie the config info */
241 /* for what icons we have and what they execute */ 245 /* for what icons we have and what they execute */
242 snprintf(buf, PATH_MAX, "%s/.e_layout/iconbar.db", v->dir->dir); 246 snprintf(buf, PATH_MAX, "%s", v->look->obj->icb);
243 /* use the config system to simply load up the db and start making */ 247 /* use the config system to simply load up the db and start making */
244 /* structs and lists and stuff for us... we told it how to in init */ 248 /* structs and lists and stuff for us... we told it how to in init */
245 ib = e_config_load(buf, "", cf_iconbar); 249 ib = e_config_load(buf, "", cf_iconbar);
@@ -289,7 +293,7 @@ e_iconbar_new(E_View * v)
289 293
290 /* now we need to load up a bits file that tells us where in the view the */ 294 /* now we need to load up a bits file that tells us where in the view the */
291 /* iconbar is meant to go. same place. just a slightly different name */ 295 /* iconbar is meant to go. same place. just a slightly different name */
292 snprintf(buf, PATH_MAX, "%s/.e_layout/iconbar.bits.db", v->dir->dir); 296 snprintf(buf, PATH_MAX, "%s", ib->view->look->obj->icb_bits);
293 ib->bit = ebits_load(buf); 297 ib->bit = ebits_load(buf);
294 298
295 /* we didn't find one? */ 299 /* we didn't find one? */
@@ -383,6 +387,8 @@ e_iconbar_realize(E_Iconbar * ib)
383{ 387{
384 Evas_List l; 388 Evas_List l;
385 389
390 if (!ib) D_RETURN;
391
386 D_ENTER; 392 D_ENTER;
387 D("realize iconbar\n"); 393 D("realize iconbar\n");
388 /* create clip object */ 394 /* create clip object */
@@ -399,8 +405,8 @@ e_iconbar_realize(E_Iconbar * ib)
399 /* the path of the key to the image memebr - that is actually */ 405 /* the path of the key to the image memebr - that is actually */
400 /* a lump of image data inlined in the iconbar db - so the icons */ 406 /* a lump of image data inlined in the iconbar db - so the icons */
401 /* themselves follow the iconbar wherever it goes */ 407 /* themselves follow the iconbar wherever it goes */
402 snprintf(buf, PATH_MAX, "%s/.e_layout/iconbar.db:%s", 408 snprintf(buf, PATH_MAX, "%s:%s",
403 ib->view->dir->dir, ic->image_path); 409 ib->view->look->obj->icb, ic->image_path);
404 /* add the icon image object */ 410 /* add the icon image object */
405 ic->image = evas_add_image_from_file(ib->view->evas, buf); 411 ic->image = evas_add_image_from_file(ib->view->evas, buf);
406 /* add an imlib image so we can save it later */ 412 /* add an imlib image so we can save it later */
@@ -514,16 +520,13 @@ e_iconbar_fix(E_Iconbar * ib)
514 double ix, iy, aw, ah; 520 double ix, iy, aw, ah;
515 521
516 D_ENTER; 522 D_ENTER;
517 523 x = y = w = h = 0;
518 /* get geometry from layout */ 524 /* get geometry from layout */
519 if (!e_view_layout_get_element_geometry(ib->view->layout, "Iconbar", 525 if (!e_view_layout_get_element_geometry(ib->view->layout, "Iconbar",
520 &x, &y, &w, &h)) 526 &x, &y, &w, &h))
521 { 527 {
522 D("Error: no geometry for iconbar, must not exist, clean it up.\n");
523 e_object_unref(E_OBJECT (ib));
524 D_RETURN; 528 D_RETURN;
525 } 529 }
526
527 D("iconbar fix: %f, %f, %f, %f\n", x, y, w, h); 530 D("iconbar fix: %f, %f, %f, %f\n", x, y, w, h);
528 /* move and resize iconbar to geometry specified in layout */ 531 /* move and resize iconbar to geometry specified in layout */
529 ebits_move(ib->bit, x, y); 532 ebits_move(ib->bit, x, y);
@@ -669,33 +672,6 @@ e_iconbar_fix(E_Iconbar * ib)
669} 672}
670 673
671/** 674/**
672 * e_iconbar_file_delete - Function to remove a file from an iconbox.
673 * @v: The view in which a file is removed
674 * @file: Name of the removed file
675 *
676 * This function is called whenever a file is deleted from a view.
677 */
678void
679e_iconbar_file_delete(E_View * v, char *file)
680{
681 D_ENTER;
682
683 /* is the file of interest */
684 if ((!strcmp("iconbar.db", file)) || (!strcmp("iconbar.bits.db", file)))
685 {
686 /* if we have an iconbar.. delete it - because its files have been */
687 /* nuked. no need to keep it around. */
688 if (v->iconbar)
689 {
690 e_object_unref(E_OBJECT(v->iconbar));
691 v->iconbar = NULL;
692 }
693 }
694
695 D_RETURN;
696}
697
698/**
699 * e_iconbar_save_out_final - save out final state of iconbar back to disk 675 * e_iconbar_save_out_final - save out final state of iconbar back to disk
700 * @ib: The iconbar 676 * @ib: The iconbar
701 * 677 *
@@ -877,12 +853,12 @@ ib_timeout(int val, void *data)
877 ic->hi.start = ecore_get_time(); 853 ic->hi.start = ecore_get_time();
878 /* no hilite (animation) image */ 854 /* no hilite (animation) image */
879 if (!ic->hi.image) 855 if (!ic->hi.image)
880 { 856 {
881 char buf[PATH_MAX]; 857 char buf[PATH_MAX];
882 858
883 /* figure out its path */ 859 /* figure out its path */
884 snprintf(buf, PATH_MAX, "%s/.e_iconbar.db:%s", 860 snprintf(buf, PATH_MAX, "%s:%s",
885 ic->iconbar->view->dir->dir, ic->image_path); 861 ic->iconbar->view->look->obj->icb, ic->image_path);
886 /* add it */ 862 /* add it */
887 ic->hi.image = evas_add_image_from_file(ic->iconbar->view->evas, 863 ic->hi.image = evas_add_image_from_file(ic->iconbar->view->evas,
888 buf); 864 buf);
@@ -1560,8 +1536,6 @@ e_iconbar_dnd_add_files(E_View * v, E_View * source, int num_files,
1560 int i; 1536 int i;
1561 1537
1562 D_ENTER; 1538 D_ENTER;
1563
1564#if 0
1565 D("add files: %s\n", source->dir->dir); 1539 D("add files: %s\n", source->dir->dir);
1566 for (i = 0; i < num_files; i++) 1540 for (i = 0; i < num_files; i++)
1567 { 1541 {
@@ -1570,8 +1544,8 @@ e_iconbar_dnd_add_files(E_View * v, E_View * source, int num_files,
1570 1544
1571 if (ic) 1545 if (ic)
1572 { 1546 {
1573 D("icon mime.base: %s\n", ic->info.mime.base); 1547 D("icon mime.base: %s\n", ic->file->info.mime.base);
1574 if (!strcmp(ic->info.mime.base, "db")) 1548 if (!strcmp(ic->file->info.mime.base, "db"))
1575 { 1549 {
1576 /* if its an icon db, set the icon */ 1550 /* if its an icon db, set the icon */
1577 D("db!\n"); 1551 D("db!\n");
@@ -1594,7 +1568,7 @@ e_iconbar_dnd_add_files(E_View * v, E_View * source, int num_files,
1594 { 1568 {
1595 D("over icon: %s\n", ibic->exec); 1569 D("over icon: %s\n", ibic->exec);
1596 snprintf(buf, PATH_MAX, "%s/%s:/icon/normal", 1570 snprintf(buf, PATH_MAX, "%s/%s:/icon/normal",
1597 ic->view->dir->dir, ic->file); 1571 ic->view->dir->dir, ic->file->file);
1598 D("set icon: %s\n", buf); 1572 D("set icon: %s\n", buf);
1599 1573
1600 ibic->imlib_image = imlib_load_image(buf); 1574 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,
1607 } 1581 }
1608 break; 1582 break;
1609 } 1583 }
1610 else if (e_file_can_exec(&ic->stat)) 1584 else if (e_file_can_exec(&ic->file->stat))
1611 { 1585 {
1612 execs = evas_list_append(execs, ic); 1586 execs = evas_list_append(execs, ic);
1613 } 1587 }
@@ -1639,13 +1613,13 @@ e_iconbar_dnd_add_files(E_View * v, E_View * source, int num_files,
1639 D("x: %f, v-dir: %s, ib-dir: %s\n", ibic->iconbar->icon_area.x, 1613 D("x: %f, v-dir: %s, ib-dir: %s\n", ibic->iconbar->icon_area.x,
1640 v->dir->dir, ibic->iconbar->view->dir->dir); 1614 v->dir->dir, ibic->iconbar->view->dir->dir);
1641 1615
1642 if (!ic->info.icon) 1616 if (!ic->file->info.icon)
1643 D_RETURN; 1617 D_RETURN;
1644 snprintf(buf, PATH_MAX, "%s:/icon/normal", ic->info.icon); 1618 snprintf(buf, PATH_MAX, "%s:/icon/normal", ic->file->info.icon);
1645 ibic->image = evas_add_image_from_file(v->evas, buf); 1619 ibic->image = evas_add_image_from_file(v->evas, buf);
1646 ibic->imlib_image = imlib_load_image(buf); 1620 ibic->imlib_image = imlib_load_image(buf);
1647 ibic->image_path = strdup(ic->info.icon); 1621 ibic->image_path = strdup(ic->file->info.icon);
1648 snprintf(buf, PATH_MAX, "%s/%s", ic->view->dir->dir, ic->file); 1622 snprintf(buf, PATH_MAX, "%s/%s", ic->view->dir->dir, ic->file->file);
1649 ibic->exec = strdup(buf); 1623 ibic->exec = strdup(buf);
1650 1624
1651 evas_set_clip(v->evas, ibic->image, v->iconbar->clip); 1625 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,
1668 /* this adds the icon to the correct place in the list and saves */ 1642 /* this adds the icon to the correct place in the list and saves */
1669 e_iconbar_icon_move(ibic, v->iconbar->dnd.x, v->iconbar->dnd.y); 1643 e_iconbar_icon_move(ibic, v->iconbar->dnd.x, v->iconbar->dnd.y);
1670 } 1644 }
1671
1672#endif
1673} 1645}
1674 1646
1675/* called when child processes exit */ 1647/* called when child processes exit */
@@ -1721,21 +1693,6 @@ ib_child_handle(Ecore_Event * ev)
1721 D_RETURN; 1693 D_RETURN;
1722} 1694}
1723 1695
1724void
1725e_iconbar_update_geometry(E_Iconbar * ib)
1726{
1727 double x, y, w, h;
1728
1729 D_ENTER;
1730 if (e_view_layout_get_element_geometry(ib->view->layout, "Iconbar",
1731 &x, &y, &w, &h))
1732 {
1733 ebits_move(ib->bit, x, y);
1734 ebits_resize(ib->bit, w, h);
1735 }
1736
1737}
1738
1739E_Rect * 1696E_Rect *
1740e_iconbar_get_resist_rect(E_Iconbar * ib) 1697e_iconbar_get_resist_rect(E_Iconbar * ib)
1741{ 1698{
diff --git a/src/icons.c b/src/icons.c
index d57a5ec21..6b18ba4f8 100644
--- a/src/icons.c
+++ b/src/icons.c
@@ -927,9 +927,10 @@ e_icon_exec(E_Icon * ic)
927 v->options.back_pixmap = 0; 927 v->options.back_pixmap = 0;
928 snprintf(buf, PATH_MAX, "%s/%s", ic->view->dir->dir, ic->file->file); 928 snprintf(buf, PATH_MAX, "%s/%s", ic->view->dir->dir, ic->file->file);
929 D("new dir >%s<\n", buf); 929 D("new dir >%s<\n", buf);
930 e_view_set_dir(v, buf, 0); 930 e_view_set_dir(v, buf);
931 e_view_realize(v); 931 e_view_realize(v);
932 e_view_populate(v); 932 e_view_populate(v);
933 e_view_set_look(v, NULL);
933 934
934 e_view_bg_reload(v); 935 e_view_bg_reload(v);
935 ecore_window_set_title(v->win.base, ic->file->file); 936 ecore_window_set_title(v->win.base, ic->file->file);
diff --git a/src/observer.c b/src/observer.c
index 389bacdd5..3762249b7 100644
--- a/src/observer.c
+++ b/src/observer.c
@@ -95,7 +95,7 @@ e_observee_init(E_Observee * obs, E_Cleanup_Func cleanup_func)
95} 95}
96 96
97void 97void
98e_observee_notify_observers(E_Observee * o, E_Event_Type event) 98e_observee_notify_observers(E_Observee * o, E_Event_Type event, void *data)
99{ 99{
100 Evas_List obs_list = NULL; 100 Evas_List obs_list = NULL;
101 E_Observer *obs = NULL; 101 E_Observer *obs = NULL;
@@ -112,7 +112,7 @@ e_observee_notify_observers(E_Observee * o, E_Event_Type event)
112 /* check bit mask */ 112 /* check bit mask */
113 if (obs->event & event) 113 if (obs->event & event)
114 { 114 {
115 obs->notify_func(obs, o, event); 115 obs->notify_func(obs, o, event, data);
116 } 116 }
117 } 117 }
118 118
@@ -120,7 +120,7 @@ e_observee_notify_observers(E_Observee * o, E_Event_Type event)
120} 120}
121 121
122void 122void
123e_observee_notify_all_observers(E_Observee * o, E_Event_Type event) 123e_observee_notify_all_observers(E_Observee * o, E_Event_Type event, void *data)
124{ 124{
125 Evas_List obs_list = NULL; 125 Evas_List obs_list = NULL;
126 E_Observer *obs = NULL; 126 E_Observer *obs = NULL;
@@ -137,7 +137,7 @@ e_observee_notify_all_observers(E_Observee * o, E_Event_Type event)
137 /* check bit mask */ 137 /* check bit mask */
138 if (obs->event & event) 138 if (obs->event & event)
139 { 139 {
140 obs->notify_func(obs, o, event); 140 obs->notify_func(obs, o, event, data);
141 } 141 }
142 } 142 }
143 143
diff --git a/src/observer.h b/src/observer.h
index 1713455ce..c864723eb 100644
--- a/src/observer.h
+++ b/src/observer.h
@@ -29,6 +29,15 @@ typedef enum _e_event_type
29 E_EVENT_DESKTOP_DELETE = 1 << 11, 29 E_EVENT_DESKTOP_DELETE = 1 << 11,
30 E_EVENT_DESKTOP_SWITCH = 1 << 12, 30 E_EVENT_DESKTOP_SWITCH = 1 << 12,
31 31
32 E_EVENT_FILE_ADD = 1 << 13,
33 E_EVENT_FILE_CHANGE = 1 << 14,
34 E_EVENT_FILE_DELETE = 1 << 15,
35 E_EVENT_FILE_INFO = 1 << 16,
36
37 E_EVENT_BG_CHANGED = 1 << 17,
38 E_EVENT_ICB_CHANGED = 1 << 18,
39 E_EVENT_LAYOUT_CHANGED = 1 << 19,
40
32 /* meta event types */ 41 /* meta event types */
33 E_EVENT_BORDER_ALL = E_EVENT_BORDER_NEW | 42 E_EVENT_BORDER_ALL = E_EVENT_BORDER_NEW |
34 E_EVENT_BORDER_DELETE | E_EVENT_BORDER_FOCUS_IN | 43 E_EVENT_BORDER_DELETE | E_EVENT_BORDER_FOCUS_IN |
@@ -44,7 +53,8 @@ E_Event_Type;
44 53
45typedef void (*E_Notify_Func) (E_Observer * observer, 54typedef void (*E_Notify_Func) (E_Observer * observer,
46 E_Observee * observee, 55 E_Observee * observee,
47 E_Event_Type event); 56 E_Event_Type event,
57 void *data);
48 58
49struct _e_observer 59struct _e_observer
50{ 60{
@@ -130,13 +140,16 @@ void e_observee_cleanup(E_Observee * obs);
130 * e_observee_notify_observers - Notify observers of a given Ecore event 140 * e_observee_notify_observers - Notify observers of a given Ecore event
131 * @o: The observee which notifies its observers 141 * @o: The observee which notifies its observers
132 * @event: The event by which to filter the observers 142 * @event: The event by which to filter the observers
143 * @data: arbitrary data attached to the event
133 * 144 *
134 * This function scans the registered observers in the observee 145 * This function scans the registered observers in the observee
135 * and calls the notify_func() of the observers that are 146 * and calls the notify_func() of the observers that are
136 * responsible for the given @event. 147 * responsible for the given @event.
137 */ 148 */
138void e_observee_notify_observers(E_Observee * o, 149void e_observee_notify_observers(E_Observee * o,
139 E_Event_Type event); 150 E_Event_Type event,
151 void *data
152 );
140 153
141/** 154/**
142 * e_observee_notify_all_observers - Notify all observers of a given E event 155 * 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,
144 * 157 *
145 * @o: The observee which notifies the observers 158 * @o: The observee which notifies the observers
146 * @event: The event by which to filter the observers 159 * @event: The event by which to filter the observers
160 * @data: arbitrary data attached to the event
147 * 161 *
148 * This function scans ALL observers in the observee 162 * This function scans ALL observers in the observee
149 * and calls the notify_func() of the observers that are 163 * and calls the notify_func() of the observers that are
@@ -153,5 +167,6 @@ void e_observee_notify_observers(E_Observee * o,
153 * it as a legitimate observee. 167 * it as a legitimate observee.
154 */ 168 */
155void e_observee_notify_all_observers(E_Observee * o, 169void e_observee_notify_all_observers(E_Observee * o,
156 E_Event_Type event); 170 E_Event_Type event,
171 void *data);
157#endif 172#endif
diff --git a/src/view.c b/src/view.c
index 6c1d16545..a61f76270 100644
--- a/src/view.c
+++ b/src/view.c
@@ -913,91 +913,54 @@ e_configure(Ecore_Event * ev)
913 D_ENTER; 913 D_ENTER;
914 914
915 e = ev->event; 915 e = ev->event;
916 if (e && e->win) 916 if (!e || !e->win)
917 { 917 D_RETURN;
918 v = e_view_machine_get_view_by_base_window(e->win); 918 v = e_view_machine_get_view_by_base_window(e->win);
919 if (v) 919 if (!v)
920 { 920 D_RETURN;
921 /* win, root, x, y, w, h, wm_generated */ 921 /* win, root, x, y, w, h, wm_generated */
922 D("Configure for view: %s\n", v->name); 922 D("Configure for view: %s\n", v->name);
923 if (e->wm_generated) 923 if (e->wm_generated)
924 { 924 {
925 D("wm generated %i %i, %ix%i\n", e->x, e->y, e->w, e->h); 925 D("wm generated %i %i, %ix%i\n", e->x, e->y, e->w, e->h);
926 if ((e->x != v->location.x) || (e->y != v->location.y)) 926 if ((e->x != v->location.x) || (e->y != v->location.y))
927 { 927 {
928 D("new spot!\n"); 928 D("new spot!\n");
929 v->location.x = e->x; 929 v->location.x = e->x;
930 v->location.y = e->y; 930 v->location.y = e->y;
931 /* FIXME */ 931 }
932 //e_view_queue_geometry_record(v); 932 }
933 } 933 D("size %ix%i\n", e->w, e->h);
934 } 934 if ((e->w != v->size.w) || (e->h != v->size.h) || (v->size.force))
935 D("size %ix%i\n", e->w, e->h); 935 {
936 if ((e->w != v->size.w) || (e->h != v->size.h) || (v->size.force)) 936 v->size.force = 0;
937 { 937 D("... a new size!\n");
938 v->size.force = 0; 938 v->size.w = e->w;
939 D("... a new size!\n"); 939 v->size.h = e->h;
940 v->size.w = e->w; 940 if (v->pmap)
941 v->size.h = e->h; 941 ecore_pixmap_free(v->pmap);
942 if (v->pmap) 942 v->pmap = 0;
943 ecore_pixmap_free(v->pmap); 943 ecore_window_resize(v->win.main, v->size.w, v->size.h);
944 v->pmap = 0; 944 if (v->options.back_pixmap)
945 ecore_window_resize(v->win.main, v->size.w, v->size.h); 945 {
946 if (v->options.back_pixmap) 946 v->pmap =
947 { 947 ecore_pixmap_new(v->win.main, v->size.w, v->size.h,
948 v->pmap = 948 0);
949 ecore_pixmap_new(v->win.main, v->size.w, v->size.h, 949 evas_set_output(v->evas, ecore_display_get(), v->pmap,
950 0); 950 evas_get_visual(v->evas),
951 evas_set_output(v->evas, ecore_display_get(), v->pmap, 951 evas_get_colormap(v->evas));
952 evas_get_visual(v->evas), 952 ecore_window_set_background_pixmap(v->win.main, v->pmap);
953 evas_get_colormap(v->evas)); 953 ecore_window_clear(v->win.main);
954 ecore_window_set_background_pixmap(v->win.main, v->pmap); 954 }
955 ecore_window_clear(v->win.main); 955 if (v->bg)
956 } 956 e_bg_resize(v->bg, v->size.w, v->size.h);
957 if (v->bg) 957 D("evas_set_output_viewpor(%p)\n", v->evas);
958 e_bg_resize(v->bg, v->size.w, v->size.h); 958 evas_set_output_viewport(v->evas, 0, 0, v->size.w, v->size.h);
959 D("evas_set_output_viewpor(%p)\n", v->evas); 959 evas_set_output_size(v->evas, v->size.w, v->size.h);
960 evas_set_output_viewport(v->evas, 0, 0, v->size.w, v->size.h); 960 e_view_scroll_to(v, v->scroll.x, v->scroll.y);
961 evas_set_output_size(v->evas, v->size.w, v->size.h); 961 e_view_arrange(v);
962 e_view_scroll_to(v, v->scroll.x, v->scroll.y); 962 e_view_layout_update(v->layout);
963 e_view_arrange(v); 963 }
964 if (v->layout)
965 e_view_layout_update(v->layout);
966 /* FIXME */
967 //e_view_queue_geometry_record(v);
968
969 {
970 double x, y, w, h;
971
972 if (e_view_layout_get_element_geometry(v->layout,
973 "Scrollbar_H",
974 &x, &y, &w, &h))
975 {
976 e_scrollbar_move(v->scrollbar.h, x, y);
977 e_scrollbar_resize(v->scrollbar.h, w, h);
978 }
979 if (e_view_layout_get_element_geometry(v->layout,
980 "Scrollbar_V",
981 &x, &y, &w, &h))
982 {
983 e_scrollbar_move(v->scrollbar.v, x, y);
984 e_scrollbar_resize(v->scrollbar.v, w, h);
985 }
986 }
987
988 e_scrollbar_move(v->scrollbar.v,
989 v->size.w - v->scrollbar.v->w, 0);
990 e_scrollbar_resize(v->scrollbar.v, v->scrollbar.v->w,
991 v->size.h - v->scrollbar.h->h);
992 e_scrollbar_move(v->scrollbar.h, 0,
993 v->size.h - v->scrollbar.h->h);
994 e_scrollbar_resize(v->scrollbar.h,
995 v->size.w - v->scrollbar.v->w,
996 v->scrollbar.h->h);
997 }
998 }
999 }
1000
1001 D_RETURN; 964 D_RETURN;
1002} 965}
1003 966
@@ -1352,7 +1315,7 @@ e_mouse_in(Ecore_Event * ev)
1352 { 1315 {
1353 if ((v = e_view_machine_get_view_by_main_window(e->win))) 1316 if ((v = e_view_machine_get_view_by_main_window(e->win)))
1354 { 1317 {
1355 if (v->dir->is_desktop) 1318 if (v->is_desktop)
1356 { 1319 {
1357 evas_event_enter(v->evas); 1320 evas_event_enter(v->evas);
1358 } 1321 }
@@ -1564,6 +1527,39 @@ e_view_resort_timeout(int val, void *data)
1564 UN(val); 1527 UN(val);
1565} 1528}
1566 1529
1530static void
1531e_view_layout_reload_timeout(int val, void *data)
1532{
1533 E_View *v;
1534 D_ENTER;
1535 v = data;
1536 e_view_layout_reload(v);
1537 D_RETURN;
1538 UN(val);
1539}
1540
1541static void
1542e_view_bg_reload_timeout(int val, void *data)
1543{
1544 E_View *v;
1545 D_ENTER;
1546 v = data;
1547 e_view_bg_reload(v);
1548 D_RETURN;
1549 UN(val);
1550}
1551
1552static void
1553e_view_ib_reload_timeout(int val, void *data)
1554{
1555 E_View *v;
1556 D_ENTER;
1557 v = data;
1558 e_view_ib_reload(v);
1559 D_RETURN;
1560 UN(val);
1561}
1562
1567void 1563void
1568e_view_queue_resort(E_View * v) 1564e_view_queue_resort(E_View * v)
1569{ 1565{
@@ -1610,7 +1606,9 @@ e_view_cleanup(E_View * v)
1610 ecore_del_event_timer(name); 1606 ecore_del_event_timer(name);
1611 1607
1612 /* unregister with the underlying dir and the global list of views */ 1608 /* unregister with the underlying dir and the global list of views */
1613 e_dir_unregister_view(v); 1609 e_observer_unregister_observee(E_OBSERVER(v), E_OBSERVEE(v->dir));
1610 e_object_unref(E_OBJECT(v->dir));
1611 v->dir = NULL;
1614 e_view_machine_unregister_view(v); 1612 e_view_machine_unregister_view(v);
1615 /* FIXME: clean up the rest!!! this leaks ... */ 1613 /* FIXME: clean up the rest!!! this leaks ... */
1616 1614
@@ -1619,6 +1617,43 @@ e_view_cleanup(E_View * v)
1619 D_RETURN; 1617 D_RETURN;
1620} 1618}
1621 1619
1620void
1621e_view_file_event_handler(E_Observer *obs, E_Observee *o, E_Event_Type event, void *data)
1622{
1623 E_View *v = (E_View *) obs;
1624 E_File *f = (E_File *) data;
1625 char buf[PATH_MAX];
1626
1627 D_ENTER;
1628
1629 if (event & E_EVENT_FILE_ADD)
1630 e_view_file_add(v, f);
1631 else if (event & E_EVENT_FILE_DELETE)
1632 e_view_file_delete(v, f);
1633 else if (event & E_EVENT_FILE_CHANGE)
1634 e_view_file_changed(v, f);
1635 else if (event & E_EVENT_FILE_INFO)
1636 e_view_file_try_to_show(v, f);
1637 else if (event & E_EVENT_BG_CHANGED)
1638 {
1639 snprintf(buf, PATH_MAX, "background_reload:%s", v->name);
1640 ecore_add_event_timer(buf, 0.5, e_view_bg_reload_timeout, 0, v);
1641 }
1642 else if (event & E_EVENT_ICB_CHANGED)
1643 {
1644 snprintf(buf, PATH_MAX, "iconbar_reload:%s", v->name);
1645 ecore_add_event_timer(buf, 0.5, e_view_ib_reload_timeout, 0, v);
1646 }
1647 else if (event & E_EVENT_LAYOUT_CHANGED)
1648 {
1649 snprintf(buf, PATH_MAX, "layout_reload:%s", v->name);
1650 ecore_add_event_timer(buf, 0.5, e_view_layout_reload_timeout, 0, v);
1651 }
1652
1653 D_RETURN;
1654 UN(o);
1655}
1656
1622E_View * 1657E_View *
1623e_view_new(void) 1658e_view_new(void)
1624{ 1659{
@@ -1629,8 +1664,14 @@ e_view_new(void)
1629 v = NEW(E_View, 1); 1664 v = NEW(E_View, 1);
1630 ZERO(v, E_View, 1); 1665 ZERO(v, E_View, 1);
1631 1666
1632 e_object_init(E_OBJECT(v), (E_Cleanup_Func) e_view_cleanup); 1667 e_observer_init(E_OBSERVER(v),
1668 E_EVENT_FILE_ADD | E_EVENT_FILE_DELETE | E_EVENT_FILE_CHANGE
1669 | E_EVENT_FILE_INFO | E_EVENT_BG_CHANGED | E_EVENT_ICB_CHANGED
1670 | E_EVENT_LAYOUT_CHANGED ,
1671 (E_Notify_Func) e_view_file_event_handler,
1672 (E_Cleanup_Func) e_view_cleanup);
1633 1673
1674
1634#define SOFT_DESK 1675#define SOFT_DESK
1635/* #define X_DESK */ 1676/* #define X_DESK */
1636/* #define GL_DESK */ 1677/* #define GL_DESK */
@@ -1674,11 +1715,60 @@ _member.r = _r; _member.g = _g; _member.b = _b; _member.a = _a;
1674 1715
1675 e_view_machine_register_view(v); 1716 e_view_machine_register_view(v);
1676 1717
1718
1677 D_RETURN_(v); 1719 D_RETURN_(v);
1678} 1720}
1679 1721
1680void 1722void
1681e_view_set_dir(E_View * v, char *path, int is_desktop) 1723e_view_set_look(E_View * v, char *path)
1724{
1725 E_View_Look *l = NULL;
1726 char buf[PATH_MAX];
1727 D_ENTER;
1728
1729 if (v->look)
1730 e_object_unref(E_OBJECT(v->look));
1731
1732 if(!path)
1733 {
1734 /*
1735 * no path specified, lets look in the view's dir. If
1736 * there is a e_layout dir there, use whats in there.
1737 * Otherwise use the default dir.
1738 */
1739 snprintf(buf, PATH_MAX, "%s/.e_layout", v->dir->dir);
1740 if (e_file_exists(buf) && e_file_is_dir(buf))
1741 path = buf;
1742 else
1743 {
1744 snprintf(buf, PATH_MAX, "%s/appearance", e_config_user_dir());
1745 path = buf;
1746 }
1747 }
1748
1749 if ( !(l=e_view_machine_look_lookup(path)) )
1750 {
1751 v->look = e_view_look_new();
1752 e_view_look_set_dir (v->look, path);
1753 }
1754 else
1755 {
1756 v->look = l;
1757 e_object_ref(E_OBJECT(v->look));
1758 }
1759 if(v->look)
1760 {
1761 e_observer_register_observee(E_OBSERVER(v), E_OBSERVEE(v->look->obj));
1762
1763 e_view_bg_reload(v);
1764 e_view_layout_reload(v);
1765 e_view_ib_reload(v);
1766 }
1767 D_RETURN;
1768}
1769
1770void
1771e_view_set_dir(E_View * v, char *path)
1682{ 1772{
1683 E_Dir *d = NULL; 1773 E_Dir *d = NULL;
1684 char buf[PATH_MAX]; 1774 char buf[PATH_MAX];
@@ -1691,34 +1781,18 @@ e_view_set_dir(E_View * v, char *path, int is_desktop)
1691 if (!(d = e_view_machine_dir_lookup(path))) 1781 if (!(d = e_view_machine_dir_lookup(path)))
1692 { 1782 {
1693 D("Model for this dir doesn't exist, make a new one\n"); 1783 D("Model for this dir doesn't exist, make a new one\n");
1694
1695 d = e_dir_new(); 1784 d = e_dir_new();
1696 e_dir_set_dir(d, path); 1785 e_dir_set_dir(d, path);
1697
1698 snprintf(buf, PATH_MAX, "%s/.e_background.bg.db", d->dir);
1699 if (!e_file_exists(buf))
1700 {
1701 if (is_desktop)
1702 {
1703 snprintf(buf, PATH_MAX, "%s/default.bg.db",
1704 e_config_get("backgrounds"));
1705 }
1706 else
1707 {
1708 snprintf(buf, PATH_MAX, "%s/view.bg.db",
1709 e_config_get("backgrounds"));
1710 }
1711 }
1712 e_strdup(d->bg_file, buf);
1713 d->is_desktop = is_desktop;
1714 } 1786 }
1787 else
1788 e_object_ref(E_OBJECT(d));
1715 1789
1716 if (d) 1790 if (d)
1717 { 1791 {
1718 e_dir_register_view(d, v); 1792 v->dir = d;
1793 e_observer_register_observee(E_OBSERVER(v), E_OBSERVEE(d));
1719 /* FIXME do a real naming scheme here */ 1794 /* FIXME do a real naming scheme here */
1720 snprintf(buf, PATH_MAX, "%s:%d", v->dir->dir, 1795 snprintf(buf, PATH_MAX, "%s:%d", v->dir->dir, e_object_get_usecount(E_OBJECT(v->dir)));
1721 e_object_get_usecount(E_OBJECT(v->dir)));
1722 e_strdup(v->name, buf); 1796 e_strdup(v->name, buf);
1723 D("assigned name to view: %s\n", v->name); 1797 D("assigned name to view: %s\n", v->name);
1724 1798
@@ -1731,16 +1805,11 @@ e_view_set_dir(E_View * v, char *path, int is_desktop)
1731 "/view/w", v->dir->dir, EFSD_INT); 1805 "/view/w", v->dir->dir, EFSD_INT);
1732 v->geom_get.h = efsd_get_metadata(e_fs_get_connection(), 1806 v->geom_get.h = efsd_get_metadata(e_fs_get_connection(),
1733 "/view/h", v->dir->dir, EFSD_INT); 1807 "/view/h", v->dir->dir, EFSD_INT);
1734 /* FIXME currently, we dont use this anyway */
1735 /*
1736 * * v->getbg = efsd_get_metadata(e_fs_get_connection(),
1737 * * "/view/background", v->dir->dir, EFSD_STRING);
1738 */
1739 v->geom_get.busy = 1; 1808 v->geom_get.busy = 1;
1740 } 1809 }
1741 else 1810 else
1742 { 1811 {
1743 /* FIXME error handling */ 1812 D("Couldnt set dir for view! Bad!");
1744 } 1813 }
1745 D_RETURN; 1814 D_RETURN;
1746} 1815}
@@ -1782,40 +1851,6 @@ e_view_realize(E_View * v)
1782 evas_get_visual(v->evas), evas_get_colormap(v->evas)); 1851 evas_get_visual(v->evas), evas_get_colormap(v->evas));
1783 ecore_window_set_background_pixmap(v->win.main, v->pmap); 1852 ecore_window_set_background_pixmap(v->win.main, v->pmap);
1784 } 1853 }
1785 if (v->bg)
1786 {
1787 e_bg_add_to_evas(v->bg, v->evas);
1788 e_bg_set_scroll(v->bg, v->scroll.x, v->scroll.y);
1789 e_bg_set_layer(v->bg, 100);
1790 e_bg_resize(v->bg, v->size.w, v->size.h);
1791
1792 e_bg_callback_add(v->bg, CALLBACK_MOUSE_UP, e_bg_up_cb, v);
1793 e_bg_callback_add(v->bg, CALLBACK_MOUSE_DOWN, e_bg_down_cb, v);
1794 e_bg_callback_add(v->bg, CALLBACK_MOUSE_MOVE, e_bg_move_cb, v);
1795
1796 e_bg_show(v->bg);
1797 }
1798
1799 /* load the layout */
1800 v->layout = e_view_layout_new(v);
1801 if (v->layout)
1802 e_view_layout_realize(v->layout);
1803
1804 /* set the file area spacing, if in layout */
1805 /* FIXME: the icon layout should probably be totally redone */
1806 {
1807 double x, y, w, h;
1808
1809 if (e_view_layout_get_element_geometry(v->layout, "Icons",
1810 &x, &y, &w, &h))
1811 {
1812 v->spacing.window.l = x;
1813 v->spacing.window.r = v->size.w - (x + w);
1814 v->spacing.window.t = y;
1815 v->spacing.window.b = v->size.h - (y + h);
1816 }
1817 }
1818
1819 v->scrollbar.v = e_scrollbar_new(v); 1854 v->scrollbar.v = e_scrollbar_new(v);
1820 e_scrollbar_set_change_func(v->scrollbar.v, e_view_scrollbar_v_change_cb, v); 1855 e_scrollbar_set_change_func(v->scrollbar.v, e_view_scrollbar_v_change_cb, v);
1821 e_scrollbar_set_direction(v->scrollbar.v, 1); 1856 e_scrollbar_set_direction(v->scrollbar.v, 1);
@@ -1834,39 +1869,10 @@ e_view_realize(E_View * v)
1834 e_scrollbar_set_range(v->scrollbar.h, 1.0); 1869 e_scrollbar_set_range(v->scrollbar.h, 1.0);
1835 e_scrollbar_set_max(v->scrollbar.h, 1.0); 1870 e_scrollbar_set_max(v->scrollbar.h, 1.0);
1836 1871
1837 {
1838 double x, y, w, h;
1839
1840 if (e_view_layout_get_element_geometry(v->layout, "Scrollbar_H",
1841 &x, &y, &w, &h))
1842 {
1843 e_scrollbar_move(v->scrollbar.h, x, y);
1844 e_scrollbar_resize(v->scrollbar.h, w, h);
1845 }
1846
1847 if (e_view_layout_get_element_geometry(v->layout, "Scrollbar_V",
1848 &x, &y, &w, &h))
1849 {
1850 e_scrollbar_move(v->scrollbar.v, x, y);
1851 e_scrollbar_resize(v->scrollbar.v, w, h);
1852 }
1853 }
1854
1855 /* I support dnd */ 1872 /* I support dnd */
1856 ecore_window_dnd_advertise(v->win.base); 1873 ecore_window_dnd_advertise(v->win.base);
1857
1858 ecore_window_show(v->win.main); 1874 ecore_window_show(v->win.main);
1859 1875
1860 if (!v->iconbar)
1861 v->iconbar = e_iconbar_new(v);
1862 if (v->iconbar)
1863 {
1864 e_iconbar_realize(v->iconbar);
1865 /*e_iconbar_set_view_window_spacing(v->iconbar); */
1866 }
1867
1868 e_view_bg_reload(v);
1869/* e_epplet_load_from_layout(v);*/
1870 v->changed = 1; 1876 v->changed = 1;
1871 D_RETURN; 1877 D_RETURN;
1872} 1878}
@@ -1882,18 +1888,12 @@ e_view_populate(E_View * v)
1882 for (l = v->dir->files; l; l = l->next) 1888 for (l = v->dir->files; l; l = l->next)
1883 { 1889 {
1884 E_File *f = (E_File *) l->data; 1890 E_File *f = (E_File *) l->data;
1885 E_Icon *ic;
1886 1891
1887 e_view_file_add(v, f); 1892 e_view_file_add(v, f);
1888 /* try to show the icons for the file. If this is not the first for 1893 /* try to show the icons for the file. If this is not the first for
1889 * the dir this will succeed because filetype and stat info have 1894 * the dir this will succeed because filetype and stat info have
1890 * already been received. If not, it'll be shown when those arrive. */ 1895 * already been received. If not, it'll be shown when those arrive. */
1891 ic = e_icon_find_by_file(v, f->file); 1896 e_view_file_try_to_show(v, f);
1892 if (ic)
1893 {
1894 e_icon_update_state(ic);
1895 e_icon_initial_show(ic);
1896 }
1897 } 1897 }
1898} 1898}
1899 1899
@@ -2001,26 +2001,41 @@ e_view_file_changed(E_View * v, E_File * f)
2001 ic = e_icon_find_by_file(v, f->file); 2001 ic = e_icon_find_by_file(v, f->file);
2002 if (ic) 2002 if (ic)
2003 { 2003 {
2004 e_icon_update_state(ic);
2004 } 2005 }
2005 v->changed = 1; 2006 v->changed = 1;
2006 D_RETURN; 2007 D_RETURN;
2007} 2008}
2008 2009
2009void 2010void
2010e_view_file_delete(E_View * v, E_File * f) 2011e_view_file_try_to_show(E_View * v, E_File * f)
2011{ 2012{
2012 E_Icon *ic; 2013 E_Icon *ic;
2013 2014
2014 D_ENTER; 2015 D_ENTER;
2016 ic = e_icon_find_by_file(v, f->file);
2017 if (ic)
2018 {
2019 e_icon_update_state(ic);
2020 e_icon_initial_show(ic);
2021 }
2022 v->changed = 1;
2023 D_RETURN;
2024}
2015 2025
2016 e_iconbar_file_delete(v, f->file); 2026void
2027e_view_file_delete(E_View * v, E_File * f)
2028{
2029 E_Icon *ic;
2030
2031 D_ENTER;
2017 2032
2018 ic = e_icon_find_by_file(v, f->file); 2033 ic = e_icon_find_by_file(v, f->file);
2019 if (ic) 2034 if (ic)
2020 { 2035 {
2021 e_icon_hide(ic); 2036 e_icon_hide(ic);
2022 e_object_unref(E_OBJECT(ic));
2023 v->icons = evas_list_remove(v->icons, ic); 2037 v->icons = evas_list_remove(v->icons, ic);
2038 e_object_unref(E_OBJECT(ic));
2024 v->changed = 1; 2039 v->changed = 1;
2025 v->extents.valid = 0; 2040 v->extents.valid = 0;
2026 e_view_queue_resort(v); 2041 e_view_queue_resort(v);
@@ -2029,22 +2044,43 @@ e_view_file_delete(E_View * v, E_File * f)
2029} 2044}
2030 2045
2031void 2046void
2047e_view_layout_reload(E_View * v)
2048{
2049 D_ENTER;
2050 if (!v || !v->look)
2051 D_RETURN;
2052
2053 if (e_object_unref(E_OBJECT(v->layout)) == 0)
2054 v->layout = NULL;
2055
2056 /* try load a new layout */
2057 v->layout = e_view_layout_new(v);
2058
2059 /* if the layout loaded and theres an evas - we're realized */
2060 /* so realize the layout */
2061 if ((v->layout) && (v->evas))
2062 e_view_layout_realize(v->layout);
2063
2064 e_view_layout_update(v->layout);
2065
2066 v->changed = 1;
2067 D_RETURN;
2068}
2069
2070
2071void
2032e_view_ib_reload(E_View * v) 2072e_view_ib_reload(E_View * v)
2033{ 2073{
2034 D_ENTER; 2074 D_ENTER;
2035 2075
2036 /* 2076
2037 * D ("check if jsut saved:\n");
2038 * if (v->iconbar->just_saved)
2039 * {
2040 * D ("just saved\n");
2041 * v->iconbar->just_saved = 0;
2042 * D_RETURN;
2043 * }
2044 */
2045 /* if we have an iconbar.. well nuke it */ 2077 /* if we have an iconbar.. well nuke it */
2046 if (e_object_unref(E_OBJECT(v->iconbar)) == 0) 2078 if (e_object_unref(E_OBJECT(v->iconbar)) == 0)
2047 v->iconbar = NULL; 2079 v->iconbar = NULL;
2080
2081 /* no iconbar in our look */
2082 if(!v->look->obj->icb || !v->look->obj->icb_bits)
2083 D_RETURN;
2048 2084
2049 /* try load a new iconbar */ 2085 /* try load a new iconbar */
2050 if (!v->iconbar) 2086 if (!v->iconbar)
@@ -2061,13 +2097,17 @@ e_view_ib_reload(E_View * v)
2061void 2097void
2062e_view_bg_reload(E_View * v) 2098e_view_bg_reload(E_View * v)
2063{ 2099{
2064 E_Background bg; 2100 E_Background bg = NULL;
2065 2101
2066 /* This should only be called if the background did really 2102 /* This should only be called if the background did really
2067 * change in the underlying dir. We dont check again 2103 * change in the underlying dir. We dont check again
2068 * here. */ 2104 * here. */
2069 D_ENTER; 2105 D_ENTER;
2070 2106
2107 if (!v || !v->look)
2108 D_RETURN;
2109
2110 /* nuke the old one */
2071 if (v->bg) 2111 if (v->bg)
2072 { 2112 {
2073 int size; 2113 int size;
@@ -2075,33 +2115,45 @@ e_view_bg_reload(E_View * v)
2075 e_bg_free(v->bg); 2115 e_bg_free(v->bg);
2076 v->bg = NULL; 2116 v->bg = NULL;
2077 if (v->evas) 2117 if (v->evas)
2078 { 2118 {
2079 size = evas_get_image_cache(v->evas); 2119 size = evas_get_image_cache(v->evas);
2080 evas_set_image_cache(v->evas, 0); 2120 evas_set_image_cache(v->evas, 0);
2081 evas_set_image_cache(v->evas, size); 2121 evas_set_image_cache(v->evas, size);
2082 } 2122 }
2083 e_db_flush(); 2123 e_db_flush();
2084 } 2124 }
2085 2125 if(v->look->obj->bg)
2086 bg = e_bg_load(v->dir->bg_file); 2126 {
2087 2127 bg = e_bg_load(v->look->obj->bg);
2128 }
2129 else
2130 {
2131 /* Our look doesnt provide a bg, falls back */
2132 char buf[PATH_MAX];
2133 if(v->is_desktop)
2134 snprintf(buf, PATH_MAX, "%s/default.bg.db", e_config_get("backgrounds"));
2135 else
2136 snprintf(buf, PATH_MAX, "%s/view.bg.db", e_config_get("backgrounds"));
2137
2138 bg = e_bg_load(buf);
2139 }
2088 if (bg) 2140 if (bg)
2089 { 2141 {
2090 v->bg = bg; 2142 v->bg = bg;
2091 if (v->evas) 2143 if (v->evas)
2092 { 2144 {
2093 e_bg_add_to_evas(v->bg, v->evas); 2145 e_bg_add_to_evas(v->bg, v->evas);
2094 e_bg_set_scroll(v->bg, v->scroll.x, v->scroll.y); 2146 e_bg_set_scroll(v->bg, v->scroll.x, v->scroll.y);
2095 e_bg_set_layer(v->bg, 100); 2147 e_bg_set_layer(v->bg, 100);
2096 e_bg_resize(v->bg, v->size.w, v->size.h); 2148 e_bg_resize(v->bg, v->size.w, v->size.h);
2097 2149
2098 e_bg_callback_add(v->bg, CALLBACK_MOUSE_UP, e_bg_up_cb, v); 2150 e_bg_callback_add(v->bg, CALLBACK_MOUSE_UP, e_bg_up_cb, v);
2099 e_bg_callback_add(v->bg, CALLBACK_MOUSE_DOWN, e_bg_down_cb, v); 2151 e_bg_callback_add(v->bg, CALLBACK_MOUSE_DOWN, e_bg_down_cb, v);
2100 e_bg_callback_add(v->bg, CALLBACK_MOUSE_MOVE, e_bg_move_cb, v); 2152 e_bg_callback_add(v->bg, CALLBACK_MOUSE_MOVE, e_bg_move_cb, v);
2101 2153
2102 e_bg_show(v->bg); 2154 e_bg_show(v->bg);
2103 } 2155 }
2104 } 2156 }
2105 v->changed = 1; 2157 v->changed = 1;
2106 D_RETURN; 2158 D_RETURN;
2107} 2159}
diff --git a/src/view.h b/src/view.h
index 2d4bb5d9b..bc646c42e 100644
--- a/src/view.h
+++ b/src/view.h
@@ -7,9 +7,11 @@
7#include "fs.h" 7#include "fs.h"
8#include "iconbar.h" 8#include "iconbar.h"
9#include "object.h" 9#include "object.h"
10#include "e_view_look.h"
10#include "e_dir.h" 11#include "e_dir.h"
11#include "e_file.h" 12#include "e_file.h"
12#include "view_layout.h" 13#include "view_layout.h"
14#include "observer.h"
13 15
14#ifndef E_VIEW_TYPEDEF 16#ifndef E_VIEW_TYPEDEF
15#define E_VIEW_TYPEDEF 17#define E_VIEW_TYPEDEF
@@ -26,8 +28,8 @@ typedef struct _E_Icon E_Icon;
26typedef struct _E_Iconbar E_Iconbar; 28typedef struct _E_Iconbar E_Iconbar;
27#endif 29#endif
28 30
29#ifndef E_VIEW_MODEL_TYPEDEF 31#ifndef E_DIR_TYPEDEF
30#define E_VIEW_MODEL_TYPEDEF 32#define E_DIR_TYPEDEF
31typedef struct _E_Dir E_Dir; 33typedef struct _E_Dir E_Dir;
32#endif 34#endif
33 35
@@ -42,6 +44,13 @@ typedef struct _E_View_Layout_Element E_View_Layout_Element;
42typedef struct _E_Scrollbar E_Scrollbar; 44typedef struct _E_Scrollbar E_Scrollbar;
43#endif 45#endif
44 46
47#ifndef E_VIEW_LOOK_TYPEDEF
48#define E_VIEW_LOOK_TYPEDEF
49typedef struct _E_View_Look E_View_Look;
50typedef struct _E_View_Look_Objects E_View_Look_Objects;
51#endif
52
53
45typedef enum 54typedef enum
46{ 55{
47 E_DND_NONE, 56 E_DND_NONE,
@@ -57,7 +66,7 @@ E_dnd_enum;
57 66
58struct _E_View 67struct _E_View
59{ 68{
60 E_Object o; 69 E_Observer o;
61 70
62 char *name; 71 char *name;
63 72
@@ -225,6 +234,8 @@ struct _E_View
225 234
226 Evas_List epplet_contexts; 235 Evas_List epplet_contexts;
227 Ebits_Object epplet_layout; 236 Ebits_Object epplet_layout;
237
238 E_View_Look *look;
228}; 239};
229 240
230/** 241/**
@@ -272,13 +283,21 @@ E_View *e_view_new(void);
272 * e_view_set_dir - Sets view to a given directory 283 * e_view_set_dir - Sets view to a given directory
273 * @v The view for which to set the directory 284 * @v The view for which to set the directory
274 * @dir The directory to set the view to 285 * @dir The directory to set the view to
275 * @is_desktop Inidicates wether the view is a desktop
276 * 286 *
277 * This function sets a view to a directory, loading the 287 * This function sets a view to a directory, loading the
278 * view's metadata (view window coordinates etc). If a dir already 288 * view's metadata (view window coordinates etc). If a dir already
279 * exists for this dir, it is reused, otherwise a new on is created. 289 * exists for this dir, it is reused, otherwise a new on is created.
280 */ 290 */
281void e_view_set_dir(E_View * v, char *dir, int is_desktop); 291void e_view_set_dir(E_View * v, char *dir);
292
293/**
294 * e_view_set_look - Sets view to a given look
295 * @v The view for which to set the directory
296 * @dir The directory that contains the look
297 *
298 * This function sets a directory containing layout information and background
299 * and iconbar dbs for the view. */
300void e_view_set_look(E_View * v, char *dir);
282 301
283/** 302/**
284 * e_view_populate - Draws icons for all files in view 303 * e_view_populate - Draws icons for all files in view
@@ -309,10 +328,12 @@ void e_view_update(E_View * v);
309 328
310void e_view_bg_reload(E_View * v); 329void e_view_bg_reload(E_View * v);
311void e_view_ib_reload(E_View * v); 330void e_view_ib_reload(E_View * v);
331void e_view_layout_reload(E_View * v);
312 332
313void e_view_file_add(E_View * v, E_File * file); 333void e_view_file_add(E_View * v, E_File * file);
314void e_view_file_changed(E_View * v, E_File * file); 334void e_view_file_changed(E_View * v, E_File * file);
315void e_view_file_delete(E_View * v, E_File * file); 335void e_view_file_delete(E_View * v, E_File * file);
336void e_view_file_try_to_show(E_View * v, E_File * file);
316 337
317void e_view_close_all(void); 338void e_view_close_all(void);
318 339
diff --git a/src/view_layout.c b/src/view_layout.c
index 3de933c27..c0a1ccca7 100644
--- a/src/view_layout.c
+++ b/src/view_layout.c
@@ -44,10 +44,6 @@ e_view_layout_cleanup(E_View_Layout *layout)
44 44
45 /* free the bits */ 45 /* free the bits */
46 if (layout->bits) ebits_free(layout->bits); 46 if (layout->bits) ebits_free(layout->bits);
47
48 IF_FREE(layout->file);
49 IF_FREE(layout->prev_file);
50
51 /* cleanup the base object */ 47 /* cleanup the base object */
52 e_object_cleanup(E_OBJECT(layout)); 48 e_object_cleanup(E_OBJECT(layout));
53 49
@@ -59,32 +55,24 @@ e_view_layout_realize(E_View_Layout *layout)
59{ 55{
60 Ebits_Object bits; 56 Ebits_Object bits;
61 Evas_List l; 57 Evas_List l;
62 char buf[PATH_MAX];
63 58
59 if (!layout) D_RETURN;
60
64 D_ENTER; 61 D_ENTER;
65 62
66 /* check for custom layout bits */ 63 if (layout->view->look->obj->layout)
67 snprintf(buf, PATH_MAX, "%s/.e_layout/layout.bits.db", 64 bits = ebits_load(layout->view->look->obj->layout);
68 layout->view->dir->dir); 65 else
69 /* keep track of file loaded */
70 IF_FREE(layout->file);
71 e_strdup(layout->file, buf);
72 bits = ebits_load(layout->file);
73
74 /* if custom doesn't exist, load default layout */
75 if (!bits)
76 { 66 {
77 if (layout->view->dir->is_desktop) 67 /* Our look doesnt provide a layout, falls back */
78 snprintf(buf, PATH_MAX, "%s/desktop.bits.db", e_config_get("layout")); 68 char buf[PATH_MAX];
69 if(layout->view->is_desktop)
70 snprintf(buf, PATH_MAX, "%sdesktop.bits.db", e_config_get("layout"));
79 else 71 else
80 snprintf(buf, PATH_MAX, "%s/view.bits.db", e_config_get("layout")); 72 snprintf(buf, PATH_MAX, "%sview.bits.db", e_config_get("layout"));
81 /* keep track of which file was loaded */ 73
82 IF_FREE(layout->file); 74 bits = ebits_load(buf);
83 e_strdup(layout->file, buf);
84 bits = ebits_load(layout->file);
85 } 75 }
86
87 D("loaded layout: %s\n", layout->file);
88 if (bits) 76 if (bits)
89 { 77 {
90 D("layout bits loaded!\n") 78 D("layout bits loaded!\n")
@@ -108,10 +96,6 @@ e_view_layout_realize(E_View_Layout *layout)
108 { 96 {
109 D("ERROR: can't load layout\n"); 97 D("ERROR: can't load layout\n");
110 } 98 }
111
112 IF_FREE(layout->prev_file);
113 e_strdup(layout->prev_file, layout->prev_file);
114
115 D_RETURN; 99 D_RETURN;
116} 100}
117 101
@@ -183,37 +167,36 @@ e_view_layout_get_element_geometry(E_View_Layout *layout, char *name,
183 double *x, double *y, double *w, double *h) 167 double *x, double *y, double *w, double *h)
184{ 168{
185 Evas_List l; 169 Evas_List l;
186
187 D_ENTER; 170 D_ENTER;
188 171 if (layout && name)
189 for (l = layout->elements; l; l = l->next)
190 { 172 {
191 E_View_Layout_Element *el = l->data; 173 for (l = layout->elements; l; l = l->next)
192
193 if (!strcmp(name, el->name))
194 { 174 {
175 E_View_Layout_Element *el = l->data;
195 176
196 if (x) *x = el->x; 177 if (!strcmp(name, el->name))
197 if (y) *y = el->y; 178 {
198 if (w) *w = el->w;
199 if (h) *h = el->h;
200 179
180 if (x) *x = el->x;
181 if (y) *y = el->y;
182 if (w) *w = el->w;
183 if (h) *h = el->h;
201 184
202 D_RETURN(1); 185 D_RETURN_(1);
186 }
203 } 187 }
204 } 188 }
205 189 D_RETURN_(0);
206 D_RETURN(0);
207} 190}
208 191
209void 192void
210e_view_layout_update(E_View_Layout *layout) 193e_view_layout_update(E_View_Layout *layout)
211{ 194{
212 Evas_List l; 195 Evas_List l;
213 196 double x, y, w, h;
214 D_ENTER; 197 D_ENTER;
215 198
216 if (!layout->bits) 199 if (!layout || !layout->bits)
217 D_RETURN; 200 D_RETURN;
218 /* move/resize bits */ 201 /* move/resize bits */
219 ebits_move(layout->bits, 0, 0); 202 ebits_move(layout->bits, 0, 0);
@@ -234,5 +217,30 @@ e_view_layout_update(E_View_Layout *layout)
234 el->h = h; 217 el->h = h;
235 } 218 }
236 219
220 /* FIXME: the icon layout should probably be totally redone */
221 if (e_view_layout_get_element_geometry(layout, "Icons",
222 &x, &y, &w, &h))
223 {
224 layout->view->spacing.window.l = x;
225 layout->view->spacing.window.r = layout->view->size.w - (x + w);
226 layout->view->spacing.window.t = y;
227 layout->view->spacing.window.b = layout->view->size.h - (y + h);
228 }
229 if (e_view_layout_get_element_geometry(layout, "Scrollbar_H",
230 &x, &y, &w, &h))
231 {
232 e_scrollbar_move(layout->view->scrollbar.h, x, y);
233 e_scrollbar_resize(layout->view->scrollbar.h, w, h);
234 }
235
236 if (e_view_layout_get_element_geometry(layout, "Scrollbar_V",
237 &x, &y, &w, &h))
238 {
239 e_scrollbar_move(layout->view->scrollbar.v, x, y);
240 e_scrollbar_resize(layout->view->scrollbar.v, w, h);
241 }
242
243 if (layout->view->iconbar)
244 e_iconbar_fix(layout->view->iconbar);
237 D_RETURN; 245 D_RETURN;
238} 246}
diff --git a/src/view_layout.h b/src/view_layout.h
index e15968570..72e77e24f 100644
--- a/src/view_layout.h
+++ b/src/view_layout.h
@@ -23,9 +23,6 @@ struct _E_View_Layout
23 23
24 E_View *view; 24 E_View *view;
25 25
26 char *file;
27 char *prev_file;
28
29 Ebits_Object bits; 26 Ebits_Object bits;
30 27
31 Evas_List elements; 28 Evas_List elements;