diff --git a/src/main.rs b/src/main.rs index b782520..0204643 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,7 +30,7 @@ fn main() { } fn display(app: &Application) { - let builder = gtk::Builder::from_file("ui.glade"); + let builder = gtk::Builder::from_file(find_ui_file()); let win = builder.get_object::("win").expect("Resource file missing!"); win.set_application(Some(app)); @@ -57,3 +57,12 @@ fn display(app: &Application) { } }); } + +fn find_ui_file() -> String{ + let ui_file = std::env::var("RANG_UI_FILE"); + match ui_file { + Ok(val) => val, + Err(_) => std::env::current_exe().unwrap().parent().unwrap() + .join("ui.glade").to_str().unwrap().to_owned() + } +} diff --git a/ui.glade b/ui.glade index 2fc8b47..5e19b25 100644 --- a/ui.glade +++ b/ui.glade @@ -7,7 +7,7 @@ dialog Rang Color Chooser - PiyushXCoder (https://gitlab.com/PiyushXCoder) + https://gitlab.com/PiyushXCoder gtk-select-color gpl-3-0 diff --git a/ui.glade~ b/ui.glade~ index 2fc8b47..5e19b25 100644 --- a/ui.glade~ +++ b/ui.glade~ @@ -7,7 +7,7 @@ dialog Rang Color Chooser - PiyushXCoder (https://gitlab.com/PiyushXCoder) + https://gitlab.com/PiyushXCoder gtk-select-color gpl-3-0