Commit 608511e5 authored by Jesse van den Kieboom's avatar Jesse van den Kieboom

Fixed handling error messages for streams

This includes reading from stdin or a named pipe (in case of
the gedit single process needing to read stdin from another gedit
process)
parent 22452900
......@@ -229,10 +229,13 @@ parse_gio_error (gint code,
break;
case G_IO_ERROR_NOT_SUPPORTED:
{
gchar *scheme_string;
gchar *scheme_string = NULL;
gchar *scheme_markup;
scheme_string = g_file_get_uri_scheme (location);
if (location)
{
scheme_string = g_file_get_uri_scheme (location);
}
if ((scheme_string != NULL) && g_utf8_validate (scheme_string, -1, NULL))
{
......@@ -282,9 +285,12 @@ parse_gio_error (gint code,
*/
{
gchar *hn = NULL;
gchar *uri;
gchar *uri = NULL;
uri = g_file_get_uri (location);
if (location)
{
uri = g_file_get_uri (location);
}
if (uri && gedit_utils_decode_uri (uri, NULL, NULL, &hn, NULL, NULL))
{
......@@ -616,13 +622,19 @@ gedit_io_loading_error_message_area_new (GFile *location,
gboolean edit_anyway = FALSE;
gboolean convert_error = FALSE;
g_return_val_if_fail (G_IS_FILE (location), NULL);
g_return_val_if_fail (error != NULL, NULL);
g_return_val_if_fail ((error->domain == G_CONVERT_ERROR) ||
(error->domain == GEDIT_DOCUMENT_ERROR) ||
(error->domain == G_IO_ERROR), NULL);
full_formatted_uri = gedit_utils_uri_for_display (location);
if (location)
{
full_formatted_uri = gedit_utils_uri_for_display (location);
}
else
{
full_formatted_uri = g_strdup ("stdin");
}
/* Truncate the URI so it doesn't get insanely wide. Note that even
* though the dialog uses wrapped text, if the URI doesn't contain
......
......@@ -517,11 +517,12 @@ io_loading_error_message_area_response (GtkWidget *message_area,
g_return_if_fail (GEDIT_IS_VIEW (view));
location = gedit_document_get_location (doc);
g_return_if_fail (location != NULL);
switch (response_id)
{
case GTK_RESPONSE_OK:
g_return_if_fail (location != NULL);
encoding = gedit_conversion_error_message_area_get_encoding (
GTK_WIDGET (message_area));
......@@ -552,13 +553,19 @@ io_loading_error_message_area_response (GtkWidget *message_area,
set_message_area (tab, NULL);
break;
default:
_gedit_recent_remove (GEDIT_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tab))), location);
if (location != NULL)
{
_gedit_recent_remove (GEDIT_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tab))), location);
}
remove_tab (tab);
break;
}
g_object_unref (location);
if (location != NULL)
{
g_object_unref (location);
}
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment