move custom file stuff to another file - e_fm.[ch] is becoming a bit of a

monster.


SVN revision: 29840
This commit is contained in:
Carsten Haitzler 2007-05-04 05:43:13 +00:00
parent f53c55aab2
commit 0e57b7cea4
7 changed files with 88 additions and 64 deletions

View File

@ -190,7 +190,8 @@ e_int_config_mouse.h \
e_mouse.h \
e_order.h \
e_exec.h \
e_widget_font_preview.h
e_widget_font_preview.h \
e_fm_custom.h
enlightenment_src = \
e_user.c \
@ -356,6 +357,7 @@ e_mouse.c \
e_order.c \
e_exec.c \
e_widget_font_preview.c \
e_fm_custom.c \
$(ENLIGHTENMENTHEADERS)
enlightenment_SOURCES = \

View File

@ -318,37 +318,6 @@ static int _e_fm2_id = 0;
EAPI int E_EVENT_REMOVABLE_ADD = 0;
EAPI int E_EVENT_REMOVABLE_DEL = 0;
/* externally accessible functions */
EAPI E_Fm2_Custom_File *
e_fm2_custom_file_get(const char *path)
{
/* get any custom info for the path in our metadata - if non exists,
* return NULL. This may mean loading upa chunk of metadata off disk
* on demand and caching it */
return NULL;
}
EAPI void
e_fm2_custom_file_set(const char *path, E_Fm2_Custom_File *cf)
{
/* set custom metadata for a file path - save it to the metadata (or queue it) */
}
EAPI void e_fm2_custom_file_del(const char *path)
{
/* delete a custom metadata entry for a path - save changes (or queue it) */
}
EAPI void e_fm2_custom_file_rename(const char *path, const char *new_path)
{
/* rename file path a to file paht b in the metadata - if the path exists */
}
EAPI void e_fm2_custom_file_flush(void)
{
/* free any loaded custom file data, sync changes to disk etc. */
}
/***/
EAPI int

View File

@ -28,7 +28,6 @@ typedef enum _E_Fm2_Menu_Flags
typedef struct _E_Fm2_Config E_Fm2_Config;
typedef struct _E_Fm2_Icon E_Fm2_Icon;
typedef struct _E_Fm2_Icon_Info E_Fm2_Icon_Info;
typedef struct _E_Fm2_Custom_File E_Fm2_Custom_File;
typedef struct _E_Fm2_Removable_Add E_Fm2_Removable_Add;
typedef struct _E_Fm2_Removable_Del E_Fm2_Removable_Del;
@ -125,28 +124,6 @@ struct _E_Fm2_Icon_Info
unsigned char broken_link : 1;
};
struct _E_Fm2_Custom_File
{
struct {
int x, y, w, h;
int res_w, res_h;
unsigned char valid;
} geom;
struct {
int type;
const char *icon;
unsigned char valid;
} icon;
const char *label;
/* FIXME: this will have more added */
};
EAPI E_Fm2_Custom_File *e_fm2_custom_file_get(const char *path);
EAPI void e_fm2_custom_file_set(const char *path, E_Fm2_Custom_File *cf);
EAPI void e_fm2_custom_file_del(const char *path);
EAPI void e_fm2_custom_file_rename(const char *path, const char *new_path);
EAPI void e_fm2_custom_file_flush(void);
EAPI int e_fm2_init(void);
EAPI int e_fm2_shutdown(void);
EAPI Evas_Object *e_fm2_add(Evas *evas);

36
src/bin/e_fm_custom.c Normal file
View File

@ -0,0 +1,36 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "e.h"
/* externally accessible functions */
EAPI E_Fm2_Custom_File *
e_fm2_custom_file_get(const char *path)
{
/* get any custom info for the path in our metadata - if non exists,
* return NULL. This may mean loading upa chunk of metadata off disk
* on demand and caching it */
return NULL;
}
EAPI void
e_fm2_custom_file_set(const char *path, E_Fm2_Custom_File *cf)
{
/* set custom metadata for a file path - save it to the metadata (or queue it) */
}
EAPI void e_fm2_custom_file_del(const char *path)
{
/* delete a custom metadata entry for a path - save changes (or queue it) */
}
EAPI void e_fm2_custom_file_rename(const char *path, const char *new_path)
{
/* rename file path a to file paht b in the metadata - if the path exists */
}
EAPI void e_fm2_custom_file_flush(void)
{
/* free any loaded custom file data, sync changes to disk etc. */
}

35
src/bin/e_fm_custom.h Normal file
View File

@ -0,0 +1,35 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef E_TYPEDEFS
typedef struct _E_Fm2_Custom_File E_Fm2_Custom_File;
#else
#ifndef E_FM_CUSTOM_H
#define E_FM_CUSTOM_H
struct _E_Fm2_Custom_File
{
struct {
int x, y, w, h;
int res_w, res_h;
unsigned char valid;
} geom;
struct {
int type;
const char *icon;
unsigned char valid;
} icon;
const char *label;
/* FIXME: this will have more added */
};
EAPI E_Fm2_Custom_File *e_fm2_custom_file_get(const char *path);
EAPI void e_fm2_custom_file_set(const char *path, E_Fm2_Custom_File *cf);
EAPI void e_fm2_custom_file_del(const char *path);
EAPI void e_fm2_custom_file_rename(const char *path, const char *new_path);
EAPI void e_fm2_custom_file_flush(void);
#endif
#endif

View File

@ -274,19 +274,23 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
E_Fm2_Custom_File *cf, cf0;
cf = e_fm2_custom_file_get(buf);
if (!cf)
if (cf)
{
cf->icon.type = cfdata->icon_type;
if (cf->icon.icon)
evas_stringshare_del(cf->icon.icon);
cf->icon.icon = NULL;
cf->icon.icon = evas_stringshare_add(cfdata->icon);
cf->icon.valid = 1;
}
else
{
memset(&cf0, 0, sizeof(E_Fm2_Custom_File));
cf = &cf0;
cf->icon.type = cfdata->icon_type;
cf->icon.icon = cfdata->icon;
cf->icon.valid = 1;
}
cf->icon.type = cfdata->icon_type;
if (cf->icon.icon)
evas_stringshare_del(cf->icon.icon);
cf->icon.icon = NULL;
// don't leak for now
// if (cfdata->icon)
// cf->icon.icon = evas_stringshare_add(cfdata->icon);
cf->icon.valid = 1;
e_fm2_custom_file_set(buf, cf);
}
cfdata->picon_type = cfdata->icon_type;

View File

@ -166,3 +166,4 @@
#include "e_order.h"
#include "e_exec.h"
#include "e_widget_font_preview.h"
#include "e_fm_custom.h"