aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorIain Holmes <iain@src.gnome.org>2001-05-12 05:19:33 +0800
committerIain Holmes <iain@src.gnome.org>2001-05-12 05:19:33 +0800
commitdd032fc24deb2a760040b08bb18aa687b762f0d3 (patch)
tree239453111f7822ad13154940e33377089ca49a1e /shell
parent95651fe8285b961687f8ade655e0c2b1b08aad78 (diff)
downloadgsoc2013-evolution-dd032fc24deb2a760040b08bb18aa687b762f0d3.tar
gsoc2013-evolution-dd032fc24deb2a760040b08bb18aa687b762f0d3.tar.gz
gsoc2013-evolution-dd032fc24deb2a760040b08bb18aa687b762f0d3.tar.bz2
gsoc2013-evolution-dd032fc24deb2a760040b08bb18aa687b762f0d3.tar.lz
gsoc2013-evolution-dd032fc24deb2a760040b08bb18aa687b762f0d3.tar.xz
gsoc2013-evolution-dd032fc24deb2a760040b08bb18aa687b762f0d3.tar.zst
gsoc2013-evolution-dd032fc24deb2a760040b08bb18aa687b762f0d3.zip
Ask for a folder to import into.
svn path=/trunk/; revision=9775
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog16
-rw-r--r--shell/Makefile.am2
-rw-r--r--shell/e-shell-folder-selection-dialog.c6
-rw-r--r--shell/e-shell-importer.c (renamed from shell/importer/importer.c)65
-rw-r--r--shell/e-shell-importer.h (renamed from shell/importer/importer.h)0
-rw-r--r--shell/e-shell-view-menu.c2
-rw-r--r--shell/importer/Makefile.am4
7 files changed, 75 insertions, 20 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 54912d89db..017a24ebff 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,19 @@
+2001-05-11 Iain Holmes <iain@ximian.com>
+
+ * e-shell-folder-selection-dialog.c (dbl_click_cb): Use gnome_dialog_close
+ instead of gtk_widget_destroy.
+ (impl_clicked): Use gnome_dialog_close instead of gtk_widget_destroy.
+
+ * e-shell-view-menu.c: #include e-shell-importer.h instead of importer/importer.h
+
+ * importer/Makefile.am: Remove importer.c and importer.h.
+
+ * importer/importer.[ch]: Moved these to e-shell-importer.[ch]
+
+ * e-shell-importer.c (start_import): Take a folderpath to import into.
+ (importer_druid_finish): Show the EShellFolderSelectionDialog to get a folder to
+ import into.
+
2001-05-11 JP Rosevear <jpr@ximian.com>
* e-component-registry.c (register_component): component_new refs
diff --git a/shell/Makefile.am b/shell/Makefile.am
index bbf4c9bc00..8ba7d53b4b 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -102,6 +102,8 @@ evolution_SOURCES = \
e-shell-folder-selection-dialog.h \
e-shell-folder-title-bar.c \
e-shell-folder-title-bar.h \
+ e-shell-importer.c \
+ e-shell-importer.h \
e-shell-offline-handler.c \
e-shell-offline-handler.h \
e-shell-utils.c \
diff --git a/shell/e-shell-folder-selection-dialog.c b/shell/e-shell-folder-selection-dialog.c
index 8674b5b599..14ceab70b7 100644
--- a/shell/e-shell-folder-selection-dialog.c
+++ b/shell/e-shell-folder-selection-dialog.c
@@ -162,7 +162,7 @@ dbl_click_cb (EStorageSetView *essv,
e_shell_folder_selection_dialog_get_selected_path (folder_selection_dialog));
}
- gtk_widget_destroy (GTK_WIDGET (folder_selection_dialog));
+ gnome_dialog_close (GNOME_DIALOG (folder_selection_dialog));
}
@@ -185,12 +185,12 @@ impl_clicked (GnomeDialog *dialog,
if (check_folder_type (folder_selection_dialog)) {
gtk_signal_emit (GTK_OBJECT (folder_selection_dialog), signals[FOLDER_SELECTED],
e_shell_folder_selection_dialog_get_selected_path (folder_selection_dialog));
- gtk_widget_destroy (GTK_WIDGET (dialog));
+ gnome_dialog_close (GNOME_DIALOG (dialog));
}
break;
case 1: /* Cancel */
gtk_signal_emit (GTK_OBJECT (folder_selection_dialog), signals[CANCELLED]);
- gtk_widget_destroy (GTK_WIDGET (dialog));
+ gnome_dialog_close (GNOME_DIALOG (dialog));
break;
case 2: /* Add */
storage_set_view = E_STORAGE_SET_VIEW (priv->storage_set_view);
diff --git a/shell/importer/importer.c b/shell/e-shell-importer.c
index 15d18db10b..0e66270a66 100644
--- a/shell/importer/importer.c
+++ b/shell/e-shell-importer.c
@@ -34,10 +34,15 @@
#include <libgnomeui/gnome-druid-page-start.h>
#include <libgnomeui/gnome-file-entry.h>
#include <libgnomeui/gnome-stock.h>
+#include <libgnomeui/gnome-dialog.h>
#include <liboaf/liboaf.h>
-#include <evolution-importer-client.h>
+#include "e-shell.h"
+#include "e-shell-view.h"
+#include "e-shell-folder-selection-dialog.h"
+
+#include "importer/evolution-importer-client.h"
#include <glade/glade.h>
#include <gtkhtml/gtkhtml.h>
@@ -46,8 +51,8 @@
#include <gal/widgets/e-gui-utils.h>
#include <gal/widgets/e-unicode.h>
-#include "importer.h"
-#include "GNOME_Evolution_Importer.h"
+#include "e-shell-importer.h"
+#include "importer/GNOME_Evolution_Importer.h"
typedef struct _ImportDialogFilePage {
GtkWidget *vbox;
@@ -59,6 +64,9 @@ typedef struct _ImportDialogFilePage {
} ImportDialogFilePage;
typedef struct _ImportData {
+ EShell *shell;
+ EShellView *view;
+
GladeXML *wizard;
GtkWidget *dialog;
GtkWidget *druid;
@@ -69,7 +77,9 @@ typedef struct _ImportData {
char *choosen_iid;
} ImportData;
-#define IMPORTER_DEBUG
+/*
+ #define IMPORTER_DEBUG
+*/
#ifdef IMPORTER_DEBUG
#define IN g_print ("=====> %s (%d)\n", __FUNCTION__, __LINE__)
#define OUT g_print ("<==== %s (%d)\n", __FUNCTION__, __LINE__)
@@ -84,10 +94,10 @@ static struct {
char *text;
} info[] = {
{ "file_html",
- N_("Choose the file that you want to import into Evolution, "
- "and select what type of file it is from the list.\n\n"
- "You can select \"Automatic\" if you do not know, and "
- "Evolution will attempt to work it out.")
+ N_("Choose the file that you want to import into Evolution, "
+ "and select what type of file it is from the list.\n\n"
+ "You can select \"Automatic\" if you do not know, and "
+ "Evolution will attempt to work it out.")
}
};
static int num_info = (sizeof (info) / sizeof (info[0]));
@@ -319,12 +329,14 @@ get_iid_for_filetype (const char *filename)
}
static void
-start_import (const char *filename,
+start_import (const char *folderpath,
+ const char *filename,
const char *iid)
{
ImporterComponentData *icd;
char *label;
char *real_iid;
+ char *real_folderpath;
if (iid == NULL || strcmp (iid, "Automatic") == 0) {
/* Work out the component to use */
@@ -383,7 +395,12 @@ start_import (const char *filename,
g_free (real_iid);
/* NULL for folderpath means use Inbox */
- if (evolution_importer_client_load_file (icd->client, filename, "/Inbox") == FALSE) {
+ g_warning ("Folderpath: %s", folderpath);
+ if (*folderpath == '/') {
+ real_folderpath = strchr (folderpath + 1, '/');
+ }
+
+ if (evolution_importer_client_load_file (icd->client, filename, real_folderpath) == FALSE) {
label = g_strdup_printf (_("Error loading %s"), filename);
gtk_label_set_text (GTK_LABEL (icd->contents), label);
g_free (label);
@@ -572,14 +589,34 @@ import_druid_finish (GnomeDruidPage *page,
GnomeDruid *druid,
ImportData *data)
{
+ GtkWidget *folder;
char *filename;
char *iid;
+ char *foldername;
filename = g_strdup (gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (data->filepage->filename)))));
iid = g_strdup (data->choosen_iid);
+ folder = e_shell_folder_selection_dialog_new (data->shell,
+ _("Select folder"),
+ e_shell_view_get_current_uri (data->view),
+ NULL);
gtk_widget_destroy (data->dialog);
- start_import (filename, iid);
+
+ gnome_dialog_close_hides (GNOME_DIALOG (folder), TRUE);
+ switch (gnome_dialog_run (GNOME_DIALOG (folder))) {
+ case 0:
+ foldername = e_shell_folder_selection_dialog_get_selected_path (E_SHELL_FOLDER_SELECTION_DIALOG (folder));
+ foldername = g_strdup (foldername);
+
+ start_import (foldername, filename, iid);
+ g_free (foldername);
+ break;
+
+ default:
+ gtk_widget_destroy (folder);
+ break;
+ }
g_free (filename);
g_free (iid);
@@ -590,7 +627,6 @@ prepare_file_page (GnomeDruidPage *page,
GnomeDruid *druid,
ImportData *data)
{
- g_print ("Prepare thyself\n");
gnome_druid_set_buttons_sensitive (druid, TRUE,
!data->filepage->need_filename,
TRUE);
@@ -629,6 +665,9 @@ show_import_wizard (BonoboUIComponent *component,
GnomeDruidPageFinish *finish;
GtkWidget *html;
+ data->view = E_SHELL_VIEW (user_data);
+ data->shell = e_shell_view_get_shell (data->view);
+
data->wizard = glade_xml_new (EVOLUTION_GLADEDIR "/import.glade", NULL);
data->dialog = glade_xml_get_widget (data->wizard, "importwizard");
gtk_window_set_wmclass (GTK_WINDOW (data->dialog), "importdruid",
@@ -644,7 +683,7 @@ show_import_wizard (BonoboUIComponent *component,
gtk_signal_connect (GTK_OBJECT (data->filedialog), "prepare",
GTK_SIGNAL_FUNC (prepare_file_page), data);
- finish = GNOME_DRUID_PAGE_FINISH (glade_xml_get_widget (data->wizard, "page3"));
+ finish = GNOME_DRUID_PAGE_FINISH (glade_xml_get_widget (data->wizard, "page4"));
data->filepage = importer_file_page_new (data);
data->vbox = data->filepage->vbox;
diff --git a/shell/importer/importer.h b/shell/e-shell-importer.h
index 644ff62866..644ff62866 100644
--- a/shell/importer/importer.h
+++ b/shell/e-shell-importer.h
diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c
index b27c5f6cac..a05348d508 100644
--- a/shell/e-shell-view-menu.c
+++ b/shell/e-shell-view-menu.c
@@ -45,7 +45,7 @@
#include "e-shell-constants.h"
#include "e-shell-view-menu.h"
-#include "importer/importer.h"
+#include "e-shell-importer.h"
#include "e-util/e-gui-utils.h"
diff --git a/shell/importer/Makefile.am b/shell/importer/Makefile.am
index 2a15012bbb..ea668fa3f5 100644
--- a/shell/importer/Makefile.am
+++ b/shell/importer/Makefile.am
@@ -35,9 +35,7 @@ libevolution_importer_la_SOURCES = \
evolution-importer-listener.c \
evolution-importer.c \
intelligent.c \
- intelligent.h \
- importer.c \
- importer.h
+ intelligent.h
libevolution_importerinclude_HEADERS = \
GNOME_Evolution_Importer.h \