[gnome-boxes] wizard-source: Add URL completion



commit e755ef5baf7cdf59e3b8b5fd19071824007ad5d8
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue Feb 17 12:54:04 2015 +0000

    wizard-source: Add URL completion
    
    Provide URL completion based on media URLs known to libosinfo.

 src/wizard-source.vala |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/wizard-source.vala b/src/wizard-source.vala
index fa4ba22..f6882d7 100644
--- a/src/wizard-source.vala
+++ b/src/wizard-source.vala
@@ -181,6 +181,26 @@ private class Boxes.WizardSource: Gtk.Stack {
         assert (window != null);
 
         this.window = window;
+
+        var os_db = media_manager.os_db;
+        os_db.get_all_media_urls_as_store.begin ((db, result) => {
+            try {
+                var url_store = os_db.get_all_media_urls_as_store.end (result);
+                var completion = new Gtk.EntryCompletion ();
+                completion.text_column = 0;
+                completion.model = url_store;
+                completion.set_match_func ((store, key, iter) => {
+                    string url;
+
+                    url_store.get (iter, 0, out url);
+
+                    return url.contains (key);
+                });
+                url_entry.completion = completion;
+            } catch (OSDatabaseError error) {
+                debug ("Failed to get all known media URLs: %s", error.message);
+            }
+        });
     }
 
     public void cleanup () {


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