Esempio n. 1
0
bool ro_gui_options_content_ok(wimp_w w)
{
	nsoption_set_bool(block_ads,
			  ro_gui_get_icon_selected_state(w, CONTENT_BLOCK_ADVERTISEMENTS));

	nsoption_set_bool(block_popups,
			  ro_gui_get_icon_selected_state(w, CONTENT_BLOCK_POPUPS));
	nsoption_set_bool(no_plugins,
			  ro_gui_get_icon_selected_state(w, CONTENT_NO_PLUGINS));

	nsoption_set_bool(target_blank,
			  ro_gui_get_icon_selected_state(w, CONTENT_TARGET_BLANK));

	ro_gui_save_options();
  	return true;
}
Esempio n. 2
0
bool ro_gui_options_theme_ok(wimp_w w)
{
	struct toolbar_display *toolbar;
	struct theme_descriptor *theme_new = NULL;

	/* find the current selection */
	for (toolbar = toolbars; toolbar; toolbar = toolbar->next) {
		if (ro_gui_get_icon_selected_state(theme_pane, toolbar->icon_number)) {
			theme_new = toolbar->descriptor;
		  	break;
		}
	}

	/* set the options */
	if (option_theme)
		free(option_theme);
	if (theme_new) {
		option_theme = strdup(theme_new->leafname);
		ro_gui_theme_apply(theme_new);
	} else
		option_theme = NULL;
	ro_gui_save_options();

	/* store the pane status */
	ro_gui_wimp_event_memorise(theme_pane);
	return true;
}
Esempio n. 3
0
bool ro_gui_options_security_ok(wimp_w w)
{
  	option_send_referer = ro_gui_get_icon_selected_state(w,
  			SECURITY_REFERRER);
	option_expire_url = ro_gui_get_icon_decimal(w,
			SECURITY_DURATION_FIELD, 0);

	ro_gui_save_options();
  	return true;
}
Esempio n. 4
0
void ro_gui_options_update_shading(wimp_w w)
{
	bool shaded;

	shaded = ro_gui_get_icon_selected_state(w, IMAGE_DISABLE_ANIMATION);
	ro_gui_set_icon_shaded_state(w, IMAGE_SPEED_TEXT, shaded);
	ro_gui_set_icon_shaded_state(w, IMAGE_SPEED_FIELD, shaded);
	ro_gui_set_icon_shaded_state(w, IMAGE_SPEED_DEC, shaded);
	ro_gui_set_icon_shaded_state(w, IMAGE_SPEED_INC, shaded);
	ro_gui_set_icon_shaded_state(w, IMAGE_SPEED_CS, shaded);
}
Esempio n. 5
0
bool ro_gui_options_security_ok(wimp_w w)
{
	nsoption_set_bool(send_referer,
			  ro_gui_get_icon_selected_state(w, SECURITY_REFERRER));

	nsoption_set_int(expire_url,
			 ro_gui_get_icon_decimal(w,SECURITY_DURATION_FIELD, 0));

	ro_gui_save_options();
  	return true;
}
Esempio n. 6
0
bool ro_gui_options_home_ok(wimp_w w)
{
	nsoption_set_charp(homepage_url,
		       strdup(ro_gui_get_icon_string(w, HOME_URL_FIELD)));

	nsoption_set_bool(open_browser_at_startup,
			  ro_gui_get_icon_selected_state(w, HOME_OPEN_STARTUP));

	ro_gui_save_options();
  	return true;
}
Esempio n. 7
0
bool ro_gui_options_interface_ok(wimp_w w)
{
	nsoption_set_bool(strip_extensions, 
			ro_gui_get_icon_selected_state(w, 
					INTERFACE_STRIP_EXTNS_OPTION));
	nsoption_set_bool(confirm_overwrite, 
                          ro_gui_get_icon_selected_state(w,
                                        INTERFACE_CONFIRM_OVWR_OPTION));
	nsoption_set_bool(url_suggestion, 
                          ro_gui_get_icon_selected_state(w,
                                        INTERFACE_URL_COMPLETE_OPTION));
	nsoption_set_bool(history_tooltip, 
                          ro_gui_get_icon_selected_state(w,
                                        INTERFACE_HISTORY_TOOLTIP_OPTION));
	nsoption_set_bool(thumbnail_iconise, 
                          ro_gui_get_icon_selected_state(w,
                                        INTERFACE_THUMBNAIL_ICONISE_OPTION));
	nsoption_set_bool(external_hotlists, 
                          ro_gui_get_icon_selected_state(w,
                                        INTERFACE_USE_EXTERNAL_HOTLIST));
	nsoption_set_charp(external_hotlist_app,
                           strdup(ro_gui_get_icon_string(w,
                                        INTERFACE_EXTERNAL_HOTLIST_APP)));

	ro_gui_save_options();
	return true;
}
Esempio n. 8
0
bool ro_gui_options_interface_click(wimp_pointer *pointer)
{
	bool	shaded;

	switch (pointer->i) {
		case INTERFACE_USE_EXTERNAL_HOTLIST:
			shaded = !ro_gui_get_icon_selected_state(pointer->w,
					INTERFACE_USE_EXTERNAL_HOTLIST);
			ro_gui_set_icon_shaded_state(pointer->w,
					INTERFACE_EXTERNAL_HOTLIST_APP, shaded);
			return false;
			break;
	}
	return false;
}
Esempio n. 9
0
bool ro_gui_options_image_ok(wimp_w w)
{
	ro_gui_options_image_read(w, 
				  (unsigned int *)&nsoption_int(plot_bg_quality),
				  (unsigned int *)&nsoption_int(plot_fg_quality));

	nsoption_set_int(minimum_gif_delay,
			 ro_gui_get_icon_decimal(w, IMAGE_SPEED_FIELD, 2));

	nsoption_set_bool(animate_images,
			  !ro_gui_get_icon_selected_state(w,
					IMAGE_DISABLE_ANIMATION));
	ro_gui_save_options();

	return true;
}
Esempio n. 10
0
bool ro_gui_save_theme(char *path) {
  	os_error *error;
	struct theme_file_header *file_header;
	char *workspace;
	int workspace_size, output_size, input_left, output_left;
	squash_output_status status;

	/*	Get some memory
	*/
	unsigned int file_size = sizeof (struct theme_file_header);
	file_header = (struct theme_file_header *)calloc(file_size, 1);
	if (!file_header) {
	  	LOG(("No memory for calloc()"));
		warn_user("NoMemory", 0);
		return false;
	}

	/*	Complete the header
	*/
	file_header->magic_value = 0x4d54534e;
	file_header->parser_version = 2;
	strcpy(file_header->name, ro_gui_get_icon_string(dialog_main, ICON_MAIN_NAME));
	strcpy(file_header->author, ro_gui_get_icon_string(dialog_main, ICON_MAIN_AUTHOR));
	file_header->browser_bg = ro_gui_get_icon_background_colour(dialog_main,
			ICON_MAIN_BROWSER_COLOUR);
	file_header->hotlist_bg = ro_gui_get_icon_background_colour(dialog_main,
			ICON_MAIN_HOTLIST_COLOUR);
	file_header->status_bg = ro_gui_get_icon_background_colour(dialog_main,
			ICON_MAIN_STATUSBG_COLOUR);
	file_header->status_fg = ro_gui_get_icon_background_colour(dialog_main,
			ICON_MAIN_STATUSFG_COLOUR);
	if (ro_gui_get_icon_selected_state(dialog_main, ICON_MAIN_THROBBER_LEFT))
		file_header->theme_flags = (1 << 0);
	if (ro_gui_get_icon_selected_state(dialog_main, ICON_MAIN_THROBBER_REDRAW))
		file_header->theme_flags = (1 << 1);


	/*	Append the compressed sprites
	*/
	if (theme_sprites) {
		file_header->decompressed_sprite_size = theme_sprites->size;
		error = xsquash_compress_return_sizes(theme_sprites->size,
				&workspace_size, &output_size);
		if (error) {
		  	free(file_header);
			LOG(("xsquash_compress_return_sizes: 0x%x: %s",
					error->errnum, error->errmess));
			warn_user("MiscError", error->errmess);
			return false;
		}
		workspace = realloc(file_header,
				file_size + output_size);
		if (!workspace) {
		  	free(file_header);
			LOG(("No memory for realloc()"));
			warn_user("NoMemory", 0);
			return false;
		}
		file_header = (struct theme_file_header *)workspace;
		workspace = malloc(workspace_size);
		if (!workspace) {
		  	free(file_header);
			LOG(("No memory for malloc()"));
			warn_user("NoMemory", 0);
			return false;
		}
		error = xsquash_compress((squash_input_status)0,
				workspace, (byte *)theme_sprites,
				theme_sprites->size,
				(byte *)(file_header + 1), output_size,
				&status, 
				0, &input_left, 0, &output_left);
	  	free(workspace);
		if (error) {
		  	free(file_header);
			LOG(("xsquash_compress: 0x%x: %s",
					error->errnum, error->errmess));
			warn_user("MiscError", error->errmess);
			return false;
		}
		if ((input_left > 0) || (status != 0)) {
		  	free(file_header);
		  	LOG(("Failed to complete compression with %i bytes left and status %i",
		  		input_left, (int)status));
		  	warn_user("FileError", 0);
		  	return false;
		}
		file_header->compressed_sprite_size = output_size - output_left;
		file_size += output_size - output_left;
	}
	
	/*	Save the file
	*/
	error = xosfile_save_stamped(path, (bits)0xffd,
			(char *)file_header, ((char *)file_header) + file_size);
	free(file_header);
	if (error) {
		LOG(("xosfile_save_stamped: 0x%x: %s",
				error->errnum, error->errmess));
		warn_user("FileError", error->errmess);
		return false;
	}
	return false;
}