aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog20
-rw-r--r--mail/em-folder-browser.c7
-rw-r--r--mail/em-folder-utils.c4
-rw-r--r--mail/em-folder-view.c15
-rw-r--r--mail/em-mailer-prefs.c5
-rw-r--r--mail/em-mailer-prefs.h1
-rw-r--r--mail/evolution-mail.schemas.in14
-rw-r--r--mail/mail-component.c7
-rw-r--r--mail/mail-config.glade56
-rw-r--r--mail/mail-vfolder.c23
-rw-r--r--mail/mail-vfolder.h1
11 files changed, 150 insertions, 3 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 6652c98483..1ae6c58b6c 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,23 @@
+2008-01-07 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #300336
+
+ * mail-vfolder.h: (vfolder_loaded):
+ * mail-vfolder.c: (vfolder_loaded): New helper function.
+ * em-folder-utils.c: (emfu_popup_new_folder_response):
+ * mail-vfolder.c: (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.
+ * mail-component.c: (mc_startup): Do not start vfolder when
+ disabled by option '/apps/evolution/mail/display/enable_vfolders'.
+ * evolution-mail.schemas.in: Added schema for new option.
+ * mail-config.glade:
+ * em-mailer-prefs.h:
+ * em-mailer-prefs.c: Added checkbox for "Enable Search Folders" option.
+
2008-01-06 Gilles Dartiguelongue <gdartigu@svn.gnome.org>
** Fix bug #497914
diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c
index 521f7df518..5b11c11a18 100644
--- a/mail/em-folder-browser.c
+++ b/mail/em-folder-browser.c
@@ -757,9 +757,14 @@ emfb_search_menu_activated(ESearchBar *esb, int id, EMFolderBrowser *emfb)
case ESB_SAVE:
d(printf("Save vfolder\n"));
if (efb->current_query) {
- FilterRule *rule = vfolder_clone_rule(efb->current_query);
+ FilterRule *rule;
char *name, *text;
+ /* ensures vfolder is running */
+ if (!vfolder_loaded ())
+ vfolder_load_storage ();
+
+ rule = vfolder_clone_rule (efb->current_query);
text = e_search_bar_get_text(esb);
name = g_strdup_printf("%s %s", rule->name, (text&&text[0])?text:"''");
g_free (text);
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c
index a12b758f82..e32efee827 100644
--- a/mail/em-folder-utils.c
+++ b/mail/em-folder-utils.c
@@ -707,6 +707,10 @@ emfu_popup_new_folder_response (EMFolderSelector *emfs, int response, gpointer d
if (CAMEL_IS_VEE_STORE(store)) {
EMVFolderRule *rule;
+ /* ensures vfolder is running */
+ if (!vfolder_loaded ())
+ vfolder_load_storage ();
+
rule = em_vfolder_rule_new();
filter_rule_set_name((FilterRule *)rule, path);
vfolder_gui_add_rule(rule);
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 1758735ab3..914f335063 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -1940,6 +1940,10 @@ 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 ();
+
addr = camel_internet_address_new ();
camel_address_decode (CAMEL_ADDRESS (addr), url->path);
vfolder_gui_add_from_address (addr, AUTO_FROM, emfv->folder_uri);
@@ -1966,6 +1970,10 @@ 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 ();
+
addr = camel_internet_address_new ();
camel_address_decode (CAMEL_ADDRESS (addr), url->path);
vfolder_gui_add_from_address (addr, AUTO_TO, emfv->folder_uri);
@@ -1994,8 +2002,13 @@ vfolder_type_current (EMFolderView *emfv, int type)
uids = message_list_get_selected (emfv->list);
- if (uids->len == 1)
+ if (uids->len == 1) {
+ /* ensures vfolder is running */
+ if (!vfolder_loaded ())
+ vfolder_load_storage ();
+
vfolder_type_uid (emfv->folder, (char *) uids->pdata[0], emfv->folder_uri, type);
+ }
em_utils_uids_free (uids);
}
diff --git a/mail/em-mailer-prefs.c b/mail/em-mailer-prefs.c
index 5a29b54456..ef4a6d64c8 100644
--- a/mail/em-mailer-prefs.c
+++ b/mail/em-mailer-prefs.c
@@ -1128,6 +1128,11 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
gtk_widget_set_sensitive ((GtkWidget *) prefs->citation_color, FALSE);
g_free (buf);
+ prefs->enable_search_folders = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkEnableSearchFolders"));
+ toggle_button_init (prefs, prefs->enable_search_folders, FALSE,
+ "/apps/evolution/mail/display/enable_vfolders",
+ G_CALLBACK (toggle_button_toggled));
+
/* Deleting Mail */
prefs->empty_trash = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkEmptyTrashOnExit"));
prefs->empty_trash_days = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuEmptyTrashDays"));
diff --git a/mail/em-mailer-prefs.h b/mail/em-mailer-prefs.h
index 8c25be69f0..a9a4327cb7 100644
--- a/mail/em-mailer-prefs.h
+++ b/mail/em-mailer-prefs.h
@@ -80,6 +80,7 @@ struct _EMMailerPrefs {
struct _GtkOptionMenu *charset;
struct _GtkToggleButton *citation_highlight;
struct _GtkColorButton *citation_color;
+ struct _GtkToggleButton *enable_search_folders;
struct _GtkToggleButton *magic_spacebar;
/* Deleting Mail */
diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in
index 381fdd5a71..5e712bb805 100644
--- a/mail/evolution-mail.schemas.in
+++ b/mail/evolution-mail.schemas.in
@@ -428,6 +428,20 @@
</schema>
<schema>
+ <key>/schemas/apps/evolution/mail/display/enable_vfolders</key>
+ <applyto>/apps/evolution/mail/display/enable_vfolders</applyto>
+ <owner>evolution-mail</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Enable Search Folders</short>
+ <long>
+ Enable Search Folders on startup.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/evolution/mail/display/safe_list</key>
<applyto>/apps/evolution/mail/display/safe_list</applyto>
<owner>evolution-mail</owner>
diff --git a/mail/mail-component.c b/mail/mail-component.c
index e4e2cbb6c5..036ad0a667 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -368,6 +368,7 @@ static void
mc_startup(MailComponent *mc)
{
static int started = 0;
+ GConfClient *gconf;
if (started)
return;
@@ -375,7 +376,11 @@ mc_startup(MailComponent *mc)
mc_setup_local_store(mc);
load_accounts(mc, mail_config_get_accounts());
- vfolder_load_storage();
+
+ gconf = mail_config_get_gconf_client();
+
+ if (gconf_client_get_bool (gconf, "/apps/evolution/mail/display/enable_vfolders", NULL))
+ vfolder_load_storage();
}
static void
diff --git a/mail/mail-config.glade b/mail/mail-config.glade
index be14dc151f..be41d9fb59 100644
--- a/mail/mail-config.glade
+++ b/mail/mail-config.glade
@@ -5268,6 +5268,62 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
<property name="fill">True</property>
</packing>
</child>
+ <child>
+ <widget class="GtkHBox" id="hboxEnableSearchFolders">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="chkEnableSearchFolders">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Enable Sea_rch Folders</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">True</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="lblEnableSFRestart">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">(Note: Requires restart)</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="left_attach">0</property>
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 6397ca772a..6a959a2280 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -948,6 +948,17 @@ 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)
{
@@ -1113,6 +1124,10 @@ vfolder_gui_add_rule(EMVFolderRule *rule)
GtkWidget *w;
GtkDialog *gd;
+ /* this should be done before we call this function */
+ if (!vfolder_loaded ())
+ vfolder_load_storage ();
+
w = filter_rule_get_widget((FilterRule *)rule, (RuleContext *)context);
gd = (GtkDialog *)gtk_dialog_new_with_buttons(_("New Search Folder"),
@@ -1142,6 +1157,10 @@ 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 ();
+
rule = (EMVFolderRule*)em_vfolder_rule_from_message(context, msg, flags, source);
vfolder_gui_add_rule(rule);
}
@@ -1153,6 +1172,10 @@ 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 ();
+
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 651ace301b..557dbbb340 100644
--- a/mail/mail-vfolder.h
+++ b/mail/mail-vfolder.h
@@ -10,6 +10,7 @@ struct _EMVFolderRule;
struct _CamelInternetAddress;
void vfolder_load_storage(void);
+gboolean vfolder_loaded (void);
void vfolder_revert(void);
void vfolder_edit (void);