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

ui/gtk/gtk2/search.c File Reference


Detailed Description

GUI filtering functions.

Author:
Raphael Manfredi

Richard Eckart

Date:
2001-2003

#include "gtk/gui.h"
#include "search_cb.h"
#include "gtk/bitzi.h"
#include "gtk/columns.h"
#include "gtk/drag.h"
#include "gtk/gtk-missing.h"
#include "gtk/misc.h"
#include "gtk/notebooks.h"
#include "gtk/search.h"
#include "gtk/settings.h"
#include "gtk/statusbar.h"
#include "if/gui_property.h"
#include "if/gui_property_priv.h"
#include "if/bridge/ui2c.h"
#include "if/core/bitzi.h"
#include "if/core/sockets.h"
#include "lib/atoms.h"
#include "lib/magnet.h"
#include "lib/misc.h"
#include "lib/glib-missing.h"
#include "lib/iso3166.h"
#include "lib/tm.h"
#include "lib/url.h"
#include "lib/utf8.h"
#include "lib/walloc.h"
#include "lib/override.h"

Data Structures

struct  result_data
struct  selection_ctx
struct  menu_helper

Defines

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

Functions

void gui_search_create_tree_view (GtkWidget **sw, GtkTreeView **tv, gpointer udata)
 Create a new GtkTreeView for search results.
result_dataget_result_data (GtkTreeModel *model, GtkTreeIter *iter)
gpointer search_gui_get_record (GtkTreeModel *model, GtkTreeIter *iter)
void search_gui_set_data (GtkTreeModel *model, struct result_data *rd)
void search_gui_synchronize_list (GtkTreeModel *model)
void on_search_list_row_deleted (GtkTreeModel *model, GtkTreePath *unused_path, gpointer unused_udata)
void on_search_list_column_clicked (GtkTreeViewColumn *column, gpointer unused_udata)
gboolean search_gui_update_rank (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer udata)
 Callback handler used with gtk_tree_model_foreach() to record the current rank/position in tree enabling stable sorting.
void cell_renderer (GtkTreeViewColumn *column, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, gpointer udata)
GtkCellRenderer * create_cell_renderer (gfloat xalign)
GtkTreeViewColumn * add_column (GtkTreeView *tv, const gchar *name, gint id, gint width, gfloat xalign, GtkTreeCellDataFunc cell_data_func, gint fg_col, gint bg_col)
result_datafind_parent (search_t *search, const struct result_data *rd)
result_datafind_parent2 (search_t *search, const struct sha1 *sha1, filesize_t filesize)
void result_data_free (search_t *search, struct result_data *rd)
gboolean prepare_remove_record (GtkTreeModel *model, GtkTreePath *unused_path, GtkTreeIter *iter, gpointer udata)
void search_gui_clear_queue (search_t *search)
void search_gui_reset_search (search_t *sch)
 Reset the internal model of the search.
gboolean on_leave_notify (GtkWidget *widget, GdkEventCrossing *unused_event, gpointer unused_udata)
gboolean gui_search_update_tab_label_cb (gpointer p)
void search_gui_clear_ctree (search_t *search)
void search_gui_clear_search (search_t *search)
 Clear all results from search.
void search_gui_close_search (search_t *search)
 Remove the search from the list of searches and free all associated ressources (including filter and gui stuff).
void search_gui_clear_sorting (search_t *sch)
void search_gui_restore_sorting (search_t *sch)
gchar * get_local_file_url (GtkWidget *widget)
guint search_gui_file_hash (gconstpointer key)
gint search_gui_file_eq (gconstpointer p, gconstpointer q)
gboolean search_gui_new_search_full (const gchar *query_str, time_t create_time, guint lifetime, guint32 reissue_timeout, gint sort_col, gint sort_order, flag_t flags, search_t **search)
 Create a new search and start it.
gint search_gui_cmp_size (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
 Search results.
gint search_gui_cmp_count (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
gint search_gui_cmp_strings (const gchar *a, const gchar *b)
gint search_gui_cmp_filename (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
gint search_gui_cmp_sha1 (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
gint search_gui_cmp_ctime (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
gint search_gui_cmp_charset (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
gint search_gui_cmp_ext (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
gint search_gui_cmp_meta (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
gint search_gui_cmp_country (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
gint search_gui_cmp_vendor (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
gint search_gui_cmp_info (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
gint search_gui_cmp_route (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
gint search_gui_cmp_hops (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
gint search_gui_cmp_ttl (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
gint search_gui_cmp_protocol (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
gint search_gui_cmp_owned (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
gint search_gui_cmp_hostile (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
gint search_gui_cmp_spam (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer unused_udata)
void search_gui_add_record (search_t *sch, record_t *rc, enum gui_color color)
 Adds the record to gth GtkCTree for this search.
const record_tsearch_gui_get_record_at_path (GtkTreeView *tv, GtkTreePath *path)
void search_gui_set_clear_button_sensitive (gboolean flag)
void search_gui_magnet_add_source (struct magnet_resource *magnet, record_t *record)
gchar * search_gui_get_magnet (GtkTreeModel *model, GtkTreeIter *iter)
void download_selected_file (GtkTreeModel *model, GtkTreeIter *iter, GSList **sl)
void remove_selected_file (gpointer iter_ptr, gpointer model_ptr)
void download_selected_all_files (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
void collect_all_iters (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
gboolean search_gui_menu_select_helper (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
void search_gui_menu_select (gint page)
void search_gui_download_files (void)
 Download selected files.
void search_gui_discard_files (void)
 Discard selected files.
void add_list_columns (GtkTreeView *tv)
void add_results_column (GtkTreeView *tv, const gchar *name, gint id, gint width, gfloat xalign, GtkTreeIterCompareFunc sortfunc, gpointer udata)
void search_details_treeview_init (void)
GtkTreeModel * create_searches_model (void)
void search_gui_init (void)
void search_gui_shutdown (void)
const GList * search_gui_get_searches (void)
gint selection_counter (GtkTreeView *tv)
void search_gui_remove_search (search_t *sch)
 Remove the search from the gui and update all widgets accordingly.
void search_gui_set_current_search (search_t *sch)
GtkTreeModel * create_results_model (void)
void add_results_columns (GtkTreeView *treeview, gpointer udata)
gboolean search_by_regex (GtkTreeModel *model, gint column, const gchar *key, GtkTreeIter *iter, gpointer unused_data)
gboolean tree_view_search_update (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
void gui_search_force_update_tab_label (search_t *sch, time_t now)
 Like search_update_tab_label but always update the label.
gboolean gui_search_update_tab_label (struct search *sch)
 Update the label if nothing's changed or if the last update was recent.
void gui_search_clear_results (void)
 Removes all search results from the current search.
void gui_search_set_enabled (struct search *sch, gboolean enabled)
 Flag whether search is enabled.
void search_gui_expand_all (void)
 Expand all nodes in tree for current search.
void search_gui_collapse_all (void)
 Expand all nodes in tree for current search.
void search_gui_start_massive_update (search_t *sch)
void search_gui_end_massive_update (search_t *sch)
void collect_parents_with_sha1 (GtkTreeModel *model, GtkTreePath *unused_path, GtkTreeIter *iter, gpointer data)
void search_gui_request_bitzi_data_helper (gpointer key, gpointer unused_value, gpointer unused_udata)
void search_gui_make_meta_column_visible (search_t *search)
void search_gui_request_bitzi_data (void)
void search_gui_metadata_update (const bitzi_data_t *data)
 Metadata Update.
void search_gui_get_selected_searches_helper (GtkTreeModel *model, GtkTreePath *unused_path, GtkTreeIter *iter, gpointer data)
GSList * search_gui_get_selected_searches (void)
gboolean search_gui_has_selected_item (search_t *search)
void search_gui_search_list_clicked (GtkWidget *widget, GdkEventButton *event)
void search_gui_flush_queue_data (search_t *search, GtkTreeModel *model, struct result_data *rd)
void search_gui_flush_queue (search_t *search)
void search_gui_flush_queues (void)

Variables

GList * searches
 List of search structs.
GtkTreeView * tree_view_search
GtkNotebook * notebook_search_results
GtkButton * button_search_clear
gboolean search_gui_shutting_down = FALSE
GtkTreeView * default_search_tree_view
GtkWidget * default_scrolled_window
tree_view_motion_t * tvm_search
 For cyclic updates of the tooltip.


Define Documentation

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


Function Documentation

GtkTreeViewColumn* add_column GtkTreeView *  tv,
const gchar *  name,
gint  id,
gint  width,
gfloat  xalign,
GtkTreeCellDataFunc  cell_data_func,
gint  fg_col,
gint  bg_col
[static]
 

void add_list_columns GtkTreeView *  tv  )  [static]
 

void add_results_column GtkTreeView *  tv,
const gchar *  name,
gint  id,
gint  width,
gfloat  xalign,
GtkTreeIterCompareFunc  sortfunc,
gpointer  udata
[static]
 

void add_results_columns GtkTreeView *  treeview,
gpointer  udata
[static]
 

void cell_renderer GtkTreeViewColumn *  column,
GtkCellRenderer *  cell,
GtkTreeModel *  model,
GtkTreeIter *  iter,
gpointer  udata
[static]
 

void collect_all_iters GtkTreeModel *  model,
GtkTreePath *  path,
GtkTreeIter *  iter,
gpointer  data
[static]
 

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

GtkCellRenderer* create_cell_renderer gfloat  xalign  )  [static]
 

GtkTreeModel* create_results_model void   )  [static]
 

GtkTreeModel* create_searches_model void   )  [static]
 

void download_selected_all_files GtkTreeModel *  model,
GtkTreePath *  path,
GtkTreeIter *  iter,
gpointer  data
[static]
 

void download_selected_file GtkTreeModel *  model,
GtkTreeIter *  iter,
GSList **  sl
[static]
 

struct result_data* find_parent search_t *  search,
const struct result_data rd
[static]
 

struct result_data* find_parent2 search_t *  search,
const struct sha1 sha1,
filesize_t  filesize
[static]
 

gchar* get_local_file_url GtkWidget *  widget  )  [static]
 

struct result_data* get_result_data GtkTreeModel *  model,
GtkTreeIter *  iter
[inline, static]
 

void gui_search_clear_results void   ) 
 

Removes all search results from the current search.

void gui_search_create_tree_view GtkWidget **  sw,
GtkTreeView **  tv,
gpointer  udata
[static]
 

Create a new GtkTreeView for search results.

void gui_search_force_update_tab_label search_t *  sch,
time_t  now
 

Like search_update_tab_label but always update the label.

void gui_search_set_enabled struct search sch,
gboolean  enabled
 

Flag whether search is enabled.

gboolean gui_search_update_tab_label struct search sch  ) 
 

Update the label if nothing's changed or if the last update was recent.

gboolean gui_search_update_tab_label_cb gpointer  p  )  [static]
 

gboolean on_leave_notify GtkWidget *  widget,
GdkEventCrossing *  unused_event,
gpointer  unused_udata
[static]
 

void on_search_list_column_clicked GtkTreeViewColumn *  column,
gpointer  unused_udata
 

void on_search_list_row_deleted GtkTreeModel *  model,
GtkTreePath *  unused_path,
gpointer  unused_udata
[static]
 

gboolean prepare_remove_record GtkTreeModel *  model,
GtkTreePath *  unused_path,
GtkTreeIter *  iter,
gpointer  udata
[static]
 

void remove_selected_file gpointer  iter_ptr,
gpointer  model_ptr
[static]
 

void result_data_free search_t *  search,
struct result_data rd
[static]
 

gboolean search_by_regex GtkTreeModel *  model,
gint  column,
const gchar *  key,
GtkTreeIter *  iter,
gpointer  unused_data
[static]
 

void search_details_treeview_init void   )  [static]
 

void search_gui_add_record search_t *  sch,
record_t rc,
enum gui_color  color
 

Adds the record to gth GtkCTree for this search.

This is where the search grouping (parenting) is done

void search_gui_clear_ctree search_t *  search  )  [static]
 

void search_gui_clear_queue search_t *  search  )  [static]
 

void search_gui_clear_search search_t *  search  ) 
 

Clear all results from search.

void search_gui_clear_sorting search_t *  sch  )  [static]
 

void search_gui_close_search search_t *  search  ) 
 

Remove the search from the list of searches and free all associated ressources (including filter and gui stuff).

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Search results.

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

gint search_gui_cmp_strings const gchar *  a,
const gchar *  b
[inline, static]
 

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

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

void search_gui_collapse_all void   ) 
 

Expand all nodes in tree for current search.

void search_gui_discard_files void   ) 
 

Discard selected files.

void search_gui_download_files void   ) 
 

Download selected files.

void search_gui_end_massive_update search_t *  sch  ) 
 

void search_gui_expand_all void   ) 
 

Expand all nodes in tree for current search.

gint search_gui_file_eq gconstpointer  p,
gconstpointer  q
 

guint search_gui_file_hash gconstpointer  key  ) 
 

void search_gui_flush_queue search_t *  search  )  [static]
 

void search_gui_flush_queue_data search_t *  search,
GtkTreeModel *  model,
struct result_data rd
[static]
 

void search_gui_flush_queues void   ) 
 

gchar* search_gui_get_magnet GtkTreeModel *  model,
GtkTreeIter *  iter
 

gpointer search_gui_get_record GtkTreeModel *  model,
GtkTreeIter *  iter
 

const record_t* search_gui_get_record_at_path GtkTreeView *  tv,
GtkTreePath *  path
 

const GList* search_gui_get_searches void   ) 
 

GSList* search_gui_get_selected_searches void   ) 
 

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

gboolean search_gui_has_selected_item search_t *  search  ) 
 

void search_gui_init void   ) 
 

void search_gui_magnet_add_source struct magnet_resource magnet,
record_t record
[static]
 

void search_gui_make_meta_column_visible search_t *  search  )  [static]
 

void search_gui_menu_select gint  page  )  [static]
 

gboolean search_gui_menu_select_helper GtkTreeModel *  model,
GtkTreePath *  path,
GtkTreeIter *  iter,
gpointer  data
[static]
 

void search_gui_metadata_update const bitzi_data_t data  ) 
 

Metadata Update.

gboolean search_gui_new_search_full const gchar *  query_str,
time_t  create_time,
guint  lifetime,
guint32  reissue_timeout,
gint  sort_col,
gint  sort_order,
flag_t  flags,
search_t **  search
 

Create a new search and start it.

Returns:
TRUE if search was sucessfully created and FALSE if an error occured. If the "search" argument is not NULL a pointer to the new search is stored there.

void search_gui_remove_search search_t *  sch  ) 
 

Remove the search from the gui and update all widgets accordingly.

void search_gui_request_bitzi_data void   ) 
 

void search_gui_request_bitzi_data_helper gpointer  key,
gpointer  unused_value,
gpointer  unused_udata
[static]
 

void search_gui_reset_search search_t *  sch  ) 
 

Reset the internal model of the search.

Called when a search is restarted, for example.

void search_gui_restore_sorting search_t *  sch  )  [static]
 

void search_gui_search_list_clicked GtkWidget *  widget,
GdkEventButton *  event
 

void search_gui_set_clear_button_sensitive gboolean  flag  ) 
 

void search_gui_set_current_search search_t *  sch  ) 
 

void search_gui_set_data GtkTreeModel *  model,
struct result_data rd
 

void search_gui_shutdown void   ) 
 

void search_gui_start_massive_update search_t *  sch  ) 
 

void search_gui_synchronize_list GtkTreeModel *  model  )  [static]
 

gboolean search_gui_update_rank GtkTreeModel *  model,
GtkTreePath *  path,
GtkTreeIter *  iter,
gpointer  udata
 

Callback handler used with gtk_tree_model_foreach() to record the current rank/position in tree enabling stable sorting.

gint selection_counter GtkTreeView *  tv  )  [static]
 

gboolean tree_view_search_update GtkTreeModel *  model,
GtkTreePath *  path,
GtkTreeIter *  iter,
gpointer  data
[static]
 


Variable Documentation

GtkButton* button_search_clear [static]
 

GtkWidget* default_scrolled_window
 

GtkTreeView* default_search_tree_view [static]
 

GtkNotebook* notebook_search_results [static]
 

gboolean search_gui_shutting_down = FALSE [static]
 

GList* searches [static]
 

List of search structs.

GtkTreeView* tree_view_search [static]
 

tree_view_motion_t* tvm_search [static]
 

For cyclic updates of the tooltip.


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