From e6ab5554d4fe16cc816d8751b0206291ffeeccc5 Mon Sep 17 00:00:00 2001 From: Iain Holmes Date: Fri, 28 Sep 2001 18:58:17 +0000 Subject: Allow callers to set the default type of folder to be created. svn path=/trunk/; revision=13220 --- shell/e-shell-folder-selection-dialog.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'shell/e-shell-folder-selection-dialog.c') diff --git a/shell/e-shell-folder-selection-dialog.c b/shell/e-shell-folder-selection-dialog.c index e113b540dc..016ef51cca 100644 --- a/shell/e-shell-folder-selection-dialog.c +++ b/shell/e-shell-folder-selection-dialog.c @@ -50,6 +50,7 @@ struct _EShellFolderSelectionDialogPrivate { GList *allowed_types; EStorageSet *storage_set; GtkWidget *storage_set_view; + char *default_type; gboolean allow_creation; }; @@ -143,6 +144,7 @@ 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); @@ -205,6 +207,7 @@ impl_clicked (GnomeDialog *dialog, e_shell_show_folder_creation_dialog (priv->shell, GTK_WINDOW (dialog), default_parent_folder, + priv->default_type, folder_creation_dialog_result_cb, dialog); @@ -260,6 +263,7 @@ 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; } @@ -311,6 +315,8 @@ 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. **/ @@ -320,7 +326,8 @@ 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 *allowed_types[], + const char *default_type) { EShellFolderSelectionDialogPrivate *priv; GtkWidget *scroll_frame; @@ -335,6 +342,11 @@ 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); @@ -437,7 +449,8 @@ e_shell_folder_selection_dialog_new (EShell *shell, const char *title, const char *caption, const char *default_uri, - const char *allowed_types[]) + const char *allowed_types[], + const char *default_type) { EShellFolderSelectionDialog *folder_selection_dialog; @@ -446,7 +459,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); + title, caption, default_uri, allowed_types, default_type); return GTK_WIDGET (folder_selection_dialog); } -- cgit v1.2.3