[gnome-games/wip/aplazas/781334-refactor-game-sources: 1/6] utils: Add Uri.from_uri_and_scheme()



commit df3235c57a6d5e8f2b77f1dd8bb7545279869ad4
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Sat May 6 11:08:06 2017 +0200

    utils: Add Uri.from_uri_and_scheme()
    
    This will be used by game factories to adapt a URI scheme to their
    needs.

 src/utils/uri.vala |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/utils/uri.vala b/src/utils/uri.vala
index 818ebff..9dac436 100644
--- a/src/utils/uri.vala
+++ b/src/utils/uri.vala
@@ -9,6 +9,10 @@ public class Games.Uri {
                this.uri = uri;
        }
 
+       public Uri.from_uri_and_scheme (Uri uri, string scheme) {
+               this.uri = scheme_regex.replace (uri.uri, -1, 0, scheme + ":");
+       }
+
        public Uri.from_file (File file) {
                uri = file.get_uri ();
        }


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