[gnome-boxes] machine: Correct thumbnail for under construction box
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] machine: Correct thumbnail for under construction box
- Date: Tue, 4 Mar 2014 13:25:00 +0000 (UTC)
commit 07c669b178767e2589ed369930940e2a59b40cc5
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Tue Mar 4 00:36:20 2014 +0000
machine: Correct thumbnail for under construction box
In commit 2526a28, we lost the code to use 'media-optical' icon as
thumbnail for an under construction box. This patch brings back the
(unintentionally) removed code.
src/machine.vala | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/src/machine.vala b/src/machine.vala
index 415b563..a444f42 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -513,8 +513,24 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
break;
case UIState.PROPERTIES:
- if (pixbuf != null)
- App.window.sidebar.screenshot.set_from_pixbuf (pixbuf);
+ Gdk.Pixbuf pixbuf = null;
+ if (previous_ui_state == UIState.WIZARD) {
+ var theme = Gtk.IconTheme.get_for_screen (App.window.get_screen ());
+ pixbuf = new Gdk.Pixbuf (Gdk.Colorspace.RGB, true, 8,
+ Machine.SCREENSHOT_WIDTH, Machine.SCREENSHOT_HEIGHT);
+ pixbuf.fill (0x00000000); // Transparent
+ try {
+ var icon = theme.load_icon ("media-optical", Machine.SCREENSHOT_HEIGHT, 0);
+ // Center icon in pixbuf
+ icon.copy_area (0, 0, Machine.SCREENSHOT_HEIGHT, Machine.SCREENSHOT_HEIGHT, pixbuf,
+ (Machine.SCREENSHOT_WIDTH - Machine.SCREENSHOT_HEIGHT) / 2, 0);
+ } catch (GLib.Error err) {
+ warning (err.message);
+ }
+ } else {
+ pixbuf = this.pixbuf;
+ }
+ App.window.sidebar.screenshot.set_from_pixbuf (pixbuf);
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]