[gnome-sudoku] Always set header bar as the title bar
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sudoku] Always set header bar as the title bar
- Date: Sun, 22 May 2016 23:12:06 +0000 (UTC)
commit 52b055a46a8c0fe1bfc57c17cc6677eefbb0cd5c
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Sun May 22 18:07:24 2016 -0500
Always set header bar as the title bar
Even in Unity. This looks better, and avoids a nasty visual glitch in
Ubuntu 16.04 where the buttons in the header bar extend beneath the
content area of the header bar.
I regret that I ever thought packing the header bar beneath the title
bar was a good idea.
src/gnome-sudoku.vala | 25 ++-----------------------
src/print-dialog.vala | 16 ++--------------
2 files changed, 4 insertions(+), 37 deletions(-)
---
diff --git a/src/gnome-sudoku.vala b/src/gnome-sudoku.vala
index 8872723..02fef4a 100644
--- a/src/gnome-sudoku.vala
+++ b/src/gnome-sudoku.vala
@@ -117,19 +117,6 @@ public class Sudoku : Gtk.Application
return -1;
}
- private bool is_desktop (string name)
- {
- var desktop_name_list = Environment.get_variable ("XDG_CURRENT_DESKTOP");
- if (desktop_name_list == null)
- return false;
-
- foreach (var n in desktop_name_list.split (":"))
- if (n == name)
- return true;
-
- return false;
- }
-
protected override void startup ()
{
base.startup ();
@@ -196,16 +183,8 @@ public class Sudoku : Gtk.Application
pause_action = (SimpleAction) lookup_action ("pause");
play_custom_game_action = (SimpleAction) lookup_action ("play-custom-game");
- if (!is_desktop ("Unity"))
- {
- headerbar.show_close_button = true;
- window.set_titlebar (headerbar);
- }
- else
- {
- var vbox = (Box) builder.get_object ("vbox");
- vbox.pack_start (headerbar, false, false, 0);
- }
+ headerbar.show_close_button = true;
+ window.set_titlebar (headerbar);
saver = new SudokuSaver ();
var savegame = saver.get_savedgame ();
diff --git a/src/print-dialog.vala b/src/print-dialog.vala
index 6245186..c5d77cf 100644
--- a/src/print-dialog.vala
+++ b/src/print-dialog.vala
@@ -49,7 +49,7 @@ public class PrintDialog : Gtk.Dialog
public PrintDialog (SudokuSaver saver, Gtk.Window window)
{
- Object (use_header_bar: Gtk.Settings.get_default ().gtk_dialogs_use_header ? 1 : 0);
+ Object (use_header_bar: 1);
this.saver = saver;
settings = new GLib.Settings ("org.gnome.sudoku");
@@ -65,8 +65,7 @@ public class PrintDialog : Gtk.Dialog
revealer = new Gtk.Revealer ();
revealer.add (spinner);
revealer.valign = Gtk.Align.CENTER;
- if (use_header_bar == 1)
- ((Gtk.HeaderBar) get_header_bar ()).pack_end (revealer);
+ ((Gtk.HeaderBar) get_header_bar ()).pack_end (revealer);
var saved_difficulty = (DifficultyCategory) settings.get_enum (DIFFICULTY_KEY_NAME);
if (saved_difficulty == DifficultyCategory.EASY)
@@ -83,17 +82,6 @@ public class PrintDialog : Gtk.Dialog
wrap_adjustment ("print-multiple-sudokus-to-print", n_sudokus_button.get_adjustment ());
}
- ~PrintDialog ()
- {
- /* Both the spinner and the revealer have a floating reference if
- they weren't added to the header bar. */
- if (use_header_bar != 1)
- {
- spinner.destroy ();
- revealer.destroy ();
- }
- }
-
private void wrap_adjustment (string key_name, Gtk.Adjustment action)
{
action.set_value (settings.get_int (key_name));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]