← Back to team overview

zeitgeist team mailing list archive

[Merge] lp:~tdfischer/zeitgeist/warning-fixes into lp:zeitgeist

 

Trever Fischer has proposed merging lp:~tdfischer/zeitgeist/warning-fixes into lp:zeitgeist.

Requested reviews:
  Zeitgeist Framework Team (zeitgeist)

For more details, see:
https://code.launchpad.net/~tdfischer/zeitgeist/warning-fixes/+merge/99374

Fixes various vala warnings
-- 
https://code.launchpad.net/~tdfischer/zeitgeist/warning-fixes/+merge/99374
Your team Zeitgeist Framework Team is requested to review the proposed merge of lp:~tdfischer/zeitgeist/warning-fixes into lp:zeitgeist.
=== modified file 'extensions/blacklist.vala'
--- extensions/blacklist.vala	2012-03-15 09:25:01 +0000
+++ extensions/blacklist.vala	2012-03-26 17:08:44 +0000
@@ -47,7 +47,7 @@
         private const string SIG_BLACKLIST = "a{s("+Utils.SIG_EVENT+")}";
 
         private static HashTable<string, Event> from_variant (
-            Variant templates_variant)
+            Variant templates_variant) throws EngineError
         {
             var blacklist = new HashTable<string, Event> (str_hash, str_equal);
 
@@ -99,10 +99,16 @@
             // Restore previous blacklist from database, or create an empty one
             Variant? templates = retrieve_config ("blacklist",
                 BlacklistTemplates.SIG_BLACKLIST);
-            if (templates != null)
-                blacklist = BlacklistTemplates.from_variant (templates);
-            else
+            if (templates != null) {
+                try {
+                    blacklist = BlacklistTemplates.from_variant (templates);
+                } catch (EngineError e) {
+                    warning ("Could not load blacklist from variant: %s", e.message);
+                    blacklist = new HashTable<string, Event> (str_hash, str_equal);
+                }
+            } else {
                 blacklist = new HashTable<string, Event> (str_hash, str_equal);
+            }
 
             // This will be called after bus is acquired, so it shouldn't block
             try

=== modified file 'extensions/ds-registry.vala'
--- extensions/ds-registry.vala	2012-03-17 14:53:25 +0000
+++ extensions/ds-registry.vala	2012-03-26 17:08:44 +0000
@@ -72,7 +72,7 @@
         }
 
         public DataSource.from_variant (Variant variant,
-            bool reset_running=false)
+            bool reset_running=false) throws EngineError
         {
             warn_if_fail (
                 variant.get_type_string () == "(sssa("+Utils.SIG_EVENT+")bxb)"
@@ -127,7 +127,7 @@
             "a(sssa("+Utils.SIG_EVENT+")bxb)";
 
         private static HashTable<string, DataSource> from_variant (
-            Variant sources_variant, bool reset_running=false)
+            Variant sources_variant, bool reset_running=false) throws EngineError
         {
             var registry = new HashTable<string, DataSource> (
                 str_hash, str_equal);
@@ -185,11 +185,16 @@
 
             Variant? registry = retrieve_config ("registry",
                 DataSources.SIG_DATASOURCES);
-            if (registry != null)
-                sources = DataSources.from_variant (registry, true);
-            else
+            if (registry != null) {
+                try {
+                    sources = DataSources.from_variant (registry, true);
+                } catch (EngineError e) {
+                    warning ("Error while loading datasource registry: %s", e.message);
+                }
+            } else {
                 sources = new HashTable<string, DataSource> (
                     str_hash, str_equal);
+            }
 
             // this will be called after bus is acquired, so it shouldn't block
             try
@@ -249,7 +254,7 @@
         }
 
         public bool register_data_source (string unique_id, string name,
-            string description, Variant event_templates, BusName? sender)
+            string description, Variant event_templates, BusName? sender) throws EngineError
         {
             debug ("%s: %s, %s, %s", Log.METHOD, unique_id, name, description);
             if (sender == null)

=== modified file 'extensions/fts++/zeitgeist-fts.vala'
--- extensions/fts++/zeitgeist-fts.vala	2012-03-26 15:52:08 +0000
+++ extensions/fts++/zeitgeist-fts.vala	2012-03-26 17:08:44 +0000
@@ -100,7 +100,7 @@
         }
 
         public async void notify_insert (Variant time_range, Variant events)
-            throws IOError
+            throws IOError, EngineError
         {
             debug ("got insertion notification");
             var events_arr = Events.from_variant (events);
@@ -188,7 +188,14 @@
             var proxy = connection.get_proxy_sync<RemoteDBus> (
                 "org.freedesktop.DBus", "/org/freedesktop/DBus",
                 DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
+<<<<<<< TREE
             if (proxy.name_has_owner (DBUS_NAME))
+=======
+            // bool zeitgeist_up = proxy.name_has_owner (ZEITGEIST_DBUS_NAME);
+            // FIXME: throw an error that zeitgeist isn't up? or just start it?
+            bool name_owned = proxy.name_has_owner (DBUS_NAME);
+            if (name_owned)
+>>>>>>> MERGE-SOURCE
             {
                 throw new EngineError.EXISTING_INSTANCE (
                     "The FTS daemon is running already.");

=== modified file 'extensions/storage-monitor.vala'
--- extensions/storage-monitor.vala	2012-03-19 10:51:53 +0000
+++ extensions/storage-monitor.vala	2012-03-26 17:08:44 +0000
@@ -377,7 +377,11 @@
                 update_storage_medium_stmt.bind_text (3, display_name);
                 update_storage_medium_stmt.bind_text (4, medium_name);
                 int rc = update_storage_medium_stmt.step ();
-                database.assert_query_success (rc, "add_storage_medium", Sqlite.DONE);
+                try {
+                    database.assert_query_success (rc, "add_storage_medium", Sqlite.DONE);
+                } catch (EngineError e) {
+                    warning ("Could not add storage medium: %s", e.message);
+                }
             }
             storage_available (medium_name, StorageMedia.to_variant (
                 medium_name, true, icon, display_name));
@@ -395,8 +399,12 @@
                 update_medium_state_stmt.bind_int (1, 0);
                 update_medium_state_stmt.bind_text (2, medium_name);
                 int rc = update_medium_state_stmt.step ();
-                database.assert_query_success (rc, "remove_storage_medium",
-                    Sqlite.DONE);
+                try {
+                    database.assert_query_success (rc, "remove_storage_medium",
+                        Sqlite.DONE);
+                } catch (EngineError e) {
+                    warning ("Could not remove storage medium: %s", e.message);
+                }
             }
             storage_unavailable (medium_name);
         }

=== modified file 'src/datamodel.vala'
--- src/datamodel.vala	2012-03-26 15:31:28 +0000
+++ src/datamodel.vala	2012-03-26 17:08:44 +0000
@@ -76,7 +76,7 @@
         }
 
         public TimeRange.from_variant (Variant variant)
-            throws EngineError.INVALID_SIGNATURE
+            throws EngineError
         {
             assert_sig (variant.get_type_string () == "(xx)",
                 "Invalid D-Bus signature.");

=== modified file 'src/remote.vala'
--- src/remote.vala	2012-02-10 17:03:50 +0000
+++ src/remote.vala	2012-03-26 17:08:44 +0000
@@ -101,7 +101,7 @@
         public async abstract void notify_insert (
             [DBus (signature = "(xx)")] Variant time_range,
             [DBus (signature = "a(asaasay)")] Variant events
-        ) throws IOError;
+        ) throws IOError, EngineError;
 
         public async abstract void notify_delete (
             [DBus (signature = "(xx)")] Variant time_range,


Follow ups