diff options
Diffstat (limited to 'calendar/gui/e-cal-component-preview.c')
-rw-r--r-- | calendar/gui/e-cal-component-preview.c | 84 |
1 files changed, 2 insertions, 82 deletions
diff --git a/calendar/gui/e-cal-component-preview.c b/calendar/gui/e-cal-component-preview.c index 633eb5678e..b0ba329286 100644 --- a/calendar/gui/e-cal-component-preview.c +++ b/calendar/gui/e-cal-component-preview.c @@ -271,83 +271,10 @@ cal_component_preview_write_html (GtkHTMLStream *stream, } static void -cal_component_preview_url_requested (GtkHTML *html, - const gchar *url, - GtkHTMLStream *html_stream) -{ - GFile *file; - GFileInputStream *input_stream; - gchar buffer[4096]; - gssize bytes_read; - GError *error = NULL; - - file = g_file_new_for_uri (url); - - /* XXX We only handle native files, which I guess minimizes - * the damage from doing blocking reads here. Annoying - * that GtkHTML does not handle this itself. */ - if (!g_file_is_native (file)) - goto exit; - - input_stream = g_file_read (file, NULL, &error); - - if (error != NULL) - goto fail; - - do { - bytes_read = g_input_stream_read ( - G_INPUT_STREAM (input_stream), - buffer, sizeof (buffer), NULL, &error); - - if (bytes_read > 0) - gtk_html_stream_write ( - html_stream, buffer, bytes_read); - - } while (bytes_read > 0); - - if (error != NULL) - goto fail; - - gtk_html_stream_close (html_stream, GTK_HTML_STREAM_OK); - - goto exit; - -fail: - g_warning ("%s", error->message); - g_error_free (error); - - gtk_html_stream_close (html_stream, GTK_HTML_STREAM_ERROR); - -exit: - if (input_stream != NULL) - g_object_unref (input_stream); - - g_object_unref (file); -} - -static void -cal_component_preview_link_clicked (GtkHTML *html, - const gchar *uri) -{ - gpointer parent; - - parent = gtk_widget_get_toplevel (GTK_WIDGET (html)); - parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL; - - e_show_uri (parent, uri); -} - -static void cal_component_preview_class_init (ECalComponentPreviewClass *class) { - GtkHTMLClass *gtkhtml_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ECalComponentPreviewPrivate)); - - gtkhtml_class = GTK_HTML_CLASS (class); - gtkhtml_class->url_requested = cal_component_preview_url_requested; - gtkhtml_class->link_clicked = cal_component_preview_link_clicked; } static void @@ -384,7 +311,8 @@ e_cal_component_preview_get_type (void) }; type = g_type_register_static ( - GTK_TYPE_HTML, "ECalComponentPreview", &type_info, 0); + E_TYPE_WEB_VIEW, "ECalComponentPreview", + &type_info, 0); } return type; @@ -429,11 +357,3 @@ e_cal_component_preview_display (ECalComponentPreview *preview, stream, ecal, comp, preview->priv->zone); gtk_html_stream_close (stream, GTK_HTML_STREAM_OK); } - -void -e_cal_component_preview_clear (ECalComponentPreview *preview) -{ - g_return_if_fail (E_IS_CAL_COMPONENT_PREVIEW (preview)); - - gtk_html_load_empty (GTK_HTML (preview)); -} |