rpms/anerley/devel anerley-mc5-port.patch, NONE, 1.1 anerley.spec, 1.5, 1.6
Bastien Nocera
hadess at fedoraproject.org
Mon Sep 28 21:21:01 UTC 2009
Author: hadess
Update of /cvs/pkgs/rpms/anerley/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv26033
Modified Files:
anerley.spec
Added Files:
anerley-mc5-port.patch
Log Message:
* Mon Sep 28 2009 Bastien Nocera <bnocera at redhat.com> 0.1.1-2
- Add patch to port to Mission Control 5
anerley-mc5-port.patch:
b/anerley/Makefile.am | 4
b/anerley/anerley-aggregate-tp-feed.c | 210 +++++++++++++---------------------
b/anerley/anerley-aggregate-tp-feed.h | 3
b/anerley/anerley-tp-feed.c | 208 +++++++++++----------------------
b/anerley/anerley-tp-feed.h | 6
b/anerley/anerley-tp-item.c | 173 ++++++++++++++++++++++------
b/anerley/anerley-tp-item.h | 4
b/configure.ac | 1
b/tests/Makefile.am | 4
b/tests/test-aggregate-tp-feed.c | 65 +++++++---
b/tests/test-simple-grid-view.c | 63 ++++++----
b/tests/test-simple-ui.c | 26 +---
b/tests/test-tile-view.c | 69 +++++++----
b/tests/test-tp-feed.c | 59 ++++++---
configure.ac | 2
15 files changed, 495 insertions(+), 402 deletions(-)
--- NEW FILE anerley-mc5-port.patch ---
commit f76297e57d4368ef4e289716e03cd8e256532fad
Author: Jonny Lamb <jonny.lamb at collabora.co.uk>
Date: Sat Sep 26 17:08:32 2009 +0100
Stop building against libmissioncontrol.
Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
diff --git a/anerley/Makefile.am b/anerley/Makefile.am
index f2043f9..9d9254c 100644
--- a/anerley/Makefile.am
+++ b/anerley/Makefile.am
@@ -30,10 +30,10 @@ libanerley_la_SOURCES = anerley-tp-feed.c \
libanerley_ladir = $(includedir)/anerley/anerley
libanerley_la_CFLAGS = -I$(top_srcdir) \
- $(GLIB_CFLAGS) $(TELEPATHY_CFLAGS) $(MC_CFLAGS) \
+ $(GLIB_CFLAGS) $(TELEPATHY_CFLAGS) \
$(NBTK_CFLAGS) $(EBOOK_CFLAGS) \
-DPKG_DATA_DIR=\"$(pkgdatadir)\" \
-D_GNU_SOURCE
-libanerley_la_LIBADD = $(GLIB_LIBS) $(TELEPATHY_LIBS) $(MC_LIBS) \
+libanerley_la_LIBADD = $(GLIB_LIBS) $(TELEPATHY_LIBS) \
$(NBTK_LIBS) $(EBOOK_LIBS)
diff --git a/configure.ac b/configure.ac
index 90444e3..8974038 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,7 +25,6 @@ CFLAGS="$CFLAGS -Wall"
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.14 gobject-2.0)
PKG_CHECK_MODULES(TELEPATHY, telepathy-glib)
-PKG_CHECK_MODULES(MC, libmissioncontrol)
PKG_CHECK_MODULES(NBTK, nbtk-1.2)
PKG_CHECK_MODULES(EBOOK, libebook-1.2)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0a5508a..00c44d5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,9 +1,9 @@
noinst_PROGRAMS = test-tp-feed test-simple-grid-view test-tile-view test-aggregate-tp-feed test-simple-ui
-AM_CFLAGS = $(GLIB_CFLAGS) $(TELEPATHY_CFLAGS) $(MC_CFLAGS) $(NBTK_CFLAGS) \
+AM_CFLAGS = $(GLIB_CFLAGS) $(TELEPATHY_CFLAGS) $(NBTK_CFLAGS) \
-I$(top_srcdir) \
-DPKG_DATA_DIR=\"$(pkgdatadir)\"
-AM_LDFLAGS = $(GLIB_LIBS) $(TELEPATHY_LIBS) $(MC_LIBS) $(NBTK_LIBS)
+AM_LDFLAGS = $(GLIB_LIBS) $(TELEPATHY_LIBS) $(NBTK_LIBS)
test_tp_feed_SOURCES = test-tp-feed.c
test_tp_feed_LDADD = ../anerley/libanerley.la
commit 3aa84f86a5c0d33d3dc3199b3891ac6a30c8fae0
Author: Jonny Lamb <jonny.lamb at collabora.co.uk>
Date: Mon Sep 28 15:33:21 2009 +0100
configure.ac: add a versioned depends on telepathy-glib
Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
diff --git a/configure.ac b/configure.ac
index 8974038..41d662a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,7 +24,7 @@ AM_PROG_CC_C_O
CFLAGS="$CFLAGS -Wall"
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.14 gobject-2.0)
-PKG_CHECK_MODULES(TELEPATHY, telepathy-glib)
+PKG_CHECK_MODULES(TELEPATHY, telepathy-glib >= 0.9.0)
PKG_CHECK_MODULES(NBTK, nbtk-1.2)
PKG_CHECK_MODULES(EBOOK, libebook-1.2)
commit 90c0a5428a743abbaa30215f34c25bea813dabf9
Author: Jonny Lamb <jonny.lamb at collabora.co.uk>
Date: Sat Sep 26 17:45:45 2009 +0100
test-simple-ui: update to use new account manager/anerley API
Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
diff --git a/tests/test-simple-ui.c b/tests/test-simple-ui.c
index c8ea91b..52c7f36 100644
--- a/tests/test-simple-ui.c
+++ b/tests/test-simple-ui.c
@@ -26,9 +26,9 @@
#include <anerley/anerley-tile.h>
#include <anerley/anerley-aggregate-tp-feed.h>
#include <anerley/anerley-feed-model.h>
+#include <anerley/anerley-tile-view.h>
#include <clutter/clutter.h>
-#include <libmissioncontrol/mission-control.h>
#include <telepathy-glib/contact.h>
#include <glib.h>
@@ -49,9 +49,7 @@ int
main (int argc,
char **argv)
{
- MissionControl *mc;
- AnerleyTpFeed *feed;
- DBusGConnection *conn;
+ AnerleyFeed *feed;
ClutterActor *stage;
NbtkWidget *scroll_view;
NbtkWidget *icon_view;
@@ -84,23 +82,21 @@ main (int argc,
g_free (path);
- conn = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
- mc = mission_control_new (conn);
- feed = anerley_aggregate_tp_feed_new (mc);
+ feed = anerley_aggregate_tp_feed_new ();
model = anerley_feed_model_new (feed);
stage = clutter_stage_get_default ();
- icon_view = anerley_tile_view_new (model);
+ icon_view = anerley_tile_view_new (ANERLEY_FEED_MODEL (model));
table = nbtk_table_new ();
entry = nbtk_entry_new (NULL);
- tmp = nbtk_entry_get_clutter_text (entry);
+ tmp = nbtk_entry_get_clutter_text (NBTK_ENTRY (entry));
g_signal_connect (tmp,
"text-changed",
- _entry_text_changed_cb,
+ G_CALLBACK (_entry_text_changed_cb),
model);
nbtk_table_add_actor_with_properties (NBTK_TABLE (table),
- entry,
+ CLUTTER_ACTOR (entry),
0,
0,
"x-fill",
@@ -113,12 +109,12 @@ main (int argc,
scroll_view = nbtk_scroll_view_new ();
clutter_container_add_actor (CLUTTER_CONTAINER (stage),
- table);
+ CLUTTER_ACTOR (table));
clutter_container_add_actor (CLUTTER_CONTAINER (scroll_view),
- icon_view);
+ CLUTTER_ACTOR (icon_view));
clutter_actor_show_all (stage);
nbtk_table_add_actor_with_properties (NBTK_TABLE (table),
- scroll_view,
+ CLUTTER_ACTOR (scroll_view),
1,
0,
"x-fill",
@@ -131,7 +127,7 @@ main (int argc,
TRUE,
NULL);
- clutter_actor_set_size (table, 640, 480);
+ clutter_actor_set_size (CLUTTER_ACTOR (table), 640, 480);
clutter_main ();
return 0;
commit 8a5d5d69bb504c2fc4a8da3e931f0d7bf82b4706
Author: Jonny Lamb <jonny.lamb at collabora.co.uk>
Date: Sat Sep 26 17:45:37 2009 +0100
test-simple-grid-view: update to use new account manager/anerley API
Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
diff --git a/tests/test-simple-grid-view.c b/tests/test-simple-grid-view.c
index 87be65b..092ac13 100644
--- a/tests/test-simple-grid-view.c
+++ b/tests/test-simple-grid-view.c
@@ -25,23 +25,55 @@
#include <anerley/anerley-simple-grid-view.h>
#include <clutter/clutter.h>
-#include <libmissioncontrol/mission-control.h>
+
+#include <telepathy-glib/account.h>
+#include <telepathy-glib/account-manager.h>
#include <telepathy-glib/contact.h>
#include <glib.h>
#include <dbus/dbus-glib.h>
-int
-main (int argc,
- char **argv)
+static void
+am_ready_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer userdata)
{
- MissionControl *mc;
- McAccount *account;
+ TpAccountManager *account_manager = TP_ACCOUNT_MANAGER (source_object);
+ TpAccount *account;
AnerleyTpFeed *feed;
- DBusGConnection *conn;
ClutterActor *stage;
NbtkWidget *scroll_view;
ClutterActor *grid;
+ const gchar **argv = userdata;
+ GError *error = NULL;
+
+ if (!tp_account_manager_prepare_finish (account_manager, result, &error))
+ {
+ g_warning ("Failed to prepare account manager: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ account = tp_account_manager_ensure_account (account_manager, argv[1]);
+
+ feed = anerley_tp_feed_new (account);
+
+ stage = clutter_stage_get_default ();
+ grid = CLUTTER_ACTOR (anerley_simple_grid_view_new (ANERLEY_FEED (feed)));
+ scroll_view = nbtk_scroll_view_new ();
+ clutter_container_add_actor (CLUTTER_CONTAINER (stage),
+ CLUTTER_ACTOR (scroll_view));
+ clutter_container_add_actor (CLUTTER_CONTAINER (scroll_view),
+ grid);
+ clutter_actor_set_size (CLUTTER_ACTOR (scroll_view), 640, 480);
+ clutter_actor_show_all (stage);
+}
+
+int
+main (int argc,
+ char **argv)
+{
+ TpAccountManager *account_manager;
gchar *path;
NbtkStyle *style;
GError *error = NULL;
@@ -71,19 +103,10 @@ main (int argc,
g_free (path);
- conn = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
- mc = mission_control_new (conn);
- account = mc_account_lookup (argv[1]);
- feed = anerley_tp_feed_new (mc, account);
- stage = clutter_stage_get_default ();
- grid = anerley_simple_grid_view_new (feed);
- scroll_view = nbtk_scroll_view_new ();
- clutter_container_add_actor (CLUTTER_CONTAINER (stage),
- scroll_view);
- clutter_container_add_actor (CLUTTER_CONTAINER (scroll_view),
- grid);
- clutter_actor_set_size (scroll_view, 640, 480);
- clutter_actor_show_all (stage);
+ account_manager = tp_account_manager_dup ();
+
+ tp_account_manager_prepare_async (account_manager, NULL,
+ am_ready_cb, argv);
clutter_main ();
commit ecca57f39bb4c1b824e99127478da3abd76643a0
Author: Jonny Lamb <jonny.lamb at collabora.co.uk>
Date: Sat Sep 26 17:45:24 2009 +0100
test-aggregate-tp-feed: update to use new account manager/anerley API
Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
diff --git a/tests/test-aggregate-tp-feed.c b/tests/test-aggregate-tp-feed.c
index 93cecad..cb33f9c 100644
--- a/tests/test-aggregate-tp-feed.c
+++ b/tests/test-aggregate-tp-feed.c
@@ -25,30 +25,61 @@
#include <anerley/anerley-simple-grid-view.h>
#include <anerley/anerley-tile.h>
#include <anerley/anerley-aggregate-tp-feed.h>
+#include <anerley/anerley-feed-model.h>
+#include <anerley/anerley-tile-view.h>
#include <clutter/clutter.h>
-#include <libmissioncontrol/mission-control.h>
+
+#include <telepathy-glib/account-manager.h>
#include <telepathy-glib/contact.h>
#include <glib.h>
#include <dbus/dbus-glib.h>
-int
-main (int argc,
- char **argv)
+static void
+am_ready_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer userdata)
+
{
- MissionControl *mc;
- AnerleyTpFeed *feed;
- DBusGConnection *conn;
+ TpAccountManager *account_manager = TP_ACCOUNT_MANAGER (source_object);
+ AnerleyFeed *feed;
ClutterActor *stage;
NbtkWidget *scroll_view;
NbtkWidget *icon_view;
ClutterModel *model;
+ GError *error = NULL;
+
+ if (!tp_account_manager_prepare_finish (account_manager, result, &error))
+ {
+ g_warning ("Failed to make account manager ready: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ feed = ANERLEY_FEED (anerley_aggregate_tp_feed_new ());
+ model = CLUTTER_MODEL (anerley_feed_model_new (feed));
+ stage = clutter_stage_get_default ();
+ icon_view = anerley_tile_view_new (ANERLEY_FEED_MODEL (model));
+
+ scroll_view = nbtk_scroll_view_new ();
+ clutter_container_add_actor (CLUTTER_CONTAINER (stage),
+ CLUTTER_ACTOR (scroll_view));
+ clutter_container_add_actor (CLUTTER_CONTAINER (scroll_view),
+ CLUTTER_ACTOR (icon_view));
+ clutter_actor_set_size (CLUTTER_ACTOR (scroll_view), 640, 480);
+ clutter_actor_show_all (stage);
+}
+
+int
+main (int argc,
+ char **argv)
+{
+ TpAccountManager *account_manager;
gchar *path;
NbtkStyle *style;
GError *error = NULL;
-
clutter_init (&argc, &argv);
path = g_build_filename (PKG_DATA_DIR,
@@ -68,23 +99,15 @@ main (int argc,
g_free (path);
- conn = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
- mc = mission_control_new (conn);
- feed = anerley_aggregate_tp_feed_new (mc);
- model = anerley_feed_model_new (feed);
- stage = clutter_stage_get_default ();
- icon_view = anerley_tile_view_new (model);
+ account_manager = tp_account_manager_dup ();
- scroll_view = nbtk_scroll_view_new ();
- clutter_container_add_actor (CLUTTER_CONTAINER (stage),
- scroll_view);
- clutter_container_add_actor (CLUTTER_CONTAINER (scroll_view),
- icon_view);
- clutter_actor_set_size (scroll_view, 640, 480);
- clutter_actor_show_all (stage);
+ tp_account_manager_prepare_async (account_manager, NULL,
+ am_ready_cb, NULL);
clutter_main ();
+ g_object_unref (account_manager);
+
return 0;
}
commit c9e59f1b8c7866e384365ef0cdeeeeb233a68926
Author: Jonny Lamb <jonny.lamb at collabora.co.uk>
Date: Sat Sep 26 17:18:31 2009 +0100
test-tile-view: update to use new account manager/anerley API
Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
diff --git a/tests/test-tile-view.c b/tests/test-tile-view.c
index 9b67191..152193f 100644
--- a/tests/test-tile-view.c
+++ b/tests/test-tile-view.c
@@ -19,34 +19,66 @@
*
*/
-
+#include <anerley/anerley-feed-model.h>
#include <anerley/anerley-tp-feed.h>
#include <anerley/anerley-item.h>
#include <anerley/anerley-simple-grid-view.h>
#include <anerley/anerley-tile.h>
+#include <anerley/anerley-tile-view.h>
#include <clutter/clutter.h>
-#include <libmissioncontrol/mission-control.h>
+
+#include <telepathy-glib/account-manager.h>
#include <telepathy-glib/contact.h>
#include <glib.h>
#include <dbus/dbus-glib.h>
-int
-main (int argc,
- char **argv)
+static void
+am_ready_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer userdata)
{
- MissionControl *mc;
- McAccount *account;
+ TpAccountManager *account_manager = TP_ACCOUNT_MANAGER (source_object);
+ TpAccount *account;
AnerleyTpFeed *feed;
- DBusGConnection *conn;
ClutterActor *stage;
NbtkWidget *scroll_view;
NbtkWidget *icon_view;
ClutterModel *model;
+ const gchar **argv = userdata;
+ GError *error = NULL;
+
+ if (!tp_account_manager_prepare_finish (account_manager, result, &error))
+ {
+ g_warning ("Failed to prepare account manager: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ account = tp_account_manager_ensure_account (account_manager, argv[1]);
+ feed = anerley_tp_feed_new (account);
+ model = anerley_feed_model_new (ANERLEY_FEED (feed));
+ stage = clutter_stage_get_default ();
+ icon_view = anerley_tile_view_new (ANERLEY_FEED_MODEL (model));
+
+ scroll_view = nbtk_scroll_view_new ();
+ clutter_container_add_actor (CLUTTER_CONTAINER (stage),
+ CLUTTER_ACTOR (scroll_view));
+ clutter_container_add_actor (CLUTTER_CONTAINER (scroll_view),
+ CLUTTER_ACTOR (icon_view));
+ clutter_actor_set_size (CLUTTER_ACTOR (scroll_view), 640, 480);
+ clutter_actor_show_all (stage);
+}
+
+int
+main (int argc,
+ char **argv)
+{
+ TpAccountManager *account_manager;
+ GError *error = NULL;
gchar *path;
NbtkStyle *style;
- GError *error = NULL;
if (argc < 2)
{
@@ -73,24 +105,15 @@ main (int argc,
g_free (path);
- conn = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
- mc = mission_control_new (conn);
- account = mc_account_lookup (argv[1]);
- feed = anerley_tp_feed_new (mc, account);
- model = anerley_feed_model_new (feed);
- stage = clutter_stage_get_default ();
- icon_view = anerley_tile_view_new (model);
+ account_manager = tp_account_manager_dup ();
- scroll_view = nbtk_scroll_view_new ();
- clutter_container_add_actor (CLUTTER_CONTAINER (stage),
- scroll_view);
- clutter_container_add_actor (CLUTTER_CONTAINER (scroll_view),
- icon_view);
- clutter_actor_set_size (scroll_view, 640, 480);
- clutter_actor_show_all (stage);
+ tp_account_manager_prepare_async (account_manager, NULL,
+ am_ready_cb, argv);
clutter_main ();
+ g_object_unref (account_manager);
+
return 0;
}
commit 52bedaac86c3787f218547e788f11a68ae8871e1
Author: Jonny Lamb <jonny.lamb at collabora.co.uk>
Date: Sat Sep 26 17:18:03 2009 +0100
test-tp-feed: update to use new account manager/anerley API
Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
diff --git a/tests/test-tp-feed.c b/tests/test-tp-feed.c
index 664ef7c..f044727 100644
--- a/tests/test-tp-feed.c
+++ b/tests/test-tp-feed.c
@@ -19,11 +19,11 @@
*
*/
-
#include <anerley/anerley-tp-feed.h>
#include <anerley/anerley-item.h>
-#include <libmissioncontrol/mission-control.h>
+#include <telepathy-glib/account.h>
+#include <telepathy-glib/account-manager.h>
#include <telepathy-glib/contact.h>
#include <glib.h>
@@ -73,15 +73,46 @@ _feed_items_removed_cb (AnerleyTpFeed *feed,
}
}
+static void
+am_ready_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer userdata)
+{
+ TpAccountManager *account_manager = TP_ACCOUNT_MANAGER (source_object);
+ TpAccount *account;
+ AnerleyTpFeed *feed;
+ const GHashTable *props;
+ const char **argv = userdata;
+ GError *error = NULL;
+
+ if (!tp_account_manager_prepare_finish (account_manager, result, &error))
+ {
+ g_warning ("Failed to prepare account manager: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ account = tp_account_manager_ensure_account (account_manager, argv[1]);
+
+ props = tp_account_get_parameters (account);
+
+ feed = anerley_tp_feed_new (account);
+ g_signal_connect (feed,
+ "items-added",
+ G_CALLBACK (_feed_items_added_cb),
+ NULL);
+ g_signal_connect (feed,
+ "items-removed",
+ G_CALLBACK (_feed_items_removed_cb),
+ NULL);
+}
int
main (int argc,
char **argv)
{
GMainLoop *main_loop;
- MissionControl *mc;
- McAccount *account;
- AnerleyTpFeed *feed;
+ TpAccountManager *account_manager;
DBusGConnection *conn;
if (argc < 2)
@@ -94,20 +125,16 @@ main (int argc,
main_loop = g_main_loop_new (NULL, FALSE);
conn = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
- mc = mission_control_new (conn);
- account = mc_account_lookup (argv[1]);
- feed = anerley_tp_feed_new (mc, account);
- g_signal_connect (feed,
- "items-added",
- _feed_items_added_cb,
- NULL);
- g_signal_connect (feed,
- "items-removed",
- _feed_items_removed_cb,
- NULL);
+
+ account_manager = tp_account_manager_dup ();
+
+ tp_account_manager_prepare_async (account_manager, NULL,
+ am_ready_cb, argv);
g_main_loop_run (main_loop);
+ g_object_unref (account_manager);
+
return 0;
}
commit d32c496fb2f13033602e1571ade18049a57537d3
Author: Jonny Lamb <jonny.lamb at collabora.co.uk>
Date: Sat Sep 26 17:10:17 2009 +0100
aggregate-tp-feed: update to use new tp-glib account helper API
Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
diff --git a/anerley/anerley-aggregate-tp-feed.c b/anerley/anerley-aggregate-tp-feed.c
index 4027be8..b0af818 100644
--- a/anerley/anerley-aggregate-tp-feed.c
+++ b/anerley/anerley-aggregate-tp-feed.c
@@ -23,7 +23,8 @@
#include "anerley-aggregate-tp-feed.h"
#include <anerley/anerley-tp-feed.h>
-#include <libmissioncontrol/mc-account-monitor.h>
+
+#include <telepathy-glib/account-manager.h>
G_DEFINE_TYPE (AnerleyAggregateTpFeed, anerley_aggregate_tp_feed, ANERLEY_TYPE_AGGREGATE_FEED)
@@ -33,47 +34,10 @@ G_DEFINE_TYPE (AnerleyAggregateTpFeed, anerley_aggregate_tp_feed, ANERLEY_TYPE_A
typedef struct _AnerleyAggregateTpFeedPrivate AnerleyAggregateTpFeedPrivate;
struct _AnerleyAggregateTpFeedPrivate {
- MissionControl *mc;
- McAccountMonitor *account_monitor;
GHashTable *feeds;
+ TpAccountManager *account_manager;
};
-enum
-{
- PROP_0,
- PROP_MC
-};
-
-static void
-anerley_aggregate_tp_feed_get_property (GObject *object, guint property_id,
- GValue *value, GParamSpec *pspec)
-{
- AnerleyAggregateTpFeedPrivate *priv = GET_PRIVATE (object);
-
- switch (property_id) {
- case PROP_MC:
- g_value_set_object (value, priv->mc);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- }
-}
-
-static void
-anerley_aggregate_tp_feed_set_property (GObject *object, guint property_id,
- const GValue *value, GParamSpec *pspec)
-{
- AnerleyAggregateTpFeedPrivate *priv = GET_PRIVATE (object);
-
- switch (property_id) {
- case PROP_MC:
- priv->mc = g_value_dup_object (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- }
-}
-
static void
anerley_aggregate_tp_feed_dispose (GObject *object)
{
@@ -85,16 +49,10 @@ anerley_aggregate_tp_feed_dispose (GObject *object)
priv->feeds = NULL;
}
- if (priv->mc)
+ if (priv->account_manager != NULL)
{
- g_object_unref (priv->mc);
- priv->mc = NULL;
- }
-
- if (priv->account_monitor)
- {
- g_object_unref (priv->account_monitor);
- priv->account_monitor = NULL;
+ g_object_unref (priv->account_manager);
+ priv->account_manager = NULL;
}
G_OBJECT_CLASS (anerley_aggregate_tp_feed_parent_class)->dispose (object);
@@ -106,118 +64,125 @@ anerley_aggregate_tp_feed_finalize (GObject *object)
G_OBJECT_CLASS (anerley_aggregate_tp_feed_parent_class)->finalize (object);
}
-
static void
-anerley_aggregate_tp_feed_constructed (GObject *object)
+_account_manager_account_enabled_cb (TpAccountManager *account_manager,
+ TpAccount *account,
+ gpointer userdata)
{
- AnerleyAggregateTpFeedPrivate *priv = GET_PRIVATE (object);
- McAccount *account;
- GList *accounts, *l;
- const gchar *account_name;
+ AnerleyAggregateTpFeed *aggregate = ANERLEY_AGGREGATE_TP_FEED (userdata);
+ AnerleyAggregateTpFeedPrivate *priv = GET_PRIVATE (aggregate);
AnerleyTpFeed *feed;
+ const gchar *account_name;
+
+ account_name = tp_proxy_get_object_path (account);
- accounts = mc_accounts_list_by_enabled (TRUE);
+ feed = g_hash_table_lookup (priv->feeds, account_name);
- for (l = accounts; l; l = l->next)
+ if (!feed)
{
- account = (McAccount *)l->data;
- feed = anerley_tp_feed_new (priv->mc, account);
- account_name = mc_account_get_unique_name (account);
+ feed = anerley_tp_feed_new (account);
+
g_hash_table_insert (priv->feeds,
g_strdup (account_name),
feed);
- anerley_aggregate_feed_add_feed (ANERLEY_AGGREGATE_FEED (object),
- (AnerleyFeed *)feed);
+ anerley_aggregate_feed_add_feed (ANERLEY_AGGREGATE_FEED (aggregate),
+ ANERLEY_FEED (feed));
}
-
- mc_accounts_list_free (accounts);
-
- if (G_OBJECT_CLASS (anerley_aggregate_tp_feed_parent_class)->constructed)
- G_OBJECT_CLASS (anerley_aggregate_tp_feed_parent_class)->constructed (object);
}
static void
-anerley_aggregate_tp_feed_class_init (AnerleyAggregateTpFeedClass *klass)
+_account_manager_account_disabled_cb (TpAccountManager *account_manager,
+ TpAccount *account,
+ gpointer userdata)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GParamSpec *pspec;
-
- g_type_class_add_private (klass, sizeof (AnerleyAggregateTpFeedPrivate));
-
- object_class->get_property = anerley_aggregate_tp_feed_get_property;
- object_class->set_property = anerley_aggregate_tp_feed_set_property;
- object_class->dispose = anerley_aggregate_tp_feed_dispose;
- object_class->finalize = anerley_aggregate_tp_feed_finalize;
- object_class->constructed = anerley_aggregate_tp_feed_constructed;
-
- pspec = g_param_spec_object ("mc",
- "Misssion Control",
- "The mission control instance",
- MISSIONCONTROL_TYPE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
- g_object_class_install_property (object_class, PROP_MC, pspec);
+ /* For TP feeds we don't actually want to remove the feed from aggregator
+ * because otherwise the removals get lost when the TP connection gets
+ * disconnect on MC account disablement.
+ *
+ * If the aggregator becomes cleverer and thus knows which items come from
+ * which feed then it can issue the removals and we will then remove the
+ * feed here. But for now it isn't.
+ */
}
static void
-_mc_account_monitor_account_enabled (McAccountMonitor *monitor,
- gchar *account_name,
- gpointer userdata)
+_account_manager_ready_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer userdata)
{
- AnerleyAggregateTpFeed *aggregate = (AnerleyAggregateTpFeed *)userdata;
- AnerleyAggregateTpFeedPrivate *priv = GET_PRIVATE (userdata);
- McAccount *account;
- AnerleyTpFeed *feed;
+ TpAccountManager *account_manager = TP_ACCOUNT_MANAGER (source_object);
+ AnerleyAggregateTpFeed *aggregate = ANERLEY_AGGREGATE_TP_FEED (userdata);
+ AnerleyAggregateTpFeedPrivate *priv = GET_PRIVATE (aggregate);
+ GList *accounts, *l;
+ GError *error = NULL;
- feed = g_hash_table_lookup (priv->feeds, account_name);
+ if (!tp_account_manager_prepare_finish (account_manager, result, &error))
+ {
+ g_warning ("Failed to prepare account manager: %s", error->message);
+ g_error_free (error);
+ return;
+ }
- if (!feed)
+ accounts = tp_account_manager_get_valid_accounts (account_manager);
+
+ for (l = accounts; l != NULL; l = l->next)
{
- account = mc_account_lookup (account_name);
- feed = anerley_tp_feed_new (priv->mc, account);
- g_object_unref (account);
+ TpAccount *account = TP_ACCOUNT (l->data);
+ AnerleyTpFeed *feed;
+ const gchar *account_name;
+
+ if (!tp_account_is_enabled (account))
+ continue;
+ feed = anerley_tp_feed_new (account);
+ account_name = tp_proxy_get_object_path (account);
g_hash_table_insert (priv->feeds,
g_strdup (account_name),
feed);
anerley_aggregate_feed_add_feed (ANERLEY_AGGREGATE_FEED (aggregate),
- (AnerleyFeed *)feed);
+ ANERLEY_FEED (feed));
}
+
+ g_list_free (accounts);
}
- static void
-_mc_account_monitor_account_disabled (McAccountMonitor *monitor,
- gchar *account_name,
- gpointer userdata)
+static void
+anerley_aggregate_tp_feed_constructed (GObject *object)
{
- /* For TP feeds we don't actually want to remove the feed from aggregator
- * because otherwise the removals get lost when the TP connection gets
- * disconnect on MC account disablement.
- *
- * If the aggregator becomes cleverer and thus knows which items come from
- * which feed then it can issue the removals and we will then remove the
- * feed here. But for now it isn't.
- */
+ AnerleyAggregateTpFeedPrivate *priv = GET_PRIVATE (object);
+
+ priv->account_manager = tp_account_manager_dup ();
+ g_signal_connect (priv->account_manager, "account-enabled",
+ G_CALLBACK (_account_manager_account_enabled_cb), object);
+ g_signal_connect (priv->account_manager, "account-disabled",
+ G_CALLBACK (_account_manager_account_disabled_cb), object);
+
+ tp_account_manager_prepare_async (priv->account_manager, NULL,
+ _account_manager_ready_cb, object);
+
+ if (G_OBJECT_CLASS (anerley_aggregate_tp_feed_parent_class)->constructed)
+ G_OBJECT_CLASS (anerley_aggregate_tp_feed_parent_class)->constructed (object);
}
+static void
+anerley_aggregate_tp_feed_class_init (AnerleyAggregateTpFeedClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ g_type_class_add_private (klass, sizeof (AnerleyAggregateTpFeedPrivate));
+
+ object_class->dispose = anerley_aggregate_tp_feed_dispose;
+ object_class->finalize = anerley_aggregate_tp_feed_finalize;
+ object_class->constructed = anerley_aggregate_tp_feed_constructed;
+}
static void
anerley_aggregate_tp_feed_init (AnerleyAggregateTpFeed *self)
{
AnerleyAggregateTpFeedPrivate *priv = GET_PRIVATE (self);
- priv->account_monitor = mc_account_monitor_new ();
- g_signal_connect (priv->account_monitor,
- "account-enabled",
- (GCallback)_mc_account_monitor_account_enabled,
- self);
- g_signal_connect (priv->account_monitor,
- "account-disabled",
- (GCallback)_mc_account_monitor_account_disabled,
- self);
-
priv->feeds = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
@@ -225,12 +190,9 @@ anerley_aggregate_tp_feed_init (AnerleyAggregateTpFeed *self)
}
AnerleyFeed *
-anerley_aggregate_tp_feed_new (MissionControl *mc)
+anerley_aggregate_tp_feed_new (void)
{
- return g_object_new (ANERLEY_TYPE_AGGREGATE_TP_FEED,
- "mc",
- mc,
- NULL);
+ return g_object_new (ANERLEY_TYPE_AGGREGATE_TP_FEED, NULL);
}
diff --git a/anerley/anerley-aggregate-tp-feed.h b/anerley/anerley-aggregate-tp-feed.h
index 37ccf09..a1b1062 100644
--- a/anerley/anerley-aggregate-tp-feed.h
+++ b/anerley/anerley-aggregate-tp-feed.h
@@ -25,7 +25,6 @@
#include <glib-object.h>
#include <anerley/anerley-aggregate-feed.h>
-#include <libmissioncontrol/mission-control.h>
G_BEGIN_DECLS
@@ -56,7 +55,7 @@ typedef struct {
GType anerley_aggregate_tp_feed_get_type (void);
-AnerleyFeed *anerley_aggregate_tp_feed_new (MissionControl *mc);
+AnerleyFeed *anerley_aggregate_tp_feed_new (void);
G_END_DECLS
commit 0823a1a6e89a55c7716c872a92000a7a14a7184f
Author: Jonny Lamb <jonny.lamb at collabora.co.uk>
Date: Sat Sep 26 17:09:49 2009 +0100
tp-feed: update to use new tp-glib account helper API
Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
diff --git a/anerley/anerley-tp-feed.c b/anerley/anerley-tp-feed.c
index 70fa2d8..1935f2b 100644
--- a/anerley/anerley-tp-feed.c
+++ b/anerley/anerley-tp-feed.c
@@ -19,9 +19,11 @@
*
*/
-
-#include <libmissioncontrol/mission-control.h>
+#include <telepathy-glib/account.h>
#include <telepathy-glib/contact.h>
+#include <telepathy-glib/connection.h>
+#include <telepathy-glib/channel.h>
+#include <telepathy-glib/interfaces.h>
#include "anerley-feed.h"
#include "anerley-item.h"
@@ -41,8 +43,7 @@ G_DEFINE_TYPE_WITH_CODE (AnerleyTpFeed,
typedef struct _AnerleyTpFeedPrivate AnerleyTpFeedPrivate;
struct _AnerleyTpFeedPrivate {
- MissionControl *mc;
- McAccount *account;
+ TpAccount *account;
TpConnection *conn;
TpChannel *subscribe_channel;
@@ -54,7 +55,6 @@ struct _AnerleyTpFeedPrivate {
enum
{
PROP_0,
- PROP_MC,
PROP_ACCOUNT
};
@@ -65,9 +65,6 @@ anerley_tp_feed_get_property (GObject *object, guint property_id,
AnerleyTpFeedPrivate *priv = GET_PRIVATE (object);
switch (property_id) {
- case PROP_MC:
- g_value_set_object (value, priv->mc);
- break;
case PROP_ACCOUNT:
g_value_set_object (value, priv->account);
break;
@@ -83,9 +80,6 @@ anerley_tp_feed_set_property (GObject *object, guint property_id,
AnerleyTpFeedPrivate *priv = GET_PRIVATE (object);
switch (property_id) {
- case PROP_MC:
- priv->mc = g_value_dup_object (value);
- break;
case PROP_ACCOUNT:
priv->account = g_value_dup_object (value);
break;
@@ -94,6 +88,14 @@ anerley_tp_feed_set_property (GObject *object, guint property_id,
}
}
+static void _account_status_changed_cb (TpAccount *account,
+ TpConnectionStatus old_status,
+ TpConnectionStatus new_status,
+ TpConnectionStatusReason reason,
+ const gchar *dbus_error_name,
+ const GHashTable *details,
+ gpointer userdata);
+
static void
anerley_tp_feed_dispose (GObject *object)
{
@@ -135,16 +137,14 @@ anerley_tp_feed_dispose (GObject *object)
if (priv->account)
{
+ g_signal_handlers_disconnect_by_func (priv->account,
+ _account_status_changed_cb,
+ object);
+
g_object_unref (priv->account);
priv->account = NULL;
}
- if (priv->mc)
- {
- g_object_unref (priv->mc);
- priv->mc = NULL;
- }
-
G_OBJECT_CLASS (anerley_tp_feed_parent_class)->dispose (object);
}
@@ -172,14 +172,9 @@ _make_item_from_contact (AnerleyTpFeed *feed,
TpContact *contact)
{
AnerleyTpFeedPrivate *priv = GET_PRIVATE (feed);
- gchar *uid;
AnerleyTpItem *item;
- uid = g_strdup_printf ("%s/%s",
- mc_account_get_normalized_name (priv->account),
- tp_contact_get_identifier (contact));
- item = anerley_tp_item_new (priv->mc,
- priv->account,
+ item = anerley_tp_item_new (priv->account,
contact);
@@ -751,71 +746,60 @@ _tp_connection_ready_cb (TpConnection *connection,
}
static void
-_mc_account_status_changed_cb (MissionControl *mc,
- TpConnectionStatus status,
- McPresence presence,
- TpConnectionStatusReason reason,
- const gchar *account_name,
- gpointer userdata)
+_account_status_changed_cb (TpAccount *account,
+ TpConnectionStatus old_status,
+ TpConnectionStatus status,
+ TpConnectionStatusReason reason,
+ const gchar *dbus_error_name,
+ const GHashTable *details,
+ gpointer userdata)
{
- AnerleyTpFeed *feed = (AnerleyTpFeed *)userdata;
+ AnerleyTpFeed *feed = ANERLEY_TP_FEED (userdata);
AnerleyTpFeedPrivate *priv = GET_PRIVATE (feed);
GList *items;
- GError *error = NULL;
- /* This is so lame. I hear this should get better with MC5 though */
- if (g_str_equal (account_name, mc_account_get_unique_name (priv->account)))
+ g_debug (G_STRLOC ": Connection is in state: %s",
+ status==TP_CONNECTION_STATUS_CONNECTED ? "connected" :
+ status==TP_CONNECTION_STATUS_CONNECTING ? "connecting" :
+ status==TP_CONNECTION_STATUS_DISCONNECTED ? "disconnected" :
+ "other");
+
+ if (status == TP_CONNECTION_STATUS_CONNECTED)
{
- g_debug (G_STRLOC ": Connection is in state: %s",
- status==TP_CONNECTION_STATUS_CONNECTED ? "connected" :
- status==TP_CONNECTION_STATUS_CONNECTING ? "connecting" :
- status==TP_CONNECTION_STATUS_DISCONNECTED ? "disconnected" :
- "other");
- if (status == TP_CONNECTION_STATUS_CONNECTED)
- {
- priv->conn = mission_control_get_tpconnection (priv->mc,
- priv->account,
- &error);
- if (!priv->conn)
- {
- g_warning (G_STRLOC ": Error getting TP connection: %s",
- error->message);
- g_clear_error (&error);
- return;
- }
+ priv->conn = g_object_ref (tp_account_get_connection (account));
- tp_connection_call_when_ready (priv->conn,
- _tp_connection_ready_cb,
- feed);
- } else if (status == TP_CONNECTION_STATUS_DISCONNECTED) {
- /*
- * This means our connection has been disconnected. That is :-( so lets
- * remove these things from our internal store and emit the signals on
- * the feed.
- */
+ tp_connection_call_when_ready (priv->conn,
+ _tp_connection_ready_cb,
+ feed);
- items = g_hash_table_get_values (priv->ids_to_items);
+ } else if (status == TP_CONNECTION_STATUS_DISCONNECTED) {
+ /*
+ * This means our connection has been disconnected. That is :-( so lets
+ * remove these things from our internal store and emit the signals on
+ * the feed.
+ */
- g_signal_emit_by_name (feed, "items-removed", items);
- g_list_free (items);
- g_hash_table_remove_all (priv->handles_to_contacts);
- g_hash_table_remove_all (priv->ids_to_items);
- g_hash_table_remove_all (priv->handles_to_ids);
+ items = g_hash_table_get_values (priv->ids_to_items);
- if (priv->subscribe_channel)
- {
- g_object_unref (priv->subscribe_channel);
- priv->subscribe_channel = NULL;
- }
+ g_signal_emit_by_name (feed, "items-removed", items);
+ g_list_free (items);
+ g_hash_table_remove_all (priv->handles_to_contacts);
+ g_hash_table_remove_all (priv->ids_to_items);
+ g_hash_table_remove_all (priv->handles_to_ids);
- if (priv->conn)
- {
- g_object_unref (priv->conn);
- priv->conn = NULL;
- }
- } else {
- /* CONNECTING */
+ if (priv->subscribe_channel)
+ {
+ g_object_unref (priv->subscribe_channel);
+ priv->subscribe_channel = NULL;
+ }
+
+ if (priv->conn)
+ {
+ g_object_unref (priv->conn);
+ priv->conn = NULL;
}
+ } else {
+ /* CONNECTING */
}
}
@@ -824,33 +808,11 @@ anerley_tp_feed_setup_tp_connection (AnerleyTpFeed *feed)
{
AnerleyTpFeedPrivate *priv = GET_PRIVATE (feed);
guint res;
- GError *error = NULL;
- /* So. Deep breath. It may be that MC is not actually running. So what we
- * can do here is setup a signal on the proxy. Note that this proxy might
- * not be pointing to a valid remote object yet. However once it is then we
- * will get this signal and we can actually connect and stuff */
- dbus_g_proxy_connect_signal (DBUS_G_PROXY (priv->mc),
- "AccountStatusChanged",
- G_CALLBACK (_mc_account_status_changed_cb),
- feed,
- NULL);
-
- /* This may fail if MC is not running. If it does, boohoo. But the above
- * signal handler hook up will come alive when we do go online
- */
- res = mission_control_get_connection_status (priv->mc,
- priv->account,
- &error);
+ g_signal_connect (priv->account, "status-changed",
+ G_CALLBACK (_account_status_changed_cb), feed);
- if (error)
- {
- g_warning (G_STRLOC ": Error requesting connection status: %s. "
- "This may just be because MC is not running",
- error->message);
- g_clear_error (&error);
- return;
- }
+ res = tp_account_get_connection_status (priv->account, NULL);
g_debug (G_STRLOC ": Connection is in state: %s",
res==TP_CONNECTION_STATUS_CONNECTED ? "connected" :
@@ -858,31 +820,15 @@ anerley_tp_feed_setup_tp_connection (AnerleyTpFeed *feed)
res==TP_CONNECTION_STATUS_DISCONNECTED ? "disconnected" :
"other");
+
if (res != TP_CONNECTION_STATUS_CONNECTED)
return;
- /*
- * Since we've established that the connection is either connected or
- * connecting then there will a connection available for us to grab
- */
- priv->conn = mission_control_get_tpconnection (priv->mc,
- priv->account,
- &error);
- if (!priv->conn)
- {
- g_warning (G_STRLOC ": Error getting TP connection: %s",
- error->message);
- g_clear_error (&error);
- return;
- }
- /*
- * The connection may or may not be ready, let's get ourselves called when
- * it is.
- */
- tp_connection_call_when_ready (priv->conn,
- _tp_connection_ready_cb,
- feed);
+ _account_status_changed_cb (priv->account,
+ 0, TP_CONNECTION_STATUS_CONNECTED,
+ TP_CONNECTION_STATUS_REASON_NONE_SPECIFIED,
+ NULL, NULL, feed);
}
static void
@@ -910,17 +856,10 @@ anerley_tp_feed_class_init (AnerleyTpFeedClass *klass)
object_class->finalize = anerley_tp_feed_finalize;
object_class->constructed = anerley_tp_feed_constructed;
- pspec = g_param_spec_object ("mc",
- "mission control",
- "The mission control object",
- MISSIONCONTROL_TYPE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
- g_object_class_install_property (object_class, PROP_MC, pspec);
-
pspec = g_param_spec_object ("account",
"account",
- "The mission control account to use",
- MC_TYPE_ACCOUNT,
+ "The Telepathy account to use",
+ TP_TYPE_ACCOUNT,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class, PROP_ACCOUNT, pspec);
}
@@ -956,12 +895,9 @@ anerley_tp_feed_init (AnerleyTpFeed *self)
}
AnerleyTpFeed *
-anerley_tp_feed_new (MissionControl *mc,
- McAccount *account)
+anerley_tp_feed_new (TpAccount *account)
{
return g_object_new (ANERLEY_TYPE_TP_FEED,
- "mc",
- mc,
"account",
account,
NULL);
diff --git a/anerley/anerley-tp-feed.h b/anerley/anerley-tp-feed.h
index 59d6236..0dfe7c4 100644
--- a/anerley/anerley-tp-feed.h
+++ b/anerley/anerley-tp-feed.h
@@ -23,8 +23,9 @@
#ifndef _ANERLEY_TP_FEED
#define _ANERLEY_TP_FEED
+#include <telepathy-glib/account.h>
+
#include <glib-object.h>
-#include <libmissioncontrol/mission-control.h>
G_BEGIN_DECLS
@@ -55,8 +56,7 @@ typedef struct {
GType anerley_tp_feed_get_type (void);
-AnerleyTpFeed *anerley_tp_feed_new (MissionControl *mc,
- McAccount *account);
+AnerleyTpFeed *anerley_tp_feed_new (TpAccount *account);
G_END_DECLS
commit 03be2d335bf4bff7452cdfee8c04768104366728
Author: Jonny Lamb <jonny.lamb at collabora.co.uk>
Date: Sat Sep 26 17:09:20 2009 +0100
tp-item: update to new tp-glib account helper API
Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
diff --git a/anerley/anerley-tp-item.c b/anerley/anerley-tp-item.c
index 9530497..2f8edc8 100644
--- a/anerley/anerley-tp-item.c
+++ b/anerley/anerley-tp-item.c
@@ -19,8 +19,10 @@
*
*/
+#include <telepathy-glib/channel-dispatcher.h>
+#include <telepathy-glib/channel-request.h>
+#include <telepathy-glib/interfaces.h>
-#include <libmissioncontrol/mission-control.h>
#include "anerley-tp-item.h"
G_DEFINE_TYPE (AnerleyTpItem, anerley_tp_item, ANERLEY_TYPE_ITEM)
@@ -32,10 +34,12 @@ G_DEFINE_TYPE (AnerleyTpItem, anerley_tp_item, ANERLEY_TYPE_ITEM)
((AnerleyTpItem *)o)->priv
struct _AnerleyTpItemPrivate {
- MissionControl *mc;
- McAccount *account;
+ TpAccount *account;
TpContact *contact;
+ GSList *channel_requests;
+ GSList *signal_connections;
+
gchar *display_name;
gchar *avatar_path;
gchar *presence_status;
@@ -50,7 +54,6 @@ enum
PROP_0,
PROP_CONTACT,
PROP_ACCOUNT,
- PROP_MC
};
static void anerley_tp_item_update_contact (AnerleyTpItem *item,
@@ -69,9 +72,6 @@ anerley_tp_item_get_property (GObject *object, guint property_id,
case PROP_ACCOUNT:
g_value_set_object (value, priv->account);
break;
- case PROP_MC:
- g_value_set_object (value, priv->mc);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -91,9 +91,6 @@ anerley_tp_item_set_property (GObject *object, guint property_id,
case PROP_ACCOUNT:
priv->account = g_value_dup_object (value);
break;
- case PROP_MC:
- priv->mc = g_value_dup_object (value);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -113,10 +110,19 @@ anerley_tp_item_dispose (GObject *object)
priv->account = NULL;
}
- if (priv->mc)
+ if (priv->channel_requests != NULL)
+ {
+ g_slist_foreach (priv->channel_requests, (GFunc) g_object_unref, NULL);
+ g_slist_free (priv->channel_requests);
+ priv->channel_requests = NULL;
+ }
+
+ if (priv->signal_connections != NULL)
{
- g_object_unref (priv->mc);
- priv->mc = NULL;
+ g_slist_foreach (priv->signal_connections,
+ (GFunc) tp_proxy_signal_connection_disconnect, NULL);
+ g_slist_free (priv->signal_connections);
+ priv->signal_connections = NULL;
}
G_OBJECT_CLASS (anerley_tp_item_parent_class)->dispose (object);
@@ -169,17 +175,123 @@ anerley_tp_item_get_presence_message (AnerleyItem *item)
}
static void
+_item_activate_proceed_cb (TpChannelRequest *proxy,
+ const GError *error,
+ gpointer userdata,
+ GObject *weak_object)
+{
+ if (error != NULL)
+ g_warning ("Failed to call Proceed on the channel request: %s",
+ error->message);
+}
+
+static void
+_item_activate_failed_cb (TpChannelRequest *proxy,
+ const gchar *arg_Error,
+ const gchar *arg_Message,
+ gpointer userdata,
+ GObject *weak_object)
+{
+ if (arg_Error != NULL)
+ {
+ g_warning ("Channel request failed: %s: %s", arg_Error, arg_Message);
+ return;
+ }
+}
+
+static void
+_item_activate_succeeded_cb (TpChannelRequest *proxy,
+ gpointer userdata,
+ GObject *weak_object)
+{
+ g_debug ("Channel request succeeded\n");
+}
+
+static void
+_item_activate_ensure_channel_cb (TpChannelDispatcher *proxy,
+ const gchar *out_Request,
+ const GError *error,
+ gpointer userdata,
+ GObject *weak_object)
+{
+ TpChannelRequest *request;
+ TpDBusDaemon *dbus;
+ AnerleyTpItemPrivate *priv = GET_PRIVATE (weak_object);
+ TpProxySignalConnection *signal;
+
+ if (error != NULL)
+ {
+ g_warning ("Failed to CreateChannel: %s", error->message);
+ return;
+ }
+
+ dbus = tp_dbus_daemon_dup (NULL);
+
+ request = tp_channel_request_new (dbus, out_Request, NULL, NULL);
+
+ /* Connect to Succeeded and add it to the list */
+ signal = tp_cli_channel_request_connect_to_succeeded (request, _item_activate_succeeded_cb,
+ NULL, NULL, weak_object, NULL);
+
+ priv->signal_connections = g_slist_append (priv->signal_connections, signal);
+
+ /* Connect to Failed and add it to the list */
+ signal = tp_cli_channel_request_connect_to_failed (request, _item_activate_failed_cb,
+ NULL, NULL, weak_object, NULL);
+
+ priv->signal_connections = g_slist_append (priv->signal_connections, signal);
+
+ /* Call Proceed and add the request to the list */
+ tp_cli_channel_request_call_proceed (request, -1, _item_activate_proceed_cb,
+ NULL, NULL, weak_object);
+
+ priv->channel_requests = g_slist_append (priv->channel_requests, request);
+
+ g_object_unref (dbus);
+}
+
+static void
anerley_tp_item_activate (AnerleyItem *item)
{
AnerleyTpItemPrivate *priv = GET_PRIVATE (item);
-
- mission_control_request_channel (priv->mc,
- priv->account,
- TP_IFACE_CHANNEL_TYPE_TEXT,
- tp_contact_get_handle (priv->contact),
- TP_HANDLE_TYPE_CONTACT,
- NULL,
- NULL);
+ TpChannelDispatcher *dispatcher;
+ TpDBusDaemon *dbus;
+ GTimeVal t;
+ GHashTable *properties;
+
+ dbus = tp_dbus_daemon_dup (NULL);
+ dispatcher = tp_channel_dispatcher_new (dbus);
+
+ g_get_current_time (&t);
+
+ properties = tp_asv_new (TP_IFACE_CHANNEL ".ChannelType",
+ G_TYPE_STRING,
+ TP_IFACE_CHANNEL_TYPE_TEXT,
+
+ TP_IFACE_CHANNEL ".TargetHandleType",
+ G_TYPE_UINT,
+ TP_HANDLE_TYPE_CONTACT,
+
+ TP_IFACE_CHANNEL ".TargetHandle",
+ G_TYPE_UINT,
+ tp_contact_get_handle (priv->contact),
+
+ NULL);
+
+ tp_cli_channel_dispatcher_call_ensure_channel (dispatcher,
+ -1,
+ tp_proxy_get_object_path (priv->account),
+ properties,
+ t.tv_sec,
+ "",
+ _item_activate_ensure_channel_cb,
+ NULL,
+ NULL,
+ item);
+
+ g_hash_table_destroy (properties);
+ g_object_unref (dispatcher);
+ g_object_unref (dbus);
}
static const gchar *
@@ -221,17 +333,10 @@ anerley_tp_item_class_init (AnerleyTpItemClass *klass)
item_class->get_last_name = anerley_tp_item_get_last_name;
item_class->activate = anerley_tp_item_activate;
- pspec = g_param_spec_object ("mc",
- "Mission control",
- "The mission control instance",
- MISSIONCONTROL_TYPE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
- g_object_class_install_property (object_class, PROP_MC, pspec);
-
pspec = g_param_spec_object ("account",
"The account",
"The mission control account",
- MC_TYPE_ACCOUNT,
+ TP_TYPE_ACCOUNT,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class, PROP_ACCOUNT, pspec);
@@ -248,16 +353,16 @@ anerley_tp_item_init (AnerleyTpItem *self)
{
AnerleyTpItemPrivate *priv = GET_PRIVATE_REAL (self);
self->priv = priv;
+
+ priv->channel_requests = NULL;
+ priv->signal_connections = NULL;
}
AnerleyTpItem *
-anerley_tp_item_new (MissionControl *mc,
- McAccount *account,
- TpContact *contact)
+anerley_tp_item_new (TpAccount *account,
+ TpContact *contact)
{
return g_object_new (ANERLEY_TYPE_TP_ITEM,
- "mc",
- mc,
"account",
account,
"contact",
diff --git a/anerley/anerley-tp-item.h b/anerley/anerley-tp-item.h
index 7f99a17..6cf4f21 100644
--- a/anerley/anerley-tp-item.h
+++ b/anerley/anerley-tp-item.h
@@ -25,6 +25,7 @@
#include <glib-object.h>
#include <anerley/anerley-item.h>
+#include <telepathy-glib/account.h>
#include <telepathy-glib/contact.h>
G_BEGIN_DECLS
@@ -59,8 +60,7 @@ typedef struct {
GType anerley_tp_item_get_type (void);
-AnerleyTpItem *anerley_tp_item_new (MissionControl *mc,
- McAccount *account,
+AnerleyTpItem *anerley_tp_item_new (TpAccount *account,
TpContact *contact);
void anerley_tp_item_set_avatar_path (AnerleyTpItem *item,
const gchar *avatar_path);
Index: anerley.spec
===================================================================
RCS file: /cvs/pkgs/rpms/anerley/devel/anerley.spec,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -p -r1.5 -r1.6
--- anerley.spec 19 Sep 2009 13:48:27 -0000 1.5
+++ anerley.spec 28 Sep 2009 21:20:57 -0000 1.6
@@ -1,6 +1,8 @@
+%define _default_patch_fuzz 2
+
Name: anerley
Version: 0.1.1
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Moblin widgets for people information
Group: System Environment/Libraries
@@ -9,6 +11,12 @@ URL: http://www.moblin.org/
Source0: http://git.moblin.org/cgit.cgi/%{name}/snapshot/%{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+# Created with:
+# git show -p f76297e57d4368ef4e289716e03cd8e256532fad
+# git show -p 3aa84f86a5c0d33d3dc3199b3891ac6a30c8fae0~9..
+# On the mc5 branch of git://git.collabora.co.uk/git/user/jonny/anerley.git
+Patch0: anerley-mc5-port.patch
+
BuildRequires: evolution-data-server-devel
BuildRequires: glib2-devel
BuildRequires: nbtk-devel
@@ -35,6 +43,7 @@ Files for development with %{name}.
%prep
%setup -q
+%patch0 -p1 -b .mc5
# Don't run configure from autogen.sh
NOCONFIGURE=true ./autogen.sh
@@ -72,6 +81,9 @@ rm -rf %{buildroot}
%{_libdir}/*.so
%changelog
+* Mon Sep 28 2009 Bastien Nocera <bnocera at redhat.com> 0.1.1-2
+- Add patch to port to Mission Control 5
+
* Sat Sep 19 2009 Peter Robinson <pbrobinson at gmail.com> 0.1.1-1
- New upstream 0.1.1 release
More information about the fedora-extras-commits
mailing list