Changeset 40804560fa72d53834c4466eb3c82b688d970089
- Timestamp:
- 07/30/2008 08:19:41 AM
(5 months ago)
- Author:
- Dave Foster <daf@minuslab.net>
- git-committer:
- Dave Foster <daf@minuslab.net> 1217431181 -0400
- git-parent:
[cafd66941f4c7a020c73c26bd7383c6bcf522fb9]
- git-author:
- Dave Foster <daf@minuslab.net> 1217428086 -0400
- Message:
First try at showing users what is currently saved in text.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rcafd669 |
r4080456 |
|
| 122 | 122 | // save |
|---|
| 123 | 123 | Config::get_instance()->set_bg(thedisp, file, mode, bgcolor); |
|---|
| | 124 | |
|---|
| | 125 | // tell the row that he's now on thedisp |
|---|
| | 126 | row[view.record.CurBGOnDisp] = thedisp; |
|---|
| | 127 | |
|---|
| | 128 | // reload config "cache" |
|---|
| | 129 | view.load_map_setbgs(); |
|---|
| | 130 | |
|---|
| | 131 | // find items removed by this config set. typically 0 or 1 items, which is the |
|---|
| | 132 | // old background on thedisp, but could be 2 items if xinerama individual bgs |
|---|
| | 133 | // are replaced by the fullscreen xinerama. |
|---|
| | 134 | for (Gtk::TreeIter i = view.store->children().begin(); i != view.store->children().end(); i++) |
|---|
| | 135 | { |
|---|
| | 136 | Glib::ustring curbgondisp = (*i)[view.record.CurBGOnDisp]; |
|---|
| | 137 | if (curbgondisp == "") |
|---|
| | 138 | continue; |
|---|
| | 139 | |
|---|
| | 140 | std::map<Glib::ustring, Glib::ustring>::iterator mapiter = view.map_setbgs.find(curbgondisp); |
|---|
| | 141 | |
|---|
| | 142 | // if filenames don't match, this row must be blanked out! |
|---|
| | 143 | Glib::ustring filename = (*i)[view.record.Filename]; |
|---|
| | 144 | if (filename != (*mapiter).second) |
|---|
| | 145 | { |
|---|
| | 146 | (*i)[view.record.CurBGOnDisp] = ""; |
|---|
| | 147 | (*i)[view.record.Description] = Glib::ustring(filename, filename.rfind("/")+1); |
|---|
| | 148 | } |
|---|
| | 149 | else |
|---|
| | 150 | (*i)[view.record.Description] = Glib::ustring(filename, filename.rfind("/")+1) + "\n<small><i>" + _("Currently set background for") + (*mapiter).first + "</i></small>"; |
|---|
| | 151 | } |
|---|
| 124 | 152 | |
|---|
| 125 | 153 | if (!this->is_multihead || thedisp == "xin_-1") |
|---|
| rcafd669 |
r4080456 |
|
| 88 | 88 | Thumbview::Thumbview() : dir("") { |
|---|
| 89 | 89 | set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); |
|---|
| 90 | | set_shadow_type (Gtk::SHADOW_IN); |
|---|
| | 90 | set_shadow_type (Gtk::SHADOW_IN); |
|---|
| | 91 | |
|---|
| | 92 | // load map of setbgs (need this for add_file) |
|---|
| | 93 | load_map_setbgs(); |
|---|
| 91 | 94 | |
|---|
| 92 | 95 | // make our async queues |
|---|
| … | … | |
| 120 | 123 | col_thumb->set_sizing(Gtk::TREE_VIEW_COLUMN_FIXED); |
|---|
| 121 | 124 | col_thumb->set_fixed_width(105); |
|---|
| 122 | | col_desc->add_attribute (rend, "text", record.Description); |
|---|
| | 125 | col_desc->add_attribute (rend, "markup", record.Description); |
|---|
| 123 | 126 | col_desc->set_sort_column (record.Filename); |
|---|
| 124 | 127 | col_desc->set_sort_indicator (true); |
|---|
| … | … | |
| 172 | 175 | row[record.Filename] = filename; |
|---|
| 173 | 176 | row[record.Description] = Glib::ustring(filename, filename.rfind ("/")+1); |
|---|
| | 177 | |
|---|
| | 178 | for (std::map<Glib::ustring, Glib::ustring>::iterator i = map_setbgs.begin(); i!=map_setbgs.end(); i++) |
|---|
| | 179 | { |
|---|
| | 180 | if (filename == (*i).second) |
|---|
| | 181 | { |
|---|
| | 182 | 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 | } |
|---|
| | 185 | } |
|---|
| 174 | 186 | |
|---|
| 175 | 187 | // for modified time |
|---|
| … | … | |
| 502 | 514 | row[record.Thumbnail] = pb; |
|---|
| 503 | 515 | // desc |
|---|
| 504 | | row[record.Description] = Glib::ustring(file, file.rfind("/")+1); |
|---|
| | 516 | //row[record.Description] = Glib::ustring(file, file.rfind("/")+1); |
|---|
| 505 | 517 | |
|---|
| 506 | 518 | // emit a changed signal |
|---|
| … | … | |
| 539 | 551 | } |
|---|
| 540 | 552 | |
|---|
| | 553 | /** |
|---|
| | 554 | * Loads the map of displays and their set bgs. Used to indicate which |
|---|
| | 555 | * files are currently set as a background. |
|---|
| | 556 | */ |
|---|
| | 557 | void Thumbview::load_map_setbgs() |
|---|
| | 558 | { |
|---|
| | 559 | map_setbgs.clear(); |
|---|
| | 560 | |
|---|
| | 561 | std::vector<Glib::ustring> vecgroups; |
|---|
| | 562 | bool ret = Config::get_instance()->get_bg_groups(vecgroups); |
|---|
| | 563 | if (!ret) |
|---|
| | 564 | return; |
|---|
| | 565 | |
|---|
| | 566 | for (std::vector<Glib::ustring>::iterator i = vecgroups.begin(); i!=vecgroups.end(); i++) |
|---|
| | 567 | { |
|---|
| | 568 | Glib::ustring file; |
|---|
| | 569 | SetBG::SetMode mode; |
|---|
| | 570 | Gdk::Color bgcolor; |
|---|
| | 571 | |
|---|
| | 572 | ret = Config::get_instance()->get_bg(*i, file, mode, bgcolor); |
|---|
| | 573 | if (!ret) |
|---|
| | 574 | { |
|---|
| | 575 | std::cerr << "(load_map_setbgs) Could not get background stored info for " << *i << "\n"; |
|---|
| | 576 | return; |
|---|
| | 577 | } |
|---|
| | 578 | |
|---|
| | 579 | map_setbgs[*i] = file; |
|---|
| | 580 | } |
|---|
| | 581 | } |
|---|
| | 582 | |
|---|
| 541 | 583 | #ifdef USE_INOTIFY |
|---|
| 542 | 584 | |
|---|
| rcafd669 |
r4080456 |
|
| 123 | 123 | // loading image |
|---|
| 124 | 124 | Glib::RefPtr<Gdk::Pixbuf> loading_image; |
|---|
| | 125 | |
|---|
| | 126 | // "cache" of config - maps displays to full filenames |
|---|
| | 127 | std::map<Glib::ustring, Glib::ustring> map_setbgs; |
|---|
| | 128 | void load_map_setbgs(); |
|---|
| 125 | 129 | |
|---|
| 126 | 130 | protected: |
|---|