aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-10-24 12:09:30 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-10-24 12:09:30 +0800
commite58630b14194b487c90a9995f10a98f93e88f9a8 (patch)
treec8a5f417c2f68d0f62b01c4ecfae3353b06f8302
parent5c99202e0b92d33db44720df655d593df4095ed2 (diff)
downloadgsoc2013-evolution-e58630b14194b487c90a9995f10a98f93e88f9a8.tar.gz
gsoc2013-evolution-e58630b14194b487c90a9995f10a98f93e88f9a8.tar.zst
gsoc2013-evolution-e58630b14194b487c90a9995f10a98f93e88f9a8.zip
Unref the global search_context. (owner_set_cb): create the global
2001-10-23 Jeffrey Stedfast <fejj@ximian.com> * component-factory.c (owner_unset_cb): Unref the global search_context. (owner_set_cb): create the global search_context. * folder-browser.c (folder_browser_gui_init): Pass along the global search_context to the e_filter_bar_new call. svn path=/trunk/; revision=13976
-rw-r--r--mail/ChangeLog10
-rw-r--r--mail/component-factory.c31
-rw-r--r--mail/folder-browser.c21
3 files changed, 43 insertions, 19 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 01a7b6b0a4..e6ec5faf18 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,12 @@
+2001-10-23 Jeffrey Stedfast <fejj@ximian.com>
+
+ * component-factory.c (owner_unset_cb): Unref the global
+ search_context.
+ (owner_set_cb): create the global search_context.
+
+ * folder-browser.c (folder_browser_gui_init): Pass along the
+ global search_context to the e_filter_bar_new call.
+
2001-10-24 <NotZed@Ximian.com>
* message-browser.c (message_browser_message_loaded): Call
@@ -36,6 +45,7 @@
(folder_browser_ui_set_selection_state): And here too.
2001-10-23 Jeffrey Stedfast <fejj@ximian.com>
+>>>>>>> 1.1890
* mail-account-gui.c (service_check_supported): Don't allow an
auth-type to be set when saving the service.
diff --git a/mail/component-factory.c b/mail/component-factory.c
index c4be75f94d..ccd6f81461 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -64,6 +64,8 @@ char *evolution_dir;
EvolutionShellClient *global_shell_client = NULL;
+RuleContext *search_context = NULL;
+
static GHashTable *storages_hash;
static EvolutionShellComponent *shell_component;
@@ -719,6 +721,24 @@ owner_set_cb (EvolutionShellComponent *shell_component,
}
mail_autoreceive_setup ();
+
+ {
+ /* setup the global quick-search context */
+ char *user = g_strdup_printf ("%s/searches.xml", evolution_dir);
+ char *system = g_strdup (EVOLUTION_DATADIR "/evolution/vfoldertypes.xml");
+
+ search_context = rule_context_new ();
+ gtk_object_set_data_full (GTK_OBJECT (search_context), "user", user, g_free);
+ gtk_object_set_data_full (GTK_OBJECT (search_context), "system", system, g_free);
+
+ rule_context_add_part_set (search_context, "partset", filter_part_get_type (),
+ rule_context_add_part, rule_context_next_part);
+
+ rule_context_add_rule_set (search_context, "ruleset", filter_rule_get_type (),
+ rule_context_add_rule, rule_context_next_rule);
+
+ rule_context_load (search_context, system, user);
+ }
if (mail_config_is_corrupt ()) {
GtkWidget *dialog;
@@ -841,19 +861,22 @@ static void
owner_unset_cb (EvolutionShellComponent *shell_component, gpointer user_data)
{
int i;
-
+
for (i=0;i<sizeof(shell_component_handlers)/sizeof(shell_component_handlers[0]);i++)
gtk_signal_disconnect((GtkObject *)shell_component, shell_component_handlers[i].hand);
-
+
if (mail_config_get_empty_trash_on_exit ())
empty_trash (NULL, NULL, NULL);
unref_standard_folders ();
mail_importer_uninit ();
-
+
global_shell_client = NULL;
mail_session_enable_interaction (FALSE);
-
+
+ gtk_object_unref (GTK_OBJECT (search_context));
+ search_context = NULL;
+
g_idle_add_full (G_PRIORITY_LOW, idle_quit, NULL, NULL);
}
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index 89b6f43524..8a1734e222 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -1772,6 +1772,7 @@ fb_resize_cb (GtkWidget *w, GtkAllocation *a, FolderBrowser *fb)
static void
folder_browser_gui_init (FolderBrowser *fb)
{
+ extern RuleContext *search_context;
ESelectionModel *esm;
/* The panned container */
@@ -1785,23 +1786,13 @@ folder_browser_gui_init (FolderBrowser *fb)
0, 0);
/* quick-search bar */
- {
- RuleContext *rc = (RuleContext *)rule_context_new ();
- char *user = g_strdup_printf ("%s/searches.xml", evolution_dir);
- /* we reuse the vfolder types here, they should match */
- char *system = EVOLUTION_DATADIR "/evolution/vfoldertypes.xml";
-
- rule_context_add_part_set ((RuleContext *)rc, "partset", filter_part_get_type (),
- rule_context_add_part, rule_context_next_part);
-
- rule_context_add_rule_set ((RuleContext *)rc, "ruleset", filter_rule_get_type (),
- rule_context_add_rule, rule_context_next_rule);
+ if (search_context) {
+ const char *systemrules = gtk_object_get_data (GTK_OBJECT (search_context), "system");
+ const char *userrules = gtk_object_get_data (GTK_OBJECT (search_context), "user");
- fb->search = e_filter_bar_new (rc, system, user, folder_browser_config_search, fb);
+ fb->search = e_filter_bar_new (search_context, systemrules, userrules,
+ folder_browser_config_search, fb);
e_search_bar_set_menu ((ESearchBar *)fb->search, folder_browser_search_menu_items);
- /*e_search_bar_set_option((ESearchBar *)fb->search, folder_browser_search_option_items);*/
- g_free (user);
- gtk_object_unref (GTK_OBJECT (rc));
}
gtk_widget_show (GTK_WIDGET (fb->search));