aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-08-25 06:41:24 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-08-25 06:41:24 +0800
commite00591f0081d57618d709e59f6d4a4d671fc2fb0 (patch)
tree8c68694840ff446e45f5ca24c9eaf901f289a074
parent7a67b5c2ff35239e7f53fb94896064af9d3c5d17 (diff)
downloadgsoc2013-evolution-e00591f0081d57618d709e59f6d4a4d671fc2fb0.tar.gz
gsoc2013-evolution-e00591f0081d57618d709e59f6d4a4d671fc2fb0.tar.zst
gsoc2013-evolution-e00591f0081d57618d709e59f6d4a4d671fc2fb0.zip
Use the new e_mkdtemp function.
2001-08-24 Jeffrey Stedfast <fejj@ximian.com> * mail-display.c (launch_cb): Use the new e_mkdtemp function. * folder-browser.c (message_list_drag_data_get): Use the new e_mkdtemp function. svn path=/trunk/; revision=12462
-rw-r--r--mail/ChangeLog19
-rw-r--r--mail/folder-browser.c20
-rw-r--r--mail/mail-display.c37
-rw-r--r--mail/message-list.c74
4 files changed, 70 insertions, 80 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 925c1e0879..94aa66e71f 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,10 @@
+2001-08-24 Jeffrey Stedfast <fejj@ximian.com>
+
+ * mail-display.c (launch_cb): Use the new e_mkdtemp function.
+
+ * folder-browser.c (message_list_drag_data_get): Use the new
+ e_mkdtemp function.
+
2001-08-24 Ettore Perazzoli <ettore@ximian.com>
[Fix #8024, Empty strings marked for translation.]
@@ -8,9 +15,9 @@
2001-08-24 Peter Williams <peterw@ximian.com>
- * mail-ops.c (remove_folder_get): Save the folder's full_name, unref it,
- and *then* unref the store, so that the folder has been closed before
- it gets deleted.
+ * mail-ops.c (remove_folder_get): Save the folder's full_name,
+ unref it, and *then* unref the store, so that the folder has been
+ closed before it gets deleted.
2001-08-24 Peter Williams <peterw@ximian.com>
@@ -26,9 +33,9 @@
(maybe_add_shortcut): Renamed to new_source_created.
(new_source_created): Call add_new_storage here.
- * component-factory.c (mail_remove_storage_by_uri): Don't warn
- if the storage isn't remote... no point in making the caller
- do extra work.
+ * component-factory.c (mail_remove_storage_by_uri): Don't warn if
+ the storage isn't remote... no point in making the caller do extra
+ work.
2001-08-24 Jeffrey Stedfast <fejj@ximian.com>
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index d54c658450..df9155f554 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -36,6 +36,7 @@
#include "mail-search-dialogue.h"
#include "e-util/e-sexp.h"
+#include "e-util/e-mktemp.h"
#include "folder-browser.h"
#include "e-searching-tokenizer.h"
#include "mail.h"
@@ -216,22 +217,14 @@ message_list_drag_data_get (ETree *tree, int row, ETreePath path, int col,
switch (info) {
case DND_TARGET_TYPE_TEXT_URI_LIST:
{
- char *uri_list, *tmpdir, *tmpl;
+ const char *filename, *tmpdir;
CamelMimeMessage *message;
- const char *filename;
CamelStream *stream;
+ char *uri_list;
int fd;
- tmpl = g_strdup ("/tmp/evolution.XXXXXX");
-#ifdef HAVE_MKDTEMP
- tmpdir = mkdtemp (tmpl);
-#else
- tmpdir = mktemp (tmpl);
- if (tmpdir) {
- if (mkdir (tmpdir, S_IRWXU) == -1)
- tmpdir = NULL;
- }
-#endif
+ tmpdir = e_mkdtemp ("drag-n-drop-XXXXXX");
+
if (!tmpdir) {
char *msg = g_strdup_printf (_("Could not create temporary "
"directory: %s"),
@@ -241,7 +234,6 @@ message_list_drag_data_get (ETree *tree, int row, ETreePath path, int col,
for (i = 0; i < uids->len; i++)
g_free (uids->pdata[i]);
g_ptr_array_free (uids, TRUE);
- g_free (tmpl);
return;
}
@@ -257,7 +249,7 @@ message_list_drag_data_get (ETree *tree, int row, ETreePath path, int col,
uri_list = g_strdup_printf ("file://%s/%s", tmpdir, filename);
- fd = open (uri_list + 7, O_WRONLY | O_CREAT, 0666);
+ fd = open (uri_list + 7, O_WRONLY | O_CREAT);
if (fd == -1) {
/* cleanup and abort */
camel_object_unref (CAMEL_OBJECT (message));
diff --git a/mail/mail-display.c b/mail/mail-display.c
index 912785ea71..9a9fe89db6 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -39,6 +39,7 @@
#include <gtkhtml/htmlinterval.h> /* XXX */
#include "e-util/e-html-utils.h"
+#include "e-util/e-mktemp.h"
#include "addressbook/backend/ebook/e-book-util.h"
#include "e-searching-tokenizer.h"
@@ -250,15 +251,16 @@ launch_cb (GtkWidget *widget, gpointer user_data)
MailMimeHandler *handler;
GList *apps, *children, *c;
GnomeVFSMimeApplication *app;
- char *tmpl, *tmpdir, *filename, *url, *argv[2];
-
+ char *filename, *url, *argv[2];
+ const char *tmpdir;
+
handler = mail_lookup_handler (gtk_object_get_data (user_data, "mime_type"));
g_return_if_fail (handler != NULL && handler->applications != NULL);
-
+
/* Yum. Too bad EPopupMenu doesn't allow per-item closures. */
children = gtk_container_children (GTK_CONTAINER (widget->parent));
g_return_if_fail (children != NULL && children->next != NULL && children->next->next != NULL);
-
+
for (c = children->next->next, apps = handler->applications; c && apps; c = c->next, apps = apps->next) {
if (c->data == widget)
break;
@@ -266,46 +268,35 @@ launch_cb (GtkWidget *widget, gpointer user_data)
g_list_free (children);
g_return_if_fail (c != NULL && apps != NULL);
app = apps->data;
-
- tmpl = g_strdup ("/tmp/evolution.XXXXXX");
-#ifdef HAVE_MKDTEMP
- tmpdir = mkdtemp (tmpl);
-#else
- tmpdir = mktemp (tmpl);
- if (tmpdir) {
- if (mkdir (tmpdir, S_IRWXU) == -1)
- tmpdir = NULL;
- }
-#endif
+
+ tmpdir = e_mkdtemp ("evolution.XXXXXX");
+
if (!tmpdir) {
char *msg = g_strdup_printf (_("Could not create temporary "
"directory: %s"),
g_strerror (errno));
gnome_error_dialog (msg);
- g_free (tmpl);
g_free (msg);
return;
}
-
+
filename = make_safe_filename (tmpdir, part);
-
+
if (!write_data_to_file (part, filename, TRUE)) {
- g_free (tmpl);
g_free (filename);
return;
}
-
+
if (app->expects_uris == GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS) {
url = g_strdup_printf ("file:%s", filename);
g_free (filename);
filename = url;
}
-
+
argv[0] = app->command;
argv[1] = filename;
-
+
gnome_execute_async (tmpdir, 2, argv);
- g_free (tmpdir);
g_free (filename);
}
diff --git a/mail/message-list.c b/mail/message-list.c
index 16b1ec0fc5..a764782ba6 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -2093,23 +2093,23 @@ message_list_set_threaded (MessageList *ml, gboolean threaded)
}
void
-message_list_set_hidedeleted(MessageList *ml, gboolean hidedeleted)
+message_list_set_hidedeleted (MessageList *ml, gboolean hidedeleted)
{
- if (ml->folder && CAMEL_IS_VTRASH_FOLDER(ml->folder))
+ if (ml->folder && CAMEL_IS_VTRASH_FOLDER (ml->folder))
hidedeleted = FALSE;
-
+
if (ml->hidedeleted != hidedeleted) {
ml->hidedeleted = hidedeleted;
-
- mail_regen_list(ml, ml->search, NULL, NULL);
+
+ mail_regen_list (ml, ml->search, NULL, NULL);
}
}
void
-message_list_set_search(MessageList *ml, const char *search)
+message_list_set_search (MessageList *ml, const char *search)
{
if (search == NULL || search[0] == '\0')
- if (ml->search == NULL || ml->search[0]=='\0')
+ if (ml->search == NULL || ml->search[0] == '\0')
return;
if (search != NULL && ml->search != NULL && strcmp (search, ml->search) == 0)
@@ -2120,7 +2120,7 @@ message_list_set_search(MessageList *ml, const char *search)
/* returns the number of messages displayable *after* expression hiding has taken place */
unsigned int
-message_list_length(MessageList *ml)
+message_list_length (MessageList *ml)
{
return ml->hide_unhidden;
}
@@ -2139,46 +2139,46 @@ message_list_length(MessageList *ml)
100 messages.
*/
void
-message_list_hide_add(MessageList *ml, const char *expr, unsigned int lower, unsigned int upper)
+message_list_hide_add (MessageList *ml, const char *expr, unsigned int lower, unsigned int upper)
{
- MESSAGE_LIST_LOCK(ml, hide_lock);
-
+ MESSAGE_LIST_LOCK (ml, hide_lock);
+
if (lower != ML_HIDE_SAME)
ml->hide_before = lower;
if (upper != ML_HIDE_SAME)
ml->hide_after = upper;
-
- MESSAGE_LIST_UNLOCK(ml, hide_lock);
-
- mail_regen_list(ml, ml->search, expr, NULL);
+
+ MESSAGE_LIST_UNLOCK (ml, hide_lock);
+
+ mail_regen_list (ml, ml->search, expr, NULL);
}
/* hide specific uid's */
void
-message_list_hide_uids(MessageList *ml, GPtrArray *uids)
+message_list_hide_uids (MessageList *ml, GPtrArray *uids)
{
int i;
char *uid;
/* first see if we need to do any work, if so, then do it all at once */
- for (i=0;i<uids->len;i++) {
- if (g_hash_table_lookup(ml->uid_nodemap, uids->pdata[i])) {
- MESSAGE_LIST_LOCK(ml, hide_lock);
+ for (i = 0; i < uids->len; i++) {
+ if (g_hash_table_lookup (ml->uid_nodemap, uids->pdata[i])) {
+ MESSAGE_LIST_LOCK (ml, hide_lock);
if (ml->hidden == NULL) {
- ml->hidden = g_hash_table_new(g_str_hash, g_str_equal);
- ml->hidden_pool = e_mempool_new(512, 256, E_MEMPOOL_ALIGN_BYTE);
+ ml->hidden = g_hash_table_new (g_str_hash, g_str_equal);
+ ml->hidden_pool = e_mempool_new (512, 256, E_MEMPOOL_ALIGN_BYTE);
}
-
- uid = e_mempool_strdup(ml->hidden_pool, uids->pdata[i]);
- g_hash_table_insert(ml->hidden, uid, uid);
- for (;i<uids->len;i++) {
- if (g_hash_table_lookup(ml->uid_nodemap, uids->pdata[i])) {
- uid = e_mempool_strdup(ml->hidden_pool, uids->pdata[i]);
- g_hash_table_insert(ml->hidden, uid, uid);
+
+ uid = e_mempool_strdup (ml->hidden_pool, uids->pdata[i]);
+ g_hash_table_insert (ml->hidden, uid, uid);
+ for ( ; i < uids->len; i++) {
+ if (g_hash_table_lookup (ml->uid_nodemap, uids->pdata[i])) {
+ uid = e_mempool_strdup (ml->hidden_pool, uids->pdata[i]);
+ g_hash_table_insert (ml->hidden, uid, uid);
}
}
- MESSAGE_LIST_UNLOCK(ml, hide_lock);
- mail_regen_list(ml, ml->search, NULL, NULL);
+ MESSAGE_LIST_UNLOCK (ml, hide_lock);
+ mail_regen_list (ml, ml->search, NULL, NULL);
break;
}
}
@@ -2188,18 +2188,18 @@ message_list_hide_uids(MessageList *ml, GPtrArray *uids)
void
message_list_hide_clear (MessageList *ml)
{
- MESSAGE_LIST_LOCK(ml, hide_lock);
+ MESSAGE_LIST_LOCK (ml, hide_lock);
if (ml->hidden) {
- g_hash_table_destroy(ml->hidden);
- e_mempool_destroy(ml->hidden_pool);
+ g_hash_table_destroy (ml->hidden);
+ e_mempool_destroy (ml->hidden_pool);
ml->hidden = NULL;
ml->hidden_pool = NULL;
}
ml->hide_before = ML_HIDE_NONE_START;
ml->hide_after = ML_HIDE_NONE_END;
- MESSAGE_LIST_UNLOCK(ml, hide_lock);
-
- mail_regen_list(ml, ml->search, NULL, NULL);
+ MESSAGE_LIST_UNLOCK (ml, hide_lock);
+
+ mail_regen_list (ml, ml->search, NULL, NULL);
}
#define HIDE_STATE_VERSION (1)
@@ -2493,7 +2493,7 @@ mail_regen_list (MessageList *ml, const char *search, const char *hideexpr, Came
#ifndef BROKEN_ETREE
/* this can sometimes crash,so ... */
-
+
/* see if we need to goto the child thread at all anyway */
/* currently the only case is the flat view with updates and no search */
if (hideexpr == NULL && search == NULL && changes != NULL && !ml->threaded) {