You could perhaps use the OnlyShowIn= line in the .desktop files for the menu items. Run through the .deskstop files and echo OnlyShowIn=GNOME or something similar. There's nothing like a dirty hack.
Well, hacking every single desktop file is doable for solitary end users, but there is no way to package that in TDE, nor would we want to. :)
There is some code in tdelibs/kservice.cpp to append KDE4 menu options with [KDE4]. The basic detection method is the root file path of the desktop file, which for KDE4 apps is $PREFIX/share/applications/kde4/.
In bug report 892 I proposed changing the default install path for Trinity apps from $PREFIX/share/applications/kde/ to $PREFIX/share/applications/trinity/. At that point we would have a way to distinguish desktop files from the three desktops without grepping any desktop files.
Long term, a couple of check boxes in KControl -> Desktop -> Panels -> Menus would suffice. Some code in kservice.cpp would work something like:
If KDE3_CheckBox_Is_Enabled Then If desktop_root_path == $PREFIX/share/applications/kde/ || desktop_root_path == $PREFIX/share/applications/kde/ then Show menu item Else Don't show menu item If KDE4_CheckBox_Is_Enabled Then If desktop_root_path == $PREFIX/share/applications/kde4/ then Show menu item Else Don't show menu item
Unfortunately none of this readily available today. :)
Darrell