From 7189f01908c33ad05a462c40c5979b289c3f94ec Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Tue, 2 Jul 2002 15:04:14 +0000 Subject: New arg @tooltip; pass it to * gui/component/addressbook-component.c (add_creatable_item): New arg @tooltip; pass it to evolution_shell_component_add_user_creatable_item() [which now has a @tooltip arg]. * gui/component-factory.c (add_creatable_item): New arg @tooltip. Pass it to evolution_shell_component_add_user_creatable_item(), which now has a @tooltip arg. (create_object): Added tooltips. * component-factory.c (create_component): Pass a tooltip to evolution_shell_component_add_user_creatable_item. * e-shell-user-creatable-items-handler.c: New member tooltip in struct MenuItem. (ensure_menu_items): Initialize the tooltip member. (shell_view_view_changed_callback): Set the tooltip for the "New" button. (ensure_menu_xml): Set up the tooltip here as well. * evolution-shell-component.c: Add tooltip member to struct UserCreatableItemType. (user_creatable_item_type_new): New arg @tooltip. (evolution_shell_component_add_user_creatable_item): New arg @tooltip. (impl__get_userCreatableItemTypes): Put the tooltip in the struct as well. * e-shell-user-creatable-items-handler.c (setup_toolbar_button): Create a GtkTooltips object and attach it to the combo_button using gtk_object_set_data(). (shell_view_view_changed_callback): Set up a tooltip for the button, according to the default. * Evolution-ShellComponent.idl: Add a tooltip member to struct UserCreatableItemType. svn path=/trunk/; revision=17343 --- addressbook/ChangeLog | 7 ++++++ addressbook/gui/component/addressbook-component.c | 8 +++++-- calendar/ChangeLog | 7 ++++++ calendar/gui/calendar-component.c | 6 ++++++ calendar/gui/component-factory.c | 6 ++++++ mail/ChangeLog | 5 +++++ mail/component-factory.c | 3 ++- shell/ChangeLog | 26 +++++++++++++++++++++++ shell/Evolution-ShellComponent.idl | 1 + shell/e-shell-user-creatable-items-handler.c | 20 ++++++++++++++++- shell/evolution-shell-component.c | 7 +++++- shell/evolution-shell-component.h | 1 + shell/evolution-test-component.c | 12 ++++++++--- 13 files changed, 101 insertions(+), 8 deletions(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index a0e3fcbbef..3c26705674 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,10 @@ +2002-07-02 Ettore Perazzoli + + * gui/component/addressbook-component.c (add_creatable_item): New + arg @tooltip; pass it to + evolution_shell_component_add_user_creatable_item() [which now has + a @tooltip arg]. + 2002-06-29 Chris Toshok * backend/pas/Makefile.am (libpas_a_SOURCES): add diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c index acfdad8128..7e2d40583d 100644 --- a/addressbook/gui/component/addressbook-component.c +++ b/addressbook/gui/component/addressbook-component.c @@ -527,6 +527,7 @@ add_creatable_item (EvolutionShellComponent *shell_component, const char *id, const char *description, const char *menu_description, + const char *tooltip, char menu_shortcut, const char *icon_name) { @@ -545,6 +546,7 @@ add_creatable_item (EvolutionShellComponent *shell_component, id, description, menu_description, + tooltip, menu_shortcut, icon); @@ -575,10 +577,12 @@ create_component (void) BONOBO_OBJECT (destination_interface)); add_creatable_item (shell_component, "contact_list", - _("New Contact List"), _("Contact _List"), 'l', + _("New Contact List"), _("Contact _List"), + _("Create a new contact list"), 'l', "all_contacts.xpm"); add_creatable_item (shell_component, "contact", - _("New Contact"), _("_Contact"), 'c', + _("New Contact"), _("_Contact"), + _("Create a new contact"), 'c', "evolution-contacts-mini.png"); gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set", diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 9f7d80d2bb..637d158ad9 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,10 @@ +2002-07-02 Ettore Perazzoli + + * gui/component-factory.c (add_creatable_item): New arg @tooltip. + Pass it to evolution_shell_component_add_user_creatable_item(), + which now has a @tooltip arg. + (create_object): Added tooltips. + 2002-07-01 JP Rosevear * gui/calendar-config.c (config_read): listen for timezone config diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index 71c52f9c7c..9c23a62899 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -645,6 +645,7 @@ add_creatable_item (EvolutionShellComponent *shell_component, const char *id, const char *description, const char *menu_description, + const char *tooltip, char menu_shortcut, const char *icon_name) { @@ -663,6 +664,7 @@ add_creatable_item (EvolutionShellComponent *shell_component, id, description, menu_description, + tooltip, menu_shortcut, icon); @@ -702,18 +704,22 @@ create_object (void) add_creatable_item (shell_component, CREATE_MEETING_ID, _("New meeting"), _("_Meeting"), + _("Create a new meeting request"), 's', "meeting-request.png"); add_creatable_item (shell_component, CREATE_TASK_ID, _("New task"), _("_Task"), + _("Create a new task"), 't', "new_task-16.png"); add_creatable_item (shell_component, CREATE_ALLDAY_EVENT_ID, _("New All Day Appointment"), _("All _Day Appointment"), + _("Create a new all-day appointment"), 'd', "new_all_day_event.png"); add_creatable_item (shell_component, CREATE_EVENT_ID, _("New appointment"), _("_Appointment"), + _("Create a new appointment"), 'a', "new_appointment.xpm"); gtk_signal_connect (GTK_OBJECT (shell_component), "user_create_new_item", diff --git a/calendar/gui/component-factory.c b/calendar/gui/component-factory.c index 71c52f9c7c..9c23a62899 100644 --- a/calendar/gui/component-factory.c +++ b/calendar/gui/component-factory.c @@ -645,6 +645,7 @@ add_creatable_item (EvolutionShellComponent *shell_component, const char *id, const char *description, const char *menu_description, + const char *tooltip, char menu_shortcut, const char *icon_name) { @@ -663,6 +664,7 @@ add_creatable_item (EvolutionShellComponent *shell_component, id, description, menu_description, + tooltip, menu_shortcut, icon); @@ -702,18 +704,22 @@ create_object (void) add_creatable_item (shell_component, CREATE_MEETING_ID, _("New meeting"), _("_Meeting"), + _("Create a new meeting request"), 's', "meeting-request.png"); add_creatable_item (shell_component, CREATE_TASK_ID, _("New task"), _("_Task"), + _("Create a new task"), 't', "new_task-16.png"); add_creatable_item (shell_component, CREATE_ALLDAY_EVENT_ID, _("New All Day Appointment"), _("All _Day Appointment"), + _("Create a new all-day appointment"), 'd', "new_all_day_event.png"); add_creatable_item (shell_component, CREATE_EVENT_ID, _("New appointment"), _("_Appointment"), + _("Create a new appointment"), 'a', "new_appointment.xpm"); gtk_signal_connect (GTK_OBJECT (shell_component), "user_create_new_item", diff --git a/mail/ChangeLog b/mail/ChangeLog index 4d382ffcd8..8177542ec0 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2002-07-02 Ettore Perazzoli + + * component-factory.c (create_component): Pass a tooltip to + evolution_shell_component_add_user_creatable_item. + 2002-07-02 Sean Atkinson * mail-preferences.c: remove dependency on removed file diff --git a/mail/component-factory.c b/mail/component-factory.c index b514bedcb5..0acc04561e 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -995,7 +995,8 @@ create_component (void) new_mail_icon = gdk_pixbuf_new_from_file (EVOLUTION_ICONSDIR "/new-message.xpm"); evolution_shell_component_add_user_creatable_item (shell_component, "message", - _("New Mail Message"), _("_Mail Message"), 'm', + _("New Mail Message"), _("_Mail Message"), + _("Compose a new mail message"), 'm', new_mail_icon); if (new_mail_icon != NULL) gdk_pixbuf_unref (new_mail_icon); diff --git a/shell/ChangeLog b/shell/ChangeLog index 4e5fedf68a..2257a5036b 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,29 @@ +2002-07-02 Ettore Perazzoli + + * e-shell-user-creatable-items-handler.c: New member tooltip in + struct MenuItem. + (ensure_menu_items): Initialize the tooltip member. + (shell_view_view_changed_callback): Set the tooltip for the "New" + button. + (ensure_menu_xml): Set up the tooltip here as well. + + * evolution-shell-component.c: Add tooltip member to struct + UserCreatableItemType. + (user_creatable_item_type_new): New arg @tooltip. + (evolution_shell_component_add_user_creatable_item): New arg + @tooltip. + (impl__get_userCreatableItemTypes): Put the tooltip in the struct + as well. + + * e-shell-user-creatable-items-handler.c (setup_toolbar_button): + Create a GtkTooltips object and attach it to the combo_button + using gtk_object_set_data(). + (shell_view_view_changed_callback): Set up a tooltip for the + button, according to the default. + + * Evolution-ShellComponent.idl: Add a tooltip member to struct + UserCreatableItemType. + 2002-07-01 Ettore Perazzoli * e-shell.c (e_shell_prepare_for_quit): Remove debugging message. diff --git a/shell/Evolution-ShellComponent.idl b/shell/Evolution-ShellComponent.idl index dabfbf178d..18118b4359 100644 --- a/shell/Evolution-ShellComponent.idl +++ b/shell/Evolution-ShellComponent.idl @@ -39,6 +39,7 @@ module Evolution { string id; string description; string menuDescription; + string tooltip; char menuShortcut; Icon icon; }; diff --git a/shell/e-shell-user-creatable-items-handler.c b/shell/e-shell-user-creatable-items-handler.c index 745b651e86..d04b17bfe3 100644 --- a/shell/e-shell-user-creatable-items-handler.c +++ b/shell/e-shell-user-creatable-items-handler.c @@ -39,6 +39,7 @@ #include #include +#include #include #include @@ -54,6 +55,7 @@ static GtkObjectClass *parent_class = NULL; #define SHELL_VIEW_KEY "EShellUserCreatableItemsHandler:shell_view" #define COMBO_BUTTON_WIDGET_KEY "EShellUserCreatableItemsHandler:combo_button" +#define TOOLTIPS_KEY "EShellUserCreatableItemsHandler:tooltips" struct _Component { EvolutionShellComponentClient *component_client; @@ -67,6 +69,7 @@ struct _MenuItem { const char *label; char shortcut; char *verb; + char *tooltip; GdkPixbuf *icon; }; typedef struct _MenuItem MenuItem; @@ -217,6 +220,7 @@ ensure_menu_items (EShellUserCreatableItemsHandler *handler) item->label = type->menuDescription; item->shortcut = type->menuShortcut; item->verb = create_verb_from_component_number_and_type_id (component_num, type->id); + item->tooltip = type->tooltip; if (strcmp (evolution_shell_component_client_get_id (component->component_client), EVOLUTION_MAIL_OAFIID) == 0 @@ -364,11 +368,11 @@ ensure_menu_xml (EShellUserCreatableItemsHandler *handler) for (p = priv->menu_items; p != NULL; p = p->next) { const MenuItem *item; char *encoded_label; + char *encoded_tooltip; item = (const MenuItem *) p->data; encoded_label = bonobo_ui_util_encode_str (item->label); - g_string_sprintfa (xml, "verb, item->verb, encoded_label); @@ -379,9 +383,13 @@ ensure_menu_xml (EShellUserCreatableItemsHandler *handler) g_string_sprintfa (xml, " pixtype=\"pixbuf\" pixname=\"%s\"", bonobo_ui_util_pixbuf_to_xml (item->icon)); + encoded_tooltip = bonobo_ui_util_encode_str (item->tooltip); + g_string_sprintfa (xml, " tip=\"%s\"", encoded_tooltip); + g_string_append (xml, "/> "); g_free (encoded_label); + g_free (encoded_tooltip); } g_string_append (xml, ""); @@ -526,6 +534,7 @@ setup_toolbar_button (EShellUserCreatableItemsHandler *handler, BonoboUIComponent *ui_component; GtkWidget *combo_button; GtkWidget *menu; + GtkTooltips *tooltips; BonoboControl *control; priv = handler->priv; @@ -550,6 +559,9 @@ setup_toolbar_button (EShellUserCreatableItemsHandler *handler, BONOBO_OBJREF (control), NULL); gtk_object_set_data (GTK_OBJECT (shell_view), COMBO_BUTTON_WIDGET_KEY, combo_button); + + tooltips = gtk_tooltips_new (); + gtk_object_set_data (GTK_OBJECT (combo_button), TOOLTIPS_KEY, tooltips); } @@ -568,6 +580,7 @@ shell_view_view_changed_callback (EShellView *shell_view, EShellUserCreatableItemsHandler *handler; EShellUserCreatableItemsHandlerPrivate *priv; GtkWidget *combo_button_widget; + GtkTooltips *tooltips; const MenuItem *default_menu_item; handler = E_SHELL_USER_CREATABLE_ITEMS_HANDLER (data); @@ -576,17 +589,22 @@ shell_view_view_changed_callback (EShellView *shell_view, combo_button_widget = gtk_object_get_data (GTK_OBJECT (shell_view), COMBO_BUTTON_WIDGET_KEY); g_assert (E_IS_COMBO_BUTTON (combo_button_widget)); + tooltips = gtk_object_get_data (GTK_OBJECT (combo_button_widget), TOOLTIPS_KEY); + g_assert (tooltips != NULL); + default_menu_item = get_default_action_for_view (handler, shell_view); if (default_menu_item == NULL) { gtk_widget_set_sensitive (combo_button_widget, FALSE); e_combo_button_set_label (E_COMBO_BUTTON (combo_button_widget), _("New")); e_combo_button_set_icon (E_COMBO_BUTTON (combo_button_widget), NULL); + gtk_tooltips_set_tip (tooltips, combo_button_widget, NULL, NULL); return; } gtk_widget_set_sensitive (combo_button_widget, TRUE); e_combo_button_set_icon (E_COMBO_BUTTON (combo_button_widget), default_menu_item->icon); + gtk_tooltips_set_tip (tooltips, combo_button_widget, default_menu_item->tooltip, NULL); } diff --git a/shell/evolution-shell-component.c b/shell/evolution-shell-component.c index d03d3ae185..cee0ee7f60 100644 --- a/shell/evolution-shell-component.c +++ b/shell/evolution-shell-component.c @@ -49,6 +49,7 @@ struct _UserCreatableItemType { char *id; char *description; char *menu_description; + char *tooltip; char menu_shortcut; GdkPixbuf *icon; }; @@ -96,6 +97,7 @@ static UserCreatableItemType * user_creatable_item_type_new (const char *id, const char *description, const char *menu_description, + const char *tooltip, char menu_shortcut, GdkPixbuf *icon) { @@ -105,6 +107,7 @@ user_creatable_item_type_new (const char *id, type->id = g_strdup (id); type->description = g_strdup (description); type->menu_description = g_strdup (menu_description); + type->tooltip = g_strdup (tooltip); type->menu_shortcut = menu_shortcut; if (icon == NULL) @@ -365,6 +368,7 @@ impl__get_userCreatableItemTypes (PortableServer_Servant servant, corba_type->id = CORBA_string_dup (type->id); 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->menuShortcut = type->menu_shortcut; e_store_corba_icon_from_pixbuf (type->icon, & corba_type->icon); @@ -1049,6 +1053,7 @@ evolution_shell_component_add_user_creatable_item (EvolutionShellComponent *she const char *id, const char *description, const char *menu_description, + const char *tooltip, char menu_shortcut, GdkPixbuf *icon) { @@ -1063,7 +1068,7 @@ evolution_shell_component_add_user_creatable_item (EvolutionShellComponent *she priv = shell_component->priv; - type = user_creatable_item_type_new (id, description, menu_description, menu_shortcut, icon); + type = user_creatable_item_type_new (id, description, menu_description, tooltip, menu_shortcut, icon); priv->user_creatable_item_types = g_slist_prepend (priv->user_creatable_item_types, type); } diff --git a/shell/evolution-shell-component.h b/shell/evolution-shell-component.h index 8cd1f98d96..a38f87eb99 100644 --- a/shell/evolution-shell-component.h +++ b/shell/evolution-shell-component.h @@ -193,6 +193,7 @@ void evolution_shell_component_add_user_creatable_item (EvolutionShellComponen const char *id, const char *description, const char *menu_description, + const char *tooltip, char menu_shortcut, GdkPixbuf *icon); diff --git a/shell/evolution-test-component.c b/shell/evolution-test-component.c index 98227d67b3..a091499ee7 100644 --- a/shell/evolution-test-component.c +++ b/shell/evolution-test-component.c @@ -581,11 +581,17 @@ register_component (void) GTK_SIGNAL_FUNC (owner_unset_callback), NULL); evolution_shell_component_add_user_creatable_item (shell_component, "Stuff", - "New Stuff", "New _Stuff", '\0', NULL); + "New Stuff", "New _Stuff", + "Create some new stuff", + '\0', NULL); evolution_shell_component_add_user_creatable_item (shell_component, "MoreStuff", - "New More Stuff", "New _More Stuff", 'n', NULL); + "New More Stuff", "New _More Stuff", + "Create more stuff", + 'n', NULL); evolution_shell_component_add_user_creatable_item (shell_component, "FolderSelector", - "Folder Selector", "New Folder _Selector", 's', NULL); + "Folder Selector", "New Folder _Selector", + "Show a folder selector", + 's', NULL); gtk_signal_connect (GTK_OBJECT (shell_component), "user_create_new_item", GTK_SIGNAL_FUNC (user_create_new_item_callback), NULL); -- cgit v1.2.3