Skip to content

Page types

Tuner.Page is a building block of all Tuner interface.

There are four types of Page: top level, regular subpage, internal subpage and stack page.

Top level pages

The interface consists of top level pages which is represents panel rows in sidebar.

blp
using Gtk 4.0;
using Tuner 1;

Tuner.Page {
    title: _("Row 1");
}

Tuner.Page {
    title: _("Row 2");
}

Tuner.Page {
    title: _("Row 3");
}
Result

Several top-level pages in the Tuner

Regular subpage

Regular subpages are child pages of top-level pages or other subpages.

They have the type subpage.

blp
using Gtk 4.0;
using Tuner 1;

Tuner.Page {
    title: _("Level 1");

    [subpage]
    Tuner.Page {
        title: _("Level 2");

        [subpage]
        Tuner.Page {
            title: _("Level 2");
        }
    }
}
Result

Level 1

Level 2

Level 3

Internal subpage

Internal subpages can be added to any top level Page or to a subpage.

They are represents Adw.NavigationPage in Panel plugin. You can navigate to internal Page using Tuner.Route or with navigation.push action.

blp
using Gtk 4.0;
using Tuner 1;

Tuner.Page {
    title: _("Internal example");

    Tuner.Group {

        Tuner.Route {
            title: _("Go to internal page");
            tag: "internal-tag";
        }
    }

    // Internal pages don't have a type!
    Tuner.Page {
        title: _("Internal page");
        tag: "internal-tag"; // Tag is required to access internal page
    }
}
Result

Page

Internal page

Stack pages

Stack pages acts almost same as internal subpages. Page that contains stack pages can't contain Groups (they will be ignored). Also the stack property will be assigned when the interface is created, so bind must be used.

blp
using Gtk 4.0;
using Tuner 1;
using Adw 1;

Tuner.Page stack_page_id {
    title: _("Stack");

    [title]
    Adw.ViewSwitcher {
        stack: bind stack_page_id.stack;
        policy: wide;
    }

    [stack]
    Tuner.Page {
        title: _("Stack page 1");
        icon-name: "gnome-power-manager-symbolic";

        Tuner.Group {

            Tuner.Switch {
                title: _("Switch from page 1");
                binding: Tuner.Setting {};
            }
        }
    }

    [stack]
    Tuner.Page {
        title: _("Stack page 2");
        icon-name: "help-info-symbolic";

        Tuner.Group {

            Tuner.Switch {
                title: _("Switch from page 2");
                binding: Tuner.Setting {};
            }
        }
    }
}
Result

First stack page

Second stack page

Released under the GPL-3.0+ License. The content is available under CC BY-SA 4.0, unless stated otherwise.