Allow callers to set the default type of folder to be created.
svn path=/trunk/; revision=13220
This commit is contained in:
@ -1,3 +1,36 @@
|
|||||||
|
2001-09-26 Iain Holmes <iain@ximian.com>
|
||||||
|
|
||||||
|
* Evolution-Shell.idl: Added a default_type parameter for setting the
|
||||||
|
default folder creation type.
|
||||||
|
|
||||||
|
* e-shell-folder-commands.c (e_shell_command_create_new_folder): Add NULL
|
||||||
|
for default type.
|
||||||
|
(e_shell_command_move_folder): Add NULL for default type.
|
||||||
|
|
||||||
|
* e-shell-folder-creation-dialog.c (add_folder_types): Check for the
|
||||||
|
default_type instead of for mail.
|
||||||
|
(get_type_from_parent_path): Get the folder type from the parent folder
|
||||||
|
(e_shell_show_folder_creation_dialog): Get the default folder type
|
||||||
|
before creating the menu.
|
||||||
|
|
||||||
|
* e-shell-folder-creation-dialog.h: Update headers.
|
||||||
|
|
||||||
|
* e-shell-folder-selection-dialog.c (impl_clicked): Add default type.
|
||||||
|
(e_shell_folder_selection_dialog_construct): Add default type.
|
||||||
|
(e_shell_folder_selection_dialog_new): Add default type.
|
||||||
|
|
||||||
|
* e-shell-folder-selection-dialog.h: Update headers.
|
||||||
|
|
||||||
|
* e-shell-importer.c (import_druid_finish): Add NULL for default type.
|
||||||
|
|
||||||
|
* e-shell-view-menu.c (command_new_folder): Set NULL for default type.
|
||||||
|
(command_goto_folder): Set NULL for default type.
|
||||||
|
|
||||||
|
* e-shell.c (impl_Shell_selectUserFolder): Update for the new default
|
||||||
|
type.
|
||||||
|
|
||||||
|
* evolution-shell-client.c (user_select_folder): Add "" for default type
|
||||||
|
|
||||||
2001-09-27 Ettore Perazzoli <ettore@ximian.com>
|
2001-09-27 Ettore Perazzoli <ettore@ximian.com>
|
||||||
|
|
||||||
* e-shell-view-menu.c (DEFINE_UNIMPLEMENTED): Remove.
|
* e-shell-view-menu.c (DEFINE_UNIMPLEMENTED): Remove.
|
||||||
|
@ -78,7 +78,8 @@ module Evolution {
|
|||||||
void selectUserFolder (in FolderSelectionListener listener,
|
void selectUserFolder (in FolderSelectionListener listener,
|
||||||
in string title,
|
in string title,
|
||||||
in string default_folder,
|
in string default_folder,
|
||||||
in FolderTypeNameList possible_types)
|
in FolderTypeNameList possible_types,
|
||||||
|
in string default_type)
|
||||||
raises (NotReady, Busy);
|
raises (NotReady, Busy);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -253,6 +253,7 @@ e_shell_command_create_new_folder (EShell *shell,
|
|||||||
/* FIXME: Should handle the result stuff. */
|
/* FIXME: Should handle the result stuff. */
|
||||||
e_shell_show_folder_creation_dialog (shell, GTK_WINDOW (shell_view),
|
e_shell_show_folder_creation_dialog (shell, GTK_WINDOW (shell_view),
|
||||||
e_shell_view_get_current_path (shell_view),
|
e_shell_view_get_current_path (shell_view),
|
||||||
|
NULL /* Default type. Take it from parent */,
|
||||||
NULL /* result_callback */,
|
NULL /* result_callback */,
|
||||||
NULL /* result_callback_data */);
|
NULL /* result_callback_data */);
|
||||||
}
|
}
|
||||||
@ -316,7 +317,7 @@ e_shell_command_copy_folder (EShell *shell,
|
|||||||
_("Copy folder"),
|
_("Copy folder"),
|
||||||
caption,
|
caption,
|
||||||
uri,
|
uri,
|
||||||
NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
g_free (caption);
|
g_free (caption);
|
||||||
g_free (uri);
|
g_free (uri);
|
||||||
@ -363,7 +364,7 @@ e_shell_command_move_folder (EShell *shell,
|
|||||||
_("Move folder"),
|
_("Move folder"),
|
||||||
caption,
|
caption,
|
||||||
uri,
|
uri,
|
||||||
NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
g_free (caption);
|
g_free (caption);
|
||||||
g_free (uri);
|
g_free (uri);
|
||||||
|
@ -374,7 +374,8 @@ type_with_display_name_compare_func (const void *a, const void *b)
|
|||||||
static GList *
|
static GList *
|
||||||
add_folder_types (GtkWidget *dialog,
|
add_folder_types (GtkWidget *dialog,
|
||||||
GladeXML *gui,
|
GladeXML *gui,
|
||||||
EShell *shell)
|
EShell *shell,
|
||||||
|
const char *default_type)
|
||||||
{
|
{
|
||||||
EFolderTypeRegistry *folder_type_registry;
|
EFolderTypeRegistry *folder_type_registry;
|
||||||
GtkWidget *folder_type_option_menu;
|
GtkWidget *folder_type_option_menu;
|
||||||
@ -438,7 +439,7 @@ add_folder_types (GtkWidget *dialog,
|
|||||||
|
|
||||||
gtk_object_set_data_full (GTK_OBJECT (menu_item), "folder_type", g_strdup (type->type), g_free);
|
gtk_object_set_data_full (GTK_OBJECT (menu_item), "folder_type", g_strdup (type->type), g_free);
|
||||||
|
|
||||||
if (strcmp (type->type, "mail") == 0)
|
if (strcmp (type->type, default_type ? default_type : "mail") == 0)
|
||||||
default_item = i;
|
default_item = i;
|
||||||
|
|
||||||
i ++;
|
i ++;
|
||||||
@ -457,6 +458,28 @@ add_folder_types (GtkWidget *dialog,
|
|||||||
return folder_types;
|
return folder_types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
get_type_from_parent_path (EShell *shell,
|
||||||
|
const char *path)
|
||||||
|
{
|
||||||
|
EFolder *folder;
|
||||||
|
const char *folder_type;
|
||||||
|
EStorageSet *set;
|
||||||
|
|
||||||
|
set = e_shell_get_storage_set (shell);
|
||||||
|
folder = e_storage_set_get_folder (set, path);
|
||||||
|
if (folder == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
folder_type = e_folder_get_type_string (folder);
|
||||||
|
if (folder_type == NULL) {
|
||||||
|
return NULL;
|
||||||
|
} else {
|
||||||
|
return folder_type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* FIXME: Currently this is modal. I think it's OK, but if people think it is
|
/* FIXME: Currently this is modal. I think it's OK, but if people think it is
|
||||||
not, we should change it to non-modal and make sure only one of these is
|
not, we should change it to non-modal and make sure only one of these is
|
||||||
@ -465,6 +488,7 @@ void
|
|||||||
e_shell_show_folder_creation_dialog (EShell *shell,
|
e_shell_show_folder_creation_dialog (EShell *shell,
|
||||||
GtkWindow *parent_window,
|
GtkWindow *parent_window,
|
||||||
const char *default_parent_folder,
|
const char *default_parent_folder,
|
||||||
|
const char *default_type,
|
||||||
EShellFolderCreationDialogCallback result_callback,
|
EShellFolderCreationDialogCallback result_callback,
|
||||||
void *result_callback_data)
|
void *result_callback_data)
|
||||||
{
|
{
|
||||||
@ -490,7 +514,14 @@ e_shell_show_folder_creation_dialog (EShell *shell,
|
|||||||
setup_folder_name_entry (dialog, gui, shell);
|
setup_folder_name_entry (dialog, gui, shell);
|
||||||
|
|
||||||
storage_set_view = add_storage_set_view (dialog, gui, shell, default_parent_folder);
|
storage_set_view = add_storage_set_view (dialog, gui, shell, default_parent_folder);
|
||||||
folder_types = add_folder_types (dialog, gui, shell);
|
if (default_type == NULL) {
|
||||||
|
char *dt;
|
||||||
|
|
||||||
|
dt = get_type_from_parent_path (shell, default_parent_folder);
|
||||||
|
folder_types = add_folder_types (dialog, gui, shell, dt);
|
||||||
|
} else {
|
||||||
|
folder_types = add_folder_types (dialog, gui, shell, default_type);
|
||||||
|
}
|
||||||
|
|
||||||
dialog_data = g_new (DialogData, 1);
|
dialog_data = g_new (DialogData, 1);
|
||||||
dialog_data->dialog = dialog;
|
dialog_data->dialog = dialog;
|
||||||
|
@ -43,6 +43,7 @@ typedef void (* EShellFolderCreationDialogCallback) (EShell *shell,
|
|||||||
void e_shell_show_folder_creation_dialog (EShell *shell,
|
void e_shell_show_folder_creation_dialog (EShell *shell,
|
||||||
GtkWindow *parent,
|
GtkWindow *parent,
|
||||||
const char *default_parent_folder,
|
const char *default_parent_folder,
|
||||||
|
const char *default_type,
|
||||||
EShellFolderCreationDialogCallback result_callback,
|
EShellFolderCreationDialogCallback result_callback,
|
||||||
void *result_callback_data);
|
void *result_callback_data);
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ struct _EShellFolderSelectionDialogPrivate {
|
|||||||
GList *allowed_types;
|
GList *allowed_types;
|
||||||
EStorageSet *storage_set;
|
EStorageSet *storage_set;
|
||||||
GtkWidget *storage_set_view;
|
GtkWidget *storage_set_view;
|
||||||
|
char *default_type;
|
||||||
|
|
||||||
gboolean allow_creation;
|
gboolean allow_creation;
|
||||||
};
|
};
|
||||||
@ -143,6 +144,7 @@ impl_destroy (GtkObject *object)
|
|||||||
|
|
||||||
e_free_string_list (priv->allowed_types);
|
e_free_string_list (priv->allowed_types);
|
||||||
|
|
||||||
|
g_free (priv->default_type);
|
||||||
g_free (priv);
|
g_free (priv);
|
||||||
|
|
||||||
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
(* 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),
|
e_shell_show_folder_creation_dialog (priv->shell, GTK_WINDOW (dialog),
|
||||||
default_parent_folder,
|
default_parent_folder,
|
||||||
|
priv->default_type,
|
||||||
folder_creation_dialog_result_cb,
|
folder_creation_dialog_result_cb,
|
||||||
dialog);
|
dialog);
|
||||||
|
|
||||||
@ -260,6 +263,7 @@ init (EShellFolderSelectionDialog *shell_folder_selection_dialog)
|
|||||||
priv->storage_set_view = NULL;
|
priv->storage_set_view = NULL;
|
||||||
priv->allowed_types = NULL;
|
priv->allowed_types = NULL;
|
||||||
priv->allow_creation = TRUE;
|
priv->allow_creation = TRUE;
|
||||||
|
priv->default_type = NULL;
|
||||||
|
|
||||||
shell_folder_selection_dialog->priv = priv;
|
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
|
* @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
|
* @default_uri: The URI of the folder to be selected by default
|
||||||
* @allowed_types: List of the names of the allowed types
|
* @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.
|
* Construct @folder_selection_dialog.
|
||||||
**/
|
**/
|
||||||
@ -320,7 +326,8 @@ e_shell_folder_selection_dialog_construct (EShellFolderSelectionDialog *folder_s
|
|||||||
const char *title,
|
const char *title,
|
||||||
const char *caption,
|
const char *caption,
|
||||||
const char *default_uri,
|
const char *default_uri,
|
||||||
const char *allowed_types[])
|
const char *allowed_types[],
|
||||||
|
const char *default_type)
|
||||||
{
|
{
|
||||||
EShellFolderSelectionDialogPrivate *priv;
|
EShellFolderSelectionDialogPrivate *priv;
|
||||||
GtkWidget *scroll_frame;
|
GtkWidget *scroll_frame;
|
||||||
@ -335,6 +342,11 @@ e_shell_folder_selection_dialog_construct (EShellFolderSelectionDialog *folder_s
|
|||||||
|
|
||||||
priv = folder_selection_dialog->priv;
|
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. */
|
/* Basic dialog setup. */
|
||||||
|
|
||||||
gtk_window_set_policy (GTK_WINDOW (folder_selection_dialog), TRUE, TRUE, FALSE);
|
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 *title,
|
||||||
const char *caption,
|
const char *caption,
|
||||||
const char *default_uri,
|
const char *default_uri,
|
||||||
const char *allowed_types[])
|
const char *allowed_types[],
|
||||||
|
const char *default_type)
|
||||||
{
|
{
|
||||||
EShellFolderSelectionDialog *folder_selection_dialog;
|
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 ());
|
folder_selection_dialog = gtk_type_new (e_shell_folder_selection_dialog_get_type ());
|
||||||
e_shell_folder_selection_dialog_construct (folder_selection_dialog, shell,
|
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);
|
return GTK_WIDGET (folder_selection_dialog);
|
||||||
}
|
}
|
||||||
|
@ -65,12 +65,14 @@ void e_shell_folder_selection_dialog_construct (EShellFolderSele
|
|||||||
const char *title,
|
const char *title,
|
||||||
const char *caption,
|
const char *caption,
|
||||||
const char *default_uri,
|
const char *default_uri,
|
||||||
const char *allowed_types[]);
|
const char *allowed_types[],
|
||||||
|
const char *default_type);
|
||||||
GtkWidget *e_shell_folder_selection_dialog_new (EShell *shell,
|
GtkWidget *e_shell_folder_selection_dialog_new (EShell *shell,
|
||||||
const char *title,
|
const char *title,
|
||||||
const char *caption,
|
const char *caption,
|
||||||
const char *default_uri,
|
const char *default_uri,
|
||||||
const char *allowed_types[]);
|
const char *allowed_types[],
|
||||||
|
const char *default_type);
|
||||||
|
|
||||||
void e_shell_folder_selection_dialog_set_allow_creation (EShellFolderSelectionDialog *folder_selection_dialog,
|
void e_shell_folder_selection_dialog_set_allow_creation (EShellFolderSelectionDialog *folder_selection_dialog,
|
||||||
gboolean allow_creation);
|
gboolean allow_creation);
|
||||||
|
@ -549,7 +549,7 @@ static ImportDialogFilePage *
|
|||||||
importer_file_page_new (ImportData *data)
|
importer_file_page_new (ImportData *data)
|
||||||
{
|
{
|
||||||
ImportDialogFilePage *page;
|
ImportDialogFilePage *page;
|
||||||
GtkWidget *table, *label;
|
GtkWidget *table, *label, *widget;
|
||||||
int row = 0;
|
int row = 0;
|
||||||
|
|
||||||
page = g_new0 (ImportDialogFilePage, 1);
|
page = g_new0 (ImportDialogFilePage, 1);
|
||||||
@ -586,9 +586,9 @@ importer_file_page_new (ImportData *data)
|
|||||||
page->filetype = gtk_option_menu_new ();
|
page->filetype = gtk_option_menu_new ();
|
||||||
page->menu = create_plugin_menu (data);
|
page->menu = create_plugin_menu (data);
|
||||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (page->filetype), page->menu);
|
gtk_option_menu_set_menu (GTK_OPTION_MENU (page->filetype), page->menu);
|
||||||
|
|
||||||
gtk_table_attach (GTK_TABLE (table), page->filetype, 1, 2,
|
gtk_table_attach (GTK_TABLE (table), page->filetype, 1, 2,
|
||||||
row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
|
row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
|
||||||
|
|
||||||
gtk_widget_show_all (table);
|
gtk_widget_show_all (table);
|
||||||
|
|
||||||
return page;
|
return page;
|
||||||
@ -645,7 +645,7 @@ import_druid_finish (GnomeDruidPage *page,
|
|||||||
_("Select folder"),
|
_("Select folder"),
|
||||||
_("Select a destination folder for importing this data"),
|
_("Select a destination folder for importing this data"),
|
||||||
e_shell_view_get_current_uri (data->view),
|
e_shell_view_get_current_uri (data->view),
|
||||||
NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (folder), "folder_selected",
|
gtk_signal_connect (GTK_OBJECT (folder), "folder_selected",
|
||||||
GTK_SIGNAL_FUNC (folder_selected), data);
|
GTK_SIGNAL_FUNC (folder_selected), data);
|
||||||
|
@ -309,6 +309,7 @@ command_new_folder (BonoboUIComponent *uih,
|
|||||||
|
|
||||||
e_shell_show_folder_creation_dialog (shell, GTK_WINDOW (shell_view),
|
e_shell_show_folder_creation_dialog (shell, GTK_WINDOW (shell_view),
|
||||||
get_path_for_folder_op (shell_view),
|
get_path_for_folder_op (shell_view),
|
||||||
|
NULL,
|
||||||
NULL /* result_callback */,
|
NULL /* result_callback */,
|
||||||
NULL /* result_callback_data */);
|
NULL /* result_callback_data */);
|
||||||
}
|
}
|
||||||
@ -441,7 +442,7 @@ command_goto_folder (BonoboUIComponent *uih,
|
|||||||
_("Go to folder..."),
|
_("Go to folder..."),
|
||||||
_("Select the folder that you want to open"),
|
_("Select the folder that you want to open"),
|
||||||
current_uri,
|
current_uri,
|
||||||
NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
gtk_window_set_transient_for (GTK_WINDOW (folder_selection_dialog), GTK_WINDOW (shell_view));
|
gtk_window_set_transient_for (GTK_WINDOW (folder_selection_dialog), GTK_WINDOW (shell_view));
|
||||||
|
|
||||||
@ -562,7 +563,7 @@ command_new_shortcut (BonoboUIComponent *uih,
|
|||||||
_("Create a new shortcut"),
|
_("Create a new shortcut"),
|
||||||
_("Select the folder you want the shortcut to point to:"),
|
_("Select the folder you want the shortcut to point to:"),
|
||||||
e_shell_view_get_current_uri (shell_view),
|
e_shell_view_get_current_uri (shell_view),
|
||||||
NULL);
|
NULL, NULL);
|
||||||
e_shell_folder_selection_dialog_set_allow_creation (E_SHELL_FOLDER_SELECTION_DIALOG (folder_selection_dialog),
|
e_shell_folder_selection_dialog_set_allow_creation (E_SHELL_FOLDER_SELECTION_DIALOG (folder_selection_dialog),
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
|
@ -375,6 +375,7 @@ impl_Shell_selectUserFolder (PortableServer_Servant servant,
|
|||||||
const CORBA_char *title,
|
const CORBA_char *title,
|
||||||
const CORBA_char *default_folder,
|
const CORBA_char *default_folder,
|
||||||
const GNOME_Evolution_Shell_FolderTypeNameList *corba_allowed_type_names,
|
const GNOME_Evolution_Shell_FolderTypeNameList *corba_allowed_type_names,
|
||||||
|
const CORBA_char *default_type,
|
||||||
CORBA_Environment *ev)
|
CORBA_Environment *ev)
|
||||||
{
|
{
|
||||||
GtkWidget *folder_selection_dialog;
|
GtkWidget *folder_selection_dialog;
|
||||||
@ -402,7 +403,8 @@ impl_Shell_selectUserFolder (PortableServer_Servant servant,
|
|||||||
title,
|
title,
|
||||||
NULL,
|
NULL,
|
||||||
default_folder,
|
default_folder,
|
||||||
allowed_type_names);
|
allowed_type_names,
|
||||||
|
default_type);
|
||||||
|
|
||||||
listener_duplicate = CORBA_Object_duplicate (listener, ev);
|
listener_duplicate = CORBA_Object_duplicate (listener, ev);
|
||||||
gtk_object_set_data_full (GTK_OBJECT (folder_selection_dialog), "corba_listener",
|
gtk_object_set_data_full (GTK_OBJECT (folder_selection_dialog), "corba_listener",
|
||||||
|
@ -233,7 +233,7 @@ user_select_folder (EvolutionShellClient *shell_client,
|
|||||||
|
|
||||||
GNOME_Evolution_Shell_selectUserFolder (corba_shell, listener_interface,
|
GNOME_Evolution_Shell_selectUserFolder (corba_shell, listener_interface,
|
||||||
title, default_folder, &corba_type_name_list,
|
title, default_folder, &corba_type_name_list,
|
||||||
&ev);
|
"", &ev);
|
||||||
|
|
||||||
if (ev._major != CORBA_NO_EXCEPTION) {
|
if (ev._major != CORBA_NO_EXCEPTION) {
|
||||||
CORBA_exception_free (&ev);
|
CORBA_exception_free (&ev);
|
||||||
|
Reference in New Issue
Block a user