elm: Enable external main menu by default

This patch replaces the ELM_EXTERNAL_MENU environment variable for
ELM_DISABLE_EXTERNAL_MENU, so that the main menu bar always attemps
connecting via D-Bus, if possible.

Patch by: Henrique Dante de Almeida <hdante@profusion.mobi>



SVN revision: 83099
This commit is contained in:
Henrique Dante de Almeida 2013-01-22 18:51:24 +00:00 committed by Bruno Dilly
parent 0fbcdfb49b
commit 9b2120b8a8
4 changed files with 15 additions and 15 deletions

View File

@ -19,7 +19,7 @@ test_main_menu(void *data __UNUSED__,
Evas_Object *win, *bg, *menu, *label, *bx;
Elm_Object_Item *menu_it, *menu_it1;
char *s;
Eina_Bool enabled = EINA_FALSE;
Eina_Bool enabled = EINA_TRUE;
win = elm_win_add(NULL, "menu", ELM_WIN_BASIC);
elm_win_title_set(win, "Menu");
@ -46,15 +46,15 @@ test_main_menu(void *data __UNUSED__,
elm_box_pack_end(bx, label);
evas_object_show(label);
s = getenv("ELM_EXTERNAL_MENU");
s = getenv("ELM_DISABLE_EXTERNAL_MENU");
if (s)
enabled = !!atoi(s);
enabled = !atoi(s);
if (!enabled)
{
label = elm_label_add(win);
elm_object_text_set(label, "(ELM_EXTERNAL_MENU environment variable not "
"set. Using local menu instead)");
elm_object_text_set(label, "(ELM_DISABLE_EXTERNAL_MENU environment "
"variable is set. Using local menu instead)");
evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
elm_box_pack_end(bx, label);

View File

@ -425,7 +425,7 @@ _desc_init(void)
ELM_CONFIG_VAL(D, T, indicator_service_90, T_STRING);
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, external_menu, T_UCHAR);
ELM_CONFIG_VAL(D, T, disable_external_menu, T_UCHAR);
#undef T
#undef D
#undef T_INT
@ -1128,7 +1128,7 @@ _config_load(void)
_elm_config->indicator_service_90 = eina_stringshare_add("elm_indicator_landscape");
_elm_config->indicator_service_180 = eina_stringshare_add("elm_indicator_portrait");
_elm_config->indicator_service_270 = eina_stringshare_add("elm_indicator_landscape");
_elm_config->external_menu = EINA_FALSE;
_elm_config->disable_external_menu = EINA_FALSE;
}
static const char *
@ -1659,8 +1659,8 @@ _env_get(void)
if (s) eina_stringshare_replace(&_elm_config->indicator_service_180, s);
s = getenv("ELM_INDICATOR_SERVICE_270");
if (s) eina_stringshare_replace(&_elm_config->indicator_service_270, s);
s = getenv("ELM_EXTERNAL_MENU");
if (s) _elm_config->external_menu = !!atoi(s);
s = getenv("ELM_DISABLE_EXTERNAL_MENU");
if (s) _elm_config->disable_external_menu = !!atoi(s);
}
EAPI Eina_Bool
@ -2175,15 +2175,15 @@ elm_config_softcursor_mode_get(void)
}
EAPI Eina_Bool
elm_config_external_menu_get(void)
elm_config_disable_external_menu_get(void)
{
return _elm_config->external_menu;
return _elm_config->disable_external_menu;
}
EAPI void
elm_config_external_menu_set(Eina_Bool enable)
elm_config_disable_external_menu_set(Eina_Bool disable)
{
_elm_config->external_menu = !!enable;
_elm_config->disable_external_menu = !!disable;
}
EAPI void

View File

@ -234,7 +234,7 @@ struct _Elm_Config
const char *indicator_service_180;
const char *indicator_service_270;
unsigned char selection_clear_enable;
unsigned char external_menu;
unsigned char disable_external_menu;
/* Not part of the EET file */
Eina_Bool is_mirrored : 1;

View File

@ -3606,7 +3606,7 @@ _main_menu_get(Eo *obj, void *_pd, va_list *list)
_elm_menu_menu_bar_set(sd->main_menu, EINA_TRUE);
#ifdef HAVE_ELEMENTARY_X
if (_elm_config->external_menu && sd->x.xwin) use_dbus = EINA_TRUE;
if (!_elm_config->disable_external_menu && sd->x.xwin) use_dbus = EINA_TRUE;
#endif
if (use_dbus && _elm_dbus_menu_register(sd->main_menu))