[gnome-software] trivial: Fix warning when calling gs_utils_widget_set_css_simple(NULL)
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] trivial: Fix warning when calling gs_utils_widget_set_css_simple(NULL)
- Date: Sat, 6 Aug 2016 20:07:48 +0000 (UTC)
commit e2af78378bfe72b60ba6a0afc72c510f5a6ab93c
Author: Richard Hughes <richard hughsie com>
Date: Fri Aug 5 13:03:18 2016 +0100
trivial: Fix warning when calling gs_utils_widget_set_css_simple(NULL)
src/gs-common.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-common.c b/src/gs-common.c
index 5fb5371..cd41c86 100644
--- a/src/gs-common.c
+++ b/src/gs-common.c
@@ -658,9 +658,16 @@ void
gs_utils_widget_set_css_simple (GtkWidget *widget, const gchar *css)
{
g_autofree gchar *class_name = NULL;
- g_autoptr(GString) str = g_string_sized_new (1024);
+ g_autoptr(GString) str = NULL;
+ /* remove custom class if NULL */
class_name = g_strdup_printf ("themed-widget_%p", widget);
+ if (css == NULL) {
+ GtkStyleContext *context = gtk_widget_get_style_context (widget);
+ gtk_style_context_remove_class (context, class_name);
+ return;
+ }
+ str = g_string_sized_new (1024);
g_string_append_printf (str, ".%s {\n", class_name);
g_string_append_printf (str, "%s\n", css);
g_string_append (str, "}");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]