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

visual_progress.c File Reference


Detailed Description

Displaying the visual progress of downloading graphically.

Visual progress indicator for files in the download queue.

Todo:
And other ideas to be implemented.

Author:
Hans de Graaff
Date:
2003-2004

#include "gui.h"
#include "visual_progress.h"
#include "if/core/http.h"
#include "if/gui_property_priv.h"
#include "if/bridge/ui2c.h"
#include "lib/walloc.h"
#include "lib/override.h"

Defines

#define VP_ARROW_HEIGHT   7
 The height of the indicator arrows in visual progress.

Typedefs

typedef vp_context vp_context_t
 The context for drawing, including location to draw.
typedef vp_info vp_info_t
 Locally cached information from fileinfo needed for drawing the graphics.

Functions

 RCSID ("$Id: visual_progress.c,v 1.32 2005/05/29 08:48:43 graaff Exp $")
void vp_draw_rectangle (vp_info_t *v, filesize_t from, filesize_t to, guint top, guint bottom)
 Draw a rectangle for visual progress.
void vp_draw_chunk (gpointer data, gpointer user_data)
 Draw a chunk for visual progress.
void vp_draw_arrow (vp_info_t *v, filesize_t at)
 Draw an downward arrow starting at the top.
void vp_draw_arrows (gpointer data, gpointer user_data)
 Draw arrows on the start of BUSY chunks to make them stand out.
static void vp_draw_range (gpointer data, gpointer user_data)
 Draw an available range.
void vp_draw_fi_progress (gboolean valid, gnet_fi_t fih)
 Draws a progress bar for the given fi struct in the DrawingArea.
void on_drawingarea_fi_progress_realize (GtkWidget *widget, gpointer user_data)
 Callback for the fileinfo pane GtkDrawingArea.
gboolean on_drawingarea_fi_progress_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
 Callback for the fileinfo pane GtkDrawingArea.
static GSList * vp_get_chunks_initial (gnet_fi_t fih)
 Get a list of chunks and filter out all empty chunks for quicker handling later on.
static void vp_gui_fi_added (gnet_fi_t fih)
 A new fileinfo is available.
static void vp_gui_fi_removed (gnet_fi_t fih)
 Handle the event that a fileinfo entry has been removed.
static void vp_print_chunk (gnet_fi_chunks_t *c, gboolean show_old)
 For debugging: print chunk.
static void vp_print_chunk_list (GSList *list, gchar *title)
static gnet_fi_chunks_tvp_create_chunk (filesize_t from, filesize_t to, enum dl_chunk_status status, gboolean old)
 Allocate a new chunk based on the parameters.
static gboolean vp_assert_chunks_list (GSList *list)
 Assert that a chunks list confirms to the assumptions.
static void vp_gui_fi_status_changed (gnet_fi_t fih)
 Fileinfo has been changed for a file.
static void vp_gui_fi_ranges_changed (gnet_fi_t fih)
 The available ranges information has been changed for a file.
void vp_free_key_value (gpointer key, gpointer value, gpointer user_data)
 Free the vp_info_t structs in the vp_info_hash.
void vp_gui_init (void)
 Initialize the use of visual progress.
void vp_gui_shutdown (void)
 Undo everything set up in vp_gui_init.

Variables

static GHashTable * vp_info_hash
static GdkColor done
static GdkColor done_old
static GdkColor busy
static GdkColor arrow
static GdkColor empty
static GdkColor black
static GdkColor available
static GdkColor nosize
static GdkColor * base
static vp_context_t fi_context
 The visual progress context for drawing fileinfo information.


Define Documentation

#define VP_ARROW_HEIGHT   7
 

The height of the indicator arrows in visual progress.


Typedef Documentation

typedef struct vp_context vp_context_t
 

The context for drawing, including location to draw.

typedef struct vp_info vp_info_t
 

Locally cached information from fileinfo needed for drawing the graphics.


Function Documentation

gboolean on_drawingarea_fi_progress_expose_event GtkWidget *  widget,
GdkEventExpose *  event,
gpointer  user_data
 

Callback for the fileinfo pane GtkDrawingArea.

void on_drawingarea_fi_progress_realize GtkWidget *  widget,
gpointer  user_data
 

Callback for the fileinfo pane GtkDrawingArea.

RCSID "$Id: visual_progress.  c,
v 1.32 2005/05/29 08:48:43 graaff Exp $" 
 

static gboolean vp_assert_chunks_list GSList *  list  )  [static]
 

Assert that a chunks list confirms to the assumptions.

static gnet_fi_chunks_t* vp_create_chunk filesize_t  from,
filesize_t  to,
enum dl_chunk_status  status,
gboolean  old
[static]
 

Allocate a new chunk based on the parameters.

Parameters:
from Start of chunk
to End of chunk
status Status of chunk
old TRUE if the chunk was downloaded before gtk-gnutella is started

void vp_draw_arrow vp_info_t v,
filesize_t  at
 

Draw an downward arrow starting at the top.

void vp_draw_arrows gpointer  data,
gpointer  user_data
 

Draw arrows on the start of BUSY chunks to make them stand out.

This is done in a separate funtion, because the arrows need to be drawn on top of the chunks.

void vp_draw_chunk gpointer  data,
gpointer  user_data
 

Draw a chunk for visual progress.

void vp_draw_fi_progress gboolean  valid,
gnet_fi_t  fih
 

Draws a progress bar for the given fi struct in the DrawingArea.

fih is expected to be a valid fih. Depending on the value of valid the area will be drawn or cleared.

static void vp_draw_range gpointer  data,
gpointer  user_data
[static]
 

Draw an available range.

Callback for a list iterator.

Parameters:
data The HTTP range to draw.
user_data A pointer to the vp_info_t structure.

void vp_draw_rectangle vp_info_t v,
filesize_t  from,
filesize_t  to,
guint  top,
guint  bottom
 

Draw a rectangle for visual progress.

void vp_free_key_value gpointer  key,
gpointer  value,
gpointer  user_data
 

Free the vp_info_t structs in the vp_info_hash.

static GSList* vp_get_chunks_initial gnet_fi_t  fih  )  [static]
 

Get a list of chunks and filter out all empty chunks for quicker handling later on.

Returns pointer to the new list. Caller should make sure to free this list and its chunks.

Parameters:
fih Fileinfo handle for which chunks should be retrieved

static void vp_gui_fi_added gnet_fi_t  fih  )  [static]
 

A new fileinfo is available.

We need to create a structure for it and store all relevant information.

Parameters:
fih The fileinfo handle of the entry being added.

static void vp_gui_fi_ranges_changed gnet_fi_t  fih  )  [static]
 

The available ranges information has been changed for a file.

Update the information and draw the information so the changes are visible.

Parameters:
fih Handle for fileinfo data that has been changed.

static void vp_gui_fi_removed gnet_fi_t  fih  )  [static]
 

Handle the event that a fileinfo entry has been removed.

Parameters:
fih The fileinfo handle of the entry to be removed

static void vp_gui_fi_status_changed gnet_fi_t  fih  )  [static]
 

Fileinfo has been changed for a file.

Update the information and draw the information so the changes are visible.

Parameters:
fih Handle for fileinfo data that has been changed.

void vp_gui_init void   ) 
 

Initialize the use of visual progress.

Register listeners into the fileinfo structure so that we are notified of fileinfo events, and get a permanent handle to the drawing area for later reuse.

void vp_gui_shutdown void   ) 
 

Undo everything set up in vp_gui_init.

static void vp_print_chunk gnet_fi_chunks_t c,
gboolean  show_old
[static]
 

For debugging: print chunk.

static void vp_print_chunk_list GSList *  list,
gchar *  title
[static]
 


Variable Documentation

GdkColor arrow [static]
 

GdkColor available [static]
 

GdkColor* base [static]
 

GdkColor black [static]
 

GdkColor busy [static]
 

GdkColor done [static]
 

GdkColor done_old [static]
 

GdkColor empty [static]
 

vp_context_t fi_context [static]
 

The visual progress context for drawing fileinfo information.

GdkColor nosize [static]
 

GHashTable* vp_info_hash [static]
 


Generated on Tue May 31 13:36:01 2005 for Gtk-Gnutella by  doxygen 1.4.2