diff options
author | Iain Holmes <iain@src.gnome.org> | 2001-09-29 02:58:17 +0800 |
---|---|---|
committer | Iain Holmes <iain@src.gnome.org> | 2001-09-29 02:58:17 +0800 |
commit | e6ab5554d4fe16cc816d8751b0206291ffeeccc5 (patch) | |
tree | 8b6ea8acb7336b8e37db01bae9cd3ae10969753e | |
parent | 03dcbdb743e9fd4d8490f60830545a88e58776ef (diff) | |
download | gsoc2013-evolution-e6ab5554d4fe16cc816d8751b0206291ffeeccc5.tar.gz gsoc2013-evolution-e6ab5554d4fe16cc816d8751b0206291ffeeccc5.tar.zst gsoc2013-evolution-e6ab5554d4fe16cc816d8751b0206291ffeeccc5.zip |
Allow callers to set the default type of folder to be created.
svn path=/trunk/; revision=13220
-rw-r--r-- | shell/ChangeLog | 33 | ||||
-rw-r--r-- | shell/Evolution-Shell.idl | 3 | ||||
-rw-r--r-- | shell/e-shell-folder-commands.c | 5 | ||||
-rw-r--r-- | shell/e-shell-folder-creation-dialog.c | 37 | ||||
-rw-r--r-- | shell/e-shell-folder-creation-dialog.h | 1 | ||||
-rw-r--r-- | shell/e-shell-folder-selection-dialog.c | 19 | ||||
-rw-r--r-- | shell/e-shell-folder-selection-dialog.h | 6 | ||||
-rw-r--r-- | shell/e-shell-importer.c | 6 | ||||
-rw-r--r-- | shell/e-shell-view-menu.c | 5 | ||||
-rw-r--r-- | shell/e-shell.c | 4 | ||||
-rw-r--r-- | shell/evolution-shell-client.c | 2 |
11 files changed, 103 insertions, 18 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 7ef4e8e95b..e27da6ac5a 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -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> * e-shell-view-menu.c (DEFINE_UNIMPLEMENTED): Remove. diff --git a/shell/Evolution-Shell.idl b/shell/Evolution-Shell.idl index 7d8889b463..a7700c38d2 100644 --- a/shell/Evolution-Shell.idl +++ b/shell/Evolution-Shell.idl @@ -78,7 +78,8 @@ module Evolution { void selectUserFolder (in FolderSelectionListener listener, in string title, in string default_folder, - in FolderTypeNameList possible_types) + in FolderTypeNameList possible_types, + in string default_type) raises (NotReady, Busy); /** diff --git a/shell/e-shell-folder-commands.c b/shell/e-shell-folder-commands.c index 1f7b815ab6..7c8ad8316c 100644 --- a/shell/e-shell-folder-commands.c +++ b/shell/e-shell-folder-commands.c @@ -253,6 +253,7 @@ e_shell_command_create_new_folder (EShell *shell, /* FIXME: Should handle the result stuff. */ e_shell_show_folder_creation_dialog (shell, GTK_WINDOW (shell_view), e_shell_view_get_current_path (shell_view), + NULL /* Default type. Take it from parent */, NULL /* result_callback */, NULL /* result_callback_data */); } @@ -316,7 +317,7 @@ e_shell_command_copy_folder (EShell *shell, _("Copy folder"), caption, uri, - NULL); + NULL, NULL); g_free (caption); g_free (uri); @@ -363,7 +364,7 @@ e_shell_command_move_folder (EShell *shell, _("Move folder"), caption, uri, - NULL); + NULL, NULL); g_free (caption); g_free (uri); diff --git a/shell/e-shell-folder-creation-dialog.c b/shell/e-shell-folder-creation-dialog.c index 59d6468338..4f0878efc2 100644 --- a/shell/e-shell-folder-creation-dialog.c +++ b/shell/e-shell-folder-creation-dialog.c @@ -374,7 +374,8 @@ type_with_display_name_compare_func (const void *a, const void *b) static GList * add_folder_types (GtkWidget *dialog, GladeXML *gui, - EShell *shell) + EShell *shell, + const char *default_type) { EFolderTypeRegistry *folder_type_registry; 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); - if (strcmp (type->type, "mail") == 0) + if (strcmp (type->type, default_type ? default_type : "mail") == 0) default_item = i; i ++; @@ -457,6 +458,28 @@ add_folder_types (GtkWidget *dialog, 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 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, GtkWindow *parent_window, const char *default_parent_folder, + const char *default_type, EShellFolderCreationDialogCallback result_callback, void *result_callback_data) { @@ -490,7 +514,14 @@ e_shell_show_folder_creation_dialog (EShell *shell, setup_folder_name_entry (dialog, gui, shell); 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->dialog = dialog; diff --git a/shell/e-shell-folder-creation-dialog.h b/shell/e-shell-folder-creation-dialog.h index b9c1b6b979..155950d5f1 100644 --- a/shell/e-shell-folder-creation-dialog.h +++ b/shell/e-shell-folder-creation-dialog.h @@ -43,6 +43,7 @@ typedef void (* EShellFolderCreationDialogCallback) (EShell *shell, void e_shell_show_folder_creation_dialog (EShell *shell, GtkWindow *parent, const char *default_parent_folder, + const char *default_type, EShellFolderCreationDialogCallback result_callback, void *result_callback_data); 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); } diff --git a/shell/e-shell-folder-selection-dialog.h b/shell/e-shell-folder-selection-dialog.h index 7cf2ec259e..4a485f7364 100644 --- a/shell/e-shell-folder-selection-dialog.h +++ b/shell/e-shell-folder-selection-dialog.h @@ -65,12 +65,14 @@ void e_shell_folder_selection_dialog_construct (EShellFolderSele const char *title, const char *caption, 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, const char *title, const char *caption, 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, gboolean allow_creation); diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index b6981747d4..42de414c3b 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -549,7 +549,7 @@ static ImportDialogFilePage * importer_file_page_new (ImportData *data) { ImportDialogFilePage *page; - GtkWidget *table, *label; + GtkWidget *table, *label, *widget; int row = 0; page = g_new0 (ImportDialogFilePage, 1); @@ -586,9 +586,9 @@ importer_file_page_new (ImportData *data) page->filetype = gtk_option_menu_new (); page->menu = create_plugin_menu (data); gtk_option_menu_set_menu (GTK_OPTION_MENU (page->filetype), page->menu); - gtk_table_attach (GTK_TABLE (table), page->filetype, 1, 2, row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0); + gtk_widget_show_all (table); return page; @@ -645,7 +645,7 @@ import_druid_finish (GnomeDruidPage *page, _("Select folder"), _("Select a destination folder for importing this data"), e_shell_view_get_current_uri (data->view), - NULL); + NULL, NULL); gtk_signal_connect (GTK_OBJECT (folder), "folder_selected", GTK_SIGNAL_FUNC (folder_selected), data); diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c index f0c392e032..282c3424da 100644 --- a/shell/e-shell-view-menu.c +++ b/shell/e-shell-view-menu.c @@ -309,6 +309,7 @@ command_new_folder (BonoboUIComponent *uih, e_shell_show_folder_creation_dialog (shell, GTK_WINDOW (shell_view), get_path_for_folder_op (shell_view), + NULL, NULL /* result_callback */, NULL /* result_callback_data */); } @@ -441,7 +442,7 @@ command_goto_folder (BonoboUIComponent *uih, _("Go to folder..."), _("Select the folder that you want to open"), current_uri, - NULL); + NULL, NULL); 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"), _("Select the folder you want the shortcut to point to:"), 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), FALSE); diff --git a/shell/e-shell.c b/shell/e-shell.c index 17f5bc2c72..cb04e01249 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -375,6 +375,7 @@ impl_Shell_selectUserFolder (PortableServer_Servant servant, const CORBA_char *title, const CORBA_char *default_folder, const GNOME_Evolution_Shell_FolderTypeNameList *corba_allowed_type_names, + const CORBA_char *default_type, CORBA_Environment *ev) { GtkWidget *folder_selection_dialog; @@ -402,7 +403,8 @@ impl_Shell_selectUserFolder (PortableServer_Servant servant, title, NULL, default_folder, - allowed_type_names); + allowed_type_names, + default_type); listener_duplicate = CORBA_Object_duplicate (listener, ev); gtk_object_set_data_full (GTK_OBJECT (folder_selection_dialog), "corba_listener", diff --git a/shell/evolution-shell-client.c b/shell/evolution-shell-client.c index 6b3f48e1f3..d71deff91f 100644 --- a/shell/evolution-shell-client.c +++ b/shell/evolution-shell-client.c @@ -233,7 +233,7 @@ user_select_folder (EvolutionShellClient *shell_client, GNOME_Evolution_Shell_selectUserFolder (corba_shell, listener_interface, title, default_folder, &corba_type_name_list, - &ev); + "", &ev); if (ev._major != CORBA_NO_EXCEPTION) { CORBA_exception_free (&ev); |