[folks] Ensure private and internal data members begin with a _
- From: Travis Reitter <treitter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] Ensure private and internal data members begin with a _
- Date: Thu, 30 Dec 2010 01:24:23 +0000 (UTC)
commit a9bbcc8e1787511900ea738af3118e15b2cdae3e
Author: Travis Reitter <travis reitter collabora co uk>
Date: Mon Dec 27 16:28:38 2010 -0800
Ensure private and internal data members begin with a _
Helps bgo#629083
HACKING | 5 +
backends/key-file/kf-backend-factory.vala | 6 +-
backends/key-file/kf-persona-store.vala | 64 +++---
backends/key-file/kf-persona.vala | 29 +--
backends/telepathy/lib/tpf-logger.vala | 36 ++--
backends/telepathy/lib/tpf-persona-store.vala | 317 +++++++++++++------------
backends/telepathy/lib/tpf-persona.vala | 8 +-
backends/telepathy/tp-backend-factory.vala | 6 +-
backends/telepathy/tp-backend.vala | 19 +-
folks/backend-store.vala | 18 +-
folks/individual-aggregator.vala | 89 ++++----
folks/individual.vala | 26 +-
12 files changed, 316 insertions(+), 307 deletions(-)
---
diff --git a/HACKING b/HACKING
index 95a2789..8fd23e8 100644
--- a/HACKING
+++ b/HACKING
@@ -73,3 +73,8 @@ Vala-specific rules
blocks. It's arguable that these should be aligned in column 0, as in regular
C functions, but it's too late to change this (as it would make 'git blame'
useless).
+
+5. Private and internal class data members should beging with a _ (public data
+ members and local variables should not begin with a _). This is to make
+ non-public data members instantly recognizable as such (which helps
+ readability).
diff --git a/backends/key-file/kf-backend-factory.vala b/backends/key-file/kf-backend-factory.vala
index 104d883..c779cf8 100644
--- a/backends/key-file/kf-backend-factory.vala
+++ b/backends/key-file/kf-backend-factory.vala
@@ -26,14 +26,14 @@
using Folks;
using Folks.Backends.Kf;
-private BackendFactory backend_factory = null;
+private BackendFactory _backend_factory = null;
/**
* The backend module entry point.
*/
public void module_init (BackendStore backend_store)
{
- backend_factory = new BackendFactory (backend_store);
+ _backend_factory = new BackendFactory (backend_store);
}
/**
@@ -41,7 +41,7 @@ public void module_init (BackendStore backend_store)
*/
public void module_finalize (BackendStore backend_store)
{
- backend_factory = null;
+ _backend_factory = null;
}
/**
diff --git a/backends/key-file/kf-persona-store.vala b/backends/key-file/kf-persona-store.vala
index 7b9986e..3f5ab65 100644
--- a/backends/key-file/kf-persona-store.vala
+++ b/backends/key-file/kf-persona-store.vala
@@ -32,10 +32,10 @@ using Folks.Backends.Kf;
public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore
{
private HashTable<string, Persona> _personas;
- private File file;
- private GLib.KeyFile key_file;
- private uint first_unused_id = 0;
- private unowned Cancellable save_key_file_cancellable = null;
+ private File _file;
+ private GLib.KeyFile _key_file;
+ private uint _first_unused_id = 0;
+ private unowned Cancellable _save_key_file_cancellable = null;
private bool _is_prepared = false;
/**
@@ -125,7 +125,7 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore
display_name: id);
this.trust_level = PersonaStoreTrust.FULL;
- this.file = key_file;
+ this._file = key_file;
this._personas = new HashTable<string, Persona> (str_hash, str_equal);
}
@@ -138,8 +138,8 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore
{
if (!this._is_prepared)
{
- string filename = this.file.get_path ();
- this.key_file = new GLib.KeyFile ();
+ string filename = this._file.get_path ();
+ this._key_file = new GLib.KeyFile ();
/* Load or create the file */
while (true)
@@ -152,11 +152,11 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore
string contents = null;
size_t length = 0;
- yield this.file.load_contents_async (null, out contents,
+ yield this._file.load_contents_async (null, out contents,
out length);
if (length > 0)
{
- this.key_file.load_from_data (contents, length,
+ this._key_file.load_from_data (contents, length,
KeyFileFlags.KEEP_COMMENTS);
}
break;
@@ -176,7 +176,7 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore
}
/* Ensure the parent directory tree exists for the new file */
- File parent_dir = this.file.get_parent ();
+ File parent_dir = this._file.get_parent ();
try
{
@@ -203,7 +203,7 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore
try
{
/* Create the file */
- FileOutputStream stream = yield this.file.create_async (
+ FileOutputStream stream = yield this._file.create_async (
FileCreateFlags.PRIVATE, Priority.DEFAULT);
yield stream.close_async (Priority.DEFAULT);
}
@@ -225,13 +225,13 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore
/* We've loaded or created a key file by now, so cycle through the
* groups: each group is a persona which we have to create and
* emit */
- string[] groups = this.key_file.get_groups ();
+ string[] groups = this._key_file.get_groups ();
foreach (string persona_id in groups)
{
- if (persona_id.to_int () == this.first_unused_id)
- this.first_unused_id++;
+ if (persona_id.to_int () == this._first_unused_id)
+ this._first_unused_id++;
- Persona persona = new Kf.Persona (this.key_file, persona_id,
+ Persona persona = new Kf.Persona (this._key_file, persona_id,
this);
this._personas.insert (persona.iid, persona);
}
@@ -261,7 +261,7 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore
* the main thread). We would cause a deadlock if we used anything as
* fancy/useful as a GCond. */
MainContext context = MainContext.default ();
- while (this.save_key_file_cancellable != null)
+ while (this._save_key_file_cancellable != null)
context.iteration (true);
}
@@ -275,7 +275,7 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore
try
{
- this.key_file.remove_group (persona.display_id);
+ this._key_file.remove_group (persona.display_id);
yield this.save_key_file ();
/* Signal the removal of the Persona */
@@ -316,14 +316,14 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore
string persona_id = null;
do
{
- persona_id = this.first_unused_id.to_string ();
- this.first_unused_id++;
+ persona_id = this._first_unused_id.to_string ();
+ this._first_unused_id++;
}
- while (this.key_file.has_group (persona_id) == true);
+ while (this._key_file.has_group (persona_id) == true);
/* Create a new persona and set its im-addresses property to update the
* key file */
- Persona persona = new Kf.Persona (this.key_file, persona_id, this);
+ Persona persona = new Kf.Persona (this._key_file, persona_id, this);
this._personas.insert (persona.iid, persona);
persona.im_addresses = im_addresses;
@@ -338,20 +338,20 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore
internal async void save_key_file ()
{
- string key_file_data = this.key_file.to_data ();
+ string key_file_data = this._key_file.to_data ();
Cancellable cancellable = new Cancellable ();
- debug ("Saving key file '%s'.", this.file.get_path ());
+ debug ("Saving key file '%s'.", this._file.get_path ());
/* There's no point in having two competing file write operations.
* We can ensure that only one is running by just checking if a
* cancellable is set. This is thread safe because the code in this file
* is all run in the main thread (inside the main loop), so only we touch
- * this.save_key_file_cancellable (albeit in many weird and wonderful
+ * this._save_key_file_cancellable (albeit in many weird and wonderful
* orders due to idle handler queuing). */
- if (this.save_key_file_cancellable != null)
- this.save_key_file_cancellable.cancel ();
- this.save_key_file_cancellable = cancellable;
+ if (this._save_key_file_cancellable != null)
+ this._save_key_file_cancellable.cancel ();
+ this._save_key_file_cancellable = cancellable;
try
{
@@ -363,11 +363,11 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore
* take this into account until we depend explicitly on
* Vala >= 0.11. */
#if VALA_0_12
- yield this.file.replace_contents_async (key_file_data,
+ yield this._file.replace_contents_async (key_file_data,
key_file_data.length, null, false, FileCreateFlags.PRIVATE,
cancellable);
#else
- yield this.file.replace_contents_async (key_file_data,
+ yield this._file.replace_contents_async (key_file_data,
key_file_data.size (), null, false, FileCreateFlags.PRIVATE,
cancellable);
#endif
@@ -379,11 +379,11 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore
/* Translators: the first parameter is a filename, the second is
* an error message. */
warning (_("Could not write updated key file '%s': %s"),
- this.file.get_path (), e.message);
+ this._file.get_path (), e.message);
}
}
- if (this.save_key_file_cancellable == cancellable)
- this.save_key_file_cancellable = null;
+ if (this._save_key_file_cancellable == cancellable)
+ this._save_key_file_cancellable = null;
}
}
diff --git a/backends/key-file/kf-persona.vala b/backends/key-file/kf-persona.vala
index 5bd5a99..c6d7c01 100644
--- a/backends/key-file/kf-persona.vala
+++ b/backends/key-file/kf-persona.vala
@@ -32,7 +32,7 @@ public class Folks.Backends.Kf.Persona : Folks.Persona,
Aliasable,
IMable
{
- private unowned GLib.KeyFile key_file;
+ private unowned GLib.KeyFile _key_file;
/* FIXME: As described in the IMable interface, we have to use
* GenericArray<string> here rather than just string[], as null-terminated
* arrays aren't supported as generic types. */
@@ -65,7 +65,7 @@ public class Folks.Backends.Kf.Persona : Folks.Persona,
debug ("Setting alias of Kf.Persona '%s' to '%s'.", this.uid, value);
this._alias = value;
- this.key_file.set_string (this.display_id, "__alias", value);
+ this._key_file.set_string (this.display_id, "__alias", value);
((Kf.PersonaStore) this.store).save_key_file.begin ();
}
@@ -87,7 +87,7 @@ public class Folks.Backends.Kf.Persona : Folks.Persona,
try
{
unowned string protocol = (string) k;
- this.key_file.remove_key (this.display_id, protocol);
+ this._key_file.remove_key (this.display_id, protocol);
}
catch (KeyFileError e)
{
@@ -135,12 +135,10 @@ public class Folks.Backends.Kf.Persona : Folks.Persona,
for (; offset > 0; offset--)
addresses[addresses.length - offset] = null;
- unowned string[] _addresses =
- (string[]) ((PtrArray) addresses).pdata;
- _addresses.length = (int) addresses.length;
+ unowned string[] addrs = (string[]) ((PtrArray) addresses).pdata;
+ addrs.length = (int) addresses.length;
- this.key_file.set_string_list (this.display_id, protocol,
- _addresses);
+ this._key_file.set_string_list (this.display_id, protocol, addrs);
im_addresses.insert (protocol, addresses);
});
@@ -171,27 +169,28 @@ public class Folks.Backends.Kf.Persona : Folks.Persona,
debug ("Adding key-file Persona '%s' (IID '%s', group '%s')", uid, iid,
id);
- this.key_file = key_file;
+ this._key_file = key_file;
this._im_addresses = new HashTable<string, GenericArray<string>> (
str_hash, str_equal);
/* Load the IM addresses from the key file */
try
{
- string[] keys = this.key_file.get_keys (this.display_id);
+ string[] keys = this._key_file.get_keys (this.display_id);
foreach (string key in keys)
{
/* Alias */
if (key == "__alias")
{
- this._alias = this.key_file.get_string (this.display_id, key);
+ this._alias = this._key_file.get_string (this.display_id,
+ key);
debug (" Loaded alias '%s'.", this._alias);
continue;
}
/* IM addresses */
string protocol = key;
- string[] im_addresses = this.key_file.get_string_list (
+ string[] im_addresses = this._key_file.get_string_list (
this.display_id, protocol);
/* FIXME: We have to convert our nice efficient string[] to a
@@ -202,12 +201,12 @@ public class Folks.Backends.Kf.Persona : Folks.Persona,
GenericArray<string> im_address_array =
new GenericArray<string> ();
- foreach (string _address in im_addresses)
+ foreach (string im_address in im_addresses)
{
try
{
- string address =
- IMable.normalise_im_address (_address, protocol);
+ string address = IMable.normalise_im_address (im_address,
+ protocol);
if (!address_set.contains (address))
{
diff --git a/backends/telepathy/lib/tpf-logger.vala b/backends/telepathy/lib/tpf-logger.vala
index f4153fa..b130626 100644
--- a/backends/telepathy/lib/tpf-logger.vala
+++ b/backends/telepathy/lib/tpf-logger.vala
@@ -45,8 +45,8 @@ private interface LoggerIface : DBus.Object
internal class Logger : GLib.Object
{
- private static LoggerIface logger;
- private string account_path;
+ private static LoggerIface _logger;
+ private string _account_path;
public signal void invalidated ();
public signal void favourite_contacts_changed (string[] added,
@@ -54,7 +54,7 @@ internal class Logger : GLib.Object
public Logger (string account_path) throws DBus.Error
{
- if (this.logger == null)
+ if (this._logger == null)
{
/* Create a logger proxy for favourites support */
/* FIXME: This should be ported to the Vala GDBus stuff and made
@@ -69,24 +69,24 @@ internal class Logger : GLib.Object
* the logger service disappears. This is, however, blocked by:
* https://bugzilla.gnome.org/show_bug.cgi?id=623198 */
var dbus_conn = DBus.Bus.get (DBus.BusType.SESSION);
- this.logger = dbus_conn.get_object (
+ this._logger = dbus_conn.get_object (
"org.freedesktop.Telepathy.Logger",
"/org/freedesktop/Telepathy/Logger",
"org.freedesktop.Telepathy.Logger.DRAFT") as LoggerIface;
- this.logger.destroy.connect (() =>
+ this._logger.destroy.connect (() =>
{
/* We've lost the connection to the logger service, so invalidate
* this logger proxy (and all the others too). */
- this.logger = null;
+ this._logger = null;
this.invalidated ();
});
}
- this.account_path = account_path;
- this.logger.favourite_contacts_changed.connect ((ap, a, r) =>
+ this._account_path = account_path;
+ this._logger.favourite_contacts_changed.connect ((ap, a, r) =>
{
- if (ap != this.account_path)
+ if (ap != this._account_path)
return;
this.favourite_contacts_changed (a, r);
@@ -96,15 +96,15 @@ internal class Logger : GLib.Object
public async string[] get_favourite_contacts () throws DBus.Error
{
/* Invalidated */
- if (this.logger == null)
+ if (this._logger == null)
return {};
- AccountFavourites[] favs = yield this.logger.get_favourite_contacts ();
+ AccountFavourites[] favs = yield this._logger.get_favourite_contacts ();
foreach (AccountFavourites account in favs)
{
/* We only want the favourites from this account */
- if (account.account_path == this.account_path)
+ if (account.account_path == this._account_path)
return account.ids;
}
@@ -114,20 +114,20 @@ internal class Logger : GLib.Object
public async void add_favourite_contact (string id) throws DBus.Error
{
/* Invalidated */
- if (this.logger == null)
+ if (this._logger == null)
return;
- yield this.logger.add_favourite_contact (
- new DBus.ObjectPath (this.account_path), id);
+ yield this._logger.add_favourite_contact (
+ new DBus.ObjectPath (this._account_path), id);
}
public async void remove_favourite_contact (string id) throws DBus.Error
{
/* Invalidated */
- if (this.logger == null)
+ if (this._logger == null)
return;
- yield this.logger.remove_favourite_contact (
- new DBus.ObjectPath (this.account_path), id);
+ yield this._logger.remove_favourite_contact (
+ new DBus.ObjectPath (this._account_path), id);
}
}
diff --git a/backends/telepathy/lib/tpf-persona-store.vala b/backends/telepathy/lib/tpf-persona-store.vala
index 1273bb3..3301ac2 100644
--- a/backends/telepathy/lib/tpf-persona-store.vala
+++ b/backends/telepathy/lib/tpf-persona-store.vala
@@ -35,15 +35,15 @@ public class Tpf.PersonaStore : Folks.PersonaStore
{
/* FIXME: expose the interface strings in the introspected tp-glib bindings
*/
- private static string tp_channel_iface = "org.freedesktop.Telepathy.Channel";
- private static string tp_channel_contact_list_type = tp_channel_iface +
+ private static string _tp_channel_iface = "org.freedesktop.Telepathy.Channel";
+ private static string _tp_channel_contact_list_type = _tp_channel_iface +
".Type.ContactList";
- private static string tp_channel_channel_type = tp_channel_iface +
+ private static string _tp_channel_channel_type = _tp_channel_iface +
".ChannelType";
- private static string tp_channel_handle_type = tp_channel_iface +
+ private static string _tp_channel_handle_type = _tp_channel_iface +
".TargetHandleType";
- private string[] undisplayed_groups = { "publish", "stored", "subscribe" };
- private static ContactFeature[] contact_features =
+ private string[] _undisplayed_groups = { "publish", "stored", "subscribe" };
+ private static ContactFeature[] _contact_features =
{
ContactFeature.ALIAS,
ContactFeature.AVATAR_DATA,
@@ -55,24 +55,24 @@ public class Tpf.PersonaStore : Folks.PersonaStore
private HashTable<string, Persona> _personas;
/* universal, contact owner handles (not channel-specific) */
- private HashMap<uint, Persona> handle_persona_map;
- private HashMap<Channel, HashSet<Persona>> channel_group_personas_map;
- private HashMap<Channel, HashSet<uint>> channel_group_incoming_adds;
- private HashMap<string, HashSet<Tpf.Persona>> group_outgoing_adds;
- private HashMap<string, HashSet<Tpf.Persona>> group_outgoing_removes;
- private HashMap<string, Channel> standard_channels_unready;
- private HashMap<string, Channel> group_channels_unready;
- private HashMap<string, Channel> groups;
+ private HashMap<uint, Persona> _handle_persona_map;
+ private HashMap<Channel, HashSet<Persona>> _channel_group_personas_map;
+ private HashMap<Channel, HashSet<uint>> _channel_group_incoming_adds;
+ private HashMap<string, HashSet<Tpf.Persona>> _group_outgoing_adds;
+ private HashMap<string, HashSet<Tpf.Persona>> _group_outgoing_removes;
+ private HashMap<string, Channel> _standard_channels_unready;
+ private HashMap<string, Channel> _group_channels_unready;
+ private HashMap<string, Channel> _groups;
/* FIXME: Should be HashSet<Handle> */
- private HashSet<uint> favourite_handles;
- private Channel publish;
- private Channel stored;
- private Channel subscribe;
- private Connection conn;
- private TpLowlevel ll;
- private AccountManager account_manager;
- private Logger logger;
- private Contact self_contact;
+ private HashSet<uint> _favourite_handles;
+ private Channel _publish;
+ private Channel _stored;
+ private Channel _subscribe;
+ private Connection _conn;
+ private TpLowlevel _ll;
+ private AccountManager _account_manager;
+ private Logger _logger;
+ private Contact _self_contact;
private MaybeBool _can_add_personas = MaybeBool.UNSET;
private MaybeBool _can_alias_personas = MaybeBool.UNSET;
private MaybeBool _can_group_personas = MaybeBool.UNSET;
@@ -197,22 +197,23 @@ public class Tpf.PersonaStore : Folks.PersonaStore
this._personas = new HashTable<string, Persona> (str_hash,
str_equal);
- this.conn = null;
- this.handle_persona_map = new HashMap<uint, Persona> ();
- this.channel_group_personas_map = new HashMap<Channel, HashSet<Persona>> (
+ this._conn = null;
+ this._handle_persona_map = new HashMap<uint, Persona> ();
+ this._channel_group_personas_map =
+ new HashMap<Channel, HashSet<Persona>> ();
+ this._channel_group_incoming_adds =
+ new HashMap<Channel, HashSet<uint>> ();
+ this._group_outgoing_adds = new HashMap<string, HashSet<Tpf.Persona>> ();
+ this._group_outgoing_removes = new HashMap<string, HashSet<Tpf.Persona>> (
);
- this.channel_group_incoming_adds = new HashMap<Channel, HashSet<uint>> ();
- this.group_outgoing_adds = new HashMap<string, HashSet<Tpf.Persona>> ();
- this.group_outgoing_removes = new HashMap<string, HashSet<Tpf.Persona>> (
- );
- this.publish = null;
- this.stored = null;
- this.subscribe = null;
- this.standard_channels_unready = new HashMap<string, Channel> ();
- this.group_channels_unready = new HashMap<string, Channel> ();
- this.groups = new HashMap<string, Channel> ();
- this.favourite_handles = new HashSet<uint> ();
- this.ll = new TpLowlevel ();
+ this._publish = null;
+ this._stored = null;
+ this._subscribe = null;
+ this._standard_channels_unready = new HashMap<string, Channel> ();
+ this._group_channels_unready = new HashMap<string, Channel> ();
+ this._groups = new HashMap<string, Channel> ();
+ this._favourite_handles = new HashSet<uint> ();
+ this._ll = new TpLowlevel ();
}
/**
@@ -226,9 +227,9 @@ public class Tpf.PersonaStore : Folks.PersonaStore
{
if (!this._is_prepared)
{
- this.account_manager = AccountManager.dup ();
+ this._account_manager = AccountManager.dup ();
- this.account_manager.account_disabled.connect ((a) =>
+ this._account_manager.account_disabled.connect ((a) =>
{
if (this.account == a)
{
@@ -237,7 +238,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
this.removed ();
}
});
- this.account_manager.account_removed.connect ((a) =>
+ this._account_manager.account_removed.connect ((a) =>
{
if (this.account == a)
{
@@ -246,7 +247,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
this.removed ();
}
});
- this.account_manager.account_validity_changed.connect (
+ this._account_manager.account_validity_changed.connect (
(a, valid) =>
{
if (!valid && this.account == a)
@@ -273,21 +274,21 @@ public class Tpf.PersonaStore : Folks.PersonaStore
try
{
- this.logger = new Logger (this.id);
- this.logger.invalidated.connect (() =>
+ this._logger = new Logger (this.id);
+ this._logger.invalidated.connect (() =>
{
warning (
_("Lost connection to the telepathy-logger service."));
- this.logger = null;
+ this._logger = null;
});
- this.logger.favourite_contacts_changed.connect (
+ this._logger.favourite_contacts_changed.connect (
this.favourite_contacts_changed_cb);
}
catch (DBus.Error e)
{
warning (
_("Couldn't connect to the telepathy-logger service."));
- this.logger = null;
+ this._logger = null;
}
this._is_prepared = true;
@@ -298,13 +299,13 @@ public class Tpf.PersonaStore : Folks.PersonaStore
private async void initialise_favourite_contacts ()
{
- if (this.logger == null)
+ if (this._logger == null)
return;
/* Get an initial set of favourite contacts */
try
{
- string[] contacts = yield this.logger.get_favourite_contacts ();
+ string[] contacts = yield this._logger.get_favourite_contacts ();
if (contacts.length == 0)
return;
@@ -313,7 +314,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
* also held by the relevant contact objects, and will be released
* as appropriate by those objects (we're circumventing tp-glib's
* handle reference counting). */
- this.conn.request_handles (-1, HandleType.CONTACT, contacts,
+ this._conn.request_handles (-1, HandleType.CONTACT, contacts,
(c, ht, h, i, e, w) =>
{
try
@@ -349,27 +350,28 @@ public class Tpf.PersonaStore : Folks.PersonaStore
for (var i = 0; i < handles.length; i++)
{
Handle h = handles[i];
- Persona p = this.handle_persona_map[h];
+ Persona p = this._handle_persona_map[h];
/* Add/Remove the handle to the set of favourite handles, since we
* might not have the corresponding contact yet */
if (add)
- this.favourite_handles.add (h);
+ this._favourite_handles.add (h);
else
- this.favourite_handles.remove (h);
+ this._favourite_handles.remove (h);
- /* If the persona isn't in the handle_persona_map yet, it's most
+ /* If the persona isn't in the _handle_persona_map yet, it's most
* likely because the account hasn't connected yet (and we haven't
* received the roster). If there are already entries in
- * handle_persona_map, the account *is* connected and we should
+ * _handle_persona_map, the account *is* connected and we should
* warn about the unknown persona.
- * We have to take into account that this.self_contact may be
+ * We have to take into account that this._self_contact may be
* retrieved before or after the rest of the account's contact list,
- * affecting the size of this.handle_persona_map. */
+ * affecting the size of this._handle_persona_map. */
if (p == null &&
- ((this.self_contact == null &&
- this.handle_persona_map.size > 0) ||
- (this.self_contact != null && this.handle_persona_map.size > 1)))
+ ((this._self_contact == null &&
+ this._handle_persona_map.size > 0) ||
+ (this._self_contact != null &&
+ this._handle_persona_map.size > 1)))
{
/* Translators: the parameter is an identifier. */
warning (_("Unknown persona '%s' in favorites list."), ids[i]);
@@ -385,13 +387,13 @@ public class Tpf.PersonaStore : Folks.PersonaStore
private void favourite_contacts_changed_cb (string[] added, string[] removed)
{
/* Don't listen to favourites updates if the account is disconnected. */
- if (this.conn == null)
+ if (this._conn == null)
return;
/* Add favourites */
if (added.length > 0)
{
- this.conn.request_handles (-1, HandleType.CONTACT, added,
+ this._conn.request_handles (-1, HandleType.CONTACT, added,
(c, ht, h, i, e, w) =>
{
try
@@ -412,7 +414,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
/* Remove favourites */
if (removed.length > 0)
{
- this.conn.request_handles (-1, HandleType.CONTACT, removed,
+ this._conn.request_handles (-1, HandleType.CONTACT, removed,
(c, ht, h, i, e, w) =>
{
try
@@ -471,15 +473,15 @@ public class Tpf.PersonaStore : Folks.PersonaStore
private void connection_ready_cb (Object s, ParamSpec? p)
{
Connection c = (Connection) s;
- this.ll.connection_connect_to_new_group_channels (c,
+ this._ll.connection_connect_to_new_group_channels (c,
this.new_group_channels_cb);
- this.ll.connection_get_alias_flags_async.begin (c, (s2, res) =>
+ this._ll.connection_get_alias_flags_async.begin (c, (s2, res) =>
{
var new_can_alias = MaybeBool.FALSE;
try
{
- var flags = this.ll.connection_get_alias_flags_async.end (res);
+ var flags = this._ll.connection_get_alias_flags_async.end (res);
if ((flags &
ConnectionAliasFlags.CONNECTION_ALIAS_FLAG_USER_SET) > 0)
{
@@ -500,13 +502,13 @@ public class Tpf.PersonaStore : Folks.PersonaStore
this.notify_property ("can-alias-personas");
});
- this.ll.connection_get_requestable_channel_classes_async.begin (c,
+ this._ll.connection_get_requestable_channel_classes_async.begin (c,
(s3, res3) =>
{
var new_can_group = MaybeBool.FALSE;
try
{
- var ll = this.ll;
+ var ll = this._ll;
GenericArray<weak void*> v;
int i;
@@ -523,12 +525,12 @@ public class Tpf.PersonaStore : Folks.PersonaStore
val.get_boxed ();
var channel_type = TelepathyGLib.asv_get_string (props,
- tp_channel_channel_type);
+ _tp_channel_channel_type);
bool handle_type_valid;
var handle_type = TelepathyGLib.asv_get_uint32 (props,
- tp_channel_handle_type, out handle_type_valid);
+ _tp_channel_handle_type, out handle_type_valid);
- if ((channel_type == tp_channel_contact_list_type) &&
+ if ((channel_type == _tp_channel_contact_list_type) &&
handle_type_valid &&
(handle_type == HandleType.GROUP))
{
@@ -555,14 +557,14 @@ public class Tpf.PersonaStore : Folks.PersonaStore
this.add_standard_channel (c, "publish");
this.add_standard_channel (c, "stored");
this.add_standard_channel (c, "subscribe");
- this.conn = c;
+ this._conn = c;
/* Add the local user */
- conn.notify["self-handle"].connect (this.self_handle_changed_cb);
- if (conn.self_handle != 0)
- this.self_handle_changed_cb (conn, null);
+ _conn.notify["self-handle"].connect (this.self_handle_changed_cb);
+ if (_conn.self_handle != 0)
+ this.self_handle_changed_cb (_conn, null);
- /* We can only initialise the favourite contacts once conn is prepared */
+ /* We can only initialise the favourite contacts once _conn is prepared */
this.initialise_favourite_contacts.begin ();
}
@@ -571,8 +573,8 @@ public class Tpf.PersonaStore : Folks.PersonaStore
Connection c = (Connection) s;
/* Remove the old self persona */
- if (this.self_contact != null)
- this.ignore_by_handle (this.self_contact.handle, null, null, 0);
+ if (this._self_contact != null)
+ this.ignore_by_handle (this._self_contact.handle, null, null, 0);
if (c.self_handle == 0)
return;
@@ -582,7 +584,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
/* We have to do it this way instead of using
* TpLowleve.get_contacts_by_handle_async() as we're in a notification
* callback */
- c.get_contacts_by_handle (contact_handles, (uint[]) contact_features,
+ c.get_contacts_by_handle (contact_handles, (uint[]) _contact_features,
(conn, contacts, failed, error, weak_object) =>
{
if (error != null)
@@ -602,7 +604,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
GLib.List<Persona> personas = new GLib.List<Persona> ();
personas.prepend (persona);
- this.self_contact = contact;
+ this._self_contact = contact;
this.personas_changed (personas, null, null, null, 0);
},
this);
@@ -628,11 +630,11 @@ public class Tpf.PersonaStore : Folks.PersonaStore
var group = channel.get_identifier ();
var change_maps = new HashMap<HashSet<Tpf.Persona>, bool> ();
- if (this.group_outgoing_adds[group] != null)
- change_maps.set (this.group_outgoing_adds[group], true);
+ if (this._group_outgoing_adds[group] != null)
+ change_maps.set (this._group_outgoing_adds[group], true);
- if (this.group_outgoing_removes[group] != null)
- change_maps.set (this.group_outgoing_removes[group], false);
+ if (this._group_outgoing_removes[group] != null)
+ change_maps.set (this._group_outgoing_removes[group], false);
if (change_maps.size < 1)
return;
@@ -645,7 +647,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
{
try
{
- this.ll.channel_group_change_membership (channel,
+ this._ll.channel_group_change_membership (channel,
(Handle) persona.contact.handle, entry.value);
}
catch (GLib.Error e)
@@ -679,7 +681,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
/* hold a ref to the channel here until it's ready, so it doesn't
* disappear */
- this.standard_channels_unready[channel.get_identifier ()] = channel;
+ this._standard_channels_unready[channel.get_identifier ()] = channel;
channel.notify["channel-ready"].connect ((s, p) =>
{
@@ -690,21 +692,21 @@ public class Tpf.PersonaStore : Folks.PersonaStore
if (name == "publish")
{
- this.publish = c;
+ this._publish = c;
c.group_members_changed_detailed.connect (
this.publish_channel_group_members_changed_detailed_cb);
}
else if (name == "stored")
{
- this.stored = c;
+ this._stored = c;
c.group_members_changed_detailed.connect (
this.stored_channel_group_members_changed_detailed_cb);
}
else if (name == "subscribe")
{
- this.subscribe = c;
+ this._subscribe = c;
c.group_members_changed_detailed.connect (
this.subscribe_channel_group_members_changed_detailed_cb);
@@ -716,7 +718,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
c.group_get_flags (), 0);
}
- this.standard_channels_unready.unset (name);
+ this._standard_channels_unready.unset (name);
c.invalidated.connect (this.channel_invalidated_cb);
@@ -820,9 +822,9 @@ public class Tpf.PersonaStore : Folks.PersonaStore
this.channel_group_pend_incoming_adds.begin (channel, added, true);
/* expose ourselves to anyone we can see */
- if (this.publish != null)
+ if (this._publish != null)
{
- this.channel_group_pend_incoming_adds.begin (this.publish, added,
+ this.channel_group_pend_incoming_adds.begin (this._publish, added,
true);
}
}
@@ -842,21 +844,21 @@ public class Tpf.PersonaStore : Folks.PersonaStore
{
var channel = (Channel) proxy;
- this.channel_group_personas_map.unset (channel);
- this.channel_group_incoming_adds.unset (channel);
+ this._channel_group_personas_map.unset (channel);
+ this._channel_group_incoming_adds.unset (channel);
- if (proxy == this.publish)
- this.publish = null;
- else if (proxy == this.stored)
- this.stored = null;
- else if (proxy == this.subscribe)
- this.subscribe = null;
+ if (proxy == this._publish)
+ this._publish = null;
+ else if (proxy == this._stored)
+ this._stored = null;
+ else if (proxy == this._subscribe)
+ this._subscribe = null;
else
{
var error = new GLib.Error ((Quark) domain, code, "%s", message);
var name = channel.get_identifier ();
this.group_removed (name, error);
- this.groups.unset (name);
+ this._groups.unset (name);
}
}
@@ -865,20 +867,20 @@ public class Tpf.PersonaStore : Folks.PersonaStore
{
unowned TelepathyGLib.Intset members;
- if (this.subscribe != null)
+ if (this._subscribe != null)
{
- members = this.subscribe.group_get_members ();
+ members = this._subscribe.group_get_members ();
if (members.is_member (handle))
return;
- members = this.subscribe.group_get_remote_pending ();
+ members = this._subscribe.group_get_remote_pending ();
if (members.is_member (handle))
return;
}
- if (this.publish != null)
+ if (this._publish != null)
{
- members = this.publish.group_get_members ();
+ members = this._publish.group_get_members ();
if (members.is_member (handle))
return;
}
@@ -889,7 +891,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
uint32 actor_handle = TelepathyGLib.asv_get_uint32 (details, "actor",
out valid);
if (actor_handle > 0 && valid)
- actor = this.handle_persona_map[actor_handle];
+ actor = this._handle_persona_map[actor_handle];
Groupable.ChangeReason reason = Groupable.ChangeReason.NONE;
uint32 tp_reason = TelepathyGLib.asv_get_uint32 (details, "change-reason",
@@ -908,19 +910,20 @@ public class Tpf.PersonaStore : Folks.PersonaStore
private void ignore_by_handle (uint handle, string? message, Persona? actor,
Groupable.ChangeReason reason)
{
- var persona = this.handle_persona_map[handle];
+ var persona = this._handle_persona_map[handle];
debug ("Ignoring handle %u (persona: %p)", handle, persona);
- if (this.self_contact != null && this.self_contact.handle == handle)
- this.self_contact = null;
+ if (this._self_contact != null && this._self_contact.handle == handle)
+ this._self_contact = null;
/*
* remove all handle-keyed entries
*/
- this.handle_persona_map.unset (handle);
+ this._handle_persona_map.unset (handle);
- /* skip channel_group_incoming_adds because they occurred after removal */
+ /* skip _channel_group_incoming_adds because they occurred after removal
+ */
if (persona == null)
return;
@@ -928,16 +931,16 @@ public class Tpf.PersonaStore : Folks.PersonaStore
/*
* remove all persona-keyed entries
*/
- foreach (var channel in this.channel_group_personas_map.keys)
+ foreach (var channel in this._channel_group_personas_map.keys)
{
- var members = this.channel_group_personas_map[channel];
+ var members = this._channel_group_personas_map[channel];
if (members != null)
members.remove (persona);
}
- foreach (var name in this.group_outgoing_adds.keys)
+ foreach (var name in this._group_outgoing_adds.keys)
{
- var members = this.group_outgoing_adds[name];
+ var members = this._group_outgoing_adds[name];
if (members != null)
members.remove (persona);
}
@@ -958,7 +961,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
{
var tp_persona = (Tpf.Persona) persona;
- if (tp_persona.contact == this.self_contact)
+ if (tp_persona.contact == this._self_contact)
{
throw new PersonaStoreError.UNSUPPORTED_ON_USER (
_("Personas representing the local user may not be removed."));
@@ -966,7 +969,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
try
{
- this.ll.channel_group_change_membership (this.stored,
+ this._ll.channel_group_change_membership (this._stored,
(Handle) tp_persona.contact.handle, false);
}
catch (GLib.Error e1)
@@ -982,7 +985,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
try
{
- this.ll.channel_group_change_membership (this.subscribe,
+ this._ll.channel_group_change_membership (this._subscribe,
(Handle) tp_persona.contact.handle, false);
}
catch (GLib.Error e2)
@@ -998,7 +1001,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
try
{
- this.ll.channel_group_change_membership (this.publish,
+ this._ll.channel_group_change_membership (this._publish,
(Handle) tp_persona.contact.handle, false);
}
catch (GLib.Error e3)
@@ -1036,15 +1039,15 @@ public class Tpf.PersonaStore : Folks.PersonaStore
var channel_handle = (Handle) adds.index (i);
var contact_handle = channel.group_get_handle_owner (
channel_handle);
- var persona = this.handle_persona_map[contact_handle];
+ var persona = this._handle_persona_map[contact_handle];
if (persona == null)
{
HashSet<uint>? contact_handles =
- this.channel_group_incoming_adds[channel];
+ this._channel_group_incoming_adds[channel];
if (contact_handles == null)
{
contact_handles = new HashSet<uint> ();
- this.channel_group_incoming_adds[channel] =
+ this._channel_group_incoming_adds[channel] =
contact_handles;
}
contact_handles.add (contact_handle);
@@ -1059,15 +1062,15 @@ public class Tpf.PersonaStore : Folks.PersonaStore
{
/* hold a ref to the channel here until it's ready, so it doesn't
* disappear */
- this.group_channels_unready[channel.get_identifier ()] = channel;
+ this._group_channels_unready[channel.get_identifier ()] = channel;
channel.notify["channel-ready"].connect ((s, p) =>
{
var c = (Channel) s;
var name = c.get_identifier ();
- this.groups[name] = c;
- this.group_channels_unready.unset (name);
+ this._groups[name] = c;
+ this._group_channels_unready.unset (name);
c.invalidated.connect (this.channel_invalidated_cb);
c.group_members_changed_detailed.connect (
@@ -1100,9 +1103,9 @@ public class Tpf.PersonaStore : Folks.PersonaStore
string group, bool is_member)
{
var tp_persona = (Tpf.Persona) persona;
- var channel = this.groups[group];
- var change_map = is_member ? this.group_outgoing_adds :
- this.group_outgoing_removes;
+ var channel = this._groups[group];
+ var change_map = is_member ? this._group_outgoing_adds :
+ this._group_outgoing_removes;
var change_set = change_map[group];
if (change_set == null)
@@ -1116,7 +1119,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
{
/* the changes queued above will be resolve in the NewChannels handler
*/
- this.ll.connection_create_group_async (this.account.connection,
+ this._ll.connection_create_group_async (this.account.connection,
group);
}
else
@@ -1133,7 +1136,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
try
{
- this.ll.channel_group_change_membership (channel,
+ this._ll.channel_group_change_membership (channel,
(Handle) tp_persona.contact.handle, is_member);
}
catch (GLib.Error e)
@@ -1168,7 +1171,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
/* FIXME: handle the error GLib.Error from this function */
try
{
- channel = yield this.ll.connection_open_contact_list_channel_async (
+ channel = yield this._ll.connection_open_contact_list_channel_async (
conn, name);
}
catch (GLib.Error e)
@@ -1196,7 +1199,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
var channel_handle = (Handle) channel_handles.index (i);
var contact_handle = channel.group_get_handle_owner (channel_handle);
- if (this.handle_persona_map[contact_handle] == null)
+ if (this._handle_persona_map[contact_handle] == null)
contact_handles += contact_handle;
}
@@ -1206,8 +1209,8 @@ public class Tpf.PersonaStore : Folks.PersonaStore
return;
GLib.List<TelepathyGLib.Contact> contacts =
- yield this.ll.connection_get_contacts_by_handle_async (
- this.conn, contact_handles, (uint[]) contact_features);
+ yield this._ll.connection_get_contacts_by_handle_async (
+ this._conn, contact_handles, (uint[]) _contact_features);
if (contacts == null || contacts.length () < 1)
return;
@@ -1239,8 +1242,8 @@ public class Tpf.PersonaStore : Folks.PersonaStore
if (contact_ids.length > 0)
{
GLib.List<TelepathyGLib.Contact> contacts =
- yield this.ll.connection_get_contacts_by_id_async (
- this.conn, contact_ids, (uint[]) contact_features);
+ yield this._ll.connection_get_contacts_by_id_async (
+ this._conn, contact_ids, (uint[]) _contact_features);
GLib.List<Persona> personas = new GLib.List<Persona> ();
uint err_count = 0;
@@ -1284,18 +1287,18 @@ public class Tpf.PersonaStore : Folks.PersonaStore
debug ("Adding persona from contact '%s'", contact.identifier);
- if (this.handle_persona_map[h] == null)
+ if (this._handle_persona_map[h] == null)
{
var persona = new Tpf.Persona (contact, this);
this._personas.insert (persona.iid, persona);
- this.handle_persona_map[h] = persona;
+ this._handle_persona_map[h] = persona;
/* If the handle is a favourite, ensure the persona's marked
* as such. This deals with the case where we receive a
* contact _after_ we've discovered that they're a
* favourite. */
- persona.is_favourite = this.favourite_handles.contains (h);
+ persona.is_favourite = this._favourite_handles.contains (h);
return persona;
}
@@ -1321,12 +1324,12 @@ public class Tpf.PersonaStore : Folks.PersonaStore
private void channel_groups_add_new_personas ()
{
- foreach (var entry in this.channel_group_incoming_adds.entries)
+ foreach (var entry in this._channel_group_incoming_adds.entries)
{
var channel = (Channel) entry.key;
var members_added = new GLib.List<Persona> ();
- HashSet<Persona> members = this.channel_group_personas_map[channel];
+ HashSet<Persona> members = this._channel_group_personas_map[channel];
if (members == null)
members = new HashSet<Persona> ();
@@ -1338,7 +1341,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
var contact_handles_added = new HashSet<uint> ();
foreach (var contact_handle in contact_handles)
{
- var persona = this.handle_persona_map[contact_handle];
+ var persona = this._handle_persona_map[contact_handle];
if (persona != null)
{
debug (" %s", persona.uid);
@@ -1353,7 +1356,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
}
if (members.size > 0)
- this.channel_group_personas_map[channel] = members;
+ this._channel_group_personas_map[channel] = members;
var name = channel.get_identifier ();
if (this.group_is_display_group (name) &&
@@ -1367,9 +1370,9 @@ public class Tpf.PersonaStore : Folks.PersonaStore
private bool group_is_display_group (string group)
{
- for (var i = 0; i < this.undisplayed_groups.length; i++)
+ for (var i = 0; i < this._undisplayed_groups.length; i++)
{
- if (this.undisplayed_groups[i] == group)
+ if (this._undisplayed_groups[i] == group)
return false;
}
@@ -1397,7 +1400,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
var status = this.account.get_connection_status (null);
if ((status == TelepathyGLib.ConnectionStatus.DISCONNECTED) ||
(status == TelepathyGLib.ConnectionStatus.CONNECTING) ||
- this.conn == null)
+ this._conn == null)
{
throw new PersonaStoreError.STORE_OFFLINE (
_("Cannot create a new persona while offline."));
@@ -1420,18 +1423,18 @@ public class Tpf.PersonaStore : Folks.PersonaStore
{
var persona = personas.data;
- if (this.subscribe != null)
- change_standard_contact_list_membership (subscribe, persona,
+ if (this._subscribe != null)
+ change_standard_contact_list_membership (_subscribe, persona,
true);
- if (this.publish != null)
+ if (this._publish != null)
{
- var flags = publish.group_get_flags ();
+ var flags = _publish.group_get_flags ();
if ((flags & ChannelGroupFlags.CAN_ADD) ==
ChannelGroupFlags.CAN_ADD)
{
- change_standard_contact_list_membership (publish, persona,
- true);
+ change_standard_contact_list_membership (_publish,
+ persona, true);
}
}
@@ -1472,7 +1475,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
{
/* It's possible for us to not be able to connect to the logger;
* see connection_ready_cb() */
- if (this.logger == null)
+ if (this._logger == null)
{
warning (
/* Translators: "telepathy-logger" is the name of an application,
@@ -1488,9 +1491,9 @@ public class Tpf.PersonaStore : Folks.PersonaStore
var id = ((Tpf.Persona) persona).contact.get_identifier ();
if (is_favourite)
- yield this.logger.add_favourite_contact (id);
+ yield this._logger.add_favourite_contact (id);
else
- yield this.logger.remove_favourite_contact (id);
+ yield this._logger.remove_favourite_contact (id);
}
catch (DBus.Error e)
{
@@ -1502,7 +1505,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
{
debug ("Changing alias of persona %u to '%s'.", persona.contact.handle,
alias);
- this.ll.connection_set_contact_alias (this.conn,
+ this._ll.connection_set_contact_alias (this._conn,
(Handle) persona.contact.handle, alias);
}
}
diff --git a/backends/telepathy/lib/tpf-persona.vala b/backends/telepathy/lib/tpf-persona.vala
index ce4e727..7829b35 100644
--- a/backends/telepathy/lib/tpf-persona.vala
+++ b/backends/telepathy/lib/tpf-persona.vala
@@ -45,7 +45,7 @@ public class Tpf.Persona : Folks.Persona,
* unnecessary trips to the Telepathy service to tell it about properties
* being set which are actually just being set from data it's just given us.
*/
- private bool is_constructed = false;
+ private bool _is_constructed = false;
/**
* An avatar for the Persona.
@@ -92,7 +92,7 @@ public class Tpf.Persona : Folks.Persona,
if (this._alias == value)
return;
- if (this.is_constructed)
+ if (this._is_constructed)
((Tpf.PersonaStore) this.store).change_alias (this, value);
this._alias = value;
}
@@ -112,7 +112,7 @@ public class Tpf.Persona : Folks.Persona,
if (this._is_favourite == value)
return;
- if (this.is_constructed)
+ if (this._is_constructed)
((Tpf.PersonaStore) this.store).change_is_favourite (this, value);
this._is_favourite = value;
}
@@ -240,7 +240,7 @@ public class Tpf.Persona : Folks.Persona,
debug ("Creating new Tpf.Persona '%s' for service-specific UID '%s': %p",
uid, id, this);
- this.is_constructed = true;
+ this._is_constructed = true;
/* Set our single IM address */
GenericArray<string> im_address_array = new GenericArray<string> ();
diff --git a/backends/telepathy/tp-backend-factory.vala b/backends/telepathy/tp-backend-factory.vala
index 9390d39..8dbc689 100644
--- a/backends/telepathy/tp-backend-factory.vala
+++ b/backends/telepathy/tp-backend-factory.vala
@@ -25,14 +25,14 @@
using Folks;
using Folks.Backends.Tp;
-private BackendFactory backend_factory = null;
+private BackendFactory _backend_factory = null;
/**
* The Telepathy backend module entry point.
*/
public void module_init (BackendStore backend_store)
{
- backend_factory = new BackendFactory (backend_store);
+ _backend_factory = new BackendFactory (backend_store);
}
/**
@@ -40,7 +40,7 @@ public void module_init (BackendStore backend_store)
*/
public void module_finalize (BackendStore backend_store)
{
- backend_factory = null;
+ _backend_factory = null;
}
/**
diff --git a/backends/telepathy/tp-backend.vala b/backends/telepathy/tp-backend.vala
index 9cefacc..c5f16a4 100644
--- a/backends/telepathy/tp-backend.vala
+++ b/backends/telepathy/tp-backend.vala
@@ -29,7 +29,7 @@ using Folks.Backends.Tp;
*/
public class Folks.Backends.Tp.Backend : Folks.Backend
{
- private AccountManager account_manager;
+ private AccountManager _account_manager;
private bool _is_prepared = false;
private HashTable<string, PersonaStore> _persona_stores;
@@ -76,11 +76,11 @@ public class Folks.Backends.Tp.Backend : Folks.Backend
{
if (!this._is_prepared)
{
- this.account_manager = AccountManager.dup ();
- yield this.account_manager.prepare_async (null);
- this.account_manager.account_enabled.connect (
+ this._account_manager = AccountManager.dup ();
+ yield this._account_manager.prepare_async (null);
+ this._account_manager.account_enabled.connect (
this.account_enabled_cb);
- this.account_manager.account_validity_changed.connect (
+ this._account_manager.account_validity_changed.connect (
(a, valid) =>
{
if (valid)
@@ -88,7 +88,7 @@ public class Folks.Backends.Tp.Backend : Folks.Backend
});
GLib.List<unowned Account> accounts =
- this.account_manager.get_valid_accounts ();
+ this._account_manager.get_valid_accounts ();
foreach (Account account in accounts)
{
this.account_enabled_cb (account);
@@ -105,10 +105,11 @@ public class Folks.Backends.Tp.Backend : Folks.Backend
*/
public override async void unprepare () throws GLib.Error
{
- this.account_manager.account_enabled.disconnect (this.account_enabled_cb);
- this.account_manager.account_validity_changed.disconnect (
+ this._account_manager.account_enabled.disconnect (
+ this.account_enabled_cb);
+ this._account_manager.account_validity_changed.disconnect (
this.account_validity_changed_cb);
- this.account_manager = null;
+ this._account_manager = null;
this._persona_stores.foreach ((k, v) =>
{
diff --git a/folks/backend-store.vala b/folks/backend-store.vala
index 370fd79..af84ab7 100644
--- a/folks/backend-store.vala
+++ b/folks/backend-store.vala
@@ -40,7 +40,7 @@ public class Folks.BackendStore : Object {
private delegate void ModuleFinalizeFunc (BackendStore store);
/* this contains all backends, regardless of enabled or prepared state */
- private HashMap<string,Backend> backend_hash;
+ private HashMap<string,Backend> _backend_hash;
private HashMap<string,Backend> _prepared_backends;
private File config_file;
private GLib.KeyFile backends_key_file;
@@ -122,7 +122,7 @@ public class Folks.BackendStore : Object {
Debug.set_flags (Environment.get_variable ("FOLKS_DEBUG"));
this.modules = new HashMap<string,unowned Module> (str_hash, str_equal);
- this.backend_hash = new HashMap<string,Backend> (str_hash, str_equal);
+ this._backend_hash = new HashMap<string,Backend> (str_hash, str_equal);
this._prepared_backends = new HashMap<string,Backend> (str_hash,
str_equal);
}
@@ -179,7 +179,7 @@ public class Folks.BackendStore : Object {
yield this.prepare ();
/* unload backends that have been disabled since they were loaded */
- foreach (var backend_existing in this.backend_hash.values)
+ foreach (var backend_existing in this._backend_hash.values)
{
yield this.backend_unload_if_needed (backend_existing);
}
@@ -234,7 +234,7 @@ public class Folks.BackendStore : Object {
this.load_module_from_file (module);
/* this is populated indirectly from load_module_from_file(), above */
- foreach (var backend in this.backend_hash.values)
+ foreach (var backend in this._backend_hash.values)
yield this.backend_load_if_needed (backend);
}
@@ -269,7 +269,7 @@ public class Folks.BackendStore : Object {
if (!this.backend_is_enabled (backend.name))
{
- var backend_existing = this.backend_hash.get (backend.name);
+ var backend_existing = this._backend_hash.get (backend.name);
if (backend_existing != null)
{
try
@@ -299,14 +299,14 @@ public class Folks.BackendStore : Object {
public void add_backend (Backend backend)
{
/* Purge any other backend with the same name; re-add if enabled */
- var backend_existing = this.backend_hash.get (backend.name);
+ var backend_existing = this._backend_hash.get (backend.name);
if (backend_existing != null && backend_existing != backend)
{
backend_existing.unprepare ();
this._prepared_backends.unset (backend_existing.name);
}
- this.backend_hash.set (backend.name, backend);
+ this._backend_hash.set (backend.name, backend);
}
private bool backend_is_enabled (string name)
@@ -339,7 +339,7 @@ public class Folks.BackendStore : Object {
*/
public Backend? get_backend_by_name (string name)
{
- return this.backend_hash.get (name);
+ return this._backend_hash.get (name);
}
/**
@@ -349,7 +349,7 @@ public class Folks.BackendStore : Object {
*/
public Collection<Backend> list_backends ()
{
- return this.backend_hash.values;
+ return this._backend_hash.values;
}
/**
diff --git a/folks/individual-aggregator.vala b/folks/individual-aggregator.vala
index 2347d50..8ed8c23 100644
--- a/folks/individual-aggregator.vala
+++ b/folks/individual-aggregator.vala
@@ -61,12 +61,12 @@ public errordomain Folks.IndividualAggregatorError
*/
public class Folks.IndividualAggregator : Object
{
- private BackendStore backend_store;
- private HashMap<string, PersonaStore> stores;
- private unowned PersonaStore writeable_store;
- private HashSet<Backend> backends;
- private HashTable<string, Individual> link_map;
- private bool linking_enabled = true;
+ private BackendStore _backend_store;
+ private HashMap<string, PersonaStore> _stores;
+ private unowned PersonaStore _writeable_store;
+ private HashSet<Backend> _backends;
+ private HashTable<string, Individual> _link_map;
+ private bool _linking_enabled = true;
private bool _is_prepared = false;
/**
@@ -140,22 +140,22 @@ public class Folks.IndividualAggregator : Object
*/
public IndividualAggregator ()
{
- this.stores = new HashMap<string, PersonaStore> ();
+ this._stores = new HashMap<string, PersonaStore> ();
this.individuals = new HashTable<string, Individual> (str_hash,
str_equal);
- this.link_map = new HashTable<string, Individual> (str_hash, str_equal);
+ this._link_map = new HashTable<string, Individual> (str_hash, str_equal);
- this.backends = new HashSet<Backend> ();
+ this._backends = new HashSet<Backend> ();
string disable_linking =
Environment.get_variable ("FOLKS_DISABLE_LINKING");
if (disable_linking != null)
disable_linking = disable_linking.strip ().down ();
- this.linking_enabled = (disable_linking == null ||
+ this._linking_enabled = (disable_linking == null ||
disable_linking == "no" || disable_linking == "0");
- this.backend_store = BackendStore.dup ();
- this.backend_store.backend_available.connect (this.backend_available_cb);
+ this._backend_store = BackendStore.dup ();
+ this._backend_store.backend_available.connect (this.backend_available_cb);
}
/**
@@ -181,7 +181,7 @@ public class Folks.IndividualAggregator : Object
{
if (!this._is_prepared)
{
- yield this.backend_store.load_backends ();
+ yield this._backend_store.load_backends ();
this._is_prepared = true;
this.notify_property ("is-prepared");
}
@@ -190,9 +190,9 @@ public class Folks.IndividualAggregator : Object
private async void add_backend (Backend backend)
{
- if (!this.backends.contains (backend))
+ if (!this._backends.contains (backend))
{
- this.backends.add (backend);
+ this._backends.add (backend);
backend.persona_store_added.connect (
this.backend_persona_store_added_cb);
@@ -225,10 +225,10 @@ public class Folks.IndividualAggregator : Object
{
store.is_writeable = true;
store.trust_level = PersonaStoreTrust.FULL;
- this.writeable_store = store;
+ this._writeable_store = store;
}
- this.stores.set (store_id, store);
+ this._stores.set (store_id, store);
store.personas_changed.connect (this.personas_changed_cb);
store.notify["is-writeable"].connect (this.is_writeable_changed_cb);
store.notify["trust-level"].connect (this.trust_level_changed_cb);
@@ -260,9 +260,9 @@ public class Folks.IndividualAggregator : Object
* they'll do that themselves (and emit their own 'removed' signal if
* necessary) */
- if (this.writeable_store == store)
- this.writeable_store = null;
- this.stores.unset (this.get_store_full_id (store.type_id, store.id));
+ if (this._writeable_store == store)
+ this._writeable_store = null;
+ this._stores.unset (this.get_store_full_id (store.type_id, store.id));
}
private string get_store_full_id (string type_id, string id)
@@ -322,7 +322,7 @@ public class Folks.IndividualAggregator : Object
* Persona to any existing Individual */
if (trust_level != PersonaStoreTrust.NONE)
{
- Individual candidate_ind = this.link_map.lookup (persona.iid);
+ Individual candidate_ind = this._link_map.lookup (persona.iid);
if (candidate_ind != null &&
candidate_ind.trust_level != TrustLevel.NONE)
{
@@ -358,7 +358,7 @@ public class Folks.IndividualAggregator : Object
{
string prop_linking_value = (string) l;
Individual candidate_ind =
- this.link_map.lookup (prop_linking_value);
+ this._link_map.lookup (prop_linking_value);
if (candidate_ind != null &&
candidate_ind.trust_level != TrustLevel.NONE &&
@@ -377,7 +377,7 @@ public class Folks.IndividualAggregator : Object
/* Ensure the original persona makes it into the final persona */
final_personas.prepend (persona);
- if (candidate_inds != null && this.linking_enabled == true)
+ if (candidate_inds != null && this._linking_enabled == true)
{
/* The Persona's IID or linkable properties match one or more
* linkable fields which are already in the link map, so we link
@@ -425,7 +425,7 @@ public class Folks.IndividualAggregator : Object
* reflected in final_individual.trust_level, so other Personas
* won't be linked against it in error if the trust level is
* NONE. */
- this.link_map.replace (final_persona.iid, final_individual);
+ this._link_map.replace (final_persona.iid, final_individual);
/* Only allow linking on non-IID properties of the Persona if we
* fully trust the PersonaStore it came from. */
@@ -455,7 +455,7 @@ public class Folks.IndividualAggregator : Object
string prop_linking_value = (string) l;
debug (" %s", prop_linking_value);
- this.link_map.replace (prop_linking_value,
+ this._link_map.replace (prop_linking_value,
final_individual);
});
}
@@ -495,7 +495,7 @@ public class Folks.IndividualAggregator : Object
private void remove_persona_from_link_map (Persona persona)
{
- this.link_map.remove (persona.iid);
+ this._link_map.remove (persona.iid);
if (persona.store.trust_level == PersonaStoreTrust.FULL)
{
@@ -521,7 +521,7 @@ public class Folks.IndividualAggregator : Object
string prop_linking_value = (string) l;
debug (" %s", prop_linking_value);
- this.link_map.remove (prop_linking_value);
+ this._link_map.remove (prop_linking_value);
});
}
}
@@ -571,7 +571,7 @@ public class Folks.IndividualAggregator : Object
/* Find the Individual containing the Persona (if any) and mark them
* for removal (any other Personas they have which aren't being
* removed will be re-linked into other Individuals). */
- Individual ind = this.link_map.lookup (persona.iid);
+ Individual ind = this._link_map.lookup (persona.iid);
if (ind != null)
removed_individuals.prepend (ind);
@@ -665,8 +665,8 @@ public class Folks.IndividualAggregator : Object
{
/* Ensure that we only have one writeable PersonaStore */
unowned PersonaStore store = (PersonaStore) object;
- assert ((store.is_writeable == true && store == this.writeable_store) ||
- (store.is_writeable == false && store != this.writeable_store));
+ assert ((store.is_writeable == true && store == this._writeable_store) ||
+ (store.is_writeable == false && store != this._writeable_store));
}
private void trust_level_changed_cb (Object object, ParamSpec pspec)
@@ -743,7 +743,7 @@ public class Folks.IndividualAggregator : Object
{
var full_id = this.get_store_full_id (persona_store_type,
persona_store_id);
- var store = this.stores[full_id];
+ var store = this._stores[full_id];
if (store == null)
{
@@ -845,16 +845,17 @@ public class Folks.IndividualAggregator : Object
* before is signalled by { link IndividualAggregator.individuals_changed} and
* { link Individual.removed}.
*
- * @param _personas the { link Persona}s to be linked
+ * @param personas_in the { link Persona}s to be linked
* @since 0.1.13
*/
- public async void link_personas (void *_personas)
+ public async void link_personas (void *personas_in)
throws IndividualAggregatorError
{
- /* FIXME: _personas should be GLib.List<Persona>, but Vala won't allow it */
- unowned GLib.List<Persona> personas = (GLib.List<Persona>) _personas;
+ /* FIXME: personas_in should be GLib.List<Persona>, but Vala won't allow
+ * it */
+ unowned GLib.List<Persona> personas = (GLib.List<Persona>) personas_in;
- if (this.writeable_store == null)
+ if (this._writeable_store == null)
{
throw new IndividualAggregatorError.NO_WRITEABLE_STORE (
_("Can't link personas with no writeable store."));
@@ -865,7 +866,7 @@ public class Folks.IndividualAggregator : Object
return;
/* Disallow linking if it's disabled */
- if (this.linking_enabled == false)
+ if (this._linking_enabled == false)
{
debug ("Can't link Personas: linking disabled.");
return;
@@ -874,7 +875,7 @@ public class Folks.IndividualAggregator : Object
/* Create a new persona in the writeable store which links together the
* given personas */
/* FIXME: We hardcode this to use the key-file backend for now */
- assert (this.writeable_store.type_id == "key-file");
+ assert (this._writeable_store.type_id == "key-file");
/* `protocols_addrs_list` will be passed to the new Kf.Persona, whereas
* `protocols_addrs_set` is used to ensure we don't get duplicate IM
@@ -931,8 +932,8 @@ public class Folks.IndividualAggregator : Object
new HashTable<string, Value?> (str_hash, str_equal);
details.insert ("im-addresses", addresses_value);
- yield this.add_persona_from_details (null, this.writeable_store.type_id,
- this.writeable_store.id, details);
+ yield this.add_persona_from_details (null, this._writeable_store.type_id,
+ this._writeable_store.id, details);
}
/**
@@ -956,7 +957,7 @@ public class Folks.IndividualAggregator : Object
*/
public async void unlink_individual (Individual individual) throws GLib.Error
{
- if (this.linking_enabled == false)
+ if (this._linking_enabled == false)
{
debug ("Can't unlink Individual '%s': linking disabled.",
individual.id);
@@ -970,7 +971,7 @@ public class Folks.IndividualAggregator : Object
/* We have to take a copy of the Persona list before removing the
* Personas, as personas_changed_cb() (which is called as a result of
- * calling writeable_store.remove_persona()) messes around with Persona
+ * calling _writeable_store.remove_persona()) messes around with Persona
* lists. */
GLib.List<Persona> personas = individual.personas.copy ();
foreach (Persona p in personas)
@@ -978,11 +979,11 @@ public class Folks.IndividualAggregator : Object
foreach (unowned Persona persona in personas)
{
- if (persona.store == this.writeable_store)
+ if (persona.store == this._writeable_store)
{
debug (" %s (is user: %s, IID: %s)", persona.uid,
persona.is_user ? "yes" : "no", persona.iid);
- yield this.writeable_store.remove_persona (persona);
+ yield this._writeable_store.remove_persona (persona);
}
}
}
diff --git a/folks/individual.vala b/folks/individual.vala
index bf3d180..3f68c8a 100644
--- a/folks/individual.vala
+++ b/folks/individual.vala
@@ -84,10 +84,10 @@ public class Folks.Individual : Object,
/* Mapping from PersonaStore -> number of Personas from that store contained
* in this Individual. There shouldn't be any entries with a number < 1.
* This is used for working out when to disconnect from store signals. */
- private HashMap<PersonaStore, uint> stores;
+ private HashMap<PersonaStore, uint> _stores;
/* The number of Personas in this Individual which have
* Persona.is_user == true. Iff this is > 0, Individual.is_user == true. */
- private uint persona_user_count = 0;
+ private uint _persona_user_count = 0;
private HashTable<string, GenericArray<string>> _im_addresses;
/**
@@ -374,7 +374,7 @@ public class Folks.Individual : Object,
this._im_addresses =
new HashTable<string, GenericArray<string>> (str_hash, str_equal);
this._persona_set = new HashSet<Persona> (null, null);
- this.stores = new HashMap<PersonaStore, uint> (null, null);
+ this._stores = new HashMap<PersonaStore, uint> (null, null);
this.personas = personas;
}
@@ -395,7 +395,7 @@ public class Folks.Individual : Object,
this.personas_changed (null, removed_personas);
if (store != null)
- this.stores.unset (store);
+ this._stores.unset (store);
if (this._persona_set.size < 1)
{
@@ -770,7 +770,7 @@ public class Folks.Individual : Object,
{
/* Keep track of how many Personas are users */
if (p.is_user)
- this.persona_user_count++;
+ this._persona_user_count++;
added.prepend (p);
@@ -779,14 +779,14 @@ public class Folks.Individual : Object,
/* Increment the Persona count for this PersonaStore */
unowned PersonaStore store = p.store;
- uint num_from_store = this.stores.get (store);
+ uint num_from_store = this._stores.get (store);
if (num_from_store == 0)
{
- this.stores.set (store, num_from_store + 1);
+ this._stores.set (store, num_from_store + 1);
}
else
{
- this.stores.set (store, 1);
+ this._stores.set (store, 1);
store.removed.connect (this.store_removed_cb);
store.personas_changed.connect (
@@ -804,16 +804,16 @@ public class Folks.Individual : Object,
{
/* Keep track of how many Personas are users */
if (p.is_user)
- this.persona_user_count--;
+ this._persona_user_count--;
removed.prepend (p);
/* Decrement the Persona count for this PersonaStore */
unowned PersonaStore store = p.store;
- uint num_from_store = this.stores.get (store);
+ uint num_from_store = this._stores.get (store);
if (num_from_store > 1)
{
- this.stores.set (store, num_from_store - 1);
+ this._stores.set (store, num_from_store - 1);
}
else
{
@@ -821,7 +821,7 @@ public class Folks.Individual : Object,
store.personas_changed.disconnect (
this.store_personas_changed_cb);
- this.stores.unset (store);
+ this._stores.unset (store);
}
this.disconnect_from_persona (p);
@@ -837,7 +837,7 @@ public class Folks.Individual : Object,
this.personas_changed (added, removed);
/* Update this.is_user */
- bool new_is_user = (this.persona_user_count > 0) ? true : false;
+ bool new_is_user = (this._persona_user_count > 0) ? true : false;
if (new_is_user != this.is_user)
this.is_user = new_is_user;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]