[epiphany/wip/exalm/gtk4-cleanups-2: 14/27] action-bar: Don't subclass GtkRevealer
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/exalm/gtk4-cleanups-2: 14/27] action-bar: Don't subclass GtkRevealer
- Date: Tue, 30 Nov 2021 15:11:09 +0000 (UTC)
commit 5e5d8a25887f45d7e6351f7f1a3662ee3039fc5a
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Tue Nov 30 04:38:14 2021 +0500
action-bar: Don't subclass GtkRevealer
This is a sad one - the only reason revealer exists is to mask the fact
GtkActionBar hide animation is broken. It's fixed in gtk4 and that revealer
will go away, but just need a stepping stone for now.
src/ephy-action-bar.c | 12 +++++---
src/ephy-action-bar.h | 2 +-
src/ephy-window.c | 1 -
src/resources/gtk/action-bar.ui | 65 ++++++++++++++++++++++-------------------
4 files changed, 44 insertions(+), 36 deletions(-)
---
diff --git a/src/ephy-action-bar.c b/src/ephy-action-bar.c
index 123d6001b..0245b6dc5 100644
--- a/src/ephy-action-bar.c
+++ b/src/ephy-action-bar.c
@@ -37,9 +37,10 @@ enum {
static GParamSpec *object_properties[N_PROPERTIES] = { NULL, };
struct _EphyActionBar {
- GtkRevealer parent_instance;
+ GtkBin parent_instance;
EphyWindow *window;
+ GtkRevealer *revealer;
EphyActionBarStart *action_bar_start;
EphyActionBarEnd *action_bar_end;
EphyPagesButton *pages_button;
@@ -48,7 +49,7 @@ struct _EphyActionBar {
gboolean can_reveal;
};
-G_DEFINE_TYPE (EphyActionBar, ephy_action_bar, GTK_TYPE_REVEALER)
+G_DEFINE_TYPE (EphyActionBar, ephy_action_bar, GTK_TYPE_BIN)
static void
sync_chromes_visibility (EphyActionBar *action_bar)
@@ -72,7 +73,7 @@ update_revealer (EphyActionBar *action_bar)
if (reveal)
gtk_widget_show (GTK_WIDGET (action_bar));
- gtk_revealer_set_reveal_child (GTK_REVEALER (action_bar), reveal);
+ gtk_revealer_set_reveal_child (action_bar->revealer, reveal);
}
static void
@@ -167,6 +168,9 @@ ephy_action_bar_class_init (EphyActionBarClass *klass)
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/epiphany/gtk/action-bar.ui");
+ gtk_widget_class_bind_template_child (widget_class,
+ EphyActionBar,
+ revealer);
gtk_widget_class_bind_template_child (widget_class,
EphyActionBar,
action_bar_start);
@@ -197,7 +201,7 @@ ephy_action_bar_init (EphyActionBar *action_bar)
ephy_action_bar_start_set_adaptive_mode (action_bar->action_bar_start,
EPHY_ADAPTIVE_MODE_NARROW);
- g_object_bind_property (action_bar, "child-revealed",
+ g_object_bind_property (action_bar->revealer, "child-revealed",
action_bar, "visible",
G_BINDING_DEFAULT);
diff --git a/src/ephy-action-bar.h b/src/ephy-action-bar.h
index 390e92007..bf0309b4a 100644
--- a/src/ephy-action-bar.h
+++ b/src/ephy-action-bar.h
@@ -32,7 +32,7 @@ G_BEGIN_DECLS
#define EPHY_TYPE_ACTION_BAR (ephy_action_bar_get_type ())
-G_DECLARE_FINAL_TYPE (EphyActionBar, ephy_action_bar, EPHY, ACTION_BAR, GtkRevealer);
+G_DECLARE_FINAL_TYPE (EphyActionBar, ephy_action_bar, EPHY, ACTION_BAR, GtkBin);
EphyActionBar *ephy_action_bar_new (EphyWindow *window);
EphyActionBarStart *ephy_action_bar_get_action_bar_start (EphyActionBar *action_bar);
diff --git a/src/ephy-window.c b/src/ephy-window.c
index c467618b4..d87a88836 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -3456,7 +3456,6 @@ setup_action_bar (EphyWindow *window)
GtkWidget *action_bar;
action_bar = GTK_WIDGET (ephy_action_bar_new (window));
- gtk_revealer_set_transition_type (GTK_REVEALER (action_bar), GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP);
gtk_widget_show (action_bar);
g_object_bind_property (window->fullscreen_box, "revealed",
diff --git a/src/resources/gtk/action-bar.ui b/src/resources/gtk/action-bar.ui
index 34c534865..8afff45a2 100644
--- a/src/resources/gtk/action-bar.ui
+++ b/src/resources/gtk/action-bar.ui
@@ -1,40 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <template class="EphyActionBar" parent="GtkRevealer">
- <property name="transition-type">slide-up</property>
+ <template class="EphyActionBar" parent="GtkBin">
<child>
- <object class="GtkActionBar" id="action_bar">
+ <object class="GtkRevealer" id="revealer">
<property name="visible">True</property>
+ <property name="transition-type">slide-up</property>
<child>
- <object class="EphyActionBarStart" id="action_bar_start">
+ <object class="GtkActionBar" id="action_bar">
<property name="visible">True</property>
+ <child>
+ <object class="EphyActionBarStart" id="action_bar_start">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="pack-type">start</property>
+ </packing>
+ </child>
+ <child>
+ <object class="EphyPagesButton" id="pages_button">
+ <property name="visible">True</property>
+ <property name="valign">center</property>
+ <!-- Translators: tooltip for the page switcher button -->
+ <property name="tooltip_text" translatable="yes">View open pages</property>
+ <property name="action_name">win.tabs-view</property>
+ <style>
+ <class name="image-button"/>
+ </style>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
+ <child>
+ <object class="EphyActionBarEnd" id="action_bar_end">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
</object>
- <packing>
- <property name="pack-type">start</property>
- </packing>
- </child>
- <child>
- <object class="EphyPagesButton" id="pages_button">
- <property name="visible">True</property>
- <property name="valign">center</property>
- <!-- Translators: tooltip for the page switcher button -->
- <property name="tooltip_text" translatable="yes">View open pages</property>
- <property name="action_name">win.tabs-view</property>
- <style>
- <class name="image-button"/>
- </style>
- </object>
- <packing>
- <property name="pack-type">end</property>
- </packing>
- </child>
- <child>
- <object class="EphyActionBarEnd" id="action_bar_end">
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="pack-type">end</property>
- </packing>
</child>
</object>
</child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]