<commit_before>#include "e.h"
#include "e_mod_main.h"

/***************************************************************************/
 /**/
/* gadcon requirements */
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
static void _gc_shutdown(E_Gadcon_Client *gcc);
static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient);
static char *_gc_label(E_Gadcon_Client_Class *client_class);
static Evas_Object *_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas);
static const char *_gc_id_new(E_Gadcon_Client_Class *client_class);

/* and actually define the gadcon class that this module provides (just 1) */
static E_Gadcon_Client_Class _gadcon_class = {
   GADCON_CLIENT_CLASS_VERSION,
   "tasks",
   {
      _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL, NULL
   },
   E_GADCON_CLIENT_STYLE_PLAIN
};
/**/
/***************************************************************************/
/***************************************************************************/
/**/
/* actual module specifics */

typedef struct _Tasks Tasks;
typedef struct _Tasks_Item Tasks_Item;

struct _Tasks
{
   E_Gadcon_Client *gcc;        // The gadcon client
   Evas_Object *o_items;        // Table of items
   Eina_List *items;            // List of items
   E_Zone *zone;                // Current Zone
   Config_Item *config;         // Configuration
   int horizontal;
};

struct _Tasks_Item
{
   Tasks *tasks;            // Parent tasks
   E_Border *border;            // The border this item points to
   Evas_Object *o_item;         // The edje theme object
   Evas_Object *o_icon;         // The icon
};

static Tasks *_tasks_new(Evas *evas, E_Zone *zone, const char *id);
static void _tasks_free(Tasks *tasks);
static void _tasks_refill(Tasks *tasks);
static void _tasks_refill_all();
static void _tasks_refill_border(E_Border *border);
static void _tasks_signal_emit(E_Border *border, char *sig, char *src);

static Tasks_Item *_tasks_item_find(Tasks *tasks, E_Border *border);
static Tasks_Item *_tasks_item_new(Tasks *tasks, E_Border *border);

static int _tasks_item_check_add(Tasks *tasks, E_Border *border);
static void _tasks_item_add(Tasks *tasks, E_Border *border);
static void _tasks_item_remove(Tasks_Item *item);
static void _tasks_item_refill(Tasks_Item *item);
static void _tasks_item_fill(Tasks_Item *item);
static void _tasks_item_free(Tasks_Item *item);
static void _tasks_item_signal_emit(Tasks_Item *item, char *sig, char *src);

static Config_Item *_tasks_config_item_get(const char *id);

static void _tasks_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi);
static void _tasks_cb_item_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _tasks_cb_item_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);

static Eina_Bool _tasks_cb_event_border_add(void *data, int type, void *event);
static Eina_Bool _tasks_cb_event_border_remove(void *data, int type, void *event);
static Eina_Bool _tasks_cb_event_border_iconify(void *data, int type, void *event);
static Eina_Bool _tasks_cb_event_border_uniconify(void *data, int type, void *event);
static Eina_Bool _tasks_cb_event_border_icon_change(void *data, int type, void *event);
static Eina_Bool _tasks_cb_event_border_zone_set(void *data, int type, void *event);
static Eina_Bool _tasks_cb_event_border_desk_set(void *data, int type, void *event);
static Eina_Bool _tasks_cb_window_focus_in(void *data, int type, void *event);
static Eina_Bool _tasks_cb_window_focus_out(void *data, int type, void *event);
static Eina_Bool _tasks_cb_event_border_property(void *data, int type, void *event);
static Eina_Bool _tasks_cb_event_desk_show(void *data, int type, void *event);
static Eina_Bool _tasks_cb_event_border_urgent_change(void *data, int type, void *event);

static E_Config_DD *conf_edd = NULL;
static E_Config_DD *conf_item_edd = NULL;

Config *tasks_config = NULL;

/* module setup */
EAPI E_Module_Api e_modapi =
{
   E_MODULE_API_VERSION,
   "Tasks"
};

EAPI void *
e_modapi_init(E_Module *m)
{
   conf_item_edd = E_CONFIG_DD_NEW("Tasks_Config_Item", Config_Item);

#undef T
#undef D
#define T Config_Item
#define D conf_item_edd
   E_CONFIG_VAL(D, T, id, STR);
   E_CONFIG_VAL(D, T, show_all, INT);
   E_CONFIG_VAL(D, T, minw, INT);
   E_CONFIG_VAL(D, T, minh, INT);

   conf_edd = E_CONFIG_DD_NEW("Tasks_Config", Config);

#undef T
#undef D
#define T Config
#define D conf_edd
   E_CONFIG_LIST(D, T, items, conf_item_edd);

   tasks_config = e_config_domain_load("module.tasks", conf_edd);
   if (!tasks_config)
     {
        Config_Item *config;
        
        tasks_config = E_NEW(Config, 1);
        config = E_NEW(Config_Item, 1);
        config->id = eina_stringshare_add("0");
        config->show_all = 0;
        config->minw = 80;
        config->minh = 32;
        tasks_config->items = eina_list_append(tasks_config->items, config);
     }

   tasks_config->module = m;

   tasks_config->handlers = eina_list_append
     (tasks_config->handlers, ecore_event_handler_add
         (E_EVENT_BORDER_ADD, _tasks_cb_event_border_add, NULL));
   tasks_config->handlers = eina_list_append
     (tasks_config->handlers, ecore_event_handler_add
         (E_EVENT_BORDER_REMOVE, _tasks_cb_event_border_remove, NULL));
   tasks_config->handlers = eina_list_append
     (tasks_config->handlers, ecore_event_handler_add
         (E_EVENT_BORDER_ICONIFY, _tasks_cb_event_border_iconify, NULL));
   tasks_config->handlers = eina_list_append
     (tasks_config->handlers, ecore_event_handler_add
         (E_EVENT_BORDER_UNICONIFY, _tasks_cb_event_border_uniconify, NULL));
   tasks_config->handlers = eina_list_append
     (tasks_config->handlers, ecore_event_handler_add<commit_msg>make default width 100 not 80.<commit_after>#include "e.h"
#include "e_mod_main.h"

/***************************************************************************/
 /**/
/* gadcon requirements */
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
static void _gc_shutdown(E_Gadcon_Client *gcc);
static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient);
static char *_gc_label(E_Gadcon_Client_Class *client_class);
static Evas_Object *_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas);
static const char *_gc_id_new(E_Gadcon_Client_Class *client_class);

/* and actually define the gadcon class that this module provides (just 1) */
static E_Gadcon_Client_Class _gadcon_class = {
   GADCON_CLIENT_CLASS_VERSION,
   "tasks",
   {
      _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL, NULL
   },
   E_GADCON_CLIENT_STYLE_PLAIN
};
/**/
/***************************************************************************/
/***************************************************************************/
/**/
/* actual module specifics */

typedef struct _Tasks Tasks;
typedef struct _Tasks_Item Tasks_Item;

struct _Tasks
{
   E_Gadcon_Client *gcc;        // The gadcon client
   Evas_Object *o_items;        // Table of items
   Eina_List *items;            // List of items
   E_Zone *zone;                // Current Zone
   Config_Item *config;         // Configuration
   int horizontal;
};

struct _Tasks_Item
{
   Tasks *tasks;            // Parent tasks
   E_Border *border;            // The border this item points to
   Evas_Object *o_item;         // The edje theme object
   Evas_Object *o_icon;         // The icon
};

static Tasks *_tasks_new(Evas *evas, E_Zone *zone, const char *id);
static void _tasks_free(Tasks *tasks);
static void _tasks_refill(Tasks *tasks);
static void _tasks_refill_all();
static void _tasks_refill_border(E_Border *border);
static void _tasks_signal_emit(E_Border *border, char *sig, char *src);

static Tasks_Item *_tasks_item_find(Tasks *tasks, E_Border *border);
static Tasks_Item *_tasks_item_new(Tasks *tasks, E_Border *border);

static int _tasks_item_check_add(Tasks *tasks, E_Border *border);
static void _tasks_item_add(Tasks *tasks, E_Border *border);
static void _tasks_item_remove(Tasks_Item *item);
static void _tasks_item_refill(Tasks_Item *item);
static void _tasks_item_fill(Tasks_Item *item);
static void _tasks_item_free(Tasks_Item *item);
static void _tasks_item_signal_emit(Tasks_Item *item, char *sig, char *src);

static Config_Item *_tasks_config_item_get(const char *id);

static void _tasks_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi);
static void _tasks_cb_item_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _tasks_cb_item_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);

static Eina_Bool _tasks_cb_event_border_add(void *data, int type, void *event);
static Eina_Bool _tasks_cb_event_border_remove(void *data, int type, void *event);
static Eina_Bool _tasks_cb_event_border_iconify(void *data, int type, void *event);
static Eina_Bool _tasks_cb_event_border_uniconify(void *data, int type, void *event);
static Eina_Bool _tasks_cb_event_border_icon_change(void *data, int type, void *event);
static Eina_Bool _tasks_cb_event_border_zone_set(void *data, int type, void *event);
static Eina_Bool _tasks_cb_event_border_desk_set(void *data, int type, void *event);
static Eina_Bool _tasks_cb_window_focus_in(void *data, int type, void *event);
static Eina_Bool _tasks_cb_window_focus_out(void *data, int type, void *event);
static Eina_Bool _tasks_cb_event_border_property(void *data, int type, void *event);
static Eina_Bool _tasks_cb_event_desk_show(void *data, int type, void *event);
static Eina_Bool _tasks_cb_event_border_urgent_change(void *data, int type, void *event);

static E_Config_DD *conf_edd = NULL;
static E_Config_DD *conf_item_edd = NULL;

Config *tasks_config = NULL;

/* module setup */
EAPI E_Module_Api e_modapi =
{
   E_MODULE_API_VERSION,
   "Tasks"
};

EAPI void *
e_modapi_init(E_Module *m)
{
   conf_item_edd = E_CONFIG_DD_NEW("Tasks_Config_Item", Config_Item);

#undef T
#undef D
#define T Config_Item
#define D conf_item_edd
   E_CONFIG_VAL(D, T, id, STR);
   E_CONFIG_VAL(D, T, show_all, INT);
   E_CONFIG_VAL(D, T, minw, INT);
   E_CONFIG_VAL(D, T, minh, INT);

   conf_edd = E_CONFIG_DD_NEW("Tasks_Config", Config);

#undef T
#undef D
#define T Config
#define D conf_edd
   E_CONFIG_LIST(D, T, items, conf_item_edd);

   tasks_config = e_config_domain_load("module.tasks", conf_edd);
   if (!tasks_config)
     {
        Config_Item *config;
        
        tasks_config = E_NEW(Config, 1);
        config = E_NEW(Config_Item, 1);
        config->id = eina_stringshare_add("0");
        config->show_all = 0;
        config->minw = 100;
        config->minh = 32;
        tasks_config->items = eina_list_append(tasks_config->items, config);
     }

   tasks_config->module = m;

   tasks_config->handlers = eina_list_append
     (tasks_config->handlers, ecore_event_handler_add
         (E_EVENT_BORDER_ADD, _tasks_cb_event_border_add, NULL));
   tasks_config->handlers = eina_list_append
     (tasks_config->handlers, ecore_event_handler_add
         (E_EVENT_BORDER_REMOVE, _tasks_cb_event_border_remove, NULL));
   tasks_config->handlers = eina_list_append
     (tasks_config->handlers, ecore_event_handler_add
         (E_EVENT_BORDER_ICONIFY, _tasks_cb_event_border_iconify, NULL));
   tasks_config->handlers = eina_list_append
     (tasks_config->handlers, ecore_event_handler_add
         (E_EVENT_BORDER_UNICONIFY, _tasks_cb_event_border_uniconify, NULL));
   tasks_config->handlers = eina_list_append
     (tasks_config->handlers, ecore_event_handler_add
{'fraction_non_alphanumeric': 0.13127047060851577, 'fraction_numerical': 0.002068608860541286, 'mean_word_length': 5.1816728822589235, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 37, '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': '753300', 'n_tokens_mistral': 4084, 'n_tokens_neox': 3993, 'n_words': 936}