Hello,

2010/3/29 Enlightenment SVN <no-re...@enlightenment.org>:
> Log:
>        * calendar: now you can move in the timeline.
>
>        TODO: Add support for remote service with a local cache.
>        People do you have suggestion on what kind of remote
>        calendar this module should support ?
>
How about (Web-/)CalDav?

BR,

Leif

> Author:       cedric
> Date:         2010-03-29 08:54:34 -0700 (Mon, 29 Mar 2010)
> New Revision: 47557
>
> Added:
>  trunk/E-MODULES-EXTRA/calendar/arrow2_left.png 
> trunk/E-MODULES-EXTRA/calendar/arrow2_right.png 
> trunk/E-MODULES-EXTRA/calendar/arrow_left.png 
> trunk/E-MODULES-EXTRA/calendar/arrow_right.png
> Modified:
>  trunk/E-MODULES-EXTRA/calendar/calendar.edc 
> trunk/E-MODULES-EXTRA/calendar/src/e_mod_main.c
>
>
> Property changes on: trunk/E-MODULES-EXTRA/calendar/arrow2_left.png
> ___________________________________________________________________
> Added: svn:mime-type
>   + application/octet-stream
>
>
> Property changes on: trunk/E-MODULES-EXTRA/calendar/arrow2_right.png
> ___________________________________________________________________
> Added: svn:mime-type
>   + application/octet-stream
>
>
> Property changes on: trunk/E-MODULES-EXTRA/calendar/arrow_left.png
> ___________________________________________________________________
> Added: svn:mime-type
>   + application/octet-stream
>
>
> Property changes on: trunk/E-MODULES-EXTRA/calendar/arrow_right.png
> ___________________________________________________________________
> Added: svn:mime-type
>   + application/octet-stream
>
> Modified: trunk/E-MODULES-EXTRA/calendar/calendar.edc
> ===================================================================
> --- trunk/E-MODULES-EXTRA/calendar/calendar.edc 2010-03-29 13:21:38 UTC (rev 
> 47556)
> +++ trunk/E-MODULES-EXTRA/calendar/calendar.edc 2010-03-29 15:54:34 UTC (rev 
> 47557)
> @@ -1,9 +1,335 @@
>  images {
>    image: "calendar.png" COMP;
> +   image: "arrow_left.png" COMP;
> +   image: "arrow_right.png" COMP;
> +   image: "arrow2_left.png" COMP;
> +   image: "arrow2_right.png" COMP;
>  }
>
> +#define FLASHY_RECT(To, X1, X2)                        \
> +  part {                                       \
> +     name: To"/back";                          \
> +     type: RECT;                               \
> +     mouse_events: 1;                          \
> +     description {                             \
> +        state: "default" 0.0;                  \
> +        rel1.to: To;                           \
> +        rel1.offset: -1 -1;                    \
> +        rel2.to: To;                           \
> +        rel2.offset: 0 0;                      \
> +        color: 255 128 128 0;                  \
> +     }                                         \
> +     description {                             \
> +        state: "click" 0.0;                    \
> +        inherit: "default" 0.0;                        \
> +        color: 255 128 128 255;                        \
> +     }                                         \
> +  }                                            \
> +  part {                                       \
> +     name: To;                                 \
> +     type: RECT;                               \
> +     mouse_events: 1;                          \
> +     description {                             \
> +        state: "default" 0.0;                  \
> +        rel1.relative: X1 0.0;                 \
> +        rel2.relative: X2 1.0;                 \
> +        color: 255 195 195 0;                  \
> +     }                                         \
> +     description {                             \
> +        state: "click" 0.0;                    \
> +        inherit: "default" 0.0;                        \
> +        color: 255 195 195 255;                        \
> +     }                                         \
> +  }
> +
> +
>  collections {
>    group {
> +      name: "modules/calendar/header";
> +      min: 42 9;
> +      parts {
> +        FLASHY_RECT("year/left", 0.0, 0.06);
> +        part {
> +           name: "year/left/image";
> +           type: IMAGE;
> +           mouse_events: 0;
> +           description {
> +              state: "default" 0.0;
> +              aspect: 1.0 1.0;
> +              aspect_preference: BOTH;
> +              rel1.to: "year/left";
> +              rel2.to: "year/left";
> +              image.normal: "arrow2_left.png";
> +           }
> +        }
> +        FLASHY_RECT("month/left", 0.06, 0.105);
> +        part {
> +           name: "month/left/image";
> +           type: IMAGE;
> +           mouse_events: 0;
> +           description {
> +              state: "default" 0.0;
> +              aspect: 1.0 1.0;
> +              aspect_preference: BOTH;
> +              rel1.to: "month/left";
> +              rel2.to: "month/left";
> +              image.normal: "arrow_left.png";
> +              color: 255 255 255 255;
> +           }
> +           description {
> +              state: "click" 0.0;
> +              inherit: "default" 0.0;
> +              color: 255 0 0 255;
> +           }
> +        }
> +        part {
> +           name: "content";
> +           type: SWALLOW;
> +           mouse_events: 0;
> +           repeat_events: 0;
> +           description {
> +              state: "default" 0.0;
> +              rel1.relative: 0.105 0.0;
> +              rel2.relative: 0.895 1.0;
> +           }
> +        }
> +        part {
> +           name: "content/catcher";
> +           type: RECT;
> +           mouse_events: 1;
> +           description {
> +              state: "default" 0.0;
> +              rel1.to: "content";
> +              rel2.to: "content";
> +              color: 0 0 0 0;
> +           }
> +        }
> +        FLASHY_RECT("month/right", 0.895, 0.94);
> +        part {
> +           name: "month/right/image";
> +           type: IMAGE;
> +           mouse_events: 0;
> +           description {
> +              state: "default" 0.0;
> +              aspect: 1.0 1.0;
> +              aspect_preference: BOTH;
> +              rel1.to: "month/right";
> +              rel2.to: "month/right";
> +              image.normal: "arrow_right.png";
> +              color: 255 255 255 255;
> +           }
> +           description {
> +              state: "click" 0.0;
> +              inherit: "default" 0.0;
> +              color: 255 0 0 255;
> +           }
> +        }
> +        FLASHY_RECT("year/right", 0.94, 1.0);
> +        part {
> +           name: "year/right/image";
> +           type: IMAGE;
> +           mouse_events: 0;
> +           description {
> +              state: "default" 0.0;
> +              aspect: 1.0 1.0;
> +              aspect_preference: BOTH;
> +              rel1.to: "year/right";
> +              rel2.to: "year/right";
> +              image.normal: "arrow2_right.png";
> +              color: 255 255 255 255;
> +           }
> +           description {
> +              state: "click" 0.0;
> +              inherit: "default" 0.0;
> +              color: 255 0 0 255;
> +           }
> +        }
> +      }
> +      programs {
> +        program {
> +           name: "month/plus/content/wheel";
> +           source: "content/catcher";
> +           signal: "mouse,wheel,0,1";
> +           after: "month/plus";
> +        }
> +        program {
> +           name: "month/plus/content/click";
> +           source: "content/catcher";
> +           signal: "mouse,clicked,3";
> +           after: "month/plus";
> +        }
> +        program {
> +           name: "month/plus/right/wheel";
> +           source: "month/right";
> +           signal: "mouse,wheel,0,1";
> +           after: "month/plus";
> +        }
> +        program {
> +           name: "month/plus/right/click";
> +           source: "month/right";
> +           signal: "mouse,clicked,*";
> +           after: "month/plus";
> +        }
> +        program {
> +           name: "month/plus/left/wheel";
> +           source: "month/left";
> +           signal: "mouse,wheel,0,1";
> +           after: "month/plus";
> +        }
> +        program {
> +           name: "month/plus";
> +           action: SIGNAL_EMIT "month" "plus";
> +           after: "month/plus/0";
> +        }
> +        program {
> +           name: "month/plus/0";
> +           action: STATE_SET "click" 0.0;
> +           target: "month/right";
> +           target: "month/right/back";
> +           transition: LINEAR 0.1;
> +           after: "month/plus/1";
> +        }
> +        program {
> +           name: "month/plus/1";
> +           action: STATE_SET "default" 0.0;
> +           target: "month/right";
> +           target: "month/right/back";
> +           transition: LINEAR 0.1;
> +        }
> +
> +        program {
> +           name: "month/minus/content/wheel";
> +           source: "content/catcher";
> +           signal: "mouse,wheel,0,-1";
> +           after: "month/minus";
> +        }
> +        program {
> +           name: "month/minus/content/click";
> +           source: "content/catcher";
> +           signal: "mouse,clicked,1";
> +           after: "month/minus";
> +        }
> +        program {
> +           name: "month/minus/right/wheel";
> +           source: "month/right";
> +           signal: "mouse,wheel,0,-1";
> +           after: "month/minus";
> +        }
> +        program {
> +           name: "month/minus/left/click";
> +           source: "month/left";
> +           signal: "mouse,clicked,*";
> +           after: "month/minus";
> +        }
> +        program {
> +           name: "month/minus/left/wheel";
> +           source: "month/left";
> +           signal: "mouse,wheel,0,-1";
> +           after: "month/minus";
> +        }
> +        program {
> +           name: "month/minus";
> +           action: SIGNAL_EMIT "month" "minus";
> +           after: "month/minus/0";
> +        }
> +        program {
> +           name: "month/minus/0";
> +           action: STATE_SET "click" 0.0;
> +           target: "month/left";
> +           target: "month/left/back";
> +           transition: LINEAR 0.1;
> +           after: "month/minus/1";
> +        }
> +        program {
> +           name: "month/minus/1";
> +           action: STATE_SET "default" 0.0;
> +           target: "month/left";
> +           target: "month/left/back";
> +           transition: LINEAR 0.1;
> +        }
> +
> +        /* Handling year now. */
> +
> +        program {
> +           name: "year/plus/right/wheel";
> +           source: "year/right";
> +           signal: "mouse,wheel,0,1";
> +           after: "year/plus";
> +        }
> +        program {
> +           name: "year/plus/right/click";
> +           source: "year/right";
> +           signal: "mouse,clicked,*";
> +           after: "year/plus";
> +        }
> +        program {
> +           name: "year/plus/left/wheel";
> +           source: "year/left";
> +           signal: "mouse,wheel,0,1";
> +           after: "year/plus";
> +        }
> +        program {
> +           name: "year/plus";
> +           action: SIGNAL_EMIT "year" "plus";
> +           after: "year/plus/0";
> +        }
> +        program {
> +           name: "year/plus/0";
> +           action: STATE_SET "click" 0.0;
> +           target: "year/right";
> +           target: "year/right/back";
> +           transition: LINEAR 0.1;
> +           after: "year/plus/1";
> +        }
> +        program {
> +           name: "year/plus/1";
> +           action: STATE_SET "default" 0.0;
> +           target: "year/right";
> +           target: "year/right/back";
> +           transition: LINEAR 0.1;
> +        }
> +
> +        program {
> +           name: "year/minus/right/wheel";
> +           source: "year/right";
> +           signal: "mouse,wheel,0,-1";
> +           after: "year/minus";
> +        }
> +        program {
> +           name: "year/minus/left/click";
> +           source: "year/left";
> +           signal: "mouse,clicked,*";
> +           after: "year/minus";
> +        }
> +        program {
> +           name: "year/minus/left/wheel";
> +           source: "year/left";
> +           signal: "mouse,wheel,0,-1";
> +           after: "year/minus";
> +        }
> +        program {
> +           name: "year/minus";
> +           action: SIGNAL_EMIT "year" "minus";
> +           after: "year/minus/0";
> +        }
> +        program {
> +           name: "year/minus/0";
> +           action: STATE_SET "click" 0.0;
> +           target: "year/left";
> +           target: "year/left/back";
> +           transition: LINEAR 0.1;
> +           after: "year/minus/1";
> +        }
> +        program {
> +           name: "year/minus/1";
> +           action: STATE_SET "default" 0.0;
> +           target: "year/left";
> +           target: "year/left/back";
> +           transition: LINEAR 0.1;
> +        }
> +      }
> +   }
> +   group {
>       name: "modules/calendar/main";
>       parts {
>          part {
>
> Modified: trunk/E-MODULES-EXTRA/calendar/src/e_mod_main.c
> ===================================================================
> --- trunk/E-MODULES-EXTRA/calendar/src/e_mod_main.c     2010-03-29 13:21:38 
> UTC (rev 47556)
> +++ trunk/E-MODULES-EXTRA/calendar/src/e_mod_main.c     2010-03-29 15:54:34 
> UTC (rev 47557)
> @@ -1,6 +1,10 @@
>  /*
>  * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
>  */
> +#ifdef HAVE_CONFIG_H
> +# include "config.h"
> +#endif
> +
>  #include <e.h>
>  #include "e_mod_main.h"
>
> @@ -9,16 +13,25 @@
>  typedef struct _Instance Instance;
>  typedef struct _Calendar Calendar;
>
> -struct _Instance
> +struct _Instance
>  {
>    E_Gadcon_Client *gcc;
>    Calendar        *calendar;
>    Config_Item     *ci;
>
>    E_Gadcon_Popup  *popup;
> +   Evas_Object     *list;
> +   Evas_Object     *label;
> +   Evas_Object     *table;
> +   Eina_List       *notes;
> +
> +   char            *edje_module;
> +
> +   struct tm        displayed_time;
> +   struct tm        current_time;
>  };
>
> -struct _Calendar
> +struct _Calendar
>  {
>    Instance *inst;
>    Evas_Object *o_icon, *o_today;
> @@ -34,7 +47,10 @@
>  static int _update_date(void *data);
>  static void _update_calendar_sheet(Instance *inst);
>  static void _calendar_popup_content_create(Instance *inst);
> +static void _calendar_popup_content_populate(Instance *inst, struct tm 
> *time);
> +static void _calendar_popup_content_update(Instance *inst);
>  static void _calendar_popup_destroy(Instance *inst);
> +static void _calendar_popup_cleanup(Instance *inst);
>  static void _cb_action(E_Object *obj, const char *params);
>  static void _cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void 
> *event_info);
>  static void _cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void 
> *event_info);
> @@ -55,36 +71,39 @@
>
>  Config *calendar_conf = NULL;
>
> -static const E_Gadcon_Client_Class _gc_class =
> +static const E_Gadcon_Client_Class _gc_class =
>  {
> -   GADCON_CLIENT_CLASS_VERSION, "calendar",
> +   GADCON_CLIENT_CLASS_VERSION, "calendar",
>      {_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, 
> NULL, NULL},
>    E_GADCON_CLIENT_STYLE_PLAIN
>  };
>
>  static E_Gadcon_Client *
> -_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
> +_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
>  {
>    Calendar        *calendar;
>    Instance        *inst;
>    E_Gadcon_Client *gcc;
> -   char             buf[4096];
> +   int              length;
>
> -   inst = E_NEW(Instance, 1);
> +   inst = E_NEW(Instance, 1);
>    inst->ci = _config_item_get(id);
>
>    calendar = E_NEW(Calendar, 1);
>    calendar->inst = inst;
>
> -   snprintf(buf, sizeof(buf), "%s/calendar.edj",
> +   /* Find module specific edje file */
> +   length = strlen(e_module_dir_get(calendar_conf->module));
> +   inst->edje_module = malloc(length + 14);
> +   snprintf(inst->edje_module, length + 14, "%s/calendar.edj",
>            e_module_dir_get(calendar_conf->module));
> -
> +
>    calendar->o_icon = edje_object_add(gc->evas);
> -   if (!e_theme_edje_object_set(calendar->o_icon,
> +   if (!e_theme_edje_object_set(calendar->o_icon,
>                                "base/theme/modules/calendar", 
> "modules/calendar/main"))
> -     edje_object_file_set(calendar->o_icon, buf, "modules/calendar/main");
> +     edje_object_file_set(calendar->o_icon, inst->edje_module, 
> "modules/calendar/main");
>    evas_object_show(calendar->o_icon);
> -
> +
>    gcc = e_gadcon_client_new(gc, name, id, style, calendar->o_icon);
>    gcc->data = inst;
>    inst->gcc = gcc;
> @@ -152,7 +171,6 @@
>  _gc_id_new(E_Gadcon_Client_Class *client_class)
>  {
>    Config_Item *ci;
> -   Eina_List   *l;
>    const char *id;
>    char buf[128];
>    int num = 0;
> @@ -161,7 +179,7 @@
>    if (calendar_conf->items)
>      {
>        const char *p;
> -       ci = eina_list_last(calendar_conf->items)->data;
> +       ci = eina_list_data_get(eina_list_last(calendar_conf->items));
>        p = strrchr(ci->id, '.');
>        if (p) num = atoi(p + 1) + 1;
>      }
> @@ -214,6 +232,7 @@
>  static int
>  _update_date(void *data)
>  {
> +   Instance *inst;
>    Eina_List *l;
>    time_t current_time;
>    struct tm *local_time;
> @@ -228,13 +247,10 @@
>    else
>      prev_day = local_time->tm_mday;
>
> -   for (l = calendar_conf->instances; l; l = l->next)
> +   EINA_LIST_FOREACH(calendar_conf->instances, l, inst)
>      {
> -       Instance *inst;
> -
> -       inst = l->data;
>        if (!inst) continue;
> -       _update_calendar_sheet (inst);
> +       _update_calendar_sheet(inst);
>      }
>
>    return 1;
> @@ -247,7 +263,6 @@
>    char buf[5];
>    time_t current_time;
>    struct tm *local_time;
> -   int old_popup_state=0, old_popup_pinned_state=0;
>
>    if (!inst) return;
>    calendar = inst->calendar;
> @@ -262,70 +277,120 @@
>    edje_object_part_text_set (calendar->o_icon, "weekday", buf);
>
>    if (inst->popup)
> -     {
> -       old_popup_state = inst->popup->win->visible;
> -       old_popup_pinned_state = inst->popup->pinned;
> -     }
> -   _calendar_popup_content_create(inst);
> -   if (inst->popup && old_popup_state)
> -     {
> -       e_gadcon_popup_show(inst->popup);
> -       if (old_popup_pinned_state) e_gadcon_popup_toggle_pinned(inst->popup);
> -     }
> +     _calendar_popup_content_update(inst);
> +   else
> +     _calendar_popup_content_create(inst);
>  }
>
> +static const char *days[] = {
> +  "Su",
> +  "Mo",
> +  "Tu",
> +  "We",
> +  "Th",
> +  "Fr",
> +  "Sa"
> +};
> +
>  static void
> -_calendar_popup_content_create(Instance *inst)
> +_calendar_popup_content_update(Instance *inst)
>  {
> -   Evas_Object *o, *of, *ob;
> +   char buf[32];
> +
> +   evas_object_del(inst->table);
> +   inst->table = NULL;
> +
> +   _calendar_popup_content_populate(inst, &inst->displayed_time);
> +}
> +
> +static void
> +_year_minus(void *data, __UNUSED__ Evas_Object *obj, __UNUSED__ const char 
> *emission, __UNUSED__ const char *source)
> +{
> +   Instance *inst = data;
> +
> +   inst->displayed_time.tm_year--;
> +   inst->displayed_time.tm_mday = 1;
> +   _calendar_popup_content_update(inst);
> +}
> +
> +static void
> +_year_plus(void *data, __UNUSED__ Evas_Object *obj, __UNUSED__ const char 
> *emission, __UNUSED__ const char *source)
> +{
> +   Instance *inst = data;
> +
> +   inst->displayed_time.tm_year++;
> +   inst->displayed_time.tm_mday = 1;
> +   _calendar_popup_content_update(inst);
> +}
> +
> +static void
> +_month_minus(void *data, __UNUSED__ Evas_Object *obj, __UNUSED__ const char 
> *emission, __UNUSED__ const char *source)
> +{
> +   Instance *inst = data;
> +
> +   inst->displayed_time.tm_mon--;
> +   inst->displayed_time.tm_mday = 1;
> +   if (inst->displayed_time.tm_mon < 0)
> +     inst->displayed_time.tm_mon = 11;
> +   _calendar_popup_content_update(inst);
> +}
> +
> +static void
> +_month_plus(void *data, __UNUSED__ Evas_Object *obj, __UNUSED__ const char 
> *emission, __UNUSED__ const char *source)
> +{
> +   Instance *inst = data;
> +
> +   inst->displayed_time.tm_mon++;
> +   inst->displayed_time.tm_mday = 1;
> +   if (inst->displayed_time.tm_mon > 11)
> +     inst->displayed_time.tm_mon = 0;
> +   _calendar_popup_content_update(inst);
> +}
> +
> +static void
> +_calendar_popup_content_populate(Instance *inst, struct tm *time)
> +{
>    Evas *evas;
> +   Evas_Object *table;
> +   Evas_Object *o;
> +   struct tm *month_start;
> +   time_t current_time, start_time;
> +   int today, month, year, maxdays;
> +   int startwd, day;
> +   int col, row;
>    Evas_Coord mw, mh;
>    char buf[32];
> -   time_t current_time, start_time;
> -   struct tm *local_time, *local_time2;
> -   int row, col, day;
> -   int startwd, today, month, year, maxdays;
>
> -   if (inst->popup) _calendar_popup_destroy(inst);
> -   inst->popup = e_gadcon_popup_new(inst->gcc);
> +   today = time->tm_mday;
> +   month = time->tm_mon;
> +   year = time->tm_year + 1900;
>
> -   current_time = time (NULL);
> -   local_time = localtime (&current_time);
> -   today = local_time->tm_mday;
> -   month = local_time->tm_mon;
> -   year = local_time->tm_year + 1900;
>    if (!(year % 4))
>      maxdays = days_in_month[(!(year % 4) && (year % 100))][month];
>    else
>      maxdays = days_in_month[(!(year % 400))][month];
>
> +   current_time = mktime(time);
>    start_time = current_time - ((today-1) * 86400);
> -   local_time2 = localtime (&start_time);
> -   strftime (buf, sizeof(buf), "%w", local_time2);
> +   month_start = localtime (&start_time);
> +   strftime (buf, sizeof (buf), "%w", month_start);
>    startwd = atoi (buf) - inst->ci->firstweekday;
>    if (startwd < 0) startwd = 6;
>
> +   /* Set current month */
> +   strftime(buf, sizeof (buf), "%B %Y", time);
> +   e_widget_label_text_set(inst->label, buf);
> +
>    evas = inst->popup->win->evas;
> -   o = e_widget_list_add(evas, 0, 0);
> -   strftime (buf, sizeof(buf), "%B %Y", local_time);
> -   of = e_widget_frametable_add(evas, buf, 0);
>
> -   /* column titles */
> +   table = e_widget_table_add(evas, 0);
> +
> +   /* Column titles */
>    day = inst->ci->firstweekday;
> -   for (col = 0; col <= 6; col++)
> +   for (col = 0; col < sizeof (days) / sizeof (char *); ++col)
>      {
> -       switch (day)
> -         {
> -            case 0: ob = e_widget_label_add(evas, "Su"); break;
> -            case 1: ob = e_widget_label_add(evas, "Mo"); break;
> -            case 2: ob = e_widget_label_add(evas, "Tu"); break;
> -            case 3: ob = e_widget_label_add(evas, "We"); break;
> -            case 4: ob = e_widget_label_add(evas, "Th"); break;
> -            case 5: ob = e_widget_label_add(evas, "Fr"); break;
> -            case 6: ob = e_widget_label_add(evas, "Sa"); break;
> -         }
> -       e_widget_frametable_object_append(of, ob, col, 0, 1, 1, 1, 0, 0, 0);
> -       if (day++ >= 6) day = 0;
> +       o = e_widget_label_add(evas, days[(col + inst->ci->firstweekday) % 
> (sizeof (days) / sizeof (char *))]);
> +       e_widget_table_object_append(table, o, col, 0, 1, 1, 1, 0, 0, 0);
>      }
>
>    /* output days */
> @@ -343,39 +408,90 @@
>               snprintf(buf, sizeof(buf), "%02d", day++);
>             else
>               buf[0] = 0;
> -
> -            if (cday == today)
> +
> +            if (cday == inst->current_time.tm_mday
> +                && month == inst->current_time.tm_mon
> +                && time->tm_year == inst->current_time.tm_year)
>               {
> -                 char buf2[4096];
> +                 o = inst->calendar->o_today = edje_object_add(evas);
>
> -                 ob = inst->calendar->o_today = edje_object_add(evas);
> -                 snprintf(buf2, sizeof(buf2), "%s/calendar.edj",
> -                          e_module_dir_get(calendar_conf->module));
> -
> -                 if (!e_theme_edje_object_set(ob,
> -                          "base/theme/modules/calendar", 
> "modules/calendar/today"))
> -                   edje_object_file_set(ob, buf2, "modules/calendar/today");
> -                 edje_object_part_text_set(ob, "e.text.label", buf);
> -                 evas_object_show(ob);
> +                 if (!e_theme_edje_object_set(o,
> +                         "base/theme/modules/calendar", 
> "modules/calendar/today"))
> +                   edje_object_file_set(o, inst->edje_module, 
> "modules/calendar/today");
> +                 edje_object_part_text_set(o, "e.text.label", buf);
> +                 evas_object_show(o);
> +
> +                 e_widget_sub_object_add(table, o);
>               }
>             else
> -              ob = e_widget_label_add(evas, buf);
> -            e_widget_frametable_object_append(of, ob, col, row, 1, 1, 1, 0, 
> 0, 0);
> +              o = e_widget_label_add(evas, buf);
> +            e_widget_table_object_append(table, o, col, row, 1, 1, 1, 0, 0, 
> 0);
>        }
>        if (day > maxdays) break;
>      }
>
> -   e_widget_list_object_append(o, of, 1, 1, 0.5);
> -   e_widget_size_min_get(o, &mw, &mh);
> +   e_widget_list_object_append(inst->list, table, 1, 1, 0.5);
> +   e_widget_size_min_get(inst->list, &mw, &mh);
>    if ((double) mw / mh > GOLDEN_RATIO)
>      mh = mw / GOLDEN_RATIO;
>    else if ((double) mw / mh < GOLDEN_RATIO - (double) 1)
>      mw = mh * (GOLDEN_RATIO - (double) 1);
> +   evas_object_size_hint_min_set(inst->list, mw, mh);
>
> -   e_gadcon_popup_content_set(inst->popup, o);
> +   inst->table = table;
>  }
>
>  static void
> +_calendar_popup_content_create(Instance *inst)
> +{
> +   Evas_Object *list, *label, *oe, *ow;
> +   Evas *evas;
> +   Evas_Coord mw, mh;
> +   time_t current_time;
> +   struct tm *local_time;
> +
> +   if (inst->popup) _calendar_popup_destroy(inst);
> +   inst->popup = e_gadcon_popup_new(inst->gcc);
> +
> +   current_time = time (NULL);
> +   local_time = localtime_r(&current_time, &inst->displayed_time);
> +   inst->current_time = inst->displayed_time;
> +
> +   evas = inst->popup->win->evas;
> +   list = e_widget_list_add(evas, 0, 0);
> +
> +   label = e_widget_label_add(evas, NULL);
> +
> +   oe = edje_object_add(evas);
> +   if (!e_theme_edje_object_set(oe,
> +                               "base/theme/modules/calendar", 
> "modules/calendar/header"))
> +     edje_object_file_set(oe, inst->edje_module, "modules/calendar/header");
> +   edje_object_part_swallow(oe, "content", label);
> +   edje_object_signal_callback_add(oe, "year", "minus", _year_minus, inst);
> +   edje_object_signal_callback_add(oe, "year", "plus", _year_plus, inst);
> +   edje_object_signal_callback_add(oe, "month", "minus", _month_minus, inst);
> +   edje_object_signal_callback_add(oe, "month", "plus", _month_plus, inst);
> +   evas_object_show(oe);
> +
> +   ow = e_widget_add(evas);
> +   e_widget_data_set(ow, NULL);
> +   edje_object_size_min_get(oe, &mw, &mh);
> +   e_widget_size_min_set(ow, mw, mh);
> +   e_widget_sub_object_add(ow, oe);
> +   e_widget_resize_object_set(ow, oe);
> +   evas_object_show(ow);
> +
> +   e_widget_list_object_append(list, ow, 1, 1, 0.5);
> +
> +   inst->list = list;
> +   inst->label = label;
> +
> +   _calendar_popup_content_populate(inst, local_time);
> +
> +   e_gadcon_popup_content_set(inst->popup, inst->list);
> +}
> +
> +static void
>  _calendar_popup_destroy(Instance *inst)
>  {
>    if (!inst->popup) return;
> @@ -383,15 +499,20 @@
>  }
>
>  static void
> +_calendar_popup_cleanup(Instance *inst)
> +{
> +   if (!inst->table) return;
> +   e_object_del(E_OBJECT(inst->table));
> +}
> +
> +static void
>  _cb_action(E_Object *obj, const char *params)
>  {
>    Eina_List *l;
> +   Instance *inst;
>
> -   for (l = calendar_conf->instances; l; l = l->next)
> +   EINA_LIST_FOREACH(calendar_conf->instances, l, inst)
>      {
> -       Instance *inst;
> -
> -       inst = l->data;
>        if (!inst) continue;
>        if (!inst->popup) continue;
>        if (inst->popup->win->visible)
> @@ -416,11 +537,11 @@
>    e_gadcon_popup_show(inst->popup);
>  }
>
> -static void
> +static void
>  _cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info)
>  {
>    Instance *inst;
> -
> +
>    if (!(inst = data)) return;
>    e_gadcon_popup_hide(inst->popup);
>  }
> @@ -445,7 +566,7 @@
>
>        mn = e_menu_new();
>        calendar_conf->menu_firstweekday = mn;
> -
> +
>        mi = e_menu_item_new(mn);
>        e_menu_item_label_set(mi, D_("Sunday"));
>        e_menu_item_radio_set(mi, 1);
> @@ -478,7 +599,7 @@
>                              E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
>         evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button,
>                                 EVAS_BUTTON_NONE, ev->timestamp, NULL);
> -     }
> +     }
>  }
>
>  static void
>
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> enlightenment-svn mailing list
> enlightenment-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to