From 8ee43fc1fb4c9f792116c5502da61cd00d112610 Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Fri, 6 Jul 2007 06:43:47 +0000 Subject: ** Fix for bug #337787 * gui/widgets/e-address-view.c: (contact_display_has_selection), (eab_view_copy): Copy selection string in contact preview if the preview widget has selection string. svn path=/trunk/; revision=33761 --- addressbook/ChangeLog | 8 ++++++++ addressbook/gui/widgets/e-addressbook-view.c | 29 ++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) (limited to 'addressbook') diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 27d77d494b..8f183d9a48 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,11 @@ +2007-07-06 Hiroyuki Ikezoe + + ** Fix for bug #337787 + + * gui/widgets/e-address-view.c: (contact_display_has_selection), + (eab_view_copy): Copy selection string in contact preview if the + preview widget has selection string. + 2007-06-20 Laszlo (Laca) Peter ** Fix for bug #433732 diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index 33042013c3..19d12ab455 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -2085,12 +2085,37 @@ eab_view_cut (EABView *view) eab_view_delete_selection (view, FALSE); } +static gboolean +contact_display_has_selection (EABContactDisplay *display) +{ + gchar *string; + gint selection_length; + gboolean has_selection; + + string = gtk_html_get_selection_html (GTK_HTML (display), &selection_length); + + has_selection = string ? TRUE : FALSE; + + if (string) + g_free (string); + + return has_selection; +} + void eab_view_copy (EABView *view) { - view->clipboard_contacts = get_selected_contacts (view); + if (GTK_WIDGET_HAS_FOCUS (view->contact_display) && + contact_display_has_selection (EAB_CONTACT_DISPLAY (view->contact_display))) + { + gtk_html_copy (GTK_HTML (view->contact_display)); + } + else + { + view->clipboard_contacts = get_selected_contacts (view); - gtk_selection_owner_set (view->invisible, clipboard_atom, GDK_CURRENT_TIME); + gtk_selection_owner_set (view->invisible, clipboard_atom, GDK_CURRENT_TIME); + } } void -- cgit v1.2.3