aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog6
-rw-r--r--mail/folder-browser.c66
-rw-r--r--mail/folder-browser.h3
3 files changed, 34 insertions, 41 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 1f04ec603e..6019fae3bc 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,9 @@
+2001-06-27 Jeffrey Stedfast <fejj@ximian.com>
+
+ * folder-browser.c: Fixed Cut/Copy/Paste to work - it turns out I
+ couldn't share a single GtkInvisible between all the
+ FolderBrowser's after all.
+
2001-06-27 Peter Williams <peterw@ximian.com>
* folder-browser-factory.c (control_deactivate): Change to use
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index 5acc7f8c7e..66365d2745 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -74,8 +74,6 @@ static GtkTargetEntry drag_types[] = {
static const int num_drag_types = sizeof (drag_types) / sizeof (drag_types[0]);
static GdkAtom clipboard_atom = GDK_NONE;
-static GByteArray *clipboard_selection = NULL;
-static GtkWidget *invisible = NULL;
static void update_unread_count (CamelObject *, gpointer, gpointer);
@@ -90,15 +88,6 @@ enum {
static guint folder_browser_signals [LAST_SIGNAL] = {0, };
static void
-invisible_destroyed (GtkObject *invisible)
-{
- if (clipboard_selection) {
- g_byte_array_free (clipboard_selection, TRUE);
- clipboard_selection = NULL;
- }
-}
-
-static void
folder_browser_destroy (GtkObject *object)
{
FolderBrowser *folder_browser;
@@ -155,7 +144,9 @@ folder_browser_destroy (GtkObject *object)
folder_browser->view_menus = NULL;
}
- gtk_object_unref (GTK_OBJECT (invisible));
+ gtk_object_unref (GTK_OBJECT (folder_browser->invisible));
+ if (folder_browser->clipboard_selection)
+ g_byte_array_free (folder_browser->clipboard_selection, TRUE);
folder_browser_parent_class->destroy (object);
}
@@ -535,21 +526,21 @@ static void
selection_get (GtkWidget *widget, GtkSelectionData *selection_data,
guint info, guint time_stamp, FolderBrowser *fb)
{
- if (clipboard_selection != NULL) {
+ if (fb->clipboard_selection != NULL) {
gtk_selection_data_set (selection_data,
GDK_SELECTION_TYPE_STRING,
8,
- clipboard_selection->data,
- clipboard_selection->len);
+ fb->clipboard_selection->data,
+ fb->clipboard_selection->len);
}
}
static void
selection_clear_event (GtkWidget *widget, GdkEventSelection *event, FolderBrowser *fb)
{
- if (clipboard_selection != NULL) {
- g_byte_array_free (clipboard_selection, TRUE);
- clipboard_selection = NULL;
+ if (fb->clipboard_selection != NULL) {
+ g_byte_array_free (fb->clipboard_selection, TRUE);
+ fb->clipboard_selection = NULL;
}
}
@@ -585,9 +576,9 @@ folder_browser_copy (GtkWidget *menuitem, FolderBrowser *fb)
cut = menuitem == NULL;
- if (clipboard_selection) {
- g_byte_array_free (clipboard_selection, TRUE);
- clipboard_selection = NULL;
+ if (fb->clipboard_selection) {
+ g_byte_array_free (fb->clipboard_selection, TRUE);
+ fb->clipboard_selection = NULL;
}
uids = g_ptr_array_new ();
@@ -623,9 +614,9 @@ folder_browser_copy (GtkWidget *menuitem, FolderBrowser *fb)
g_ptr_array_free (uids, TRUE);
- clipboard_selection = bytes;
+ fb->clipboard_selection = bytes;
- gtk_selection_owner_set (invisible, clipboard_atom, GDK_CURRENT_TIME);
+ gtk_selection_owner_set (fb->invisible, clipboard_atom, GDK_CURRENT_TIME);
}
void
@@ -637,7 +628,7 @@ folder_browser_cut (GtkWidget *menuitem, FolderBrowser *fb)
void
folder_browser_paste (GtkWidget *menuitem, FolderBrowser *fb)
{
- gtk_selection_convert (invisible,
+ gtk_selection_convert (fb->invisible,
clipboard_atom,
GDK_SELECTION_TYPE_STRING,
GDK_CURRENT_TIME);
@@ -1792,29 +1783,22 @@ my_folder_browser_init (GtkObject *object)
GTK_SIGNAL_FUNC (message_list_drag_data_recieved), fb);
/* cut, copy & paste */
- if (!invisible) {
- invisible = gtk_invisible_new ();
-
- gtk_signal_connect (GTK_OBJECT (invisible), "destroy",
- GTK_SIGNAL_FUNC (invisible_destroyed),
- NULL);
-
- gtk_selection_add_target (invisible,
- clipboard_atom,
- GDK_SELECTION_TYPE_STRING,
- 0);
- } else
- gtk_object_ref (GTK_OBJECT (invisible));
-
- gtk_signal_connect (GTK_OBJECT (invisible),
+ fb->invisible = gtk_invisible_new ();
+
+ gtk_selection_add_target (fb->invisible,
+ clipboard_atom,
+ GDK_SELECTION_TYPE_STRING,
+ 0);
+
+ gtk_signal_connect (GTK_OBJECT (fb->invisible),
"selection_get",
GTK_SIGNAL_FUNC (selection_get),
(gpointer) fb);
- gtk_signal_connect (GTK_OBJECT (invisible),
+ gtk_signal_connect (GTK_OBJECT (fb->invisible),
"selection_clear_event",
GTK_SIGNAL_FUNC (selection_clear_event),
(gpointer) fb);
- gtk_signal_connect (GTK_OBJECT (invisible),
+ gtk_signal_connect (GTK_OBJECT (fb->invisible),
"selection_received",
GTK_SIGNAL_FUNC (selection_received),
(gpointer) fb);
diff --git a/mail/folder-browser.h b/mail/folder-browser.h
index 943bcf2fc8..a6e2f42ec9 100644
--- a/mail/folder-browser.h
+++ b/mail/folder-browser.h
@@ -65,6 +65,9 @@ struct _FolderBrowser {
/* View collection and the menu handler object */
GalViewCollection *view_collection;
GalViewMenus *view_menus;
+
+ GtkWidget *invisible;
+ GByteArray *clipboard_selection;
};