Enlightenment CVS committal Author : morlenxus Project : e_modules Module : calendar
Dir : e_modules/calendar Modified Files: e_mod_main.c e_mod_main.h Log Message: Resize bug fixed. =================================================================== RCS file: /cvs/e/e_modules/calendar/e_mod_main.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -3 -r1.15 -r1.16 --- e_mod_main.c 2 Dec 2007 16:46:08 -0000 1.15 +++ e_mod_main.c 5 Dec 2007 01:30:55 -0000 1.16 @@ -13,7 +13,6 @@ { E_Gadcon_Client *gcc; Calendar *calendar; - Ecore_Timer *timer; E_Gadcon_Popup *popup; }; @@ -30,7 +29,8 @@ static char *_gc_label(void); static Evas_Object *_gc_icon(Evas *evas); static const char *_gc_id_new(void); -static int _update_calendar_sheet(void *data); +static int _update_date(void *data); +static int _update_calendar_sheet(Instance *inst); static void _calendar_popup_content_create(Instance *inst); static void _calendar_popup_resize(Evas_Object *obj, int *w, int *h); static void _calendar_popup_destroy(Instance *inst); @@ -95,7 +95,6 @@ _cb_mouse_down, inst); _update_calendar_sheet(inst); - inst->timer = ecore_timer_add(1, _update_calendar_sheet, inst); return gcc; } @@ -109,10 +108,7 @@ calendar = inst->calendar; if (inst->popup) _calendar_popup_destroy(inst); - if (inst->timer) - ecore_timer_del(inst->timer); - if (calendar->o_icon) - evas_object_del(calendar->o_icon); + if (calendar->o_icon) evas_object_del(calendar->o_icon); calendar_conf->instances = evas_list_remove(calendar_conf->instances, inst); E_FREE(calendar); @@ -136,7 +132,7 @@ _gc_icon(Evas *evas) { Evas_Object *o; - char buf[4096]; + char buf[4096]; if (!calendar_conf->module) return NULL; @@ -168,26 +164,48 @@ } static int -_update_calendar_sheet(void *data) +_update_date(void *data) +{ + Evas_List *l; + time_t current_time; + struct tm *local_time; + static int prev_day=0; + + if (!calendar_conf->instances) return 1; + + current_time = time (NULL); + local_time = localtime (¤t_time); + if (prev_day == local_time->tm_mday) + return 1; + else + prev_day = local_time->tm_mday; + + for (l = calendar_conf->instances; l; l = l->next) + { + Instance *inst; + + inst = l->data; + if (!inst) continue; + _update_calendar_sheet (inst); + } + + return 1; +} + +static int +_update_calendar_sheet(Instance *inst) { - Instance *inst; Calendar *calendar; char buf[4]; time_t current_time; struct tm *local_time; - static int prev_day = 0; - inst = data; if (!inst) return 1; calendar = inst->calendar; if (!calendar) return 1; current_time = time (NULL); local_time = localtime (¤t_time); - if (prev_day == local_time->tm_mday) - return 1; - else - prev_day = local_time->tm_mday; strftime (buf, sizeof(buf), "%d", local_time); edje_object_part_text_set (calendar->o_icon, "monthday", buf); @@ -202,8 +220,6 @@ } else _calendar_popup_content_create(inst); - - return 1; } static void @@ -428,12 +444,14 @@ e_action_predef_name_set(D_("Calendar"), D_("Monthview Popup (Show/Hide)"), "calendar", "<none>", NULL, 0); } + calendar_conf->timer = ecore_timer_add(1, _update_date, calendar_conf); return m; } EAPI int e_modapi_shutdown(E_Module *m) { + if (calendar_conf->timer) ecore_timer_del(calendar_conf->timer); calendar_conf->module = NULL; e_gadcon_provider_unregister(&_gc_class); /* remove module-supplied action */ =================================================================== RCS file: /cvs/e/e_modules/calendar/e_mod_main.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- e_mod_main.h 2 Dec 2007 16:16:02 -0000 1.5 +++ e_mod_main.h 5 Dec 2007 01:30:55 -0000 1.6 @@ -11,6 +11,7 @@ E_Module *module; E_Config_Dialog *config_dialog; E_Menu *menu; + Ecore_Timer *timer; Evas_List *instances; Evas_List *items; }; ------------------------------------------------------------------------- SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs