🧹 cleanup

This commit is contained in:
Vladislav Nepogodin 2022-09-11 03:09:54 +04:00
parent 8f96023bb6
commit de0a7425c7
No known key found for this signature in database
GPG Key ID: B62C3D10C54D5DA9
2 changed files with 18 additions and 3 deletions

View File

@ -170,6 +170,7 @@ fn build_ui(application: &gtk::Application) {
"on_action_clicked" => Box::new(on_action_clicked),
"on_btn_clicked" => Box::new(on_btn_clicked),
"on_link_clicked" => Box::new(on_link_clicked),
"on_link1_clicked" => Box::new(on_link1_clicked),
"on_delete_window" => Box::new(on_delete_window),
_ => Box::new(|_| None),
}
@ -520,6 +521,20 @@ fn on_link_clicked(param: &[glib::Value]) -> Option<glib::Value> {
None
}
fn on_link1_clicked(param: &[glib::Value]) -> Option<glib::Value> {
let widget = param[0].get::<gtk::Widget>().unwrap();
let name = widget.widget_name();
unsafe {
let preferences = &g_hello_window.clone().unwrap().preferences["urls"];
let uri = preferences[name.as_str()].as_str().unwrap();
let _ = gtk::show_uri_on_window(gtk::Window::NONE, uri, 0);
}
Some(false.to_value())
}
fn on_delete_window(_param: &[glib::Value]) -> Option<glib::Value> {
unsafe {
let preferences = &g_hello_window.clone().unwrap().preferences["save_path"];

View File

@ -476,7 +476,7 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we
<property name="name">telegram</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<signal name="button-press-event" handler="on_link_clicked" swapped="no"/>
<signal name="button-press-event" handler="on_link1_clicked" swapped="no"/>
<child>
<object class="GtkImage" id="telegram">
<property name="visible">True</property>
@ -496,7 +496,7 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we
<property name="name">discord</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<signal name="button-press-event" handler="on_link_clicked" swapped="no"/>
<signal name="button-press-event" handler="on_link1_clicked" swapped="no"/>
<child>
<object class="GtkImage" id="discord">
<property name="visible">True</property>
@ -516,7 +516,7 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we
<property name="name">reddit</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<signal name="button-press-event" handler="on_link_clicked" swapped="no"/>
<signal name="button-press-event" handler="on_link1_clicked" swapped="no"/>
<child>
<object class="GtkImage" id="reddit">
<property name="visible">True</property>