diff --git a/src/iconbar.c b/src/iconbar.c index 78a4d7973..a34513db2 100644 --- a/src/iconbar.c +++ b/src/iconbar.c @@ -6,6 +6,7 @@ static E_Config_Base_Type *cf_iconbar_icon = NULL; /* internal func (iconbar use only) prototypes */ +static void ib_reload_timeout(int val, void *data); static void ib_timeout(int val, void *data); static void ib_bits_show(void *data); @@ -100,7 +101,7 @@ e_iconbar_new(E_View *v) if (!ib->bit) { /* unref the iconbar (and thus it will get freed and all icons in it */ - OBJ_UNREF(ib); + OBJ_DO_FREE(ib); /* return NULL - no iconbar worth doing here if we don't know where */ /* to put it */ return NULL; @@ -114,6 +115,8 @@ e_iconbar_new(E_View *v) void e_iconbar_free(E_Iconbar *ib) { + char buf[PATH_MAX]; + /* tell the view we attached to that somehting in it changed. this way */ /* the view will now it needs to redraw */ ib->view->changed = 1; @@ -130,11 +133,14 @@ e_iconbar_free(E_Iconbar *ib) E_Iconbar_Icon *ic; ic = l->data; - OBJ_UNREF(ic); + OBJ_DO_FREE(ic); } /* free the list itself */ evas_list_free(ib->icons); } + /* delete any timers intended to work on this iconbar */ + sprintf(buf, "iconbar_reload:%s", ib->view->dir); + ecore_del_event_timer(buf); /* free the iconbar struct */ FREE(ib); } @@ -309,8 +315,59 @@ e_iconbar_fix(E_Iconbar *ib) } } +/* this function is called from the view code whenever a file is added to a */ +/* view. the iconbar code here determines if the file add is of interest */ +/* and if it is, in 0.5 secs will do a "reload */ +void +e_iconbar_file_add(E_View *v, char *file) +{ + /* is the file of interest ? */ + if ((!strcmp(".e_iconbar.db", file)) || + (!strcmp(".e_iconbar.bits.db", file))) + { + char buf[PATH_MAX]; + + /* unique timer name */ + sprintf(buf, "iconbar_reload:%s", v->dir); + /* in 0.5 secs call our timout handler */ + ecore_add_event_timer(buf, 0.5, ib_reload_timeout, 0, v); + } +} +/* caled whenever a file is deleted from a view */ +void +e_iconbar_file_delete(E_View *v, char *file) +{ + /* is the file of interest */ + if ((!strcmp(".e_iconbar.db", file)) || + (!strcmp(".e_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) + { + OBJ_DO_FREE(v->iconbar); + v->iconbar = NULL; + } + } +} +/* called whenever a file changes in a view */ +void +e_iconbar_file_change(E_View *v, char *file) +{ + /* is the file that changed of interest */ + if ((!strcmp(".e_iconbar.db", file)) || + (!strcmp(".e_iconbar.bits.db", file))) + { + char buf[PATH_MAX]; + + /* unique timer name */ + sprintf(buf, "iconbar_reload:%s", v->dir); + /* in 0.5 secsm call the realod timeout */ + ecore_add_event_timer(buf, 0.5, ib_reload_timeout, 0, v); + } +} @@ -320,6 +377,25 @@ e_iconbar_fix(E_Iconbar *ib) /* static (internal to iconbar use only) callbacks */ +/* reload timeout. called whenevr iconbar special files changed/added to */ +/* a view */ +static void +ib_reload_timeout(int val, void *data) +{ + E_View *v; + + /* get our view pointer */ + v = (E_View *)data; + /* if we have an iconbar.. well nuke it */ + if (v->iconbar) OBJ_DO_FREE(v->iconbar); + v->iconbar = NULL; + /* try load a new iconbar */ + if (!v->iconbar) v->iconbar = e_iconbar_new(v); + /* if the iconbar loaded and theres an evas - we're realized */ + /* so realize the iconbar */ + if ((v->iconbar) && (v->evas)) e_iconbar_realize(v->iconbar); +} + /* this timeout is responsible for doing the mouse over animation */ static void ib_timeout(int val, void *data) @@ -607,7 +683,7 @@ ib_mouse_in(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y) char buf[PATH_MAX]; /* come up with a unique name for it */ - sprintf(buf, "%s/%s", ic->iconbar->view->dir, ic->image_path); + sprintf(buf, "iconbar:%s/%s", ic->iconbar->view->dir, ic->image_path); e_strdup(ic->hi.timer, buf); /* call the timeout */ ib_timeout(0, ic); diff --git a/src/iconbar.h b/src/iconbar.h index 1990ccd0e..8b8d088c2 100644 --- a/src/iconbar.h +++ b/src/iconbar.h @@ -55,5 +55,8 @@ void e_iconbar_free(E_Iconbar *ib); void e_iconbar_icon_free(E_Iconbar_Icon *); void e_iconbar_realize(E_Iconbar *ib); void e_iconbar_fix(E_Iconbar *ib); +void e_iconbar_file_add(E_View *v, char *file); +void e_iconbar_file_delete(E_View *v, char *file); +void e_iconbar_file_change(E_View *v, char *file); #endif diff --git a/src/view.c b/src/view.c index 4a57a9778..4f1801e84 100644 --- a/src/view.c +++ b/src/view.c @@ -1644,7 +1644,10 @@ e_view_handle_fs_restart(void *data) { EfsdOptions *ops; - ops = efsd_ops(2, efsd_op_get_stat(), efsd_op_get_filetype()); + ops = efsd_ops(3, + efsd_op_get_stat(), + efsd_op_get_filetype(), + efsd_op_list_all()); v->monitor_id = efsd_start_monitor(e_fs_get_connection(), v->dir, ops, TRUE); @@ -2081,6 +2084,7 @@ e_view_file_added(int id, char *file) if (file[0] == '/') return; v = e_view_find_by_monitor_id(id); if (!v) return; + e_iconbar_file_add(v, file); /* filter files here */ if (!e_view_filter_file(v, file)) return; if (!e_view_find_icon_by_file(v, file)) @@ -2106,8 +2110,8 @@ e_view_file_deleted(int id, char *file) if (!file) return; if (file[0] == '/') return; v = e_view_find_by_monitor_id(id); - if (!v) return; - + e_iconbar_file_delete(v, file); + if (!v) return; { E_Icon *ic; @@ -2115,7 +2119,7 @@ e_view_file_deleted(int id, char *file) if (ic) { e_view_icon_hide(ic); - OBJ_UNREF(ic); + OBJ_DO_FREE(ic); v->icons = evas_list_remove(v->icons, ic); v->changed = 1; v->extents.valid = 0; @@ -2132,6 +2136,7 @@ e_view_file_changed(int id, char *file) if (!file) return; if (file[0] == '/') return; v = e_view_find_by_monitor_id(id); + e_iconbar_file_change(v, file); if (!v) return; { @@ -2186,7 +2191,7 @@ e_view_free(E_View *v) { char name[PATH_MAX]; - if (v->iconbar) OBJ_UNREF(v->iconbar); + if (v->iconbar) OBJ_DO_FREE(v->iconbar); sprintf(name, "resort_timer.%s", v->dir); ecore_del_event_timer(name); @@ -2293,7 +2298,10 @@ e_view_set_dir(E_View *v, char *dir) { EfsdOptions *ops; - ops = efsd_ops(2, efsd_op_get_stat(), efsd_op_get_filetype()); + ops = efsd_ops(3, + efsd_op_get_stat(), + efsd_op_get_filetype(), + efsd_op_list_all()); v->monitor_id = efsd_start_monitor(e_fs_get_connection(), v->dir, ops, TRUE); } @@ -2392,7 +2400,7 @@ e_view_realize(E_View *v) IF_FREE(dir); } - v->iconbar = e_iconbar_new(v); + if (!v->iconbar) v->iconbar = e_iconbar_new(v); if (v->iconbar) e_iconbar_realize(v->iconbar); v->changed = 1;