コード例 #1
0
ファイル: nodes.c プロジェクト: Longdengyu/gtk-gnutella
/**
 * 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);
}
コード例 #2
0
ファイル: icon.c プロジェクト: qgewfg/gtk-gnutella
/**
 * For details of what is expected from an icon window and what it
 * should expect.
 *
 * See --
 *    http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.9
 */
G_GNUC_COLD void
icon_init(void)
{
    create_icon();

	gtk_widget_realize(icon);

    /*
     * For some reason, when a window is the icon for another
     * window, none of its subwindows get mapped.  This is not
     * because of GTK, but seems to be either the window manager
     * or X itself that does this.
     *
     * Also note the canvas widget is never unmapped, regardless
     * of whether the icon window is visible or not.
     */
    gtk_widget_map(canvas);
	/* FIXME: This causes a crash with twm when iconizing the main window. */
#if 0
    gdk_window_set_icon(gui_main_window()->window, icon->window, NULL, NULL);
#endif
    icon_just_mapped_fg = icon_visible_fg = icon_close_fg = FALSE;

    /*   load images   */
    con_pixbuf = create_pixbuf("smallserver.xpm");
    up_pixbuf = create_pixbuf("upload.xpm");
    down_pixbuf = create_pixbuf("download.xpm");

	status_icon_init();

	main_gui_add_timer(icon_timer);
}
コード例 #3
0
ファイル: statusbar.c プロジェクト: MrJoe/gtk-gnutella
G_GNUC_COLD void
statusbar_gui_init(void)
{
    GtkStatusbar *sb;

    sb = statusbar_get();
	statusbar_set_shadow_type(GTK_STATUSBAR(sb), GTK_SHADOW_ETCHED_IN);

	scid_bottom = gtk_statusbar_get_context_id(sb, "default");
	scid_hostsfile = gtk_statusbar_get_context_id(sb, "reading hosts file");
	scid_queue_freezed = gtk_statusbar_get_context_id(sb, "queue freezed");
   	scid_info = gtk_statusbar_get_context_id(sb, "information");
    scid_ip_changed = gtk_statusbar_get_context_id(sb, "ip changed");
    scid_warn = gtk_statusbar_get_context_id(sb, "warning");

   	/*
	 * This message lies at the bottom of the statusbar, and is never removed,
	 * but to be replaced by an updated message.
	 *
	 * The current string held at the bottom is stored in `statbar_botstr'.
	 * If a new string is pending replacement in `statbar_botstr_new', then
	 * it will replace the current one when the last timeout for pushed
	 * messages expires, at which time we'll know the bottom message is shown.
	 *		--RAM, 27/06/2002
	 */

	statbar_botstr = h_strdup(product_get_website());
	statusbar_gui_push(SB_MESSAGE, scid_bottom, 0, "%s", statbar_botstr);

	main_gui_add_timer(statusbar_gui_clear_timeouts);
}
コード例 #4
0
ファイル: nodes.c プロジェクト: lucab/gtk-gnutella
/**
 * 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);
}
コード例 #5
0
void
search_stats_gui_init(void)
{
    GtkCList *clist = GTK_CLIST(gui_main_window_lookup("clist_search_stats"));

    /* set up the clist to be sorted properly */
	gtk_clist_set_sort_column(clist, c_st_total);
	gtk_clist_set_sort_type(clist, GTK_SORT_DESCENDING);
	clist_restore_widths(clist, PROP_SEARCH_STATS_COL_WIDTHS);

	stat_hash = g_hash_table_new(g_str_hash, g_str_equal);
	main_gui_add_timer(search_stats_gui_timer);
}
コード例 #6
0
void
search_stats_gui_init(void)
{
    static GType types[] = {
        G_TYPE_STRING,
        G_TYPE_ULONG,
        G_TYPE_ULONG
    };
    static const struct {
        const int id;
        const float align;
        const char *title;
    } cols[] = {
        { 0, 0.0, N_("Search Term") },
        { 1, 1.0, N_("This Interval") },
        { 2, 1.0, N_("Total") },
    };
    size_t i;
    GtkTreeModel *model;
    GtkTreeView *treeview;

    STATIC_ASSERT(G_N_ELEMENTS(cols) == G_N_ELEMENTS(types));

    treeview_search_stats =
        GTK_TREE_VIEW(gui_main_window_lookup("treeview_search_stats"));
    label_search_stats_count =
        GTK_LABEL(gui_main_window_lookup("label_search_stats_count"));

    treeview = treeview_search_stats;

    /* set up the treeview to be sorted properly */
    model = GTK_TREE_MODEL(gtk_list_store_newv(G_N_ELEMENTS(types), types));
    gtk_tree_view_set_model(treeview, model);
    store_search_stats = GTK_LIST_STORE(model);
    g_object_unref(model);

    for (i = 0; i < G_N_ELEMENTS(cols); i++) {
        add_column(treeview, cols[i].id, cols[i].align, _(cols[i].title));
    }
    tree_view_restore_widths(treeview, PROP_SEARCH_STATS_COL_WIDTHS);
    tree_view_set_fixed_height_mode(treeview, TRUE);

    stat_hash = htable_create(HASH_KEY_STRING, 0);
    main_gui_add_timer(search_stats_gui_timer);
}
コード例 #7
0
ファイル: hcache.c プロジェクト: luciomarinelli/gtk-gnutella
void
hcache_gui_init(void)
{
    GtkTreeModel *model;
    gint n;

	STATIC_ASSERT(N_ITEMS(hcache_col_labels) ==
		HCACHE_STATS_VISIBLE_COLUMNS);

    treeview_hcache = GTK_TREE_VIEW(gui_main_window_lookup("treeview_hcache"));
	model = GTK_TREE_MODEL(gtk_list_store_new(4,
							G_TYPE_STRING, G_TYPE_UINT, G_TYPE_UINT,
							G_TYPE_UINT));

	for (n = 0; n < HCACHE_MAX; n++) {
		GtkTreeIter iter;

		if (n == HCACHE_NONE)
			continue;

		gtk_list_store_append(GTK_LIST_STORE(model), &iter);
        gtk_list_store_set(GTK_LIST_STORE(model), &iter,
            c_hcs_name,       get_hcache_name(n),
            c_hcs_host_count, 0,
            c_hcs_hits,       0,
            c_hcs_misses,     0,
            (-1));
	}

	for (n = 0; (guint) n < N_ITEMS(hcache_col_labels); n++) {
		add_column(treeview_hcache, n, (gfloat) (n != 0),
			_(hcache_col_labels[n].text));
	}
    gtk_tree_view_set_model(treeview_hcache, model);
    tree_view_restore_widths(treeview_hcache, PROP_HCACHE_COL_WIDTHS);
	g_object_unref(model);

	tree_view_set_fixed_height_mode(treeview_hcache, TRUE);
	main_gui_add_timer(hcache_gui_timer);
}
コード例 #8
0
ファイル: hcache.c プロジェクト: MrJoe/gtk-gnutella
void
hcache_gui_init(void)
{
    GtkCList *clist;
    const gchar *titles[5];
    guint i;

    for (i = 0; i < G_N_ELEMENTS(titles); i++) {
        titles[i] = "-";
	}
    clist = GTK_CLIST(gui_main_window_lookup("clist_hcache"));

    /*
     * Stats can't be sorted: make column headers insensitive.
     */
	gtk_clist_column_titles_passive(clist);

    /*
     * Initialize stats tables.
     */
    for (i = 0; i < HCACHE_MAX; i++) {
        gint row;

		if (i == HCACHE_NONE)
			continue;

        titles[0] = get_hcache_name(i);

	/* Override const */
        row = gtk_clist_append(clist, (gchar **) titles);
        gtk_clist_set_selectable(clist, row, FALSE);
    }

    for (i = 1; i < 4; i++) {
        gtk_clist_set_column_justification(clist, i, GTK_JUSTIFY_RIGHT);
    }
	clist_restore_widths(clist, PROP_HCACHE_COL_WIDTHS);
	main_gui_add_timer(hcache_gui_timer);
}