Пример #1
0
void
search_gui_init_tree(search_t *sch)
{
	GtkListStore *model;
	GtkTreeIter iter;
	
	g_assert(sch);

	g_assert(NULL == sch->parents);
	sch->parents = htable_create_any(search_gui_file_hash, NULL,
		search_gui_file_eq);

	g_assert(NULL == sch->queue);
	sch->queue = slist_new();

	/* Add the search to the TreeView in pane on the left */
	model = GTK_LIST_STORE(gtk_tree_view_get_model(tree_view_search));
	gtk_list_store_append(model, &iter);
	gtk_list_store_set(model, &iter,
		c_sl_name, search_gui_query(sch),
		c_sl_hit, 0,
		c_sl_new, 0,
		c_sl_sch, sch,
		c_sl_fg, NULL,
		c_sl_bg, NULL,
		(-1));
}
Пример #2
0
/**
 * Initialize the nodes controller. Register callbacks in the backend.
 */
void
nodes_gui_init(void)
{
	GtkTreeView *tv;
	
	tv = GTK_TREE_VIEW(gui_main_window_lookup( "treeview_nodes"));
	treeview_nodes = tv;

	tree_view_restore_widths(tv, PROP_NODES_COL_WIDTHS);
	tree_view_restore_visibility(tv, PROP_NODES_COL_VISIBLE);
	tree_view_set_fixed_height_mode(tv, TRUE);

	nodes_handles = htable_create_any(nid_hash, nid_hash2, nid_equal);
    ht_node_info_changed = hset_create_any(nid_hash, nid_hash2, nid_equal);
    ht_node_flags_changed = hset_create_any(nid_hash, nid_hash2, nid_equal);
    ht_pending_lookups = hset_create_any(nid_hash, nid_hash2, nid_equal);

    guc_node_add_node_added_listener(nodes_gui_node_added);
    guc_node_add_node_removed_listener(nodes_gui_node_removed);
    guc_node_add_node_info_changed_listener(nodes_gui_node_info_changed);
    guc_node_add_node_flags_changed_listener(nodes_gui_node_flags_changed);

	widget_add_popup_menu(GTK_WIDGET(tv), nodes_gui_get_popup_menu);
	gui_signal_connect(tv, "cursor-changed", on_cursor_changed, tv);
	gui_signal_connect(tv, "leave-notify-event", on_leave_notify, tv);

	tvm_nodes = tree_view_motion_set_callback(tv, update_tooltip, 400);

	main_gui_add_timer(nodes_gui_timer);
}
Пример #3
0
/**
 * Create a map implemented as a hash table.
 *
 * @param hash_func		the hash function for keys
 * @param key_eq_func	the key comparison function
 *
 * @return the new map
 */
map_t *
map_create_hash(hash_fn_t hash_func, eq_fn_t key_eq_func)
{
	map_t *m;

	WALLOC(m);
	m->magic = MAP_MAGIC;
	m->type = MAP_HASH;
	m->u.ht = htable_create_any(hash_func, NULL, key_eq_func);

	return m;
}
Пример #4
0
static htable_t *
header_get_table(header_t *o)
{
	header_check(o);

	if (NULL == o->headers) {
		o->headers = htable_create_any(ascii_strcase_hash,
			NULL, ascii_strcase_eq);
	}

	return o->headers;
}