Skip to content

Commit 2b64146

Browse files
authored
Merge pull request #13 from derenv/mainwindow_cleanup
Mainwindow cleanup
2 parents 7330d4a + 1c790cb commit 2b64146

File tree

4 files changed

+66
-63
lines changed

4 files changed

+66
-63
lines changed

src/mainwindow/imp.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,11 +487,8 @@ impl MainWindow {
487487
// Update GPU list
488488
match existing_provider.get_gpu_uuids() {
489489
Ok(gpu_uuids) => {
490-
// Get GPU list
491-
let gpu_count: i32 = gpu_uuids.len() as i32;
492-
493490
// Update each property
494-
match existing_provider.update_property_value::<i32>("gpu-count", gpu_count) {
491+
match existing_provider.update_property_value::<i32>("gpu-count", gpu_uuids.len() as i32) {
495492
Ok(_) => {
496493
// Construct a row for each GPU
497494
for uuid in gpu_uuids {

src/mainwindow/mod.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,25 @@ impl MainWindow {
140140
*
141141
*/
142142
fn setup_widgets(&self) {
143+
// Check if list of GPU's done
144+
//if done
145+
// // Create pages
146+
// //
143147
//
148+
// // Grab GtkBox with id `right`
149+
// //
150+
//
151+
// // Add pages to `right`
152+
// //
153+
//else
154+
// // Create default page
155+
// //
156+
//
157+
// // Grab GtkBox with id `right`
158+
// //
159+
//
160+
// // Add default page to `right`
161+
// //
144162
}
145163

146164
/**

src/property/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl Property {
155155
* Notes:
156156
*
157157
*/
158-
pub fn get_value<T: for<'b> FromValue<'b> + 'static>(&self, name: &str) -> T {
158+
pub fn get_value<T: for<'a> FromValue<'a> + 'static>(&self, name: &str) -> T {
159159
// Return the value of the property
160160
self.property::<T>(name)
161161
}

src/resources/main-window.ui

Lines changed: 46 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
3232
<template class="NvidiaExtensionMainWindow" parent="GtkApplicationWindow">
3333
<!-- Properties -->
3434
<property name="title" translatable="yes">Nvidia App</property>
35-
<property name="width-request">360</property>
3635

3736
<!-- Children -->
3837
<child type="titlebar">
@@ -67,35 +66,38 @@ SPDX-License-Identifier: GPL-3.0-or-later
6766
<!-- Properties -->
6867
<property name="hscrollbar-policy">never</property>
6968
<property name="min-content-height">750</property>
69+
<property name="min-content-width">500</property>
7070
<property name="vexpand">True</property>
71+
<property name="hexpand">True</property>
7172

7273
<!-- Children -->
7374
<property name="child">
7475
<object class="AdwClamp">
7576
<property name="child">
7677
<object class="AdwLeaflet">
7778
<!-- Properties -->
78-
<property name="orientation">horizontal</property>
79-
<property name="margin-top">12</property>
80-
<property name="margin-bottom">12</property>
81-
<property name="margin-start">12</property>
82-
<property name="margin-end">12</property>
83-
<property name="vexpand">True</property>
84-
<property name="hexpand">True</property>
79+
<property name="transition-type">slide</property>
80+
<property name="visible-child">content</property>
8581

8682
<!-- Content -->
8783
<!-- Children -->
8884
<child>
89-
<object class="GtkBox">
85+
<object class="GtkBox" id="sidebar">
9086
<!-- Properties -->
9187
<property name="orientation">vertical</property>
88+
89+
<property name="vexpand">True</property>
90+
<property name="hexpand">True</property>
91+
<property name="halign">fill</property>
92+
<!--
93+
<property name="width-request">250</property>
94+
-->
95+
9296
<property name="margin-top">12</property>
9397
<property name="margin-bottom">12</property>
9498
<property name="margin-start">12</property>
9599
<property name="margin-end">12</property>
96100
<property name="spacing">12</property>
97-
<property name="vexpand">True</property>
98-
<property name="hexpand">True</property>
99101

100102
<!-- Children -->
101103
<child>
@@ -107,44 +109,16 @@ SPDX-License-Identifier: GPL-3.0-or-later
107109
<!-- Children -->
108110
<child>
109111
<object class="GtkListBox" id="cards_list">
112+
<!-- Properties -->
110113
<property name="show-separators">True</property>
114+
115+
<!-- Signals -->
111116
<signal name="row_activated" handler="card_selected" swapped="true"/>
112-
<!-- Properties -->
113-
<!--
114-
<property name="valign">start</property>
115-
<property name="visible">False</property>
116-
<property name="selection-mode">none</property>
117-
-->
117+
118118
<!-- Style Info -->
119119
<style>
120120
<class name="boxed-list" />
121121
</style>
122-
123-
<!-- Children - ->
124-
<child>
125-
<object class="AdwActionRow">
126-
<!- - Properties - ->
127-
<property name="title">Card 1</property>
128-
<property name="subtitle">Nvidia 9090 Ti</property>
129-
<property name="activatable">true</property>
130-
<property name="selectable">true</property>
131-
<!- - Signals - ->
132-
<signal name="activated" handler="card_selected"/>
133-
</object>
134-
</child>
135-
<child>
136-
<object class="AdwActionRow">
137-
<!- - Properties - ->
138-
<property name="title">Card 2</property>
139-
<property name="subtitle">Nvidia Infinity and Beyond</property>
140-
<property name="activatable">true</property>
141-
<property name="selectable">true</property>
142-
143-
<signal name="activated" handler="card_selected"/>
144-
</object>
145-
</child>
146-
<!- - -->
147-
148122
</object>
149123
</child>
150124

@@ -154,8 +128,9 @@ SPDX-License-Identifier: GPL-3.0-or-later
154128
<child>
155129
<object class="NvidiaMonitorRustCustomButton" id="refresh_button">
156130
<!-- Properties -->
157-
<property name="label">Refresh</property>
131+
<property name="label">Scan for GPUs</property>
158132

133+
<!-- Signals -->
159134
<signal name="clicked" handler="refresh_cards" swapped="true"/>
160135
</object>
161136
</child>
@@ -171,32 +146,45 @@ SPDX-License-Identifier: GPL-3.0-or-later
171146
</child>
172147

173148
<child>
174-
<object class="GtkBox">
149+
<object class="GtkBox" id="content">
175150
<!-- Properties -->
176151
<property name="orientation">vertical</property>
152+
<property name="vexpand">True</property>
153+
<property name="hexpand">True</property>
154+
<!--
155+
<property name="halign">fill</property>
156+
<property name="width-request">500</property>
157+
-->
158+
177159
<property name="margin-top">12</property>
178160
<property name="margin-bottom">12</property>
179161
<property name="margin-start">12</property>
180162
<property name="margin-end">12</property>
181163
<property name="spacing">12</property>
182-
<property name="vexpand">True</property>
183-
<property name="hexpand">True</property>
184164

185-
<!-- Children -->
186165
<child>
187-
<object class="GtkButton">
188-
<property name="label">This should be in the right hand pane</property>
189-
</object>
190-
</child>
166+
<object class="GtkScrolledWindow">
167+
<!-- Properties -->
168+
<property name="vexpand">True</property>
169+
<property name="hexpand">True</property>
191170

192-
<!--
193-
<child>
194-
<object class="GtkEntry" id="entry">
195-
<property name="placeholder-text" translatable="yes">Enter a Task…</property>
196-
<property name="secondary-icon-name">list-add-symbolic</property>
171+
<!-- Children -->
172+
<child>
173+
<object class="GtkButton">
174+
<property name="label">This should be in the right hand pane</property>
175+
</object>
176+
</child>
177+
178+
<!--
179+
<child>
180+
<object class="GtkEntry" id="entry">
181+
<property name="placeholder-text" translatable="yes">Enter a Task…</property>
182+
<property name="secondary-icon-name">list-add-symbolic</property>
183+
</object>
184+
</child>
185+
-->
197186
</object>
198187
</child>
199-
-->
200188

201189
</object>
202190
</child>

0 commit comments

Comments
 (0)