forked from enlightenment/enlightenment
add menu augmentation for syscon to display the same menu that the syscon gadget displays
SVN revision: 75195
This commit is contained in:
parent
0a278dd435
commit
a1ac78a4af
|
@ -31,8 +31,8 @@ e_modapi_init(E_Module *m)
|
||||||
e_action_predef_name_set(_("System"), _("System Control"), "syscon",
|
e_action_predef_name_set(_("System"), _("System Control"), "syscon",
|
||||||
NULL, NULL, 0);
|
NULL, NULL, 0);
|
||||||
}
|
}
|
||||||
// maug = e_int_menus_menu_augmentation_add_sorted
|
maug = e_int_menus_menu_augmentation_add_sorted
|
||||||
// ("main/8", _("System"), _e_mod_menu_add, NULL, NULL, NULL);
|
("main/8", _("System"), _e_mod_menu_add, NULL, NULL, NULL);
|
||||||
e_configure_registry_category_add("advanced", 80, _("Advanced"), NULL, "preferences-advanced");
|
e_configure_registry_category_add("advanced", 80, _("Advanced"), NULL, "preferences-advanced");
|
||||||
e_configure_registry_item_add("advanced/syscon", 10, _("Syscon"), NULL, "preferences-syscon", e_int_config_syscon);
|
e_configure_registry_item_add("advanced/syscon", 10, _("Syscon"), NULL, "preferences-syscon", e_int_config_syscon);
|
||||||
e_syscon_gadget_init(m);
|
e_syscon_gadget_init(m);
|
||||||
|
@ -121,8 +121,7 @@ _e_mod_syscon_cb(void *data __UNUSED__, E_Menu *m, E_Menu_Item *mi __UNUSED__)
|
||||||
static void
|
static void
|
||||||
_e_mod_menu_generate(void *data __UNUSED__, E_Menu *m)
|
_e_mod_menu_generate(void *data __UNUSED__, E_Menu *m)
|
||||||
{
|
{
|
||||||
E_Menu_Item *mi;
|
e_syscon_menu_fill(m);
|
||||||
mi = e_menu_item_new(m);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* menu item add hook */
|
/* menu item add hook */
|
||||||
|
|
|
@ -15,6 +15,7 @@ EAPI int e_modapi_save (E_Module *m);
|
||||||
|
|
||||||
void e_syscon_gadget_init(E_Module *m);
|
void e_syscon_gadget_init(E_Module *m);
|
||||||
void e_syscon_gadget_shutdown(void);
|
void e_syscon_gadget_shutdown(void);
|
||||||
|
void e_syscon_menu_fill(E_Menu *m);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup Optional_Control
|
* @addtogroup Optional_Control
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "e.h"
|
#include "e.h"
|
||||||
|
#include "e_mod_main.h"
|
||||||
|
|
||||||
/* local structures */
|
/* local structures */
|
||||||
typedef struct _Instance Instance;
|
typedef struct _Instance Instance;
|
||||||
|
@ -203,87 +204,9 @@ _cb_menu_sel(void *data, E_Menu *m, E_Menu_Item *mi __UNUSED__)
|
||||||
static void
|
static void
|
||||||
_create_menu(Instance *inst)
|
_create_menu(Instance *inst)
|
||||||
{
|
{
|
||||||
E_Config_Syscon_Action *sca;
|
|
||||||
E_Menu_Item *it;
|
|
||||||
|
|
||||||
if (!inst) return;
|
if (!inst) return;
|
||||||
inst->menu = e_menu_new();
|
inst->menu = e_menu_new();
|
||||||
|
e_syscon_menu_fill(inst->menu);
|
||||||
if ((sca = _find_action("desk_lock")))
|
|
||||||
{
|
|
||||||
it = e_menu_item_new(inst->menu);
|
|
||||||
e_menu_item_label_set(it, _(e_action_predef_label_get(sca->action,
|
|
||||||
sca->params)));
|
|
||||||
if (sca->icon)
|
|
||||||
e_util_menu_item_theme_icon_set(it, sca->icon);
|
|
||||||
e_menu_item_callback_set(it, _cb_menu_sel, sca);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((sca = _find_action("logout")))
|
|
||||||
{
|
|
||||||
it = e_menu_item_new(inst->menu);
|
|
||||||
e_menu_item_label_set(it, _(e_action_predef_label_get(sca->action,
|
|
||||||
sca->params)));
|
|
||||||
if (sca->icon)
|
|
||||||
e_util_menu_item_theme_icon_set(it, sca->icon);
|
|
||||||
e_menu_item_callback_set(it, _cb_menu_sel, sca);
|
|
||||||
if (!e_sys_action_possible_get(E_SYS_LOGOUT))
|
|
||||||
e_menu_item_disabled_set(it, EINA_TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
it = e_menu_item_new(inst->menu);
|
|
||||||
e_menu_item_separator_set(it, EINA_TRUE);
|
|
||||||
|
|
||||||
if ((sca = _find_action("suspend")))
|
|
||||||
{
|
|
||||||
it = e_menu_item_new(inst->menu);
|
|
||||||
e_menu_item_label_set(it, _(e_action_predef_label_get(sca->action,
|
|
||||||
sca->params)));
|
|
||||||
if (sca->icon)
|
|
||||||
e_util_menu_item_theme_icon_set(it, sca->icon);
|
|
||||||
e_menu_item_callback_set(it, _cb_menu_sel, sca);
|
|
||||||
if (!e_sys_action_possible_get(E_SYS_SUSPEND))
|
|
||||||
e_menu_item_disabled_set(it, EINA_TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((sca = _find_action("hibernate")))
|
|
||||||
{
|
|
||||||
it = e_menu_item_new(inst->menu);
|
|
||||||
e_menu_item_label_set(it, _(e_action_predef_label_get(sca->action,
|
|
||||||
sca->params)));
|
|
||||||
if (sca->icon)
|
|
||||||
e_util_menu_item_theme_icon_set(it, sca->icon);
|
|
||||||
e_menu_item_callback_set(it, _cb_menu_sel, sca);
|
|
||||||
if (!e_sys_action_possible_get(E_SYS_HIBERNATE))
|
|
||||||
e_menu_item_disabled_set(it, EINA_TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
it = e_menu_item_new(inst->menu);
|
|
||||||
e_menu_item_separator_set(it, EINA_TRUE);
|
|
||||||
|
|
||||||
if ((sca = _find_action("reboot")))
|
|
||||||
{
|
|
||||||
it = e_menu_item_new(inst->menu);
|
|
||||||
e_menu_item_label_set(it, _(e_action_predef_label_get(sca->action,
|
|
||||||
sca->params)));
|
|
||||||
if (sca->icon)
|
|
||||||
e_util_menu_item_theme_icon_set(it, sca->icon);
|
|
||||||
e_menu_item_callback_set(it, _cb_menu_sel, sca);
|
|
||||||
if (!e_sys_action_possible_get(E_SYS_REBOOT))
|
|
||||||
e_menu_item_disabled_set(it, EINA_TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((sca = _find_action("halt")))
|
|
||||||
{
|
|
||||||
it = e_menu_item_new(inst->menu);
|
|
||||||
e_menu_item_label_set(it, _(e_action_predef_label_get(sca->action,
|
|
||||||
sca->params)));
|
|
||||||
if (sca->icon)
|
|
||||||
e_util_menu_item_theme_icon_set(it, sca->icon);
|
|
||||||
e_menu_item_callback_set(it, _cb_menu_sel, sca);
|
|
||||||
if (!e_sys_action_possible_get(E_SYS_HALT))
|
|
||||||
e_menu_item_disabled_set(it, EINA_TRUE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static E_Config_Syscon_Action *
|
static E_Config_Syscon_Action *
|
||||||
|
@ -319,3 +242,87 @@ e_syscon_gadget_shutdown(void)
|
||||||
mod = NULL;
|
mod = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
e_syscon_menu_fill(E_Menu *m)
|
||||||
|
{
|
||||||
|
E_Config_Syscon_Action *sca;
|
||||||
|
E_Menu_Item *it;
|
||||||
|
|
||||||
|
if (!m) return;
|
||||||
|
if ((sca = _find_action("desk_lock")))
|
||||||
|
{
|
||||||
|
it = e_menu_item_new(m);
|
||||||
|
e_menu_item_label_set(it, _(e_action_predef_label_get(sca->action,
|
||||||
|
sca->params)));
|
||||||
|
if (sca->icon)
|
||||||
|
e_util_menu_item_theme_icon_set(it, sca->icon);
|
||||||
|
e_menu_item_callback_set(it, _cb_menu_sel, sca);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((sca = _find_action("logout")))
|
||||||
|
{
|
||||||
|
it = e_menu_item_new(m);
|
||||||
|
e_menu_item_label_set(it, _(e_action_predef_label_get(sca->action,
|
||||||
|
sca->params)));
|
||||||
|
if (sca->icon)
|
||||||
|
e_util_menu_item_theme_icon_set(it, sca->icon);
|
||||||
|
e_menu_item_callback_set(it, _cb_menu_sel, sca);
|
||||||
|
if (!e_sys_action_possible_get(E_SYS_LOGOUT))
|
||||||
|
e_menu_item_disabled_set(it, EINA_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
it = e_menu_item_new(m);
|
||||||
|
e_menu_item_separator_set(it, EINA_TRUE);
|
||||||
|
|
||||||
|
if ((sca = _find_action("suspend")))
|
||||||
|
{
|
||||||
|
it = e_menu_item_new(m);
|
||||||
|
e_menu_item_label_set(it, _(e_action_predef_label_get(sca->action,
|
||||||
|
sca->params)));
|
||||||
|
if (sca->icon)
|
||||||
|
e_util_menu_item_theme_icon_set(it, sca->icon);
|
||||||
|
e_menu_item_callback_set(it, _cb_menu_sel, sca);
|
||||||
|
if (!e_sys_action_possible_get(E_SYS_SUSPEND))
|
||||||
|
e_menu_item_disabled_set(it, EINA_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((sca = _find_action("hibernate")))
|
||||||
|
{
|
||||||
|
it = e_menu_item_new(m);
|
||||||
|
e_menu_item_label_set(it, _(e_action_predef_label_get(sca->action,
|
||||||
|
sca->params)));
|
||||||
|
if (sca->icon)
|
||||||
|
e_util_menu_item_theme_icon_set(it, sca->icon);
|
||||||
|
e_menu_item_callback_set(it, _cb_menu_sel, sca);
|
||||||
|
if (!e_sys_action_possible_get(E_SYS_HIBERNATE))
|
||||||
|
e_menu_item_disabled_set(it, EINA_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
it = e_menu_item_new(m);
|
||||||
|
e_menu_item_separator_set(it, EINA_TRUE);
|
||||||
|
|
||||||
|
if ((sca = _find_action("reboot")))
|
||||||
|
{
|
||||||
|
it = e_menu_item_new(m);
|
||||||
|
e_menu_item_label_set(it, _(e_action_predef_label_get(sca->action,
|
||||||
|
sca->params)));
|
||||||
|
if (sca->icon)
|
||||||
|
e_util_menu_item_theme_icon_set(it, sca->icon);
|
||||||
|
e_menu_item_callback_set(it, _cb_menu_sel, sca);
|
||||||
|
if (!e_sys_action_possible_get(E_SYS_REBOOT))
|
||||||
|
e_menu_item_disabled_set(it, EINA_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((sca = _find_action("halt")))
|
||||||
|
{
|
||||||
|
it = e_menu_item_new(m);
|
||||||
|
e_menu_item_label_set(it, _(e_action_predef_label_get(sca->action,
|
||||||
|
sca->params)));
|
||||||
|
if (sca->icon)
|
||||||
|
e_util_menu_item_theme_icon_set(it, sca->icon);
|
||||||
|
e_menu_item_callback_set(it, _cb_menu_sel, sca);
|
||||||
|
if (!e_sys_action_possible_get(E_SYS_HALT))
|
||||||
|
e_menu_item_disabled_set(it, EINA_TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue