elemntary: mr proper with council from SeoZ. Add _MODE_ to the enum
authoryoz <yoz@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 19 Apr 2012 09:03:59 +0000 (09:03 +0000)
committeryoz <yoz@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 19 Apr 2012 09:03:59 +0000 (09:03 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@70326 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/bin/test_calendar.c
src/lib/elm_calendar.c
src/lib/elm_calendar.h

index d7995f4..153cf7e 100644 (file)
@@ -70,7 +70,7 @@ set_api_state(api_data *api)
               time_t sec_per_day = (60*60*24);
               time_t sec_per_year = sec_per_day * 365;
               time_t the_time = (sec_per_year * 41) + (sec_per_day * 10); /* Set date to JAN 01, 2011 */
-              elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_NONE);
+              elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_MODE_NONE);
               elm_calendar_selected_time_set(cal, gmtime(&the_time));
            }
          break;
@@ -81,7 +81,7 @@ set_api_state(api_data *api)
               time_t sec_per_year = sec_per_day * 365;
               time_t the_time = (sec_per_year * 41) + (sec_per_day * 40); /* Set date to FEB 01, 2011 */
               elm_calendar_marks_clear(cal);
-              elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_NONE);
+              elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_MODE_NONE);
               elm_calendar_selected_time_set(cal, gmtime(&the_time));
            }
          break;
@@ -174,7 +174,7 @@ _print_cal_info(Evas_Object *cal, Evas_Object *en)
 
    interval = elm_calendar_interval_get(cal);
    elm_calendar_min_max_year_get(cal, &year_min, &year_max);
-   sel_enabled = !!(elm_calendar_select_mode_get(cal) != ELM_CALENDAR_SELECT_NONE);
+   sel_enabled = !!(elm_calendar_select_mode_get(cal) != ELM_CALENDAR_SELECT_MODE_NONE);
    wds = elm_calendar_weekdays_names_get(cal);
 
    snprintf(info, sizeof(info),
@@ -241,7 +241,7 @@ test_calendar2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i
    cal2 = elm_calendar_add(win);
    evas_object_size_hint_weight_set(cal2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(cal2, EVAS_HINT_FILL, EVAS_HINT_FILL);
-   elm_calendar_select_mode_set(cal2, ELM_CALENDAR_SELECT_NONE);
+   elm_calendar_select_mode_set(cal2, ELM_CALENDAR_SELECT_MODE_NONE);
    evas_object_show(cal2);
    elm_box_pack_end(bxh, cal2);
 
@@ -322,35 +322,13 @@ test_calendar3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i
    elm_win_resize_object_add(win, bxx);
    evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_show(bxx);
-   /*
-
-   bx = elm_box_add(win);
-   evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-   api->box = bx;
-   evas_object_show(bx);
-
-   bt = elm_button_add(win);
-   elm_object_text_set(bt, "Next API function");
-   evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api);
-   elm_box_pack_end(bxx, bt);
-   elm_object_disabled_set(bt, api->state == API_STATE_LAST);
-   evas_object_show(bt);
-
-   elm_box_pack_end(bxx, bx);
-   */
 
    cal = elm_calendar_add(win);
    elm_calendar_first_day_of_week_set(cal, ELM_DAY_THURSDAY);
-   elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_ONDEMAND);
+   elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_MODE_ONDEMAND);
    evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    elm_box_pack_end(bxx, cal);
-//
-//   time_t sec_per_day = (60*60*24);
-//   time_t sec_per_year = sec_per_day * 365;
-//   time_t the_time = (sec_per_year * 41) + (sec_per_day * 9); /* Set date to DEC 31, 2010 */
-//   elm_calendar_selected_time_set(cal, gmtime(&the_time));
-//   elm_calendar_min_max_year_set(cal, 2010, 2012);
-//
+
    evas_object_show(cal);
 
    evas_object_show(win);
index 3b65ce0..f90d8fe 100644 (file)
@@ -302,7 +302,8 @@ _populate(Evas_Object *obj)
              if ((wd->selected_it > -1) && (wd->selected_it != i))
                _unselect(wd, wd->selected_it);
 
-             if (wd->select_mode != ELM_CALENDAR_SELECT_NONE) _select(wd, i);
+             if (wd->select_mode != ELM_CALENDAR_SELECT_MODE_NONE)
+               _select(wd, i);
 
              wd->selected_it = i;
           }
@@ -600,7 +601,7 @@ _update_sel_it(Evas_Object *obj, int sel_it)
 {
    int day;
    Widget_Data *wd = elm_widget_data_get(obj);
-   if ((!wd) || (wd->select_mode == ELM_CALENDAR_SELECT_NONE))
+   if ((!wd) || (wd->select_mode == ELM_CALENDAR_SELECT_MODE_NONE))
      return;
 
    day = _get_item_day(obj, sel_it);
@@ -621,7 +622,7 @@ _day_selected(void *data, Evas_Object *obj __UNUSED__, const char *emission __UN
 {
    int sel_it;
    Widget_Data *wd = elm_widget_data_get(data);
-   if ((!wd) || (wd->select_mode == ELM_CALENDAR_SELECT_NONE))
+   if ((!wd) || (wd->select_mode == ELM_CALENDAR_SELECT_MODE_NONE))
      return;
    sel_it = atoi(source);
 
@@ -668,7 +669,7 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type ty
 
    if (!wd) return EINA_FALSE;
    if (elm_widget_disabled_get(obj)) return EINA_FALSE;
-   if (wd->select_mode ==  ELM_CALENDAR_SELECT_NONE) return EINA_FALSE;
+   if (wd->select_mode ==  ELM_CALENDAR_SELECT_MODE_NONE) return EINA_FALSE;
 
    if ((!strcmp(ev->keyname, "Left")) ||
        ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string)))
@@ -867,9 +868,9 @@ EINA_DEPRECATED EAPI void
 elm_calendar_day_selection_disabled_set(Evas_Object *obj, Eina_Bool disabled)
 {
    if (disabled)
-     elm_calendar_select_mode_set(obj, ELM_CALENDAR_SELECT_NONE);
+     elm_calendar_select_mode_set(obj, ELM_CALENDAR_SELECT_MODE_NONE);
    else
-     elm_calendar_select_mode_set(obj, ELM_CALENDAR_SELECT_DEFAULT);
+     elm_calendar_select_mode_set(obj, ELM_CALENDAR_SELECT_MODE_DEFAULT);
 }
 
 EINA_DEPRECATED EAPI Eina_Bool
@@ -878,7 +879,7 @@ elm_calendar_day_selection_disabled_get(const Evas_Object *obj)
    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
    Widget_Data *wd = elm_widget_data_get(obj);
    if (!wd) return EINA_FALSE;
-   return !!(wd->select_mode == ELM_CALENDAR_SELECT_NONE);
+   return !!(wd->select_mode == ELM_CALENDAR_SELECT_MODE_NONE);
 }
 
 EAPI void
@@ -1005,12 +1006,12 @@ elm_calendar_select_mode_set(Evas_Object *obj, Elm_Calendar_Select_Mode mode)
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
    if (!wd) return;
-   if ((mode >= ELM_CALENDAR_SELECT_DEFAULT)
-       && (mode <= ELM_CALENDAR_SELECT_ONDEMAND)
+   if ((mode >= ELM_CALENDAR_SELECT_MODE_DEFAULT)
+       && (mode <= ELM_CALENDAR_SELECT_MODE_ONDEMAND)
        && (wd->select_mode != mode))
      {
         wd->select_mode = mode;
-        if (wd->select_mode == ELM_CALENDAR_SELECT_ALWAYS)
+        if (wd->select_mode == ELM_CALENDAR_SELECT_MODE_ALWAYS)
           _select(wd, wd->selected_it);
         else
           _unselect(wd, wd->selected_it);
index c33d050..6778018 100644 (file)
@@ -89,10 +89,10 @@ typedef _Elm_Calendar_Weekday Elm_Calendar_Weekday;
 
 typedef enum
 {
-   ELM_CALENDAR_SELECT_DEFAULT = 0, /**< Default value. a day is always selected. */
-   ELM_CALENDAR_SELECT_ALWAYS, /**< a day is always selected. */
-   ELM_CALENDAR_SELECT_NONE, /**< None of the days can be selected. */
-   ELM_CALENDAR_SELECT_ONDEMAND /**< User may have selected a day or not. (not supported yet)*/
+   ELM_CALENDAR_SELECT_MODE_DEFAULT = 0, /**< Default value. a day is always selected. */
+   ELM_CALENDAR_SELECT_MODE_ALWAYS, /**< a day is always selected. */
+   ELM_CALENDAR_SELECT_MODE_NONE, /**< None of the days can be selected. */
+   ELM_CALENDAR_SELECT_MODE_ONDEMAND /**< User may have selected a day or not. (not supported yet)*/
 } _Elm_Calendar_Select_Mode;
 
 /**