From ec3f54257d3d3ddcd22779547f543ba9a9716f89 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Wed, 31 Jul 2002 20:36:16 +0000 Subject: Pass "contacts" as the @folder_type to * gui/component/addressbook-component.c (add_creatable_item): Pass "contacts" as the @folder_type to evolution_shell_component_add_user_creatable_item(). * gui/component-factory.c (add_creatable_item): New arg @folder_type, pass it to evolution_shell_component_add_user_creatable_item(). (create_object): Set the right folder types for the various user-creatable items. * component-factory.c (create_component): Pass "mail" as @folder_type to evolution_shell_component_add_user_creatable_item(). * evolution-test-component.c (register_component): Pass NULL for @folder_type to evolution_shell_component_add_user_creatable_item(). * e-shell-user-creatable-items-handler.c: New member folder_type in struct MenuItem. (ensure_menu_items): Initialize ->folder_type. (item_is_default): New helper function. (create_menu_xml): New arg @folder_type. Put the items on the top using item_is_default(). (shell_view_view_changed_callback): Pass the folder type to create_menu_xml(). * evolution-shell-component.c: New member folder_type in UserCreatableItemType. (user_creatable_item_type_new): New arg @folder_type. (user_creatable_item_type_free): Free ->folder_type. (evolution_shell_component_add_user_creatable_item): New arg @folder_type. (impl__get_userCreatableItemTypes): Set ->folderType in the returned CORBA structs. * Evolution-ShellComponent.idl: New member folderType in struct UserCreatableItemType. * e-shell-user-creatable-items-handler.c: New member component_id in struct MenuItem. Removed member menu_xml from EShellUserCreatableItemsHandlerPrivate. (init): No need to initialize menu_xml here anymore. (impl_destroy): ...And no need to free here, either. (setup_menu_xml): New, derived from ensure_menu_xml(). This orders the menu so that the items for the current component go at the top. (create_menu_xml): Removed. (e_shell_user_creatable_items_handler_attach_menus): Set up properly for the current component ID, using setup_menu_xml(). svn path=/trunk/; revision=17658 --- shell/evolution-shell-component.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'shell/evolution-shell-component.c') diff --git a/shell/evolution-shell-component.c b/shell/evolution-shell-component.c index cee0ee7f60..cfe318b610 100644 --- a/shell/evolution-shell-component.c +++ b/shell/evolution-shell-component.c @@ -52,6 +52,7 @@ struct _UserCreatableItemType { char *tooltip; char menu_shortcut; GdkPixbuf *icon; + char *folder_type; }; typedef struct _UserCreatableItemType UserCreatableItemType; @@ -98,6 +99,7 @@ user_creatable_item_type_new (const char *id, const char *description, const char *menu_description, const char *tooltip, + const char *folder_type, char menu_shortcut, GdkPixbuf *icon) { @@ -109,6 +111,7 @@ user_creatable_item_type_new (const char *id, type->menu_description = g_strdup (menu_description); type->tooltip = g_strdup (tooltip); type->menu_shortcut = menu_shortcut; + type->folder_type = g_strdup (folder_type); if (icon == NULL) type->icon = NULL; @@ -124,6 +127,7 @@ user_creatable_item_type_free (UserCreatableItemType *type) g_free (type->id); g_free (type->description); g_free (type->menu_description); + g_free (type->folder_type); if (type->icon != NULL) gdk_pixbuf_unref (type->icon); @@ -369,6 +373,7 @@ impl__get_userCreatableItemTypes (PortableServer_Servant servant, corba_type->description = CORBA_string_dup (type->description); corba_type->menuDescription = CORBA_string_dup (type->menu_description); corba_type->tooltip = CORBA_string_dup (type->tooltip != NULL ? type->tooltip : ""); + corba_type->folderType = CORBA_string_dup (type->folder_type != NULL ? type->folder_type : ""); corba_type->menuShortcut = type->menu_shortcut; e_store_corba_icon_from_pixbuf (type->icon, & corba_type->icon); @@ -1054,6 +1059,7 @@ evolution_shell_component_add_user_creatable_item (EvolutionShellComponent *she const char *description, const char *menu_description, const char *tooltip, + const char *folder_type, char menu_shortcut, GdkPixbuf *icon) { @@ -1068,7 +1074,7 @@ evolution_shell_component_add_user_creatable_item (EvolutionShellComponent *she priv = shell_component->priv; - type = user_creatable_item_type_new (id, description, menu_description, tooltip, menu_shortcut, icon); + type = user_creatable_item_type_new (id, description, menu_description, tooltip, folder_type, menu_shortcut, icon); priv->user_creatable_item_types = g_slist_prepend (priv->user_creatable_item_types, type); } -- cgit v1.2.3