diff options
author | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-08-21 13:59:48 +0800 |
---|---|---|
committer | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-08-21 13:59:48 +0800 |
commit | 8177c10b7843a873cb1feefd390363c1518e805d (patch) | |
tree | 6aee4ef68a89a641f257b75de573ef29bda60762 | |
parent | b8bb5bc3cdd673a93aec5d7f820eaf8fc5c63d84 (diff) | |
download | gsoc2013-evolution-8177c10b7843a873cb1feefd390363c1518e805d.tar.gz gsoc2013-evolution-8177c10b7843a873cb1feefd390363c1518e805d.tar.zst gsoc2013-evolution-8177c10b7843a873cb1feefd390363c1518e805d.zip |
Fixes a lot of search issues
svn path=/trunk/; revision=32607
-rw-r--r-- | calendar/ChangeLog | 6 | ||||
-rw-r--r-- | calendar/gui/cal-search-bar.c | 134 | ||||
-rw-r--r-- | mail/ChangeLog | 14 | ||||
-rw-r--r-- | mail/em-folder-browser.c | 161 | ||||
-rw-r--r-- | mail/em-folder-view.c | 24 | ||||
-rw-r--r-- | mail/em-folder-view.h | 3 | ||||
-rw-r--r-- | mail/em-message-browser.c | 3 |
7 files changed, 260 insertions, 85 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index b9d5da268f..87d7c7fefd 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,9 @@ +2006-08-21 Srinivasa Ragavan <sragavan@novell.com> + + * gui/cal-search-bar.c: (string_without_underscores), + (generate_viewoption_menu), (make_suboptions): Fixes few search + issues. + 2006-08-18 Chenthill Palanisamy <pchenthill@novell.com> Fixes #343369 diff --git a/calendar/gui/cal-search-bar.c b/calendar/gui/cal-search-bar.c index 437d09f62b..cdb9d2de42 100644 --- a/calendar/gui/cal-search-bar.c +++ b/calendar/gui/cal-search-bar.c @@ -30,8 +30,13 @@ #include <gtk/gtkoptionmenu.h> #include <gtk/gtksignal.h> #include <libgnome/gnome-i18n.h> +#include <e-util/e-icon-factory.h> #include "cal-search-bar.h" +typedef struct CALSearchBarItem { + ESearchBarItem search; + char *image; +}CALSearchBarItem; /* IDs and option items for the ESearchBar */ enum { @@ -337,55 +342,126 @@ cal_search_bar_search_activated (ESearchBar *search) + +static char * +string_without_underscores (const char *s) +{ + char *new_string; + const char *sp; + char *dp; + + new_string = g_malloc (strlen (s) + 1); + + dp = new_string; + for (sp = s; *sp != '\0'; sp ++) { + if (*sp != '_') { + *dp = *sp; + dp ++; + } else if (sp[1] == '_') { + /* Translate "__" in "_". */ + *dp = '_'; + dp ++; + sp ++; + } + } + *dp = 0; + + return new_string; +} + +static GtkWidget * +generate_viewoption_menu (CALSearchBarItem *subitems) +{ + GtkWidget *menu, *menu_item; + gint i = 0; + GSList *l; + + menu = gtk_menu_new (); + + for (i = 0; subitems[i].search.id != -1; ++i) { + if (subitems[i].search.text) { + char *str = NULL; + str = string_without_underscores (subitems[i].search.text); + menu_item = gtk_image_menu_item_new_with_label (str); +/* if (subitems[i].image) + gtk_image_menu_item_set_image (menu_item, e_icon_factory_get_image (subitems[i].image, E_ICON_SIZE_MENU));*/ + g_free (str); + } else { + menu_item = gtk_menu_item_new (); + gtk_widget_set_sensitive (menu_item, FALSE); + } + + g_object_set_data (G_OBJECT (menu_item), "EsbItemId", + GINT_TO_POINTER (subitems[i].search.id)); + + gtk_widget_show (menu_item); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); + } + + return menu; +} + /* Creates the suboptions menu for the ESearchBar with the list of categories */ static void make_suboptions (CalSearchBar *cal_search) { CalSearchBarPrivate *priv; - ESearchBarItem *subitems; + CALSearchBarItem *subitems; int i; - + GtkWidget *menu; + priv = cal_search->priv; g_assert (priv->categories != NULL); /* Categories plus "all", "unmatched", separator, terminator */ - subitems = g_new (ESearchBarItem, priv->categories->len + 3 + 1); + subitems = g_new (CALSearchBarItem, priv->categories->len + 3 + 1); /* All, unmatched, separator */ - subitems[0].text = _("Any Category"); - subitems[0].id = CATEGORIES_ALL; - - subitems[1].text = _("Unmatched"); - subitems[1].id = CATEGORIES_UNMATCHED; + subitems[0].search.text = _("Any Category"); + subitems[0].search.id = CATEGORIES_ALL; + subitems[0].image = NULL; + subitems[1].search.text = _("Unmatched"); + subitems[1].search.id = CATEGORIES_UNMATCHED; + subitems[1].image = NULL; + /* All the other items */ if (priv->categories->len > 0) { - subitems[2].text = NULL; /* separator */ - subitems[2].id = 0; - - for (i = 0; i < priv->categories->len; i++) { - const char *category; - char *str; - - category = priv->categories->pdata[i]; - str = g_strdup (category ? category : ""); - - subitems[i + CATEGORIES_OFFSET].text = str; - subitems[i + CATEGORIES_OFFSET].id = i + CATEGORIES_OFFSET; - } - - subitems[i + CATEGORIES_OFFSET].id = -1; /* terminator */ - } else - subitems[2].id = -1; /* terminator */ - - e_search_bar_set_viewoption (E_SEARCH_BAR (cal_search), SEARCH_CATEGORY_IS, subitems); - + subitems[2].search.text = NULL; /* separator */ + subitems[2].search.id = 0; + subitems[2].image = 0; + + for (i = 0; i < priv->categories->len; i++) { + const char *category; + char *str; + + category = priv->categories->pdata[i]; + str = g_strdup (category ? category : ""); + + subitems[i + CATEGORIES_OFFSET].search.text = str; + subitems[i + CATEGORIES_OFFSET].search.id = i + CATEGORIES_OFFSET; + subitems[i + CATEGORIES_OFFSET].image = e_categories_get_icon_file_for(str); + } + + subitems[i + CATEGORIES_OFFSET].search.id = -1; /* terminator */ + subitems[2].search.text = NULL; + subitems[2].image = NULL; + } else { + + subitems[2].search.id = -1; /* terminator */ + subitems[2].search.text = NULL; + subitems[2].image = NULL; + } + + menu = generate_viewoption_menu (subitems); + e_search_bar_set_viewoption_menu ((ESearchBar *)cal_search, menu); + /* Free the strings */ for (i = 0; i < priv->categories->len; i++) - g_free (subitems[i + CATEGORIES_OFFSET].text); + g_free (subitems[i + CATEGORIES_OFFSET].search.text); g_free (subitems); } diff --git a/mail/ChangeLog b/mail/ChangeLog index 49724141a7..8ac40d8d0e 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,17 @@ +2006-08-21 Srinivasa Ragavan <sragavan@novell.com> + + ** Fixes a lot of search issues including widget packing. + + * em-folder-browser.c: (generate_viewoption_menu), + (viewoption_menu_generator), (emfb_realize), (emfb_init), + (em_folder_browser_show_preview), (emfb_search_search_activated), + (emfb_search_search_cleared), (emfb_list_key_press), + (emfb_list_message_selected), (emfb_set_search_folder): + * em-folder-view.c: (emfv_init), (emfv_message_search), + (em_folder_view_get_popup_target), (emfv_setting_notify): + * em-folder-view.h: + * em-message-browser.c: (emmb_init): + 2006-08-19 Srinivasa Ragavan <sragavan@novell.com> ** Fix for bug #350884 diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c index 8890d5931d..7abacdb578 100644 --- a/mail/em-folder-browser.c +++ b/mail/em-folder-browser.c @@ -104,6 +104,7 @@ CamelStore *vfolder_store; /* the 1 static vfolder store */ struct _EMFolderBrowserPrivate { GtkWidget *preview; /* container for message display */ + GtkWidget *scroll; GtkWidget *subscribe_editor; @@ -122,10 +123,16 @@ struct _EMFolderBrowserPrivate { guint folder_changed_id; int show_wide:1; - + gboolean scope_restricted; + EMMenu *menu; /* toplevel menu manager */ }; +typedef struct EMFBSearchBarItem { + ESearchBarItem search; + char *image; +} EMFBSearchBarItem; + static void emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int state); static void emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri); static void emfb_set_search_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri); @@ -135,6 +142,7 @@ static void emfb_search_config_search(EFilterBar *efb, FilterRule *rule, int id, static void emfb_search_menu_activated(ESearchBar *esb, int id, EMFolderBrowser *emfb); static void emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb); static void emfb_search_query_changed(ESearchBar *esb, EMFolderBrowser *emfb); +static void emfb_search_search_cleared(ESearchBar *esb); static int emfb_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, EMFolderBrowser *emfb); static void emfb_list_message_selected (MessageList *ml, const char *uid, EMFolderBrowser *emfb); @@ -180,26 +188,26 @@ enum { }; /* Options for View */ -static ESearchBarItem emfb_view_items[] = { - { N_("All Messages"), VIEW_ALL_MESSAGES, 0 }, - { N_("Unread Messages"), VIEW_UNREAD_MESSAGES, 0 }, - { NULL, 0, 0 }, - { N_("No Label"),VIEW_NO_LABEL, 0 }, - { NULL, -1, 0 } +static EMFBSearchBarItem emfb_view_items[] = { + {{ N_("All Messages"), VIEW_ALL_MESSAGES, 0 }, NULL}, + {{ N_("Unread Messages"), VIEW_UNREAD_MESSAGES, 0 }, "stock_mail-unread"}, + {{ NULL, 0, 0 }, NULL}, + {{ N_("No Label"),VIEW_NO_LABEL, 0 }, NULL}, + {{ NULL, -1, 0 }, NULL} }; /* TODO: Following options should be customizable */ -static ESearchBarItem temp_view_items[] = { - { NULL, 0, 0 }, - { N_("Read Messages"), VIEW_READ_MESSAGES, 0 }, - { N_("Recent Messages"), VIEW_RECENT_MESSAGES, 0 }, - { N_("Last 5 Days' Messages"), VIEW_LAST_FIVE_DAYS, 0 }, - { N_("Messages with Attachments"), VIEW_WITH_ATTACHMENTS, 0 }, - { N_("Important Messages"), VIEW_MESSAGES_MARKED_AS_IMPORTANT, 0}, - { N_("Messages Not Junk"), VIEW_NOT_JUNK, 0 }, +static EMFBSearchBarItem temp_view_items[] = { + {{ NULL, 0, 0 }, NULL}, + {{ N_("Read Messages"), VIEW_READ_MESSAGES, 0 }, "stock_mail-open"}, + {{ N_("Recent Messages"), VIEW_RECENT_MESSAGES, 0 }, NULL}, + {{ N_("Last 5 Days' Messages"), VIEW_LAST_FIVE_DAYS, 0 }, NULL}, + {{ N_("Messages with Attachments"), VIEW_WITH_ATTACHMENTS, 0 }, "stock_attach"}, + {{ N_("Important Messages"), VIEW_MESSAGES_MARKED_AS_IMPORTANT, 0}, "stock_mail-priority-high"}, + {{ N_("Messages Not Junk"), VIEW_NOT_JUNK, 0 }, "stock_not-spam"}, /* { NULL, 0, NULL }, */ /* { N_("Customize"), NOT_IMPLEMENTED, NULL }, */ - { NULL, -1, 0 } + {{ NULL, -1, 0 }, NULL} }; static ESearchBarItem emfb_search_scope_items[] = { @@ -278,7 +286,7 @@ string_without_underscores (const char *s) } static GtkWidget * -generate_viewoption_menu () +generate_viewoption_menu (GtkWidget *emfv) { GtkWidget *menu, *menu_item; gint i = 0; @@ -286,11 +294,13 @@ generate_viewoption_menu () menu = gtk_menu_new (); - for (i = 0; emfb_view_items[i].id != -1; ++i) { - if (emfb_view_items[i].text) { + for (i = 0; emfb_view_items[i].search.id != -1; ++i) { + if (emfb_view_items[i].search.text) { char *str; - str = string_without_underscores (emfb_view_items[i].text); - menu_item = gtk_menu_item_new_with_label (str); + str = string_without_underscores (emfb_view_items[i].search.text); + menu_item = gtk_image_menu_item_new_with_label (str); +/* if (emfb_view_items[i].image) + gtk_image_menu_item_set_image (menu_item, e_icon_factory_get_image (emfb_view_items[i].image, E_ICON_SIZE_MENU)); */ g_free (str); } else { menu_item = gtk_menu_item_new (); @@ -298,7 +308,7 @@ generate_viewoption_menu () } g_object_set_data (G_OBJECT (menu_item), "EsbItemId", - GINT_TO_POINTER (emfb_view_items[i].id)); + GINT_TO_POINTER (emfb_view_items[i].search.id)); gtk_widget_show (menu_item); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); @@ -309,10 +319,25 @@ generate_viewoption_menu () MailConfigLabel *label = l->data; if (label->name && *(label->name)) { char *str; +/* GdkPixmap *pixmap; + GdkColor colour; + GdkGC *gc; + GtkImage *image; + + gdk_color_parse(label->colour, &colour); + gdk_color_alloc(gdk_colormap_get_system(), &colour); + + pixmap = gdk_pixmap_new(((GtkWidget *)emfv)->window, 16, 16, -1); + gc = gdk_gc_new(((GtkWidget *)emfv)->window); + gdk_gc_set_foreground(gc, &colour); + gdk_draw_rectangle(pixmap, gc, TRUE, 0, 0, 16, 16); + gdk_gc_unref(gc); + + image = gtk_image_new_from_pixmap(pixmap, NULL); */ str = string_without_underscores (label->name); - menu_item = gtk_menu_item_new_with_label (str); + menu_item = gtk_image_menu_item_new_with_label (str); g_free (str); - +/* gtk_image_menu_item_set_image (menu_item, image); */ g_object_set_data (G_OBJECT (menu_item), "EsbItemId", GINT_TO_POINTER (VIEW_LABEL)); @@ -324,11 +349,13 @@ generate_viewoption_menu () gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); } - for (i = 0; temp_view_items[i].id != -1; ++i) { - if (temp_view_items[i].text) { + for (i = 0; temp_view_items[i].search.id != -1; ++i) { + if (temp_view_items[i].search.text) { char *str; - str = string_without_underscores (temp_view_items[i].text); - menu_item = gtk_menu_item_new_with_label (str); + str = string_without_underscores (temp_view_items[i].search.text); + menu_item = gtk_image_menu_item_new_with_label (str); +/* if (temp_view_items[i].image) + gtk_image_menu_item_set_image (menu_item, e_icon_factory_get_image (temp_view_items[i].image, E_ICON_SIZE_MENU)); */ g_free (str); } else { menu_item = gtk_menu_item_new (); @@ -336,7 +363,7 @@ generate_viewoption_menu () } g_object_set_data (G_OBJECT (menu_item), "EsbItemId", - GINT_TO_POINTER (temp_view_items[i].id)); + GINT_TO_POINTER (temp_view_items[i].search.id)); gtk_widget_show (menu_item); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); @@ -354,7 +381,7 @@ viewoption_menu_generator () ESearchBarItem dup_item; GSList *l; - for (i = 0; emfb_view_items[i].id != -1; i++) + for (i = 0; emfb_view_items[i].search.id != -1; i++) g_array_append_vals (menu, &emfb_view_items[i], 1); for (l = mail_config_get_labels(); l; l = l->next) { @@ -375,6 +402,16 @@ viewoption_menu_generator () } static void +emfb_realize (GtkWidget *widget) +{ + GtkWidget *menu; + EMFolderBrowser *emfb = (EMFolderBrowser *)widget; + + menu = generate_viewoption_menu(widget); + e_search_bar_set_viewoption_menu ((ESearchBar *)emfb->search, menu); +} + +static void emfb_init(GObject *o) { EMFolderBrowser *emfb = (EMFolderBrowser *)o; @@ -412,15 +449,16 @@ emfb_init(GObject *o) emfb->search = e_filter_bar_new(search_context, systemrules, userrules, emfb_search_config_search, emfb); e_search_bar_set_menu ((ESearchBar *)emfb->search, emfb_search_items); e_search_bar_set_scopeoption ((ESearchBar *)emfb->search, emfb_search_scope_items); - - menu = generate_viewoption_menu(); - e_search_bar_set_viewoption_menu ((ESearchBar *)emfb->search, menu); + e_search_bar_scope_enable ((ESearchBar *)emfb->search, E_FILTERBAR_CURRENT_MESSAGE_ID, FALSE); + emfb->priv->scope_restricted = TRUE; + g_signal_connect(emfb, "realize", G_CALLBACK(emfb_realize), NULL); gtk_widget_show((GtkWidget *)emfb->search); p->search_menu_activated_id = g_signal_connect(emfb->search, "menu_activated", G_CALLBACK(emfb_search_menu_activated), emfb); p->search_activated_id = g_signal_connect(emfb->search, "search_activated", G_CALLBACK(emfb_search_search_activated), emfb); p->search_query_changed_id = g_signal_connect(emfb->search, "query_changed", G_CALLBACK(emfb_search_query_changed), emfb); - + g_signal_connect(emfb->search, "search_cleared", G_CALLBACK(emfb_search_search_cleared), NULL); + gtk_box_pack_start((GtkBox *)emfb, (GtkWidget *)emfb->search, FALSE, TRUE, 0); } @@ -438,14 +476,16 @@ emfb_init(GObject *o) gtk_widget_show((GtkWidget *)emfb->view.list); /* currently: just use a scrolledwindow for preview widget */ - p->preview = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy((GtkScrolledWindow *)p->preview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type((GtkScrolledWindow *)p->preview, GTK_SHADOW_IN); - gtk_widget_show(p->preview); + p->scroll = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy((GtkScrolledWindow *)p->scroll, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type((GtkScrolledWindow *)p->scroll, GTK_SHADOW_IN); + gtk_widget_show(p->scroll); - gtk_container_add((GtkContainer *)p->preview, (GtkWidget *)emfb->view.preview->formathtml.html); + p->preview = gtk_vbox_new (FALSE, 6); + gtk_container_add((GtkContainer *)p->scroll, (GtkWidget *)emfb->view.preview->formathtml.html); gtk_widget_show((GtkWidget *)emfb->view.preview->formathtml.html); - + gtk_box_pack_start ((GtkBox *)p->preview, p->scroll, TRUE, TRUE, 0); + gtk_box_pack_start ((GtkBox *)p->preview, em_format_html_get_search_dialog (emfb->view.preview), FALSE, FALSE, 0); gtk_paned_add2((GtkPaned *)emfb->vpane, p->preview); gtk_widget_show(p->preview); @@ -563,8 +603,14 @@ GtkWidget *em_folder_browser_new(void) void em_folder_browser_show_preview(EMFolderBrowser *emfb, gboolean state) { if ((emfb->view.preview_active ^ state) == 0 - || emfb->view.list == NULL) + || emfb->view.list == NULL) { + if (state && emfb->priv->scope_restricted && emfb->view.list->cursor_uid && *(emfb->view.list->cursor_uid)) { + e_search_bar_scope_enable ((ESearchBar *)emfb->search, E_FILTERBAR_CURRENT_MESSAGE_ID, TRUE); + emfb->priv->scope_restricted = FALSE; + } + return; + } emfb->view.preview_active = state; @@ -581,6 +627,8 @@ void em_folder_browser_show_preview(EMFolderBrowser *emfb, gboolean state) if (emfb->view.list->cursor_uid) { char *uid = g_alloca(strlen(emfb->view.list->cursor_uid)+1); + e_search_bar_scope_enable ((ESearchBar *)emfb->search, E_FILTERBAR_CURRENT_MESSAGE_ID, TRUE); + emfb->priv->scope_restricted = FALSE; strcpy(uid, emfb->view.list->cursor_uid); em_folder_view_set_message(&emfb->view, uid, FALSE); } @@ -595,6 +643,9 @@ void em_folder_browser_show_preview(EMFolderBrowser *emfb, gboolean state) emfb->view.displayed_uid = NULL; gtk_widget_hide(emfb->priv->preview); + e_search_bar_scope_enable ((ESearchBar *)emfb->search, E_FILTERBAR_CURRENT_MESSAGE_ID, FALSE); + emfb->priv->scope_restricted = TRUE; + printf("%s(%d):%s: TRUE\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); /* mail_display_set_message (emfb->mail_display, NULL, NULL, NULL); emfb_ui_message_loaded (emfb);*/ @@ -917,7 +968,6 @@ emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb) GList *folder_list_account = NULL ; GList *l, *folder_list = NULL ; CamelException *ex; - ex = camel_exception_new (); if (emfv->list == NULL || emfv->folder == NULL) @@ -944,6 +994,7 @@ emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb) case E_FILTERBAR_CURRENT_ACCOUNT_ID: word = e_search_bar_get_text (esb); if (!(word && *word)) { + mail_cancel_all (); g_signal_emit (emfb, folder_browser_signals [ACCOUNT_SEARCH_CLEARED], 0); gtk_widget_set_sensitive (esb->scopeoption, TRUE); break; @@ -984,6 +1035,7 @@ emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb) case E_FILTERBAR_ALL_ACCOUNTS_ID: word = e_search_bar_get_text (esb); if (!(word && *word)) { + mail_cancel_all (); g_signal_emit (emfb, folder_browser_signals [ACCOUNT_SEARCH_CLEARED], 0); gtk_widget_set_sensitive (esb->scopeoption, TRUE); break; @@ -1079,6 +1131,13 @@ emfb_search_query_changed(ESearchBar *esb, EMFolderBrowser *emfb) } } +static void +emfb_search_search_cleared(ESearchBar *esb) +{ + /* FIXME: It should just cancel search.*/ + mail_cancel_all(); +} + /* ********************************************************************** */ static int @@ -1089,10 +1148,10 @@ emfb_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, switch (ev->key.keyval) { case GDK_space: - em_utils_adjustment_page(gtk_scrolled_window_get_vadjustment((GtkScrolledWindow *)emfb->priv->preview), TRUE); + em_utils_adjustment_page(gtk_scrolled_window_get_vadjustment((GtkScrolledWindow *)emfb->priv->scroll), TRUE); break; case GDK_BackSpace: - em_utils_adjustment_page(gtk_scrolled_window_get_vadjustment((GtkScrolledWindow *)emfb->priv->preview), FALSE); + em_utils_adjustment_page(gtk_scrolled_window_get_vadjustment((GtkScrolledWindow *)emfb->priv->scroll), FALSE); break; default: return FALSE; @@ -1105,10 +1164,18 @@ static void emfb_list_message_selected (MessageList *ml, const char *uid, EMFolderBrowser *emfb) { EMFolderView *emfv = (EMFolderView *) emfb; - + if (emfv->folder == NULL) return; - + + if (uid && *uid && emfb->priv->scope_restricted && emfb->view.preview_active) { + e_search_bar_scope_enable ((ESearchBar *)emfb->search, E_FILTERBAR_CURRENT_MESSAGE_ID, TRUE); + emfb->priv->scope_restricted = FALSE; + } else if ( !(uid && *uid) && !emfb->priv->scope_restricted) { + e_search_bar_scope_enable ((ESearchBar *)emfb->search, E_FILTERBAR_CURRENT_MESSAGE_ID, FALSE); + emfb->priv->scope_restricted = TRUE; + } + camel_object_meta_set (emfv->folder, "evolution:selected_uid", uid); camel_object_state_write (emfv->folder); } @@ -1711,7 +1778,7 @@ emfb_set_search_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) "<column source=\"0\"/> <column source=\"3\"/> <column source=\"1\"/>" "<column source=\"14\"/> <column source=\"5\"/>" "<column source=\"7\"/> <column source=\"13\"/> " - "<grouping> </grouping> </ETableState>"; + "<grouping><leaf column=\"7\" ascending=\"false\"/> </grouping> </ETableState>"; e_tree_set_state (((MessageList *)emfv->list)->tree, state); message_list_thaw(emfv->list); diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index 03080cd23e..988cfb4bf9 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -75,6 +75,7 @@ #include "menus/gal-view-menus.h" #include "misc/e-charset-picker.h" +#include <misc/e-filter-bar.h> #include "e-util/e-error.h" #include "e-util/e-dialog-utils.h" @@ -229,9 +230,6 @@ emfv_init(GObject *o) gtk_selection_add_target(p->invisible, GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 0); gtk_selection_add_target(p->invisible, GDK_SELECTION_CLIPBOARD, GDK_SELECTION_TYPE_STRING, 1); - search_bar = em_format_html_get_search_dialog (emfv->preview); - gtk_box_pack_end(GTK_WIDGET (emfv), search_bar, FALSE, FALSE, 5); - emfv->async = mail_async_event_new(); emfv_setting_setup(emfv); @@ -1504,8 +1502,14 @@ static void emfv_message_search(BonoboUIComponent *uic, void *data, const char *path) { EMFolderView *emfv = data; - - em_format_html_display_search(emfv->preview); + + if (!emfv->list_active) /* We are in new mail window */ + em_format_html_display_search(emfv->preview); + else { + /* We are in top level. Just grab focus to Search Bar */ + gtk_widget_grab_focus (((ESearchBar *)((EMFolderBrowser *) emfv)->search)->entry); + gtk_option_menu_set_history (((ESearchBar *)((EMFolderBrowser *) emfv)->search)->scopeoption, 3); + } } static void @@ -1860,7 +1864,7 @@ static const EMFolderViewEnable emfv_enable_map[] = { { "MessageReplySender", EM_POPUP_SELECT_ONE }, { "MessageEdit", EM_POPUP_SELECT_EDIT }, { "MessageSaveAs", EM_POPUP_SELECT_MANY }, - { "MessageSearch", EM_POPUP_SELECT_ONE }, + { "MessageSearch", EM_POPUP_SELECT_ONE| EM_FOLDER_VIEW_PREVIEW_PRESENT }, { "MessageUndelete", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_UNDELETE }, { "PrintMessage", EM_POPUP_SELECT_ONE }, { "PrintPreviewMessage", EM_POPUP_SELECT_ONE }, @@ -2182,6 +2186,9 @@ em_folder_view_get_popup_target(EMFolderView *emfv, EMPopup *emp, int on_display else t->target.mask &= ~EM_FOLDER_VIEW_SELECT_NOSELECTION; + if (emfv->preview_active) + t->target.mask &= ~EM_FOLDER_VIEW_PREVIEW_PRESENT; + /* See bug #54770 */ if (!emfv->hide_deleted) t->target.mask &= ~EM_POPUP_SELECT_DELETE; @@ -2721,12 +2728,15 @@ emfv_setting_notify(GConfClient *gconf, guint cnxn_id, GConfEntry *entry, EMFold case EMFV_SHOW_PREVIEW: { gboolean state_gconf, state_camel; char *ret; - + /* If emfv->folder hasn't been initialized, do nothing */ if (!emfv->folder) return; state_gconf = gconf_value_get_bool (value); + if (state_gconf == FALSE) + emfv_enable_menus (emfv); + if ((ret = camel_object_meta_get (emfv->folder, "evolution:show_preview"))) { state_camel = (ret[0] != '0'); g_free (ret); diff --git a/mail/em-folder-view.h b/mail/em-folder-view.h index 8c8669c897..4c998dcc86 100644 --- a/mail/em-folder-view.h +++ b/mail/em-folder-view.h @@ -53,7 +53,8 @@ enum { EM_FOLDER_VIEW_SELECT_DISPLAY = EM_POPUP_SELECT_LAST<<5, EM_FOLDER_VIEW_SELECT_SELECTION = EM_POPUP_SELECT_LAST<<6, EM_FOLDER_VIEW_SELECT_NOSELECTION = EM_POPUP_SELECT_LAST<<7, - EM_FOLDER_VIEW_SELECT_LAST = EM_POPUP_SELECT_LAST<<8, + EM_FOLDER_VIEW_PREVIEW_PRESENT = EM_POPUP_SELECT_LAST<<8, + EM_FOLDER_VIEW_SELECT_LAST = EM_POPUP_SELECT_LAST<<9, }; struct _EMFolderViewEnable { diff --git a/mail/em-message-browser.c b/mail/em-message-browser.c index 28a99e84df..f1b464a545 100644 --- a/mail/em-message-browser.c +++ b/mail/em-message-browser.c @@ -111,7 +111,8 @@ emmb_init(GObject *o) gtk_widget_show(p->preview); - gtk_box_pack_start_defaults((GtkBox *)emmb, p->preview); + gtk_box_pack_start ((GtkBox *)emmb, p->preview, TRUE, TRUE, 0); + gtk_box_pack_start((GtkBox *)emmb, em_format_html_get_search_dialog (emmb->view.preview), FALSE, FALSE, 0); } static void |