[gnome-boxes] searchbar: Ensure window is set before connecting to it



commit 3a4f0b2e402dcb90485e725b87d144f5ec060302
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Tue Aug 12 09:03:44 2014 +0200

    searchbar: Ensure window is set before connecting to it
    
    Until this patch, window was in an uncertain state when trying to connect
    to it, because on_app_ready() was called before setup_ui().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=734486

 src/searchbar.vala |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/src/searchbar.vala b/src/searchbar.vala
index b6ac6a6..ff6ee1e 100644
--- a/src/searchbar.vala
+++ b/src/searchbar.vala
@@ -19,12 +19,12 @@ private class Boxes.Searchbar: Gtk.SearchBar {
 
     construct {
         search_mode_enabled = false;
-
-        App.app.call_when_ready (on_app_ready);
     }
 
     public void setup_ui (AppWindow window) {
         this.window = window;
+
+        key_handler_id = window.key_press_event.connect (on_app_key_pressed);
     }
 
     [GtkCallback]
@@ -49,10 +49,6 @@ private class Boxes.Searchbar: Gtk.SearchBar {
         set { entry.set_text (value); }
     }
 
-    private void on_app_ready () {
-        key_handler_id = window.key_press_event.connect (on_app_key_pressed);
-    }
-
     private bool on_app_key_pressed (Gtk.Widget widget, Gdk.EventKey event) {
         if (window.ui_state != UIState.COLLECTION)
             return false;


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