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 () {
|
||||
var t_indices = get_template_indices ();
|
||||
var o_indices = get_objects_indices ();
|
||||
if (t_indices.length != 0 && o_indices.length != 0)
|
||||
AppCore.core.compose_object (t_indices[0], o_indices[0]);
|
||||
statusbar_show (_("After composing all objects print the document."));
|
||||
try {
|
||||
var t_indices = get_template_indices ();
|
||||
var o_indices = get_objects_indices ();
|
||||
if (t_indices.length != 0 && o_indices.length != 0)
|
||||
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)]
|
||||
|
@ -183,18 +190,30 @@ namespace LAview.Desktop {
|
|||
|
||||
[CCode (instance_pos = -1)]
|
||||
public void action_edit_result_activate (Gtk.Action action) {
|
||||
var indices = get_template_indices();
|
||||
if (indices.length != 0) {
|
||||
var lyx_path = AppCore.core.get_lyx_file_path (indices[0]);
|
||||
edit_lyx_files ({ lyx_path });
|
||||
try {
|
||||
var indices = get_template_indices();
|
||||
if (indices.length != 0) {
|
||||
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 () {
|
||||
var indices = get_template_indices();
|
||||
var pdf_file = AppCore.core.get_pdf_file_path (indices[0]);
|
||||
if (pdf_file != null && pdf_file != "")
|
||||
Utils.open_document (pdf_file, window);
|
||||
try {
|
||||
var indices = get_template_indices();
|
||||
Utils.open_document (AppCore.core.get_pdf_file_path (indices[0]), 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)]
|
||||
|
@ -281,8 +300,10 @@ namespace LAview.Desktop {
|
|||
public void action_saveas_activate (Gtk.Action action) {
|
||||
var indices = get_template_indices ();
|
||||
if (indices.length == 0) return;
|
||||
var tmp_pdf = AppCore.core.get_pdf_file_path (indices[0]);
|
||||
if (tmp_pdf == null || tmp_pdf == "") {
|
||||
string tmp_pdf = "";
|
||||
try {
|
||||
tmp_pdf = AppCore.core.get_pdf_file_path (indices[0]);
|
||||
} catch (Error err) {
|
||||
statusbar_show (_("Prepare the document first! >;-]"));
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue