Logo Search packages:      
Sourcecode: transmission version File versions  Download package

void TRWindow::UpdateList ( int32  selection = -1,
bool  menus = true 
)

Called from the be_app Pulse(); This will update the data structures that the TRTorrents use to render, and invalidate the view.

Definition at line 433 of file TRWindow.cpp.

Referenced by StartTorrent(), StopTorrent(), and TRWindow().

                                                                 {
      bool running = false;
      
      tr_stat_t * s;
      int i = 0;
      int max = tr_torrentStat(engine, &s);
      bool invalid[max];
      
      for (i = 0; i < max; i++) {
            invalid[i] = ((TRTransfer*)transfers->ItemAt(i))->SetStatus(&(s[i]), (i % 2 != 0));
            
            if (menus && i == (int)selection) {
                  running = (s[selection].status & 
                            (TR_STATUS_CHECK | TR_STATUS_DOWNLOAD | TR_STATUS_SEED));
            }
      }
      free(s);
      
      if (menus) {
            KeyMenuBar()->FindItem(TR_INFO)->SetEnabled(selection >= 0);
            KeyMenuBar()->FindItem(TR_RESUME)->SetEnabled(selection >= 0 && !running);
            KeyMenuBar()->FindItem(TR_PAUSE)->SetEnabled(selection >= 0 && running);
            KeyMenuBar()->FindItem(TR_REMOVE)->SetEnabled(selection >= 0 && !running);
      }
      
      if (Lock()) {
            for (i = 0; i < max; i++) {
                  if (invalid[i]) {
                        transfers->InvalidateItem(i);
                  }
            }
            Unlock();
      }
}


Generated by  Doxygen 1.6.0   Back to index