fix desktop path storing to be more successful, also now store desktop view modes for all desktops

SVN revision: 76584
This commit is contained in:
Mike Blumenkrantz 2012-09-13 07:18:13 +00:00
parent 8140c6fa8d
commit 457152dc16
4 changed files with 75 additions and 82 deletions

View File

@ -27,6 +27,7 @@ struct _E_Fwin
E_Win *win;
E_Zone *zone;
Fileman_Path *path; /* not freed with fwin, actually attached to config */
Evas_Object *bg_obj;
E_Fwin_Apps_Dialog *fad;
@ -270,11 +271,10 @@ e_fwin_new(E_Container *con,
}
void
e_fwin_zone_new(E_Zone *zone,
const char *dev,
const char *path)
e_fwin_zone_new(E_Zone *zone, void *p)
{
E_Fwin *fwin;
Fileman_Path *path = p;
E_Fwin_Page *page;
Evas_Object *o;
int x, y, w, h;
@ -285,6 +285,7 @@ e_fwin_zone_new(E_Zone *zone,
page = E_NEW(E_Fwin_Page, 1);
page->fwin = fwin;
fwin->path = path;
/* Add Event Handler for zone move/resize & del */
fwin->zone_handler =
@ -366,7 +367,7 @@ e_fwin_zone_new(E_Zone *zone,
evas_object_focus_set(page->fm_obj, 1);
e_fm2_path_set(page->fm_obj, dev, path);
e_fm2_path_set(page->fm_obj, path->dev, path->path);
fwin->cur_page = page;
}
@ -387,11 +388,15 @@ e_fwin_zone_shutdown(E_Zone *zone)
{
Eina_List *f, *fn;
E_Fwin *win;
const char *dev, *path;
EINA_LIST_FOREACH_SAFE(fwins, f, fn, win)
{
if (win->zone != zone) continue;
fileman_config->view.desktop_mode = e_fm2_view_mode_get(win->cur_page->fm_obj);
win->path->desktop_mode = e_fm2_view_mode_get(win->cur_page->fm_obj);
e_fm2_path_get(win->cur_page->fm_obj, &dev, &path);
eina_stringshare_replace(&win->path->dev, dev);
eina_stringshare_replace(&win->path->path, path);
evas_event_callback_del_full(zone->container->bg_evas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _e_fwin_zone_focus_in, win);
e_object_del(E_OBJECT(win));
win = NULL;
@ -457,26 +462,8 @@ e_fwin_reload_all(void)
EINA_LIST_FOREACH(con->zones, lll, zone)
{
if (e_fwin_zone_find(zone)) continue;
if ((zone->container->num == 0) && (zone->num == 0) &&
(fileman_config->view.show_desktop_icons))
{
// disable until such a day as this handles both screens properly!
// if ((fileman_config->dev) && (fileman_config->path))
// e_fwin_zone_new(zone, fileman_config->dev, fileman_config->path);
// else
e_fwin_zone_new(zone, "desktop", "/");
}
else
{
char buf[256];
if (fileman_config->view.show_desktop_icons)
{
snprintf(buf, sizeof(buf), "%i",
(zone->container->num + zone->num));
e_fwin_zone_new(zone, "desktop", buf);
}
}
if (fileman_config->view.show_desktop_icons)
e_fwin_zone_new(zone, e_mod_fileman_path_find(zone));
}
}
@ -1295,7 +1282,7 @@ _e_fwin_config_set(E_Fwin_Page *page)
fmc.icon.fixed.w = 1;
fmc.icon.fixed.h = 1;
#else
fmc.view.mode = fileman_config->view.desktop_mode;
fmc.view.mode = page->fwin->path->desktop_mode;
fmc.icon.icon.w = fileman_config->icon.icon.w * e_scale;
fmc.icon.icon.h = fileman_config->icon.icon.h * e_scale;
fmc.icon.fixed.w = 0;
@ -1612,10 +1599,9 @@ _e_fwin_changed(void *data,
_e_fwin_icon_mouse_out(fwin, NULL, NULL);
if (fwin->zone)
{
if (fwin->zone->num) return;
e_fm2_path_get(page->fm_obj, &dev, &path);
eina_stringshare_replace(&fileman_config->dev, dev);
eina_stringshare_replace(&fileman_config->path, path);
eina_stringshare_replace(&fwin->path->dev, dev);
eina_stringshare_replace(&fwin->path->path, path);
return;
}
_e_fwin_window_title_set(page);

View File

@ -7,7 +7,7 @@
int e_fwin_init (void);
int e_fwin_shutdown (void);
void e_fwin_new (E_Container *con, const char *dev, const char *path);
void e_fwin_zone_new (E_Zone *zone, const char *dev, const char *path);
void e_fwin_zone_new (E_Zone *zone, void *path);
void e_fwin_zone_shutdown (E_Zone *zone);
void e_fwin_all_unsel (void *data);
void e_fwin_reload_all (void);

View File

@ -34,7 +34,7 @@ static E_Int_Menu_Augmentation *maug = NULL;
static E_Menu_Category_Callback *mcb = NULL;
static Ecore_Event_Handler *zone_add_handler = NULL;
static E_Config_DD *conf_edd = NULL;
static E_Config_DD *paths_edd = NULL, *conf_edd = NULL;
Config *fileman_config = NULL;
/* module setup */
@ -91,26 +91,8 @@ e_modapi_init(E_Module *m)
{
zone = lll->data;
if (e_fwin_zone_find(zone)) continue;
if ((zone->container->num == 0) && (zone->num == 0) &&
(fileman_config->view.show_desktop_icons))
{
// disable until such a day as this handles both screens properly!
// if ((fileman_config->dev) && (fileman_config->path))
// e_fwin_zone_new(zone, fileman_config->dev, fileman_config->path);
// else
e_fwin_zone_new(zone, "desktop", "/");
}
else
{
char buf[256];
if (fileman_config->view.show_desktop_icons)
{
snprintf(buf, sizeof(buf), "%i",
(zone->container->num + zone->num));
e_fwin_zone_new(zone, "desktop", buf);
}
}
if (fileman_config->view.show_desktop_icons)
e_fwin_zone_new(zone, e_mod_fileman_path_find(zone));
}
}
}
@ -190,6 +172,7 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
e_config_domain_save("module.fileman", conf_edd, fileman_config);
_e_mod_fileman_config_free();
E_CONFIG_DD_FREE(conf_edd);
E_CONFIG_DD_FREE(paths_edd);
//eina_shutdown();
@ -664,6 +647,15 @@ _e_mod_main_menu_cb(E_Menu *m, void *category_data __UNUSED__, void *data __UNUS
static void
_e_mod_fileman_config_load(void)
{
#undef T
#undef D
#define T Fileman_Path
#define D paths_edd
paths_edd = E_CONFIG_DD_NEW("Fileman_Path", Fileman_Path);
E_CONFIG_VAL(D, T, dev, STR);
E_CONFIG_VAL(D, T, path, STR);
E_CONFIG_VAL(D, T, zone, UINT);
E_CONFIG_VAL(D, T, desktop_mode, INT);
conf_edd = E_CONFIG_DD_NEW("Fileman_Config", Config);
#undef T
#undef D
@ -671,7 +663,6 @@ _e_mod_fileman_config_load(void)
#define D conf_edd
E_CONFIG_VAL(D, T, config_version, INT);
E_CONFIG_VAL(D, T, view.mode, INT);
E_CONFIG_VAL(D, T, view.desktop_mode, INT);
E_CONFIG_VAL(D, T, view.open_dirs_in_place, UCHAR);
E_CONFIG_VAL(D, T, view.selector, UCHAR);
E_CONFIG_VAL(D, T, view.single_click, UCHAR);
@ -707,8 +698,7 @@ _e_mod_fileman_config_load(void)
E_CONFIG_VAL(D, T, tooltip.delay, DOUBLE);
E_CONFIG_VAL(D, T, tooltip.size, DOUBLE);
E_CONFIG_VAL(D, T, tooltip.enable, UCHAR);
E_CONFIG_VAL(D, T, dev, STR);
E_CONFIG_VAL(D, T, path, STR);
E_CONFIG_LIST(D, T, paths, paths_edd);
fileman_config = e_config_domain_load("module.fileman", conf_edd);
if (fileman_config)
@ -760,10 +750,6 @@ _e_mod_fileman_config_load(void)
e_config->filemanager_single_click = fileman_config->view.single_click;
IFMODCFGEND;
IFMODCFG(0x0106);
fileman_config->view.desktop_mode = E_FM2_VIEW_MODE_CUSTOM_ICONS;
IFMODCFGEND;
IFMODCFG(0x0107);
fileman_config->view.show_sidebar = 1;
IFMODCFGEND;
@ -780,11 +766,6 @@ _e_mod_fileman_config_load(void)
fileman_config->tooltip.enable = 1;
IFMODCFGEND;
IFMODCFG(0x0111);
fileman_config->dev = eina_stringshare_add("desktop");
fileman_config->path = eina_stringshare_add("/");
IFMODCFGEND;
fileman_config->config_version = MOD_CONFIG_FILE_VERSION;
/* UCHAR's give nasty compile warnings about comparisons so not gonna limit those */
@ -800,14 +781,22 @@ _e_mod_fileman_config_load(void)
e_config_save_queue();
}
static void
_e_mod_fileman_path_free(Fileman_Path *path)
{
if (!path) return;
eina_stringshare_del(path->dev);
eina_stringshare_del(path->path);
free(path);
}
static void
_e_mod_fileman_config_free(void)
{
eina_stringshare_del(fileman_config->theme.background);
eina_stringshare_del(fileman_config->theme.frame);
eina_stringshare_del(fileman_config->theme.icons);
eina_stringshare_del(fileman_config->dev);
eina_stringshare_del(fileman_config->path);
E_FREE_LIST(fileman_config->paths, _e_mod_fileman_path_free);
E_FREE(fileman_config);
}
@ -823,20 +812,31 @@ _e_mod_zone_add(__UNUSED__ void *data,
ev = event;
zone = ev->zone;
if (e_fwin_zone_find(zone)) return ECORE_CALLBACK_PASS_ON;
if ((zone->container->num == 0) && (zone->num == 0) &&
(fileman_config->view.show_desktop_icons))
e_fwin_zone_new(zone, fileman_config->dev, fileman_config->path);
else
{
char buf[256];
if (fileman_config->view.show_desktop_icons)
{
snprintf(buf, sizeof(buf), "%i",
(zone->container->num + zone->num));
e_fwin_zone_new(zone, "desktop", buf);
}
}
if (fileman_config->view.show_desktop_icons)
e_fwin_zone_new(zone, e_mod_fileman_path_find(zone));
return ECORE_CALLBACK_PASS_ON;
}
Fileman_Path *
e_mod_fileman_path_find(E_Zone *zone)
{
Eina_List *l;
Fileman_Path *path;
char buf[256];
EINA_LIST_FOREACH(fileman_config->paths, l, path)
if (path->zone == zone->container->num + zone->num) return path;
path = E_NEW(Fileman_Path, 1);
path->zone = zone->container->num + zone->num;
path->dev = eina_stringshare_add("desktop");
path->desktop_mode = E_FM2_VIEW_MODE_GRID_ICONS;
if ((zone->container->num == 0) && (zone->num == 0))
path->path = eina_stringshare_add("/");
else
{
snprintf(buf, sizeof(buf), "%i", (zone->container->num + zone->num));
path->path = eina_stringshare_add(buf);
}
fileman_config->paths = eina_list_append(fileman_config->paths, path);
return path;
}

View File

@ -4,7 +4,7 @@
/* Increment for Major Changes */
#define MOD_CONFIG_FILE_EPOCH 0x0001
/* Increment for Minor Changes (ie: user doesn't need a new config) */
#define MOD_CONFIG_FILE_GENERATION 0x0112
#define MOD_CONFIG_FILE_GENERATION 0x0113
#define MOD_CONFIG_FILE_VERSION ((MOD_CONFIG_FILE_EPOCH << 16) | MOD_CONFIG_FILE_GENERATION)
typedef struct _Config Config;
@ -19,6 +19,13 @@ typedef struct _Config Config;
#include "e_int_config_mime_edit.h"
#include "e_int_config_mime.h"
typedef struct Fileman_Path
{
const char *dev, *path;
unsigned int zone;
E_Fm2_View_Mode desktop_mode;
} Fileman_Path;
struct _Config
{
int config_version;
@ -26,7 +33,6 @@ struct _Config
struct
{
E_Fm2_View_Mode mode;
E_Fm2_View_Mode desktop_mode;
unsigned char open_dirs_in_place;
unsigned char selector;
unsigned char single_click;
@ -101,7 +107,7 @@ struct _Config
const char *icons;
unsigned char fixed;
} theme;
const char *dev, *path; // stored from desktop navigation mode
Eina_List *paths; // Fileman_Path
};
EAPI extern E_Module_Api e_modapi;
@ -111,6 +117,7 @@ EAPI int e_modapi_shutdown(E_Module *m);
EAPI int e_modapi_save(E_Module *m);
extern Config *fileman_config;
Fileman_Path *e_mod_fileman_path_find(E_Zone *zone);
/**
* @addtogroup Optional_Fileman