--- menu-2.1.41~/update-menus/exceptions.h 2004-05-17 20:43:35.000000000 +0400 +++ menu-2.1.41/update-menus/exceptions.h 2011-05-25 14:30:01.000000000 +0400 @@ -90,6 +90,15 @@ namespace exceptions { } }; + /** Exception to be thrown when entry ignored */ + class ignore_entry : public except_string { + public: + ignore_entry(std::string f) : except_string(f) { } + std::string message() { + return String::compose(_("Menu entry %1 skipped: obsolete format"), msg); + } + }; + /** Exception to be thrown when package isn't installed. */ class cond_inst_false : public genexcept { }; --- menu-2.1.41~/update-menus/update-menus.cc 2011-05-25 14:27:17.000000000 +0400 +++ menu-2.1.41/update-menus/update-menus.cc 2011-05-25 14:30:25.000000000 +0400 @@ -123,6 +123,7 @@ menuentry::menuentry(parsestream &i, con data[COMMAND_VAR] = i.get_line(); } check_req_tags(file); + check_ignore_entry(file); } /** This function checks the package name to see if it's valid and installed. @@ -179,6 +180,21 @@ void menuentry::check_req_tags(const std } +/** Checks whether we ignore menuentry. */ +void menuentry::check_ignore_entry(const std::string& filename) +{ + std::map::const_iterator command_entry = data.find(COMMAND_VAR); + if( command_entry != data.end() && !command_entry->second.empty() ) + { + std::map::const_iterator needs_entry = data.find(NEEDS_VAR); + if(needs_entry != data.end() && !needs_entry->second.empty() ) + { + if( needs_entry->second == "x11" || needs_entry->second == "text" ) + throw ignore_entry(filename); + } + } +} + /** Parse a menuentry from a parsestream */ void menuentry::read_menuentry(parsestream &i) { @@ -536,6 +552,9 @@ int read_menufile(const string &filename std::cerr << exc.message() << std::endl; std::cerr << _("Skipping file because of errors...\n"); } + catch (ignore_entry& exc) { + std::cerr << exc.message() << std::endl; + } catch (except_pi& exc) { exc.report(); std::cerr << _("Skipping file because of errors...\n"); --- menu-2.1.41~/update-menus/update-menus.h 2008-05-09 18:12:41.000000000 +0400 +++ menu-2.1.41/update-menus/update-menus.h 2011-05-25 14:27:38.000000000 +0400 @@ -37,6 +37,7 @@ /** Internal representation of a menu entry */ class menuentry { void check_req_tags(const std::string& filename); + void check_ignore_entry(const std::string& filename); void check_pkg_validity(parsestream &i, std::string &); void read_menuentry(parsestream &i);