diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2001-08-20 12:42:04 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2001-08-20 12:42:04 +0800 |
commit | d9ed7a6a6366e5b47341c31409f4ac0f12aca690 (patch) | |
tree | 49f414492082b291156a8de6558b25f4dc3794f5 /shell/e-shell-folder-creation-dialog.c | |
parent | 5ab5cd2560b80b34432173508bed44d8fbc03b5f (diff) | |
download | gsoc2013-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-shell-folder-creation-dialog.c')
-rw-r--r-- | shell/e-shell-folder-creation-dialog.c | 53 |
1 files changed, 44 insertions, 9 deletions
diff --git a/shell/e-shell-folder-creation-dialog.c b/shell/e-shell-folder-creation-dialog.c index 6cc5138e8e..52b66d742e 100644 --- a/shell/e-shell-folder-creation-dialog.c +++ b/shell/e-shell-folder-creation-dialog.c @@ -340,6 +340,23 @@ add_storage_set_view (GtkWidget *dialog, return storage_set_view; } +struct _TypeWithDisplayName { + const char *type; + const char *display_name; +}; +typedef struct _TypeWithDisplayName TypeWithDisplayName; + +static int +type_with_display_name_compare_func (const void *a, const void *b) +{ + const TypeWithDisplayName *val_a, *val_b; + + val_a = (const TypeWithDisplayName *) a; + val_b = (const TypeWithDisplayName *) b; + + return g_strcasecmp (val_a->display_name, val_b->display_name); +} + static GList * add_folder_types (GtkWidget *dialog, GladeXML *gui, @@ -349,6 +366,7 @@ add_folder_types (GtkWidget *dialog, GtkWidget *folder_type_option_menu; GtkWidget *menu; GList *folder_types; + GList *types_with_display_names; GList *p; int default_item; int i; @@ -374,31 +392,48 @@ add_folder_types (GtkWidget *dialog, if (folder_types == NULL) return NULL; /* Uh? */ - folder_types = g_list_sort (folder_types, (GCompareFunc) g_strcasecmp); + types_with_display_names = NULL; + for (p = folder_types; p != NULL; p = p->next) { + TypeWithDisplayName *new; + + new = g_new (TypeWithDisplayName, 1); + new->type = g_strdup ((const char *) p->data); + new->display_name = e_folder_type_registry_get_display_name_for_type (folder_type_registry, new->type); + + types_with_display_names = g_list_prepend (types_with_display_names, new); + } + + types_with_display_names = g_list_sort (types_with_display_names, type_with_display_name_compare_func); - /* FIXME: Use descriptive name (not in the registry's implementation yet). */ /* FIXME: Add icon (I don't feel like writing an alpha-capable thingie again). */ default_item = 0; - for (p = folder_types, i = 0; p != NULL; p = p->next, i++) { - const char *type_name; + i = 0; + for (p = types_with_display_names; p != NULL; p = p->next) { + const TypeWithDisplayName *type; GtkWidget *menu_item; - type_name = (const char *) p->data; + type = (const TypeWithDisplayName *) p->data; - if (! e_folder_type_registry_type_is_user_creatable (folder_type_registry, type_name)) + if (! e_folder_type_registry_type_is_user_creatable (folder_type_registry, type->type)) continue; - menu_item = gtk_menu_item_new_with_label (type_name); + menu_item = gtk_menu_item_new_with_label (type->display_name); gtk_widget_show (menu_item); gtk_menu_append (GTK_MENU (menu), menu_item); - gtk_object_set_data (GTK_OBJECT (menu_item), "folder_type", (void *) type_name); + gtk_object_set_data (GTK_OBJECT (menu_item), "folder_type", (void *) type->type); - if (strcmp (type_name, "mail") == 0) + if (strcmp (type->type, "mail") == 0) default_item = i; + + i ++; } + for (p = types_with_display_names; p != NULL; p = p->next) + g_free (p->data); + g_list_free (types_with_display_names); + gtk_option_menu_set_menu (GTK_OPTION_MENU (folder_type_option_menu), menu); gtk_widget_show (menu); |