forked from enlightenment/enlightenment
ok folks, here goes. The multiple view stuff as discussed in lenght. I've managed to get metadata back up, views save
their geometry on close. I'll start getting the documentation back in sync and commenting some more. Could anyone willing to clean up/fix either the iconbar dnd stuff and/or the regular dnd stuff please announce it, so we dont start duplicating work. Thanks. SVN revision: 5977
This commit is contained in:
parent
abf7d8f0ee
commit
5744b944d6
|
@ -84,6 +84,9 @@ enlightenment_SOURCES = \
|
|||
text.h text.c \
|
||||
util.h util.c \
|
||||
view.h view.c \
|
||||
e_file.h e_file.c \
|
||||
e_view_model.h e_view_model.c \
|
||||
e_view_machine.h e_view_machine.c \
|
||||
e.h
|
||||
|
||||
enlightenment_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ @efsd_libs@ @ebg_libs@ @ferite_libs@ -lm -lc $(INTLLIBS)
|
||||
|
|
|
@ -281,7 +281,7 @@ e_config_load(char *file, char *prefix, E_Config_Base_Type *type)
|
|||
for (l = type->nodes; l; l = l->next)
|
||||
{
|
||||
E_Config_Node *node;
|
||||
|
||||
|
||||
node = l->data;
|
||||
|
||||
switch (node->type)
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "icccm.h"
|
||||
#include "util.h"
|
||||
#include "object.h"
|
||||
#include "e_view_machine.h"
|
||||
|
||||
static Evas_List desktops = NULL;
|
||||
static Window e_base_win = 0;
|
||||
|
@ -196,7 +197,6 @@ e_desktops_init_file_display(E_Desktop *desk)
|
|||
v->size.w = desk->real.w;
|
||||
v->size.h = desk->real.h;
|
||||
v->options.back_pixmap = 1;
|
||||
v->is_desktop = 1;
|
||||
|
||||
desk->view = v;
|
||||
/* fixme: later */
|
||||
|
@ -204,11 +204,10 @@ e_desktops_init_file_display(E_Desktop *desk)
|
|||
/* e_strdup(v->dir, "/dev"); */
|
||||
/* e_strdup(v->dir, e_file_home()); */
|
||||
snprintf(buf, PATH_MAX, "%s/desktop/default", e_config_user_dir());
|
||||
e_strdup(v->dir, buf);
|
||||
|
||||
e_view_bg_load(v);
|
||||
|
||||
|
||||
e_view_set_dir(v, buf, 1);
|
||||
e_view_realize(v);
|
||||
e_view_populate(v);
|
||||
|
||||
ecore_window_hint_set_borderless(v->win.base);
|
||||
ecore_window_hint_set_sticky(v->win.base, 1);
|
||||
|
|
|
@ -0,0 +1,144 @@
|
|||
#include "debug.h"
|
||||
#include "e_file.h"
|
||||
#include "file.h"
|
||||
#include "util.h"
|
||||
|
||||
static void e_file_cleanup (E_File *f);
|
||||
|
||||
static void
|
||||
e_file_cleanup(E_File *f)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
IF_FREE(f->info.icon);
|
||||
IF_FREE(f->info.link)
|
||||
IF_FREE(f->info.custom_icon);
|
||||
IF_FREE(f->info.mime.base);
|
||||
IF_FREE(f->info.mime.type);
|
||||
IF_FREE(f->file);
|
||||
e_object_cleanup(E_OBJECT(f));
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
E_File *
|
||||
e_file_new(char *file)
|
||||
{
|
||||
E_File *f;
|
||||
D_ENTER;
|
||||
|
||||
f = NEW(E_File, 1);
|
||||
|
||||
e_object_init(E_OBJECT(f),
|
||||
(E_Cleanup_Func) e_file_cleanup);
|
||||
|
||||
f->info.icon = NULL;
|
||||
f->info.link = NULL;
|
||||
f->info.custom_icon = NULL;
|
||||
f->info.mime.base = NULL;
|
||||
f->info.mime.type = NULL;
|
||||
f->file = strdup(file);
|
||||
|
||||
D_RETURN_(f);
|
||||
}
|
||||
|
||||
E_File *
|
||||
e_file_get_by_name(Evas_List l, char *file)
|
||||
{
|
||||
Evas_List ll;
|
||||
E_File *f;
|
||||
D_ENTER;
|
||||
for (ll=l;ll;ll=ll->next)
|
||||
{
|
||||
f = (E_File*) ll->data;
|
||||
|
||||
if (!strcmp(file, f->file))
|
||||
{
|
||||
D_RETURN_(f);
|
||||
}
|
||||
}
|
||||
D_RETURN_(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
e_file_set_mime(E_File *f, char *base, char *mime)
|
||||
{
|
||||
char icon[PATH_MAX];
|
||||
char type[PATH_MAX];
|
||||
char *p;
|
||||
|
||||
D_ENTER;
|
||||
D("Setting mime: %40s: %s/%s\n", f->file, base, mime);
|
||||
if ( ((f->info.mime.base) && !(strcmp(f->info.mime.base, base)))
|
||||
&&((f->info.mime.type) && !(strcmp(f->info.mime.type, mime))))
|
||||
D_RETURN;
|
||||
|
||||
if (f->info.mime.base)
|
||||
free(f->info.mime.base);
|
||||
if (f->info.mime.type)
|
||||
free(f->info.mime.type);
|
||||
f->info.mime.base = strdup(base);
|
||||
f->info.mime.type = strdup(mime);
|
||||
|
||||
|
||||
/* effect changes here */
|
||||
/*
|
||||
* if (f->info.custom_icon)
|
||||
* {
|
||||
* if (f->info.icon)
|
||||
* free(f->info.icon);
|
||||
* f->info.icon = strdup(f->info.custom_icon);
|
||||
* evas_set_image_file(f->view->evas, f->obj.icon, f->info.custom_icon);
|
||||
* e_view_queue_resort(f->view);
|
||||
* D_RETURN;
|
||||
* }
|
||||
*/
|
||||
|
||||
/* find an icon */
|
||||
strcpy(type, f->info.mime.type);
|
||||
p=type;
|
||||
do
|
||||
{
|
||||
snprintf(icon, PATH_MAX, "%s/data/icons/%s/%s.db",
|
||||
PACKAGE_DATA_DIR, f->info.mime.base, type);
|
||||
p = strrchr(type, '/');
|
||||
if (p) *p = 0;
|
||||
}
|
||||
while (p && !e_file_exists(icon));
|
||||
|
||||
/* fallback to base type icon */
|
||||
if (!e_file_exists(icon))
|
||||
snprintf(icon, PATH_MAX, "%s/data/icons/%s/default.db",
|
||||
PACKAGE_DATA_DIR, f->info.mime.base);
|
||||
/* still no luck fall back to default */
|
||||
if (!e_file_exists(icon))
|
||||
snprintf(icon, PATH_MAX, "%s/data/icons/unknown/default.db",
|
||||
PACKAGE_DATA_DIR);
|
||||
|
||||
f->info.icon = strdup(icon);
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_file_set_link(E_File *f, char *link)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
if ((!link) && (f->info.link))
|
||||
{
|
||||
free(f->info.link);
|
||||
f->info.link = NULL;
|
||||
/* effect changes here */
|
||||
}
|
||||
else if (link)
|
||||
{
|
||||
if ((f->info.link) && (!strcmp(f->info.link, link)))
|
||||
{
|
||||
free(f->info.link);
|
||||
f->info.link = strdup(link);
|
||||
/* effect changes here */
|
||||
}
|
||||
}
|
||||
D_RETURN;
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef E_EFILE_H
|
||||
#define E_EFILE_H
|
||||
#include "object.h"
|
||||
#include <sys/stat.h>
|
||||
|
||||
typedef struct _E_File E_File;
|
||||
struct _E_File
|
||||
{
|
||||
E_Object o;
|
||||
|
||||
char *file;
|
||||
struct stat stat;
|
||||
|
||||
struct {
|
||||
char *icon;
|
||||
char *custom_icon;
|
||||
char *link;
|
||||
struct {
|
||||
char *base;
|
||||
char *type;
|
||||
} mime;
|
||||
} info;
|
||||
};
|
||||
|
||||
E_File *e_file_new(char *file);
|
||||
E_File *e_file_get_by_name(Evas_List l, char *file);
|
||||
void e_file_set_mime(E_File *f, char *base, char *mime);
|
||||
void e_file_set_link(E_File *f, char *link);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,108 @@
|
|||
#include <Ecore.h>
|
||||
#include "e_view_machine.h"
|
||||
#include "e_view_model.h"
|
||||
#include "util.h"
|
||||
#include "globals.h"
|
||||
#include "file.h"
|
||||
|
||||
void
|
||||
e_view_machine_init()
|
||||
{
|
||||
D_ENTER;
|
||||
/* FIXME make this a singleton */
|
||||
VM= NEW(E_View_Model, 1);
|
||||
e_view_init();
|
||||
e_view_model_init();
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_view_machine_register_view(E_View *v)
|
||||
{
|
||||
D_ENTER;
|
||||
/* Add view to the list of views */
|
||||
VM->views = evas_list_append(VM->views, v);
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_view_machine_unregister_view(E_View *v)
|
||||
{
|
||||
D_ENTER;
|
||||
/* Remove the view from the global list of views
|
||||
* and from the list of its model. */
|
||||
VM->views = evas_list_remove(VM->views, v);
|
||||
v->model->views = evas_list_remove(v->model->views, v);
|
||||
e_object_unref (E_OBJECT(v->model));
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
|
||||
static E_View_Model *
|
||||
get_model_from_realpath(char *path)
|
||||
{
|
||||
E_View_Model *m;
|
||||
Evas_List l;
|
||||
|
||||
D_ENTER;
|
||||
if (path)
|
||||
{
|
||||
for (l=VM->models; l; l = l->next)
|
||||
{
|
||||
m = l->data;
|
||||
if (!strcmp(m->dir, path))
|
||||
{
|
||||
D("Model for this dir already exists\n");
|
||||
e_object_ref (E_OBJECT(m));
|
||||
D_RETURN_(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
D_RETURN_(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
e_view_machine_get_model(E_View *v, char *path, int is_desktop)
|
||||
{
|
||||
E_View_Model *m = NULL;
|
||||
char *realpath;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
D_ENTER;
|
||||
realpath = e_file_realpath(path);
|
||||
if (!(m = get_model_from_realpath(realpath)))
|
||||
{
|
||||
D("Model for this dir doesnt exist, make a new one\n");
|
||||
m = e_view_model_new();
|
||||
VM->models = evas_list_append(VM->models, m);
|
||||
e_view_model_set_dir(m, path);
|
||||
snprintf(buf, PATH_MAX, "%s/.e_background.bg.db", realpath);
|
||||
if (!e_file_exists(buf))
|
||||
{
|
||||
if (is_desktop)
|
||||
{
|
||||
snprintf(buf, PATH_MAX, "%s/default.bg.db", e_config_get("backgrounds"));
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buf, PATH_MAX, "%s/view.bg.db", e_config_get("backgrounds"));
|
||||
}
|
||||
}
|
||||
e_strdup(m->bg_file, buf);
|
||||
m->is_desktop = is_desktop;
|
||||
}
|
||||
if (m)
|
||||
{
|
||||
v->model = m;
|
||||
v->model->views = evas_list_append(v->model->views, 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)));
|
||||
e_strdup(v->name, buf);
|
||||
D("assigned name to view: %s\n",v->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME error handling */
|
||||
}
|
||||
D_RETURN;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef E_VIEW_MACHINE_H
|
||||
#define E_VIEW_MACHINE_H
|
||||
#include <Evas.h>
|
||||
#include "view.h"
|
||||
struct _e_view_machine
|
||||
{
|
||||
Evas_List views;
|
||||
Evas_List models;
|
||||
};
|
||||
typedef struct _e_view_machine E_View_Machine;
|
||||
|
||||
void e_view_machine_init();
|
||||
void e_view_machine_register_view(E_View *v);
|
||||
void e_view_machine_unregister_view(E_View *v);
|
||||
void e_view_machine_get_model(E_View *v, char *path, int is_desktop);
|
||||
#endif
|
|
@ -0,0 +1,666 @@
|
|||
#include "file.h"
|
||||
#include "e_view_model.h"
|
||||
#include "e_view_machine.h"
|
||||
#include "view.h"
|
||||
#include "icons.h"
|
||||
#include "util.h"
|
||||
#include "libefsd.h"
|
||||
#include "e_file.h"
|
||||
#include "globals.h"
|
||||
|
||||
static void e_view_model_handle_fs_restart(void *data);
|
||||
static void e_view_model_handle_fs(EfsdEvent *ev);
|
||||
static void e_view_model_handle_efsd_event_reply (EfsdEvent *ev);
|
||||
static void e_view_model_handle_efsd_event_reply_stat (EfsdEvent *ev);
|
||||
static void e_view_model_handle_efsd_event_reply_readlink (EfsdEvent *ev);
|
||||
static void e_view_model_handle_efsd_event_reply_getfiletype (EfsdEvent *ev);
|
||||
static void e_view_model_handle_efsd_event_reply_getmeta (EfsdEvent *ev);
|
||||
|
||||
static void e_view_model_cleanup(E_View_Model *m);
|
||||
static void e_view_model_bg_reload_timeout(int val, void *data);
|
||||
static void e_view_model_set_default_background(E_View_Model *m);
|
||||
static void e_view_model_redraw_views(E_View_Model *m);
|
||||
|
||||
void
|
||||
e_view_model_init()
|
||||
{
|
||||
D_ENTER;
|
||||
e_fs_add_event_handler(e_view_model_handle_fs);
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
static void
|
||||
e_view_model_cleanup(E_View_Model *m)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
efsd_stop_monitor(e_fs_get_connection(), m->dir, TRUE);
|
||||
if (m->restarter)
|
||||
e_fs_del_restart_handler(m->restarter);
|
||||
|
||||
m->restarter = NULL;
|
||||
VM->models = evas_list_remove(VM->models, m);
|
||||
|
||||
e_object_cleanup(E_OBJECT(m));
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
E_View_Model *
|
||||
e_view_model_new ()
|
||||
{
|
||||
E_View_Model *m;
|
||||
|
||||
D_ENTER;
|
||||
|
||||
m = NEW (E_View_Model, 1);
|
||||
ZERO(m, E_View_Model, 1);
|
||||
m->dir = NULL;
|
||||
m->views = NULL;
|
||||
|
||||
e_object_init(E_OBJECT(m),
|
||||
(E_Cleanup_Func) e_view_model_cleanup);
|
||||
|
||||
D_RETURN_(m);
|
||||
}
|
||||
|
||||
static void
|
||||
e_view_model_redraw_views(E_View_Model *m)
|
||||
{
|
||||
Evas_List l;
|
||||
E_View *v;
|
||||
D_ENTER;
|
||||
|
||||
/* set the dirty flag of all views. the next time the idle
|
||||
* handler calls update_views, they'll be redrawn */
|
||||
for (l=m->views;l;l=l->next)
|
||||
{
|
||||
v = l->data;
|
||||
v->changed = 1;
|
||||
}
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
static void
|
||||
e_view_model_set_default_background(E_View_Model *m)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
D_ENTER;
|
||||
IF_FREE(m->bg_file);
|
||||
if (m->is_desktop)
|
||||
snprintf(buf, PATH_MAX, "%s/default.bg.db", e_config_get("backgrounds"));
|
||||
else
|
||||
snprintf(buf, PATH_MAX, "%s/view.bg.db", e_config_get("backgrounds"));
|
||||
e_strdup(m->bg_file, buf);
|
||||
snprintf(buf, PATH_MAX, "background_reload:%s", m->dir);
|
||||
ecore_add_event_timer(buf, 0.5,
|
||||
e_view_model_bg_reload_timeout, 0, m);
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
static void
|
||||
e_view_model_handle_fs_restart(void *data)
|
||||
{
|
||||
E_View_Model *m;
|
||||
|
||||
D_ENTER;
|
||||
m = data;
|
||||
D("e_view_model_handle_fs_restart\n");
|
||||
if (e_fs_get_connection())
|
||||
{
|
||||
EfsdOptions *ops;
|
||||
/* FIXME restart with metadata pending for views */
|
||||
|
||||
ops = efsd_ops(3,
|
||||
efsd_op_get_stat(),
|
||||
efsd_op_get_filetype(),
|
||||
efsd_op_list_all());
|
||||
m->monitor_id = efsd_start_monitor(e_fs_get_connection(), m->dir,
|
||||
ops, TRUE);
|
||||
|
||||
}
|
||||
D("restarted monitor id (connection = %p), %i for %s\n", e_fs_get_connection(), m->monitor_id, m->dir);
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_view_model_set_dir(E_View_Model *m, char *dir)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
/* stop monitoring old dir */
|
||||
if ((m->dir) && (m->monitor_id))
|
||||
{
|
||||
efsd_stop_monitor(e_fs_get_connection(), m->dir, TRUE);
|
||||
m->monitor_id = 0;
|
||||
}
|
||||
IF_FREE(m->dir);
|
||||
m->dir = e_file_realpath(dir);
|
||||
|
||||
/* start monitoring new dir */
|
||||
m->restarter = e_fs_add_restart_handler(e_view_model_handle_fs_restart, m);
|
||||
if (e_fs_get_connection())
|
||||
{
|
||||
EfsdOptions *ops;
|
||||
|
||||
ops = efsd_ops(3,
|
||||
efsd_op_get_stat(),
|
||||
efsd_op_get_filetype(),
|
||||
efsd_op_list_all());
|
||||
m->monitor_id = efsd_start_monitor(e_fs_get_connection(), m->dir,
|
||||
ops, TRUE);
|
||||
D("monitor id for %s = %i\n", m->dir, m->monitor_id);
|
||||
}
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
static void
|
||||
e_view_model_handle_fs(EfsdEvent *ev)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
switch (ev->type)
|
||||
{
|
||||
case EFSD_EVENT_FILECHANGE:
|
||||
switch (ev->efsd_filechange_event.changetype)
|
||||
{
|
||||
case EFSD_FILE_CREATED:
|
||||
e_view_model_file_added(ev->efsd_filechange_event.id,
|
||||
ev->efsd_filechange_event.file);
|
||||
break;
|
||||
case EFSD_FILE_EXISTS:
|
||||
e_view_model_file_added(ev->efsd_filechange_event.id,
|
||||
ev->efsd_filechange_event.file);
|
||||
break;
|
||||
case EFSD_FILE_DELETED:
|
||||
e_view_model_file_deleted(ev->efsd_filechange_event.id,
|
||||
ev->efsd_filechange_event.file);
|
||||
break;
|
||||
case EFSD_FILE_CHANGED:
|
||||
e_view_model_file_changed(ev->efsd_filechange_event.id,
|
||||
ev->efsd_filechange_event.file);
|
||||
break;
|
||||
case EFSD_FILE_MOVED:
|
||||
e_view_model_file_moved(ev->efsd_filechange_event.id,
|
||||
ev->efsd_filechange_event.file);
|
||||
break;
|
||||
case EFSD_FILE_END_EXISTS:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case EFSD_EVENT_REPLY:
|
||||
e_view_model_handle_efsd_event_reply (ev);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
e_view_model_handle_efsd_event_reply_getfiletype(EfsdEvent *ev)
|
||||
{
|
||||
E_File *f;
|
||||
char *file;
|
||||
Evas_List l;
|
||||
E_View_Model *model;
|
||||
|
||||
char *m, *p;
|
||||
char mime[PATH_MAX], base[PATH_MAX];
|
||||
D_ENTER;
|
||||
|
||||
if (!ev->efsd_reply_event.errorcode == 0)
|
||||
D_RETURN;
|
||||
|
||||
file = NULL;
|
||||
if ( (file = efsd_event_filename(ev)) )
|
||||
{
|
||||
file = e_file_get_file(file);
|
||||
}
|
||||
model = e_view_model_find_by_monitor_id(efsd_event_id(ev));
|
||||
|
||||
f = e_file_get_by_name(model->files, file);
|
||||
/* if its not in the list we care about, its filetype is meaningless */
|
||||
if(!f)
|
||||
D_RETURN;
|
||||
|
||||
m = ev->efsd_reply_event.data;
|
||||
p = strchr(m, '/');
|
||||
if (p)
|
||||
{
|
||||
strcpy(base, m);
|
||||
strcpy(mime, p + 1);
|
||||
p = strchr(base, '/');
|
||||
*p = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(base, m);
|
||||
strcpy(mime, "unknown");
|
||||
}
|
||||
e_file_set_mime(f, base, mime);
|
||||
|
||||
for (l=model->views;l;l=l->next)
|
||||
{
|
||||
E_View *v = (E_View *)l->data;
|
||||
E_Icon *ic = e_icon_find_by_file(v, f->file);
|
||||
/* Try to update the GUI.
|
||||
It's just a try because we need to have the file's stat
|
||||
info as well. --cK.
|
||||
*/
|
||||
e_icon_update_state(ic);
|
||||
e_icon_initial_show(ic);
|
||||
}
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
static void
|
||||
e_view_model_handle_efsd_event_reply_stat(EfsdEvent *ev)
|
||||
{
|
||||
E_View_Model *m;
|
||||
E_File *f;
|
||||
Evas_List l;
|
||||
D_ENTER;
|
||||
if (!ev->efsd_reply_event.errorcode == 0)
|
||||
D_RETURN;
|
||||
|
||||
m = e_view_model_find_by_monitor_id(efsd_event_id(ev));
|
||||
f = e_file_get_by_name(m->files, e_file_get_file(efsd_event_filename(ev)));
|
||||
/* if its not in the list we care about, return */
|
||||
if(!f)
|
||||
D_RETURN;
|
||||
|
||||
/* When everything went okay and we can find a model,
|
||||
set the file stat data for the file and try to update the gui.
|
||||
It's just a try because we need to have received the filetype
|
||||
info too. --cK. */
|
||||
f->stat = *((struct stat*)efsd_event_data(ev));
|
||||
for (l=m->views;l;l=l->next)
|
||||
{
|
||||
E_View *v = (E_View *)l->data;
|
||||
E_Icon *ic = e_icon_find_by_file(v, f->file);
|
||||
e_icon_update_state(ic);
|
||||
e_icon_initial_show(ic);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
e_view_model_handle_efsd_event_reply_readlink(EfsdEvent *ev)
|
||||
{
|
||||
E_View_Model *m;
|
||||
E_File *f;
|
||||
Evas_List l;
|
||||
D_ENTER;
|
||||
|
||||
if (!ev->efsd_reply_event.errorcode == 0)
|
||||
D_RETURN;
|
||||
|
||||
m = e_view_model_find_by_monitor_id(efsd_event_id(ev));
|
||||
f = e_file_get_by_name(m->files, e_file_get_file(efsd_event_filename(ev)));
|
||||
if (f)
|
||||
{
|
||||
e_file_set_link(f, (char*)efsd_event_data(ev));
|
||||
}
|
||||
for (l=m->views;l;l=l->next)
|
||||
{
|
||||
E_View *v = (E_View *)l->data;
|
||||
E_Icon *ic = e_icon_find_by_file(v, f->file);
|
||||
e_icon_update_state(ic);
|
||||
e_icon_initial_show(ic);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
e_view_model_handle_efsd_event_reply_getmeta(EfsdEvent *ev)
|
||||
{
|
||||
Evas_List l;
|
||||
EfsdCmdId cmd;
|
||||
D_ENTER;
|
||||
|
||||
cmd = efsd_event_id(ev);
|
||||
for (l=VM->views;l;l=l->next)
|
||||
{
|
||||
E_View *v;
|
||||
v = l->data;
|
||||
/* ignore metadata for desktops */
|
||||
if(v->model->is_desktop) continue;
|
||||
if (v->geom_get.x == cmd)
|
||||
{
|
||||
v->geom_get.x = 0;
|
||||
if (efsd_metadata_get_type(ev) == EFSD_INT)
|
||||
{
|
||||
if (ev->efsd_reply_event.errorcode == 0)
|
||||
efsd_metadata_get_int(ev, &(v->location.x));
|
||||
else
|
||||
v->location.x = 0;
|
||||
}
|
||||
}
|
||||
else if (v->geom_get.y == cmd)
|
||||
{
|
||||
v->geom_get.y = 0;
|
||||
if (efsd_metadata_get_type(ev) == EFSD_INT)
|
||||
{
|
||||
if (ev->efsd_reply_event.errorcode == 0)
|
||||
efsd_metadata_get_int(ev, &(v->location.y));
|
||||
else
|
||||
v->location.y = 0;
|
||||
|
||||
}
|
||||
}
|
||||
else if (v->geom_get.w == cmd)
|
||||
{
|
||||
v->geom_get.w = 0;
|
||||
if (efsd_metadata_get_type(ev) == EFSD_INT)
|
||||
{
|
||||
if (ev->efsd_reply_event.errorcode == 0)
|
||||
efsd_metadata_get_int(ev, &(v->size.w));
|
||||
else
|
||||
v->size.w = 400;
|
||||
}
|
||||
}
|
||||
else if (v->geom_get.h == cmd)
|
||||
{
|
||||
v->geom_get.h = 0;
|
||||
if (ev->efsd_reply_event.errorcode == 0)
|
||||
{
|
||||
if (ev->efsd_reply_event.errorcode == 0)
|
||||
efsd_metadata_get_int(ev, &(v->size.h));
|
||||
else
|
||||
v->size.h = 400;
|
||||
}
|
||||
}
|
||||
/* FIXME currently, the bg info is not set via metadata */
|
||||
/*
|
||||
* else if (v->getbg == cmd)
|
||||
* {
|
||||
* v->getbg = 0;
|
||||
* if (efsd_metadata_get_type(ev) == EFSD_STRING)
|
||||
* {
|
||||
* if (ev->efsd_reply_event.errorcode == 0)
|
||||
* {
|
||||
* char buf[PATH_MAX];
|
||||
*
|
||||
* IF_FREE(v->model->bg_file);
|
||||
* e_strdup(v->model->bg_file, efsd_metadata_get_str(ev));
|
||||
* snprintf(buf, PATH_MAX, "background_reload:%s", v->model->dir);
|
||||
* ecore_add_event_timer(buf, 0.5, e_view_model_bg_reload_timeout, 0, v->model);
|
||||
* }
|
||||
* else
|
||||
* e_view_model_set_default_background(v->model);
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
ecore_window_move(v->win.base, v->location.x, v->location.y);
|
||||
ecore_window_resize(v->win.base, v->size.w, v->size.h);
|
||||
v->size.force = 1;
|
||||
|
||||
/* We have received all metadata we need, display the view */
|
||||
if ((!v->geom_get.x) &&
|
||||
(!v->geom_get.y) &&
|
||||
(!v->geom_get.w) &&
|
||||
(!v->geom_get.h) &&
|
||||
(v->geom_get.busy))
|
||||
{
|
||||
E_Border *b;
|
||||
|
||||
v->geom_get.busy = 0;
|
||||
if (v->bg)
|
||||
e_bg_resize(v->bg, v->size.w, v->size.h);
|
||||
if (v->options.back_pixmap) e_view_update(v);
|
||||
b = e_border_adopt(v->win.base, 1);
|
||||
b->client.internal = 1;
|
||||
e_border_remove_click_grab(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
e_view_model_handle_efsd_event_reply(EfsdEvent *ev)
|
||||
{
|
||||
D_ENTER;
|
||||
switch (ev->efsd_reply_event.command.type)
|
||||
{
|
||||
case EFSD_CMD_REMOVE:
|
||||
break;
|
||||
case EFSD_CMD_MOVE:
|
||||
break;
|
||||
case EFSD_CMD_SYMLINK:
|
||||
break;
|
||||
case EFSD_CMD_LISTDIR:
|
||||
break;
|
||||
case EFSD_CMD_MAKEDIR:
|
||||
break;
|
||||
case EFSD_CMD_CHMOD:
|
||||
break;
|
||||
case EFSD_CMD_GETFILETYPE:
|
||||
e_view_model_handle_efsd_event_reply_getfiletype(ev);
|
||||
break;
|
||||
case EFSD_CMD_STAT:
|
||||
e_view_model_handle_efsd_event_reply_stat(ev);
|
||||
break;
|
||||
case EFSD_CMD_READLINK:
|
||||
e_view_model_handle_efsd_event_reply_readlink(ev);
|
||||
break;
|
||||
case EFSD_CMD_CLOSE:
|
||||
break;
|
||||
case EFSD_CMD_SETMETA:
|
||||
break;
|
||||
case EFSD_CMD_GETMETA:
|
||||
e_view_model_handle_efsd_event_reply_getmeta(ev);
|
||||
break;
|
||||
case EFSD_CMD_STARTMON_DIR:
|
||||
break;
|
||||
case EFSD_CMD_STARTMON_FILE:
|
||||
break;
|
||||
case EFSD_CMD_STOPMON_DIR:
|
||||
break;
|
||||
case EFSD_CMD_STOPMON_FILE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
D_RETURN;
|
||||
}
|
||||
static void
|
||||
e_view_model_ib_reload_timeout(int val, void *data)
|
||||
{
|
||||
Evas_List l;
|
||||
E_View *v;
|
||||
E_View_Model *m;
|
||||
|
||||
D_ENTER;
|
||||
m = data;
|
||||
|
||||
for (l=m->views;l;l=l->next)
|
||||
{
|
||||
v = (E_View*) l->data;
|
||||
e_view_ib_reload(v);
|
||||
}
|
||||
D_RETURN;
|
||||
UN(val);
|
||||
}
|
||||
|
||||
static void
|
||||
e_view_model_bg_reload_timeout(int val, void *data)
|
||||
{
|
||||
Evas_List l;
|
||||
E_View *v;
|
||||
E_View_Model *m;
|
||||
|
||||
D_ENTER;
|
||||
m = data;
|
||||
|
||||
for (l=m->views;l;l=l->next)
|
||||
{
|
||||
v = (E_View*) l->data;
|
||||
e_view_bg_reload(v);
|
||||
}
|
||||
D_RETURN;
|
||||
UN(val);
|
||||
}
|
||||
|
||||
void
|
||||
e_view_model_file_added(int id, char *file)
|
||||
{
|
||||
Evas_List l;
|
||||
E_View_Model *m;
|
||||
E_View *v;
|
||||
E_File *f;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
D_ENTER;
|
||||
|
||||
/* if we get a path - ignore it - its not a file in the dir */
|
||||
if (!file || file[0] == '/') D_RETURN;
|
||||
m = e_view_model_find_by_monitor_id(id);
|
||||
|
||||
if (!strcmp(file, ".e_background.bg.db"))
|
||||
{
|
||||
IF_FREE(m->bg_file);
|
||||
snprintf(buf, PATH_MAX, "%s/%s", m->dir, file);
|
||||
e_strdup(m->bg_file, buf);
|
||||
snprintf(buf, PATH_MAX, "background_reload:%s", m->dir);
|
||||
ecore_add_event_timer(buf, 0.5,
|
||||
e_view_model_bg_reload_timeout, 0, m);
|
||||
}
|
||||
else if ((!strcmp (".e_iconbar.db", file)) ||
|
||||
(!strcmp (".e_iconbar.bits.db", file)))
|
||||
{
|
||||
snprintf(buf, PATH_MAX, "iconbar_reload:%s", m->dir);
|
||||
ecore_add_event_timer(buf, 0.5,
|
||||
e_view_model_ib_reload_timeout, 0, m);
|
||||
}
|
||||
else if (file[0] != '.')
|
||||
{
|
||||
f = e_file_new(file);
|
||||
m->files = evas_list_append(m->files, f);
|
||||
/* tell all views for this dir about the new file */
|
||||
for (l= m->views;l ;l = l->next)
|
||||
{
|
||||
v = l->data;
|
||||
e_view_file_add(v, f);
|
||||
}
|
||||
}
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_view_model_file_deleted(int id, char *file)
|
||||
{
|
||||
Evas_List l;
|
||||
E_File *f;
|
||||
E_View_Model *m;
|
||||
D_ENTER;
|
||||
|
||||
if (!file || file[0] == '/') D_RETURN;
|
||||
m = e_view_model_find_by_monitor_id(id);
|
||||
f = e_file_get_by_name(m->files, file);
|
||||
m->files = evas_list_remove(m->files, f);
|
||||
if (!strcmp(file, ".e_background.bg.db"))
|
||||
{
|
||||
e_view_model_set_default_background(m);
|
||||
}
|
||||
else if ((!strcmp (".e_iconbar.db", file)) ||
|
||||
(!strcmp (".e_iconbar.bits.db", file)))
|
||||
{
|
||||
for (l=m->views;l;l=l->next)
|
||||
{
|
||||
E_View *v = (E_View*) l->data;
|
||||
e_object_unref(E_OBJECT(v->iconbar));
|
||||
v->iconbar = NULL;
|
||||
}
|
||||
}
|
||||
else if(file[0] != '.')
|
||||
{
|
||||
for (l=m->views;l;l=l->next)
|
||||
{
|
||||
E_View *v = (E_View*) l->data;
|
||||
e_view_file_delete(v, f);
|
||||
}
|
||||
}
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_view_model_file_changed(int id, char *file)
|
||||
{
|
||||
Evas_List l;
|
||||
E_View_Model *m;
|
||||
E_File *f;
|
||||
E_View *v;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
D_ENTER;
|
||||
|
||||
if (!file || file[0] == '/') D_RETURN;
|
||||
m = e_view_model_find_by_monitor_id(id);
|
||||
f = e_file_get_by_name(m->files, file);
|
||||
if (!strcmp(file, ".e_background.bg.db"))
|
||||
{
|
||||
IF_FREE(m->bg_file);
|
||||
snprintf(buf, PATH_MAX, "%s/%s", m->dir, file);
|
||||
e_strdup(m->bg_file, buf);
|
||||
snprintf(buf, PATH_MAX, "background_reload:%s", m->dir);
|
||||
ecore_add_event_timer(buf, 0.5,
|
||||
e_view_model_bg_reload_timeout, 0, m);
|
||||
}
|
||||
else if ((!strcmp (".e_iconbar.db", file)) ||
|
||||
(!strcmp (".e_iconbar.bits.db", file)))
|
||||
{
|
||||
snprintf(buf, PATH_MAX, "iconbar_reload:%s", m->dir);
|
||||
ecore_add_event_timer(buf, 0.5,
|
||||
e_view_model_ib_reload_timeout, 0, m);
|
||||
}
|
||||
else if (file[0] != '.')
|
||||
{
|
||||
for (l= m->views;l ;l = l->next)
|
||||
{
|
||||
v = l->data;
|
||||
e_view_file_changed(v, f);
|
||||
}
|
||||
}
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_view_model_file_moved(int id, char *file)
|
||||
{
|
||||
Evas_List l;
|
||||
E_View_Model *m;
|
||||
|
||||
D_ENTER;
|
||||
|
||||
if (!file || file[0] == '/') D_RETURN;
|
||||
m = e_view_model_find_by_monitor_id(id);
|
||||
for (l=m->views;l;l=l->next)
|
||||
{
|
||||
E_View *v = (E_View*) l->data;
|
||||
E_Icon *ic;
|
||||
|
||||
ic = e_icon_find_by_file(v, file);
|
||||
if (ic)
|
||||
{
|
||||
}
|
||||
}
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
E_View_Model *
|
||||
e_view_model_find_by_monitor_id(int id)
|
||||
{
|
||||
E_View_Model *m;
|
||||
Evas_List l;
|
||||
D_ENTER;
|
||||
|
||||
for (l = VM->models; l; l = l->next)
|
||||
{
|
||||
m = l->data;
|
||||
if (m->monitor_id == id)
|
||||
D_RETURN_(m);;
|
||||
}
|
||||
D_RETURN_(NULL);
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
#ifndef E_VIEW_MODEL_H
|
||||
#define E_VIEW_MODEL_H
|
||||
|
||||
#include "fs.h"
|
||||
#include "iconbar.h"
|
||||
#include <Evas.h>
|
||||
|
||||
#ifndef E_VIEW_TYPEDEF
|
||||
#define E_VIEW_TYPEDEF
|
||||
typedef struct _E_View E_View;
|
||||
#endif
|
||||
|
||||
#ifndef E_ICON_TYPEDEF
|
||||
#define E_ICON_TYPEDEF
|
||||
typedef struct _E_Icon E_Icon;
|
||||
#endif
|
||||
|
||||
#ifndef E_VIEW_MODEL_TYPEDEF
|
||||
#define E_VIEW_MODEL_TYPEDEF
|
||||
typedef struct _E_View_Model E_View_Model;
|
||||
#endif
|
||||
|
||||
struct _E_View_Model
|
||||
{
|
||||
E_Object o;
|
||||
char *dir;
|
||||
Evas_List files;
|
||||
|
||||
Evas_Object obj_bg;
|
||||
|
||||
char *bg_file;
|
||||
|
||||
E_FS_Restarter *restarter;
|
||||
|
||||
int monitor_id;
|
||||
|
||||
Evas_List views;
|
||||
int is_desktop;
|
||||
};
|
||||
|
||||
void e_view_model_set_dir(E_View_Model *m, char *dir);
|
||||
E_View_Model * e_view_model_new();
|
||||
void e_view_model_init();
|
||||
E_View_Model * e_view_model_find_by_monitor_id(int id);
|
||||
void e_view_model_file_added(int id, char *file);
|
||||
void e_view_model_file_deleted(int id, char *file);
|
||||
void e_view_model_file_changed(int id, char *file);
|
||||
void e_view_model_file_moved(int id, char *file);
|
||||
#endif
|
|
@ -1,6 +1,5 @@
|
|||
#include "debug.h"
|
||||
#include "epplet.h"
|
||||
#include "globals.h"
|
||||
#include "file.h"
|
||||
#include "observer.h"
|
||||
#include "desktops.h"
|
||||
|
|
|
@ -104,7 +104,7 @@ e_file_get_file(char *path)
|
|||
result++;
|
||||
else
|
||||
result = path;
|
||||
|
||||
|
||||
D_RETURN_(result);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#ifndef E_FILE_H
|
||||
#define E_FILE_H
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <Evas.h>
|
||||
|
||||
time_t e_file_mod_time(char *file);
|
||||
int e_file_exists(char *file);
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include <Evas.h>
|
||||
#include <Ecore.h>
|
||||
|
||||
#include "view.h"
|
||||
#include "e_view_machine.h"
|
||||
|
||||
Ecore_Event_Key_Modifiers multi_select_mod = ECORE_EVENT_KEY_MODIFIER_SHIFT;
|
||||
Ecore_Event_Key_Modifiers range_select_mod = ECORE_EVENT_KEY_MODIFIER_CTRL;
|
||||
Evas_List views = NULL;
|
||||
E_View_Machine *VM = NULL;
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#ifndef E_GLOBALS_H
|
||||
#define E_GLOBALS_H
|
||||
|
||||
extern Ecore_Event_Key_Modifiers multi_select_mod;
|
||||
extern Ecore_Event_Key_Modifiers range_select_mod;
|
||||
extern Evas_List views;
|
||||
|
||||
extern E_View_Machine *VM;
|
||||
#endif
|
||||
|
|
145
src/iconbar.c
145
src/iconbar.c
|
@ -18,7 +18,6 @@ static void e_ib_bit_down_cb (void *data, Ebits_Object o, char *class, int bt,
|
|||
static void e_ib_bit_up_cb (void *data, Ebits_Object o, char *class, int bt,
|
||||
int x, int y, int ox, int oy, int ow, int oh);
|
||||
|
||||
static void ib_reload_timeout (int val, void *data);
|
||||
static void ib_scroll_timeout (int val, void *data);
|
||||
static void ib_timeout (int val, void *data);
|
||||
static void ib_cancel_launch_timeout (int val, void *data);
|
||||
|
@ -165,9 +164,9 @@ e_iconbar_cleanup (E_Iconbar * ib)
|
|||
if ((ib->view) && (ib->view->evas) && (ib->clip))
|
||||
evas_del_object (ib->view->evas, ib->clip);
|
||||
/* delete any timers intended to work on this iconbar */
|
||||
snprintf (buf, PATH_MAX, "iconbar_reload:%s", ib->view->dir);
|
||||
snprintf (buf, PATH_MAX, "iconbar_reload:%s", ib->view->name);
|
||||
ecore_del_event_timer (buf);
|
||||
snprintf (buf, PATH_MAX, "iconbar_scroll:%s", ib->view->dir);
|
||||
snprintf (buf, PATH_MAX, "iconbar_scroll:%s", ib->view->name);
|
||||
ecore_del_event_timer (buf);
|
||||
|
||||
/* call the destructor of the base class */
|
||||
|
@ -237,7 +236,7 @@ e_iconbar_new (E_View * v)
|
|||
|
||||
/* 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_iconbar.db", v->dir);
|
||||
snprintf (buf, PATH_MAX, "%s/.e_iconbar.db", v->model->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);
|
||||
|
@ -284,7 +283,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_iconbar.bits.db", v->dir);
|
||||
snprintf (buf, PATH_MAX, "%s/.e_iconbar.bits.db", v->model->dir);
|
||||
ib->bit = ebits_load (buf);
|
||||
/* we didn't find one? */
|
||||
if (!ib->bit)
|
||||
|
@ -392,7 +391,7 @@ e_iconbar_realize (E_Iconbar * ib)
|
|||
/* the path of the key to the image memebr - that is actually */
|
||||
/* a lump of image data inlined in the iconbar db - so the icons */
|
||||
/* themselves follow the iconbar wherever it goes */
|
||||
snprintf (buf, PATH_MAX, "%s/.e_iconbar.db:%s", ib->view->dir,
|
||||
snprintf (buf, PATH_MAX, "%s/.e_iconbar.db:%s", ib->view->model->dir,
|
||||
ic->image_path);
|
||||
/* add the icon image object */
|
||||
ic->image = evas_add_image_from_file (ib->view->evas, buf);
|
||||
|
@ -654,43 +653,6 @@ e_iconbar_fix (E_Iconbar * ib)
|
|||
D_RETURN;
|
||||
}
|
||||
|
||||
/**
|
||||
* e_iconbar_file_add - Adds a file to a view
|
||||
* @v: The view in which a file is added
|
||||
* @file: Name of the added file
|
||||
*
|
||||
* 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)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
/* is the file of interest ? */
|
||||
if ((!strcmp (".e_iconbar.db", file)) ||
|
||||
(!strcmp (".e_iconbar.bits.db", file)))
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
|
||||
/* unique timer name */
|
||||
snprintf (buf, PATH_MAX, "iconbar_reload:%s", v->dir);
|
||||
/* if we've scrolled or changed icons since. save */
|
||||
if (v->iconbar
|
||||
&& (v->iconbar->has_been_scrolled || v->iconbar->changed))
|
||||
{
|
||||
e_iconbar_save_out_final (v->iconbar);
|
||||
}
|
||||
|
||||
/* in 0.5 secs call our timout handler */
|
||||
ecore_add_event_timer (buf, 0.5, ib_reload_timeout, 0, v);
|
||||
}
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
/**
|
||||
* e_iconbar_file_delete - Function to remove a file from an iconbox.
|
||||
* @v: The view in which a file is removed
|
||||
|
@ -719,37 +681,6 @@ e_iconbar_file_delete (E_View * v, char *file)
|
|||
D_RETURN;
|
||||
}
|
||||
|
||||
/**
|
||||
* e_iconbar_file_change - File change update function
|
||||
* @v: The view in which a file changes
|
||||
* @file: Name of the changed file
|
||||
*
|
||||
* This function gets called whenever a file changes in a view
|
||||
*/
|
||||
void
|
||||
e_iconbar_file_change (E_View * v, char *file)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
/* 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 */
|
||||
snprintf (buf, PATH_MAX, "iconbar_reload:%s", v->dir);
|
||||
/* if we've scrolled since. save */
|
||||
if (v->iconbar
|
||||
&& (v->iconbar->has_been_scrolled || v->iconbar->changed))
|
||||
e_iconbar_save_out_final (v->iconbar);
|
||||
/* in 0.5 secs call the realod timeout */
|
||||
ecore_add_event_timer (buf, 0.5, ib_reload_timeout, 0, v);
|
||||
}
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
/**
|
||||
* e_iconbar_save_out_final - save out final state of iconbar back to disk
|
||||
* @ib: The iconbar
|
||||
|
@ -766,11 +697,10 @@ e_iconbar_save_out_final (E_Iconbar * ib)
|
|||
if (ib->view)
|
||||
{
|
||||
E_DB_File *edb;
|
||||
Imlib_Image im;
|
||||
Evas_List l;
|
||||
int i;
|
||||
|
||||
snprintf (buf, PATH_MAX, "%s/.e_iconbar.db", ib->view->dir);
|
||||
snprintf (buf, PATH_MAX, "%s/.e_iconbar.db", ib->view->model->dir);
|
||||
D ("%s\n", buf);
|
||||
|
||||
if (ib->changed)
|
||||
|
@ -801,7 +731,7 @@ e_iconbar_save_out_final (E_Iconbar * ib)
|
|||
|
||||
snprintf (buf2, PATH_MAX,
|
||||
"%s/.e_iconbar.db:/icons/%i/image",
|
||||
ib->view->dir, i);
|
||||
ib->view->model->dir, i);
|
||||
D ("save image\n");
|
||||
imlib_save_image (buf2);
|
||||
}
|
||||
|
@ -866,43 +796,6 @@ e_iconbar_handle_launch_id (Window win, void *data)
|
|||
|
||||
/* 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;
|
||||
|
||||
D_ENTER;
|
||||
|
||||
/* get our view pointer */
|
||||
v = (E_View *) data;
|
||||
/*
|
||||
D ("check if jsut saved:\n");
|
||||
if (v->iconbar->just_saved)
|
||||
{
|
||||
D ("just saved\n");
|
||||
v->iconbar->just_saved = 0;
|
||||
D_RETURN;
|
||||
}
|
||||
*/
|
||||
/* if we have an iconbar.. well nuke it */
|
||||
if (e_object_unref (E_OBJECT (v->iconbar)) == 0)
|
||||
v->iconbar = NULL;
|
||||
|
||||
/* 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);
|
||||
|
||||
D_RETURN;
|
||||
UN (val);
|
||||
}
|
||||
|
||||
/* scroll timeout. called to continuously scroll when arrow button down */
|
||||
static void
|
||||
ib_scroll_timeout (int val, void *data)
|
||||
|
@ -915,7 +808,7 @@ ib_scroll_timeout (int val, void *data)
|
|||
/* get our iconbar pointer */
|
||||
ib = (E_Iconbar *) data;
|
||||
|
||||
snprintf (buf, PATH_MAX, "iconbar_scroll:%s", ib->view->dir);
|
||||
snprintf (buf, PATH_MAX, "iconbar_scroll:%s", ib->view->name);
|
||||
if (val == 0)
|
||||
ecore_del_event_timer (buf);
|
||||
else
|
||||
|
@ -975,7 +868,7 @@ ib_timeout (int val, void *data)
|
|||
|
||||
/* figure out its path */
|
||||
snprintf (buf, PATH_MAX, "%s/.e_iconbar.db:%s",
|
||||
ic->iconbar->view->dir, ic->image_path);
|
||||
ic->iconbar->view->model->dir, ic->image_path);
|
||||
/* add it */
|
||||
ic->hi.image = evas_add_image_from_file (ic->iconbar->view->evas,
|
||||
buf);
|
||||
|
@ -989,7 +882,7 @@ ib_timeout (int val, void *data)
|
|||
/* start at 0 */
|
||||
val = 0;
|
||||
}
|
||||
/* what tame is it ? */
|
||||
/* what time is it ? */
|
||||
t = ecore_get_time ();
|
||||
if (ic->launch_id)
|
||||
{
|
||||
|
@ -1312,7 +1205,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 */
|
||||
snprintf (buf, PATH_MAX, "iconbar:%s/%s", ic->iconbar->view->dir,
|
||||
snprintf (buf, PATH_MAX, "iconbar:%s/%s", ic->iconbar->view->name,
|
||||
ic->image_path);
|
||||
e_strdup (ic->hi.timer, buf);
|
||||
/* call the timeout */
|
||||
|
@ -1650,7 +1543,7 @@ e_iconbar_icon_move (E_Iconbar_Icon *ic, int x, int y)
|
|||
ic->iconbar->changed = 1;
|
||||
e_iconbar_save_out_final(ic->iconbar);
|
||||
/* ic->iconbar->just_saved = 0;*/
|
||||
ib_reload_timeout(0, ic->iconbar->view);
|
||||
e_view_ib_reload(ic->iconbar->view);
|
||||
|
||||
}
|
||||
D_RETURN;
|
||||
|
@ -1669,7 +1562,8 @@ e_iconbar_dnd_add_files (E_View *v, E_View *source, int num_files,
|
|||
|
||||
D_ENTER;
|
||||
|
||||
D("add files: %s\n", source->dir);
|
||||
#if 0
|
||||
D("add files: %s\n", source->model->dir);
|
||||
for (i = 0; i < num_files; i++)
|
||||
{
|
||||
char *file = e_file_get_file(strdup(dnd_files[i]));
|
||||
|
@ -1681,7 +1575,6 @@ e_iconbar_dnd_add_files (E_View *v, E_View *source, int num_files,
|
|||
if (!strcmp(ic->info.mime.base, "db"))
|
||||
{
|
||||
/* if its an icon db, set the icon */
|
||||
#if 0
|
||||
D("db!\n");
|
||||
for (l = v->iconbar->icons; l; l = l->next)
|
||||
{
|
||||
|
@ -1699,7 +1592,7 @@ e_iconbar_dnd_add_files (E_View *v, E_View *source, int num_files,
|
|||
v->iconbar->dnd.y < ibic->current.y + ibic->current.h )
|
||||
{
|
||||
D("over icon: %s\n", ibic->exec);
|
||||
snprintf(buf, PATH_MAX, "%s/%s:/icon/normal", ic->view->dir, ic->file);
|
||||
snprintf(buf, PATH_MAX, "%s/%s:/icon/normal", ic->view->model->dir, ic->file);
|
||||
D("set icon: %s\n", buf);
|
||||
|
||||
ibic->imlib_image = imlib_load_image(buf);
|
||||
|
@ -1711,7 +1604,6 @@ e_iconbar_dnd_add_files (E_View *v, E_View *source, int num_files,
|
|||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
else if (e_file_can_exec (&ic->stat))
|
||||
{
|
||||
|
@ -1743,14 +1635,14 @@ e_iconbar_dnd_add_files (E_View *v, E_View *source, int num_files,
|
|||
else
|
||||
D("EEEEEEEEEEEEK: how the hell did this happen?");
|
||||
|
||||
D("x: %i, v-dir: %s, ib-dir: %s\n", ibic->iconbar->icon_area.x, v->dir, ibic->iconbar->view->dir);
|
||||
D("x: %f, v-dir: %s, ib-dir: %s\n", ibic->iconbar->icon_area.x, v->model->dir, ibic->iconbar->view->model->dir);
|
||||
|
||||
if (!ic->info.icon) D_RETURN_(NULL);
|
||||
if (!ic->info.icon) D_RETURN;
|
||||
snprintf(buf, PATH_MAX, "%s:/icon/normal", ic->info.icon);
|
||||
ibic->image = evas_add_image_from_file (v->evas, buf);
|
||||
ibic->imlib_image = imlib_load_image (buf);
|
||||
ibic->image_path = strdup (ic->info.icon);
|
||||
snprintf(buf, PATH_MAX, "%s/%s", ic->view->dir, ic->file);
|
||||
snprintf(buf, PATH_MAX, "%s/%s", ic->view->model->dir, ic->file);
|
||||
ibic->exec = strdup(buf);
|
||||
|
||||
evas_set_clip (v->evas, ibic->image, v->iconbar->clip);
|
||||
|
@ -1774,6 +1666,7 @@ e_iconbar_dnd_add_files (E_View *v, E_View *source, int num_files,
|
|||
e_iconbar_icon_move(ibic, v->iconbar->dnd.x, v->iconbar->dnd.y);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
177
src/icons.c
177
src/icons.c
|
@ -1,10 +1,13 @@
|
|||
#include "view.h"
|
||||
#include "icons.h"
|
||||
#include "debug.h"
|
||||
#include "globals.h"
|
||||
#include "cursors.h"
|
||||
#include "file.h"
|
||||
#include "util.h"
|
||||
#include "e_view_model.h"
|
||||
#include "e_file.h"
|
||||
#include "e_view_machine.h"
|
||||
#include "globals.h"
|
||||
|
||||
static void e_icon_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
|
||||
static void e_icon_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
|
||||
|
@ -174,14 +177,13 @@ e_icon_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
|
|||
E_Icon *ic;
|
||||
Ecore_Event *ev;
|
||||
Ecore_Event_Mouse_Move *e;
|
||||
|
||||
#if 0
|
||||
D_ENTER;
|
||||
|
||||
ev = e_view_get_current_event();
|
||||
|
||||
if (!ev)
|
||||
D_RETURN;
|
||||
|
||||
e = ev->event;
|
||||
ic = _data;
|
||||
|
||||
|
@ -207,7 +209,7 @@ e_icon_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
|
|||
y = 999999999;
|
||||
xx = -999999999;
|
||||
yy = -999999999;
|
||||
for (l = views; l; l = l->next)
|
||||
for (l = VM->views; l; l = l->next)
|
||||
{
|
||||
E_View *v;
|
||||
Evas_List ll;
|
||||
|
@ -282,7 +284,7 @@ e_icon_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
|
|||
imlib_context_set_cliprect(0, 0, 0, 0);
|
||||
imlib_context_set_angle(0);
|
||||
|
||||
for (l = views; l; l = l->next)
|
||||
for (l = VM->views; l; l = l->next)
|
||||
{
|
||||
E_View *v;
|
||||
Evas_List ll;
|
||||
|
@ -403,7 +405,7 @@ e_icon_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
|
|||
ecore_pointer_xy_get(&x, &y);
|
||||
ecore_window_dnd_handle_motion( ic->view->win.base, x, y, 1);
|
||||
}
|
||||
|
||||
#endif
|
||||
D_RETURN;
|
||||
UN(_e);
|
||||
UN(_o);
|
||||
|
@ -464,8 +466,8 @@ e_icon_find_by_file(E_View *view, char *file)
|
|||
E_Icon *ic;
|
||||
|
||||
ic = l->data;
|
||||
if ((ic) && (ic->file) && (file) && (!strcmp(ic->file, file)))
|
||||
D_RETURN_(ic);
|
||||
if ((ic) && (ic->file->file) && (file) && (!strcmp(ic->file->file, file)))
|
||||
D_RETURN_(ic);
|
||||
}
|
||||
D_RETURN_(NULL);
|
||||
}
|
||||
|
@ -475,7 +477,6 @@ e_icon_show(E_Icon *ic)
|
|||
{
|
||||
D_ENTER;
|
||||
|
||||
|
||||
if (ic->state.visible) D_RETURN;
|
||||
ic->state.visible = 1;
|
||||
if (!ic->obj.event1)
|
||||
|
@ -577,7 +578,7 @@ e_icon_apply_xy(E_Icon *ic)
|
|||
{
|
||||
D_ENTER;
|
||||
|
||||
/* threse calc icon extents for: */
|
||||
/* these calc icon extents for: */
|
||||
/* [I] */
|
||||
/* Ig */
|
||||
/* [txt] */
|
||||
|
@ -653,7 +654,8 @@ e_icon_apply_xy(E_Icon *ic)
|
|||
if ((ic->geom.x != ic->prev_geom.x) || (ic->geom.y != ic->prev_geom.y))
|
||||
{
|
||||
ic->q.write_xy = 1;
|
||||
e_view_queue_icon_xy_record(ic->view);
|
||||
/* FIXME */
|
||||
//e_view_queue_icon_xy_record(ic->view);
|
||||
}
|
||||
if (ic->geom.x != ic->prev_geom.x) ic->view->extents.valid = 0;
|
||||
else if (ic->geom.y != ic->prev_geom.y) ic->view->extents.valid = 0;
|
||||
|
@ -675,12 +677,12 @@ e_icon_check_permissions(E_Icon *ic)
|
|||
{
|
||||
D_ENTER;
|
||||
|
||||
if (!ic || !ic->info.mime.base || ic->stat.st_ino == 0)
|
||||
if (!ic || !ic->file->info.mime.base || ic->file->stat.st_ino == 0)
|
||||
D_RETURN;
|
||||
|
||||
if (!strcmp(ic->info.mime.base, "dir"))
|
||||
if (!strcmp(ic->file->info.mime.base, "dir"))
|
||||
{
|
||||
if (e_file_can_exec(&ic->stat))
|
||||
if (e_file_can_exec(&ic->file->stat))
|
||||
evas_set_color(ic->view->evas, ic->obj.icon, 255, 255, 255, 255);
|
||||
else
|
||||
evas_set_color(ic->view->evas, ic->obj.icon, 128, 128, 128, 128);
|
||||
|
@ -694,11 +696,12 @@ void
|
|||
e_icon_initial_show(E_Icon *ic)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
|
||||
/* check if we have enuf info and we havent been shown yet */
|
||||
if (!ic->info.icon) D_RETURN;
|
||||
if (ic->state.visible) D_RETURN;
|
||||
|
||||
if ( !ic->file->info.icon || !ic->obj.icon
|
||||
|| ic->state.visible)
|
||||
D_RETURN;
|
||||
|
||||
/* first. lets figure out the size of the icon */
|
||||
evas_get_image_size(ic->view->evas, ic->obj.icon,
|
||||
&(ic->geom.icon.w), &(ic->geom.icon.h));
|
||||
|
@ -724,130 +727,30 @@ e_icon_initial_show(E_Icon *ic)
|
|||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_icon_set_mime(E_Icon *ic, char *base, char *mime)
|
||||
{
|
||||
int diff = 0;
|
||||
|
||||
D_ENTER;
|
||||
|
||||
if (!ic->info.mime.base) diff = 1;
|
||||
if (!ic->info.mime.type) diff = 1;
|
||||
if ((ic->info.mime.base) && (strcmp(ic->info.mime.base, base))) diff = 1;
|
||||
if ((ic->info.mime.type) && (strcmp(ic->info.mime.base, mime))) diff = 1;
|
||||
if (!diff) D_RETURN;
|
||||
if (ic->info.mime.base) free(ic->info.mime.base);
|
||||
if (ic->info.mime.type) free(ic->info.mime.type);
|
||||
ic->info.mime.base = NULL;
|
||||
ic->info.mime.type = NULL;
|
||||
ic->info.mime.base = strdup(base);
|
||||
ic->info.mime.type = strdup(mime);
|
||||
|
||||
D("%40s: %s/%s\n", ic->file, base, mime);
|
||||
|
||||
/* effect changes here */
|
||||
if (ic->info.custom_icon)
|
||||
{
|
||||
if (ic->info.icon) free(ic->info.icon);
|
||||
ic->info.icon = NULL;
|
||||
ic->info.icon = strdup(ic->info.custom_icon);
|
||||
evas_set_image_file(ic->view->evas, ic->obj.icon, ic->info.custom_icon);
|
||||
e_view_queue_resort(ic->view);
|
||||
D_RETURN;
|
||||
}
|
||||
/* find an icon */
|
||||
{
|
||||
char icon[PATH_MAX];
|
||||
char type[PATH_MAX];
|
||||
char *p;
|
||||
int done = 0;
|
||||
|
||||
strcpy(type, ic->info.mime.type);
|
||||
for (p = type; *p; p++)
|
||||
{
|
||||
if (*p == '/') *p = '-';
|
||||
}
|
||||
do
|
||||
{
|
||||
snprintf(icon, PATH_MAX, "%s/data/icons/%s/%s.db", PACKAGE_DATA_DIR,
|
||||
ic->info.mime.base, type);
|
||||
if (e_file_exists(icon))
|
||||
{
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
p = strrchr(type, '-');
|
||||
if (p) *p = 0;
|
||||
}
|
||||
while (p);
|
||||
if (!done)
|
||||
{
|
||||
if (!e_file_exists(icon))
|
||||
{
|
||||
snprintf(icon, PATH_MAX, "%s/data/icons/%s/default.db", PACKAGE_DATA_DIR,
|
||||
ic->info.mime.base);
|
||||
if (!e_file_exists(icon))
|
||||
snprintf(icon, PATH_MAX, "%s/data/icons/unknown/default.db", PACKAGE_DATA_DIR);
|
||||
}
|
||||
}
|
||||
ic->info.icon = strdup(icon);
|
||||
}
|
||||
|
||||
e_icon_update_state(ic);
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_icon_set_link(E_Icon *ic, char *link)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
if ((!link) && (ic->info.link))
|
||||
{
|
||||
free(ic->info.link);
|
||||
ic->info.link = NULL;
|
||||
/* effect changes here */
|
||||
}
|
||||
else if (link)
|
||||
{
|
||||
if ((ic->info.link) && (!strcmp(ic->info.link, link)))
|
||||
{
|
||||
free(ic->info.link);
|
||||
ic->info.link = strdup(link);
|
||||
/* effect changes here */
|
||||
}
|
||||
}
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
e_icon_update_state(E_Icon *ic)
|
||||
{
|
||||
char icon[PATH_MAX];
|
||||
int iw, ih;
|
||||
int gw, gh;
|
||||
|
||||
D_ENTER;
|
||||
|
||||
if (!ic->info.icon)
|
||||
|
||||
if (!ic->file->info.icon)
|
||||
{
|
||||
D("EEEEEEEEEEK %s has no icon\n", ic->file);
|
||||
D("EEEEEEEEEEK %s has no icon\n", ic->file->file);
|
||||
D_RETURN;
|
||||
}
|
||||
if (ic->state.clicked)
|
||||
{
|
||||
snprintf(icon, PATH_MAX, "%s:/icon/clicked", ic->info.icon);
|
||||
snprintf(icon, PATH_MAX, "%s:/icon/clicked", ic->file->info.icon);
|
||||
}
|
||||
else if (ic->state.selected)
|
||||
{
|
||||
snprintf(icon, PATH_MAX, "%s:/icon/selected", ic->info.icon);
|
||||
snprintf(icon, PATH_MAX, "%s:/icon/selected", ic->file->info.icon);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(icon, PATH_MAX, "%s:/icon/normal", ic->info.icon);
|
||||
snprintf(icon, PATH_MAX, "%s:/icon/normal", ic->file->info.icon);
|
||||
}
|
||||
if ((ic->state.selected) &&
|
||||
(!ic->obj.sel.under.icon) &&
|
||||
|
@ -899,8 +802,12 @@ e_icon_update_state(E_Icon *ic)
|
|||
ic->obj.sel.over.icon = NULL;
|
||||
ic->obj.sel.over.text = NULL;
|
||||
}
|
||||
/* This relies on the obj.icon having been allocated in view_file_add.
|
||||
* Maybe it would be better to allocate here, the first
|
||||
* time the icon is set? -- till */
|
||||
evas_set_image_file(ic->view->evas, ic->obj.icon, icon);
|
||||
evas_get_image_size(ic->view->evas, ic->obj.icon, &iw, &ih);
|
||||
evas_get_image_size(ic->view->evas, ic->obj.icon, &iw, &ih);
|
||||
e_icon_check_permissions(ic);
|
||||
gw = ic->geom.icon.w;
|
||||
gh = ic->geom.icon.h;
|
||||
e_icon_apply_xy(ic);
|
||||
|
@ -956,27 +863,29 @@ void
|
|||
e_icon_exec(E_Icon *ic)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
if (!strcmp(ic->info.mime.base, "dir") &&
|
||||
e_file_can_exec(&ic->stat))
|
||||
|
||||
if (!strcmp(ic->file->info.mime.base, "dir") &&
|
||||
e_file_can_exec(&ic->file->stat))
|
||||
{
|
||||
E_View *v;
|
||||
E_Border *b;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
|
||||
v = e_view_new();
|
||||
v->size.w = 400;
|
||||
v->size.h = 300;
|
||||
v->options.back_pixmap = 0;
|
||||
snprintf(buf, PATH_MAX, "%s/%s", ic->view->dir, ic->file);
|
||||
snprintf(buf, PATH_MAX, "%s/%s", ic->view->model->dir, ic->file->file);
|
||||
D("new dir >%s<\n", buf);
|
||||
v->dir = strdup(buf);
|
||||
e_view_bg_load(v);
|
||||
e_view_set_dir(v, buf, 0);
|
||||
e_view_realize(v);
|
||||
ecore_window_set_title(v->win.base, ic->file);
|
||||
e_view_populate(v);
|
||||
|
||||
e_view_bg_reload(v);
|
||||
ecore_window_set_title(v->win.base, ic->file->file);
|
||||
ecore_window_set_name_class(v->win.base, "FileView", "E");
|
||||
ecore_window_set_min_size(v->win.base, 8, 8);
|
||||
}
|
||||
|
||||
e_icon_deselect(ic);
|
||||
|
||||
D_RETURN;
|
||||
|
|
17
src/icons.h
17
src/icons.h
|
@ -1,6 +1,7 @@
|
|||
#ifndef E_ICONS_H
|
||||
#define E_ICONS_H
|
||||
|
||||
#include "e_file.h"
|
||||
#include "view.h"
|
||||
#include "text.h"
|
||||
|
||||
|
@ -17,22 +18,10 @@ typedef struct _E_View E_View;
|
|||
struct _E_Icon
|
||||
{
|
||||
E_Object o;
|
||||
|
||||
char *file;
|
||||
struct stat stat;
|
||||
|
||||
|
||||
E_File *file;
|
||||
E_View *view;
|
||||
|
||||
struct {
|
||||
char *icon;
|
||||
char *custom_icon;
|
||||
char *link;
|
||||
struct {
|
||||
char *base;
|
||||
char *type;
|
||||
} mime;
|
||||
} info;
|
||||
|
||||
struct {
|
||||
Evas_Object icon;
|
||||
Evas_Object event1;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "place.h"
|
||||
#include "iconbar.h"
|
||||
#include "util.h"
|
||||
#include "e_view_machine.h"
|
||||
|
||||
#ifdef USE_FERITE
|
||||
# include "e_ferite.h"
|
||||
|
@ -140,12 +141,13 @@ main(int argc, char **argv)
|
|||
ecore_ungrab();
|
||||
|
||||
/* Initialization for the various modules: */
|
||||
|
||||
e_fs_init();
|
||||
e_desktops_init();
|
||||
e_border_init();
|
||||
e_action_init();
|
||||
e_menu_init();
|
||||
e_view_init();
|
||||
e_view_machine_init();
|
||||
e_entry_init();
|
||||
e_keys_init();
|
||||
e_guides_init();
|
||||
|
|
|
@ -49,7 +49,6 @@ rects = evas_list_append(rects, r); \
|
|||
/* here if need be - ie xinerama middle between screens and panels etc. */
|
||||
|
||||
{
|
||||
E_View *v;
|
||||
if (b->desk->view->iconbar)
|
||||
evas_list_append(rects, e_iconbar_get_resist_rect(b->desk->view->iconbar));
|
||||
}
|
||||
|
|
1373
src/view.c
1373
src/view.c
File diff suppressed because it is too large
Load Diff
60
src/view.h
60
src/view.h
|
@ -7,6 +7,8 @@
|
|||
#include "fs.h"
|
||||
#include "iconbar.h"
|
||||
#include "object.h"
|
||||
#include "e_view_model.h"
|
||||
#include "e_file.h"
|
||||
|
||||
#ifndef E_VIEW_TYPEDEF
|
||||
#define E_VIEW_TYPEDEF
|
||||
|
@ -23,6 +25,12 @@ typedef struct _E_Icon E_Icon;
|
|||
typedef struct _E_Iconbar E_Iconbar;
|
||||
#endif
|
||||
|
||||
#ifndef E_VIEW_MODEL_TYPEDEF
|
||||
#define E_VIEW_MODEL_TYPEDEF
|
||||
typedef struct _E_View_Model E_View_Model;
|
||||
#endif
|
||||
|
||||
|
||||
typedef enum {
|
||||
E_DND_NONE,
|
||||
E_DND_COPY,
|
||||
|
@ -37,8 +45,10 @@ typedef enum {
|
|||
struct _E_View
|
||||
{
|
||||
E_Object o;
|
||||
|
||||
char * name;
|
||||
|
||||
char *dir;
|
||||
E_View_Model *model;
|
||||
|
||||
struct {
|
||||
Evas_Render_Method render_method;
|
||||
|
@ -135,38 +145,32 @@ struct _E_View
|
|||
int valid;
|
||||
double x1, x2, y1, y2;
|
||||
} extents;
|
||||
|
||||
|
||||
E_Background bg;
|
||||
|
||||
|
||||
struct {
|
||||
EfsdCmdId x, y, w, h;
|
||||
int busy;
|
||||
} geom_get;
|
||||
EfsdCmdId getbg;
|
||||
|
||||
Evas_Object obj_bg;
|
||||
|
||||
char *bg_file;
|
||||
char *prev_bg_file;
|
||||
time_t bg_mod;
|
||||
E_Background bg;
|
||||
|
||||
EfsdCmdId getbg;
|
||||
|
||||
|
||||
struct {
|
||||
E_Scrollbar *h, *v;
|
||||
} scrollbar;
|
||||
|
||||
int is_listing;
|
||||
int monitor_id;
|
||||
|
||||
E_FS_Restarter *restarter;
|
||||
|
||||
E_Iconbar *iconbar;
|
||||
|
||||
Evas_List icons;
|
||||
|
||||
int is_desktop;
|
||||
int have_resort_queued;
|
||||
|
||||
int changed;
|
||||
|
||||
E_Iconbar *iconbar;
|
||||
|
||||
Evas_List epplet_contexts;
|
||||
Ebits_Object epplet_layout;
|
||||
};
|
||||
|
@ -198,15 +202,9 @@ void e_view_get_position_percentage(E_View *v, double *vx, double *vy);
|
|||
void e_view_resort_alphabetical(E_View *v);
|
||||
void e_view_arrange(E_View *v);
|
||||
void e_view_resort(E_View *v);
|
||||
void e_view_geometry_record(E_View *v);
|
||||
void e_view_queue_geometry_record(E_View *v);
|
||||
void e_view_queue_icon_xy_record(E_View *v);
|
||||
void e_view_queue_resort(E_View *v);
|
||||
void e_view_file_added(int id, char *file);
|
||||
void e_view_file_deleted(int id, char *file);
|
||||
void e_view_file_changed(int id, char *file);
|
||||
void e_view_file_moved(int id, char *file);
|
||||
E_View *e_view_find_by_monitor_id(int id);
|
||||
E_View *e_view_find_by_window(Window win);
|
||||
|
||||
/**
|
||||
|
@ -229,7 +227,14 @@ void e_view_set_background(E_View *v);
|
|||
* directory, it also requests monitoring of the files in
|
||||
* the directory @dir from efsd.
|
||||
*/
|
||||
void e_view_set_dir(E_View *v, char *dir);
|
||||
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
|
||||
*/
|
||||
|
||||
void e_view_populate(E_View *v);
|
||||
|
||||
/**
|
||||
* e_view_realize - Initializes a view's graphics and content
|
||||
|
@ -243,11 +248,12 @@ void e_view_realize(E_View *v);
|
|||
|
||||
void e_view_update(E_View *v);
|
||||
|
||||
void e_view_bg_load(E_View *v);
|
||||
void e_view_bg_reload(E_View *v);
|
||||
void e_view_ib_reload(E_View *v);
|
||||
|
||||
void e_view_bg_change(E_View *v, char *file);
|
||||
void e_view_bg_add(E_View *v, char *file);
|
||||
void e_view_bg_del(E_View *v, char *file);
|
||||
void e_view_file_add(E_View *v, E_File *file);
|
||||
void e_view_file_changed(E_View *v, E_File *file);
|
||||
void e_view_file_delete(E_View *v, E_File *file);
|
||||
|
||||
void e_view_close_all(void);
|
||||
|
||||
|
|
Loading…
Reference in New Issue