diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2009-01-11 22:20:50 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2009-01-11 22:20:50 +0800 |
commit | e0610b2e0cea191f631dc825cdc8023cdcd9433d (patch) | |
tree | 239b20ce4632d6538b9c664ddec883b6e19c11b5 | |
parent | 59d1f3405c653eb45ca462508d5e6ed968513e42 (diff) | |
download | gsoc2013-evolution-e0610b2e0cea191f631dc825cdc8023cdcd9433d.tar.gz gsoc2013-evolution-e0610b2e0cea191f631dc825cdc8023cdcd9433d.tar.zst gsoc2013-evolution-e0610b2e0cea191f631dc825cdc8023cdcd9433d.zip |
Continue chipping away at EMFolderView and EMFolderBrowser.
Migrate from gnome_url_show() to e_show_uri().
svn path=/branches/kill-bonobo/; revision=37038
33 files changed, 1037 insertions, 909 deletions
diff --git a/addressbook/gui/component/e-book-shell-content.c b/addressbook/gui/component/e-book-shell-content.c index c9066c9ef1..52549f0122 100644 --- a/addressbook/gui/component/e-book-shell-content.c +++ b/addressbook/gui/component/e-book-shell-content.c @@ -188,7 +188,7 @@ book_shell_content_constructed (GObject *object) g_signal_connect_swapped ( priv->preview, "send-message", - book_shell_content_send_message_cb, object); + G_CALLBACK (book_shell_content_send_message_cb), object); /* Bind GObject properties to GConf keys. */ diff --git a/addressbook/gui/widgets/eab-contact-display.c b/addressbook/gui/widgets/eab-contact-display.c index 0208c4fd0f..02aa5b81f0 100644 --- a/addressbook/gui/widgets/eab-contact-display.c +++ b/addressbook/gui/widgets/eab-contact-display.c @@ -27,13 +27,13 @@ #include "eab-contact-display.h" #include "eab-gui-util.h" +#include "e-util/e-util.h" #include "e-util/e-html-utils.h" #include "e-util/e-icon-factory.h" #include "e-util/e-plugin-ui.h" #include <string.h> #include <glib/gi18n.h> -#include <libgnome/gnome-url.h> #include <gtkhtml/gtkhtml.h> #include <gtkhtml/gtkhtml-stream.h> @@ -158,18 +158,8 @@ static void action_open_link_cb (GtkAction *action, EABContactDisplay *display) { - GdkScreen *screen; - const gchar *uri; - GError *error = NULL; - - screen = gtk_widget_get_screen (GTK_WIDGET (display)); - uri = display->priv->selected_uri; - g_return_if_fail (uri != NULL); - - if (!gtk_show_uri (screen, uri, GDK_CURRENT_TIME, &error)) { - g_warning ("%s", error->message); - g_error_free (error); - } + /* XXX Pass a parent window. */ + e_show_uri (NULL, display->priv->selected_uri); } static void @@ -287,18 +277,16 @@ contact_display_on_url_requested (GtkHTML *html, static void contact_display_on_link_clicked (GtkHTML *html, - const gchar *url, + const gchar *uri, EABContactDisplay *display) { - GError *err = NULL; - #ifdef HANDLE_MAILTO_INTERNALLY - if (!strncmp (url, "internal-mailto:", strlen ("internal-mailto:"))) { + if (!strncmp (uri, "internal-mailto:", strlen ("internal-mailto:"))) { EDestination *destination; EContact *contact; gint email_num; - email_num = atoi (url + strlen ("internal-mailto:")); + email_num = atoi (uri + strlen ("internal-mailto:")); if (email_num == -1) return; @@ -312,12 +300,8 @@ contact_display_on_link_clicked (GtkHTML *html, } #endif - gnome_url_show (url, &err); - - if (err) { - g_warning ("gnome_url_show: %s", err->message); - g_error_free (err); - } + /* FIXME Pass a parent window. */ + e_show_uri (NULL, uri); } static void diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index f3d9eb7b34..3b7f2c5385 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -1945,7 +1945,6 @@ open_attachment (EAttachmentBar *bar, CompEditor *editor) GList *p; int num; char *attach_file_url; - GError *error = NULL; if (E_IS_ATTACHMENT_BAR (bar)) { icon_list = GNOME_ICON_LIST (bar); @@ -1970,11 +1969,7 @@ open_attachment (EAttachmentBar *bar, CompEditor *editor) attach_file_url = g_build_path ("/", local_store, filename, NULL); /* launch the url now */ - /* TODO should send GError and handle error conditions - * here */ - gnome_url_show (attach_file_url, &error); - if (error) - g_message ("DEBUG: gnome_url_show(%s) failed\n", attach_file_url); + e_show_uri (GTK_WINDOW (editor), attach_file_url); g_free (filename); g_free (attach_file_url); } @@ -2587,11 +2582,15 @@ comp_editor_get_managed_widget (CompEditor *editor, CompEditor * comp_editor_find_instance (const gchar *uid) { + GList *link; + g_return_val_if_fail (uid != NULL, NULL); - return g_list_find_custom ( + link = g_list_find_custom ( active_editors, uid, (GCompareFunc) comp_editor_compare); + + return (link != NULL) ? link->data : NULL; } /** diff --git a/calendar/gui/e-cal-component-preview.c b/calendar/gui/e-cal-component-preview.c index 8d3a903119..d75f06c41e 100644 --- a/calendar/gui/e-cal-component-preview.c +++ b/calendar/gui/e-cal-component-preview.c @@ -31,6 +31,7 @@ #include <libedataserver/e-categories.h> #include <gtkhtml/gtkhtml-stream.h> #include <libedataserver/e-time-utils.h> +#include <e-util/e-util.h> #include <e-util/e-categories-config.h> #include "calendar-config.h" #include <camel/camel-mime-filter-tohtml.h> @@ -47,18 +48,10 @@ static gpointer parent_class; static void cal_component_preview_link_clicked (GtkHTML *html, - const gchar *url) + const gchar *uri) { - GdkScreen *screen; - GError *error = NULL; - - screen = gtk_widget_get_screen (GTK_WIDGET (html)); - gtk_show_uri (screen, url, GDK_CURRENT_TIME, &error); - - if (error != NULL) { - g_warning ("%s", error->message); - g_error_free (error); - } + /* FIXME Pass a parent window. */ + e_show_uri (NULL, uri); } static void diff --git a/calendar/modules/e-cal-shell-view-memopad.c b/calendar/modules/e-cal-shell-view-memopad.c index 7c306fd8eb..b78bdd1c50 100644 --- a/calendar/modules/e-cal-shell-view-memopad.c +++ b/calendar/modules/e-cal-shell-view-memopad.c @@ -164,14 +164,17 @@ static void action_calendar_memopad_open_url_cb (GtkAction *action, ECalShellView *cal_shell_view) { + EShellView *shell_view; + EShellWindow *shell_window; ECalShellContent *cal_shell_content; EMemoTable *memo_table; ECalModelComponent *comp_data; icalproperty *prop; - GdkScreen *screen; const gchar *uri; GSList *list; - GError *error = NULL; + + shell_view = E_SHELL_VIEW (cal_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); cal_shell_content = cal_shell_view->priv->cal_shell_content; memo_table = e_cal_shell_content_get_memo_table (cal_shell_content); @@ -186,14 +189,8 @@ action_calendar_memopad_open_url_cb (GtkAction *action, comp_data->icalcomp, ICAL_URL_PROPERTY); g_return_if_fail (prop == NULL); - screen = gtk_widget_get_screen (GTK_WIDGET (cal_shell_view)); uri = icalproperty_get_url (prop); - gtk_show_uri (screen, uri, GDK_CURRENT_TIME, &error); - - if (error != NULL) { - g_warning ("%s", error->message); - g_error_free (error); - } + e_show_uri (GTK_WINDOW (shell_window), uri); } static void diff --git a/calendar/modules/e-cal-shell-view-taskpad.c b/calendar/modules/e-cal-shell-view-taskpad.c index 082572b4c8..651cf1e878 100644 --- a/calendar/modules/e-cal-shell-view-taskpad.c +++ b/calendar/modules/e-cal-shell-view-taskpad.c @@ -233,14 +233,17 @@ static void action_calendar_taskpad_open_url_cb (GtkAction *action, ECalShellView *cal_shell_view) { + EShellView *shell_view; + EShellWindow *shell_window; ECalShellContent *cal_shell_content; ECalendarTable *task_table; ECalModelComponent *comp_data; icalproperty *prop; - GdkScreen *screen; const gchar *uri; GSList *list; - GError *error = NULL; + + shell_view = E_SHELL_VIEW (cal_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); cal_shell_content = cal_shell_view->priv->cal_shell_content; task_table = e_cal_shell_content_get_task_table (cal_shell_content); @@ -254,14 +257,8 @@ action_calendar_taskpad_open_url_cb (GtkAction *action, comp_data->icalcomp, ICAL_URL_PROPERTY); g_return_if_fail (prop == NULL); - screen = gtk_widget_get_screen (GTK_WIDGET (cal_shell_view)); uri = icalproperty_get_url (prop); - gtk_show_uri (screen, uri, GDK_CURRENT_TIME, &error); - - if (error != NULL) { - g_warning ("%s", error->message); - g_error_free (error); - } + e_show_uri (GTK_WINDOW (shell_window), uri); } static void diff --git a/calendar/modules/e-memo-shell-view-actions.c b/calendar/modules/e-memo-shell-view-actions.c index 8975edf71a..23c456c066 100644 --- a/calendar/modules/e-memo-shell-view-actions.c +++ b/calendar/modules/e-memo-shell-view-actions.c @@ -387,14 +387,17 @@ static void action_memo_open_url_cb (GtkAction *action, EMemoShellView *memo_shell_view) { + EShellView *shell_view; + EShellWindow *shell_window; EMemoShellContent *memo_shell_content; EMemoTable *memo_table; ECalModelComponent *comp_data; icalproperty *prop; - GdkScreen *screen; const gchar *uri; GSList *list; - GError *error = NULL; + + shell_view = E_SHELL_VIEW (memo_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); memo_shell_content = memo_shell_view->priv->memo_shell_content; memo_table = e_memo_shell_content_get_memo_table (memo_shell_content); @@ -409,14 +412,8 @@ action_memo_open_url_cb (GtkAction *action, comp_data->icalcomp, ICAL_URL_PROPERTY); g_return_if_fail (prop == NULL); - screen = gtk_widget_get_screen (GTK_WIDGET (memo_shell_view)); uri = icalproperty_get_url (prop); - gtk_show_uri (screen, uri, GDK_CURRENT_TIME, &error); - - if (error != NULL) { - g_warning ("%s", error->message); - g_error_free (error); - } + e_show_uri (GTK_WINDOW (shell_window), uri); } static void diff --git a/calendar/modules/e-task-shell-module.c b/calendar/modules/e-task-shell-module.c index dbcb58104b..80cfc0a61a 100644 --- a/calendar/modules/e-task-shell-module.c +++ b/calendar/modules/e-task-shell-module.c @@ -337,38 +337,38 @@ task_module_handle_uri (EShellModule *shell_module, goto exit; while (*cp != '\0') { - gchar *header; - gchar *content; - gsize header_len; - gsize content_len; - - header_len = strcspn (cp, "=&"); - - /* If it's malformed, give up. */ - if (cp[header_len] != '=') - break; - - header = (gchar *) cp; - header[header_len] = '\0'; - cp += header_len + 1; - - content_len = strcspn (cp, "&"); - - content = g_strndup (cp, content_len); - if (g_ascii_strcasecmp (header, "source-uid") == 0) - source_uid = g_strdup (content); - else if (g_ascii_strcasecmp (header, "comp-uid") == 0) - comp_uid = g_strdup (content); - else if (g_ascii_strcasecmp (header, "comp-rid") == 0) - comp_rid = g_strdup (content); - g_free (content); - - cp += content_len; - if (*cp == '&') { - cp++; - if (strcmp (cp, "amp;") == 0) - cp += 4; - } + gchar *header; + gchar *content; + gsize header_len; + gsize content_len; + + header_len = strcspn (cp, "=&"); + + /* If it's malformed, give up. */ + if (cp[header_len] != '=') + break; + + header = (gchar *) cp; + header[header_len] = '\0'; + cp += header_len + 1; + + content_len = strcspn (cp, "&"); + + content = g_strndup (cp, content_len); + if (g_ascii_strcasecmp (header, "source-uid") == 0) + source_uid = g_strdup (content); + else if (g_ascii_strcasecmp (header, "comp-uid") == 0) + comp_uid = g_strdup (content); + else if (g_ascii_strcasecmp (header, "comp-rid") == 0) + comp_rid = g_strdup (content); + g_free (content); + + cp += content_len; + if (*cp == '&') { + cp++; + if (strcmp (cp, "amp;") == 0) + cp += 4; + } } if (source_uid != NULL || comp_uid != NULL) @@ -452,25 +452,25 @@ static void task_module_window_created (EShellModule *shell_module, EShellWindow *shell_window) { - const gchar *module_name; + const gchar *module_name; - module_name = G_TYPE_MODULE (shell_module)->name; + module_name = G_TYPE_MODULE (shell_module)->name; - e_shell_window_register_new_item_actions ( - shell_window, module_name, - item_entries, G_N_ELEMENTS (item_entries)); + e_shell_window_register_new_item_actions ( + shell_window, module_name, + item_entries, G_N_ELEMENTS (item_entries)); - e_shell_window_register_new_source_actions ( - shell_window, module_name, - source_entries, G_N_ELEMENTS (source_entries)); + e_shell_window_register_new_source_actions ( + shell_window, module_name, + source_entries, G_N_ELEMENTS (source_entries)); } static EShellModuleInfo module_info = { - MODULE_NAME, - MODULE_ALIASES, - MODULE_SCHEMES, - MODULE_SORT_ORDER, + MODULE_NAME, + MODULE_ALIASES, + MODULE_SCHEMES, + MODULE_SORT_ORDER, /* is_busy */ NULL, /* shutdown */ NULL, @@ -480,23 +480,23 @@ static EShellModuleInfo module_info = { void e_shell_module_init (GTypeModule *type_module) { - EShell *shell; - EShellModule *shell_module; + EShell *shell; + EShellModule *shell_module; - shell_module = E_SHELL_MODULE (type_module); - shell = e_shell_module_get_shell (shell_module); + shell_module = E_SHELL_MODULE (type_module); + shell = e_shell_module_get_shell (shell_module); - e_shell_module_set_info ( + e_shell_module_set_info ( shell_module, &module_info, e_task_shell_view_get_type (type_module)); task_module_ensure_sources (shell_module); - g_signal_connect_swapped ( - shell, "handle-uri", - G_CALLBACK (task_module_handle_uri), shell_module); + g_signal_connect_swapped ( + shell, "handle-uri", + G_CALLBACK (task_module_handle_uri), shell_module); - g_signal_connect_swapped ( - shell, "window-created", - G_CALLBACK (task_module_window_created), shell_module); + g_signal_connect_swapped ( + shell, "window-created", + G_CALLBACK (task_module_window_created), shell_module); } diff --git a/calendar/modules/e-task-shell-view-actions.c b/calendar/modules/e-task-shell-view-actions.c index c1273633c9..21e9d89767 100644 --- a/calendar/modules/e-task-shell-view-actions.c +++ b/calendar/modules/e-task-shell-view-actions.c @@ -480,14 +480,17 @@ static void action_task_open_url_cb (GtkAction *action, ETaskShellView *task_shell_view) { + EShellView *shell_view; + EShellWindow *shell_window; ETaskShellContent *task_shell_content; ECalendarTable *task_table; ECalModelComponent *comp_data; icalproperty *prop; - GdkScreen *screen; const gchar *uri; GSList *list; - GError *error = NULL; + + shell_view = E_SHELL_VIEW (task_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); task_shell_content = task_shell_view->priv->task_shell_content; task_table = e_task_shell_content_get_task_table (task_shell_content); @@ -501,14 +504,8 @@ action_task_open_url_cb (GtkAction *action, comp_data->icalcomp, ICAL_URL_PROPERTY); g_return_if_fail (prop == NULL); - screen = gtk_widget_get_screen (GTK_WIDGET (task_shell_view)); uri = icalproperty_get_url (prop); - gtk_show_uri (screen, uri, GDK_CURRENT_TIME, &error); - - if (error != NULL) { - g_warning ("%s", error->message); - g_error_free (error); - } + e_show_uri (GTK_WINDOW (shell_window), uri); } static void diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 48b006bb67..7b55072653 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -56,8 +56,6 @@ #include <gconf/gconf.h> #include <gconf/gconf-client.h> -#include <libgnome/gnome-url.h> - #include <glade/glade.h> #include "e-util/e-dialog-utils.h" @@ -2552,8 +2550,6 @@ static void msg_composer_link_clicked (GtkhtmlEditor *editor, const gchar *uri) { - GError *error = NULL; - if (uri == NULL || *uri == '\0') return; @@ -2566,12 +2562,7 @@ msg_composer_link_clicked (GtkhtmlEditor *editor, if (g_ascii_strncasecmp (uri, "cid:", 4) == 0) return; - gnome_url_show (uri, &error); - - if (error) { - g_warning ("%s", error->message); - g_error_free (error); - } + e_show_uri (GTK_WINDOW (editor), uri); } static void diff --git a/e-util/e-error.c b/e-util/e-error.c index 763a9ca540..da4d034606 100644 --- a/e-util/e-error.c +++ b/e-util/e-error.c @@ -30,10 +30,10 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <libgnome/gnome-url.h> #include <libedataserver/e-xml-utils.h> +#include "e-util.h" #include "e-util-private.h" #include "e-error.h" @@ -395,15 +395,9 @@ ee_build_label(GString *out, const char *fmt, GPtrArray *args, static void ee_response(GtkWidget *w, guint button, struct _e_error *e) { - GError *err = NULL; - if (button == GTK_RESPONSE_HELP) { g_signal_stop_emission_by_name(w, "response"); - gnome_url_show(e->help_uri, &err); - if (err) { - g_warning("Unable to run help uri: %s", err->message); - g_error_free(err); - } + e_display_help (GTK_WINDOW (w), e->help_uri); } } diff --git a/e-util/e-util.c b/e-util/e-util.c index 148d89a414..a5e6c6b548 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -92,6 +92,50 @@ e_get_accels_filename (void) } /** + * e_show_uri: + * @parent: a parent #GtkWindow or %NULL + * @uri: the URI to show + * + * Launches the default application to show the given URI. The URI must + * be of a form understood by GIO. If the URI cannot be shown, it presents + * a dialog describing the error. The dialog is set as transient to @parent + * if @parent is non-%NULL. + **/ +void +e_show_uri (GtkWindow *parent, + const gchar *uri) +{ + GtkWidget *dialog; + GdkScreen *screen = NULL; + GError *error = NULL; + guint32 timestamp; + + g_return_if_fail (uri != NULL); + + timestamp = gtk_get_current_event_time (); + + if (parent != NULL) + screen = gtk_widget_get_screen (GTK_WIDGET (parent)); + + if (gtk_show_uri (screen, uri, timestamp, &error)) + return; + + dialog = gtk_message_dialog_new_with_markup ( + parent, GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + "<big><b>%s</b></big>", + _("Could not open the link.")); + + gtk_message_dialog_format_secondary_text ( + GTK_MESSAGE_DIALOG (dialog), "%s", error->message); + + gtk_dialog_run (GTK_DIALOG (dialog)); + + gtk_widget_destroy (dialog); + g_error_free (error); +} + +/** * e_display_help: * @parent: a parent #GtkWindow or %NULL * @link_id: help section to present or %NULL diff --git a/e-util/e-util.h b/e-util/e-util.h index 0d2628bbf0..28d7a50a39 100644 --- a/e-util/e-util.h +++ b/e-util/e-util.h @@ -42,6 +42,8 @@ typedef enum { const gchar * e_get_user_data_dir (void); const gchar * e_get_accels_filename (void); +void e_show_uri (GtkWindow *parent, + const gchar *uri); void e_display_help (GtkWindow *parent, const gchar *link_id); guint e_load_ui_definition (GtkUIManager *ui_manager, diff --git a/mail/Makefile.am b/mail/Makefile.am index 1ce0ae79ad..2139df572c 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -93,8 +93,6 @@ libevolution_module_mail_la_SOURCES = \ em-folder-tree.h \ em-folder-tree-model.c \ em-folder-tree-model.h \ - em-folder-view.c \ - em-folder-view.h \ em-folder-utils.c \ em-folder-utils.h \ em-format.c \ diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c index e6c1072304..ad736236cf 100644 --- a/mail/e-mail-browser.c +++ b/mail/e-mail-browser.c @@ -424,6 +424,8 @@ mail_browser_get_action_group (EMailReader *reader) static gboolean mail_browser_get_hide_deleted (EMailReader *reader) { + /* FIXME */ + return FALSE; } static EMFormatHTMLDisplay * diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index bdf9ec84b0..7260dcd47e 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -35,6 +35,7 @@ #include "shell/e-shell.h" #include "widgets/misc/e-charset-picker.h" +#include "mail/e-mail-browser.h" #include "mail/e-mail-reader-utils.h" #include "mail/e-mail-shell-module.h" #include "mail/em-composer-utils.h" @@ -45,9 +46,17 @@ #include "mail/mail-autofilter.h" #include "mail/mail-ops.h" +enum { + CHANGED, + FOLDER_LOADED, + LAST_SIGNAL +}; + /* Remembers the previously selected folder when transferring messages. */ static gchar *default_xfer_messages_uri; +static guint signals[LAST_SIGNAL]; + static void action_mail_add_sender_cb (GtkAction *action, EMailReader *reader) @@ -862,7 +871,22 @@ static void action_mail_select_all_cb (GtkAction *action, EMailReader *reader) { - /* FIXME */ + EMFormatHTMLDisplay *html_display; + GtkActionGroup *action_group; + GtkHTML *html; + const gchar *action_name; + gboolean selection_active; + + html_display = e_mail_reader_get_html_display (reader); + html = ((EMFormatHTML *) html_display)->html; + + gtk_html_select_all (html); + + action_name = "mail-clipboard-copy"; + action_group = e_mail_reader_get_action_group (reader); + action = gtk_action_group_get_action (action_group, action_name); + selection_active = gtk_html_command (html, "is-selection-active"); + gtk_action_set_sensitive (action, selection_active); } static void @@ -886,7 +910,32 @@ static void action_mail_show_source_cb (GtkAction *action, EMailReader *reader) { - /* FIXME */ + EMFormatHTMLDisplay *html_display; + EShellModule *shell_module; + MessageList *message_list; + CamelFolder *folder; + GtkWidget *browser; + GPtrArray *uids; + const gchar *folder_uri; + + message_list = e_mail_reader_get_message_list (reader); + shell_module = e_mail_reader_get_shell_module (reader); + + folder = message_list->folder; + folder_uri = message_list->folder_uri; + uids = message_list_get_selected (message_list); + g_return_if_fail (uids->len > 0); + + /* FIXME Set session. */ + browser = e_mail_browser_new (shell_module); + reader = E_MAIL_READER (browser); + html_display = e_mail_reader_get_html_display (reader); + em_format_set_mode ((EMFormat *) html_display, EM_FORMAT_SOURCE); + e_mail_reader_set_folder (reader, folder, folder_uri); + e_mail_reader_set_message (reader, uids->pdata[0], FALSE); + gtk_widget_show (browser); + + message_list_free_uids (message_list, uids); } static void @@ -934,6 +983,46 @@ action_mail_undelete_cb (GtkAction *action, } static void +action_mail_uri_call_to_cb (GtkAction *action, + EMailReader *reader) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +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) { @@ -991,7 +1080,7 @@ static GtkActionEntry mail_reader_entries[] = { { "mail-copy", "mail-copy", - N_("_Copy to Folder"), + N_("_Copy to Folder..."), "<Shift><Control>y", N_("Copy selected messages to another folder"), G_CALLBACK (action_mail_copy_cb) }, @@ -1173,7 +1262,7 @@ static GtkActionEntry mail_reader_entries[] = { { "mail-move", "mail-move", - N_("_Move to Folder"), + N_("_Move to Folder..."), "<Shift><Control>v", N_("Move selected messages to another folder"), G_CALLBACK (action_mail_move_cb) }, @@ -1339,6 +1428,41 @@ static GtkActionEntry mail_reader_entries[] = { N_("Undelete the selected messages"), G_CALLBACK (action_mail_undelete_cb) }, + { "mail-uri-call-to", + NULL, + N_("C_all To..."), + NULL, + NULL, /* XXX Add a tooltip! */ + G_CALLBACK (action_mail_uri_call_to_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"), @@ -1360,6 +1484,57 @@ static GtkActionEntry mail_reader_entries[] = { N_("Decrease the text size"), G_CALLBACK (action_mail_zoom_out_cb) }, + /*** Popup Menu Variations ***/ + + { "mail-popup-flag-for-followup", + "stock_mail-flag-for-followup", + N_("Mark for Follo_w Up..."), + NULL, + N_("Flag the selected messages for follow-up"), + G_CALLBACK (action_mail_flag_for_followup_cb) }, + + { "mail-popup-mark-important", + "mail-mark-important", + N_("Mark as _Important"), + NULL, + N_("Mark the selected messages as important"), + G_CALLBACK (action_mail_mark_important_cb) }, + + { "mail-popup-mark-junk", + "mail-mark-junk", + N_("Mark as _Junk"), + NULL, + N_("Mark the selected messages as junk"), + G_CALLBACK (action_mail_mark_junk_cb) }, + + { "mail-popup-mark-notjunk", + "mail-mark-notjunk", + N_("Mark as _Not Junk"), + NULL, + N_("Mark the selected messages as not being junk"), + G_CALLBACK (action_mail_mark_notjunk_cb) }, + + { "mail-popup-mark-read", + "mail-mark-read", + N_("Mark as _Read"), + NULL, + N_("Mark the selected messages as having been read"), + G_CALLBACK (action_mail_mark_read_cb) }, + + { "mail-popup-mark-unimportant", + NULL, + N_("Mark as Uni_mportant"), + NULL, + N_("Mark the selected message as unimportant"), + G_CALLBACK (action_mail_mark_unimportant_cb) }, + + { "mail-popup-mark-unread", + "mail-mark-unread", + N_("Mark as _Unread"), + NULL, + N_("Mark the selected messages as not having been read"), + G_CALLBACK (action_mail_mark_unread_cb) }, + /*** Menus ***/ { "mail-create-rule-menu", @@ -1390,6 +1565,13 @@ static GtkActionEntry mail_reader_entries[] = { NULL, NULL }, + { "mail-label-menu", + NULL, + N_("_Label"), + NULL, + NULL, + NULL }, + { "mail-mark-as-menu", NULL, N_("Mar_k As"), @@ -1404,6 +1586,13 @@ 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"), @@ -1432,6 +1621,59 @@ static GtkToggleActionEntry mail_reader_toggle_entries[] = { }; static void +mail_reader_link_clicked_cb (EMailReader *reader, + const gchar *uri, + EMFormatHTMLDisplay *html_display) +{ + GtkHTML *html; + GtkWindow *window; + MessageList *message_list; + const gchar *folder_uri; + + html = ((EMFormatHTML *) html_display)->html; + message_list = e_mail_reader_get_message_list (reader); + window = e_mail_reader_get_window (reader); + folder_uri = message_list->folder_uri; + + if (g_str_has_prefix (uri, "##")) + return; + + if (g_ascii_strncasecmp (uri, "mailto:", 7) == 0) + em_utils_compose_new_message_with_mailto (uri, folder_uri); + + else if (*uri == '#') + gtk_html_jump_to_anchor (html, uri + 1); + + else if (g_ascii_strncasecmp (uri, "thismessage:", 12) == 0) + /* ignore */ ; + + else if (g_ascii_strncasecmp (uri, "cid:", 4) == 0) + /* ignore */ ; + + else + e_show_uri (window, uri); +} + +static gboolean +mail_reader_html_button_release_event_cb (EMailReader *reader, + GdkEventButton *button, + GtkHTML *html) +{ + GtkActionGroup *action_group; + GtkAction *action; + const gchar *action_name; + gboolean selection_active; + + action_name = "mail-clipboard-copy"; + action_group = e_mail_reader_get_action_group (reader); + action = gtk_action_group_get_action (action_group, action_name); + selection_active = gtk_html_command (html, "is-selection-active"); + gtk_action_set_sensitive (action, selection_active); + + return FALSE; +} + +static void mail_reader_double_click_cb (EMailReader *reader, gint row, ETreePath path, @@ -1529,10 +1771,12 @@ mail_reader_message_read_cb (EMailReader *reader) message_list = e_mail_reader_get_message_list (reader); uid = g_object_get_data (G_OBJECT (reader), "mark-read-uid"); - g_return_if_fail (uid != NULL); + g_return_val_if_fail (uid != NULL, FALSE); if (g_strcmp0 (message_list->cursor_uid, uid) == 0) e_mail_reader_mark_as_read (reader, uid); + + return FALSE; } static void @@ -1675,6 +1919,14 @@ mail_reader_message_selected_cb (EMailReader *reader, data = GUINT_TO_POINTER (source_id); g_object_set_data (G_OBJECT (reader), key, data); + + e_mail_reader_changed (reader); +} + +static void +mail_reader_emit_folder_loaded (EMailReader *reader) +{ + g_signal_emit (reader, signals[FOLDER_LOADED], 0); } static void @@ -1698,6 +1950,8 @@ mail_reader_set_folder (EMailReader *reader, em_format_format ((EMFormat *) html_display, NULL, NULL, NULL); message_list_set_folder (message_list, folder, folder_uri, outgoing); + + mail_reader_emit_folder_loaded (reader); } static void @@ -1745,6 +1999,22 @@ mail_reader_class_init (EMailReaderIface *iface) { iface->set_folder = mail_reader_set_folder; iface->set_message = mail_reader_set_message; + + signals[CHANGED] = g_signal_new ( + "changed", + G_OBJECT_CLASS_TYPE (iface), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[FOLDER_LOADED] = g_signal_new ( + "folder-loaded", + G_OBJECT_CLASS_TYPE (iface), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); } GType @@ -1778,8 +2048,9 @@ e_mail_reader_get_type (void) void e_mail_reader_init (EMailReader *reader) { - MessageList *message_list; + EMFormatHTMLDisplay *html_display; GtkActionGroup *action_group; + MessageList *message_list; GConfBridge *bridge; GtkAction *action; const gchar *action_name; @@ -1788,6 +2059,7 @@ e_mail_reader_init (EMailReader *reader) g_return_if_fail (E_IS_MAIL_READER (reader)); action_group = e_mail_reader_get_action_group (reader); + html_display = e_mail_reader_get_html_display (reader); message_list = e_mail_reader_get_message_list (reader); gtk_action_group_add_actions ( @@ -1815,31 +2087,63 @@ e_mail_reader_init (EMailReader *reader) /* Fine tuning. */ - action = gtk_action_group_get_action (action_group, "mail-delete"); + action_name = "mail-clipboard-copy"; + action = gtk_action_group_get_action (action_group, action_name); + gtk_action_set_sensitive (action, FALSE); + + action_name = "mail-delete"; + action = gtk_action_group_get_action (action_group, action_name); g_object_set (action, "short-label", _("Delete"), NULL); - action = gtk_action_group_get_action (action_group, "mail-next"); + action_name = "mail-next"; + action = gtk_action_group_get_action (action_group, action_name); g_object_set (action, "short-label", _("Next"), NULL); - action = gtk_action_group_get_action (action_group, "mail-previous"); + action_name = "mail-previous"; + action = gtk_action_group_get_action (action_group, action_name); g_object_set (action, "short-label", _("Previous"), NULL); - action = gtk_action_group_get_action (action_group, "mail-reply-sender"); + action_name = "mail-reply-sender"; + action = gtk_action_group_get_action (action_group, action_name); g_object_set (action, "short-label", _("Reply"), NULL); /* Connect signals. */ g_signal_connect_swapped ( + html_display, "link-clicked", + G_CALLBACK (mail_reader_link_clicked_cb), reader); + + g_signal_connect_swapped ( + ((EMFormatHTML *) html_display)->html, "button-release-event", + G_CALLBACK (mail_reader_html_button_release_event_cb), reader); + + g_signal_connect_swapped ( message_list, "message-selected", G_CALLBACK (mail_reader_message_selected_cb), reader); g_signal_connect_swapped ( + message_list, "message-list-built", + G_CALLBACK (mail_reader_emit_folder_loaded), reader); + + g_signal_connect_swapped ( message_list->tree, "double-click", G_CALLBACK (mail_reader_double_click_cb), reader); g_signal_connect_swapped ( message_list->tree, "key-press", G_CALLBACK (mail_reader_key_press_cb), reader); + + g_signal_connect_swapped ( + message_list->tree, "selection-change", + G_CALLBACK (e_mail_reader_changed), reader); +} + +void +e_mail_reader_changed (EMailReader *reader) +{ + g_return_if_fail (E_IS_MAIL_READER (reader)); + + g_signal_emit (reader, signals[CHANGED], 0); } GtkActionGroup * diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h index bb9e8d461f..bf8f986145 100644 --- a/mail/e-mail-reader.h +++ b/mail/e-mail-reader.h @@ -71,6 +71,7 @@ struct _EMailReaderIface { GType e_mail_reader_get_type (void); void e_mail_reader_init (EMailReader *reader); +void e_mail_reader_changed (EMailReader *reader); GtkActionGroup * e_mail_reader_get_action_group (EMailReader *reader); gboolean e_mail_reader_get_hide_deleted (EMailReader *reader); diff --git a/mail/e-mail-shell-content.c b/mail/e-mail-shell-content.c index e06e68acfc..d0d51baf1b 100644 --- a/mail/e-mail-shell-content.c +++ b/mail/e-mail-shell-content.c @@ -43,9 +43,9 @@ struct _EMailShellContentPrivate { GtkWidget *paned; - GtkWidget *folder_view; + GtkWidget *message_list; - EMFormatHTMLDisplay *preview; + EMFormatHTMLDisplay *html_display; GalViewInstance *view_instance; guint paned_binding_id; @@ -66,14 +66,15 @@ static void mail_shell_content_display_view_cb (EMailShellContent *mail_shell_content, GalView *gal_view) { - EMFolderView *folder_view; + EMailReader *reader; + MessageList *message_list; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + reader = E_MAIL_READER (mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); if (GAL_IS_VIEW_ETABLE (gal_view)) gal_view_etable_attach_tree ( - GAL_VIEW_ETABLE (gal_view), - folder_view->list->tree); + GAL_VIEW_ETABLE (gal_view), message_list->tree); } static void @@ -135,14 +136,14 @@ mail_shell_content_dispose (GObject *object) priv->paned = NULL; } - if (priv->folder_view != NULL) { - g_object_unref (priv->folder_view); - priv->folder_view = NULL; + if (priv->message_list != NULL) { + g_object_unref (priv->message_list); + priv->message_list = NULL; } - if (priv->preview != NULL) { - g_object_unref (priv->preview); - priv->preview = NULL; + if (priv->html_display != NULL) { + g_object_unref (priv->html_display); + priv->html_display = NULL; } if (priv->view_instance != NULL) { @@ -199,11 +200,9 @@ mail_shell_content_constructed (GObject *object) container = widget; - /* XXX Kill EMFolderView? */ - priv->folder_view = em_folder_view_new (); - g_object_ref_sink (priv->folder_view); - widget = GTK_WIDGET (((EMFolderView *) priv->folder_view)->list); + widget = message_list_new (); gtk_paned_add1 (GTK_PANED (container), widget); + priv->message_list = g_object_ref (widget); gtk_widget_show (widget); widget = gtk_scrolled_window_new (NULL, NULL); @@ -217,9 +216,8 @@ mail_shell_content_constructed (GObject *object) container = widget; - /* XXX Kill EMFolderView? */ - priv->preview = ((EMFolderView *) priv->folder_view)->preview; - widget = GTK_WIDGET (((EMFormatHTML *) priv->preview)->html); + priv->html_display = em_format_html_display_new (); + widget = GTK_WIDGET (((EMFormatHTML *) priv->html_display)->html); gtk_container_add (GTK_CONTAINER (container), widget); gtk_widget_show (widget); @@ -240,8 +238,9 @@ mail_shell_content_constructed (GObject *object) static guint32 mail_shell_content_check_state (EShellContent *shell_content) { + EMailReader *reader; EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + MessageList *message_list; GPtrArray *uids; CamelFolder *folder; CamelStore *store; @@ -262,11 +261,12 @@ mail_shell_content_check_state (EShellContent *shell_content) guint32 state = 0; guint ii; + reader = E_MAIL_READER (shell_content); + message_list = e_mail_reader_get_message_list (reader); mail_shell_content = E_MAIL_SHELL_CONTENT (shell_content); - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - uids = message_list_get_selected (folder_view->list); - folder_uri = folder_view->folder_uri; - folder = folder_view->folder; + uids = message_list_get_selected (message_list); + folder_uri = message_list->folder_uri; + folder = message_list->folder; store = CAMEL_STORE (folder->parent_store); draft_or_outbox = @@ -386,23 +386,21 @@ mail_shell_content_get_hide_deleted (EMailReader *reader) static EMFormatHTMLDisplay * mail_shell_content_get_html_display (EMailReader *reader) { - EMailShellContent *mail_shell_content; + EMailShellContentPrivate *priv; - mail_shell_content = E_MAIL_SHELL_CONTENT (reader); + priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); - return e_mail_shell_content_get_preview_format (mail_shell_content); + return priv->html_display; } static MessageList * mail_shell_content_get_message_list (EMailReader *reader) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + EMailShellContentPrivate *priv; - mail_shell_content = E_MAIL_SHELL_CONTENT (reader); - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); - return folder_view->list; + return MESSAGE_LIST (priv->message_list); } static EShellModule * @@ -540,24 +538,6 @@ e_mail_shell_content_new (EShellView *shell_view) "shell-view", shell_view, NULL); } -EMFolderView * -e_mail_shell_content_get_folder_view (EMailShellContent *mail_shell_content) -{ - g_return_val_if_fail ( - E_IS_MAIL_SHELL_CONTENT (mail_shell_content), NULL); - - return EM_FOLDER_VIEW (mail_shell_content->priv->folder_view); -} - -EMFormatHTMLDisplay * -e_mail_shell_content_get_preview_format (EMailShellContent *mail_shell_content) -{ - g_return_val_if_fail ( - E_IS_MAIL_SHELL_CONTENT (mail_shell_content), NULL); - - return mail_shell_content->priv->preview; -} - gboolean e_mail_shell_content_get_preview_visible (EMailShellContent *mail_shell_content) { @@ -592,19 +572,6 @@ e_mail_shell_content_set_preview_visible (EMailShellContent *mail_shell_content, g_object_notify (G_OBJECT (mail_shell_content), "preview-visible"); } -GtkWidget * -e_mail_shell_content_get_preview_widget (EMailShellContent *mail_shell_content) -{ - EMFormatHTML *format; - - g_return_val_if_fail ( - E_IS_MAIL_SHELL_CONTENT (mail_shell_content), NULL); - - format = (EMFormatHTML *) mail_shell_content->priv->preview; - - return GTK_WIDGET (format->html); -} - gboolean e_mail_shell_content_get_vertical_view (EMailShellContent *mail_shell_content) { @@ -671,12 +638,13 @@ e_mail_shell_content_set_vertical_view (EMailShellContent *mail_shell_content, void e_mail_shell_content_update_view_instance (EMailShellContent *mail_shell_content) { + EMailReader *reader; EShellContent *shell_content; EShellView *shell_view; EShellViewClass *shell_view_class; GalViewCollection *view_collection; GalViewInstance *view_instance; - EMFolderView *folder_view; + MessageList *message_list; gboolean outgoing_folder; gboolean show_vertical_view; gchar *view_id; @@ -688,21 +656,22 @@ e_mail_shell_content_update_view_instance (EMailShellContent *mail_shell_content shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view); view_collection = shell_view_class->view_collection; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + reader = E_MAIL_READER (mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); /* If no folder is selected, return silently. */ - if (folder_view->folder == NULL) + if (message_list->folder == NULL) return; /* If we have a folder, we should also have a URI. */ - g_return_if_fail (folder_view->folder_uri != NULL); + g_return_if_fail (message_list->folder_uri != NULL); if (mail_shell_content->priv->view_instance != NULL) { g_object_unref (mail_shell_content->priv->view_instance); mail_shell_content->priv->view_instance = NULL; } - view_id = mail_config_folder_to_safe_url (folder_view->folder); + view_id = mail_config_folder_to_safe_url (message_list->folder); view_instance = e_shell_view_new_view_instance (shell_view, view_id); mail_shell_content->priv->view_instance = view_instance; @@ -740,11 +709,11 @@ e_mail_shell_content_update_view_instance (EMailShellContent *mail_shell_content outgoing_folder = em_utils_folder_is_drafts ( - folder_view->folder, folder_view->folder_uri) || + message_list->folder, message_list->folder_uri) || em_utils_folder_is_outbox ( - folder_view->folder, folder_view->folder_uri) || + message_list->folder, message_list->folder_uri) || em_utils_folder_is_sent ( - folder_view->folder, folder_view->folder_uri); + message_list->folder, message_list->folder_uri); if (outgoing_folder) { if (show_vertical_view) @@ -764,7 +733,7 @@ e_mail_shell_content_update_view_instance (EMailShellContent *mail_shell_content gchar *state_filename; state_filename = mail_config_folder_to_cachename ( - folder_view->folder, "et-header-"); + message_list->folder, "et-header-"); if (g_file_test (state_filename, G_FILE_TEST_IS_REGULAR)) { ETableSpecification *spec; diff --git a/mail/e-mail-shell-content.h b/mail/e-mail-shell-content.h index 593969e5a5..5a94df559c 100644 --- a/mail/e-mail-shell-content.h +++ b/mail/e-mail-shell-content.h @@ -25,7 +25,6 @@ #include <shell/e-shell-content.h> #include <shell/e-shell-view.h> -#include "em-folder-view.h" #include "em-format-html-display.h" /* Standard GObject macros */ @@ -86,18 +85,11 @@ struct _EMailShellContentClass { GType e_mail_shell_content_get_type (void); GtkWidget * e_mail_shell_content_new (EShellView *shell_view); -EMFolderView * e_mail_shell_content_get_folder_view - (EMailShellContent *mail_shell_content); -EMFormatHTMLDisplay * - e_mail_shell_content_get_preview_format - (EMailShellContent *mail_shell_content); gboolean e_mail_shell_content_get_preview_visible (EMailShellContent *mail_shell_content); void e_mail_shell_content_set_preview_visible (EMailShellContent *mail_shell_content, gboolean preview_visible); -GtkWidget * e_mail_shell_content_get_preview_widget - (EMailShellContent *mail_shell_content); gboolean e_mail_shell_content_get_vertical_view (EMailShellContent *mail_shell_content); void e_mail_shell_content_set_vertical_view diff --git a/mail/e-mail-shell-module.c b/mail/e-mail-shell-module.c index 1185e13575..96d7a5ebbd 100644 --- a/mail/e-mail-shell-module.c +++ b/mail/e-mail-shell-module.c @@ -119,8 +119,6 @@ static guint mail_sync_timeout_source_id; extern gint camel_application_is_exiting; -G_LOCK_DEFINE_STATIC (local_store); - static StoreInfo * store_info_new (CamelStore *store, const gchar *name) diff --git a/mail/e-mail-shell-view-actions.c b/mail/e-mail-shell-view-actions.c index 611ceff204..817b2283ae 100644 --- a/mail/e-mail-shell-view-actions.c +++ b/mail/e-mail-shell-view-actions.c @@ -94,20 +94,20 @@ static void action_mail_folder_expunge_cb (GtkAction *action, EMailShellView *mail_shell_view) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + EMailReader *reader; + MessageList *message_list; EShellWindow *shell_window; EShellView *shell_view; shell_view = E_SHELL_VIEW (mail_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - g_return_if_fail (folder_view->folder != NULL); + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); + g_return_if_fail (message_list->folder != NULL); em_utils_expunge_folder ( - GTK_WIDGET (shell_window), folder_view->folder); + GTK_WIDGET (shell_window), message_list->folder); } static void @@ -223,26 +223,26 @@ static void action_mail_folder_select_thread_cb (GtkAction *action, EMailShellView *mail_shell_view) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + MessageList *message_list; + EMailReader *reader; - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); - message_list_select_thread (folder_view->list); + message_list_select_thread (message_list); } static void action_mail_folder_select_subthread_cb (GtkAction *action, EMailShellView *mail_shell_view) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + MessageList *message_list; + EMailReader *reader; - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); - message_list_select_subthread (folder_view->list); + message_list_select_subthread (message_list); } static void @@ -257,14 +257,14 @@ static void action_mail_hide_read_cb (GtkAction *action, EMailShellView *mail_shell_view) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + MessageList *message_list; + EMailReader *reader; - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); message_list_hide_add ( - folder_view->list, + message_list, "(match-all (system-flag \"seen\"))", ML_HIDE_SAME, ML_HIDE_SAME); } @@ -273,16 +273,16 @@ static void action_mail_hide_selected_cb (GtkAction *action, EMailShellView *mail_shell_view) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + MessageList *message_list; + EMailReader *reader; GPtrArray *uids; - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); - uids = message_list_get_selected (folder_view->list); - message_list_hide_uids (folder_view->list, uids); - message_list_free_uids (folder_view->list, uids); + uids = message_list_get_selected (message_list); + message_list_hide_uids (message_list, uids); + message_list_free_uids (message_list, uids); } static void @@ -303,13 +303,13 @@ static void action_mail_show_hidden_cb (GtkAction *action, EMailShellView *mail_shell_view) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + MessageList *message_list; + EMailReader *reader; - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); - message_list_hide_clear (folder_view->list); + message_list_hide_clear (message_list); } static void @@ -323,26 +323,26 @@ static void action_mail_threads_collapse_all_cb (GtkAction *action, EMailShellView *mail_shell_view) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + MessageList *message_list; + EMailReader *reader; - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); - message_list_set_threaded_collapse_all (folder_view->list); + message_list_set_threaded_collapse_all (message_list); } static void action_mail_threads_expand_all_cb (GtkAction *action, EMailShellView *mail_shell_view) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + MessageList *message_list; + EMailReader *reader; - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); - message_list_set_threaded_expand_all (folder_view->list); + message_list_set_threaded_expand_all (message_list); } static void @@ -392,46 +392,6 @@ action_mail_tools_subscriptions_cb (GtkAction *action, } static void -action_mail_uri_call_to_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); -} - -static void -action_mail_uri_copy_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); -} - -static void -action_mail_uri_copy_address_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - /* 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, - EMailShellView *mail_shell_view) -{ - /* 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, - EMailShellView *mail_shell_view) -{ - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); -} - -static void action_mail_view_cb (GtkRadioAction *action, GtkRadioAction *current, EMailShellView *mail_shell_view) @@ -623,41 +583,6 @@ static GtkActionEntry mail_entries[] = { N_("Subscribe or unsubscribe to folders on remote servers"), G_CALLBACK (action_mail_tools_subscriptions_cb) }, - { "mail-uri-call-to", - NULL, - N_("C_all To..."), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_mail_uri_call_to_cb) }, - - { "mail-uri-copy", - GTK_STOCK_COPY, - 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) }, - /*** Menus ***/ { "mail-folder-menu", @@ -667,25 +592,11 @@ static GtkActionEntry mail_entries[] = { NULL, NULL }, - { "mail-label-menu", - NULL, - N_("_Label"), - NULL, - NULL, - NULL }, - { "mail-preview-menu", NULL, N_("_Preview"), NULL, NULL, - NULL }, - - { "mail-uri-to-search-folder-menu", - NULL, - N_("Create _Search Folder"), - NULL, - NULL, NULL } }; diff --git a/mail/e-mail-shell-view-private.c b/mail/e-mail-shell-view-private.c index 8dbaf56877..728f056421 100644 --- a/mail/e-mail-shell-view-private.c +++ b/mail/e-mail-shell-view-private.c @@ -30,14 +30,12 @@ mail_shell_view_folder_tree_selected_cb (EMailShellView *mail_shell_view, guint32 flags, EMFolderTree *folder_tree) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + EMailReader *reader; - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); if ((flags & CAMEL_FOLDER_NOSELECT) || full_name == NULL) - em_folder_view_set_folder (folder_view, NULL, NULL); + e_mail_reader_set_folder (reader, NULL, NULL); else { EMFolderTreeModel *model; @@ -45,7 +43,7 @@ mail_shell_view_folder_tree_selected_cb (EMailShellView *mail_shell_view, em_folder_tree_model_set_selected (model, uri); em_folder_tree_model_save_state (model); - em_folder_view_set_folder_uri (folder_view, uri); + e_mail_reader_set_folder_uri (reader, uri); } } @@ -59,9 +57,23 @@ mail_shell_view_folder_tree_popup_event_cb (EShellView *shell_view, e_shell_view_show_popup_menu (shell_view, widget_path, event); } +static gboolean +mail_shell_view_message_list_right_click_cb (EShellView *shell_view, + gint row, + ETreePath path, + gint col, + GdkEventButton *event) +{ + const gchar *widget_path; + + widget_path = "/mail-message-popup"; + e_shell_view_show_popup_menu (shell_view, widget_path, event); + + return TRUE; +} + static void -mail_shell_view_folder_view_changed_cb (EMailShellView *mail_shell_view, - EMFolderView *folder_view) +mail_shell_view_reader_changed_cb (EMailShellView *mail_shell_view) { EMailShellContent *mail_shell_content; @@ -142,14 +154,14 @@ void e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) { EMailShellViewPrivate *priv = mail_shell_view->priv; - EMailShellContent *mail_shell_content; EMailShellSidebar *mail_shell_sidebar; EShellView *shell_view; EShellContent *shell_content; EShellSidebar *shell_sidebar; EMFolderTreeModel *folder_tree_model; EMFolderTree *folder_tree; - EMFolderView *folder_view; + MessageList *message_list; + EMailReader *reader; gchar *uri; shell_view = E_SHELL_VIEW (mail_shell_view); @@ -160,8 +172,8 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) priv->mail_shell_content = g_object_ref (shell_content); priv->mail_shell_sidebar = g_object_ref (shell_sidebar); - mail_shell_content = E_MAIL_SHELL_CONTENT (shell_content); - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + reader = E_MAIL_READER (shell_content); + message_list = e_mail_reader_get_message_list (reader); mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar); folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); @@ -177,18 +189,23 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) mail_shell_view); g_signal_connect_swapped ( - folder_view, "changed", - G_CALLBACK (mail_shell_view_folder_view_changed_cb), + message_list->tree, "right-click", + G_CALLBACK (mail_shell_view_message_list_right_click_cb), + mail_shell_view); + + g_signal_connect_swapped ( + reader, "changed", + G_CALLBACK (mail_shell_view_reader_changed_cb), mail_shell_view); /* Use the same callback as "changed". */ g_signal_connect_swapped ( - folder_view, "loaded", - G_CALLBACK (mail_shell_view_folder_view_changed_cb), + reader, "folder-loaded", + G_CALLBACK (mail_shell_view_reader_changed_cb), mail_shell_view); e_mail_shell_view_actions_init (mail_shell_view); - e_mail_reader_init (E_MAIL_READER (mail_shell_content)); + e_mail_reader_init (reader); /* Restore the previously selected folder. */ folder_tree_model = em_folder_tree_get_model (folder_tree); @@ -199,7 +216,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) expanded = em_folder_tree_model_get_expanded_uri ( folder_tree_model, uri); em_folder_tree_set_selected (folder_tree, uri, FALSE); - em_folder_view_set_folder_uri (folder_view, uri); + e_mail_reader_set_folder_uri (reader, uri); if (!expanded) em_folder_tree_model_set_expanded_uri ( @@ -229,11 +246,11 @@ e_mail_shell_view_private_finalize (EMailShellView *mail_shell_view) void e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) { - EMailShellContent *mail_shell_content; EShellSidebar *shell_sidebar; EShellModule *shell_module; EShellView *shell_view; - EMFolderView *folder_view; + EMailReader *reader; + MessageList *message_list; CamelStore *local_store; CamelFolder *folder; GPtrArray *selected; @@ -255,10 +272,10 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); local_store = e_mail_shell_module_get_local_store (shell_module); - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - folder_uri = folder_view->folder_uri; - folder = folder_view->folder; + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); + folder_uri = message_list->folder_uri; + folder = message_list->folder; /* If no folder is selected, reset the sidebar banners * to their default values and stop. */ @@ -286,7 +303,7 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) NULL); buffer = g_string_sized_new (256); - selected = message_list_get_selected (folder_view->list); + selected = message_list_get_selected (message_list); if (selected->len > 1) g_string_append_printf ( @@ -305,7 +322,7 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) "%d deleted", num_deleted), num_deleted); /* "Junk" folder (hide deleted messages) */ - else if (folder_view->hide_deleted) + else if (e_mail_reader_get_hide_deleted (reader)) g_string_append_printf ( buffer, ngettext ("%d junk", "%d junk", num_junked_not_deleted), @@ -337,7 +354,7 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) /* Normal folder */ } else { - if (!folder_view->hide_deleted) + if (!e_mail_reader_get_hide_deleted (reader)) num_visible += num_deleted - num_junked + num_junked_not_deleted; @@ -351,7 +368,7 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) num_visible), num_visible); } - message_list_free_uids (folder_view->list, selected); + message_list_free_uids (message_list, selected); /* Choose a suitable folder name for displaying. */ if (folder->parent_store == local_store && ( @@ -399,8 +416,8 @@ void e_mail_shell_view_create_filter_from_selected (EMailShellView *mail_shell_view, gint filter_type) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + EMailReader *reader; + MessageList *message_list; CamelFolder *folder; const gchar *filter_source; const gchar *folder_uri; @@ -413,10 +430,10 @@ e_mail_shell_view_create_filter_from_selected (EMailShellView *mail_shell_view, g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view)); - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - folder_uri = folder_view->folder_uri; - folder = folder_view->folder; + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); + folder_uri = message_list->folder_uri; + folder = message_list->folder; if (em_utils_folder_is_sent (folder, folder_uri)) filter_source = FILTER_SOURCE_OUTGOING; @@ -425,7 +442,7 @@ e_mail_shell_view_create_filter_from_selected (EMailShellView *mail_shell_view, else filter_source = FILTER_SOURCE_INCOMING; - uids = message_list_get_selected (folder_view->list); + uids = message_list_get_selected (message_list); if (uids->len == 1) { filter_data = g_malloc (sizeof (*filter_data)); @@ -465,8 +482,8 @@ void e_mail_shell_view_create_vfolder_from_selected (EMailShellView *mail_shell_view, gint vfolder_type) { - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; + EMailReader *reader; + MessageList *message_list; CamelFolder *folder; const gchar *folder_uri; GPtrArray *uids; @@ -478,12 +495,12 @@ e_mail_shell_view_create_vfolder_from_selected (EMailShellView *mail_shell_view, g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view)); - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - folder_uri = folder_view->folder_uri; - folder = folder_view->folder; + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); + folder_uri = message_list->folder_uri; + folder = message_list->folder; - uids = message_list_get_selected (folder_view->list); + uids = message_list_get_selected (message_list); if (uids->len == 1) { vfolder_data = g_malloc (sizeof (*vfolder_data)); diff --git a/mail/em-config.c b/mail/em-config.c index 9075fc3842..94df437519 100644 --- a/mail/em-config.c +++ b/mail/em-config.c @@ -29,8 +29,6 @@ #include <gtk/gtk.h> -#include <libgnome/gnome-url.h> - #include "em-config.h" #include "libedataserver/e-msgport.h" #include "em-utils.h" diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index e940b841a4..68b682c14c 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -40,8 +40,6 @@ #undef interface #endif -#include <libgnome/gnome-url.h> - #include <gconf/gconf-client.h> #include <camel/camel-mime-message.h> @@ -108,31 +106,6 @@ #include <X11/XF86keysym.h> #endif -static void emfv_list_message_selected(MessageList *ml, const char *uid, EMFolderView *emfv); -static void emfv_list_built(MessageList *ml, EMFolderView *emfv); -static int emfv_list_right_click(ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, EMFolderView *emfv); -static void emfv_list_selection_change(ETree *tree, EMFolderView *emfv); - -static void emfv_format_link_clicked(EMFormatHTMLDisplay *efhd, const char *uri, EMFolderView *); -static int emfv_format_popup_event(EMFormatHTMLDisplay *efhd, GdkEventButton *event, const char *uri, CamelMimePart *part, EMFolderView *); - -static void emfv_enable_menus(EMFolderView *emfv); - -static void emfv_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri); -static void emfv_set_folder_uri(EMFolderView *emfv, const char *uri); -static void emfv_set_message(EMFolderView *emfv, const char *uid, int nomarkseen); -static void emfv_activate(EMFolderView *emfv, BonoboUIComponent *uic, int state); - -static void emfv_setting_setup(EMFolderView *emfv); - -static void emfv_on_url_cb(GObject *emitter, const char *url, EMFolderView *emfv); -static void emfv_on_url(EMFolderView *emfv, const char *uri, const char *nice_uri); - -static void emfv_set_seen (EMFolderView *emfv, const char *uid); -static gboolean emfv_on_html_button_released_cb (GtkHTML *html, GdkEventButton *button, EMFolderView *emfv); -static gboolean emfv_popup_menu (GtkWidget *widget); - - /* this is added to emfv->enable_map in :init() */ static const EMFolderViewEnable emfv_enable_map[] = { { "EditCut", EM_POPUP_SELECT_MANY }, @@ -246,39 +219,39 @@ emfv_init(GObject *o) struct _EMFolderViewPrivate *p; extern CamelSession *session; - gtk_box_set_homogeneous (GTK_BOX (emfv), FALSE); - - p = emfv->priv = g_malloc0(sizeof(struct _EMFolderViewPrivate)); - - emfv->statusbar_active = TRUE; - emfv->list_active = FALSE; - - emfv->ui_files = g_slist_append(NULL, - g_build_filename (EVOLUTION_UIDIR, - "evolution-mail-message.xml", - NULL)); - - emfv->ui_app_name = "evolution-mail"; +// gtk_box_set_homogeneous (GTK_BOX (emfv), FALSE); +// +// p = emfv->priv = g_malloc0(sizeof(struct _EMFolderViewPrivate)); +// +// emfv->statusbar_active = TRUE; +// emfv->list_active = FALSE; +// +// emfv->ui_files = g_slist_append(NULL, +// g_build_filename (EVOLUTION_UIDIR, +// "evolution-mail-message.xml", +// NULL)); +// +// emfv->ui_app_name = "evolution-mail"; emfv->enable_map = g_slist_prepend(NULL, (void *)emfv_enable_map); - emfv->list = (MessageList *)message_list_new(); - g_signal_connect(emfv->list, "message_selected", G_CALLBACK(emfv_list_message_selected), emfv); - g_signal_connect(emfv->list, "message_list_built", G_CALLBACK(emfv_list_built), emfv); +// emfv->list = (MessageList *)message_list_new(); +// g_signal_connect(emfv->list, "message_selected", G_CALLBACK(emfv_list_message_selected), emfv); +// g_signal_connect(emfv->list, "message_list_built", G_CALLBACK(emfv_list_built), emfv); /* FIXME: should this hang off message-list instead? */ - g_signal_connect(emfv->list->tree, "right_click", G_CALLBACK(emfv_list_right_click), emfv); +// g_signal_connect(emfv->list->tree, "right_click", G_CALLBACK(emfv_list_right_click), emfv); // g_signal_connect(emfv->list->tree, "double_click", G_CALLBACK(emfv_list_double_click), emfv); // g_signal_connect(emfv->list->tree, "key_press", G_CALLBACK(emfv_list_key_press), emfv); - g_signal_connect(emfv->list->tree, "selection_change", G_CALLBACK(emfv_list_selection_change), emfv); +// g_signal_connect(emfv->list->tree, "selection_change", G_CALLBACK(emfv_list_selection_change), emfv); emfv->preview = (EMFormatHTMLDisplay *)em_format_html_display_new(); /* FIXME: set_session should NOT be called here. Should it be a constructor attribute? */ em_format_set_session ((EMFormat *) emfv->preview, session); - g_signal_connect(emfv->preview, "link_clicked", G_CALLBACK(emfv_format_link_clicked), emfv); +// g_signal_connect(emfv->preview, "link_clicked", G_CALLBACK(emfv_format_link_clicked), emfv); g_signal_connect(emfv->preview, "popup_event", G_CALLBACK(emfv_format_popup_event), emfv); g_signal_connect (emfv->preview, "on_url", G_CALLBACK (emfv_on_url_cb), emfv); - g_signal_connect (((EMFormatHTML *)emfv->preview)->html, "button-release-event", G_CALLBACK (emfv_on_html_button_released_cb), emfv); +// g_signal_connect (((EMFormatHTML *)emfv->preview)->html, "button-release-event", G_CALLBACK (emfv_on_html_button_released_cb), emfv); #ifdef ENABLE_PROFILING g_signal_connect(emfv->preview, "complete", G_CALLBACK (emfv_format_complete), emfv); #endif @@ -293,84 +266,84 @@ emfv_init(GObject *o) emfv_setting_setup(emfv); } -static void -free_one_ui_file (gpointer data, - gpointer user_data) -{ - g_free (data); -} - -static void -emfv_finalise(GObject *o) -{ - EMFolderView *emfv = (EMFolderView *)o; - struct _EMFolderViewPrivate *p = emfv->priv; - - g_slist_foreach (emfv->ui_files, free_one_ui_file, NULL); - g_slist_free(emfv->ui_files); - g_slist_free(emfv->enable_map); - - g_free(p); - - ((GObjectClass *)emfv_parent)->finalize(o); -} - -static void -emfv_destroy (GtkObject *o) -{ - EMFolderView *emfv = (EMFolderView *) o; - struct _EMFolderViewPrivate *p = emfv->priv; - - p->destroyed = TRUE; - - if (emfv->list && emfv->list->seen_id) { - g_source_remove(emfv->list->seen_id); - emfv->list->seen_id = 0; - } - - if (p->setting_notify_id) { - GConfClient *gconf = gconf_client_get_default(); - - gconf_client_notify_remove(gconf, p->setting_notify_id); - p->setting_notify_id = 0; - g_object_unref(gconf); - } - - if (emfv->folder) { - camel_object_unref(emfv->folder); - g_free(emfv->folder_uri); - emfv->folder = NULL; - emfv->folder_uri = NULL; - } - - if (emfv->async) { - mail_async_event_destroy(emfv->async); - emfv->async = NULL; - } - - if (p->invisible) { - gtk_object_destroy((GtkObject *)p->invisible); - p->invisible = NULL; - } - - if (p->selected_id != 0) { - g_source_remove(p->selected_id); - p->selected_id = 0; - } - - g_free(p->selected_uid); - p->selected_uid = NULL; - - g_free (emfv->displayed_uid); - emfv->displayed_uid = NULL; +//static void +//free_one_ui_file (gpointer data, +// gpointer user_data) +//{ +// g_free (data); +//} - emfv->preview = NULL; - emfv->list = NULL; - emfv->preview_active = FALSE; - emfv->uic = NULL; +//static void +//emfv_finalise(GObject *o) +//{ +// EMFolderView *emfv = (EMFolderView *)o; +// struct _EMFolderViewPrivate *p = emfv->priv; +// +// g_slist_foreach (emfv->ui_files, free_one_ui_file, NULL); +/ g_slist_free(emfv->ui_files); +/// g_slist_free(emfv->enable_map); +// +// g_free(p); +// +// ((GObjectClass *)emfv_parent)->finalize(o); +//} - ((GtkObjectClass *) emfv_parent)->destroy (o); -} +//static void +//emfv_destroy (GtkObject *o) +//{ +// EMFolderView *emfv = (EMFolderView *) o; +// struct _EMFolderViewPrivate *p = emfv->priv; +// +// p->destroyed = TRUE; +// +// if (emfv->list && emfv->list->seen_id) { +// g_source_remove(emfv->list->seen_id); +// emfv->list->seen_id = 0; +// } +// +// if (p->setting_notify_id) { +// GConfClient *gconf = gconf_client_get_default(); +// +// gconf_client_notify_remove(gconf, p->setting_notify_id); +// p->setting_notify_id = 0; +// g_object_unref(gconf); +// } +// +// if (emfv->folder) { +// camel_object_unref(emfv->folder); +// g_free(emfv->folder_uri); +// emfv->folder = NULL; +// emfv->folder_uri = NULL; +// } +// +// if (emfv->async) { +// mail_async_event_destroy(emfv->async); +// emfv->async = NULL; +// } +// +// if (p->invisible) { +// gtk_object_destroy((GtkObject *)p->invisible); +// p->invisible = NULL; +// } +// +// if (p->selected_id != 0) { +// g_source_remove(p->selected_id); +// p->selected_id = 0; +// } +// +// g_free(p->selected_uid); +// p->selected_uid = NULL; +// +// g_free (emfv->displayed_uid); +// emfv->displayed_uid = NULL; +// +// emfv->preview = NULL; +// emfv->list = NULL; +// emfv->preview_active = FALSE; +// emfv->uic = NULL; +// +// ((GtkObjectClass *) emfv_parent)->destroy (o); +//} static void emfv_class_init(GObjectClass *klass) @@ -418,116 +391,115 @@ emfv_class_init(GObjectClass *klass) 0); } -GType -em_folder_view_get_type(void) -{ - static GType type = 0; - - if (type == 0) { - static const GTypeInfo info = { - sizeof(EMFolderViewClass), - NULL, NULL, - (GClassInitFunc)emfv_class_init, - NULL, NULL, - sizeof(EMFolderView), 0, - (GInstanceInitFunc)emfv_init - }; - emfv_parent = g_type_class_ref(gtk_vbox_get_type()); - type = g_type_register_static(gtk_vbox_get_type(), "EMFolderView", &info, 0); - } - - return type; -} - -GtkWidget *em_folder_view_new(void) -{ - EMFolderView *emfv = g_object_new(em_folder_view_get_type(), NULL); +//GType +//em_folder_view_get_type(void) +//{ +// static GType type = 0; +// +// if (type == 0) { +// static const GTypeInfo info = { +// sizeof(EMFolderViewClass), +// NULL, NULL, +// (GClassInitFunc)emfv_class_init, +// NULL, NULL, +// sizeof(EMFolderView), 0, +// (GInstanceInitFunc)emfv_init +// }; +// emfv_parent = g_type_class_ref(gtk_vbox_get_type()); +// type = g_type_register_static(gtk_vbox_get_type(), "EMFolderView", &info, 0); +// } +// +// return type; +//} - return (GtkWidget *)emfv; -} +//GtkWidget *em_folder_view_new(void) +//{ +// EMFolderView *emfv = g_object_new(em_folder_view_get_type(), NULL); +// +// return (GtkWidget *)emfv; +//} /* flag all selected messages. Return number flagged */ /* FIXME: Should this be part of message-list instead? */ -int -em_folder_view_mark_selected(EMFolderView *emfv, guint32 mask, guint32 set) -{ - GPtrArray *uids; - int i; - - if (emfv->folder == NULL) - return 0; - - uids = message_list_get_selected(emfv->list); - camel_folder_freeze(emfv->folder); - - for (i=0; i<uids->len; i++) - camel_folder_set_message_flags(emfv->folder, uids->pdata[i], mask, set); - - message_list_free_uids(emfv->list, uids); - camel_folder_thaw(emfv->folder); - - return i; -} +//int +//em_folder_view_mark_selected(EMFolderView *emfv, guint32 mask, guint32 set) +//{ +// GPtrArray *uids; +// int i; +// +// if (emfv->folder == NULL) +// return 0; +// +// uids = message_list_get_selected(emfv->list); +// camel_folder_freeze(emfv->folder); +// +// for (i=0; i<uids->len; i++) +// camel_folder_set_message_flags(emfv->folder, uids->pdata[i], mask, set); +// +// message_list_free_uids(emfv->list, uids); +// camel_folder_thaw(emfv->folder); +// +// return i; +//} /* should this be elsewhere/take a uid list? */ -int -em_folder_view_open_selected(EMFolderView *emfv) -{ - GPtrArray *uids, *views; - int i = 0; - - uids = message_list_get_selected(emfv->list); - - if (uids->len >= 10) { - char *num = g_strdup_printf("%d", uids->len); - int doit; - - doit = em_utils_prompt_user((GtkWindow *)gtk_widget_get_toplevel((GtkWidget *)emfv), - "/apps/evolution/mail/prompts/open_many", - "mail:ask-open-many", num, NULL); - g_free(num); - if (!doit) { - message_list_free_uids(emfv->list, uids); - return 0; - } - } - - if (em_utils_folder_is_drafts(emfv->folder, emfv->folder_uri) - || em_utils_folder_is_templates(emfv->folder, emfv->folder_uri) - || em_utils_folder_is_outbox(emfv->folder, emfv->folder_uri)) { - em_utils_edit_messages(emfv->folder, uids, TRUE); - return uids->len; - } - - /* for vfolders we need to edit the *original*, not the vfolder copy */ - views = g_ptr_array_new(); - for (i=0;i<uids->len;i++) { - if (camel_object_is((CamelObject *)emfv->folder, camel_vee_folder_get_type())) { - CamelVeeMessageInfo *vinfo = (CamelVeeMessageInfo *)camel_folder_get_message_info(emfv->folder, uids->pdata[i]); - - if (vinfo) { - char *uid; - /* TODO: get_location shouldn't strdup the uid */ - CamelFolder *f = camel_vee_folder_get_location((CamelVeeFolder *)emfv->folder, vinfo, &uid); - char *uri = mail_tools_folder_to_url(f); - - if (em_utils_folder_is_drafts(f, uri) || em_utils_folder_is_outbox(f, uri)) { - GPtrArray *edits = g_ptr_array_new(); - - g_ptr_array_add(edits, uid); - em_utils_edit_messages(f, edits, TRUE); - } else { - g_free(uid); - g_ptr_array_add(views, g_strdup(uids->pdata[i])); - } - g_free(uri); - } - } else { - g_ptr_array_add(views, g_strdup(uids->pdata[i])); - } - } +//int +//em_folder_view_open_selected(EMFolderView *emfv) +//{ +// GPtrArray *uids, *views; +// int i = 0; +// +// uids = message_list_get_selected(emfv->list); +// +// if (uids->len >= 10) { +// char *num = g_strdup_printf("%d", uids->len); +// int doit; +// +// doit = em_utils_prompt_user((GtkWindow *)gtk_widget_get_toplevel((GtkWidget *)emfv), +// "/apps/evolution/mail/prompts/open_many", +// "mail:ask-open-many", num, NULL); +// g_free(num); +// if (!doit) { +// message_list_free_uids(emfv->list, uids); +// return 0; +// } +// } +// +// if (em_utils_folder_is_drafts(emfv->folder, emfv->folder_uri) +// || em_utils_folder_is_templates(emfv->folder, emfv->folder_uri) +// || em_utils_folder_is_outbox(emfv->folder, emfv->folder_uri)) { +// em_utils_edit_messages(emfv->folder, uids, TRUE); +// return uids->len; +// } +// +// /* for vfolders we need to edit the *original*, not the vfolder copy */ +// views = g_ptr_array_new(); +// for (i=0;i<uids->len;i++) { +// if (camel_object_is((CamelObject *)emfv->folder, camel_vee_folder_get_type())) { +// CamelVeeMessageInfo *vinfo = (CamelVeeMessageInfo *)camel_folder_get_message_info(emfv->folder, uids->pdata[i]); +// +// if (vinfo) { +// char *uid; +// /* TODO: get_location shouldn't strdup the uid */ +// CamelFolder *f = camel_vee_folder_get_location((CamelVeeFolder *)emfv->folder, vinfo, &uid); +// char *uri = mail_tools_folder_to_url(f); +// +// if (em_utils_folder_is_drafts(f, uri) || em_utils_folder_is_outbox(f, uri)) { +// GPtrArray *edits = g_ptr_array_new(); +// +// g_ptr_array_add(edits, uid); +// em_utils_edit_messages(f, edits, TRUE); +// } else { +// g_free(uid); +// g_ptr_array_add(views, g_strdup(uids->pdata[i])); +// } +// g_free(uri); +// } +// } else { +// g_ptr_array_add(views, g_strdup(uids->pdata[i])); +// } +// } -#if 0 /* KILL-BONOBO */ /* TODO: have an em_utils_open_messages call? */ for (i=0; i<views->len; i++) { EMMessageBrowser *emmb; @@ -547,84 +519,81 @@ em_folder_view_open_selected(EMFolderView *emfv) em_utils_handle_receipt (emfv->folder, uids->pdata[i], NULL); g_free(views->pdata[i]); } -#endif - g_ptr_array_free(views, TRUE); - - message_list_free_uids(emfv->list, uids); - - return i; -} +// g_ptr_array_free(views, TRUE); +// +// message_list_free_uids(emfv->list, uids); +// +// return i; +//} /* ********************************************************************** */ -static void -emfv_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) -{ - int isout = (folder && uri - && (em_utils_folder_is_drafts(folder, uri) - || em_utils_folder_is_sent(folder, uri) - || em_utils_folder_is_outbox(folder, uri))); - - if (folder == emfv->folder) - return; - - if (emfv->priv->selected_id) - g_source_remove(emfv->priv->selected_id); - - if (emfv->preview) - em_format_format ((EMFormat *) emfv->preview, NULL, NULL, NULL); - - message_list_set_folder(emfv->list, folder, uri, isout); - g_free(emfv->folder_uri); - emfv->folder_uri = uri ? g_strdup(uri):NULL; - - if (emfv->folder) { - emfv->hide_deleted = emfv->list->hidedeleted; /* <- a bit nasty but makes it track the display better */ - mail_sync_folder (emfv->folder, NULL, NULL); - camel_object_unref(emfv->folder); - } - - emfv->folder = folder; - if (folder) { - /* We need to set this up to get the right view options for the message-list, - * even if we're not showing it */ -#if 0 /* KILL-BONOBO */ - emfv_setup_view_instance(emfv); -#endif - camel_object_ref(folder); - } - - emfv_enable_menus(emfv); - - /* TODO: should probably be called after all processing, not just this class's impl */ - g_signal_emit(emfv, signals[EMFV_LOADED], 0); -} - -static void -emfv_got_folder(char *uri, CamelFolder *folder, void *data) -{ - EMFolderView *emfv = data; - - em_folder_view_set_folder(emfv, folder, uri); -} +//static void +//emfv_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) +//{ +// int isout = (folder && uri +// && (em_utils_folder_is_drafts(folder, uri) +// || em_utils_folder_is_sent(folder, uri) +// || em_utils_folder_is_outbox(folder, uri))); +// +// if (folder == emfv->folder) +// return; +// +// if (emfv->priv->selected_id) +// g_source_remove(emfv->priv->selected_id); +// +// if (emfv->preview) +// em_format_format ((EMFormat *) emfv->preview, NULL, NULL, NULL); +// +// message_list_set_folder(emfv->list, folder, uri, isout); +// g_free(emfv->folder_uri); +// emfv->folder_uri = uri ? g_strdup(uri):NULL; +// +// if (emfv->folder) { +// emfv->hide_deleted = emfv->list->hidedeleted; /* <- a bit nasty but makes it track the display better */ +// mail_sync_folder (emfv->folder, NULL, NULL); +// camel_object_unref(emfv->folder); +// } +// +// emfv->folder = folder; +// if (folder) { +// /* We need to set this up to get the right view options for the message-list, +// * even if we're not showing it */ +// emfv_setup_view_instance(emfv); +// camel_object_ref(folder); +// } +// +// emfv_enable_menus(emfv); +// +// /* TODO: should probably be called after all processing, not just this class's impl */ +// g_signal_emit(emfv, signals[EMFV_LOADED], 0); +//} -static void -emfv_set_folder_uri(EMFolderView *emfv, const char *uri) -{ - mail_get_folder(uri, 0, emfv_got_folder, emfv, mail_msg_fast_ordered_push); -} +//static void +//emfv_got_folder(char *uri, CamelFolder *folder, void *data) +//{ +// EMFolderView *emfv = data; +// +// em_folder_view_set_folder(emfv, folder, uri); +//} -static void -emfv_set_message(EMFolderView *emfv, const char *uid, int nomarkseen) -{ - e_profile_event_emit("goto.uid", uid?uid:"<none>", 0); +//static void +//emfv_set_folder_uri(EMFolderView *emfv, const char *uri) +//{ +// mail_get_folder(uri, 0, emfv_got_folder, emfv, mail_msg_fast_ordered_push); +//} - /* This could possible race with other set messages, but likelyhood is small */ - emfv->priv->nomarkseen = nomarkseen; - message_list_select_uid(emfv->list, uid); - /* force an update, since we may not get an updated event if we select the same uid */ - emfv_list_message_selected(emfv->list, uid, emfv); -} +//static void +//emfv_set_message(EMFolderView *emfv, const char *uid, int nomarkseen) +//{ +// e_profile_event_emit("goto.uid", uid?uid:"<none>", 0); +// +// /* This could possible race with other set messages, but likelyhood is small */ +// emfv->priv->nomarkseen = nomarkseen; +// message_list_select_uid(emfv->list, uid); +// /* force an update, since we may not get an updated event if we select the same uid */ +// emfv_list_message_selected(emfv->list, uid, emfv); +//} /* ********************************************************************** */ @@ -655,33 +624,31 @@ emfv_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, EMFolder /* Popup menu In many cases these are the functions called by the bonobo callbacks too */ -static void -emfv_popup_open(EPopup *ep, EPopupItem *pitem, void *data) -{ - EMFolderView *emfv = data; - em_folder_view_open_selected(emfv); -} - -static void -emfv_popup_source(EPopup *ep, EPopupItem *pitem, void *data) -{ -#if 0 /* KILL-BONOBO */ - EMFolderView *emfv = data; - EMMessageBrowser *emmb; - GPtrArray *uids; - - uids = message_list_get_selected(emfv->list); - - emmb = (EMMessageBrowser *)em_message_browser_window_new(); - em_format_set_session((EMFormat *)((EMFolderView *)emmb)->preview, ((EMFormat *)emfv->preview)->session); - em_folder_view_set_folder((EMFolderView *)emmb, emfv->folder, emfv->folder_uri); - em_format_set_mode((EMFormat *)((EMFolderView *)emmb)->preview, EM_FORMAT_SOURCE); - em_folder_view_set_message((EMFolderView *)emmb, uids->pdata[0], FALSE); - gtk_widget_show(emmb->window); +//static void +//emfv_popup_open(EPopup *ep, EPopupItem *pitem, void *data) +//{ +// EMFolderView *emfv = data; +// em_folder_view_open_selected(emfv); +//} - message_list_free_uids(emfv->list, uids); -#endif -} +//static void +//emfv_popup_source(EPopup *ep, EPopupItem *pitem, void *data) +//{ +// EMFolderView *emfv = data; +// EMMessageBrowser *emmb; +// GPtrArray *uids; +// +// uids = message_list_get_selected(emfv->list); +// +// emmb = (EMMessageBrowser *)em_message_browser_window_new(); +// em_format_set_session((EMFormat *)((EMFolderView *)emmb)->preview, ((EMFormat *)emfv->preview)->session); +// em_folder_view_set_folder((EMFolderView *)emmb, emfv->folder, emfv->folder_uri); +// em_format_set_mode((EMFormat *)((EMFolderView *)emmb)->preview, EM_FORMAT_SOURCE); +// em_folder_view_set_message((EMFolderView *)emmb, uids->pdata[0], FALSE); +// gtk_widget_show(emmb->window); +// +// message_list_free_uids(emfv->list, uids); +//} //#define DelInVFolderCheckName "DelInVFolderCheck" //#define DelInVFolderKey "/apps/evolution/mail/prompts/delete_in_vfolder" @@ -1010,8 +977,8 @@ from(BonoboUIComponent *uid, void *data, const char *path) \ } //EMFV_MAP_CALLBACK(emfv_message_delete, emfv_popup_delete) -EMFV_MAP_CALLBACK(emfv_message_open, emfv_popup_open) -EMFV_MAP_CALLBACK(emfv_message_source, emfv_popup_source) +//EMFV_MAP_CALLBACK(emfv_message_open, emfv_popup_open) +//EMFV_MAP_CALLBACK(emfv_message_source, emfv_popup_source) static void prepare_offline(void *key, void *value, void *data) @@ -1061,22 +1028,21 @@ emfv_edit_paste(BonoboUIComponent *uid, void *data, const char *path) message_list_paste(emfv->list); } -static void -emfv_select_all_text(BonoboUIComponent *uid, void *data, const char *path) -{ - EMFolderView *emfv = data; - gboolean selected; - - gtk_html_select_all (((EMFormatHTML *)emfv->preview)->html); - selected = gtk_html_command (((EMFormatHTML *)emfv->preview)->html, "is-selection-active"); - bonobo_ui_component_set_prop(emfv->uic, "/commands/EditCopy", "sensitive", selected?"1":"0", NULL); - -} +//static void +//emfv_select_all_text(BonoboUIComponent *uid, void *data, const char *path) +//{ +// EMFolderView *emfv = data; +// gboolean selected; +// +// gtk_html_select_all (((EMFormatHTML *)emfv->preview)->html); +// selected = gtk_html_command (((EMFormatHTML *)emfv->preview)->html, "is-selection-active"); +// bonobo_ui_component_set_prop(emfv->uic, "/commands/EditCopy", "sensitive", selected?"1":"0", NULL); +// +//} static void emfv_message_search(BonoboUIComponent *uic, void *data, const char *path) { -#if 0 /* KILL-BONOBO */ EMFolderView *emfv = data; if (!emfv->list_active) /* We are in new mail window */ @@ -1086,7 +1052,6 @@ emfv_message_search(BonoboUIComponent *uic, void *data, const char *path) gtk_widget_grab_focus (((ESearchBar *)((EMFolderBrowser *) emfv)->search)->entry); gtk_option_menu_set_history (GTK_OPTION_MENU (((ESearchBar *)((EMFolderBrowser *) emfv)->search)->scopeoption), 3); } -#endif } static void @@ -1153,14 +1118,14 @@ static BonoboUIVerb emfv_message_verbs[] = { BONOBO_UI_UNSAFE_VERB ("EditCopy", emfv_edit_copy), BONOBO_UI_UNSAFE_VERB ("EditPaste", emfv_edit_paste), - BONOBO_UI_UNSAFE_VERB ("SelectAllText", emfv_select_all_text), +// BONOBO_UI_UNSAFE_VERB ("SelectAllText", emfv_select_all_text), // BONOBO_UI_UNSAFE_VERB ("MessageDelete", emfv_message_delete), // BONOBO_UI_UNSAFE_VERB ("MessageDeleteKey", emfv_message_delete), - BONOBO_UI_UNSAFE_VERB ("MessageOpen", emfv_message_open), +// BONOBO_UI_UNSAFE_VERB ("MessageOpen", emfv_message_open), BONOBO_UI_UNSAFE_VERB ("MessageSearch", emfv_message_search), - BONOBO_UI_UNSAFE_VERB ("ViewSource", emfv_message_source), +// BONOBO_UI_UNSAFE_VERB ("ViewSource", emfv_message_source), BONOBO_UI_VERB_END }; @@ -1309,10 +1274,8 @@ emfv_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act) bonobo_ui_component_set_translate (uic, "/", "<status><item name=\"main\"/></status>", NULL); /* We need to set this up to get the right view options for the message-list, even if we're not showing it */ -#if 0 /* KILL-BONOBO */ if (emfv->folder) emfv_setup_view_instance(emfv); -#endif } else { const BonoboUIVerb *v; @@ -1565,34 +1528,34 @@ emfv_message_selected_timeout(void *data) return FALSE; } -static void -emfv_list_message_selected(MessageList *ml, const char *uid, EMFolderView *emfv) -{ - e_profile_event_emit("goto.listuid", uid, 0); - - if (emfv->preview_active) { - if (emfv->priv->selected_id != 0) - g_source_remove(emfv->priv->selected_id); - - emfv->priv->selected_id = g_timeout_add(100, emfv_message_selected_timeout, emfv); - - g_free(emfv->priv->selected_uid); - emfv->priv->selected_uid = g_strdup(uid); - } - - emfv_enable_menus(emfv); - - g_signal_emit(emfv, signals[EMFV_CHANGED], 0); -} +//static void +//emfv_list_message_selected(MessageList *ml, const char *uid, EMFolderView *emfv) +//{ +// e_profile_event_emit("goto.listuid", uid, 0); +// +// if (emfv->preview_active) { +// if (emfv->priv->selected_id != 0) +// g_source_remove(emfv->priv->selected_id); +// +// emfv->priv->selected_id = g_timeout_add(100, emfv_message_selected_timeout, emfv); +// +// g_free(emfv->priv->selected_uid); +// emfv->priv->selected_uid = g_strdup(uid); +// } +// +// emfv_enable_menus(emfv); +// +// g_signal_emit(emfv, signals[EMFV_CHANGED], 0); +//} -static void -emfv_list_built(MessageList *ml, EMFolderView *emfv) -{ - if (!emfv->priv->destroyed) { - emfv_enable_menus(emfv); - g_signal_emit(emfv, signals[EMFV_LOADED], 0); - } -} +//static void +//emfv_list_built(MessageList *ml, EMFolderView *emfv) +//{ +// if (!emfv->priv->destroyed) { +// emfv_enable_menus(emfv); +// g_signal_emit(emfv, signals[EMFV_LOADED], 0); +// } +//} //static void //emfv_list_double_click(ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, EMFolderView *emfv) @@ -1604,13 +1567,13 @@ emfv_list_built(MessageList *ml, EMFolderView *emfv) // em_folder_view_open_selected(emfv); //} -static int -emfv_list_right_click(ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, EMFolderView *emfv) -{ - emfv_popup(emfv, event, FALSE); - - return TRUE; -} +//static int +//emfv_list_right_click(ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, EMFolderView *emfv) +//{ +// emfv_popup(emfv, event, FALSE); +// +// return TRUE; +//} //static int //emfv_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, EMFolderView *emfv) @@ -1679,39 +1642,39 @@ emfv_popup_menu (GtkWidget *widget) return TRUE; } -static void -emfv_list_selection_change(ETree *tree, EMFolderView *emfv) -{ - /* we can't just listen to the message-list message selected thing, since we dont get them - in all cases. blah */ - g_signal_emit(emfv, signals[EMFV_CHANGED], 0); -} - -static void -emfv_format_link_clicked(EMFormatHTMLDisplay *efhd, const char *uri, EMFolderView *emfv) -{ - if (!strncmp (uri, "##", 2)) - return; - - if (!g_ascii_strncasecmp (uri, "mailto:", 7)) { - em_utils_compose_new_message_with_mailto (uri, emfv->folder_uri); - } else if (*uri == '#') { - gtk_html_jump_to_anchor (((EMFormatHTML *) efhd)->html, uri + 1); - } else if (!g_ascii_strncasecmp (uri, "thismessage:", 12)) { - /* ignore */ - } else if (!g_ascii_strncasecmp (uri, "cid:", 4)) { - /* ignore */ - } else { - GError *err = NULL; - - gnome_url_show (uri, &err); +//static void +//emfv_list_selection_change(ETree *tree, EMFolderView *emfv) +//{ +// /* we can't just listen to the message-list message selected thing, since we dont get them +// in all cases. blah */ +// g_signal_emit(emfv, signals[EMFV_CHANGED], 0); +//} - if (err) { - g_warning ("gnome_url_show: %s", err->message); - g_error_free (err); - } - } -} +//static void +//emfv_format_link_clicked(EMFormatHTMLDisplay *efhd, const char *uri, EMFolderView *emfv) +//{ +// if (!strncmp (uri, "##", 2)) +// return; +// +// if (!g_ascii_strncasecmp (uri, "mailto:", 7)) { +// em_utils_compose_new_message_with_mailto (uri, emfv->folder_uri); +// } else if (*uri == '#') { +// gtk_html_jump_to_anchor (((EMFormatHTML *) efhd)->html, uri + 1); +// } else if (!g_ascii_strncasecmp (uri, "thismessage:", 12)) { +// /* ignore */ +// } else if (!g_ascii_strncasecmp (uri, "cid:", 4)) { +// /* ignore */ +// } else { +// GError *err = NULL; +// +// gnome_url_show (uri, &err); +/ +/// if (err) { +// g_warning ("gnome_url_show: %s", err->message); +// g_error_free (err); +// } +// } +//} static gchar * url_unescape_amp (const gchar *url) @@ -2026,7 +1989,6 @@ static GHashTable *emfv_setting_key; static void emfv_setting_notify(GConfClient *gconf, guint cnxn_id, GConfEntry *entry, EMFolderView *emfv) { -#if 0 /* KILL-BONOBO */ GConfValue *value; char *tkey; @@ -2190,7 +2152,6 @@ emfv_setting_notify(GConfClient *gconf, guint cnxn_id, GConfEntry *entry, EMFold gtk_paned_set_position (GTK_PANED (emfb->vpane), paned_size); break; } } -#endif } static void @@ -2285,14 +2246,14 @@ emfv_on_url_cb (GObject *emitter, const char *url, EMFolderView *emfv) g_free (nice_url); } -static gboolean -emfv_on_html_button_released_cb (GtkHTML *html, GdkEventButton *button, EMFolderView *emfv) -{ - gboolean selected; - - selected = gtk_html_command (html, "is-selection-active"); - bonobo_ui_component_set_prop(emfv->uic, "/commands/EditCopy", "sensitive", selected?"1":"0", NULL); - - return FALSE; -} +//static gboolean +//emfv_on_html_button_released_cb (GtkHTML *html, GdkEventButton *button, EMFolderView *emfv) +//{ +// gboolean selected; +// +// selected = gtk_html_command (html, "is-selection-active"); +// bonobo_ui_component_set_prop(emfv->uic, "/commands/EditCopy", "sensitive", selected?"1":"0", NULL); +// +// return FALSE; +//} diff --git a/mail/em-menu.c b/mail/em-menu.c index 9894054dc7..fc2e43d455 100644 --- a/mail/em-menu.c +++ b/mail/em-menu.c @@ -29,8 +29,6 @@ #include <gtk/gtk.h> -#include <libgnome/gnome-url.h> - #include "em-menu.h" #include "libedataserver/e-msgport.h" #include "em-utils.h" diff --git a/mail/em-popup.c b/mail/em-popup.c index 34abb6a0a9..18d4875a8d 100644 --- a/mail/em-popup.c +++ b/mail/em-popup.c @@ -31,8 +31,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <libgnome/gnome-url.h> - #include "em-popup.h" #include "libedataserver/e-msgport.h" #include "em-utils.h" @@ -587,13 +585,9 @@ static void emp_uri_popup_link_open(EPopup *ep, EPopupItem *item, void *data) { EMPopupTargetURI *t = (EMPopupTargetURI *)ep->target; - GError *err = NULL; - gnome_url_show(t->uri, &err); - if (err) { - g_warning("gnome_url_show: %s", err->message); - g_error_free(err); - } + /* FIXME Pass a parent window. */ + e_show_uri (NULL, t->uri); } static void diff --git a/plugins/mailing-list-actions/mailing-list-actions.c b/plugins/mailing-list-actions/mailing-list-actions.c index 9772fc22e4..7d586c32c7 100644 --- a/plugins/mailing-list-actions/mailing-list-actions.c +++ b/plugins/mailing-list-actions/mailing-list-actions.c @@ -29,7 +29,6 @@ #include <string.h> #include <gtk/gtk.h> #include <gconf/gconf-client.h> -#include <libgnome/gnome-url.h> #include "camel/camel-multipart.h" #include "camel/camel-mime-part.h" @@ -170,11 +169,9 @@ void emla_list_action_do (CamelFolder *folder, const char *uid, CamelMimeMessage goto exit; } else { - GError *err = NULL; - gnome_url_show (url, &err); - if (!err) - goto exit; - g_error_free (err); + /* FIXME Pass a parent window. */ + e_show_uri (NULL, url); + goto exit; } g_free (url); url = NULL; diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c index cf513669c8..3ab8b8e7dd 100644 --- a/shell/e-shell-window-actions.c +++ b/shell/e-shell-window-actions.c @@ -735,15 +735,7 @@ static void action_faq_cb (GtkAction *action, EShellWindow *shell_window) { - GError *error = NULL; - - gtk_show_uri (NULL, EVOLUTION_FAQ, GDK_CURRENT_TIME, &error); - - if (error != NULL) { - /* FIXME Show an error dialog. */ - g_warning ("%s", error->message); - g_error_free (error); - } + e_show_uri (GTK_WINDOW (shell_window), EVOLUTION_FAQ); } /** diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c index ef36b0e9c9..2a9adc67ac 100644 --- a/shell/e-shell-window.c +++ b/shell/e-shell-window.c @@ -760,7 +760,7 @@ e_shell_window_set_safe_mode (EShellWindow *shell_window, * * Registers a list of #GtkAction<!-- -->s to appear in * @shell_window<!-- -->'s "New" menu and toolbar button. This - * function should be called from an #EShellModule<!-- -->'s + * function should be called from an #EShell<!-- -->'s * #EShell::window-created signal handler. The #EShellModule calling * this function should pass its own name for the @module_name argument * (i.e. the <structfield>name</structfield> field from its own @@ -849,7 +849,7 @@ e_shell_window_register_new_item_actions (EShellWindow *shell_window, * * Registers a list of #GtkAction<!-- -->s to appear in * @shell_window<!-- -->'s "New" menu and toolbar button. This - * function should be called from an #EShellModule<!-- -->'s + * function should be called from an #EShell<!-- -->'s * #EShell::window-created signal handler. The #EShellModule calling * this function should pass its own name for the @module_name argument * (i.e. the <structfield>name</structfield> field from its own diff --git a/ui/evolution-mail-reader.ui b/ui/evolution-mail-reader.ui index e5ef5db624..a14db5090d 100644 --- a/ui/evolution-mail-reader.ui +++ b/ui/evolution-mail-reader.ui @@ -123,4 +123,35 @@ <toolitem action='mail-next'/> </placeholder> </toolbar> + <popup name='mail-message-popup'> + <menuitem action='mail-reply-sender'/> + <menuitem action='mail-reply-all'/> + <menuitem action='mail-forward'/> + <separator/> + <menuitem action='mail-message-edit'/> + <menuitem action='mail-save-as'/> + <menuitem action='mail-print'/> + <separator/> + <menuitem action='mail-delete'/> + <menuitem action='mail-copy'/> + <menuitem action='mail-move'/> + <separator/> + <menuitem action='mail-popup-mark-read'/> + <menuitem action='mail-popup-mark-unread'/> + <menuitem action='mail-popup-mark-important'/> + <menuitem action='mail-popup-mark-unimportant'/> + <menuitem action='mail-popup-mark-junk'/> + <menuitem action='mail-popup-mark-notjunk'/> + <menuitem action='mail-popup-flag-for-followup'/> + <menu action='mail-label-menu'/> + </popup> + <popup name='mail-uri-popup'> + <menuitem action='mail-uri-call-to'/> + <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> diff --git a/ui/evolution-mail.ui b/ui/evolution-mail.ui index 665d8900ad..76e93a43b4 100644 --- a/ui/evolution-mail.ui +++ b/ui/evolution-mail.ui @@ -80,34 +80,6 @@ <separator/> <menuitem action='mail-folder-properties'/> </popup> - <popup name='mail-message-popup'> - <menuitem action='mail-reply-sender'/> - <menuitem action='mail-reply-all'/> - <menuitem action='mail-forward'/> - <separator/> - <menuitem action='mail-message-edit'/> - <menuitem action='mail-save-as'/> - <menuitem action='mail-print'/> - <separator/> - <menuitem action='mail-delete'/> - <menuitem action='mail-copy'/> - <menuitem action='mail-move'/> - <separator/> - <menuitem action='mail-mark-unread'/> - <menuitem action='mail-mark-important'/> - <menuitem action='mail-mark-junk'/> - <menuitem action='mail-flag-for-followup'/> - <menu action='mail-label-menu'/> - </popup> - <popup name='mail-uri-popup'> - <menuitem action='mail-uri-call-to'/> - <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> <popup name='mail-search-options'> <menuitem action='mail-search-subject-or-sender-contains'/> <menuitem action='mail-search-subject-or-recipients-contains'/> diff --git a/widgets/misc/e-attachment-bar.c b/widgets/misc/e-attachment-bar.c index bdb6852e13..2da9d3541c 100644 --- a/widgets/misc/e-attachment-bar.c +++ b/widgets/misc/e-attachment-bar.c @@ -993,7 +993,6 @@ static gboolean eab_icon_clicked_cb (EAttachmentBar *bar, GdkEvent *event, gpointer *dummy) { EAttachment *attachment; - GError *error = NULL; gboolean ret = FALSE; CamelURL *url; char *path; @@ -1015,13 +1014,8 @@ eab_icon_clicked_cb (EAttachmentBar *bar, GdkEvent *event, gpointer *dummy) g_free (path); } - /* launch the url now */ - gnome_url_show (attachment->store_uri, &error); - if (error) { - g_message ("DEBUG: Launch failed: %s\n", error->message); - g_error_free (error); - error = NULL; - } + /* FIXME Pass a parent window. */ + e_show_uri (NULL, attachment->store_uri); ret = TRUE; } diff --git a/widgets/misc/e-url-entry.c b/widgets/misc/e-url-entry.c index 26d081fc85..32490f6590 100644 --- a/widgets/misc/e-url-entry.c +++ b/widgets/misc/e-url-entry.c @@ -25,9 +25,9 @@ #endif #include <gtk/gtk.h> -#include <libgnome/gnome-url.h> #include <glib/gi18n.h> #include "e-url-entry.h" +#include "e-util/e-util.h" struct _EUrlEntryPrivate { GtkWidget *entry; @@ -170,11 +170,15 @@ button_clicked_cb (GtkWidget *widget, gpointer data) { EUrlEntry *url_entry; EUrlEntryPrivate *priv; + const gchar *uri; url_entry = E_URL_ENTRY (data); priv = url_entry->priv; - gnome_url_show (gtk_entry_get_text (GTK_ENTRY (priv->entry)), NULL); + uri = gtk_entry_get_text (GTK_ENTRY (priv->entry)); + + /* FIXME Pass a parent window. */ + e_show_uri (NULL, uri); } static void |