On Sat, 16 Jul 2011 07:45:41 -0700
"Enlightenment SVN" <no-re...@enlightenment.org> wrote:

> Log:
> elm_config gains a new feature: multitheme selection! themes are added in the
> order of selection, so to use an overlay for a theme you would select the
> "base" theme first, then the "overlay" part. then just click use theme and
> zooooooooooooooooooon 
> 
> Author:       discomfitor
> Date:         2011-07-16 07:45:41 -0700 (Sat, 16 Jul 2011)
> New Revision: 61426
> Trac:         http://trac.enlightenment.org/e/changeset/61426
> 
> Modified:
>   trunk/elementary/src/bin/config.c 
> 
> Modified: trunk/elementary/src/bin/config.c
> ===================================================================
> --- trunk/elementary/src/bin/config.c 2011-07-16 14:27:33 UTC (rev
> 61425) +++ trunk/elementary/src/bin/config.c  2011-07-16 14:45:41 UTC
> (rev 61426) @@ -17,7 +17,7 @@
>     Eina_Bool   in_search_path;
>  };
>  
> -static Theme *tsel = NULL;
> +static const Eina_List *tsel = NULL;
>  static Eina_List *themes = NULL;
>  
>  struct _Elm_Text_Class_Data
> @@ -1063,28 +1063,13 @@
>             void *event_info __UNUSED__)
>  {
>     const char *defth;
> -   char *newth;
> -   Theme *t = tsel;
> +   Elm_Theme *th;
> +   Evas_Object *win = elm_object_top_widget_get(obj);
> +   Evas_Object *sample = evas_object_data_get(win, "theme_preview");
>  
> -   if (!t) return;
> -   defth = elm_theme_get(NULL);
> -   newth = malloc(strlen(defth) + 1 + strlen(t->name) + 1);
> -   if (newth)
> -     {
> -        char *rest;
> -
> -        newth[0] = 0;
> -        rest = strchr(defth, ':');
> -        if (!rest)
> -          strcpy(newth, t->name);
> -        else
> -          {
> -             strcpy(newth, t->name);
> -             strcat(newth, rest);
> -          }
> -        elm_theme_all_set(newth);
> -        free(newth);
> -     }
> +   th = elm_object_theme_get(sample);
> +   defth = elm_theme_get(th);
> +   elm_theme_all_set(defth);
>  }
>  
>  static void
> @@ -1095,30 +1080,33 @@
>     Theme *t = data;
>     Evas_Object *win = elm_object_top_widget_get(obj);
>     Evas_Object *sample = evas_object_data_get(win, "theme_preview");
> -   Elm_Theme *th;
> -   const char *defth;
> -   char *newth;
> +   Elm_Theme *th, *sth;
> +   const char *defth, *rest;
> +   Eina_Strbuf *newth;
>  
> -   tsel = t;
> -   defth = elm_theme_get(NULL);
> -   newth = malloc(strlen(defth) + 1 + strlen(t->name) + 1);
> +   tsel = elm_list_selected_items_get(obj);
> +   sth = elm_object_theme_get(sample);
> +   defth = elm_theme_get(sth);
> +   newth = eina_strbuf_new();
> +   EINA_SAFETY_ON_NULL_RETURN(newth);
>     th = elm_theme_new();
> -   if (newth)
> +   if (!th)
>       {
> -        char *rest;
> -
> -        newth[0] = 0;
> +        eina_strbuf_free(newth);
> +        return;
> +     }
> +   if (eina_list_count(tsel) > 1)
> +     eina_strbuf_append_printf(newth, "%s:%s", t->name, defth);
> +   else
> +     {
>          rest = strchr(defth, ':');
>          if (!rest)
> -          strcpy(newth, t->name);
> +          eina_strbuf_append(newth, t->name);
>          else
> -          {
> -             strcpy(newth, t->name);
> -             strcat(newth, rest);
> -          }
> -        elm_theme_set(th, newth);
> -        free(newth);
> +          eina_strbuf_append_printf(newth, "%s%s", t->name, rest);
>       }
> +   elm_theme_set(th, eina_strbuf_string_get(newth));
> +   eina_strbuf_free(newth);
>     elm_object_theme_set(sample, th);
>     elm_theme_free(th);
>  }
> @@ -1303,6 +1291,7 @@
>     evas_object_show(pd);
>  
>     li = elm_list_add(win);
> +   elm_list_multi_select_set(li, EINA_TRUE);
>     evas_object_size_hint_weight_set(li, 1.0, 1.0);
>     evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
>     elm_frame_content_set(pd, li);
> 
> 
now it is possible to use theme overlays such as darkness-desktop with great
ease! but with great ease comes great responsibility, so don't go selecting all
the themes at once...

-- 
Mike Blumenkrantz
Zentific: Coding in binary since '10.

------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to