jigdo API
JobList Class Reference
A bit like a vector<JobLine*>, but uses the GtkTreeStore for storing the elements. More...
#include <joblist.hh>

Public Types | |
enum | { COLUMN_STATUS, COLUMN_OBJECT, COLUMN_DATA, NR_OF_COLUMNS } |
typedef unsigned | size_type |
Public Member Functions | |
JobList () | |
~JobList () | |
Any Jobs still in the list are deleted. | |
void | finalize () |
Like the dtor; later call to the dtor will not cause anything to happen. | |
GtkTreeStore * | store () const |
The GTK data structure that contains the linked list of items for this JobList. | |
GtkTreeView * | view () const |
The GTK data structure responsible for drawing this list on screen. | |
size_type | size () const |
Size *includes* null pointer entries. | |
size_type | entryCount () const |
Number of non-null entries (always <= size()). | |
bool | empty () const |
JobLine * | get (GtkTreeIter *row) const |
Retrieve the data for a list entry. | |
void | set (size_type n, JobLine *j) |
Simply overwrites pointer, will not delete the old entry. | |
void | erase (GtkTreeIter *row) |
Deletes row from the list. | |
void | insert (size_type n, JobLine *j) |
Insert new JobLine before position n. | |
void | prepend (JobLine *j, JobLine *parent=0) |
Add new JobLine at start of list, or as first child of parent if parent != 0. | |
void | append (JobLine *j, JobLine *parent=0) |
Append new JobLine at end of list or as last child of parent if parent != 0. | |
void | makeRowBlank (GtkTreeIter *row) |
Make row blank by setting text labels to "". | |
void | setWindowOwner (JobLine *j) |
Set a static var of the JobList class to the supplied value. | |
bool | isWindowOwner (JobLine *j) const |
Check whether the supplied JobLine is in charge of updating the window. | |
JobLine * | windowOwner () const |
Get the current JobLine in charge of the main window. | |
void | registerTicks () |
(De)register a JobLine whose tick() method should be called regularly. | |
void | unregisterTicks () |
void | postGtkInit () |
To be called sometime after gtk_init, but before any JobLines/JobVectors are used. | |
void | assertValid () const |
Public Attributes | |
LOCAL_DEBUG_UNIT_DECL | |
Static Public Attributes | |
static const int | WIDTH_STATUS = 280 |
static const int | TICK_INTERVAL = 250 |
Time values are in milliseconds. |
Detailed Description
A bit like a vector<JobLine*>, but uses the GtkTreeStore for storing the elements.There can be empty entries in the vector which hold null pointers and which are displayed as empty lines on screen.
~JobList deletes all JobLine objects in the list.
Member Typedef Documentation
typedef unsigned JobList::size_type |
Member Enumeration Documentation
anonymous enum |
- Enumerator:
-
COLUMN_STATUS Pixmap "% done" + text message ("x kB/sec" etc). COLUMN_OBJECT URL. COLUMN_DATA pointer to JobLine object (not displayed on screen) NR_OF_COLUMNS Assumed number of columns in job display (progress bar, URL).
Constructor & Destructor Documentation
JobList::JobList | ( | ) | [inline] |
JobList::~JobList | ( | ) |
Member Function Documentation
void JobList::finalize | ( | ) |
Like the dtor; later call to the dtor will not cause anything to happen.
References debug, empty(), and store().
Referenced by main(), and ~JobList().
GtkTreeStore * JobList::store | ( | ) | const [inline] |
The GTK data structure that contains the linked list of items for this JobList.
Referenced by append(), erase(), finalize(), get(), makeRowBlank(), postGtkInit(), and prepend().
GtkTreeView * JobList::view | ( | ) | const [inline] |
The GTK data structure responsible for drawing this list on screen.
Currently, we cheat and always return the same static object, GUI::window.jobs, rather than storing a pointer in the JobList. This only works as long as only one JobList is ever created.
References GUI::window.
Referenced by append(), makeRowBlank(), postGtkInit(), and prepend().
JobList::size_type JobList::size | ( | ) | const [inline] |
Size *includes* null pointer entries.
JobList::size_type JobList::entryCount | ( | ) | const [inline] |
Number of non-null entries (always <= size()).
bool JobList::empty | ( | ) | const [inline] |
Referenced by finalize().
JobLine * JobList::get | ( | GtkTreeIter * | row | ) | const [inline] |
Retrieve the data for a list entry.
References COLUMN_DATA, and store().
Referenced by GtkMakeImage::~GtkMakeImage().
Simply overwrites pointer, will not delete the old entry.
void JobList::erase | ( | GtkTreeIter * | row | ) |
Deletes row from the list.
The Job object pointed to by the entry is not* deleted.
References Paranoid, and store().
Referenced by JobLine::~JobLine().
Add new JobLine at start of list, or as first child of parent if parent != 0.
Also scrolls to the top to display the new entry. You should call j->run() after this so the Job can visualize itself.
References COLUMN_DATA, NULL, Paranoid, JobLine::row(), store(), view(), and GUI::window.
Referenced by JobLine::create().
Append new JobLine at end of list or as last child of parent if parent != 0.
You should call j->run() after this so the Job can visualize itself.
References COLUMN_DATA, NULL, Paranoid, JobLine::row(), store(), and view().
void JobList::makeRowBlank | ( | GtkTreeIter * | row | ) |
void JobList::setWindowOwner | ( | JobLine * | j | ) | [inline] |
Set a static var of the JobList class to the supplied value.
The Job that is currently selected and is in charge of updating the main window (e.g. with progress info) calls this with j==this, and subsequently uses isWindowOwner(this) to check whether it is still in charge of updating the window. This way, it is ensured that only one JobLine at a time updates the window. Supply 0 to unset.
Referenced by GtkSingleUrl::selectRow(), GtkMakeImage::selectRow(), and setNotebookPage().
bool JobList::isWindowOwner | ( | JobLine * | j | ) | const [inline] |
Check whether the supplied JobLine is in charge of updating the window.
JobLine * JobList::windowOwner | ( | ) | const [inline] |
Get the current JobLine in charge of the main window.
This will be called if a button is clicked in the main window, to find the JobLine the click should be "forwarded" to.
Referenced by on_download_closeButton_clicked(), on_download_pauseButton_clicked(), on_download_restartButton_clicked(), on_download_startButton_clicked(), on_download_stopButton_clicked(), on_jigdo_closeButton_clicked(), on_jigdo_pauseButton_clicked(), on_jigdo_restartButton_clicked(), on_jigdo_startButton_clicked(), and on_jigdo_stopButton_clicked().
void JobList::registerTicks | ( | ) | [inline] |
(De)register a JobLine whose tick() method should be called regularly.
As soon as there is at least one such JobLine, a GTK timeout function is registered which does a freeze(), then scans through the whole list calling objects' tick handler where present, then thaw()s the list. As soon as the count of tick-needing JobLines reaches 0, the timeout function is unregistered again.
References debug, and TICK_INTERVAL.
Referenced by JobLine::callRegularly().
void JobList::unregisterTicks | ( | ) | [inline] |
void JobList::postGtkInit | ( | ) |
To be called sometime after gtk_init, but before any JobLines/JobVectors are used.
References _, Assert, COLUMN_OBJECT, COLUMN_STATUS, NR_OF_COLUMNS, NULL, Paranoid, store(), view(), and WIDTH_STATUS.
Referenced by GUI::create().
void JobList::assertValid | ( | ) | const [inline] |
Member Data Documentation
const int JobList::WIDTH_STATUS = 280 [static] |
Referenced by postGtkInit().
const int JobList::TICK_INTERVAL = 250 [static] |
Time values are in milliseconds.
All values should be multiples of TICK_INTERVAL
Referenced by JobLine::callRegularlyLater(), and registerTicks().
The documentation for this class was generated from the following files:
- gtk/joblist.hh
- gtk/joblist.cc
Generated on Tue Sep 23 14:27:42 2008 for jigdo by
