aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-07-22 11:50:07 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-07-22 11:50:07 +0800
commitced2af332134dcdf783ef6d86d6f6ab8b948589b (patch)
treedfdd86946d12ac9d791cac635ff57faa6d7106ce /shell
parent01101330717eca3f06233281fa40eefa5293f378 (diff)
downloadgsoc2013-evolution-ced2af332134dcdf783ef6d86d6f6ab8b948589b.tar
gsoc2013-evolution-ced2af332134dcdf783ef6d86d6f6ab8b948589b.tar.gz
gsoc2013-evolution-ced2af332134dcdf783ef6d86d6f6ab8b948589b.tar.bz2
gsoc2013-evolution-ced2af332134dcdf783ef6d86d6f6ab8b948589b.tar.lz
gsoc2013-evolution-ced2af332134dcdf783ef6d86d6f6ab8b948589b.tar.xz
gsoc2013-evolution-ced2af332134dcdf783ef6d86d6f6ab8b948589b.tar.zst
gsoc2013-evolution-ced2af332134dcdf783ef6d86d6f6ab8b948589b.zip
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
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog27
-rw-r--r--shell/Evolution-ShellComponent.idl2
-rw-r--r--shell/e-component-registry.c5
-rw-r--r--shell/e-folder-type-registry.c32
-rw-r--r--shell/e-folder-type-registry.h3
-rw-r--r--shell/e-shell-folder-creation-dialog.c3
-rw-r--r--shell/evolution-shell-component.c6
-rw-r--r--shell/evolution-shell-component.h1
8 files changed, 71 insertions, 8 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 266a02140e..881bc24f0a 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,5 +1,32 @@
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
`g_source_remove()' instead of `gtk_timeout_remove()' here, as we
are using `g_timeout_add()' and not `gtk_timeout_add()' to set up
diff --git a/shell/Evolution-ShellComponent.idl b/shell/Evolution-ShellComponent.idl
index f2e7e22ee8..73110b5011 100644
--- a/shell/Evolution-ShellComponent.idl
+++ b/shell/Evolution-ShellComponent.idl
@@ -18,6 +18,8 @@ module Evolution {
string name;
string icon_name;
+ boolean user_creatable;
+
sequence<string> accepted_dnd_types;
sequence<string> exported_dnd_types;
};
diff --git a/shell/e-component-registry.c b/shell/e-component-registry.c
index b5df6601da..db957a6ea4 100644
--- a/shell/e-component-registry.c
+++ b/shell/e-component-registry.c
@@ -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,
diff --git a/shell/e-folder-type-registry.c b/shell/e-folder-type-registry.c
index ebd258b61e..ac520ff308 100644
--- a/shell/e-folder-type-registry.c
+++ b/shell/e-folder-type-registry.c
@@ -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,
@@ -74,8 +76,9 @@ folder_type_new (const char *name,
new = g_new (FolderType, 1);
- new->name = g_strdup (name);
- new->icon_name = g_strdup (icon_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,
diff --git a/shell/e-folder-type-registry.h b/shell/e-folder-type-registry.h
index 46d7f41442..1bcb87b3ac 100644
--- a/shell/e-folder-type-registry.h
+++ b/shell/e-folder-type-registry.h
@@ -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);
diff --git a/shell/e-shell-folder-creation-dialog.c b/shell/e-shell-folder-creation-dialog.c
index 5e6c5e5556..ea81bfdc58 100644
--- a/shell/e-shell-folder-creation-dialog.c
+++ b/shell/e-shell-folder-creation-dialog.c
@@ -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);
diff --git a/shell/evolution-shell-component.c b/shell/evolution-shell-component.c
index f9fd35a9f2..cf7de2354c 100644
--- a/shell/evolution-shell-component.c
+++ b/shell/evolution-shell-component.c
@@ -156,8 +156,9 @@ impl_ShellComponent__get_supported_types (PortableServer_Servant servant,
folder_type = (EvolutionShellComponentFolderType *) p->data;
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->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);
diff --git a/shell/evolution-shell-component.h b/shell/evolution-shell-component.h
index 190eb57a8d..28401826a0 100644
--- a/shell/evolution-shell-component.h
+++ b/shell/evolution-shell-component.h
@@ -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;