Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/plug.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

.wallpaper flowboxchild {
border-radius: 0.75em;
margin: 1em;
margin: 0.5em;
}

.wallpaper flowboxchild picture {
Expand Down
1 change: 0 additions & 1 deletion src/Views/Wallpaper.vala
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public class PantheonShell.Wallpaper : Switchboard.SettingsPage {
activate_on_single_click = true,
homogeneous = true,
selection_mode = SINGLE,
min_children_per_line = 3,
max_children_per_line = 5
};
wallpaper_view.bind_model (wallpaper_model, create_widget_func);
Expand Down
23 changes: 17 additions & 6 deletions src/Widgets/WallpaperContainer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public class PantheonShell.WallpaperContainer : Granite.Bin {
protected const int THUMB_HEIGHT = 144;
protected Gtk.Picture image;

private Gtk.Box card_box;
private static float monitor_ratio;

private Gtk.Revealer check_revealer;

public string? thumb_path { get; construct set; }
Expand Down Expand Up @@ -53,10 +54,18 @@ public class PantheonShell.WallpaperContainer : Granite.Bin {
Object (uri: uri, thumb_path: thumb_path, thumb_valid: thumb_valid);
}

static construct {
var monitor = Gdk.Display.get_default ().get_monitor_at_surface (
(((Gtk.Application) Application.get_default ()).active_window).get_surface ()
);

monitor_ratio = (float) monitor.geometry.width / monitor.geometry.height;
}

construct {
image = new Gtk.Picture () {
content_fit = COVER,
height_request = THUMB_HEIGHT
can_shrink = false,
content_fit = COVER
};
image.add_css_class (Granite.CssClass.CARD);

Expand All @@ -78,10 +87,12 @@ public class PantheonShell.WallpaperContainer : Granite.Bin {
};
overlay.add_overlay (check_revealer);

halign = CENTER;
valign = CENTER;
var frame = new Gtk.AspectFrame (0.5f, 0.5f, monitor_ratio, false) {
child = overlay
};

child = overlay;
child = frame;
height_request = THUMB_HEIGHT;

if (uri != null) {
var remove_wallpaper_action = new SimpleAction ("trash", null);
Expand Down