Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

ui/gtk/gtk1/downloads.c File Reference

#include "gtk/gui.h"
#include "gtk/downloads.h"
#include "gtk/downloads_common.h"
#include "downloads_cb.h"
#include "gtk/statusbar.h"
#include "gtk/columns.h"
#include "gtk/notebooks.h"
#include "gtk/settings.h"
#include "if/core/pproxy.h"
#include "if/core/bsched.h"
#include "if/bridge/ui2c.h"
#include "lib/atoms.h"
#include "lib/glib-missing.h"
#include "lib/tm.h"
#include "lib/utf8.h"
#include "lib/override.h"

Defines

#define DL_GUI_TREE_SPACE   5
 Space between a child node and a parent.
#define DL_VISIBLE_MAX   MAX(DOWNLOADS_VISIBLE_COLUMNS, DOWNLOAD_QUEUE_VISIBLE_COLUMNS)

Functions

void add_parent_with_fi_handle (GHashTable *ht, gpointer key, GtkCTreeNode *data)
 Add the given tree node to the hashtable.
void remove_parent_with_fi_handle (GHashTable *ht, const gnet_fi_t fi_handle)
 Removes the treenode matching the given fi_handle from the hash table and frees the original key used to store it.
GtkCTreeNode * find_parent_with_fi_handle (GHashTable *ht, gpointer key)
void record_parent_gui_update (gpointer key, time_t when)
 Remember when we did the last GUI update of the parent.
time_t get_last_parent_gui_update (gpointer key)
gboolean parent_gui_needs_update (struct download *d, time_t now)
gint parent_children_add (GtkCTree *ctree, gpointer key, gint x)
 Add (arithmetically) `x' to the amount of children of the parent, identified by its fileifo hande.
GList * downloads_gui_collect_ctree_data (GtkCTree *ctree, GList *node_list, gboolean unselect, gboolean add_children)
 Given a GList of GtkCTreeNodes, return a new list pointing to the row data If unselect is TRUE, unselect all nodes in the list If children is TRUE, check and strip out header nodes.
gboolean downloads_gui_any_status (struct download *d, download_status_t status)
gboolean downloads_gui_all_aborted (struct download *d)
gboolean downloads_gui_update_parent_status (struct download *d, time_t now, gchar *new_status)
 Finds parent of given download in the active download tree and changes the status column to the given string.
void downloads_gui_init (void)
 Initialize local data structures.
void downloads_gui_shutdown (void)
 Cleanup local data structures.
void download_gui_add (struct download *d)
 Adds a download to the gui.
void gui_update_download_server (struct download *d)
void gui_update_download_range (struct download *d)
void gui_update_download_size (struct download *d)
void gui_update_download_host (struct download *d)
void gui_update_download (struct download *d, gboolean force)
void gui_update_download_abort_resume (void)
void download_gui_remove (struct download *d)
 Remove a download from the GUI.
void downloads_gui_expand_all (GtkCTree *ctree)
 Collapse all nodes in given, tree either downloads or downloads_queue.
void downloads_gui_collapse_all (GtkCTree *ctree)
 Collapse all nodes in given, tree either downloads or downloads_queue.
void downloads_update_active_pane (void)
 Update "active" pane if needed.
void downloads_update_queue_pane (void)
 Update "queue" pane if needed.
void downloads_gui_update_display (time_t unused_now)
 Periodically called to update downloads display.

Variables

gchar tmpstr [4096]
GHashTable * parents
 table of parent download iterators
GHashTable * parents_queue
 table of parent queued dl iterators
GHashTable * parents_gui_time
 Time at which parent was updated.
GHashTable * parents_children
GHashTable * parents_queue_children
GtkCTree * ctree_downloads
GtkCTree * ctree_downloads_queue
GtkNotebook * notebook
gboolean ctree_downloads_frozen = FALSE
gboolean ctree_downloads_queue_frozen = FALSE


Define Documentation

#define DL_GUI_TREE_SPACE   5
 

Space between a child node and a parent.

#define DL_VISIBLE_MAX   MAX(DOWNLOADS_VISIBLE_COLUMNS, DOWNLOAD_QUEUE_VISIBLE_COLUMNS)
 


Function Documentation

void add_parent_with_fi_handle GHashTable *  ht,
gpointer  key,
GtkCTreeNode *  data
[inline, static]
 

Add the given tree node to the hashtable.

The key is an int ref on the fi_handle for a given download.

void download_gui_add struct download d  ) 
 

Adds a download to the gui.

All parenting (grouping) is done here

void download_gui_remove struct download d  ) 
 

Remove a download from the GUI.

gboolean downloads_gui_all_aborted struct download d  ) 
 

Returns:
true if all the active downloads in the same tree as the given download are aborted (status is GTA_DL_ABORTED or GTA_DL_ERROR).

gboolean downloads_gui_any_status struct download d,
download_status_t  status
[static]
 

Returns:
true if any of the active downloads in the same tree as the given download are in the specified status.

void downloads_gui_collapse_all GtkCTree *  ctree  ) 
 

Collapse all nodes in given, tree either downloads or downloads_queue.

GList* downloads_gui_collect_ctree_data GtkCTree *  ctree,
GList *  node_list,
gboolean  unselect,
gboolean  add_children
 

Given a GList of GtkCTreeNodes, return a new list pointing to the row data If unselect is TRUE, unselect all nodes in the list If children is TRUE, check and strip out header nodes.

Instead of adding the headers, add all of their children. List will have to be freed later on.

FIXME: Worst case approaches O(n*n) ensuring no duplicate children are added FIXME: There are a lot of glist "appends" in here => unneccesary O(n)

void downloads_gui_expand_all GtkCTree *  ctree  ) 
 

Collapse all nodes in given, tree either downloads or downloads_queue.

void downloads_gui_init void   ) 
 

Initialize local data structures.

void downloads_gui_shutdown void   ) 
 

Cleanup local data structures.

void downloads_gui_update_display time_t  unused_now  ) 
 

Periodically called to update downloads display.

gboolean downloads_gui_update_parent_status struct download d,
time_t  now,
gchar *  new_status
 

Finds parent of given download in the active download tree and changes the status column to the given string.

Returns true if status is changed.

void downloads_update_active_pane void   ) 
 

Update "active" pane if needed.

void downloads_update_queue_pane void   ) 
 

Update "queue" pane if needed.

GtkCTreeNode* find_parent_with_fi_handle GHashTable *  ht,
gpointer  key
[inline, static]
 

Returns:
the tree iterator corresponding to the given key, an atomized fi_handle.

time_t get_last_parent_gui_update gpointer  key  )  [inline, static]
 

Returns:
the last time we updated the GUI of the parent.

void gui_update_download struct download d,
gboolean  force
 

void gui_update_download_abort_resume void   ) 
 

void gui_update_download_host struct download d  ) 
 

void gui_update_download_range struct download d  ) 
 

void gui_update_download_server struct download d  ) 
 

void gui_update_download_size struct download d  ) 
 

gint parent_children_add GtkCTree *  ctree,
gpointer  key,
gint  x
[static]
 

Add (arithmetically) `x' to the amount of children of the parent, identified by its fileifo hande.

The `ctree' is used to determine whether we're managing a parent from the active downlods or the queue downlaods.

Returns:
the new amount of children (use x=0 to get the current count).

gboolean parent_gui_needs_update struct download d,
time_t  now
[inline, static]
 

Returns:
whether the parent of download `d', if any, needs a GUI update.

void record_parent_gui_update gpointer  key,
time_t  when
[inline, static]
 

Remember when we did the last GUI update of the parent.

void remove_parent_with_fi_handle GHashTable *  ht,
const gnet_fi_t  fi_handle
[inline, static]
 

Removes the treenode matching the given fi_handle from the hash table and frees the original key used to store it.


Variable Documentation

GtkCTree* ctree_downloads [static]
 

gboolean ctree_downloads_frozen = FALSE [static]
 

GtkCTree* ctree_downloads_queue [static]
 

gboolean ctree_downloads_queue_frozen = FALSE [static]
 

GtkNotebook* notebook [static]
 

GHashTable* parents [static]
 

table of parent download iterators

GHashTable* parents_children [static]
 

GHashTable* parents_gui_time [static]
 

Time at which parent was updated.

GHashTable* parents_queue [static]
 

table of parent queued dl iterators

GHashTable* parents_queue_children [static]
 

gchar tmpstr[4096] [static]
 


Generated on Sat Jun 30 17:53:26 2007 for gtk-gnutella by  doxygen 1.3.9.1