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

/* NOTE:
 *
 * currently the edje data to display the clock is not in CVS, to use the clock
 * you must:
 * a) set up expedition to get mouse events - in parts/bg.edc set part "bg"'s 
 *      mouse_events to 1
 * b) build expedition.eet with this change
 * c) copy your "expedition.eet" to 
 *      $PREFIX/lib/enlightenment/modules/clock/default.eet
 * d) in src/bin/e_module.c uncomment the lines:
 *       m = e_module_new("clock");
 *       e_module_enable(m);
 */	 

/* TODO List:
 *
 * Add checking for screen edges - do not want to drag off screen
 * 
 */

/* module private routines */
static Clock *_clock_init(E_Module *m);
static void    _clock_shutdown(Clock *e);
static E_Menu *_clock_config_menu_new(Clock *e);
static void    _clock_config_menu_del(Clock *e, E_Menu *m);
static void    _clock_face_init(Clock_Face *ef);
static void    _clock_face_free(Clock_Face *ef);
static void    _clock_face_reconfigure(Clock_Face *ef);
static void    _clock_cb_face_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void    _clock_cb_face_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void    _clock_cb_face_move(void *data, Evas *e, Evas_Object *obj, void *event_info);

char          *_clock_module_dir;

/* public module routines. all modules must have these */
void *
init(E_Module *m)
{
   Clock *e;
   
   /* check module api version */
   if (m->api->version < E_MODULE_API_VERSION)
     {
	e_error_dialog_show("Module API Error",
			    "Error initializing Module: IBar\n"
			    "It requires a minimum module API version of: %i.\n"
			    "The module API advertized by Enlightenment is: %i.\n"
			    "Aborting module.",
			    E_MODULE_API_VERSION,
			    m->api->version);
	return NULL;
     }
   /* actually init clock */
   e = _clock_init(m);
   m->config_menu = _clock_config_menu_new(e);
   return e;
}

int
shutdown(E_Module *m)
{
   Clock *e;
   
   e = m->data;
   if (e)
     {
	if (m->config_menu)
	  {
	     _clock_config_menu_del(e, m->config_menu);
	     m->config_menu = NULL;
	  }
	_clock_shutdown(e);
     }
   return 1;
}

int
save(E_Module *m)
{
   Clock *e;

   e = m->data;
   ecore_config_int_set("e.module.clock.x", e->face->fx);
   ecore_config_int_set("e.module.clock.y", e->face->fy);
   ecore_config_int_set("e.module.clock.width", e->face->fw);
   return 1;
}

int
info(E_Module *m)
{
   char buf[4096];
   
   m->label = strdup("Clock");
   snprintf(buf, sizeof(buf), "%s/module_icon.png", e_module_dir_get(m));
   m->icon_file = strdup(buf);
   return 1;
}

int
about(E_Module *m)
{
   e_error_dialog_show("Enlightenment Clock Module",
		       "A simple module to give E17 a clock.");
   return 1;
}<commit_msg>Actually save as we get disabled, so we load same state when re-enabled<commit_after>#include "e.h"
#include "e_mod_main.h"

/* NOTE:
 *
 * currently the edje data to display the clock is not in CVS, to use the clock
 * you must:
 * a) set up expedition to get mouse events - in parts/bg.edc set part "bg"'s 
 *      mouse_events to 1
 * b) build expedition.eet with this change
 * c) copy your "expedition.eet" to 
 *      $PREFIX/lib/enlightenment/modules/clock/default.eet
 * d) in src/bin/e_module.c uncomment the lines:
 *       m = e_module_new("clock");
 *       e_module_enable(m);
 */	 

/* TODO List:
 *
 * Add checking for screen edges - do not want to drag off screen
 * 
 */

/* module private routines */
static Clock *_clock_init(E_Module *m);
static void    _clock_shutdown(Clock *e);
static E_Menu *_clock_config_menu_new(Clock *e);
static void    _clock_config_menu_del(Clock *e, E_Menu *m);
static void    _clock_face_init(Clock_Face *ef);
static void    _clock_face_free(Clock_Face *ef);
static void    _clock_face_reconfigure(Clock_Face *ef);
static void    _clock_cb_face_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void    _clock_cb_face_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void    _clock_cb_face_move(void *data, Evas *e, Evas_Object *obj, void *event_info);

char          *_clock_module_dir;

/* public module routines. all modules must have these */
void *
init(E_Module *m)
{
   Clock *e;
   
   /* check module api version */
   if (m->api->version < E_MODULE_API_VERSION)
     {
	e_error_dialog_show("Module API Error",
			    "Error initializing Module: IBar\n"
			    "It requires a minimum module API version of: %i.\n"
			    "The module API advertized by Enlightenment is: %i.\n"
			    "Aborting module.",
			    E_MODULE_API_VERSION,
			    m->api->version);
	return NULL;
     }
   /* actually init clock */
   e = _clock_init(m);
   m->config_menu = _clock_config_menu_new(e);
   return e;
}

int
shutdown(E_Module *m)
{
   Clock *e;
   
   e = m->data;
   if (e)
     {
	if (m->config_menu)
	  {
	     _clock_config_menu_del(e, m->config_menu);
	     m->config_menu = NULL;
	  }
	_clock_shutdown(e);
     }
   return 1;
}

int
save(E_Module *m)
{
   Clock *e;

   e = m->data;
   ecore_config_int_set("e.module.clock.x", e->face->fx);
   ecore_config_int_set("e.module.clock.y", e->face->fy);
   ecore_config_int_set("e.module.clock.width", e->face->fw);
   e_config_save_queue();
   return 1;
}

int
info(E_Module *m)
{
   char buf[4096];
   
   m->label = strdup("Clock");
   snprintf(buf, sizeof(buf), "%s/module_icon.png", e_module_dir_get(m));
   m->icon_file = strdup(buf);
   return 1;
}

int
about(E_Module *m)
{
   e_error_dialog_show("Enlightenment Clock Module",
		       "A simple module to give E17 a clock.");
   return 1;
}
{'fraction_non_alphanumeric': 0.1268790264853257, 'fraction_numerical': 0.003937007874015748, 'mean_word_length': 3.27947932618683, 'pattern_counts': {'":': 0, '<': 5, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7564692', 'n_tokens_mistral': 2153, 'n_tokens_neox': 2042, 'n_words': 537}