Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
765b8d2
adds toolbarview
SoNiC-HeRE Aug 11, 2023
f575dae
add viewswitcher
SoNiC-HeRE Aug 14, 2023
36976ed
Update
SoNiC-HeRE Aug 14, 2023
159135b
Update
SoNiC-HeRE Aug 14, 2023
efa6eb7
Updated
SoNiC-HeRE Aug 15, 2023
c482ff9
Updated json
SoNiC-HeRE Aug 15, 2023
d493c76
Update to window
SoNiC-HeRE Aug 16, 2023
11ff56d
Updated
SoNiC-HeRE Aug 16, 2023
b5cc2ce
UI and Code refactoring
SoNiC-HeRE Aug 17, 2023
e245322
Minor Fix
SoNiC-HeRE Aug 17, 2023
aeb7f7e
More tweaks
SoNiC-HeRE Aug 17, 2023
1051d31
library: Port Event Controllers demo to Vala (#486)
Diego-Ivan Aug 12, 2023
5aa829c
library: Add Power Profile Monitor demo (#489)
AkshayWarrier Aug 13, 2023
ea5e7b8
library: Add Network Monitor demo (#488)
AkshayWarrier Aug 13, 2023
67ac25d
library: add Adw.Clamp entry (#301)
SoNiC-HeRE Aug 13, 2023
f52b3c7
library: add SourceView example (#452)
Cogitri Aug 13, 2023
307c303
library: Adds Navigation View Entry (#485)
SoNiC-HeRE Aug 13, 2023
a5a8636
library: add Breakpoint entry (#484)
halfmexican Aug 13, 2023
42b7d79
Boxed Lists: show off activatable widget property. (#499)
halfmexican Aug 16, 2023
8d44df1
Merge branch 'main' into sonic/toolbarview
sonnyp Aug 18, 2023
3e8a35e
formatting issues
sonnyp Aug 18, 2023
00d4c34
Use org.gnome.Sdk//45
sonnyp Aug 18, 2023
24bba37
library: Add Memory Monitor entry (#508)
AkshayWarrier Aug 19, 2023
69ad348
library: add Picture Entry (#362)
halfmexican Aug 19, 2023
728c663
Merge branch 'main' into sonic/toolbarview
sonnyp Aug 20, 2023
a3c93ed
improvements
sonnyp Aug 20, 2023
4796e9d
add comment
sonnyp Aug 20, 2023
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
8 changes: 4 additions & 4 deletions src/Library/demos/Center Box/main.blp
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ using Adw 1;

Adw.StatusPage {
title: _("Center Box");
description: _("Displays three child widgets, while keeping the middle centered");
description: _("Displays three child widgets, while keeping the middle one centered");

child: Box {
spacing: 24;
orientation: vertical;

Adw.Clamp {
maximum-size: bind width_adjustment.value;
child: CenterBox {
maximum-size: bind width_adjustment.value;
child: CenterBox {
shrink-center-last: true;

[start]
Expand Down Expand Up @@ -39,7 +39,7 @@ Adw.StatusPage {
}

LinkButton {
label: "API Reference";
label: _("API Reference");
uri: "https://docs.gtk.org/gtk4/class.CenterBox.html";
}
};
Expand Down
216 changes: 216 additions & 0 deletions src/Library/demos/Toolbar View/main.blp
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
using Gtk 4.0;
using Adw 1;

Adw.Window {
width-request: 360;
height-request: 640;
default-width: 640;
default-height: 640;

Adw.ToolbarView toolbar_view {
extend-content-to-bottom-edge: bind extend_bottom.active;
extend-content-to-top-edge: bind extend_top.active;
top-bar-style: bind barstyle_select.selected;
bottom-bar-style: bind barstyle_select.selected;
reveal-top-bars: bind reveal_topbar.active;
reveal-bottom-bars: bind reveal_bottombar.active;

// In this demo we are using the API to set the header bars
// you can use the [top] and [bottom] child types directly instead
// [top]
// Adw.HeaderBar {
// title-widget: Adw.WindowTitle {
// title: _("Header Bar");
// };
// }


content: Adw.ViewStack stack {
Adw.ViewStackPage page_defualt {
name: "page_default";
title: _("Toolbar View");
icon-name: "toolbars-symbolic";
child: Adw.StatusPage{
Box {
halign: center;
orientation: vertical;
spacing: 18;
Label {
label: _("Toolbar View");
styles ["title-1"]
}
Label {
wrap: true;
label: _("A widget containing a page, as well as top and/or bottom bars.");
}
LinkButton {
label: _("API Reference");
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.ToolbarView.html";
}
ListBox list_box {
styles ["boxed-list"]
selection-mode: none;
Adw.ComboRow topbar_select {
title: _("Top bar");
model: StringList {
strings [_("Header Bar"),_("Tab Bar"),_("View Switcher Bar"),_("Action Bar"),_("PopOverMenu Bar"),_("Search Bar"),_("Gtk Box")]
};
selected: 0;
}
Adw.ComboRow bottombar_select {
title: _("Bottom bar");
model: StringList {
strings [_("Header Bar"),_("Tab Bar"),_("View Switcher Bar"),_("Action Bar"),_("PopOverMenu Bar"),_("Search Bar"),_("Gtk Box")]
};
selected: 2;
}
Adw.ComboRow barstyle_select {
title: _("Style");
model: StringList {
strings [_("Flat"), _("Raised"), _("Raised-Border")]
};
}
Adw.SwitchRow reveal_topbar {
title: _("Reveal Top Bar");
active: true;
}
Adw.SwitchRow reveal_bottombar {
title: _("Reveal Bottom Bar");
active: true;
}
Adw.SwitchRow extend_top {
title: _("Extend content behind top bar");
active: false;
}
Adw.SwitchRow extend_bottom {
title: _("Extend content behind bottom bar");
active: false;
}
}
}
};
}

Adw.ViewStackPage page1 {
name: "page1";
title: _("Page 1");
icon-name: "explore2-symbolic";
use-underline: true;
child: Adw.StatusPage{
title: _("Hello");
};
}

Adw.ViewStackPage page2 {
name: "page2";
title: _("Page 2");
icon-name: "explore2-symbolic";
use-underline: true;
child: Adw.StatusPage {
title: _("from");
};
}

Adw.ViewStackPage page3 {
name: "page3";
title: _("Page 3");
icon-name: "explore2-symbolic";
use-underline: true;
child: Adw.StatusPage {
title: _("Workbench");
};
}
};
}
}

Adw.HeaderBar header_bar {
title-widget: Adw.WindowTitle {
title: _("Header Bar");
};
}

ActionBar action_bar {
revealed: true;
valign: end;

[start]
Button start_widget {
icon-name: "call-start-symbolic";
}

[center]
DropDown {
model: StringList {
strings ["Center Widget","👁️", "❤️", "💼", "🪑"]
};
}

[end]
Button end_widget {
icon-name: "padlock2-symbolic";
}
}

Adw.ViewSwitcherBar switcher_bar {
stack: stack;
reveal: true;
}

PopoverMenuBar popover {
menu-model: menu_app;
}

menu menu_app {
section {
item {
label: _("Keyboard Shortcuts");
action: "app.shortcuts";
}

item {
label: _("About Workbench");
action: "app.about";
}
}
}

SearchBar search_bar {
search-mode-enabled: true;
show-close-button: true;
SearchEntry {
placeholder-text: _("Start Searching…");
}
}

Box gtk_box {
name: "gtk_box";
halign: fill;
height-request: 20;
}

Adw.TabBar tab_bar {
view: tab_view;
}

Adw.TabView tab_view {
Adw.TabPage main_tab_page {
title: _("First Page");
child: Adw.StatusPage {
hexpand: true;
vexpand: true;
title: _("Tab View");
description: _("A dynamic tabbed container");
};
}

Adw.TabPage main_tab_page2 {
title: _("Second Page");
child: Adw.StatusPage {
hexpand: true;
vexpand: true;
title: _("Tab View");
description: _("A dynamic tabbed container");
};
}
}
4 changes: 4 additions & 0 deletions src/Library/demos/Toolbar View/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#gtk_box {
background-color: purple;
}

85 changes: 85 additions & 0 deletions src/Library/demos/Toolbar View/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import Gio from "gi://Gio";
import Gdk from "gi://Gdk";
import GObject from "gi://GObject";
import Gtk from "gi://Gtk";
import Adw from "gi://Adw";

const topbar_select = workbench.builder.get_object("topbar_select");
const bottombar_select = workbench.builder.get_object("bottombar_select");
const toolbar_view = workbench.builder.get_object("toolbar_view");

let top_bar;
let bottom_bar;

function changeTopBar(name) {
const new_top_bar = workbench.builder.get_object(name);
top_bar && toolbar_view.remove(top_bar);
toolbar_view.add_top_bar(new_top_bar);
top_bar = new_top_bar;
}

function changeBottomBar(name) {
const new_bottom_bar = workbench.builder.get_object(name);
bottom_bar && toolbar_view.remove(bottom_bar);
toolbar_view.add_bottom_bar(new_bottom_bar);
bottom_bar = new_bottom_bar;
}

topbar_select.connect("notify::selected-item", selectTopBar);
bottombar_select.connect("notify::selected-item", selectBottomBar);

selectTopBar();
selectBottomBar();

function selectTopBar() {
switch (topbar_select.selected) {
case 0:
changeTopBar("header_bar");
break;
case 1:
changeTopBar("tab_bar");
break;
case 2:
changeTopBar("switcher_bar");
break;
case 3:
changeTopBar("action_bar");
break;
case 4:
changeTopBar("popover");
break;
case 5:
changeTopBar("search_bar");
break;
case 6:
changeTopBar("gtk_box");
break;
}
}

function selectBottomBar() {
switch (bottombar_select.selected) {
case 0:
changeBottomBar("header_bar");
break;
case 1:
changeBottomBar("tab_bar");
break;
case 2:
changeBottomBar("switcher_bar");
break;
case 3:
changeBottomBar("action_bar");
break;
case 4:
changeBottomBar("popover");
break;
case 5:
changeBottomBar("search_bar");
break;
case 6:
changeBottomBar("gtk_box");
break;
}
}

6 changes: 6 additions & 0 deletions src/Library/demos/Toolbar View/main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"category": "layout",
"description": "A widget containing a page, as well as top and/or bottom bars.",
"panels": ["ui", "preview"],
"autorun": true
}