aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2015-04-05 16:28:56 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2015-04-06 15:23:20 -0400
commit369977cb18786cf05cbd08dac05515f8f0afcda7 (patch)
tree9436f0fa450ef60225e3d3003f94d3e6286a80b7
parentset colorclass descriptions for default color classes (diff)
downloadterminology-devs/discomfitor/cc.tar.gz
add colorclass editor to settings paneldevs/discomfitor/cc
-rw-r--r--src/bin/main.c45
-rw-r--r--src/bin/options.c9
-rw-r--r--src/bin/options_colors.c22
-rw-r--r--src/bin/options_colors.h3
4 files changed, 78 insertions, 1 deletions
diff --git a/src/bin/main.c b/src/bin/main.c
index 6eca428..704839f 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -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)
{
diff --git a/src/bin/options.c b/src/bin/options.c
index e26171f..14b94b7 100644
--- a/src/bin/options.c
+++ b/src/bin/options.c
@@ -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);
diff --git a/src/bin/options_colors.c b/src/bin/options_colors.c
index 0581408..d0c5e73 100644
--- a/src/bin/options_colors.c
+++ b/src/bin/options_colors.c
@@ -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
diff --git a/src/bin/options_colors.h b/src/bin/options_colors.h
index 0512d98..8c9b861 100644
--- a/src/bin/options_colors.h
+++ b/src/bin/options_colors.h
@@ -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