File icewm-mate.patch of Package icewm.8066

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,5 +53,5 @@ add_subdirectory(po)
 add_subdirectory(lib)
 add_subdirectory(doc)
 
+install(FILES icewm-set-matewm DESTINATION ${BINDIR} PERMISSIONS WORLD_EXECUTE OWNER_EXECUTE GROUP_EXECUTE WORLD_READ OWNER_READ OWNER_WRITE GROUP_READ)
 install(FILES icewm-set-gnomewm DESTINATION ${BINDIR} PERMISSIONS WORLD_EXECUTE OWNER_EXECUTE GROUP_EXECUTE WORLD_READ OWNER_READ OWNER_WRITE GROUP_READ)
-
--- a/configure.ac
+++ b/configure.ac
@@ -344,6 +344,18 @@ fi
 AC_SUBST([GNOME1_CFLAGS])
 AC_SUBST([GNOME1_LIBS])
 
+AC_ARG_ENABLE([menus-mate],
+    AC_HELP_STRING([--disable-menus-mate],[Disable display of MATE menus.]))
+if test x$enable_menus_mate != xno; then
+    PKG_CHECK_MODULES([GNOME2],[mate-desktop-2.0],[
+	enable_menus_gnome2=no
+	AC_DEFINE([CONFIG_MATE_MENUS],[1],[Define to make IceWM more MATE-friendly])
+	AC_DEFINE([CONFIG_GNOME_MENUS],[1],[Define to make IceWM more GNOME-friendly])
+	BUILD_MENU_MATE=yes
+	APPLICATIONS="${APPLICATIONS} icewm-menu-mate"],[
+	AC_MSG_WARN([MATE menus not supported.])])
+fi
+
 AC_ARG_ENABLE([menus-gnome2],
     AC_HELP_STRING([--disable-menus-gnome2],[Disable display of GNOME 2 menus.]))
 if test x$enable_menus_gnome2 != xno; then
@@ -383,6 +395,7 @@ AM_CONDITIONAL([BUILD_HELP],[test x$BUIL
 AM_CONDITIONAL([BUILD_SOUND],[test x$BUILD_SOUND = xyes])
 AM_CONDITIONAL([BUILD_MENU_GNOME1],[test x$BUILD_MENU_GNOME1 = xyes])
 AM_CONDITIONAL([BUILD_MENU_GNOME2],[test x$BUILD_MENU_GNOME2 = xyes])
+AM_CONDITIONAL([BUILD_MENU_MATE],[test x$BUILD_MENU_MATE = xyes])
 AM_CONDITIONAL([BUILD_MENU_FDO],[test x$BUILD_MENU_FDO = xyes])
 
 test "x$prefix" = xNONE && prefix="$ac_default_prefix"
--- a/icewm.desktop
+++ b/icewm.desktop
@@ -0,0 +1,13 @@
+[Desktop Entry]
+Type=Application
+Name=IceWM
+Exec=icewm
+NoDisplay=true
+X-MATE-WMName=IceWM
+X-MATE-Autostart-Phase=WindowManager
+X-MATE-Provides=windowmanager
+X-MATE-Autostart-Notify=true
+X-GNOME-WMName=IceWM
+X-GNOME-Autostart-Phase=WindowManager
+X-GNOME-Provides=windowmanager
+X-GNOME-Autostart-Notify=true
--- a/icewm-set-matewm
+++ b/icewm-set-matewm
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+echo -n "Previous window manager: "
+gsettings get org.mate.session.required-components windowmanager
+
+gsettings set org.mate.session.required-components windowmanager "'icewm'"
+
+echo -n "New window manager: "
+gsettings get org.mate.session.required-components windowmanager
--- a/Makefile.am
+++ b/Makefile.am
@@ -36,8 +36,12 @@ dist_noinst_SCRIPTS = \
 	autogen.sh
 
 dist_bin_SCRIPTS = \
+	icewm-set-matewm \
 	icewm-set-gnomewm
 
+desktopdir = $(datadir)/applications
+desktop_DATA = icewm.desktop
+
 ChangeLog:
 	( \
 	  echo -e "# created with git log -n 200 --abbrev-commit --decorate --stat=76 -M -C|fmt -sct -w80\n" ; \
--- a/src/gnome2.cc
+++ b/src/gnome2.cc
@@ -22,12 +22,17 @@
 #include <dirent.h>
 #include <string.h>
 
-#include <gnome.h>
+#include "yarray.h"
+#ifdef CONFIG_MATE_MENUS
+#include <libmate-desktop/mate-desktop-item.h>
+
+char const * ApplicationName = "icewm-menu-mate";
+#else
 #include <libgnome/gnome-desktop-item.h>
 #include <libgnomevfs/gnome-vfs-init.h>
-#include "yarray.h"
 
 char const * ApplicationName = "icewm-menu-gnome2";
+#endif
 
 class GnomeMenu;
 
@@ -58,14 +63,16 @@ void dumpMenu(GnomeMenu *menu) {
         GnomeMenuItem *item = menu->items.getItem(i);
 
         if (item->dentry && !item->submenu) {
-            printf("prog \"%s\" %s icewm-menu-gnome2 --open \"%s\"\n",
+            printf("prog \"%s\" %s %s --open \"%s\"\n",
                    item->title,
                    item->icon ? item->icon : "-",
+                   ApplicationName,
                    item->dentry);
         } else if (item->dentry && item->submenu) {
-            printf("menuprog \"%s\" %s icewm-menu-gnome2 --list \"%s\"\n",
+            printf("menuprog \"%s\" %s %s --list \"%s\"\n",
                    item->title,
                    item->icon ? item->icon : "-",
+                   ApplicationName,
                    (!strcmp(my_basename(item->dentry), ".directory") ?
                     g_dirname(item->dentry) : item->dentry));
         }
@@ -101,16 +108,27 @@ void GnomeMenu::addEntry(const char *fPa
         GnomeMenuItem *item = new GnomeMenuItem();
         item->title = name;
 
+#ifdef CONFIG_MATE_MENUS
+        MateDesktopItem *ditem =
+            mate_desktop_item_new_from_file(npath,
+                                             (MateDesktopItemLoadFlags)0,
+#else
         GnomeDesktopItem *ditem =
             gnome_desktop_item_new_from_file(npath,
                                              (GnomeDesktopItemLoadFlags)0,
+#endif
                                              NULL);
 
         struct stat sb;
         const char *type;
         bool isDir = (!stat(npath, &sb) && S_ISDIR(sb.st_mode));
+#ifdef CONFIG_MATE_MENUS
+        type = mate_desktop_item_get_string(ditem,
+                                             MATE_DESKTOP_ITEM_TYPE);
+#else
         type = gnome_desktop_item_get_string(ditem,
                                              GNOME_DESKTOP_ITEM_TYPE);
+#endif
         if (!isDir && type && strstr(type, "Directory")) {
             isDir = 1;
         }
@@ -119,7 +137,9 @@ void GnomeMenu::addEntry(const char *fPa
             GnomeMenu *submenu = new GnomeMenu();
 
             item->title = g_path_get_basename(npath);
-            item->icon = gnome_pixmap_file("gnome-folder.png");
+            item->icon = gtk_icon_info_get_filename(gtk_icon_theme_lookup_icon(
+                                                     gtk_icon_theme_get_default(), "folder",
+                                                     16, GTK_ICON_LOOKUP_NO_SVG));
             item->submenu = submenu;
 
             char *epath = new char[nlen + sizeof("/.directory")];
@@ -130,19 +150,35 @@ void GnomeMenu::addEntry(const char *fPa
                 strcpy(epath, npath);
             }
 
+#ifdef CONFIG_MATE_MENUS
+            ditem = mate_desktop_item_new_from_file(epath,
+                                                     (MateDesktopItemLoadFlags)0,
+#else
             ditem = gnome_desktop_item_new_from_file(epath,
                                                      (GnomeDesktopItemLoadFlags)0,
+#endif
                                                      NULL);
             if (ditem) {
+#ifdef CONFIG_MATE_MENUS
+                item->title = mate_desktop_item_get_localestring(ditem, MATE_DESKTOP_ITEM_NAME); //LXP FX
+                item->icon = mate_desktop_item_get_string(ditem, MATE_DESKTOP_ITEM_ICON);
+#else
                 item->title = gnome_desktop_item_get_localestring(ditem, GNOME_DESKTOP_ITEM_NAME); //LXP FX
                 item->icon = gnome_desktop_item_get_string(ditem, GNOME_DESKTOP_ITEM_ICON);
+#endif
             }
             item->dentry = epath;
         } else {
             if (type && !strstr(type, "Directory")) {
+#ifdef CONFIG_MATE_MENUS
+                item->title = mate_desktop_item_get_localestring(ditem, MATE_DESKTOP_ITEM_NAME);
+                if (mate_desktop_item_get_string(ditem, MATE_DESKTOP_ITEM_ICON))
+                    item->icon = mate_desktop_item_get_string(ditem, MATE_DESKTOP_ITEM_ICON);
+#else
                 item->title = gnome_desktop_item_get_localestring(ditem, GNOME_DESKTOP_ITEM_NAME);
                 if (gnome_desktop_item_get_string(ditem, GNOME_DESKTOP_ITEM_ICON))
                     item->icon = gnome_desktop_item_get_string(ditem, GNOME_DESKTOP_ITEM_ICON);
+#endif
                 item->dentry = npath;
             }
         }
@@ -280,13 +316,24 @@ void GnomeMenu::populateMenu(const char
                 char fullpath[256];
                 strcpy(fullpath, dirname);
                 strcat(fullpath, file->d_name);
+#ifdef CONFIG_MATE_MENUS
+                MateDesktopItem *ditem =
+                    mate_desktop_item_new_from_file(fullpath,
+                                                     (MateDesktopItemLoadFlags)0,
+#else
                 GnomeDesktopItem *ditem =
                     gnome_desktop_item_new_from_file(fullpath,
                                                      (GnomeDesktopItemLoadFlags)0,
+#endif
                                                      NULL);
                 const char *categories =
+#ifdef CONFIG_MATE_MENUS
+                    mate_desktop_item_get_string(ditem,
+                                                  MATE_DESKTOP_ITEM_CATEGORIES);
+#else
                     gnome_desktop_item_get_string(ditem,
                                                   GNOME_DESKTOP_ITEM_CATEGORIES);
+#endif
 
                 if (categories && strstr(categories, category)) {
                     if (*file->d_name != '.') {
@@ -323,9 +370,15 @@ int runFile(const char *dentry_path) {
     char arg[32];
     int i;
 
+#ifdef CONFIG_MATE_MENUS
+    MateDesktopItem *ditem =
+        mate_desktop_item_new_from_file(dentry_path,
+                                         (MateDesktopItemLoadFlags)0,
+#else
     GnomeDesktopItem *ditem =
         gnome_desktop_item_new_from_file(dentry_path,
                                          (GnomeDesktopItemLoadFlags)0,
+#endif
                                          NULL);
 
     if (ditem == NULL) {
@@ -334,7 +387,11 @@ int runFile(const char *dentry_path) {
 //      FIXME: leads to segfault for some reason, so using execlp instead
 //      gnome_desktop_item_launch(ditem, NULL, 0, NULL);
 
+#ifdef CONFIG_MATE_MENUS
+        const char *app = mate_desktop_item_get_string(ditem, MATE_DESKTOP_ITEM_EXEC);
+#else
         const char *app = gnome_desktop_item_get_string(ditem, GNOME_DESKTOP_ITEM_EXEC);
+#endif
         if(!app)
         	return 1;
 
@@ -351,7 +408,10 @@ int runFile(const char *dentry_path) {
 
 int main(int argc, char **argv) {
 
+    gtk_init(&argc, &argv);
+#ifndef CONFIG_MATE_MENUS
     gnome_vfs_init();
+#endif
 
     for (char ** arg = argv + 1; arg < argv + argc; ++arg) {
         if (**arg == '-') {
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -14,6 +14,7 @@ EXTRA_PROGRAMS = \
 	icesound \
 	icewm-menu-gnome1 \
 	icewm-menu-gnome2 \
+	icewm-menu-mate \
 	icewm-menu-fdo \
 	testarray \
 	testlocale \
@@ -75,6 +76,10 @@ if BUILD_MENU_GNOME2
 bin_PROGRAMS += icewm-menu-gnome2
 endif
 
+if BUILD_MENU_MATE
+bin_PROGRAMS += icewm-menu-mate
+endif
+
 if BUILD_MENU_FDO
 bin_PROGRAMS += icewm-menu-fdo
 endif
@@ -373,6 +378,20 @@ icewm_menu_gnome1_SOURCES = \
 	ycmdline.h
 icewm_menu_gnome1_LDADD = libice.la $(GNOME1_LIBS) $(CORE_LIBS)
 
+icewm_menu_mate_SOURCES = \
+	intl.h \
+	debug.h \
+	sysdep.h \
+	base.h \
+	themable.h \
+	default.h \
+	ylib.h \
+	gnome2.cc \
+	ascii.h \
+	ycmdline.cc \
+	ycmdline.h
+icewm_menu_mate_LDADD = libice.la $(GNOME2_LIBS) $(CORE_LIBS)
+
 icewm_menu_gnome2_SOURCES = \
 	intl.h \
 	debug.h \
openSUSE Build Service is sponsored by