Skip to content
Merged
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
17 changes: 5 additions & 12 deletions data/plug.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,30 +53,23 @@
background-position: calc(100% + 24px) calc(100% + 24px), 0;
}

.wallpaper-container {
background-color: transparent;
.wallpaper flowboxchild {
border-radius: 0.75em;
margin: 1em;
}

.wallpaper-container picture {
.wallpaper flowboxchild picture {
margin: 0.666em; /* Needs to be separate to position checkbutton */
}

.wallpaper-container .card:checked {
box-shadow:
0 0 0 4px alpha(@text_color, 0.2),
0 0 0 1px alpha(#000, 0.05),
0 3px 3px alpha(#000, 0.22);
}

.wallpaper-container:focus .card {
.wallpaper flowboxchild:checked .card {
box-shadow:
0 0 0 4px @accent_color,
0 0 0 1px alpha(#000, 0.05),
0 3px 3px alpha(#000, 0.22);
}

.wallpaper-container check {
.wallpaper flowboxchild check {
border-radius: 50%;
min-height: 20px;
min-width: 20px;
Expand Down
3 changes: 1 addition & 2 deletions src/Views/Appearance.vala
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,7 @@ public class PantheonShell.Appearance : Switchboard.SettingsPage {
overlay.add_overlay (dock);
overlay.add_overlay (window_back);
overlay.add_overlay (window_front);
overlay.add_css_class (Granite.STYLE_CLASS_CARD);
overlay.add_css_class (Granite.STYLE_CLASS_ROUNDED);
overlay.add_css_class (Granite.CssClass.CARD);

var monitor = Gdk.Display.get_default ().get_monitor_at_surface (
(((Gtk.Application) Application.get_default ()).active_window).get_surface ()
Expand Down
27 changes: 18 additions & 9 deletions src/Views/Wallpaper.vala
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,12 @@ public class PantheonShell.Wallpaper : Switchboard.SettingsPage {
var box = new Gtk.Box (VERTICAL, 0);
box.append (view_overlay);
box.append (actionbar);
box.add_css_class (Granite.STYLE_CLASS_FRAME);

child = box;
var frame = new Gtk.Frame (null) {
child = box
};

child = frame;
add_css_class ("wallpaper");

add_wallpaper_button.clicked.connect (show_wallpaper_chooser);
Expand All @@ -124,7 +127,13 @@ public class PantheonShell.Wallpaper : Switchboard.SettingsPage {
}

private Gtk.Widget create_widget_func (Object object) {
return (WallpaperContainer) object;
var wallpaper_container = (WallpaperContainer) object;

var flowbox_child = new Gtk.FlowBoxChild () {
child = wallpaper_container
};

return flowbox_child;
}

private void show_wallpaper_chooser () {
Expand Down Expand Up @@ -195,7 +204,7 @@ public class PantheonShell.Wallpaper : Switchboard.SettingsPage {
}

private void update_checked_wallpaper (Gtk.FlowBox box, Gtk.FlowBoxChild child) {
var children = (WallpaperContainer) wallpaper_view.get_selected_children ().data;
var children = (WallpaperContainer) child.get_child ();

if (!(children is SolidColorContainer)) {
current_wallpaper_path = children.uri;
Expand Down Expand Up @@ -230,7 +239,7 @@ public class PantheonShell.Wallpaper : Switchboard.SettingsPage {

wallpaper_model.insert_sorted (solid_color, wallpapers_sort_function);

wallpaper_view.select_child (solid_color);
wallpaper_view.select_child ((Gtk.FlowBoxChild) solid_color.get_parent ());

if (active_wallpaper != null) {
active_wallpaper.checked = false;
Expand All @@ -256,7 +265,7 @@ public class PantheonShell.Wallpaper : Switchboard.SettingsPage {
var container = (WallpaperContainer) child;
if (container.uri == current_wallpaper_path) {
container.checked = true;
wallpaper_view.select_child (container);
wallpaper_view.select_child ((Gtk.FlowBoxChild) container.get_parent ());
active_wallpaper = container;
break;
}
Expand Down Expand Up @@ -337,7 +346,7 @@ public class PantheonShell.Wallpaper : Switchboard.SettingsPage {
finished = true;

if (gnome_background_settings.get_string ("picture-options") == "none") {
wallpaper_view.select_child (solid_color);
wallpaper_view.select_child ((Gtk.FlowBoxChild) solid_color.get_parent ());
solid_color.checked = true;
active_wallpaper = solid_color;
}
Expand All @@ -357,7 +366,7 @@ public class PantheonShell.Wallpaper : Switchboard.SettingsPage {

private void create_solid_color_container (string color) {
if (solid_color != null) {
wallpaper_view.unselect_child (solid_color);
wallpaper_view.unselect_child ((Gtk.FlowBoxChild) solid_color.get_parent ());

uint pos = -1;
if (wallpaper_model.find (solid_color, out pos)) {
Expand Down Expand Up @@ -411,7 +420,7 @@ public class PantheonShell.Wallpaper : Switchboard.SettingsPage {

// Select the wallpaper if it is the current wallpaper
if (current_wallpaper_path.has_suffix (uri) && gnome_background_settings.get_string ("picture-options") != "none") {
this.wallpaper_view.select_child (wallpaper);
this.wallpaper_view.select_child ((Gtk.FlowBoxChild) wallpaper.get_parent ());
// Set the widget activated without activating it
wallpaper.checked = true;
active_wallpaper = wallpaper;
Expand Down
28 changes: 4 additions & 24 deletions src/Widgets/WallpaperContainer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

public class PantheonShell.WallpaperContainer : Gtk.FlowBoxChild {
public class PantheonShell.WallpaperContainer : Granite.Bin {
public signal void trash ();

protected const int THUMB_WIDTH = 256;
Expand All @@ -38,44 +38,27 @@ public class PantheonShell.WallpaperContainer : Gtk.FlowBoxChild {
return Gtk.StateFlags.CHECKED in get_state_flags ();
} set {
if (value) {
card_box.set_state_flags (Gtk.StateFlags.CHECKED, false);
parent.set_state_flags (Gtk.StateFlags.CHECKED, false);
check_revealer.reveal_child = true;
} else {
card_box.unset_state_flags (Gtk.StateFlags.CHECKED);
parent.unset_state_flags (Gtk.StateFlags.CHECKED);
check_revealer.reveal_child = false;
}

queue_draw ();
}
}

public bool selected {
get {
return Gtk.StateFlags.SELECTED in get_state_flags ();
} set {
if (value) {
set_state_flags (Gtk.StateFlags.SELECTED, false);
} else {
unset_state_flags (Gtk.StateFlags.SELECTED);
}

queue_draw ();
}
}

public WallpaperContainer (string uri, string? thumb_path, bool thumb_valid) {
Object (uri: uri, thumb_path: thumb_path, thumb_valid: thumb_valid);
}

construct {
add_css_class ("wallpaper-container");

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

var check = new Gtk.CheckButton () {
active = true,
Expand Down Expand Up @@ -142,9 +125,6 @@ public class PantheonShell.WallpaperContainer : Gtk.FlowBoxChild {
add_controller (secondary_click_gesture);
}

activate.connect (() => {
checked = true;
});
try {
if (uri != null) {
if (thumb_path != null && thumb_valid) {
Expand Down