[iagno/arnaudb/wip/gtk4: 35/54] Restore NewGameScreen look.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [iagno/arnaudb/wip/gtk4: 35/54] Restore NewGameScreen look.
- Date: Thu, 30 Apr 2020 13:20:22 +0000 (UTC)
commit cfef163b72b3a1340acb084d62fb15027289d6b8
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Wed Feb 19 04:59:16 2020 +0100
Restore NewGameScreen look.
data/new-game-screen.css | 14 +++++++-------
src/iagno.vala | 14 +++++++-------
src/new-game-screen.vala | 30 ++++++++++++++++++++++++++++--
3 files changed, 42 insertions(+), 16 deletions(-)
---
diff --git a/data/new-game-screen.css b/data/new-game-screen.css
index 73f84e4..4c17eb7 100644
--- a/data/new-game-screen.css
+++ b/data/new-game-screen.css
@@ -19,7 +19,7 @@
.extra-flat-window.flat-window .new-game-screen { padding:0.4rem; }
button.radio-like-toggle,
-button.menubutton-like-combo {
+menubutton.menubutton-like-combo > button.toggle {
border-radius:15px;
/* -gtk-outline-radius:13px;*/
}
@@ -101,10 +101,10 @@ window:not(.hc-theme) button.radio-like-toggle
/* copying start-game button */
-.extra-flat-window button.menubutton-like-combo {
+.extra-flat-window menubutton.menubutton-like-combo > button.toggle {
min-height:2rem;
}
- button.menubutton-like-combo {
+ menubutton.menubutton-like-combo > button.toggle {
min-height:3rem;
min-width:11rem;
@@ -113,13 +113,13 @@ window:not(.hc-theme) button.radio-like-toggle
/* styling */
-button.menubutton-like-combo:checked,
-button.menubutton-like-combo:hover {
+menubutton.menubutton-like-combo > button.toggle:checked,
+menubutton.menubutton-like-combo > button.toggle:hover {
color:#2e3436; /* gtk-contained.css’ theme_fg_color */
/* background:radial-gradient (circle at center, rgba (255, 255, 255, 1) 0, rgba (255, 255, 255, 0) 0.5);*/
}
-button.menubutton-like-combo:backdrop:checked,
-button.menubutton-like-combo:backdrop:hover {
+menubutton.menubutton-like-combo > button.toggle:backdrop:checked,
+menubutton.menubutton-like-combo > button.toggle:backdrop:hover {
color:@theme_unfocused_fg_color;
/* background:radial-gradient (circle at center, rgba (255, 255, 255, 0.3) 0, rgba (255, 255, 255, 0)
0.5);*/
}
diff --git a/src/iagno.vala b/src/iagno.vala
index fc1adef..46bea43 100644
--- a/src/iagno.vala
+++ b/src/iagno.vala
@@ -615,15 +615,15 @@ private class Iagno : Gtk.Application, BaseApplication
case "two":
new_game_screen.update_menubutton_label (NewGameScreen.MenuButton.ONE,
/* Translators: when configuring a new game, button label if a two-players game is chosen */
- "%s ▾".printf (_("Two players")));
return;
+ _("Two players")); return;
case "dark":
new_game_screen.update_menubutton_label (NewGameScreen.MenuButton.ONE,
/* Translators: when configuring a new game, button label if the player choose to start */
- "%s ▾".printf (_("Color: Dark")));
return;
+ _("Color: Dark")); return;
case "light":
new_game_screen.update_menubutton_label (NewGameScreen.MenuButton.ONE,
/* Translators: when configuring a new game, button label if the player choose let computer
start */
- "%s ▾".printf (_("Color: Light")));
return;
+ _("Color: Light")); return;
default: assert_not_reached ();
}
}
@@ -680,19 +680,19 @@ private class Iagno : Gtk.Application, BaseApplication
case 0:
new_game_screen.update_menubutton_label (NewGameScreen.MenuButton.TWO,
/* Translators: when configuring a new game, second menubutton label, when configuring a
two-player game */
- "%s ▾".printf (_("More options")));
return;
+ _("More options")); return;
case 1:
new_game_screen.update_menubutton_label (NewGameScreen.MenuButton.TWO,
/* Translators: when configuring a new game, button label for the AI level, if easy */
- "%s ▾".printf (_("Difficulty: Easy")));
return;
+ _("Difficulty: Easy")); return;
case 2:
new_game_screen.update_menubutton_label (NewGameScreen.MenuButton.TWO,
/* Translators: when configuring a new game, button label for the AI level, if medium */
- "%s ▾".printf (_("Difficulty: Medium")));
return;
+ _("Difficulty: Medium")); return;
case 3:
new_game_screen.update_menubutton_label (NewGameScreen.MenuButton.TWO,
/* Translators: when configuring a new game, button label for the AI level, if hard */
- "%s ▾".printf (_("Difficulty: Hard")));
return;
+ _("Difficulty: Hard")); return;
default: assert_not_reached ();
}
}
diff --git a/src/new-game-screen.vala b/src/new-game-screen.vala
index 0ec5bce..cd921c8 100644
--- a/src/new-game-screen.vala
+++ b/src/new-game-screen.vala
@@ -36,6 +36,13 @@ private class NewGameScreen : Box, AdaptativeWidget
Gdk.Display? gdk_display = Gdk.Display.get_default ();
if (gdk_display != null) // else..?
StyleContext.add_provider_for_display ((!) gdk_display, css_provider,
STYLE_PROVIDER_PRIORITY_APPLICATION);
+
+ Widget? widget = menubutton_one.get_first_child ();
+ if (widget != null && (!) widget is ToggleButton)
+ ((!) widget).get_style_context ().add_class ("flat");
+ widget = menubutton_two.get_first_child ();
+ if (widget != null && (!) widget is ToggleButton)
+ ((!) widget).get_style_context ().add_class ("flat");
}
internal NewGameScreen (string modelbutton_one_label,
@@ -61,10 +68,29 @@ private class NewGameScreen : Box, AdaptativeWidget
internal inline void update_menubutton_label (MenuButton button, string label)
{
+ Widget? widget;
switch (button)
{
- case MenuButton.ONE: menubutton_one.set_label (label); return;
- case MenuButton.TWO: menubutton_two.set_label (label); return;
+ case MenuButton.ONE:
+ menubutton_one.set_label (label);
+ widget = menubutton_one.get_first_child ();
+ if (widget != null && (!) widget is ToggleButton)
+ {
+ widget = ((!) widget).get_first_child ();
+ if (widget != null && (!) widget is Box)
+ ((!) widget).halign = Align.CENTER;
+ }
+ return;
+
+ case MenuButton.TWO: menubutton_two.set_label (label);
+ widget = menubutton_two.get_first_child ();
+ if (widget != null && (!) widget is ToggleButton)
+ {
+ widget = ((!) widget).get_first_child ();
+ if (widget != null && (!) widget is Box)
+ ((!) widget).halign = Align.CENTER;
+ }
+ return;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]