Merge branch '#97_save_as' into develop

This commit is contained in:
Kolan Sh 2016-01-24 03:08:07 +03:00
commit 40e3471008
5 changed files with 211 additions and 21 deletions

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: laview-desktop\n" "Project-Id-Version: laview-desktop\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-24 02:51+0300\n" "POT-Creation-Date: 2016-01-24 02:59+0300\n"
"PO-Revision-Date: 2015-10-24 20:19+0300\n" "PO-Revision-Date: 2015-10-24 20:19+0300\n"
"Last-Translator: <backbone@backbone.ws>\n" "Last-Translator: <backbone@backbone.ws>\n"
"Language-Team: German\n" "Language-Team: German\n"
@ -50,7 +50,7 @@ msgid "We're ready, Commander! Select or create a template. :-)"
msgstr "" msgstr ""
#: src/MainWindow.vala:76 src/MainWindow.vala:120 src/MainWindow.vala:194 #: src/MainWindow.vala:76 src/MainWindow.vala:120 src/MainWindow.vala:194
#: src/MainWindow.vala:212 #: src/MainWindow.vala:212 src/MainWindow.vala:302
msgid "Error" msgid "Error"
msgstr "" msgstr ""
@ -58,7 +58,7 @@ msgstr ""
msgid "Select templates" msgid "Select templates"
msgstr "" msgstr ""
#: src/MainWindow.vala:86 #: src/MainWindow.vala:86 src/MainWindow.vala:268
msgid "_Cancel" msgid "_Cancel"
msgstr "" msgstr ""
@ -78,6 +78,30 @@ msgstr ""
msgid "Press 'Properties' button to compose the object." msgid "Press 'Properties' button to compose the object."
msgstr "" msgstr ""
#: src/MainWindow.vala:262
msgid "Prepare the document first! >;-]"
msgstr ""
#: src/MainWindow.vala:266
msgid "Select destination"
msgstr ""
#: src/MainWindow.vala:269
msgid "_Save"
msgstr ""
#: src/MainWindow.vala:297
msgid "bytes copied/saved"
msgstr ""
#: src/MainWindow.vala:297
msgid "bytes of"
msgstr ""
#: src/MainWindow.vala:299
msgid "Save/Copy operation complete! :-)"
msgstr ""
#: src/main.vala:33 #: src/main.vala:33
msgid "Show the application's version" msgid "Show the application's version"
msgstr "" msgstr ""
@ -197,21 +221,25 @@ msgid "Edit the result document"
msgstr "" msgstr ""
#: ui/glade/laview-desktop.glade.h:26 #: ui/glade/laview-desktop.glade.h:26
msgid "Application preferences" msgid "Save the document as..."
msgstr "" msgstr ""
#: ui/glade/laview-desktop.glade.h:27 #: ui/glade/laview-desktop.glade.h:27
msgid "Help and reference" msgid "Application preferences"
msgstr "" msgstr ""
#: ui/glade/laview-desktop.glade.h:28 #: ui/glade/laview-desktop.glade.h:28
msgid "Close the application" msgid "Help and reference"
msgstr "" msgstr ""
#: ui/glade/laview-desktop.glade.h:29 #: ui/glade/laview-desktop.glade.h:29
msgid "Templates" msgid "Close the application"
msgstr "" msgstr ""
#: ui/glade/laview-desktop.glade.h:30 #: ui/glade/laview-desktop.glade.h:30
msgid "Templates"
msgstr ""
#: ui/glade/laview-desktop.glade.h:31
msgid "Document Objects" msgid "Document Objects"
msgstr "" msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: laview-desktop\n" "Project-Id-Version: laview-desktop\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-24 02:51+0300\n" "POT-Creation-Date: 2016-01-24 02:59+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -50,7 +50,7 @@ msgid "We're ready, Commander! Select or create a template. :-)"
msgstr "" msgstr ""
#: src/MainWindow.vala:76 src/MainWindow.vala:120 src/MainWindow.vala:194 #: src/MainWindow.vala:76 src/MainWindow.vala:120 src/MainWindow.vala:194
#: src/MainWindow.vala:212 #: src/MainWindow.vala:212 src/MainWindow.vala:302
msgid "Error" msgid "Error"
msgstr "" msgstr ""
@ -58,7 +58,7 @@ msgstr ""
msgid "Select templates" msgid "Select templates"
msgstr "" msgstr ""
#: src/MainWindow.vala:86 #: src/MainWindow.vala:86 src/MainWindow.vala:268
msgid "_Cancel" msgid "_Cancel"
msgstr "" msgstr ""
@ -78,6 +78,30 @@ msgstr ""
msgid "Press 'Properties' button to compose the object." msgid "Press 'Properties' button to compose the object."
msgstr "" msgstr ""
#: src/MainWindow.vala:262
msgid "Prepare the document first! >;-]"
msgstr ""
#: src/MainWindow.vala:266
msgid "Select destination"
msgstr ""
#: src/MainWindow.vala:269
msgid "_Save"
msgstr ""
#: src/MainWindow.vala:297
msgid "bytes copied/saved"
msgstr ""
#: src/MainWindow.vala:297
msgid "bytes of"
msgstr ""
#: src/MainWindow.vala:299
msgid "Save/Copy operation complete! :-)"
msgstr ""
#: src/main.vala:33 #: src/main.vala:33
msgid "Show the application's version" msgid "Show the application's version"
msgstr "" msgstr ""
@ -197,21 +221,25 @@ msgid "Edit the result document"
msgstr "" msgstr ""
#: ui/glade/laview-desktop.glade.h:26 #: ui/glade/laview-desktop.glade.h:26
msgid "Application preferences" msgid "Save the document as..."
msgstr "" msgstr ""
#: ui/glade/laview-desktop.glade.h:27 #: ui/glade/laview-desktop.glade.h:27
msgid "Help and reference" msgid "Application preferences"
msgstr "" msgstr ""
#: ui/glade/laview-desktop.glade.h:28 #: ui/glade/laview-desktop.glade.h:28
msgid "Close the application" msgid "Help and reference"
msgstr "" msgstr ""
#: ui/glade/laview-desktop.glade.h:29 #: ui/glade/laview-desktop.glade.h:29
msgid "Templates" msgid "Close the application"
msgstr "" msgstr ""
#: ui/glade/laview-desktop.glade.h:30 #: ui/glade/laview-desktop.glade.h:30
msgid "Templates"
msgstr ""
#: ui/glade/laview-desktop.glade.h:31
msgid "Document Objects" msgid "Document Objects"
msgstr "" msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: laview-desktop\n" "Project-Id-Version: laview-desktop\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-24 02:51+0300\n" "POT-Creation-Date: 2016-01-24 02:59+0300\n"
"PO-Revision-Date: 2015-10-24 20:19+0300\n" "PO-Revision-Date: 2015-10-24 20:19+0300\n"
"Last-Translator: <backbone@backbone.ws>\n" "Last-Translator: <backbone@backbone.ws>\n"
"Language-Team: Russian\n" "Language-Team: Russian\n"
@ -51,7 +51,7 @@ msgid "We're ready, Commander! Select or create a template. :-)"
msgstr "Мы готовы, Командир! Выберите или создайте шаблон. :-)" msgstr "Мы готовы, Командир! Выберите или создайте шаблон. :-)"
#: src/MainWindow.vala:76 src/MainWindow.vala:120 src/MainWindow.vala:194 #: src/MainWindow.vala:76 src/MainWindow.vala:120 src/MainWindow.vala:194
#: src/MainWindow.vala:212 #: src/MainWindow.vala:212 src/MainWindow.vala:302
msgid "Error" msgid "Error"
msgstr "Ошибка" msgstr "Ошибка"
@ -59,7 +59,7 @@ msgstr "Ошибка"
msgid "Select templates" msgid "Select templates"
msgstr "Выберите шаблоны" msgstr "Выберите шаблоны"
#: src/MainWindow.vala:86 #: src/MainWindow.vala:86 src/MainWindow.vala:268
msgid "_Cancel" msgid "_Cancel"
msgstr "_Отмена" msgstr "_Отмена"
@ -79,6 +79,30 @@ msgstr "Документ проанализирован, выберите объ
msgid "Press 'Properties' button to compose the object." msgid "Press 'Properties' button to compose the object."
msgstr "Нажмите кнопку 'Свойства' для компоновки объекта." msgstr "Нажмите кнопку 'Свойства' для компоновки объекта."
#: src/MainWindow.vala:262
msgid "Prepare the document first! >;-]"
msgstr "Сначала подготовьте документ! >;-]"
#: src/MainWindow.vala:266
msgid "Select destination"
msgstr "Выберите назначение"
#: src/MainWindow.vala:269
msgid "_Save"
msgstr "_Сохранить"
#: src/MainWindow.vala:297
msgid "bytes copied/saved"
msgstr "байт скопировано/сохранено"
#: src/MainWindow.vala:297
msgid "bytes of"
msgstr "байт из"
#: src/MainWindow.vala:299
msgid "Save/Copy operation complete! :-)"
msgstr "Операция сохранения/копирования завершена! :-)"
#: src/main.vala:33 #: src/main.vala:33
msgid "Show the application's version" msgid "Show the application's version"
msgstr "Показать версию приложения" msgstr "Показать версию приложения"
@ -198,21 +222,25 @@ msgid "Edit the result document"
msgstr "Редактировать полученный документ" msgstr "Редактировать полученный документ"
#: ui/glade/laview-desktop.glade.h:26 #: ui/glade/laview-desktop.glade.h:26
msgid "Save the document as..."
msgstr "Сохранить документ как..."
#: ui/glade/laview-desktop.glade.h:27
msgid "Application preferences" msgid "Application preferences"
msgstr "Параметры приложения" msgstr "Параметры приложения"
#: ui/glade/laview-desktop.glade.h:27 #: ui/glade/laview-desktop.glade.h:28
msgid "Help and reference" msgid "Help and reference"
msgstr "Помощь и справка" msgstr "Помощь и справка"
#: ui/glade/laview-desktop.glade.h:28 #: ui/glade/laview-desktop.glade.h:29
msgid "Close the application" msgid "Close the application"
msgstr "Закрыть приложение" msgstr "Закрыть приложение"
#: ui/glade/laview-desktop.glade.h:29 #: ui/glade/laview-desktop.glade.h:30
msgid "Templates" msgid "Templates"
msgstr "Шаблоны" msgstr "Шаблоны"
#: ui/glade/laview-desktop.glade.h:30 #: ui/glade/laview-desktop.glade.h:31
msgid "Document Objects" msgid "Document Objects"
msgstr "Объекты документа" msgstr "Объекты документа"

View File

@ -252,5 +252,61 @@ namespace LAview.Desktop {
public void objects_cursor_changed (Gtk.TreeView treeview) { public void objects_cursor_changed (Gtk.TreeView treeview) {
statusbar_show (_("Press 'Properties' button to compose the object.")); statusbar_show (_("Press 'Properties' button to compose the object."));
} }
[CCode (instance_pos = -1)]
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 == "") {
statusbar_show (_("Prepare the document first! >;-]"));
return;
}
FileChooserDialog chooser = new Gtk.FileChooserDialog (_("Select destination"), window,
FileChooserAction.SAVE,
_("_Cancel"), ResponseType.CANCEL,
_("_Save"), ResponseType.ACCEPT);
chooser.select_multiple = false;
FileFilter filter = new FileFilter ();
chooser.set_filter (filter);
filter.add_mime_type ("application/pdf");
filter.add_pattern ("*.pdf");
// set current pdf file name or select an existance one
var template_name = AppCore.core.get_template_path_by_index (indices[0]);
template_name = File.new_for_path(template_name).get_basename ();
if (template_name.down().has_suffix(".lyx"))
template_name = template_name.splice (template_name.length-4, template_name.length, ".pdf");
if (File.new_for_path(template_name).query_exists())
chooser.set_filename (template_name);
else
chooser.set_current_name (template_name);
// open dialog
var response = chooser.run ();
// process response
if (response == ResponseType.ACCEPT) {
var save_path = chooser.get_filename ();
var file_src = File.new_for_path (tmp_pdf);
var file_dest = File.new_for_path (save_path);
try {
file_src.copy (file_dest, FileCopyFlags.OVERWRITE, null,
(current_num_bytes, total_num_bytes) => {
statusbar_show (@"$current_num_bytes "+_("bytes of")+
@" $total_num_bytes "+_("bytes copied/saved")+".");
});
statusbar_show (_("Save/Copy operation complete! :-)"));
} catch (Error err) {
var msg = new MessageDialog (chooser, DialogFlags.MODAL, MessageType.ERROR,
ButtonsType.CLOSE, _("Error")+@": $(err.message).");
msg.response.connect ((response_id) => { msg.destroy (); chooser.close (); } );
msg.show ();
}
}
chooser.close ();
}
} }
} }

View File

@ -94,6 +94,12 @@
<signal name="activate" handler="laview_desktop_main_window_action_edit_result_activate" swapped="no"/> <signal name="activate" handler="laview_desktop_main_window_action_edit_result_activate" swapped="no"/>
</object> </object>
</child> </child>
<child>
<object class="GtkAction" id="action_saveas">
<property name="always_show_image">True</property>
<signal name="activate" handler="laview_desktop_main_window_action_saveas_activate" swapped="no"/>
</object>
</child>
</object> </object>
<object class="GtkFileFilter" id="filefilter_open"> <object class="GtkFileFilter" id="filefilter_open">
<patterns> <patterns>
@ -523,6 +529,18 @@
<property name="always_show_image">True</property> <property name="always_show_image">True</property>
</object> </object>
</child> </child>
<child>
<object class="GtkImageMenuItem" id="menuitem_saveas">
<property name="label">gtk-save</property>
<property name="use_action_appearance">False</property>
<property name="related_action">action_saveas</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<property name="always_show_image">True</property>
</object>
</child>
</object> </object>
</child> </child>
</object> </object>
@ -722,6 +740,21 @@
<property name="homogeneous">True</property> <property name="homogeneous">True</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkToolButton" id="toolbutton_saveas">
<property name="use_action_appearance">False</property>
<property name="related_action">action_saveas</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Save the document as...</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-save</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child> <child>
<object class="GtkSeparatorToolItem" id="separatortoolitem2"> <object class="GtkSeparatorToolItem" id="separatortoolitem2">
<property name="visible">True</property> <property name="visible">True</property>
@ -1032,6 +1065,23 @@
<property name="position">2</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkButton" id="button_saveas">
<property name="label">gtk-save</property>
<property name="use_action_appearance">False</property>
<property name="related_action">action_saveas</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>