aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-03-11 16:52:03 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-03-11 16:52:03 +0800
commitfff0d518420ca7ea8cd97014eb547120174c4a4e (patch)
treeec38e590ed3818be9e628ac820ed3a006935a455 /mail
parent4138eb99da5fdc980384e64acc933d0d174d0842 (diff)
downloadgsoc2013-evolution-fff0d518420ca7ea8cd97014eb547120174c4a4e.tar.gz
gsoc2013-evolution-fff0d518420ca7ea8cd97014eb547120174c4a4e.tar.zst
gsoc2013-evolution-fff0d518420ca7ea8cd97014eb547120174c4a4e.zip
a really gross hack, disable all search handlers before setting the search
2004-03-11 Not Zed <NotZed@Ximian.com> * em-folder-browser.c (emfb_set_folder): a really gross hack, disable all search handlers before setting the search and set hte search manually rather than going through the callbacks. Partial fix for #55267, and ugly as it is. (emfb_init): save the search signal id's. (emfb_set_folder): ugh, properly set the defaults if the settings haven't been stored on the folder, and properly move them upstream to the bonobo menus. svn path=/trunk/; revision=25027
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog9
-rw-r--r--mail/em-folder-browser.c71
2 files changed, 61 insertions, 19 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 062482a543..3756840b54 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,14 @@
2004-03-11 Not Zed <NotZed@Ximian.com>
+ * em-folder-browser.c (emfb_set_folder): a really gross hack,
+ disable all search handlers before setting the search and set hte
+ search manually rather than going through the callbacks. Partial
+ fix for #55267, and ugly as it is.
+ (emfb_init): save the search signal id's.
+ (emfb_set_folder): ugh, properly set the defaults if the settings
+ haven't been stored on the folder, and properly move them upstream
+ to the bonobo menus.
+
* em-folder-tree-model.c (sort_cb): when we sort, handle not
having the node in the tree. otherwise we always compare against
"" which puts it at the head of the branch, rather than the tail.
diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c
index 2a17a3417c..f49d0c0a00 100644
--- a/mail/em-folder-browser.c
+++ b/mail/em-folder-browser.c
@@ -98,6 +98,10 @@ struct _EMFolderBrowserPrivate {
GalViewInstance *view_instance;
GalViewMenus *view_menus;
+ guint search_menu_activated_id;
+ guint search_activated_id;
+ guint search_query_changed_id;
+
guint vpane_resize_id;
guint list_built_id; /* hook onto list-built for delayed 'select first unread' stuff */
@@ -187,9 +191,9 @@ emfb_init(GObject *o)
e_search_bar_set_menu ((ESearchBar *)emfb->search, emfb_search_items);
gtk_widget_show((GtkWidget *)emfb->search);
- g_signal_connect(emfb->search, "menu_activated", G_CALLBACK(emfb_search_menu_activated), emfb);
- g_signal_connect(emfb->search, "search_activated", G_CALLBACK(emfb_search_search_activated), emfb);
- g_signal_connect(emfb->search, "query_changed", G_CALLBACK(emfb_search_query_changed), emfb);
+ 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);
gtk_box_pack_start((GtkBox *)emfb, (GtkWidget *)emfb->search, FALSE, TRUE, 0);
}
@@ -912,6 +916,7 @@ static void
emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri)
{
EMFolderBrowser *emfb = (EMFolderBrowser *) emfv;
+ struct _EMFolderBrowserPrivate *p = emfb->priv;
emfb_parent->set_folder(emfv, folder, uri);
@@ -920,27 +925,55 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri)
defaults */
if (folder) {
char *sstate;
+ int state;
+ GConfClient *gconf = mail_config_get_gconf_client();
+
+ /* FIXME: this mostly copied from activate() */
+ if ((sstate = camel_object_meta_get(folder, "evolution:show_preview"))) {
+ state = sstate[0] != '0';
+ g_free(sstate);
+ } else
+ state = gconf_client_get_bool(gconf, "/apps/evolution/mail/display/show_preview", NULL);
+ em_folder_browser_show_preview(emfb, state);
+ if (emfv->uic)
+ bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewPreview", "state", state?"1":"0", NULL);
- if ((sstate = camel_object_meta_get (folder, "evolution:show_preview"))) {
- em_folder_browser_show_preview (emfb, sstate[0] != '0');
- g_free (sstate);
- }
-
- if ((sstate = camel_object_meta_get (folder, "evolution:thread_list"))) {
- message_list_set_threaded (emfv->list, sstate[0] != '0');
- g_free (sstate);
- }
-
- sstate = camel_object_meta_get (folder, "evolution:search_state");
- g_object_set (emfb->search, "state", sstate, NULL);
- g_free (sstate);
-
+ if ((sstate = camel_object_meta_get(folder, "evolution:thread_list"))) {
+ state = sstate[0] != '0';
+ g_free(sstate);
+ } else
+ state = gconf_client_get_bool(gconf, "/apps/evolution/mail/display/thread_list", NULL);
+ message_list_set_threaded(emfv->list, state);
+ if (emfv->uic)
+ bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewThreaded", "state", state?"1":"0", NULL);
+
+ /* gross, but effective? */
+ g_signal_handler_block(emfb->search, p->search_menu_activated_id);
+ g_signal_handler_block(emfb->search, p->search_activated_id);
+ g_signal_handler_block(emfb->search, p->search_query_changed_id);
+
+ sstate = camel_object_meta_get(folder, "evolution:search_state");
+ g_object_set(emfb->search, "state", sstate, NULL);
+ g_free(sstate);
+
+ g_signal_handler_unblock(emfb->search, p->search_menu_activated_id);
+ g_signal_handler_unblock(emfb->search, p->search_activated_id);
+ g_signal_handler_unblock(emfb->search, p->search_query_changed_id);
+
+ /* set the query manually, so we dont pop up advanced or saved search stuff */
+ g_object_get(emfb->search, "query", &sstate, NULL);
+ message_list_set_search(emfb->view.list, sstate);
+ g_free(sstate);
+
if ((sstate = camel_object_meta_get (folder, "evolution:selected_uid")))
emfb->priv->select_uid = sstate;
+ else {
+ g_free(p->select_uid);
+ p->select_uid = NULL;
+ }
if (emfv->list->cursor_uid == NULL && emfb->priv->list_built_id == 0)
- emfb->priv->list_built_id =
- g_signal_connect (emfv->list, "message_list_built", G_CALLBACK (emfb_list_built), emfv);
+ emfb->priv->list_built_id = g_signal_connect(emfv->list, "message_list_built", G_CALLBACK (emfb_list_built), emfv);
/*emfb_create_view_instance (emfb, folder, uri);*/
if (emfv->uic)