finally complete
This commit is contained in:
parent
104bbbc25d
commit
9873bb8957
50
src/lib.rs
50
src/lib.rs
|
|
@ -75,8 +75,8 @@ pub fn build_ui(app: >k::Application, config: Arc::<Mutex::<Config>>) {
|
||||||
let about_window = builder.get_object::<gtk::AboutDialog>("about_window").expect("Resource file missing!");
|
let about_window = builder.get_object::<gtk::AboutDialog>("about_window").expect("Resource file missing!");
|
||||||
about_window.set_transient_for(Some(&win));
|
about_window.set_transient_for(Some(&win));
|
||||||
|
|
||||||
about_window.connect_delete_event(|a,_| {
|
about_window.connect_delete_event(|win,_| {
|
||||||
a.hide();
|
win.hide();
|
||||||
Inhibit(true)
|
Inhibit(true)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -87,12 +87,48 @@ pub fn build_ui(app: >k::Application, config: Arc::<Mutex::<Config>>) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// save_log
|
// save_log
|
||||||
// let save_log = builder.get_object::<gtk::MenuItem>("save_log").expect("Resource file missing!");
|
let save_menu = builder.get_object::<gtk::MenuItem>("save_menu").expect("Resource file missing!");
|
||||||
|
|
||||||
// let tmp_log_area = log_area.clone();
|
let save_window = builder.get_object::<gtk::FileChooserDialog>("save_window").expect("Resource file missing!");
|
||||||
// save_log.connect_activate(move |_|{
|
save_window.set_transient_for(Some(&win));
|
||||||
|
save_window.set_action(gtk::FileChooserAction::Save);
|
||||||
// });
|
|
||||||
|
save_window.connect_delete_event(|win,_| {
|
||||||
|
win.hide();
|
||||||
|
Inhibit(true)
|
||||||
|
});
|
||||||
|
|
||||||
|
save_window.add_button("_Save", gtk::ResponseType::Apply);
|
||||||
|
save_window.add_button("_Cancel", gtk::ResponseType::Cancel);
|
||||||
|
|
||||||
|
let tmp_log_area = log_area.clone();
|
||||||
|
let tmp_bar = bar.clone();
|
||||||
|
save_window.connect_response(move |win, res| {
|
||||||
|
match res {
|
||||||
|
gtk::ResponseType::Cancel => win.hide(),
|
||||||
|
gtk::ResponseType::Apply => {
|
||||||
|
if let Some(path) = win.get_filename() {
|
||||||
|
if let Some(buf) = tmp_log_area.get_buffer() {
|
||||||
|
let text = buf.get_text(&buf.get_start_iter(), &buf.get_end_iter(), false).unwrap().to_string();
|
||||||
|
|
||||||
|
match std::fs::write(path, text) {
|
||||||
|
Ok(_) => {
|
||||||
|
win.hide();
|
||||||
|
},
|
||||||
|
Err(_) => {
|
||||||
|
tmp_bar.push(1, "Failed to save!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_ => ()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
save_menu.connect_activate(move |_|{
|
||||||
|
save_window.show();
|
||||||
|
});
|
||||||
|
|
||||||
// pankti
|
// pankti
|
||||||
let pankti = builder.get_object::<gtk::SpinButton>("pankti").expect("Resource file missing!");
|
let pankti = builder.get_object::<gtk::SpinButton>("pankti").expect("Resource file missing!");
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,6 @@
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child type="titlebar">
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkImage" id="document_save">
|
<object class="GtkImage" id="document_save">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
@ -52,6 +49,38 @@
|
||||||
<property name="step-increment">0.5</property>
|
<property name="step-increment">0.5</property>
|
||||||
<property name="page-increment">10</property>
|
<property name="page-increment">10</property>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="GtkFileChooserDialog" id="save_window">
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="type-hint">dialog</property>
|
||||||
|
<property name="action">select-folder</property>
|
||||||
|
<child internal-child="vbox">
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="spacing">2</property>
|
||||||
|
<child internal-child="action_area">
|
||||||
|
<object class="GtkButtonBox">
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="layout-style">end</property>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
<object class="GtkImage" id="send_image">
|
<object class="GtkImage" id="send_image">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<!-- Generated with glade 3.38.2 -->
|
<!-- Generated with glade 3.38.2 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.22"/>
|
<requires lib="gtk+" version="3.22"/>
|
||||||
<object class="GtkAboutDialog" id="about">
|
<object class="GtkAboutDialog" id="about_window">
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="type-hint">dialog</property>
|
<property name="type-hint">dialog</property>
|
||||||
<property name="program-name">Tarangam (तरंगम्)</property>
|
<property name="program-name">Tarangam (तरंगम्)</property>
|
||||||
|
|
@ -36,9 +36,6 @@
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child type="titlebar">
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkImage" id="document_save">
|
<object class="GtkImage" id="document_save">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
@ -52,6 +49,38 @@
|
||||||
<property name="step-increment">0.5</property>
|
<property name="step-increment">0.5</property>
|
||||||
<property name="page-increment">10</property>
|
<property name="page-increment">10</property>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="GtkFileChooserDialog" id="save_window">
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="type-hint">dialog</property>
|
||||||
|
<property name="action">select-folder</property>
|
||||||
|
<child internal-child="vbox">
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="spacing">2</property>
|
||||||
|
<child internal-child="action_area">
|
||||||
|
<object class="GtkButtonBox">
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="layout-style">end</property>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
<object class="GtkImage" id="send_image">
|
<object class="GtkImage" id="send_image">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue