summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2008-10-25 15:18:48 +0000
committerCarsten Haitzler <raster@rasterman.com>2008-10-25 15:18:48 +0000
commit96b6bd54dca0f57d00112e8660d586db41830a6a (patch)
tree1de3c53b033f29f50ed3f5f8505ae554649228c3 /src
parent625af3eb8861bd33c58d6bac1e3ea1b0ca920643 (diff)
downloadenlightenment-96b6bd54dca0f57d00112e8660d586db41830a6a.tar.gz
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
Diffstat (limited to 'src')
-rw-r--r--src/bin/e_config.c6
-rw-r--r--src/bin/e_config.h4
-rw-r--r--src/bin/e_order.c2
-rw-r--r--src/modules/wizard/Makefile.am8
-rw-r--r--src/modules/wizard/e_mod_main.c6
-rw-r--r--src/modules/wizard/e_wizard.h1
-rw-r--r--src/modules/wizard/page_020.c3
-rw-r--r--src/modules/wizard/page_030.c172
8 files changed, 199 insertions, 3 deletions
diff --git a/src/bin/e_config.c b/src/bin/e_config.c
index d7586d8df4..2886d16b3f 100644
--- a/src/bin/e_config.c
+++ b/src/bin/e_config.c
@@ -635,6 +635,8 @@ e_config_init(void)
E_CONFIG_VAL(D, T, show_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);
if (e_config)
@@ -1586,6 +1588,10 @@ e_config_init(void)
e_config->idle_cursor = 1;
IFCFGEND;
+ IFCFG(0x0129);
+ e_config->default_system_menu = NULL;
+ IFCFGEND;
+
e_config->config_version = E_CONFIG_FILE_VERSION;
#if 0 /* example of new config */
diff --git a/src/bin/e_config.h b/src/bin/e_config.h
index e16e2909ba..4045dd087f 100644
--- a/src/bin/e_config.h
+++ b/src/bin/e_config.h
@@ -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
* 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_EVAS_ENGINE_DEFAULT 0
@@ -313,6 +313,8 @@ struct _E_Config
unsigned char show_cursor; // GUI
unsigned char idle_cursor; // GUI
+
+ const char *default_system_menu;
};
struct _E_Config_Module
diff --git a/src/bin/e_order.c b/src/bin/e_order.c
index 3d7eb85da0..0dd74ee50f 100644
--- a/src/bin/e_order.c
+++ b/src/bin/e_order.c
@@ -21,7 +21,7 @@ EAPI int
e_order_init(void)
{
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;
}
diff --git a/src/modules/wizard/Makefile.am b/src/modules/wizard/Makefile.am
index f28f02ce52..7a2115339c 100644
--- a/src/modules/wizard/Makefile.am
+++ b/src/modules/wizard/Makefile.am
@@ -20,7 +20,8 @@ pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH
pkg_LTLIBRARIES = module.la \
page_000.la \
page_010.la \
- page_020.la
+ page_020.la \
+ page_030.la
module_la_SOURCES = e_mod_main.c \
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_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:
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
diff --git a/src/modules/wizard/e_mod_main.c b/src/modules/wizard/e_mod_main.c
index ccbe6472e7..fa75ebdce1 100644
--- a/src/modules/wizard/e_mod_main.c
+++ b/src/modules/wizard/e_mod_main.c
@@ -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 *
e_modapi_init(E_Module *m)
{
@@ -64,6 +69,7 @@ e_modapi_init(E_Module *m)
char *file;
ecore_list_first_goto(files);
+ ecore_list_sort(files, ECORE_COMPARE_CB(_cb_sort_files), ECORE_SORT_MIN);
while ((file = ecore_list_current(files)))
{
if (!strncmp(file, "page_", 5))
diff --git a/src/modules/wizard/e_wizard.h b/src/modules/wizard/e_wizard.h
index db6139cdf6..a05f65ab88 100644
--- a/src/modules/wizard/e_wizard.h
+++ b/src/modules/wizard/e_wizard.h
@@ -38,6 +38,7 @@ EAPI E_Wizard_Page *
EAPI void e_wizard_page_del(E_Wizard_Page *pg);
EAPI void e_wizard_button_next_enable_set(int enable);
EAPI void e_wizard_title_set(const char *title);
+EAPI void e_wizard_labels_update(void);
#endif
#endif
diff --git a/src/modules/wizard/page_020.c b/src/modules/wizard/page_020.c
index 5bf109156c..3d8d0951e6 100644
--- a/src/modules/wizard/page_020.c
+++ b/src/modules/wizard/page_020.c
@@ -83,6 +83,7 @@ wizard_page_show(E_Wizard_Page *pg)
snprintf(buf, sizeof(buf), "%s/profile.desktop", dir);
desk = efreet_desktop_get(buf);
label = prof;
+ // FIXME: filter out wizard default profile
if ((desk) && (desk->name)) label = desk->name;
snprintf(buf, sizeof(buf), "%s/icon.edj", dir);
if ((desk) && (desk->icon))
@@ -133,5 +134,7 @@ EAPI int
wizard_page_apply(E_Wizard_Page *pg)
{
// FIXME: actually apply profile
+ if (!profile) profile = "default";
+ e_config_profile_set(profile);
return 1;
}
diff --git a/src/modules/wizard/page_030.c b/src/modules/wizard/page_030.c
new file mode 100644
index 0000000000..559b1428a5
--- /dev/null
+++ b/src/modules/wizard/page_030.c
@@ -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;
+}