Bug 504087 - make gtk_tooltip_set_custom a no-op for setting the current
2008-05-28 Kristian Rietveld <kris@imendio.com> Bug 504087 - make gtk_tooltip_set_custom a no-op for setting the current widget again. * gtk/gtktooltip.c (gtk_tooltip_set_custom), (gtk_tooltip_reset), (gtk_tooltip_run_requery): use a custom_was_reset field to check if the custom widget is set again in the query-tooltip callback; if not, we set it to NULL. Based on a patch by Xavier Claessens, insightful comments from Jean-Yves Lefort and Christian Persch. svn path=/trunk/; revision=20215
This commit is contained in:
committed by
Kristian Rietveld
parent
83b215f9ea
commit
382ce2f138
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
|||||||
|
2008-05-28 Kristian Rietveld <kris@imendio.com>
|
||||||
|
|
||||||
|
Bug 504087 - make gtk_tooltip_set_custom a no-op for setting the
|
||||||
|
current widget again.
|
||||||
|
|
||||||
|
* gtk/gtktooltip.c (gtk_tooltip_set_custom),
|
||||||
|
(gtk_tooltip_reset), (gtk_tooltip_run_requery): use a
|
||||||
|
custom_was_reset field to check if the custom widget is set again in
|
||||||
|
the query-tooltip callback; if not, we set it to NULL. Based on a
|
||||||
|
patch by Xavier Claessens, insightful comments from Jean-Yves Lefort
|
||||||
|
and Christian Persch.
|
||||||
|
|
||||||
2008-05-28 Michael Natterer <mitch@imendio.com>
|
2008-05-28 Michael Natterer <mitch@imendio.com>
|
||||||
|
|
||||||
* modules/printbackends/cups/gtkcupsutils.c
|
* modules/printbackends/cups/gtkcupsutils.c
|
||||||
|
|||||||
@ -71,6 +71,7 @@ struct _GtkTooltip
|
|||||||
guint browse_mode_enabled : 1;
|
guint browse_mode_enabled : 1;
|
||||||
guint keyboard_mode_enabled : 1;
|
guint keyboard_mode_enabled : 1;
|
||||||
guint tip_area_set : 1;
|
guint tip_area_set : 1;
|
||||||
|
guint custom_was_reset : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkTooltipClass
|
struct _GtkTooltipClass
|
||||||
@ -349,6 +350,15 @@ gtk_tooltip_set_custom (GtkTooltip *tooltip,
|
|||||||
if (custom_widget)
|
if (custom_widget)
|
||||||
g_return_if_fail (GTK_IS_WIDGET (custom_widget));
|
g_return_if_fail (GTK_IS_WIDGET (custom_widget));
|
||||||
|
|
||||||
|
/* The custom widget has been updated from the query-tooltip
|
||||||
|
* callback, so we do not want to reset the custom widget later on.
|
||||||
|
*/
|
||||||
|
tooltip->custom_was_reset = TRUE;
|
||||||
|
|
||||||
|
/* No need to do anything if the custom widget stays the same */
|
||||||
|
if (tooltip->custom_widget == custom_widget)
|
||||||
|
return;
|
||||||
|
|
||||||
if (tooltip->custom_widget)
|
if (tooltip->custom_widget)
|
||||||
{
|
{
|
||||||
GtkWidget *custom = tooltip->custom_widget;
|
GtkWidget *custom = tooltip->custom_widget;
|
||||||
@ -440,8 +450,12 @@ gtk_tooltip_reset (GtkTooltip *tooltip)
|
|||||||
{
|
{
|
||||||
gtk_tooltip_set_markup (tooltip, NULL);
|
gtk_tooltip_set_markup (tooltip, NULL);
|
||||||
gtk_tooltip_set_icon (tooltip, NULL);
|
gtk_tooltip_set_icon (tooltip, NULL);
|
||||||
gtk_tooltip_set_custom (tooltip, NULL);
|
|
||||||
gtk_tooltip_set_tip_area (tooltip, NULL);
|
gtk_tooltip_set_tip_area (tooltip, NULL);
|
||||||
|
|
||||||
|
/* See if the custom widget is again set from the query-tooltip
|
||||||
|
* callback.
|
||||||
|
*/
|
||||||
|
tooltip->custom_was_reset = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -792,6 +806,12 @@ gtk_tooltip_run_requery (GtkWidget **widget,
|
|||||||
}
|
}
|
||||||
while (*widget);
|
while (*widget);
|
||||||
|
|
||||||
|
/* If the custom widget was not reset in the query-tooltip
|
||||||
|
* callback, we clear it here.
|
||||||
|
*/
|
||||||
|
if (!tooltip->custom_was_reset)
|
||||||
|
gtk_tooltip_set_custom (tooltip, NULL);
|
||||||
|
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user