aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Vrátil <dvratil@redhat.com>2012-05-03 23:01:53 +0800
committerDan Vrátil <dvratil@redhat.com>2012-05-03 23:02:31 +0800
commit32e4f0814d464ebf175f7a39e56fb41fcd73f70d (patch)
tree9ad74f344c2cd5ca2ec947b509d472d4b4ffc219
parentf25826211b007a615118f9b583a66d7027eddeac (diff)
downloadgsoc2013-evolution-32e4f0814d464ebf175f7a39e56fb41fcd73f70d.tar
gsoc2013-evolution-32e4f0814d464ebf175f7a39e56fb41fcd73f70d.tar.gz
gsoc2013-evolution-32e4f0814d464ebf175f7a39e56fb41fcd73f70d.tar.bz2
gsoc2013-evolution-32e4f0814d464ebf175f7a39e56fb41fcd73f70d.tar.lz
gsoc2013-evolution-32e4f0814d464ebf175f7a39e56fb41fcd73f70d.tar.xz
gsoc2013-evolution-32e4f0814d464ebf175f7a39e56fb41fcd73f70d.tar.zst
gsoc2013-evolution-32e4f0814d464ebf175f7a39e56fb41fcd73f70d.zip
Fix displaying icons in EWebView alerts
-rw-r--r--e-util/e-stock-request.c3
-rw-r--r--mail/e-mail-display.c1
-rw-r--r--widgets/misc/e-web-view.c38
3 files changed, 10 insertions, 32 deletions
diff --git a/e-util/e-stock-request.c b/e-util/e-stock-request.c
index cbb8820406..2b805f471e 100644
--- a/e-util/e-stock-request.c
+++ b/e-util/e-stock-request.c
@@ -68,7 +68,6 @@ handle_stock_request (GSimpleAsyncResult *res,
if (query) {
a_size = g_hash_table_lookup (query, "size");
- g_hash_table_destroy (query);
} else {
a_size = NULL;
}
@@ -79,6 +78,8 @@ handle_stock_request (GSimpleAsyncResult *res,
size = atoi (a_size);
}
+ g_hash_table_destroy (query);
+
/* Try style context first */
context = gtk_style_context_new ();
path = gtk_widget_path_new ();
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index d8ca523682..558755c1a4 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -462,7 +462,6 @@ mail_display_resource_requested (WebKitWebView *web_view,
const gchar *uri = webkit_network_request_get_uri (request);
if (!formatter) {
- webkit_network_request_set_uri (request, "about:blank");
return;
}
diff --git a/widgets/misc/e-web-view.c b/widgets/misc/e-web-view.c
index 2c92a39274..e9288cd9b7 100644
--- a/widgets/misc/e-web-view.c
+++ b/widgets/misc/e-web-view.c
@@ -38,6 +38,7 @@
#include <libevolution-utils/e-alert-sink.h>
#include <e-util/e-plugin-ui.h>
#include <e-util/e-file-request.h>
+#include <e-util/e-stock-request.h>
#define LIBSOUP_USE_UNSTABLE_REQUEST_API
#include <libsoup/soup.h>
@@ -1281,35 +1282,28 @@ static void
web_view_submit_alert (EAlertSink *alert_sink,
EAlert *alert)
{
- GtkIconInfo *icon_info;
EWebView *web_view;
GtkWidget *dialog;
GString *buffer;
const gchar *icon_name = NULL;
- const gchar *filename;
gpointer parent;
- gchar *icon_uri;
- gint size = 0;
- GError *error = NULL;
web_view = E_WEB_VIEW (alert_sink);
parent = gtk_widget_get_toplevel (GTK_WIDGET (web_view));
parent = gtk_widget_is_toplevel (parent) ? parent : NULL;
- /* We use equivalent named icons instead of stock IDs,
- * since it's easier to get the filename of the icon. */
switch (e_alert_get_message_type (alert)) {
case GTK_MESSAGE_INFO:
- icon_name = "dialog-information";
+ icon_name = GTK_STOCK_DIALOG_INFO;
break;
case GTK_MESSAGE_WARNING:
- icon_name = "dialog-warning";
+ icon_name = GTK_STOCK_DIALOG_WARNING;
break;
case GTK_MESSAGE_ERROR:
- icon_name = "dialog-error";
+ icon_name = GTK_STOCK_DIALOG_ERROR;
break;
default:
@@ -1319,21 +1313,6 @@ web_view_submit_alert (EAlertSink *alert_sink,
return;
}
- gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, &size, NULL);
-
- icon_info = gtk_icon_theme_lookup_icon (
- gtk_icon_theme_get_default (),
- icon_name, size, GTK_ICON_LOOKUP_NO_SVG);
- g_return_if_fail (icon_info != NULL);
-
- filename = gtk_icon_info_get_filename (icon_info);
- icon_uri = g_filename_to_uri (filename, NULL, &error);
-
- if (error != NULL) {
- g_warning ("%s", error->message);
- g_clear_error (&error);
- }
-
buffer = g_string_sized_new (512);
g_string_append (
@@ -1358,14 +1337,15 @@ web_view_submit_alert (EAlertSink *alert_sink,
buffer,
"<tr>"
"<td valign='top'>"
- "<img src='%s'/>"
+ "<img src='gtk-stock://%s/?size=%d'/>"
"</td>"
"<td align='left' width='100%%'>"
"<h3>%s</h3>"
"%s"
"</td>"
"</tr>",
- icon_uri,
+ icon_name,
+ GTK_ICON_SIZE_DIALOG,
e_alert_get_primary_text (alert),
e_alert_get_secondary_text (alert));
@@ -1381,9 +1361,6 @@ web_view_submit_alert (EAlertSink *alert_sink,
e_web_view_load_string (web_view, buffer->str);
g_string_free (buffer, TRUE);
-
- gtk_icon_info_free (icon_info);
- g_free (icon_uri);
}
static void
@@ -1725,6 +1702,7 @@ e_web_view_init (EWebView *web_view)
g_object_unref (web_settings);
e_web_view_install_request_handler (web_view, E_TYPE_FILE_REQUEST);
+ e_web_view_install_request_handler (web_view, E_TYPE_STOCK_REQUEST);
settings = g_settings_new ("org.gnome.desktop.interface");
g_signal_connect_swapped (