[gnome-builder] gui: use revealer for notifications button



commit 85a9d8a402cc81a654e585dda61fe54c07451af6
Author: Christian Hergert <chergert redhat com>
Date:   Sat Jun 29 13:01:37 2019 -0700

    gui: use revealer for notifications button

 src/libide/editor/ide-editor-workspace.ui | 10 ++++++++--
 src/libide/gui/ide-notifications-button.c | 15 +++++++++++++++
 src/libide/gui/ide-primary-workspace.ui   | 11 +++++++++--
 3 files changed, 32 insertions(+), 4 deletions(-)
---
diff --git a/src/libide/editor/ide-editor-workspace.ui b/src/libide/editor/ide-editor-workspace.ui
index 555d7f173..2c339fbe4 100644
--- a/src/libide/editor/ide-editor-workspace.ui
+++ b/src/libide/editor/ide-editor-workspace.ui
@@ -39,9 +39,15 @@
               </packing>
             </child>
             <child>
-              <object class="IdeNotificationsButton" id="notifications_button">
-                <property name="show-theatric">false</property>
+              <object class="GtkRevealer">
+                <property name="reveal-child">false</property>
                 <property name="visible">true</property>
+                <child>
+                  <object class="IdeNotificationsButton" id="notifications_button">
+                    <property name="show-theatric">false</property>
+                    <property name="visible">true</property>
+                  </object>
+                </child>
               </object>
               <packing>
                 <property name="pack-type">end</property>
diff --git a/src/libide/gui/ide-notifications-button.c b/src/libide/gui/ide-notifications-button.c
index c2b13b30b..4dd2c9efa 100644
--- a/src/libide/gui/ide-notifications-button.c
+++ b/src/libide/gui/ide-notifications-button.c
@@ -115,9 +115,24 @@ ide_notifications_button_notify_has_progress_cb (IdeNotificationsButton *self,
                                                  GParamSpec             *pspec,
                                                  IdeNotifications       *notifications)
 {
+  GtkWidget *parent;
+
   g_assert (IDE_IS_NOTIFICATIONS_BUTTON (self));
   g_assert (IDE_IS_NOTIFICATIONS (notifications));
 
+  parent = gtk_widget_get_parent (GTK_WIDGET (self));
+
+  /* If we are in a revealer, just toggle the revealer
+   * instead of falling back to using fading widgetry.
+   */
+  if (GTK_IS_REVEALER (parent))
+    {
+      gtk_revealer_set_reveal_child (GTK_REVEALER (parent),
+                                     ide_notifications_get_has_progress (notifications));
+      return;
+    }
+
+  /* Fallback to using widget opacity to hide/show from/to view. */
   if (ide_notifications_get_has_progress (notifications))
     {
       if (!gtk_widget_get_visible (GTK_WIDGET (self)))
diff --git a/src/libide/gui/ide-primary-workspace.ui b/src/libide/gui/ide-primary-workspace.ui
index 8d89b44a2..37a88cdea 100644
--- a/src/libide/gui/ide-primary-workspace.ui
+++ b/src/libide/gui/ide-primary-workspace.ui
@@ -52,9 +52,16 @@
           </object>
         </child>
         <child type="right">
-          <object class="IdeNotificationsButton" id="notifications_button">
-            <property name="show-theatric">false</property>
+          <object class="GtkRevealer">
+            <property name="reveal-child">false</property>
+            <property name="transition-type">slide-left</property>
             <property name="visible">true</property>
+            <child>
+              <object class="IdeNotificationsButton" id="notifications_button">
+                <property name="show-theatric">false</property>
+                <property name="visible">true</property>
+              </object>
+            </child>
           </object>
         </child>
       </object>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]