Commit 68ed0fc1 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

drop everything after the first newline and strip leading and trailing

2005-02-11  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimptoolbox.c (toolbox_paste_received): drop
	everything after the first newline and strip leading and trailing
	whitespace from the pasted text.
parent 9279ee7c
2005-02-11 Sven Neumann <sven@gimp.org>
* app/widgets/gimptoolbox.c (toolbox_paste_received): drop
everything after the first newline and strip leading and trailing
whitespace from the pasted text.
2005-02-11 Michael Natterer <mitch@gimp.org>
* app/actions/layers-actions.c (layers_actions): fixed
......
......@@ -979,13 +979,13 @@ toolbox_tool_button_press (GtkWidget *widget,
}
else if (event->type == GDK_BUTTON_PRESS && event->button == 2)
{
GimpContext *context = GIMP_DOCK (toolbox)->context;
GimpContext *context = GIMP_DOCK (toolbox)->context;
GtkClipboard *clipboard;
clipboard = gtk_widget_get_clipboard (widget, GDK_SELECTION_PRIMARY);
g_object_ref (context);
gtk_clipboard_request_text (clipboard, toolbox_paste_received, context);
gtk_clipboard_request_text (clipboard,
toolbox_paste_received,
g_object_ref (context));
}
return FALSE;
......@@ -1008,29 +1008,40 @@ toolbox_paste_received (GtkClipboard *clipboard,
{
GimpContext *context = GIMP_CONTEXT (data);
if (text && g_utf8_validate (text, -1, NULL))
if (text)
{
GimpImage *image;
GimpPDBStatusType status;
GError *error = NULL;
const gchar *newline = strchr (text, '\n');
gchar *copy;
/* FIXME: need to validate the URI here!!
*/
if (newline)
copy = g_strndup (text, newline - text);
else
copy = g_strdup (text);
image = file_open_with_display (context->gimp, context, NULL,
text, &status, &error);
g_strstrip (copy);
if (! image && status != GIMP_PDB_CANCEL)
if (strlen (copy))
{
gchar *filename = file_utils_uri_to_utf8_filename (text);
GimpImage *image;
GimpPDBStatusType status;
GError *error = NULL;
image = file_open_with_display (context->gimp, context, NULL,
copy, &status, &error);
g_message (_("Opening '%s' failed:\n\n%s"),
filename, error->message);
if (! image && status != GIMP_PDB_CANCEL)
{
gchar *filename = file_utils_uri_to_utf8_filename (copy);
g_message (_("Opening '%s' failed:\n\n%s"),
filename, error->message);
g_clear_error (&error);
g_free (filename);
g_clear_error (&error);
g_free (filename);
}
}
g_free (copy);
}
g_object_unref (context);
......
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