From 82f2740249a309e51d19a7e5d539f41b74fa6a36 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 25 Sep 2002 21:40:17 +0000 Subject: If one of the allowed types is "type/*", allow anything starting with * e-shell-folder-selection-dialog.c (check_folder_type_valid): If one of the allowed types is "type/*", allow anything starting with "type/". (impl_clicked): If the first allowed type is "type/*", pass "type" to e_shell_show_folder_creation_dialog. * evolution-folder-selector-button.c (evolution_folder_selector_button_set_uri): Handle "type/*" as an allowed type. * e-shell-settings-dialog.c (e_shell_settings_dialog_show_type): If there are no pages for the current folder type, try the parent type (eg, "mail" for "mail/public"). * e-shell-config-autocompletion.c (e_shell_config_autocompletion_create_widget): Use "contacts/*" as the allowed folder type. svn path=/trunk/; revision=18220 --- shell/ChangeLog | 20 ++++++++++++++++++++ shell/e-shell-config-autocompletion.c | 2 +- shell/e-shell-folder-selection-dialog.c | 23 ++++++++++++++--------- shell/e-shell-settings-dialog.c | 14 ++++++++++++-- shell/evolution-folder-selector-button.c | 8 ++++++++ 5 files changed, 55 insertions(+), 12 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index a73e173a70..1f50d73486 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,23 @@ +2002-09-25 Dan Winship + + * e-shell-folder-selection-dialog.c (check_folder_type_valid): + If one of the allowed types is "type/*", allow anything starting + with "type/". + (impl_clicked): If the first allowed type is "type/*", pass "type" + to e_shell_show_folder_creation_dialog. + + * evolution-folder-selector-button.c + (evolution_folder_selector_button_set_uri): Handle "type/*" as an + allowed type. + + * e-shell-settings-dialog.c (e_shell_settings_dialog_show_type): + If there are no pages for the current folder type, try the parent + type (eg, "mail" for "mail/public"). + + * e-shell-config-autocompletion.c + (e_shell_config_autocompletion_create_widget): Use "contacts/*" as + the allowed folder type. + 2002-09-25 Ettore Perazzoli [Finish fixing #11645.] diff --git a/shell/e-shell-config-autocompletion.c b/shell/e-shell-config-autocompletion.c index 71e48fbdd7..4627061248 100644 --- a/shell/e-shell-config-autocompletion.c +++ b/shell/e-shell-config-autocompletion.c @@ -87,7 +87,7 @@ e_shell_config_autocompletion_create_widget (EShell *shell, EvolutionConfigContr EvolutionAutocompletionConfig *ac; char *xml; CORBA_Environment ev; - static const char *possible_types[] = { "contacts", "ldap-contacts", NULL }; + static const char *possible_types[] = { "contacts/*", NULL }; ac = g_new0 (EvolutionAutocompletionConfig, 1); ac->db = e_shell_get_config_db (shell); diff --git a/shell/e-shell-folder-selection-dialog.c b/shell/e-shell-folder-selection-dialog.c index f4300a2dd0..62a9b2bb08 100644 --- a/shell/e-shell-folder-selection-dialog.c +++ b/shell/e-shell-folder-selection-dialog.c @@ -88,11 +88,15 @@ check_folder_type_valid (EShellFolderSelectionDialog *folder_selection_dialog) folder_type = e_folder_get_type_string (folder); for (p = priv->allowed_types; p != NULL; p = p->next) { - const char *type; + const char *type, *slash; type = (const char *) p->data; if (strcasecmp (folder_type, type) == 0) return TRUE; + slash = strchr (type, '/'); + if (slash && slash[1] == '*' && + g_strncasecmp (folder_type, type, slash - type) == 0) + return TRUE; } return FALSE; @@ -199,7 +203,8 @@ impl_clicked (GnomeDialog *dialog, EShellFolderSelectionDialogPrivate *priv; EStorageSetView *storage_set_view; const char *default_parent_folder; - const char *default_type; + const char *default_subtype; + char *default_type; folder_selection_dialog = E_SHELL_FOLDER_SELECTION_DIALOG (dialog); priv = folder_selection_dialog->priv; @@ -224,15 +229,19 @@ impl_clicked (GnomeDialog *dialog, 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; + default_type = g_strdup ("mail"); + else { + default_subtype = (const char *) priv->allowed_types->data; + default_type = g_strndup (default_subtype, + strcspn (default_subtype, "/")); + } e_shell_show_folder_creation_dialog (priv->shell, GTK_WINDOW (dialog), default_parent_folder, default_type, folder_creation_dialog_result_cb, dialog); + g_free (default_type); break; } @@ -316,16 +325,12 @@ double_click_cb (EStorageSetView *essv, GdkEvent *event, EShellFolderSelectionDialog *folder_selection_dialog) { - EShellFolderSelectionDialogPrivate *priv; - g_return_if_fail (folder_selection_dialog != NULL); - priv = folder_selection_dialog->priv; if (check_folder_type_valid (folder_selection_dialog)) { gtk_signal_emit (GTK_OBJECT (folder_selection_dialog), signals[FOLDER_SELECTED], e_shell_folder_selection_dialog_get_selected_path (folder_selection_dialog)); - gnome_dialog_close (GNOME_DIALOG (folder_selection_dialog)); } } diff --git a/shell/e-shell-settings-dialog.c b/shell/e-shell-settings-dialog.c index f0f5101d65..a00f55bfc6 100644 --- a/shell/e-shell-settings-dialog.c +++ b/shell/e-shell-settings-dialog.c @@ -341,7 +341,7 @@ void e_shell_settings_dialog_show_type (EShellSettingsDialog *dialog, const char *type) { EShellSettingsDialogPrivate *priv; - gpointer value; + gpointer key, value; int page; g_return_if_fail (dialog != NULL); @@ -350,7 +350,17 @@ e_shell_settings_dialog_show_type (EShellSettingsDialog *dialog, const char *typ priv = dialog->priv; - value = g_hash_table_lookup (priv->types, type); + if (!g_hash_table_lookup_extended (priv->types, type, &key, &value)) { + char *slash, *supertype; + + slash = strchr (type, '/'); + if (slash) { + supertype = g_strndup (type, slash - type); + value = g_hash_table_lookup (priv->types, type); + g_free (supertype); + } else + value = NULL; + } page = GPOINTER_TO_INT (value); e_multi_config_dialog_show_page (E_MULTI_CONFIG_DIALOG (dialog), page); diff --git a/shell/evolution-folder-selector-button.c b/shell/evolution-folder-selector-button.c index a3593b9693..35e24e7d82 100644 --- a/shell/evolution-folder-selector-button.c +++ b/shell/evolution-folder-selector-button.c @@ -358,6 +358,7 @@ evolution_folder_selector_button_set_uri (EvolutionFolderSelectorButton *folder_ { EvolutionFolderSelectorButtonPrivate *priv; GNOME_Evolution_Folder *folder; + char *slash; int i; g_return_val_if_fail (EVOLUTION_IS_FOLDER_SELECTOR_BUTTON (folder_selector_button), FALSE); @@ -379,6 +380,13 @@ evolution_folder_selector_button_set_uri (EvolutionFolderSelectorButton *folder_ set_folder (folder_selector_button, folder); return TRUE; } + slash = strchr (priv->possible_types[i], '/'); + if (slash && slash[1] == '*' && + !strncmp (folder->type, priv->possible_types[i], + slash - priv->possible_types[i])) { + set_folder (folder_selector_button, folder); + return TRUE; + } } CORBA_free (folder); -- cgit