[gnome-chess/chess-telepathy-networking-support-664946-rebase: 27/64] Add remote contacts to chess-launcher
- From: Chandni Verma <vchandni src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chess/chess-telepathy-networking-support-664946-rebase: 27/64] Add remote contacts to chess-launcher
- Date: Sun, 23 Dec 2012 03:40:53 +0000 (UTC)
commit 7cd5f5f1c3fca46126486108568ea9f6e74fee6d
Author: Chandni Verma <chandniverma2112 gmail com>
Date: Wed Sep 5 05:31:03 2012 +0530
Add remote contacts to chess-launcher
data/new-game-launcher.ui | 37 ++++++++++++++++++++++++++++++-------
src/chess-launcher.vala | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 73 insertions(+), 7 deletions(-)
---
diff --git a/data/new-game-launcher.ui b/data/new-game-launcher.ui
index 56cb9d8..32fec34 100644
--- a/data/new-game-launcher.ui
+++ b/data/new-game-launcher.ui
@@ -336,7 +336,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">2</property>
+ <property name="top_attach">3</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
@@ -357,7 +357,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">3</property>
+ <property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -378,21 +378,38 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">3</property>
+ <property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkScrolledWindow" id="scrolledwindow_remote_player">
- <property name="height_request">120</property>
+ <object class="GtkBox" id="contacts_box">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can_focus">False</property>
<property name="margin_left">50</property>
<property name="margin_right">50</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <property name="shadow_type">in</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow_remote_player">
+ <property name="height_request">120</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
<child>
<placeholder/>
</child>
@@ -404,6 +421,12 @@
<property name="height">1</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="left_attach">1</property>
diff --git a/src/chess-launcher.vala b/src/chess-launcher.vala
index 75eb099..7276e7f 100644
--- a/src/chess-launcher.vala
+++ b/src/chess-launcher.vala
@@ -45,6 +45,13 @@ public class ChessLauncher : Gtk.Window
private Gtk.Action radioaction_opponent_local_player;
private Gtk.Action radioaction_opponent_remote_player;
+ private Gtk.Widget contacts_box;
+ private Gtk.Widget scrolledwindow_remote_player;
+ private GamesContacts.IndividualStore? individual_store = null;
+ private GamesContacts.IndividualManager? individual_manager = null;
+ private GamesContacts.IndividualView? individual_view = null;
+ private GamesContacts.LiveSearch? search_widget;
+
private Gtk.Widget togglebutton_easy;
private Gtk.Widget togglebutton_normal;
private Gtk.Widget togglebutton_difficult;
@@ -111,6 +118,9 @@ public class ChessLauncher : Gtk.Window
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");
+ scrolledwindow_remote_player = (Gtk.ScrolledWindow) builder.get_object ("scrolledwindow_remote_player");
+ contacts_box = (Gtk.Widget) builder.get_object ("contacts_box");
+
togglebutton_easy = (Gtk.Widget) builder.get_object ("togglebutton_easy");
togglebutton_normal = (Gtk.Widget) builder.get_object ("togglebutton_normal");
togglebutton_difficult = (Gtk.Widget) builder.get_object ("togglebutton_difficult");
@@ -182,6 +192,36 @@ public class ChessLauncher : Gtk.Window
if (!Config.ENABLE_NETWORKING)
togglebutton_remote_player.hide ();
+ /* Remote players list */
+ individual_manager =
+ GamesContacts.IndividualManager.dup_singleton ();
+ individual_store = new GamesContacts.IndividualStoreManager (
+ individual_manager);
+ individual_view = new GamesContacts.IndividualView (
+ individual_store,
+ GamesContacts.IndividualViewFeatureFlags.GROUPS_SAVE);
+
+ /* Create searching capability for the treeview */
+ search_widget = new GamesContacts.LiveSearch (
+ individual_view as Gtk.Widget);
+ individual_view.set_live_search (search_widget);
+
+ /* Add filter for contacts capable of playing glchess */
+ individual_view.set_custom_filter ((model, iter, data)=>{
+ return (data as GamesContacts.IndividualView).filter_default (
+ model, iter, GamesContacts.ActionType.PLAY_GLCHESS);
+ });
+
+ /* Evaluate contacts' presence using filter */
+ individual_view.refilter ();
+
+ /* Add to scrolled window and show */
+ (scrolledwindow_remote_player as Gtk.Container).add (individual_view);
+ scrolledwindow_remote_player.show ();
+ individual_view.show ();
+
+ (contacts_box as Gtk.Box).set_orientation (Gtk.Orientation.VERTICAL);
+ (contacts_box as Gtk.Container).add (search_widget);
}
~ChessLauncher ()
@@ -284,7 +324,10 @@ public class ChessLauncher : Gtk.Window
grid_select_game.hide ();
grid_select_opponent.hide ();
+
grid_select_remote_player.show ();
+ (contacts_box as Gtk.Widget).grab_focus ();
+
grid_game_options.hide ();
grid_preferences.hide ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]