[gnome-chess/chess-telepathy-networking-support-664946-rebase: 12/64] [Chess Screen] Show remote player option only when networking is enabled



commit ef8fac30e6cac8c1ec2e66238d74faadf5258bca
Author: Chandni Verma <chandniverma2112 gmail com>
Date:   Thu Jul 19 17:49:30 2012 +0530

    [Chess Screen] Show remote player option only when networking is enabled

 configure.ac         |    7 ++++++-
 src/config.vapi      |    1 +
 src/gnome-chess.vala |    6 ++++++
 3 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 892ab5e..fff683c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,7 +38,7 @@ dnl ###########################################################################
 
 AC_ARG_ENABLE([networking],
     AS_HELP_STRING([--enable-networking=@<:@no/yes@:>@],
-        [build with Contacts and Telepathy networking support]),
+        [build with Contacts and Telepathy networking support (default: yes)]),
     [case "${enableval}" in
         yes) networking=yes ;;
          no) networking=no ;;
@@ -55,6 +55,11 @@ if test "x$networking" = "xyes"; then
          folks-telepathy >= $FOLKS_REQUIRED])
     AC_SUBST([FOLKS_CFLAGS])
     AC_SUBST([FOLKS_LIBS])
+
+    AC_DEFINE([ENABLE_NETWORKING],[1],[Defines whether Telepathy networking is enabled])
+else
+    AC_DEFINE([ENABLE_NETWORKING],[0],
+        [Defines whether Telepathy networking is enabled])
 fi
 AM_CONDITIONAL([ENABLE_NETWORKING], [test "x$networking" = "xyes"])
 
diff --git a/src/config.vapi b/src/config.vapi
index a1787ca..7f2503d 100644
--- a/src/config.vapi
+++ b/src/config.vapi
@@ -2,3 +2,4 @@ public const string PKGDATADIR;
 public const string LOCALEDIR;
 public const string GETTEXT_PACKAGE;
 public const string VERSION;
+public const bool ENABLE_NETWORKING;
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index 7cbeb2a..a7e1907 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -21,6 +21,7 @@ public class Application : Gtk.Application
     private Gtk.Action radioaction_new_game;
 
     private Gtk.Widget togglebutton_robot;
+    private Gtk.Widget togglebutton_remote_player;
     private Gtk.Action radioaction_opponent_robot;
     private Gtk.Action radioaction_opponent_local_player;
     private Gtk.Action radioaction_opponent_remote_player;
@@ -162,6 +163,8 @@ public class Application : Gtk.Application
         radioaction_new_game = (Gtk.Action) builder.get_object ("radioaction_new_game");
 
         togglebutton_robot = (Gtk.Widget) builder.get_object ("togglebutton_robot");
+        togglebutton_remote_player = (Gtk.Widget) builder.get_object ("togglebutton_remote_player");
+
         radioaction_opponent_robot = (Gtk.Action) builder.get_object ("radioaction_opponent_robot");
         radioaction_opponent_local_player = (Gtk.Action) builder.get_object ("radioaction_opponent_local_player");
         radioaction_opponent_remote_player = (Gtk.Action) builder.get_object ("radioaction_opponent_remote_player");
@@ -283,6 +286,9 @@ public class Application : Gtk.Application
 
         }
 
+        if (!ENABLE_NETWORKING)
+          togglebutton_remote_player.hide ();
+
         if (game_file == null)
         {
             var unfinished = history.get_unfinished ();



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