Exemplo n.º 1
0
/**
 * Initialize the nodes controller. Register callbacks in the backend.
 */
G_GNUC_COLD void
nodes_gui_init(void)
{
	unsigned i;
	GtkCList *clist;

	clist = GTK_CLIST(gui_main_window_lookup("clist_nodes"));

    gtk_clist_column_titles_passive(clist);
	for (i = 0; i < c_gnet_num; i++) {
    	gtk_clist_set_column_name(clist, i, nodes_gui_column_title(i));
	}
	clist_restore_visibility(clist, PROP_NODES_COL_VISIBLE);
	clist_restore_widths(clist, PROP_NODES_COL_WIDTHS);

	widget_add_popup_menu(GTK_WIDGET(clist), nodes_gui_get_popup_menu);

    hs_node_info_changed = hset_create_any(nid_hash, nid_hash2, nid_equal);
    hs_node_flags_changed = 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);

	main_gui_add_timer(nodes_gui_timer);
}
Exemplo n.º 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);
}
Exemplo n.º 3
0
static void
search_list_tree_view_init(void)
{
	GtkTreeView *tv;
	
    tv = GTK_TREE_VIEW(gui_main_window_lookup("tree_view_search"));
    tree_view_search = tv;

	gtk_tree_view_set_reorderable(tv, TRUE);	
	gtk_tree_selection_set_mode(gtk_tree_view_get_selection(tv),
		GTK_SELECTION_MULTIPLE);
	gtk_tree_view_set_model(tv, create_searches_model());
	add_list_columns(tv);

	widget_add_popup_menu(GTK_WIDGET(tv),
		search_gui_get_search_list_popup_menu);
	gui_signal_connect(tv,
		"button-release-event", on_search_list_button_release_event, NULL);
	gui_signal_connect(tv,
		"key-release-event", on_search_list_key_release_event, NULL);
	gui_signal_connect_after(gtk_tree_view_get_model(tv),
		"row-deleted", on_search_list_row_deleted, NULL);
}
Exemplo n.º 4
0
void
fi_gui_init(void)
{
	fi_sources = g_hash_table_new(NULL, NULL);
	
	{
		GtkTreeViewColumn *column;
		GtkTreeView *tv;

		tv = GTK_TREE_VIEW(gui_main_window_lookup("treeview_download_aliases"));
		treeview_download_aliases = tv;

		store_aliases = gtk_list_store_new(1, G_TYPE_STRING);
		gtk_tree_view_set_model(tv, GTK_TREE_MODEL(store_aliases));

		column = gtk_tree_view_column_new_with_attributes(_("Aliases"),
					create_text_cell_renderer(0.0),
					"text", 0,
					(void *) 0);
		configure_column(column);
		gtk_tree_view_column_set_sort_column_id(column, 0);
    	gtk_tree_view_append_column(tv, column);

		tree_view_set_fixed_height_mode(tv, TRUE);
		drag_attach_text(GTK_WIDGET(tv), fi_gui_get_alias);
	}

	{
		static const struct {
			enum c_src id;
			const char *title;
		} tab[] = {
   			{ c_src_host, 	 	N_("Host"), },
   			{ c_src_country, 	N_("Country"), },
   			{ c_src_server,  	N_("Server"), },
   			{ c_src_range, 	 	N_("Range"), },
   			{ c_src_progress,	N_("Progress"), },
   			{ c_src_status,	 	N_("Status"), },
		};
		GtkTreeView *tv;
		unsigned i;

		STATIC_ASSERT(c_src_num == G_N_ELEMENTS(tab));
		
		tv = GTK_TREE_VIEW(gui_main_window_lookup("treeview_download_sources"));
		treeview_download_sources = tv;

		store_sources = gtk_list_store_new(1, G_TYPE_POINTER);
		gtk_tree_view_set_model(tv, GTK_TREE_MODEL(store_sources));

		for (i = 0; i < G_N_ELEMENTS(tab); i++) {
			GtkCellRenderer *renderer;

			renderer = tab[i].id == c_src_progress
						? gtk_cell_renderer_progress_new()
						: NULL;
    		add_column(tv, tab[i].id, _(tab[i].title), 0.0,
				renderer, render_sources);
		}

		gtk_tree_view_set_headers_clickable(tv, FALSE);
		gtk_tree_selection_set_mode(gtk_tree_view_get_selection(tv),
			GTK_SELECTION_MULTIPLE);
		tree_view_restore_widths(tv, PROP_SOURCES_COL_WIDTHS);
		tree_view_set_fixed_height_mode(tv, TRUE);

		widget_add_popup_menu(GTK_WIDGET(tv), fi_gui_sources_get_popup_menu);	
	}

	fi_gui_details_treeview_init();
	fi_gui_common_init();
}
Exemplo n.º 5
0
void
fi_gui_init(void)
{
	fi_sources = htable_create(HASH_KEY_SELF, 0);

	{
		GtkTreeViewColumn *column;
		GtkTreeView *tv;

		tv = GTK_TREE_VIEW(gui_main_window_lookup("treeview_download_aliases"));
		treeview_download_aliases = tv;

		store_aliases = gtk_list_store_new(1, G_TYPE_STRING);
		gtk_tree_view_set_model(tv, GTK_TREE_MODEL(store_aliases));

		column = gtk_tree_view_column_new_with_attributes(_("Aliases"),
					create_text_cell_renderer(0.0),
					"text", 0,
					NULL_PTR);
		configure_column(column);
		gtk_tree_view_column_set_sort_column_id(column, 0);
    	gtk_tree_view_append_column(tv, column);

		tree_view_set_fixed_height_mode(tv, TRUE);
		drag_attach_text(GTK_WIDGET(tv), fi_gui_get_alias);
	}

	{
		static const struct {
			enum c_src id;
			const char *title;
		} tab[] = {
   			{ c_src_host, 	 	N_("Host"), },
   			{ c_src_country, 	N_("Country"), },
   			{ c_src_server,  	N_("Server"), },
   			{ c_src_range, 	 	N_("Range"), },
   			{ c_src_progress,	N_("Progress"), },
   			{ c_src_status,	 	N_("Status"), },
		};
		GtkTreeView *tv;
		unsigned i;

		STATIC_ASSERT(c_src_num == N_ITEMS(tab));

		tv = GTK_TREE_VIEW(gui_main_window_lookup("treeview_download_sources"));
		treeview_download_sources = tv;

		store_sources = gtk_list_store_new(1, G_TYPE_POINTER);
		gtk_tree_view_set_model(tv, GTK_TREE_MODEL(store_sources));

		for (i = 0; i < N_ITEMS(tab); i++) {
			GtkCellRenderer *renderer;

			renderer = tab[i].id == c_src_progress
						? gtk_cell_renderer_progress_new()
						: NULL;
			(void) add_column(tv, tab[i].id, _(tab[i].title), 0.0,
				renderer, render_sources);
		}

		gtk_tree_view_set_headers_clickable(tv, FALSE);
		gtk_tree_selection_set_mode(gtk_tree_view_get_selection(tv),
			GTK_SELECTION_MULTIPLE);
		tree_view_restore_widths(tv, PROP_SOURCES_COL_WIDTHS);
		tree_view_set_fixed_height_mode(tv, TRUE);

		widget_add_popup_menu(GTK_WIDGET(tv), fi_gui_sources_get_popup_menu);
	}

	fi_gui_details_treeview_init();
	fi_gui_common_init();

	{
		uint32 page;
		GtkNotebook *notebook_downloads_info =
			GTK_NOTEBOOK(gui_main_window_lookup("notebook_downloads_info"));

		gui_prop_get_guint32_val(PROP_DOWNLOADS_INFO_NOTEBOOK_TAB, &page);

		if (page >= NUM_DOWNLOADS_INFO_NB_PAGES)
			page = DOWNLOADS_INFO_NB_PAGE_DETAILS;

		notebook_downloads_info_current_page = page;
		gtk_notebook_set_current_page(notebook_downloads_info, page);

		gui_signal_connect(notebook_downloads_info,
			"switch-page", on_notebook_downloads_info_switch_page, NULL);
	}
}