[evolution] Do not use "dialog-apply" icon and make EStockRequest fool-proof



commit 55557b13d2111c5728078e4866da77140ace960b
Author: Milan Crha <mcrha redhat com>
Date:   Thu Feb 13 09:09:21 2014 +0100

    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 ++++++++++++++------------
 modules/itip-formatter/itip-view.c          |   41 ++++++++++++++---------
 plugins/publish-calendar/publish-calendar.c |    2 -
 3 files changed, 51 insertions(+), 41 deletions(-)
---
diff --git a/e-util/e-stock-request.c b/e-util/e-stock-request.c
index ad911d1..5d70fa3 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");
diff --git a/modules/itip-formatter/itip-view.c b/modules/itip-formatter/itip-view.c
index b33d85b..8ef8f81 100644
--- a/modules/itip-formatter/itip-view.c
+++ b/modules/itip-formatter/itip-view.c
@@ -992,13 +992,22 @@ buttons_table_write_button (GString *buffer,
 
        html_label = e_mail_formatter_parse_html_mnemonics (label, &access_key);
 
-       g_string_append_printf (
-               buffer,
-               "<td><button type=\"button\" name=\"%s\" value=\"%d\" id=\"%s\" accesskey=\"%s\" hidden 
disabled>"
-               "<div><img src=\"gtk-stock://%s?size=%d\"> <span>%s</span></div>"
-               "</button></td>\n",
-               name, response, name, access_key ? access_key : "" , icon,
-               GTK_ICON_SIZE_BUTTON, html_label);
+       if (icon) {
+               g_string_append_printf (
+                       buffer,
+                       "<td><button type=\"button\" name=\"%s\" value=\"%d\" id=\"%s\" accesskey=\"%s\" 
hidden disabled>"
+                       "<div><img src=\"gtk-stock://%s?size=%d\"> <span>%s</span></div>"
+                       "</button></td>\n",
+                       name, response, name, access_key ? access_key : "" , icon,
+                       GTK_ICON_SIZE_BUTTON, html_label);
+       } else {
+               g_string_append_printf (
+                       buffer,
+                       "<td><button type=\"button\" name=\"%s\" value=\"%d\" id=\"%s\" accesskey=\"%s\" 
hidden disabled>"
+                       "<div><span>%s</span></div>"
+                       "</button></td>\n",
+                       name, response, name, access_key ? access_key : "" , html_label);
+       }
 
        g_free (html_label);
 
@@ -1022,31 +1031,31 @@ append_buttons_table (GString *buffer)
                "go-jump", ITIP_VIEW_RESPONSE_OPEN);
        buttons_table_write_button (
                buffer, BUTTON_DECLINE_ALL, _("_Decline all"),
-               "process-stop", ITIP_VIEW_RESPONSE_DECLINE);
+               NULL, ITIP_VIEW_RESPONSE_DECLINE);
        buttons_table_write_button (
                buffer, BUTTON_DECLINE, _("_Decline"),
-               "process-stop", ITIP_VIEW_RESPONSE_DECLINE);
+               NULL, ITIP_VIEW_RESPONSE_DECLINE);
        buttons_table_write_button (
                buffer, BUTTON_TENTATIVE_ALL, _("_Tentative all"),
-               "dialog-question", ITIP_VIEW_RESPONSE_TENTATIVE);
+               NULL, ITIP_VIEW_RESPONSE_TENTATIVE);
        buttons_table_write_button (
                buffer, BUTTON_TENTATIVE, _("_Tentative"),
-               "dialog-question", ITIP_VIEW_RESPONSE_TENTATIVE);
+               NULL, ITIP_VIEW_RESPONSE_TENTATIVE);
        buttons_table_write_button (
                buffer, BUTTON_ACCEPT_ALL, _("Acce_pt all"),
-               "dialog-apply", ITIP_VIEW_RESPONSE_ACCEPT);
+               NULL, ITIP_VIEW_RESPONSE_ACCEPT);
        buttons_table_write_button (
                buffer, BUTTON_ACCEPT, _("Acce_pt"),
-               "dialog-apply", ITIP_VIEW_RESPONSE_ACCEPT);
+               NULL, ITIP_VIEW_RESPONSE_ACCEPT);
        buttons_table_write_button (
                buffer, BUTTON_SEND_INFORMATION, _("Send _Information"),
-               "view-refresh", ITIP_VIEW_RESPONSE_REFRESH);
+               NULL, ITIP_VIEW_RESPONSE_REFRESH);
        buttons_table_write_button (
                buffer, BUTTON_UPDATE_ATTENDEE_STATUS, _("_Update Attendee Status"),
-               "view-refresh", ITIP_VIEW_RESPONSE_UPDATE);
+               NULL, ITIP_VIEW_RESPONSE_UPDATE);
        buttons_table_write_button (
                buffer, BUTTON_UPDATE,  _("_Update"),
-               "view-refresh", ITIP_VIEW_RESPONSE_CANCEL);
+               NULL, ITIP_VIEW_RESPONSE_CANCEL);
 
        g_string_append (buffer, "</tr></table>");
 }
diff --git a/plugins/publish-calendar/publish-calendar.c b/plugins/publish-calendar/publish-calendar.c
index 455c34a..fcaa509 100644
--- a/plugins/publish-calendar/publish-calendar.c
+++ b/plugins/publish-calendar/publish-calendar.c
@@ -932,8 +932,6 @@ publish_calendar_locations (EPlugin *epl,
        gtk_widget_set_sensitive (GTK_WIDGET (ui->url_edit), FALSE);
        gtk_widget_set_sensitive (GTK_WIDGET (ui->url_remove), FALSE);
        gtk_widget_set_sensitive (GTK_WIDGET (ui->url_enable), FALSE);
-
-       gtk_button_set_image (GTK_BUTTON (ui->url_enable), gtk_image_new_from_icon_name ("dialog-apply", 
GTK_ICON_SIZE_BUTTON));
        gtk_button_set_use_underline (GTK_BUTTON (ui->url_enable), TRUE);
 
        l = publish_uris;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]