Commit dc3acdfc authored by Travis Reitter's avatar Travis Reitter
Browse files

Refer to non-local variables and methods with full name.

The benefit here is to make it easier to tell when variables are local. Methods
are referred to similarly for consistency.

Fixes bgo#629083
parent 6aa04aae
......@@ -100,3 +100,9 @@ Vala-specific rules
9. As in most languages, avoid casting. Casting is usually a sign of an error
which should be fixed and reduces readability.
10. Refer to non-local variables and methods with their qualified name. Within a
class function, refer to private data members like 'this._foo' and foreign
package symbols like 'package_name.symbol'.
This makes scope immediately clear, helping readability.
......@@ -530,12 +530,14 @@ public class Tpf.PersonaStore : Folks.PersonaStore
val.get_boxed ();
var channel_type = TelepathyGLib.asv_get_string (props,
_tp_channel_channel_type);
this._tp_channel_channel_type);
bool handle_type_valid;
var handle_type = TelepathyGLib.asv_get_uint32 (props,
_tp_channel_handle_type, out handle_type_valid);
this._tp_channel_handle_type,
out handle_type_valid);
if ((channel_type == _tp_channel_contact_list_type) &&
if ((channel_type ==
this._tp_channel_contact_list_type) &&
handle_type_valid &&
(handle_type == HandleType.GROUP))
{
......@@ -566,8 +568,8 @@ public class Tpf.PersonaStore : Folks.PersonaStore
/* 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);
if (this._conn.self_handle != 0)
this._self_handle_changed_cb (this._conn, null);
/* We can only initialise the favourite contacts once _conn is prepared */
this._initialise_favourite_contacts.begin ();
......@@ -589,7 +591,8 @@ 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[]) this._contact_features,
(conn, contacts, failed, error, weak_object) =>
{
if (error != null)
......@@ -903,12 +906,13 @@ public class Tpf.PersonaStore : Folks.PersonaStore
var tp_reason = TelepathyGLib.asv_get_uint32 (details, "change-reason",
out valid);
if (valid)
reason = _change_reason_from_tp_reason (tp_reason);
reason = Tpf.PersonaStore._change_reason_from_tp_reason (tp_reason);
this._ignore_by_handle (handle, message, actor, reason);
}
private Groupable.ChangeReason _change_reason_from_tp_reason (uint reason)
private static Groupable.ChangeReason _change_reason_from_tp_reason (
uint reason)
{
return (Groupable.ChangeReason) reason;
}
......@@ -1417,7 +1421,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
try
{
var personas = yield _create_personas_from_contact_ids (
var personas = yield this._create_personas_from_contact_ids (
contact_ids);
if (personas == null)
......@@ -1430,17 +1434,17 @@ public class Tpf.PersonaStore : Folks.PersonaStore
var persona = personas.data;
if (this._subscribe != null)
_change_standard_contact_list_membership (_subscribe, persona,
true);
this._change_standard_contact_list_membership (this._subscribe,
persona, true);
if (this._publish != null)
{
var flags = _publish.group_get_flags ();
var flags = this._publish.group_get_flags ();
if ((flags & ChannelGroupFlags.CAN_ADD) ==
ChannelGroupFlags.CAN_ADD)
{
_change_standard_contact_list_membership (_publish,
persona, true);
this._change_standard_contact_list_membership (
this._publish, persona, true);
}
}
......
......@@ -168,7 +168,7 @@ public class Tpf.Persona : Folks.Persona,
*/
public async void change_group (string group, bool is_member)
{
if (_change_group (group, is_member))
if (this._change_group (group, is_member))
{
Tpf.PersonaStore store = (Tpf.PersonaStore) this.store;
yield store._change_group_membership (this, group, is_member);
......@@ -214,7 +214,7 @@ public class Tpf.Persona : Folks.Persona,
{
unowned string id = contact.get_identifier ();
unowned Connection connection = contact.connection;
var account = _account_for_connection (connection);
var account = this._account_for_connection (connection);
var uid = this.build_uid ("telepathy", account.get_protocol (), id);
Object (alias: contact.get_alias (),
......@@ -337,7 +337,7 @@ public class Tpf.Persona : Folks.Persona,
private void _contact_notify_presence_type ()
{
this.presence_type = _folks_presence_type_from_tp (
this.presence_type = Tpf.Persona._folks_presence_type_from_tp (
this.contact.get_presence_type ());
}
......
......@@ -207,7 +207,7 @@ public class Folks.BackendStore : Object {
bool is_file;
bool is_dir;
yield _get_file_info (file, out is_file, out is_dir);
yield this._get_file_info (file, out is_file, out is_dir);
if (is_file)
{
modules.set (subpath, file);
......
......@@ -142,7 +142,8 @@ public interface Folks.HasPresence : Object
*/
public static int typecmp (PresenceType type_a, PresenceType type_b)
{
return _type_availability (type_a) - _type_availability (type_b);
return (HasPresence._type_availability (type_a) -
HasPresence._type_availability (type_b));
}
/**
......
......@@ -754,7 +754,7 @@ public class Folks.IndividualAggregator : Object
Persona persona = null;
try
{
var details_copy = _asv_copy (details);
var details_copy = this._asv_copy (details);
persona = yield store.add_persona_from_details (details_copy);
}
catch (PersonaStoreError e)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment