Changeset cafd66941f4c7a020c73c26bd7383c6bcf522fb9

Show
Ignore:
Timestamp:
07/29/08 11:25:01 (4 months ago)
Author:
Dave Foster <daf@minuslab.net>
git-committer:
Dave Foster <daf@minuslab.net> 1217355901 -0400
git-parent:

[90ee6b7c31468b9b240ffdce54f2f6e4345f1608]

git-author:
Dave Foster <daf@minuslab.net> 1217355901 -0400
Message:

Better rounded tree model record, added stub for currently set bg display.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/NWindow.cc

    r90ee6b7 rcafd669  
    9999        Gtk::TreeModel::iterator iter = (view.store)->get_iter(path); 
    100100        Gtk::TreeModel::Row row = *iter; 
    101         this->set_bg(row[view.filename]); 
     101        this->set_bg(row[view.record.Filename]); 
    102102 
    103103} 
     
    113113        Gtk::TreeModel::iterator iter = view.view.get_selection()->get_selected (); 
    114114        Gtk::TreeModel::Row row = *iter; 
    115     Glib::ustring file = row[view.filename]; 
     115    Glib::ustring file = row[view.record.Filename]; 
    116116        this->set_bg(file); 
    117117 
     
    301301                for (Gtk::TreeIter iter = view.store->children().begin(); iter != view.store->children().end(); iter++) 
    302302                { 
    303                         if ( (*iter)[view.filename] == default_selection) { 
     303                        if ( (*iter)[view.record.Filename] == default_selection) { 
    304304                                view.view.get_selection()->select(iter); 
    305305                                view.view.scroll_to_row(Gtk::TreeModel::Path(iter), 0.5); 
  • src/Thumbview.cc

    r014e7ee rcafd669  
    6767                Glib::RefPtr<Gdk::Pixbuf> thumb = base.get(); 
    6868 
    69                 if (thumb == thumbview->loading_image && !row[thumbview->loadingthumb]) 
     69                if (thumb == thumbview->loading_image && !row[thumbview->record.LoadingThumb]) 
    7070                { 
    7171                        TreePair* tp = new TreePair(); 
    72                         tp->file = row[thumbview->filename]; 
     72                        tp->file = row[thumbview->record.Filename]; 
    7373                        tp->iter = iter; 
    7474 
    75                         row[thumbview->loadingthumb] = true; 
     75                        row[thumbview->record.LoadingThumb] = true; 
    7676 
    7777                        Util::program_log("Custom model: planning on loading %s\n", tp->file.c_str()); 
     
    9494        this->aqueue_createthumbs = g_async_queue_new(); 
    9595        this->aqueue_donethumbs = g_async_queue_new();   
    96  
    97         // build model record 
    98         record.add (thumbnail); 
    99         record.add (description); 
    100         record.add (filename); 
    101         record.add (time); 
    102         record.add (loadingthumb); 
    10396 
    10497        // create store 
     
    124117        this->col_desc = new Gtk::TreeViewColumn("description", this->rend); 
    125118         
    126         col_thumb->add_attribute (rend_img, "pixbuf", thumbnail); 
     119        col_thumb->add_attribute (rend_img, "pixbuf", record.Thumbnail); 
    127120        col_thumb->set_sizing(Gtk::TREE_VIEW_COLUMN_FIXED); 
    128121        col_thumb->set_fixed_width(105); 
    129         col_desc->add_attribute (rend, "text", description); 
    130         col_desc->set_sort_column (filename); 
     122        col_desc->add_attribute (rend, "text", record.Description); 
     123        col_desc->set_sort_column (record.Filename); 
    131124        col_desc->set_sort_indicator (true); 
    132125        col_desc->set_sort_order (Gtk::SORT_ASCENDING); 
     
    137130 
    138131        // enable search 
    139         view.set_search_column (description); 
     132        view.set_search_column (record.Description); 
    140133        view.set_search_equal_func (sigc::mem_fun (this, &Thumbview::search_compare)); 
    141134 
     
    176169        Gtk::TreeModel::Row row = *iter; 
    177170        Glib::RefPtr<Gdk::Pixbuf> thumb = this->loading_image;  
    178         row[thumbnail] = thumb; 
    179         row[this->filename] = filename; 
    180         row[description] = Glib::ustring(filename, filename.rfind ("/")+1); 
     171        row[record.Thumbnail] = thumb; 
     172        row[record.Filename] = filename; 
     173        row[record.Description] = Glib::ustring(filename, filename.rfind ("/")+1); 
    181174 
    182175        // for modified time 
    183         row[time] = get_file_mtime(filename); 
     176        row[record.Time] = get_file_mtime(filename); 
    184177 
    185178        Util::program_log("add_file(): Adding file %s\n", filename.c_str()); 
     
    507500{ 
    508501        Gtk::TreeModel::Row row = *iter; 
    509         row[thumbnail] = pb; 
     502        row[record.Thumbnail] = pb; 
    510503        // desc 
    511         row[description] = Glib::ustring(file, file.rfind("/")+1); 
     504        row[record.Description] = Glib::ustring(file, file.rfind("/")+1); 
    512505 
    513506        // emit a changed signal 
     
    519512 */ 
    520513bool Thumbview::search_compare (const Glib::RefPtr<Gtk::TreeModel>& model, int column, const Glib::ustring& key, const Gtk::TreeModel::iterator& iter) { 
    521         Glib::ustring target = (*iter)[description]; 
     514        Glib::ustring target = (*iter)[record.Description]; 
    522515        if (target.find (key) != Glib::ustring::npos) { 
    523516                return false; 
     
    532525        switch (mode) { 
    533526                case SORT_ALPHA: 
    534                         store->set_sort_column (description, Gtk::SORT_ASCENDING); 
     527                        store->set_sort_column (record.Description, Gtk::SORT_ASCENDING); 
    535528                        break; 
    536529                case SORT_RALPHA: 
    537                         store->set_sort_column (description, Gtk::SORT_DESCENDING); 
     530                        store->set_sort_column (record.Description, Gtk::SORT_DESCENDING); 
    538531                        break; 
    539532                case SORT_TIME: 
    540                         store->set_sort_column (time, Gtk::SORT_ASCENDING); 
     533                        store->set_sort_column (record.Time, Gtk::SORT_ASCENDING); 
    541534                        break; 
    542535                case SORT_RTIME: 
    543                         store->set_sort_column (time, Gtk::SORT_DESCENDING); 
     536                        store->set_sort_column (record.Time, Gtk::SORT_DESCENDING); 
    544537                        break; 
    545538        } 
     
    562555        Gtk::TreeModel::Children children = store->children(); 
    563556        for (iter = children.begin(); iter != children.end(); iter++) { 
    564                 Glib::ustring this_filename = (*iter)[this->filename]; 
     557                Glib::ustring this_filename = (*iter)[record.Filename]; 
    565558                if (this_filename == filename) { 
    566559                        // remove this iter. 
  • src/Thumbview.h

    r014e7ee rcafd669  
    6262}; 
    6363 
     64///////////////////////////////////////////////////////////////////////////// 
     65 
     66/** 
     67 * Column record for the Thumbview store. 
     68 */ 
     69class ThumbviewRecord : public Gtk::TreeModelColumnRecord 
     70{ 
     71    public: 
     72        ThumbviewRecord() 
     73        { 
     74            add(Thumbnail); 
     75            add(Description); 
     76            add(Filename); 
     77            add(Time); 
     78            add(LoadingThumb); 
     79            add(CurBGOnDisp); 
     80        } 
     81 
     82                Gtk::TreeModelColumn<Glib::ustring> Filename; 
     83                Gtk::TreeModelColumn<Glib::ustring> Description; 
     84                Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > Thumbnail; 
     85                Gtk::TreeModelColumn<time_t> Time; 
     86                Gtk::TreeModelColumn<bool> LoadingThumb; 
     87        Gtk::TreeModelColumn<Glib::ustring> CurBGOnDisp; 
     88}; 
     89 
     90 
     91///////////////////////////////////////////////////////////////////////////// 
     92 
    6493class Thumbview : public Gtk::ScrolledWindow { 
    6594        public: 
     
    76105                void set_dir(std::string indir) { this->dir = indir; } 
    77106                 
    78                 // TODO: make private? 
    79                 Gtk::TreeModelColumn<Glib::ustring> filename; 
    80                 Gtk::TreeModelColumn<Glib::ustring> description; 
    81                 Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> >  thumbnail; 
    82                 Gtk::TreeModelColumn<time_t> time; 
    83                 Gtk::TreeModelColumn<bool> loadingthumb; 
    84                  
    85107                Glib::RefPtr<DelayLoadingStore> store; 
    86108                Gtk::TreeView view; 
    87  
     109        ThumbviewRecord record; 
     110         
    88111                // dispatcher  
    89112                Glib::Dispatcher dispatch_thumb; 
     
    100123                // loading image 
    101124                Glib::RefPtr<Gdk::Pixbuf> loading_image; 
    102                 
     125         
    103126        protected: 
    104127 
     
    112135                void add_file(std::string filename); 
    113136                void handle_dispatch_thumb(); 
    114  
    115                 Gtk::TreeModel::ColumnRecord record; 
    116137                 
    117138                Gtk::TreeViewColumn *col_thumb;