aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorPaolo Borelli <pborelli@katamail.com>2008-07-14 19:38:30 +0800
committerPaolo Borelli <pborelli@src.gnome.org>2008-07-14 19:38:30 +0800
commitc049cedd6969d77649db15b71f4ba112d4a2c065 (patch)
treeab42a98360f79974bcefa46a83cd3610aec1c6bf /shell
parent5dcc53160bfb1202e53fece360838f39646a6d09 (diff)
downloadgsoc2013-evolution-c049cedd6969d77649db15b71f4ba112d4a2c065.tar
gsoc2013-evolution-c049cedd6969d77649db15b71f4ba112d4a2c065.tar.gz
gsoc2013-evolution-c049cedd6969d77649db15b71f4ba112d4a2c065.tar.bz2
gsoc2013-evolution-c049cedd6969d77649db15b71f4ba112d4a2c065.tar.lz
gsoc2013-evolution-c049cedd6969d77649db15b71f4ba112d4a2c065.tar.xz
gsoc2013-evolution-c049cedd6969d77649db15b71f4ba112d4a2c065.tar.zst
gsoc2013-evolution-c049cedd6969d77649db15b71f4ba112d4a2c065.zip
** Fix for bug #542889
2008-17-14 Paolo Borelli <pborelli@katamail.com> ** Fix for bug #542889 Port to the new gtk tooltip api. svn path=/trunk/; revision=35744
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog9
-rw-r--r--shell/e-shell-window.c11
-rw-r--r--shell/e-sidebar.c54
-rw-r--r--shell/e-user-creatable-items-handler.c13
4 files changed, 51 insertions, 36 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 94aa1b2dfd..7c9dbea21e 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,12 @@
+2008-17-14 Paolo Borelli <pborelli@katamail.com>
+
+ ** Fix for bug #542889
+
+ * e-shell-window.c:
+ * e-user-creatable-items-handler.c:
+ * e-sidebar.c:
+ Port to the new gtk tooltip api.
+
2008-07-13 Matthew Barnes <mbarnes@redhat.com>
* e-shell-folder-title-bar.[ch]:
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index c6f08a7aa9..7d772fd2af 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -112,9 +112,6 @@ struct _EShellWindowPrivate {
/* The current view (can be NULL initially). */
ComponentView *current_view;
- /* Tooltips. */
- GtkTooltips *tooltips;
-
/* The status bar widgetry. */
GtkWidget *status_bar;
GtkWidget *offline_toggle;
@@ -407,7 +404,7 @@ update_offline_toggle_status (EShellWindow *window)
gtk_image_set_from_file (GTK_IMAGE (priv->offline_toggle_image), icon_file);
g_free (icon_file);
gtk_widget_set_sensitive (priv->offline_toggle, sensitive);
- gtk_tooltips_set_tip (priv->tooltips, priv->offline_toggle, tooltip, NULL);
+ gtk_widget_set_tooltip_text (priv->offline_toggle, tooltip);
/* TODO: If we get more shell flags, this should be centralised */
t = es_menu_target_new_shell(priv->menu, flags);
@@ -863,11 +860,6 @@ impl_dispose (GObject *object)
priv->ui_component = NULL;
}
- if (priv->tooltips != NULL) {
- gtk_object_destroy (GTK_OBJECT (priv->tooltips));
- priv->tooltips = NULL;
- }
-
if (priv->store_window_size_timer) {
g_source_remove (priv->store_window_size_timer);
self->priv->store_window_size_timer = 0;
@@ -992,7 +984,6 @@ e_shell_window_init (EShellWindow *shell_window)
{
EShellWindowPrivate *priv = g_new0 (EShellWindowPrivate, 1);
- priv->tooltips = gtk_tooltips_new ();
priv->shell_view = e_shell_view_new(shell_window);
priv->destroyed = FALSE;
diff --git a/shell/e-sidebar.c b/shell/e-sidebar.c
index b665edf318..d3404b5813 100644
--- a/shell/e-sidebar.c
+++ b/shell/e-sidebar.c
@@ -36,7 +36,6 @@ typedef struct {
GtkWidget *label;
GtkWidget *icon;
GtkWidget *hbox;
- GtkTooltips *tooltips;
GdkPixbuf *default_icon;
int id;
} Button;
@@ -73,8 +72,11 @@ G_DEFINE_TYPE (ESidebar, e_sidebar, GTK_TYPE_CONTAINER)
/* Utility functions. */
static Button *
-button_new (GtkWidget *button_widget, GtkWidget *label, GtkWidget *icon, GtkTooltips *tooltips,
- GtkWidget *hbox, int id)
+button_new (GtkWidget *button_widget,
+ GtkWidget *label,
+ GtkWidget *icon,
+ GtkWidget *hbox,
+ int id)
{
Button *button = g_new (Button, 1);
@@ -82,7 +84,6 @@ button_new (GtkWidget *button_widget, GtkWidget *label, GtkWidget *icon, GtkTool
button->label = label;
button->icon = icon;
button->hbox = hbox;
- button->tooltips = tooltips;
button->id = id;
button->default_icon = NULL;
@@ -90,7 +91,6 @@ button_new (GtkWidget *button_widget, GtkWidget *label, GtkWidget *icon, GtkTool
g_object_ref (label);
g_object_ref (icon);
g_object_ref (hbox);
- g_object_ref (tooltips);
return button;
}
@@ -102,7 +102,6 @@ button_free (Button *button)
g_object_unref (button->label);
g_object_unref (button->icon);
g_object_unref (button->hbox);
- g_object_unref (button->tooltips);
if (button->default_icon)
g_object_unref (button->default_icon);
g_free (button);
@@ -182,6 +181,30 @@ button_pressed_callback (GtkToggleButton *toggle_button,
return return_val;
}
+static gboolean
+button_query_tooltip (GtkWidget *widget,
+ gint x,
+ gint y,
+ gboolean keyboard_mode,
+ GtkTooltip *tooltip,
+ ESidebar *sidebar)
+{
+ /* Show the tooltip only if the label is hidden */
+ if (INTERNAL_MODE (sidebar) == E_SIDEBAR_MODE_ICON) {
+ char *tip;
+
+ tip = g_object_get_data (G_OBJECT (widget),
+ "ESidebar:button-tooltip");
+ if (tip) {
+ gtk_tooltip_set_text (tooltip, tip);
+
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
/* Layout. */
@@ -529,7 +552,6 @@ e_sidebar_add_button (ESidebar *sidebar,
GtkWidget *hbox;
GtkWidget *icon_widget;
GtkWidget *label_widget;
- GtkTooltips *button_tooltips;
button_widget = gtk_toggle_button_new ();
if (sidebar->priv->show)
@@ -548,29 +570,32 @@ e_sidebar_add_button (ESidebar *sidebar,
label_widget = gtk_label_new (label);
gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);
gtk_widget_show (label_widget);
- button_tooltips = gtk_tooltips_new();
- gtk_tooltips_set_tip (GTK_TOOLTIPS (button_tooltips), button_widget, tooltips, NULL);
+
+ g_object_set_data_full (G_OBJECT (button_widget),
+ "ESidebar:button-tooltip",
+ g_strdup (tooltips),
+ g_free);
+ gtk_widget_set_has_tooltip (button_widget, TRUE);
+ g_signal_connect (button_widget, "query-tooltip",
+ G_CALLBACK (button_query_tooltip), sidebar);
switch (INTERNAL_MODE (sidebar)) {
case E_SIDEBAR_MODE_TEXT:
gtk_box_pack_start (GTK_BOX (hbox), label_widget, TRUE, TRUE, 0);
- gtk_tooltips_disable (button_tooltips);
break;
case E_SIDEBAR_MODE_ICON:
gtk_box_pack_start (GTK_BOX (hbox), icon_widget, TRUE, TRUE, 0);
- gtk_tooltips_enable (button_tooltips);
break;
case E_SIDEBAR_MODE_BOTH:
default:
gtk_box_pack_start (GTK_BOX (hbox), icon_widget, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), label_widget, TRUE, TRUE, 0);
- gtk_tooltips_disable (button_tooltips);
break;
}
gtk_container_add (GTK_CONTAINER (button_widget), hbox);
- sidebar->priv->buttons = g_slist_append (sidebar->priv->buttons, button_new (button_widget, label_widget, icon_widget, button_tooltips, hbox, id));
+ sidebar->priv->buttons = g_slist_append (sidebar->priv->buttons, button_new (button_widget, label_widget, icon_widget, hbox, id));
gtk_widget_set_parent (button_widget, GTK_WIDGET (sidebar));
gtk_widget_queue_resize (GTK_WIDGET (sidebar));
@@ -657,7 +682,6 @@ set_mode_internal (ESidebar *sidebar, ESidebarMode mode )
if (INTERNAL_MODE (sidebar) == E_SIDEBAR_MODE_ICON) {
gtk_box_pack_start (GTK_BOX (button->hbox), button->label, TRUE, TRUE, 0);
gtk_widget_show (button->label);
- gtk_tooltips_disable (button->tooltips);
}
break;
case E_SIDEBAR_MODE_ICON:
@@ -669,7 +693,6 @@ set_mode_internal (ESidebar *sidebar, ESidebarMode mode )
gtk_container_child_set (GTK_CONTAINER (button->hbox), button->icon,
"expand", TRUE,
NULL);
- gtk_tooltips_enable (button->tooltips);
break;
case E_SIDEBAR_MODE_BOTH:
if (INTERNAL_MODE (sidebar) == E_SIDEBAR_MODE_TEXT) {
@@ -682,7 +705,6 @@ set_mode_internal (ESidebar *sidebar, ESidebarMode mode )
NULL);
}
- gtk_tooltips_disable (button->tooltips);
gtk_box_pack_start (GTK_BOX (button->hbox), button->label, TRUE, TRUE, 0);
gtk_widget_show (button->label);
break;
diff --git a/shell/e-user-creatable-items-handler.c b/shell/e-user-creatable-items-handler.c
index ed17f4934c..f18deeb527 100644
--- a/shell/e-user-creatable-items-handler.c
+++ b/shell/e-user-creatable-items-handler.c
@@ -88,7 +88,6 @@ struct _EUserCreatableItemsHandlerPrivate {
char *menu_xml;
GtkWidget *new_button, *new_menu;
BonoboControl *new_control;
- GtkTooltips *tooltips;
GtkAccelGroup *accel_group;
};
@@ -744,11 +743,10 @@ setup_toolbar_button (EUserCreatableItemsHandler *handler)
gconf_client_notify_add(gconf,"/desktop/gnome/interface/toolbar_style",
(GConfClientNotifyFunc)new_button_change, handler, NULL, NULL);
+ gtk_widget_set_tooltip_text (priv->new_button,
+ priv->default_menu_item->tooltip);
gtk_widget_show (priv->new_button);
- priv->tooltips = gtk_tooltips_new ();
- g_object_ref_sink (priv->tooltips);
- gtk_tooltips_set_tip (priv->tooltips, priv->new_button,
- priv->default_menu_item->tooltip, NULL);
+
g_free (val);
g_object_unref (gconf);
}
@@ -796,11 +794,6 @@ impl_dispose (GObject *object)
priv->new_control = NULL;
}
- if (priv->tooltips) {
- g_object_unref (priv->tooltips);
- priv->tooltips = NULL;
- }
-
if (priv->accel_group) {
g_object_unref (priv->accel_group);
priv->accel_group = NULL;