From 55557b13d2111c5728078e4866da77140ace960b Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 13 Feb 2014 09:09:21 +0100 Subject: Do not use "dialog-apply" icon and make EStockRequest fool-proof The "dialog-apply" icon is not from a set of standard icons, thus it cannot be used, which I overlooked yesterday. With its drop are also dropped other button icons in itip-formatter. The missing icon made EStockRequest "panic" which effectively broke page rendering for WebKit - the rendering was never finished. --- e-util/e-stock-request.c | 49 +++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) (limited to 'e-util') diff --git a/e-util/e-stock-request.c b/e-util/e-stock-request.c index ad911d13ce..5d70fa38e9 100644 --- a/e-util/e-stock-request.c +++ b/e-util/e-stock-request.c @@ -104,35 +104,38 @@ handle_stock_request_idle_cb (gpointer user_data) icon_theme, uri->host, size, GTK_ICON_LOOKUP_USE_BUILTIN); - filename = gtk_icon_info_get_filename (icon_info); - if (filename != NULL) { - if (!g_file_get_contents ( - filename, &buffer, &buff_len, &local_error)) { - buffer = NULL; - buff_len = 0; + /* Some icons can be missing in the theme */ + if (icon_info) { + filename = gtk_icon_info_get_filename (icon_info); + if (filename != NULL) { + if (!g_file_get_contents ( + filename, &buffer, &buff_len, &local_error)) { + buffer = NULL; + buff_len = 0; + } + priv->content_type = + g_content_type_guess (filename, NULL, 0, NULL); + + } else { + GdkPixbuf *pixbuf; + + pixbuf = gtk_icon_info_get_builtin_pixbuf (icon_info); + if (pixbuf != NULL) { + gdk_pixbuf_save_to_buffer ( + pixbuf, &buffer, &buff_len, + "png", &local_error, NULL); + g_object_unref (pixbuf); + } } - priv->content_type = - g_content_type_guess (filename, NULL, 0, NULL); - - } else { - GdkPixbuf *pixbuf; - - pixbuf = gtk_icon_info_get_builtin_pixbuf (icon_info); - if (pixbuf != NULL) { - gdk_pixbuf_save_to_buffer ( - pixbuf, &buffer, &buff_len, - "png", &local_error, NULL); - g_object_unref (pixbuf); - } - } - gtk_icon_info_free (icon_info); + gtk_icon_info_free (icon_info); + } } /* Sanity check */ - g_return_val_if_fail ( + g_warn_if_fail ( ((buffer != NULL) && (local_error == NULL)) || - ((buffer == NULL) && (local_error != NULL)), FALSE); + ((buffer == NULL) && (local_error != NULL))); if (priv->content_type == NULL) priv->content_type = g_strdup ("image/png"); -- cgit v1.2.3