Hello community,

here is the log from the commit of package spice-up for openSUSE:Factory 
checked in at 2018-10-17 08:42:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/spice-up (Old)
 and      /work/SRC/openSUSE:Factory/.spice-up.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "spice-up"

Wed Oct 17 08:42:27 2018 rev:13 rq:642429 version:1.6.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/spice-up/spice-up.changes        2018-10-02 
19:49:20.293711564 +0200
+++ /work/SRC/openSUSE:Factory/.spice-up.new/spice-up.changes   2018-10-17 
08:43:21.909755854 +0200
@@ -1,0 +2,6 @@
+Mon Oct  8 11:56:25 UTC 2018 - Alexei Podvalsky <avvi...@yandex.by>
+
+- Update to 1.6.1:
+  * Remote templates v2 (#237)
+
+-------------------------------------------------------------------

Old:
----
  Spice-up-1.6.0.tar.gz

New:
----
  Spice-up-1.6.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ spice-up.spec ++++++
--- /var/tmp/diff_new_pack.dxsryb/_old  2018-10-17 08:43:22.285755535 +0200
+++ /var/tmp/diff_new_pack.dxsryb/_new  2018-10-17 08:43:22.285755535 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           spice-up
-Version:        1.6.0
+Version:        1.6.1
 Release:        0
 Summary:        Desktop presentation application
 License:        GPL-3.0-only

++++++ Spice-up-1.6.0.tar.gz -> Spice-up-1.6.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/Spice-up-1.6.0/data/com.github.philip-scott.spice-up.appdata.xml 
new/Spice-up-1.6.1/data/com.github.philip-scott.spice-up.appdata.xml
--- old/Spice-up-1.6.0/data/com.github.philip-scott.spice-up.appdata.xml        
2018-09-24 06:56:52.000000000 +0200
+++ new/Spice-up-1.6.1/data/com.github.philip-scott.spice-up.appdata.xml        
2018-10-04 02:48:01.000000000 +0200
@@ -26,7 +26,7 @@
     <binary>spice-up</binary>
   </provides>
   <releases>
-    <release version="1.6.0" date="2018-9-23">
+    <release version="1.6.1" date="2018-10-3">
       <description>
         <p>Slide Transitions and the Slide List Redesign</p>
         <ul>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Spice-up-1.6.0/src/Services/Fetcher.vala 
new/Spice-up-1.6.1/src/Services/Fetcher.vala
--- old/Spice-up-1.6.0/src/Services/Fetcher.vala        2018-09-24 
06:56:52.000000000 +0200
+++ new/Spice-up-1.6.1/src/Services/Fetcher.vala        2018-10-04 
02:48:01.000000000 +0200
@@ -20,9 +20,9 @@
 */
 
 public class Spice.Services.Fetcher {
-    private const string TEMPLATES_URL = 
"https://spice-up-dev.azurewebsites.net/api/get-templates";;
+    private const string TEMPLATES_URL = 
"https://spice-up-prod.azurewebsites.net/api/";;
     private const int64 CACHE_LIFE = 43200; // 1/2 a day
-    public const int CURRENT_VERSION = 1;
+    public const string CURRENT_VERSION = "2";
 
     private File cache_file;
     private string cache = "";
@@ -32,7 +32,7 @@
         cache_file = File.new_for_path (Environment.get_tmp_dir () + 
"/com.github.philip-scott.spice-up.cache.json");
     }
 
-    public void fetch () {
+    public void fetch_templates () {
         var now = new DateTime.now_utc ().to_unix ();
 
         var settigns = Spice.Services.Settings.get_instance ();
@@ -44,7 +44,7 @@
             debug ("Getting templates from server\n");
             new Thread<void*> ("fetch-templates", () => {
                 var session = new Soup.Session ();
-                var message = new Soup.Message ("GET", TEMPLATES_URL);
+                var message = new Soup.Message ("GET", TEMPLATES_URL + 
"get-templates");
 
                 session.send_message (message);
 
@@ -56,6 +56,7 @@
                 mutex.lock ();
 
                 cache = data.str;
+
                 if (cache != "") {
                     save_to_cache (cache);
                     settigns.last_fetch = now.to_string ();
@@ -70,6 +71,20 @@
         }
     }
 
+    public static string get_template_data (string template) {
+        var session = new Soup.Session ();
+        var message = new Soup.Message ("GET", TEMPLATES_URL + template);
+
+        session.send_message (message);
+
+        var data = new StringBuilder ();
+        foreach (var c in message.response_body.data) {
+            data.append ("%c".printf (c));
+        }
+
+        return data.str;
+    }
+
     public string get_data () {
         mutex.lock ();
         if (cache == "" && cache_file.query_exists ()) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Spice-up-1.6.0/src/Widgets/Library/Library.vala 
new/Spice-up-1.6.1/src/Widgets/Library/Library.vala
--- old/Spice-up-1.6.0/src/Widgets/Library/Library.vala 2018-09-24 
06:56:52.000000000 +0200
+++ new/Spice-up-1.6.1/src/Widgets/Library/Library.vala 2018-10-04 
02:48:01.000000000 +0200
@@ -57,7 +57,26 @@
         item_box.min_children_per_line = 2;
 
         item_box.child_activated.connect ((child) => {
-            item_selected ((child as LibraryItem).data);
+            var library_item = child as LibraryItem;
+            if (library_item == null) return;
+
+            if (library_item.remote_path == null) {
+                item_selected (library_item.data);
+            } else {
+                sensitive = false;
+                new Thread<void*> ("fetch-template", () => {
+                    var data = Spice.Services.Fetcher.get_template_data 
(library_item.remote_path);
+
+                    Idle.add (() => {
+                        item_selected (data);
+                        sensitive = true;
+                        return GLib.Source.REMOVE;
+                    });
+                    return null;
+                });
+            }
+
+
         });
     }
 
@@ -80,8 +99,8 @@
         item_box.add (item);
     }
 
-    public void add_from_data (string data, string? file_name) {
-        var item = new LibraryItem.from_data (data, file_name);
+    public void add_remote (string file_name, string path, string data) {
+        var item = new LibraryItem.from_remote (data, file_name, path);
         item_box.add (item);
     }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Spice-up-1.6.0/src/Widgets/Library/LibraryItem.vala 
new/Spice-up-1.6.1/src/Widgets/Library/LibraryItem.vala
--- old/Spice-up-1.6.0/src/Widgets/Library/LibraryItem.vala     2018-09-24 
06:56:52.000000000 +0200
+++ new/Spice-up-1.6.1/src/Widgets/Library/LibraryItem.vala     2018-10-04 
02:48:01.000000000 +0200
@@ -37,6 +37,7 @@
     }
 
     public string data { get; construct set; }
+    public string? remote_path {get; construct set; default = null; }
 
     private SlideWidget slide_widget;
     private Gtk.Popover? popover = null;
@@ -51,11 +52,12 @@
         get_thumbnail ();
     }
 
-    public LibraryItem.from_data (string data, string? file_name) {
-        Object (data: data);
+    public LibraryItem.from_remote (string data, string file_name, string 
path) {
+        Object (data: data, remote_path: path);
 
         title_label.label = file_name;
-        load_thumbnail ();
+        load_thumbnail (data);
+        set_tooltip_text (_("Create Presentation"));
     }
 
     construct {
@@ -202,19 +204,21 @@
             new Thread<void*> ("content-loading", () => {
                 if (real_file) {
                     get_file_data ();
+                    load_thumbnail (Utils.get_thumbnail_data (data));
+                } else if (remote_path != null) {
+                    load_thumbnail (data);
                 } else {
                     get_template_data ();
+                    load_thumbnail (Utils.get_thumbnail_data (data));
                 }
 
-                load_thumbnail ();
-
                 return null;
             });
         }
     }
 
-    private void load_thumbnail () {
-        var pixbuf = Utils.base64_to_pixbuf (Utils.get_thumbnail_data (data));
+    private void load_thumbnail (string base64_image) {
+        var pixbuf = Utils.base64_to_pixbuf (base64_image);
 
         Idle.add (() => {
             slide_widget.pixbuf = pixbuf;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Spice-up-1.6.0/src/Widgets/Welcome.vala 
new/Spice-up-1.6.1/src/Widgets/Welcome.vala
--- old/Spice-up-1.6.0/src/Widgets/Welcome.vala 2018-09-24 06:56:52.000000000 
+0200
+++ new/Spice-up-1.6.1/src/Widgets/Welcome.vala 2018-10-04 02:48:01.000000000 
+0200
@@ -33,7 +33,7 @@
 
     public Welcome () {
         fetcher = new Spice.Services.Fetcher ();
-        fetcher.fetch ();
+        fetcher.fetch_templates ();
 
         orientation = Gtk.Orientation.HORIZONTAL;
         get_style_context ().add_class ("view");
@@ -121,14 +121,18 @@
 
         if (json_data == null) return;
 
-        if (json_data.get_int_member ("version") > 
Spice.Services.Fetcher.CURRENT_VERSION) return;
+        if (json_data.get_string_member ("version") != 
Spice.Services.Fetcher.CURRENT_VERSION) return;
 
         var templates_array = json_data.get_array_member ("templates");
 
         Idle.add (() => {
             foreach (var raw in templates_array.get_elements ()) {
                 var template = raw.get_object ();
-                templates.add_from_data (template.get_string_member ("data"), 
template.get_string_member ("name"));
+                templates.add_remote (
+                    template.get_string_member ("name"),
+                    template.get_string_member ("url"),
+                    template.get_string_member ("preview")
+                );
             }
             return GLib.Source.REMOVE;
         });


Reply via email to