Commit 198ccfc0 authored by Andy Hertzfeld's avatar Andy Hertzfeld
Browse files

made the sidebar title color be themable, and changed the color in the


	made the sidebar title color be themable, and changed the color
	in the arlo theme to white
parent 472dfcee
2000-07-03 Andy Hertzfeld <andy@eazel.com>
* src/nautilus-sidebar-title.c:
(nautilus_sidebar_title_initialize),
(nautilus_sidebar_title_destroy), (nautilus_sidebar_title_new),
(set_widget_color), (nautilus_sidebar_title_theme_changed):
made the sidebar title text color themable.
* icons/arlo/arlo.xml:
made the arlo theme use white text for the sidebar title
2000-07-03 Eskil Heyn Olsen <eskil@eazel.com>
* components/services/install/lib/Makefile.am:
......
<?xml version="1.0"?>
<theme name="arlo">
<directory BACKGROUND_TILE_IMAGE="backgrounds/white_ribs.png"/>
<sidebar SIDEBAR_BACKGROUND_COLOR="rgb:5BBB/9111/9444-rgb:2999/5888/5AAA|80-rgb:0000/3333/0000:h" SIDEBAR_BACKGROUND_TILE_IMAGE="backgrounds/.striated.png" TAB_PIECE_IMAGE="sidebar_tab_pieces.png" COMBINE="TRUE"
<sidebar SIDEBAR_BACKGROUND_COLOR="rgb:6666/9999/9999-rgb:0000/3333/3333|90-rgb:0000/0000/0000:h" SIDEBAR_BACKGROUND_TILE_IMAGE="backgrounds/.striated.png" TAB_PIECE_IMAGE="sidebar_tab_pieces.png" COMBINE="TRUE"
PIECE_OFFSETS="1,1,20,4:1,13,20,13:1,47,20,61:1,123,20,139:1,5,20,8:1,14,20,14:1,62,20,76:1,140,20,156:1,9,20,12:1,15,24,15:1,93,24,107:1,157,20,173"
LEFT_OFFSET="0" />
LEFT_OFFSET="0" LABEL_COLOR="rgb:FFFF/FFFF/FFFF" />
</theme>
......@@ -38,18 +38,21 @@
#include <libnautilus-extensions/nautilus-file-attributes.h>
#include <libnautilus-extensions/nautilus-gdk-extensions.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-global-preferences.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-directory.h>
#include <libnautilus-extensions/nautilus-icon-factory.h>
#include <libnautilus-extensions/nautilus-metadata.h>
#include <libnautilus-extensions/nautilus-font-factory.h>
#include <libnautilus-extensions/nautilus-theme.h>
static void nautilus_sidebar_title_initialize_class (NautilusSidebarTitleClass *klass);
static void nautilus_sidebar_title_destroy (GtkObject *object);
static void nautilus_sidebar_title_initialize (NautilusSidebarTitle *pixmap);
static gboolean nautilus_sidebar_title_button_press_event (GtkWidget *widget,
GdkEventButton *event);
static void nautilus_sidebar_title_theme_changed (gpointer user_data);
static void update_icon (NautilusSidebarTitle *sidebar_title);
struct NautilusSidebarTitleDetails {
......@@ -117,6 +120,10 @@ nautilus_sidebar_title_initialize (NautilusSidebarTitle *sidebar_title)
gdk_font_unref (font);
gtk_widget_show (sidebar_title->details->notes);
gtk_box_pack_start (GTK_BOX (sidebar_title), sidebar_title->details->notes, 0, 0, 0);
/* set up the label colors according to the theme, and get notified of changes */
nautilus_sidebar_title_theme_changed (sidebar_title);
nautilus_preferences_add_callback (NAUTILUS_PREFERENCES_THEME, nautilus_sidebar_title_theme_changed, sidebar_title);
}
/* destroy by throwing away private storage */
......@@ -148,6 +155,8 @@ nautilus_sidebar_title_destroy (GtkObject *object)
g_free (sidebar_title->details->title_text);
g_free (sidebar_title->details);
nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_THEME, nautilus_sidebar_title_theme_changed, sidebar_title);
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
}
......@@ -160,6 +169,48 @@ nautilus_sidebar_title_new (void)
return GTK_WIDGET (gtk_type_new (nautilus_sidebar_title_get_type ()));
}
/* utility to set up the style of a widget to have a particular color */
static void
set_widget_color (GtkWidget *widget, const char* color_spec)
{
GtkStyle *style;
GdkColor color;
style = gtk_widget_get_style (widget);
/* Make a copy of the style. */
style = gtk_style_copy (style);
nautilus_gdk_color_parse_with_white_default (color_spec, &color);
style->fg[GTK_STATE_NORMAL] = color;
style->base[GTK_STATE_NORMAL] = color;
style->fg[GTK_STATE_ACTIVE] = color;
style->base[GTK_STATE_ACTIVE] = color;
/* Put the style in the widget. */
gtk_widget_set_style (widget, style);
gtk_style_unref (style);
}
/* handle theme changes by setting up the color of the labels */
static void
nautilus_sidebar_title_theme_changed (gpointer user_data)
{
char *sidebar_title_color;
NautilusSidebarTitle *sidebar_title;
sidebar_title = NAUTILUS_SIDEBAR_TITLE (user_data);
sidebar_title_color = nautilus_theme_get_theme_data ("sidebar", "LABEL_COLOR");
if (sidebar_title_color == NULL) {
sidebar_title_color = g_strdup("rgb:0000/0000/0000");
}
set_widget_color (sidebar_title->details->title, sidebar_title_color);
set_widget_color (sidebar_title->details->more_info, sidebar_title_color);
g_free (sidebar_title_color);
}
/* set up the icon image */
static void
update_icon (NautilusSidebarTitle *sidebar_title)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment