2004-04-14  Not Zed  <NotZed@Ximian.com>

        ** See bug #56149.

        * em-folder-view.c (emfv_edit_cut): similar to below, use focus to
        determine who we select from.
        (emfv_edit_copy): ditto.

        * message-list.c: Remove primary selection stuff.  It just annoys.

        * em-folder-browser.c (emfb_edit_copy): use focus rather than
        selection owner to determine who to copy from.
        (emfb_edit_cut): similarly.

svn path=/trunk/; revision=25455
This commit is contained in:
Not Zed
2004-04-14 08:25:43 +00:00
committed by Michael Zucci
parent 8bdc418acd
commit 2864da8135
5 changed files with 26 additions and 44 deletions

View File

@ -1,5 +1,17 @@
2004-04-14 Not Zed <NotZed@Ximian.com>
** See bug #56149.
* em-folder-view.c (emfv_edit_cut): similar to below, use focus to
determine who we select from.
(emfv_edit_copy): ditto.
* message-list.c: Remove primary selection stuff. It just annoys.
* em-folder-browser.c (emfb_edit_copy): use focus rather than
selection owner to determine who to copy from.
(emfb_edit_cut): similarly.
* em-format.c (emf_multipart_related): hmm, use the right pointer
when iterating the pending uri list.

View File

@ -489,10 +489,10 @@ emfb_edit_cut(BonoboUIComponent *uid, void *data, const char *path)
if (GTK_WIDGET_HAS_FOCUS(((ESearchBar *)emfb->search)->entry))
gtk_editable_cut_clipboard((GtkEditable *)((ESearchBar *)emfb->search)->entry);
else if (message_list_has_primary_selection(emfb->view.list))
message_list_copy(emfb->view.list, TRUE);
else if (emfb->view.preview_active)
else if (GTK_WIDGET_HAS_FOCUS(emfb->view.preview->formathtml.html))
em_format_html_display_cut(emfb->view.preview);
else
message_list_copy(emfb->view.list, TRUE);
}
static void
@ -502,10 +502,10 @@ emfb_edit_copy(BonoboUIComponent *uid, void *data, const char *path)
if (GTK_WIDGET_HAS_FOCUS(((ESearchBar *)emfb->search)->entry))
gtk_editable_copy_clipboard((GtkEditable *)((ESearchBar *)emfb->search)->entry);
else if (message_list_has_primary_selection(emfb->view.list))
message_list_copy(emfb->view.list, FALSE);
else if (emfb->view.preview_active)
else if (GTK_WIDGET_HAS_FOCUS(emfb->view.preview->formathtml.html))
em_format_html_display_copy(emfb->view.preview);
else
message_list_copy(emfb->view.list, FALSE);
}
static void

View File

@ -954,10 +954,10 @@ emfv_edit_cut(BonoboUIComponent *uid, void *data, const char *path)
{
EMFolderView *emfv = data;
if (message_list_has_primary_selection(emfv->list))
message_list_copy(emfv->list, TRUE);
else if (emfv->preview_active)
if (GTK_WIDGET_HAS_FOCUS(emfv->preview->formathtml.html))
em_format_html_display_cut(emfv->preview);
else
message_list_copy(emfv->list, TRUE);
}
static void
@ -965,10 +965,10 @@ emfv_edit_copy(BonoboUIComponent *uid, void *data, const char *path)
{
EMFolderView *emfv = data;
if (message_list_has_primary_selection(emfv->list))
message_list_copy(emfv->list, FALSE);
else if (emfv->preview_active)
if (GTK_WIDGET_HAS_FOCUS(emfv->preview->formathtml.html))
em_format_html_display_copy(emfv->preview);
else
message_list_copy(emfv->list, FALSE);
}
static void

View File

@ -98,7 +98,6 @@ struct _MLSelection {
struct _MessageListPrivate {
GtkWidget *invisible; /* 4 selection */
struct _MLSelection primary;
struct _MLSelection clipboard;
};
@ -734,12 +733,6 @@ message_list_copy(MessageList *ml, gboolean cut)
}
}
gboolean
message_list_has_primary_selection(MessageList *ml)
{
return ml->priv->primary.uids != NULL;
}
void
message_list_paste(MessageList *ml)
{
@ -1454,10 +1447,7 @@ ml_selection_get(GtkWidget *widget, GtkSelectionData *data, guint info, guint ti
{
struct _MLSelection *selection;
if (info & 1)
selection = &ml->priv->primary;
else
selection = &ml->priv->clipboard;
selection = &ml->priv->clipboard;
if (selection->uids == NULL)
return;
@ -1478,10 +1468,7 @@ ml_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, MessageLis
{
struct _MessageListPrivate *p = ml->priv;
if (event->selection == GDK_SELECTION_PRIMARY)
clear_selection(ml, &p->primary);
else if (event->selection == GDK_SELECTION_CLIPBOARD)
clear_selection(ml, &p->clipboard);
clear_selection(ml, &p->clipboard);
}
static void
@ -1611,9 +1598,7 @@ message_list_init (GtkObject *object)
matom = gdk_atom_intern ("x-uid-list", FALSE);
gtk_selection_add_target(p->invisible, GDK_SELECTION_CLIPBOARD, matom, 0);
gtk_selection_add_target(p->invisible, GDK_SELECTION_PRIMARY, matom, 1);
gtk_selection_add_target(p->invisible, GDK_SELECTION_CLIPBOARD, GDK_SELECTION_TYPE_STRING, 2);
gtk_selection_add_target(p->invisible, GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 3);
g_signal_connect(p->invisible, "selection_get", G_CALLBACK(ml_selection_get), message_list);
g_signal_connect(p->invisible, "selection_clear_event", G_CALLBACK(ml_selection_clear_event), message_list);
@ -1708,7 +1693,6 @@ message_list_finalise (GObject *object)
g_free(message_list->folder_uri);
message_list->folder_uri = NULL;
clear_selection(message_list, &p->primary);
clear_selection(message_list, &p->clipboard);
g_free(p);
@ -2673,19 +2657,6 @@ on_selection_changed_cmd(ETree *tree, MessageList *ml)
if (!ml->idle_id)
ml->idle_id = g_idle_add_full (G_PRIORITY_LOW, on_cursor_activated_idle, ml, NULL);
clear_selection(ml, &ml->priv->primary);
if (uids->len > 0) {
ml->priv->primary.uids = uids;
ml->priv->primary.folder = ml->folder;
camel_object_ref(ml->priv->primary.folder);
ml->priv->primary.folder_uri = g_strdup(ml->folder_uri);
gtk_selection_owner_set(ml->priv->invisible, GDK_SELECTION_PRIMARY, gtk_get_current_event_time());
} else {
message_list_free_uids(ml, uids);
gtk_selection_owner_set(NULL, GDK_SELECTION_PRIMARY, gtk_get_current_event_time());
}
}
static gint

View File

@ -188,7 +188,6 @@ void message_list_invert_selection (MessageList *ml);
/* clipboard stuff */
void message_list_copy(MessageList *ml, gboolean cut);
gboolean message_list_has_primary_selection(MessageList *ml);
void message_list_paste (MessageList *ml);
/* info */