Skip to content

Commit 09d8b58

Browse files
authored
Merge pull request #14 from derenv/right_pane
Right pane
2 parents 2b64146 + 7e53f3c commit 09d8b58

File tree

18 files changed

+1392
-367
lines changed

18 files changed

+1392
-367
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ adwaita = { version = "^0.1.1", package = "libadwaita" }
1111
gtk = { version = "^0.4.8", package = "gtk4" }
1212
gdk = { version = "^0.4.8", package = "gdk4" }
1313

14-
#shell = { version = "^0.4.4", package = "gtk-layer-shell" } #may not need
1514
#serde = { version = "1.0", features = ["derive"] }
1615
#serde_json = "1.0"
16+
17+
#shell = { version = "^0.4.4", package = "gtk-layer-shell" } #may not need
1718
#gobject = { version = "^0.15.10", package = "gobject-sys" }
1819
#libappindicator = { version = "^0.7.1", package = "libappindicator" }
1920

src/custom_button/imp.rs

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*/
2020

2121
// Imports
22+
use glib::{once_cell::sync::Lazy, ParamSpec, Value};
2223
use gtk::{glib, subclass::prelude::*};
2324

2425
/// Object holding the State and any Template Children
@@ -37,7 +38,94 @@ impl ObjectSubclass for CustomButton {
3738
}
3839

3940
// Trait shared by all GObjects
40-
impl ObjectImpl for CustomButton {}
41+
impl ObjectImpl for CustomButton {
42+
/**
43+
* Name:
44+
* properties
45+
*
46+
* Description:
47+
* Create list of custom properties for our GObject
48+
*
49+
* Made:
50+
* 05/10/2022
51+
*
52+
* Made by:
53+
* Deren Vural
54+
*
55+
* Notes:
56+
* beware that you need to use kebab-case (<https://en.wikipedia.org/wiki/Letter_case#Kebab_case>)
57+
*
58+
* ParamSpec Examples:
59+
* glib::ParamSpecString::builder("icon").build(),
60+
* glib::ParamSpecUInt::builder("gpu_count").build(),
61+
* glib::ParamSpecString::builder("call_extension").build(),
62+
* TODO: these are from property class
63+
* glib::ParamSpecBoxed::builder("processor").build(),
64+
* glib::ParamSpecObject::builder("formatter").build(),
65+
*/
66+
fn properties() -> &'static [ParamSpec] {
67+
static PROPERTIES: Lazy<Vec<ParamSpec>> = Lazy::new(|| {
68+
vec![
69+
//
70+
]
71+
});
72+
73+
//println!("PROPERTIES: {:?}", PROPERTIES);//TEST
74+
//println!("trying to add `base_call`: {:?}", glib::ParamSpecString::builder("base_call").build());//TEST
75+
76+
PROPERTIES.as_ref()
77+
}
78+
79+
/**
80+
* Name:
81+
* set_property
82+
*
83+
* Description:
84+
* Mutator for custom GObject properties
85+
*
86+
* Made:
87+
* 05/10/2022
88+
*
89+
* Made by:
90+
* Deren Vural
91+
*
92+
* Notes:
93+
*
94+
*/
95+
fn set_property(&self, _obj: &Self::Type, _id: usize, _value: &Value, pspec: &ParamSpec) {
96+
//println!("setting: {:?}", pspec.name());//TEST
97+
98+
match pspec.name() {
99+
//
100+
_ => panic!("Property `{}` does not exist..", pspec.name())
101+
}
102+
}
103+
104+
/**
105+
* Name:
106+
* property
107+
*
108+
* Description:
109+
* Accessir for custom GObject properties
110+
*
111+
* Made:
112+
* 05/10/2022
113+
*
114+
* Made by:
115+
* Deren Vural
116+
*
117+
* Notes:
118+
*
119+
*/
120+
fn property(&self, _obj: &Self::Type, _id: usize, pspec: &ParamSpec) -> Value {
121+
//println!("getting: {:?}", pspec.name());//TEST
122+
123+
match pspec.name() {
124+
//
125+
_ => panic!("Property `{}` does not exist..", pspec.name())
126+
}
127+
}
128+
}
41129

42130
// Trait shared by all widgets
43131
impl WidgetImpl for CustomButton {}

src/formatter/imp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ impl ObjectImpl for Formatter {
115115

116116
match pspec.name() {
117117
//
118-
_ => unimplemented!(), //TODO
118+
_ => panic!("Property `{}` does not exist..", pspec.name())
119119
}
120120
}
121121

@@ -140,7 +140,7 @@ impl ObjectImpl for Formatter {
140140

141141
match pspec.name() {
142142
//
143-
_ => unimplemented!(), //TODO
143+
_ => panic!("Property `{}` does not exist..", pspec.name())
144144
}
145145
}
146146
}

0 commit comments

Comments
 (0)