[evolution] Bug 776969 - Huge icons in meeting invites when using SVG icon theme



commit 25d8b4ef92d8b4edb774b48eba1b29c6a63cd910
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jan 9 15:25:46 2017 +0100

    Bug 776969 - Huge icons in meeting invites when using SVG icon theme

 .../gui/widgets/eab-contact-formatter.c            |   10 ++++----
 src/e-util/e-web-view.c                            |   10 ++++++++-
 src/em-format/e-mail-formatter-error.c             |   10 +++++++-
 src/em-format/e-mail-formatter-headers.c           |    4 +-
 src/modules/itip-formatter/itip-view.c             |   22 ++++++++++++++++---
 5 files changed, 42 insertions(+), 14 deletions(-)
---
diff --git a/src/addressbook/gui/widgets/eab-contact-formatter.c 
b/src/addressbook/gui/widgets/eab-contact-formatter.c
index aa8188a..e7ae78c 100644
--- a/src/addressbook/gui/widgets/eab-contact-formatter.c
+++ b/src/addressbook/gui/widgets/eab-contact-formatter.c
@@ -264,7 +264,7 @@ render_table_row (GString *buffer,
                value = (gchar *) str;
 
        if (icon && icon_available (icon)) {
-               icon_html = g_strdup_printf ("<img src=\"gtk-stock://%s\" width=\"16\" height=\"16\" />", 
icon);
+               icon_html = g_strdup_printf ("<img src=\"gtk-stock://%s\" width=\"16px\" height=\"16px\" />", 
icon);
        } else {
                icon_html = "";
        }
@@ -562,7 +562,7 @@ render_title_block (EABContactFormatter *formatter,
                e_contact_photo_free (photo);
 
        if (e_contact_get (contact, E_CONTACT_IS_LIST)) {
-               g_string_append_printf (buffer, "<img src=\"gtk-stock://%s\">", CONTACT_LIST_ICON);
+               g_string_append_printf (buffer, "<img src=\"gtk-stock://%s\" width=\"16px\" 
height=\"16px\">", CONTACT_LIST_ICON);
        }
 
        g_string_append_printf (
@@ -611,7 +611,7 @@ render_contact_list_row (EABContactFormatter *formatter,
                g_string_append_printf (
                        buffer,
                        "<td width=" IMAGE_COL_WIDTH " valign=\"top\" align=\"left\">"
-                       "<img src=\"evo-file://%s/minus.png\" "
+                       "<img src=\"evo-file://%s/minus.png\" width=\"16px\" height=\"16px\" "
                        "id=\"%s\" "
                        "class=\"navigable _evo_collapse_button\">"
                        "</td><td width=\"100%%\" align=\"left\">%s",
@@ -1075,7 +1075,7 @@ render_compact (EABContactFormatter *formatter,
                        #endif
                        g_string_append_printf (
                                buffer,
-                               "<img id=\"__evo-contact-photo\" width=\"%d\" height=\"%d\" src=\"%s%s\">",
+                               "<img id=\"__evo-contact-photo\" width=\"%dpx\" height=\"%dpx\" 
src=\"%s%s\">",
                                calced_width, calced_height,
                                is_local ? "evo-" : "", uri);
                        #if !(WEBKIT_MAJOR_VERSION == 2 && WEBKIT_MINOR_VERSION == 2)
@@ -1090,7 +1090,7 @@ render_compact (EABContactFormatter *formatter,
                        g_string_append_printf (
                                buffer,
                                "<img id=\"__evo-contact-photo\" border=\"1\" src=\"data:%s;base64,%s\" "
-                                       "width=\"%d\" height=\"%d\">",
+                                       "width=\"%dpx\" height=\"%dpx\">",
                                photo->data.inlined.mime_type,
                                photo_data,
                                calced_width, calced_height);
diff --git a/src/e-util/e-web-view.c b/src/e-util/e-web-view.c
index a6ef841..1601533 100644
--- a/src/e-util/e-web-view.c
+++ b/src/e-util/e-web-view.c
@@ -1813,6 +1813,7 @@ web_view_submit_alert (EAlertSink *alert_sink,
        const gchar *icon_name = NULL;
        const gchar *primary_text;
        const gchar *secondary_text;
+       gint icon_width, icon_height;
        gpointer parent;
 
        web_view = E_WEB_VIEW (alert_sink);
@@ -1849,6 +1850,11 @@ web_view_submit_alert (EAlertSink *alert_sink,
        if (secondary_text == NULL)
                secondary_text = "";
 
+       if (!gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, &icon_width, &icon_height)) {
+               icon_width = 48;
+               icon_height = 48;
+       }
+
        buffer = g_string_sized_new (512);
 
        g_string_append (
@@ -1873,7 +1879,7 @@ web_view_submit_alert (EAlertSink *alert_sink,
                buffer,
                "<tr>"
                "<td valign='top'>"
-               "<img src='gtk-stock://%s/?size=%d'/>"
+               "<img src='gtk-stock://%s/?size=%d' width=\"%dpx\" height=\"%dpx\"/>"
                "</td>"
                "<td align='left' width='100%%'>"
                "<h3>%s</h3>"
@@ -1882,6 +1888,8 @@ web_view_submit_alert (EAlertSink *alert_sink,
                "</tr>",
                icon_name,
                GTK_ICON_SIZE_DIALOG,
+               icon_width,
+               icon_height,
                primary_text,
                secondary_text);
 
diff --git a/src/em-format/e-mail-formatter-error.c b/src/em-format/e-mail-formatter-error.c
index 40fe2b9..66307bf 100644
--- a/src/em-format/e-mail-formatter-error.c
+++ b/src/em-format/e-mail-formatter-error.c
@@ -52,6 +52,12 @@ emfe_error_format (EMailFormatterExtension *extension,
        CamelDataWrapper *dw;
        const gchar *string;
        gchar *html;
+       gint icon_width, icon_height;
+
+       if (!gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, &icon_width, &icon_height)) {
+               icon_width = 48;
+               icon_height = 48;
+       }
 
        mime_part = e_mail_part_ref_mime_part (part);
        dw = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
@@ -63,9 +69,9 @@ emfe_error_format (EMailFormatterExtension *extension,
                "<table border=\"0\" cellspacing=\"10\" "
                "cellpadding=\"0\" width=\"100%%\">\n"
                "<tr valign=\"top\"><td width=50>"
-               "<img src=\"gtk-stock://%s/?size=%d\" /></td>\n"
+               "<img src=\"gtk-stock://%s/?size=%d\" width=\"%dpx\" height=\"%dpx\"/></td>\n"
                "<td style=\"color: red;\">",
-               "dialog-error", GTK_ICON_SIZE_DIALOG);
+               "dialog-error", GTK_ICON_SIZE_DIALOG, icon_width, icon_height);
 
        g_output_stream_write_all (
                stream, html, strlen (html), NULL, cancellable, NULL);
diff --git a/src/em-format/e-mail-formatter-headers.c b/src/em-format/e-mail-formatter-headers.c
index 3f0760a..ed847dc 100644
--- a/src/em-format/e-mail-formatter-headers.c
+++ b/src/em-format/e-mail-formatter-headers.c
@@ -170,7 +170,7 @@ write_contact_picture (CamelMimePart *mime_part,
                        if (size >= 0) {
                                g_string_append_printf (
                                        buffer,
-                                       "<img width=\"%d\" src=\"evo-file://%s\" />",
+                                       "<img width=\"%dpx\" src=\"evo-file://%s\" />",
                                        size, filename);
                        } else {
                                g_string_append_printf (
@@ -190,7 +190,7 @@ write_contact_picture (CamelMimePart *mime_part,
        if (size >= 0) {
                g_string_append_printf (
                        buffer,
-                       "<img width=\"%d\" src=\"data:%s;base64,%s\">",
+                       "<img width=\"%dpx\" src=\"data:%s;base64,%s\">",
                        size, content_type, b64);
        } else {
                g_string_append_printf (
diff --git a/src/modules/itip-formatter/itip-view.c b/src/modules/itip-formatter/itip-view.c
index 885d41b..b28053c 100644
--- a/src/modules/itip-formatter/itip-view.c
+++ b/src/modules/itip-formatter/itip-view.c
@@ -1165,13 +1165,20 @@ buttons_table_write_button (GString *buffer,
        html_label = e_mail_formatter_parse_html_mnemonics (label, &access_key);
 
        if (icon) {
+               gint icon_width, icon_height;
+
+               if (!gtk_icon_size_lookup (GTK_ICON_SIZE_BUTTON, &icon_width, &icon_height)) {
+                       icon_width = 16;
+                       icon_height = 16;
+               }
+
                g_string_append_printf (
                        buffer,
                        "<td><button class=\"itip-button\" type=\"button\" name=\"%s\" value=\"%p:%d\" 
id=\"%s\" accesskey=\"%s\" hidden disabled>"
-                       "<div><img src=\"gtk-stock://%s?size=%d\"> <span>%s</span></div>"
+                       "<div><img src=\"gtk-stock://%s?size=%d\" width=\"%dpx\" height=\"%dpx\"> 
<span>%s</span></div>"
                        "</button></td>\n",
                        name, itip_part_ptr, response, name, access_key ? access_key : "" , icon,
-                       GTK_ICON_SIZE_BUTTON, html_label);
+                       GTK_ICON_SIZE_BUTTON, icon_width, icon_height, html_label);
        } else {
                g_string_append_printf (
                        buffer,
@@ -1633,14 +1640,21 @@ itip_view_write (gpointer itip_part_ptr,
                 EMailFormatter *formatter,
                  GString *buffer)
 {
+       gint icon_width, icon_height;
        gchar *header = e_mail_formatter_get_html_header (formatter);
+
        g_string_append (buffer, header);
        g_free (header);
 
+       if (!gtk_icon_size_lookup (GTK_ICON_SIZE_BUTTON, &icon_width, &icon_height)) {
+               icon_width = 16;
+               icon_height = 16;
+       }
+
        g_string_append_printf (
                buffer,
-               "<img src=\"gtk-stock://%s?size=%d\" class=\"itip icon\" />\n",
-                       MEETING_ICON, GTK_ICON_SIZE_BUTTON);
+               "<img src=\"gtk-stock://%s?size=%d\" class=\"itip icon\" width=\"%dpx\" height=\"%dpx\"/>\n",
+                       MEETING_ICON, GTK_ICON_SIZE_BUTTON, icon_width, icon_height);
 
        g_string_append (
                buffer,


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