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

upload_stats.c File Reference


Detailed Description

Keep track of which files we send away, and how often.

Statistics are kept by _FILENAME_ and file size, not by actual path, so two files with the same name and size will be counted in the same bin.

I dont see this as a limitation because the user wouldn't be able to differentiate the files anyway. This could be extended to keep the entire path to each file and optionally show the entire path, but..

The 'upload_history' file has the following format:

Todo:
TODO: Add a check to make sure that all of the files still exist(?) grey them out if they dont, optionally remove them from the stats list (when 'Clear Non-existent Files' is clicked).
Author:
Raphael Manfredi
Date:
2001-2003
Author:
Michael Tesch
Date:
2002

#include "gtk/gui.h"
#include "interface-glade.h"
#include "gtk/columns.h"
#include "gtk/gtk-missing.h"
#include "gtk/misc.h"
#include "if/gui_property.h"
#include "if/bridge/ui2c.h"
#include "lib/glib-missing.h"
#include "lib/utf8.h"
#include "lib/override.h"

Functions

 RCSID ("$Id:upload_stats.c, v 1.13 2005/11/16 13:35:14 cbiere Exp $")
gboolean on_button_press_event (GtkWidget *unused_widget, GdkEventButton *event, gpointer unused_udata)
 Private callbacks.

void cell_render_size_func (GtkTreeViewColumn *column, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, gpointer unused_data)
 Render the size column.

void cell_render_norm_func (GtkTreeViewColumn *column, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, gpointer unused_data)
 Render the normalized statistic column.

void add_column (GtkTreeView *tree, gint column_id, const gchar *title, gfloat xalign, GtkTreeCellDataFunc cell_data_func)
 Add a column to the GtkTreeView.

ul_statsupload_stats_gui_find (const gchar *name, guint64 size, GtkTreeModel *model, GtkTreeIter *iter)
 Find an ul_stats structure associated with the given name and size.

void upload_stats_gui_init_intern (gboolean intern)
 Initialize the upload statistics GUI.

void upload_stats_gui_add (const struct ul_stats *us)
 Add a new upload stats row to the model.

void upload_stats_gui_init (void)
void upload_stats_gui_update (const gchar *name, guint64 size)
 Update the visible statistics for a given file.

void upload_stats_gui_clear_all (void)
 Clear all upload statistic entries from the GtkTreeModel.

void upload_stats_gui_shutdown (void)

Variables

GtkTreeView * upload_stats_treeview = NULL
GtkWidget * popup_upload_stats = NULL


Function Documentation

void add_column GtkTreeView *  tree,
gint  column_id,
const gchar *  title,
gfloat  xalign,
GtkTreeCellDataFunc  cell_data_func
[static]
 

Add a column to the GtkTreeView.

This function adds a column to the treeview.

Parameters:
tree The GtkTreeView which will have a new column appended.
column_id The numerical tag for this column.
title The title displayed in the column header.
xalign A number between 0.0 (left) and 1.0 (right) horizontal alignment.
cell_data_func The function which will render that data to show in the cell. If, NULL gtk will try to render the data as appropriate for the type.

void cell_render_norm_func GtkTreeViewColumn *  column,
GtkCellRenderer *  cell,
GtkTreeModel *  model,
GtkTreeIter *  iter,
gpointer  unused_data
[static]
 

Render the normalized statistic column.

Generate the text string which should be displayed in the normalized cell.

Parameters:
column The column which is being rendered.
cell The cell renderer for the column.
model The model holding the upload stats info.
iter The iter of the row we are working with.
unused_data user data passed to the function.

void cell_render_size_func GtkTreeViewColumn *  column,
GtkCellRenderer *  cell,
GtkTreeModel *  model,
GtkTreeIter *  iter,
gpointer  unused_data
[static]
 

Render the size column.

Generate the text string which should be displayed in the size cell.

Parameters:
column The column which is being rendered.
cell The cell renderer for the column.
model The model holding the upload stats info.
iter The iter of the row we are working with.
unused_data user data passed to the function.

gboolean on_button_press_event GtkWidget *  unused_widget,
GdkEventButton *  event,
gpointer  unused_udata
[static]
 

Private callbacks.

RCSID "$Id:upload_stats.  c,
v 1.13 2005/11/16 13:35:14 cbiere Exp $" 
 

void upload_stats_gui_add const struct ul_stats us  ) 
 

Add a new upload stats row to the model.

Add the information within the ul_stats structure to the GtkTreeModel and another row the the upload statistics pane.

Parameters:
us A ul_stats structure with new upload stats to add.

void upload_stats_gui_clear_all void   ) 
 

Clear all upload statistic entries from the GtkTreeModel.

struct ul_stats* upload_stats_gui_find const gchar *  name,
guint64  size,
GtkTreeModel *  model,
GtkTreeIter *  iter
[static]
 

Find an ul_stats structure associated with the given name and size.

Given the filename and it's size, iterate through the list of all ul_stats and find the one that matches up.

Parameters:
name The filename of we are looking for.
size The size of the file.
model The model associated with the tree_view.
iter The iterator where the ul_stats structure was found.
Returns:
The ul_stats structure associated with the name and size parameters.

void upload_stats_gui_init void   ) 
 

void upload_stats_gui_init_intern gboolean  intern  )  [static]
 

Initialize the upload statistics GUI.

Initialize the upload statistics GUI. Define the GtkTreeModel used to store the information as well as rendering and sorting functions to use on the cells and columns.

void upload_stats_gui_shutdown void   ) 
 

void upload_stats_gui_update const gchar *  name,
guint64  size
 

Update the visible statistics for a given file.

Parameters:
name The filename whose upload statistics should be updated.
size The size of that file.


Variable Documentation

GtkWidget* popup_upload_stats = NULL [static]
 

GtkTreeView* upload_stats_treeview = NULL [static]
 


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