diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 19 | ||||
-rw-r--r-- | mail/Makefile.am | 2 | ||||
-rw-r--r-- | mail/default/C/Inbox | 6 | ||||
-rw-r--r-- | mail/default/C/Makefile.am | 7 | ||||
-rw-r--r-- | mail/default/Makefile.am | 4 | ||||
-rw-r--r-- | mail/em-format-html-display.c | 15 | ||||
-rw-r--r-- | mail/em-migrate.c | 77 |
7 files changed, 113 insertions, 17 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 3d21154d1b..4280d4aa02 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,22 @@ +2004-01-16 Not Zed <NotZed@Ximian.com> + + * default/C/Inbox: + * default/C/Makefile.am: + * default/Makefile.am: Startup files/folders. + + * em-migrate.c (emm_setup_initial): initial implementation of + startup setup. + (cp): Fix the test, we want exists AND size>0, not exists OR + size>0. + (cp): Fix the open, we can't use O_EXCL with empty, but present + files. Another hack fix for #52880. + + ** See bug #52896. + + * em-format-html-display.c (efhd_html_button_press_event): do this + based on get_object_at rather than get_point_at, so we get the + offset properly. + 2004-01-15 Jeffrey Stedfast <fejj@ximian.com> * mail-vfolder.c: Make vfolder_store 'global'. diff --git a/mail/Makefile.am b/mail/Makefile.am index 2538b5464e..0baac3ce07 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = # importers FIXME +SUBDIRS = default # importers FIXME libexec_PROGRAMS = \ evolution-mbox-upgrade diff --git a/mail/default/C/Inbox b/mail/default/C/Inbox new file mode 100644 index 0000000000..bf0da4a911 --- /dev/null +++ b/mail/default/C/Inbox @@ -0,0 +1,6 @@ +From - +Subject: Welcome to Ximian Evolution + +Welcome to Ximian Evolution! + +This is a placeholder message. diff --git a/mail/default/C/Makefile.am b/mail/default/C/Makefile.am new file mode 100644 index 0000000000..fab3401384 --- /dev/null +++ b/mail/default/C/Makefile.am @@ -0,0 +1,7 @@ + +defaultlocaldir = $(privdatadir)/default/C/mail/local + +defaultlocal_DATA = \ + Inbox + +EXTRA_DIST = $(defaultlocal_DATA) diff --git a/mail/default/Makefile.am b/mail/default/Makefile.am new file mode 100644 index 0000000000..82be2bc415 --- /dev/null +++ b/mail/default/Makefile.am @@ -0,0 +1,4 @@ + +SUBDIRS=C + + diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c index 10f5d89d33..907b674f0a 100644 --- a/mail/em-format-html-display.c +++ b/mail/em-format-html-display.c @@ -570,26 +570,27 @@ static int efhd_html_button_press_event (GtkWidget *widget, GdkEventButton *event, EMFormatHTMLDisplay *efhd) { HTMLEngine *e; - HTMLPoint *point; + HTMLObject *obj; const char *url; gboolean res = FALSE; + gint offset; if (event->button != 3) return FALSE; e = ((GtkHTML *)widget)->engine; - point = html_engine_get_point_at(e, event->x, event->y, FALSE); - if (point == NULL) + obj = html_engine_get_object_at(e, event->x, event->y, &offset, FALSE); + if (obj == NULL) return FALSE; d(printf("popup button pressed\n")); - if ( (url = html_object_get_src(point->object)) != NULL - || (url = html_object_get_url(point->object, 0)) != NULL) { + if ( (url = html_object_get_src(obj)) != NULL + || (url = html_object_get_url(obj, offset)) != NULL) { EMFormatPURI *puri; char *uri; - uri = gtk_html_get_url_object_relative((GtkHTML *)widget, point->object, url); + uri = gtk_html_get_url_object_relative((GtkHTML *)widget, obj, url); puri = em_format_find_puri((EMFormat *)efhd, uri); d(printf("poup event, uri = '%s' part = '%p'\n", uri, puri?puri->part:NULL)); @@ -597,8 +598,6 @@ efhd_html_button_press_event (GtkWidget *widget, GdkEventButton *event, EMFormat g_signal_emit((GtkObject *)efhd, efhd_signals[EFHD_POPUP_EVENT], 0, event, uri, puri?puri->part:NULL, &res); g_free(uri); } - - html_point_destroy(point); return res; } diff --git a/mail/em-migrate.c b/mail/em-migrate.c index 8ea8d08248..f7610b7e27 100644 --- a/mail/em-migrate.c +++ b/mail/em-migrate.c @@ -1245,13 +1245,13 @@ cp (const char *src, const char *dest, gboolean show_progress) /* if the dest file exists and has content, abort - we don't * want to corrupt their existing data */ - if (stat (dest, &st) != -1 && st.st_size > 0) + if (stat (dest, &st) == 0 && st.st_size > 0) return -1; if ((fd[0] = open (src, O_RDONLY)) == -1) return -1; - if ((fd[1] = open (dest, O_WRONLY | O_CREAT | O_TRUNC, 0666)) == -1) { + if ((fd[1] = open (dest, O_WRONLY | O_CREAT, 0666)) == -1) { errnosav = errno; close (fd[0]); errno = errnosav; @@ -1836,6 +1836,71 @@ emm_save_xml (xmlDocPtr doc, const char *dirname, const char *filename) return retval; } +static int +emm_setup_initial(const char *evolution_dir) +{ + DIR *dir; + struct dirent *d; + struct stat st; + char *base, *local, *lang; + + /* special-case - this means brand new install of evolution */ + /* FIXME: create default folders and stuff... */ + + base = e_iconv_locale_language(); + if (base) { + lang = g_alloca(strlen(base)+1); + strcpy(lang, base); + } else + lang = NULL; + + d(printf("Setting up initial mail tree\n")); + + base = g_build_filename(evolution_dir, "/mail/local", NULL); + if (camel_mkdir(base, 0777) == -1 && errno != EEXIST) { + g_free(base); + return -1; + } + + /* e.g. try en-AU then en, etc */ + while (lang != NULL) { + local = g_build_filename(EVOLUTION_PRIVDATADIR "/default", lang, "mail/local", NULL); + if (stat(local, &st) == 0) + goto gotlocal; + + g_free(local); + if (strlen(lang)>2 && lang[2] == '-') + lang[2] = 0; + else + lang = NULL; + } + + local = g_build_filename(EVOLUTION_PRIVDATADIR "/default/C/mail/local", NULL); +gotlocal: + + dir = opendir(local); + if (dir) { + while ((d = readdir(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); + + cp(src, dest, FALSE); + g_free(dest); + g_free(src); + } + closedir(dir); + } + + g_free(local); + g_free(base); + + return 0; +} int em_migrate (const char *evolution_dir, int major, int minor, int revision, CamelException *ex) @@ -1857,12 +1922,8 @@ em_migrate (const char *evolution_dir, int major, int minor, int revision, Camel g_free (path); - if (major == 0) { - /* special-case - this means brand new install of evolution */ - /* FIXME: create default folders and stuff... */ - - return 0; - } + if (major == 0) + return emm_setup_initial(evolution_dir); if (major == 1 && minor < 5) { xmlDocPtr config_xmldb = NULL, filters, vfolders; |