diff --git a/src/Makefile.am b/src/Makefile.am index 8883c071c..769fe51db 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -78,7 +78,7 @@ enlightenment_SOURCES = \ util.h util.c \ view.h view.c \ e_file.h e_file.c \ - e_view_model.h e_view_model.c \ + e_dir.h e_dir.c \ e_view_machine.h e_view_machine.c \ view_layout.h view_layout.c \ e.h diff --git a/src/e_view_machine.c b/src/e_view_machine.c index c0794c07c..946f61154 100644 --- a/src/e_view_machine.c +++ b/src/e_view_machine.c @@ -1,6 +1,6 @@ #include #include "e_view_machine.h" -#include "e_view_model.h" +#include "e_dir.h" #include "util.h" #include "globals.h" #include "file.h" @@ -12,29 +12,29 @@ e_view_machine_init() if (VM == NULL) { - VM = NEW(E_View_Model, 1); + VM = NEW(E_Dir, 1); VM->views = NULL; - VM->models = NULL; + VM->dirs = NULL; e_view_init(); - e_view_model_init(); + e_dir_init(); } D_RETURN; } void -e_view_machine_register_view_model(E_View_Model * m) +e_view_machine_register_dir(E_Dir * d) { D_ENTER; - VM->models = evas_list_append(VM->models, m); + VM->dirs = evas_list_append(VM->dirs, d); D_RETURN; } void -e_view_machine_unregister_view_model(E_View_Model * m) +e_view_machine_unregister_dir(E_Dir * d) { D_ENTER; - VM->models = evas_list_remove(VM->models, m); + VM->dirs = evas_list_remove(VM->dirs, d); D_RETURN; } @@ -65,15 +65,15 @@ e_view_machine_close_all_views(void) { E_View *v = l->data; - e_object_unref(E_OBJECT(v->model)); + e_object_unref(E_OBJECT(v->dir)); } D_RETURN; } -E_View_Model * -e_view_machine_model_lookup(char *path) +E_Dir * +e_view_machine_dir_lookup(char *path) { - E_View_Model *m; + E_Dir *d; Evas_List l; char *realpath = NULL; @@ -84,15 +84,15 @@ e_view_machine_model_lookup(char *path) realpath = e_file_realpath(path); - for (l = VM->models; l; l = l->next) + for (l = VM->dirs; l; l = l->next) { - m = l->data; - if (!strcmp(m->dir, realpath)) + d = l->data; + if (!strcmp(d->dir, realpath)) { - D("Model for this dir already exists\n"); + D("E_Dir for this dir already exists\n"); IF_FREE(realpath); - D_RETURN_(m); + D_RETURN_(d); } } diff --git a/src/e_view_machine.h b/src/e_view_machine.h index 617d4d574..0c0547ad8 100644 --- a/src/e_view_machine.h +++ b/src/e_view_machine.h @@ -5,18 +5,18 @@ struct _e_view_machine { Evas_List views; - Evas_List models; + Evas_List dirs; }; typedef struct _e_view_machine E_View_Machine; void e_view_machine_init(void); void e_view_machine_register_view(E_View * v); void e_view_machine_unregister_view(E_View * v); -void e_view_machine_register_view_model(E_View_Model * m); -void e_view_machine_unregister_view_model(E_View_Model * m); +void e_view_machine_register_dir(E_Dir * d); +void e_view_machine_unregister_dir(E_Dir * d); void e_view_machine_close_all_views(void); -E_View_Model *e_view_machine_model_lookup(char *path); +E_Dir *e_view_machine_dir_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); diff --git a/src/iconbar.c b/src/iconbar.c index f88da85f5..40dff31d3 100644 --- a/src/iconbar.c +++ b/src/iconbar.c @@ -239,7 +239,7 @@ e_iconbar_new(E_View * v) D("new iconbar\n"); /* 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->model->dir); + snprintf(buf, PATH_MAX, "%s/.e_layout/iconbar.db", v->dir->dir); /* 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 +289,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->model->dir); + snprintf(buf, PATH_MAX, "%s/.e_layout/iconbar.bits.db", v->dir->dir); ib->bit = ebits_load(buf); /* we didn't find one? */ @@ -400,7 +400,7 @@ e_iconbar_realize(E_Iconbar * ib) /* 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->model->dir, ic->image_path); + ib->view->dir->dir, 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 */ @@ -714,7 +714,7 @@ e_iconbar_save_out_final(E_Iconbar * ib) Evas_List l; int i; - snprintf(buf, PATH_MAX, "%s/.e_iconbar.db", ib->view->model->dir); + snprintf(buf, PATH_MAX, "%s/.e_iconbar.db", ib->view->dir->dir); D("%s\n", buf); if (ib->changed) @@ -745,7 +745,7 @@ e_iconbar_save_out_final(E_Iconbar * ib) snprintf(buf2, PATH_MAX, "%s/.e_iconbar.db:/icons/%i/image", - ib->view->model->dir, i); + ib->view->dir->dir, i); D("save image\n"); imlib_save_image(buf2); } @@ -882,7 +882,7 @@ ib_timeout(int val, void *data) /* figure out its path */ snprintf(buf, PATH_MAX, "%s/.e_iconbar.db:%s", - ic->iconbar->view->model->dir, ic->image_path); + ic->iconbar->view->dir->dir, ic->image_path); /* add it */ ic->hi.image = evas_add_image_from_file(ic->iconbar->view->evas, buf); @@ -1562,7 +1562,7 @@ e_iconbar_dnd_add_files(E_View * v, E_View * source, int num_files, D_ENTER; #if 0 - D("add files: %s\n", source->model->dir); + D("add files: %s\n", source->dir->dir); for (i = 0; i < num_files; i++) { char *file = e_file_get_file(strdup(dnd_files[i])); @@ -1594,7 +1594,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->model->dir, ic->file); + ic->view->dir->dir, ic->file); D("set icon: %s\n", buf); ibic->imlib_image = imlib_load_image(buf); @@ -1637,7 +1637,7 @@ e_iconbar_dnd_add_files(E_View * v, E_View * source, int num_files, D("EEEEEEEEEEEEK: how the hell did this happen?"); D("x: %f, v-dir: %s, ib-dir: %s\n", ibic->iconbar->icon_area.x, - v->model->dir, ibic->iconbar->view->model->dir); + v->dir->dir, ibic->iconbar->view->dir->dir); if (!ic->info.icon) D_RETURN; @@ -1645,7 +1645,7 @@ e_iconbar_dnd_add_files(E_View * v, E_View * source, int num_files, 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->model->dir, ic->file); + snprintf(buf, PATH_MAX, "%s/%s", ic->view->dir->dir, ic->file); ibic->exec = strdup(buf); evas_set_clip(v->evas, ibic->image, v->iconbar->clip); diff --git a/src/icons.c b/src/icons.c index a0af96db1..d57a5ec21 100644 --- a/src/icons.c +++ b/src/icons.c @@ -4,7 +4,7 @@ #include "cursors.h" #include "file.h" #include "util.h" -#include "e_view_model.h" +#include "e_dir.h" #include "e_file.h" #include "e_view_machine.h" #include "globals.h" @@ -925,7 +925,7 @@ e_icon_exec(E_Icon * ic) v->size.w = 400; v->size.h = 300; v->options.back_pixmap = 0; - snprintf(buf, PATH_MAX, "%s/%s", ic->view->model->dir, ic->file->file); + 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_realize(v); diff --git a/src/scrollbar.c b/src/scrollbar.c index 3b6e8d7c7..1d7887d27 100644 --- a/src/scrollbar.c +++ b/src/scrollbar.c @@ -82,7 +82,7 @@ e_scrollbar_setup_bits(E_Scrollbar * sb) { /* load from the current dir's layout */ snprintf(buf, PATH_MAX, "%s/.e_layout/scroll_base_v.bits.db", - sb->view->model->dir); + sb->view->dir->dir); sb->base = ebits_load(buf); /* if not loaded, load defaults */ @@ -95,7 +95,7 @@ e_scrollbar_setup_bits(E_Scrollbar * sb) /* load from current dir's layout */ snprintf(buf, PATH_MAX, "%s/.e_layout/scroll_bar_v.bits.db", - sb->view->model->dir); + sb->view->dir->dir); sb->bar = ebits_load(buf); /* if not loaded, load defaults */ @@ -110,7 +110,7 @@ e_scrollbar_setup_bits(E_Scrollbar * sb) { /* load from the current dir's layout */ snprintf(buf, PATH_MAX, "%s/.e_layout/scroll_base_h.bits.db", - sb->view->model->dir); + sb->view->dir->dir); sb->base = ebits_load(buf); /* if not loaded, load defaults */ @@ -123,7 +123,7 @@ e_scrollbar_setup_bits(E_Scrollbar * sb) /* load from current dir's layout */ snprintf(buf, PATH_MAX, "%s/.e_layout/scroll_bar_h.bits.db", - sb->view->model->dir); + sb->view->dir->dir); sb->bar = ebits_load(buf); /* if not loaded, load defaults */ diff --git a/src/view.c b/src/view.c index a06de40cc..e509d7400 100644 --- a/src/view.c +++ b/src/view.c @@ -11,7 +11,7 @@ #include "file.h" #include "util.h" #include "icons.h" -#include "e_view_model.h" +#include "e_dir.h" #include "e_view_machine.h" #include "e_file.h" #include "globals.h" @@ -86,7 +86,7 @@ e_view_write_icon_xy_timeout(int val, void *data) ic->q.write_xy = 0; /* FIXME */ - snprintf(buf, PATH_MAX, "%s/%s", ic->view->model->dir, + snprintf(buf, PATH_MAX, "%s/%s", ic->view->dir->dir, ic->file->file); D("write meta xy for icon for file %s\n", ic->file->file); @@ -99,7 +99,7 @@ e_view_write_icon_xy_timeout(int val, void *data) { char name[PATH_MAX]; - snprintf(name, PATH_MAX, "icon_xy_record.%s", v->model->dir); + snprintf(name, PATH_MAX, "icon_xy_record.%s", v->dir->dir); ecore_add_event_timer(name, 0.01, e_view_write_icon_xy_timeout, 0, v); D_RETURN; @@ -852,13 +852,13 @@ e_view_geometry_record(E_View * v) D("Record geom for view\n"); ecore_window_get_frame_size(v->win.base, &left, NULL, &top, NULL); efsd_set_metadata_int(e_fs_get_connection(), - "/view/x", v->model->dir, v->location.x - left); + "/view/x", v->dir->dir, v->location.x - left); efsd_set_metadata_int(e_fs_get_connection(), - "/view/y", v->model->dir, v->location.y - top); + "/view/y", v->dir->dir, v->location.y - top); efsd_set_metadata_int(e_fs_get_connection(), - "/view/w", v->model->dir, v->size.w); + "/view/w", v->dir->dir, v->size.w); efsd_set_metadata_int(e_fs_get_connection(), - "/view/h", v->model->dir, v->size.h); + "/view/h", v->dir->dir, v->size.h); } D_RETURN; @@ -885,7 +885,7 @@ e_view_queue_geometry_record(E_View * v) D_ENTER; - snprintf(name, PATH_MAX, "geometry_record.%s", v->model->dir); + snprintf(name, PATH_MAX, "geometry_record.%s", v->dir->dir); ecore_add_event_timer(name, 0.10, e_view_geometry_record_timeout, 0, v); D_RETURN; @@ -898,7 +898,7 @@ e_view_queue_icon_xy_record(E_View * v) D_ENTER; - snprintf(name, PATH_MAX, "icon_xy_record.%s", v->model->dir); + snprintf(name, PATH_MAX, "icon_xy_record.%s", v->dir->dir); ecore_add_event_timer(name, 0.10, e_view_write_icon_xy_timeout, 0, v); D_RETURN; @@ -1352,7 +1352,7 @@ e_mouse_in(Ecore_Event * ev) { if ((v = e_view_machine_get_view_by_main_window(e->win))) { - if (v->model->is_desktop) + if (v->dir->is_desktop) { evas_event_enter(v->evas); } @@ -1611,8 +1611,8 @@ e_view_cleanup(E_View * v) snprintf(name, PATH_MAX, "resort_timer.%s", v->name); ecore_del_event_timer(name); - /* unregister with the underlying model and the global list of views */ - e_view_model_unregister_view(v); + /* unregister with the underlying dir and the global list of views */ + e_dir_unregister_view(v); e_view_machine_unregister_view(v); /* FIXME: clean up the rest!!! this leaks ... */ @@ -1682,7 +1682,7 @@ _member.r = _r; _member.g = _g; _member.b = _b; _member.a = _a; void e_view_set_dir(E_View * v, char *path, int is_desktop) { - E_View_Model *m = NULL; + E_Dir *d = NULL; char buf[PATH_MAX]; D_ENTER; @@ -1690,14 +1690,14 @@ e_view_set_dir(E_View * v, char *path, int is_desktop) if (!v || !path || *path == 0) D_RETURN; - if (!(m = e_view_machine_model_lookup(path))) + if (!(d = e_view_machine_dir_lookup(path))) { D("Model for this dir doesn't exist, make a new one\n"); - m = e_view_model_new(); - e_view_model_set_dir(m, path); + d = e_dir_new(); + e_dir_set_dir(d, path); - snprintf(buf, PATH_MAX, "%s/.e_background.bg.db", m->dir); + snprintf(buf, PATH_MAX, "%s/.e_background.bg.db", d->dir); if (!e_file_exists(buf)) { if (is_desktop) @@ -1711,32 +1711,32 @@ e_view_set_dir(E_View * v, char *path, int is_desktop) e_config_get("backgrounds")); } } - e_strdup(m->bg_file, buf); - m->is_desktop = is_desktop; + e_strdup(d->bg_file, buf); + d->is_desktop = is_desktop; } - if (m) + if (d) { - e_view_model_register_view(m, v); + e_dir_register_view(d, v); /* FIXME do a real naming scheme here */ - snprintf(buf, PATH_MAX, "%s:%d", v->model->dir, - e_object_get_usecount(E_OBJECT(v->model))); + 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); /* Request metadata via efsd */ v->geom_get.x = efsd_get_metadata(e_fs_get_connection(), - "/view/x", v->model->dir, EFSD_INT); + "/view/x", v->dir->dir, EFSD_INT); v->geom_get.y = efsd_get_metadata(e_fs_get_connection(), - "/view/y", v->model->dir, EFSD_INT); + "/view/y", v->dir->dir, EFSD_INT); v->geom_get.w = efsd_get_metadata(e_fs_get_connection(), - "/view/w", v->model->dir, EFSD_INT); + "/view/w", v->dir->dir, EFSD_INT); v->geom_get.h = efsd_get_metadata(e_fs_get_connection(), - "/view/h", v->model->dir, EFSD_INT); + "/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->model->dir, EFSD_STRING); + * * "/view/background", v->dir->dir, EFSD_STRING); */ v->geom_get.busy = 1; } @@ -1881,7 +1881,7 @@ e_view_populate(E_View * v) /* populate with icons for all files in the dir we are monitoring. * This has to be called _after_ view_realize because * view_add_file needs the evas to be intialized */ - for (l = v->model->files; l; l = l->next) + for (l = v->dir->files; l; l = l->next) { E_File *f = (E_File *) l->data; E_Icon *ic; @@ -2066,7 +2066,7 @@ e_view_bg_reload(E_View * v) E_Background bg; /* This should only be called if the background did really - * change in the underlying model. We dont check again + * change in the underlying dir. We dont check again * here. */ D_ENTER; @@ -2085,7 +2085,7 @@ e_view_bg_reload(E_View * v) e_db_flush(); } - bg = e_bg_load(v->model->bg_file); + bg = e_bg_load(v->dir->bg_file); if (bg) { @@ -2213,13 +2213,13 @@ e_dnd_data_request(Ecore_Event * ev) if (first) { /*FIXME */ - snprintf(buf, PATH_MAX, "file:%s/%s", v->model->dir, + snprintf(buf, PATH_MAX, "file:%s/%s", v->dir->dir, ic->file->file); first = 0; } else /* FIXME */ - snprintf(buf, PATH_MAX, "\r\nfile:%s/%s", v->model->dir, + snprintf(buf, PATH_MAX, "\r\nfile:%s/%s", v->dir->dir, ic->file->file); REALLOC(data, char, strlen(data) + strlen(buf) + 1); @@ -2246,13 +2246,13 @@ e_dnd_data_request(Ecore_Event * ev) if (first) { /*FIXME */ - snprintf(buf, PATH_MAX, "%s/%s\n", v->model->dir, + snprintf(buf, PATH_MAX, "%s/%s\n", v->dir->dir, ic->file->file); first = 0; } else /*FIXME */ - snprintf(buf, PATH_MAX, "\n%s/%s", v->model->dir, + snprintf(buf, PATH_MAX, "\n%s/%s", v->dir->dir, ic->file->file); REALLOC(data, char, strlen(data) + strlen(buf) + 1); @@ -2278,7 +2278,7 @@ e_dnd_data_request(Ecore_Event * ev) char buf[16384]; /* FIXME */ - snprintf(buf, PATH_MAX, "file:%s/%s", v->model->dir, + snprintf(buf, PATH_MAX, "file:%s/%s", v->dir->dir, ic->file->file); data = strdup(buf); break; @@ -2411,7 +2411,7 @@ e_dnd_drop(Ecore_Event * ev) { /* Dropped! Handle data */ /* Same view or same underlying dir? Mark to skip action */ - if (e->win == e->source_win || v->model == v_dnd_source->model) + if (e->win == e->source_win || v->dir == v_dnd_source->dir) v_dnd_source->drag.matching_drop_attempt = 1; /* Perform the action... */ e_dnd_handle_drop(v); @@ -2529,7 +2529,7 @@ e_dnd_handle_drop(E_View * v) if (dnd_files[out]) FREE(dnd_files[out]); - dnd_files[out++] = strdup(v->model->dir); + dnd_files[out++] = strdup(v->dir->dir); switch (dnd_pending_mode) { diff --git a/src/view.h b/src/view.h index a107f2002..6ea8017d0 100644 --- a/src/view.h +++ b/src/view.h @@ -7,7 +7,7 @@ #include "fs.h" #include "iconbar.h" #include "object.h" -#include "e_view_model.h" +#include "e_dir.h" #include "e_file.h" #include "view_layout.h" @@ -28,7 +28,7 @@ typedef struct _E_Iconbar E_Iconbar; #ifndef E_VIEW_MODEL_TYPEDEF #define E_VIEW_MODEL_TYPEDEF -typedef struct _E_View_Model E_View_Model; +typedef struct _E_Dir E_Dir; #endif #ifndef E_VIEW_LAYOUT_TYPEDEF @@ -61,7 +61,7 @@ struct _E_View char *name; - E_View_Model *model; + E_Dir *dir; struct { @@ -273,7 +273,7 @@ E_View *e_view_new(void); * @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 view_model already + * 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); @@ -282,7 +282,7 @@ void e_view_set_dir(E_View * v, char *dir, int is_desktop); * e_view_populate - Draws icons for all files in view * @v The view to populate * - * Goes through the list of files in the underlying view_model and calls + * Goes through the list of files in the underlying dir and calls * view_add_file for each one. This results in icons being created for each * file. */ diff --git a/src/view_layout.c b/src/view_layout.c index afee6e877..3de933c27 100644 --- a/src/view_layout.c +++ b/src/view_layout.c @@ -65,7 +65,7 @@ e_view_layout_realize(E_View_Layout *layout) /* check for custom layout bits */ snprintf(buf, PATH_MAX, "%s/.e_layout/layout.bits.db", - layout->view->model->dir); + layout->view->dir->dir); /* keep track of file loaded */ IF_FREE(layout->file); e_strdup(layout->file, buf); @@ -74,7 +74,7 @@ e_view_layout_realize(E_View_Layout *layout) /* if custom doesn't exist, load default layout */ if (!bits) { - if (layout->view->model->is_desktop) + if (layout->view->dir->is_desktop) snprintf(buf, PATH_MAX, "%s/desktop.bits.db", e_config_get("layout")); else snprintf(buf, PATH_MAX, "%s/view.bits.db", e_config_get("layout"));