Enlightenment CVS committal
Author : onefang
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_desktop
Modified Files:
ecore_desktop_menu.c ecore_desktop_paths.c
Log Message:
*Implement MergeFile type=parent.
*Workaround for some strangeness I found in some menu files.
*Config path was broken, fixed now.
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop_menu.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- ecore_desktop_menu.c 14 Oct 2006 04:14:28 -0000 1.29
+++ ecore_desktop_menu.c 9 Nov 2006 13:35:21 -0000 1.30
@@ -129,11 +129,17 @@
NULL);
if (!menu_file)
{
- /* Try various quirks of various systems. */
+ /* Try various quirks of various systems and other wms. */
menu_file = ecore_desktop_paths_file_find(ecore_desktop_paths_menus,
+ "kde-applications.menu", -1,
NULL,
+ NULL);
+ if (!menu_file)
+ {
+ menu_file =
ecore_desktop_paths_file_find(ecore_desktop_paths_menus,
"debian-menu.menu", -1, NULL,
NULL);
- /* FIXME: If all else fails, run debians funky menu generator shit. */
+ /* FIXME: If all else fails, run debians funky menu generator
shit. */
+ }
}
if (menu_file)
@@ -240,6 +246,9 @@
data.path = ecore_file_get_dir(file);
if ((level == 0) && (merge_stack == NULL))
merge_stack = ecore_desktop_tree_new(NULL);
+#ifdef DEBUG
+printf("MENU FILE %d - %s\n", level, file);
+#endif
menu_xml = ecore_desktop_xmlame_get(file);
if ((data.stack) && (data.base) && (data.path) && (merge_stack)
&& (menu_xml))
@@ -1225,12 +1234,15 @@
if (path_type)
{
if (string[0] == '/')
- sprintf(merge_path, "%s", string);
+ snprintf(merge_path, PATH_MAX, "%s", string);
else
- sprintf(merge_path, "%s/%s", unxml_data->path, string);
+ snprintf(merge_path, PATH_MAX, "%s/%s", unxml_data->path,
string);
}
else /* This is a parent type MergeFile. */
{
+ char *xdg_path;
+ int found = -1;
+
/* The spec is a little unclear, and the examples may look
like they
* contradict the description, but it all makes sense if you
cross
* reference it with the XDG Base Directory Specification
(version 0.6).
@@ -1238,6 +1250,9 @@
*
* What you do is this.
*
+ * Just plain ignore the specified path in the MergeFile
element, it's for
+ * legacy apps that don't understand parent types.
+ *
* Take the XDG_CONFIG_DIRS stuff as a whole
($XDG_CONFIG_HOME, then
* $XDG_CONFIG_DIRS), in this code that will be
ecore_desktop_paths_config.
*
@@ -1257,12 +1272,26 @@
* The first one found wins, if none are found, don't merge
anything.
*/
- /* FIXME: Actually implement this when I have some menus that
will exercise it.
- * Slackware uses them.
- */
merge_path[0] = '\0';
- printf
- ("\n### Didn't expect a MergeFile parent type in the FDO
menu. onefang must write more code now.\n");
+ ecore_list_goto_first(ecore_desktop_paths_config);
+ while ((xdg_path =
ecore_list_next(ecore_desktop_paths_config)) != NULL)
+ {
+ if (found < 0)
+ {
+ int length = strlen(xdg_path);
+
+ if (strncmp(xdg_path, unxml_data->file, length) ==
0)
+ found = length;
+ }
+ else
+ {
+ snprintf(merge_path, PATH_MAX, "%s%s", xdg_path,
&(unxml_data->file)[found]);
+ if (ecore_file_exists(merge_path))
+ break;
+ merge_path[0] = '\0';
+ }
+ }
+
}
if (merge_path[0] != '\0')
{
@@ -1524,6 +1553,8 @@
#ifdef DEBUG
printf("MAKING MENU - %s \t\t%s\n", generate_data.path,
generate_data.name);
+ ecore_desktop_tree_dump(generate_data.rules, 0);
+ printf("\n\n");
#endif
for (i = 0; i < generate_data.rules->size; i++)
{
@@ -1535,6 +1566,9 @@
elements[i].element;
if (generate_data.rule->size > 0)
{
+ /* FIXME: This might not be correct, but it
fixes ubuntu. */
+ while (generate_data.rule->elements[0].type ==
ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE)
+ generate_data.rule = (Ecore_Desktop_Tree *)
generate_data.rule->elements[0].element;
if (((char *)generate_data.rule->elements[0].
element)[0] == 'I')
{
@@ -1594,7 +1628,7 @@
key = (char *)node->key;
app = (char *)node->value;
- /* FIXME: pass an actualy language parameter. */
+ /* FIXME: pass an actuall language parameter. */
desktop = ecore_desktop_get(app, NULL);
if (desktop)
@@ -1610,9 +1644,9 @@
{
ecore_hash_set(generate_data->apps, key, strdup(app));
#ifdef DEBUG
-// printf("INCLUDING %s%s - %s\n",
-// ((generate_data->unallocated) ? "UNALLOCATED " : ""),
-// app, key);
+ printf("INCLUDING %s%s - %s\n",
+ ((generate_data->unallocated) ? "UNALLOCATED " : ""),
+ app, key);
#endif
}
else
@@ -1678,8 +1712,7 @@
{
// int j;
- if (ecore_hash_get(desktop->Categories, &rul[4]) !=
- NULL)
+ if (ecore_hash_get(desktop->Categories, &rul[4]) !=
NULL)
sub_result = TRUE;
// for (j = 0; j < desktop->Categories->size; j++)
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop_paths.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- ecore_desktop_paths.c 14 Oct 2006 00:29:22 -0000 1.37
+++ ecore_desktop_paths.c 9 Nov 2006 13:35:21 -0000 1.38
@@ -276,7 +276,7 @@
ecore_desktop_paths_config =
_ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_CONFIG, NULL,
"XDG_CONFIG_HOME", "XDG_CONFIG_DIRS",
- "~/.config", "/etc/xdg", "", NULL, NULL);
+ "~/.config", "/etc/xdg", NULL, NULL, NULL);
if (!ecore_desktop_paths_xsessions)
ecore_desktop_paths_xsessions =
_ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_XSESSIONS, NULL,
@@ -483,18 +483,28 @@
if ((value == NULL) || (value[0] == '\0'))
value = env_home_default;
env_list = ecore_desktop_paths_to_list(value);
- if (env_list && types)
+ if (env_list)
{
- char *this_env, *this_type;
+ char *this_env;
ecore_list_goto_first(env_list);
while ((this_env = ecore_list_next(env_list)) != NULL)
{
- ecore_list_goto_first(types);
- while ((this_type = ecore_list_next(types)) != NULL)
+ if (types)
{
- _ecore_desktop_paths_massage_path(path, home,
+ char *this_type;
+
+ ecore_list_goto_first(types);
+ while ((this_type = ecore_list_next(types)) != NULL)
+ {
+ _ecore_desktop_paths_massage_path(path, home,
this_env, this_type);
+ _ecore_desktop_paths_check_and_add(paths, path);
+ }
+ }
+ else
+ {
+ _ecore_desktop_paths_massage_path(path, home, this_env,
NULL);
_ecore_desktop_paths_check_and_add(paths, path);
}
}
@@ -534,18 +544,28 @@
if ((value == NULL) || (value[0] == '\0'))
value = env_default;
env_list = ecore_desktop_paths_to_list(value);
- if (env_list && types)
+ if (env_list)
{
- char *this_env, *this_type;
+ char *this_env;
ecore_list_goto_first(env_list);
while ((this_env = ecore_list_next(env_list)) != NULL)
{
- ecore_list_goto_first(types);
- while ((this_type = ecore_list_next(types)) != NULL)
+ if (types)
{
- _ecore_desktop_paths_massage_path(path, home,
+ char *this_type;
+
+ ecore_list_goto_first(types);
+ while ((this_type = ecore_list_next(types)) != NULL)
+ {
+ _ecore_desktop_paths_massage_path(path, home,
this_env, this_type);
+ _ecore_desktop_paths_check_and_add(paths, path);
+ }
+ }
+ else
+ {
+ _ecore_desktop_paths_massage_path(path, home, this_env,
NULL);
_ecore_desktop_paths_check_and_add(paths, path);
}
}
@@ -572,18 +592,28 @@
* if it exists, add it to end of paths
*/
- if (gnome_data && types)
+ if (gnome_data)
{
- char *this_gnome, *this_type;
+ char *this_gnome;
ecore_list_goto_first(gnome_data);
while ((this_gnome = ecore_list_next(gnome_data)) != NULL)
{
- ecore_list_goto_first(types);
- while ((this_type = ecore_list_next(types)) != NULL)
+ if (types)
{
- _ecore_desktop_paths_massage_path(path, home,
- this_gnome, this_type);
+ char *this_type;
+
+ ecore_list_goto_first(types);
+ while ((this_type = ecore_list_next(types)) != NULL)
+ {
+ _ecore_desktop_paths_massage_path(path, home,
+ this_gnome, this_type);
+ _ecore_desktop_paths_check_and_add(paths, path);
+ }
+ }
+ else
+ {
+ _ecore_desktop_paths_massage_path(path, home, this_gnome,
NULL);
_ecore_desktop_paths_check_and_add(paths, path);
}
}
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs