<commit_before>#include "e.h"

static void        *_create_data(E_Config_Dialog *cfd);
static void         _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static int          _apply_cfdata(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static Evas_Object *_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
static void         _ilist_fill(E_Config_Dialog_Data *cfdata);
static void         _ilist_cb_selected(void *data);
static void         _cb_add(void *data, void *data2);
static void         _cb_delete(void *data, void *data2);
static void         _cb_scratch(void *data, void *data2);
static void         _cb_reset(void *data, void *data2);
static void         _cb_dialog_yes(void *data);
static void         _cb_dialog_destroy(void *data);

static void         _new_profile_cb_ok(void *data, char *text);
static void         _new_profile_cb_dia_del(void *obj);

struct _E_Config_Dialog_Data
{
   E_Config_Dialog *cfd;
   Evas_Object     *o_list;
   Evas_Object     *o_delete;
   Evas_Object     *o_scratch;
   Evas_Object     *o_reset;
   Evas_Object     *o_text;
   Evas_Object     *o_textlabel;
   const char      *sel_profile;

   E_Entry_Dialog *dia_new_profile;
};

typedef struct _Del_Profile_Confirm_Data Del_Profile_Confirm_Data;
struct _Del_Profile_Confirm_Data
{
   E_Config_Dialog_Data *cfdata;
};

E_Config_Dialog *
e_int_config_profiles(E_Comp *comp, const char *params __UNUSED__)
{
   E_Config_Dialog *cfd;
   E_Config_Dialog_View *v;

   if (e_config_dialog_find("E", "settings/profiles")) return NULL;
   v = E_NEW(E_Config_Dialog_View, 1);
   if (!v) return NULL;
   v->create_cfdata = _create_data;
   v->free_cfdata = _free_data;
   v->basic.apply_cfdata = _apply_cfdata;
   v->basic.create_widgets = _create_widgets;

   cfd = e_config_dialog_new(comp, _("Profile Selector"),
                             "E", "settings/profiles",
                             "preferences-profiles", 0, v, NULL);
   e_config_dialog_changed_auto_set(cfd, 0);
   return cfd;
}

static void *
_create_data(E_Config_Dialog *cfd)
{
   E_Config_Dialog_Data *cfdata;

   cfdata = E_NEW(E_Config_Dialog_Data, 1);
   cfdata->cfd = cfd;
   return cfdata;
}

static void
_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{
   E_FREE(cfdata);
}

static int
_apply_cfdata(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{
   const char *cur_profile;
   E_Action *a;

   cur_profile = e_config_profile_get();
   if (strcmp(cur_profile, cfdata->sel_profile) == 0)
     return 1;

   e_config_save_flush();
   e_config_profile_set(cfdata->sel_profile);
   e_config_profile_save();
   e_config_save_block_set(1);

   a = e_action_find("restart");
   if ((a) && (a->func.go)) a->func.go(NULL, NULL);
   return 1;
}

static Evas_Object *
_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{
   Evas_Object *o, *of, *ot, *ob;
   Evas_Coord mw, mh;
   char buf[PATH_MAX];

   o = e_widget_list_add(evas, 0, 0);

   of = e_widget_framelist_add(evas, _("Available Profiles"), 0);
   cfdata->o_list = e_widget_ilist_add(evas, 24, 24, &(cfdata->sel_profile));
   e_widget_size_min_set(cfdata->o_list, 140 * e_scale, 80 * e_scale);
   e_widget_framelist_object_append(of, cfdata->o_list);

   cfdata->o_textlabel = e_widget_label_add(evas, "");
   e_widget_size_min_get(cfdata->o_textlabel, &mw, &mh);
   e_widget_framelist_object_append_full(of, cfdata->o_textlabel,
                                         1, 1, /* fill */
                                         1, 0, /* expand */
                                         0.5, 0.5, /* align */
                                         mw, mh, /* min */
                                         99999, 99999 /* max */
                                         );

   ob = e_widget_textblock_add(evas);
   e_widget_textblock_markup_set(ob, _("Select a profile"));
   cfdata->o_text = ob;
   e_widget_framelist_object_append_full(of, cfdata->o_text,
                                         1, 1, /* fill */<commit_msg>add missing EINA_UNUSED for unused param.<commit_after>#include "e.h"

static void        *_create_data(E_Config_Dialog *cfd);
static void         _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static int          _apply_cfdata(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static Evas_Object *_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
static void         _ilist_fill(E_Config_Dialog_Data *cfdata);
static void         _ilist_cb_selected(void *data);
static void         _cb_add(void *data, void *data2);
static void         _cb_delete(void *data, void *data2);
static void         _cb_scratch(void *data, void *data2);
static void         _cb_reset(void *data, void *data2);
static void         _cb_dialog_yes(void *data);
static void         _cb_dialog_destroy(void *data);

static void         _new_profile_cb_ok(void *data, char *text);
static void         _new_profile_cb_dia_del(void *obj);

struct _E_Config_Dialog_Data
{
   E_Config_Dialog *cfd;
   Evas_Object     *o_list;
   Evas_Object     *o_delete;
   Evas_Object     *o_scratch;
   Evas_Object     *o_reset;
   Evas_Object     *o_text;
   Evas_Object     *o_textlabel;
   const char      *sel_profile;

   E_Entry_Dialog *dia_new_profile;
};

typedef struct _Del_Profile_Confirm_Data Del_Profile_Confirm_Data;
struct _Del_Profile_Confirm_Data
{
   E_Config_Dialog_Data *cfdata;
};

E_Config_Dialog *
e_int_config_profiles(E_Comp *comp, const char *params __UNUSED__)
{
   E_Config_Dialog *cfd;
   E_Config_Dialog_View *v;

   if (e_config_dialog_find("E", "settings/profiles")) return NULL;
   v = E_NEW(E_Config_Dialog_View, 1);
   if (!v) return NULL;
   v->create_cfdata = _create_data;
   v->free_cfdata = _free_data;
   v->basic.apply_cfdata = _apply_cfdata;
   v->basic.create_widgets = _create_widgets;

   cfd = e_config_dialog_new(comp, _("Profile Selector"),
                             "E", "settings/profiles",
                             "preferences-profiles", 0, v, NULL);
   e_config_dialog_changed_auto_set(cfd, 0);
   return cfd;
}

static void *
_create_data(E_Config_Dialog *cfd)
{
   E_Config_Dialog_Data *cfdata;

   cfdata = E_NEW(E_Config_Dialog_Data, 1);
   cfdata->cfd = cfd;
   return cfdata;
}

static void
_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{
   E_FREE(cfdata);
}

static int
_apply_cfdata(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{
   const char *cur_profile;
   E_Action *a;

   cur_profile = e_config_profile_get();
   if (strcmp(cur_profile, cfdata->sel_profile) == 0)
     return 1;

   e_config_save_flush();
   e_config_profile_set(cfdata->sel_profile);
   e_config_profile_save();
   e_config_save_block_set(1);

   a = e_action_find("restart");
   if ((a) && (a->func.go)) a->func.go(NULL, NULL);
   return 1;
}

static Evas_Object *
_create_widgets(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dialog_Data *cfdata)
{
   Evas_Object *o, *of, *ot, *ob;
   Evas_Coord mw, mh;
   char buf[PATH_MAX];

   o = e_widget_list_add(evas, 0, 0);

   of = e_widget_framelist_add(evas, _("Available Profiles"), 0);
   cfdata->o_list = e_widget_ilist_add(evas, 24, 24, &(cfdata->sel_profile));
   e_widget_size_min_set(cfdata->o_list, 140 * e_scale, 80 * e_scale);
   e_widget_framelist_object_append(of, cfdata->o_list);

   cfdata->o_textlabel = e_widget_label_add(evas, "");
   e_widget_size_min_get(cfdata->o_textlabel, &mw, &mh);
   e_widget_framelist_object_append_full(of, cfdata->o_textlabel,
                                         1, 1, /* fill */
                                         1, 0, /* expand */
                                         0.5, 0.5, /* align */
                                         mw, mh, /* min */
                                         99999, 99999 /* max */
                                         );

   ob = e_widget_textblock_add(evas);
   e_widget_textblock_markup_set(ob, _("Select a profile"));
   cfdata->o_text = ob;
   e_widget_framelist_object_append_full(of, cfdata->o_text,
                                         1, 1, /* fill */
{'fraction_non_alphanumeric': 0.1051025390625, 'fraction_numerical': 0.0107421875, 'mean_word_length': 2.9656340755082287, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1684632', 'n_tokens_mistral': 3029, 'n_tokens_neox': 2918, 'n_words': 562}