From 8359408c64178ea81b299ca9ce98b6cd6e5d9c18 Mon Sep 17 00:00:00 2001 From: dooglus Date: Tue, 4 Sep 2007 10:01:53 +0000 Subject: [PATCH] Make the 'open recent' menu escape '_' characters. git-svn-id: http://svn.voria.com/code@582 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-studio/trunk/src/gtkmm/toolbox.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/synfig-studio/trunk/src/gtkmm/toolbox.cpp b/synfig-studio/trunk/src/gtkmm/toolbox.cpp index f29025d..3dd4b00 100644 --- a/synfig-studio/trunk/src/gtkmm/toolbox.cpp +++ b/synfig-studio/trunk/src/gtkmm/toolbox.cpp @@ -557,12 +557,20 @@ Toolbox::on_recent_files_changed() recent_files_menu->remove(**recent_files_menu->get_children().begin()); list::const_iterator iter; - // Check to see if the file is already on the list. - // If it is, then remove it from the list for(iter=App::get_recent_files().begin();iter!=App::get_recent_files().end();iter++) - recent_files_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(basename(*iter), + { + string raw = basename(*iter), quoted; + size_t pos = 0, last_pos = 0; + + // replace _ in filenames by __ or it won't show up in the menu + for (pos = last_pos = 0; (pos = raw.find('_', pos)) != string::npos; last_pos = pos) + quoted += raw.substr(last_pos, ++pos - last_pos) + '_'; + quoted += raw.substr(last_pos); + + recent_files_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(quoted, sigc::hide_return(sigc::bind(sigc::ptr_fun(&App::open),*iter)) )); + } // HACK show(); -- 2.7.4