Skip to content

Commit 8cebd5f

Browse files
feat: Update all deps and edition to 2024
1 parent fb86788 commit 8cebd5f

File tree

11 files changed

+85
-92
lines changed

11 files changed

+85
-92
lines changed

Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[package]
22
description = "Property List editor written in Rust"
3-
edition = "2021"
3+
edition = "2024"
44
name = "plist-oxide"
55
publish = false
66
version = "0.1.0"
77

88
[package.metadata.bundle]
99
category = "public.app-category.utilities"
10-
copyright = "Copyright © 2022-2024 ChefKiss Inc. Licensed under the Thou Shalt Not Profit License version 1.5"
10+
copyright = "Copyright © 2022-2025 ChefKiss Inc. Licensed under the Thou Shalt Not Profit License version 1.5"
1111
icon = ["src/app_icon/icon*.png"]
1212
identifier = "org.ChefKiss.PlistOxide"
1313
linux_exec_args = "%f"
@@ -20,22 +20,22 @@ lto = true
2020
strip = true
2121

2222
[dependencies]
23-
winit = { version = "0.30.10", default-features = true }
24-
eframe = { version = "0.31.1", default-features = false, features = [
23+
winit = { version = "0.30.11", default-features = true }
24+
eframe = { version = "0.32.0", default-features = false, features = [
2525
"default_fonts",
2626
"accesskit",
2727
"persistence",
2828
"wgpu",
2929
"wayland",
3030
"x11",
3131
] }
32-
egui = { version = "0.31.1" }
33-
egui_extras = "0.31.1"
32+
egui = { version = "0.32.0" }
33+
egui_extras = "0.32.0"
3434
hex = "0.4.3"
35-
plist = "1.7.1"
35+
plist = "1.7.4"
3636
rfd = "0.15.3"
3737
serde = { version = "1.0.219", features = ["derive"] }
38-
font-kit = "0.14.2"
38+
font-kit = "0.14.3"
3939

4040
[target.'cfg(target_os = "macos")'.dependencies]
4141
objc2 = "0.6.1"

build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Copyright © 2022-2024 ChefKiss Inc. Licensed under the Thou Shalt Not Profit License version 1.5.
1+
//! Copyright © 2022-2025 ChefKiss Inc. Licensed under the Thou Shalt Not Profit License version 1.5.
22
//! See LICENSE for details.
33
44
fn main() {

src/app.rs

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
//! Copyright © 2022-2024 ChefKiss Inc. Licensed under the Thou Shalt Not Profit License version 1.5.
1+
//! Copyright © 2022-2025 ChefKiss Inc. Licensed under the Thou Shalt Not Profit License version 1.5.
22
//! See LICENSE for details.
33
44
use egui::ViewportCommand;
55
use egui_extras::{Column, TableBuilder};
66
#[cfg(target_os = "macos")]
7-
use objc2::{define_class, msg_send, rc::Retained, sel, MainThreadOnly};
7+
use objc2::{MainThreadOnly, define_class, msg_send, rc::Retained, sel};
88
#[cfg(target_os = "macos")]
99
use objc2_app_kit::{NSApplication, NSMenu, NSMenuItem};
1010
#[cfg(target_os = "macos")]
11-
use objc2_foundation::{ns_string, MainThreadMarker, NSObject, NSObjectProtocol};
11+
use objc2_foundation::{MainThreadMarker, NSObject, NSObjectProtocol, ns_string};
1212
use plist::{Dictionary, Value};
1313
use serde::{Deserialize, Serialize};
1414
#[cfg(target_os = "macos")]
@@ -65,15 +65,15 @@ define_class!(
6565

6666
impl PlistOxideMenu {
6767
#[unsafe(method(openingFile))]
68-
unsafe fn opening_file(&self) {
68+
fn opening_file(&self) {
6969
*OPENING_FILE.lock().unwrap() = true;
70-
(*EGUI_CTX.get()).assume_init_mut().request_repaint();
70+
unsafe { (*EGUI_CTX.get()).assume_init_mut().request_repaint() };
7171
}
7272

7373
#[unsafe(method(savingFile))]
74-
unsafe fn saving_file(&self) {
74+
fn saving_file(&self) {
7575
*SAVING_FILE.lock().unwrap() = true;
76-
(*EGUI_CTX.get()).assume_init_mut().request_repaint();
76+
unsafe { (*EGUI_CTX.get()).assume_init_mut().request_repaint() };
7777
}
7878
}
7979
);
@@ -90,46 +90,52 @@ impl PlistOxide {
9090
}
9191

9292
#[cfg(target_os = "macos")]
93-
unsafe fn new_global_menu(cc: &eframe::CreationContext<'_>) -> Retained<PlistOxideMenu> {
94-
(*EGUI_CTX.get()).write(cc.egui_ctx.clone());
93+
fn new_global_menu(cc: &eframe::CreationContext<'_>) -> Retained<PlistOxideMenu> {
94+
unsafe { (*EGUI_CTX.get()).write(cc.egui_ctx.clone()) };
9595
let mtm = MainThreadMarker::new().unwrap();
96-
let file_menu = NSMenu::initWithTitle(mtm.alloc(), ns_string!("File"));
96+
let file_menu = unsafe { NSMenu::initWithTitle(NSMenu::alloc(mtm), ns_string!("File")) };
9797

9898
let menu: Retained<PlistOxideMenu> = unsafe { msg_send![PlistOxideMenu::alloc(mtm), init] };
9999

100-
let file_open = NSMenuItem::initWithTitle_action_keyEquivalent(
101-
mtm.alloc(),
102-
ns_string!("Open..."),
103-
Some(sel!(openingFile)),
104-
ns_string!("o"),
105-
);
106-
file_open.setTarget(Some(&menu));
100+
let file_open = unsafe {
101+
NSMenuItem::initWithTitle_action_keyEquivalent(
102+
NSMenuItem::alloc(mtm),
103+
ns_string!("Open..."),
104+
Some(sel!(openingFile)),
105+
ns_string!("o"),
106+
)
107+
};
108+
unsafe { file_open.setTarget(Some(&menu)) };
107109
file_menu.addItem(&file_open);
108110

109111
file_menu.addItem(&NSMenuItem::separatorItem(mtm));
110112

111-
let file_save = NSMenuItem::initWithTitle_action_keyEquivalent(
112-
mtm.alloc(),
113-
ns_string!("Save..."),
114-
Some(sel!(savingFile)),
115-
ns_string!("s"),
116-
);
117-
file_save.setTarget(Some(&menu));
113+
let file_save = unsafe {
114+
NSMenuItem::initWithTitle_action_keyEquivalent(
115+
NSMenuItem::alloc(mtm),
116+
ns_string!("Save..."),
117+
Some(sel!(savingFile)),
118+
ns_string!("s"),
119+
)
120+
};
121+
unsafe { file_save.setTarget(Some(&menu)) };
118122
file_menu.addItem(&file_save);
119123

120124
let file_item = NSMenuItem::new(mtm);
121125
file_item.setSubmenu(Some(&file_menu));
122-
NSApplication::sharedApplication(mtm)
123-
.mainMenu()
124-
.unwrap()
125-
.addItem(&file_item);
126+
unsafe {
127+
NSApplication::sharedApplication(mtm)
128+
.mainMenu()
129+
.unwrap()
130+
.addItem(&file_item)
131+
};
126132
menu
127133
}
128134

129135
#[must_use]
130136
pub fn new(cc: &eframe::CreationContext<'_>, path: Option<PathBuf>) -> Self {
131137
#[cfg(target_os = "macos")]
132-
let menu = unsafe { Self::new_global_menu(cc) };
138+
let menu = Self::new_global_menu(cc);
133139
cc.egui_ctx.set_fonts(crate::style::get_fonts());
134140
let state = cc
135141
.storage

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Copyright © 2022-2024 ChefKiss Inc. Licensed under the Thou Shalt Not Profit License version 1.5.
1+
//! Copyright © 2022-2025 ChefKiss Inc. Licensed under the Thou Shalt Not Profit License version 1.5.
22
//! See LICENSE for details.
33
44
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

src/style.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Copyright © 2022-2024 ChefKiss Inc. Licensed under the Thou Shalt Not Profit License version 1.5.
1+
//! Copyright © 2022-2025 ChefKiss Inc. Licensed under the Thou Shalt Not Profit License version 1.5.
22
//! See LICENSE for details.
33
44
use egui::{FontData, FontDefinitions, FontFamily};

src/utils.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
//! Copyright © 2022-2024 ChefKiss Inc. Licensed under the Thou Shalt Not Profit License version 1.5.
1+
//! Copyright © 2022-2025 ChefKiss Inc. Licensed under the Thou Shalt Not Profit License version 1.5.
22
//! See LICENSE for details.
33
44
use plist::Value;
55

66
#[must_use]
7-
#[inline]
87
pub fn pv<'a>(path: &[String], mut p: &'a Value) -> &'a Value {
98
for k in path {
109
p = match p {
@@ -17,7 +16,6 @@ pub fn pv<'a>(path: &[String], mut p: &'a Value) -> &'a Value {
1716
}
1817

1918
#[must_use]
20-
#[inline]
2119
pub fn pv_mut<'a>(path: &[String], mut p: &'a mut Value) -> &'a mut Value {
2220
for k in path {
2321
p = match p {
@@ -30,7 +28,6 @@ pub fn pv_mut<'a>(path: &[String], mut p: &'a mut Value) -> &'a mut Value {
3028
}
3129

3230
#[must_use]
33-
#[inline]
3431
pub fn child_keys(path: &[String], p: &Value) -> Vec<String> {
3532
match pv(path, p) {
3633
Value::Dictionary(v) => v.keys().cloned().collect(),
@@ -53,7 +50,6 @@ pub enum ValueType {
5350

5451
impl ValueType {
5552
#[must_use]
56-
#[inline]
5753
pub fn from_val(path: &[String], p: &Value) -> Self {
5854
match pv(path, p) {
5955
Value::Array(_) => Self::Array,
@@ -69,7 +65,6 @@ impl ValueType {
6965
}
7066

7167
#[must_use]
72-
#[inline]
7368
pub const fn is_expandable(self) -> bool {
7469
matches!(self, Self::Array | Self::Dictionary)
7570
}

src/widgets/click_text_edit.rs

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Copyright © 2022-2024 ChefKiss Inc. Licensed under the Thou Shalt Not Profit License version 1.5.
1+
//! Copyright © 2022-2025 ChefKiss Inc. Licensed under the Thou Shalt Not Profit License version 1.5.
22
//! See LICENSE for details.
33
44
use egui::{
@@ -24,7 +24,6 @@ struct State {
2424

2525
impl State {
2626
#[must_use]
27-
#[inline]
2827
pub const fn new(edit_string: String) -> Self {
2928
Self { edit_string }
3029
}
@@ -46,7 +45,6 @@ pub struct ClickableTextEdit<'a> {
4645
}
4746

4847
impl<'a> ClickableTextEdit<'a> {
49-
#[inline]
5048
pub fn from_get_set(
5149
get_set_value: impl 'a + FnMut(Option<String>) -> String,
5250
validate_value: impl 'a + FnMut(&str) -> bool,
@@ -84,31 +82,29 @@ impl Widget for ClickableTextEdit<'_> {
8482
.id(kb_edit_id)
8583
.font(TextStyle::Monospace),
8684
);
87-
egui::popup::popup_below_widget(
88-
ui,
89-
popup_id,
90-
&response,
91-
PopupCloseBehavior::IgnoreClicks,
92-
|ui| {
93-
ui.set_min_width(100.0);
94-
ui.label(
95-
RichText::new("Value is currently invalid")
96-
.color(Color32::RED)
97-
.strong(),
98-
);
99-
},
100-
);
85+
86+
egui::Popup::from_response(&response)
87+
.layout(egui::Layout::top_down_justified(egui::Align::LEFT))
88+
.open_memory(None)
89+
.close_behavior(PopupCloseBehavior::IgnoreClicks)
90+
.id(popup_id)
91+
.align(egui::RectAlign::BOTTOM_START)
92+
.width(response.rect.width())
93+
.show(|ui| {
94+
ui.set_min_width(ui.available_width());
95+
ui.label(RichText::new("Invalid").color(Color32::RED).strong());
96+
});
10197

10298
if validate_value(state.edit_string.as_str()) {
103-
ui.memory_mut(egui::Memory::close_popup);
99+
egui::Popup::close_id(ui.ctx(), popup_id);
104100
if ui.input(|v| v.key_pressed(Key::Enter)) {
105101
set(&mut get_set_value, state.edit_string.clone());
106102
ui.memory_mut(|v| v.surrender_focus(kb_edit_id));
107103
ui.data_mut(|d| d.remove::<State>(state_id));
108104
return response;
109105
}
110106
} else {
111-
ui.memory_mut(|v| v.open_popup(popup_id));
107+
egui::Popup::open_id(ui.ctx(), popup_id);
112108
ui.memory_mut(|v| v.request_focus(kb_edit_id));
113109
}
114110
state.store(ui.ctx(), state_id);
@@ -136,7 +132,7 @@ impl Widget for ClickableTextEdit<'_> {
136132
}
137133

138134
response.widget_info(|| {
139-
WidgetInfo::text_edit(ui.is_enabled(), old_value.as_str(), value.as_str())
135+
WidgetInfo::text_edit(ui.is_enabled(), old_value.as_str(), value.as_str(), "")
140136
});
141137
response
142138
}

src/widgets/entry.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
//! Copyright © 2022-2024 ChefKiss Inc. Licensed under the Thou Shalt Not Profit License version 1.5.
1+
//! Copyright © 2022-2025 ChefKiss Inc. Licensed under the Thou Shalt Not Profit License version 1.5.
22
//! See LICENSE for details.
33
44
use std::{
55
sync::{Arc, Mutex},
66
time::SystemTime,
77
};
88

9-
use egui::{pos2, vec2, ComboBox, Context, Id, Label, Response, Sense, TextEdit};
9+
use egui::{ComboBox, Context, Id, Label, Response, Sense, TextEdit, pos2, vec2};
1010
use egui_extras::TableBody;
1111
use plist::Value;
1212
use serde::{Deserialize, Serialize};
1313

1414
use super::{click_text_edit::ClickableTextEdit, value::PlistValue};
15-
use crate::utils::{child_keys, pv_mut, ValueType};
15+
use crate::utils::{ValueType, child_keys, pv_mut};
1616

1717
#[must_use]
18-
#[inline]
1918
fn get_new_key(keys: plist::dictionary::Keys, k: &str) -> String {
2019
keys.filter(|v| (v.as_str() == k) || (v.starts_with(k) && v.ends_with("Duplicate")))
2120
.last()
@@ -35,12 +34,12 @@ pub fn render_menu(resp: &Response, path: &[String], p: &mut Value) -> Option<bo
3534
get_new_key(dict.keys(), "New Child"),
3635
Value::String(String::new()),
3736
);
38-
ui.close_menu();
37+
ui.close();
3938
ret = Some(false);
4039
}
4140
if ui.button("Sort").clicked() {
4241
pv_mut(path, p).as_dictionary_mut().unwrap().sort_keys();
43-
ui.close_menu();
42+
ui.close();
4443
ret = Some(false);
4544
}
4645
}
@@ -50,7 +49,7 @@ pub fn render_menu(resp: &Response, path: &[String], p: &mut Value) -> Option<bo
5049
.as_array_mut()
5150
.unwrap()
5251
.push(Value::String(String::new()));
53-
ui.close_menu();
52+
ui.close();
5453
ret = Some(false);
5554
}
5655
}
@@ -71,7 +70,7 @@ pub fn render_menu(resp: &Response, path: &[String], p: &mut Value) -> Option<bo
7170
}
7271
_ => unreachable!(),
7372
}
74-
ui.close_menu();
73+
ui.close();
7574
ret = Some(false);
7675
}
7776

@@ -85,7 +84,7 @@ pub fn render_menu(resp: &Response, path: &[String], p: &mut Value) -> Option<bo
8584
}
8685
_ => unreachable!(),
8786
}
88-
ui.close_menu();
87+
ui.close();
8988
ret = Some(true);
9089
}
9190
});
@@ -123,7 +122,6 @@ pub struct PlistEntry {
123122
}
124123

125124
impl PlistEntry {
126-
#[inline]
127125
pub fn new(data: Arc<Mutex<Value>>, path: Vec<String>) -> Self {
128126
let id = Id::new(path.join("/"));
129127
Self { data, path, id }

src/widgets/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Copyright © 2022-2024 ChefKiss Inc. Licensed under the Thou Shalt Not Profit License version 1.5.
1+
//! Copyright © 2022-2025 ChefKiss Inc. Licensed under the Thou Shalt Not Profit License version 1.5.
22
//! See LICENSE for details.
33
44
pub mod click_text_edit;

src/widgets/toggle.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Copyright © 2022-2024 ChefKiss Inc. Licensed under the Thou Shalt Not Profit License version 1.5.
1+
//! Copyright © 2022-2025 ChefKiss Inc. Licensed under the Thou Shalt Not Profit License version 1.5.
22
//! See LICENSE for details.
33
44
use egui::{StrokeKind, Widget};
@@ -9,7 +9,6 @@ pub struct Toggle<'a> {
99

1010
impl<'a> Toggle<'a> {
1111
#[must_use]
12-
#[inline]
1312
pub const fn new(on: &'a mut bool) -> Self {
1413
Self { on }
1514
}

0 commit comments

Comments
 (0)