示例#1
0
static void
key_handler(void *data, Evas * evas, Evas_Object * obj, void *event_info)
{
    eoi_help_info_t *info = data;

    if (!info->navigation) {
        char *app;
        if (!asprintf(&app, "help/%s", info->application))
            err(1, "asprintf");
        info->navigation = keys_alloc(app);
        free(app);
    }

    if (!info->keys)
        info->keys = keys_alloc("eoi_help");


    const char *action =
        keys_lookup_by_event(info->navigation,
                             eina_list_data_get(info->history),
                             event_info);

    if (action && strlen(action)) {
        load_page(info, action);
        return;
    }

    action = keys_lookup_by_event(info->keys, "default", event_info);
    if (!action || !strlen(action))
        return;

    if (!strcmp(action, "PageDown"))
        eoi_textbox_page_next(info->textbox);
    else if (!strcmp(action, "PageUp"))
        eoi_textbox_page_prev(info->textbox);
    else if (!strcmp(action, "Back")) {
        if (eina_list_prev(info->history)) {
            free(eina_list_data_get(info->history));
            info->history = eina_list_prev(info->history);
            char *page = strdup(eina_list_data_get(info->history));
            info->history =
                eina_list_remove_list(info->history,
                                      eina_list_next(info->history));

            free(eina_list_data_get(info->history));
            info->history = eina_list_prev(info->history);
            info->history =
                eina_list_remove_list(info->history,
                                      eina_list_next(info->history));

            load_page(info, page);
            free(page);
        } else
            eoi_help_free(info->textbox);
    } else if (!strcmp(action, "Close"))
        eoi_help_free(info->textbox);
}
示例#2
0
文件: eina_list.c 项目: jigpu/efl
static Eina_Bool
eina_list_accessor_get_at(Eina_Accessor_List *it, unsigned int idx, void **data)
{
   const Eina_List *over;
   unsigned int middle;
   unsigned int i;

   EINA_MAGIC_CHECK_LIST_ACCESSOR(it, EINA_FALSE);

   if (idx >= eina_list_count(it->head))
     return EINA_FALSE;

   if (it->index == idx)
     over = it->current;
   else if (idx > it->index)
     {
        /* After current position. */
        middle = ((eina_list_count(it->head) - it->index) >> 1) + it->index;

        if (idx > middle)
          /* Go backward from the end. */
          for (i = eina_list_count(it->head) - 1,
               over = eina_list_last(it->head);
               i > idx && over;
               --i, over = eina_list_prev(over))
            ;
        else
          /* Go forward from current. */
          for (i = it->index, over = it->current;
               i < idx && over;
               ++i, over = eina_list_next(over))
            ;
     }
示例#3
0
文件: eina_list_04.c 项目: Limsik/e17
int
main(int argc, char **argv)
{
   Eina_List *list = NULL;
   Eina_List *l;
   void *list_data;

   eina_init();

   list = eina_list_append(list, eina_stringshare_add("calvin"));
   list = eina_list_append(list, eina_stringshare_add("Leoben"));
   list = eina_list_append(list, eina_stringshare_add("D'Anna"));
   list = eina_list_append(list, eina_stringshare_add("Simon"));
   list = eina_list_append(list, eina_stringshare_add("Doral"));
   list = eina_list_append(list, eina_stringshare_add("Six"));
   list = eina_list_append(list, eina_stringshare_add("Sharon"));

   for(l = list; l; l = eina_list_next(l))
     printf("%s\n", (char*)l->data);

   for(l = eina_list_last(list); l; l = eina_list_prev(l))
      printf("%s\n", (char*)eina_list_data_get(l));

   EINA_LIST_FREE(list, list_data)
     eina_stringshare_del(list_data);

   eina_shutdown();

   return 0;
}
static void
_cb_feed_down(void *data, void *data2)
{
   E_Config_Dialog_Data *cfdata;
   News_Feed *f;
   News_Item *ni;
   News_Feed_Ref *ref;
   Eina_List *sel, *l, *lf;

   cfdata = data;
   ni = cfdata->ni;

   for (sel=eina_list_last(cfdata->ilist_selected_feeds_sel); sel; sel=eina_list_prev(sel))
     {
        f = sel->data;
        ref = news_feed_ref_find(f, ni);
        if (!ref) return;

        l = eina_list_data_find_list(ni->config->feed_refs, ref);
        lf = eina_list_next(l);
        if (!lf) return;
  
        ni->config->feed_refs = eina_list_remove_list(ni->config->feed_refs, l);
        ni->config->feed_refs = eina_list_append_relative_list(ni->config->feed_refs,
                                                               ref, lf);
     }

   news_item_refresh(ni, 1, 0, 0);
   news_config_dialog_item_content_refresh_selected_feeds(ni);
}
示例#5
0
static void
_elm_code_widget_undo_prev_clear(Evas_Object *widget)
{
   Elm_Code_Widget_Data *pd;
   Elm_Code_Widget_Change_Info *info;
   Eina_List *list;

   pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS);
   if (!pd->undo_stack_ptr)
     return;

   for (list = eina_list_prev(pd->undo_stack_ptr); list; list = eina_list_prev(list))
     {
        info = eina_list_data_get(list);
        free(info->content);
        free(info);
     }
}
示例#6
0
文件: eina_list.c 项目: jigpu/efl
static Eina_Bool
eina_list_iterator_prev(Eina_Iterator_List *it, void **data)
{
   EINA_MAGIC_CHECK_LIST_ITERATOR(it, EINA_FALSE);

   if (!it->current)
     return EINA_FALSE;

   *data = eina_list_data_get(it->current);

   it->current = eina_list_prev(it->current);

   return EINA_TRUE;
}
示例#7
0
static void
_on_key_down(void *data, Evas *e, Evas_Object *o, void *event_info)
{
    Evas_Event_Key_Down *ev = event_info;
    Evas_Object *em = data;

    if (!strcmp(ev->keyname, "Return"))
    {
        emotion_object_play_set(em, EINA_TRUE);
    }
    else if (!strcmp(ev->keyname, "space"))
    {
        emotion_object_play_set(em, EINA_FALSE);
    }
    else if (!strcmp(ev->keyname, "Escape"))
    {
        ecore_main_loop_quit();
    }
    else if (!strcmp(ev->keyname, "t"))
    {
        int w, h;
        emotion_object_size_get(em, &w, &h);
        fprintf(stderr, "example -> size: %dx%d\n", w, h);
    }
    else if (!strcmp(ev->keyname, "s"))
    {
        float len, pos;
        len = emotion_object_play_length_get(em);
        pos = 0.98 * len;
        fprintf(stderr, "skipping to position %0.3f\n", pos);
        emotion_object_position_set(em, pos);
    }
    else if (!strcmp(ev->keyname, "1"))
    {
        fprintf(stderr, "setting speed to 1.0\n");
        emotion_object_play_speed_set(em, 1.0);
    }
    else if (!strcmp(ev->keyname, "2"))
    {
        fprintf(stderr, "setting speed to 2.0\n");
        emotion_object_play_speed_set(em, 2.0);
    }
    else if (!strcmp(ev->keyname, "n"))
    {
        const char *file;
        if (!curfile)
            curfile = filenames;
        else
            curfile = eina_list_next(curfile);
        file = eina_list_data_get(curfile);
        fprintf(stderr, "playing next file: %s\n", file);
        emotion_object_file_set(em, file);
    }
    else if (!strcmp(ev->keyname, "p"))
    {
        const char *file;
        if (!curfile)
            curfile = eina_list_last(filenames);
        else
            curfile = eina_list_prev(curfile);
        file = eina_list_data_get(curfile);
        fprintf(stderr, "playing next file: %s\n", file);
        emotion_object_file_set(em, file);
    }
    else if (!strcmp(ev->keyname, "d"))
    {
        evas_object_del(em);
    }
    else if (!strcmp(ev->keyname, "l"))
    {
        // force frame dropping
        sleep(5);
    }
    else
    {
        fprintf(stderr, "unhandled key: %s\n", ev->keyname);
    }
}