[gnome-chess/arnaudb/wip/gtk4: 49/54] Fix signals.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chess/arnaudb/wip/gtk4: 49/54] Fix signals.
- Date: Thu, 13 Aug 2020 15:34:52 +0000 (UTC)
commit 455a2f225969eee1257ddde6c4b0e15537912de4
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Tue Apr 7 21:13:32 2020 +0200
Fix signals.
data/gnome-chess.ui | 5 ---
data/preferences.ui | 13 --------
src/gnome-chess.vala | 90 ++++++++++++++++++++++++++--------------------------
3 files changed, 45 insertions(+), 63 deletions(-)
---
diff --git a/data/gnome-chess.ui b/data/gnome-chess.ui
index 1cd740a..8edac83 100644
--- a/data/gnome-chess.ui
+++ b/data/gnome-chess.ui
@@ -136,7 +136,6 @@
<property name="tooltip-text" translatable="yes" comments="Tooltip on the show
first move (i.e. game start) navigation button">Rewind to the game start</property>
<property name="icon-name">go-first-symbolic</property>
<!-- <accelerator key="Left" signal="activate" modifiers="GDK_SHIFT_MASK |
GDK_MOD1_MASK"/>-->
- <signal name="clicked" handler="history_start_clicked_cb" swapped="no"/>
<style>
<class name="image-button"/>
</style>
@@ -149,7 +148,6 @@
<property name="tooltip-text" translatable="yes" comments="Tooltip on the show
previous move navigation button">Show the previous move</property>
<property name="icon-name">go-previous-symbolic</property>
<!-- <accelerator key="Left" signal="activate" modifiers="GDK_MOD1_MASK"/>-->
- <signal name="clicked" handler="history_previous_clicked_cb" swapped="no"/>
<style>
<class name="image-button"/>
</style>
@@ -162,7 +160,6 @@
<property name="tooltip-text" translatable="yes" comments="Tooltip on the show
next move navigation button">Show the next move</property>
<property name="icon-name">go-next-symbolic</property>
<!-- <accelerator key="Right" signal="activate" modifiers="GDK_MOD1_MASK"/>-->
- <signal name="clicked" handler="history_next_clicked_cb" swapped="no"/>
<style>
<class name="image-button"/>
</style>
@@ -175,7 +172,6 @@
<property name="tooltip-text" translatable="yes" comments="Tooltip on the show
current move navigation button">Show the current move</property>
<property name="icon-name">go-last-symbolic</property>
<!-- <accelerator key="Right" signal="activate" modifiers="GDK_SHIFT_MASK |
GDK_MOD1_MASK"/>-->
- <signal name="clicked" handler="history_latest_clicked_cb" swapped="no"/>
<style>
<class name="image-button"/>
</style>
@@ -187,7 +183,6 @@
<object class="GtkComboBox" id="history_combo">
<property name="hexpand">True</property>
<property name="model">history-model</property>
- <signal name="changed" handler="history_combo_changed_cb" swapped="no"/>
<child>
<object class="GtkCellRendererText">
<property name="ellipsize">PANGO_ELLIPSIZE_END</property>
diff --git a/data/preferences.ui b/data/preferences.ui
index 824ec1c..c39e4bd 100644
--- a/data/preferences.ui
+++ b/data/preferences.ui
@@ -86,14 +86,12 @@
<property name="upper">59</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
- <signal name="value-changed" handler="timer_increment_units_changed_cb" swapped="no"/>
</object>
<object class="GtkAdjustment" id="duration_adjustment">
<property name="lower">1</property>
<property name="upper">10</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
- <signal name="value-changed" handler="duration_changed_cb" swapped="no"/>
</object>
<object class="GtkListStore" id="duration-model">
<columns>
@@ -228,7 +226,6 @@
<property name="destroy-with-parent">True</property>
<property name="use-header-bar">1</property>
<!-- <signal name="delete-event" handler="preferences_delete_event_cb" swapped="no"/>-->
- <signal name="response" handler="preferences_response_cb" swapped="no"/>
<child internal-child="content_area">
<object class="GtkBox">
<property name="can-focus">False</property>
@@ -282,7 +279,6 @@
<property name="hexpand">True</property>
<property name="can-focus">False</property>
<property name="model">clock-type-model</property>
- <signal name="changed" handler="clock_type_changed_cb" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
@@ -354,7 +350,6 @@
<property name="hexpand">True</property>
<property name="can-focus">False</property>
<property name="model">timer-increment-units-model</property>
- <signal name="changed" handler="timer_increment_units_changed_cb" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
@@ -374,7 +369,6 @@
<property name="hexpand">True</property>
<property name="can-focus">False</property>
<property name="model">side-model</property>
- <signal name="changed" handler="side_combo_changed_cb" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
@@ -392,7 +386,6 @@
<property name="hexpand">True</property>
<property name="can-focus">False</property>
<property name="model">opponent-model</property>
- <signal name="changed" handler="opponent_combo_changed_cb" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
@@ -410,7 +403,6 @@
<property name="hexpand">True</property>
<property name="can-focus">False</property>
<property name="model">difficulty-model</property>
- <signal name="changed" handler="difficulty_combo_changed_cb" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
@@ -443,7 +435,6 @@
<property name="hexpand">True</property>
<property name="can-focus">False</property>
<property name="model">custom-duration-units-model</property>
- <signal name="changed" handler="duration_units_changed_cb" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
@@ -476,7 +467,6 @@
<property name="hexpand">True</property>
<property name="can-focus">False</property>
<property name="model">duration-model</property>
- <signal name="changed" handler="duration_combo_changed_cb" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
@@ -583,7 +573,6 @@
<property name="hexpand">True</property>
<property name="can-focus">False</property>
<property name="model">orientation-model</property>
- <signal name="changed" handler="orientation_combo_changed_cb" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
@@ -601,7 +590,6 @@
<property name="hexpand">True</property>
<property name="can-focus">False</property>
<property name="model">move-format-model</property>
- <signal name="changed" handler="move_format_combo_changed_cb" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
@@ -619,7 +607,6 @@
<property name="hexpand">True</property>
<property name="can-focus">True</property>
<property name="model">piece-style-model</property>
- <signal name="changed" handler="piece_style_combo_changed_cb" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index 5095ed8..6540736 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -35,10 +35,10 @@ public class ChessApplication : Gtk.Application
private ChessView view;
private Button pause_resume_button;
private Box navigation_box;
- private Widget first_move_button;
- private Widget prev_move_button;
- private Widget next_move_button;
- private Widget last_move_button;
+ private Button first_move_button;
+ private Button prev_move_button;
+ private Button next_move_button;
+ private Button last_move_button;
private ComboBox history_combo;
private DrawingArea white_time_label;
private DrawingArea black_time_label;
@@ -162,16 +162,21 @@ Copyright © 2015–2016 Sahil Sareen""";
info_bar = (InfoBar) builder.get_object ("info_bar");
pause_resume_button = (Button) builder.get_object ("pause_button");
navigation_box = (Box) builder.get_object ("navigation_box");
- first_move_button = (Widget) builder.get_object ("first_move_button");
- prev_move_button = (Widget) builder.get_object ("prev_move_button");
- next_move_button = (Widget) builder.get_object ("next_move_button");
- last_move_button = (Widget) builder.get_object ("last_move_button");
+ first_move_button = (Button) builder.get_object ("first_move_button");
+ prev_move_button = (Button) builder.get_object ("prev_move_button");
+ next_move_button = (Button) builder.get_object ("next_move_button");
+ last_move_button = (Button) builder.get_object ("last_move_button");
history_combo = (ComboBox) builder.get_object ("history_combo");
white_time_label = (DrawingArea) builder.get_object ("white_time_label");
black_time_label = (DrawingArea) builder.get_object ("black_time_label");
view_container = (Box) builder.get_object ("view_container");
headerbar = (HeaderBar) builder.get_object ("headerbar");
- // builder.connect_signals (this);
+
+ first_move_button.clicked.connect (history_start_clicked_cb);
+ prev_move_button.clicked.connect (history_previous_clicked_cb);
+ next_move_button.clicked.connect (history_next_clicked_cb);
+ last_move_button.clicked.connect (history_latest_clicked_cb);
+ history_combo.changed.connect (history_combo_changed_cb);
white_time_label.set_draw_func (white_time_draw_cb);
black_time_label.set_draw_func (black_time_draw_cb);
@@ -1699,8 +1704,7 @@ Copyright © 2015–2016 Sahil Sareen""";
widget.set_size_request (compute_time_label_width_request (c), -1);
}
- [CCode (cname = "history_combo_changed_cb", instance_pos = -1)]
- public void history_combo_changed_cb (ComboBox combo)
+ private inline void history_combo_changed_cb (ComboBox combo)
{
TreeIter iter;
if (!combo.get_active_iter (out iter))
@@ -1712,14 +1716,12 @@ Copyright © 2015–2016 Sahil Sareen""";
scene.move_number = move_number;
}
- [CCode (cname = "history_latest_clicked_cb", instance_pos = -1)]
- public void history_latest_clicked_cb (Widget widget)
+ private inline void history_latest_clicked_cb (Widget widget)
{
scene.move_number = -1;
}
- [CCode (cname = "history_next_clicked_cb", instance_pos = -1)]
- public void history_next_clicked_cb (Widget widget)
+ private inline void history_next_clicked_cb (Widget widget)
{
if (scene.move_number == -1)
return;
@@ -1731,8 +1733,7 @@ Copyright © 2015–2016 Sahil Sareen""";
scene.move_number = move_number;
}
- [CCode (cname = "history_previous_clicked_cb", instance_pos = -1)]
- public void history_previous_clicked_cb (Widget widget)
+ private inline void history_previous_clicked_cb (Widget widget)
{
if (scene.move_number == 0)
return;
@@ -1743,8 +1744,7 @@ Copyright © 2015–2016 Sahil Sareen""";
scene.move_number = scene.move_number - 1;
}
- [CCode (cname = "history_start_clicked_cb", instance_pos = -1)]
- public void history_start_clicked_cb (Widget widget)
+ private inline void history_start_clicked_cb (Widget widget)
{
scene.move_number = 0;
}
@@ -1822,7 +1822,19 @@ Copyright © 2015–2016 Sahil Sareen""";
var theme_combo = (ComboBox) preferences_builder.get_object ("piece_style_combo");
set_combo (theme_combo, 1, settings.get_string ("piece-theme"));
- // preferences_builder.connect_signals (this);
+ preferences_dialog.response.connect (preferences_response_cb);
+ clock_type_combo.changed.connect (clock_type_changed_cb);
+ timer_increment_units_combo.changed.connect (timer_increment_units_changed_cb);
+ side_combo.changed.connect (side_combo_changed_cb);
+ ai_combo.changed.connect (opponent_combo_changed_cb);
+ difficulty_combo.changed.connect (difficulty_combo_changed_cb);
+ custom_duration_units_combo.changed.connect (duration_units_changed_cb);
+ duration_combo.changed.connect (duration_combo_changed_cb);
+ orientation_combo.changed.connect (orientation_combo_changed_cb);
+ move_combo.changed.connect (move_format_combo_changed_cb);
+ theme_combo.changed.connect (piece_style_combo_changed_cb);
+ timer_increment_adjustment.value_changed.connect (timer_increment_units_changed_cb);
+ duration_adjustment.value_changed.connect (duration_changed_cb);
/* Human vs. human */
if (ai_combo.get_active () == 0)
@@ -1862,8 +1874,7 @@ Copyright © 2015–2016 Sahil Sareen""";
return value;
}
- [CCode (cname = "side_combo_changed_cb", instance_pos = -1)]
- public void side_combo_changed_cb (ComboBox combo)
+ private inline void side_combo_changed_cb (ComboBox combo)
{
TreeIter iter;
if (!combo.get_active_iter (out iter))
@@ -1874,8 +1885,7 @@ Copyright © 2015–2016 Sahil Sareen""";
settings.set_enum ("play-as", player);
}
- [CCode (cname = "opponent_combo_changed_cb", instance_pos = -1)]
- public void opponent_combo_changed_cb (ComboBox combo)
+ private inline void opponent_combo_changed_cb (ComboBox combo)
{
TreeIter iter;
if (!combo.get_active_iter (out iter))
@@ -1888,8 +1898,7 @@ Copyright © 2015–2016 Sahil Sareen""";
difficulty_combo.sensitive = !vs_human;
}
- [CCode (cname = "difficulty_combo_changed_cb", instance_pos = -1)]
- public void difficulty_combo_changed_cb (ComboBox combo)
+ private inline void difficulty_combo_changed_cb (ComboBox combo)
{
TreeIter iter;
if (!combo.get_active_iter (out iter))
@@ -1951,7 +1960,7 @@ Copyright © 2015–2016 Sahil Sareen""";
}
timer_increment_units_combo.set_active_iter (reqd_iter);
- timer_increment_units_changed_cb (timer_increment_units_combo);
+ timer_increment_units_changed_cb ();
}
private void set_duration (int duration, bool simplify = true)
@@ -2051,8 +2060,7 @@ Copyright © 2015–2016 Sahil Sareen""";
return Source.REMOVE;
}
- [CCode (cname = "duration_changed_cb", instance_pos = -1)]
- public void duration_changed_cb (Adjustment adjustment)
+ private inline void duration_changed_cb (Adjustment adjustment)
{
var model = (Gtk.ListStore) custom_duration_units_combo.model;
TreeIter iter;
@@ -2082,14 +2090,12 @@ Copyright © 2015–2016 Sahil Sareen""";
save_duration ();
}
- [CCode (cname = "duration_units_changed_cb", instance_pos = -1)]
- public void duration_units_changed_cb (Widget widget)
+ private inline void duration_units_changed_cb (Widget widget)
{
save_duration ();
}
- [CCode (cname = "timer_increment_units_changed_cb", instance_pos = -1)]
- public void timer_increment_units_changed_cb (Widget widget)
+ private void timer_increment_units_changed_cb ()
{
var model = (Gtk.ListStore) timer_increment_units_combo.model;
TreeIter iter;
@@ -2147,8 +2153,7 @@ Copyright © 2015–2016 Sahil Sareen""";
save_duration_timeout = Timeout.add (100, save_duration_cb);
}
- [CCode (cname = "duration_combo_changed_cb", instance_pos = -1)]
- public void duration_combo_changed_cb (ComboBox combo)
+ private inline void duration_combo_changed_cb (ComboBox combo)
{
TreeIter iter;
if (!combo.get_active_iter (out iter))
@@ -2170,8 +2175,7 @@ Copyright © 2015–2016 Sahil Sareen""";
save_duration ();
}
- [CCode (cname = "clock_type_changed_cb", instance_pos = -1)]
- public void clock_type_changed_cb (ComboBox combo)
+ private void clock_type_changed_cb (ComboBox combo)
{
TreeIter iter;
if (!combo.get_active_iter (out iter))
@@ -2184,8 +2188,7 @@ Copyright © 2015–2016 Sahil Sareen""";
settings.set_string ("clock-type", clock_type.to_string ());
}
- [CCode (cname = "preferences_response_cb", instance_pos = -1)]
- public void preferences_response_cb (Widget widget, int response_id)
+ private inline void preferences_response_cb (Widget widget, int response_id)
{
preferences_dialog.hide ();
}
@@ -2197,20 +2200,17 @@ Copyright © 2015–2016 Sahil Sareen""";
return true;
}
- [CCode (cname = "piece_style_combo_changed_cb", instance_pos = -1)]
- public void piece_style_combo_changed_cb (ComboBox combo)
+ private inline void piece_style_combo_changed_cb (ComboBox combo)
{
settings.set_string ("piece-theme", get_combo (combo, 1));
}
- [CCode (cname = "move_format_combo_changed_cb", instance_pos = -1)]
- public void move_format_combo_changed_cb (ComboBox combo)
+ private inline void move_format_combo_changed_cb (ComboBox combo)
{
settings.set_string ("move-format", get_combo (combo, 1));
}
- [CCode (cname = "orientation_combo_changed_cb", instance_pos = -1)]
- public void orientation_combo_changed_cb (ComboBox combo)
+ private inline void orientation_combo_changed_cb (ComboBox combo)
{
settings.set_string ("board-side", get_combo (combo, 1));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]