[gnome-taquin/arnaudb/wip/gtk4: 97/108] GtkRevealer is not subclassable anymore.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-taquin/arnaudb/wip/gtk4: 97/108] GtkRevealer is not subclassable anymore.
- Date: Tue, 29 Sep 2020 14:16:04 +0000 (UTC)
commit b0c7b4608017e224af9559f1c240d54c7d7e9684
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Sat Apr 18 16:49:20 2020 +0200
GtkRevealer is not subclassable anymore.
data/ui/game-actionbar-placeholder.ui | 8 +++--
data/ui/game-actionbar.ui | 16 ++++++----
data/ui/notifications-revealer.ui | 60 +++++++++++++++++++----------------
src/game-actionbar.vala | 26 +++++++++++----
src/notifications-revealer.vala | 10 ++++--
5 files changed, 75 insertions(+), 45 deletions(-)
---
diff --git a/data/ui/game-actionbar-placeholder.ui b/data/ui/game-actionbar-placeholder.ui
index 9176736..40fcce8 100644
--- a/data/ui/game-actionbar-placeholder.ui
+++ b/data/ui/game-actionbar-placeholder.ui
@@ -19,9 +19,13 @@
-->
<interface>
<requires lib="gtk+" version="3.99"/>
- <template class="GameActionBarPlaceHolder" parent="GtkRevealer">
+ <template class="GameActionBarPlaceHolder" parent="GtkWidget">
<child>
- <object class="GtkDrawingArea" id="placeholder_child"/>
+ <object class="GtkRevealer" id="revealer">
+ <child>
+ <object class="GtkDrawingArea" id="placeholder_child"/>
+ </child>
+ </object>
</child>
</template>
</interface>
diff --git a/data/ui/game-actionbar.ui b/data/ui/game-actionbar.ui
index 7551f28..4876e8b 100644
--- a/data/ui/game-actionbar.ui
+++ b/data/ui/game-actionbar.ui
@@ -19,14 +19,18 @@
-->
<interface>
<requires lib="gtk+" version="3.99"/>
- <template class="GameActionBar" parent="GtkRevealer">
+ <template class="GameActionBar" parent="GtkWidget">
<child>
- <object class="GtkActionBar" id="action_bar">
+ <object class="GtkRevealer" id="revealer">
<child>
- <object class="GtkLabel" id="game_label">
- <style>
- <class name="game-name-label"/>
- </style>
+ <object class="GtkActionBar" id="action_bar">
+ <child>
+ <object class="GtkLabel" id="game_label">
+ <style>
+ <class name="game-name-label"/>
+ </style>
+ </object>
+ </child>
</object>
</child>
</object>
diff --git a/data/ui/notifications-revealer.ui b/data/ui/notifications-revealer.ui
index 510b788..49eafb9 100644
--- a/data/ui/notifications-revealer.ui
+++ b/data/ui/notifications-revealer.ui
@@ -17,37 +17,41 @@
-->
<interface>
<requires lib="gtk+" version="3.99"/>
- <template class="NotificationsRevealer" parent="GtkRevealer">
- <property name="halign">center</property>
- <property name="valign">start</property>
+ <template class="NotificationsRevealer" parent="GtkWidget">
<child>
- <object class="GtkFrame">
- <style>
- <class name="app-notification"/>
- </style>
+ <object class="GtkRevealer" id="revealer">
+ <property name="halign">center</property>
+ <property name="valign">start</property>
<child>
- <object class="GtkGrid">
- <property name="column-spacing">6</property>
+ <object class="GtkFrame">
+ <style>
+ <class name="app-notification"/>
+ </style>
<child>
- <object class="GtkLabel" id="notification_label">
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="wrap">True</property>
- </object>
- </child>
- <child>
- <object class="GtkSeparator"/>
- </child>
- <child>
- <object class="GtkButton">
- <property name="valign">center</property>
- <property name="focus-on-click">False</property>
- <property name="relief">none</property>
- <property name="action-name">notification.hide</property>
- <property name="icon-name">window-close-symbolic</property>
- <style>
- <class name="image-button"/>
- </style>
+ <object class="GtkGrid">
+ <property name="column-spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="notification_label">
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ <property name="wrap">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSeparator"/>
+ </child>
+ <child>
+ <object class="GtkButton">
+ <property name="valign">center</property>
+ <property name="focus-on-click">False</property>
+ <property name="relief">none</property>
+ <property name="action-name">notification.hide</property>
+ <property name="icon-name">window-close-symbolic</property>
+ <style>
+ <class name="image-button"/>
+ </style>
+ </object>
+ </child>
</object>
</child>
</object>
diff --git a/src/game-actionbar.vala b/src/game-actionbar.vala
index e75907e..edf8290 100644
--- a/src/game-actionbar.vala
+++ b/src/game-actionbar.vala
@@ -21,18 +21,22 @@
using Gtk;
[GtkTemplate (ui = "/org/gnome/Taquin/ui/game-actionbar.ui")]
-private class GameActionBar : Revealer, AdaptativeWidget
+private class GameActionBar : Widget, AdaptativeWidget
{
[CCode (notify = false)] public bool show_actionbar { private get; protected construct set; default =
false; }
[CCode (notify = false)] public bool window_has_name { private get; protected construct set; default =
false; }
[CCode (notify = false)] public string window_name { private get; protected construct set; default =
"" ; }
[CCode (notify = false)] public Widget? game_widget { private get; protected construct ; default =
null ; }
+ [GtkChild] private Revealer revealer;
[GtkChild] private ActionBar action_bar;
[GtkChild] private Label game_label;
construct
{
+ BinLayout layout = new BinLayout ();
+ set_layout_manager (layout);
+
if (game_widget != null)
action_bar.pack_end ((!) game_widget);
@@ -69,7 +73,7 @@ private class GameActionBar : Revealer, AdaptativeWidget
private void update_visibility ()
{
- set_reveal_child (is_extra_thin && show_actionbar);
+ revealer.set_reveal_child (is_extra_thin && show_actionbar);
}
/*\
@@ -91,23 +95,33 @@ private class GameActionBar : Revealer, AdaptativeWidget
}
[GtkTemplate (ui = "/org/gnome/Taquin/ui/game-actionbar-placeholder.ui")]
-private class GameActionBarPlaceHolder : Revealer, AdaptativeWidget
+private class GameActionBarPlaceHolder : Widget, AdaptativeWidget
{
+ [GtkChild] private Revealer revealer;
[GtkChild] private Widget placeholder_child;
private GameActionBar actionbar;
+ construct
+ {
+ BinLayout layout = new BinLayout ();
+ set_layout_manager (layout);
+ }
+
internal GameActionBarPlaceHolder (GameActionBar _actionbar)
{
actionbar = _actionbar;
actionbar.size_allocate.connect (set_height);
set_height ();
- set_reveal_child (true); // seems like setting it in the UI file does not work, while it is OK
for GameActionBar...
+ revealer.set_reveal_child (true); // seems like setting it in the UI file does not work, while it
is OK for GameActionBar...
}
private void set_height ()
{
Requisition natural_size;
- Widget? widget = actionbar.get_child ();
+ Widget? widget = actionbar.get_first_child ();
+ if (widget == null || !(widget is Revealer))
+ assert_not_reached ();
+ widget = ((Revealer) (!) widget).get_child ();
if (widget == null)
return;
((!) widget).get_preferred_size (/* minimum size */ null, out natural_size);
@@ -125,6 +139,6 @@ private class GameActionBarPlaceHolder : Revealer, AdaptativeWidget
if (_is_extra_thin == is_extra_thin)
return;
is_extra_thin = _is_extra_thin;
- set_reveal_child (is_extra_thin);
+ revealer.set_reveal_child (is_extra_thin);
}
}
diff --git a/src/notifications-revealer.vala b/src/notifications-revealer.vala
index 8831e3e..ff7e1db 100644
--- a/src/notifications-revealer.vala
+++ b/src/notifications-revealer.vala
@@ -18,12 +18,16 @@
using Gtk;
[GtkTemplate (ui = "/org/gnome/Taquin/ui/notifications-revealer.ui")]
-private class NotificationsRevealer : Revealer, AdaptativeWidget
+private class NotificationsRevealer : Widget, AdaptativeWidget
{
+ [GtkChild] private Revealer revealer;
[GtkChild] private Label notification_label;
construct
{
+ BinLayout layout = new BinLayout ();
+ set_layout_manager (layout);
+
install_action_entries ();
}
@@ -34,7 +38,7 @@ private class NotificationsRevealer : Revealer, AdaptativeWidget
internal void show_notification (string notification)
{
notification_label.set_text (notification);
- set_reveal_child (true);
+ revealer.set_reveal_child (true);
}
private bool is_thin = false;
@@ -75,6 +79,6 @@ private class NotificationsRevealer : Revealer, AdaptativeWidget
internal void hide_notification (/* SimpleAction action, Variant? variant */)
{
- set_reveal_child (false);
+ revealer.set_reveal_child (false);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]