From fae1cffde71a257e991e7ec68adb65e6cd3611e7 Mon Sep 17 00:00:00 2001 From: alexou2 Date: Fri, 12 May 2023 11:50:30 -0400 Subject: [PATCH] now runs commands from other categories than apps --- src/gui_app.rs | 11 ++++++++--- src/main.rs | 20 +------------------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/gui_app.rs b/src/gui_app.rs index 4b991a2..2dbee2f 100644 --- a/src/gui_app.rs +++ b/src/gui_app.rs @@ -121,8 +121,13 @@ pub fn build_ui(app: &Application) { } )); // button action - submit_button.connect_clicked(clone!(@weak app_list => move |_| { - let app_list = app_list.clone(); + submit_button.connect_clicked(clone!(@weak app_list, @weak content => move |_| { + let content = content.clone(); + + for tab in &content.observe_children() { + if let Some(boxy) = tab.expect("ll").downcast_ref::() { + + let app_list = boxy.clone(); for i in &app_list.observe_children() { if let Some(check_button) = i.expect("ll").downcast_ref::() { @@ -138,7 +143,7 @@ pub fn build_ui(app: &Application) { // utils::run_command(command.as_str()); // run_cmd(command); } - } + }}} } })); // adds the list of buttons diff --git a/src/main.rs b/src/main.rs index bf2100b..7f3d071 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,21 +1,8 @@ -use glib::clone; -use gtk::gdk::Display; -use gtk::glib; use gtk::prelude::*; -use gtk::traits::{ButtonExt, GtkWindowExt, WidgetExt}; -use gtk::{ - Application, ApplicationWindow, Box, Button, CheckButton, CssProvider, DropDown, Entry, Label, - Orientation, StyleContext, STYLE_PROVIDER_PRIORITY_APPLICATION, -}; -use json::print_json; -use lazy_static::lazy_static; -use std::str::FromStr; -use std::sync::Mutex; mod apps; mod json; mod utils; -use serde_json::Value; // the list of commands that will be executed // lazy_static! { @@ -89,12 +76,7 @@ fn main() { // Run the application // app.run(); - // utils::convert_to_struct() app.connect_activate(gui_app::build_ui); - // json::find_element("ls -a"); app.run(); // runs the window -} - - - +} \ No newline at end of file