aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2002-07-02 23:04:14 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2002-07-02 23:04:14 +0800
commit7189f01908c33ad05a462c40c5979b289c3f94ec (patch)
tree27d540f03af5393f6f154b8312b64e914265d390 /shell
parentb99e17ac5284983f620ca83b0d21d77fc82afdf4 (diff)
downloadgsoc2013-evolution-7189f01908c33ad05a462c40c5979b289c3f94ec.tar
gsoc2013-evolution-7189f01908c33ad05a462c40c5979b289c3f94ec.tar.gz
gsoc2013-evolution-7189f01908c33ad05a462c40c5979b289c3f94ec.tar.bz2
gsoc2013-evolution-7189f01908c33ad05a462c40c5979b289c3f94ec.tar.lz
gsoc2013-evolution-7189f01908c33ad05a462c40c5979b289c3f94ec.tar.xz
gsoc2013-evolution-7189f01908c33ad05a462c40c5979b289c3f94ec.tar.zst
gsoc2013-evolution-7189f01908c33ad05a462c40c5979b289c3f94ec.zip
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
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog26
-rw-r--r--shell/Evolution-ShellComponent.idl1
-rw-r--r--shell/e-shell-user-creatable-items-handler.c20
-rw-r--r--shell/evolution-shell-component.c7
-rw-r--r--shell/evolution-shell-component.h1
-rw-r--r--shell/evolution-test-component.c12
6 files changed, 62 insertions, 5 deletions
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 <ettore@ximian.com>
+
+ * 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 <ettore@ximian.com>
* 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 <libgnome/gnome-i18n.h>
#include <gtk/gtksignal.h>
+#include <gtk/gtktooltips.h>
#include <stdlib.h>
#include <ctype.h>
@@ -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, "<menuitem name=\"New:%s\" verb=\"%s\" label=\"%s\"",
item->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, "</placeholder>");
@@ -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);