コード例 #1
0
ファイル: icon.c プロジェクト: qgewfg/gtk-gnutella
G_GNUC_COLD void
icon_init(void)
{
    GtkPixmap *pixmap;
    pixmap = (GtkPixmap *) create_pixmap(gui_main_window(), "icon.xpm");
    gtk_pixmap_get(pixmap, &icon_map, &icon_mask);
    gdk_window_set_icon(gui_main_window()->window, NULL, icon_map, icon_mask);
}
コード例 #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
ファイル: icon.c プロジェクト: qgewfg/gtk-gnutella
static void
status_icon_disable(void)
{
	if (status_icon) {
		g_object_unref(status_icon);
		status_icon = NULL;
		gtk_widget_show(gui_main_window());
	}
}
コード例 #4
0
ファイル: search_cb.c プロジェクト: Longdengyu/gtk-gnutella
void
on_popup_search_copy_magnet_activate(GtkMenuItem *unused_item,
	gpointer unused_udata)
{
	search_t *search;

	(void) unused_item;
	(void) unused_udata;

	search = search_gui_get_current_search();
	g_return_if_fail(search);

	if (selected_record) {
		char *magnet = search_gui_get_magnet(search, selected_record);
		clipboard_set_text(gui_main_window(), magnet);
		HFREE_NULL(magnet);
	}
}
コード例 #5
0
ファイル: callbacks.c プロジェクト: MrJoe/gtk-gnutella
static void
directory_chooser_show(enum dir_choice dir_choice, const char *title,
	const char *current_directory)
{
	GtkWidget *widget;

	if (directory_chooser) {
		gtk_widget_destroy(directory_chooser);
		directory_chooser = NULL;
	}

	widget = gtk_file_chooser_dialog_new(title,
				GTK_WINDOW(gui_main_window()),
				GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
				GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
				GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
				(void *) 0);
	g_return_if_fail(NULL != widget);
	directory_chooser = widget;

	gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(widget), TRUE);
	gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(widget),
		gtk_file_filter_new());	/* Display only directories */

	if (NULL != current_directory) {
		gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(widget),
			current_directory);
	}

	gui_signal_connect(widget, "destroy-event",
		on_directory_chooser_destroy_event, NULL);
	gui_signal_connect(widget, "delete-event",
		on_directory_chooser_delete_event, NULL);
	gui_signal_connect(widget, "response",
		on_directory_chooser_response, uint_to_pointer(dir_choice));

	gtk_widget_show(widget);
}
コード例 #6
0
ファイル: icon.c プロジェクト: qgewfg/gtk-gnutella
static void
on_status_icon_activate(GtkStatusIcon *sicon, gpointer unused_udata)
{
	static gboolean hidden;

	(void) sicon;
	(void) unused_udata;

	/*
	 * Start from known state: force de-iconification of the Window if we
	 * haven't hidden it through the tray icon previously.
	 *
	 * On Windows, hiding the window via the tray icon when the main window
	 * is in the iconified state results in a window that can no longer
	 * be restored to the screen!
	 *
	 * De-iconifying first is a hack because we don't want to trap the state
	 * change events on the window to know whether it is already iconified.
	 * The de-iconification will be visible by users, but it's better than
	 * the alternative: not being able to restore the window later.
	 *		--RAM, 2011-11-16.
	 */

	if (!hidden)
		gtk_window_deiconify(GTK_WINDOW(gui_main_window()));

	if (GTK_WIDGET_VISIBLE(gui_main_window())) {
		gui_save_window(gui_main_window(), PROP_WINDOW_COORDS);
		gtk_widget_hide(gui_main_window());
		hidden = TRUE;
	} else {
		gtk_widget_show(gui_main_window());
		gui_restore_window(gui_main_window(), PROP_WINDOW_COORDS);
		hidden = FALSE;
	}
}