[folks] Bug 645056 — TpLowlevel library should have only static public functions
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] Bug 645056 — TpLowlevel library should have only static public functions
- Date: Mon, 29 Aug 2011 11:14:50 +0000 (UTC)
commit b851568b7faf4f3ef9f89810e97165eaf37ec44b
Author: Philip Withnall <philip tecnocode co uk>
Date: Sat Aug 27 14:25:28 2011 +0100
Bug 645056 â TpLowlevel library should have only static public functions
Remove the TpLowlevel class from the TpLowlevel library and instead place
all the functions statically in the âFolksTpLowlevelâ namespace.
Closes: bgo#645056
NEWS | 1 +
backends/telepathy/lib/Makefile.am | 3 +-
backends/telepathy/lib/tp-lowlevel.c | 43 +-----------------------
backends/telepathy/lib/tp-lowlevel.h | 38 ----------------------
backends/telepathy/lib/tpf-persona-store.vala | 39 +++++++++++-----------
5 files changed, 24 insertions(+), 100 deletions(-)
---
diff --git a/NEWS b/NEWS
index 2a8e56f..b0113c8 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Bugs fixed:
* Bug 655374 â Un-break avatar tests
* Bug 657067 â Can't build EDS backend using Vala master
* Bug 657332 â Add linking link-individuals
+* Bug 645056 â TpLowlevel library should have only static public functions
Overview of changes from libfolks 0.5.2 to libfolks 0.5.3
=========================================================
diff --git a/backends/telepathy/lib/Makefile.am b/backends/telepathy/lib/Makefile.am
index 8d8888c..7129e3e 100644
--- a/backends/telepathy/lib/Makefile.am
+++ b/backends/telepathy/lib/Makefile.am
@@ -63,7 +63,8 @@ tp_lowlevel_gir_INCLUDES = GObject-2.0 TelepathyGLib-0.12
tp_lowlevel_gir_CFLAGS = $(TP_GLIB_CFLAGS)
tp_lowlevel_gir_LIBS = libtp-lowlevel.la
tp_lowlevel_gir_FILES = $(libtp_lowlevel_la_SOURCES) $(tp_lowlevel_headers)
-tp_lowlevel_gir_NAMESPACE = Folks
+tp_lowlevel_gir_NAMESPACE = TpLowlevel
+tp_lowlevel_gir_SCANNERFLAGS = --identifier-prefix=FolksTpLowlevel
INTROSPECTION_GIRS += tp-lowlevel.gir
if HAVE_VALA
diff --git a/backends/telepathy/lib/tp-lowlevel.c b/backends/telepathy/lib/tp-lowlevel.c
index 90adefa..faeed5e 100644
--- a/backends/telepathy/lib/tp-lowlevel.c
+++ b/backends/telepathy/lib/tp-lowlevel.c
@@ -30,8 +30,6 @@
#include "tp-lowlevel.h"
-G_DEFINE_TYPE (FolksTpLowlevel, folks_tp_lowlevel, G_TYPE_OBJECT);
-
GQuark
folks_tp_lowlevel_error_quark (void)
{
@@ -76,7 +74,6 @@ connection_ensure_channel_cb (TpConnection *conn,
void
folks_tp_lowlevel_connection_open_contact_list_channel_async (
- FolksTpLowlevel *tp_lowlevel,
TpConnection *conn,
const char *name,
GAsyncReadyCallback callback,
@@ -100,7 +97,6 @@ folks_tp_lowlevel_connection_open_contact_list_channel_async (
/**
* folks_tp_lowlevel_connection_open_contact_list_channel_finish:
- * @lowlevel: a #FolksTpLowlevel
* @result: a #GAsyncResult
* @error: return location for a #GError, or %NULL
*
@@ -111,7 +107,6 @@ folks_tp_lowlevel_connection_open_contact_list_channel_async (
*/
TpChannel *
folks_tp_lowlevel_connection_open_contact_list_channel_finish (
- FolksTpLowlevel *lowlevel,
GAsyncResult *result,
GError **error)
{
@@ -158,7 +153,6 @@ connection_get_alias_flags_cb (TpConnection *conn,
void
folks_tp_lowlevel_connection_get_alias_flags_async (
- FolksTpLowlevel *tp_lowlevel,
TpConnection *conn,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -174,7 +168,6 @@ folks_tp_lowlevel_connection_get_alias_flags_async (
/**
* folks_tp_lowlevel_connection_get_alias_flags_finish:
- * @lowlevel: a #FolksTpLowlevel
* @result: a #GAsyncResult
* @error: return location for a #GError, or %NULL
*
@@ -184,7 +177,6 @@ folks_tp_lowlevel_connection_get_alias_flags_async (
*/
TpConnectionAliasFlags
folks_tp_lowlevel_connection_get_alias_flags_finish (
- FolksTpLowlevel *lowlevel,
GAsyncResult *result,
GError **error)
{
@@ -241,7 +233,6 @@ get_contacts_by_handle_cb (TpConnection *conn,
/**
* folks_tp_lowlevel_connection_get_contacts_by_handle_async:
- * @tp_lowlevel: a #FolksTpLowlevel
* @conn: the connection to use
* @contact_handles: (array length=contact_handles_length): the contact handles
* to get
@@ -255,7 +246,6 @@ get_contacts_by_handle_cb (TpConnection *conn,
*/
void
folks_tp_lowlevel_connection_get_contacts_by_handle_async (
- FolksTpLowlevel *tp_lowlevel,
TpConnection *conn,
const guint *contact_handles,
guint contact_handles_length,
@@ -282,7 +272,6 @@ folks_tp_lowlevel_connection_get_contacts_by_handle_async (
/**
* folks_tp_lowlevel_connection_get_contacts_by_handle_finish:
- * @tp_lowlevel: a #FolksTpLowlevel
* @result: the async result
* @error: a #GError, or %NULL
*
@@ -294,7 +283,6 @@ folks_tp_lowlevel_connection_get_contacts_by_handle_async (
*/
GList *
folks_tp_lowlevel_connection_get_contacts_by_handle_finish (
- FolksTpLowlevel *tp_lowlevel,
GAsyncResult *result,
GError **error)
{
@@ -350,7 +338,6 @@ get_contacts_by_id_cb (TpConnection *conn,
/**
* folks_tp_lowlevel_connection_get_contacts_by_id_async:
- * @tp_lowlevel: a #FolksTpLowlevel
* @conn: the connection to use
* @contact_ids: (array length=contact_ids_length) (element-type utf8): the
* contact IDs to get
@@ -364,7 +351,6 @@ get_contacts_by_id_cb (TpConnection *conn,
*/
void
folks_tp_lowlevel_connection_get_contacts_by_id_async (
- FolksTpLowlevel *tp_lowlevel,
TpConnection *conn,
const char **contact_ids,
guint contact_ids_length,
@@ -391,7 +377,6 @@ folks_tp_lowlevel_connection_get_contacts_by_id_async (
/**
* folks_tp_lowlevel_connection_get_contacts_by_id_finish:
- * @tp_lowlevel: a #FolksTpLowlevel
* @result: the async result
* @error: a #GError, or %NULL
*
@@ -403,7 +388,6 @@ folks_tp_lowlevel_connection_get_contacts_by_id_async (
*/
GList *
folks_tp_lowlevel_connection_get_contacts_by_id_finish (
- FolksTpLowlevel *tp_lowlevel,
GAsyncResult *result,
GError **error)
{
@@ -452,7 +436,6 @@ connection_get_requestable_channel_classes_cb (TpProxy *conn,
void
folks_tp_lowlevel_connection_get_requestable_channel_classes_async (
- FolksTpLowlevel *tp_lowlevel,
TpConnection *conn,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -470,7 +453,6 @@ folks_tp_lowlevel_connection_get_requestable_channel_classes_async (
/**
* folks_tp_lowlevel_connection_get_requestable_channel_classes_finish:
- * @tp_lowlevel: a #FolksTpLowlevel
* @result: a #GAsyncResult
* @error: return location for a #GError, or %NULL
*
@@ -481,7 +463,6 @@ folks_tp_lowlevel_connection_get_requestable_channel_classes_async (
*/
GPtrArray *
folks_tp_lowlevel_connection_get_requestable_channel_classes_finish (
- FolksTpLowlevel *tp_lowlevel,
GAsyncResult *result,
GError **error)
{
@@ -531,7 +512,7 @@ group_request_handles_cb (
const GArray *handles,
const GError *error,
gpointer user_data,
- GObject *tp_lowlevel)
+ GObject *weak_object)
{
guint channel_handle;
@@ -550,12 +531,11 @@ group_request_handles_cb (
TRUE,
group_request_channel_cb,
NULL, NULL,
- tp_lowlevel);
+ weak_object);
}
void
folks_tp_lowlevel_connection_create_group_async (
- FolksTpLowlevel *tp_lowlevel,
TpConnection *conn,
const char *group)
{
@@ -584,7 +564,6 @@ set_contact_alias_cb (TpConnection *conn,
void
folks_tp_lowlevel_connection_set_contact_alias (
- FolksTpLowlevel *tp_lowlevel,
TpConnection *conn,
guint handle,
const gchar *alias)
@@ -679,7 +658,6 @@ got_channels_cb (TpProxy *conn,
/**
* folks_tp_lowlevel_connection_connect_to_new_group_channels:
- * @lowlevel: a #FolksTpLowlevel
* @conn: the connection to use
* @callback: (scope call): function to call on completion
* @user_data: (closure): user data to pass to @callback
@@ -688,7 +666,6 @@ got_channels_cb (TpProxy *conn,
*/
void
folks_tp_lowlevel_connection_connect_to_new_group_channels (
- FolksTpLowlevel *lowlevel,
TpConnection *conn,
FolksTpLowlevelNewGroupChannelsCallback callback,
gpointer user_data)
@@ -771,19 +748,3 @@ folks_tp_lowlevel_channel_group_change_membership (TpChannel *channel,
g_array_free (handles, TRUE);
}
-
-static void
-folks_tp_lowlevel_class_init (FolksTpLowlevelClass *klass)
-{
-}
-
-static void
-folks_tp_lowlevel_init (FolksTpLowlevel *self)
-{
-}
-
-FolksTpLowlevel *
-folks_tp_lowlevel_new (void)
-{
- return FOLKS_TP_LOWLEVEL (g_object_new (FOLKS_TYPE_TP_LOWLEVEL, NULL));
-}
diff --git a/backends/telepathy/lib/tp-lowlevel.h b/backends/telepathy/lib/tp-lowlevel.h
index 0584930..89ed8ee 100644
--- a/backends/telepathy/lib/tp-lowlevel.h
+++ b/backends/telepathy/lib/tp-lowlevel.h
@@ -30,28 +30,6 @@
G_BEGIN_DECLS
-typedef struct _FolksTpLowlevel FolksTpLowlevel;
-typedef struct _FolksTpLowlevelClass FolksTpLowlevelClass;
-
-struct _FolksTpLowlevel {
- /*<private>*/
- GObject parent;
-};
-
-struct _FolksTpLowlevelClass {
- /*<private>*/
- GObjectClass parent_class;
-};
-
-GType folks_tp_lowlevel_get_type (void);
-
-#define FOLKS_TYPE_TP_LOWLEVEL (folks_tp_lowlevel_get_type ())
-#define FOLKS_TP_LOWLEVEL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), FOLKS_TYPE_TP_LOWLEVEL, FolksTpLowlevel))
-#define FOLKS_TP_LOWLEVEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_TYPE_TP_LOWLEVEL, FolksTpLowlevelClass))
-#define FOLKS_IS_TP_LOWLEVEL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), FOLKS_TYPE_TP_LOWLEVEL))
-#define FOLKS_IS_TP_LOWLEVEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_TYPE_TP_LOWLEVEL))
-#define FOLKS_TP_LOWLEVEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_TYPE_TP_LOWLEVEL, FolksTpLowlevelClass))
-
GQuark folks_tp_lowlevel_error_quark (void);
#define FOLKS_TP_LOWLEVEL_ERROR (folks_tp_lowlevel_error_quark ())
@@ -59,9 +37,6 @@ typedef enum {
FOLKS_TP_LOWLEVEL_ERROR_INVALID_ARGUMENT,
} FolksTpLowlevelError;
-FolksTpLowlevel *
-folks_tp_lowlevel_new (void) G_GNUC_WARN_UNUSED_RESULT;
-
/**
* folks_tp_lowlevel_channel_group_change_membership:
* @channel:
@@ -92,27 +67,23 @@ typedef void (*FolksTpLowlevelNewGroupChannelsCallback) (TpChannel *channel,
void
folks_tp_lowlevel_connection_connect_to_new_group_channels (
- FolksTpLowlevel *lowlevel,
TpConnection *conn,
FolksTpLowlevelNewGroupChannelsCallback callback,
gpointer user_data);
void
folks_tp_lowlevel_connection_create_group_async (
- FolksTpLowlevel *lowlevel,
TpConnection *conn,
const char *name);
void
folks_tp_lowlevel_connection_set_contact_alias (
- FolksTpLowlevel *tp_lowlevel,
TpConnection *conn,
guint handle,
const gchar *alias);
void
folks_tp_lowlevel_connection_open_contact_list_channel_async (
- FolksTpLowlevel *lowlevel,
TpConnection *conn,
const char *name,
GAsyncReadyCallback callback,
@@ -120,26 +91,22 @@ folks_tp_lowlevel_connection_open_contact_list_channel_async (
TpChannel *
folks_tp_lowlevel_connection_open_contact_list_channel_finish (
- FolksTpLowlevel *lowlevel,
GAsyncResult *result,
GError **error);
void
folks_tp_lowlevel_connection_get_alias_flags_async (
- FolksTpLowlevel *tp_lowlevel,
TpConnection *conn,
GAsyncReadyCallback callback,
gpointer user_data);
TpConnectionAliasFlags
folks_tp_lowlevel_connection_get_alias_flags_finish (
- FolksTpLowlevel *lowlevel,
GAsyncResult *result,
GError **error);
void
folks_tp_lowlevel_connection_get_contacts_by_handle_async (
- FolksTpLowlevel *tp_lowlevel,
TpConnection *conn,
const guint *contact_handles,
guint contact_handles_length,
@@ -150,13 +117,11 @@ folks_tp_lowlevel_connection_get_contacts_by_handle_async (
GList *
folks_tp_lowlevel_connection_get_contacts_by_handle_finish (
- FolksTpLowlevel *tp_lowlevel,
GAsyncResult *result,
GError **error);
void
folks_tp_lowlevel_connection_get_contacts_by_id_async (
- FolksTpLowlevel *tp_lowlevel,
TpConnection *conn,
const char **contact_ids,
guint contact_ids_length,
@@ -167,20 +132,17 @@ folks_tp_lowlevel_connection_get_contacts_by_id_async (
GList *
folks_tp_lowlevel_connection_get_contacts_by_id_finish (
- FolksTpLowlevel *tp_lowlevel,
GAsyncResult *result,
GError **error);
void
folks_tp_lowlevel_connection_get_requestable_channel_classes_async (
- FolksTpLowlevel *tp_lowlevel,
TpConnection *conn,
GAsyncReadyCallback callback,
gpointer user_data);
GPtrArray *
folks_tp_lowlevel_connection_get_requestable_channel_classes_finish (
- FolksTpLowlevel *tp_lowlevel,
GAsyncResult *result,
GError **error);
diff --git a/backends/telepathy/lib/tpf-persona-store.vala b/backends/telepathy/lib/tpf-persona-store.vala
index b031c21..630c610 100644
--- a/backends/telepathy/lib/tpf-persona-store.vala
+++ b/backends/telepathy/lib/tpf-persona-store.vala
@@ -79,7 +79,6 @@ public class Tpf.PersonaStore : Folks.PersonaStore
private Channel _stored;
private Channel _subscribe;
private Connection _conn;
- private TpLowlevel _ll;
private AccountManager _account_manager;
private Logger _logger;
private Contact? _self_contact;
@@ -484,7 +483,6 @@ public class Tpf.PersonaStore : Folks.PersonaStore
this._groups = new HashMap<string, Channel> ();
this._favourite_handles = new HashSet<uint> ();
this._self_contact = null;
- this._ll = new TpLowlevel ();
}
/**
@@ -775,15 +773,16 @@ public class Tpf.PersonaStore : Folks.PersonaStore
private void _connection_ready_cb (Object s, ParamSpec? p)
{
var c = (Connection) s;
- this._ll.connection_connect_to_new_group_channels (c,
+ FolksTpLowlevel.connection_connect_to_new_group_channels (c,
this._new_group_channels_cb);
- this._ll.connection_get_alias_flags_async.begin (c, (s2, res) =>
+ FolksTpLowlevel.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 =
+ FolksTpLowlevel.connection_get_alias_flags_async.end (res);
if ((flags &
ConnectionAliasFlags.CONNECTION_ALIAS_FLAG_USER_SET) > 0)
{
@@ -804,18 +803,17 @@ public class Tpf.PersonaStore : Folks.PersonaStore
this.notify_property ("can-alias-personas");
});
- this._ll.connection_get_requestable_channel_classes_async.begin (c,
+ FolksTpLowlevel.connection_get_requestable_channel_classes_async.begin (c,
(s3, res3) =>
{
var new_can_group = MaybeBool.FALSE;
try
{
- var ll = this._ll;
GenericArray<weak void*> v;
int i;
- v = ll.connection_get_requestable_channel_classes_async.end (
- res3);
+ v = FolksTpLowlevel.
+ connection_get_requestable_channel_classes_async.end (res3);
for (i = 0; i < v.length; i++)
{
@@ -1030,7 +1028,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
{
try
{
- this._ll.channel_group_change_membership (channel,
+ FolksTpLowlevel.channel_group_change_membership (channel,
(Handle) persona.contact.handle, entry.value, null);
}
catch (GLib.Error e)
@@ -1383,7 +1381,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
try
{
- this._ll.channel_group_change_membership (this._stored,
+ FolksTpLowlevel.channel_group_change_membership (this._stored,
(Handle) tp_persona.contact.handle, false, null);
}
catch (GLib.Error e1)
@@ -1399,7 +1397,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
try
{
- this._ll.channel_group_change_membership (this._subscribe,
+ FolksTpLowlevel.channel_group_change_membership (this._subscribe,
(Handle) tp_persona.contact.handle, false, null);
}
catch (GLib.Error e2)
@@ -1415,7 +1413,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
try
{
- this._ll.channel_group_change_membership (this._publish,
+ FolksTpLowlevel.channel_group_change_membership (this._publish,
(Handle) tp_persona.contact.handle, false, null);
}
catch (GLib.Error e3)
@@ -1560,7 +1558,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,
+ FolksTpLowlevel.connection_create_group_async (this.account.connection,
group);
}
else
@@ -1578,7 +1576,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
try
{
- this._ll.channel_group_change_membership (channel,
+ FolksTpLowlevel.channel_group_change_membership (channel,
(Handle) tp_persona.contact.handle, is_member, message);
}
catch (GLib.Error e)
@@ -1613,8 +1611,9 @@ 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 (
- conn, name);
+ channel =
+ yield FolksTpLowlevel.connection_open_contact_list_channel_async (
+ conn, name);
}
catch (GLib.Error e)
{
@@ -1666,7 +1665,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
return;
GLib.List<TelepathyGLib.Contact> contacts =
- yield this._ll.connection_get_contacts_by_handle_async (
+ yield FolksTpLowlevel.connection_get_contacts_by_handle_async (
this._conn, contact_handles, (uint[]) _contact_features);
if (contacts == null || contacts.length () < 1)
@@ -1702,7 +1701,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
return personas;
GLib.List<TelepathyGLib.Contact> contacts =
- yield this._ll.connection_get_contacts_by_id_async (
+ yield FolksTpLowlevel.connection_get_contacts_by_id_async (
this._conn, contact_ids, (uint[]) _contact_features);
unowned GLib.List<TelepathyGLib.Contact> l;
@@ -1992,7 +1991,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,
+ FolksTpLowlevel.connection_set_contact_alias (this._conn,
(Handle) persona.contact.handle, alias);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]