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

ui/gtk/gtk2/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 "gtk/settings.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/walloc.h"
#include "lib/override.h"

Data Structures

struct  upload_data

Functions

gboolean on_button_press_event (GtkWidget *unused_widget, GdkEventButton *event, gpointer unused_udata)
 Private callbacks.
void cell_renderer_func (GtkTreeViewColumn *column, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, gpointer udata)
void add_column (GtkTreeView *tv, gint column_id, const gchar *title, gfloat xalign, GtkTreeIterCompareFunc sortfunc, GtkTreeCellDataFunc cell_data_func)
 Add a column to the GtkTreeView.
upload_dataupload_stats_gui_find (const struct ul_stats *us)
 Find an ul_stats structure associated with the given name and size.
upload_dataget_upload_data (GtkTreeModel *model, GtkTreeIter *iter)
gint upload_stats_gui_cmp_filename (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
gint upload_stats_gui_cmp_size (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
gint upload_stats_gui_cmp_norm (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
gint upload_stats_gui_cmp_attempts (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
gint upload_stats_gui_cmp_complete (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
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 struct ul_stats *us)
 Update the visible statistics for a given file.
gboolean free_upload_data (gpointer unused_key, gpointer value, gpointer unused_data)
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
GtkWidget * popup_upload_stats
GHashTable * ht_uploads


Function Documentation

void add_column GtkTreeView *  tv,
gint  column_id,
const gchar *  title,
gfloat  xalign,
GtkTreeIterCompareFunc  sortfunc,
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_renderer_func GtkTreeViewColumn *  column,
GtkCellRenderer *  cell,
GtkTreeModel *  model,
GtkTreeIter *  iter,
gpointer  udata
[static]
 

gboolean free_upload_data gpointer  unused_key,
gpointer  value,
gpointer  unused_data
[static]
 

struct upload_data* get_upload_data GtkTreeModel *  model,
GtkTreeIter *  iter
[inline, static]
 

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

Private callbacks.

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.

gint upload_stats_gui_cmp_attempts GtkTreeModel *  model,
GtkTreeIter *  a,
GtkTreeIter *  b,
gpointer  unused_udata
[static]
 

gint upload_stats_gui_cmp_complete GtkTreeModel *  model,
GtkTreeIter *  a,
GtkTreeIter *  b,
gpointer  unused_udata
[static]
 

gint upload_stats_gui_cmp_filename GtkTreeModel *  model,
GtkTreeIter *  a,
GtkTreeIter *  b,
gpointer  unused_udata
[static]
 

gint upload_stats_gui_cmp_norm GtkTreeModel *  model,
GtkTreeIter *  a,
GtkTreeIter *  b,
gpointer  unused_udata
[static]
 

gint upload_stats_gui_cmp_size GtkTreeModel *  model,
GtkTreeIter *  a,
GtkTreeIter *  b,
gpointer  unused_udata
[static]
 

struct upload_data* upload_stats_gui_find const struct ul_stats us  )  [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 struct ul_stats us  ) 
 

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

GHashTable* ht_uploads [static]
 

GtkWidget* popup_upload_stats [static]
 

GtkTreeView* upload_stats_treeview [static]
 


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