On 20/05/13 17:19, Daniel Juyung Seo wrote: > On Mon, May 20, 2013 at 10:45 PM, Tom Hacohen - Enlightenment Git > <no-re...@enlightenment.org> wrote: >> tasn pushed a commit to branch master. >> >> commit f4d5732ff90e9b7952165af870804261b6f3e8b0 >> Author: Tom Hacohen <t...@stosb.com> >> Date: Mon May 20 13:03:43 2013 +0100 >> >> Made clouseau_enable an elm_config option. >> >> You can now just use elementary_config to enable and disable clouseau on >> run-time. >> --- >> src/bin/config.c | 51 ++++++++++++++++++++++++++++++++++++++++++ >> src/lib/elm_config.c | 21 ++++++++++++++++++ >> src/lib/elm_config.h | 16 ++++++++++++++ >> src/lib/elm_main.c | 62 >> +++++++++++++++++++++++++++++++++------------------- >> src/lib/elm_priv.h | 2 ++ >> 5 files changed, 129 insertions(+), 23 deletions(-) >> >> diff --git a/src/bin/config.c b/src/bin/config.c >> index a4d4177..7586012 100644 >> --- a/src/bin/config.c >> +++ b/src/bin/config.c >> @@ -763,6 +763,20 @@ sel_change(void *data __UNUSED__, >> } >> >> static void >> +dbg_change(void *data __UNUSED__, >> + Evas_Object *obj, >> + void *event_info __UNUSED__) >> +{ >> + Eina_Bool val = elm_check_state_get(obj); >> + Eina_Bool sel = elm_config_clouseau_enable_get(); >> + >> + if (val == sel) return; >> + elm_config_clouseau_enable_set(val); >> + elm_config_all_flush(); >> + elm_config_save(); >> +} >> + >> +static void >> _status_basic(Evas_Object *win, >> Evas_Object *bx0) >> { >> @@ -928,6 +942,14 @@ _cf_selection(void *data, >> _flip_to(data, "selection"); >> } >> >> +static void >> +_cf_debug(void *data, >> + Evas_Object *obj __UNUSED__, >> + void *event_info __UNUSED__) >> +{ >> + _flip_to(data, "debug"); >> +} >> + >> const char * >> _elm_theme_current_get(const char *theme_search_order) >> { >> @@ -1492,6 +1514,33 @@ _status_config_selection(Evas_Object *win, >> elm_naviframe_item_simple_push(naviframe, bx); >> } >> >> +static void >> +_status_config_debug(Evas_Object *win, >> + Evas_Object *naviframe) >> +{ >> + Evas_Object *bx, *ck; >> + >> + bx = elm_box_add(win); >> + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0); >> + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.5); >> + >> + ck = elm_check_add(win); >> + elm_object_tooltip_text_set(ck, "Set clouseau mode"); >> + elm_object_text_set(ck, "Enable clouseau"); >> + evas_object_data_set(win, "clouseau_check", ck); >> + evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0); >> + evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5); >> + elm_check_state_set(ck, elm_config_clouseau_enable_get()); >> + elm_box_pack_end(bx, ck); >> + evas_object_show(ck); >> + >> + evas_object_smart_callback_add(ck, "changed", dbg_change, NULL); >> + >> + evas_object_data_set(win, "debug", bx); >> + >> + elm_naviframe_item_simple_push(naviframe, bx); >> +} >> + >> static Evas_Object * >> _sample_theme_new(Evas_Object *win) >> { >> @@ -3391,6 +3440,7 @@ _status_config_full(Evas_Object *win, >> elm_toolbar_item_append(tb, "appointment-new", "Caches", _cf_caches, >> win); >> elm_toolbar_item_append(tb, "stock_spellcheck", "Access", _cf_access, >> win); >> elm_toolbar_item_append(tb, "clear-selection-check", "Selection", >> _cf_selection, win); >> + elm_toolbar_item_append(tb, "preferences-other", "Debug", _cf_debug, >> win); >> >> elm_box_pack_end(bx0, tb); >> evas_object_show(tb); >> @@ -3408,6 +3458,7 @@ _status_config_full(Evas_Object *win, >> _status_config_caches(win, naviframe); >> _status_config_access(win, naviframe); >> _status_config_selection(win, naviframe); >> + _status_config_debug(win, naviframe); >> _status_config_sizing(win, naviframe); // Note: call this at the end. >> >> // FIXME uncomment after flip style fix, please >> diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c >> index 6f16915..aee702e 100644 >> --- a/src/lib/elm_config.c >> +++ b/src/lib/elm_config.c >> @@ -187,6 +187,7 @@ _prop_config_get(void) >> _elm_config_font_overlay_apply(); >> _elm_rescale(); >> _elm_recache(); >> + _elm_clouseau_reload(); >> _elm_win_access(_elm_config->access_mode); >> ecore_event_add(ELM_EVENT_CONFIG_ALL_CHANGED, NULL, NULL, NULL); >> return EINA_TRUE; >> @@ -434,6 +435,7 @@ _desc_init(void) >> ELM_CONFIG_VAL(D, T, indicator_service_180, T_STRING); >> ELM_CONFIG_VAL(D, T, indicator_service_270, T_STRING); >> ELM_CONFIG_VAL(D, T, disable_external_menu, T_UCHAR); >> + ELM_CONFIG_VAL(D, T, clouseau_enable, T_UCHAR); >> #undef T >> #undef D >> #undef T_INT >> @@ -1700,6 +1702,9 @@ _env_get(void) >> if (s) eina_stringshare_replace(&_elm_config->indicator_service_270, s); >> s = getenv("ELM_DISABLE_EXTERNAL_MENU"); >> if (s) _elm_config->disable_external_menu = !!atoi(s); >> + >> + s = getenv("ELM_CLOUSEAU"); >> + if (s) _elm_config->clouseau_enable = atoi(s); >> } >> >> EAPI Eina_Bool >> @@ -2297,6 +2302,19 @@ elm_config_disable_external_menu_set(Eina_Bool >> disable) >> _elm_config->disable_external_menu = !!disable; >> } >> >> +EAPI Eina_Bool >> +elm_config_clouseau_enable_get(void) >> +{ >> + return _elm_config->clouseau_enable; >> +} >> + >> +EAPI void >> +elm_config_clouseau_enable_set(Eina_Bool enable) >> +{ >> + _elm_config->clouseau_enable = !!enable; >> + _elm_clouseau_reload(); >> +} >> + >> EAPI void >> elm_config_all_flush(void) >> { >> @@ -2348,6 +2366,7 @@ _elm_config_init(void) >> _config_apply(); >> _elm_config_font_overlay_apply(); >> _elm_recache(); >> + _elm_clouseau_reload(); >> } >> >> void >> @@ -2439,6 +2458,7 @@ _elm_config_reload(void) >> _elm_config_font_overlay_apply(); >> _elm_rescale(); >> _elm_recache(); >> + _elm_clouseau_reload(); >> ecore_event_add(ELM_EVENT_CONFIG_ALL_CHANGED, NULL, NULL, NULL); >> } >> >> @@ -2510,6 +2530,7 @@ _elm_config_profile_set(const char *profile) >> _elm_config_font_overlay_apply(); >> _elm_rescale(); >> _elm_recache(); >> + _elm_clouseau_reload(); >> } >> } >> >> diff --git a/src/lib/elm_config.h b/src/lib/elm_config.h >> index 71efd19..ec33f79 100644 >> --- a/src/lib/elm_config.h >> +++ b/src/lib/elm_config.h >> @@ -1165,6 +1165,22 @@ EAPI Eina_Bool elm_config_mirrored_get(void); >> EAPI void elm_config_mirrored_set(Eina_Bool mirrored); >> >> /** >> + * Get the clouseau state. EINA_TRUE if clouseau was tried to be run. >> + * >> + * @since 1.8 >> + * @return EINA_TRUE if clouseau was tried to run, EINA_FALSE otherwise >> + */ >> +EAPI Eina_Bool elm_config_clouseau_enable_get(void); > > Great patch tom! > Btw, how about elm_config_clouseau_enabled_set/get() for consistency? > All other elm apis look like elm_xxx_enabled_set/get().
Oh damn, should have been that. Without the d it doesn't even make grammatical sense. Fixed. -- Tom. ------------------------------------------------------------------------------ AlienVault Unified Security Management (USM) platform delivers complete security visibility with the essential security capabilities. Easily and efficiently configure, manage, and operate all of your security controls from a single console and one unified framework. Download a free trial. http://p.sf.net/sfu/alienvault_d2d _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel