textview: Avoid bubblewindow popup/popdown API

Besides setting all positioning properties at once, popup() would just
show the widget, so do that directly after just updating the position.
This commit is contained in:
Carlos Garnacho 2013-11-12 14:22:08 +01:00
parent 49277953d3
commit 1813c8391c

View File

@ -8857,7 +8857,7 @@ activate_bubble_cb (GtkWidget *item,
{
const gchar *signal = g_object_get_data (G_OBJECT (item), "gtk-signal");
g_signal_emit_by_name (text_view, signal);
_gtk_bubble_window_popdown (GTK_BUBBLE_WINDOW (text_view->priv->selection_bubble));
gtk_widget_hide (text_view->priv->selection_bubble);
}
static void
@ -8902,6 +8902,9 @@ bubble_targets_received (GtkClipboard *clipboard,
gtk_widget_destroy (priv->selection_bubble);
priv->selection_bubble = _gtk_bubble_window_new (GTK_WIDGET (text_view));
_gtk_bubble_window_set_position (GTK_BUBBLE_WINDOW (priv->selection_bubble),
GTK_POS_TOP);
toolbar = GTK_WIDGET (gtk_toolbar_new ());
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_TEXT);
gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), FALSE);
@ -8928,8 +8931,10 @@ bubble_targets_received (GtkClipboard *clipboard,
gtk_text_view_get_selection_rect (text_view, &rect);
rect.x -= priv->xoffset;
rect.y -= priv->yoffset;
_gtk_bubble_window_popup (GTK_BUBBLE_WINDOW (priv->selection_bubble),
GTK_WIDGET (text_view), &rect, GTK_POS_TOP);
_gtk_bubble_window_set_pointing_to (GTK_BUBBLE_WINDOW (priv->selection_bubble),
&rect);
gtk_widget_show (priv->selection_bubble);
priv->selection_bubble_timeout_id = 0;
}
@ -8955,7 +8960,7 @@ gtk_text_view_selection_bubble_popup_unset (GtkTextView *text_view)
priv = text_view->priv;
if (priv->selection_bubble)
_gtk_bubble_window_popdown (GTK_BUBBLE_WINDOW (priv->selection_bubble));
gtk_widget_hide (priv->selection_bubble);
if (priv->selection_bubble_timeout_id)
{
@ -9219,7 +9224,7 @@ text_window_scroll (GtkTextWindow *win,
if (dx != 0 || dy != 0)
{
if (priv->selection_bubble)
_gtk_bubble_window_popdown (GTK_BUBBLE_WINDOW (priv->selection_bubble));
gtk_widget_hide (priv->selection_bubble);
view->priv->in_scroll = TRUE;
gdk_window_scroll (win->bin_window, dx, dy);
view->priv->in_scroll = FALSE;