]> git.pld-linux.org Git - packages/mate-menus.git/commitdiff
handle XDG_MENU_PREFIX, like it was in GNOME2/GNOME3 auto/th/mate-menus-1.5.0-2
authorElan Ruusamäe <glen@delfi.ee>
Wed, 16 Jan 2013 10:37:57 +0000 (12:37 +0200)
committerElan Ruusamäe <glen@delfi.ee>
Wed, 16 Jan 2013 10:37:57 +0000 (12:37 +0200)
do not enforce hardcoded mate prefix

mate-menus.spec
xdg-menu-prefix-compat.patch [new file with mode: 0644]

index e2a1b443f66db34da333dfc3ea4531cbadbcc09f..11d1ef78fe13c7c1faf95eb4facbed72f7795595 100644 (file)
@@ -1,12 +1,13 @@
 Summary:       Displays menus for MATE Desktop
 Name:          mate-menus
 Version:       1.5.0
-Release:       1
+Release:       2
 License:       GPL v2+ and LGPL v2+
 Group:         X11/Applications
 Source0:       http://pub.mate-desktop.org/releases/1.5/%{name}-%{version}.tar.xz
 # Source0-md5: fc36e94245d8508cda14c2cd436aad5a
 URL:           http://wiki.mate-desktop.org/mate-menus
+Patch0:                xdg-menu-prefix-compat.patch
 BuildRequires: gobject-introspection-devel
 BuildRequires: intltool >= 0.40.0
 BuildRequires: mate-common >= 1.5
@@ -35,6 +36,7 @@ Development files for mate-menus
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
 NOCONFIGURE=1 ./autogen.sh
diff --git a/xdg-menu-prefix-compat.patch b/xdg-menu-prefix-compat.patch
new file mode 100644 (file)
index 0000000..affb745
--- /dev/null
@@ -0,0 +1,73 @@
+restore XDG_MENU_PREFIX functionality
+
+23:19:05  glen> hmm, xdg menus does not seem to work
+23:19:07  glen> i mean $XDG_MENU_PREFIX
+23:19:09  glen> is not respected
+23:19:51  glen> 23:19:38 root[load: 3.16]@blodnatt xdg/menus# ls -l /etc/xdg/menus/${XDG_MENU_PREFIX}applications.menu
+23:19:51  glen> -rw-r--r-- 1 root root 23K 18. mai    2012 /etc/xdg/menus/applnk-applications.menu
+
+seems perberos just renamed the file not to conflict file installed by GNOME
+
+additionally load mate-applications.menu if XDG_MENU_PREFIX is not set, as this
+is how we package mate applications.menu.
+--- mate-menus-1.5.0/./libmenu/matemenu-tree.c~        2012-10-11 11:26:03.000000000 +0300
++++ mate-menus-1.5.0/./libmenu/matemenu-tree.c 2013-01-15 23:41:33.733159313 +0200
+@@ -539,7 +539,7 @@
+       {
+               matemenu_tree_remove_menu_file_monitors (tree);
+-              if (strcmp(tree->basename, "mate-applications.menu") == 0 && g_getenv("XDG_MENU_PREFIX"))
++              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);
+@@ -1895,7 +1895,7 @@
+       found = FALSE;
+       menu_file = g_strconcat(menu_name, ".menu", NULL);
+-      if (strcmp(menu_file, "mate-applications.menu") == 0 && g_getenv("XDG_MENU_PREFIX"))
++      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);
+--- mate-menus-1.5.0/util/test-menu-spec.c~    2012-10-11 11:26:03.000000000 +0300
++++ mate-menus-1.5.0/util/test-menu-spec.c     2013-01-15 23:36:26.719020435 +0200
+@@ -191,8 +191,7 @@
+               flags |= MATEMENU_TREE_FLAGS_INCLUDE_NODISPLAY;
+       }
+-      // Usamos applications.menu is existe. Para compatibilidad con GNOME
+-      MateMenuTree* tree = matemenu_tree_lookup(menu_file ? menu_file : "mate-applications.menu", flags);
++      MateMenuTree* tree = matemenu_tree_lookup(menu_file ? menu_file : "applications.menu", flags);
+       g_assert(tree != NULL);
+--- mate-menus-1.5.0/util/mate-menus-ls.py~    2012-10-11 11:26:03.000000000 +0300
++++ mate-menus-1.5.0/util/mate-menus-ls.py     2013-01-15 23:37:38.595663893 +0200
+@@ -72,7 +72,7 @@
+     if options.file:
+         menu_file = options.file
+     else:
+-        menu_file = 'mate-applications.menu'
++        menu_file = 'applications.menu'
+     flags = matemenu.FLAGS_NONE
+     if options.exclude:
+--- mate-menus-1.5.0/libmenu/matemenu-tree.c~  2013-01-16 11:12:55.000000000 +0200
++++ mate-menus-1.5.0/libmenu/matemenu-tree.c   2013-01-16 12:36:08.224428926 +0200
+@@ -1903,6 +1903,15 @@
+               g_free(prefixed_basename);
+       }
++      // load mate-applications.menu
++      if (!found && !g_getenv("XDG_MENU_PREFIX"))
++      {
++              char* prefixed_basename;
++              prefixed_basename = g_strdup_printf("mate-%s", menu_file);
++              found = load_parent_merge_file_from_basename(tree, loaded_menu_files, layout, prefixed_basename, canonical_basedir);
++              g_free(prefixed_basename);
++      }
++
+       if (!found)
+       {
+               found = load_parent_merge_file_from_basename(tree, loaded_menu_files, layout, menu_file, canonical_basedir);
This page took 0.144142 seconds and 4 git commands to generate.