Skip to content

Commit

Permalink
refactor: Use new libadwaita 1.4 widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
marhkb committed Jul 23, 2023
1 parent 8d2e55f commit fb36a64
Show file tree
Hide file tree
Showing 141 changed files with 7,978 additions and 7,145 deletions.
859 changes: 548 additions & 311 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,17 @@ names = { version = "0.14", default-features = false }
once_cell = "1"
oo7 = { version = "0.1", default-features = false, features = ["native_crypto", "tokio"] }
panel = { git = "https://gitlab.gnome.org/World/Rust/libpanel-rs.git", package = "libpanel", features = ["adw_v1_2"] }
# panel = { version = "0.2", package = "libpanel" }
paste = "1"
paste = "1.0.4"
podman-api = { git = "https://github.com/vv9k/podman-api-rs.git", commit = "363d945b9b9905c50dfa0bfe0f9331f9fdeef079", default-features = false }
regex = "1"
serde = "1"
serde_json = "1"
sourceview5 = { git = "https://gitlab.gnome.org/World/Rust/sourceview5-rs.git" }
# sourceview5 = "0.6"
syslog = "6"
tokio = "1"
tokio-tar = "0.3"
vte = { version = "0.11", default-features = false }
# vte4 = "0.6"
vte4 = { git = "https://gitlab.gnome.org/World/Rust/vte4-rs.git" }

[profile.release]
lto = true
Expand Down
4 changes: 2 additions & 2 deletions data/com.github.marhkb.Pods.gschema.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
<summary>The last used view</summary>
<description></description>
</key>
<key name="show-intermediate-images" type="b">
<key name="hide-intermediate-images" type="b">
<default>false</default>
<summary>Whether to show intermediate images</summary>
<summary>Whether to hide intermediate images</summary>
<description></description>
</key>
<key name="last-used-container-file-path" type="s">
Expand Down
2 changes: 2 additions & 0 deletions data/resources/icons/scalable/actions/about-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions data/resources/icons/scalable/actions/funnel-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions data/resources/resources.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@

<file compressed="true" preprocess="xml-stripblanks" alias="gtk/help-overlay.ui">ui/shortcuts.ui</file>

<file compressed="true" preprocess="xml-stripblanks">icons/scalable/actions/about-symbolic.svg</file>
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/actions/arrow1-right-symbolic.svg</file>
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/actions/bell-outline-symbolic.svg</file>
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/actions/build-configure-symbolic.svg</file>
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/actions/code-symbolic.svg</file>
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/actions/eraser5-symbolic.svg</file>
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/actions/funnel-symbolic.svg</file>
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/actions/get-symbolic.svg</file>
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/actions/hospital-symbolic.svg</file>
<file compressed="true" preprocess="xml-stripblanks">icons/scalable/actions/memory-symbolic.svg</file>
Expand Down
4 changes: 3 additions & 1 deletion data/resources/style-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
}

.container-status-running,
.pod-status-running {
.pod-status-running,
.image-used,
.volume-used {
color: @blue_1;
background-color: alpha(@blue_2, .35);
}
Expand Down
7 changes: 6 additions & 1 deletion data/resources/style-hc.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
font-weight: bold;
}

.version,
.container-status-configured,
.container-status-created,
.container-status-exited,
Expand All @@ -15,6 +16,8 @@
.pod-status-created,
.pod-status-exited,
.pod-status-stopped,
.image-unused,
.volume-unused,
.container-health-status-checking,
.container-health-status-unconfigured,
.rich-expander-row-header #badge {
Expand All @@ -35,7 +38,9 @@
}

.container-status-running,
.pod-status-running {
.pod-status-running,
.image-used,
.volume-used {
background-color: @accent_bg_color;
color: @accent_fg_color;
}
Expand Down
72 changes: 59 additions & 13 deletions data/resources/style.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
.flat-headerbar-content scrollbar.vertical {
/* The size a typical headerbar takes: 46px + 1px for the bottom border. */
margin-top: 47px;

/* Relevant for scrollbars without .overlay-indicator. */
background: none;
box-shadow: none;
}

.flat-headerbar-normal-scrollbar scrollbar.vertical {
margin-top: 0;
.navigation-sidebar .list-separator {
margin: -12px 0;
}

.text-box textview {
Expand Down Expand Up @@ -40,6 +31,47 @@ button.large {
color: @destructive_color;
}

.sidebar-row {
margin: 12px 6px;
}

actionsbutton .action-count-mask {
background-color: @headerbar_bg_color;
border-radius: 9999px;
margin-left: 10px;
padding: 7px;
}

actionsbutton .action-count-badge {
border-radius: 9999px;
font-feature-settings: "tnum";
font-size: x-small;
font-weight: bold;
margin-top: 1px;
margin-left: 10px;
padding: 6px;
}

actionsbutton.good .action-count-badge {
background-color: @accent_bg_color;
color: @accent_fg_color;
}

actionsbutton.finished .action-count-badge {
background-color: @success_bg_color;
color: @success_fg_color;
}

actionsbutton.cancelled .action-count-badge {
background-color: @warning_bg_color;
color: @warning_fg_color;
}

actionsbutton.failed .action-count-badge {
background-color: @error_bg_color;
color: @error_fg_color;
}

connectionswitcher row #selection-indicator #background,
actionssidebar #type {
background-color: @shade_color;
Expand Down Expand Up @@ -100,18 +132,28 @@ connectionchooserpage connectionswitcher row {
}

.status-badge {
font-size: 0.8em;
font-size: 0.9em;
font-weight: bold;
min-width: 1.7em;
border-radius: 9999px;
padding: 5px 7px;
}

.status-badge-small {
font-size: small;
font-weight: bold;
font-feature-settings: "tnum";
min-width: 10px;
border-radius: 9999px;
padding: 1px 5px;
}

.repo-tags-small {
background-color: transparent;
margin: 0 0 -4px -2px;
}

.version,
.container-status-configured,
.container-status-created,
.container-status-exited,
Expand All @@ -122,6 +164,8 @@ connectionchooserpage connectionswitcher row {
.pod-status-created,
.pod-status-exited,
.pod-status-stopped,
.image-unused,
.volume-unused,
.container-health-status-checking,
.container-health-status-unconfigured,
.rich-expander-row-header #badge {
Expand All @@ -142,7 +186,9 @@ connectionchooserpage connectionswitcher row {
}

.container-status-running,
.pod-status-running {
.pod-status-running,
.image-used,
.volume-used {
color: @blue_4;
background-color: alpha(@blue_3, .25);
}
Expand Down
10 changes: 5 additions & 5 deletions src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ use once_cell::sync::Lazy;
use once_cell::sync::OnceCell;

use crate::config;
use crate::window::Window;
use crate::view;

mod imp {
use super::*;

#[derive(Default)]
pub(crate) struct Application {
pub(super) ticks: Cell<u64>,
pub(super) window: OnceCell<glib::WeakRef<Window>>,
pub(super) window: OnceCell<glib::WeakRef<view::Window>>,
}

#[glib::object_subclass]
Expand Down Expand Up @@ -75,7 +75,7 @@ mod imp {
return;
}

let window = Window::new(app);
let window = view::Window::new(app);
self.window
.set(window.downgrade())
.expect("Window already set.");
Expand Down Expand Up @@ -127,13 +127,13 @@ impl Application {
self.notify("ticks");
}

pub(super) fn main_window(&self) -> Window {
pub(super) fn main_window(&self) -> view::Window {
let imp = self.imp();

match imp.window.get() {
Some(window) => window.upgrade().unwrap(),
None => {
let window = Window::new(self);
let window = view::Window::new(self);
imp.window.set(window.downgrade()).unwrap();
window
}
Expand Down
113 changes: 96 additions & 17 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ mod model;
mod utils;
mod view;
mod widget;
mod window;

use std::path::PathBuf;
use std::str::FromStr;
Expand All @@ -19,6 +18,7 @@ use gettextrs::LocaleCategory;
use gtk::gio;
use gtk::glib;
use gtk::prelude::ApplicationExt;
use gtk::prelude::StaticType;
use once_cell::sync::Lazy;
use once_cell::sync::OnceCell;

Expand All @@ -33,22 +33,6 @@ pub(crate) static RUNTIME: Lazy<tokio::runtime::Runtime> =
pub(crate) static KEYRING: OnceCell<oo7::Keyring> = OnceCell::new();

fn main() {
glib::log_set_writer_func(glib::log_writer_journald);

adw::init().expect("Failed to init GTK/libadwaita");
panel::init();
sourceview5::init();

// Prepare i18n
gettextrs::setlocale(LocaleCategory::LcAll, "");
gettextrs::bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR).expect("Unable to bind the text domain");
gettextrs::textdomain(GETTEXT_PACKAGE).expect("Unable to switch to the text domain");

glib::set_application_name(&gettext("Pods"));

let res = gio::Resource::load(RESOURCES_FILE).expect("Could not load gresource file");
gio::resources_register(&res);

let app = setup_cli(Application::default());

// Command line handling
Expand All @@ -59,6 +43,24 @@ fn main() {
// ... and exit application.
1
} else {
glib::log_set_writer_func(glib::log_writer_journald);

adw::init().expect("Failed to init GTK/libadwaita");
panel::init();
sourceview5::init();
crate::init();

// Prepare i18n
gettextrs::setlocale(LocaleCategory::LcAll, "");
gettextrs::bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR)
.expect("Unable to bind the text domain");
gettextrs::textdomain(GETTEXT_PACKAGE).expect("Unable to switch to the text domain");

glib::set_application_name(&gettext("Pods"));

let res = gio::Resource::load(RESOURCES_FILE).expect("Could not load gresource file");
gio::resources_register(&res);

let log_level_filter = match dict.lookup::<String>("log-level").unwrap() {
Some(level) => {
log::LevelFilter::from_str(&level).expect("Error on parsing log-level")
Expand Down Expand Up @@ -136,3 +138,80 @@ fn setup_cli(app: Application) -> Application {

app
}

fn init() {
model::Connection::static_type();

view::ActionPage::static_type();
view::ActionRow::static_type();
view::ActionsButton::static_type();
view::ActionsSidebar::static_type();
view::ClientView::static_type();
view::ConnectionChooserPage::static_type();
view::ConnectionCustomInfoDialog::static_type();
view::ConnectionRow::static_type();
view::ConnectionSwitcher::static_type();
view::ConnectionsSidebar::static_type();
view::ContainerCommitPage::static_type();
view::ContainerFilesGetPage::static_type();
view::ContainerFilesPutPage::static_type();
view::ContainerHealthCheckLogRow::static_type();
view::ContainerHealthCheckPage::static_type();
view::ContainerLogPage::static_type();
view::ContainerMenuButton::static_type();
view::ContainerPropertiesGroup::static_type();
view::ContainerResources::static_type();
view::ContainerTerminal::static_type();
view::ContainerTerminalPage::static_type();
view::ContainerVolumeRow::static_type();
view::ContainersCountBar::static_type();
view::ContainersGroup::static_type();
view::ContainersPanel::static_type();
view::ContainersPrunePage::static_type();
view::ContainersRow::static_type();
view::ImageBuildPage::static_type();
view::ImageHistoryPage::static_type();
view::ImageMenuButton::static_type();
view::ImageSearchResponseRow::static_type();
view::ImageSelectionComboRow::static_type();
view::ImageSelectionPage::static_type();
view::ImagesPanel::static_type();
view::ImagesRow::static_type();
view::InfoPanel::static_type();
view::InfoRow::static_type();
view::PodMenuButton::static_type();
view::PodRow::static_type();
view::PodSelectionPage::static_type();
view::PodsPanel::static_type();
view::PodsPrunePage::static_type();
view::PodsRow::static_type();
view::RepoTagAddDialog::static_type();
view::RepoTagPushPage::static_type();
view::RepoTagRow::static_type();
view::RepoTagSimpleRow::static_type();
view::ScalableTextViewPage::static_type();
view::SearchPanel::static_type();
view::SearchRow::static_type();
view::VolumeRow::static_type();
view::VolumesGroup::static_type();
view::VolumesPanel::static_type();
view::VolumesPrunePage::static_type();
view::VolumesRow::static_type();
view::WelcomePage::static_type();
view::Window::static_type();

widget::CircularProgressBar::static_type();
widget::CountBadge::static_type();
widget::DateTimeRow::static_type();
widget::EfficientSpinner::static_type();
widget::MainMenuButton::static_type();
widget::PropertyRow::static_type();
widget::PropertyWidgetRow::static_type();
widget::RandomNameEntryRow::static_type();
widget::ScalableTextView::static_type();
widget::SeparatorRow::static_type();
widget::SourceViewSearchWidget::static_type();
widget::Spinner::static_type();
widget::TextSearchEntry::static_type();
widget::ZoomControl::static_type();
}
Loading

0 comments on commit fb36a64

Please sign in to comment.