aboutsummaryrefslogtreecommitdiffstats
path: root/importers
diff options
context:
space:
mode:
authorIain Holmes <iain@src.gnome.org>2001-08-30 04:54:17 +0800
committerIain Holmes <iain@src.gnome.org>2001-08-30 04:54:17 +0800
commit4c74d37ed9f151117681699f90dde6b1cd7abed7 (patch)
tree4bbb6242af38a49f5aa3fbb1674f7c35c1705f0e /importers
parentd754f55ce5aeb4578f5cf9ea8221e8d0ec3bbfd5 (diff)
downloadgsoc2013-evolution-4c74d37ed9f151117681699f90dde6b1cd7abed7.tar.gz
gsoc2013-evolution-4c74d37ed9f151117681699f90dde6b1cd7abed7.tar.zst
gsoc2013-evolution-4c74d37ed9f151117681699f90dde6b1cd7abed7.zip
GUI
svn path=/trunk/; revision=12516
Diffstat (limited to 'importers')
-rw-r--r--importers/ChangeLog6
-rw-r--r--importers/netscape-importer.c65
2 files changed, 67 insertions, 4 deletions
diff --git a/importers/ChangeLog b/importers/ChangeLog
index 986ad3fb98..13b1c234dd 100644
--- a/importers/ChangeLog
+++ b/importers/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
2001-08-21 Iain Holmes <iain@ximian.com>
* pine-importer.c (scan_dir): Don't add a directory to the list of files
diff --git a/importers/netscape-importer.c b/importers/netscape-importer.c
index f3332c1a6e..097da9339b 100644
--- a/importers/netscape-importer.c
+++ b/importers/netscape-importer.c
@@ -88,10 +88,33 @@ typedef struct {
gboolean do_settings;
Bonobo_ConfigDatabase db;
+
+ /* GUI */
+ GtkWidget *dialog;
+ GtkWidget *label;
+ GtkWidget *progressbar;
} NetscapeImporter;
static void import_next (NetscapeImporter *importer);
+static GtkWidget *
+create_importer_gui (NetscapeImporter *importer)
+{
+ GtkWidget *dialog;
+
+ dialog = gnome_message_box_new ("", 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_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox),
+ importer->label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox),
+ importer->progressbar, FALSE, FALSE, 0);
+
+ return dialog;
+}
+
static void
netscape_store_settings (NetscapeImporter *importer)
{
@@ -545,10 +568,7 @@ importer_cb (EvolutionImporterListener *listener,
CORBA_Object objref;
CORBA_Environment ev;
- g_print ("Processed....\n");
if (more_items) {
- g_print ("Processing...\n");
-
CORBA_exception_init (&ev);
objref = bonobo_object_corba_objref (BONOBO_OBJECT (importer->listener));
GNOME_Evolution_Importer_processItem (importer->importer,
@@ -562,6 +582,8 @@ importer_cb (EvolutionImporterListener *listener,
return;
}
+ gtk_progress_set_value (GTK_PROGRESS (importer->progressbar), 1);
+
if (importer->dir_list) {
import_next (importer);
} else {
@@ -577,12 +599,20 @@ netscape_import_file (NetscapeImporter *importer,
CORBA_boolean result;
CORBA_Environment ev;
CORBA_Object objref;
+ char *str;
/* Do import */
d(g_warning ("Importing %s as %s\n", path, folderpath));
CORBA_exception_init (&ev);
+ str = g_strdup_printf (_("Importing %s as %s"), path, folderpath);
+ gtk_label_set_text (GTK_LABEL (importer->label), str);
+ g_free (str);
+ while (gtk_events_pending ()) {
+ gtk_main_iteration ();
+ }
+
result = GNOME_Evolution_Importer_loadFile (importer->importer, path,
folderpath, &ev);
if (ev._major != CORBA_NO_EXCEPTION || result == FALSE) {
@@ -660,6 +690,7 @@ scan_dir (NetscapeImporter *importer,
DIR *nsmail;
struct stat buf;
struct dirent *current;
+ char *str;
nsmail = opendir (dirname);
if (nsmail == NULL) {
@@ -667,7 +698,15 @@ scan_dir (NetscapeImporter *importer,
dirname, g_strerror (errno)));
return;
}
-
+
+ str = g_strdup_printf (_("Scanning %s"), dirname);
+ gtk_label_set_text (GTK_LABEL (importer->label), str);
+ g_free (str);
+
+ while (gtk_events_pending ()) {
+ gtk_main_iteration ();
+ }
+
current = readdir (nsmail);
while (current) {
char *fullname, *foldername;
@@ -744,6 +783,13 @@ netscape_create_structure (EvolutionIntelligentImporter *ii,
netscape_store_settings (importer);
+ /* Create a dialog */
+ importer->dialog = create_importer_gui (importer);
+ gtk_widget_show_all (importer->dialog);
+ while (gtk_events_pending ()) {
+ gtk_main_iteration ();
+ }
+
if (importer->do_settings == TRUE) {
bonobo_config_set_boolean (importer->db,
"/Importer/Netscape/settings-imported", TRUE, NULL);
@@ -755,9 +801,20 @@ netscape_create_structure (EvolutionIntelligentImporter *ii,
"/Importer/Netscape/mail-imported", TRUE, NULL);
/* Scan the nsmail folder and find out what folders
need to be imported */
+ gtk_label_set_text (GTK_LABEL (importer->label),
+ _("Scanning directory"));
+ while (gtk_events_pending ()) {
+ gtk_main_iteration ();
+ }
+
scan_dir (importer, "/", nsmail_dir);
/* Import them */
+ gtk_label_set_text (GTK_LABEL (importer->label),
+ _("Starting import"));
+ while (gtk_events_pending ()) {
+ gtk_main_iteration ();
+ }
import_next (importer);
}