Skip to content

Commit

Permalink
now runs commands from other categories than apps
Browse files Browse the repository at this point in the history
  • Loading branch information
alexou2 committed May 12, 2023
1 parent d35fcc8 commit fae1cff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 22 deletions.
11 changes: 8 additions & 3 deletions src/gui_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Box>() {

let app_list = boxy.clone();

for i in &app_list.observe_children() {
if let Some(check_button) = i.expect("ll").downcast_ref::<CheckButton>() {
Expand All @@ -138,7 +143,7 @@ pub fn build_ui(app: &Application) {
// utils::run_command(command.as_str());
// run_cmd(command);
}
}
}}}
}
}));
// adds the list of buttons
Expand Down
20 changes: 1 addition & 19 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -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! {
Expand Down Expand Up @@ -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
}



}

0 comments on commit fae1cff

Please sign in to comment.