------------------------------------------------------------ revno: 224 committer: Michal Hruby <michal....@gmail.com> branch nick: bluebird timestamp: Mon 2011-09-05 12:27:02 +0200 message: Fix up lots of warnings modified: configure.ac extensions/Makefile.am extensions/blacklist.vala extensions/ds-registry.vala extra/ontology2code src/Makefile.am src/errors.vala src/ontology.vala.in src/utils.vala src/zeitgeist-daemon.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 'configure.ac' --- configure.ac 2011-08-21 14:17:16 +0000 +++ configure.ac 2011-09-05 10:27:02 +0000 @@ -11,6 +11,8 @@ AM_PROG_VALAC([0.12.1]) +AM_SILENT_RULES([yes]) + AH_TEMPLATE([GETTEXT_PACKAGE], [Package name for gettext]) GETTEXT_PACKAGE=bluebird AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE") === modified file 'extensions/Makefile.am' --- extensions/Makefile.am 2011-08-31 11:02:37 +0000 +++ extensions/Makefile.am 2011-09-05 10:27:02 +0000 @@ -6,7 +6,8 @@ AM_CPPFLAGS = \ $(BLUEBIRD_CFLAGS) \ -include $(CONFIG_HEADER) \ - -I $(top_srcdir)/src + -I $(top_srcdir)/src \ + -w \ $(NULL) VALAFLAGS = \ === modified file 'extensions/blacklist.vala' --- extensions/blacklist.vala 2011-08-31 11:02:37 +0000 +++ extensions/blacklist.vala 2011-09-05 10:27:02 +0000 @@ -26,7 +26,7 @@ namespace Zeitgeist { [DBus (name = "org.gnome.zeitgeist.Blacklist")] - interface RemoteBlacklist: Object + public interface RemoteBlacklist: Object { public abstract void add_template (string blacklist_id, [DBus (signature = "(asaasay)")] Variant event_template) @@ -59,18 +59,32 @@ // FIXME: load blacklist from file // This will be called after bus is acquired, so it shouldn't block - var connection = Bus.get_sync (BusType.SESSION, null); - registration_id = connection.register_object<RemoteBlacklist> ( - "/org/gnome/zeitgeist/blacklist", this); + try + { + var connection = Bus.get_sync (BusType.SESSION, null); + registration_id = connection.register_object<RemoteBlacklist> ( + "/org/gnome/zeitgeist/blacklist", this); + } + catch (Error err) + { + warning ("%s", err.message); + } } public override void unload () { - var connection = Bus.get_sync (BusType.SESSION, null); - if (registration_id != 0) - { - connection.unregister_object (registration_id); - registration_id = 0; + try + { + var connection = Bus.get_sync (BusType.SESSION, null); + if (registration_id != 0) + { + connection.unregister_object (registration_id); + registration_id = 0; + } + } + catch (Error err) + { + warning ("%s", err.message); } debug ("%s, this.ref_count = %u", Log.METHOD, this.ref_count); @@ -114,10 +128,10 @@ [ModuleInit] #if BUILTIN_EXTENSIONS - Type blacklist_init (TypeModule module) + public static Type blacklist_init (TypeModule module) { #else - Type extension_register (TypeModule module) + public static Type extension_register (TypeModule module) { #endif return typeof (Blacklist); === modified file 'extensions/ds-registry.vala' --- extensions/ds-registry.vala 2011-09-05 09:53:08 +0000 +++ extensions/ds-registry.vala 2011-09-05 10:27:02 +0000 @@ -24,7 +24,7 @@ namespace Zeitgeist { [DBus (name = "org.gnome.zeitgeist.DataSourceRegistry")] - interface RemoteRegistry: Object + public interface RemoteRegistry: Object { [DBus (signature = "a(sssa(asaasay)bxb)")] public abstract Variant get_data_sources () throws Error; @@ -135,9 +135,18 @@ // FIXME: load data sources // this will be called after bus is acquired, so it shouldn't block - var connection = Bus.get_sync (BusType.SESSION, null); - registration_id = connection.register_object<RemoteRegistry> ( - "/org/gnome/zeitgeist/data_source_registry", this); + try + { + var connection = Bus.get_sync (BusType.SESSION, null); + registration_id = connection.register_object<RemoteRegistry> ( + "/org/gnome/zeitgeist/data_source_registry", this); + } + catch (Error err) + { + warning ("%s", err.message); + } + + // FIXME: nothing changed, why is this here? dirty = true; // FIXME: set up gobject timer like -> // gobject.timeout_add(DISK_WRITE_TIMEOUT, self._write_to_disk) @@ -145,11 +154,18 @@ public override void unload () { - var connection = Bus.get_sync (BusType.SESSION, null); - if (registration_id != 0) - { - connection.unregister_object (registration_id); - registration_id = 0; + try + { + var connection = Bus.get_sync (BusType.SESSION, null); + if (registration_id != 0) + { + connection.unregister_object (registration_id); + registration_id = 0; + } + } + catch (Error err) + { + warning ("%s", err.message); } debug ("%s, this.ref_count = %u", Log.METHOD, this.ref_count); @@ -287,10 +303,10 @@ [ModuleInit] #if BUILTIN_EXTENSIONS - Type data_source_registry_init (TypeModule module) + public static Type data_source_registry_init (TypeModule module) { #else - Type extension_register (TypeModule module) + public static Type extension_register (TypeModule module) { #endif return typeof (DataSourceRegistry); === modified file 'extra/ontology2code' --- extra/ontology2code 2011-08-06 15:29:40 +0000 +++ extra/ontology2code 2011-09-05 10:27:02 +0000 @@ -340,7 +340,7 @@ dest.write('parents = { %s };\n' % parent_uris) dest.write('children = { %s };\n' % children_uris) dest.write('all_children = { %s };\n' % all_children_uris) - dest.write('Symbol.register (uri, display_name, description, ' \ + dest.write('Symbol.Info.register (uri, display_name, description, ' \ 'parents, children, all_children);\n\n') class OntologyCodeGenerator: === modified file 'src/Makefile.am' --- src/Makefile.am 2011-08-31 12:23:34 +0000 +++ src/Makefile.am 2011-09-05 10:27:02 +0000 @@ -55,8 +55,8 @@ BUILT_SOURCES = zeitgeist-engine_vala.stamp extensions_vala.stamp -zeitgeist-engine_vala.stamp zeitgeist-engine.vapi: $(bluebird_VALASOURCES) - $(VALAC) $(VALAFLAGS) -C -H zeitgeist-engine.h --library zeitgeist-engine $^ +zeitgeist-engine_vala.stamp: $(bluebird_VALASOURCES) + $(VALA_V)$(VALAC) $(VALAFLAGS) -C -H zeitgeist-engine.h --library zeitgeist-engine $^ touch "$@" extensions_vala.stamp: zeitgeist-engine.vapi $(extensions_VALASOURCES) @@ -90,3 +90,8 @@ distclean-local: rm -f *.c *.o *.stamp *.~[0-9]~ + +VALA_V = $(VALA_V_$(V)) +VALA_V_ = $(VALA_V_$(AM_DEFAULT_VERBOSITY)) +VALA_V_0 = @echo " VALAC " $^; + === modified file 'src/errors.vala' --- src/errors.vala 2011-08-31 11:02:37 +0000 +++ src/errors.vala 2011-09-05 10:27:02 +0000 @@ -33,7 +33,7 @@ { try { - var bus = Bus.get_sync (BusType.SESSION, null); + Bus.get_sync (BusType.SESSION, null); } catch (Error err) { === modified file 'src/ontology.vala.in' --- src/ontology.vala.in 2011-08-12 11:39:56 +0000 +++ src/ontology.vala.in 2011-09-05 10:27:02 +0000 @@ -3,6 +3,7 @@ * Copyright © 2011 Collabora Ltd. * By Seif Lotfy <s...@lotfy.com> * By Siegfried-Angel Gevatter Pujals <siegfr...@gevatter.com> + * Copyright © 2011 Michal Hruby <michal....@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -22,61 +23,40 @@ namespace Zeitgeist { - private class Symbol + namespace Symbol { - private static HashTable<string, Symbol> all_symbols = null; + private static HashTable<string, Info> all_symbols = null; private static bool initialized = false; - private List<string> parents; - private List<string> children; - private List<string> all_children; - private string uri; - private string display_name; - private string description; - - private Symbol (string uri, string display_name, string description, - string[] parents, string[] children, string[] all_children) - { - this.uri = uri; - this.display_name = display_name; - this.description = description; - this.parents = new List<string> (); - for (int i = 0; i < parents.length; i++) - this.parents.append (parents[i]); - this.children = new List<string> (); - for (int i = 0; i < children.length; i++) - this.children.append (children[i]); - this.all_children = new List<string> (); - for (int i = 0; i < all_children.length; i++) - this.all_children.append (all_children[i]); - } - - public static string get_display_name (string symbol_uri) + public static unowned string get_display_name (string symbol_uri) { initialize_symbols (); + var symbol = all_symbols.lookup (symbol_uri); - if (symbol == null) - return symbol_uri; + if (symbol == null) return symbol_uri; + return symbol.display_name; } - public static string get_description(string symbol_uri) + public static unowned string get_description(string symbol_uri) { initialize_symbols (); + var symbol = all_symbols.lookup (symbol_uri); - if (symbol == null) - return "Unknown symbol: %s".printf (symbol_uri); + if (symbol == null) return ""; + return symbol.description; } - public static List<string> get_all_parents(string symbol_uri) + public static List<unowned string> get_all_parents(string symbol_uri) { initialize_symbols (); + var results = new List<string> (); var symbol = all_symbols.lookup (symbol_uri); - if (symbol == null) - return results; - foreach (string uri in symbol.parents) + if (symbol == null) return results; + + foreach (unowned string uri in symbol.parents) { results.append (uri); // Recursively get the other parents @@ -84,73 +64,107 @@ if (results.index (parent_uri) > -1) results.append (parent_uri); } + return results; } - public static List<string> get_all_children (string symbol_uri) + public static List<unowned string> get_all_children (string symbol_uri) { initialize_symbols (); + var results = new List<string> (); var symbol = all_symbols.lookup (symbol_uri); - if (symbol == null) - return results; - foreach (string uri in symbol.all_children) + if (symbol == null) return results; + + foreach (unowned string uri in symbol.all_children) results.append (uri); + return results; } - public static List<string> get_children (string symbol_uri) + public static List<unowned string> get_children (string symbol_uri) { initialize_symbols (); var results = new List<string> (); var symbol = all_symbols.lookup (symbol_uri); - if (symbol == null) - return results; - foreach (string uri in symbol.children) + if (symbol == null) return results; + + foreach (unowned string uri in symbol.children) results.append(uri); + return results; } - public static List<string> get_parents (string symbol_uri) + public static List<unowned string> get_parents (string symbol_uri) { initialize_symbols (); + var results = new List<string>(); var symbol = all_symbols.lookup (symbol_uri); - if (symbol == null) - return results; - foreach (string uri in symbol.parents) + if (symbol == null) return results; + + foreach (unowned string uri in symbol.parents) results.append (uri); + return results; } public static bool is_a (string symbol_uri, string parent_uri) { initialize_symbols (); - foreach (string uri in get_all_parents (symbol_uri)) + + foreach (unowned string uri in get_all_parents (symbol_uri)) if (parent_uri == uri) return true; return false; } + private static void initialize_symbols () + { + if (initialized) return; + initialized = true; + // *insert-auto-generated-code* + } + + } + + private class Symbol.Info + { + public List<string> parents; + public List<string> children; + public List<string> all_children; + public string uri; + public string display_name; + public string description; + + private Info (string uri, string display_name, string description, + string[] parents, string[] children, string[] all_children) + { + this.uri = uri; + this.display_name = display_name; + this.description = description; + this.parents = new List<string> (); + for (int i = 0; i < parents.length; i++) + this.parents.append (parents[i]); + this.children = new List<string> (); + for (int i = 0; i < children.length; i++) + this.children.append (children[i]); + this.all_children = new List<string> (); + for (int i = 0; i < all_children.length; i++) + this.all_children.append (all_children[i]); + } + internal static void register (string uri, string display_name, string description, string[] parents, string[] children, string[] all_children) { if (all_symbols == null) - all_symbols = new HashTable<string, Symbol> (str_hash, str_equal); - Symbol symbol = new Symbol (uri, display_name, description, + all_symbols = new HashTable<string, Info> (str_hash, str_equal); + Info symbol = new Info (uri, display_name, description, parents, children, all_children); all_symbols.insert (uri, symbol); } - private static void initialize_symbols () - { - if (initialized) - return; - initialized = true; - // *insert-auto-generated-code* - } - } } === modified file 'src/utils.vala' --- src/utils.vala 2011-08-26 10:15:10 +0000 +++ src/utils.vala 2011-09-05 10:27:02 +0000 @@ -29,8 +29,8 @@ private static string DATA_PATH; private static string DATABASE_FILE_PATH; private static string DATABASE_FILE_BACKUP_PATH; - private static string DEFAULT_LOG_PATH; private static string LOCAL_EXTENSIONS_PATH; + //private static string DEFAULT_LOG_PATH; FIXME: remove? public const string ZEITGEIST_DATA_FOLDER = "bluebird"; public const string USER_EXTENSION_PATH = ""; === modified file 'src/zeitgeist-daemon.vala' --- src/zeitgeist-daemon.vala 2011-09-02 16:38:41 +0000 +++ src/zeitgeist-daemon.vala 2011-09-05 10:27:02 +0000 @@ -228,7 +228,7 @@ notifications.remove_monitor (owner, monitor_path); } - public void register_dbus_object (DBusConnection conn) throws Error + public void register_dbus_object (DBusConnection conn) throws IOError { connection = conn; log_register_id = conn.register_object<RemoteLog> (
_______________________________________________ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp