Changeset 69c1750dc41ea3051e2a4abb3f653be3536d9ae1
- Timestamp:
- 07/30/2008 12:23:42 PM (4 months ago)
- git-parent:
- Files:
-
- src/NWindow.cc (modified) (5 diffs)
- src/NWindow.h (modified) (2 diffs)
- src/Thumbview.cc (modified) (2 diffs)
- src/Util.cc (modified) (2 diffs)
- src/Util.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
src/NWindow.cc
r4080456 r69c1750 25 25 #include <sys/wait.h> 26 26 #include "gcs-i18n.h" 27 #include "Util.h" 27 28 28 29 #ifdef USE_XINERAMA … … 148 149 } 149 150 else 150 (*i)[view.record.Description] = Glib::ustring(filename, filename.rfind("/")+1) + "\n<small><i>" + _("Currently set background for") + (*mapiter).first + "</i></small>";151 (*i)[view.record.Description] = Util::make_current_set_string(this, filename, (*mapiter).first); 151 152 } 152 153 … … 253 254 254 255 this->select_display.add_image_row( video_display_icon, ostr.str(), screen->make_display_name(), on ); 256 257 map_displays[screen->make_display_name()] = ostr.str(); 255 258 } 256 259 … … 274 277 this->select_display.add_image_row(video_display_icon, _("Full Screen"), "xin_-1", true); 275 278 279 map_displays["xin_-1"] = _("Full Screen"); 280 276 281 for (int i=0; i<xinerama_num_screens; i++) { 277 282 std::ostringstream ostr, valstr; … … 280 285 281 286 this->select_display.add_image_row(video_display_icon, ostr.str(), valstr.str(), false); 287 288 map_displays[valstr.str()] = ostr.str(); 282 289 } 283 290 src/NWindow.h
ra5e6749 r69c1750 40 40 41 41 void set_default_selections(); 42 43 std::map<Glib::ustring, Glib::ustring> map_displays; // a map of current displays on the running instance to their display names 42 44 45 bool is_multihead; 46 bool is_xinerama; 47 43 48 protected: 44 49 … … 54 59 void setup_select_boxes(); 55 60 56 bool is_multihead;57 bool is_xinerama;58 59 61 #ifdef USE_XINERAMA 60 62 // xinerama stuff src/Thumbview.cc
r4080456 r69c1750 169 169 */ 170 170 void Thumbview::add_file(std::string filename) { 171 Gtk::Window *window = dynamic_cast<Gtk::Window*>(get_toplevel()); 171 172 Gtk::TreeModel::iterator iter = this->store->append (); 172 173 Gtk::TreeModel::Row row = *iter; … … 181 182 { 182 183 row[record.CurBGOnDisp] = (*i).first; 183 row[record.Description] = Glib::ustring(filename, filename.rfind("/")+1) + "\n<i>" + _("Currently set background for") + " " + (*i).first + "</i>";184 row[record.Description] = Util::make_current_set_string(window, filename, (*i).first); 184 185 } 185 186 } src/Util.cc
rf593b91 r69c1750 27 27 #include "gcs-i18n.h" 28 28 #include <glib/gprintf.h> 29 #include "NWindow.h" 29 30 30 31 namespace Util { … … 228 229 } 229 230 230 } 231 /** 232 * Determines if the passed display is one that is currently seen by the program. 233 * 234 * Displays are passed in here to determine if they need to be shown as the "current 235 * background". 236 */ 237 bool is_display_relevant(Gtk::Window* window, Glib::ustring display) 238 { 239 // cast window to an NWindow. we have to do this to avoid a circular dep 240 NWindow *nwindow = dynamic_cast<NWindow*>(window); 241 if (!nwindow->is_multihead) 242 { 243 Glib::ustring curdisp = Gdk::DisplayManager::get()->get_default_display()->get_default_screen()->make_display_name(); 244 return (curdisp == display); 245 } 246 247 // window IS multihead, check to see if this display is in the map 248 return (nwindow->map_displays.find(display) != nwindow->map_displays.end()); 249 } 250 251 /** 252 * Makes a string for the UI to indicate it is the currently selected background. 253 * 254 * Checks to make sure the display is relevant with is_display_relevant(). If it is 255 * not relevent, it simply returns the filename. 256 * 257 * ex: "filename\nCurrently set background for Screen 1" 258 */ 259 Glib::ustring make_current_set_string(Gtk::Window* window, Glib::ustring filename, Glib::ustring display) 260 { 261 // cast window to an NWindow. we have to do this to avoid a circular dep 262 NWindow *nwindow = dynamic_cast<NWindow*>(window); 263 264 Glib::ustring shortfile(filename, filename.rfind("/")+1); 265 if (!is_display_relevant(window, display)) 266 return shortfile; 267 268 std::ostringstream ostr; 269 ostr << shortfile << "\n\n" << "<i>" << _("Currently set background"); 270 271 if (nwindow->is_multihead) 272 ostr << " " << _("for") << " " << nwindow->map_displays[display]; 273 274 ostr << "</i>"; 275 276 return ostr.str(); 277 } 278 279 } src/Util.h
rc8365d4 r69c1750 33 33 ArgParser* create_arg_parser(); 34 34 std::string fix_start_dir(std::string startdir); 35 36 bool is_display_relevant(Gtk::Window* window, Glib::ustring display); 37 Glib::ustring make_current_set_string(Gtk::Window* window, Glib::ustring filename, Glib::ustring display); 35 38 } 36 39
