usability: sort menus, always keep same order.
maybe this is too much for a feature freeze phase, but this is annoying for users, sometimes your menu looks one way, sometimes another. Now it will always look the same, alphabetically ordered. If it breaks anything before Monday revert! SVN revision: 40205
This commit is contained in:
parent
3b733a2081
commit
8b22937367
|
@ -8,6 +8,25 @@ static void _e_configure_registry_item_full_add(const char *path, int pri, const
|
|||
EAPI Eina_List *e_configure_registry = NULL;
|
||||
|
||||
static Eina_List *handlers = NULL;
|
||||
static E_Int_Menu_Augmentation *maug = NULL;
|
||||
|
||||
|
||||
static void
|
||||
_e_configure_menu_module_item_cb(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
e_int_config_modules(m->zone->container, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_configure_menu_add(void *data, E_Menu *m)
|
||||
{
|
||||
E_Menu_Item *mi;
|
||||
|
||||
mi = e_menu_item_new(m);
|
||||
e_menu_item_label_set(mi, _("Modules"));
|
||||
e_util_menu_item_theme_icon_set(mi, "preferences-plugin");
|
||||
e_menu_item_callback_set(mi, _e_configure_menu_module_item_cb, NULL);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_configure_init(void)
|
||||
|
@ -15,6 +34,9 @@ e_configure_init(void)
|
|||
e_configure_registry_category_add("extensions", 90, _("Extensions"), NULL, "preferences-extensions");
|
||||
e_configure_registry_item_add("extensions/modules", 10, _("Modules"), NULL, "preferences-plugin", e_int_config_modules);
|
||||
|
||||
maug = e_int_menus_menu_augmentation_add_sorted
|
||||
("config/1", _("Modules"), _e_configure_menu_add, NULL, NULL, NULL);
|
||||
|
||||
handlers = eina_list_append
|
||||
(handlers, ecore_event_handler_add
|
||||
(EFREET_EVENT_DESKTOP_LIST_CHANGE, _e_configure_cb_efreet_desktop_list_change, NULL));
|
||||
|
|
|
@ -334,11 +334,12 @@ e_int_menus_lost_clients_new(void)
|
|||
}
|
||||
|
||||
EAPI E_Int_Menu_Augmentation *
|
||||
e_int_menus_menu_augmentation_add(const char *menu,
|
||||
void (*func_add) (void *data, E_Menu *m),
|
||||
void *data_add,
|
||||
void (*func_del) (void *data, E_Menu *m),
|
||||
void *data_del)
|
||||
e_int_menus_menu_augmentation_add_sorted(const char *menu,
|
||||
const char *sort_key,
|
||||
void (*func_add) (void *data, E_Menu *m),
|
||||
void *data_add,
|
||||
void (*func_del) (void *data, E_Menu *m),
|
||||
void *data_del)
|
||||
{
|
||||
E_Int_Menu_Augmentation *maug;
|
||||
Eina_List *l;
|
||||
|
@ -347,6 +348,8 @@ e_int_menus_menu_augmentation_add(const char *menu,
|
|||
maug = E_NEW(E_Int_Menu_Augmentation, 1);
|
||||
if (!maug) return NULL;
|
||||
|
||||
maug->sort_key = eina_stringshare_add(sort_key);
|
||||
|
||||
maug->add.func = func_add;
|
||||
maug->add.data = data_add;
|
||||
|
||||
|
@ -365,7 +368,27 @@ e_int_menus_menu_augmentation_add(const char *menu,
|
|||
old = 0;
|
||||
}
|
||||
|
||||
l = eina_list_append(l, maug);
|
||||
if ((!l) || (!maug->sort_key))
|
||||
l = eina_list_append(l, maug);
|
||||
else
|
||||
{
|
||||
E_Int_Menu_Augmentation *m2;
|
||||
Eina_List *l2;
|
||||
|
||||
/* keep list sorted, those missing sort_key at the end. */
|
||||
EINA_LIST_FOREACH(l, l2, m2)
|
||||
{
|
||||
if (!m2->sort_key)
|
||||
break;
|
||||
if (strcasecmp(maug->sort_key, m2->sort_key) < 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (l2)
|
||||
l = eina_list_prepend_relative_list(l, maug, l2);
|
||||
else
|
||||
l = eina_list_append(l, maug);
|
||||
}
|
||||
|
||||
if (old)
|
||||
eina_hash_modify(_e_int_menus_augmentation, menu, l);
|
||||
|
@ -375,6 +398,17 @@ e_int_menus_menu_augmentation_add(const char *menu,
|
|||
return maug;
|
||||
}
|
||||
|
||||
EAPI E_Int_Menu_Augmentation *
|
||||
e_int_menus_menu_augmentation_add(const char *menu,
|
||||
void (*func_add) (void *data, E_Menu *m),
|
||||
void *data_add,
|
||||
void (*func_del) (void *data, E_Menu *m),
|
||||
void *data_del)
|
||||
{
|
||||
return e_int_menus_menu_augmentation_add_sorted
|
||||
(menu, NULL, func_add, data_add, func_del, data_del);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_int_menus_menu_augmentation_del(const char *menu, E_Int_Menu_Augmentation *maug)
|
||||
{
|
||||
|
@ -382,6 +416,7 @@ e_int_menus_menu_augmentation_del(const char *menu, E_Int_Menu_Augmentation *mau
|
|||
|
||||
if (!_e_int_menus_augmentation)
|
||||
{
|
||||
eina_stringshare_del(maug->sort_key);
|
||||
free(maug);
|
||||
return;
|
||||
}
|
||||
|
@ -396,6 +431,7 @@ e_int_menus_menu_augmentation_del(const char *menu, E_Int_Menu_Augmentation *mau
|
|||
else
|
||||
eina_hash_del_by_key(_e_int_menus_augmentation, menu);
|
||||
}
|
||||
eina_stringshare_del(maug->sort_key);
|
||||
free(maug);
|
||||
}
|
||||
|
||||
|
@ -730,12 +766,6 @@ _e_int_menus_virtuals_icon_cb(void *data, E_Menu *m, E_Menu_Item *mi)
|
|||
mi->icon_object = o;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_int_menus_module_item_cb(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
e_configure_registry_call("extensions/modules", m->zone->container, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_int_menus_config_pre_cb(void *data, E_Menu *m)
|
||||
{
|
||||
|
@ -752,14 +782,6 @@ _e_int_menus_config_pre_cb(void *data, E_Menu *m)
|
|||
e_menu_item_separator_set(mi, 1);
|
||||
}
|
||||
|
||||
if (e_configure_registry_exists("extensions/modules"))
|
||||
{
|
||||
mi = e_menu_item_new(m);
|
||||
e_menu_item_label_set(mi, _("Modules"));
|
||||
e_util_menu_item_theme_icon_set(mi, "preferences-plugin");
|
||||
e_menu_item_callback_set(mi, _e_int_menus_module_item_cb, NULL);
|
||||
}
|
||||
|
||||
l = _e_int_menus_augmentation_find("config/1");
|
||||
if (l) _e_int_menus_augmentation_add(m, l);
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ typedef struct _E_Int_Menu_Augmentation E_Int_Menu_Augmentation;
|
|||
|
||||
struct _E_Int_Menu_Augmentation
|
||||
{
|
||||
const char *sort_key;
|
||||
struct {
|
||||
void (*func)(void *data, E_Menu *m);
|
||||
void *data;
|
||||
|
@ -51,6 +52,12 @@ EAPI E_Int_Menu_Augmentation *e_int_menus_menu_augmentation_add(const char *menu
|
|||
void *data_add,
|
||||
void (*func_del) (void *data, E_Menu *m),
|
||||
void *data_del);
|
||||
EAPI E_Int_Menu_Augmentation *e_int_menus_menu_augmentation_add_sorted(const char *menu,
|
||||
const char *sort_key,
|
||||
void (*func_add) (void *data, E_Menu *m),
|
||||
void *data_add,
|
||||
void (*func_del) (void *data, E_Menu *m),
|
||||
void *data_del);
|
||||
EAPI void e_int_menus_menu_augmentation_del(const char *menu,
|
||||
E_Int_Menu_Augmentation *maug);
|
||||
|
||||
|
|
|
@ -139,7 +139,8 @@ e_modapi_init(E_Module *m)
|
|||
e_action_predef_name_set(_("Launch"), _("Settings Panel"), "configuration",
|
||||
NULL, NULL, 0);
|
||||
}
|
||||
maug = e_int_menus_menu_augmentation_add("config/0", _e_mod_menu_add, NULL, NULL, NULL);
|
||||
maug = e_int_menus_menu_augmentation_add_sorted
|
||||
("config/0", _("Settings Panel"), _e_mod_menu_add, NULL, NULL, NULL);
|
||||
e_module_delayed_set(m, 1);
|
||||
e_gadcon_provider_register(&_gadcon_class);
|
||||
return m;
|
||||
|
|
|
@ -37,7 +37,8 @@ e_modapi_init(E_Module *m)
|
|||
{
|
||||
e_configure_registry_category_add("extensions", 90, _("Extensions"), NULL, "preferences-extensions");
|
||||
e_configure_registry_item_add("extensions/shelves", 20, _("Shelves"), NULL, "preferences-desktop-shelf", e_int_config_shelf);
|
||||
maug = e_int_menus_menu_augmentation_add("config/1", _e_mod_menu_add, NULL, NULL, NULL);
|
||||
maug = e_int_menus_menu_augmentation_add_sorted
|
||||
("config/1", _("Shelves"), _e_mod_menu_add, NULL, NULL, NULL);
|
||||
|
||||
conf_module = m;
|
||||
e_module_delayed_set(m, 1);
|
||||
|
|
|
@ -37,7 +37,7 @@ e_modapi_init(E_Module *m)
|
|||
{
|
||||
e_configure_registry_category_add("appearance", 10, _("Look"), NULL, "preferences-appearance");
|
||||
e_configure_registry_item_add("appearance/theme", 20, _("Theme"), NULL, "preferences-desktop-theme", e_int_config_theme);
|
||||
maug = e_int_menus_menu_augmentation_add("config/1", _e_mod_menu_add, NULL, NULL, NULL);
|
||||
maug = e_int_menus_menu_augmentation_add_sorted("config/1", _("Theme"), _e_mod_menu_add, NULL, NULL, NULL);
|
||||
|
||||
conf_module = m;
|
||||
e_module_delayed_set(m, 1);
|
||||
|
|
|
@ -29,7 +29,7 @@ e_modapi_init(E_Module *m)
|
|||
e_configure_registry_item_add("appearance/wallpaper", 10, _("Wallpaper"), NULL, "preferences-desktop-wallpaper", e_int_config_wallpaper);
|
||||
e_configure_registry_category_add("internal", -1, _("Internal"), NULL, "enlightenment/internal");
|
||||
e_configure_registry_item_add("internal/wallpaper_desk", -1, _("Wallpaper"), NULL, "preferences-system-windows", e_int_config_wallpaper_desk);
|
||||
maug = e_int_menus_menu_augmentation_add("config/1", _e_mod_menu_add, NULL, NULL, NULL);
|
||||
maug = e_int_menus_menu_augmentation_add_sorted("config/1", _("Wallpaper"), _e_mod_menu_add, NULL, NULL, NULL);
|
||||
|
||||
import_hdl = e_fm2_mime_handler_new(_("Set As Background"), "preferences-desktop-wallpaper",
|
||||
e_int_config_wallpaper_handler_set, NULL,
|
||||
|
|
|
@ -29,7 +29,8 @@ e_modapi_init(E_Module *m)
|
|||
e_configure_registry_item_add("appearance/wallpaper2", 10, _("Wallpaper 2"), NULL, "preferences-desktop-wallpaper",wp_conf_show);
|
||||
e_configure_registry_category_add("internal", -1, _("Internal"), NULL, "enlightenment/internal");
|
||||
// e_configure_registry_item_add("internal/wallpaper_desk", -1, _("Wallpaper 2"), NULL, "preferences-system-windows", e_int_config_wallpaper_desk);
|
||||
maug = e_int_menus_menu_augmentation_add("config/1", _e_mod_menu_add, NULL, NULL, NULL);
|
||||
maug = e_int_menus_menu_augmentation_add_sorted
|
||||
("config/1", _("Wallpaper 2"), _e_mod_menu_add, NULL, NULL, NULL);
|
||||
|
||||
// import_hdl = e_fm2_mime_handler_new(_("Set As Background 2"), "preferences-desktop-wallpaper",
|
||||
// e_int_config_wallpaper_handler_set, NULL,
|
||||
|
|
|
@ -48,7 +48,8 @@ e_modapi_init(E_Module *m)
|
|||
e_action_predef_name_set(_("Launch"), _("Run Command Dialog"), "exebuf",
|
||||
NULL, NULL, 0);
|
||||
}
|
||||
maug = e_int_menus_menu_augmentation_add("main/1", _e_mod_menu_add, NULL, NULL, NULL);
|
||||
maug = e_int_menus_menu_augmentation_add_sorted
|
||||
("main/1", _("Run Command"), _e_mod_menu_add, NULL, NULL, NULL);
|
||||
e_module_delayed_set(m, 1);
|
||||
return m;
|
||||
}
|
||||
|
|
|
@ -63,8 +63,8 @@ e_modapi_init(E_Module *m)
|
|||
e_action_predef_name_set(_("Launch"), _("File Manager"),
|
||||
"fileman", NULL, "syntax: /path/to/dir or ~/path/to/dir or favorites or desktop, examples: /boot/grub, ~/downloads", 1);
|
||||
}
|
||||
maug = e_int_menus_menu_augmentation_add("main/1", _e_mod_menu_add,
|
||||
NULL, NULL, NULL);
|
||||
maug = e_int_menus_menu_augmentation_add_sorted
|
||||
("main/1", _("Files"),_e_mod_menu_add, NULL, NULL, NULL);
|
||||
e_module_delayed_set(m, 1);
|
||||
|
||||
/* Hook into zones */
|
||||
|
|
|
@ -73,8 +73,9 @@ e_modapi_init(E_Module *m)
|
|||
Man->icon_name = eina_stringshare_add(buf);
|
||||
Man->maug = NULL;
|
||||
Man->maug =
|
||||
e_int_menus_menu_augmentation_add("config/1", _gadman_maug_add,
|
||||
(void *)Man->icon_name, NULL, NULL);
|
||||
e_int_menus_menu_augmentation_add_sorted
|
||||
("config/1", _("Gadgets"), _gadman_maug_add, (void *)Man->icon_name,
|
||||
NULL, NULL);
|
||||
/* Create toggle action */
|
||||
Man->action = e_action_add("gadman_toggle");
|
||||
if (Man->action)
|
||||
|
|
|
@ -34,8 +34,8 @@ e_modapi_init(E_Module *m)
|
|||
e_action_predef_name_set(_("System"), _("System Control"), "syscon",
|
||||
NULL, NULL, 0);
|
||||
}
|
||||
maug = e_int_menus_menu_augmentation_add("main/10", _e_mod_menu_add,
|
||||
NULL, NULL, NULL);
|
||||
maug = e_int_menus_menu_augmentation_add_sorted
|
||||
("main/10", _("System"), _e_mod_menu_add, NULL, NULL, NULL);
|
||||
e_module_delayed_set(m, 1);
|
||||
return m;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue