diff options
author | Vivek Dasmohapatra <vivek@collabora.co.uk> | 2011-03-01 16:57:09 +0000 |
---|---|---|
committer | Vivek Dasmohapatra <vivek@collabora.co.uk> | 2011-03-01 16:57:09 +0000 |
commit | ff0847e2dea8848c76d6f965014a1d1869d2d710 (patch) | |
tree | 9efeb03120d71ffc5edc5c719f7acce75bc76cba | |
parent | 28c11afb58a9809e648b6de8fadda6a9c2308773 (diff) | |
parent | 28581cc816dd6082916db86d68200a439d64934a (diff) | |
download | telepathy-mission-control-ff0847e2dea8848c76d6f965014a1d1869d2d710.tar.gz |
Merge branch 'master' of git+ssh://git.freedesktop.org/git/telepathy/telepathy-mission-control
-rw-r--r-- | tests/twisted/mctest.py | 30 | ||||
-rw-r--r-- | util/mc-tool.c | 30 |
2 files changed, 20 insertions, 40 deletions
diff --git a/tests/twisted/mctest.py b/tests/twisted/mctest.py index fee227f3..8a37e914 100644 --- a/tests/twisted/mctest.py +++ b/tests/twisted/mctest.py @@ -66,6 +66,16 @@ def install_colourer(): sys.stdout = Colourer(sys.stdout, patterns) return sys.stdout +def wait_for_name(queue, bus, name): + if not bus.name_has_owner(name): + queue.expect('dbus-signal', signal='NameOwnerChanged', + predicate=lambda e: e.args[0] == name and e.args[2]) + +def wait_for_mc(queue, bus, params): + mc = make_mc(bus, queue.append, params) + wait_for_name(queue, bus, cs.AM) + wait_for_name(queue, bus, cs.CD) + return mc def exec_test_deferred (fun, params, protocol=None, timeout=None, preload_mc=True): @@ -81,23 +91,17 @@ def exec_test_deferred (fun, params, protocol=None, timeout=None, bus = dbus.SessionBus() queue.attach_to_bus(bus) - if preload_mc: - mc = make_mc(bus, queue.append, params) - - try: - bus.get_name_owner(cs.AM) - except dbus.DBusException, e: - queue.expect('dbus-signal', signal='NameOwnerChanged', - predicate=lambda e: e.args[0] == cs.AM and e.args[2]) + error = None + if preload_mc: try: - bus.get_name_owner(cs.CD) - except dbus.DBusException, e: - queue.expect('dbus-signal', signal='NameOwnerChanged', - predicate=lambda e: e.args[0] == cs.CD and e.args[2]) + mc = wait_for_mc(queue, bus, params) + except Exception, e: + import traceback + traceback.print_exc() + os._exit(1) else: mc = None - error = None try: fun(queue, bus, mc) diff --git a/util/mc-tool.c b/util/mc-tool.c index 3541fa1c..f762203c 100644 --- a/util/mc-tool.c +++ b/util/mc-tool.c @@ -31,9 +31,6 @@ #include <telepathy-glib/telepathy-glib.h> -#include <libmcclient/_gen/interfaces.h> -#include <libmcclient/mc-profile.h> - static gchar *app_name; static GMainLoop *main_loop; @@ -45,7 +42,6 @@ show_help (gchar * err) printf ("Usage:\n" " %1$s list\n" - " %1$s add <profile> <display name> [<param> ...]\n" " %1$s add <manager>/<protocol> <display name> [<param> ...]\n" " %1$s update <account name> [<param>|clear:key] ...\n" " %1$s display <account name> <display name>\n" @@ -85,7 +81,7 @@ union command { struct { struct common common; - gchar const *manager, *protocol, *profile, *display; + gchar const *manager, *protocol, *display; GHashTable *parameters; } add; @@ -546,19 +542,9 @@ static gboolean command_add (TpAccountManager *manager) { GHashTable *properties; - GValue v_profile = { 0 }; properties = g_hash_table_new (g_str_hash, g_str_equal); - if (command.add.profile) - { - g_value_init (&v_profile, G_TYPE_STRING); - g_value_set_static_string (&v_profile, command.add.profile); - g_hash_table_insert (properties, - MC_IFACE_ACCOUNT_INTERFACE_COMPAT ".Profile", - &v_profile); - } - return NULL != tp_cli_account_manager_call_create_account (manager, 25000, @@ -941,19 +927,9 @@ parse (int argc, char **argv) } else { - McProfile *profile; - - profile = mc_profile_lookup (argv[2]); - if (!profile) - { - g_warning ("%s: profile %s not found", argv[1], argv[2]); - exit (1); - } - - command.add.profile = argv[2]; - command.add.manager = mc_profile_get_manager_name (profile); - command.add.protocol = mc_profile_get_protocol_name (profile); + show_help ("Invalid add command."); } + command.ready.manager = command_add; command.add.display = argv[3]; |