[gtksourceview] Completion: connect signals with G_CONNECT_SWAPPED



commit 9b8ebf33dd3759fcab889fec977538b47ed0856d
Author: SÃbastien Wilmet <swilmet gnome org>
Date:   Sat Feb 16 21:46:26 2013 +0100

    Completion: connect signals with G_CONNECT_SWAPPED
    
    It permits to call directly the right function.

 gtksourceview/gtksourcecompletion.c |   52 +++++++++++------------------------
 1 files changed, 16 insertions(+), 36 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index c0f6c4a..9141367 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -1113,15 +1113,6 @@ show_info_after_cb (GtkWidget           *widget,
        gtk_label_select_region (GTK_LABEL (completion->priv->default_info), 0, 0);
 }
 
-static void
-info_size_allocate_cb (GtkWidget           *widget,
-                       GtkAllocation       *allocation,
-                       GtkSourceCompletion *completion)
-{
-       /* Update window position */
-       update_info_position (completion);
-}
-
 static gint
 measure_accelerator_width (GtkWidget *widget)
 {
@@ -1221,21 +1212,6 @@ update_column_sizes (GtkSourceCompletion *completion)
                                          icon_height);
 }
 
-static void
-gtk_source_completion_size_allocate (GtkWidget           *widget,
-                                     GtkAllocation       *allocation,
-                                     GtkSourceCompletion *completion)
-{
-       update_column_sizes (completion);
-}
-
-static void
-gtk_source_completion_style_updated (GtkWidget           *widget,
-                                     GtkSourceCompletion *completion)
-{
-       update_column_sizes (completion);
-}
-
 static gboolean
 view_focus_out_event_cb (GtkWidget     *widget,
                          GdkEventFocus *event,
@@ -2686,15 +2662,19 @@ initialize_tree_view (GtkSourceCompletion *completion,
                                  G_CALLBACK (gtk_source_completion_activate_proposal),
                                  completion);
 
-       g_signal_connect_after (completion->priv->tree_view_proposals,
-                               "size-allocate",
-                               G_CALLBACK (gtk_source_completion_size_allocate),
-                               completion);
+       g_signal_connect_data (completion->priv->tree_view_proposals,
+                              "size-allocate",
+                              G_CALLBACK (update_column_sizes),
+                              completion,
+                              NULL,
+                              G_CONNECT_AFTER | G_CONNECT_SWAPPED);
 
-       g_signal_connect_after (completion->priv->tree_view_proposals,
-                               "style-updated",
-                               G_CALLBACK (gtk_source_completion_style_updated),
-                               completion);
+       g_signal_connect_data (completion->priv->tree_view_proposals,
+                              "style-updated",
+                              G_CALLBACK (update_column_sizes),
+                              completion,
+                              NULL,
+                              G_CONNECT_AFTER | G_CONNECT_SWAPPED);
 
        /* Selection */
 
@@ -2839,10 +2819,10 @@ initialize_ui (GtkSourceCompletion *completion)
                          G_CALLBACK (show_info_after_cb),
                          completion);
 
-       g_signal_connect (completion->priv->info_window,
-                         "size-allocate",
-                         G_CALLBACK(info_size_allocate_cb),
-                         completion);
+       g_signal_connect_swapped (completion->priv->info_window,
+                                 "size-allocate",
+                                 G_CALLBACK (update_info_position),
+                                 completion);
 
        gtk_widget_set_size_request (completion->priv->main_window,
                                     WINDOW_WIDTH,


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