[gnome-boxes] display-toolbar: Add file transfers button
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] display-toolbar: Add file transfers button
- Date: Mon, 5 Feb 2018 14:56:38 +0000 (UTC)
commit 4eb94c0ecb876cb4d7513f32757f4bd711a4ba80
Author: Visarion Alexandru <viorel visarion gmail com>
Date: Sun Dec 17 19:54:08 2017 +0100
display-toolbar: Add file transfers button
Add a button which lets the users view/manage ongoing
file transfers between the host and the guest machine
corresponding to the current display.
https://bugzilla.gnome.org/show_bug.cgi?id=762321
data/ui/display-toolbar.ui | 20 ++++++++++++++++++++
src/display-toolbar.vala | 47 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 67 insertions(+)
---
diff --git a/data/ui/display-toolbar.ui b/data/ui/display-toolbar.ui
index 65a2721b..8f50947c 100644
--- a/data/ui/display-toolbar.ui
+++ b/data/ui/display-toolbar.ui
@@ -127,6 +127,26 @@
<property name="pack-type">end</property>
</packing>
</child>
+ <child>
+ <object class="GtkButton" id="transfers_button">
+ <property name="visible">False</property>
+ <property name="valign">center</property>
+ <property name="use-underline">True</property>
+ <style>
+ <class name="image-button"/>
+ </style>
+
+ <child>
+ <object class="GtkDrawingArea" id="transfers_drawing_area">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
+
</object>
<packing>
diff --git a/src/display-toolbar.vala b/src/display-toolbar.vala
index 9f02126d..34597814 100644
--- a/src/display-toolbar.vala
+++ b/src/display-toolbar.vala
@@ -9,6 +9,11 @@
[GtkChild]
private Gtk.Image fullscreen_image;
[GtkChild]
+ private Gtk.DrawingArea transfers_drawing_area;
+ [GtkChild]
+ public Gtk.Button transfers_button;
+ [GtkChild]
+
private Gtk.Button back;
[GtkChild]
private Gtk.Button fullscreen;
@@ -19,6 +24,21 @@
private AppWindow window;
+ private double _progress = 0;
+ public double progress {
+ get {
+ return _progress;
+ }
+ set {
+ if (!transfers_button.get_visible ())
+ transfers_button.set_visible (true);
+
+ _progress = value;
+
+ transfers_drawing_area.queue_draw ();
+ }
+ }
+
public DisplayToolbar (bool overlay, bool handle_drag) {
Object (overlay: overlay,
handle_drag: handle_drag);
@@ -68,6 +88,33 @@ public void setup_ui (AppWindow window) {
(menu_button.popover as ActionsPopover).update_for_item (window.current_item);
});
keys_menu_button.popover = new KeysInputPopover (window);
+ transfers_drawing_area.draw.connect (on_draw);
+ }
+
+ private bool on_draw (Widget da, Cairo.Context ctx) {
+
+ var width = transfers_drawing_area.get_allocated_width ();
+ var height = transfers_drawing_area.get_allocated_height ();
+
+ ctx.set_line_join (Cairo.LineJoin.ROUND);
+
+ var style_context = transfers_button.get_style_context ();
+ var foreground = style_context.get_color (transfers_button.get_state_flags ());
+ var background = foreground;
+
+ background.alpha *= 0.3;
+ ctx.set_source_rgba (background.red, background.green, background.blue, background.alpha);
+ ctx.arc (width / 2, height / 2, height / 3, -Math.PI / 2, 3*Math.PI/2);
+ ctx.fill ();
+
+ ctx.move_to (width / 2, height / 2);
+ ctx.set_source_rgba (foreground.red, foreground.green, foreground.blue, foreground.alpha);
+
+ double radians = -Math.PI/2 + 2*Math.PI * _progress;
+ ctx.arc (width / 2, height / 2, height / 3, -Math.PI / 2, radians);
+ ctx.fill ();
+
+ return true;
}
private bool button_down;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]