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



commit 8a0000fb635823096381f85334beb1ceb8c5c161
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

 addressbook/gui/widgets/eab-contact-formatter.c |   10 +++++-----
 e-util/e-web-view.c                             |   10 +++++++++-
 em-format/e-mail-formatter-error.c              |   10 ++++++++--
 em-format/e-mail-formatter-headers.c            |    4 ++--
 modules/itip-formatter/itip-view.c              |   22 ++++++++++++++++++----
 5 files changed, 42 insertions(+), 14 deletions(-)
---
diff --git a/addressbook/gui/widgets/eab-contact-formatter.c b/addressbook/gui/widgets/eab-contact-formatter.c
index d2e217b..5e251e7 100644
--- a/addressbook/gui/widgets/eab-contact-formatter.c
+++ b/addressbook/gui/widgets/eab-contact-formatter.c
@@ -263,7 +263,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 = "";
        }
@@ -561,7 +561,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 (
@@ -610,7 +610,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",
@@ -1069,7 +1069,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)
@@ -1084,7 +1084,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/e-util/e-web-view.c b/e-util/e-web-view.c
index 53d9ce7..37a584d 100644
--- a/e-util/e-web-view.c
+++ b/e-util/e-web-view.c
@@ -1858,6 +1858,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);
@@ -1894,6 +1895,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 (
@@ -1918,7 +1924,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>"
@@ -1927,6 +1933,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/em-format/e-mail-formatter-error.c b/em-format/e-mail-formatter-error.c
index 10993d7..67abae8 100644
--- a/em-format/e-mail-formatter-error.c
+++ b/em-format/e-mail-formatter-error.c
@@ -54,6 +54,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));
@@ -65,9 +71,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/em-format/e-mail-formatter-headers.c b/em-format/e-mail-formatter-headers.c
index 2affbe1..b9e4b44 100644
--- a/em-format/e-mail-formatter-headers.c
+++ b/em-format/e-mail-formatter-headers.c
@@ -166,7 +166,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 (
@@ -186,7 +186,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/modules/itip-formatter/itip-view.c b/modules/itip-formatter/itip-view.c
index 9724466..c636f3c 100644
--- a/modules/itip-formatter/itip-view.c
+++ b/modules/itip-formatter/itip-view.c
@@ -1167,13 +1167,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,
@@ -1635,14 +1642,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]