gave Arlo the ability to control the sidebar text color for his new

* src/nautilus-sidebar-title.c:
	(nautilus_sidebar_title_background_is_default),
	(nautilus_sidebar_title_select_text_color):
	gave Arlo the ability to control the sidebar text color for his new
	sidebar by specifying the colors in the theme file.
	* icons/eazel/eazel.xml:
	specified the sidebar title text colors for the eazel theme

	* src/nautilus-theme-selector.c: (make_theme_description):
	fixed memory leak.
This commit is contained in:
Andy Hertzfeld 2000-12-13 08:03:18 +00:00
parent 1045595d14
commit ae59913ccb
4 changed files with 69 additions and 11 deletions

View file

@ -1,3 +1,16 @@
2000-12-13 Andy Hertzfeld <andy@eazel.com>
* src/nautilus-sidebar-title.c:
(nautilus_sidebar_title_background_is_default),
(nautilus_sidebar_title_select_text_color):
gave Arlo the ability to control the sidebar text color for his new
sidebar by specifying the colors in the theme file.
* icons/eazel/eazel.xml:
specified the sidebar title text colors for the eazel theme
* src/nautilus-theme-selector.c: (make_theme_description):
fixed memory leak.
2000-12-13 Josh Barrow <josh@eazel.com>
* icons/eazel/eazel.xml:

View file

@ -2,6 +2,7 @@
<theme name="eazel">
<sidebar SIDEBAR_BACKGROUND_TILE_IMAGE="./side_bar_image.png"
SIDEBAR_BACKGROUND_COLOR="rgb:E7E7/E7E7/E7E7-rgb:C3C3/C3C3/C3C3%88-rgb:A9A9/A9A9/A9A9%95-rgb:3636/3636/3636:h"
TITLE_COLOR="rgb:3333/3333/7777" TITLE_INFO_COLOR="rgb:3333/3333/7777" TITLE_SHADOW_COLOR="rgb:BBBB/BBBB/FFFF"
TAB_PIECE_IMAGES="sidebar_tab_pieces" COMBINE="TRUE" LEFT_OFFSET="0" SHADOW_OFFSET="1" TEXT_H_OFFSET="-4" LABEL_COLOR="rgb:FFFF/FFFF/FFFF" TAB_FONT="-*-helvetica-bold-r-normal-*-24-*-*-*-*-*-*-*" />
<directory BACKGROUND_COLOR="rgb:CFFF/D333/D999"
SELECTION_BOX_COLOR_RGBA="0x727D974C" SELECTION_BOX_COLOR="rgb:7222/7DDD/9777" />

View file

@ -279,6 +279,27 @@ nautilus_sidebar_title_background (NautilusSidebarTitle *sidebar_title)
}
}
/* utility to determine if the sidebar is using the default theme */
static gboolean
nautilus_sidebar_title_background_is_default (NautilusSidebarTitle *sidebar_title)
{
char *background_color, *background_image;
gboolean is_default;
background_color = nautilus_file_get_metadata (sidebar_title->details->file,
NAUTILUS_METADATA_KEY_SIDEBAR_BACKGROUND_COLOR,
NULL);
background_image = nautilus_file_get_metadata (sidebar_title->details->file,
NAUTILUS_METADATA_KEY_SIDEBAR_BACKGROUND_IMAGE,
NULL);
is_default = background_color == NULL && background_image == NULL;
g_free (background_color);
g_free (background_image);
return is_default;
}
/* utility that returns true if the title is over a dark background. We do this by finding the
sidebar and asking its background */
void
@ -289,20 +310,42 @@ nautilus_sidebar_title_select_text_color (NautilusSidebarTitle *sidebar_title)
char *sidebar_info_title_color;
char *sidebar_title_shadow_color;
/* if the background is set to the default, the theme can explicitly define the title colors. Check if
* the background has been customized and if the theme specified any colors
*/
sidebar_title_color = NULL;
sidebar_info_title_color = NULL;
sidebar_title_shadow_color = NULL;
background = nautilus_sidebar_title_background (sidebar_title);
if (background != NULL) {
/* FIXME bugzilla.eazel.com 2496: for now, both the title and info colors are the same */
if (nautilus_background_is_dark (background)) {
sidebar_title_color = g_strdup("rgb:FFFF/FFFF/FFFF");
sidebar_info_title_color = g_strdup("rgb:FFFF/FFFF/FFFF");
sidebar_title_shadow_color = g_strdup("rgb:0000/0000/0000");
} else {
sidebar_title_color = g_strdup("rgb:0000/0000/0000");
sidebar_info_title_color = g_strdup("rgb:0000/0000/0000");
sidebar_title_shadow_color = g_strdup("rgb:FFFF/FFFF/FFFF");
if (nautilus_sidebar_title_background_is_default (sidebar_title)) {
sidebar_title_color = nautilus_theme_get_theme_data ("sidebar", "TITLE_COLOR");
sidebar_info_title_color = nautilus_theme_get_theme_data ("sidebar", "TITLE_INFO_COLOR");
sidebar_title_shadow_color = nautilus_theme_get_theme_data ("sidebar", "TITLE_SHADOW_COLOR");
}
if (sidebar_title_color == NULL) {
/* FIXME bugzilla.eazel.com 2496: for now, both the title and info colors are the same */
if (nautilus_background_is_dark (background)) {
sidebar_title_color = g_strdup("rgb:FFFF/FFFF/FFFF");
sidebar_info_title_color = g_strdup("rgb:FFFF/FFFF/FFFF");
sidebar_title_shadow_color = g_strdup("rgb:0000/0000/0000");
} else {
sidebar_title_color = g_strdup("rgb:0000/0000/0000");
sidebar_info_title_color = g_strdup("rgb:0000/0000/0000");
sidebar_title_shadow_color = g_strdup("rgb:FFFF/FFFF/FFFF");
}
} else {
if (sidebar_info_title_color == NULL) {
sidebar_info_title_color = g_strdup (sidebar_title_color);
}
if (sidebar_title_shadow_color == NULL) {
sidebar_title_shadow_color = g_strdup("rgb:FFFF/FFFF/FFFF");
}
}
if (sidebar_title->details->smooth_graphics) {
nautilus_label_set_text_color (NAUTILUS_LABEL (sidebar_title->details->smooth_title_label),
nautilus_parse_rgb_with_white_default (sidebar_title_color));

View file

@ -667,6 +667,7 @@ make_theme_description (const char *theme_name, const char *theme_path_uri)
if (description_node != NULL) {
temp_str = xmlGetProp (description_node, "TEXT");
description_result = g_strdup (temp_str);
xmlFree (temp_str);
}
xmlFreeDoc (theme_document);