forked from enlightenment/enlightenment
allow for explicitly selecting the system menu file - and tell efreet about
it, save/restore it etc. etc. and wizard page to ask for it. note: missing norma config dialog to select this too! SVN revision: 37099
This commit is contained in:
parent
625af3eb88
commit
96b6bd54dc
|
@ -1,5 +1,5 @@
|
||||||
group "E_Config" struct {
|
group "E_Config" struct {
|
||||||
value "config_version" int: 65832;
|
value "config_version" int: 65833;
|
||||||
value "show_splash" int: 1;
|
value "show_splash" int: 1;
|
||||||
value "init_default_theme" string: "default.edj";
|
value "init_default_theme" string: "default.edj";
|
||||||
value "desktop_default_name" string: "Desktop %i, %i";
|
value "desktop_default_name" string: "Desktop %i, %i";
|
||||||
|
@ -1993,4 +1993,5 @@ group "E_Config" struct {
|
||||||
value "scale.use_custom" uchar: 1;
|
value "scale.use_custom" uchar: 1;
|
||||||
value "show_cursor" uchar: 1;
|
value "show_cursor" uchar: 1;
|
||||||
value "idle_cursor" uchar: 1;
|
value "idle_cursor" uchar: 1;
|
||||||
|
value "default_system_menu" string: "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -635,6 +635,8 @@ e_config_init(void)
|
||||||
|
|
||||||
E_CONFIG_VAL(D, T, show_cursor, UCHAR); /**/
|
E_CONFIG_VAL(D, T, show_cursor, UCHAR); /**/
|
||||||
E_CONFIG_VAL(D, T, idle_cursor, UCHAR); /**/
|
E_CONFIG_VAL(D, T, idle_cursor, UCHAR); /**/
|
||||||
|
|
||||||
|
E_CONFIG_VAL(D, T, default_system_menu, STR);
|
||||||
|
|
||||||
e_config = e_config_domain_load("e", _e_config_edd);
|
e_config = e_config_domain_load("e", _e_config_edd);
|
||||||
if (e_config)
|
if (e_config)
|
||||||
|
@ -1586,6 +1588,10 @@ e_config_init(void)
|
||||||
e_config->idle_cursor = 1;
|
e_config->idle_cursor = 1;
|
||||||
IFCFGEND;
|
IFCFGEND;
|
||||||
|
|
||||||
|
IFCFG(0x0129);
|
||||||
|
e_config->default_system_menu = NULL;
|
||||||
|
IFCFGEND;
|
||||||
|
|
||||||
e_config->config_version = E_CONFIG_FILE_VERSION;
|
e_config->config_version = E_CONFIG_FILE_VERSION;
|
||||||
|
|
||||||
#if 0 /* example of new config */
|
#if 0 /* example of new config */
|
||||||
|
|
|
@ -33,7 +33,7 @@ typedef struct _E_Event_Config_Icon_Theme E_Event_Config_Icon_Theme;
|
||||||
/* increment this whenever a new set of config values are added but the users
|
/* increment this whenever a new set of config values are added but the users
|
||||||
* config doesn't need to be wiped - simply new values need to be put in
|
* config doesn't need to be wiped - simply new values need to be put in
|
||||||
*/
|
*/
|
||||||
#define E_CONFIG_FILE_GENERATION 0x0128
|
#define E_CONFIG_FILE_GENERATION 0x0129
|
||||||
#define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION)
|
#define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION)
|
||||||
|
|
||||||
#define E_EVAS_ENGINE_DEFAULT 0
|
#define E_EVAS_ENGINE_DEFAULT 0
|
||||||
|
@ -313,6 +313,8 @@ struct _E_Config
|
||||||
|
|
||||||
unsigned char show_cursor; // GUI
|
unsigned char show_cursor; // GUI
|
||||||
unsigned char idle_cursor; // GUI
|
unsigned char idle_cursor; // GUI
|
||||||
|
|
||||||
|
const char *default_system_menu;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _E_Config_Module
|
struct _E_Config_Module
|
||||||
|
|
|
@ -21,7 +21,7 @@ EAPI int
|
||||||
e_order_init(void)
|
e_order_init(void)
|
||||||
{
|
{
|
||||||
handlers = eina_list_append(handlers, ecore_event_handler_add(EFREET_EVENT_DESKTOP_CHANGE, _e_order_cb_efreet_desktop_change, NULL));
|
handlers = eina_list_append(handlers, ecore_event_handler_add(EFREET_EVENT_DESKTOP_CHANGE, _e_order_cb_efreet_desktop_change, NULL));
|
||||||
|
efreet_menu_file_set(e_config->default_system_menu);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,8 @@ pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH
|
||||||
pkg_LTLIBRARIES = module.la \
|
pkg_LTLIBRARIES = module.la \
|
||||||
page_000.la \
|
page_000.la \
|
||||||
page_010.la \
|
page_010.la \
|
||||||
page_020.la
|
page_020.la \
|
||||||
|
page_030.la
|
||||||
|
|
||||||
module_la_SOURCES = e_mod_main.c \
|
module_la_SOURCES = e_mod_main.c \
|
||||||
e_mod_main.h \
|
e_mod_main.h \
|
||||||
|
@ -46,5 +47,10 @@ page_020_la_LIBADD = @e_libs@ @dlopen_libs@
|
||||||
page_020_la_LDFLAGS = -module -avoid-version
|
page_020_la_LDFLAGS = -module -avoid-version
|
||||||
page_020_la_DEPENDENCIES = $(top_builddir)/config.h
|
page_020_la_DEPENDENCIES = $(top_builddir)/config.h
|
||||||
|
|
||||||
|
page_030_la_SOURCES = page_030.c
|
||||||
|
page_030_la_LIBADD = @e_libs@ @dlopen_libs@
|
||||||
|
page_030_la_LDFLAGS = -module -avoid-version
|
||||||
|
page_030_la_DEPENDENCIES = $(top_builddir)/config.h
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
|
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
|
||||||
|
|
|
@ -48,6 +48,11 @@ EAPI E_Module_Api e_modapi =
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static int _cb_sort_files(char *f1, char *f2)
|
||||||
|
{
|
||||||
|
return strcmp(f1, f2);
|
||||||
|
}
|
||||||
|
|
||||||
EAPI void *
|
EAPI void *
|
||||||
e_modapi_init(E_Module *m)
|
e_modapi_init(E_Module *m)
|
||||||
{
|
{
|
||||||
|
@ -64,6 +69,7 @@ e_modapi_init(E_Module *m)
|
||||||
char *file;
|
char *file;
|
||||||
|
|
||||||
ecore_list_first_goto(files);
|
ecore_list_first_goto(files);
|
||||||
|
ecore_list_sort(files, ECORE_COMPARE_CB(_cb_sort_files), ECORE_SORT_MIN);
|
||||||
while ((file = ecore_list_current(files)))
|
while ((file = ecore_list_current(files)))
|
||||||
{
|
{
|
||||||
if (!strncmp(file, "page_", 5))
|
if (!strncmp(file, "page_", 5))
|
||||||
|
|
|
@ -38,6 +38,7 @@ EAPI E_Wizard_Page *
|
||||||
EAPI void e_wizard_page_del(E_Wizard_Page *pg);
|
EAPI void e_wizard_page_del(E_Wizard_Page *pg);
|
||||||
EAPI void e_wizard_button_next_enable_set(int enable);
|
EAPI void e_wizard_button_next_enable_set(int enable);
|
||||||
EAPI void e_wizard_title_set(const char *title);
|
EAPI void e_wizard_title_set(const char *title);
|
||||||
|
EAPI void e_wizard_labels_update(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -83,6 +83,7 @@ wizard_page_show(E_Wizard_Page *pg)
|
||||||
snprintf(buf, sizeof(buf), "%s/profile.desktop", dir);
|
snprintf(buf, sizeof(buf), "%s/profile.desktop", dir);
|
||||||
desk = efreet_desktop_get(buf);
|
desk = efreet_desktop_get(buf);
|
||||||
label = prof;
|
label = prof;
|
||||||
|
// FIXME: filter out wizard default profile
|
||||||
if ((desk) && (desk->name)) label = desk->name;
|
if ((desk) && (desk->name)) label = desk->name;
|
||||||
snprintf(buf, sizeof(buf), "%s/icon.edj", dir);
|
snprintf(buf, sizeof(buf), "%s/icon.edj", dir);
|
||||||
if ((desk) && (desk->icon))
|
if ((desk) && (desk->icon))
|
||||||
|
@ -133,5 +134,7 @@ EAPI int
|
||||||
wizard_page_apply(E_Wizard_Page *pg)
|
wizard_page_apply(E_Wizard_Page *pg)
|
||||||
{
|
{
|
||||||
// FIXME: actually apply profile
|
// FIXME: actually apply profile
|
||||||
|
if (!profile) profile = "default";
|
||||||
|
e_config_profile_set(profile);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,172 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
|
#include "e.h"
|
||||||
|
#include "e_mod_main.h"
|
||||||
|
|
||||||
|
static char *xdg_sel = NULL;
|
||||||
|
static Eina_List *menus = NULL;
|
||||||
|
|
||||||
|
EAPI int
|
||||||
|
wizard_page_init(E_Wizard_Page *pg)
|
||||||
|
{
|
||||||
|
const char *dirs[] =
|
||||||
|
{
|
||||||
|
"/etc/xdg",
|
||||||
|
"/usr/etc/xdg",
|
||||||
|
"/usr/local/etc/xdg",
|
||||||
|
"/usr/opt/etc/xdg",
|
||||||
|
"/usr/opt/xdg",
|
||||||
|
// FIXME: add more "known locations"
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; dirs[i]; i++)
|
||||||
|
{
|
||||||
|
Ecore_List *files;
|
||||||
|
char buf[PATH_MAX], *file;
|
||||||
|
|
||||||
|
snprintf(buf, sizeof(buf), "%s/menus", dirs[i]);
|
||||||
|
files = ecore_file_ls(buf);
|
||||||
|
if (files)
|
||||||
|
{
|
||||||
|
ecore_list_first_goto(files);
|
||||||
|
while ((file = ecore_list_current(files)))
|
||||||
|
{
|
||||||
|
if (e_util_glob_match(file, "*.menu"))
|
||||||
|
{
|
||||||
|
snprintf(buf, sizeof(buf), "%s/menus/%s", dirs[i], file);
|
||||||
|
menus = eina_list_append(menus, strdup(buf));
|
||||||
|
}
|
||||||
|
ecore_list_next(files);
|
||||||
|
}
|
||||||
|
ecore_list_destroy(files);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
EAPI int
|
||||||
|
wizard_page_shutdown(E_Wizard_Page *pg)
|
||||||
|
{
|
||||||
|
// FIXME: free menus
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
EAPI int
|
||||||
|
wizard_page_show(E_Wizard_Page *pg)
|
||||||
|
{
|
||||||
|
Evas_Object *o, *of, *ob;
|
||||||
|
Eina_List *l;
|
||||||
|
int i, sel = -1;
|
||||||
|
|
||||||
|
o = e_widget_list_add(pg->evas, 1, 0);
|
||||||
|
e_wizard_title_set(_("Menus"));
|
||||||
|
of = e_widget_framelist_add(pg->evas, _("Select application menu"), 0);
|
||||||
|
|
||||||
|
ob = e_widget_ilist_add(pg->evas, 32 * e_scale, 32 * e_scale, &xdg_sel);
|
||||||
|
e_widget_min_size_set(ob, 140 * e_scale, 140 * e_scale);
|
||||||
|
|
||||||
|
e_widget_ilist_freeze(ob);
|
||||||
|
for (i = 0, l = menus; l; l = l->next, i++)
|
||||||
|
{
|
||||||
|
char buf[PATH_MAX], *file, *p, *p2, *tlabel, *tdesc;
|
||||||
|
const char *label;
|
||||||
|
|
||||||
|
file = l->data;
|
||||||
|
label = file;
|
||||||
|
tlabel = NULL;
|
||||||
|
tdesc = NULL;
|
||||||
|
if (!strcmp("/etc/xdg/menus/applications.menu", file))
|
||||||
|
{
|
||||||
|
label = _("System Default");
|
||||||
|
sel = i;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p = strrchr(file, '/');
|
||||||
|
if (p)
|
||||||
|
{
|
||||||
|
p++;
|
||||||
|
p2 = strchr(p, '-');
|
||||||
|
if (!p2) p2 = strrchr(p, '.');
|
||||||
|
if (p2)
|
||||||
|
{
|
||||||
|
tlabel = malloc(p2 - p + 1);
|
||||||
|
if (tlabel)
|
||||||
|
{
|
||||||
|
strncpy(tlabel, p, p2 - p);
|
||||||
|
tlabel[p2 - p] = 0;
|
||||||
|
tlabel[0] = toupper(tlabel[0]);
|
||||||
|
if (*p2 == '-')
|
||||||
|
{
|
||||||
|
p2++;
|
||||||
|
p = strrchr(p2, '.');
|
||||||
|
if (p)
|
||||||
|
{
|
||||||
|
tdesc = malloc(p - p2 + 1);
|
||||||
|
if (tdesc)
|
||||||
|
{
|
||||||
|
strncpy(tdesc, p2, p - p2);
|
||||||
|
tdesc[p - p2] = 0;
|
||||||
|
tdesc[0] = toupper(tdesc[0]);
|
||||||
|
snprintf(buf, sizeof(buf), "%s (%s)", tlabel, tdesc);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
snprintf(buf, sizeof(buf), "%s", tlabel);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
snprintf(buf, sizeof(buf), "%s", tlabel);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
snprintf(buf, sizeof(buf), "%s", tlabel);
|
||||||
|
label = buf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
label = p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
e_widget_ilist_append(ob, NULL, label, NULL, NULL, file);
|
||||||
|
if (tlabel) free(tlabel);
|
||||||
|
if (tdesc) free(tdesc);
|
||||||
|
free(file);
|
||||||
|
}
|
||||||
|
if (!menus)
|
||||||
|
{
|
||||||
|
e_widget_ilist_append(ob, NULL, _("No menus found"), NULL, NULL, NULL);
|
||||||
|
sel = 0;
|
||||||
|
}
|
||||||
|
if (menus) evas_list_free(menus);
|
||||||
|
e_widget_ilist_go(ob);
|
||||||
|
e_widget_ilist_thaw(ob);
|
||||||
|
|
||||||
|
if (sel >= 0) e_widget_ilist_selected_set(ob, sel);
|
||||||
|
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
e_widget_list_object_append(o, of, 0, 0, 0.5);
|
||||||
|
|
||||||
|
evas_object_show(ob);
|
||||||
|
evas_object_show(of);
|
||||||
|
e_wizard_page_show(o);
|
||||||
|
pg->data = of;
|
||||||
|
return 1; /* 1 == show ui, and wait for user, 0 == just continue */
|
||||||
|
}
|
||||||
|
EAPI int
|
||||||
|
wizard_page_hide(E_Wizard_Page *pg)
|
||||||
|
{
|
||||||
|
evas_object_del(pg->data);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
EAPI int
|
||||||
|
wizard_page_apply(E_Wizard_Page *pg)
|
||||||
|
{
|
||||||
|
if (!strcmp("/etc/xdg/menus/applications.menu", xdg_sel))
|
||||||
|
xdg_sel = NULL;
|
||||||
|
if (xdg_sel)
|
||||||
|
e_config->default_system_menu = eina_stringshare_add(xdg_sel);
|
||||||
|
else
|
||||||
|
e_config->default_system_menu = NULL;
|
||||||
|
efreet_menu_file_set(e_config->default_system_menu);
|
||||||
|
// FIXME: no normal config dialog to change this!
|
||||||
|
return 1;
|
||||||
|
}
|
Loading…
Reference in New Issue