Commit bb5e1acb authored by Darin Adler's avatar Darin Adler

reviewed by: John Sullivan <sullivan@eazel.com>

	Fix bug 7587 (Copying text in Notes with menu item kills Notes
	[also Text viewer, etc]):

	* libnautilus/nautilus-clipboard.c: (do_with_fake_current_event):
	Function to set up a non-NULL event so the code in GtkEditable
	won't die.
	(cut_callback), (copy_callback), (paste_callback): Use the new
	function.
parent a63ef918
2001-03-09 Darin Adler <darin@eazel.com>
reviewed by: John Sullivan <sullivan@eazel.com>
Fix bug 7587 (Copying text in Notes with menu item kills Notes
[also Text viewer, etc]):
* libnautilus/nautilus-clipboard.c: (do_with_fake_current_event):
Function to set up a non-NULL event so the code in GtkEditable
won't die.
(cut_callback), (copy_callback), (paste_callback): Use the new
function.
2001-03-09 John Sullivan <sullivan@eazel.com>
reviewed by: Rebecca Schulman <rebecka@eazel.com>
......
......@@ -6,7 +6,7 @@
* and paste.
*
* Copyright (C) 1999, 2000 Free Software Foundaton
* Copyright (C) 2000 Eazel, Inc.
* Copyright (C) 2000, 2001 Eazel, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -33,12 +33,59 @@
#include <bonobo/bonobo-ui-util.h>
#include <gtk/gtkeditable.h>
#include <gtk/gtkinvisible.h>
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
typedef void (* EditableFunction) (GtkEditable *editable);
static void disconnect_set_up_in_control_handlers (GtkObject *object,
gpointer callback_data);
static void selection_changed_callback (GtkWidget *widget,
gpointer callback_data);
static void
do_with_fake_current_event (EditableFunction function,
GtkEditable *editable)
{
GdkEvent *current_event;
GdkEvent fake_event;
GtkWidget *fake_widget;
/* Handle the simple case where no fakery is required. */
current_event = gtk_get_current_event ();
if (current_event != NULL) {
gdk_event_free (current_event);
(* function) (editable);
return;
}
/* Call the function inside a fake event, so the event is
* non-NULL. This works around the gtk bug described in
* http://bugzilla.gnome.org/show_bug.cgi?id=51889 where the
* event must not be NULL.
*/
/* Make widget. */
fake_widget = gtk_invisible_new ();
gtk_signal_connect_object (GTK_OBJECT (fake_widget),
"client_event",
function,
GTK_OBJECT (editable));
gtk_widget_realize (fake_widget);
/* Make event. */
memset (&fake_event, 0, sizeof (fake_event));
fake_event.type = GDK_CLIENT_EVENT;
fake_event.any.window = fake_widget->window;
/* Handle event, calling through to function. */
gtk_main_do_event (&fake_event);
/* Discard widget. */
gtk_widget_unref (fake_widget);
}
static void
cut_callback (BonoboUIComponent *ui,
gpointer callback_data,
......@@ -47,7 +94,8 @@ cut_callback (BonoboUIComponent *ui,
g_assert (BONOBO_IS_UI_COMPONENT (ui));
g_assert (strcmp (command_name, "Cut") == 0);
gtk_editable_cut_clipboard (GTK_EDITABLE (callback_data));
do_with_fake_current_event (gtk_editable_cut_clipboard,
GTK_EDITABLE (callback_data));
}
static void
......@@ -57,8 +105,9 @@ copy_callback (BonoboUIComponent *ui,
{
g_assert (BONOBO_IS_UI_COMPONENT (ui));
g_assert (strcmp (command_name, "Copy") == 0);
gtk_editable_copy_clipboard (GTK_EDITABLE (callback_data));
do_with_fake_current_event (gtk_editable_copy_clipboard,
GTK_EDITABLE (callback_data));
}
static void
......@@ -68,8 +117,9 @@ paste_callback (BonoboUIComponent *ui,
{
g_assert (BONOBO_IS_UI_COMPONENT (ui));
g_assert (strcmp (command_name, "Paste") == 0);
gtk_editable_paste_clipboard (GTK_EDITABLE (callback_data));
do_with_fake_current_event (gtk_editable_paste_clipboard,
GTK_EDITABLE (callback_data));
}
static void
......@@ -79,7 +129,7 @@ clear_callback (BonoboUIComponent *ui,
{
g_assert (BONOBO_IS_UI_COMPONENT (ui));
g_assert (strcmp (command_name, "Clear") == 0);
gtk_editable_delete_selection (GTK_EDITABLE (callback_data));
}
......
......@@ -918,15 +918,8 @@ rsvg_text_handler_characters (RsvgSaxHandler *self, const xmlChar *ch, int len)
ArtRender *render;
GdkPixbuf *pixbuf;
gboolean has_alpha;
static int count = 0;
int opacity;
count++;
if (count == 2)
{
count = 10;
}
/* Copy ch into string, chopping off leading and trailing whitespace */
for (beg = 0; beg < len; beg++)
if (!isspace (ch[beg]))
......
......@@ -60,7 +60,7 @@ struct FMListViewDetails {
in chunks, to improve responsiveness during loading.
This is the number of files we add to the list, or change
at once. */
/* FIXME: Why doesn't the icon view need the same thing. */
/* FIXME: Why doesn't the icon view need the same thing? */
#define LIST_VIEW_DISPLAY_PENDING_FILES_GROUP_SIZE 100
/*
......
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