← Back to team overview

zeitgeist team mailing list archive

[Branch ~zeitgeist/zeitgeist/bluebird] Rev 214: added update_from_data_source to DataSource and made enabled property true on initiation

 

------------------------------------------------------------
revno: 214
committer: Seif Lotfy <seif@xxxxxxxxx>
branch nick: bluebird
timestamp: Fri 2011-09-02 15:42:00 +0200
message:
  added update_from_data_source to DataSource and made enabled property true on initiation
modified:
  extensions/ds-registry.vala


--
lp:~zeitgeist/zeitgeist/bluebird
https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird

Your team Zeitgeist Framework Team is subscribed to branch lp:~zeitgeist/zeitgeist/bluebird.
To unsubscribe from this branch go to https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird/+edit-subscription
=== modified file 'extensions/ds-registry.vala'
--- extensions/ds-registry.vala	2011-08-31 11:02:37 +0000
+++ extensions/ds-registry.vala	2011-09-02 13:42:00 +0000
@@ -108,12 +108,21 @@
                 vb.close ();
             }
 
+            vb.add ("b", running);
+            vb.add ("x", timestamp);
             vb.add ("b", enabled);
-            vb.add ("x", timestamp);
-            vb.add ("b", running);
 
             return vb.end ();
         }
+        
+        public void update_from_data_source(DataSource source)
+        {
+            this.name = source.name;
+            this.description = source.description;
+            this.event_templates = source.event_templates;
+            this.running = source.running;
+            this.timestamp = source.timestamp;
+        }
     }
 
     class DataSourceRegistry: Extension, RemoteRegistry
@@ -176,6 +185,9 @@
             if (ds != null)
             {
                 // FIXME: update timestamp?
+                var templates = Events.from_variant (event_templates);
+                ds.update_from_data_source(new DataSource.full (unique_id, name,
+                    description, templates));
                 return ds.enabled;
             }
             else
@@ -186,8 +198,9 @@
                 sources.insert (unique_id, new_ds);
 
                 data_source_registered (new_ds.to_variant ());
-
-                return true;
+                new_ds.enabled = true;
+                new_ds.running = true;
+                return new_ds.enabled;
             }
         }