From 8d4ec01c81c7f4ccad89ed53d2f34acabec4f595 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Fri, 29 Dec 2017 17:37:40 +0100 Subject: Killed the last uses of the deprecated gtk_widget_override_color() function. --- ChangeLog | 6 ++++++ plugins/ropgadgets/select.c | 14 +++++--------- src/gui/panels/regedit.c | 13 +++++-------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index e0437a5..fd451b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 17-12-29 Cyrille Bagard + * plugins/ropgadgets/select.c: + * src/gui/panels/regedit.c: + Kill the last uses of the deprecated gtk_widget_override_color() function. + +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. diff --git a/plugins/ropgadgets/select.c b/plugins/ropgadgets/select.c index 92456e7..2294a9c 100644 --- a/plugins/ropgadgets/select.c +++ b/plugins/ropgadgets/select.c @@ -1605,34 +1605,30 @@ static void on_rop_gadgets_filter_changed(GtkSearchEntry *entry, GObject *ref) { regex_t preg; /* Expression régulière de test*/ 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 */ GtkTreeView *treeview; /* Arborescence à actualiser */ GtkTreeModelFilter *filter; /* Modèle de gestion associé */ text = gtk_entry_get_text(GTK_ENTRY(entry)); + context = gtk_widget_get_style_context(GTK_WIDGET(entry)); + if (text[0] != '\0') { ret = regcomp(&preg, text, REG_EXTENDED); 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; - } regfree(&preg); } - gtk_widget_override_color(GTK_WIDGET(entry), GTK_STATE_NORMAL, NULL); + gtk_style_context_remove_class(context, "filter-error"); treeview = GTK_TREE_VIEW(g_object_get_data(ref, "treeview")); diff --git a/src/gui/panels/regedit.c b/src/gui/panels/regedit.c index 0975c9e..bc19009 100644 --- a/src/gui/panels/regedit.c +++ b/src/gui/panels/regedit.c @@ -817,8 +817,8 @@ static void on_param_value_edited(GtkCellRendererText *renderer, gchar *path, gc static void on_param_search_changed(GtkSearchEntry *entry, GRegeditPanel *panel) { 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 (panel->filter != NULL) { @@ -829,6 +829,8 @@ static void on_param_search_changed(GtkSearchEntry *entry, GRegeditPanel *panel) text = gtk_entry_get_text(GTK_ENTRY(entry)); + context = gtk_widget_get_style_context(GTK_WIDGET(entry)); + if (strlen(text) > 0) { panel->filter = (regex_t *)calloc(1, sizeof(regex_t)); @@ -839,19 +841,14 @@ static void on_param_search_changed(GtkSearchEntry *entry, GRegeditPanel *panel) free(panel->filter); panel->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"); reload_config_into_treeview(panel, get_main_configuration()); -- cgit v0.11.2-87-g4458