<commit_before>#include <Elementary.h>
#include "private.h"

void
external_signal(void *data, Evas_Object *obj, const char *signal, const char *source)
{
   printf("External Signal received: '%s' '%s'\n", signal, source);
}

void *
external_common_params_parse_internal(size_t params_size, void *data, Evas_Object *obj, const Eina_List *params)
{
   Elm_Params *p;
   const Eina_List *l;
   Edje_External_Param *param;

   if (params_size < sizeof(Elm_Params))
     return NULL;

   p = calloc(1, params_size);
   if (!p)
     return NULL;

   EINA_LIST_FOREACH(params, l, param)
     {
	if (!strcmp(param->name, "label"))
	  p->label = param->s;
     }
   return p;
}

void
external_common_icon_param_parse(Evas_Object **icon, Evas_Object *obj, const Eina_List *params)
{
   Edje_External_Param *p;

   p = edje_external_param_find(params, "icon");
   if (p)
     {
	Evas_Object *parent = evas_object_smart_parent_get(obj);
	const char *file;
	edje_object_file_get(parent, &file, NULL);
	*icon = elm_icon_add(parent);

	if (!elm_icon_file_set(*icon, file, p->s))
	  elm_icon_standard_set(*icon, p->s);
     }
}

void
external_common_params_free(void *params)
{
   Elm_Params *p = params;
   free(p);
};

#define DEFINE_TYPE(type_name) \
  extern const Edje_External_Type external_##type_name##_type;
#include "modules.inc"
#undef DEFINE_TYPE

static Edje_External_Type_Info elm_external_types[] =
{
#define DEFINE_TYPE(type_name)              \
  {"elm/"#type_name, &external_##type_name##_type},
#include "modules.inc"<commit_msg>Icon parser check if it was successfuly set and if not deletes the icon.<commit_after>#include <Elementary.h>
#include "private.h"

void
external_signal(void *data, Evas_Object *obj, const char *signal, const char *source)
{
   printf("External Signal received: '%s' '%s'\n", signal, source);
}

void *
external_common_params_parse_internal(size_t params_size, void *data, Evas_Object *obj, const Eina_List *params)
{
   Elm_Params *p;
   const Eina_List *l;
   Edje_External_Param *param;

   if (params_size < sizeof(Elm_Params))
     return NULL;

   p = calloc(1, params_size);
   if (!p)
     return NULL;

   EINA_LIST_FOREACH(params, l, param)
     {
	if (!strcmp(param->name, "label"))
	  p->label = param->s;
     }
   return p;
}

void
external_common_icon_param_parse(Evas_Object **icon, Evas_Object *obj, const Eina_List *params)
{
   Edje_External_Param *p;

   p = edje_external_param_find(params, "icon");
   if (p)
     {
	Evas_Object *parent = evas_object_smart_parent_get(obj);
	const char *file;
	edje_object_file_get(parent, &file, NULL);
	*icon = elm_icon_add(parent);

	if (elm_icon_file_set(*icon, file, p->s))
	  return;
	if (elm_icon_standard_set(*icon, p->s))
	  return;

	evas_object_del(*icon);
	*icon = NULL;
     }
}

void
external_common_params_free(void *params)
{
   Elm_Params *p = params;
   free(p);
};

#define DEFINE_TYPE(type_name) \
  extern const Edje_External_Type external_##type_name##_type;
#include "modules.inc"
#undef DEFINE_TYPE

static Edje_External_Type_Info elm_external_types[] =
{
#define DEFINE_TYPE(type_name)              \
  {"elm/"#type_name, &external_##type_name##_type},
#include "modules.inc"
{'fraction_non_alphanumeric': 0.1292751804204581, 'fraction_numerical': 0.0006275494195167869, 'mean_word_length': 4.662522202486678, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6781427', 'n_tokens_mistral': 1214, 'n_tokens_neox': 1194, 'n_words': 256}