Skip to content

Commit 4f29106

Browse files
author
Deren Vural
committed
Updated mainwindow class
- simplified settings loading - added about menu option with todo print statement as is unfinished Signed-off-by: Deren Vural <[email protected]>
1 parent c5bdd73 commit 4f29106

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

src/mainwindow/imp.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
use adwaita::{gio, glib, prelude::*, subclass::prelude::*};
2323
use gio::Settings;
2424
use glib::{
25-
once_cell::sync::Lazy, once_cell::sync::OnceCell, signal::Inhibit,
26-
subclass::InitializingObject, ParamSpec, Value,
25+
once_cell::sync::OnceCell, signal::Inhibit,
26+
subclass::InitializingObject,
2727
};
2828
use gtk::{subclass::prelude::*, CompositeTemplate}; //, Entry, ListBox, TemplateChild};
2929
use std::{cell::Cell, cell::RefCell, rc::Rc};
@@ -155,14 +155,11 @@ impl WindowImpl for MainWindow {
155155
.expect("Could not write data to json file");
156156
157157
*/
158-
// Set app-settings state in settings
158+
// Set state in settings
159159
let settings: &Settings = window.settings();
160160
settings
161161
.set_boolean("app-settings-open", false)
162162
.expect("Could not set setting.");
163-
164-
// Set nvidia-settings state in settings
165-
let settings: &Settings = window.settings();
166163
settings
167164
.set_boolean("nvidia-settings-open", false)
168165
.expect("Could not set setting.");

src/mainwindow/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ impl MainWindow {
612612

613613
// Check if an object is stored
614614
match &settings_window_container.window {
615-
Some(window) => {
615+
Some(_window) => {
616616
println!("..window exists");//DEBUG
617617

618618
// Check if the window is already open
@@ -662,6 +662,13 @@ impl MainWindow {
662662
}));
663663
self.add_action(&open_app_settings);
664664

665+
let about: SimpleAction = SimpleAction::new("about", None);
666+
about.connect_activate(clone!(@weak self as window => move |_, _| {
667+
// Show About info pop-up
668+
println!("About pop-up not yet implemented..");//TODO
669+
}));
670+
self.add_action(&about);
671+
665672
/*
666673
// Create action from key "filter" and add to action group "win"
667674
let action_filter = self.settings().create_action("filter");

src/resources/main-window.ui

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ SPDX-License-Identifier: GPL-3.0-or-later
3434
<attribute name="label" translatable="yes">Test Providers</attribute>
3535
<attribute name="action">win.providers</attribute>
3636
</item>
37+
<item>
38+
<attribute name="label" translatable="yes">About</attribute>
39+
<attribute name="action">win.about</attribute>
40+
</item>
3741
</menu>
3842

3943
<!-- Header Implementation (implements main-menu) -->
@@ -71,6 +75,9 @@ SPDX-License-Identifier: GPL-3.0-or-later
7175
<!-- Content Implementation -->
7276
<child>
7377
<!--
78+
<object class="GtkLabel" id="temp">
79+
</object>
80+
7481
<object class="GtkEntry" id="entry">
7582
<property name="placeholder-text" translatable="yes">Enter a Task…</property>
7683
<property name="secondary-icon-name">list-add-symbolic</property>

0 commit comments

Comments
 (0)