From a133c16ccf9334dc665a82d6ddc37a26c2d3a23d Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Wed, 14 Apr 2004 15:46:33 +0000 Subject: differentiate between user cancellation and no importer (next_file_page): 2004-04-14 JP Rosevear * e-shell-importer.c (get_iid_for_filetype): differentiate between user cancellation and no importer (next_file_page): don't throw up a dialog if the user cancelled the selection process svn path=/trunk/; revision=25461 --- shell/e-shell-importer.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'shell/e-shell-importer.c') diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index 79c961ef7d..18268cc004 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -370,13 +370,12 @@ choose_importer_from_list (GList *importer_list) return g_strdup (iid); } -static char * -get_iid_for_filetype (const char *filename) +static gboolean +get_iid_for_filetype (const char *filename, char **ret_iid) { Bonobo_ServerInfoList *info_list; CORBA_Environment ev; GList *can_handle = NULL; - char *ret_iid; int i, len = 0; CORBA_exception_init (&ev); @@ -420,22 +419,24 @@ get_iid_for_filetype (const char *filename) iid = can_handle->data; - ret_iid = g_strdup (iid->iid); + *ret_iid = g_strdup (iid->iid); free_iid_list (can_handle); g_list_free (can_handle); - return ret_iid; + return TRUE; } else if (len > 1) { /* Display all the IIDs */ - ret_iid = choose_importer_from_list (can_handle); + *ret_iid = choose_importer_from_list (can_handle); free_iid_list (can_handle); g_list_free (can_handle); - return ret_iid; + return *ret_iid ? TRUE : FALSE; } else { - return NULL; + *ret_iid = NULL; + + return TRUE; } } @@ -482,7 +483,7 @@ start_import (gpointer parent, const char *filename, EvolutionImporterClient *cl g_object_unref (icd->client); if (icd->dialog) - gtk_widget_destroy (icd->dialog); + gtk_widget_destroy (GTK_WIDGET (icd->dialog)); g_free (icd); return; } @@ -1029,7 +1030,11 @@ next_file_page (GnomeDruidPage *page, /* Work out the component to use */ if (data->choosen_iid == NULL || strcmp (data->choosen_iid, "Automatic") == 0) { - real_iid = get_iid_for_filetype (data->filename); + if (!get_iid_for_filetype (data->filename, &real_iid)) { + gnome_druid_set_page (druid, GNOME_DRUID_PAGE (data->filedialog)); + + return TRUE; + } } else { real_iid = g_strdup (data->choosen_iid); } -- cgit