[evolution-patches] Various fixes for e-shell-importer.c and mail importers
- From: Frederic Crozat <fcrozat mandrakesoft com>
- To: Evolution Patches <evolution-patches lists ximian com>
- Subject: [evolution-patches] Various fixes for e-shell-importer.c and mail importers
- Date: Fri, 20 Aug 2004 17:45:48 +0200
While investigating some mail rendering bugs, I found 3 different bugs
in importer :
-one druid page was used before being initialized, causing a warning
from libgnomeui (hopefully, it didn't crashed) and a missing icon in the
last page of import druid.
-gtk_dialog_set_has_separator shouldn't be used on message dialog with
GTK+ >= 2.4.0 (it causes a warning)
-importing files with non ASCII character in the path/filename was
impossible on systems with non-UTF8 locales (and could cause a lot of
pango warnings).
The attached patch fixes the problem in e-shell-importer.c and mail
importers.
--
Frederic Crozat <fcrozat mandrakesoft com>
Mandrakesoft
? evolution-1.5.93-importfix.patch.bz2
? mail/importers/.mail-importer.c.swp
? shell/.e-shell-importer.c.swp
? shell/evolution-1.5.93-importfix.patch.bz2
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3435
diff -u -p -r1.3435 ChangeLog
--- mail/ChangeLog 18 Aug 2004 02:29:32 -0000 1.3435
+++ mail/ChangeLog 20 Aug 2004 15:25:05 -0000
@@ -1,3 +1,10 @@
+2004-08-20 Frederic Crozat <fcrozat mandrakesoft com>
+
+ * importers/evolution-mbox-importer.c: (load_file_fn):
+ * importers/evolution-outlook-importer.c: (load_file_fn):
+ * importers/mail-importer.c: (import_folders_rec):
+ Convert filename to UTF-8 from local encoding before displaying it.
+
2004-08-16 Not Zed <NotZed Ximian com>
** See bug #62963.
Index: mail/importers/evolution-mbox-importer.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/importers/evolution-mbox-importer.c,v
retrieving revision 1.38
diff -u -p -r1.38 evolution-mbox-importer.c
--- mail/importers/evolution-mbox-importer.c 26 May 2004 04:25:10 -0000 1.38
+++ mail/importers/evolution-mbox-importer.c 20 Aug 2004 15:25:05 -0000
@@ -214,10 +214,13 @@ static gboolean
load_file_fn(EvolutionImporter *eimporter, const char *filename, void *data)
{
MboxImporter *importer = data;
-
+ char *utf8_filename;
+
+ utf8_filename = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
importer->dialog = gtk_message_dialog_new(NULL, 0/*GTK_DIALOG_NO_SEPARATOR*/,
GTK_MESSAGE_INFO, GTK_BUTTONS_CANCEL,
- _("Importing `%s'"), filename);
+ _("Importing `%s'"), utf8_filename);
+ g_free (utf8_filename);
gtk_window_set_title (GTK_WINDOW (importer->dialog), _("Importing..."));
importer->label = gtk_label_new (_("Please wait"));
Index: mail/importers/evolution-outlook-importer.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/importers/evolution-outlook-importer.c,v
retrieving revision 1.16
diff -u -p -r1.16 evolution-outlook-importer.c
--- mail/importers/evolution-outlook-importer.c 26 May 2004 04:25:10 -0000 1.16
+++ mail/importers/evolution-outlook-importer.c 20 Aug 2004 15:25:05 -0000
@@ -248,10 +248,13 @@ static gboolean
load_file_fn(EvolutionImporter *eimporter, const char *filename, void *data)
{
OutlookImporter *importer = data;
+ char *utf8_filename;
+ utf8_filename = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
importer->dialog = gtk_message_dialog_new(NULL, 0/*GTK_DIALOG_NO_SEPARATOR*/,
GTK_MESSAGE_INFO, GTK_BUTTONS_CANCEL,
- _("Importing `%s'"), filename);
+ _("Importing `%s'"), utf8_filename);
+ g_free (utf8_filename);
gtk_window_set_title (GTK_WINDOW (importer->dialog), _("Importing..."));
importer->label = gtk_label_new (_("Please wait"));
Index: mail/importers/mail-importer.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/importers/mail-importer.c,v
retrieving revision 1.4
diff -u -p -r1.4 mail-importer.c
--- mail/importers/mail-importer.c 3 May 2004 10:31:00 -0000 1.4
+++ mail/importers/mail-importer.c 20 Aug 2004 15:25:06 -0000
@@ -350,14 +350,16 @@ import_folders_rec(struct _import_folder
DIR *dir;
struct dirent *d;
struct stat st;
- char *filefull, *foldersub, *uri;
+ char *filefull, *foldersub, *uri, utf8_filename;
const char *folder;
dir = opendir(filepath);
if (dir == NULL)
return;
- camel_operation_start(NULL, _("Scanning %s"), filepath);
+ utf8_filename = g_filename_to_utf8 (filepath, -1, NULL, NULL, NULL);
+ camel_operation_start(NULL, _("Scanning %s"), utf8_filename);
+ g_free (utf8_filename);
while ( (d=readdir(dir)) ) {
if (d->d_name[0] == '.')
Index: shell/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1466
diff -u -p -r1.1466 ChangeLog
--- shell/ChangeLog 12 Aug 2004 20:37:07 -0000 1.1466
+++ shell/ChangeLog 20 Aug 2004 15:25:06 -0000
@@ -1,3 +1,12 @@
+2004-08-20 Frederic Crozat <fcrozat mandrakesoft com>
+
+ * e-shell-importer.c: (e_shell_importer_start_import):
+ Initialize data->finish before using it
+ (prepare_intelligent_page): don't call gtk_dialog_set_has_separator
+ on Message Dialog on GTK+ >= 2.4.0 (output warning)
+ (start_import) (next_file_page): convert filename from UTF-8 to
+ local encoding.
+
2004-08-12 Carlos Garnacho Parro <carlosg gnome org>
* e-shell-importer.c: added the "use_filechooser" property to the
Index: shell/e-shell-importer.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-importer.c,v
retrieving revision 1.76
diff -u -p -r1.76 e-shell-importer.c
--- shell/e-shell-importer.c 12 Aug 2004 20:37:07 -0000 1.76
+++ shell/e-shell-importer.c 20 Aug 2004 15:25:06 -0000
@@ -128,7 +128,7 @@ typedef struct _SelectedImporterData{
#define IMPORTER_REPO_ID_QUERY "repo_ids.has ('IDL:GNOME/Evolution/Importer:" BASE_VERSION "')"
#define IMPORTER_INTEL_REPO_ID_QUERY "repo_ids.has ('IDL:GNOME/Evolution/IntelligentImporter:" BASE_VERSION "')"
-#define IMPORTER_DEBUG
+/*#define IMPORTER_DEBUG*/
#ifdef IMPORTER_DEBUG
#define IN g_print ("=====> %s (%d)\n", G_GNUC_FUNCTION, __LINE__)
@@ -226,10 +226,14 @@ import_cb (EvolutionImporterListener *li
}
if (more_items) {
+ char *utf8_filename;
+
+ utf8_filename = g_filename_to_utf8 (icd->filename, -1, NULL, NULL, NULL);
label = g_strdup_printf (_("Importing %s\nImporting item %d."),
- icd->filename, ++(icd->item));
+ utf8_filename, ++(icd->item));
gtk_label_set_text (GTK_LABEL (icd->contents), label);
g_free (label);
+ g_free (utf8_filename);
while (gtk_events_pending ())
gtk_main_iteration ();
@@ -254,13 +258,16 @@ static gboolean
importer_timeout_fn (gpointer data)
{
ImporterComponentData *icd = (ImporterComponentData *) data;
- char *label;
+ char *label, *utf8_filename;
IN;
+
+ utf8_filename = g_filename_to_utf8 (icd->filename, -1, NULL, NULL, NULL);
label = g_strdup_printf (_("Importing %s\nImporting item %d."),
- icd->filename, icd->item);
+ utf8_filename, icd->item);
gtk_label_set_text (GTK_LABEL (icd->contents), label);
g_free (label);
+ g_free (utf8_filename);
while (gtk_events_pending ())
gtk_main_iteration ();
@@ -446,10 +453,13 @@ start_import (gpointer parent, const cha
{
ImporterComponentData *icd;
char *label;
+ char *utf8_filename;
+ utf8_filename = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
if (!g_file_test (filename, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
- e_notice (parent, GTK_MESSAGE_ERROR, _("File %s does not exist"), filename);
+ e_notice (parent, GTK_MESSAGE_ERROR, _("File %s does not exist"), utf8_filename);
+ g_free (utf8_filename);
return;
}
@@ -464,7 +474,7 @@ start_import (gpointer parent, const cha
g_object_weak_ref (G_OBJECT(icd->dialog), dialog_destroy_notify, icd);
- label = g_strdup_printf (_("Importing %s.\n"), filename);
+ label = g_strdup_printf (_("Importing %s.\n"), utf8_filename);
icd->contents = gtk_label_new (label);
g_free (label);
@@ -474,7 +484,7 @@ start_import (gpointer parent, const cha
gtk_main_iteration ();
if (evolution_importer_client_load_file (icd->client, filename) == FALSE) {
- label = g_strdup_printf (_("Error loading %s"), filename);
+ label = g_strdup_printf (_("Error loading %s"), utf8_filename);
e_notice (icd->dialog, GTK_MESSAGE_ERROR, _("Error loading %s"), filename);
gtk_label_set_text (GTK_LABEL (icd->contents), label);
@@ -486,6 +496,7 @@ start_import (gpointer parent, const cha
if (icd->dialog)
gtk_widget_destroy (GTK_WIDGET (icd->dialog));
g_free (icd);
+ g_free (utf8_filename);
return;
}
@@ -493,9 +504,10 @@ start_import (gpointer parent, const cha
icd->item = 1;
label = g_strdup_printf (_("Importing %s\nImporting item 1."),
- filename);
+ utf8_filename);
gtk_label_set_text (GTK_LABEL (icd->contents), label);
g_free (label);
+ g_free (utf8_filename);
while (gtk_events_pending ())
gtk_main_iteration ();
@@ -752,7 +764,10 @@ prepare_intelligent_page (GnomeDruidPage
dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_NONE, "%s",
_("Please wait...\nScanning for existing setups"));
e_make_widget_backing_stored (dialog);
+#if !GTK_CHECK_VERSION(2,4,0)
+ /* not needed for message_dialog with GTK+ 2.4 */
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+#endif
gtk_window_set_title (GTK_WINDOW (dialog), _("Starting Intelligent Importers"));
gtk_widget_show_all (dialog);
@@ -1046,16 +1061,18 @@ next_file_page (GnomeDruidPage *page,
ImportData *data)
{
char *real_iid = NULL;
+ char *utf8_filename;
/* Get and test the file name */
if (data->filename)
g_free (data->filename);
- data->filename = gnome_file_entry_get_full_path (GNOME_FILE_ENTRY (data->filepage->filename), FALSE);
+ utf8_filename = gnome_file_entry_get_full_path (GNOME_FILE_ENTRY (data->filepage->filename), FALSE);
+ data->filename = g_filename_from_utf8 (utf8_filename, -1, NULL, NULL, NULL);
if (!g_file_test (data->filename, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
- e_notice (druid, GTK_MESSAGE_ERROR, _("File %s does not exist"), data->filename);
+ e_notice (druid, GTK_MESSAGE_ERROR, _("File %s does not exist"), utf8_filename);
gnome_druid_set_page (druid, GNOME_DRUID_PAGE (data->filedialog));
-
+ g_free (utf8_filename);
return TRUE;
}
@@ -1064,6 +1081,7 @@ next_file_page (GnomeDruidPage *page,
if (!get_iid_for_filetype (data->filename, &real_iid)) {
gnome_druid_set_page (druid, GNOME_DRUID_PAGE (data->filedialog));
+ g_free (utf8_filename);
return TRUE;
}
} else {
@@ -1071,9 +1089,10 @@ next_file_page (GnomeDruidPage *page,
}
if (!real_iid) {
- e_notice (druid, GTK_MESSAGE_ERROR, _("No importer available for file %s"), data->filename);
+ e_notice (druid, GTK_MESSAGE_ERROR, _("No importer available for file %s"), utf8_filename);
gnome_druid_set_page (druid, GNOME_DRUID_PAGE (data->filedialog));
+ g_free (utf8_filename);
return TRUE;
}
@@ -1081,6 +1100,7 @@ next_file_page (GnomeDruidPage *page,
g_object_unref (data->client);
data->client = evolution_importer_client_new_from_id (real_iid);
g_free (real_iid);
+ g_free (utf8_filename);
if (!data->client) {
e_notice (druid, GTK_MESSAGE_ERROR, _("Unable to execute importer"));
@@ -1238,7 +1258,6 @@ e_shell_importer_start_import (EShellWin
G_CALLBACK (prepare_file_page), data);
g_signal_connect (data->filedialog, "next",
G_CALLBACK (next_file_page), data);
- gnome_druid_page_edge_set_logo (data->finish, icon);
data->filepage = importer_file_page_new (data);
html = create_help ("file_html");
@@ -1260,6 +1279,7 @@ e_shell_importer_start_import (EShellWin
/* Finish page */
data->finish = GNOME_DRUID_PAGE_EDGE (glade_xml_get_widget (data->wizard, "page4"));
+ gnome_druid_page_edge_set_logo (data->finish, icon);
g_signal_connect (data->finish, "back",
G_CALLBACK (back_finish_page), data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]