Ejemplo n.º 1
0
static int load_panel_theme(struct panel_theme *theme, struct config_format_tree *tree)
{
	CLEAR_STRUCT(theme);
	struct config_format_entry *e = find_config_format_entry(&tree->root, "panel");
	if (!e)
		return XERROR("Failed to find 'panel' section in theme format file");


	theme->position = PANEL_POSITION_TOP; /* default */
	const char *v = find_config_format_entry_value(e, "position");
	if (v)
		theme->position = parse_position(v);

	theme->background = parse_image_part_named("background", e, tree, 1);
	if (!theme->background)
		return -1;

	theme->separator = parse_image_part_named("separator", e, tree, 0);
	theme->transparent = parse_bool("transparent", e);
	theme->align = parse_align("align", e);
	theme->height = parse_int("height", e, -1);
	theme->width = parse_int_or_percents("width", e, -1,
					     &theme->width_in_percents);
	return 0;
}
Ejemplo n.º 2
0
static int parse_taskbar_theme(struct taskbar_theme *tt,
			       struct config_format_entry *e,
			       struct config_format_tree *tree)
{
	if (parse_taskbar_state(&tt->states[BUTTON_STATE_IDLE], "idle", e, tree, 1))
		goto parse_taskbar_button_theme_error_idle;

	if (parse_taskbar_state(&tt->states[BUTTON_STATE_PRESSED], "pressed", e, tree, 1))
		goto parse_taskbar_button_theme_error_pressed;

	struct config_format_entry *ee = find_config_format_entry(e, "default_icon");
	
	tt->draw_mode = parse_draw_mode("draw_mode", e);
	
	if (ee && tt->draw_mode != DRAW_MODE_ONLY_TEXT);
		tt->default_icon = parse_image_part(ee, tree, 0);

	parse_taskbar_state(&tt->states[BUTTON_STATE_IDLE_HIGHLIGHT],
			    "idle_highlight", e, tree, 0);
	parse_taskbar_state(&tt->states[BUTTON_STATE_PRESSED_HIGHLIGHT],
			    "pressed_highlight", e, tree, 0);

	tt->separator = parse_image_part_named("separator", e, tree, 0);
	tt->task_max_width = parse_int("task_max_width", e, 0);

	return 0;

parse_taskbar_button_theme_error_pressed:
	free_taskbar_state(&tt->states[BUTTON_STATE_IDLE]);
parse_taskbar_button_theme_error_idle:
	return -1;
}