diff options
author | Milan Crha <mcrha@redhat.com> | 2014-02-13 16:09:21 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2014-02-13 16:09:21 +0800 |
commit | 55557b13d2111c5728078e4866da77140ace960b (patch) | |
tree | 0fd957e6c2cd07893e321ec7c7b4350830715d2b /e-util/e-stock-request.c | |
parent | b48e21d9aa7eb16e559739b71b9d08f90dfa92be (diff) | |
download | gsoc2013-evolution-55557b13d2111c5728078e4866da77140ace960b.tar gsoc2013-evolution-55557b13d2111c5728078e4866da77140ace960b.tar.gz gsoc2013-evolution-55557b13d2111c5728078e4866da77140ace960b.tar.bz2 gsoc2013-evolution-55557b13d2111c5728078e4866da77140ace960b.tar.lz gsoc2013-evolution-55557b13d2111c5728078e4866da77140ace960b.tar.xz gsoc2013-evolution-55557b13d2111c5728078e4866da77140ace960b.tar.zst gsoc2013-evolution-55557b13d2111c5728078e4866da77140ace960b.zip |
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.
Diffstat (limited to 'e-util/e-stock-request.c')
-rw-r--r-- | e-util/e-stock-request.c | 49 |
1 files changed, 26 insertions, 23 deletions
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"); |