🧹 cleanup
This commit is contained in:
parent
8f96023bb6
commit
de0a7425c7
15
src/main.rs
15
src/main.rs
|
@ -170,6 +170,7 @@ fn build_ui(application: >k::Application) {
|
||||||
"on_action_clicked" => Box::new(on_action_clicked),
|
"on_action_clicked" => Box::new(on_action_clicked),
|
||||||
"on_btn_clicked" => Box::new(on_btn_clicked),
|
"on_btn_clicked" => Box::new(on_btn_clicked),
|
||||||
"on_link_clicked" => Box::new(on_link_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),
|
"on_delete_window" => Box::new(on_delete_window),
|
||||||
_ => Box::new(|_| None),
|
_ => Box::new(|_| None),
|
||||||
}
|
}
|
||||||
|
@ -520,6 +521,20 @@ fn on_link_clicked(param: &[glib::Value]) -> Option<glib::Value> {
|
||||||
None
|
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> {
|
fn on_delete_window(_param: &[glib::Value]) -> Option<glib::Value> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let preferences = &g_hello_window.clone().unwrap().preferences["save_path"];
|
let preferences = &g_hello_window.clone().unwrap().preferences["save_path"];
|
||||||
|
|
|
@ -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="name">telegram</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</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>
|
<child>
|
||||||
<object class="GtkImage" id="telegram">
|
<object class="GtkImage" id="telegram">
|
||||||
<property name="visible">True</property>
|
<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="name">discord</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</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>
|
<child>
|
||||||
<object class="GtkImage" id="discord">
|
<object class="GtkImage" id="discord">
|
||||||
<property name="visible">True</property>
|
<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="name">reddit</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</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>
|
<child>
|
||||||
<object class="GtkImage" id="reddit">
|
<object class="GtkImage" id="reddit">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
Loading…
Reference in New Issue