aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-folder-selection-dialog.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/e-shell-folder-selection-dialog.c')
-rw-r--r--shell/e-shell-folder-selection-dialog.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/shell/e-shell-folder-selection-dialog.c b/shell/e-shell-folder-selection-dialog.c
index 5419da4431..d653e31522 100644
--- a/shell/e-shell-folder-selection-dialog.c
+++ b/shell/e-shell-folder-selection-dialog.c
@@ -49,7 +49,6 @@ struct _EShellFolderSelectionDialogPrivate {
GList *allowed_types;
EStorageSet *storage_set;
GtkWidget *storage_set_view;
- char *default_type;
gboolean allow_creation;
};
@@ -160,7 +159,6 @@ impl_destroy (GtkObject *object)
e_free_string_list (priv->allowed_types);
- g_free (priv->default_type);
g_free (priv);
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
@@ -201,6 +199,7 @@ impl_clicked (GnomeDialog *dialog,
EShellFolderSelectionDialogPrivate *priv;
EStorageSetView *storage_set_view;
const char *default_parent_folder;
+ const char *default_type;
folder_selection_dialog = E_SHELL_FOLDER_SELECTION_DIALOG (dialog);
priv = folder_selection_dialog->priv;
@@ -221,9 +220,17 @@ impl_clicked (GnomeDialog *dialog,
storage_set_view = E_STORAGE_SET_VIEW (priv->storage_set_view);
default_parent_folder = e_storage_set_view_get_current_folder (storage_set_view);
+ /* The default type in the folder creation dialog will be the
+ first of the allowed types. If all types are allowed,
+ hardcode to "mail". */
+ if (priv->allowed_types == NULL)
+ default_type = "mail";
+ else
+ default_type = (const char *) priv->allowed_types->data;
+
e_shell_show_folder_creation_dialog (priv->shell, GTK_WINDOW (dialog),
default_parent_folder,
- priv->default_type,
+ (const char *) priv->allowed_types->data,
folder_creation_dialog_result_cb,
dialog);
@@ -279,7 +286,6 @@ init (EShellFolderSelectionDialog *shell_folder_selection_dialog)
priv->storage_set_view = NULL;
priv->allowed_types = NULL;
priv->allow_creation = TRUE;
- priv->default_type = NULL;
shell_folder_selection_dialog->priv = priv;
}
@@ -331,8 +337,6 @@ folder_selected_cb (EStorageSetView *storage_set_view,
* @caption: A brief text to be put on top of the storage view
* @default_uri: The URI of the folder to be selected by default
* @allowed_types: List of the names of the allowed types
- * @default_type: The default type of folder that will be created if the
- * New folder button is pressed.
*
* Construct @folder_selection_dialog.
**/
@@ -342,8 +346,7 @@ e_shell_folder_selection_dialog_construct (EShellFolderSelectionDialog *folder_s
const char *title,
const char *caption,
const char *default_uri,
- const char *allowed_types[],
- const char *default_type)
+ const char *allowed_types[])
{
EShellFolderSelectionDialogPrivate *priv;
GtkWidget *scroll_frame;
@@ -358,11 +361,6 @@ e_shell_folder_selection_dialog_construct (EShellFolderSelectionDialog *folder_s
priv = folder_selection_dialog->priv;
- if (default_type != NULL && *default_type != 0) {
- priv->default_type = g_strdup (default_type);
- } else {
- priv->default_type = NULL;
- }
/* Basic dialog setup. */
gtk_window_set_policy (GTK_WINDOW (folder_selection_dialog), TRUE, TRUE, FALSE);
@@ -424,6 +422,11 @@ e_shell_folder_selection_dialog_construct (EShellFolderSelectionDialog *folder_s
for (i = 0; allowed_types[i] != NULL; i++)
priv->allowed_types = g_list_prepend (priv->allowed_types,
g_strdup (allowed_types[i]));
+
+ /* Preserve the order so we can use the first type listed as
+ the default for the folder creation dialog invoked by the
+ "New..." button. */
+ priv->allowed_types = g_list_reverse (priv->allowed_types);
}
if (default_uri != NULL)
@@ -465,8 +468,7 @@ e_shell_folder_selection_dialog_new (EShell *shell,
const char *title,
const char *caption,
const char *default_uri,
- const char *allowed_types[],
- const char *default_type)
+ const char *allowed_types[])
{
EShellFolderSelectionDialog *folder_selection_dialog;
@@ -475,7 +477,7 @@ e_shell_folder_selection_dialog_new (EShell *shell,
folder_selection_dialog = gtk_type_new (e_shell_folder_selection_dialog_get_type ());
e_shell_folder_selection_dialog_construct (folder_selection_dialog, shell,
- title, caption, default_uri, allowed_types, default_type);
+ title, caption, default_uri, allowed_types);
return GTK_WIDGET (folder_selection_dialog);
}