From 0ff898adb4dd311f7b1c34ece1b4717ea3d513eb Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sun, 18 Dec 2005 09:46:32 +0000 Subject: Use gstdio wrappers. Construct glade file name at run-time. 2005-12-18 Tor Lillqvist * e-attachment.c: Use gstdio wrappers. Construct glade file name at run-time. svn path=/trunk/; revision=30864 --- widgets/misc/ChangeLog | 3 +++ widgets/misc/e-attachment.c | 29 ++++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) (limited to 'widgets') diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index 3e30dfc393..98eb6178d0 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -6,6 +6,9 @@ instead of privlib (no difference on Unix). Use -no-undefined on Win32. Link with all required libraries. + * e-attachment.c: Use gstdio wrappers. Construct glade file name + at run-time. + 2005-12-15 Srinivasa Ragavan * e-filter-bar.c: (rule_advanced_response), (option_changed), diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c index e5a37bcdc4..e0eb1b9e02 100644 --- a/widgets/misc/e-attachment.c +++ b/widgets/misc/e-attachment.c @@ -26,6 +26,21 @@ #include #endif +#include + +#ifdef G_OS_WIN32 +/* Include early (as the gnome-vfs stuff below will + * include it anyway, sigh) to workaround the DATADIR problem. + * (and the headers it includes) stomps all over the + * namespace like a baboon on crack, and especially the DATADIR enum + * in objidl.h causes problems. + */ +#undef DATADIR +#define DATADIR crap_DATADIR +#include +#undef DATADIR +#endif + #include #include #include @@ -37,8 +52,10 @@ #include #include #include +#include #include "e-util/e-mktemp.h" +#include "e-util/e-util-private.h" #include "e-attachment.h" @@ -216,7 +233,7 @@ e_attachment_new (const char *file_name, g_return_val_if_fail (file_name != NULL, NULL); - if (stat (file_name, &statbuf) < 0) { + if (g_stat (file_name, &statbuf) < 0) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot attach file %s: %s"), file_name, g_strerror (errno)); @@ -420,7 +437,7 @@ e_attachment_build_remote_file (const char *file_name, g_return_if_fail (file_name != NULL); - if (stat (file_name, &statbuf) < 0) { + if (g_stat (file_name, &statbuf) < 0) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot attach file %s: %s"), file_name, g_strerror (errno)); @@ -655,6 +672,7 @@ e_attachment_edit (EAttachment *attachment, GtkWidget *parent) DialogData *dialog_data; GladeXML *editor_gui; char *type; + char *filename; g_return_if_fail (attachment != NULL); g_return_if_fail (E_IS_ATTACHMENT (attachment)); @@ -668,8 +686,13 @@ e_attachment_edit (EAttachment *attachment, GtkWidget *parent) return; } - editor_gui = glade_xml_new (EVOLUTION_GLADEDIR "/e-attachment.glade", + filename = g_build_filename (EVOLUTION_GLADEDIR, + "e-attachment.glade", + NULL); + editor_gui = glade_xml_new (filename, NULL, NULL); + g_free (filename); + if (editor_gui == NULL) { g_warning ("Cannot load `e-attachment.glade'"); return; -- cgit v1.2.3