Guest User

Untitled

a guest
Jul 18th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. #include <telepathy-glib/account-manager.h>
  2. #include <telepathy-glib/connection-manager.h>
  3. #include <telepathy-glib/debug.h>
  4.  
  5. #include <glib-object.h>
  6. #include <glib.h>
  7. #include <glib/glist.h>
  8.  
  9. #include "observer.h"
  10.  
  11. static GMainLoop *loop = NULL;
  12.  
  13.  
  14.  
  15. void _prepare_async_cb(TpAccountManager* tp_am, GAsyncResult *res, gpointer user_data) {
  16. GError* gerror;
  17. g_print("FOO\n");
  18. if( tp_account_manager_prepare_finish(tp_am, res, &gerror) ) {
  19.  
  20. if (tp_account_manager_is_prepared (tp_am, TP_ACCOUNT_MANAGER_FEATURE_CORE)==TRUE) {
  21. g_print("PREPARED\n");
  22. } else
  23. g_print("UNPREP\n");
  24.  
  25. GList* accounts = tp_account_manager_get_valid_accounts(tp_am);
  26. //gpointer account = g_list_nth_data(accounts, 0);
  27. g_list_free(accounts);
  28. } else {
  29. g_error("NOT FINISHED\n");
  30. }
  31.  
  32. }
  33.  
  34. int main(int argc, char *argv[])
  35. {
  36. TpAccountManager* tp_am;
  37. g_type_init ();
  38. loop = g_main_loop_new (NULL, FALSE);
  39. tp_am = tp_account_manager_dup();
  40. if (!tp_am) {
  41. g_error("AccountManager is NULL\n");
  42. }
  43. tp_account_manager_prepare_async (tp_am,
  44. NULL, (GAsyncReadyCallback) _prepare_async_cb, NULL);
  45. g_main_loop_run (loop);
  46. return 0;
  47. }
Add Comment
Please, Sign In to add comment