Get the mailer's URI popup menu working.
Except for "Add to Address Book", which looks like a project unto itself. This also kills off another plugin (copy-tool).
This commit is contained in:
@ -1807,7 +1807,7 @@ plugins_base_always="calendar-file calendar-http $CALENDAR_WEATHER itip-formatte
|
||||
plugins_base="$plugins_base_always $SA_JUNK_PLUGIN $BF_JUNK_PLUGIN $EXCHANGE_PLUGIN $MONO_PLUGIN "
|
||||
all_plugins_base="$plugins_base_always sa-junk-plugin bogo-junk-plugin exchange-operations mono"
|
||||
|
||||
plugins_standard_always="bbdb subject-thread save-calendar copy-tool mail-to-task audio-inline mailing-list-actions default-mailer prefer-plain mail-notification attachment-reminder face backup-restore email-custom-header templates pst-import vcard-inline"
|
||||
plugins_standard_always="bbdb subject-thread save-calendar mail-to-task audio-inline mailing-list-actions default-mailer prefer-plain mail-notification attachment-reminder face backup-restore email-custom-header templates pst-import vcard-inline"
|
||||
|
||||
plugins_standard="$plugins_standard_always"
|
||||
all_plugins_standard="$plugins_standard"
|
||||
@ -1817,7 +1817,7 @@ plugins_experimental="$plugins_experimental_always $IPOD_SYNC $TNEF_ATTACHMENTS
|
||||
all_plugins_experimental="$plugins_experimental_always ipod-sync tnef-attachments"
|
||||
|
||||
dnl Temporary KILL-BONOBO hack
|
||||
enable_plugins="attachment-reminder addressbook-file audio-inline bbdb bogo-junk-plugin caldav calendar-file calendar-http copy-tool default-source external-editor google-account-setup hula-account-setup imap-features mail-notification mark-all-read plugin-manager profiler sa-junk-plugin save-calendar subject-thread $TNEF_ATTACHMENTS vcard-inline webdav-account-setup"
|
||||
enable_plugins="attachment-reminder addressbook-file audio-inline bbdb bogo-junk-plugin caldav calendar-file calendar-http default-source external-editor google-account-setup hula-account-setup imap-features mail-notification mark-all-read plugin-manager profiler sa-junk-plugin save-calendar subject-thread $TNEF_ATTACHMENTS vcard-inline webdav-account-setup"
|
||||
|
||||
dnl PLUGINS NOT BUILDING YET
|
||||
dnl ------------------------
|
||||
@ -2132,7 +2132,6 @@ plugins/caldav/Makefile
|
||||
plugins/calendar-file/Makefile
|
||||
plugins/calendar-http/Makefile
|
||||
plugins/calendar-weather/Makefile
|
||||
plugins/copy-tool/Makefile
|
||||
plugins/default-mailer/Makefile
|
||||
plugins/default-source/Makefile
|
||||
plugins/email-custom-header/Makefile
|
||||
|
||||
@ -21,10 +21,14 @@
|
||||
|
||||
#include "e-mail-display.h"
|
||||
|
||||
#include <config.h>
|
||||
#include <string.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include "e-util/e-util.h"
|
||||
#include "e-util/e-plugin-ui.h"
|
||||
#include "mail/em-composer-utils.h"
|
||||
#include "mail/em-utils.h"
|
||||
|
||||
#define E_MAIL_DISPLAY_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE \
|
||||
@ -32,13 +36,16 @@
|
||||
|
||||
struct _EMailDisplayPrivate {
|
||||
EMFormatHTML *formatter;
|
||||
GtkUIManager *ui_manager;
|
||||
gchar *selected_uri;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_ANIMATE,
|
||||
PROP_CARET_MODE,
|
||||
PROP_FORMATTER
|
||||
PROP_FORMATTER,
|
||||
PROP_SELECTED_URI
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -50,6 +57,188 @@ enum {
|
||||
static gpointer parent_class;
|
||||
static guint signals[LAST_SIGNAL];
|
||||
|
||||
static const gchar *ui =
|
||||
"<ui>"
|
||||
" <popup name='context'>"
|
||||
" <menuitem action='http-open'/>"
|
||||
" <menuitem action='send-message'/>"
|
||||
" <menuitem action='uri-copy'/>"
|
||||
" <menuitem action='add-to-address-book'/>"
|
||||
" <menuitem action='mailto-copy'/>"
|
||||
" <menu action='search-folder-menu'>"
|
||||
" <menuitem action='search-folder-sender'/>"
|
||||
" <menuitem action='search-folder-recipient'/>"
|
||||
" </menu>"
|
||||
" </popup>"
|
||||
"</ui>";
|
||||
|
||||
static void
|
||||
action_add_to_address_book_cb (GtkAction *action,
|
||||
EMailDisplay *display)
|
||||
{
|
||||
CamelURL *curl;
|
||||
const gchar *uri;
|
||||
gpointer parent;
|
||||
|
||||
parent = gtk_widget_get_toplevel (GTK_WIDGET (display));
|
||||
parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL;
|
||||
|
||||
uri = e_mail_display_get_selected_uri (display);
|
||||
g_return_if_fail (uri != NULL);
|
||||
|
||||
/* This should work because we checked it in update_actions(). */
|
||||
curl = camel_url_new (uri, NULL);
|
||||
g_return_if_fail (curl != NULL);
|
||||
|
||||
if (curl->path != NULL && *curl->path != '\0')
|
||||
em_utils_add_address (parent, curl->path);
|
||||
|
||||
camel_url_free (curl);
|
||||
}
|
||||
|
||||
static void
|
||||
action_http_open_cb (GtkAction *action,
|
||||
EMailDisplay *display)
|
||||
{
|
||||
const gchar *uri;
|
||||
gpointer parent;
|
||||
|
||||
parent = gtk_widget_get_toplevel (GTK_WIDGET (display));
|
||||
parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL;
|
||||
|
||||
uri = e_mail_display_get_selected_uri (display);
|
||||
g_return_if_fail (uri != NULL);
|
||||
|
||||
e_show_uri (parent, uri);
|
||||
}
|
||||
|
||||
static void
|
||||
action_mailto_copy_cb (GtkAction *action,
|
||||
EMailDisplay *display)
|
||||
{
|
||||
CamelURL *curl;
|
||||
CamelInternetAddress *inet_addr;
|
||||
GtkClipboard *clipboard;
|
||||
const gchar *uri;
|
||||
gchar *text;
|
||||
|
||||
clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
|
||||
uri = e_mail_display_get_selected_uri (display);
|
||||
g_return_if_fail (uri != NULL);
|
||||
|
||||
/* This should work because we checked it in update_actions(). */
|
||||
curl = camel_url_new (uri, NULL);
|
||||
g_return_if_fail (curl != NULL);
|
||||
|
||||
inet_addr = camel_internet_address_new ();
|
||||
camel_address_decode (CAMEL_ADDRESS (inet_addr), curl->path);
|
||||
text = camel_address_encode (CAMEL_ADDRESS (inet_addr));
|
||||
if (text == NULL || *text == '\0')
|
||||
text = g_strdup (uri + strlen ("mailto:"));
|
||||
|
||||
camel_object_unref (inet_addr);
|
||||
camel_url_free (curl);
|
||||
|
||||
gtk_clipboard_set_text (clipboard, text, -1);
|
||||
gtk_clipboard_store (clipboard);
|
||||
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
static void
|
||||
action_send_message_cb (GtkAction *action,
|
||||
EMailDisplay *display)
|
||||
{
|
||||
const gchar *uri;
|
||||
|
||||
uri = e_mail_display_get_selected_uri (display);
|
||||
g_return_if_fail (uri != NULL);
|
||||
|
||||
em_utils_compose_new_message_with_mailto (uri, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
action_uri_copy_cb (GtkAction *action,
|
||||
EMailDisplay *display)
|
||||
{
|
||||
GtkClipboard *clipboard;
|
||||
const gchar *uri;
|
||||
|
||||
clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
|
||||
uri = e_mail_display_get_selected_uri (display);
|
||||
g_return_if_fail (uri != NULL);
|
||||
|
||||
gtk_clipboard_set_text (clipboard, uri, -1);
|
||||
gtk_clipboard_store (clipboard);
|
||||
}
|
||||
|
||||
static GtkActionEntry uri_entries[] = {
|
||||
|
||||
{ "uri-copy",
|
||||
GTK_STOCK_COPY,
|
||||
N_("_Copy Link Location"),
|
||||
NULL,
|
||||
NULL, /* XXX Add a tooltip! */
|
||||
G_CALLBACK (action_uri_copy_cb) },
|
||||
};
|
||||
|
||||
static GtkActionEntry http_entries[] = {
|
||||
|
||||
{ "http-open",
|
||||
"emblem-web",
|
||||
N_("_Open Link in Browser"),
|
||||
NULL,
|
||||
NULL, /* XXX Add a tooltip! */
|
||||
G_CALLBACK (action_http_open_cb) },
|
||||
};
|
||||
|
||||
static GtkActionEntry mailto_entries[] = {
|
||||
|
||||
{ "add-to-address-book",
|
||||
"contact-new",
|
||||
N_("_Add to Address Book"),
|
||||
NULL,
|
||||
NULL, /* XXX Add a tooltip! */
|
||||
G_CALLBACK (action_add_to_address_book_cb) },
|
||||
|
||||
{ "mailto-copy",
|
||||
GTK_STOCK_COPY,
|
||||
N_("_Copy Email Address"),
|
||||
NULL,
|
||||
NULL, /* XXX Add a tooltip! */
|
||||
G_CALLBACK (action_mailto_copy_cb) },
|
||||
|
||||
{ "search-folder-recipient",
|
||||
NULL,
|
||||
N_("_To This Address"),
|
||||
NULL,
|
||||
NULL, /* XXX Add a tooltip! */
|
||||
NULL /* Handled by EMailReader */ },
|
||||
|
||||
{ "search-folder-sender",
|
||||
NULL,
|
||||
N_("_From This Address"),
|
||||
NULL,
|
||||
NULL, /* XXX Add a tooltip! */
|
||||
NULL /* Handled by EMailReader */ },
|
||||
|
||||
{ "send-message",
|
||||
"mail-message-new",
|
||||
N_("_Send New Message To..."),
|
||||
NULL,
|
||||
NULL, /* XXX Add a tooltip! */
|
||||
G_CALLBACK (action_send_message_cb) },
|
||||
|
||||
/*** Menus ***/
|
||||
|
||||
{ "search-folder-menu",
|
||||
"folder-saved-search",
|
||||
N_("Create Search _Folder"),
|
||||
NULL,
|
||||
NULL,
|
||||
NULL }
|
||||
};
|
||||
|
||||
static gboolean
|
||||
mail_display_emit_popup_event (EMailDisplay *display,
|
||||
GdkEventButton *event,
|
||||
@ -78,16 +267,15 @@ mail_display_emit_status_message (EMailDisplay *display,
|
||||
static void
|
||||
mail_display_get_uri_puri (EMailDisplay *display,
|
||||
GdkEventButton *event,
|
||||
GtkHTML *html,
|
||||
gchar **uri,
|
||||
EMFormatPURI **puri)
|
||||
{
|
||||
EMFormat *formatter;
|
||||
GtkHTML *html;
|
||||
gchar *text_uri;
|
||||
gchar *image_uri;
|
||||
gboolean is_cid;
|
||||
|
||||
html = GTK_HTML (display);
|
||||
formatter = EM_FORMAT (display->priv->formatter);
|
||||
|
||||
if (event != NULL) {
|
||||
@ -107,7 +295,7 @@ mail_display_get_uri_puri (EMailDisplay *display,
|
||||
|
||||
temp = g_strconcat ("file://", image_uri, NULL);
|
||||
g_free (image_uri);
|
||||
temp = image_uri;
|
||||
image_uri = temp;
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,6 +327,35 @@ mail_display_get_uri_puri (EMailDisplay *display,
|
||||
g_free (image_uri);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
mail_display_button_press_event_cb (EMailDisplay *display,
|
||||
GdkEventButton *event,
|
||||
GtkHTML *html)
|
||||
{
|
||||
EMFormatPURI *puri = NULL;
|
||||
gboolean finished = TRUE;
|
||||
gchar *uri = NULL;
|
||||
|
||||
/* The GtkHTML object may be the EMailDisplay itself
|
||||
* or an inner iframe. */
|
||||
|
||||
if (event->button != 3)
|
||||
return FALSE;
|
||||
|
||||
mail_display_get_uri_puri (display, event, html, &uri, &puri);
|
||||
|
||||
if (uri == NULL || g_str_has_prefix (uri, "##")) {
|
||||
g_free (uri);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
finished = mail_display_emit_popup_event (display, event, uri, puri);
|
||||
|
||||
g_free (uri);
|
||||
|
||||
return finished;
|
||||
}
|
||||
|
||||
static void
|
||||
mail_display_update_formatter_colors (EMailDisplay *display)
|
||||
{
|
||||
@ -204,6 +421,12 @@ mail_display_set_property (GObject *object,
|
||||
E_MAIL_DISPLAY (object),
|
||||
g_value_get_object (value));
|
||||
return;
|
||||
|
||||
case PROP_SELECTED_URI:
|
||||
e_mail_display_set_selected_uri (
|
||||
E_MAIL_DISPLAY (object),
|
||||
g_value_get_string (value));
|
||||
return;
|
||||
}
|
||||
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
@ -233,6 +456,12 @@ mail_display_get_property (GObject *object,
|
||||
value, e_mail_display_get_formatter (
|
||||
E_MAIL_DISPLAY (object)));
|
||||
return;
|
||||
|
||||
case PROP_SELECTED_URI:
|
||||
g_value_set_string (
|
||||
value, e_mail_display_get_selected_uri (
|
||||
E_MAIL_DISPLAY (object)));
|
||||
return;
|
||||
}
|
||||
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
@ -250,6 +479,11 @@ mail_display_dispose (GObject *object)
|
||||
priv->formatter = NULL;
|
||||
}
|
||||
|
||||
if (priv->ui_manager) {
|
||||
g_object_unref (priv->ui_manager);
|
||||
priv->ui_manager = NULL;
|
||||
}
|
||||
|
||||
/* Chain up to parent's dispose() method. */
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
@ -282,24 +516,11 @@ static gboolean
|
||||
mail_display_button_press_event (GtkWidget *widget,
|
||||
GdkEventButton *event)
|
||||
{
|
||||
if (event->button == 3) {
|
||||
EMailDisplay *display;
|
||||
EMFormatPURI *puri = NULL;
|
||||
gboolean stop_handlers = TRUE;
|
||||
gchar *uri = NULL;
|
||||
EMailDisplay *display = E_MAIL_DISPLAY (widget);
|
||||
GtkHTML *html = GTK_HTML (widget);
|
||||
|
||||
display = E_MAIL_DISPLAY (widget);
|
||||
mail_display_get_uri_puri (display, event, &uri, &puri);
|
||||
|
||||
if (uri == NULL || !g_str_has_prefix (uri, "##"))
|
||||
stop_handlers = mail_display_emit_popup_event (
|
||||
display, event, uri, puri);
|
||||
|
||||
g_free (uri);
|
||||
|
||||
if (stop_handlers)
|
||||
return TRUE;
|
||||
}
|
||||
if (mail_display_button_press_event_cb (display, event, html))
|
||||
return TRUE;
|
||||
|
||||
/* Chain up to parent's button_press_event() method. */
|
||||
return GTK_WIDGET_CLASS (parent_class)->
|
||||
@ -437,7 +658,19 @@ mail_display_iframe_created (GtkHTML *html,
|
||||
{
|
||||
g_signal_connect_swapped (
|
||||
iframe, "button-press-event",
|
||||
G_CALLBACK (mail_display_button_press_event), html);
|
||||
G_CALLBACK (mail_display_button_press_event_cb), html);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
mail_display_popup_event (EMailDisplay *display,
|
||||
GdkEventButton *event,
|
||||
const gchar *uri,
|
||||
EMFormatPURI *puri)
|
||||
{
|
||||
e_mail_display_set_selected_uri (display, uri);
|
||||
e_mail_display_show_popup_menu (display, event, NULL, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -466,6 +699,8 @@ mail_display_class_init (EMailDisplayClass *class)
|
||||
html_class->on_url = mail_display_on_url;
|
||||
html_class->iframe_created = mail_display_iframe_created;
|
||||
|
||||
class->popup_event = mail_display_popup_event;
|
||||
|
||||
g_object_class_install_property (
|
||||
object_class,
|
||||
PROP_ANIMATE,
|
||||
@ -496,6 +731,16 @@ mail_display_class_init (EMailDisplayClass *class)
|
||||
EM_TYPE_FORMAT_HTML,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (
|
||||
object_class,
|
||||
PROP_SELECTED_URI,
|
||||
g_param_spec_string (
|
||||
"selected-uri",
|
||||
"Selected URI",
|
||||
NULL,
|
||||
NULL,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
signals[POPUP_EVENT] = g_signal_new (
|
||||
"popup-event",
|
||||
G_TYPE_FROM_CLASS (class),
|
||||
@ -522,7 +767,44 @@ mail_display_class_init (EMailDisplayClass *class)
|
||||
static void
|
||||
mail_display_init (EMailDisplay *display)
|
||||
{
|
||||
GtkUIManager *ui_manager;
|
||||
GtkActionGroup *action_group;
|
||||
const gchar *id;
|
||||
GError *error = NULL;
|
||||
|
||||
display->priv = E_MAIL_DISPLAY_GET_PRIVATE (display);
|
||||
|
||||
ui_manager = gtk_ui_manager_new ();
|
||||
display->priv->ui_manager = ui_manager;
|
||||
|
||||
action_group = e_mail_display_add_action_group (display, "uri");
|
||||
|
||||
gtk_action_group_add_actions (
|
||||
action_group, uri_entries,
|
||||
G_N_ELEMENTS (uri_entries), display);
|
||||
|
||||
action_group = e_mail_display_add_action_group (display, "http");
|
||||
|
||||
gtk_action_group_add_actions (
|
||||
action_group, http_entries,
|
||||
G_N_ELEMENTS (http_entries), display);
|
||||
|
||||
action_group = e_mail_display_add_action_group (display, "mailto");
|
||||
|
||||
gtk_action_group_add_actions (
|
||||
action_group, mailto_entries,
|
||||
G_N_ELEMENTS (mailto_entries), display);
|
||||
|
||||
/* Because we are loading from a hard-coded string, there is
|
||||
* no chance of I/O errors. Failure here implies a malformed
|
||||
* UI definition. Full stop. */
|
||||
gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error);
|
||||
if (error != NULL)
|
||||
g_error ("%s", error->message);
|
||||
|
||||
id = "org.gnome.evolution.mail.display";
|
||||
e_plugin_ui_register_manager (ui_manager, id, display);
|
||||
e_plugin_ui_enable_manager (ui_manager, id);
|
||||
}
|
||||
|
||||
GType
|
||||
@ -625,3 +907,166 @@ e_mail_display_set_formatter (EMailDisplay *display,
|
||||
|
||||
g_object_notify (G_OBJECT (display), "formatter");
|
||||
}
|
||||
|
||||
const gchar *
|
||||
e_mail_display_get_selected_uri (EMailDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (E_IS_MAIL_DISPLAY (display), NULL);
|
||||
|
||||
return display->priv->selected_uri;
|
||||
}
|
||||
|
||||
void
|
||||
e_mail_display_set_selected_uri (EMailDisplay *display,
|
||||
const gchar *selected_uri)
|
||||
{
|
||||
g_return_if_fail (E_IS_MAIL_DISPLAY (display));
|
||||
|
||||
g_free (display->priv->selected_uri);
|
||||
display->priv->selected_uri = g_strdup (selected_uri);
|
||||
|
||||
g_object_notify (G_OBJECT (display), "selected-uri");
|
||||
}
|
||||
|
||||
GtkAction *
|
||||
e_mail_display_get_action (EMailDisplay *display,
|
||||
const gchar *action_name)
|
||||
{
|
||||
GtkUIManager *ui_manager;
|
||||
|
||||
g_return_val_if_fail (E_IS_MAIL_DISPLAY (display), NULL);
|
||||
g_return_val_if_fail (action_name != NULL, NULL);
|
||||
|
||||
ui_manager = e_mail_display_get_ui_manager (display);
|
||||
|
||||
return e_lookup_action (ui_manager, action_name);
|
||||
}
|
||||
|
||||
GtkActionGroup *
|
||||
e_mail_display_add_action_group (EMailDisplay *display,
|
||||
const gchar *group_name)
|
||||
{
|
||||
GtkActionGroup *action_group;
|
||||
GtkUIManager *ui_manager;
|
||||
const gchar *domain;
|
||||
|
||||
g_return_val_if_fail (E_IS_MAIL_DISPLAY (display), NULL);
|
||||
g_return_val_if_fail (group_name != NULL, NULL);
|
||||
|
||||
ui_manager = e_mail_display_get_ui_manager (display);
|
||||
domain = GETTEXT_PACKAGE;
|
||||
|
||||
action_group = gtk_action_group_new (group_name);
|
||||
gtk_action_group_set_translation_domain (action_group, domain);
|
||||
gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
|
||||
g_object_unref (action_group);
|
||||
|
||||
return action_group;
|
||||
}
|
||||
|
||||
GtkActionGroup *
|
||||
e_mail_display_get_action_group (EMailDisplay *display,
|
||||
const gchar *group_name)
|
||||
{
|
||||
GtkUIManager *ui_manager;
|
||||
|
||||
g_return_val_if_fail (E_IS_MAIL_DISPLAY (display), NULL);
|
||||
g_return_val_if_fail (group_name != NULL, NULL);
|
||||
|
||||
ui_manager = e_mail_display_get_ui_manager (display);
|
||||
|
||||
return e_lookup_action_group (ui_manager, group_name);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
e_mail_display_get_popup_menu (EMailDisplay *display)
|
||||
{
|
||||
GtkUIManager *ui_manager;
|
||||
GtkWidget *menu;
|
||||
|
||||
g_return_val_if_fail (E_IS_MAIL_DISPLAY (display), NULL);
|
||||
|
||||
ui_manager = e_mail_display_get_ui_manager (display);
|
||||
menu = gtk_ui_manager_get_widget (ui_manager, "/context");
|
||||
g_return_val_if_fail (GTK_IS_MENU (menu), NULL);
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
GtkUIManager *
|
||||
e_mail_display_get_ui_manager (EMailDisplay *display)
|
||||
{
|
||||
EMailDisplayPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (E_IS_MAIL_DISPLAY (display), NULL);
|
||||
|
||||
priv = E_MAIL_DISPLAY_GET_PRIVATE (display);
|
||||
|
||||
return priv->ui_manager;
|
||||
}
|
||||
|
||||
void
|
||||
e_mail_display_show_popup_menu (EMailDisplay *display,
|
||||
GdkEventButton *event,
|
||||
GtkMenuPositionFunc func,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
|
||||
g_return_if_fail (E_IS_MAIL_DISPLAY (display));
|
||||
|
||||
e_mail_display_update_actions (display);
|
||||
|
||||
menu = e_mail_display_get_popup_menu (display);
|
||||
|
||||
if (event != NULL)
|
||||
gtk_menu_popup (
|
||||
GTK_MENU (menu), NULL, NULL, func,
|
||||
user_data, event->button, event->time);
|
||||
else
|
||||
gtk_menu_popup (
|
||||
GTK_MENU (menu), NULL, NULL, func,
|
||||
user_data, 0, gtk_get_current_event_time ());
|
||||
}
|
||||
|
||||
void
|
||||
e_mail_display_update_actions (EMailDisplay *display)
|
||||
{
|
||||
CamelURL *curl;
|
||||
GtkActionGroup *action_group;
|
||||
gboolean scheme_is_http;
|
||||
gboolean scheme_is_mailto;
|
||||
gboolean uri_is_valid;
|
||||
gboolean visible;
|
||||
const gchar *uri;
|
||||
|
||||
g_return_if_fail (E_IS_MAIL_DISPLAY (display));
|
||||
|
||||
uri = e_mail_display_get_selected_uri (display);
|
||||
g_return_if_fail (uri != NULL);
|
||||
|
||||
/* Parse the URI early so we know if the actions will work. */
|
||||
curl = camel_url_new (uri, NULL);
|
||||
uri_is_valid = (curl != NULL);
|
||||
camel_url_free (curl);
|
||||
|
||||
scheme_is_http =
|
||||
(g_ascii_strncasecmp (uri, "http:", 5) == 0) ||
|
||||
(g_ascii_strncasecmp (uri, "https:", 6) == 0);
|
||||
|
||||
scheme_is_mailto =
|
||||
(g_ascii_strncasecmp (uri, "mailto:", 7) == 0);
|
||||
|
||||
/* Allow copying the URI even if it's malformed. */
|
||||
visible = !scheme_is_mailto;
|
||||
action_group = e_mail_display_get_action_group (display, "uri");
|
||||
gtk_action_group_set_visible (action_group, visible);
|
||||
|
||||
visible = uri_is_valid && scheme_is_http;
|
||||
action_group = e_mail_display_get_action_group (display, "http");
|
||||
gtk_action_group_set_visible (action_group, visible);
|
||||
|
||||
visible = uri_is_valid && scheme_is_mailto;
|
||||
action_group = e_mail_display_get_action_group (display, "mailto");
|
||||
gtk_action_group_set_visible (action_group, visible);
|
||||
}
|
||||
|
||||
@ -77,6 +77,22 @@ void e_mail_display_set_caret_mode (EMailDisplay *display,
|
||||
EMFormatHTML * e_mail_display_get_formatter (EMailDisplay *display);
|
||||
void e_mail_display_set_formatter (EMailDisplay *display,
|
||||
EMFormatHTML *formatter);
|
||||
const gchar * e_mail_display_get_selected_uri (EMailDisplay *display);
|
||||
void e_mail_display_set_selected_uri (EMailDisplay *display,
|
||||
const gchar *uri);
|
||||
GtkAction * e_mail_display_get_action (EMailDisplay *display,
|
||||
const gchar *action_name);
|
||||
GtkActionGroup *e_mail_display_add_action_group (EMailDisplay *display,
|
||||
const gchar *group_name);
|
||||
GtkActionGroup *e_mail_display_get_action_group (EMailDisplay *display,
|
||||
const gchar *group_name);
|
||||
GtkWidget * e_mail_display_get_popup_menu (EMailDisplay *display);
|
||||
GtkUIManager * e_mail_display_get_ui_manager (EMailDisplay *display);
|
||||
void e_mail_display_show_popup_menu (EMailDisplay *display,
|
||||
GdkEventButton *event,
|
||||
GtkMenuPositionFunc func,
|
||||
gpointer user_data);
|
||||
void e_mail_display_update_actions (EMailDisplay *display);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
#include "widgets/misc/e-popup-action.h"
|
||||
|
||||
#include "mail/e-mail-browser.h"
|
||||
#include "mail/e-mail-display.h"
|
||||
#include "mail/e-mail-reader-utils.h"
|
||||
#include "mail/e-mail-shell-backend.h"
|
||||
#include "mail/em-composer-utils.h"
|
||||
@ -48,6 +49,7 @@
|
||||
#include "mail/mail-autofilter.h"
|
||||
#include "mail/mail-config.h"
|
||||
#include "mail/mail-ops.h"
|
||||
#include "mail/mail-vfolder.h"
|
||||
|
||||
enum {
|
||||
CHANGED,
|
||||
@ -941,38 +943,6 @@ action_mail_undelete_cb (GtkAction *action,
|
||||
e_mail_reader_mark_selected (reader, mask, set);
|
||||
}
|
||||
|
||||
static void
|
||||
action_mail_uri_copy_cb (GtkAction *action,
|
||||
EMailReader *reader)
|
||||
{
|
||||
/* FIXME */
|
||||
g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action)));
|
||||
}
|
||||
|
||||
static void
|
||||
action_mail_uri_copy_address_cb (GtkAction *action,
|
||||
EMailReader *reader)
|
||||
{
|
||||
/* FIXME */
|
||||
g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action)));
|
||||
}
|
||||
|
||||
static void
|
||||
action_mail_uri_to_search_folder_recipient_cb (GtkAction *action,
|
||||
EMailReader *reader)
|
||||
{
|
||||
/* FIXME */
|
||||
g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action)));
|
||||
}
|
||||
|
||||
static void
|
||||
action_mail_uri_to_search_folder_sender_cb (GtkAction *action,
|
||||
EMailReader *reader)
|
||||
{
|
||||
/* FIXME */
|
||||
g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action)));
|
||||
}
|
||||
|
||||
static void
|
||||
action_mail_zoom_100_cb (GtkAction *action,
|
||||
EMailReader *reader)
|
||||
@ -1012,6 +982,88 @@ action_mail_zoom_out_cb (GtkAction *action,
|
||||
gtk_html_zoom_out (html);
|
||||
}
|
||||
|
||||
static void
|
||||
action_search_folder_recipient_cb (GtkAction *action,
|
||||
EMailReader *reader)
|
||||
{
|
||||
EMFormatHTMLDisplay *html_display;
|
||||
MessageList *message_list;
|
||||
EMailDisplay *display;
|
||||
CamelURL *curl;
|
||||
const gchar *uri;
|
||||
|
||||
/* This action is defined in EMailDisplay. */
|
||||
|
||||
html_display = e_mail_reader_get_html_display (reader);
|
||||
message_list = e_mail_reader_get_message_list (reader);
|
||||
|
||||
display = E_MAIL_DISPLAY (EM_FORMAT_HTML (html_display)->html);
|
||||
|
||||
uri = e_mail_display_get_selected_uri (display);
|
||||
g_return_if_fail (uri != NULL);
|
||||
|
||||
curl = camel_url_new (uri, NULL);
|
||||
g_return_if_fail (curl != NULL);
|
||||
|
||||
if (curl->path != NULL && *curl->path != '\0') {
|
||||
CamelInternetAddress *inet_addr;
|
||||
const gchar *folder_uri;
|
||||
|
||||
/* Ensure vfolder is running. */
|
||||
vfolder_load_storage ();
|
||||
|
||||
folder_uri = message_list->folder_uri;
|
||||
|
||||
inet_addr = camel_internet_address_new ();
|
||||
camel_address_decode (CAMEL_ADDRESS (inet_addr), curl->path);
|
||||
vfolder_gui_add_from_address (inet_addr, AUTO_TO, folder_uri);
|
||||
camel_object_unref (inet_addr);
|
||||
}
|
||||
|
||||
camel_url_free (curl);
|
||||
}
|
||||
|
||||
static void
|
||||
action_search_folder_sender_cb (GtkAction *action,
|
||||
EMailReader *reader)
|
||||
{
|
||||
EMFormatHTMLDisplay *html_display;
|
||||
MessageList *message_list;
|
||||
EMailDisplay *display;
|
||||
CamelURL *curl;
|
||||
const gchar *uri;
|
||||
|
||||
/* This action is defined in EMailDisplay. */
|
||||
|
||||
html_display = e_mail_reader_get_html_display (reader);
|
||||
message_list = e_mail_reader_get_message_list (reader);
|
||||
|
||||
display = E_MAIL_DISPLAY (EM_FORMAT_HTML (html_display)->html);
|
||||
|
||||
uri = e_mail_display_get_selected_uri (display);
|
||||
g_return_if_fail (uri != NULL);
|
||||
|
||||
curl = camel_url_new (uri, NULL);
|
||||
g_return_if_fail (curl != NULL);
|
||||
|
||||
if (curl->path != NULL && *curl->path != '\0') {
|
||||
CamelInternetAddress *inet_addr;
|
||||
const gchar *folder_uri;
|
||||
|
||||
/* Ensure vfolder is running. */
|
||||
vfolder_load_storage ();
|
||||
|
||||
folder_uri = message_list->folder_uri;
|
||||
|
||||
inet_addr = camel_internet_address_new ();
|
||||
camel_address_decode (CAMEL_ADDRESS (inet_addr), curl->path);
|
||||
vfolder_gui_add_from_address (inet_addr, AUTO_FROM, folder_uri);
|
||||
camel_object_unref (inet_addr);
|
||||
}
|
||||
|
||||
camel_url_free (curl);
|
||||
}
|
||||
|
||||
static GtkActionEntry mail_reader_entries[] = {
|
||||
|
||||
{ "mail-add-sender",
|
||||
@ -1371,34 +1423,6 @@ static GtkActionEntry mail_reader_entries[] = {
|
||||
N_("Undelete the selected messages"),
|
||||
G_CALLBACK (action_mail_undelete_cb) },
|
||||
|
||||
{ "mail-uri-copy",
|
||||
NULL,
|
||||
N_("_Copy Link Location"),
|
||||
NULL,
|
||||
NULL, /* XXX Add a tooltip! */
|
||||
G_CALLBACK (action_mail_uri_copy_cb) },
|
||||
|
||||
{ "mail-uri-copy-address",
|
||||
GTK_STOCK_COPY,
|
||||
N_("Copy _Email Address"),
|
||||
NULL,
|
||||
NULL, /* XXX Add a tooltip! */
|
||||
G_CALLBACK (action_mail_uri_copy_address_cb) },
|
||||
|
||||
{ "mail-uri-to-search-folder-recipient",
|
||||
NULL,
|
||||
N_("_To This Address"),
|
||||
NULL,
|
||||
NULL, /* XXX Add a tooltip! */
|
||||
G_CALLBACK (action_mail_uri_to_search_folder_recipient_cb) },
|
||||
|
||||
{ "mail-uri-to-search-folder-sender",
|
||||
NULL,
|
||||
N_("_From This Address"),
|
||||
NULL,
|
||||
NULL, /* XXX Add a tooltip! */
|
||||
G_CALLBACK (action_mail_uri_to_search_folder_sender_cb) },
|
||||
|
||||
{ "mail-zoom-100",
|
||||
GTK_STOCK_ZOOM_100,
|
||||
N_("_Normal Size"),
|
||||
@ -1464,13 +1488,6 @@ static GtkActionEntry mail_reader_entries[] = {
|
||||
NULL,
|
||||
NULL },
|
||||
|
||||
{ "mail-uri-to-search-folder-menu",
|
||||
NULL,
|
||||
N_("Create _Search Folder"),
|
||||
NULL,
|
||||
NULL,
|
||||
NULL },
|
||||
|
||||
{ "mail-zoom-menu",
|
||||
NULL,
|
||||
N_("_Zoom"),
|
||||
@ -1570,9 +1587,9 @@ static GtkToggleActionEntry mail_reader_toggle_entries[] = {
|
||||
};
|
||||
|
||||
static gboolean
|
||||
mail_reader_html_button_release_event_cb (EMailReader *reader,
|
||||
GdkEventButton *button,
|
||||
GtkHTML *html)
|
||||
mail_reader_button_release_event_cb (EMailReader *reader,
|
||||
GdkEventButton *button,
|
||||
GtkHTML *html)
|
||||
{
|
||||
GtkAction *action;
|
||||
const gchar *action_name;
|
||||
@ -1984,11 +2001,11 @@ e_mail_reader_init (EMailReader *reader)
|
||||
EShellBackend *shell_backend;
|
||||
EShellSettings *shell_settings;
|
||||
EMFormatHTMLDisplay *html_display;
|
||||
EMailDisplay *display;
|
||||
GtkActionGroup *action_group;
|
||||
MessageList *message_list;
|
||||
GConfBridge *bridge;
|
||||
GtkAction *action;
|
||||
GtkHTML *html;
|
||||
const gchar *action_name;
|
||||
const gchar *key;
|
||||
|
||||
@ -2002,7 +2019,7 @@ e_mail_reader_init (EMailReader *reader)
|
||||
shell = e_shell_backend_get_shell (shell_backend);
|
||||
shell_settings = e_shell_get_shell_settings (shell);
|
||||
|
||||
html = EM_FORMAT_HTML (html_display)->html;
|
||||
display = E_MAIL_DISPLAY (EM_FORMAT_HTML (html_display)->html);
|
||||
|
||||
gtk_action_group_add_actions (
|
||||
action_group, mail_reader_entries,
|
||||
@ -2052,6 +2069,18 @@ e_mail_reader_init (EMailReader *reader)
|
||||
action = e_mail_reader_get_action (reader, action_name);
|
||||
g_object_set (action, "short-label", _("Reply"), NULL);
|
||||
|
||||
action_name = "search-folder-recipient";
|
||||
action = e_mail_display_get_action (display, action_name);
|
||||
g_signal_connect (
|
||||
action, "activate",
|
||||
G_CALLBACK (action_search_folder_recipient_cb), reader);
|
||||
|
||||
action_name = "search-folder-sender";
|
||||
action = e_mail_display_get_action (display, action_name);
|
||||
g_signal_connect (
|
||||
action, "activate",
|
||||
G_CALLBACK (action_search_folder_sender_cb), reader);
|
||||
|
||||
/* Bind properties. */
|
||||
|
||||
e_binding_new_full (
|
||||
@ -2070,7 +2099,7 @@ e_mail_reader_init (EMailReader *reader)
|
||||
|
||||
e_binding_new (
|
||||
G_OBJECT (shell_settings), "mail-show-animated-images",
|
||||
G_OBJECT (html), "animate");
|
||||
G_OBJECT (display), "animate");
|
||||
|
||||
e_binding_new (
|
||||
G_OBJECT (shell_settings), "mail-show-sender-photo",
|
||||
@ -2081,16 +2110,16 @@ e_mail_reader_init (EMailReader *reader)
|
||||
|
||||
e_mutual_binding_new (
|
||||
G_OBJECT (action), "active",
|
||||
G_OBJECT (html), "caret-mode");
|
||||
G_OBJECT (display), "caret-mode");
|
||||
|
||||
/* Connect signals. */
|
||||
|
||||
g_signal_connect_swapped (
|
||||
html, "button-release-event",
|
||||
G_CALLBACK (mail_reader_html_button_release_event_cb), reader);
|
||||
display, "button-release-event",
|
||||
G_CALLBACK (mail_reader_button_release_event_cb), reader);
|
||||
|
||||
g_signal_connect_swapped (
|
||||
html, "key-press-event",
|
||||
display, "key-press-event",
|
||||
G_CALLBACK (mail_reader_key_press_event_cb), reader);
|
||||
|
||||
g_signal_connect_swapped (
|
||||
|
||||
@ -852,27 +852,27 @@ static BonoboUIVerb emfb_verbs[] = {
|
||||
BONOBO_UI_VERB_END
|
||||
};
|
||||
|
||||
static gboolean
|
||||
emfb_select_all_daemon (MessageList *ml)
|
||||
{
|
||||
message_list_select_all(ml);
|
||||
gtk_widget_grab_focus ((GtkWidget *)ml);
|
||||
return FALSE;
|
||||
}
|
||||
//static gboolean
|
||||
//emfb_select_all_daemon (MessageList *ml)
|
||||
//{
|
||||
// message_list_select_all(ml);
|
||||
// gtk_widget_grab_focus ((GtkWidget *)ml);
|
||||
// return FALSE;
|
||||
//}
|
||||
|
||||
static void
|
||||
emfb_hide_deleted(BonoboUIComponent *uic, const gchar *path, Bonobo_UIComponent_EventType type, const gchar *state, gpointer data)
|
||||
{
|
||||
GConfClient *gconf;
|
||||
EMFolderView *emfv = data;
|
||||
|
||||
if (type != Bonobo_UIComponent_STATE_CHANGED)
|
||||
return;
|
||||
|
||||
gconf = mail_config_get_gconf_client ();
|
||||
gconf_client_set_bool(gconf, "/apps/evolution/mail/display/show_deleted", state[0] == '0', NULL);
|
||||
em_folder_view_set_hide_deleted(emfv, state[0] != '0');
|
||||
}
|
||||
//static void
|
||||
//emfb_hide_deleted(BonoboUIComponent *uic, const gchar *path, Bonobo_UIComponent_EventType type, const gchar *state, gpointer data)
|
||||
//{
|
||||
// GConfClient *gconf;
|
||||
// EMFolderView *emfv = data;
|
||||
//
|
||||
// if (type != Bonobo_UIComponent_STATE_CHANGED)
|
||||
// return;
|
||||
//
|
||||
// gconf = mail_config_get_gconf_client ();
|
||||
// gconf_client_set_bool(gconf, "/apps/evolution/mail/display/show_deleted", state[0] == '0', NULL);
|
||||
// em_folder_view_set_hide_deleted(emfv, state[0] != '0');
|
||||
//}
|
||||
|
||||
static void
|
||||
emfb_set_search_folder(EMFolderView *emfv, CamelFolder *folder, const gchar *uri)
|
||||
@ -1057,16 +1057,16 @@ emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, gint act)
|
||||
state = mail_msg_active((unsigned int)-1);
|
||||
bonobo_ui_component_set_prop(uic, "/commands/MailStop", "sensitive", state?"1":"0", NULL);
|
||||
|
||||
/* HideDeleted */
|
||||
state = !gconf_client_get_bool(gconf, "/apps/evolution/mail/display/show_deleted", NULL);
|
||||
if (emfv->folder && (emfv->folder->folder_flags & CAMEL_FOLDER_IS_TRASH)) {
|
||||
state = FALSE;
|
||||
bonobo_ui_component_set_prop(uic, "/commands/HideDeleted", "sensitive", "0", NULL);
|
||||
} else
|
||||
bonobo_ui_component_set_prop(uic, "/commands/HideDeleted", "sensitive", "1", NULL);
|
||||
bonobo_ui_component_set_prop(uic, "/commands/HideDeleted", "state", state ? "1" : "0", NULL);
|
||||
bonobo_ui_component_add_listener(uic, "HideDeleted", emfb_hide_deleted, emfv);
|
||||
em_folder_view_set_hide_deleted(emfv, state); /* <- not sure if this optimal, but it'll do */
|
||||
// /* HideDeleted */
|
||||
// state = !gconf_client_get_bool(gconf, "/apps/evolution/mail/display/show_deleted", NULL);
|
||||
// if (emfv->folder && (emfv->folder->folder_flags & CAMEL_FOLDER_IS_TRASH)) {
|
||||
// state = FALSE;
|
||||
// bonobo_ui_component_set_prop(uic, "/commands/HideDeleted", "sensitive", "0", NULL);
|
||||
// } else
|
||||
// bonobo_ui_component_set_prop(uic, "/commands/HideDeleted", "sensitive", "1", NULL);
|
||||
// bonobo_ui_component_set_prop(uic, "/commands/HideDeleted", "state", state ? "1" : "0", NULL);
|
||||
// bonobo_ui_component_add_listener(uic, "HideDeleted", emfb_hide_deleted, emfv);
|
||||
// em_folder_view_set_hide_deleted(emfv, state); /* <- not sure if this optimal, but it'll do */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -243,11 +243,11 @@ emfv_init(GObject *o)
|
||||
//#ifdef ENABLE_PROFILING
|
||||
// g_signal_connect(emfv->preview, "complete", G_CALLBACK (emfv_format_complete), emfv);
|
||||
//#endif
|
||||
p->invisible = gtk_invisible_new();
|
||||
g_signal_connect(p->invisible, "selection_get", G_CALLBACK(emfv_selection_get), emfv);
|
||||
g_signal_connect(p->invisible, "selection_clear_event", G_CALLBACK(emfv_selection_clear_event), emfv);
|
||||
gtk_selection_add_target(p->invisible, GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 0);
|
||||
gtk_selection_add_target(p->invisible, GDK_SELECTION_CLIPBOARD, GDK_SELECTION_TYPE_STRING, 1);
|
||||
// p->invisible = gtk_invisible_new();
|
||||
// g_signal_connect(p->invisible, "selection_get", G_CALLBACK(emfv_selection_get), emfv);
|
||||
// g_signal_connect(p->invisible, "selection_clear_event", G_CALLBACK(emfv_selection_clear_event), emfv);
|
||||
// gtk_selection_add_target(p->invisible, GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 0);
|
||||
// gtk_selection_add_target(p->invisible, GDK_SELECTION_CLIPBOARD, GDK_SELECTION_TYPE_STRING, 1);
|
||||
|
||||
emfv->async = mail_async_event_new();
|
||||
}
|
||||
@ -298,27 +298,27 @@ emfv_class_init(GObjectClass *klass)
|
||||
0);
|
||||
}
|
||||
|
||||
static void
|
||||
emfv_selection_get(GtkWidget *widget, GtkSelectionData *data, guint info, guint time_stamp, EMFolderView *emfv)
|
||||
{
|
||||
struct _EMFolderViewPrivate *p = emfv->priv;
|
||||
//static void
|
||||
//emfv_selection_get(GtkWidget *widget, GtkSelectionData *data, guint info, guint time_stamp, EMFolderView *emfv)
|
||||
//{
|
||||
// struct _EMFolderViewPrivate *p = emfv->priv;
|
||||
//
|
||||
// if (p->selection_uri == NULL)
|
||||
// return;
|
||||
//
|
||||
// gtk_selection_data_set(data, data->target, 8, (guchar *)p->selection_uri, strlen(p->selection_uri));
|
||||
//}
|
||||
|
||||
if (p->selection_uri == NULL)
|
||||
return;
|
||||
|
||||
gtk_selection_data_set(data, data->target, 8, (guchar *)p->selection_uri, strlen(p->selection_uri));
|
||||
}
|
||||
|
||||
static void
|
||||
emfv_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, EMFolderView *emfv)
|
||||
{
|
||||
#if 0 /* do i care? */
|
||||
struct _EMFolderViewPrivate *p = emfv->priv;
|
||||
|
||||
g_free(p->selection_uri);
|
||||
p->selection_uri = NULL;
|
||||
#endif
|
||||
}
|
||||
//static void
|
||||
//emfv_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, EMFolderView *emfv)
|
||||
//{
|
||||
//#if 0 /* do i care? */
|
||||
// struct _EMFolderViewPrivate *p = emfv->priv;
|
||||
//
|
||||
// g_free(p->selection_uri);
|
||||
// p->selection_uri = NULL;
|
||||
//#endif
|
||||
//}
|
||||
|
||||
/* ********************************************************************** */
|
||||
|
||||
@ -367,61 +367,61 @@ emfv_edit_paste(BonoboUIComponent *uid, gpointer data, const gchar *path)
|
||||
message_list_paste(emfv->list);
|
||||
}
|
||||
|
||||
static void
|
||||
emp_uri_popup_vfolder_sender(EPopup *ep, EPopupItem *pitem, gpointer data)
|
||||
{
|
||||
EMFolderView *emfv = data;
|
||||
EMPopupTargetURI *t = (EMPopupTargetURI *)ep->target;
|
||||
CamelURL *url;
|
||||
CamelInternetAddress *addr;
|
||||
|
||||
url = camel_url_new(t->uri, NULL);
|
||||
if (url == NULL) {
|
||||
g_warning("cannot parse url '%s'", t->uri);
|
||||
return;
|
||||
}
|
||||
|
||||
if (url->path && url->path[0]) {
|
||||
/* ensures vfolder is running */
|
||||
vfolder_load_storage ();
|
||||
|
||||
addr = camel_internet_address_new ();
|
||||
camel_address_decode (CAMEL_ADDRESS (addr), url->path);
|
||||
vfolder_gui_add_from_address (addr, AUTO_FROM, emfv->folder_uri);
|
||||
camel_object_unref (addr);
|
||||
}
|
||||
|
||||
camel_url_free(url);
|
||||
|
||||
}
|
||||
//static void
|
||||
//emp_uri_popup_vfolder_sender(EPopup *ep, EPopupItem *pitem, gpointer data)
|
||||
//{
|
||||
// EMFolderView *emfv = data;
|
||||
// EMPopupTargetURI *t = (EMPopupTargetURI *)ep->target;
|
||||
// CamelURL *url;
|
||||
// CamelInternetAddress *addr;
|
||||
//
|
||||
// url = camel_url_new(t->uri, NULL);
|
||||
// if (url == NULL) {
|
||||
// g_warning("cannot parse url '%s'", t->uri);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (url->path && url->path[0]) {
|
||||
// /* ensures vfolder is running */
|
||||
// vfolder_load_storage ();
|
||||
//
|
||||
// addr = camel_internet_address_new ();
|
||||
// camel_address_decode (CAMEL_ADDRESS (addr), url->path);
|
||||
// vfolder_gui_add_from_address (addr, AUTO_FROM, emfv->folder_uri);
|
||||
// camel_object_unref (addr);
|
||||
// }
|
||||
//
|
||||
// camel_url_free(url);
|
||||
//
|
||||
//}
|
||||
|
||||
|
||||
static void
|
||||
emp_uri_popup_vfolder_recipient(EPopup *ep, EPopupItem *pitem, gpointer data)
|
||||
{
|
||||
EMFolderView *emfv = data;
|
||||
EMPopupTargetURI *t = (EMPopupTargetURI *)ep->target;
|
||||
CamelURL *url;
|
||||
CamelInternetAddress *addr;
|
||||
|
||||
url = camel_url_new(t->uri, NULL);
|
||||
if (url == NULL) {
|
||||
g_warning("cannot parse url '%s'", t->uri);
|
||||
return;
|
||||
}
|
||||
|
||||
if (url->path && url->path[0]) {
|
||||
/* ensures vfolder is running */
|
||||
vfolder_load_storage ();
|
||||
|
||||
addr = camel_internet_address_new ();
|
||||
camel_address_decode (CAMEL_ADDRESS (addr), url->path);
|
||||
vfolder_gui_add_from_address (addr, AUTO_TO, emfv->folder_uri);
|
||||
camel_object_unref (addr);
|
||||
}
|
||||
|
||||
camel_url_free(url);
|
||||
}
|
||||
//static void
|
||||
//emp_uri_popup_vfolder_recipient(EPopup *ep, EPopupItem *pitem, gpointer data)
|
||||
//{
|
||||
// EMFolderView *emfv = data;
|
||||
// EMPopupTargetURI *t = (EMPopupTargetURI *)ep->target;
|
||||
// CamelURL *url;
|
||||
// CamelInternetAddress *addr;
|
||||
//
|
||||
// url = camel_url_new(t->uri, NULL);
|
||||
// if (url == NULL) {
|
||||
// g_warning("cannot parse url '%s'", t->uri);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (url->path && url->path[0]) {
|
||||
// /* ensures vfolder is running */
|
||||
// vfolder_load_storage ();
|
||||
//
|
||||
// addr = camel_internet_address_new ();
|
||||
// camel_address_decode (CAMEL_ADDRESS (addr), url->path);
|
||||
// vfolder_gui_add_from_address (addr, AUTO_TO, emfv->folder_uri);
|
||||
// camel_object_unref (addr);
|
||||
// }
|
||||
//
|
||||
// camel_url_free(url);
|
||||
//}
|
||||
|
||||
/* ********************************************************************** */
|
||||
|
||||
@ -744,25 +744,25 @@ emfv_popup_menu (GtkWidget *widget)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
emp_uri_popup_link_copy(EPopup *ep, EPopupItem *pitem, gpointer data)
|
||||
{
|
||||
EMFolderView *emfv = data;
|
||||
struct _EMFolderViewPrivate *p = emfv->priv;
|
||||
|
||||
g_free(p->selection_uri);
|
||||
p->selection_uri = em_utils_url_unescape_amp(pitem->user_data);
|
||||
|
||||
gtk_selection_owner_set(p->invisible, GDK_SELECTION_PRIMARY, gtk_get_current_event_time());
|
||||
gtk_selection_owner_set(p->invisible, GDK_SELECTION_CLIPBOARD, gtk_get_current_event_time());
|
||||
}
|
||||
//static void
|
||||
//emp_uri_popup_link_copy(EPopup *ep, EPopupItem *pitem, gpointer data)
|
||||
//{
|
||||
// EMFolderView *emfv = data;
|
||||
// struct _EMFolderViewPrivate *p = emfv->priv;
|
||||
//
|
||||
// g_free(p->selection_uri);
|
||||
// p->selection_uri = em_utils_url_unescape_amp(pitem->user_data);
|
||||
//
|
||||
// gtk_selection_owner_set(p->invisible, GDK_SELECTION_PRIMARY, gtk_get_current_event_time());
|
||||
// gtk_selection_owner_set(p->invisible, GDK_SELECTION_CLIPBOARD, gtk_get_current_event_time());
|
||||
//}
|
||||
|
||||
static EPopupItem emfv_uri_popups[] = {
|
||||
{ E_POPUP_ITEM, (gchar *) "00.uri.15", (gchar *) N_("_Copy Link Location"), emp_uri_popup_link_copy, NULL, (gchar *) "edit-copy", EM_POPUP_URI_NOT_MAILTO },
|
||||
// { E_POPUP_ITEM, (gchar *) "00.uri.15", (gchar *) N_("_Copy Link Location"), emp_uri_popup_link_copy, NULL, (gchar *) "edit-copy", EM_POPUP_URI_NOT_MAILTO },
|
||||
|
||||
{ E_POPUP_SUBMENU, (gchar *) "99.uri.00", (gchar *) N_("Create _Search Folder"), NULL, NULL, NULL, EM_POPUP_URI_MAILTO },
|
||||
{ E_POPUP_ITEM, (gchar *) "99.uri.00/00.10", (gchar *) N_("_From this Address"), emp_uri_popup_vfolder_sender, NULL, NULL, EM_POPUP_URI_MAILTO },
|
||||
{ E_POPUP_ITEM, (gchar *) "99.uri.00/00.00", (gchar *) N_("_To this Address"), emp_uri_popup_vfolder_recipient, NULL, NULL, EM_POPUP_URI_MAILTO },
|
||||
// { E_POPUP_SUBMENU, (gchar *) "99.uri.00", (gchar *) N_("Create _Search Folder"), NULL, NULL, NULL, EM_POPUP_URI_MAILTO },
|
||||
// { E_POPUP_ITEM, (gchar *) "99.uri.00/00.10", (gchar *) N_("_From this Address"), emp_uri_popup_vfolder_sender, NULL, NULL, EM_POPUP_URI_MAILTO },
|
||||
// { E_POPUP_ITEM, (gchar *) "99.uri.00/00.00", (gchar *) N_("_To this Address"), emp_uri_popup_vfolder_recipient, NULL, NULL, EM_POPUP_URI_MAILTO },
|
||||
};
|
||||
|
||||
static void
|
||||
|
||||
@ -1,67 +0,0 @@
|
||||
2008-08-27 Sankar P <psankar@novell.com>
|
||||
|
||||
License Changes
|
||||
|
||||
* copy-tool.c:
|
||||
|
||||
2008-08-12 Bharath Acharya <abharath@novell.com>
|
||||
|
||||
* Makefile.am: Use NO_UNDEFINED. Link with more libraries. To generate
|
||||
dlls on Windows.
|
||||
|
||||
2007-04-02 Sankar P <psankar@novell.com>
|
||||
|
||||
* Committed on behalf of Gilles Dartiguelongue <dartigug@esiee.fr>
|
||||
|
||||
* org-gnome-copy-tool.eplug.xml:
|
||||
Cleanup.
|
||||
Fixes part of #301149
|
||||
|
||||
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.
|
||||
|
||||
* copy-tool.c: (ct_selection_get): Removed printf() statement
|
||||
in order to avoid printing NULL point.
|
||||
(org_gnome_copy_tool_copy_address): Removed printf() statement.
|
||||
(ct_selection_clear_event): Removed printf() statement.
|
||||
|
||||
2005-05-11 Not Zed <NotZed@Ximian.com>
|
||||
|
||||
* Makefile.am: added built_sources/cleanfiles.
|
||||
|
||||
2005-05-06 Not Zed <NotZed@Ximian.com>
|
||||
|
||||
* Makefile.am:
|
||||
* org-gnome-copy-tool.eplug.xml: s/.in/.xml/ & i18n.
|
||||
|
||||
2005-02-24 Björn Torkelsson <torkel@acc.umu.se>
|
||||
|
||||
* org-gnome-copy-tool.eplug.in: Added a . to the end of description.
|
||||
|
||||
2004-11-03 Not Zed <NotZed@Ximian.com>
|
||||
|
||||
* org-gnome-copy-tool.eplug.in: gave it a better name and fixed
|
||||
the description and author tags.
|
||||
|
||||
2004-11-01 JP Rosevear <jpr@novell.com>
|
||||
|
||||
* Makefile.am: dist .eplug.in file
|
||||
|
||||
2004-10-28 Not Zed <NotZed@Ximian.com>
|
||||
|
||||
* org-gnome-copy-tool.eplug.in: fix folderview popup hook id.
|
||||
|
||||
2004-10-21 JP Rosevear <jpr@novell.com>
|
||||
|
||||
* org-gnome-copy-tool.eplug.in: s/image/icon/
|
||||
|
||||
2004-10-20 Not Zed <NotZed@Ximian.com>
|
||||
|
||||
* implemented a copy-utils plugin.
|
||||
|
||||
@ -1,20 +0,0 @@
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir) \
|
||||
$(EVOLUTION_MAIL_CFLAGS)
|
||||
|
||||
@EVO_PLUGIN_RULE@
|
||||
|
||||
plugin_DATA = org-gnome-copy-tool.eplug
|
||||
plugin_LTLIBRARIES = liborg-gnome-copy-tool.la
|
||||
|
||||
liborg_gnome_copy_tool_la_SOURCES = copy-tool.c
|
||||
liborg_gnome_copy_tool_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
|
||||
liborg_gnome_copy_tool_la_LIBADD = \
|
||||
$(EVOLUTION_MAIL_LIBS)
|
||||
|
||||
EXTRA_DIST = org-gnome-copy-tool.eplug.xml
|
||||
|
||||
BUILT_SOURCES = $(plugin_DATA)
|
||||
CLEANFILES = $(BUILT_SOURCES)
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
@ -1,71 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with the program; if not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*
|
||||
* Authors:
|
||||
* Michael Zucchi <notzed@novell.com>
|
||||
*
|
||||
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
|
||||
*
|
||||
*/
|
||||
|
||||
/* Add 'copy to clipboard' things to various menu's.
|
||||
|
||||
Uh, so far only to copy mail addresses from mail content */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mail/em-popup.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "camel/camel-internet-address.h"
|
||||
#include "camel/camel-url.h"
|
||||
|
||||
void org_gnome_copy_tool_copy_address(gpointer ep, EMPopupTargetURI *t);
|
||||
|
||||
void
|
||||
org_gnome_copy_tool_copy_address(gpointer ep, EMPopupTargetURI *t)
|
||||
{
|
||||
if (t->uri) {
|
||||
CamelInternetAddress *cia = camel_internet_address_new();
|
||||
CamelURL *curl;
|
||||
GtkClipboard *clipboard;
|
||||
gchar *addr;
|
||||
const gchar *tmp;
|
||||
|
||||
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 : t->uri + 7;
|
||||
|
||||
clipboard = gtk_clipboard_get (GDK_SELECTION_PRIMARY);
|
||||
|
||||
gtk_clipboard_set_text (clipboard, tmp, strlen (tmp));
|
||||
|
||||
clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
|
||||
gtk_clipboard_set_text (clipboard, tmp, strlen (tmp));
|
||||
|
||||
g_free(addr);
|
||||
camel_url_free(curl);
|
||||
camel_object_unref(cia);
|
||||
}
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<e-plugin-list>
|
||||
<e-plugin
|
||||
type="shlib"
|
||||
id="org.gnome.evolution.plugin.copyTool"
|
||||
location="@PLUGINDIR@/liborg-gnome-copy-tool@SOEXT@"
|
||||
_name="Copy Tool">
|
||||
<_description>Copy things to the clipboard.</_description>
|
||||
<author name="Michael Zucchi" email="notzed@ximian.com"/>
|
||||
|
||||
<!-- hook into the uri popup menu -->
|
||||
<hook class="org.gnome.evolution.mail.popup:1.0">
|
||||
<menu id="org.gnome.evolution.mail.folderview.popup" target="uri">
|
||||
<item
|
||||
type="item"
|
||||
path="80.test"
|
||||
icon="gtk-copy"
|
||||
_label="Copy _Email Address"
|
||||
visible="mailto"
|
||||
activate="org_gnome_copy_tool_copy_address"/>
|
||||
</menu>
|
||||
</hook>
|
||||
</e-plugin>
|
||||
</e-plugin-list>
|
||||
@ -133,12 +133,4 @@
|
||||
<menuitem action='mail-popup-print'/>
|
||||
</placeholder>
|
||||
</popup>
|
||||
<popup name='mail-uri-popup'>
|
||||
<menuitem action='mail-uri-copy'/>
|
||||
<menuitem action='mail-uri-copy-address'/>
|
||||
<menu action='mail-uri-to-search-folder-menu'>
|
||||
<menuitem action='mail-uri-to-search-folder-sender'/>
|
||||
<menuitem action='mail-uri-to-search-folder-recipient'/>
|
||||
</menu>
|
||||
</popup>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user