aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog40
-rw-r--r--mail/em-folder-browser.c33
-rw-r--r--mail/em-folder-tree-model.c6
-rw-r--r--mail/em-folder-view.c83
-rw-r--r--mail/em-format-html-display.c46
-rw-r--r--mail/em-format-html.c21
-rw-r--r--mail/em-mailer-prefs.c10
-rw-r--r--mail/em-message-browser.c30
-rw-r--r--mail/em-migrate.c63
-rw-r--r--mail/em-subscribe-editor.c9
-rw-r--r--mail/em-sync-stream.c6
-rw-r--r--mail/em-utils.c76
-rw-r--r--mail/em-vfolder-editor.c10
-rw-r--r--mail/em-vfolder-rule.c9
-rw-r--r--mail/em-vfs-stream.c7
-rw-r--r--mail/mail-autofilter.c11
-rw-r--r--mail/mail-component.c10
-rw-r--r--mail/mail-config.c30
-rw-r--r--mail/mail-folder-cache.c15
19 files changed, 400 insertions, 115 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index de99445184..31d9dafe07 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -4,8 +4,44 @@
* em-account-editor.c
* em-account-prefs.c
- * em-filter-editor.c: Use gstdio wrappers. Construct pathnames of
- glade files at run-time.
+ * em-filter-editor.c
+ * em-folder-browser.c
+ * em-folder-view.c
+ * em-format-html.c
+ * em-format-html-display.c
+ * em-mailer-prefs.c
+ * em-message-browser.c
+ * em-migrate.c
+ * em-subscribe-editor.c
+ * em-sync-stream.c
+ * em-utils.c
+ * em-vfolder-editor.c
+ * em-vfolder-rule.c
+ * mail-autofilter.c
+ * mail-component.c
+ * mail-config.c
+ * mail-folder-cache.c: Use gstdio wrappers. Construct pathnames of
+ glade, xml, etspec and png files at run-time. Use
+ g_filename_{to,from}_uri().
+
+ * em-folder-browser.c (emfb_init)
+ * em-folder-view.c (emfv_finalise)
+ * em-message-browser.c (emmb_init): As EMFolderView::ui_files now
+ always is a list of filenames constructed with g_build_filename(),
+ use g_free() on each list entry before calling g_slist_free() on
+ the list.
+
+ * em-folder-tree-model.c (em_folder_tree_model_load_state): Use
+ e_xml_parse_file().
+
+ * em-migrate.c: Bypass all the code for upgrading from 1.x on Win32.
+ (emm_setup_initial): Use GDir instead of dirent.
+
+ * em-sync-stream.c
+ * mail-folder-cache.c: Use pthread_equal() to compare pthread_t
+ values.
+
+ * em-vfs-stream.c: No EINPROGRESS or ELOOP on Win32.
2005-12-17 Tor Lillqvist <tml@novell.com>
diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c
index a8f90bebcb..4eac993fe0 100644
--- a/mail/em-folder-browser.c
+++ b/mail/em-folder-browser.c
@@ -39,6 +39,14 @@
#include <gdk/gdkkeysyms.h>
#include <gconf/gconf-client.h>
+#ifdef G_OS_WIN32
+/* Work around 'DATADIR' and 'interface' lossage in <windows.h> */
+#define DATADIR crap_DATADIR
+#include <windows.h>
+#undef DATADIR
+#undef interface
+#endif
+
#include <libgnomeprintui/gnome-print-dialog.h>
#include "mail-mt.h"
@@ -67,6 +75,7 @@
#include <camel/camel-search-private.h>
#include "e-util/e-dialog-utils.h"
+#include "e-util/e-util-private.h"
#include "em-utils.h"
#include "em-composer-utils.h"
#include "em-format-html-display.h"
@@ -160,6 +169,13 @@ emfb_pane_button_release_event(GtkWidget *w, GdkEventButton *e, EMFolderBrowser
}
static void
+free_one_ui_file (gpointer data,
+ gpointer user_data)
+{
+ g_free (data);
+}
+
+static void
emfb_init(GObject *o)
{
EMFolderBrowser *emfb = (EMFolderBrowser *)o;
@@ -171,10 +187,21 @@ emfb_init(GObject *o)
emfb->view.preview_active = TRUE;
emfb->view.list_active = TRUE;
+ g_slist_foreach (emfb->view.ui_files, free_one_ui_file, NULL);
g_slist_free(emfb->view.ui_files);
- emfb->view.ui_files = g_slist_append(NULL, EVOLUTION_UIDIR "/evolution-mail-global.xml");
- emfb->view.ui_files = g_slist_append(emfb->view.ui_files, EVOLUTION_UIDIR "/evolution-mail-list.xml");
- emfb->view.ui_files = g_slist_append(emfb->view.ui_files, EVOLUTION_UIDIR "/evolution-mail-message.xml");
+
+ emfb->view.ui_files = g_slist_append(NULL,
+ g_build_filename (EVOLUTION_UIDIR,
+ "evolution-mail-global.xml",
+ NULL));
+ emfb->view.ui_files = g_slist_append(emfb->view.ui_files,
+ g_build_filename (EVOLUTION_UIDIR,
+ "evolution-mail-list.xml",
+ NULL));
+ emfb->view.ui_files = g_slist_append(emfb->view.ui_files,
+ g_build_filename (EVOLUTION_UIDIR,
+ "evolution-mail-message.xml",
+ NULL));
emfb->view.enable_map = g_slist_prepend(emfb->view.enable_map, (void *)emfb_enable_map);
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index 44b318b44c..7cc83be033 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -34,9 +34,10 @@
#include <libxml/parser.h>
+#include <libedataserver/e-xml-utils.h>
+
#include <e-util/e-mktemp.h>
-#include <e-util/e-xml-utils.h>
#include <libgnome/gnome-i18n.h>
#include <camel/camel-file-utils.h>
@@ -323,12 +324,11 @@ static void
em_folder_tree_model_load_state (EMFolderTreeModel *model, const char *filename)
{
xmlNodePtr root, node;
- struct stat st;
if (model->state)
xmlFreeDoc (model->state);
- if (stat (filename, &st) == 0 && (model->state = xmlParseFile (filename)))
+ if ((model->state = e_xml_parse_file (filename)))
return;
/* setup some defaults - expand "Local Folders" and "Search Folders" */
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 83a5d9791e..2388f471c1 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -20,31 +20,33 @@
*
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkvpaned.h>
+#include <glib.h>
+#include <glib/gstdio.h>
+
+#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
+#ifdef G_OS_WIN32
+/* Work around 'DATADIR' and 'interface' lossage in <windows.h> */
+#define DATADIR crap_DATADIR
+#include <windows.h>
+#undef DATADIR
+#undef interface
+#endif
+
#include <libgnome/gnome-url.h>
#include <libgnomeprintui/gnome-print-dialog.h>
#include <gconf/gconf-client.h>
-#include <widgets/menus/gal-view-etable.h>
-#include <widgets/menus/gal-view-factory-etable.h>
-#include <widgets/menus/gal-view-instance.h>
-#include "widgets/menus/gal-view-menus.h"
-
#include <camel/camel-mime-message.h>
#include <camel/camel-stream.h>
#include <camel/camel-stream-filter.h>
@@ -63,13 +65,22 @@
#include <bonobo/bonobo-ui-component.h>
#include <bonobo/bonobo-ui-util.h>
+#include <gtkhtml/gtkhtml.h>
+#include <gtkhtml/gtkhtml-stream.h>
+
+#include "menus/gal-view-etable.h"
+#include "menus/gal-view-factory-etable.h"
+#include "menus/gal-view-instance.h"
+#include "menus/gal-view-menus.h"
+
#include "misc/e-charset-picker.h"
-#include "e-util/e-error.h"
-#include <e-util/e-dialog-utils.h>
-#include <e-util/e-icon-factory.h>
-#include <e-util/e-print.h>
-#include <e-util/e-profile-event.h>
+#include "e-util/e-error.h"
+#include "e-util/e-dialog-utils.h"
+#include "e-util/e-icon-factory.h"
+#include "e-util/e-print.h"
+#include "e-util/e-profile-event.h"
+#include "e-util/e-util-private.h"
#include "filter/filter-rule.h"
@@ -77,7 +88,7 @@
#include "em-format-html-print.h"
#include "em-folder-selection.h"
#include "em-folder-view.h"
-#include "em-folder-browser.h" /* EMFolderBrowser stuff */
+#include "em-folder-browser.h"
#include "em-mailer-prefs.h"
#include "em-message-browser.h"
#include "message-list.h"
@@ -87,9 +98,6 @@
#include "em-menu.h"
#include "em-event.h"
-#include <gtkhtml/gtkhtml.h>
-#include <gtkhtml/gtkhtml-stream.h>
-
#include "mail-mt.h"
#include "mail-ops.h"
#include "mail-config.h"
@@ -184,7 +192,11 @@ emfv_init(GObject *o)
emfv->statusbar_active = TRUE;
emfv->list_active = FALSE;
- emfv->ui_files = g_slist_append(NULL, EVOLUTION_UIDIR "/evolution-mail-message.xml");
+ emfv->ui_files = g_slist_append(NULL,
+ g_build_filename (EVOLUTION_UIDIR,
+ "evolution-mail-message.xml",
+ NULL));
+
emfv->ui_app_name = "evolution-mail";
emfv->enable_map = g_slist_prepend(NULL, (void *)emfv_enable_map);
@@ -220,11 +232,19 @@ emfv_init(GObject *o)
}
static void
+free_one_ui_file (gpointer data,
+ gpointer user_data)
+{
+ g_free (data);
+}
+
+static void
emfv_finalise(GObject *o)
{
EMFolderView *emfv = (EMFolderView *)o;
struct _EMFolderViewPrivate *p = emfv->priv;
+ g_slist_foreach (emfv->ui_files, free_one_ui_file, NULL);
g_slist_free(emfv->ui_files);
g_slist_free(emfv->enable_map);
@@ -489,18 +509,28 @@ emfv_setup_view_instance(EMFolderView *emfv)
GalViewFactory *factory;
const char *evolution_dir;
char *dir;
+ char *galviewsmaildir;
+ char *etspecfile;
collection = gal_view_collection_new ();
gal_view_collection_set_title (collection, _("Mail"));
evolution_dir = mail_component_peek_base_directory (mail_component_peek ());
+ galviewsmaildir = g_build_filename (EVOLUTION_GALVIEWSDIR,
+ "mail",
+ NULL);
dir = g_build_filename (evolution_dir, "mail", "views", NULL);
- gal_view_collection_set_storage_directories (collection, EVOLUTION_GALVIEWSDIR "/mail/", dir);
+ gal_view_collection_set_storage_directories (collection, galviewsmaildir, dir);
g_free (dir);
+ g_free (galviewsmaildir);
spec = e_table_specification_new ();
- e_table_specification_load_from_file (spec, EVOLUTION_ETSPECDIR "/message-list.etspec");
+ etspecfile = g_build_filename (EVOLUTION_ETSPECDIR,
+ "message-list.etspec",
+ NULL);
+ e_table_specification_load_from_file (spec, etspecfile);
+ g_free (etspecfile);
factory = gal_view_factory_etable_new (spec);
g_object_unref (spec);
@@ -539,13 +569,18 @@ emfv_setup_view_instance(EMFolderView *emfv)
char *path;
path = mail_config_folder_to_cachename (emfv->folder, "et-header-");
- if (path && stat (path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) {
+ if (path && g_stat (path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) {
ETableSpecification *spec;
ETableState *state;
GalView *view;
+ char *etspecfile;
spec = e_table_specification_new ();
- e_table_specification_load_from_file (spec, EVOLUTION_ETSPECDIR "/message-list.etspec");
+ etspecfile = g_build_filename (EVOLUTION_ETSPECDIR,
+ "message-list.etspec",
+ NULL);
+ e_table_specification_load_from_file (spec, etspecfile);
+ g_free (etspecfile);
view = gal_view_etable_new (spec, "");
g_object_unref (spec);
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index ec26935242..e485631ee4 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -26,6 +26,17 @@
#include <string.h>
+#include <glib.h>
+#include <glib/gstdio.h>
+
+#ifdef G_OS_WIN32
+/* Work around 'DATADIR' and 'interface' lossage in <windows.h> */
+#define DATADIR crap_DATADIR
+#include <windows.h>
+#undef DATADIR
+#undef interface
+#endif
+
#include <gtkhtml/gtkhtml.h>
#include <gtkhtml/gtkhtml-embedded.h>
#include <gtkhtml/gtkhtml-search.h>
@@ -68,8 +79,8 @@
#include <camel/camel-folder.h>
#include <camel/camel-string-utils.h>
-/* should this be in e-util rather than gal? */
#include <e-util/e-util.h>
+#include <e-util/e-util-private.h>
#include <libedataserver/e-msgport.h>
#include <e-util/e-gui-utils.h>
@@ -545,13 +556,19 @@ em_format_html_display_search(EMFormatHTMLDisplay *efhd)
{
struct _EMFormatHTMLDisplayPrivate *p = efhd->priv;
GladeXML *xml;
+ char *gladefile;
if (p->search_dialog) {
gdk_window_raise(((GtkWidget *)p->search_dialog)->window);
return;
}
- xml = glade_xml_new (EVOLUTION_GLADEDIR "/mail-dialogs.glade", "search_message_dialog", NULL);
+ gladefile = g_build_filename (EVOLUTION_GLADEDIR,
+ "mail-dialogs.glade",
+ NULL);
+ xml = glade_xml_new (gladefile, "search_message_dialog", NULL);
+ g_free (gladefile);
+
if (xml == NULL) {
g_warning("Cannot open search dialog glade file");
/* ?? */
@@ -855,12 +872,18 @@ efhd_xpkcs7mime_validity_clicked(GtkWidget *button, EMFormatHTMLPObject *pobject
struct _smime_pobject *po = (struct _smime_pobject *)pobject;
GladeXML *xml;
GtkWidget *vbox, *w;
+ char *gladefile;
if (po->widget)
/* FIXME: window raise? */
return;
- xml = glade_xml_new(EVOLUTION_GLADEDIR "/mail-dialogs.glade", "message_security_dialog", NULL);
+ gladefile = g_build_filename (EVOLUTION_GLADEDIR,
+ "mail-dialogs.glade",
+ NULL);
+ xml = glade_xml_new(gladefile, "message_security_dialog", NULL);
+ g_free (gladefile);
+
po->widget = glade_xml_get_widget(xml, "message_security_dialog");
vbox = glade_xml_get_widget(xml, "signature_vbox");
@@ -1285,7 +1308,7 @@ static void
efhd_drag_data_get(GtkWidget *w, GdkDragContext *drag, GtkSelectionData *data, guint info, guint time, EMFormatHTMLPObject *pobject)
{
CamelMimePart *part = pobject->part;
- char *uri, *path;
+ char *uri, *uri_crlf, *path;
CamelStream *stream;
switch (info) {
@@ -1319,10 +1342,12 @@ efhd_drag_data_get(GtkWidget *w, GdkDragContext *drag, GtkSelectionData *data, g
if (path == NULL)
return;
- uri = g_strdup_printf("file://%s\r\n", path);
+ uri = g_filename_to_uri(path, NULL, NULL);
g_free(path);
- gtk_selection_data_set(data, data->target, 8, uri, strlen(uri));
- g_object_set_data_full((GObject *)w, "e-drag-uri", uri, g_free);
+ uri_crlf = g_strconcat(uri, "\r\n", NULL);
+ g_free(uri);
+ gtk_selection_data_set(data, data->target, 8, uri_crlf, strlen(uri_crlf));
+ g_object_set_data_full((GObject *)w, "e-drag-uri", uri_crlf, g_free);
break;
default:
abort();
@@ -1338,7 +1363,12 @@ efhd_drag_data_delete(GtkWidget *w, GdkDragContext *drag, EMFormatHTMLPObject *p
if (uri) {
/* NB: this doesn't kill the dnd directory */
/* NB: is this ever called? */
- unlink(uri+7);
+ /* NB even more: doesn't the e-drag-uri have \r\n
+ * appended? (see efhd_drag_data_get())
+ */
+ char *filename = g_filename_from_uri (uri, NULL, NULL);
+ g_unlink(filename);
+ g_free(filename);
g_object_set_data((GObject *)w, "e-drag-uri", NULL);
}
}
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index f0a91f92c4..52c3fe9075 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -31,10 +31,20 @@
#include <fcntl.h>
#include <ctype.h>
+#include <glib.h>
+#ifdef G_OS_WIN32
+/* Work around 'DATADIR' and 'interface' lossage in <windows.h> */
+#define DATADIR crap_DATADIR
+#include <windows.h>
+#undef DATADIR
+#undef interface
+#endif
+
#include <libedataserver/e-iconv.h>
#include <libedataserver/e-util.h> /* for e_utf8_strftime, what about e_time_format_time? */
#include <libedataserver/e-time-utils.h>
#include "e-util/e-icon-factory.h"
+#include "e-util/e-util-private.h"
#include <gtkhtml/gtkhtml.h>
#include <gtkhtml/gtkhtml-embedded.h>
@@ -906,7 +916,7 @@ efh_message_external(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part
if (name == NULL)
goto fail;
- url = g_strdup_printf ("file:///%s", *name == '/' ? name+1:name);
+ url = g_filename_to_uri (name, NULL, NULL);
if (site)
desc = g_strdup_printf(_("Pointer to local file (%s) valid at site \"%s\""), name, site);
else
@@ -1715,10 +1725,17 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part)
if (rupert && efh->show_rupert) {
char *classid;
CamelMimePart *iconpart;
+ char *pngfile;
classid = g_strdup_printf("icon:///em-format-html/%s/icon/header", emf->part_id->str);
camel_stream_printf(stream, "<td align=\"right\" valign=\"top\"><img width=16 height=16 src=\"%s\"></td>", classid);
- iconpart = em_format_html_file_part((EMFormatHTML *)emf, "image/png", EVOLUTION_ICONSDIR "/monkey-16.png");
+
+ pngfile = g_build_filename (EVOLUTION_ICONSDIR,
+ "monkey-16.png",
+ NULL);
+ iconpart = em_format_html_file_part((EMFormatHTML *)emf, "image/png", pngfile);
+ g_free (pngfile);
+
if (iconpart) {
em_format_add_puri(emf, sizeof(EMFormatPURI), classid, iconpart, efh_write_image);
camel_object_unref(iconpart);
diff --git a/mail/em-mailer-prefs.c b/mail/em-mailer-prefs.c
index 4fe3cbfa68..e437ee0860 100644
--- a/mail/em-mailer-prefs.c
+++ b/mail/em-mailer-prefs.c
@@ -54,6 +54,8 @@
#include <gtk/gtkoptionmenu.h>
#include <gtk/gtkmenuitem.h>
+#include "e-util/e-util-private.h"
+
#include "mail-config.h"
#include "em-config.h"
@@ -719,8 +721,14 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
EMConfig *ec;
EMConfigTargetPrefs *target;
GSList *l;
+ char *gladefile;
+
+ gladefile = g_build_filename (EVOLUTION_GLADEDIR,
+ "mail-config.glade",
+ NULL);
+ gui = glade_xml_new (gladefile, "preferences_toplevel", NULL);
+ g_free (gladefile);
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "preferences_toplevel", NULL);
prefs->gui = gui;
/** @HookPoint-EMConfig: Mail Preferences Page
diff --git a/mail/em-message-browser.c b/mail/em-message-browser.c
index caf93e7e41..f8e2d5bdd1 100644
--- a/mail/em-message-browser.c
+++ b/mail/em-message-browser.c
@@ -25,6 +25,15 @@
#include <config.h>
#endif
+#include <glib.h>
+#ifdef G_OS_WIN32
+/* Work around 'DATADIR' and 'interface' lossage in <windows.h> */
+#define DATADIR crap_DATADIR
+#include <windows.h>
+#undef DATADIR
+#undef interface
+#endif
+
#include <gtk/gtkscrolledwindow.h>
#include <gtk/gtkbutton.h>
@@ -39,6 +48,8 @@
#include <bonobo/bonobo-ui-component.h>
#include <bonobo/bonobo-ui-util.h>
+#include "e-util/e-util-private.h"
+
#include "em-format-html-display.h"
#include "em-message-browser.h"
#include "em-menu.h"
@@ -59,6 +70,13 @@ static void emmb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int state)
static EMFolderViewClass *emmb_parent;
static void
+free_one_ui_file (gpointer data,
+ gpointer user_data)
+{
+ g_free (data);
+}
+
+static void
emmb_init(GObject *o)
{
EMMessageBrowser *emmb = (EMMessageBrowser *)o;
@@ -68,9 +86,17 @@ emmb_init(GObject *o)
((EMFolderView *)emmb)->preview_active = TRUE;
+ g_slist_foreach (emmb->view.ui_files, free_one_ui_file, NULL);
g_slist_free(emmb->view.ui_files);
- emmb->view.ui_files = g_slist_append(NULL, EVOLUTION_UIDIR "/evolution-mail-messagedisplay.xml");
- emmb->view.ui_files = g_slist_append(emmb->view.ui_files, EVOLUTION_UIDIR "/evolution-mail-message.xml");
+
+ emmb->view.ui_files = g_slist_append(NULL,
+ g_build_filename (EVOLUTION_UIDIR,
+ "evolution-mail-messagedisplay.xml",
+ NULL));
+ emmb->view.ui_files = g_slist_append(emmb->view.ui_files,
+ g_build_filename (EVOLUTION_UIDIR,
+ "evolution-mail-message.xml",
+ NULL));
/* currently: just use a scrolledwindow for preview widget */
p->preview = gtk_scrolled_window_new(NULL, NULL);
diff --git a/mail/em-migrate.c b/mail/em-migrate.c
index 8b01766350..72071e3edc 100644
--- a/mail/em-migrate.c
+++ b/mail/em-migrate.c
@@ -36,6 +36,9 @@
#include <errno.h>
#include <ctype.h>
+#include <glib.h>
+#include <glib/gstdio.h>
+
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
@@ -61,6 +64,7 @@
#include "e-util/e-account-list.h"
#include "e-util/e-signature-list.h"
#include "e-util/e-error.h"
+#include "e-util/e-util-private.h"
#include "mail-config.h"
#include "em-utils.h"
@@ -68,6 +72,12 @@
#define d(x) x
+#ifndef G_OS_WIN32
+
+/* No previous versions have been available on Win32, so don't bother
+ * with upgrade support from 1.x on Win32.
+ */
+
/* upgrade helper functions */
static xmlDocPtr
emm_load_xml (const char *dirname, const char *filename)
@@ -1404,6 +1414,8 @@ nofile:
return g_strdup_printf("%s:%s", protocol, dirname);
}
+#endif /* !G_OS_WIN32 */
+
enum {
CP_UNIQUE = 0,
CP_OVERWRITE,
@@ -1428,16 +1440,16 @@ cp (const char *src, const char *dest, gboolean show_progress, int mode)
/* if the dest file exists and has content, abort - we don't
* want to corrupt their existing data */
- if (stat (dest, &st) == 0 && st.st_size > 0 && mode == CP_UNIQUE) {
+ if (g_stat (dest, &st) == 0 && st.st_size > 0 && mode == CP_UNIQUE) {
errno = EEXIST;
return -1;
}
- if (stat (src, &st) == -1
- || (readfd = open (src, O_RDONLY)) == -1)
+ if (g_stat (src, &st) == -1
+ || (readfd = g_open (src, O_RDONLY | O_BINARY, 0)) == -1)
return -1;
- if ((writefd = open (dest, open_flags[mode], 0666)) == -1) {
+ if ((writefd = g_open (dest, open_flags[mode] | O_BINARY, 0666)) == -1) {
errnosav = errno;
close (readfd);
errno = errnosav;
@@ -1462,9 +1474,10 @@ cp (const char *src, const char *dest, gboolean show_progress, int mode)
goto exception;
total += nwritten;
-
+#ifndef G_OS_WIN32
if (show_progress)
em_migrate_set_progress (((double) total) / ((double) st.st_size));
+#endif
} while (total < st.st_size);
if (fsync (writefd) == -1)
@@ -1497,6 +1510,8 @@ cp (const char *src, const char *dest, gboolean show_progress, int mode)
return -1;
}
+#ifndef G_OS_WIN32
+
static int
cp_r (const char *src, const char *dest, const char *pattern, int mode)
{
@@ -2621,11 +2636,13 @@ em_migrate_1_4 (const char *evolution_dir, xmlDocPtr filters, xmlDocPtr vfolders
return 0;
}
+#endif
+
static int
emm_setup_initial(const char *evolution_dir)
{
- DIR *dir;
- struct dirent *d;
+ GDir *dir;
+ const char *d;
struct stat st;
const GList *l;
char *local, *base;
@@ -2635,7 +2652,7 @@ emm_setup_initial(const char *evolution_dir)
d(printf("Setting up initial mail tree\n"));
- base = g_build_filename(evolution_dir, "/mail/local", NULL);
+ base = g_build_filename(evolution_dir, "mail/local", NULL);
if (camel_mkdir(base, 0777) == -1 && errno != EEXIST) {
g_free(base);
return -1;
@@ -2645,32 +2662,33 @@ emm_setup_initial(const char *evolution_dir)
for (l = gnome_i18n_get_language_list("LC_MESSAGES");
l != NULL;
l = g_list_next(l)) {
- local = g_build_filename(EVOLUTION_PRIVDATADIR "/default", (char *)l->data, "mail/local", NULL);
- if (stat(local, &st) == 0)
+ local = g_build_filename(EVOLUTION_PRIVDATADIR,
+ "default",
+ (char *)l->data,
+ "mail/local", NULL);
+ if (g_stat(local, &st) == 0)
goto gotlocal;
g_free(local);
}
- local = g_build_filename(EVOLUTION_PRIVDATADIR "/default/C/mail/local", NULL);
+ local = g_build_filename(EVOLUTION_PRIVDATADIR,
+ "default/C/mail/local", NULL);
gotlocal:
- dir = opendir(local);
+ dir = g_dir_open(local, 0, NULL);
if (dir) {
- while ((d = readdir(dir))) {
+ while ((d = g_dir_read_name(dir))) {
char *src, *dest;
- if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
- continue;
-
- src = g_build_filename(local, d->d_name, NULL);
- dest = g_build_filename(base, d->d_name, NULL);
+ src = g_build_filename(local, d, NULL);
+ dest = g_build_filename(base, d, NULL);
cp(src, dest, FALSE, CP_UNIQUE);
g_free(dest);
g_free(src);
}
- closedir(dir);
+ g_dir_close(dir);
}
g_free(local);
@@ -2687,7 +2705,7 @@ em_migrate (const char *evolution_dir, int major, int minor, int revision, Camel
/* make sure ~/.evolution/mail exists */
path = g_build_filename (evolution_dir, "mail", NULL);
- if (stat (path, &st) == -1) {
+ if (g_stat (path, &st) == -1) {
if (errno != ENOENT || camel_mkdir (path, 0777) == -1) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Unable to create local mail folders at `%s': %s"),
@@ -2701,7 +2719,8 @@ em_migrate (const char *evolution_dir, int major, int minor, int revision, Camel
if (major == 0)
return emm_setup_initial(evolution_dir);
-
+
+#ifndef G_OS_WIN32
if (major == 1 && minor < 5) {
xmlDocPtr config_xmldb = NULL, filters, vfolders;
@@ -2759,6 +2778,6 @@ em_migrate (const char *evolution_dir, int major, int minor, int revision, Camel
g_free (path);
}
-
+#endif /* !G_OS_WIN32 */
return 0;
}
diff --git a/mail/em-subscribe-editor.c b/mail/em-subscribe-editor.c
index 205776e858..51dd4a2404 100644
--- a/mail/em-subscribe-editor.c
+++ b/mail/em-subscribe-editor.c
@@ -37,6 +37,7 @@
#include "camel/camel-store.h"
#include "camel/camel-session.h"
#include "e-util/e-account-list.h"
+#include "e-util/e-util-private.h"
#include "em-subscribe-editor.h"
@@ -835,11 +836,17 @@ GtkDialog *em_subscribe_editor_new(void)
EIterator *iter;
GladeXML *xml;
GtkWidget *menu, *w;
+ char *gladefile;
se = g_malloc0(sizeof(*se));
e_dlist_init(&se->stores);
- xml = glade_xml_new (EVOLUTION_GLADEDIR "/mail-dialogs.glade", "subscribe_dialog", NULL);
+ gladefile = g_build_filename (EVOLUTION_GLADEDIR,
+ "mail-dialogs.glade",
+ NULL);
+ xml = glade_xml_new (gladefile, "subscribe_dialog", NULL);
+ g_free (gladefile);
+
if (xml == NULL) {
/* ?? */
return NULL;
diff --git a/mail/em-sync-stream.c b/mail/em-sync-stream.c
index d6fae3a8d7..2b18f782d9 100644
--- a/mail/em-sync-stream.c
+++ b/mail/em-sync-stream.c
@@ -263,7 +263,7 @@ stream_write (CamelStream *stream, const char *buffer, size_t n)
if (emss->cancel)
return -1;
- if (pthread_self() == mail_gui_thread) {
+ if (pthread_equal(pthread_self(), mail_gui_thread)) {
EMSS_CLASS(emss)->sync_write(stream, buffer, n);
#ifdef LOG_STREAM
if (p->logfd)
@@ -293,7 +293,7 @@ stream_flush(CamelStream *stream)
if (emss->cancel)
return -1;
- if (pthread_self() == mail_gui_thread)
+ if (pthread_equal(pthread_self(), mail_gui_thread))
return ((EMSyncStreamClass *)(((CamelObject *)emss)->klass))->sync_flush(stream);
else
sync_op(emss, EMSS_FLUSH, NULL, 0);
@@ -311,7 +311,7 @@ stream_close(CamelStream *stream)
d(printf("%p: closing stream\n", stream));
- if (pthread_self() == mail_gui_thread) {
+ if (pthread_equal(pthread_self(), mail_gui_thread)) {
#ifdef LOG_STREAM
if (emss->priv->logfd) {
fclose(emss->priv->logfd);
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 434b0205d9..dcc8ec7971 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -31,6 +31,21 @@
#include <errno.h>
#include <time.h>
+#include <glib.h>
+#include <glib/gstdio.h>
+
+#ifdef G_OS_WIN32
+/* Work around namespace clobbage in <windows.h> */
+#define DATADIR windows_DATADIR
+#include <windows.h>
+#undef DATADIR
+#undef interface
+#endif
+
+#if !GLIB_CHECK_VERSION (2, 8, 0)
+#define g_access access
+#endif
+
#include <camel/camel-stream-fs.h>
#include <camel/camel-url-scanner.h>
#include <camel/camel-file-utils.h>
@@ -53,12 +68,13 @@
#include "mail-config.h"
#include "message-tag-followup.h"
-#include <e-util/e-mktemp.h>
-#include <e-util/e-account-list.h>
-#include <e-util/e-dialog-utils.h>
+#include "e-util/e-util.h"
+#include "e-util/e-util-private.h"
+#include "e-util/e-mktemp.h"
+#include "e-util/e-account-list.h"
+#include "e-util/e-dialog-utils.h"
#include "e-util/e-error.h"
-#include <e-util/e-util.h>
#include "em-utils.h"
#include "em-composer-utils.h"
@@ -317,9 +333,10 @@ em_utils_edit_filters (GtkWidget *parent)
fc = em_filter_context_new ();
user = g_strdup_printf ("%s/mail/filters.xml", base_directory);
- system = EVOLUTION_PRIVDATADIR "/filtertypes.xml";
+ system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL);
rule_context_load ((RuleContext *) fc, system, user);
g_free (user);
+ g_free (system);
if (((RuleContext *) fc)->error) {
e_error_run((GtkWindow *)parent, "mail:filter-load-error", ((RuleContext *)fc)->error, NULL);
@@ -420,11 +437,11 @@ emu_can_save(GtkWindow *parent, const char *path)
return FALSE;
/* make sure we can actually save to it... */
- if (stat (path, &st) != -1 && !S_ISREG (st.st_mode))
+ if (g_stat (path, &st) != -1 && !S_ISREG (st.st_mode))
return FALSE;
- if (access (path, F_OK) == 0) {
- if (access (path, W_OK) != 0) {
+ if (g_access (path, F_OK) == 0) {
+ if (g_access (path, W_OK) != 0) {
e_error_run(parent, "mail:no-save-path", path, g_strerror(errno), NULL);
return FALSE;
}
@@ -582,14 +599,14 @@ em_utils_save_part_to_file(GtkWidget *parent, const char *filename, CamelMimePar
}
g_free(dirname);
- if (access(filename, F_OK) == 0) {
- if (access(filename, W_OK) != 0) {
+ if (g_access(filename, F_OK) == 0) {
+ if (g_access(filename, W_OK) != 0) {
e_error_run((GtkWindow *)parent, E_ERROR_ASK_FILE_EXISTS_OVERWRITE, filename, NULL);
return FALSE;
}
}
- if (stat(filename, &st) != -1 && !S_ISREG(st.st_mode)) {
+ if (g_stat(filename, &st) != -1 && !S_ISREG(st.st_mode)) {
e_error_run((GtkWindow *)parent, "mail:no-write-path-notfile", filename, NULL);
return FALSE;
}
@@ -1158,7 +1175,7 @@ em_utils_selection_set_urilist(GtkSelectionData *data, CamelFolder *folder, GPtr
{
char *tmpdir;
CamelStream *fstream;
- char *uri, *p, *file = NULL;
+ char *uri, *file = NULL, *tmpfile;
int fd;
CamelMessageInfo *info;
@@ -1183,25 +1200,30 @@ em_utils_selection_set_urilist(GtkSelectionData *data, CamelFolder *folder, GPtr
e_filename_make_safe(file);
- p = uri = g_alloca (strlen (tmpdir) + strlen(file) + 16);
- p += sprintf (uri, "file:///%s/%s", tmpdir, file);
+ tmpfile = g_build_filename(tmpdir, file, NULL);
g_free(tmpdir);
g_free(file);
- fd = open(uri + 7, O_WRONLY | O_CREAT | O_EXCL, 0666);
- if (fd == -1)
+ fd = g_open(tmpfile, O_WRONLY | O_CREAT | O_EXCL | O_BINARY, 0666);
+ g_free(tmpfile);
+ if (fd == -1) {
return;
-
+ }
+
+ uri = g_filename_to_uri(tmpfile, NULL, NULL);
fstream = camel_stream_fs_new_with_fd(fd);
if (fstream) {
- /* terminate with \r\n to be compliant with the spec */
- strcpy (p, "\r\n");
-
- if (em_utils_write_messages_to_stream(folder, uids, fstream) == 0)
- gtk_selection_data_set(data, data->target, 8, uri, strlen(uri));
+ if (em_utils_write_messages_to_stream(folder, uids, fstream) == 0) {
+ /* terminate with \r\n to be compliant with the spec */
+ char *uri_crlf = g_strconcat(uri, "\r\n", NULL);
+
+ gtk_selection_data_set(data, data->target, 8, uri_crlf, strlen(uri_crlf));
+ g_free(uri_crlf);
+ }
camel_object_unref(fstream);
}
+ g_free(uri);
}
/**
@@ -1237,7 +1259,7 @@ em_utils_selection_get_urilist(GtkSelectionData *data, CamelFolder *folder)
continue;
if (strcmp(url->protocol, "file") == 0
- && (fd = open(url->path, O_RDONLY)) != -1) {
+ && (fd = g_open(url->path, O_RDONLY | O_BINARY, 0)) != -1) {
stream = camel_stream_fs_new_with_fd(fd);
res = em_utils_read_messages_from_stream(folder, stream);
camel_object_unref(stream);
@@ -1818,6 +1840,14 @@ char *em_uri_to_camel(const char *euri)
curl = camel_url_new("mbox:", NULL);
base = g_strdup_printf("%s/.evolution/mail/%s", g_get_home_dir(), eurl->user);
+#ifdef G_OS_WIN32
+ /* Turn backslashes into slashes to avoid URI encoding */
+ {
+ char *p = base;
+ while ((p = strchr (p, '\\')))
+ *p++ = '/';
+ }
+#endif
camel_url_set_path(curl, base);
g_free(base);
camel_url_set_fragment(curl, eurl->path[0]=='/'?eurl->path+1:eurl->path);
diff --git a/mail/em-vfolder-editor.c b/mail/em-vfolder-editor.c
index 781a80bb19..e1b78381c2 100644
--- a/mail/em-vfolder-editor.c
+++ b/mail/em-vfolder-editor.c
@@ -27,6 +27,8 @@
#include <gtk/gtk.h>
#include <libgnome/gnome-i18n.h>
+#include "e-util/e-util-private.h"
+
#include "em-vfolder-editor.h"
#include "em-vfolder-rule.h"
@@ -99,8 +101,14 @@ em_vfolder_editor_new (EMVFolderContext *vc)
{
EMVFolderEditor *ve = (EMVFolderEditor *) g_object_new (em_vfolder_editor_get_type(), NULL);
GladeXML *gui;
+ char *gladefile;
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/filter.glade", "rule_editor", NULL);
+ gladefile = g_build_filename (EVOLUTION_GLADEDIR,
+ "filter.glade",
+ NULL);
+ gui = glade_xml_new (gladefile, "rule_editor", NULL);
+ g_free (gladefile);
+
rule_editor_construct ((RuleEditor *) ve, (RuleContext *) vc, gui, "incoming", _("Search _Folders"));
gtk_widget_hide(glade_xml_get_widget (gui, "filter_source"));
g_object_unref (gui);
diff --git a/mail/em-vfolder-rule.c b/mail/em-vfolder-rule.c
index 885c6e0339..88d61204e8 100644
--- a/mail/em-vfolder-rule.c
+++ b/mail/em-vfolder-rule.c
@@ -38,6 +38,7 @@
#include "mail/em-folder-selector.h"
#include "mail/mail-component.h"
#include "e-util/e-error.h"
+#include "e-util/e-util-private.h"
#define d(x)
@@ -600,6 +601,7 @@ get_widget(FilterRule *fr, RuleContext *rc)
GtkTreeIter iter;
GladeXML *gui;
int i;
+ char *gladefile;
widget = FILTER_RULE_CLASS(parent_class)->get_widget(fr, rc);
@@ -607,7 +609,12 @@ get_widget(FilterRule *fr, RuleContext *rc)
data->rc = rc;
data->vr = vr;
- gui = glade_xml_new(EVOLUTION_GLADEDIR "/mail-dialogs.glade", "vfolder_source_frame", NULL);
+ gladefile = g_build_filename (EVOLUTION_GLADEDIR,
+ "mail-dialogs.glade",
+ NULL);
+ gui = glade_xml_new(gladefile, "vfolder_source_frame", NULL);
+ g_free (gladefile);
+
frame = glade_xml_get_widget(gui, "vfolder_source_frame");
g_object_set_data_full((GObject *)frame, "data", data, g_free);
diff --git a/mail/em-vfs-stream.c b/mail/em-vfs-stream.c
index af23862988..d232b3e6cb 100644
--- a/mail/em-vfs-stream.c
+++ b/mail/em-vfs-stream.c
@@ -33,6 +33,13 @@
#include "em-vfs-stream.h"
+#ifndef EINPROGRESS
+#define EINPROGRESS EAGAIN
+#endif
+#ifndef ELOOP
+#define ELOOP EIO
+#endif
+
#define LOG_STREAM
#define d(x)
diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c
index ffba4ba084..f02c8134de 100644
--- a/mail/mail-autofilter.c
+++ b/mail/mail-autofilter.c
@@ -42,6 +42,7 @@
#include "mail-component.h"
#include "em-utils.h"
#include "e-util/e-error.h"
+#include "e-util/e-util-private.h"
#include "em-vfolder-context.h"
#include "em-vfolder-rule.h"
@@ -360,8 +361,10 @@ filter_gui_add_from_message (CamelMimeMessage *msg, const char *source, int flag
fc = em_filter_context_new ();
user = g_strdup_printf ("%s/mail/filters.xml",
mail_component_peek_base_directory (mail_component_peek ()));
- system = EVOLUTION_PRIVDATADIR "/filtertypes.xml";
+ system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL);
rule_context_load ((RuleContext *)fc, system, user);
+ g_free (system);
+
rule = filter_rule_from_message (fc, msg, flags);
filter_rule_set_source (rule, source);
@@ -384,8 +387,9 @@ mail_filter_rename_uri(CamelStore *store, const char *olduri, const char *newuri
fc = em_filter_context_new ();
user = g_strdup_printf ("%s/mail/filters.xml", mail_component_peek_base_directory (mail_component_peek ()));
- system = EVOLUTION_PRIVDATADIR "/filtertypes.xml";
+ system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL);
rule_context_load ((RuleContext *)fc, system, user);
+ g_free (system);
changed = rule_context_rename_uri((RuleContext *)fc, eolduri, enewuri, g_str_equal);
if (changed) {
@@ -414,8 +418,9 @@ mail_filter_delete_uri(CamelStore *store, const char *uri)
fc = em_filter_context_new ();
user = g_strdup_printf ("%s/mail/filters.xml", mail_component_peek_base_directory (mail_component_peek ()));
- system = EVOLUTION_PRIVDATADIR "/filtertypes.xml";
+ system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL);
rule_context_load ((RuleContext *)fc, system, user);
+ g_free (system);
deleted = rule_context_delete_uri ((RuleContext *) fc, euri, g_str_equal);
if (deleted) {
diff --git a/mail/mail-component.c b/mail/mail-component.c
index ee7e20044a..9ca61d2a75 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -48,6 +48,7 @@
#include "misc/e-info-label.h"
#include "e-util/e-error.h"
+#include "e-util/e-util-private.h"
#include "em-search-context.h"
#include "mail-config.h"
@@ -342,7 +343,7 @@ setup_search_context (MailComponent *component)
if (priv->search_context == NULL) {
char *user = g_build_filename(component->priv->base_directory, "mail/searches.xml", NULL);
- char *system = g_strdup (EVOLUTION_PRIVDATADIR "/searchtypes.xml");
+ char *system = g_build_filename (EVOLUTION_PRIVDATADIR, "searchtypes.xml", NULL);
priv->search_context = (RuleContext *)em_search_context_new ();
g_object_set_data_full (G_OBJECT (priv->search_context), "user", user, g_free);
@@ -1040,6 +1041,13 @@ mail_component_init (MailComponent *component)
priv->lock = g_mutex_new();
priv->base_directory = g_build_filename (g_get_home_dir (), ".evolution", NULL);
+#ifdef G_OS_WIN32
+ {
+ char *p = priv->base_directory;
+ while ((p = strchr(p, '\\')))
+ *p++ = '/';
+ }
+#endif
if (camel_mkdir (priv->base_directory, 0777) == -1 && errno != EEXIST)
abort ();
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 6619b49b84..8900295ad4 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -29,8 +29,6 @@
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
-#include <pwd.h>
-#include <sys/wait.h>
#include <signal.h>
#include <errno.h>
@@ -38,6 +36,12 @@
#include <ctype.h>
#include <glib.h>
+#include <glib/gstdio.h>
+
+#ifndef G_OS_WIN32
+#include <sys/wait.h>
+#endif
+
#include <gtk/gtkdialog.h>
#include <gtkhtml/gtkhtml.h>
#include <glade/glade.h>
@@ -71,6 +75,10 @@
#include "mail-mt.h"
#include "mail-tools.h"
+#if !GLIB_CHECK_VERSION (2, 8, 0)
+#define g_creat creat
+#endif
+
/* Note, the first element of each MailConfigLabel must NOT be translated */
MailConfigLabel label_defaults[5] = {
{ "important", N_("Important"), "#ff0000" }, /* red */
@@ -252,7 +260,7 @@ config_write_style (void)
char *citation_color;
FILE *rc;
- if (!(rc = fopen (config->gtkrc, "wt"))) {
+ if (!(rc = g_fopen (config->gtkrc, "wt"))) {
g_warning ("unable to open %s", config->gtkrc);
return;
}
@@ -823,7 +831,7 @@ mail_config_uri_renamed (GCompareFunc uri_cmp, const char *old, const char *new)
oldname = uri_to_evname (old, cachenames[i]);
newname = uri_to_evname (new, cachenames[i]);
/*printf ("** renaming %s to %s\n", oldname, newname);*/
- rename (oldname, newname);
+ g_rename (oldname, newname);
g_free (oldname);
g_free (newname);
}
@@ -917,9 +925,9 @@ get_new_signature_filename (void)
base_directory = mail_component_peek_base_directory (mail_component_peek ());
filename = g_build_filename (base_directory, "signatures", NULL);
- if (lstat (filename, &st)) {
+ if (g_lstat (filename, &st)) {
if (errno == ENOENT) {
- if (mkdir (filename, 0700))
+ if (g_mkdir (filename, 0700))
g_warning ("Fatal problem creating %s directory.", filename);
} else
g_warning ("Fatal problem with %s directory.", filename);
@@ -932,10 +940,10 @@ get_new_signature_filename (void)
for (i = 0; i < (INT_MAX - 1); i++) {
sprintf (id, "%d", i);
- if (lstat (filename, &st) == -1 && errno == ENOENT) {
+ if (g_lstat (filename, &st) == -1 && errno == ENOENT) {
int fd;
- fd = creat (filename, 0600);
+ fd = g_creat (filename, 0600);
if (fd >= 0) {
close (fd);
return filename;
@@ -990,7 +998,7 @@ void
mail_config_remove_signature (ESignature *signature)
{
if (signature->filename && !signature->script)
- unlink (signature->filename);
+ g_unlink (signature->filename);
e_signature_list_remove (config->signatures, signature);
mail_config_save_signatures ();
@@ -999,6 +1007,7 @@ mail_config_remove_signature (ESignature *signature)
char *
mail_config_signature_run_script (const char *script)
{
+#ifndef G_OS_WIN32
int result, status;
int in_fds[2];
pid_t pid;
@@ -1104,4 +1113,7 @@ mail_config_signature_run_script (const char *script)
return content;
}
+#else
+ return NULL;
+#endif
}
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index 7cfc651989..6f4fda244e 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -33,6 +33,9 @@
#include <string.h>
#include <time.h>
+#include <glib.h>
+#include <glib/gstdio.h>
+
#include <libgnome/gnome-sound.h>
#include <libgnome/gnome-i18n.h>
#include <bonobo/bonobo-exception.h>
@@ -59,7 +62,7 @@
#include "em-event.h"
-#define w(x)
+#define w(x)
#define d(x)
/* This code is a mess, there is no reason it should be so complicated. */
@@ -392,7 +395,7 @@ setup_folder(CamelFolderInfo *fi, struct _store_info *si)
if (mfi) {
update_1folder(mfi, 0, fi);
} else {
- d(printf("Adding new folder: %s (%s) %d unread\n", fi->path, fi->url, fi->unread_message_count));
+ d(printf("Adding new folder: %s (%s)\n", fi->full_name, fi->uri));
mfi = g_malloc0(sizeof(*mfi));
mfi->full_name = g_strdup(fi->full_name);
mfi->uri = g_strdup(fi->uri);
@@ -679,12 +682,12 @@ rename_folders(struct _store_info *si, const char *oldbase, const char *newbase,
e_filename_make_safe(newuri);
oldfile = g_strdup_printf("%s/mail/config/custom_view-%s.xml", mail_component_peek_base_directory(NULL), olduri);
newfile = g_strdup_printf("%s/mail/config/custom_view-%s.xml", mail_component_peek_base_directory(NULL), newuri);
- rename(oldfile, newfile);
+ g_rename(oldfile, newfile);
g_free(oldfile);
g_free(newfile);
oldfile = g_strdup_printf("%s/mail/config/current_view-%s.xml", mail_component_peek_base_directory(NULL), olduri);
newfile = g_strdup_printf("%s/mail/config/current_view-%s.xml", mail_component_peek_base_directory(NULL), newuri);
- rename(oldfile, newfile);
+ g_rename(oldfile, newfile);
g_free(oldfile);
g_free(newfile);
g_free(olduri);
@@ -819,7 +822,7 @@ update_folders(CamelStore *store, CamelFolderInfo *fi, void *data)
struct _update_data *ud = data;
struct _store_info *si;
- d(printf("Got folderinfo for store\n"));
+ d(printf("Got folderinfo for store %s\n", store->parent_object.provider->protocol));
LOCK(info_lock);
si = g_hash_table_lookup(stores, store);
@@ -940,7 +943,7 @@ mail_note_store(CamelStore *store, CamelOperation *op,
int hook = 0;
g_assert(CAMEL_IS_STORE(store));
- g_assert(pthread_self() == mail_gui_thread);
+ g_assert(pthread_equal(pthread_self(), mail_gui_thread));
LOCK(info_lock);