Skip to content

Commit

Permalink
Fix selected wallpaper accent + mode
Browse files Browse the repository at this point in the history
  • Loading branch information
lainsce committed Aug 21, 2024
1 parent fc9b6e4 commit 9d9fc0f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
27 changes: 17 additions & 10 deletions fuses/appearance/Views/AppearanceView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class AppearanceView : Gtk.Box {
private AccentColorButton purple;
private AccentColorButton red;
private AccentColorButton yellow;
private EnsorFlowBox ensor_flowbox;

public Gtk.ScrolledWindow sw;
public Gtk.Stack contrast_stack;
Expand Down Expand Up @@ -76,14 +77,14 @@ public class AppearanceView : Gtk.Box {
// XXX: UNCOMMENT WHEN KIRI LOCK SCREEN IS IMPL'D
//
// var edit_button = new He.Button ("document-edit-symbolic", "") {
// hexpand = true,
// vexpand = true,
// halign = Gtk.Align.END,
// valign = Gtk.Align.END,
// margin_end = 12,
// margin_bottom = 12,
// is_disclosure = true,
// tooltip_text = _("Customize Lock Screen…")
// hexpand = true,
// vexpand = true,
// halign = Gtk.Align.END,
// valign = Gtk.Align.END,
// margin_end = 12,
// margin_bottom = 12,
// is_disclosure = true,
// tooltip_text = _("Customize Lock Screen…")
// };

// var wallpaper_lock_button_overlay = new Gtk.Overlay ();
Expand Down Expand Up @@ -284,6 +285,9 @@ public class AppearanceView : Gtk.Box {
fusebox_appearance_settings.set_boolean ("wallpaper-accent", true);
accent_box.sensitive = false;

var sel = fusebox_appearance_settings.get_int ("wallpaper-accent-choice");
ensor_flowbox.flowbox.select_child (ensor_flowbox.flowbox.get_child_at_index (sel));

multi.set_active (false);
red.set_active (false);
yellow.set_active (false);
Expand Down Expand Up @@ -481,12 +485,15 @@ public class AppearanceView : Gtk.Box {
int[] argb_ints = {};

for (int i = 0; i < result.length; i++) {
var value = result.index(i);
var value = result.index (i);
if (value != null) {
argb_ints += value;
}

var ensor_flowbox = new EnsorFlowBox (argb_ints);
ensor_flowbox = new EnsorFlowBox (argb_ints);

var sel = fusebox_appearance_settings.get_int ("wallpaper-accent-choice");
ensor_flowbox.flowbox.select_child (ensor_flowbox.flowbox.get_child_at_index (sel));

color_sw.set_child (ensor_flowbox);
}
Expand Down
12 changes: 7 additions & 5 deletions fuses/appearance/Widgets/EnsorFlowBox.vala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
public class EnsorFlowBox : He.Bin {
private Gtk.FlowBox flowbox;
public Gtk.FlowBox flowbox;
public int current_selection;

private static GLib.Settings tau_appearance_settings;
Expand All @@ -25,16 +25,18 @@ public class EnsorFlowBox : He.Bin {
flowbox.add_css_class ("ensor-box");
flowbox.child_activated.connect (child_activated_cb);

var sel = fusebox_appearance_settings.get_int ("wallpaper-accent-choice");
flowbox.select_child (flowbox.get_child_at_index ((sel < 0 || sel > (color.length * 4)) ? 0 : sel));

for (int i = 0; i < color.length; i++) {
make_ensor_set (color[i]);
}

this.child = flowbox;
}

construct {
var sel = fusebox_appearance_settings.get_int ("wallpaper-accent-choice");
flowbox.select_child (flowbox.get_child_at_index (sel));
}

private void child_activated_cb (Gtk.FlowBoxChild child) {
var ensor_mode = ((EnsorModeButton) child.get_first_child ()).mode;
var ensor_color = ((EnsorModeButton) child.get_first_child ()).colors[0];
Expand Down Expand Up @@ -64,4 +66,4 @@ public class EnsorFlowBox : He.Bin {
flowbox.append (vibrant);
flowbox.append (salad);
}
}
}

0 comments on commit 9d9fc0f

Please sign in to comment.