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

search_stats.c File Reference


Detailed Description

Needs short description here.

Keep track of what search terms we have seen, and how frequently each has been seen.

Note:
This uses the glib hash tables and lists, but a much more efficient implementation could be done with a specialized hash table / re-keyable binary tree.
Author:
Raphael Manfredi
Date:
2001-2003
Author:
Michael Tesch
Date:
2002

#include "gtk/gui.h"
#include "gtk/search_stats.h"
#include "gtk/gtk-missing.h"
#include "gtk/misc.h"
#include "if/gui_property.h"
#include "if/gui_property_priv.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/wordvec.h"
#include "lib/override.h"

Data Structures

struct  term_counts
 This is what the stat_hash's 'val' points to. More...


Functions

 RCSID ("$Id:search_stats.c, v 1.21 2005/12/17 09:25:45 daichik Exp $")
gboolean delete_hash_entry (gpointer key, gpointer val, gpointer data)
void empty_hash_table (void)
gboolean stats_hash_to_treeview (gpointer key, gpointer value, gpointer userdata)
 Helper func for stats_display - does two things:.

void search_stats_tally (const word_vec_t *vec)
 Count a word that has been seen.

void search_stats_notify_word (query_type_t type, const gchar *search, const host_addr_t unused_addr, guint16 unused_port)
void search_stats_notify_whole (query_type_t type, const gchar *search, const host_addr_t unused_addr, guint16 unused_port)
void search_stats_notify_routed (query_type_t unused_type, const gchar *unused_search, const host_addr_t addr, guint16 port)
void search_stats_gui_enable (search_request_listener_t lst)
 Enable search stats.

void search_stats_gui_disable (void)
void search_stats_gui_reset (void)
 Clear the list, empty the hash table.

void search_stats_gui_set_type (gint type)
void add_column (GtkTreeView *treeview, gint id, gfloat xalign, const gchar *label)
void search_stats_gui_init (void)
void search_stats_gui_shutdown (void)
void search_stats_gui_update (time_t now)
 Display the data gathered during the last time period.


Variables

guint stat_count = 0
GHashTable * stat_hash = NULL
GtkListStore * store_search_stats = NULL
GtkTreeView * treeview_search_stats = NULL
GtkLabel * label_search_stats_count = NULL
gboolean callback_registered = FALSE
gint selected_type = NO_SEARCH_STATS


Function Documentation

void add_column GtkTreeView *  treeview,
gint  id,
gfloat  xalign,
const gchar *  label
[static]
 

gboolean delete_hash_entry gpointer  key,
gpointer  val,
gpointer  data
[static]
 

void empty_hash_table void   )  [static]
 

RCSID "$Id:search_stats.  c,
v 1.21 2005/12/17 09:25:45 daichik Exp $" 
 

void search_stats_gui_disable void   )  [static]
 

void search_stats_gui_enable search_request_listener_t  lst  )  [static]
 

Enable search stats.

void search_stats_gui_init void   ) 
 

void search_stats_gui_reset void   ) 
 

Clear the list, empty the hash table.

void search_stats_gui_set_type gint  type  ) 
 

void search_stats_gui_shutdown void   ) 
 

void search_stats_gui_update time_t  now  ) 
 

Display the data gathered during the last time period.

Perhaps it would be better to have this done on a button click(?)

void search_stats_notify_routed query_type_t  unused_type,
const gchar *  unused_search,
const host_addr_t  addr,
guint16  port
[static]
 

void search_stats_notify_whole query_type_t  type,
const gchar *  search,
const host_addr_t  unused_addr,
guint16  unused_port
[static]
 

void search_stats_notify_word query_type_t  type,
const gchar *  search,
const host_addr_t  unused_addr,
guint16  unused_port
[static]
 

void search_stats_tally const word_vec_t vec  )  [static]
 

Count a word that has been seen.

gboolean stats_hash_to_treeview gpointer  key,
gpointer  value,
gpointer  unused_udata
[static]
 

Helper func for stats_display - does two things:.

  • clears out aged / infrequent search terms

sticks the rest of the search terms in treeview_search_stats


Variable Documentation

gboolean callback_registered = FALSE [static]
 

GtkLabel* label_search_stats_count = NULL [static]
 

gint selected_type = NO_SEARCH_STATS [static]
 

guint stat_count = 0 [static]
 

GHashTable* stat_hash = NULL [static]
 

GtkListStore* store_search_stats = NULL [static]
 

GtkTreeView* treeview_search_stats = NULL [static]
 


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