From 19f1e3fe20c29690aaf07d26e81760405cc577df Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 7 Jan 2009 21:27:06 +0000 Subject: Fix some miscellaneous mailer bugs. svn path=/branches/kill-bonobo/; revision=37011 --- mail/e-mail-reader.c | 62 ++++++++++++++++++++-- mail/e-mail-reader.h | 2 + mail/e-mail-shell-content.c | 5 +- mail/e-mail-shell-view-actions.c | 60 ++------------------- mail/em-folder-browser.c | 102 ++++++++++++++++++------------------ mail/evolution-mail.schemas.in | 19 ++++--- widgets/table/e-table-header-item.c | 5 +- 7 files changed, 133 insertions(+), 122 deletions(-) diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index 93279c2bfe..5a623baa96 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -548,7 +548,6 @@ static void action_mail_message_open_cb (GtkAction *action, EMailReader *reader) { - /* FIXME This belongs in EMailShellView */ e_mail_reader_open_selected (reader); } @@ -1456,15 +1455,29 @@ mail_reader_key_press_cb (EMailReader *reader, const gchar *action_name; if ((event->key.state & GDK_CONTROL_MASK) != 0) - return FALSE; + goto ctrl; + /* alone */ switch (event->key.keyval) { + case GDK_Delete: + case GDK_KP_Delete: + action_name = "mail-delete"; + break; + case GDK_Return: case GDK_KP_Enter: case GDK_ISO_Enter: action_name = "mail-message-open"; break; + case GDK_period: + action_name = "mail-next-unread"; + break; + + case GDK_comma: + action_name = "mail-previous-unread"; + break; + #ifdef HAVE_XFREE case XF86XK_Reply: action_name = "mail-reply-all"; @@ -1483,6 +1496,25 @@ mail_reader_key_press_cb (EMailReader *reader, return FALSE; } + goto exit; + +ctrl: + + /* Ctrl + */ + switch (event->key.keyval) { + case GDK_period: + action_name = "mail-next-unread"; + break; + + case GDK_comma: + action_name = "mail-previous-unread"; + break; + + default: + return FALSE; + } + +exit: e_mail_reader_activate (reader, action_name); return TRUE; @@ -1520,7 +1552,6 @@ mail_reader_message_loaded_cb (CamelFolder *folder, EMEventTargetMessage *target; gboolean mark_read; gint timeout_interval; - gpointer data; html_display = e_mail_reader_get_html_display (reader); message_list = e_mail_reader_get_message_list (reader); @@ -1675,7 +1706,6 @@ mail_reader_set_message (EMailReader *reader, gboolean mark_read) { MessageList *message_list; - gpointer data; message_list = e_mail_reader_get_message_list (reader); message_list_select_uid (message_list, uid); @@ -1907,6 +1937,30 @@ e_mail_reader_set_folder (EMailReader *reader, iface->set_folder (reader, folder, folder_uri); } +/* Helper for e_mail_reader_set_folder_uri() */ +static void +mail_reader_got_folder_cb (gchar *folder_uri, + CamelFolder *folder, + gpointer user_data) +{ + EMailReader *reader = user_data; + + e_mail_reader_set_folder (reader, folder, folder_uri); +} + +void +e_mail_reader_set_folder_uri (EMailReader *reader, + const gchar *folder_uri) +{ + g_return_if_fail (E_IS_MAIL_READER (reader)); + g_return_if_fail (folder_uri != NULL); + + /* Fetch the CamelFolder asynchronously. */ + mail_get_folder ( + folder_uri, 0, mail_reader_got_folder_cb, + reader, mail_msg_fast_ordered_push); +} + void e_mail_reader_set_message (EMailReader *reader, const gchar *uid, diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h index 4fba37056f..bb9e8d461f 100644 --- a/mail/e-mail-reader.h +++ b/mail/e-mail-reader.h @@ -82,6 +82,8 @@ GtkWindow * e_mail_reader_get_window (EMailReader *reader); void e_mail_reader_set_folder (EMailReader *reader, CamelFolder *folder, const gchar *folder_uri); +void e_mail_reader_set_folder_uri (EMailReader *reader, + const gchar *folder_uri); void e_mail_reader_set_message (EMailReader *reader, const gchar *uid, gboolean mark_read); diff --git a/mail/e-mail-shell-content.c b/mail/e-mail-shell-content.c index c846a83d5d..e06e68acfc 100644 --- a/mail/e-mail-shell-content.c +++ b/mail/e-mail-shell-content.c @@ -663,6 +663,8 @@ e_mail_shell_content_set_vertical_view (EMailShellContent *mail_shell_content, mail_shell_content->priv->paned_binding_id = binding_id; mail_shell_content->priv->paned = g_object_ref (new_paned); + e_mail_shell_content_update_view_instance (mail_shell_content); + g_object_notify (G_OBJECT (mail_shell_content), "vertical-view"); } @@ -700,12 +702,11 @@ e_mail_shell_content_update_view_instance (EMailShellContent *mail_shell_content mail_shell_content->priv->view_instance = NULL; } - /* TODO: Should this go through the mail-config API? */ view_id = mail_config_folder_to_safe_url (folder_view->folder); view_instance = e_shell_view_new_view_instance (shell_view, view_id); mail_shell_content->priv->view_instance = view_instance; - show_vertical_view = folder_view->list_active && + show_vertical_view = e_mail_shell_content_get_vertical_view (mail_shell_content); if (show_vertical_view) { diff --git a/mail/e-mail-shell-view-actions.c b/mail/e-mail-shell-view-actions.c index 5b26c8a67d..611ceff204 100644 --- a/mail/e-mail-shell-view-actions.c +++ b/mail/e-mail-shell-view-actions.c @@ -455,24 +455,6 @@ static GtkActionEntry mail_entries[] = { NULL, /* XXX Add a tooltip! */ G_CALLBACK (action_mail_create_search_folder_cb) }, -#if 0 - /* XXX Work around one-accelerator-per-action limit. */ - { "mail-delete-1", - NULL, - NULL, - "Delete", - NULL, - G_CALLBACK (action_mail_delete_cb) }, - - /* XXX Work around one-accelerator-per-action limit. */ - { "mail-delete-2", - NULL, - NULL, - "KP_Delete", - NULL, - G_CALLBACK (action_mail_delete_cb) }, -#endif - { "mail-download", NULL, N_("_Download Messages for Offline Usage"), @@ -592,40 +574,6 @@ static GtkActionEntry mail_entries[] = { N_("Temporarily hide the selected messages"), G_CALLBACK (action_mail_hide_selected_cb) }, -#if 0 - /* XXX Work around one-accelerator-per-action limit. */ - { "mail-next-unread-1", - NULL, - NULL, - "period", - NULL, - G_CALLBACK (action_mail_next_unread_cb) }, - - /* XXX Work around one-accelerator-per-action limit. */ - { "mail-next-unread-2", - NULL, - NULL, - "period", - NULL, - G_CALLBACK (action_mail_next_unread_cb) }, - - /* XXX Work around one-accelerator-per-action limit. */ - { "mail-previous-unread-1", - NULL, - NULL, - "comma", - NULL, - G_CALLBACK (action_mail_previous_unread_cb) }, - - /* XXX Work around one-accelerator-per-action limit. */ - { "mail-previous-unread-2", - NULL, - NULL, - "comma", - NULL, - G_CALLBACK (action_mail_previous_unread_cb) }, -#endif - { "mail-show-hidden", NULL, N_("Show Hidde_n Messages"), @@ -1029,11 +977,11 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) key = "/apps/evolution/mail/display/show_preview"; gconf_bridge_bind_property (bridge, key, object, "active"); - object = G_OBJECT (ACTION (MAIL_VIEW_VERTICAL)); - key = "/apps/evolution/mail/display/show_wide"; - gconf_bridge_bind_property (bridge, key, object, "active"); - object = G_OBJECT (ACTION (MAIL_THREADS_GROUP_BY)); key = "/apps/evolution/mail/display/thread_list"; gconf_bridge_bind_property (bridge, key, object, "active"); + + object = G_OBJECT (ACTION (MAIL_VIEW_VERTICAL)); + key = "/apps/evolution/mail/display/layout"; + gconf_bridge_bind_property (bridge, key, object, "current-value"); } diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c index 1822d04fcb..7522149c7d 100644 --- a/mail/em-folder-browser.c +++ b/mail/em-folder-browser.c @@ -246,36 +246,36 @@ static ESearchBarItem emfb_search_scope_items[] = { static EMFolderViewClass *emfb_parent; /* Needed since the paned wont take the position its given otherwise ... */ -static void -emfb_pane_realised(GtkWidget *w, EMFolderBrowser *emfb) -{ - GConfClient *gconf; - - gconf = mail_config_get_gconf_client (); - - if (emfb->priv->show_wide) - gtk_paned_set_position((GtkPaned *)emfb->vpane, gconf_client_get_int(gconf, "/apps/evolution/mail/display/hpaned_size", NULL)); - else - gtk_paned_set_position((GtkPaned *)emfb->vpane, gconf_client_get_int(gconf, "/apps/evolution/mail/display/paned_size", NULL)); -} - -static gboolean -emfb_pane_button_release_event(GtkWidget *w, GdkEventButton *e, EMFolderBrowser *emfb) -{ - GConfClient *gconf = mail_config_get_gconf_client (); - - if (GTK_WIDGET_REALIZED (w)) { - if (emfb->priv->show_wide) - gconf_client_set_int(gconf, "/apps/evolution/mail/display/hpaned_size", - gtk_paned_get_position(GTK_PANED(w)), NULL); - else - gconf_client_set_int(gconf, "/apps/evolution/mail/display/paned_size", - gtk_paned_get_position(GTK_PANED(w)), NULL); - - } +//static void +//emfb_pane_realised(GtkWidget *w, EMFolderBrowser *emfb) +//{ +// GConfClient *gconf; +// +// gconf = mail_config_get_gconf_client (); +// +// if (emfb->priv->show_wide) +// gtk_paned_set_position((GtkPaned *)emfb->vpane, gconf_client_get_int(gconf, "/apps/evolution/mail/display/hpaned_size", NULL)); +// else +// gtk_paned_set_position((GtkPaned *)emfb->vpane, gconf_client_get_int(gconf, "/apps/evolution/mail/display/paned_size", NULL)); +//} - return FALSE; -} +//static gboolean +//emfb_pane_button_release_event(GtkWidget *w, GdkEventButton *e, EMFolderBrowser *emfb) +//{ +// GConfClient *gconf = mail_config_get_gconf_client (); +// +// if (GTK_WIDGET_REALIZED (w)) { +// if (emfb->priv->show_wide) +// gconf_client_set_int(gconf, "/apps/evolution/mail/display/hpaned_size", +// gtk_paned_get_position(GTK_PANED(w)), NULL); +// else +// gconf_client_set_int(gconf, "/apps/evolution/mail/display/paned_size", +// gtk_paned_get_position(GTK_PANED(w)), NULL); +// +// } +// +// return FALSE; +//} static void free_one_ui_file (gpointer data, @@ -493,21 +493,21 @@ emfb_init(GObject *o) g_signal_connect_after (((EMFormatHTML *)(emfb->view.preview))->html, "scroll", G_CALLBACK (html_scroll), emfb); - g_slist_foreach (emfb->view.ui_files, free_one_ui_file, NULL); - g_slist_free(emfb->view.ui_files); - - emfb->view.ui_files = g_slist_append(NULL, - g_build_filename (EVOLUTION_UIDIR, - "evolution-mail-global.xml", - NULL)); - emfb->view.ui_files = g_slist_append(emfb->view.ui_files, - g_build_filename (EVOLUTION_UIDIR, - "evolution-mail-list.xml", - NULL)); - emfb->view.ui_files = g_slist_append(emfb->view.ui_files, - g_build_filename (EVOLUTION_UIDIR, - "evolution-mail-message.xml", - NULL)); +// g_slist_foreach (emfb->view.ui_files, free_one_ui_file, NULL); +// g_slist_free(emfb->view.ui_files); + +// emfb->view.ui_files = g_slist_append(NULL, +// g_build_filename (EVOLUTION_UIDIR, +// "evolution-mail-global.xml", +// NULL)); +// emfb->view.ui_files = g_slist_append(emfb->view.ui_files, +// g_build_filename (EVOLUTION_UIDIR, +// "evolution-mail-list.xml", +// NULL)); +// emfb->view.ui_files = g_slist_append(emfb->view.ui_files, +// g_build_filename (EVOLUTION_UIDIR, +// "evolution-mail-message.xml", +// NULL)); emfb->view.enable_map = g_slist_prepend(emfb->view.enable_map, (void *)emfb_enable_map); @@ -539,13 +539,13 @@ emfb_init(GObject *o) emfb->priv->labels_change_notify_id = gconf_client_notify_add (gconf, E_UTIL_LABELS_GCONF_KEY, gconf_labels_changed, emfb, NULL, NULL); } - emfb->priv->show_wide = gconf_client_get_bool(mail_config_get_gconf_client(), "/apps/evolution/mail/display/show_wide", NULL); - emfb->vpane = emfb->priv->show_wide?gtk_hpaned_new():gtk_vpaned_new(); +// emfb->priv->show_wide = gconf_client_get_bool(mail_config_get_gconf_client(), "/apps/evolution/mail/display/show_wide", NULL); +// emfb->vpane = emfb->priv->show_wide?gtk_hpaned_new():gtk_vpaned_new(); - g_signal_connect(emfb->vpane, "realize", G_CALLBACK(emfb_pane_realised), emfb); - emfb->priv->vpane_resize_id = g_signal_connect(emfb->vpane, "button_release_event", G_CALLBACK(emfb_pane_button_release_event), emfb); +// g_signal_connect(emfb->vpane, "realize", G_CALLBACK(emfb_pane_realised), emfb); +// emfb->priv->vpane_resize_id = g_signal_connect(emfb->vpane, "button_release_event", G_CALLBACK(emfb_pane_button_release_event), emfb); - gtk_widget_show(emfb->vpane); +// gtk_widget_show(emfb->vpane); gtk_box_pack_start_defaults((GtkBox *)emfb, emfb->vpane); @@ -766,8 +766,8 @@ void em_folder_browser_show_wide(EMFolderBrowser *emfb, gboolean state) w = emfb->priv->show_wide?gtk_hpaned_new():gtk_vpaned_new(); g_signal_handler_disconnect(emfb->vpane, emfb->priv->vpane_resize_id); - g_signal_connect(w, "realize", G_CALLBACK(emfb_pane_realised), emfb); - emfb->priv->vpane_resize_id = g_signal_connect(w, "button_release_event", G_CALLBACK(emfb_pane_button_release_event), emfb); +// g_signal_connect(w, "realize", G_CALLBACK(emfb_pane_realised), emfb); +// emfb->priv->vpane_resize_id = g_signal_connect(w, "button_release_event", G_CALLBACK(emfb_pane_button_release_event), emfb); gtk_box_pack_start_defaults((GtkBox *)emfb, w); gtk_widget_reparent((GtkWidget *)emfb->view.list, w); diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in index d74295f669..3dca693698 100644 --- a/mail/evolution-mail.schemas.in +++ b/mail/evolution-mail.schemas.in @@ -570,16 +570,19 @@ - /schemas/apps/evolution/mail/display/show_wide - /apps/evolution/mail/display/show_wide + /schemas/apps/evolution/mail/display/layout + /apps/evolution/mail/display/layout evolution-mail - bool - false + int + 0 - Use side-by-side or wide layout - - If the "Preview" pane is on, then show it side-by-side rather than vertically. - + Layout style + + The layout style determines where to place the preview pane + in relation to the message list. "0" (Classic View) places + the preview pane below the message list. "1" (Vertical View) + places the preview pane next to the message list. + diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index 7ffb1776ae..a7da9e2fe1 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -913,7 +913,10 @@ ethi_unrealize (GnomeCanvasItem *item) { ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item); - pango_font_description_free (ethi->font_desc); + if (ethi->font_desc != NULL) { + pango_font_description_free (ethi->font_desc); + ethi->font_desc = NULL; + } g_signal_handler_disconnect (item->canvas, ethi->drag_motion_id); g_signal_handler_disconnect (item->canvas, ethi->drag_leave_id); -- cgit