[gnome-boxes] Remove all thumbnail prelighting code
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Remove all thumbnail prelighting code
- Date: Tue, 8 Jul 2014 23:50:28 +0000 (UTC)
commit a2790ca6be6fcd4cce020fab1a0ccaad05205bd9
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Thu Jul 3 00:34:22 2014 +0100
Remove all thumbnail prelighting code
Turns out that prelighting just works out of the box by setting
Gtk.CellRendererPixbuf.follow-state property to true.
This patch reverts these patches:
2531ed10bd8d326263b75671882d296d367f87c9 "machine: Fix prelight for non-running boxes".
fff165f47924eee0d1d375d3373f9fbef439c4fa "collection-view: Prelight for running machines"
d3f79d6fb5da1bb5966e8aaca6ea63e34f0c4a44 "collection-view: No prelight after mouse leaves view"
2b9d1314c0739a7a2f4737ef058bd7a5b4c0fc7b "collection-view: Implement prelight on mouse hover"
cf9e16f62ca729bc754626655c3040184aa5fa44 "machine: Make origin_pixbuf a public property"
Conflicts:
src/collection-view.vala
src/machine.vala
src/collection-view.vala | 47 +---------------------------------------------
src/machine.vala | 36 +++-------------------------------
2 files changed, 5 insertions(+), 78 deletions(-)
---
diff --git a/src/collection-view.vala b/src/collection-view.vala
index 3cca7c6..175264c 100644
--- a/src/collection-view.vala
+++ b/src/collection-view.vala
@@ -32,7 +32,6 @@ private class Boxes.CollectionView: Gd.MainView, Boxes.UI {
private Gtk.ListStore store;
private Gtk.TreeModelFilter model_filter;
- private Gtk.TreeIter? prelight_iter; // Iter of item under the cursor
construct {
category = new Category (_("New and Recent"), Category.Kind.NEW);
@@ -57,7 +56,7 @@ private class Boxes.CollectionView: Gd.MainView, Boxes.UI {
store.get (iter, ModelColumns.ITEM, out item);
Machine machine = item as Machine;
return_if_fail (machine != null);
- var pixbuf = (iter == prelight_iter)? machine.prelight_pixbuf : machine.pixbuf;
+ var pixbuf = machine.pixbuf;
if ("favorite" in machine.config.categories)
emblem_icons += create_symbolic_emblem ("emblem-favorite");
@@ -279,11 +278,6 @@ private class Boxes.CollectionView: Gd.MainView, Boxes.UI {
selection_mode_request.connect (() => {
App.app.selection_mode = true;
});
- var icon_view = get_generic_view () as Gtk.IconView;
- icon_view.add_events (Gdk.EventMask.LEAVE_NOTIFY_MASK);
- icon_view.motion_notify_event.connect (on_motion_notify);
- icon_view.leave_notify_event.connect (on_leave_notify);
-
show_all ();
}
@@ -343,43 +337,4 @@ private class Boxes.CollectionView: Gd.MainView, Boxes.UI {
});
machine.set_data<uint> ("activity_timeout", activity_timeout);
}
-
- private bool on_motion_notify (Gtk.Widget widget,
- Gdk.Event event) {
- var icon_view = widget as Gtk.IconView;
- var motion = (Gdk.EventMotion) event;
- int x, y;
-
- icon_view.convert_widget_to_bin_window_coords ((int) motion.x, (int) motion.y,
- out x, out y);
- var path = icon_view.get_path_at_pos (x, y);
- if (path != null) {
- Gtk.TreeIter filter_iter;
-
- model_filter.get_iter (out filter_iter, path);
- model_filter.convert_iter_to_child_iter (out prelight_iter, filter_iter);
- } else {
- prelight_iter = null;
- }
-
- store.foreach ((store, path, iter) => {
- update_screenshot (iter);
-
- return false;
- });
-
- return false;
- }
-
- private bool on_leave_notify (Gtk.Widget widget,
- Gdk.Event event) {
- if (prelight_iter == null)
- return false;
-
- var iter = prelight_iter;
- prelight_iter = null;
- update_screenshot (iter);
-
- return false;
- }
}
diff --git a/src/machine.vala b/src/machine.vala
index f3cd7e8..a444f42 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -34,10 +34,6 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
public Cancellable connecting_cancellable { get; protected set; }
- // The current screenshot without running status applied
- private Gdk.Pixbuf? orig_pixbuf;
- public Gdk.Pixbuf? prelight_pixbuf { get; private set; }
-
public enum MachineState {
UNKNOWN,
STOPPED,
@@ -54,6 +50,9 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
IGNORE_SAVED_STATE
}
+ // The current screenshot without running status applied
+ private Gdk.Pixbuf? orig_pixbuf;
+
private MachineState _state;
public MachineState state { get { return _state; }
protected set {
@@ -63,10 +62,8 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
set_screenshot (null, false);
else {
// Update existing screenshot based on machine status
- if (orig_pixbuf != null) {
+ if (orig_pixbuf != null)
pixbuf = draw_vm (orig_pixbuf, SCREENSHOT_WIDTH, SCREENSHOT_HEIGHT);
- prelight_pixbuf = draw_prelighted_vm (orig_pixbuf, SCREENSHOT_WIDTH, SCREENSHOT_HEIGHT);
- }
}
// If the display is active and the VM goes to a non-running
@@ -371,7 +368,6 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
orig_pixbuf = small_screenshot;
pixbuf = draw_vm (small_screenshot, SCREENSHOT_WIDTH, SCREENSHOT_HEIGHT);
- prelight_pixbuf = draw_prelighted_vm (small_screenshot, SCREENSHOT_WIDTH, SCREENSHOT_HEIGHT);
if (App.app.current_item == this)
App.window.sidebar.screenshot.set_from_pixbuf (pixbuf);
if (save)
@@ -380,7 +376,6 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
} else {
orig_pixbuf = null;
pixbuf = draw_stopped_vm ();
- prelight_pixbuf = draw_prelighted_vm (pixbuf, pixbuf.width, pixbuf.height);
}
}
@@ -440,29 +435,6 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
return Gdk.pixbuf_get_from_surface (surface, 0, 0, width, height);
}
- private Gdk.Pixbuf draw_prelighted_vm (Gdk.Pixbuf pixbuf, int width, int height) {
- var surface = new Cairo.ImageSurface (Cairo.Format.ARGB32, width, height);
- var context = new Cairo.Context (surface);
-
- var pw = pixbuf.get_width ();
- var ph = pixbuf.get_height ();
- var x = (width - pw) / 2;
- var y = (height - ph) / 2;
-
- context.rectangle (x, y, pw, ph);
- context.clip ();
-
- Gdk.cairo_set_source_pixbuf (context, pixbuf, x, y);
- context.set_operator (Cairo.Operator.SOURCE);
- context.paint ();
-
- context.set_source_rgba (0.2, 0.2, 0.2, 0.2);
- context.set_operator (Cairo.Operator.SCREEN);
- context.paint ();
-
- return Gdk.pixbuf_get_from_surface (surface, 0, 0, width, height);
- }
-
private static Gdk.Pixbuf draw_stopped_vm (int width = SCREENSHOT_WIDTH,
int height = SCREENSHOT_HEIGHT) {
var surface = new Cairo.ImageSurface (Cairo.Format.RGB24, width, height);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]