diff options
-rw-r--r-- | importers/ChangeLog | 14 | ||||
-rw-r--r-- | importers/netscape-importer.c | 36 | ||||
-rw-r--r-- | importers/pine-importer.c | 23 |
3 files changed, 69 insertions, 4 deletions
diff --git a/importers/ChangeLog b/importers/ChangeLog index 13b1c234dd..f97bf62473 100644 --- a/importers/ChangeLog +++ b/importers/ChangeLog @@ -1,5 +1,19 @@ 2001-08-29 Iain Holmes <iain@ximian.com> + * netscape-importer.c (importer_cb): Handle the case if the importer + isn't ready or is busy. + (importer_timeout_fn): One shot timeout function to call the importer + again. + + * pine-importer.c (importer_cb): Same. + +2001-08-29 Iain Holmes <iain@ximian.com> + + * netscape-importer.c (create_importer_gui): Add a message. + (importer_cb): Make the progressbar move (ohhh pretty). + +2001-08-29 Iain Holmes <iain@ximian.com> + * netscape-importer.c (create_importer_gui): Create a progress GUI. (importer_cb): Update GUI. (netscape_import_file): Update GUI. diff --git a/importers/netscape-importer.c b/importers/netscape-importer.c index 097da9339b..8c4283dc99 100644 --- a/importers/netscape-importer.c +++ b/importers/netscape-importer.c @@ -102,11 +102,12 @@ create_importer_gui (NetscapeImporter *importer) { GtkWidget *dialog; - dialog = gnome_message_box_new ("", GNOME_MESSAGE_BOX_INFO, NULL); + dialog = gnome_message_box_new (_("Evolution is importing your old Netscape data"), GNOME_MESSAGE_BOX_INFO, NULL); gtk_window_set_title (GTK_WINDOW (dialog), _("Importing...")); importer->label = gtk_label_new (_("Please wait")); importer->progressbar = gtk_progress_bar_new (); + gtk_progress_set_activity_mode (GTK_PROGRESS (importer->progressbar), TRUE); gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), importer->label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), @@ -558,6 +559,21 @@ netscape_can_import (EvolutionIntelligentImporter *ii, } } +static gboolean +importer_timeout_fn (gpointer data) +{ + NetscapeImporter *importer = (NetscapeImporter *) data; + CORBA_Object objref; + CORBA_Environment ev; + + CORBA_exception_init (&ev); + objref = bonobo_object_corba_objref (BONOBO_OBJECT (importer->listener)); + GNOME_Evolution_Importer_processItem (importer->importer, objref, &ev); + CORBA_exception_free (&ev); + + return FALSE; +} + static void importer_cb (EvolutionImporterListener *listener, EvolutionImporterResult result, @@ -568,7 +584,23 @@ importer_cb (EvolutionImporterListener *listener, CORBA_Object objref; CORBA_Environment ev; + if (result == EVOLUTION_IMPORTER_NOT_READY || + result == EVOLUTION_IMPORTER_BUSY) { + gtk_timeout_add (5000, importer_timeout_fn, data); + return; + } + if (more_items) { + GtkAdjustment *adj; + float newval; + + adj = GTK_PROGRESS (importer->progressbar)->adjustment; + newval = adj->value + 1; + if (newval > adj->upper) { + newval = adj->lower; + } + + gtk_progress_set_value (GTK_PROGRESS (importer->progressbar), newval); CORBA_exception_init (&ev); objref = bonobo_object_corba_objref (BONOBO_OBJECT (importer->listener)); GNOME_Evolution_Importer_processItem (importer->importer, @@ -582,8 +614,6 @@ importer_cb (EvolutionImporterListener *listener, return; } - gtk_progress_set_value (GTK_PROGRESS (importer->progressbar), 1); - if (importer->dir_list) { import_next (importer); } else { diff --git a/importers/pine-importer.c b/importers/pine-importer.c index e483b1a5d6..a6ca9a4f17 100644 --- a/importers/pine-importer.c +++ b/importers/pine-importer.c @@ -332,6 +332,21 @@ import_addressbook (PineImporter *importer) g_free (uri); } +static gboolean +importer_timeout_fn (gpointer data) +{ + PineImporter *importer = (PineImporter *) data; + CORBA_Object objref; + CORBA_Environment ev; + + CORBA_exception_init (&ev); + objref = bonobo_object_corba_objref (BONOBO_OBJECT (importer->listener)); + GNOME_Evolution_Importer_processItem (importer->importer, objref, &ev); + CORBA_exception_free (&ev); + + return FALSE; +} + static void importer_cb (EvolutionImporterListener *listener, EvolutionImporterResult result, @@ -342,6 +357,12 @@ importer_cb (EvolutionImporterListener *listener, CORBA_Object objref; CORBA_Environment ev; + if (result == EVOLUTION_IMPORTER_NOT_READY || + result == EVOLUTION_IMPORTER_BUSY) { + gtk_timeout_add (5000, importer_timeout_fn, data); + return; + } + if (more_items) { CORBA_exception_init (&ev); objref = bonobo_object_corba_objref (BONOBO_OBJECT (importer->listener)); @@ -380,7 +401,7 @@ pine_import_file (PineImporter *importer, result = GNOME_Evolution_Importer_loadFile (importer->importer, path, folderpath, &ev); if (ev._major != CORBA_NO_EXCEPTION || result == FALSE) { - g_warning ("Exception here: %s", CORBA_exception_id (&ev)); + g_warning ("Exception here: %s\n%s, %s", CORBA_exception_id (&ev), path, folderpath); CORBA_Object_release (importer->importer, &ev); CORBA_exception_free (&ev); return FALSE; |