+2009-01-17 [colin] 3.7.0cvs37
+
+ * src/addressbook.c
+ * src/compose.c
+ * src/foldersel.c
+ * src/main.c
+ * src/mainwindow.c
+ * src/mbox.c
+ * src/common/md5.c
+ * src/common/ssl_certificate.c
+ * src/common/tags.c
+ * src/common/utils.c
+ * src/etpan/imap-thread.c
+ * src/plugins/bogofilter/bogofilter.c
+ * src/plugins/pgpinline/pgpinline.c
+ * src/plugins/smime/smime.c
+ Probably fix bug 1825, 'Unable to fetch messages from
+ IMAP folders named with non-ASCII string'
+ Change remaining occurences of fopen and open with
+ g_fopen and g_open
+
2009-01-17 [paul] 3.7.0cvs36
* manual/faq.xml
( cvs diff -u -r 1.60.2.55 -r 1.60.2.56 po/es.po; ) > 3.7.0cvs34.patchset
( cvs diff -u -r 1.52.2.72 -r 1.52.2.73 src/prefs_folder_item.c; ) > 3.7.0cvs35.patchset
( cvs diff -u -r 1.1.2.18 -r 1.1.2.19 manual/faq.xml; ) > 3.7.0cvs36.patchset
+( cvs diff -u -r 1.60.2.128 -r 1.60.2.129 src/addressbook.c; cvs diff -u -r 1.382.2.494 -r 1.382.2.495 src/compose.c; cvs diff -u -r 1.26.2.41 -r 1.26.2.42 src/foldersel.c; cvs diff -u -r 1.115.2.218 -r 1.115.2.219 src/main.c; cvs diff -u -r 1.274.2.295 -r 1.274.2.296 src/mainwindow.c; cvs diff -u -r 1.28.2.44 -r 1.28.2.45 src/mbox.c; cvs diff -u -r 1.2.2.6 -r 1.2.2.7 src/common/md5.c; cvs diff -u -r 1.4.2.35 -r 1.4.2.36 src/common/ssl_certificate.c; cvs diff -u -r 1.1.2.9 -r 1.1.2.10 src/common/tags.c; cvs diff -u -r 1.36.2.163 -r 1.36.2.164 src/common/utils.c; cvs diff -u -r 1.1.4.107 -r 1.1.4.108 src/etpan/imap-thread.c; cvs diff -u -r 1.1.2.39 -r 1.1.2.40 src/plugins/bogofilter/bogofilter.c; cvs diff -u -r 1.1.2.42 -r 1.1.2.43 src/plugins/pgpinline/pgpinline.c; cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/plugins/smime/smime.c; ) > 3.7.0cvs37.patchset
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=36
+EXTRA_VERSION=37
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
#define ADDRESSBOOK_MSGBUF_SIZE 2048
-static GdkPixbuf *folderxpm;
-static GdkPixbuf *folderopenxpm;
-static GdkPixbuf *groupxpm;
-static GdkPixbuf *interfacexpm;
-static GdkPixbuf *bookxpm;
-static GdkPixbuf *addressxpm;
-static GdkPixbuf *vcardxpm;
-static GdkPixbuf *jpilotxpm;
-static GdkPixbuf *categoryxpm;
-static GdkPixbuf *ldapxpm;
-static GdkPixbuf *addrsearchxpm;
+static GdkPixbuf *folderxpm = NULL;
+static GdkPixbuf *folderopenxpm = NULL;
+static GdkPixbuf *groupxpm = NULL;
+static GdkPixbuf *interfacexpm = NULL;
+static GdkPixbuf *bookxpm = NULL;
+static GdkPixbuf *addressxpm = NULL;
+static GdkPixbuf *vcardxpm = NULL;
+static GdkPixbuf *jpilotxpm = NULL;
+static GdkPixbuf *categoryxpm = NULL;
+static GdkPixbuf *ldapxpm = NULL;
+static GdkPixbuf *addrsearchxpm = NULL;
/* Message buffer */
static gchar addressbook_msgbuf[ ADDRESSBOOK_MSGBUF_SIZE ];
G_CALLBACK(addressbook_close_clicked), NULL);
/* Build icons for interface */
- stock_pixbuf_gdk( window, STOCK_PIXMAP_INTERFACE,
- &interfacexpm );
/* Build control tables */
addrbookctl_build_map(window);
return ioType;
}
+#define UPDATE_ICON_ATCI(id,icon,iconopen) { \
+ atci = addrbookctl_lookup(id); \
+ if (atci) { \
+ atci->iconXpm = icon; \
+ atci->iconXpmOpen = iconopen; \
+ } else { \
+ g_warning("can't get atci %d\n", id); \
+ } \
+}
+
/*
* Build table that controls the rendering of object types.
*/
-static void addrbookctl_build_map( GtkWidget *window ) {
+static void addrbookctl_build_icons( GtkWidget *window ) {
AddressTypeControlItem *atci;
/* Build icons */
+ g_object_unref(interfacexpm);
+ g_object_unref(folderxpm);
+ g_object_unref(folderopenxpm);
+ g_object_unref(groupxpm);
+ g_object_unref(vcardxpm);
+ g_object_unref(bookxpm);
+ g_object_unref(addressxpm);
+ g_object_unref(jpilotxpm);
+ g_object_unref(categoryxpm);
+ g_object_unref(ldapxpm);
+ g_object_unref(addrsearchxpm);
+ stock_pixbuf_gdk(window, STOCK_PIXMAP_INTERFACE, &interfacexpm );
stock_pixbuf_gdk(window, STOCK_PIXMAP_DIR_CLOSE, &folderxpm);
stock_pixbuf_gdk(window, STOCK_PIXMAP_DIR_OPEN, &folderopenxpm);
stock_pixbuf_gdk(window, STOCK_PIXMAP_GROUP, &groupxpm);
stock_pixbuf_gdk(window, STOCK_PIXMAP_CATEGORY, &categoryxpm);
stock_pixbuf_gdk(window, STOCK_PIXMAP_LDAP, &ldapxpm);
stock_pixbuf_gdk(window, STOCK_PIXMAP_ADDRESS_SEARCH, &addrsearchxpm);
+
+ UPDATE_ICON_ATCI(ADDR_INTERFACE,folderxpm,folderopenxpm);
+ UPDATE_ICON_ATCI(ADDR_BOOK,bookxpm,bookxpm);
+ UPDATE_ICON_ATCI(ADDR_ITEM_PERSON,NULL,NULL);
+ UPDATE_ICON_ATCI(ADDR_ITEM_EMAIL,addressxpm,addressxpm);
+ UPDATE_ICON_ATCI(ADDR_ITEM_GROUP,groupxpm,groupxpm);
+ UPDATE_ICON_ATCI(ADDR_ITEM_FOLDER,folderxpm,folderopenxpm);
+ UPDATE_ICON_ATCI(ADDR_VCARD,vcardxpm,vcardxpm);
+ UPDATE_ICON_ATCI(ADDR_JPILOT,jpilotxpm,jpilotxpm);
+ UPDATE_ICON_ATCI(ADDR_CATEGORY,categoryxpm,categoryxpm);
+ UPDATE_ICON_ATCI(ADDR_LDAP,ldapxpm,ldapxpm);
+ UPDATE_ICON_ATCI(ADDR_LDAP_QUERY,addrsearchxpm,addrsearchxpm);
+
+}
+
+/*
+* Build table that controls the rendering of object types.
+*/
+static void addrbookctl_build_map( GtkWidget *window ) {
+ AddressTypeControlItem *atci;
_addressBookTypeHash_ = g_hash_table_new( g_int_hash, g_int_equal );
_addressBookTypeList_ = NULL;
atci->treeExpand = TRUE;
atci->treeLeaf = FALSE;
atci->displayName = _( "Interface" );
- atci->iconXpm = folderxpm;
- atci->iconXpmOpen = folderopenxpm;
atci->menuCommand = NULL;
g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci );
_addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci );
atci->treeExpand = TRUE;
atci->treeLeaf = FALSE;
atci->displayName = _( "Address Book" );
- atci->iconXpm = bookxpm;
- atci->iconXpmOpen = bookxpm;
atci->menuCommand = "Menu/Book/NewBook";
g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci );
_addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci );
atci->treeExpand = FALSE;
atci->treeLeaf = FALSE;
atci->displayName = _( "Person" );
- atci->iconXpm = NULL;
- atci->iconXpmOpen = NULL;
atci->menuCommand = NULL;
g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci );
_addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci );
atci->treeExpand = FALSE;
atci->treeLeaf = TRUE;
atci->displayName = _( "Email Address" );
- atci->iconXpm = addressxpm;
- atci->iconXpmOpen = addressxpm;
atci->menuCommand = NULL;
g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci );
_addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci );
atci->treeExpand = FALSE;
atci->treeLeaf = FALSE;
atci->displayName = _( "Group" );
- atci->iconXpm = groupxpm;
- atci->iconXpmOpen = groupxpm;
atci->menuCommand = NULL;
g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci );
_addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci );
atci->treeExpand = FALSE;
atci->treeLeaf = FALSE;
atci->displayName = _( "Folder" );
- atci->iconXpm = folderxpm;
- atci->iconXpmOpen = folderopenxpm;
atci->menuCommand = NULL;
g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci );
_addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci );
atci->treeExpand = TRUE;
atci->treeLeaf = TRUE;
atci->displayName = _( "vCard" );
- atci->iconXpm = vcardxpm;
- atci->iconXpmOpen = vcardxpm;
atci->menuCommand = "Menu/Book/NewVCard";
g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci );
_addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci );
atci->treeExpand = TRUE;
atci->treeLeaf = FALSE;
atci->displayName = _( "JPilot" );
- atci->iconXpm = jpilotxpm;
- atci->iconXpmOpen = jpilotxpm;
atci->menuCommand = "Menu/Book/NewJPilot";
g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci );
_addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci );
atci->treeExpand = TRUE;
atci->treeLeaf = TRUE;
atci->displayName = _( "JPilot" );
- atci->iconXpm = categoryxpm;
- atci->iconXpmOpen = categoryxpm;
atci->menuCommand = NULL;
g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci );
_addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci );
atci->treeExpand = TRUE;
atci->treeLeaf = FALSE;
atci->displayName = _( "LDAP servers" );
- atci->iconXpm = ldapxpm;
- atci->iconXpmOpen = ldapxpm;
atci->menuCommand = "Menu/Book/NewLDAPServer";
g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci );
_addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci );
atci->treeExpand = FALSE;
atci->treeLeaf = TRUE;
atci->displayName = _( "LDAP Query" );
- atci->iconXpm = addrsearchxpm;
- atci->iconXpmOpen = addrsearchxpm;
atci->menuCommand = NULL;
g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci );
_addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci );
+ addrbookctl_build_icons(window);
+}
+
+void addressbook_reflect_prefs_pixmap_theme(void)
+{
+ if (addrbook.window)
+ addrbookctl_build_icons(addrbook.window);
}
/*
char *lastp = buf; /* point to the start of the buffer */
size_t total = 0; /* total length read */
int num_alloc = 1; /* number of blocks allocated */
- int fd = open(file, O_RDONLY);
+ int fd = g_open(file, O_RDONLY);
if (fd == -1) {
FILE_OP_ERROR(file, "open");
FILE *fp;
if (claws_ssl_get_cert_file())
- fp = fopen(claws_ssl_get_cert_file(), "r");
+ fp = g_fopen(claws_ssl_get_cert_file(), "r");
else
return (guint)-1;
TAGS_RC, NULL);
gchar tmp[255];
gint id;
- FILE *fp = fopen(file, "rb");
+ FILE *fp = g_fopen(file, "rb");
g_free(file);
TAGS_RC, NULL);
TagWriteData data;
- FILE *fp = fopen(file, "wb");
+ FILE *fp = g_fopen(file, "wb");
if (!fp) {
- FILE_OP_ERROR(file, "fopen");
+ FILE_OP_ERROR(file, "g_fopen");
g_free(file);
g_free(file_new);
return;
return fopen(filename, mode);
#endif
}
+int g_open(const gchar *filename, int flags, int mode)
+{
+#ifdef G_OS_WIN32
+ char *name = g_win32_locale_filename_from_utf8(filename);
+ int fd = open(name, flags, mode);
+ g_free(name);
+ return fp;
+#else
+ return open(filename, flags, mode);
+#endif
+}
#endif /* GLIB_CHECK_VERSION && G_OS_UNIX */
int tmpfd;
*name_used = g_strdup_printf("%s.%ld",_mktemp(template),count++);
- tmpfd = open (*name_used, (O_CREAT | O_RDWR | O_BINARY),
+ tmpfd = g_open (*name_used, (O_CREAT | O_RDWR | O_BINARY),
(S_IRUSR | S_IWUSR));
tempfiles=g_slist_append(tempfiles, g_strdup(*name_used));
if (file == NULL)
goto freeout;
- fp = fopen(file, "rb");
+ fp = g_fopen(file, "rb");
if (!fp)
goto freeout;
- outfp = fopen(out, "wb");
+ outfp = g_fopen(out, "wb");
if (!outfp) {
fclose(fp);
goto freeout;
gchar buf[BUFFSIZE];
if ((fp = g_fopen(file, "rb")) == NULL) {
- FILE_OP_ERROR(file, "fopen");
+ FILE_OP_ERROR(file, "g_fopen");
return -1;
}
gboolean err = FALSE;
if ((src_fp = g_fopen(src, "rb")) == NULL) {
- FILE_OP_ERROR(src, "fopen");
+ FILE_OP_ERROR(src, "g_fopen");
return -1;
}
if ((dest_fp = g_fopen(dest, "ab")) == NULL) {
- FILE_OP_ERROR(dest, "fopen");
+ FILE_OP_ERROR(dest, "g_fopen");
fclose(src_fp);
return -1;
}
gboolean err = FALSE;
if ((src_fp = g_fopen(src, "rb")) == NULL) {
- FILE_OP_ERROR(src, "fopen");
+ FILE_OP_ERROR(src, "g_fopen");
return -1;
}
if (is_file_exist(dest)) {
}
if ((dest_fp = g_fopen(dest, "wb")) == NULL) {
- FILE_OP_ERROR(dest, "fopen");
+ FILE_OP_ERROR(dest, "g_fopen");
fclose(src_fp);
if (dest_bak) {
if (rename_force(dest_bak, dest) < 0)
gboolean err = FALSE;
if ((dest_fp = g_fopen(dest, "wb")) == NULL) {
- FILE_OP_ERROR(dest, "fopen");
+ FILE_OP_ERROR(dest, "g_fopen");
return -1;
}
gboolean last_linebreak = FALSE;
if ((src_fp = g_fopen(src, "rb")) == NULL) {
- FILE_OP_ERROR(src, "fopen");
+ FILE_OP_ERROR(src, "g_fopen");
return -1;
}
if ((dest_fp = g_fopen(dest, "wb")) == NULL) {
- FILE_OP_ERROR(dest, "fopen");
+ FILE_OP_ERROR(dest, "g_fopen");
fclose(src_fp);
return -1;
}
g_return_val_if_fail(file != NULL, -1);
if ((fp = g_fopen(file, "wb")) == NULL) {
- FILE_OP_ERROR(file, "fopen");
+ FILE_OP_ERROR(file, "g_fopen");
return -1;
}
}
#ifdef G_OS_WIN32
- fp = fopen (file, "rb");
+ fp = g_fopen (file, "rb");
if (fp == NULL) {
FILE_OP_ERROR(file, "open");
return NULL;
}
#else
/* test whether the file is readable without blocking */
- fd = open(file, O_RDONLY | O_NONBLOCK);
+ fd = g_open(file, O_RDONLY | O_NONBLOCK);
if (fd == -1) {
FILE_OP_ERROR(file, "open");
return NULL;
static gchar *mailcap_get_command_in_file(const gchar *path, const gchar *type, const gchar *file_to_open)
{
- FILE *fp = fopen(path, "rb");
+ FILE *fp = g_fopen(path, "rb");
gchar buf[BUFFSIZE];
gchar *result = NULL;
if (!fp)
gchar *path = NULL, *outpath = NULL;
path = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S, ".mailcap", NULL);
outpath = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S, ".mailcap.new", NULL);
- FILE *fp = fopen(path, "rb");
- FILE *outfp = fopen(outpath, "wb");
+ FILE *fp = g_fopen(path, "rb");
+ FILE *outfp = g_fopen(outpath, "wb");
gchar buf[BUFFSIZE];
gboolean err = FALSE;
/* strangely, testing data->type == gdk_atom_intern("text/uri-list", TRUE)
* does not work */
debug_print("drop: %s (%s)\n", gdk_atom_name(data->type)?gdk_atom_name(data->type):"nul",
- data->data?data->data:"nul");
+ (gchar *)(data->data?data->data:"nul"));
#ifndef G_OS_WIN32
if (gdk_atom_name(data->type) && !strcmp(gdk_atom_name(data->type), "text/uri-list")) {
#else
list = uri_list_extract_filenames((const gchar *)data->data);
debug_print("list: %p (%s)\n", list,
- data->data?data->data:"nul");
+ (gchar *)(data->data?data->data:"nul"));
if (list == NULL && strstr((gchar *)(data->data), "://")) {
/* Assume a list of no files, and data has ://, is a remote link */
gchar *tmpdata = g_strstrip(g_strdup((const gchar *)data->data));
result->error = r;
if (r == MAILIMAP_NO_ERROR) {
- fd = open(param->filename, O_RDWR | O_CREAT, 0600);
+ fd = g_open(param->filename, O_RDWR | O_CREAT, 0600);
if (fd < 0) {
result->error = MAILIMAP_ERROR_FETCH;
goto free;
}
size = stat_buf.st_size;
- fd = open(param->filename, O_RDONLY);
+ fd = g_open(param->filename, O_RDONLY);
if (fd < 0) {
result->error = MAILIMAP_ERROR_APPEND;
return;
/* Detach from the controlling tty if we have one. Otherwise,
SSH might do something stupid like trying to use it instead
of running $SSH_ASKPASS. Doh. */
- fd = open("/dev/tty", O_RDONLY);
+ fd = g_open("/dev/tty", O_RDONLY);
if (fd != -1) {
ioctl(fd, TIOCNOTTY, NULL);
close(fd);
&foldernoselect_pixbuf);
}
-void foldersel_reflect_prefs_pixmap_theme(void){
+void foldersel_reflect_prefs_pixmap_theme(void)
+{
if (folder_pixbuf)
g_object_unref(folder_pixbuf);
if (folderopen_pixbuf)
struct sigaction act;
int flags;
- mem_notify_fd = open("/dev/mem_notify", O_RDONLY|O_NONBLOCK);
+ mem_notify_fd = g_open("/dev/mem_notify", O_RDONLY|O_NONBLOCK);
if (mem_notify_fd == -1) {
debug_print("/dev/mem_notify not available (%s)\n",
strerror(errno));
folderview_reflect_prefs_pixmap_theme(mainwin->folderview);
summary_reflect_prefs_pixmap_theme(mainwin->summaryview);
foldersel_reflect_prefs_pixmap_theme();
+ addressbook_reflect_prefs_pixmap_theme();
#ifndef GENERIC_UMPC
pixmap = stock_pixmap_widget(mainwin->hbox_stat, STOCK_PIXMAP_ONLINE);
gtk_container_remove(GTK_CONTAINER(mainwin->online_switch),
#endif
#if HAVE_FLOCK
- if ((lockfd = open(base, O_RDWR)) < 0) {
+ if ((lockfd = g_open(base, O_RDWR)) < 0) {
#else
- if ((lockfd = open(base, O_RDWR)) < 0) {
+ if ((lockfd = g_open(base, O_RDWR)) < 0) {
#endif
FILE_OP_ERROR(base, "open");
return -1;
FOLDER_TYPE(msginfo->folder->folder) == F_MH &&
config.insert_header) {
gchar *tmpfile = get_tmp_file();
- FILE *input = fopen(file, "r");
- FILE *output = fopen(tmpfile, "w");
+ FILE *input = g_fopen(file, "r");
+ FILE *output = g_fopen(tmpfile, "w");
if (strstr(parts[2], "\n"))
*(strstr(parts[2], "\n")) = '\0';
if (input && !output)
printf("error dumping file\n");
return NULL;
}
- fp = fopen(filename,"rb");
+ fp = g_fopen(filename,"rb");
if (!fp) {
printf("error reading file\n");
return NULL;
get_mime_tmp_dir(), G_DIR_SEPARATOR, ++id);
if ((dstfp = g_fopen(fname, "wb")) == NULL) {
- FILE_OP_ERROR(fname, "fopen");
+ FILE_OP_ERROR(fname, "g_fopen");
g_free(fname);
gpgme_data_release(plain);
gpgme_release(ctx);
/* write message content to temporary file */
tmpfile = get_tmp_file();
- fp = fopen(tmpfile, "wb");
+ fp = g_fopen(tmpfile, "wb");
if (fp == NULL) {
perror("get_tmp_file");
return FALSE;
procmime_write_mimeinfo(msgcontent, fp);
fclose(fp);
canonicalize_file_replace(tmpfile);
- fp = fopen(tmpfile, "rb");
+ fp = g_fopen(tmpfile, "rb");
if (fp == NULL) {
perror("get_tmp_file");
return FALSE;
}
tmpfile = get_tmp_file();
- fp = fopen(tmpfile, "wb");
+ fp = g_fopen(tmpfile, "wb");
if (fp) {
if (fwrite(enccontent, 1, len, fp) < len) {
FILE_OP_ERROR(tmpfile, "fwrite");