Add tooltip foreground and background colours to the list of recognised

2007-07-30  Thomas Wood  <thos@gnome.org>

	* appearance-style.c: (update_color_buttons_from_string),
	(check_color_schemes_enabled), (color_button_clicked_cb),
	(style_init):
	* data/appearance.glade:

	Add tooltip foreground and background colours to the list of recognised
	symbolic colours.

2007-07-30  Thomas Wood  <thos@gnome.org>

	* gnome-theme-info.c: (gnome_theme_color_scheme_parse): Add tooltip foreground
	and background colours to the list of recognised symbolic colours.

svn path=/trunk/; revision=7933
This commit is contained in:
Thomas Wood 2007-07-30 16:49:28 +00:00 committed by Thomas Wood
parent 383545e688
commit 12faf7f40e
5 changed files with 792 additions and 869 deletions

View file

@ -1,3 +1,14 @@
2007-07-30 Thomas Wood <thos@gnome.org>
* appearance-style.c: (update_color_buttons_from_string),
(check_color_schemes_enabled), (color_button_clicked_cb),
(style_init):
* data/appearance.glade:
Add tooltip foreground and background colours to the list of recognised
symbolic colours.
2007-07-29 Jens Granseuer <jensgr@gmx.net> 2007-07-29 Jens Granseuer <jensgr@gmx.net>
* appearance-main.c: (main): default to showing the background tab * appearance-main.c: (main): default to showing the background tab

View file

@ -161,7 +161,7 @@ cursor_theme_sort_func (GtkTreeModel *model,
static void static void
update_color_buttons_from_string (const gchar *color_scheme, AppearanceData *data) update_color_buttons_from_string (const gchar *color_scheme, AppearanceData *data)
{ {
GdkColor color_scheme_colors[6]; GdkColor color_scheme_colors[8];
GtkWidget *widget; GtkWidget *widget;
if (!gnome_theme_color_scheme_parse (color_scheme, color_scheme_colors)) if (!gnome_theme_color_scheme_parse (color_scheme, color_scheme_colors))
@ -180,6 +180,10 @@ update_color_buttons_from_string (const gchar *color_scheme, AppearanceData *dat
gtk_color_button_set_color (GTK_COLOR_BUTTON (widget), &color_scheme_colors[4]); gtk_color_button_set_color (GTK_COLOR_BUTTON (widget), &color_scheme_colors[4]);
widget = glade_xml_get_widget (data->xml, "selected_bg_colorbutton"); widget = glade_xml_get_widget (data->xml, "selected_bg_colorbutton");
gtk_color_button_set_color (GTK_COLOR_BUTTON (widget), &color_scheme_colors[5]); gtk_color_button_set_color (GTK_COLOR_BUTTON (widget), &color_scheme_colors[5]);
widget = glade_xml_get_widget (data->xml, "tooltip_fg_colorbutton");
gtk_color_button_set_color (GTK_COLOR_BUTTON (widget), &color_scheme_colors[6]);
widget = glade_xml_get_widget (data->xml, "tooltip_bg_colorbutton");
gtk_color_button_set_color (GTK_COLOR_BUTTON (widget), &color_scheme_colors[7]);
} }
static void static void
@ -247,8 +251,8 @@ static void
color_button_clicked_cb (GtkWidget *colorbutton, AppearanceData *data) color_button_clicked_cb (GtkWidget *colorbutton, AppearanceData *data)
{ {
gchar *new_scheme; gchar *new_scheme;
GdkColor colors[6]; GdkColor colors[7];
gchar *bg, *fg, *text, *base, *selected_fg, *selected_bg; gchar *bg, *fg, *text, *base, *selected_fg, *selected_bg, *tooltip_fg, *tooltip_bg;
GtkWidget *widget; GtkWidget *widget;
widget = glade_xml_get_widget (data->xml, "fg_colorbutton"); widget = glade_xml_get_widget (data->xml, "fg_colorbutton");
@ -263,6 +267,10 @@ color_button_clicked_cb (GtkWidget *colorbutton, AppearanceData *data)
gtk_color_button_get_color (GTK_COLOR_BUTTON (widget), &colors[4]); gtk_color_button_get_color (GTK_COLOR_BUTTON (widget), &colors[4]);
widget = glade_xml_get_widget (data->xml, "selected_bg_colorbutton"); widget = glade_xml_get_widget (data->xml, "selected_bg_colorbutton");
gtk_color_button_get_color (GTK_COLOR_BUTTON (widget), &colors[5]); gtk_color_button_get_color (GTK_COLOR_BUTTON (widget), &colors[5]);
widget = glade_xml_get_widget (data->xml, "tooltip_fg_colorbutton");
gtk_color_button_get_color (GTK_COLOR_BUTTON (widget), &colors[5]);
widget = glade_xml_get_widget (data->xml, "tooltip_fg_colorbutton");
gtk_color_button_get_color (GTK_COLOR_BUTTON (widget), &colors[5]);
fg = g_strdup_printf ("fg_color:#%04x%04x%04x\n", colors[0].red, colors[0].green, colors[0].blue); fg = g_strdup_printf ("fg_color:#%04x%04x%04x\n", colors[0].red, colors[0].green, colors[0].blue);
bg = g_strdup_printf ("bg_color:#%04x%04x%04x\n", colors[1].red, colors[1].green, colors[1].blue); bg = g_strdup_printf ("bg_color:#%04x%04x%04x\n", colors[1].red, colors[1].green, colors[1].blue);
@ -270,8 +278,10 @@ color_button_clicked_cb (GtkWidget *colorbutton, AppearanceData *data)
base = g_strdup_printf ("base_color:#%04x%04x%04x\n", colors[3].red, colors[3].green, colors[3].blue); base = g_strdup_printf ("base_color:#%04x%04x%04x\n", colors[3].red, colors[3].green, colors[3].blue);
selected_fg = g_strdup_printf ("selected_fg_color:#%04x%04x%04x\n", colors[4].red, colors[4].green, colors[4].blue); selected_fg = g_strdup_printf ("selected_fg_color:#%04x%04x%04x\n", colors[4].red, colors[4].green, colors[4].blue);
selected_bg = g_strdup_printf ("selected_bg_color:#%04x%04x%04x", colors[5].red, colors[5].green, colors[5].blue); selected_bg = g_strdup_printf ("selected_bg_color:#%04x%04x%04x", colors[5].red, colors[5].green, colors[5].blue);
tooltip_fg = g_strdup_printf ("tooltip_fg_color:#%04x%04x%04x\n", colors[6].red, colors[6].green, colors[6].blue);
tooltip_bg = g_strdup_printf ("tooltip_bg_color:#%04x%04x%04x", colors[7].red, colors[7].green, colors[7].blue);
new_scheme = g_strconcat (fg, bg, text, base, selected_fg, selected_bg, NULL); new_scheme = g_strconcat (fg, bg, text, base, selected_fg, selected_bg, tooltip_fg, tooltip_bg, NULL);
/* Currently we assume this has only been called when one of the colours has /* Currently we assume this has only been called when one of the colours has
* actually changed, so we don't check the original key first */ * actually changed, so we don't check the original key first */
@ -285,6 +295,8 @@ color_button_clicked_cb (GtkWidget *colorbutton, AppearanceData *data)
g_free (base); g_free (base);
g_free (selected_fg); g_free (selected_fg);
g_free (selected_bg); g_free (selected_bg);
g_free (tooltip_fg);
g_free (tooltip_bg);
g_free (new_scheme); g_free (new_scheme);
} }
@ -920,6 +932,8 @@ style_init (AppearanceData *data)
g_signal_connect (G_OBJECT (glade_xml_get_widget (data->xml, "base_colorbutton")), "color-set", (GCallback) color_button_clicked_cb, data); g_signal_connect (G_OBJECT (glade_xml_get_widget (data->xml, "base_colorbutton")), "color-set", (GCallback) color_button_clicked_cb, data);
g_signal_connect (G_OBJECT (glade_xml_get_widget (data->xml, "selected_fg_colorbutton")), "color-set", (GCallback) color_button_clicked_cb, data); g_signal_connect (G_OBJECT (glade_xml_get_widget (data->xml, "selected_fg_colorbutton")), "color-set", (GCallback) color_button_clicked_cb, data);
g_signal_connect (G_OBJECT (glade_xml_get_widget (data->xml, "selected_bg_colorbutton")), "color-set", (GCallback) color_button_clicked_cb, data); g_signal_connect (G_OBJECT (glade_xml_get_widget (data->xml, "selected_bg_colorbutton")), "color-set", (GCallback) color_button_clicked_cb, data);
g_signal_connect (G_OBJECT (glade_xml_get_widget (data->xml, "tooltip_fg_colorbutton")), "color-set", (GCallback) color_button_clicked_cb, data);
g_signal_connect (G_OBJECT (glade_xml_get_widget (data->xml, "tooltip_bg_colorbutton")), "color-set", (GCallback) color_button_clicked_cb, data);
/* revert button */ /* revert button */
g_signal_connect (G_OBJECT (glade_xml_get_widget (data->xml, "color_scheme_defaults_button")), "clicked", (GCallback) color_scheme_defaults_button_clicked_cb, data); g_signal_connect (G_OBJECT (glade_xml_get_widget (data->xml, "color_scheme_defaults_button")), "clicked", (GCallback) color_scheme_defaults_button_clicked_cb, data);
/* delete buttons */ /* delete buttons */

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,8 @@
2007-07-30 Thomas Wood <thos@gnome.org>
* gnome-theme-info.c: (gnome_theme_color_scheme_parse): Add tooltip foreground
and background colours to the list of recognised symbolic colours.
2007-07-29 Thomas Wood <thos@gnome.org> 2007-07-29 Thomas Wood <thos@gnome.org>
* gnome-theme-info.c: (gnome_theme_read_meta_theme): Expand check for empty * gnome-theme-info.c: (gnome_theme_read_meta_theme): Expand check for empty

View file

@ -1857,6 +1857,12 @@ gnome_theme_color_scheme_parse (const gchar *scheme, GdkColor *colors)
color_scheme_strings = g_strsplit (scheme, "\n", 0); color_scheme_strings = g_strsplit (scheme, "\n", 0);
/* initialise the array */
for (i = 0; i < 8; i++)
{
gdk_color_parse ("#000", &colors[i]);
}
/* loop through the name:color pairs, and save the color if we recognise the name */ /* loop through the name:color pairs, and save the color if we recognise the name */
i = 0; i = 0;
while ((current_string = color_scheme_strings[i++])) { while ((current_string = color_scheme_strings[i++])) {
@ -1878,6 +1884,10 @@ gnome_theme_color_scheme_parse (const gchar *scheme, GdkColor *colors)
gdk_color_parse (color_scheme_pair[1], &colors[4]); gdk_color_parse (color_scheme_pair[1], &colors[4]);
else if (!strcmp ("selected_bg_color", color_scheme_pair[0])) else if (!strcmp ("selected_bg_color", color_scheme_pair[0]))
gdk_color_parse (color_scheme_pair[1], &colors[5]); gdk_color_parse (color_scheme_pair[1], &colors[5]);
else if (!strcmp ("tooltip_fg_color", color_scheme_pair[0]))
gdk_color_parse (color_scheme_pair[1], &colors[6]);
else if (!strcmp ("tooltip_bg_color", color_scheme_pair[0]))
gdk_color_parse (color_scheme_pair[1], &colors[7]);
} }
g_strfreev (color_scheme_pair); g_strfreev (color_scheme_pair);
@ -1891,14 +1901,14 @@ gnome_theme_color_scheme_parse (const gchar *scheme, GdkColor *colors)
gboolean gboolean
gnome_theme_color_scheme_equal (const gchar *s1, const gchar *s2) gnome_theme_color_scheme_equal (const gchar *s1, const gchar *s2)
{ {
GdkColor c1[6], c2[6]; GdkColor c1[8], c2[8];
int i; int i;
if (!gnome_theme_color_scheme_parse (s1, c1) || if (!gnome_theme_color_scheme_parse (s1, c1) ||
!gnome_theme_color_scheme_parse (s2, c2)) !gnome_theme_color_scheme_parse (s2, c2))
return FALSE; return FALSE;
for (i = 0; i < 6; ++i) { for (i = 0; i < 8; ++i) {
if (!gdk_color_equal (&c1[i], &c2[i])) if (!gdk_color_equal (&c1[i], &c2[i]))
return FALSE; return FALSE;
} }