diff options
author | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-08-21 00:28:30 +0800 |
---|---|---|
committer | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-08-21 00:28:30 +0800 |
commit | 84779196fa3510e4d2fbf53b7a2dfcc1575b39c4 (patch) | |
tree | 7f29c097845db28d04930ee5e0de65c518552904 /plugins | |
parent | ca3ed1d1ed20461efcb10b0495336a0417fe1dd1 (diff) | |
download | gsoc2013-evolution-84779196fa3510e4d2fbf53b7a2dfcc1575b39c4.tar gsoc2013-evolution-84779196fa3510e4d2fbf53b7a2dfcc1575b39c4.tar.gz gsoc2013-evolution-84779196fa3510e4d2fbf53b7a2dfcc1575b39c4.tar.bz2 gsoc2013-evolution-84779196fa3510e4d2fbf53b7a2dfcc1575b39c4.tar.lz gsoc2013-evolution-84779196fa3510e4d2fbf53b7a2dfcc1575b39c4.tar.xz gsoc2013-evolution-84779196fa3510e4d2fbf53b7a2dfcc1575b39c4.tar.zst gsoc2013-evolution-84779196fa3510e4d2fbf53b7a2dfcc1575b39c4.zip |
** Fixes bug #322771
svn path=/trunk/; revision=32602
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/copy-tool/ChangeLog | 5 | ||||
-rw-r--r-- | plugins/copy-tool/copy-tool.c | 63 |
2 files changed, 18 insertions, 50 deletions
diff --git a/plugins/copy-tool/ChangeLog b/plugins/copy-tool/ChangeLog index f29bcf4662..422ec4cb81 100644 --- a/plugins/copy-tool/ChangeLog +++ b/plugins/copy-tool/ChangeLog @@ -1,3 +1,8 @@ +2006-05-19 Hiroyuki Ikezoe <poincare@ikezoe.net> + + ** Fixes bug #322771 + * copy-tool.c: Use GtkClipboard instead of GtkInvisible. + 2005-11-30 Simon Zheng <Simon.Zheng@Sun.Com> Fix for 322733. diff --git a/plugins/copy-tool/copy-tool.c b/plugins/copy-tool/copy-tool.c index b14d762346..7b066f186e 100644 --- a/plugins/copy-tool/copy-tool.c +++ b/plugins/copy-tool/copy-tool.c @@ -13,78 +13,41 @@ #include <glib/gi18n-lib.h> #include <string.h> -#include <stdio.h> #include "mail/em-popup.h" -#include <gtk/gtkmain.h> -#include <gtk/gtkinvisible.h> -#include <gtk/gtkselection.h> +#include <gtk/gtkclipboard.h> #include "camel/camel-internet-address.h" #include "camel/camel-url.h" -static GtkWidget *invisible; -static char *address_uri; - void org_gnome_copy_tool_copy_address(void *ep, EMPopupTargetURI *t); void org_gnome_copy_tool_copy_address(void *ep, EMPopupTargetURI *t) { - g_free(address_uri); - address_uri = g_strdup(t->uri); - - gtk_selection_owner_set(invisible, GDK_SELECTION_PRIMARY, gtk_get_current_event_time()); - gtk_selection_owner_set(invisible, GDK_SELECTION_CLIPBOARD, gtk_get_current_event_time()); -} - -static void -ct_selection_get(GtkWidget *widget, GtkSelectionData *data, guint info, guint time_stamp, void *dummy) -{ - if (address_uri && (strncmp (address_uri, "mailto:", 7) == 0)) { + if (t->uri) { CamelInternetAddress *cia = camel_internet_address_new(); CamelURL *curl; + GtkClipboard *clipboard; char *addr; const char *tmp; - curl = camel_url_new(address_uri, NULL); + curl = camel_url_new(t->uri, NULL); camel_address_decode((CamelAddress *)cia, curl->path); /* should it perhaps use address format? */ addr = camel_address_encode((CamelAddress *)cia); - tmp = addr && addr[0] ? addr : address_uri + 7; + tmp = addr && addr[0] ? addr : t->uri + 7; - gtk_selection_data_set(data, data->target, 8, tmp, strlen(tmp)); - g_free(addr); - camel_url_free(curl); - camel_object_unref(cia); - } -} + clipboard = gtk_clipboard_get (GDK_SELECTION_PRIMARY); -static void -ct_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, void *dummy) -{ - g_free(address_uri); - address_uri = NULL; -} + gtk_clipboard_set_text (clipboard, tmp, strlen (tmp)); -int e_plugin_lib_enable(EPluginLib *ep, int enable); + clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD); + gtk_clipboard_set_text (clipboard, tmp, strlen (tmp)); -int -e_plugin_lib_enable(EPluginLib *ep, int enable) -{ - if (enable) { - invisible = gtk_invisible_new(); - g_signal_connect(invisible, "selection_get", G_CALLBACK(ct_selection_get), NULL); - g_signal_connect(invisible, "selection_clear_event", G_CALLBACK(ct_selection_clear_event), NULL); - gtk_selection_add_target(invisible, GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 0); - gtk_selection_add_target(invisible, GDK_SELECTION_CLIPBOARD, GDK_SELECTION_TYPE_STRING, 1); - } else { - g_free(address_uri); - address_uri = NULL; - gtk_widget_destroy(invisible); - invisible = NULL; - } - - return 0; + g_free(addr); + camel_url_free(curl); + camel_object_unref(cia); + } } |