Revert "Use inner headerbar in narrow mode"
This reverts commit 0e8090dcd1
.
Emmanuele, Matthias, and Exalm all do not like it.
This commit is contained in:
parent
9411e198b8
commit
4129f1950a
2 changed files with 10 additions and 42 deletions
|
@ -52,7 +52,7 @@
|
||||||
<property name="default-width">700</property>
|
<property name="default-width">700</property>
|
||||||
<signal name="delete-event" handler="gnome_chess_app_delete_event_cb" swapped="no"/>
|
<signal name="delete-event" handler="gnome_chess_app_delete_event_cb" swapped="no"/>
|
||||||
<child type="titlebar">
|
<child type="titlebar">
|
||||||
<object class="GtkHeaderBar" id="main_headerbar">
|
<object class="GtkHeaderBar" id="headerbar">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="show-close-button">True</property>
|
<property name="show-close-button">True</property>
|
||||||
|
@ -137,11 +137,6 @@
|
||||||
<property name="visible">False</property>
|
<property name="visible">False</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<object class="GtkHeaderBar" id="inner_headerbar">
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkAlignment" id="view_container">
|
<object class="GtkAlignment" id="view_container">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
|
@ -28,8 +28,6 @@ public class ChessApplication : Gtk.Application
|
||||||
|
|
||||||
private GLib.Settings settings;
|
private GLib.Settings settings;
|
||||||
private ApplicationWindow window;
|
private ApplicationWindow window;
|
||||||
private HeaderBar main_headerbar;
|
|
||||||
private HeaderBar inner_headerbar;
|
|
||||||
private InfoBar info_bar;
|
private InfoBar info_bar;
|
||||||
private Container view_container;
|
private Container view_container;
|
||||||
private ChessScene scene;
|
private ChessScene scene;
|
||||||
|
@ -45,6 +43,7 @@ public class ChessApplication : Gtk.Application
|
||||||
private Widget white_time_label;
|
private Widget white_time_label;
|
||||||
private Widget black_time_label;
|
private Widget black_time_label;
|
||||||
private Widget timer_increment_label;
|
private Widget timer_increment_label;
|
||||||
|
private HeaderBar headerbar;
|
||||||
|
|
||||||
private Dialog? preferences_dialog = null;
|
private Dialog? preferences_dialog = null;
|
||||||
private ComboBox side_combo;
|
private ComboBox side_combo;
|
||||||
|
@ -164,8 +163,6 @@ Copyright © 2015–2016 Sahil Sareen""";
|
||||||
window.size_allocate.connect (size_allocate_cb);
|
window.size_allocate.connect (size_allocate_cb);
|
||||||
window.window_state_event.connect (window_state_event_cb);
|
window.window_state_event.connect (window_state_event_cb);
|
||||||
|
|
||||||
main_headerbar = (HeaderBar) builder.get_object ("main_headerbar");
|
|
||||||
inner_headerbar = (HeaderBar) builder.get_object ("inner_headerbar");
|
|
||||||
info_bar = (InfoBar) builder.get_object ("info_bar");
|
info_bar = (InfoBar) builder.get_object ("info_bar");
|
||||||
pause_resume_button = (Button) builder.get_object ("pause_button");
|
pause_resume_button = (Button) builder.get_object ("pause_button");
|
||||||
navigation_box = (Box) builder.get_object ("navigation_box");
|
navigation_box = (Box) builder.get_object ("navigation_box");
|
||||||
|
@ -178,6 +175,7 @@ Copyright © 2015–2016 Sahil Sareen""";
|
||||||
white_time_label = (Widget) builder.get_object ("white_time_label");
|
white_time_label = (Widget) builder.get_object ("white_time_label");
|
||||||
black_time_label = (Widget) builder.get_object ("black_time_label");
|
black_time_label = (Widget) builder.get_object ("black_time_label");
|
||||||
view_container = (Container) builder.get_object ("view_container");
|
view_container = (Container) builder.get_object ("view_container");
|
||||||
|
headerbar = (HeaderBar) builder.get_object ("headerbar");
|
||||||
builder.connect_signals (this);
|
builder.connect_signals (this);
|
||||||
|
|
||||||
update_pause_resume_button ();
|
update_pause_resume_button ();
|
||||||
|
@ -280,23 +278,7 @@ Copyright © 2015–2016 Sahil Sareen""";
|
||||||
return;
|
return;
|
||||||
layout_mode = new_layout_mode;
|
layout_mode = new_layout_mode;
|
||||||
|
|
||||||
if (layout_mode == LayoutMode.NORMAL)
|
navigation_box.set_orientation ((layout_mode == LayoutMode.NORMAL) ? Orientation.HORIZONTAL : Orientation.VERTICAL);
|
||||||
{
|
|
||||||
main_headerbar.title = inner_headerbar.title;
|
|
||||||
main_headerbar.subtitle = inner_headerbar.subtitle;
|
|
||||||
inner_headerbar.visible = false;
|
|
||||||
|
|
||||||
navigation_box.set_orientation (Orientation.HORIZONTAL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
inner_headerbar.title = main_headerbar.title;
|
|
||||||
inner_headerbar.subtitle = main_headerbar.subtitle;
|
|
||||||
inner_headerbar.visible = true;
|
|
||||||
main_headerbar.title = _("Chess");
|
|
||||||
|
|
||||||
navigation_box.set_orientation (Orientation.VERTICAL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void size_allocate_cb (Allocation allocation)
|
private void size_allocate_cb (Allocation allocation)
|
||||||
|
@ -507,9 +489,9 @@ Copyright © 2015–2016 Sahil Sareen""";
|
||||||
starting = true;
|
starting = true;
|
||||||
|
|
||||||
if (game_file != null && game_file.get_path () != autosave_filename)
|
if (game_file != null && game_file.get_path () != autosave_filename)
|
||||||
main_headerbar.set_subtitle (game_file.get_basename ());
|
headerbar.set_subtitle (game_file.get_basename ());
|
||||||
else
|
else
|
||||||
main_headerbar.set_subtitle (null);
|
headerbar.set_subtitle (null);
|
||||||
|
|
||||||
var model = (Gtk.ListStore) history_combo.model;
|
var model = (Gtk.ListStore) history_combo.model;
|
||||||
model.clear ();
|
model.clear ();
|
||||||
|
@ -1290,18 +1272,8 @@ Copyright © 2015–2016 Sahil Sareen""";
|
||||||
disable_window_action (UNDO_MOVE_ACTION_NAME);
|
disable_window_action (UNDO_MOVE_ACTION_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void update_headerbar_title (string? title = null, string? subtitle = null)
|
private void update_headerbar_title ()
|
||||||
{
|
{
|
||||||
var headerbar = layout_mode == LayoutMode.NORMAL ? main_headerbar : inner_headerbar;
|
|
||||||
|
|
||||||
if (title != null)
|
|
||||||
{
|
|
||||||
headerbar.set_title (title);
|
|
||||||
if (subtitle != null)
|
|
||||||
headerbar.set_subtitle (subtitle);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (human_player != null &&
|
if (human_player != null &&
|
||||||
human_player.color == game.current_player.color &&
|
human_player.color == game.current_player.color &&
|
||||||
game.current_state.is_in_check (game.current_player))
|
game.current_state.is_in_check (game.current_player))
|
||||||
|
@ -1491,7 +1463,8 @@ Copyright © 2015–2016 Sahil Sareen""";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
update_headerbar_title (title, reason);
|
headerbar.set_title (title);
|
||||||
|
headerbar.set_subtitle (reason);
|
||||||
|
|
||||||
white_time_label.queue_draw ();
|
white_time_label.queue_draw ();
|
||||||
black_time_label.queue_draw ();
|
black_time_label.queue_draw ();
|
||||||
|
@ -2395,7 +2368,7 @@ Copyright © 2015–2016 Sahil Sareen""";
|
||||||
save_dialog = null;
|
save_dialog = null;
|
||||||
|
|
||||||
pgn_game.write (game_file);
|
pgn_game.write (game_file);
|
||||||
main_headerbar.set_subtitle (game_file.get_basename ());
|
headerbar.set_subtitle (game_file.get_basename ());
|
||||||
disable_window_action (SAVE_GAME_ACTION_NAME);
|
disable_window_action (SAVE_GAME_ACTION_NAME);
|
||||||
game_needs_saving = false;
|
game_needs_saving = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue