LAview Core API fixed: null-returns replaced with exceptions.
This commit is contained in:
parent
c1a53e8cba
commit
02d7d47daa
|
@ -162,11 +162,18 @@ namespace LAview.Desktop {
|
||||||
}
|
}
|
||||||
|
|
||||||
void compose_object () {
|
void compose_object () {
|
||||||
var t_indices = get_template_indices ();
|
try {
|
||||||
var o_indices = get_objects_indices ();
|
var t_indices = get_template_indices ();
|
||||||
if (t_indices.length != 0 && o_indices.length != 0)
|
var o_indices = get_objects_indices ();
|
||||||
AppCore.core.compose_object (t_indices[0], o_indices[0]);
|
if (t_indices.length != 0 && o_indices.length != 0)
|
||||||
statusbar_show (_("After composing all objects print the document."));
|
AppCore.core.compose_object (t_indices[0], o_indices[0]);
|
||||||
|
statusbar_show (_("After composing all objects print the document."));
|
||||||
|
} catch (Error err) {
|
||||||
|
var msg = new MessageDialog (window, DialogFlags.MODAL, MessageType.ERROR,
|
||||||
|
ButtonsType.CLOSE, _("Error")+@": $(err.message).");
|
||||||
|
msg.response.connect ((response_id) => { msg.destroy (); } );
|
||||||
|
msg.show ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[CCode (instance_pos = -1)]
|
[CCode (instance_pos = -1)]
|
||||||
|
@ -183,18 +190,30 @@ namespace LAview.Desktop {
|
||||||
|
|
||||||
[CCode (instance_pos = -1)]
|
[CCode (instance_pos = -1)]
|
||||||
public void action_edit_result_activate (Gtk.Action action) {
|
public void action_edit_result_activate (Gtk.Action action) {
|
||||||
var indices = get_template_indices();
|
try {
|
||||||
if (indices.length != 0) {
|
var indices = get_template_indices();
|
||||||
var lyx_path = AppCore.core.get_lyx_file_path (indices[0]);
|
if (indices.length != 0) {
|
||||||
edit_lyx_files ({ lyx_path });
|
var lyx_path = AppCore.core.get_lyx_file_path (indices[0]);
|
||||||
|
edit_lyx_files ({ lyx_path });
|
||||||
|
}
|
||||||
|
} catch (Error err) {
|
||||||
|
var msg = new MessageDialog (window, DialogFlags.MODAL, MessageType.ERROR,
|
||||||
|
ButtonsType.CLOSE, _("Error")+@": $(err.message).");
|
||||||
|
msg.response.connect ((response_id) => { msg.destroy (); } );
|
||||||
|
msg.show ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void post_print () {
|
void post_print () {
|
||||||
var indices = get_template_indices();
|
try {
|
||||||
var pdf_file = AppCore.core.get_pdf_file_path (indices[0]);
|
var indices = get_template_indices();
|
||||||
if (pdf_file != null && pdf_file != "")
|
Utils.open_document (AppCore.core.get_pdf_file_path (indices[0]), window);
|
||||||
Utils.open_document (pdf_file, window);
|
} catch (Error err) {
|
||||||
|
var msg = new MessageDialog (window, DialogFlags.MODAL, MessageType.ERROR,
|
||||||
|
ButtonsType.CLOSE, _("Error")+@": $(err.message).");
|
||||||
|
msg.response.connect ((response_id) => { msg.destroy (); } );
|
||||||
|
msg.show ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[CCode (instance_pos = -1)]
|
[CCode (instance_pos = -1)]
|
||||||
|
@ -281,8 +300,10 @@ namespace LAview.Desktop {
|
||||||
public void action_saveas_activate (Gtk.Action action) {
|
public void action_saveas_activate (Gtk.Action action) {
|
||||||
var indices = get_template_indices ();
|
var indices = get_template_indices ();
|
||||||
if (indices.length == 0) return;
|
if (indices.length == 0) return;
|
||||||
var tmp_pdf = AppCore.core.get_pdf_file_path (indices[0]);
|
string tmp_pdf = "";
|
||||||
if (tmp_pdf == null || tmp_pdf == "") {
|
try {
|
||||||
|
tmp_pdf = AppCore.core.get_pdf_file_path (indices[0]);
|
||||||
|
} catch (Error err) {
|
||||||
statusbar_show (_("Prepare the document first! >;-]"));
|
statusbar_show (_("Prepare the document first! >;-]"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue