notebook: consolidate code to remove the switch tab timer

https://bugzilla.gnome.org/show_bug.cgi?id=684415
This commit is contained in:
Cosimo Cecchi 2012-09-19 17:01:00 -04:00
parent 67fec32d27
commit 42da600eb1

View File

@ -1674,6 +1674,18 @@ gtk_notebook_get_property (GObject *object,
* gtk_notebook_drag_data_get
* gtk_notebook_drag_data_received
*/
static void
remove_switch_tab_timer (GtkNotebook *notebook)
{
GtkNotebookPrivate *priv = notebook->priv;
if (priv->switch_tab_timer)
{
g_source_remove (priv->switch_tab_timer);
priv->switch_tab_timer = 0;
}
}
static void
gtk_notebook_destroy (GtkWidget *widget)
{
@ -1701,11 +1713,7 @@ gtk_notebook_destroy (GtkWidget *widget)
priv->source_targets = NULL;
}
if (priv->switch_tab_timer)
{
g_source_remove (priv->switch_tab_timer);
priv->switch_tab_timer = 0;
}
remove_switch_tab_timer (notebook);
GTK_WIDGET_CLASS (gtk_notebook_parent_class)->destroy (widget);
}
@ -3789,11 +3797,7 @@ gtk_notebook_drag_motion (GtkWidget *widget,
}
else
{
if (priv->switch_tab_timer)
{
g_source_remove (priv->switch_tab_timer);
priv->switch_tab_timer = 0;
}
remove_switch_tab_timer (notebook);
}
return (target == tab_target) ? TRUE : FALSE;
@ -3807,13 +3811,8 @@ gtk_notebook_drag_leave (GtkWidget *widget,
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
GtkNotebookPrivate *priv = notebook->priv;
if (priv->switch_tab_timer)
{
g_source_remove (priv->switch_tab_timer);
priv->switch_tab_timer = 0;
}
stop_scrolling (GTK_NOTEBOOK (widget));
remove_switch_tab_timer (notebook);
stop_scrolling (notebook);
}
static gboolean