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

downloads.c File Reference

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

Data Structures

struct  update_help_t

Defines

#define IO_STALLED   60 /**< If nothing exchanged after that many secs */
 If nothing exchanged after that many secs.

#define REGRESSION(x)
#define TREE_ITER_NEW()   w_tree_iter_new()
#define TREE_ITER_FREE(x)   w_tree_iter_free(x)
#define SET(c, x)   case (c): columns[i] = (x); break
#define SET(c, x)   case (c): columns[i] = (x); break

Functions

 RCSID ("$Id:downloads.c, v 1.61 2006/02/06 20:02:41 cbiere Exp $")
gboolean iter_is_valid (GtkTreeIter *iter)
void check_iter_fi_handle (gpointer key, gpointer value, gpointer unused_udata)
void check_iter_download (gpointer key, gpointer value, gpointer unused_udata)
GtkTreeIter * tree_iter_new (void)
void tree_iter_free (GtkTreeIter *iter)
void ht_dl_iter_destroy (gpointer key, gpointer value, gpointer unused_udata)
void add_parent_with_fi_handle (GHashTable *ht, gnet_fi_t fi_handle, GtkTreeIter *iter)
 Add the given tree iterator to the hashtable.

void remove_parent_with_fi_handle (GHashTable *ht, gnet_fi_t fi_handle)
 Removes the tree iterator matching the given fi_handle from the hash table.

GtkTreeIter * find_parent_with_fi_handle (GHashTable *ht, gnet_fi_t fi_handle)
GtkTreeIter * find_download (download_t *d)
gboolean downloads_gui_all_aborted (download_t *drecord)
gboolean downloads_gui_update_parent_status (download_t *d, const gchar *new_status)
 Finds parent of given download in the active download tree and changes the status column to the given string.

GtkTreeViewColumn * add_column (GtkTreeView *treeview, GtkType column_type, const gchar *name, gint id, gfloat xalign, gint fg_column, gint bg_column)
 Sets the details applicable to a single column in the treeviews.

void add_active_downloads_column (GtkTreeView *treeview, GtkType column_type, const gchar *name, gint id, gfloat xalign, const GtkTreeIterCompareFunc sortfunc)
 Add one column to the treeview.

void add_queue_downloads_column (GtkTreeView *treeview, const gchar *name, gint id, gfloat xalign, const GtkTreeIterCompareFunc sortfunc)
 Add one column to the treeview.

gint compare_size_func (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data)
gint compare_range_func (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data)
void add_active_downloads_columns (GtkTreeView *treeview)
 Add all columns to the treeview.

void add_queue_downloads_columns (GtkTreeView *treeview)
 Add all columns to the treeview.

GtkTreeModel * create_downloads_model (void)
GtkTreeModel * create_queue_model (void)
void downloads_gui_init (void)
 Initialize local data structures.

void downloads_gui_shutdown (void)
 Cleanup local data structures.

void download_gui_add (download_t *d)
 Add a download to either the active or queued download treeview depending on the download's flags.

void download_gui_remove (download_t *d)
 Remove a download from the GUI.

void gui_update_download_column (download_t *d, GtkTreeView *tree_view, gint column, const gchar *value)
 Updates the given column of the given treeview.

void gui_update_download_server (download_t *d)
 Update the server/vendor column of the active downloads treeview.

void gui_update_download_range (download_t *d)
 Update the range column of the active downloads treeview.

void gui_update_download_size (download_t *d)
 Update the size column of the active downloads treeview.

void gui_update_download_host (download_t *d)
 Update the host column of the active downloads treeview.

void gui_update_download (download_t *d, gboolean force)
 Update the gui to reflect the current state of the given download.

void update_download_abort_resume_helper (GtkTreeModel *model, GtkTreePath *unused_path, GtkTreeIter *iter, gpointer data)
void gui_update_download_abort_resume (void)
 Determines if abort/resume buttons should be sensitive or not Determines if the queue and abort options should be available in the treeview popups.

void downloads_gui_expand_all (GtkTreeView *tree_view)
 Expand all nodes in given tree, either downloads or downloads_queue.

void downloads_gui_collapse_all (GtkTreeView *tree_view)
 Collapse all nodes in given, tree either downloads or downloads_queue.

void downloads_gui_update_display (time_t unused_now)
 Periodically called to update downloads display.


Variables

GHashTable * parents
 table of parent download iterators

GHashTable * parents_queue
 table of parent queued dl iterators

GHashTable * ht_dl_iters
 table of iters to find downloads

GtkTreeView * treeview_downloads
GtkTreeView * treeview_downloads_queue


Define Documentation

#define IO_STALLED   60 /**< If nothing exchanged after that many secs */
 

If nothing exchanged after that many secs.

#define REGRESSION  ) 
 

#define SET c,
 )     case (c): columns[i] = (x); break
 

#define SET c,
 )     case (c): columns[i] = (x); break
 

#define TREE_ITER_FREE  )     w_tree_iter_free(x)
 

 
#define TREE_ITER_NEW  )     w_tree_iter_new()
 


Function Documentation

void add_active_downloads_column GtkTreeView *  treeview,
GtkType  column_type,
const gchar *  name,
gint  id,
gfloat  xalign,
const GtkTreeIterCompareFunc  sortfunc
[static]
 

Add one column to the treeview.

Note:
Usable only for active downloads treeview.

void add_active_downloads_columns GtkTreeView *  treeview  )  [static]
 

Add all columns to the treeview.

Set titles, alignment, width, etc. here.

Note:
Usable only for active downloads treeview.

GtkTreeViewColumn* add_column GtkTreeView *  treeview,
GtkType  column_type,
const gchar *  name,
gint  id,
gfloat  xalign,
gint  fg_column,
gint  bg_column
[static]
 

Sets the details applicable to a single column in the treeviews.

Usable for both active downloads and downloads queue treeview.

void add_parent_with_fi_handle GHashTable *  ht,
gnet_fi_t  fi_handle,
GtkTreeIter *  iter
[inline, static]
 

Add the given tree iterator to the hashtable.

The key is the fi_handle for a given download.

void add_queue_downloads_column GtkTreeView *  treeview,
const gchar *  name,
gint  id,
gfloat  xalign,
const GtkTreeIterCompareFunc  sortfunc
[static]
 

Add one column to the treeview.

Note:
Usable only for downloads queue treeview.

void add_queue_downloads_columns GtkTreeView *  treeview  )  [static]
 

Add all columns to the treeview.

Set titles, alignment, width, etc. here.

Note:
Usable only for downloads queue treeview.

void check_iter_download gpointer  key,
gpointer  value,
gpointer  unused_udata
 

void check_iter_fi_handle gpointer  key,
gpointer  value,
gpointer  unused_udata
 

gint compare_range_func GtkTreeModel *  model,
GtkTreeIter *  a,
GtkTreeIter *  b,
gpointer  user_data
[static]
 

gint compare_size_func GtkTreeModel *  model,
GtkTreeIter *  a,
GtkTreeIter *  b,
gpointer  user_data
[static]
 

GtkTreeModel* create_downloads_model void   )  [static]
 

GtkTreeModel* create_queue_model void   )  [static]
 

void download_gui_add download_t d  ) 
 

Add a download to either the active or queued download treeview depending on the download's flags.

This function handles grouping new downloads appropriately and creation of parent/child nodes.

void download_gui_remove download_t d  ) 
 

Remove a download from the GUI.

gboolean downloads_gui_all_aborted download_t drecord  )  [static]
 

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).

void downloads_gui_collapse_all GtkTreeView *  tree_view  ) 
 

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

void downloads_gui_expand_all GtkTreeView *  tree_view  ) 
 

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

void downloads_gui_init void   ) 
 

Initialize local data structures.

Important things in here: initialization of hash tables, adding columns to the treeviews, creating treeview model (what the columns mean and their numbers), hooking up of signal callbacks

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 download_t d,
const gchar *  new_status
[static]
 

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.

GtkTreeIter* find_download download_t d  )  [inline, static]
 

GtkTreeIter* find_parent_with_fi_handle GHashTable *  ht,
gnet_fi_t  fi_handle
[inline, static]
 

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

void gui_update_download download_t d,
gboolean  force
 

Update the gui to reflect the current state of the given download.

void gui_update_download_abort_resume void   ) 
 

Determines if abort/resume buttons should be sensitive or not Determines if the queue and abort options should be available in the treeview popups.

void gui_update_download_column download_t d,
GtkTreeView *  tree_view,
gint  column,
const gchar *  value
[static]
 

Updates the given column of the given treeview.

void gui_update_download_host download_t d  ) 
 

Update the host column of the active downloads treeview.

void gui_update_download_range download_t d  ) 
 

Update the range column of the active downloads treeview.

void gui_update_download_server download_t d  ) 
 

Update the server/vendor column of the active downloads treeview.

void gui_update_download_size download_t d  ) 
 

Update the size column of the active downloads treeview.

void ht_dl_iter_destroy gpointer  key,
gpointer  value,
gpointer  unused_udata
 

gboolean iter_is_valid GtkTreeIter *  iter  ) 
 

RCSID "$Id:downloads.  c,
v 1.61 2006/02/06 20:02:41 cbiere Exp $" 
 

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

Removes the tree iterator matching the given fi_handle from the hash table.

The atom used for the key along with the stored iter are assumed to be freed automatically. The functions to free this memory should be declared when creating the hash table.

void tree_iter_free GtkTreeIter *  iter  ) 
 

GtkTreeIter* tree_iter_new void   ) 
 

void update_download_abort_resume_helper GtkTreeModel *  model,
GtkTreePath *  unused_path,
GtkTreeIter *  iter,
gpointer  data
[static]
 


Variable Documentation

GHashTable* ht_dl_iters [static]
 

table of iters to find downloads

GHashTable* parents [static]
 

table of parent download iterators

GHashTable* parents_queue [static]
 

table of parent queued dl iterators

GtkTreeView* treeview_downloads [static]
 

GtkTreeView* treeview_downloads_queue [static]
 


Generated on Sun Feb 12 10:50:00 2006 for Gtk-Gnutella by doxygen 1.3.6