From 4eb4ae3be83fcc187ac0ca3bd104a14ceeb0786f Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Wed, 23 Jan 2002 22:21:24 +0000 Subject: [Implement an Outlook-style "New" dropdown button. It is basically done but it needs pretty icons so I am leaving it disabled for now.] * e-combo-button.c: Remove member `separator' from `EComboButtonPrivate'. New members `icon', `label'. (init): There shall be no separator no more. Init `icon' and `label' to %NULL. (e_combo_button_construct): Set no relief. (e_combo_button_new): Don't get a @menu arg anymore. (e_combo_button_construct): Likewise. (e_combo_button_set_icon): New. (e_combo_button_set_label): New. (e_combo_button_set_menu): New. (impl_clicked): New, overriding the "clicked" method for GtkButton. (class_init): Install. (impl_button_release_event): Removed. (class_init): No need to override ::release_event with this anymore. (impl_released): New, override for the GtkButton::released method. (class_init): Install. * e-shell-user-creatable-items-handler.c: New member `id' in struct `Component'. New member `icon' in struct `MenuItem'. (component_free): Free ->id. (component_new): Renamed from `component_new_from_client'. Get an @id arg and set ->id accordingly. (e_shell_user_creatable_items_handler_add_component): New arg @id. Pass it to `component_new'. (e_shell_user_creatable_items_handler_setup_menus): New arg @current_component_id. (e_shell_user_creatable_items_handler_update_menus): New. (set_current_component): New helper function. (get_component_by_id): New helper function. (add_verbs): Renamed from `add_verbs_to_ui_component()'. Get a @shell_view instead of a @ui_component. Set the SHELL_VIEW_KEY on the ui_component of the shell_view to point to the shell_view itself. (ensure_menu_items): Set item->icon to NULL. (free_menu_items): Unref item->icon. (ensure_menu_xml): Set the icon as well. (get_default_action_for_view): New helper function. (find_menu_item_for_verb): New helper function. (shell_view_view_changed_callback): New callback, set up the label on the "New" button depending on the current component. (e_shell_user_creatable_items_handler_attach_menus): New. For now, do not display the toolbar button yet. (execute_verb): New helper function, splitting out code from `verb_fn'. (verb_fn): Use `execute_verb'. (combo_button_activate_default_callback): Callback for the "activate_default" signal on the EComboButton. (setup_toolbar_button): Connect. * evolution-shell-component.c: New member `icon' in `UserCreatableItemType'. (impl__get_userCreatableItemTypes): Put the ->icon in the corba_type as well. (user_creatable_item_type_new): Get a new @icon argument. (evolution_shell_component_add_user_creatable_item): New arg @icon. * Evolution-ShellComponent.idl: New member `icon' in struct `UserCreatableItemType'. * evolution-test-component.c (register_component): Pass a NULL @icon to `evolution_shell_component_add_user_creatable_item()'. * e-shell-view.c (class_init): Add the signal to the class. (e_shell_view_display_uri): Emit "view_changed". (e_shell_view_get_current_component_id): New. * evolution-shell-component-client.c: New member `id' in EvolutionShellComponentClientPrivate. (init): Init to NULL. (impl_destroy): Free. (evolution_shell_component_client_new_for_objref): Removed. (evolution_shell_component_client_construct): New arg @id. Initialize ->id from it. (evolution_shell_component_client_get_id): New. * e-shell-view.h: New signal "view_changed". * evolution-activity-client.c (create_icon_from_pixbuf): Removed. (create_corba_animated_icon_from_pixbuf_array): Removed. (evolution_activity_client_construct): Use `e_new_corba_animated_icon_from_pixbuf_array()' instead. svn path=/trunk/; revision=15438 --- shell/evolution-shell-component-client.c | 41 +++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'shell/evolution-shell-component-client.c') diff --git a/shell/evolution-shell-component-client.c b/shell/evolution-shell-component-client.c index 4b35e2ac7a..574b75ecc8 100644 --- a/shell/evolution-shell-component-client.c +++ b/shell/evolution-shell-component-client.c @@ -44,6 +44,8 @@ char *evolution_debug_log; static BonoboObjectClass *parent_class = NULL; struct _EvolutionShellComponentClientPrivate { + char *id; + EvolutionShellComponentClientCallback callback; void *callback_data; @@ -298,6 +300,8 @@ impl_destroy (GtkObject *object) shell_component_client = EVOLUTION_SHELL_COMPONENT_CLIENT (object); priv = shell_component_client->priv; + g_free (priv->id); + if (priv->callback != NULL) dispatch_callback (shell_component_client, EVOLUTION_SHELL_COMPONENT_INTERRUPTED); @@ -347,6 +351,8 @@ init (EvolutionShellComponentClient *shell_component_client) priv = g_new (EvolutionShellComponentClientPrivate, 1); + priv->id = NULL; + priv->listener_interface = CORBA_OBJECT_NIL; priv->listener_servant = NULL; @@ -365,12 +371,18 @@ init (EvolutionShellComponentClient *shell_component_client) void evolution_shell_component_client_construct (EvolutionShellComponentClient *shell_component_client, + const char *id, CORBA_Object corba_object) { + EvolutionShellComponentClientPrivate *priv; + g_return_if_fail (shell_component_client != NULL); g_return_if_fail (EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component_client)); g_return_if_fail (corba_object != CORBA_OBJECT_NIL); + priv = shell_component_client->priv; + priv->id = g_strdup (id); + bonobo_object_client_construct (BONOBO_OBJECT_CLIENT (shell_component_client), corba_object); } @@ -378,6 +390,7 @@ evolution_shell_component_client_construct (EvolutionShellComponentClient *shell EvolutionShellComponentClient * evolution_shell_component_client_new (const char *id) { + EvolutionShellComponentClient *new; CORBA_Environment ev; CORBA_Object corba_object; @@ -392,12 +405,6 @@ evolution_shell_component_client_new (const char *id) return NULL; } -#if 0 - ior = CORBA_ORB_object_to_string (bonobo_orb (), corba_object, &ev); - g_print ("--- %s %s\n", id, ior); - CORBA_free (ior); -#endif - CORBA_exception_free (&ev); if (corba_object == CORBA_OBJECT_NIL) { @@ -406,20 +413,26 @@ evolution_shell_component_client_new (const char *id) return NULL; } - return evolution_shell_component_client_new_for_objref (corba_object); + new = gtk_type_new (evolution_shell_component_client_get_type ()); + evolution_shell_component_client_construct (new, id, corba_object); + + return new; } -EvolutionShellComponentClient * -evolution_shell_component_client_new_for_objref (const GNOME_Evolution_ShellComponent objref) + +/* Properties. */ + +const char * +evolution_shell_component_client_get_id (EvolutionShellComponentClient *shell_component_client) { - EvolutionShellComponentClient *new; + EvolutionShellComponentClientPrivate *priv; - g_return_val_if_fail (objref != CORBA_OBJECT_NIL, NULL); + g_return_val_if_fail (shell_component_client != NULL, NULL); + g_return_val_if_fail (EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component_client), NULL); - new = gtk_type_new (evolution_shell_component_client_get_type ()); - evolution_shell_component_client_construct (new, objref); + priv = shell_component_client->priv; - return new; + return priv->id; } -- cgit