aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2008-01-24 19:06:21 +0800
committerMilan Crha <mcrha@src.gnome.org>2008-01-24 19:06:21 +0800
commit8e8d332b85b56b98e1f7d8d977170403fe1a42d5 (patch)
tree3e5587629b352246ca0bd459e2d2568e57e84d49 /mail
parentd5ec942afbcd814dbe6f9adaa0bf4d31b7b1b26a (diff)
downloadgsoc2013-evolution-8e8d332b85b56b98e1f7d8d977170403fe1a42d5.tar
gsoc2013-evolution-8e8d332b85b56b98e1f7d8d977170403fe1a42d5.tar.gz
gsoc2013-evolution-8e8d332b85b56b98e1f7d8d977170403fe1a42d5.tar.bz2
gsoc2013-evolution-8e8d332b85b56b98e1f7d8d977170403fe1a42d5.tar.lz
gsoc2013-evolution-8e8d332b85b56b98e1f7d8d977170403fe1a42d5.tar.xz
gsoc2013-evolution-8e8d332b85b56b98e1f7d8d977170403fe1a42d5.tar.zst
gsoc2013-evolution-8e8d332b85b56b98e1f7d8d977170403fe1a42d5.zip
** Part of bug #511488
2008-01-24 Milan Crha <mcrha@redhat.com> ** Part of bug #511488 * mail/mail-vfolder.h: * mail/mail-vfolder.c: (vfolder_loaded): Function dropped. * mail/mail-vfolder.c: (vfolder_load_storage): Allow to call this function more than once, but do load the storage only once. * mail/em-folder-utils.c: (emfu_popup_new_folder_response): * mail/mail-vfolder.c: (vfolder_edit), (vfolder_gui_add_rule), (vfolder_gui_add_from_message), (vfolder_gui_add_from_address): * mail/em-folder-browser.c: (emfb_search_menu_activated): * mail/em-folder-view.c: (emp_uri_popup_vfolder_sender), (emp_uri_popup_vfolder_recipient), (vfolder_type_current): Ensure vfolder is running. * plugins/groupwise-features/share-folder-common.c: (users_dialog_response): The logic to check if vfolder is running has been changed, so reflect it here too. svn path=/trunk/; revision=34878
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog16
-rw-r--r--mail/em-folder-browser.c3
-rw-r--r--mail/em-folder-utils.c3
-rw-r--r--mail/em-folder-view.c9
-rw-r--r--mail/mail-vfolder.c36
-rw-r--r--mail/mail-vfolder.h1
6 files changed, 38 insertions, 30 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 9ef98523fc..3c1d1685c4 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,19 @@
+2008-01-24 Milan Crha <mcrha@redhat.com>
+
+ ** Part of bug #511488
+
+ * mail-vfolder.h:
+ * mail-vfolder.c: (vfolder_loaded): Function dropped.
+ * mail-vfolder.c: (vfolder_load_storage): Allow to call this function
+ more than once, but do load the storage only once.
+ * em-folder-utils.c: (emfu_popup_new_folder_response):
+ * mail-vfolder.c: (vfolder_edit), (vfolder_gui_add_rule),
+ (vfolder_gui_add_from_message), (vfolder_gui_add_from_address):
+ * em-folder-browser.c: (emfb_search_menu_activated):
+ * em-folder-view.c: (emp_uri_popup_vfolder_sender),
+ (emp_uri_popup_vfolder_recipient), (vfolder_type_current):
+ Ensure vfolder is running.
+
2008-01-24 Srinivasa Ragavan <sragavan@novell.com>
** Fix for bug #510779
diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c
index 716235a203..0ef7be078b 100644
--- a/mail/em-folder-browser.c
+++ b/mail/em-folder-browser.c
@@ -761,8 +761,7 @@ emfb_search_menu_activated(ESearchBar *esb, int id, EMFolderBrowser *emfb)
char *name, *text;
/* ensures vfolder is running */
- if (!vfolder_loaded ())
- vfolder_load_storage ();
+ vfolder_load_storage ();
rule = vfolder_clone_rule (efb->current_query);
text = e_search_bar_get_text(esb);
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c
index e66213f9d6..d030731a90 100644
--- a/mail/em-folder-utils.c
+++ b/mail/em-folder-utils.c
@@ -711,8 +711,7 @@ emfu_popup_new_folder_response (EMFolderSelector *emfs, int response, gpointer d
EMVFolderRule *rule;
/* ensures vfolder is running */
- if (!vfolder_loaded ())
- vfolder_load_storage ();
+ vfolder_load_storage ();
rule = em_vfolder_rule_new();
filter_rule_set_name((FilterRule *)rule, path);
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index e9f798ca2d..6fdafc0dcf 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -1958,8 +1958,7 @@ emp_uri_popup_vfolder_sender(EPopup *ep, EPopupItem *pitem, void *data)
if (url->path && url->path[0]) {
/* ensures vfolder is running */
- if (!vfolder_loaded ())
- vfolder_load_storage ();
+ vfolder_load_storage ();
addr = camel_internet_address_new ();
camel_address_decode (CAMEL_ADDRESS (addr), url->path);
@@ -1988,8 +1987,7 @@ emp_uri_popup_vfolder_recipient(EPopup *ep, EPopupItem *pitem, void *data)
if (url->path && url->path[0]) {
/* ensures vfolder is running */
- if (!vfolder_loaded ())
- vfolder_load_storage ();
+ vfolder_load_storage ();
addr = camel_internet_address_new ();
camel_address_decode (CAMEL_ADDRESS (addr), url->path);
@@ -2021,8 +2019,7 @@ vfolder_type_current (EMFolderView *emfv, int type)
if (uids->len == 1) {
/* ensures vfolder is running */
- if (!vfolder_loaded ())
- vfolder_load_storage ();
+ vfolder_load_storage ();
vfolder_type_uid (emfv->folder, (char *) uids->pdata[0], emfv->folder_uri, type);
}
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 14655a769f..75e0dc11f8 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -896,12 +896,25 @@ store_folder_renamed(CamelObject *o, void *event_data, void *data)
void
vfolder_load_storage(void)
{
+ /* lock for loading storage, it is safe to call it more than once */
+ static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+
char *user, *storeuri;
FilterRule *rule;
char *xmlfile;
+ pthread_mutex_lock (&lock);
+
+ if (vfolder_hash) {
+ /* we have already initialized */
+ pthread_mutex_unlock (&lock);
+ return;
+ }
+
vfolder_hash = g_hash_table_new(g_str_hash, g_str_equal);
+ pthread_mutex_unlock (&lock);
+
/* first, create the vfolder store, and set it up */
storeuri = g_strdup_printf("vfolder:%s/mail/vfolder", mail_component_peek_base_directory (mail_component_peek ()));
vfolder_store = camel_session_get_store(session, storeuri, NULL);
@@ -947,17 +960,6 @@ vfolder_load_storage(void)
g_free(storeuri);
}
-/**
- * vfolder_loaded
- * Test if we have vfolder already inited or not.
- * @return Whether was vfolder inited or not (by call of @ref vfolder_load_storage).
- **/
-gboolean
-vfolder_loaded (void)
-{
- return vfolder_hash != NULL;
-}
-
void
vfolder_revert(void)
{
@@ -1002,8 +1004,7 @@ vfolder_edit (void)
}
/* ensures vfolder is running */
- if (!vfolder_loaded ())
- vfolder_load_storage ();
+ vfolder_load_storage ();
vfolder_editor = GTK_WIDGET (em_vfolder_editor_new (context));
gtk_window_set_title (GTK_WINDOW (vfolder_editor), _("Search Folders"));
@@ -1130,8 +1131,7 @@ vfolder_gui_add_rule(EMVFolderRule *rule)
GtkDialog *gd;
/* this should be done before we call this function */
- if (!vfolder_loaded ())
- vfolder_load_storage ();
+ vfolder_load_storage ();
w = filter_rule_get_widget((FilterRule *)rule, (RuleContext *)context);
@@ -1163,8 +1163,7 @@ vfolder_gui_add_from_message(CamelMimeMessage *msg, int flags, const char *sourc
g_return_if_fail (msg != NULL);
/* ensures vfolder is running */
- if (!vfolder_loaded ())
- vfolder_load_storage ();
+ vfolder_load_storage ();
rule = (EMVFolderRule*)em_vfolder_rule_from_message(context, msg, flags, source);
vfolder_gui_add_rule(rule);
@@ -1178,8 +1177,7 @@ vfolder_gui_add_from_address(CamelInternetAddress *addr, int flags, const char *
g_return_if_fail (addr != NULL);
/* ensures vfolder is running */
- if (!vfolder_loaded ())
- vfolder_load_storage ();
+ vfolder_load_storage ();
rule = (EMVFolderRule*)em_vfolder_rule_from_address(context, addr, flags, source);
vfolder_gui_add_rule(rule);
diff --git a/mail/mail-vfolder.h b/mail/mail-vfolder.h
index 557dbbb340..651ace301b 100644
--- a/mail/mail-vfolder.h
+++ b/mail/mail-vfolder.h
@@ -10,7 +10,6 @@ struct _EMVFolderRule;
struct _CamelInternetAddress;
void vfolder_load_storage(void);
-gboolean vfolder_loaded (void);
void vfolder_revert(void);
void vfolder_edit (void);