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



commit 89ea8f87bd74032fca09ea9b478dc8027264880c
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 2f485e9..74b6107 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -8830,7 +8830,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
@@ -8875,6 +8875,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);
@@ -8901,8 +8904,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;
 }
@@ -8928,7 +8933,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)
     {
@@ -9192,7 +9197,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]