Changeset 40804560fa72d53834c4466eb3c82b688d970089

Show
Ignore:
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
  • src/NWindow.cc

    rcafd669 r4080456  
    122122        // save  
    123123    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    } 
    124152 
    125153    if (!this->is_multihead || thedisp == "xin_-1") 
  • src/Thumbview.cc

    rcafd669 r4080456  
    8888Thumbview::Thumbview() : dir("") { 
    8989        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(); 
    9194 
    9295        // make our async queues 
     
    120123        col_thumb->set_sizing(Gtk::TREE_VIEW_COLUMN_FIXED); 
    121124        col_thumb->set_fixed_width(105); 
    122         col_desc->add_attribute (rend, "text", record.Description); 
     125        col_desc->add_attribute (rend, "markup", record.Description); 
    123126        col_desc->set_sort_column (record.Filename); 
    124127        col_desc->set_sort_indicator (true); 
     
    172175        row[record.Filename] = filename; 
    173176        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    } 
    174186 
    175187        // for modified time 
     
    502514        row[record.Thumbnail] = pb; 
    503515        // desc 
    504         row[record.Description] = Glib::ustring(file, file.rfind("/")+1); 
     516        //row[record.Description] = Glib::ustring(file, file.rfind("/")+1); 
    505517 
    506518        // emit a changed signal 
     
    539551} 
    540552 
     553/** 
     554 * Loads the map of displays and their set bgs. Used to indicate which 
     555 * files are currently set as a background. 
     556 */ 
     557void 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 
    541583#ifdef USE_INOTIFY 
    542584 
  • src/Thumbview.h

    rcafd669 r4080456  
    123123                // loading image 
    124124                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(); 
    125129         
    126130        protected: