mirror of https://github.com/GNOME/gimp.git
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.
This commit is contained in:
parent
9279ee7cb6
commit
68ed0fc12c
|
@ -1,3 +1,9 @@
|
||||||
|
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>
|
2005-02-11 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* app/actions/layers-actions.c (layers_actions): fixed
|
* 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)
|
else if (event->type == GDK_BUTTON_PRESS && event->button == 2)
|
||||||
{
|
{
|
||||||
GimpContext *context = GIMP_DOCK (toolbox)->context;
|
GimpContext *context = GIMP_DOCK (toolbox)->context;
|
||||||
GtkClipboard *clipboard;
|
GtkClipboard *clipboard;
|
||||||
|
|
||||||
clipboard = gtk_widget_get_clipboard (widget, GDK_SELECTION_PRIMARY);
|
clipboard = gtk_widget_get_clipboard (widget, GDK_SELECTION_PRIMARY);
|
||||||
|
gtk_clipboard_request_text (clipboard,
|
||||||
g_object_ref (context);
|
toolbox_paste_received,
|
||||||
gtk_clipboard_request_text (clipboard, toolbox_paste_received, context);
|
g_object_ref (context));
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1008,29 +1008,40 @@ toolbox_paste_received (GtkClipboard *clipboard,
|
||||||
{
|
{
|
||||||
GimpContext *context = GIMP_CONTEXT (data);
|
GimpContext *context = GIMP_CONTEXT (data);
|
||||||
|
|
||||||
if (text && g_utf8_validate (text, -1, NULL))
|
if (text)
|
||||||
{
|
{
|
||||||
GimpImage *image;
|
const gchar *newline = strchr (text, '\n');
|
||||||
GimpPDBStatusType status;
|
gchar *copy;
|
||||||
GError *error = NULL;
|
|
||||||
|
|
||||||
/* 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,
|
g_strstrip (copy);
|
||||||
text, &status, &error);
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
g_message (_("Opening '%s' failed:\n\n%s"),
|
image = file_open_with_display (context->gimp, context, NULL,
|
||||||
filename, error->message);
|
copy, &status, &error);
|
||||||
|
|
||||||
g_clear_error (&error);
|
if (! image && status != GIMP_PDB_CANCEL)
|
||||||
g_free (filename);
|
{
|
||||||
|
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_free (copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (context);
|
g_object_unref (context);
|
||||||
|
|
Loading…
Reference in New Issue