[gtk+/wip/baedert/gtkimageview: 228/228] infobar: Add API to show/hide with animation
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/gtkimageview: 228/228] infobar: Add API to show/hide with animation
- Date: Tue, 5 Jul 2016 18:49:49 +0000 (UTC)
commit 09bfde4bd4130d61d957b4d5c83bcc6138bef831
Author: Timm Bäder <mail baedert org>
Date: Tue Jul 5 20:40:53 2016 +0200
infobar: Add API to show/hide with animation
demos/gtk-demo/infobar.c | 2 +-
gtk/gtkinfobar.c | 48 +++++++++++++++++++++++-----------------------
gtk/gtkinfobar.h | 6 +++++
gtk/ui/gtkinfobar.ui | 1 +
4 files changed, 32 insertions(+), 25 deletions(-)
---
diff --git a/demos/gtk-demo/infobar.c b/demos/gtk-demo/infobar.c
index bca0e31..8dc24bd 100644
--- a/demos/gtk-demo/infobar.c
+++ b/demos/gtk-demo/infobar.c
@@ -16,7 +16,7 @@ on_bar_response (GtkInfoBar *info_bar,
if (response_id == GTK_RESPONSE_CLOSE)
{
- gtk_widget_hide (GTK_WIDGET (info_bar));
+ gtk_info_bar_hide (info_bar);
return;
}
diff --git a/gtk/gtkinfobar.c b/gtk/gtkinfobar.c
index cc5a5b7..455ca06 100644
--- a/gtk/gtkinfobar.c
+++ b/gtk/gtkinfobar.c
@@ -301,16 +301,6 @@ gtk_info_bar_close (GtkInfoBar *info_bar)
}
static void
-gtk_info_bar_show (GtkWidget *widget)
-{
- GtkInfoBarPrivate *priv = GTK_INFO_BAR (widget)->priv;
-
- GTK_WIDGET_CLASS (gtk_info_bar_parent_class)->show (widget);
-
- gtk_revealer_set_reveal_child (GTK_REVEALER (priv->revealer), TRUE);
-}
-
-static void
child_revealed (GObject *object, GParamSpec *pspec, gpointer data)
{
GtkWidget *widget = data;
@@ -321,16 +311,6 @@ child_revealed (GObject *object, GParamSpec *pspec, gpointer data)
}
static void
-gtk_info_bar_hide (GtkWidget *widget)
-{
- GtkInfoBarPrivate *priv = GTK_INFO_BAR (widget)->priv;
-
- g_signal_connect_object (priv->revealer, "notify::child-revealed",
- G_CALLBACK (child_revealed), widget, 0);
- gtk_revealer_set_reveal_child (GTK_REVEALER (priv->revealer), FALSE);
-}
-
-static void
gtk_info_bar_class_init (GtkInfoBarClass *klass)
{
GtkWidgetClass *widget_class;
@@ -343,9 +323,6 @@ gtk_info_bar_class_init (GtkInfoBarClass *klass)
object_class->get_property = gtk_info_bar_get_property;
object_class->set_property = gtk_info_bar_set_property;
- widget_class->show = gtk_info_bar_show;
- widget_class->hide = gtk_info_bar_hide;
-
klass->close = gtk_info_bar_close;
/**
@@ -851,7 +828,7 @@ gtk_info_bar_set_response_sensitive (GtkInfoBar *info_bar,
* Pressing “Enter” normally activates the default widget.
*
* Note that this function currently requires @info_bar to
- * be added to a widget hierarchy.
+ * be added to a widget hierarchy.
*
* Since: 2.18
*/
@@ -1258,3 +1235,26 @@ gtk_info_bar_get_show_close_button (GtkInfoBar *info_bar)
return info_bar->priv->show_close_button;
}
+
+void
+gtk_info_bar_show (GtkInfoBar *info_bar)
+{
+ g_return_if_fail (GTK_IS_INFO_BAR (info_bar));
+
+ gtk_revealer_set_reveal_child (GTK_REVEALER (info_bar->priv->revealer), TRUE);
+}
+
+void
+gtk_info_bar_hide (GtkInfoBar *info_bar)
+{
+ GtkInfoBarPrivate *priv;
+
+ g_return_if_fail (GTK_IS_INFO_BAR (info_bar));
+
+ priv = info_bar->priv;
+
+ g_signal_connect_object (priv->revealer, "notify::child-revealed",
+ G_CALLBACK (child_revealed), info_bar, 0);
+ gtk_revealer_set_reveal_child (GTK_REVEALER (priv->revealer), FALSE);
+
+}
diff --git a/gtk/gtkinfobar.h b/gtk/gtkinfobar.h
index a10c3a9..e6d9b70 100644
--- a/gtk/gtkinfobar.h
+++ b/gtk/gtkinfobar.h
@@ -130,6 +130,12 @@ void gtk_info_bar_set_show_close_button (GtkInfoBar *info_bar,
GDK_AVAILABLE_IN_3_10
gboolean gtk_info_bar_get_show_close_button (GtkInfoBar *info_bar);
+GDK_AVAILABLE_IN_3_22
+void gtk_info_bar_show (GtkInfoBar *info_bar);
+
+GDK_AVAILABLE_IN_3_22
+void gtk_info_bar_hide (GtkInfoBar *info_bar);
+
G_END_DECLS
#endif /* __GTK_INFO_BAR_H__ */
diff --git a/gtk/ui/gtkinfobar.ui b/gtk/ui/gtkinfobar.ui
index 6db47d0..0913810 100644
--- a/gtk/ui/gtkinfobar.ui
+++ b/gtk/ui/gtkinfobar.ui
@@ -6,6 +6,7 @@
<child>
<object class="GtkRevealer" id="revealer">
<property name="visible">1</property>
+ <property name="reveal-child">1</property>
<child>
<object class="GtkBox" id="content">
<property name="visible">1</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]