Merge lp:~victored/pantheon-files/lp-1418653 into lp:~elementary-apps/pantheon-files/trunk

Proposed by Victor Martinez
Status: Merged
Approved by: Cody Garver
Approved revision: 1879
Merged at revision: 1879
Proposed branch: lp:~victored/pantheon-files/lp-1418653
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 180 lines (+5/-120)
4 files modified
libwidgets/CMakeLists.txt (+0/-1)
libwidgets/PoofWindow.vala (+0/-117)
src/CMakeLists.txt (+3/-0)
src/View/Sidebar.vala (+2/-2)
To merge this branch: bzr merge lp:~victored/pantheon-files/lp-1418653
Reviewer Review Type Date Requested Status
Cody Garver (community) Approve
Review via email: mp+264496@code.launchpad.net

Commit message

Use PoofWindow from LibPlank

Description of the change

Use PoofWindow from LibPlank

This implies adding libplank-dev as a build dependency and libplank0 as a runtime dependency

To post a comment you must log in.
Revision history for this message
Cody Garver (codygarver) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libwidgets/CMakeLists.txt'
--- libwidgets/CMakeLists.txt 2014-08-05 23:34:45 +0000
+++ libwidgets/CMakeLists.txt 2015-07-12 16:24:24 +0000
@@ -39,7 +39,6 @@
39vala_precompile(VALA_C ${PKGNAME}39vala_precompile(VALA_C ${PKGNAME}
40 Animations.vala40 Animations.vala
41 LocationBar.vala41 LocationBar.vala
42 PoofWindow.vala
43 BreadcrumbsElements.vala42 BreadcrumbsElements.vala
44PACKAGES43PACKAGES
45 gtk+-3.044 gtk+-3.0
4645
=== removed file 'libwidgets/PoofWindow.vala'
--- libwidgets/PoofWindow.vala 2015-05-03 06:44:42 +0000
+++ libwidgets/PoofWindow.vala 1970-01-01 00:00:00 +0000
@@ -1,117 +0,0 @@
1/***
2 Copyright (C) 2011-2012 Robert Dyer, Rico Tzschichholz
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16***/
17
18namespace Marlin.Animation
19{
20 /**
21 * An animated window that draws a 'poof' animation.
22 * Used when dragging items off the dock.
23 */
24 public class PoofWindow : Gtk.Window {
25 const int POOF_SIZE = 128;
26 const int POOF_FRAMES = 5;
27 const int MSEC_PER_FRAME = 60;
28 int frame_number = 0;
29
30 static PoofWindow? instance = null;
31
32 public static unowned PoofWindow get_default () {
33 if (instance == null)
34 instance = new PoofWindow ();
35
36 return instance;
37 }
38
39 Gdk.Pixbuf poof_image;
40
41 uint animation_timer = 0;
42
43 /**
44 * Creates a new poof window at the screen-relative coordinates specified.
45 */
46 public PoofWindow () {
47 GLib.Object (type: Gtk.WindowType.TOPLEVEL, type_hint: Gdk.WindowTypeHint.DOCK);
48 }
49
50 construct {
51 app_paintable = true;
52 decorated = false;
53 resizable = false;
54 double_buffered = false;
55
56 unowned Gdk.Screen screen = get_screen ();
57 set_visual (screen.get_rgba_visual () ?? screen.get_system_visual ());
58 accept_focus = false;
59 can_focus = false;
60 set_keep_above (true);
61
62 try {
63 poof_image = new Gdk.Pixbuf.from_file ("%s/poof.png".printf (Config.PIXMAP_DIR));
64 } catch {
65 poof_image = new Gdk.Pixbuf (Gdk.Colorspace.RGB, true, 8, 128, 640);
66 warning ("Unable to load poof animation image");
67 }
68
69 set_size_request (POOF_SIZE, POOF_SIZE);
70 }
71
72 ~PoofWindow () {
73 if (animation_timer > 0) {
74 GLib.Source.remove (animation_timer);
75 animation_timer = 0;
76 }
77 }
78
79 /**
80 * Show the animated poof-window at the given coordinates
81 *
82 * @param x the x position of the poof window
83 * @param y the y position of the poof window
84 */
85 public void show_at (int x, int y) {
86 if (animation_timer > 0)
87 GLib.Source.remove (animation_timer);
88
89 frame_number = 0;
90
91 show ();
92 move (x - (POOF_SIZE / 2), y - (POOF_SIZE / 2));
93
94 animation_timer = Gdk.threads_add_timeout (MSEC_PER_FRAME, () => {
95 if (frame_number++ < POOF_FRAMES) {
96 queue_draw ();
97 return true;
98 }
99
100 animation_timer = 0;
101 hide ();
102 return false;
103 });
104 }
105
106 public override bool draw (Cairo.Context cr) {
107 cr.set_operator (Cairo.Operator.SOURCE);
108 Gdk.cairo_set_source_pixbuf (cr,
109 poof_image,
110 0,
111 -POOF_SIZE * frame_number);
112 cr.paint ();
113
114 return true;
115 }
116 }
117}
1180
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2015-01-18 20:46:03 +0000
+++ src/CMakeLists.txt 2015-07-12 16:24:24 +0000
@@ -26,6 +26,7 @@
26 sqlite326 sqlite3
27 dbus-glib-127 dbus-glib-1
28 libnotify>=0.7.228 libnotify>=0.7.2
29 plank
29 zeitgeist-2.0)30 zeitgeist-2.0)
3031
31set (CFLAGS32set (CFLAGS
@@ -98,6 +99,7 @@
98 pantheon-files-widgets99 pantheon-files-widgets
99 marlin100 marlin
100 zeitgeist-2.0101 zeitgeist-2.0
102 plank
101 GENERATE_HEADER103 GENERATE_HEADER
102 marlin-vala104 marlin-vala
103 OPTIONS105 OPTIONS
@@ -163,6 +165,7 @@
163 pantheon-files-widgets165 pantheon-files-widgets
164 marlin166 marlin
165 zeitgeist-2.0167 zeitgeist-2.0
168 plank
166 GENERATE_HEADER169 GENERATE_HEADER
167 marlin-vala170 marlin-vala
168 OPTIONS171 OPTIONS
169172
=== modified file 'src/View/Sidebar.vala'
--- src/View/Sidebar.vala 2015-06-24 07:49:31 +0000
+++ src/View/Sidebar.vala 2015-07-12 16:24:24 +0000
@@ -717,12 +717,12 @@
717 private bool drag_failed_callback (Gdk.DragContext context, Gtk.DragResult result) {717 private bool drag_failed_callback (Gdk.DragContext context, Gtk.DragResult result) {
718 int x, y;718 int x, y;
719 Gdk.Device device;719 Gdk.Device device;
720 Marlin.Animation.PoofWindow poof_window;720 Plank.Widgets.PoofWindow poof_window;
721721
722 if (internal_drag_started && dragged_out_of_window) {722 if (internal_drag_started && dragged_out_of_window) {
723 device = context.get_device ();723 device = context.get_device ();
724 device.get_position (null, out x, out y);724 device.get_position (null, out x, out y);
725 poof_window = Marlin.Animation.PoofWindow.get_default ();725 poof_window = Plank.Widgets.PoofWindow.get_default ();
726 poof_window.show_at (x, y);726 poof_window.show_at (x, y);
727 remove_selected_bookmarks ();727 remove_selected_bookmarks ();
728 return true;728 return true;

Subscribers

People subscribed via source and target branches

to all changes: