No, we REALLY dont want to perform an immediate search as the keys are

2000-10-18  Not Zed  <NotZed@HelixCode.com>

        * folder-browser.c (folder_browser_gui_init): No, we REALLY dont
        want to perform an immediate search as the keys are pressed.

        * mail-display.c (on_object_requested): Kill a minor warning with
        a cast.

        * mail-config.c: Include mising ctype.h to kill a warning.

        * message-thread.c (main): Fixed the test case for api changes.

        * message-list.c (message_list_drag_data_get): Set some flags to
        get_folder().  I dont even think this will work because
        mail_tool_get_folder doesn't handle file url's.

        * mail-vfolder.c (vfolder_uri_to_folder): Pass appropriate flags.

        * mail-ops.c (do_setup_folder): Pass appropriate flags.  Hmm,
        whats the difference between setup and create.  *shrug*
        (do_create_folder): Pass appropriate flags to get_folder.  Needs a
        way to specify the index flag.

        * mail-tools.c (mail_tool_get_folder_from_urlname): Changed create
        to flags argument.
        (mail_tool_get_local_inbox_url): Add an index argument.
        (mail_tool_get_local_inbox): honour index flag.
        (mail_tool_get_inbox): Changed for api change.
        (mail_tool_uri_to_folder): Fixed calls to store_get_folder();

        * mail-local.c (load_metainfo): Added an indexed field to the metainfo.
        (save_metainfo): And save it too.
        (do_reconfigure_folder): Honour index flag when creating the new
        folder.  Do not open the old folder with an index at all.
        (mail_local_map_uri): Add an index argument - tells if the mbox is
        indexed.
        (mail_tool_local_uri_to_folder): Create & pass flags properly.
        (#include gnome.h): Dont include all of gnome, just what we use,
        and explicity include xml-memory, so we get xmlFree().

svn path=/trunk/; revision=5979
This commit is contained in:
Not Zed
2000-10-18 06:13:12 +00:00
committed by Michael Zucci
parent 229f78b929
commit ee5eeb1dd2
13 changed files with 118 additions and 29 deletions

View File

@ -1,3 +1,43 @@
2000-10-18 Not Zed <NotZed@HelixCode.com>
* folder-browser.c (folder_browser_gui_init): No, we REALLY dont
want to perform an immediate search as the keys are pressed.
* mail-display.c (on_object_requested): Kill a minor warning with
a cast.
* mail-config.c: Include mising ctype.h to kill a warning.
* message-thread.c (main): Fixed the test case for api changes.
* message-list.c (message_list_drag_data_get): Set some flags to
get_folder(). I dont even think this will work because
mail_tool_get_folder doesn't handle file url's.
* mail-vfolder.c (vfolder_uri_to_folder): Pass appropriate flags.
* mail-ops.c (do_setup_folder): Pass appropriate flags. Hmm,
whats the difference between setup and create. *shrug*
(do_create_folder): Pass appropriate flags to get_folder. Needs a
way to specify the index flag.
* mail-tools.c (mail_tool_get_folder_from_urlname): Changed create
to flags argument.
(mail_tool_get_local_inbox_url): Add an index argument.
(mail_tool_get_local_inbox): honour index flag.
(mail_tool_get_inbox): Changed for api change.
(mail_tool_uri_to_folder): Fixed calls to store_get_folder();
* mail-local.c (load_metainfo): Added an indexed field to the metainfo.
(save_metainfo): And save it too.
(do_reconfigure_folder): Honour index flag when creating the new
folder. Do not open the old folder with an index at all.
(mail_local_map_uri): Add an index argument - tells if the mbox is
indexed.
(mail_tool_local_uri_to_folder): Create & pass flags properly.
(#include gnome.h): Dont include all of gnome, just what we use,
and explicity include xml-memory, so we get xmlFree().
2000-10-16 Jeffrey Stedfast <fejj@helixcode.com>
* folder-browser.c (search_full_clicked): Un #if 0'd out

View File

@ -482,7 +482,6 @@ folder_browser_gui_init (FolderBrowser *fb)
fb->search_entry = gtk_entry_new();
gtk_widget_show(fb->search_entry);
gtk_signal_connect(GTK_OBJECT (fb->search_entry), "activate", search_activate, fb);
gtk_signal_connect(GTK_OBJECT (fb->search_entry), "changed", search_activate, fb);
searchbutton = (GtkButton *)gtk_button_new_with_label(_("Full Search"));
gtk_widget_show((GtkWidget *)searchbutton);
label = gtk_label_new(_("Search"));

View File

@ -27,6 +27,7 @@
#include <config.h>
#include <pwd.h>
#include <ctype.h>
#include <gnome.h>
#include <gtkhtml/gtkhtml.h>

View File

@ -490,7 +490,7 @@ on_object_requested (GtkHTML *html, GtkHTMLEmbedded *eb, gpointer data)
gtk_widget_set_usize (pixmap, 24, 24);
pbl->pixmap = pixmap;
g_idle_add_full (G_PRIORITY_LOW, pixbuf_gen_idle,
g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc)pixbuf_gen_idle,
pbl, NULL);
} else {
icon = gnome_vfs_mime_get_value (eb->type, "icon-filename");

View File

@ -33,8 +33,9 @@
#include <config.h>
#endif
#include <bonobo.h>
#include <gnome.h>
#include <libgnomeui/gnome-dialog.h>
#include <glade/glade.h>
#include <gnome-xml/xmlmemory.h>
#include "Evolution.h"
#include "evolution-storage.h"
@ -60,6 +61,7 @@ struct _local_meta {
char *format; /* format of mailbox */
char *name; /* name of mbox itself */
int indexed; /* do we index the body? */
};
static struct _local_meta *
@ -85,8 +87,16 @@ load_metainfo(const char *path)
node = node->childs;
while (node) {
if (!strcmp(node->name, "folder")) {
char *index;
meta->format = xmlGetProp(node, "type");
meta->name = xmlGetProp(node, "name");
index = xmlGetProp(node, "index");
if (index) {
meta->indexed = atoi(index);
xmlFree(index);
} else
meta->indexed = TRUE;
}
node = node->next;
}
@ -96,6 +106,7 @@ load_metainfo(const char *path)
dodefault:
meta->format = g_strdup("mbox"); /* defaults */
meta->name = g_strdup("mbox");
meta->indexed = TRUE;
if (doc)
xmlFreeDoc(doc);
return meta;
@ -126,6 +137,7 @@ save_metainfo(struct _local_meta *meta)
node = xmlNewChild(root, NULL, "folder", NULL);
xmlSetProp(node, "type", meta->format);
xmlSetProp(node, "name", meta->name);
xmlSetProp(node, "index", meta->indexed?"1":"0");
ret = xmlSaveFile(meta->path, doc);
xmlFreeDoc(doc);
@ -134,7 +146,7 @@ save_metainfo(struct _local_meta *meta)
/* maps a local uri to the real type */
char *
mail_local_map_uri(const char *uri)
mail_local_map_uri(const char *uri, int *index)
{
CamelURL *url;
char *metapath;
@ -142,6 +154,9 @@ mail_local_map_uri(const char *uri)
struct _local_meta *meta;
CamelException *ex;
if (index)
*index = TRUE;
if (strncmp(uri, "file:", 5)) {
g_warning("Trying to map non-local uri: %s", uri);
return g_strdup(uri);
@ -159,6 +174,9 @@ mail_local_map_uri(const char *uri)
meta = load_metainfo(metapath);
g_free(metapath);
if (index)
*index = meta->indexed;
/* change file: to format: */
camel_url_set_protocol(url, meta->format);
storename = camel_url_to_string(url, TRUE);
@ -175,6 +193,7 @@ mail_tool_local_uri_to_folder(const char *uri, CamelException *ex)
char *storename;
CamelFolder *folder = NULL;
struct _local_meta *meta;
int flags;
if (strncmp(uri, "file:", 5)) {
return NULL;
@ -197,8 +216,11 @@ mail_tool_local_uri_to_folder(const char *uri, CamelException *ex)
storename = camel_url_to_string(url, TRUE);
printf("store name is %s\n", storename);
flags = 0;
if (meta->indexed)
flags |= CAMEL_STORE_FOLDER_BODY_INDEX;
folder = mail_tool_get_folder_from_urlname (storename, meta->name, FALSE, ex);
folder = mail_tool_get_folder_from_urlname (storename, meta->name, flags, ex);
camel_url_free(url);
g_free (storename);
free_metainfo(meta);
@ -297,6 +319,7 @@ do_reconfigure_folder(gpointer in_data, gpointer op_data, CamelException *ex)
char *uri;
CamelURL *url = NULL;
struct _local_meta *meta;
guint32 flags;
printf("reconfiguring folder: %s to type %s\n", input->fb->uri, input->newtype);
@ -342,7 +365,7 @@ do_reconfigure_folder(gpointer in_data, gpointer op_data, CamelException *ex)
if (camel_exception_is_set(ex))
goto cleanup;
/* rename the old mbox and open it again */
/* rename the old mbox and open it again, without indexing */
tmpname = g_strdup_printf("%s_reconfig", meta->name);
printf("renaming %s to %s, and opening it\n", meta->name, tmpname);
update_progress("Renaming old folder and opening", 0.0);
@ -353,8 +376,9 @@ do_reconfigure_folder(gpointer in_data, gpointer op_data, CamelException *ex)
mail_tool_camel_lock_down ();
goto cleanup;
}
fromfolder = camel_store_get_folder(fromstore, tmpname, TRUE, ex);
/* we dont need to set the create flag ... or need an index if it has one */
fromfolder = camel_store_get_folder(fromstore, tmpname, 0, ex);
if (fromfolder == NULL || camel_exception_is_set(ex)) {
/* try and recover ... */
camel_exception_clear (ex);
@ -367,7 +391,10 @@ do_reconfigure_folder(gpointer in_data, gpointer op_data, CamelException *ex)
printf("Creating the destination mbox\n");
update_progress("Creating new folder", 0.0);
tofolder = camel_store_get_folder(tostore, meta->name, TRUE, ex);
flags = CAMEL_STORE_FOLDER_CREATE;
if (meta->indexed)
flags |= CAMEL_STORE_FOLDER_BODY_INDEX;
tofolder = camel_store_get_folder(tostore, meta->name, flags, ex);
if (tofolder == NULL || camel_exception_is_set(ex)) {
printf("cannot open destination folder\n");
/* try and recover ... */

View File

@ -32,6 +32,6 @@
/* mail-local.c */
CamelFolder *mail_tool_local_uri_to_folder(const char *uri, CamelException *ex);
void local_reconfigure_folder(FolderBrowser *fb);
char *mail_local_map_uri(const char *uri);
char *mail_local_map_uri(const char *uri, int *index);
#endif

View File

@ -1881,8 +1881,10 @@ do_create_folder (gpointer in_data, gpointer op_data, CamelException *ex)
Evolution_ShellComponentListener_UNSUPPORTED_TYPE;
else {
camel_url = g_strdup_printf ("mbox://%s", input->uri);
/* FIXME: supply a way to make indexes optional */
folder = mail_tool_get_folder_from_urlname (camel_url,
"mbox", TRUE, ex);
"mbox", CAMEL_STORE_FOLDER_CREATE
|CAMEL_STORE_FOLDER_BODY_INDEX, ex);
g_free (camel_url);
if (!camel_exception_is_set (ex)) {
@ -2259,7 +2261,9 @@ do_setup_folder (gpointer in_data, gpointer op_data, CamelException *ex)
url = g_strdup_printf ("mbox://%s/local/%s", evolution_dir,
input->name);
*(input->folder) = mail_tool_get_folder_from_urlname (url, "mbox",
TRUE, ex);
CAMEL_STORE_FOLDER_CREATE
|CAMEL_STORE_FOLDER_BODY_INDEX,
ex);
g_free (url);
}

View File

@ -88,7 +88,7 @@ void mail_tool_camel_lock_down (void)
CamelFolder *
mail_tool_get_folder_from_urlname (const gchar *url, const gchar *name,
gboolean create, CamelException *ex)
guint32 flags, CamelException *ex)
{
CamelStore *store;
CamelFolder *folder;
@ -109,7 +109,7 @@ mail_tool_get_folder_from_urlname (const gchar *url, const gchar *name,
*}
*/
folder = camel_store_get_folder (store, name, create, ex);
folder = camel_store_get_folder (store, name, flags, ex);
camel_object_unref (CAMEL_OBJECT (store));
mail_tool_camel_lock_down();
@ -136,12 +136,12 @@ mail_tool_get_folder_name (CamelFolder *folder)
}
gchar *
mail_tool_get_local_inbox_url (void)
mail_tool_get_local_inbox_url (int *index)
{
char *uri, *new;
uri = g_strdup_printf("file://%s/local/Inbox", evolution_dir);
new = mail_local_map_uri(uri);
new = mail_local_map_uri(uri, index);
g_free(uri);
return new;
}
@ -163,9 +163,13 @@ mail_tool_get_local_inbox (CamelException *ex)
{
gchar *url;
CamelFolder *folder;
int index;
guint32 flags = CAMEL_STORE_FOLDER_CREATE;
url = mail_tool_get_local_inbox_url();
folder = mail_tool_get_folder_from_urlname (url, "mbox", TRUE, ex);
url = mail_tool_get_local_inbox_url(&index);
if (index)
flags |= CAMEL_STORE_FOLDER_BODY_INDEX;
folder = mail_tool_get_folder_from_urlname (url, "mbox", flags, ex);
g_free (url);
return folder;
}
@ -174,7 +178,7 @@ CamelFolder *
mail_tool_get_inbox (const gchar *url, CamelException *ex)
{
/* FIXME: should be smarter? get_default_folder, etc */
return mail_tool_get_folder_from_urlname (url, "inbox", FALSE, ex);
return mail_tool_get_folder_from_urlname (url, "inbox", 0, ex);
}
@ -516,7 +520,7 @@ mail_tool_uri_to_folder (const char *uri, CamelException *ex)
/*for ( ; *ptr && *ptr == '/'; ptr++);*/
folder_uri = g_strdup (ptr);
folder = camel_store_get_folder (store, folder_uri, TRUE, ex);
folder = camel_store_get_folder (store, folder_uri, CAMEL_STORE_FOLDER_CREATE, ex);
g_free (folder_uri);
}
}
@ -533,7 +537,7 @@ mail_tool_uri_to_folder (const char *uri, CamelException *ex)
if (*ptr == '/') {
ptr++;
folder_path = ptr;
folder = camel_store_get_folder (store, folder_path, FALSE, ex);
folder = camel_store_get_folder (store, folder_path, 0, ex);
}
}

View File

@ -35,13 +35,13 @@ void mail_tool_camel_lock_down (void);
/* Get a CamelFolder from a root url and a foldername (uses the global session)*/
CamelFolder *
mail_tool_get_folder_from_urlname (const gchar *url, const gchar *name,
gboolean create, CamelException *ex);
guint32 flags, CamelException *ex);
/* Get a useful name for a given CamelFolder (ie, not "mbox") */
const gchar *mail_tool_get_folder_name (CamelFolder *folder);
/* Get the url for the local inbox */
gchar *mail_tool_get_local_inbox_url (void);
/* Get the url for the local inbox, index returns if the mailbox is indexed */
gchar *mail_tool_get_local_inbox_url (int *index);
/* Get the filename for our movemail folder or storage */
gchar *mail_tool_get_local_movemail_path (void);

View File

@ -194,7 +194,8 @@ vfolder_uri_to_folder(const char *uri, CamelException *ex)
storeuri = g_strdup_printf("vfolder:%s/vfolder/%s", evolution_dir, info->name);
foldername = g_strdup_printf("mbox?%s", info->query);
folder = mail_tool_get_folder_from_urlname (storeuri, foldername, TRUE, ex);
/* we dont have indexing on vfolders */
folder = mail_tool_get_folder_from_urlname (storeuri, foldername, CAMEL_STORE_FOLDER_CREATE, ex);
sourceuri = NULL;
sources = 0;

View File

@ -29,13 +29,26 @@
#include "component-factory.h"
#include "mail.h"
static int blowup(int status)
{
printf("memory blew up, status %d\n", status);
/*abort();*/
}
int
main (int argc, char *argv [])
{
CORBA_ORB orb;
/* free (malloc (10));*/
#if 0
/* used to make elfence work */
#if 0
free (malloc (10));
#else
/*mtrace();*/
mcheck(blowup);
#endif
#endif
bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR);
textdomain (PACKAGE);

View File

@ -374,7 +374,7 @@ message_list_drag_data_get (ETable *table,
url = g_strdup_printf ("file:%s", dirname);
ex = camel_exception_new ();
folder = mail_tool_get_folder_from_urlname (url, filename, TRUE, ex);
folder = mail_tool_get_folder_from_urlname (url, filename, CAMEL_STORE_FOLDER_CREATE, ex);
if (camel_exception_is_set (ex)) {
camel_exception_free (ex);
g_free (url);

View File

@ -643,7 +643,7 @@ main (int argc, char**argv)
return -1;
}
folder = camel_store_get_folder (store, "mbox", TRUE, ex);
folder = camel_store_get_folder (store, "mbox", 0, ex);
if (camel_exception_get_id (ex)) {
printf ("Exception caught in camel_store_get_folder\n"
"Full description : %s\n", camel_exception_get_description (ex));