[gnome-chess/chess-telepathy-networking-support-664946-rebase: 45/64] Use account-manager obtained from a TpAutomaticClientFactory



commit e50355147b83bfd5c76dc1eaaebaffb143697df8
Author: Chandni Verma <chandniverma2112 gmail com>
Date:   Sun Sep 9 07:26:00 2012 +0530

    Use account-manager obtained from a TpAutomaticClientFactory
    
    This is needed to dispatch dbus-tube channels.
    Folks picks up this default account-manager.

 src/gnome-chess-application.vala     |   20 ++++++++++++++++++++
 src/gnome-chess-channel-handler.vala |    2 ++
 2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/gnome-chess-application.vala b/src/gnome-chess-application.vala
index d22ab06..d8840fc 100644
--- a/src/gnome-chess-application.vala
+++ b/src/gnome-chess-application.vala
@@ -90,6 +90,8 @@ public class Application : Gtk.Application
         foreach (var profile in ai_profiles)
             message ("Detected AI profile %s in %s", profile.name, profile.path);
 
+        chess_networking_init ();
+
         if (game_file == null)
         {
             launcher = create_launcher (engines_file, ai_profiles, history);
@@ -119,6 +121,24 @@ public class Application : Gtk.Application
         settings_common.changed.connect (settings_changed_cb);
     }
 
+    public void chess_networking_init ()
+    {
+      TelepathyGLib.SimpleClientFactory factory;
+      TelepathyGLib.AccountManager am;
+
+      if (Config.ENABLE_NETWORKING)
+      {
+        /* Prepare account-manager from TpAutomaticClientFactory if networking
+         * is enabled. Set it as default so that folks uses it.  */
+
+         factory = new TelepathyGLib.AutomaticClientFactory (null);
+
+         /* Features are prepared by folks so we don't need to prepare them */
+         am = new TelepathyGLib.AccountManager.with_factory (factory);
+         am.set_default ();
+      }
+    }
+
     private ChessLauncher create_launcher (string engines_file,
         List<AIProfile>? ai_profiles,
         History history)
diff --git a/src/gnome-chess-channel-handler.vala b/src/gnome-chess-channel-handler.vala
index 3b7a479..3b4d0c9 100644
--- a/src/gnome-chess-channel-handler.vala
+++ b/src/gnome-chess-channel-handler.vala
@@ -50,6 +50,8 @@ public class HandlerApplication : Application
             application_id: TelepathyGLib.CLIENT_BUS_NAME_BASE + "Gnome.Chess",
             flags: ApplicationFlags.FLAGS_NONE);
 
+        chess_networking_init ();
+
         settings = new Settings ("org.gnome.gnome-chess");
         settings_common = new Settings ("org.gnome.gnome-chess.games-common");
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]