Commit 09564c3a authored by Michaël Meyer's avatar Michaël Meyer Committed by Matthew Brush

Fix color modifications in search entries

The current code has no effect anymore in gtk3. This makes it work again.
Instead of manually changing colors, however, use the "error" CSS class, so
that things work consistently with the chosen gtk theme.

Closes #36
parent f590e923
Pipeline #945 failed with stages
in 1 minute and 11 seconds
......@@ -382,8 +382,6 @@ void
mousepad_util_entry_error (GtkWidget *widget,
gboolean error)
{
const GdkColor red = {0, 0xffff, 0x6666, 0x6666};
const GdkColor white = {0, 0xffff, 0xffff, 0xffff};
gpointer pointer;
g_return_if_fail (GTK_IS_WIDGET (widget));
......@@ -395,8 +393,11 @@ mousepad_util_entry_error (GtkWidget *widget,
if (GPOINTER_TO_INT (pointer) != error)
{
/* set the widget style */
gtk_widget_modify_base (widget, GTK_STATE_NORMAL, error ? &red : NULL);
gtk_widget_modify_text (widget, GTK_STATE_NORMAL, error ? &white : NULL);
/* see http://gtk.10911.n7.nabble.com/set-custom-entry-background-td88472.html#a88489 */
if (error)
gtk_style_context_add_class (gtk_widget_get_style_context (widget), GTK_STYLE_CLASS_ERROR);
else
gtk_style_context_remove_class (gtk_widget_get_style_context (widget), GTK_STYLE_CLASS_ERROR);
/* set the new state */
mousepad_object_set_data (G_OBJECT (widget), "error-state", GINT_TO_POINTER (error));
......
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