Skip to content

Commit

Permalink
Migrate from SwiftGui to Libadwaita
Browse files Browse the repository at this point in the history
  • Loading branch information
david-swift committed Nov 26, 2023
1 parent 490e1a5 commit 7a97d36
Show file tree
Hide file tree
Showing 49 changed files with 88 additions and 88 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/component_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ body:

- type: textarea
attributes:
label: Name the equivalents in GTUI.
label: Name the equivalents in Libadwaita.
placeholder: >-
A list of the equivalents in the GTUI library in SwiftGui (see dependencies).
A list of the equivalents in the Libadwaita library (see dependencies).
validations:
required: true

Expand Down
2 changes: 1 addition & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ disabled_rules:
custom_rules:
github_issue:
name: 'GitHub Issue'
regex: '//.(TODO|FIXME):.(?!.*(https://github\.com/david-swift/Adwaita/issues/\d))'
regex: '//.(TODO|FIXME):.(?!.*(https://github\.com/AparokshaUI/Adwaita/issues/\d))'
message: 'The related GitHub issue must be included in a TODO or FIXME.'
severity: warning

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Just open a new issue on GitHub and describe the bug. It helps if your descripti
Just open a new issue on GitHub and describe the idea. Thank you very much for your contribution!

### Suggest a New Component
If you want to be able to access a component from Libadwaita or GTK that is currently not available in Adwaita, you can add it to [SwiftGui](https://github.com/JCWasmx86/SwiftGui).
If you want to be able to access a component from Libadwaita or GTK that is currently not available in Adwaita, you can add it to [Libadwaita](https://github.com/AparokshaUI/Libadwaita).
If you want to add an Adwaita interface for an already existing GTUI widget, open an issue.

## Pull Requests
Expand Down
2 changes: 1 addition & 1 deletion Documentation/Reference/extensions/Box.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
## Methods
### `vertical()`

Initialize a vertical `GTUI.Box`.
Initialize a vertical `Libadwaita.Box`.
- Returns: The vertical box.
4 changes: 2 additions & 2 deletions Documentation/Reference/extensions/NativeWidgetPeer.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
## Methods
### `update(_:modifiers:)`

A `GTUI.NativeWidgetPeer` is static.
A `Libadwaita.NativeWidgetPeer` is static.
- Parameters:
- storage: The view storage.
- modifiers: Modify views before being updated.

### `container(modifiers:)`

A `GTUI.NativeWidgetPeer`'s container is itself.
A `Libadwaita.NativeWidgetPeer`'s container is itself.
- Parameter modifiers: Modify views before being updated.
- Returns: The view storage.

Expand Down
2 changes: 1 addition & 1 deletion Documentation/Reference/protocols/App.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A structure conforming to `App` is the entry point of your app.
@main
struct Test: App {

let id = "io.github.david-swift.TestApp"
let id = "io.github.AparokshaUI.TestApp"
var app: GTUIApp!

var scene: Scene {
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ let package = Package(
)
],
dependencies: [
.package(url: "https://github.com/david-swift/SwiftGui", from: "0.1.0")
.package(url: "https://github.com/AparokshaUI/Libadwaita", from: "0.1.0")
],
targets: [
.target(
name: "Adwaita",
dependencies: [.product(name: "GTUI", package: "swiftgui")]
dependencies: [.product(name: "Libadwaita", package: "Libadwaita")]
),
.executableTarget(
name: "Swift Adwaita Demo",
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
User Manual
</a>
·
<a href="https://github.com/david-swift/Adwaita">
<a href="https://github.com/AparokshaUI/Adwaita">
GitHub
</a>
·
Expand Down Expand Up @@ -88,7 +88,7 @@ If you want to use _Adwaita_ in a project, but there are widgets missing, open a

| Syntax | Description |
| ---------------------------- | --------------------------------------------------------------------------------------- |
| `inspect(_:)` | Edit the underlying [GTUI][10] widget. |
| `inspect(_:)` | Edit the underlying [Libadwaita][10] widget. |
| `padding(_:_:)` | Add empty space around a view. |
| `hexpand(_:)` | Enable or disable the horizontal expansion of a view. |
| `vexpand(_:)` | Enable or disable the vertical expansion of a view. |
Expand Down Expand Up @@ -168,7 +168,7 @@ brew install libadwaita
2. Open the `Package.swift` file.
3. Into the `Package` initializer, under `dependencies`, paste:
```swift
.package(url: "https://github.com/david-swift/Adwaita", from: "0.1.0")
.package(url: "https://github.com/AparokshaUI/Adwaita", from: "0.1.0")
```

## Usage
Expand All @@ -189,7 +189,7 @@ brew install libadwaita
## Thanks

### Dependencies
- [SwiftGui][18] licensed under the [GPL-3.0 license][19]
- [Libadwaita][18] licensed under the [GPL-3.0 license][19]

### Other Thanks
- The [contributors][20]
Expand All @@ -205,17 +205,17 @@ brew install libadwaita
[6]: #thanks
[7]: https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1-latest/index.html
[8]: https://docs.gtk.org/gtk4/
[9]: https://github.com/david-swift/Adwaita/issues
[10]: https://github.com/JCWasmx86/SwiftGui
[9]: https://github.com/AparokshaUI/Adwaita/issues
[10]: https://github.com/AparokshaUI/Libadwaita
[11]: https://brew.sh
[12]: user-manual/GettingStarted.md
[13]: user-manual/Basics/HelloWorld.md
[14]: user-manual/Basics/CreatingViews.md
[15]: user-manual/Basics/Windows.md
[16]: user-manual/Basics/KeyboardShortcuts.md
[17]: user-manual/Advanced/CreatingWidgets.md
[18]: https://github.com/JCWasmx86/SwiftGui
[19]: https://github.com/JCWasmx86/SwiftGui/blob/main/COPYING
[18]: https://github.com/AparokshaUI/Libadwaita
[19]: https://github.com/AparokshaUI/Libadwaita/blob/main/LICENSE.md
[20]: Contributors.md
[21]: https://github.com/realm/SwiftLint
[22]: https://github.com/apple/swift
Expand Down
4 changes: 2 additions & 2 deletions Sources/Adwaita/Menu/MenuButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by david-swift on 22.10.23.
//

import GTUI
import Libadwaita

/// A button widget for menus.
public struct MenuButton: MenuItem {
Expand Down Expand Up @@ -35,7 +35,7 @@ public struct MenuButton: MenuItem {
/// - menu: The menu.
/// - app: The application containing the menu.
/// - window: The application window containing the menu.
public func addMenuItem(menu: GTUI.Menu, app: GTUIApp, window: GTUIApplicationWindow?) {
public func addMenuItem(menu: Libadwaita.Menu, app: GTUIApp, window: GTUIApplicationWindow?) {
if let window, preferApplicationWindow {
_ = menu.append(label, window: window, shortcut: shortcut, handler: handler)
} else {
Expand Down
6 changes: 3 additions & 3 deletions Sources/Adwaita/Menu/MenuSection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by david-swift on 22.10.23.
//

import GTUI
import Libadwaita

/// A section for menus.
public struct MenuSection: MenuItem {
Expand All @@ -24,8 +24,8 @@ public struct MenuSection: MenuItem {
/// - menu: The menu.
/// - app: The application containing the menu.
/// - window: The application window containing the menu.
public func addMenuItem(menu: GTUI.Menu, app: GTUIApp, window: GTUIApplicationWindow?) {
let section = GTUI.Menu()
public func addMenuItem(menu: Libadwaita.Menu, app: GTUIApp, window: GTUIApplicationWindow?) {
let section = Libadwaita.Menu()
_ = menu.append("", section: section)
for element in sectionContent {
element.addMenuItems(menu: section, app: app, window: window)
Expand Down
6 changes: 3 additions & 3 deletions Sources/Adwaita/Menu/Submenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by david-swift on 22.10.23.
//

import GTUI
import Libadwaita

/// A submenu widget.
public struct Submenu: MenuItem {
Expand All @@ -29,8 +29,8 @@ public struct Submenu: MenuItem {
/// - menu: The menu.
/// - app: The application containing the menu.
/// - window: The application window containing the menu.
public func addMenuItem(menu: GTUI.Menu, app: GTUIApp, window: GTUIApplicationWindow?) {
let submenu = GTUI.Menu()
public func addMenuItem(menu: Libadwaita.Menu, app: GTUIApp, window: GTUIApplicationWindow?) {
let submenu = Libadwaita.Menu()
_ = menu.append(label, submenu: submenu)
for element in submenuContent {
element.addMenuItems(menu: submenu, app: app, window: window)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Adwaita/Model/Extensions/Array.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by david-swift on 06.08.23.
//

import GTUI
import Libadwaita

extension Array: View where Element == View {

Expand Down
6 changes: 3 additions & 3 deletions Sources/Adwaita/Model/Extensions/NativeWidgetPeer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
// Created by david-swift on 05.08.23.
//

import GTUI
import Libadwaita

extension NativeWidgetPeer: Widget {

/// A `GTUI.NativeWidgetPeer` is static.
/// A `Libadwaita.NativeWidgetPeer` is static.
/// - Parameters:
/// - storage: The view storage.
/// - modifiers: Modify views before being updated.
public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) { }

/// A `GTUI.NativeWidgetPeer`'s container is itself.
/// A `Libadwaita.NativeWidgetPeer`'s container is itself.
/// - Parameter modifiers: Modify views before being updated.
/// - Returns: The view storage.
public func container(modifiers: [(View) -> View]) -> ViewStorage {
Expand Down
4 changes: 2 additions & 2 deletions Sources/Adwaita/Model/User Interface/App/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
// Created by david-swift on 05.08.23.
//

import GTUI
import Libadwaita

/// A structure conforming to `App` is the entry point of your app.
///
/// ```swift
/// @main
/// struct Test: App {
///
/// let id = "io.github.david-swift.TestApp"
/// let id = "io.github.AparokshaUI.TestApp"
/// var app: GTUIApp!
///
/// var scene: Scene {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Adwaita/Model/User Interface/App/GTUIApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by david-swift on 05.08.23.
//

import GTUI
import Libadwaita

/// The GTUI application.
public class GTUIApp: Application {
Expand Down
4 changes: 2 additions & 2 deletions Sources/Adwaita/Model/User Interface/Menu/MenuItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by david-swift on 22.10.23.
//

import GTUI
import Libadwaita

/// A structure representing the content for a certain menu item type.
public protocol MenuItem: MenuItemGroup {
Expand All @@ -15,7 +15,7 @@ public protocol MenuItem: MenuItemGroup {
/// - menu: The menu.
/// - app: The application containing the menu.
/// - window: The application window containing the menu.
func addMenuItem(menu: GTUI.Menu, app: GTUIApp, window: GTUIApplicationWindow?)
func addMenuItem(menu: Libadwaita.Menu, app: GTUIApp, window: GTUIApplicationWindow?)

}

Expand Down
4 changes: 2 additions & 2 deletions Sources/Adwaita/Model/User Interface/Menu/MenuItemGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by david-swift on 22.10.23.
//

import GTUI
import Libadwaita

/// A structure conforming to `MenuItemGroup` can be added to the content accepting a menu.
public protocol MenuItemGroup {
Expand All @@ -19,7 +19,7 @@ extension MenuItemGroup {

/// Add the menu items described by the group to a menu.
/// - Parameter menu: The menu.
func addMenuItems(menu: GTUI.Menu, app: GTUIApp, window: GTUIApplicationWindow?) {
func addMenuItems(menu: Libadwaita.Menu, app: GTUIApp, window: GTUIApplicationWindow?) {
for element in content {
if let item = element as? MenuItem {
item.addMenuItem(menu: menu, app: app, window: window)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Adwaita/Model/User Interface/View/View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by david-swift on 05.08.23.
//

import GTUI
import Libadwaita

/// A structure conforming to `View` is referred to as a view.
/// It can be part of a body.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by david-swift on 31.08.23.
//

import GTUI
import Libadwaita

/// Store a rendered view in a view storage.
public class ViewStorage {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Adwaita/Model/User Interface/View/Widget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by david-swift on 16.08.23.
//

import GTUI
import Libadwaita

/// A widget is a view that know about its GTUI widget.
public protocol Widget: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by david-swift on 19.10.23.
//

import GTUI
import Libadwaita

/// A GTUI application window.
public typealias GTUIApplicationWindow = GTUI.ApplicationWindow
public typealias GTUIApplicationWindow = Libadwaita.ApplicationWindow
4 changes: 2 additions & 2 deletions Sources/Adwaita/Model/User Interface/Window/GTUIWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by david-swift on 12.10.23.
//

import GTUI
import Libadwaita

/// A GTUI window.
public typealias GTUIWindow = GTUI.Window
public typealias GTUIWindow = Libadwaita.Window
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by david-swift on 05.08.23.
//

import GTUI
import Libadwaita

/// A structure representing the content for a certain window type.
public protocol WindowScene: WindowSceneGroup {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by david-swift on 31.08.23.
//

import GTUI
import Libadwaita

/// A storage for an app's window.
public class WindowStorage {
Expand Down
8 changes: 4 additions & 4 deletions Sources/Adwaita/View/Button.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by david-swift on 10.09.23.
//

import GTUI
import Libadwaita

/// A button widget.
public struct Button: Widget {
Expand Down Expand Up @@ -44,7 +44,7 @@ public struct Button: Widget {
/// - storage: The view storage.
/// - modifiers: Modify views before being updated.
public func update(_ storage: ViewStorage, modifiers: [(View) -> View]) {
if let button = storage.view as? GTUI.Button {
if let button = storage.view as? Libadwaita.Button {
let content = button.getContent()
if let label {
if icon == nil {
Expand All @@ -64,9 +64,9 @@ public struct Button: Widget {
/// - Returns: The button's view storage.
public func container(modifiers: [(View) -> View]) -> ViewStorage {
if let icon {
return .init(GTUI.Button(label, icon: icon).handler(handler))
return .init(Libadwaita.Button(label, icon: icon).handler(handler))
} else {
return .init(GTUI.Button(label ?? .init()).handler(handler))
return .init(Libadwaita.Button(label ?? .init()).handler(handler))
}
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/Adwaita/View/EitherView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by david-swift on 22.08.23.
//

import GTUI
import Libadwaita

/// An equivalent to GtkStack for two views.
public struct EitherView: Widget {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Adwaita/View/HStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by david-swift on 26.09.23.
//

import GTUI
import Libadwaita

/// A horizontal GtkBox equivalent.
public struct HStack: Widget {
Expand Down
Loading

0 comments on commit 7a97d36

Please sign in to comment.