Commit 44ea1c21 authored by Travis Reitter's avatar Travis Reitter

Adjust to the new tp-glib vala bindings namespace introduced by the g-i version.

parent 41c6c340
......@@ -20,7 +20,7 @@
using GLib;
using Gee;
using Tp;
using TelepathyGLib;
using Folks;
using Folks.Backends.Tp;
......
......@@ -3,9 +3,9 @@ folks_tp_lowlevel_connection_get_contacts_by_handle_async.contact_handles is_arr
folks_tp_lowlevel_connection_get_contacts_by_handle_async.contact_handles_length hidden="1"
folks_tp_lowlevel_connection_get_contacts_by_handle_async.features is_array="1" array_length_type="guint"
folks_tp_lowlevel_connection_get_contacts_by_handle_async.features_length hidden="1"
folks_tp_lowlevel_connection_get_contacts_by_handle_finish type_arguments="Tp.Contact"
folks_tp_lowlevel_connection_get_contacts_by_handle_finish type_arguments="TelepathyGLib.Contact"
folks_tp_lowlevel_connection_get_contacts_by_id_async.contact_ids is_array="1" array_length_type="guint"
folks_tp_lowlevel_connection_get_contacts_by_id_async.contact_ids_length hidden="1"
folks_tp_lowlevel_connection_get_contacts_by_id_async.features is_array="1" array_length_type="guint"
folks_tp_lowlevel_connection_get_contacts_by_id_async.features_length hidden="1"
folks_tp_lowlevel_connection_get_contacts_by_id_finish type_arguments="Tp.Contact"
folks_tp_lowlevel_connection_get_contacts_by_id_finish type_arguments="TelepathyGLib.Contact"
......@@ -20,7 +20,7 @@
using GLib;
using Gee;
using Tp;
using TelepathyGLib;
using Folks;
private struct AccountFavourites
......
......@@ -21,8 +21,8 @@
using GLib;
using Gee;
using Tp;
using Tp.ContactFeature;
using TelepathyGLib;
using TelepathyGLib.ContactFeature;
using Folks;
/**
......@@ -97,7 +97,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
Object (account: account);
this.type_id = "telepathy";
this.id = account.get_object_path (account);
this.id = account.get_object_path ();
this._personas = new HashTable<string, Persona> (str_hash,
str_equal);
......@@ -137,14 +137,17 @@ public class Tpf.PersonaStore : Folks.PersonaStore
this.account.status_changed.connect (this.account_status_changed_cb);
Tp.ConnectionStatusReason reason;
TelepathyGLib.ConnectionStatusReason reason;
var status = this.account.get_connection_status (out reason);
/* immediately handle accounts which are not currently being disconnected
*/
if (status != Tp.ConnectionStatus.DISCONNECTED)
if (status != TelepathyGLib.ConnectionStatus.DISCONNECTED)
{
this.account_status_changed_cb (Tp.ConnectionStatus.DISCONNECTED,
status, reason, null, null);
var details = new GLib.HashTable<weak string, weak void*> (
str_hash, str_equal);
this.account_status_changed_cb (
TelepathyGLib.ConnectionStatus.DISCONNECTED, status, reason, null,
details);
}
try
......@@ -287,11 +290,11 @@ public class Tpf.PersonaStore : Folks.PersonaStore
}
}
private void account_status_changed_cb (ConnectionStatus old_status,
ConnectionStatus new_status, ConnectionStatusReason reason,
string? dbus_error_name, GLib.HashTable? details)
private void account_status_changed_cb (uint old_status, uint new_status,
uint reason, string? dbus_error_name,
GLib.HashTable details)
{
if (new_status != Tp.ConnectionStatus.CONNECTED)
if (new_status != TelepathyGLib.ConnectionStatus.CONNECTED)
return;
var conn = this.account.get_connection ();
......@@ -399,7 +402,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
c.invalidated.connect (this.channel_invalidated_cb);
unowned IntSet members = c.group_get_members ();
unowned IntSet? members = c.group_get_members ();
if (members != null)
{
this.channel_group_pend_incoming_adds.begin (c,
......@@ -506,7 +509,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
private void ignore_by_handle_if_needed (uint handle)
{
unowned Tp.IntSet members;
unowned TelepathyGLib.IntSet members;
if (this.subscribe != null)
{
......@@ -666,8 +669,8 @@ public class Tpf.PersonaStore : Folks.PersonaStore
this.group_channels_unready.remove (name);
c.invalidated.connect (this.channel_invalidated_cb);
c.group_members_changed.connect (
this.group_channel_group_members_changed_cb);
c.group_members_changed_detailed.connect (
this.channel_group_members_changed_detailed_cb);
unowned IntSet members = c.group_get_members ();
if (members != null)
......@@ -678,15 +681,13 @@ public class Tpf.PersonaStore : Folks.PersonaStore
});
}
private void group_channel_group_members_changed_cb (Channel channel,
string message,
private void channel_group_members_changed_detailed_cb (Channel channel,
/* FIXME: Array<uint> => Array<Handle>; parser bug */
Array<uint>? added,
Array<uint>? removed,
Array<uint>? local_pending,
Array<uint>? remote_pending,
uint actor,
uint reason)
Array<weak uint> added,
Array<weak uint> removed,
Array<weak uint> local_pending,
Array<weak uint> remote_pending,
HashTable details)
{
if (added != null)
this.channel_group_pend_incoming_adds.begin (channel, added, false);
......@@ -724,8 +725,8 @@ public class Tpf.PersonaStore : Folks.PersonaStore
}
}
private void change_standard_contact_list_membership (Tp.Channel channel,
Folks.Persona persona, bool is_member)
private void change_standard_contact_list_membership (
TelepathyGLib.Channel channel, Folks.Persona persona, bool is_member)
{
var tp_persona = (Tpf.Persona) persona;
......@@ -779,7 +780,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
PRESENCE
};
Handle[] contact_handles = {};
uint[] contact_handles = {};
for (var i = 0; i < channel_handles.length; i++)
{
var channel_handle = (Handle) channel_handles.index (i);
......@@ -794,16 +795,16 @@ public class Tpf.PersonaStore : Folks.PersonaStore
if (contact_handles.length < 1)
return;
unowned GLib.List<Tp.Contact> contacts =
unowned GLib.List<TelepathyGLib.Contact> contacts =
yield this.ll.connection_get_contacts_by_handle_async (
this.conn, contact_handles, features);
if (contacts == null || contacts.length () < 1)
return;
var contacts_array = new Tp.Contact[contacts.length ()];
var contacts_array = new TelepathyGLib.Contact[contacts.length ()];
var j = 0;
unowned GLib.List<Tp.Contact> l = contacts;
unowned GLib.List<TelepathyGLib.Contact> l = contacts;
for (; l != null; l = l.next)
{
contacts_array[j] = l.data;
......@@ -832,14 +833,14 @@ public class Tpf.PersonaStore : Folks.PersonaStore
if (contact_ids.length > 0)
{
unowned GLib.List<Tp.Contact> contacts =
unowned GLib.List<TelepathyGLib.Contact> contacts =
yield this.ll.connection_get_contacts_by_id_async (
this.conn, contact_ids, features);
GLib.List<Persona> personas = new GLib.List<Persona> ();
uint err_count = 0;
string err_format = "";
unowned GLib.List<Tp.Contact> l;
unowned GLib.List<TelepathyGLib.Contact> l;
for (l = contacts; l != null; l = l.next)
{
var contact = l.data;
......@@ -849,7 +850,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
if (persona != null)
personas.prepend (persona);
}
catch (Tp.Error e)
catch (TelepathyGLib.Error e)
{
if (err_count == 0)
err_format = "failed to create %u personas:\n";
......@@ -876,7 +877,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
}
private Tpf.Persona? add_persona_from_contact (Contact contact)
throws Tp.Error
throws TelepathyGLib.Error
{
var h = contact.get_handle ();
if (this.handle_persona_map[h] == null)
......@@ -909,7 +910,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
if (persona != null)
personas.prepend (persona);
}
catch (Tp.Error e)
catch (Tpf.PersonaError e)
{
warning ("failed to create persona from contact '%s' (%p)",
contact.alias, contact);
......
......@@ -20,7 +20,7 @@
using Gee;
using GLib;
using Tp;
using TelepathyGLib;
using Folks;
/**
......@@ -169,14 +169,16 @@ public class Tpf.Persona : Folks.Persona,
* Create a new persona for the {@link PersonaStore} `store`, representing
* the Telepathy contact given by `contact`.
*/
public Persona (Contact contact, PersonaStore store) throws Tp.Error
public Persona (Contact contact, PersonaStore store) throws
TelepathyGLib.Error
{
/* FIXME: There is the possibility of a crash in the error condition below
* due to bgo#604299, where the C self variable isn't initialised until we
* chain up to the Object constructor, below. */
var uid = contact.get_identifier ();
if (uid == null || uid == "")
throw new Tp.Error.INVALID_ARGUMENT ("contact has an invalid UID");
throw new TelepathyGLib.Error.INVALID_ARGUMENT ("contact has an " +
"invalid UID");
var account = account_for_connection (contact.get_connection ());
var account_id = ((Proxy) account).object_path;
......@@ -272,27 +274,27 @@ public class Tpf.Persona : Folks.Persona,
}
private static PresenceType folks_presence_type_from_tp (
Tp.ConnectionPresenceType type)
TelepathyGLib.ConnectionPresenceType type)
{
switch (type)
{
case Tp.ConnectionPresenceType.AVAILABLE:
case TelepathyGLib.ConnectionPresenceType.AVAILABLE:
return PresenceType.AVAILABLE;
case Tp.ConnectionPresenceType.AWAY:
case TelepathyGLib.ConnectionPresenceType.AWAY:
return PresenceType.AWAY;
case Tp.ConnectionPresenceType.BUSY:
case TelepathyGLib.ConnectionPresenceType.BUSY:
return PresenceType.BUSY;
case Tp.ConnectionPresenceType.ERROR:
case TelepathyGLib.ConnectionPresenceType.ERROR:
return PresenceType.ERROR;
case Tp.ConnectionPresenceType.EXTENDED_AWAY:
case TelepathyGLib.ConnectionPresenceType.EXTENDED_AWAY:
return PresenceType.EXTENDED_AWAY;
case Tp.ConnectionPresenceType.HIDDEN:
case TelepathyGLib.ConnectionPresenceType.HIDDEN:
return PresenceType.HIDDEN;
case Tp.ConnectionPresenceType.OFFLINE:
case TelepathyGLib.ConnectionPresenceType.OFFLINE:
return PresenceType.OFFLINE;
case Tp.ConnectionPresenceType.UNKNOWN:
case TelepathyGLib.ConnectionPresenceType.UNKNOWN:
return PresenceType.UNKNOWN;
case Tp.ConnectionPresenceType.UNSET:
case TelepathyGLib.ConnectionPresenceType.UNSET:
return PresenceType.UNSET;
default:
return PresenceType.UNKNOWN;
......@@ -315,7 +317,7 @@ public class Tpf.Persona : Folks.Persona,
/* Based off tp_caps_to_capabilities() in empathy-contact.c */
private static CapabilitiesFlags folks_capabilities_flags_from_tp (
Tp.Capabilities caps)
TelepathyGLib.Capabilities caps)
{
CapabilitiesFlags capabilities = 0;
var classes = caps.get_channel_classes ();
......@@ -327,27 +329,29 @@ public class Tpf.Persona : Folks.Persona,
unowned Value val = class_struct.get_nth (0);
unowned HashTable fixed_prop = (HashTable) val.get_boxed ();
Tp.HandleType handle_type = (Tp.HandleType) Tp.asv_get_uint32 (
fixed_prop, Tp.PROP_CHANNEL_TARGET_HANDLE_TYPE, null);
TelepathyGLib.HandleType handle_type =
(TelepathyGLib.HandleType) TelepathyGLib.asv_get_uint32 (
fixed_prop, TelepathyGLib.PROP_CHANNEL_TARGET_HANDLE_TYPE,
null);
if (handle_type != HandleType.CONTACT)
return; /* i.e. continue the loop */
unowned string chan_type = Tp.asv_get_string (fixed_prop,
Tp.PROP_CHANNEL_CHANNEL_TYPE);
unowned string chan_type = TelepathyGLib.asv_get_string (fixed_prop,
TelepathyGLib.PROP_CHANNEL_CHANNEL_TYPE);
if (chan_type == Tp.IFACE_CHANNEL_TYPE_FILE_TRANSFER)
if (chan_type == TelepathyGLib.IFACE_CHANNEL_TYPE_FILE_TRANSFER)
{
capabilities |= CapabilitiesFlags.FILE_TRANSFER;
}
else if (chan_type == Tp.IFACE_CHANNEL_TYPE_STREAM_TUBE)
else if (chan_type == TelepathyGLib.IFACE_CHANNEL_TYPE_STREAM_TUBE)
{
var service = Tp.asv_get_string (fixed_prop,
Tp.PROP_CHANNEL_TYPE_STREAM_TUBE_SERVICE);
var service = TelepathyGLib.asv_get_string (fixed_prop,
TelepathyGLib.PROP_CHANNEL_TYPE_STREAM_TUBE_SERVICE);
if (service == "rfb")
capabilities |= CapabilitiesFlags.STREAM_TUBE;
}
else if (chan_type == Tp.IFACE_CHANNEL_TYPE_STREAMED_MEDIA)
else if (chan_type == TelepathyGLib.IFACE_CHANNEL_TYPE_STREAMED_MEDIA)
{
val = class_struct.get_nth (1);
unowned string[] allowed_prop = (string[]) val.get_boxed ();
......@@ -359,10 +363,10 @@ public class Tpf.Persona : Folks.Persona,
unowned string prop = allowed_prop[i];
if (prop ==
Tp.PROP_CHANNEL_TYPE_STREAMED_MEDIA_INITIAL_AUDIO)
TelepathyGLib.PROP_CHANNEL_TYPE_STREAMED_MEDIA_INITIAL_AUDIO)
capabilities |= CapabilitiesFlags.AUDIO;
else if (prop ==
Tp.PROP_CHANNEL_TYPE_STREAMED_MEDIA_INITIAL_VIDEO)
TelepathyGLib.PROP_CHANNEL_TYPE_STREAMED_MEDIA_INITIAL_VIDEO)
capabilities |= CapabilitiesFlags.VIDEO;
}
}
......
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