If XDG_MENU_PREFIX is not set, set it. This allows the menu to work when

not using gnome-session and not knowing about XDG_MENU_PREFIX.
This commit is contained in:
ajacoutot 2009-11-15 14:10:02 +00:00
parent c663c5d14d
commit b29a744178
2 changed files with 68 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.29 2009/11/14 16:39:44 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.30 2009/11/15 14:10:02 ajacoutot Exp $
SHARED_ONLY= Yes
@ -6,7 +6,7 @@ COMMENT= implementation of the FreeDesktop Desktop Menu Spec
GNOME_PROJECT= gnome-menus
GNOME_VERSION= 2.28.0.1
PKGNAME= ${DISTNAME}p1
PKGNAME= ${DISTNAME}p2
SHARED_LIBS += gnome-menu 5.0 # .6.2

View File

@ -0,0 +1,66 @@
$OpenBSD: patch-libmenu_gmenu-tree_c,v 1.1 2009/11/15 14:10:02 ajacoutot Exp $
Set default menu to gnome-applications.menu if XDG_MENU_PREFIX is not set.
--- libmenu/gmenu-tree.c.orig Thu Oct 1 13:08:33 2009
+++ libmenu/gmenu-tree.c Sun Nov 15 12:55:42 2009
@@ -23,6 +23,7 @@
#include <string.h>
#include <errno.h>
+#include <stdlib.h>
#include "menu-layout.h"
#include "menu-monitor.h"
@@ -540,16 +541,13 @@ gmenu_tree_canonicalize_path (GMenuTree *tree)
{
gmenu_tree_remove_menu_file_monitors (tree);
- if (strcmp (tree->basename, "applications.menu") == 0 &&
- g_getenv ("XDG_MENU_PREFIX"))
- {
- char *prefixed_basename;
- prefixed_basename = g_strdup_printf ("%s%s",
- g_getenv ("XDG_MENU_PREFIX"),
- tree->basename);
- canonicalize_basename (tree, prefixed_basename);
- g_free (prefixed_basename);
- }
+ setenv ("XDG_MENU_PREFIX", "gnome-", 0);
+ char *prefixed_basename;
+ prefixed_basename = g_strdup_printf ("%s%s",
+ g_getenv ("XDG_MENU_PREFIX"),
+ tree->basename);
+ canonicalize_basename (tree, prefixed_basename);
+ g_free (prefixed_basename);
if (!tree->canonical)
canonicalize_basename (tree, tree->basename);
@@ -1949,18 +1947,15 @@ load_parent_merge_file (GMenuTree *tree,
found = FALSE;
menu_file = g_strconcat (menu_name, ".menu", NULL);
- if (strcmp (menu_file, "applications.menu") == 0 &&
- g_getenv ("XDG_MENU_PREFIX"))
- {
- char *prefixed_basename;
- prefixed_basename = g_strdup_printf ("%s%s",
- g_getenv ("XDG_MENU_PREFIX"),
- menu_file);
- found = load_parent_merge_file_from_basename (tree, loaded_menu_files,
- layout, prefixed_basename,
- canonical_basedir);
- g_free (prefixed_basename);
- }
+ setenv ("XDG_MENU_PREFIX", "gnome-", 0);
+ char *prefixed_basename;
+ prefixed_basename = g_strdup_printf ("%s%s",
+ g_getenv ("XDG_MENU_PREFIX"),
+ menu_file);
+ found = load_parent_merge_file_from_basename (tree, loaded_menu_files,
+ layout, prefixed_basename,
+ canonical_basedir);
+ g_free (prefixed_basename);
if (!found)
{