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)
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));
}
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;
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;
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);
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)
{
if (!_e_int_menus_augmentation)
{
+ eina_stringshare_del(maug->sort_key);
free(maug);
return;
}
else
eina_hash_del_by_key(_e_int_menus_augmentation, menu);
}
+ eina_stringshare_del(maug->sort_key);
free(maug);
}
}
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)
{
E_Menu_Item *mi;
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);
struct _E_Int_Menu_Augmentation
{
+ const char *sort_key;
struct {
void (*func)(void *data, E_Menu *m);
void *data;
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);
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;
{
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);
{
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);
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,
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,
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;
}
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 */
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)
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;
}