[gnome-builder] transfers: use DzlProgressMenuBUtton



commit e038133739b90a3bba7d120573c50da5bfd27d6a
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jun 9 19:51:52 2017 -0700

    transfers: use DzlProgressMenuBUtton
    
    We no longer need this as it is in libdazzle.

 libide/transfers/ide-transfers-button.c  |   83 ++----------------------------
 libide/transfers/ide-transfers-button.h  |    2 +-
 libide/transfers/ide-transfers-button.ui |    7 +--
 3 files changed, 7 insertions(+), 85 deletions(-)
---
diff --git a/libide/transfers/ide-transfers-button.c b/libide/transfers/ide-transfers-button.c
index 7e75c98..4cf50bb 100644
--- a/libide/transfers/ide-transfers-button.c
+++ b/libide/transfers/ide-transfers-button.c
@@ -32,16 +32,13 @@
 
 struct _IdeTransfersButton
 {
-  GtkMenuButton             parent_instance;
+  DzlProgressMenuButton  parent_instance;
 
-  GtkPopover               *popover;
-  GtkListBox               *list_box;
-  IdeTransfersProgressIcon *icon;
+  GtkPopover            *popover;
+  GtkListBox            *list_box;
 };
 
-G_DEFINE_TYPE (IdeTransfersButton, ide_transfers_button, GTK_TYPE_MENU_BUTTON)
-
-static void ide_transfers_button_begin_theatrics (IdeTransfersButton *self);
+G_DEFINE_TYPE (IdeTransfersButton, ide_transfers_button, DZL_TYPE_PROGRESS_MENU_BUTTON)
 
 GtkWidget *
 ide_transfers_button_new (void)
@@ -49,69 +46,6 @@ ide_transfers_button_new (void)
   return g_object_new (IDE_TYPE_TRANSFERS_BUTTON, NULL);
 }
 
-static gboolean
-begin_theatrics_from_main (gpointer user_data)
-{
-  g_autoptr(IdeTransfersButton) self = user_data;
-
-  g_assert (IDE_IS_TRANSFERS_BUTTON (self));
-
-  ide_transfers_button_begin_theatrics (self);
-
-  return G_SOURCE_REMOVE;
-}
-
-static void
-ide_transfers_button_begin_theatrics (IdeTransfersButton *self)
-{
-  g_autoptr(GIcon) icon = NULL;
-  DzlBoxTheatric *theatric;
-  GtkAllocation rect;
-
-  IDE_ENTRY;
-
-  g_assert (IDE_IS_TRANSFERS_BUTTON (self));
-
-  gtk_widget_get_allocation (GTK_WIDGET (self), &rect);
-
-  if (rect.x == -1 && rect.y == -1)
-    {
-      /* Delay this until our widget has been mapped/realized/displayed */
-      g_timeout_add (50, begin_theatrics_from_main, g_object_ref (self));
-      return;
-    }
-
-  rect.x = 0;
-  rect.y = 0;
-
-  icon = g_themed_icon_new ("folder-download-symbolic");
-
-  theatric = g_object_new (DZL_TYPE_BOX_THEATRIC,
-                           "alpha", 1.0,
-                           "height", rect.height,
-                           "icon", icon,
-                           "target", self,
-                           "width", rect.width,
-                           "x", rect.x,
-                           "y", rect.y,
-                           NULL);
-
-  dzl_object_animate_full (theatric,
-                           DZL_ANIMATION_EASE_OUT_CUBIC,
-                           750,
-                           gtk_widget_get_frame_clock (GTK_WIDGET (self)),
-                           g_object_unref,
-                           theatric,
-                           "x", rect.x - 60,
-                           "width", rect.width + 120,
-                           "y", rect.y,
-                           "height", rect.height + 120,
-                           "alpha", 0.0,
-                           NULL);
-
-  IDE_EXIT;
-}
-
 static void
 ide_transfers_button_cancel_clicked (IdeTransfersButton *self,
                                      IdeTransferRow     *row)
@@ -185,14 +119,8 @@ ide_transfers_button_context_set (GtkWidget  *widget,
 
   transfer_manager = ide_context_get_transfer_manager (context);
 
-  g_signal_connect_object (transfer_manager,
-                           "all-transfers-completed",
-                           G_CALLBACK (ide_transfers_button_begin_theatrics),
-                           self,
-                           G_CONNECT_SWAPPED);
-
   g_object_bind_property (transfer_manager, "progress",
-                          self->icon, "progress",
+                          self, "progress",
                           G_BINDING_SYNC_CREATE);
 
   g_signal_connect_object (transfer_manager,
@@ -236,7 +164,6 @@ ide_transfers_button_class_init (IdeTransfersButtonClass *klass)
   gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/builder/ui/ide-transfers-button.ui");
   gtk_widget_class_bind_template_child (widget_class, IdeTransfersButton, list_box);
   gtk_widget_class_bind_template_child (widget_class, IdeTransfersButton, popover);
-  gtk_widget_class_bind_template_child (widget_class, IdeTransfersButton, icon);
 }
 
 static void
diff --git a/libide/transfers/ide-transfers-button.h b/libide/transfers/ide-transfers-button.h
index b9c2616..702ade7 100644
--- a/libide/transfers/ide-transfers-button.h
+++ b/libide/transfers/ide-transfers-button.h
@@ -25,7 +25,7 @@ G_BEGIN_DECLS
 
 #define IDE_TYPE_TRANSFERS_BUTTON (ide_transfers_button_get_type())
 
-G_DECLARE_FINAL_TYPE (IdeTransfersButton, ide_transfers_button, IDE, TRANSFERS_BUTTON, GtkMenuButton)
+G_DECLARE_FINAL_TYPE (IdeTransfersButton, ide_transfers_button, IDE, TRANSFERS_BUTTON, DzlProgressMenuButton)
 
 GtkWidget *ide_transfers_button_new (void);
 
diff --git a/libide/transfers/ide-transfers-button.ui b/libide/transfers/ide-transfers-button.ui
index 579ec9c..9f71fb0 100644
--- a/libide/transfers/ide-transfers-button.ui
+++ b/libide/transfers/ide-transfers-button.ui
@@ -45,15 +45,10 @@
       </object>
     </child>
   </object>
-  <template class="IdeTransfersButton" parent="GtkMenuButton">
+  <template class="IdeTransfersButton" parent="DzlProgressMenuButton">
     <property name="popover">popover</property>
     <style>
       <class name="image-button"/>
     </style>
-    <child>
-      <object class="IdeTransfersProgressIcon" id="icon">
-        <property name="visible">true</property>
-      </object>
-    </child>
   </template>
 </interface>


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