Пример #1
0
void ro_treeview_update_toolbar(void *data)
{
	ro_treeview *tv = (ro_treeview *) data;

	if (tv != NULL && tv->tb != NULL) {
		ro_treeview_set_origin(tv, 0,
				-(ro_toolbar_height(tv->tb)));

		xwimp_force_redraw(tv->w, 0, tv->extent.y, tv->extent.x, 0);
	}
}
Пример #2
0
void ro_gui_cookies_open(void)
{
	tree_set_redraw(ro_treeview_get_tree(cookies_window.tv), true);

	ro_gui_cookies_toolbar_update_buttons();

	if (!ro_gui_dialog_open_top(cookies_window.window,
			cookies_window.toolbar, 600, 800)) {
		ro_treeview_set_origin(cookies_window.tv, 0,
				-(ro_toolbar_height(cookies_window.toolbar)));
	}
}
Пример #3
0
void ro_gui_global_history_open(void)
{
	tree_set_redraw(ro_treeview_get_tree(global_history_window.tv), true);

	ro_gui_global_history_toolbar_update_buttons();

	if (!ro_gui_dialog_open_top(global_history_window.window,
			global_history_window.toolbar, 600, 800)) {
		ro_treeview_set_origin(global_history_window.tv, 0,
				-(ro_toolbar_height(
				global_history_window.toolbar)));
	}
}
Пример #4
0
void gui_cert_verify(const char *url,
		const struct ssl_cert_info *certs, unsigned long num,
		nserror (*cb)(bool proceed, void *pw), void *cbpw)
{
	struct ro_sslcert		*sslcert_window;
	wimp_window_state		state;
	wimp_icon_state			istate;
	wimp_window_info		info;
	os_error			*error;
	bool				set_extent;

	assert(certs);

	sslcert_window = malloc(sizeof(struct ro_sslcert));
	if (sslcert_window == NULL) {
		LOG(("Failed to allocate memory for SSL Cert Dialog"));
		return;
	}

	/* Create the SSL window and its pane. */

	error = xwimp_create_window(ro_gui_cert_dialog_template,
			&(sslcert_window->window));
	if (error) {
		LOG(("xwimp_create_window: 0x%x: %s",
				error->errnum, error->errmess));
		free(sslcert_window);
		return;
	}

	error = xwimp_create_window(ro_gui_cert_tree_template,
			&(sslcert_window->pane));
	if (error) {
		LOG(("xwimp_create_window: 0x%x: %s",
				error->errnum, error->errmess));
		free(sslcert_window);
		return;
	}

	/* Create the SSL data and build a tree from it. */

	sslcert_window->tv = ro_treeview_create(sslcert_window->pane,
			NULL, NULL, sslcert_get_tree_flags());
	if (sslcert_window->tv == NULL) {
		LOG(("Failed to allocate treeview"));
		free(sslcert_window);
		return;
	}

	sslcert_window->data = sslcert_create_session_data(num, url, cb, cbpw);
	sslcert_load_tree(ro_treeview_get_tree(sslcert_window->tv),
			certs, sslcert_window->data);

	tree_set_redraw(ro_treeview_get_tree(sslcert_window->tv), true);

	/* Set up the certificate window event handling.
	 *
	 * (The action buttons are registered as button events, not OK and
	 * Cancel, as both need to carry out actions.)
	 */

	ro_gui_wimp_event_set_user_data(sslcert_window->window, sslcert_window);
	ro_gui_wimp_event_register_close_window(sslcert_window->window,
			ro_gui_cert_close_window);
	ro_gui_wimp_event_register_button(sslcert_window->window,
			ICON_SSL_REJECT, ro_gui_cert_reject);
	ro_gui_wimp_event_register_button(sslcert_window->window,
			ICON_SSL_ACCEPT, ro_gui_cert_accept);

	ro_gui_dialog_open_persistent(NULL, sslcert_window->window, false);

	/* Nest the tree window inside the pane window.  To do this, we:
	 * - Get the current pane extent,
	 * - Get the parent window position and the location of the pane-
	 *   locating icon inside it,
	 * - Set the visible area of the pane to suit,
	 * - Check that the pane extents are OK for this visible area, and
	 *   increase them if necessary,
	 * - Before finally opening the pane as a nested part of the parent.
	 */

	info.w = sslcert_window->pane;
	error = xwimp_get_window_info_header_only(&info);
	if (error) {
		ro_gui_cert_release_window(sslcert_window);
		LOG(("xwimp_get_window_info: 0x%x: %s",
				error->errnum, error->errmess));
		return;
	}

	state.w = sslcert_window->window;
	error = xwimp_get_window_state(&state);
	if (error) {
		ro_gui_cert_release_window(sslcert_window);
		LOG(("xwimp_get_window_state: 0x%x: %s",
				error->errnum, error->errmess));
		return;
	}

	istate.w = sslcert_window->window;
	istate.i = ICON_SSL_PANE;
	error = xwimp_get_icon_state(&istate);
	if (error) {
		ro_gui_cert_release_window(sslcert_window);
		LOG(("xwimp_get_icon_state: 0x%x: %s",
				error->errnum, error->errmess));
		return;
	}

	state.w = sslcert_window->pane;
	state.visible.x1 = state.visible.x0 + istate.icon.extent.x1 - 20 -
			ro_get_vscroll_width(sslcert_window->pane);
	state.visible.x0 += istate.icon.extent.x0 + 20;
	state.visible.y0 = state.visible.y1 + istate.icon.extent.y0 + 20 +
			ro_get_hscroll_height(sslcert_window->pane);
	state.visible.y1 += istate.icon.extent.y1 - 32;

	set_extent = false;

	if ((info.extent.x1 - info.extent.x0) <
			(state.visible.x1 - state.visible.x0)) {
		info.extent.x0 = 0;
		info.extent.x1 = state.visible.x1 - state.visible.x0;
		set_extent = true;
	}
	if ((info.extent.y1 - info.extent.y0) <
			(state.visible.y1 - state.visible.y0)) {
		info.extent.y1 = 0;
		info.extent.x1 = state.visible.y0 - state.visible.y1;
		set_extent = true;
	}

	if (set_extent) {
		error = xwimp_set_extent(sslcert_window->pane, &(info.extent));
		if (error) {
			ro_gui_cert_release_window(sslcert_window);
			LOG(("xwimp_set_extent: 0x%x: %s",
					error->errnum, error->errmess));
			return;
		}
	}

	error = xwimp_open_window_nested(PTR_WIMP_OPEN(&state),
			sslcert_window->window,
			wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
					<< wimp_CHILD_XORIGIN_SHIFT |
			wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT
					<< wimp_CHILD_YORIGIN_SHIFT |
			wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
					<< wimp_CHILD_LS_EDGE_SHIFT |
			wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
					<< wimp_CHILD_RS_EDGE_SHIFT);
	if (error) {
		ro_gui_cert_release_window(sslcert_window);
		LOG(("xwimp_open_window_nested: 0x%x: %s",
				error->errnum, error->errmess));
		ro_gui_cert_release_window(sslcert_window);
		return;
	}

	ro_treeview_set_origin(sslcert_window->tv, 0, 0);
}