[gnome-chess] Put buttons for common actions into the header bar
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chess] Put buttons for common actions into the header bar
- Date: Sun, 16 Feb 2014 17:38:00 +0000 (UTC)
commit 308b71725add480798ef16494d947da506ac94c0
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Sat Feb 15 20:49:33 2014 -0600
Put buttons for common actions into the header bar
data/gnome-chess.ui | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++
src/gnome-chess.vala | 9 +-----
2 files changed, 73 insertions(+), 7 deletions(-)
---
diff --git a/data/gnome-chess.ui b/data/gnome-chess.ui
index 6eae827..0ace3c1 100644
--- a/data/gnome-chess.ui
+++ b/data/gnome-chess.ui
@@ -22,6 +22,35 @@
<property name="show_close_button">True</property>
<property name="title" translatable="yes">Chess</property>
<child>
+ <object class="GtkButton" id="new_game_button">
+ <property name="visible">True</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="label" translatable="yes">New Game</property>
+ <property name="action-name">win.new</property>
+ <style>
+ <class name="text-button"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="undo_move_button">
+ <property name="visible">True</property>
+ <property name="valign">center</property>
+ <property name="action-name">win.undo</property>
+ <property name="tooltip-text" translatable="yes">Undo your most recent move</property>
+ <style>
+ <class name="image-button"/>
+ </style>
+ <child>
+ <object class="GtkImage" id="undo_move_image">
+ <property name="visible">True</property>
+ <property name="icon_size">1</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
<object class="GtkMenuButton" id="gear_button">
<property name="visible">True</property>
<property name="valign">center</property>
@@ -40,6 +69,48 @@
<property name="pack_type">end</property>
</packing>
</child>
+ <child>
+ <object class="GtkButton" id="save_game_button">
+ <property name="visible">True</property>
+ <property name="valign">center</property>
+ <property name="action-name">win.save</property>
+ <property name="tooltip-text" translatable="yes">Save the current game</property>
+ <style>
+ <class name="image-button"/>
+ </style>
+ <child>
+ <object class="GtkImage" id="save_game_image">
+ <property name="visible">True</property>
+ <property name="icon_size">1</property>
+ <property name="icon_name">document-save-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="open_game_button">
+ <property name="visible">True</property>
+ <property name="valign">center</property>
+ <property name="action-name">win.open</property>
+ <property name="tooltip-text" translatable="yes">Open a saved game</property>
+ <style>
+ <class name="image-button"/>
+ </style>
+ <child>
+ <object class="GtkImage" id="open_game_image">
+ <property name="visible">True</property>
+ <property name="icon_size">1</property>
+ <property name="icon_name">document-open-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+ </child>
</object>
</child>
<child>
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index f49323c..fd8eafb 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -127,6 +127,7 @@ public class Application : Gtk.Application
warning ("Could not load UI: %s", e.message);
}
window = (Gtk.ApplicationWindow) builder.get_object ("gnome_chess_app");
+ var undo_move_image = (Gtk.Image) builder.get_object ("undo_move_image");
menu_button = (Gtk.MenuButton) builder.get_object ("gear_button");
first_move_button = (Gtk.Widget) builder.get_object ("first_move_button");
prev_move_button = (Gtk.Widget) builder.get_object ("prev_move_button");
@@ -149,6 +150,7 @@ public class Application : Gtk.Application
prev_move_image.icon_name = rtl ? "go-previous-rtl-symbolic" : "go-previous-symbolic";
next_move_image.icon_name = rtl ? "go-next-rtl-symbolic" : "go-next-symbolic";
last_move_image.icon_name = rtl ? "go-last-rtl-symbolic" : "go-last-symbolic";
+ undo_move_image.icon_name = rtl ? "edit-undo-rtl-symbolic" : "edit-undo-symbolic";
window.add_action_entries (window_entries, this);
add_window (window);
@@ -1076,18 +1078,11 @@ public class Application : Gtk.Application
var window_menu = new Menu ();
var section = new Menu ();
- section.append (_("New"), "win." + NEW_GAME_ACTION_NAME);
- section.append (_("Open…"), "win." + OPEN_GAME_ACTION_NAME);
- section.append (_("Save"), "win." + SAVE_GAME_ACTION_NAME);
section.append (_("Save As…"), "win." + SAVE_GAME_AS_ACTION_NAME);
- window_menu.append_section (null, section);
-
- section = new Menu();
if (game.is_paused)
section.append (_("Resume"), "win." + PAUSE_RESUME_ACTION_NAME);
else
section.append (_("Pause"), "win." + PAUSE_RESUME_ACTION_NAME);
- section.append (_("Undo Move"), "win." + UNDO_MOVE_ACTION_NAME);
section.append (_("Claim Draw"), "win." + CLAIM_DRAW_ACTION_NAME);
section.append (_("Resign"), "win." + RESIGN_ACTION_NAME);
window_menu.append_section (null, section);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]