aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-folder-type-registry.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-08-20 12:42:04 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-08-20 12:42:04 +0800
commitd9ed7a6a6366e5b47341c31409f4ac0f12aca690 (patch)
tree49f414492082b291156a8de6558b25f4dc3794f5 /shell/e-folder-type-registry.c
parent5ab5cd2560b80b34432173508bed44d8fbc03b5f (diff)
downloadgsoc2013-evolution-d9ed7a6a6366e5b47341c31409f4ac0f12aca690.tar.gz
gsoc2013-evolution-d9ed7a6a6366e5b47341c31409f4ac0f12aca690.tar.zst
gsoc2013-evolution-d9ed7a6a6366e5b47341c31409f4ac0f12aca690.zip
Added display_name and description to the type.
* evolution-test-component.c: Added display_name and description to the type. * evolution-shell-component.c (impl__get_supported_types): Pass `display_name' and `description' here. (evolution_shell_component_construct): Likewise. * evolution-shell-component.h: New members `display_name', `description' in `EvolutionShellComponentFolderType'. * e-component-registry.c (register_type): New args @description and @display_name. Pass to `e_folder_type_registry_register_type()'. (register_component): Pass the values returned in the sequence from __get_supported_types. * e-folder-type-registry.c: New members `display_name' and `description' in `struct _FolderType'. (folder_type_new): New args @description and @display_name. Initialize the respective fields in the `FolderType' accordingly. (folder_type_free): Free `display_name' and `description'. (register_folder_type): New args @display_name, @description. (e_folder_type_registry_register_type): New args @display_name, @description. (e_folder_type_registry_get_description_for_type): New. (e_folder_type_registry_get_display_name_for_type): New. * Evolution-ShellComponent.idl: Added `display_name' and `description' fields to the `FolderType' struct. svn path=/trunk/; revision=12245
Diffstat (limited to 'shell/e-folder-type-registry.c')
-rw-r--r--shell/e-folder-type-registry.c60
1 files changed, 58 insertions, 2 deletions
diff --git a/shell/e-folder-type-registry.c b/shell/e-folder-type-registry.c
index ac520ff308..97fb7b4c25 100644
--- a/shell/e-folder-type-registry.c
+++ b/shell/e-folder-type-registry.c
@@ -41,6 +41,10 @@ static GtkObjectClass *parent_class = NULL;
struct _FolderType {
char *name;
char *icon_name;
+
+ char *display_name;
+ char *description;
+
gboolean user_creatable;
GList *exported_dnd_types; /* char * */
@@ -64,6 +68,8 @@ struct _EFolderTypeRegistryPrivate {
static FolderType *
folder_type_new (const char *name,
const char *icon_name,
+ const char *display_name,
+ const char *description,
gboolean user_creatable,
int num_exported_dnd_types,
const char **exported_dnd_types,
@@ -78,6 +84,9 @@ folder_type_new (const char *name,
new->name = g_strdup (name);
new->icon_name = g_strdup (icon_name);
+ new->display_name = g_strdup (display_name);
+ new->description = g_strdup (description);
+
new->user_creatable = user_creatable;
new->exported_dnd_types = NULL;
@@ -122,6 +131,8 @@ folder_type_free (FolderType *folder_type)
{
g_free (folder_type->name);
g_free (folder_type->icon_name);
+ g_free (folder_type->display_name);
+ g_free (folder_type->description);
if (folder_type->icon_pixbuf != NULL)
gdk_pixbuf_unref (folder_type->icon_pixbuf);
@@ -149,6 +160,8 @@ static gboolean
register_folder_type (EFolderTypeRegistry *folder_type_registry,
const char *name,
const char *icon_name,
+ const char *display_name,
+ const char *description,
gboolean user_creatable,
int num_exported_dnd_types,
const char **exported_dnd_types,
@@ -164,7 +177,9 @@ 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, user_creatable,
+ folder_type = folder_type_new (name, icon_name,
+ display_name, description,
+ 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);
@@ -279,6 +294,8 @@ gboolean
e_folder_type_registry_register_type (EFolderTypeRegistry *folder_type_registry,
const char *type_name,
const char *icon_name,
+ const char *display_name,
+ const char *description,
gboolean user_creatable,
int num_exported_dnd_types,
const char **exported_dnd_types,
@@ -290,7 +307,8 @@ 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, user_creatable,
+ return register_folder_type (folder_type_registry, type_name, icon_name,
+ display_name, description, user_creatable,
num_exported_dnd_types, exported_dnd_types,
num_accepted_dnd_types, accepted_dnd_types);
}
@@ -419,6 +437,44 @@ e_folder_type_registry_type_is_user_creatable (EFolderTypeRegistry *folder_type
return folder_type->user_creatable;
}
+const char *
+e_folder_type_registry_get_display_name_for_type (EFolderTypeRegistry *folder_type_registry,
+ const char *type_name)
+{
+ const FolderType *folder_type;
+
+ g_return_val_if_fail (folder_type_registry != NULL, NULL);
+ g_return_val_if_fail (E_IS_FOLDER_TYPE_REGISTRY (folder_type_registry), NULL);
+ g_return_val_if_fail (type_name != NULL, NULL);
+
+ folder_type = get_folder_type (folder_type_registry, type_name);
+ if (folder_type == NULL) {
+ g_warning ("e_folder_type_registry_type_get_display_name_for_type() -- Unknown type `%s'", type_name);
+ return FALSE;
+ }
+
+ return folder_type->display_name;
+}
+
+const char *
+e_folder_type_registry_get_description_for_type (EFolderTypeRegistry *folder_type_registry,
+ const char *type_name)
+{
+ const FolderType *folder_type;
+
+ g_return_val_if_fail (folder_type_registry != NULL, NULL);
+ g_return_val_if_fail (E_IS_FOLDER_TYPE_REGISTRY (folder_type_registry), NULL);
+ g_return_val_if_fail (type_name != NULL, NULL);
+
+ folder_type = get_folder_type (folder_type_registry, type_name);
+ if (folder_type == NULL) {
+ g_warning ("e_folder_type_registry_get_description_for_type() -- Unknown type `%s'", type_name);
+ return FALSE;
+ }
+
+ return folder_type->description;
+}
+
GList *
e_folder_type_registry_get_exported_dnd_types_for_type (EFolderTypeRegistry *folder_type_registry,