Skip to content

Commit

Permalink
Fix terminal warning on navigate (#260)
Browse files Browse the repository at this point in the history
* update_navigation: Test for CategoryView better

* Fix trailing spaces
  • Loading branch information
Jeremy Wootten authored and danirabbit committed Oct 10, 2023
1 parent 7319c9c commit 6c1d04f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
12 changes: 6 additions & 6 deletions lib/Plug.vala
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ public abstract class Switchboard.Plug : GLib.Object {

/**
* The category under which the plug will be stored.
*
*
* Possible {@link Category} values are PERSONAL, HARDWARE, NETWORK or SYSTEM.
*/
public Category category { get; construct; }

/**
* The unique name representing the plug.
*
*
* It is also used to recognise it with the open-plug command.
* for example "system-pantheon-info" for the official Info plug of the pantheon desktop.
*/
Expand Down Expand Up @@ -95,24 +95,24 @@ public abstract class Switchboard.Plug : GLib.Object {

/**
* Called when the plug disappear to the user.
*
*
* This is not called when the plug got destroyed or the window is closed, use ~Plug () instead.
*/
public abstract void hidden ();

/**
* This function should return the widget that contain the whole interface.
*
*
* When the user click on an action, the second parameter is send to the {@link search_callback} method
*
*
* @param search a {@link string} that represent the search.
* @return a {@link Gee.TreeMap} containing two strings like {"Keyboard → Behavior → Duration", "keyboard<sep>behavior"}.
*/
public abstract async Gee.TreeMap<string, string> search (string search);

/**
* This function is used when the user click on a search result, it should show the selected setting (right tab…).
*
*
* @param location a {@link string} that represents the setting to show.
*/
public abstract void search_callback (string location);
Expand Down
15 changes: 11 additions & 4 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -288,17 +288,24 @@ namespace Switchboard {
previous_child.hidden ();
}

if (leaflet.visible_child == category_view) {
var visible_widget = leaflet.visible_child;
if (visible_widget is Switchboard.CategoryView) {
main_window.title = _("System Settings");
title_stack.visible_child = search_box;

navigation_button.hide ();

search_box.sensitive = Switchboard.PlugsManager.get_default ().has_plugs ();
} else {
plug_widgets[leaflet.visible_child].shown ();
main_window.title = plug_widgets[leaflet.visible_child].display_name;
title_stack.visible_child = title_label;
var plug = plug_widgets[visible_widget];
if (plug != null) {
plug.shown ();
main_window.title = plug.display_name;
title_stack.visible_child = title_label;
} else {
critical ("Visible child is not CategoryView nor is associated with a Plug.");
}


if (previous_child != null && previous_child is Switchboard.Plug) {
navigation_button.label = previous_child.display_name;
Expand Down

0 comments on commit 6c1d04f

Please sign in to comment.