From 57cbeb4dd151c10b4c0156035120f673a4424017 Mon Sep 17 00:00:00 2001 From: Shaun McCance Date: Fri, 30 Jul 2021 18:11:46 -0400 Subject: Stop using all those colors in error pages --- libyelp/yelp-view.c | 68 +++++++++++++++-------------------------------------- 1 file changed, 19 insertions(+), 49 deletions(-) diff --git a/libyelp/yelp-view.c b/libyelp/yelp-view.c index 9b2e5fb2..d4810fa5 100644 --- a/libyelp/yelp-view.c +++ b/libyelp/yelp-view.c @@ -1942,42 +1942,13 @@ view_load_page (YelpView *view) #define FORMAT_ERRORPAGE \ "" \ "" \ - "" \ - "
" \ - "%s
%s%s
" \ - "
" \ - "" + " body { color: %s; background-color: %s; } " \ + " div.title { font-size: 2em; margin: 1rem 0 0 0; } " \ + " p { margin: 1em 0 0 0; } " \ + " .container { max-width: 800px; margin: 0 auto; text-align: center; } " \ + "" \ + "
" \ + "
%s%s%s
" static void view_show_error_page (YelpView *view, @@ -1985,12 +1956,12 @@ view_show_error_page (YelpView *view, { YelpViewPrivate *priv = yelp_view_get_instance_private (view); YelpSettings *settings = yelp_settings_get_default (); + GtkIconTheme *icontheme; + GtkIconInfo *icon; gchar *page, *title = NULL, *title_m, *content_beg, *content_end; - gchar *textcolor, *bgcolor, *noteborder, *notebg, *titlecolor, *noteicon, *linkcolor; - gint iconsize; + gchar *textcolor, *bgcolor; GParamSpec *spec; gboolean doc404 = FALSE; - const gchar *left = (gtk_widget_get_direction ((GtkWidget *) view) == GTK_TEXT_DIR_RTL) ? "right" : "left"; if (priv->uri && yelp_uri_get_document_type (priv->uri) == YELP_URI_DOCUMENT_TYPE_NOT_FOUND) doc404 = TRUE; @@ -2035,18 +2006,17 @@ view_show_error_page (YelpView *view, textcolor = yelp_settings_get_color (settings, YELP_SETTINGS_COLOR_TEXT); bgcolor = yelp_settings_get_color (settings, YELP_SETTINGS_COLOR_BASE); - noteborder = yelp_settings_get_color (settings, YELP_SETTINGS_COLOR_RED_BORDER); - notebg = yelp_settings_get_color (settings, YELP_SETTINGS_COLOR_YELLOW_BASE); - titlecolor = yelp_settings_get_color (settings, YELP_SETTINGS_COLOR_TEXT_LIGHT); - linkcolor = yelp_settings_get_color (settings, YELP_SETTINGS_COLOR_LINK); - noteicon = yelp_settings_get_icon (settings, YELP_SETTINGS_ICON_WARNING); - iconsize = yelp_settings_get_icon_size (settings) + 6; - + g_object_get (settings, "gtk-icon-theme", &icontheme, NULL); + icon = gtk_icon_theme_lookup_icon (icontheme, "computer-fail-symbolic", 256, 0); page = g_strdup_printf (FORMAT_ERRORPAGE, - textcolor, bgcolor, noteborder, notebg, noteicon, - left, iconsize, left, iconsize, left, iconsize, - titlecolor, linkcolor, title_m, content_beg, + textcolor, bgcolor, + gtk_icon_info_get_filename (icon), + title_m, + content_beg, (content_end != NULL) ? content_end : ""); + g_object_unref (icon); + g_free (textcolor); + g_free (bgcolor); g_object_set (view, "state", YELP_VIEW_STATE_ERROR, NULL); -- cgit v1.2.1