From e819784e1a9f2d997f5908af4c1c17962f96fc7c Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Fri, 29 Dec 2017 16:18:34 +0100 Subject: Removed remaining compilation warnings for GTK deprecated functions when defining regular expressions. --- ChangeLog | 9 +++++++++ src/gtkext/gtkdockable.c | 17 +++++++---------- src/gtkext/tmgt.c | 13 +++++-------- themes/Adwaita/display.css | 6 ++++++ 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6f7643b..e0437a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 17-12-29 Cyrille Bagard + * src/gtkext/gtkdockable.c: + * src/gtkext/tmgt.c: + Remove remaining compilation warnings for GTK deprecated functions when defining regular expressions. + + * themes/Adwaita/display.css: + Define a class for filter error. + +17-12-29 Cyrille Bagard + * src/glibext/gbufferview.c: * src/glibext/gbufferview.h: Update code. diff --git a/src/gtkext/gtkdockable.c b/src/gtkext/gtkdockable.c index 2280029..115549e 100644 --- a/src/gtkext/gtkdockable.c +++ b/src/gtkext/gtkdockable.c @@ -409,14 +409,16 @@ static void on_dockable_search_changed(GtkSearchEntry *entry, GtkDockable *docka { regex_t *filter; /* Expression régulière */ const gchar *text; /* Texte de l'utilisateur */ + GtkStyleContext *context; /* Contexte du thème actuel */ int ret; /* Bilan de mise en place */ - GdkRGBA error; /* Couleur d'erreur */ GtkDockableIface *iface; /* Interface utilisée */ filter = g_object_get_data(G_OBJECT(entry), "preg_filter"); text = gtk_entry_get_text(GTK_ENTRY(entry)); + context = gtk_widget_get_style_context(GTK_WIDGET(entry)); + /* Mise en place d'une nouvelle règle */ if (strlen(text) > 0) { @@ -439,14 +441,8 @@ static void on_dockable_search_changed(GtkSearchEntry *entry, GtkDockable *docka if (ret != 0) { - error.red = 1.0; - error.green = 0.0; - error.blue = 0.0; - error.alpha = 1.0; - gtk_widget_override_color(GTK_WIDGET(entry), GTK_STATE_NORMAL, &error); - + gtk_style_context_add_class(context, "filter-error"); return; - } } @@ -460,7 +456,7 @@ static void on_dockable_search_changed(GtkSearchEntry *entry, GtkDockable *docka /* Mises à jour */ - gtk_widget_override_color(GTK_WIDGET(entry), GTK_STATE_NORMAL, NULL); + gtk_style_context_remove_class(context, "filter-error"); iface = GTK_DOCKABLE_GET_IFACE(dockable); @@ -722,7 +718,8 @@ static void update_drag_window_background(GtkWidget *dnd_window, gint width, gin cairo_surface_destroy(surface); - gdk_window_set_background_pattern(window, pattern); + // Deprecated + // gdk_window_set_background_pattern(window, pattern); cairo_pattern_destroy(pattern); } diff --git a/src/gtkext/tmgt.c b/src/gtkext/tmgt.c index ce6f9a8..fa1e2b8 100644 --- a/src/gtkext/tmgt.c +++ b/src/gtkext/tmgt.c @@ -48,8 +48,8 @@ void update_regex_on_search_entry_changed(GtkSearchEntry *entry, regex_t **filter) { const gchar *text; /* Texte de l'utilisateur */ + GtkStyleContext *context; /* Contexte du thème actuel */ int ret; /* Bilan de mise en place */ - GdkRGBA error; /* Couleur d'erreur */ if (*filter != NULL) { @@ -60,6 +60,8 @@ void update_regex_on_search_entry_changed(GtkSearchEntry *entry, regex_t **filte text = gtk_entry_get_text(GTK_ENTRY(entry)); + context = gtk_widget_get_style_context(GTK_WIDGET(entry)); + if (strlen(text) > 0) { *filter = (regex_t *)calloc(1, sizeof(regex_t)); @@ -70,19 +72,14 @@ void update_regex_on_search_entry_changed(GtkSearchEntry *entry, regex_t **filte free(*filter); *filter = NULL; - error.red = 1.0; - error.green = 0.0; - error.blue = 0.0; - error.alpha = 1.0; - gtk_widget_override_color(GTK_WIDGET(entry), GTK_STATE_NORMAL, &error); - + gtk_style_context_add_class(context, "filter-error"); return; } } - gtk_widget_override_color(GTK_WIDGET(entry), GTK_STATE_NORMAL, NULL); + gtk_style_context_remove_class(context, "filter-error"); } diff --git a/themes/Adwaita/display.css b/themes/Adwaita/display.css index 2368b64..f5bd72c 100644 --- a/themes/Adwaita/display.css +++ b/themes/Adwaita/display.css @@ -196,3 +196,9 @@ font-weight: bold; } + +.filter-error { + + color: #f00 + +} -- cgit v0.11.2-87-g4458