forked from enlightenment/edi
config: Fix indentation, pluralisation and tests for remember-mime work
This commit is contained in:
parent
782efd79ca
commit
fbd84d8782
|
@ -76,7 +76,7 @@ static void
|
|||
_edi_config_cb_free(void)
|
||||
{
|
||||
Edi_Config_Project *proj;
|
||||
Edi_Config_Mime_Associations *mimes;
|
||||
Edi_Config_Mime_Association *mime;
|
||||
|
||||
EINA_LIST_FREE(_edi_cfg->projects, proj)
|
||||
{
|
||||
|
@ -85,11 +85,11 @@ _edi_config_cb_free(void)
|
|||
free(proj);
|
||||
}
|
||||
|
||||
EINA_LIST_FREE(_edi_cfg->mime_assocs, mimes)
|
||||
EINA_LIST_FREE(_edi_cfg->mime_assocs, mime)
|
||||
{
|
||||
if (mimes->id) eina_stringshare_del(mimes->id);
|
||||
if (mimes->mime) eina_stringshare_del(mimes->mime);
|
||||
free(mimes);
|
||||
if (mime->id) eina_stringshare_del(mime->id);
|
||||
if (mime->mime) eina_stringshare_del(mime->mime);
|
||||
free(mime);
|
||||
}
|
||||
|
||||
free(_edi_cfg);
|
||||
|
@ -163,10 +163,10 @@ _edi_config_init(void)
|
|||
EDI_CONFIG_VAL(D, T, name, EET_T_STRING);
|
||||
EDI_CONFIG_VAL(D, T, path, EET_T_STRING);
|
||||
|
||||
_edi_cfg_mime_edd = EDI_CONFIG_DD_NEW("Config_Mime", Edi_Config_Mime_Associations);
|
||||
_edi_cfg_mime_edd = EDI_CONFIG_DD_NEW("Config_Mime", Edi_Config_Mime_Association);
|
||||
#undef T
|
||||
#undef D
|
||||
#define T Edi_Config_Mime_Associations
|
||||
#define T Edi_Config_Mime_Association
|
||||
#define D _edi_cfg_mime_edd
|
||||
EDI_CONFIG_VAL(D, T, id, EET_T_STRING);
|
||||
EDI_CONFIG_VAL(D, T, mime, EET_T_STRING);
|
||||
|
@ -321,7 +321,7 @@ _edi_config_project_remove(const char *path)
|
|||
void
|
||||
_edi_config_mime_add(const char *mime, const char *id)
|
||||
{
|
||||
Edi_Config_Mime_Associations *mime_assoc;
|
||||
Edi_Config_Mime_Association *mime_assoc;
|
||||
|
||||
mime_assoc = malloc(sizeof(*mime_assoc));
|
||||
mime_assoc->id = eina_stringshare_add(id);
|
||||
|
@ -330,18 +330,18 @@ _edi_config_mime_add(const char *mime, const char *id)
|
|||
_edi_config_save();
|
||||
}
|
||||
|
||||
const char*
|
||||
const char *
|
||||
_edi_config_mime_search(const char *mime)
|
||||
{
|
||||
Edi_Config_Mime_Associations *mime_assoc;
|
||||
Edi_Config_Mime_Association *mime_assoc;
|
||||
Eina_List *list, *next;
|
||||
|
||||
EINA_LIST_FOREACH_SAFE(_edi_cfg->mime_assocs, list, next, mime_assoc)
|
||||
{
|
||||
if (!strncmp(mime_assoc->mime, mime, strlen(mime_assoc->mime)))
|
||||
{
|
||||
return mime_assoc->id;
|
||||
}
|
||||
{
|
||||
return mime_assoc->id;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
typedef struct _Edi_Config_Project Edi_Config_Project;
|
||||
typedef struct _Edi_Config_Mime_Associations Edi_Config_Mime_Associations;
|
||||
typedef struct _Edi_Config_Mime_Association Edi_Config_Mime_Association;
|
||||
typedef struct _Edi_Config Edi_Config;
|
||||
|
||||
struct _Edi_Config_Project
|
||||
|
@ -17,7 +17,7 @@ struct _Edi_Config_Project
|
|||
const char *path;
|
||||
};
|
||||
|
||||
struct _Edi_Config_Mime_Associations
|
||||
struct _Edi_Config_Mime_Association
|
||||
{
|
||||
const char *id;
|
||||
const char *mime;
|
||||
|
|
|
@ -8,9 +8,10 @@
|
|||
#include "edi_content_provider.h"
|
||||
#include "editor/edi_editor.h"
|
||||
|
||||
#include "edi_private.h"
|
||||
#include "edi_config.h"
|
||||
|
||||
#include "edi_private.h"
|
||||
|
||||
// TODO move out to edi_content.c ot similar just like the editor type
|
||||
// (and the Evas include)
|
||||
|
||||
|
@ -58,7 +59,7 @@ static Edi_Content_Provider _edi_content_provider_registry[] =
|
|||
|
||||
Edi_Content_Provider *edi_content_provider_for_mime_get(const char *mime)
|
||||
{
|
||||
char *id = NULL;
|
||||
const char *id = NULL;
|
||||
|
||||
if (!mime)
|
||||
return NULL;
|
||||
|
@ -76,8 +77,9 @@ Edi_Content_Provider *edi_content_provider_for_mime_get(const char *mime)
|
|||
id = "diff";
|
||||
else
|
||||
{
|
||||
id = (char *)_edi_config_mime_search(mime);
|
||||
if (!strcasecmp(id, ""))
|
||||
id = _edi_config_mime_search(mime);
|
||||
|
||||
if (!id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,11 +7,19 @@
|
|||
#include "edi_suite.h"
|
||||
|
||||
// Add some no-op methods here so linking works without having to import the whole UI!
|
||||
EAPI Evas_Object *_edi_editor_add(Evas_Object *parent EINA_UNUSED, Edi_Mainview_Item *item EINA_UNUSED)
|
||||
EAPI Evas_Object *
|
||||
_edi_editor_add(Evas_Object *parent EINA_UNUSED, Edi_Mainview_Item *item EINA_UNUSED)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
_edi_config_mime_search(const char *mime EINA_UNUSED)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
// end no-ops
|
||||
|
||||
START_TEST (edi_test_content_provider_id_lookup)
|
||||
{
|
||||
Edi_Content_Provider *provider;
|
||||
|
|
Loading…
Reference in New Issue