diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index 561de7e26..c3faf493d 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -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 = \ diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index b2b8a7b2b..163edb7e4 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -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 diff --git a/src/bin/e_fm.h b/src/bin/e_fm.h index 4486cc24a..e5528730c 100644 --- a/src/bin/e_fm.h +++ b/src/bin/e_fm.h @@ -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); diff --git a/src/bin/e_fm_custom.c b/src/bin/e_fm_custom.c new file mode 100644 index 000000000..6254d0954 --- /dev/null +++ b/src/bin/e_fm_custom.c @@ -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. */ +} + diff --git a/src/bin/e_fm_custom.h b/src/bin/e_fm_custom.h new file mode 100644 index 000000000..94eff2a60 --- /dev/null +++ b/src/bin/e_fm_custom.h @@ -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 diff --git a/src/bin/e_fm_prop.c b/src/bin/e_fm_prop.c index 086c1644f..ccfbf3022 100644 --- a/src/bin/e_fm_prop.c +++ b/src/bin/e_fm_prop.c @@ -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; diff --git a/src/bin/e_includes.h b/src/bin/e_includes.h index fcc58cc24..a91ff4dc5 100644 --- a/src/bin/e_includes.h +++ b/src/bin/e_includes.h @@ -166,3 +166,4 @@ #include "e_order.h" #include "e_exec.h" #include "e_widget_font_preview.h" +#include "e_fm_custom.h"