Skip to content

Commit 6fbc0d5

Browse files
committed
cs_themes.py: Fix navigation/stack issue.
- Remember the last page shown, and return to it when the Themes page is revisited. - Do better with syncing the stack switcher's visibility with the current page. Fixes #11747.
1 parent ffa9050 commit 6fbc0d5

File tree

1 file changed

+14
-11
lines changed
  • files/usr/share/cinnamon/cinnamon-settings/modules

1 file changed

+14
-11
lines changed

files/usr/share/cinnamon/cinnamon-settings/modules/cs_themes.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,10 @@ def on_module_selected(self):
330330
print(e)
331331

332332
self.refresh_choosers()
333+
GLib.idle_add(self.set_mode, "simplified" if self.active_variant is not None else "themes", True)
334+
return
333335

334-
GLib.idle_add(self.set_simplified_mode, self.active_variant is not None, True)
336+
GLib.idle_add(self.set_mode, self.sidePage.stack.get_visible_child_name())
335337

336338
def is_variant_active(self, variant):
337339
# returns whether or not the given variant corresponds to the currently selected themes
@@ -512,27 +514,28 @@ def on_customize_button_clicked(self, button):
512514
self.set_button_chooser(self.cursor_chooser, self.settings.get_string("cursor-theme"), 'icons', 'cursors', 32)
513515
self.set_button_chooser(self.theme_chooser, self.settings.get_string("gtk-theme"), 'themes', 'gtk-3.0', 35)
514516
self.set_button_chooser(self.cinnamon_chooser, self.cinnamon_settings.get_string("name"), 'themes', 'cinnamon', 60)
515-
self.set_simplified_mode(False)
517+
self.set_mode("themes")
516518

517519
def on_simplified_button_clicked(self, button):
518520
self.reset_look_ui()
519-
self.set_simplified_mode(True)
521+
self.set_mode("simplified")
520522

521-
def set_simplified_mode(self, simplified, startup=False):
523+
def set_mode(self, mode, startup=False):
522524
# When picking a start page at startup, no transition, or else you'll see the tail end of it happening
523525
# as the page is loading. Otherwise, crossfade when switching between simple/custom. The left/right
524526
# transition is kept as the default for shifting between the 3 custom pages (themes, downloads, settings).
525-
if simplified:
526-
self.sidePage.stack.set_visible_child_full("simplified", Gtk.StackTransitionType.CROSSFADE)
527-
Gio.Application.get_default().stack_switcher.set_opacity(0.0)
527+
if startup:
528+
transition = Gtk.StackTransitionType.NONE
528529
else:
529-
if startup:
530-
self.sidePage.stack.set_visible_child_full("themes", Gtk.StackTransitionType.NONE)
531-
else:
532-
self.sidePage.stack.set_visible_child_full("themes", Gtk.StackTransitionType.CROSSFADE)
530+
transition = Gtk.StackTransitionType.CROSSFADE
533531

532+
if mode == "simplified":
533+
Gio.Application.get_default().stack_switcher.set_opacity(0.0)
534+
else:
534535
Gio.Application.get_default().stack_switcher.set_opacity(1.0)
535536

537+
self.sidePage.stack.set_visible_child_full(mode, transition)
538+
536539
def on_color_button_clicked(self, button, variant):
537540
print("Color button clicked")
538541
self.activate_variant(variant)

0 commit comments

Comments
 (0)