[gnome-chess] Revert "Use inner headerbar in narrow mode"



commit 4129f1950a0a828a7ac56d1bc0e9b49771c545c4
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sat Dec 5 10:07:20 2020 -0600

    Revert "Use inner headerbar in narrow mode"
    
    This reverts commit 0e8090dcd1a2979fa5de75b32076e1af6acfb224.
    
    Emmanuele, Matthias, and Exalm all do not like it.

 data/gnome-chess.ui  |  7 +------
 src/gnome-chess.vala | 45 +++++++++------------------------------------
 2 files changed, 10 insertions(+), 42 deletions(-)
---
diff --git a/data/gnome-chess.ui b/data/gnome-chess.ui
index 0527e89..0831d89 100644
--- a/data/gnome-chess.ui
+++ b/data/gnome-chess.ui
@@ -52,7 +52,7 @@
     <property name="default-width">700</property>
     <signal name="delete-event" handler="gnome_chess_app_delete_event_cb" swapped="no"/>
     <child type="titlebar">
-      <object class="GtkHeaderBar" id="main_headerbar">
+      <object class="GtkHeaderBar" id="headerbar">
         <property name="visible">True</property>
         <property name="can-focus">False</property>
         <property name="show-close-button">True</property>
@@ -137,11 +137,6 @@
             <property name="visible">False</property>
           </object>
         </child>
-        <child>
-          <object class="GtkHeaderBar" id="inner_headerbar">
-            <property name="can-focus">False</property>
-          </object>
-        </child>
         <child>
           <object class="GtkAlignment" id="view_container">
             <property name="visible">True</property>
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index 1e88812..12717b0 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -28,8 +28,6 @@ public class ChessApplication : Gtk.Application
 
     private GLib.Settings settings;
     private ApplicationWindow window;
-    private HeaderBar main_headerbar;
-    private HeaderBar inner_headerbar;
     private InfoBar info_bar;
     private Container view_container;
     private ChessScene scene;
@@ -45,6 +43,7 @@ public class ChessApplication : Gtk.Application
     private Widget white_time_label;
     private Widget black_time_label;
     private Widget timer_increment_label;
+    private HeaderBar headerbar;
 
     private Dialog? preferences_dialog = null;
     private ComboBox side_combo;
@@ -164,8 +163,6 @@ Copyright © 2015–2016 Sahil Sareen""";
         window.size_allocate.connect (size_allocate_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");
         pause_resume_button = (Button) builder.get_object ("pause_button");
         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");
         black_time_label = (Widget) builder.get_object ("black_time_label");
         view_container = (Container) builder.get_object ("view_container");
+        headerbar = (HeaderBar) builder.get_object ("headerbar");
         builder.connect_signals (this);
 
         update_pause_resume_button ();
@@ -280,23 +278,7 @@ Copyright © 2015–2016 Sahil Sareen""";
             return;
         layout_mode = new_layout_mode;
 
-        if (layout_mode == LayoutMode.NORMAL)
-        {
-            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);
-        }
+        navigation_box.set_orientation ((layout_mode == LayoutMode.NORMAL) ? Orientation.HORIZONTAL : 
Orientation.VERTICAL);
     }
 
     private void size_allocate_cb (Allocation allocation)
@@ -507,9 +489,9 @@ Copyright © 2015–2016 Sahil Sareen""";
         starting = true;
 
         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
-            main_headerbar.set_subtitle (null);
+            headerbar.set_subtitle (null);
 
         var model = (Gtk.ListStore) history_combo.model;
         model.clear ();
@@ -1290,18 +1272,8 @@ Copyright © 2015–2016 Sahil Sareen""";
             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 &&
             human_player.color == game.current_player.color &&
             game.current_state.is_in_check (game.current_player))
@@ -1491,7 +1463,8 @@ Copyright © 2015–2016 Sahil Sareen""";
              break;
         }
 
-        update_headerbar_title (title, reason);
+        headerbar.set_title (title);
+        headerbar.set_subtitle (reason);
 
         white_time_label.queue_draw ();
         black_time_label.queue_draw ();
@@ -2395,7 +2368,7 @@ Copyright © 2015–2016 Sahil Sareen""";
                 save_dialog = null;
 
                 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);
                 game_needs_saving = false;
             }


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