add colorclass editor to settings panel

devs/discomfitor/cc
Mike Blumenkrantz 7 years ago
parent d470649e9b
commit 369977cb18
  1. 45
      src/bin/main.c
  2. 9
      src/bin/options.c
  3. 22
      src/bin/options_colors.c
  4. 3
      src/bin/options_colors.h

@ -440,6 +440,44 @@ _translate_options(void)
}
#endif
#ifdef ELM_COLOR_CLASS_H
# if defined(HAVE_GETTEXT) && defined(ENABLE_NLS)
static char *
colorclasses_name_cb(char *name)
{
return _(name);
}
#endif
static Eina_List *
colorclasses_list_cb(void)
{
Eina_List *l, *ret = NULL;
Eina_Iterator *it;
Eina_File *f;
const char *config_dir = efreet_config_home_get(),
*data_dir = elm_app_data_dir_get();
char buf[PATH_MAX], buf2[PATH_MAX];
it = edje_file_iterator_new();
if (!it) return NULL;
snprintf(buf, sizeof(buf), "%s/themes", data_dir);
snprintf(buf2, sizeof(buf2), "%s/terminology/themes", config_dir);
EINA_ITERATOR_FOREACH(it, f)
{
const char *name;
name = eina_file_filename_get(f);
if ((!strstr(name, buf)) && (!strstr(name, buf2))) continue;
l = elm_color_class_util_edje_file_list(f);
if (l)
ret = eina_list_merge(ret, l);
}
eina_iterator_free(it);
return ret;
}
#endif
EAPI_MAIN int
elm_main(int argc, char **argv)
{
@ -540,6 +578,9 @@ elm_main(int argc, char **argv)
bindtextdomain(PACKAGE, elm_app_locale_dir_get());
textdomain(PACKAGE);
_translate_options();
# ifdef ELM_COLOR_CLASS_H
elm_color_class_translate_cb_set(colorclasses_name_cb);
# endif
#else
options.copyright = "(C) 2012-2015 Carsten Haitzler and others";
#endif
@ -575,7 +616,9 @@ elm_main(int argc, char **argv)
}
if (quit_option) goto end;
#ifdef ELM_COLOR_CLASS_H
elm_color_class_list_cb_set(colorclasses_list_cb);
#endif
#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
if (cmd_options)
{

@ -30,6 +30,9 @@ static enum option_mode {
OPTION_THEME,
OPTION_WALLPAPER,
OPTION_COLORS,
#ifdef ELM_COLOR_CLASS_H
OPTION_COLORCLASSES,
#endif
OPTION_VIDEO,
OPTION_BEHAVIOR,
OPTION_KEYS,
@ -86,6 +89,9 @@ _cb_opdt_hide_done(void *data, Evas_Object *obj EINA_UNUSED, const char *sig EIN
case OPTION_THEME: options_theme(op_opbox, data); break;
case OPTION_WALLPAPER: options_wallpaper(op_opbox, data); break;
case OPTION_COLORS: options_colors(op_opbox, data); break;
#ifdef ELM_COLOR_CLASS_H
case OPTION_COLORCLASSES: options_colorclasses(op_opbox, data); break;
#endif
case OPTION_VIDEO: options_video(op_opbox, data); break;
case OPTION_BEHAVIOR: options_behavior(op_opbox, data); break;
case OPTION_KEYS: options_keys(op_opbox, data); break;
@ -168,6 +174,9 @@ options_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
ITEM_APPEND("preferences-desktop-wallpaper", _("Wallpaper"), WALLPAPER);
ITEM_APPEND("video-display", _("Video"), VIDEO);
ITEM_APPEND("preferences-desktop-theme", _("Colors"), COLORS);
#ifdef ELM_COLOR_CLASS_H
ITEM_APPEND("preferences-desktop-theme", _("Color Classes"), COLORCLASSES);
#endif
ITEM_APPEND("preferences-system", _("Behavior"), BEHAVIOR);
ITEM_APPEND("preferences-desktop-keyboard-shortcuts", _("Keys"), KEYS);
ITEM_APPEND("system-run", _("Helpers"), HELPERS);

@ -287,3 +287,25 @@ options_colors(Evas_Object *opbox, Evas_Object *term)
evas_object_show(o);
evas_object_smart_callback_add(o, "clicked", _cb_op_reset, term);
}
#ifdef ELM_COLOR_CLASS_H
void
options_colorclasses(Evas_Object *opbox, Evas_Object *term EINA_UNUSED)
{
Evas_Object *o, *fr;
fr = o = elm_frame_add(opbox);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(o, _("Color Classes"));
elm_box_pack_end(opbox, o);
evas_object_show(o);
o = elm_color_class_editor_add(opbox, 0);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(o, _("Color Classes"));
elm_object_content_set(fr, o);
evas_object_show(o);
}
#endif

@ -2,5 +2,8 @@
#define _OPTIONS_COLORS_H__ 1
void options_colors(Evas_Object *opbox, Evas_Object *term);
#ifdef ELM_COLOR_CLASS_H
void options_colorclasses(Evas_Object *opbox, Evas_Object *term);
#endif
#endif

Loading…
Cancel
Save