yes libc give already some func, no need to add an algo for that. look for
strrchr or memrchr. Last one is better


2014-04-07 16:44 GMT+02:00 Sebastian Dransfeld <s...@tango.flipp.net>:

> strrchr
>
> Sendt fra min iPad
>
> > Den Apr 7, 2014 kl. 14:30 skrev Marcel Hollerbach <
> marcel-hollerb...@t-online.de>:
> >
> > I use them in entrance_conf_main.c and entrance_conf_user.c, so where
> > should I put the macro ?
> >
> > The group has the name entrance/wallpaper/foo
> >
> > I just want to display foo so I need something which returns me "foo"
> > ecore_file_file_get does that, but okay, I will do it different.
> >
> >
> >> On Mon, Apr 07, 2014 at 02:19:13PM +0200, Michaël Bouchaud wrote:
> >> nothing to do in a .h if you are using in one place. It's a design
> request.
> >> And a macro calling another macro is just a wrong design. Or you target
> is
> >> to write unmaintainable code.
> >> ecore_file is for file and nothing else ...
> >> Write a little algo to find last / ???
> >>
> >>
> >> 2014-04-07 12:57 GMT+02:00 Marcel Hollerbach <
> marcel-hollerb...@t-online.de>
> >> :
> >>
> >>>
> >>>
> >>>> On Mon, Apr 07, 2014 at 10:42:20AM +0200, Michaël Bouchaud wrote:
> >>>> Please split you patch. why adding a macro used nowhere in this patch
> ?
> >>> I am using this macro in the user settings and the general settings.
> >>> Should I put them in the headers od the user and general settings ?
> >>>> And stop to cut and paste some code. A group isn't a file ... Try to
> >>> give a
> >>>> better quality in your patch
> >>> I never copy and paste that, I wanted to ecore_file_file_get cause it
> is
> >>> just returning the last substring after the last "/". Of course I can
> >>> write a little algo to do the same.
> >>>>
> >>>>
> >>>> 2014-04-02 17:55 GMT+02:00 Marcel Hollerbach <
> >>> marcel.hollerb...@stzedn.de>:
> >>>>
> >>>>> bu5hm4n pushed a commit to branch master.
> >>>
> http://git.enlightenment.org/misc/entrance.git/commit/?id=cf5c4cf46a598925bcd9549e04f141903c3871b4
> >>>>>
> >>>>> commit cf5c4cf46a598925bcd9549e04f141903c3871b4
> >>>>> Author: Marcel Hollerbach <marcel.hollerb...@stzedn.de>
> >>>>> Date:   Wed Apr 2 12:18:47 2014 +0200
> >>>>>
> >>>>>    entrance: Updated the entrance_conf.c
> >>>>>
> >>>>>         - backgrounds are hold in pools, no need to generate them
> >>> there
> >>>>>
> >>>>>         - New Textes for the Items are used
> >>>>>
> >>>>>         - Lets use the thumb style in the settings pane
> >>>>>
> >>>>>         - There is a macro to get Entrance_Image structs to
> >>>>>           Entrance_Conf_Background struct (in lists)
> >>>>> ---
> >>>>> src/bin/entrance_conf.c | 121
> >>>>> +++++++++++++++++++-----------------------------
> >>>>> src/bin/entrance_conf.h |  16 ++++++-
> >>>>> 2 files changed, 63 insertions(+), 74 deletions(-)
> >>>>>
> >>>>> diff --git a/src/bin/entrance_conf.c b/src/bin/entrance_conf.c
> >>>>> index 4d0623f..979c6a0 100644
> >>>>> --- a/src/bin/entrance_conf.c
> >>>>> +++ b/src/bin/entrance_conf.c
> >>>>> @@ -76,7 +76,44 @@ _entrance_conf_end(Evas_Object *win)
> >>>>>    _entrance_conf->current = NULL;
> >>>>> }
> >>>>>
> >>>>> -static void
> >>>>> +void
> >>>>> +entrance_conf_background_title_gen(Entrance_Conf_Background *cbg)
> >>>>> +{
> >>>>> +   char buf[PATH_MAX];
> >>>>> +   char *group_suffix = NULL, *result;
> >>>>> +   const char *filename = NULL;
> >>>>> +
> >>>>> +   if (cbg->path)
> >>>>> +     {
> >>>>> +        filename = ecore_file_file_get(cbg->path);
> >>>>> +     }
> >>>>> +
> >>>>> +   if (cbg->group)
> >>>>> +     {
> >>>>> +        group_suffix = ecore_file_file_get(cbg->group);
> >>>>> +     }
> >>>>> +
> >>>>> +   if ((group_suffix) && (filename))
> >>>>> +     {
> >>>>> +        snprintf(buf, sizeof(buf), "%s - %s", filename,
> group_suffix);
> >>>>> +     }
> >>>>> +   else if (group_suffix)
> >>>>> +     {
> >>>>> +        snprintf(buf, sizeof(buf), "%s", group_suffix);
> >>>>> +     }
> >>>>> +   else if(filename)
> >>>>> +     {
> >>>>> +        snprintf(buf, sizeof(buf), "%s", filename);
> >>>>> +     }
> >>>>> +   else
> >>>>> +     {
> >>>>> +        snprintf(buf, sizeof(buf), "None");
> >>>>> +     }
> >>>>> +
> >>>>> +   cbg->name = eina_stringshare_add(buf);
> >>>>> +}
> >>>>> +
> >>>>> +  static void
> >>>>> _entrance_conf_promote(Entrance_Conf_Module *conf)
> >>>>> {
> >>>>>    elm_naviframe_item_promote(conf->item);
> >>>>> @@ -126,12 +163,15 @@ _entrance_conf_bg_content_get(void *data,
> >>>>> Evas_Object *obj, const char *part)
> >>>>>    cbg = data;
> >>>>>    if (part && !strcmp("elm.swallow.icon", part))
> >>>>>      {
> >>>>> -        o = elm_image_add(obj);
> >>>>> -        elm_image_file_set(o, cbg->path, cbg->group);
> >>>>> -        elm_image_smooth_set(o, EINA_FALSE);
> >>>>> -        evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND,
> >>>>> -                                         EVAS_HINT_EXPAND);
> >>>>> -        evas_object_show(o);
> >>>>> +        if (cbg->path || cbg->group)
> >>>>> +          {
> >>>>> +             o = elm_image_add(obj);
> >>>>> +             elm_image_file_set(o, cbg->path, cbg->group);
> >>>>> +             elm_image_smooth_set(o, EINA_FALSE);
> >>>>> +             evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND,
> >>>>> +                                              EVAS_HINT_EXPAND);
> >>>>> +             evas_object_show(o);
> >>>>> +          }
> >>>>>      }
> >>>>>    return o;
> >>>>> }
> >>>>> @@ -160,7 +200,7 @@ entrance_conf_init(void)
> >>>>>    PT("conf init\n");
> >>>>>    _entrance_conf = calloc(1, sizeof(Entrance_Int_Conf));
> >>>>>    _entrance_conf->background_fill =
> >>>>> -      entrance_fill_new("default",
> >>>>> +      entrance_fill_new("thumb",
> >>>>>                         _entrance_conf_bg_text_get,
> >>>>>                         _entrance_conf_bg_content_get,
> >>>>>                         _entrance_conf_bg_state_get,
> >>>>> @@ -305,71 +345,6 @@ entrance_conf_changed(void)
> >>>>>      }
> >>>>> }
> >>>>>
> >>>>> -Eina_List *
> >>>>> -entrance_conf_backgrounds_get(Evas_Object *obj, const char *user)
> >>>>> -{
> >>>>> -   Evas_Object *o, *edj;
> >>>>> -   Eina_List *list, *l, *nl = NULL;
> >>>>> -   Entrance_Conf_Background *cbg;
> >>>>> -   const char *str;
> >>>>> -   const char *path;
> >>>>> -   char buf[PATH_MAX];
> >>>>> -   Eina_Iterator *it;
> >>>>> -
> >>>>> -   o = entrance_gui_theme_get(obj, "entrance/background");
> >>>>> -   edj = elm_layout_edje_get(o);
> >>>>> -   edje_object_file_get(edj, &path, NULL);
> >>>>> -   list = entrance_gui_stringlist_get(edje_object_data_get(edj,
> >>> "items"));
> >>>>> -   EINA_LIST_FOREACH(list, l, str)
> >>>>> -     {
> >>>>> -        cbg = calloc(1, sizeof(Entrance_Conf_Background));
> >>>>> -        snprintf(buf, sizeof(buf),
> >>>>> -                 "entrance/background/%s", str);
> >>>>> -
> >>>>> -        cbg->path = eina_stringshare_add(path);
> >>>>> -        cbg->group = eina_stringshare_add(buf);
> >>>>> -        cbg->name = eina_stringshare_add(str);
> >>>>> -        nl = eina_list_append(nl, cbg);
> >>>>> -     }
> >>>>> -   entrance_gui_stringlist_free(list);
> >>>>> -   evas_object_del(o);
> >>>>> -
> >>>>> -   it = eina_file_ls(PACKAGE_DATA_DIR"/backgrounds");
> >>>>> -   EINA_ITERATOR_FOREACH(it, str)
> >>>>> -     {
> >>>>> -        int len;
> >>>>> -        len = strlen(str);
> >>>>> -        if (len < 4) continue;
> >>>>> -        if (!strcmp(&str[len-4], ".edj"))
> >>>>> -          {
> >>>>> -             cbg = calloc(1, sizeof(Entrance_Conf_Background));
> >>>>> -             snprintf(buf, sizeof(buf),
> >>>>> -                      "entrance/background/%s", str);
> >>>>> -             cbg->path = str;
> >>>>> -             /* TODO use entrance/desktop/background or
> >>>>> e/desktop/background */
> >>>>> -             cbg->group =
> >>> eina_stringshare_add("e/desktop/background");
> >>>>> -               {
> >>>>> -                  char *name, *p;
> >>>>> -                  name = strrchr(str, '/');
> >>>>> -                  if (name)
> >>>>> -                    {
> >>>>> -                       name++;
> >>>>> -                       name = strdupa(name);
> >>>>> -                       p = strrchr(name, '.');
> >>>>> -                       if (p) *p = '\0';
> >>>>> -                    }
> >>>>> -                  cbg->name = eina_stringshare_add(name);
> >>>>> -               }
> >>>>> -             nl = eina_list_append(nl, cbg);
> >>>>> -          }
> >>>>> -        else
> >>>>> -          eina_stringshare_del(str);
> >>>>> -     }
> >>>>> -   eina_iterator_free(it);
> >>>>> -
> >>>>> -   return nl;
> >>>>> -}
> >>>>> -
> >>>>> Entrance_Fill *
> >>>>> entrance_conf_background_fill_get(void)
> >>>>> {
> >>>>> diff --git a/src/bin/entrance_conf.h b/src/bin/entrance_conf.h
> >>>>> index 8082bea..73ea6cc 100644
> >>>>> --- a/src/bin/entrance_conf.h
> >>>>> +++ b/src/bin/entrance_conf.h
> >>>>> @@ -8,6 +8,20 @@ typedef struct Entrance_Conf_Background_
> >>>>>    const char *name;
> >>>>> } Entrance_Conf_Background;
> >>>>>
> >>>>> +#define IMG_LIST_FORK(l_src, l_dest) \
> >>>>> +  do { \
> >>>>> +  Entrance_Image *ptr; \
> >>>>> +  Entrance_Conf_Background *tmp_ptr; \
> >>>>> +  EINA_LIST_FOREACH(l_src, node, ptr) \
> >>>>> +   { \
> >>>>> +     tmp_ptr = malloc(sizeof(Entrance_Conf_Background)); \
> >>>>> +     tmp_ptr->path = eina_stringshare_add(ptr->path); \
> >>>>> +     tmp_ptr->group = eina_stringshare_add(ptr->group); \
> >>>>> +     entrance_conf_background_title_gen(tmp_ptr);\
> >>>>> +     l_dest = eina_list_append(l_dest, tmp_ptr); \
> >>>>> +   } \
> >>>>> +  }while(0);
> >>>>> +
> >>>>> typedef void (*Entrance_Conf_Begin) (void);
> >>>>> typedef void (*Entrance_Conf_End) (void);
> >>>>> typedef Evas_Object *(*Entrance_Conf_Build) (Evas_Object *obj);
> >>>>> @@ -19,7 +33,7 @@ void entrance_conf_shutdown(void);
> >>>>> void entrance_conf_module_register(const char *label,
> >>> Entrance_Conf_Begin
> >>>>> begin, Entrance_Conf_End end, Entrance_Conf_Build build,
> >>>>> Entrance_Conf_Check check, Entrance_Conf_Apply apply);
> >>>>> void entrance_conf_begin(Evas_Object *obj, Evas_Object *parent);
> >>>>> void entrance_conf_changed(void);
> >>>>> -Eina_List *entrance_conf_backgrounds_get(Evas_Object *obj, const
> char
> >>>>> *user);
> >>>>> +void entrance_conf_background_title_gen(Entrance_Conf_Background
> >>> *ptr);
> >>>>> Entrance_Fill *entrance_conf_background_fill_get(void);
> >>>>>
> >>>>>
> >>>>>
> >>>>> --
> >>>>
> >>>>
> >>>> --
> >>>> Michaël Bouchaud (yoz) <y...@efl.so>
> >>>
> ------------------------------------------------------------------------------
> >>>> Put Bad Developers to Shame
> >>>> Dominate Development with Jenkins Continuous Integration
> >>>> Continuously Automate Build, Test & Deployment
> >>>> Start a new project now. Try Jenkins in the cloud.
> >>>> http://p.sf.net/sfu/13600_Cloudbees_APR
> >>>> _______________________________________________
> >>>> enlightenment-devel mailing list
> >>>> enlightenment-devel@lists.sourceforge.net
> >>>> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> >>>
> >>>
> >>>
> ------------------------------------------------------------------------------
> >>> Put Bad Developers to Shame
> >>> Dominate Development with Jenkins Continuous Integration
> >>> Continuously Automate Build, Test & Deployment
> >>> Start a new project now. Try Jenkins in the cloud.
> >>> http://p.sf.net/sfu/13600_Cloudbees_APR
> >>> _______________________________________________
> >>> enlightenment-devel mailing list
> >>> enlightenment-devel@lists.sourceforge.net
> >>> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> >>
> >>
> >>
> >> --
> >> Michaël Bouchaud (yoz) <y...@efl.so>
> >>
> ------------------------------------------------------------------------------
> >> Put Bad Developers to Shame
> >> Dominate Development with Jenkins Continuous Integration
> >> Continuously Automate Build, Test & Deployment
> >> Start a new project now. Try Jenkins in the cloud.
> >> http://p.sf.net/sfu/13600_Cloudbees_APR
> >> _______________________________________________
> >> enlightenment-devel mailing list
> >> enlightenment-devel@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> >
> >
> ------------------------------------------------------------------------------
> > Put Bad Developers to Shame
> > Dominate Development with Jenkins Continuous Integration
> > Continuously Automate Build, Test & Deployment
> > Start a new project now. Try Jenkins in the cloud.
> > http://p.sf.net/sfu/13600_Cloudbees_APR
> > _______________________________________________
> > enlightenment-devel mailing list
> > enlightenment-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>
>
> ------------------------------------------------------------------------------
> Put Bad Developers to Shame
> Dominate Development with Jenkins Continuous Integration
> Continuously Automate Build, Test & Deployment
> Start a new project now. Try Jenkins in the cloud.
> http://p.sf.net/sfu/13600_Cloudbees_APR
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>



-- 
Michaël Bouchaud (yoz) <y...@efl.so>
------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees_APR
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to