[gtk+/popovers: 8/45] textview: Avoid bubblewindow popup/popdown API



commit a171b0e3d3310455fdc4d78893b51a2c88ccf02c
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Nov 12 14:22:08 2013 +0100

    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.

 gtk/gtktextview.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index de6f41e..36265c0 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]