Add a `user_creatable' property to folder types and make components

use it, so that e.g. you cannot create a folder of type "mailstorage"
or "vtrash".

svn path=/trunk/; revision=11298
This commit is contained in:
Ettore Perazzoli
2001-07-22 03:50:07 +00:00
parent 0110133071
commit ced2af3321
19 changed files with 110 additions and 18 deletions

View File

@ -1,3 +1,9 @@
2001-07-21 Ettore Perazzoli <ettore@ximian.com>
* gui/component/addressbook-component.c: Make the "contacts"
folders user-creatable by setting `user_creatable' to %TRUE in the
`EvolutionShellComponentFolderType's.
2001-07-18 Chris Toshok <toshok@ximian.com>
[ patch contributed by Jos Dehaes <jos.dehaes@bigfoot.com> ]

View File

@ -63,7 +63,7 @@ static char *accepted_dnd_types[] = {
};
static const EvolutionShellComponentFolderType folder_types[] = {
{ "contacts", "evolution-contacts.png", accepted_dnd_types, NULL },
{ "contacts", "evolution-contacts.png", TRUE, accepted_dnd_types, NULL },
{ NULL, NULL, NULL, NULL }
};

View File

@ -1,3 +1,9 @@
2001-07-21 Ettore Perazzoli <ettore@ximian.com>
* gui/component-factory.c: Make folders of type "calendar" and
"tasks" user-creatable by setting `user_creatable' to %TRUE in the
`EvolutionShellComponentFolderType's.
2001-07-19 Federico Mena Quintero <federico@ximian.com>
* gui/dialogs/event-editor.h (event_editor_update_widgets):

View File

@ -47,8 +47,8 @@ static BonoboGenericFactory *factory = NULL;
char *evolution_dir;
static const EvolutionShellComponentFolderType folder_types[] = {
{ "calendar", "evolution-calendar.png" },
{ "tasks", "evolution-tasks.png" },
{ "calendar", "evolution-calendar.png", TRUE, NULL, NULL },
{ "tasks", "evolution-tasks.png", TRUE, NULL, NULL },
{ NULL, NULL }
};

View File

@ -47,8 +47,8 @@ static BonoboGenericFactory *factory = NULL;
char *evolution_dir;
static const EvolutionShellComponentFolderType folder_types[] = {
{ "calendar", "evolution-calendar.png" },
{ "tasks", "evolution-tasks.png" },
{ "calendar", "evolution-calendar.png", TRUE, NULL, NULL },
{ "tasks", "evolution-tasks.png", TRUE, NULL, NULL },
{ NULL, NULL }
};

View File

@ -1,3 +1,9 @@
2001-07-21 Ettore Perazzoli <ettore@ximian.com>
* component/component-factory.c: Make the "executive-summary"
folders non-user-creatable by setting `user_creatable' to %FALSE
in the `EvolutionShellComponentFolderType's.
2001-06-18 Dan Winship <danw@ximian.com>
* test-service/Makefile.am (test_service_LDADD): Remove DB3_LDADD

View File

@ -44,7 +44,7 @@ static BonoboGenericFactory *factory = NULL;
static gint running_objects = 0;
static const EvolutionShellComponentFolderType folder_types[] = {
{ "executive-summary", "evolution-today.png" },
{ "executive-summary", "evolution-today.png", FALSE, NULL, NULL },
{ NULL, NULL }
};

View File

@ -1,3 +1,8 @@
2001-07-21 Ettore Perazzoli <ettore@ximian.com>
* component-factory.c: Make types "mailstorage" and "vtrash"
non-user-creatable.
2001-07-20 Jason Leach <jleach@ximian.com>
* mail-summary.c (generate_html_summary): Change this back to the

View File

@ -90,9 +90,9 @@ static char *exported_dnd_types[] = {
};
static const EvolutionShellComponentFolderType folder_types[] = {
{ "mail", "evolution-inbox.png", accepted_dnd_types, exported_dnd_types },
{ "mailstorage", "evolution-inbox.png", NULL, NULL },
{ "vtrash", "evolution-trash.png", accepted_dnd_types, exported_dnd_types },
{ "mail", "evolution-inbox.png", TRUE, accepted_dnd_types, exported_dnd_types },
{ "mailstorage", "evolution-inbox.png", FALSE, NULL, NULL },
{ "vtrash", "evolution-trash.png", FALSE, accepted_dnd_types, exported_dnd_types },
{ NULL, NULL, NULL, NULL }
};

View File

@ -1,3 +1,9 @@
2001-07-21 Ettore Perazzoli <ettore@ximian.com>
* component-factory.c: Make the "My Evolution" folder
non-creatable by setting the `user_creatable' member of
`EvolutionShellComponentFolderType' to %FALSE.
2001-07-20 Jason Leach <jleach@ximian.com>
* e-summary-tasks.c: Revert last changes, URIs are now back to

View File

@ -27,7 +27,7 @@
static gint running_objects = 0;
static const EvolutionShellComponentFolderType folder_types[] = {
{ "My Evolution", "evolution-today.png" },
{ "My Evolution", "evolution-today.png", FALSE, NULL, NULL },
{ NULL, NULL }
};

View File

@ -1,3 +1,30 @@
2001-07-21 Ettore Perazzoli <ettore@ximian.com>
* e-shell-folder-creation-dialog.c (add_folder_types): Only put
the types that are user-creatable in the folder type option menu.
* evolution-shell-component.c
(impl_ShellComponent__get_supported_types): Set the
`user_creatable' member too.
(evolution_shell_component_construct): Copy the `user_creatable'
member too.
* evolution-shell-component.h: New member `user_creatable' in
`EvolutionShellComponentFolderType'.
* e-component-registry.c (register_type): Pass the user_creatable
member of the CORBA FolderType struct.
* e-folder-type-registry.c: New member `user_creatable' in struct
FolderType.
(e_folder_type_registry_register_type): New arg @user_creatable.
(register_folder_type): Likewise.
(folder_type_new): Likewise.
(e_folder_type_registry_type_is_user_creatable): New.
* Evolution-ShellComponent.idl: New member `user_creatable' in
`struct FolderType'.
2001-07-21 Ettore Perazzoli <ettore@ximian.com>
* evolution-activity-client.c (impl_destroy): Use

View File

@ -18,6 +18,8 @@ module Evolution {
string name;
string icon_name;
boolean user_creatable;
sequence<string> accepted_dnd_types;
sequence<string> exported_dnd_types;
};

View File

@ -105,6 +105,7 @@ static gboolean
register_type (EComponentRegistry *component_registry,
const char *name,
const char *icon_name,
gboolean user_creatable,
int num_exported_dnd_types,
const char **exported_dnd_types,
int num_accepted_dnd_types,
@ -120,7 +121,7 @@ register_type (EComponentRegistry *component_registry,
g_assert (folder_type_registry != NULL);
if (! e_folder_type_registry_register_type (folder_type_registry,
name, icon_name,
name, icon_name, user_creatable,
num_exported_dnd_types,
exported_dnd_types,
num_accepted_dnd_types,
@ -188,7 +189,7 @@ register_component (EComponentRegistry *component_registry,
type = supported_types->_buffer + i;
if (! register_type (component_registry,
type->name, type->icon_name,
type->name, type->icon_name, type->user_creatable,
type->exported_dnd_types._length,
(const char **) type->exported_dnd_types._buffer,
type->accepted_dnd_types._length,

View File

@ -41,6 +41,7 @@ static GtkObjectClass *parent_class = NULL;
struct _FolderType {
char *name;
char *icon_name;
gboolean user_creatable;
GList *exported_dnd_types; /* char * */
GList *accepted_dnd_types; /* char * */
@ -63,6 +64,7 @@ struct _EFolderTypeRegistryPrivate {
static FolderType *
folder_type_new (const char *name,
const char *icon_name,
gboolean user_creatable,
int num_exported_dnd_types,
const char **exported_dnd_types,
int num_accepted_dnd_types,
@ -76,6 +78,7 @@ folder_type_new (const char *name,
new->name = g_strdup (name);
new->icon_name = g_strdup (icon_name);
new->user_creatable = user_creatable;
new->exported_dnd_types = NULL;
for (i = 0; i < num_exported_dnd_types; i++)
@ -146,6 +149,7 @@ static gboolean
register_folder_type (EFolderTypeRegistry *folder_type_registry,
const char *name,
const char *icon_name,
gboolean user_creatable,
int num_exported_dnd_types,
const char **exported_dnd_types,
int num_accepted_dnd_types,
@ -160,7 +164,7 @@ register_folder_type (EFolderTypeRegistry *folder_type_registry,
if (get_folder_type (folder_type_registry, name) != NULL)
return FALSE;
folder_type = folder_type_new (name, icon_name,
folder_type = folder_type_new (name, icon_name, user_creatable,
num_exported_dnd_types, exported_dnd_types,
num_accepted_dnd_types, accepted_dnd_types);
g_hash_table_insert (priv->name_to_type, folder_type->name, folder_type);
@ -275,6 +279,7 @@ gboolean
e_folder_type_registry_register_type (EFolderTypeRegistry *folder_type_registry,
const char *type_name,
const char *icon_name,
gboolean user_creatable,
int num_exported_dnd_types,
const char **exported_dnd_types,
int num_accepted_dnd_types,
@ -285,7 +290,7 @@ e_folder_type_registry_register_type (EFolderTypeRegistry *folder_type_registry,
g_return_val_if_fail (type_name != NULL, FALSE);
g_return_val_if_fail (icon_name != NULL, FALSE);
return register_folder_type (folder_type_registry, type_name, icon_name,
return register_folder_type (folder_type_registry, type_name, icon_name, user_creatable,
num_exported_dnd_types, exported_dnd_types,
num_accepted_dnd_types, accepted_dnd_types);
}
@ -395,6 +400,25 @@ e_folder_type_registry_get_handler_for_type (EFolderTypeRegistry *folder_type_re
return folder_type->handler;
}
gboolean
e_folder_type_registry_type_is_user_creatable (EFolderTypeRegistry *folder_type_registry,
const char *type_name)
{
const FolderType *folder_type;
g_return_val_if_fail (folder_type_registry != NULL, FALSE);
g_return_val_if_fail (E_IS_FOLDER_TYPE_REGISTRY (folder_type_registry), FALSE);
g_return_val_if_fail (type_name != NULL, FALSE);
folder_type = get_folder_type (folder_type_registry, type_name);
if (folder_type == NULL) {
g_warning ("e_folder_type_registry_type_is_user_creatable() -- Unknown type `%s'", type_name);
return FALSE;
}
return folder_type->user_creatable;
}
GList *
e_folder_type_registry_get_exported_dnd_types_for_type (EFolderTypeRegistry *folder_type_registry,

View File

@ -63,6 +63,7 @@ EFolderTypeRegistry *e_folder_type_registry_new (void);
gboolean e_folder_type_registry_register_type (EFolderTypeRegistry *folder_type_registry,
const char *type_name,
const char *icon_name,
gboolean user_creatable,
int num_exported_dnd_types,
const char **exported_dnd_types,
int num_accepted_dnd_types,
@ -80,6 +81,8 @@ const char *e_folder_type_registry_get_icon_name_for_type (E
const char *type_name);
EvolutionShellComponentClient *e_folder_type_registry_get_handler_for_type (EFolderTypeRegistry *folder_type_registry,
const char *type_name);
gboolean e_folder_type_registry_type_is_user_creatable (EFolderTypeRegistry *folder_type_registry,
const char *type_name);
GList *e_folder_type_registry_get_exported_dnd_types_for_type (EFolderTypeRegistry *folder_type_registry,
const char *type_name);

View File

@ -361,6 +361,9 @@ add_folder_types (GtkWidget *dialog,
type_name = (const char *) p->data;
if (! e_folder_type_registry_type_is_user_creatable (folder_type_registry, type_name))
continue;
menu_item = gtk_menu_item_new_with_label (type_name);
gtk_widget_show (menu_item);
gtk_menu_append (GTK_MENU (menu), menu_item);

View File

@ -158,6 +158,7 @@ impl_ShellComponent__get_supported_types (PortableServer_Servant servant,
corba_folder_type = folder_type_list->_buffer + i;
corba_folder_type->name = CORBA_string_dup (folder_type->name);
corba_folder_type->icon_name = CORBA_string_dup (folder_type->icon_name);
corba_folder_type->user_creatable = folder_type->user_creatable;
fill_corba_sequence_from_null_terminated_string_array (& corba_folder_type->accepted_dnd_types,
folder_type->accepted_dnd_types);
@ -617,6 +618,7 @@ evolution_shell_component_construct (EvolutionShellComponent *shell_component,
new = g_new (EvolutionShellComponentFolderType, 1);
new->name = g_strdup (folder_types[i].name);
new->icon_name = g_strdup (folder_types[i].icon_name);
new->user_creatable = folder_types[i].user_creatable;
new->accepted_dnd_types = duplicate_null_terminated_string_array (folder_types[i].accepted_dnd_types);
new->exported_dnd_types = duplicate_null_terminated_string_array (folder_types[i].exported_dnd_types);

View File

@ -107,6 +107,7 @@ typedef char * (* EvolutionShellComponentGetDndSelectionFn) (EvolutionShellCompo
struct _EvolutionShellComponentFolderType {
char *name;
char *icon_name;
gboolean user_creatable;
/* The following are NULL-terminated arrays. */
char **accepted_dnd_types;