Merge branch '#98_last_pdf_dir' into develop
This commit is contained in:
commit
dd665bd61b
|
@ -1,22 +1,10 @@
|
||||||
<schemalist>
|
<schemalist>
|
||||||
<schema id="ws.backbone.lavew.desktop-@MAJOR@" path="/ws/backbone/laview/desktop-@MAJOR@/" gettext-domain="laview-desktop-@MAJOR@">
|
<schema id="ws.backbone.laview.desktop-@MAJOR@" path="/ws/backbone/laview/desktop-@MAJOR@/" gettext-domain="laview-desktop-@MAJOR@">
|
||||||
|
|
||||||
<key name="greeting" type="s">
|
<key name="pdf-save-path" type="s">
|
||||||
<default l10n="messages">"Hello, earthlings"</default>
|
<default>""</default>
|
||||||
<summary>A greeting</summary>
|
<summary>Directory to save pdf files (last selected path).</summary>
|
||||||
<description>Greeting of the invading martians</description>
|
<description>It is too lazy to select a directory each time...</description>
|
||||||
</key>
|
|
||||||
|
|
||||||
<key name="bottles-of-beer" type="i">
|
|
||||||
<default>99</default>
|
|
||||||
<summary>Bottles of beer</summary>
|
|
||||||
<description>Number of bottles of beer on the wall</description>
|
|
||||||
</key>
|
|
||||||
|
|
||||||
<key name="lighting" type="b">
|
|
||||||
<default>false</default>
|
|
||||||
<summary>Is the light switched on?</summary>
|
|
||||||
<description>State of an imaginary light switch.</description>
|
|
||||||
</key>
|
</key>
|
||||||
|
|
||||||
</schema>
|
</schema>
|
||||||
|
|
|
@ -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:59+0300\n"
|
"POT-Creation-Date: 2016-01-27 04:50+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"
|
||||||
|
@ -18,31 +18,11 @@ msgstr ""
|
||||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
|
||||||
#: config/ws.backbone.laview.desktop.gschema.xml.h:1
|
#: config/ws.backbone.laview.desktop.gschema.xml.h:1
|
||||||
msgid "\"Hello, earthlings\""
|
msgid "Directory to save pdf files (last selected path)."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: config/ws.backbone.laview.desktop.gschema.xml.h:2
|
#: config/ws.backbone.laview.desktop.gschema.xml.h:2
|
||||||
msgid "A greeting"
|
msgid "It is too lazy to select a directory each time..."
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: config/ws.backbone.laview.desktop.gschema.xml.h:3
|
|
||||||
msgid "Greeting of the invading martians"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: config/ws.backbone.laview.desktop.gschema.xml.h:4
|
|
||||||
msgid "Bottles of beer"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: config/ws.backbone.laview.desktop.gschema.xml.h:5
|
|
||||||
msgid "Number of bottles of beer on the wall"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: config/ws.backbone.laview.desktop.gschema.xml.h:6
|
|
||||||
msgid "Is the light switched on?"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: config/ws.backbone.laview.desktop.gschema.xml.h:7
|
|
||||||
msgid "State of an imaginary light switch."
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/MainWindow.vala:58
|
#: src/MainWindow.vala:58
|
||||||
|
@ -50,7 +30,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:302
|
#: src/MainWindow.vala:212 src/MainWindow.vala:312
|
||||||
msgid "Error"
|
msgid "Error"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -90,15 +70,15 @@ msgstr ""
|
||||||
msgid "_Save"
|
msgid "_Save"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/MainWindow.vala:297
|
#: src/MainWindow.vala:305
|
||||||
msgid "bytes copied/saved"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/MainWindow.vala:297
|
|
||||||
msgid "bytes of"
|
msgid "bytes of"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/MainWindow.vala:299
|
#: src/MainWindow.vala:306
|
||||||
|
msgid "bytes copied/saved"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/MainWindow.vala:309
|
||||||
msgid "Save/Copy operation complete! :-)"
|
msgid "Save/Copy operation complete! :-)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -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:59+0300\n"
|
"POT-Creation-Date: 2016-01-27 04:50+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"
|
||||||
|
@ -18,31 +18,11 @@ msgstr ""
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
#: config/ws.backbone.laview.desktop.gschema.xml.h:1
|
#: config/ws.backbone.laview.desktop.gschema.xml.h:1
|
||||||
msgid "\"Hello, earthlings\""
|
msgid "Directory to save pdf files (last selected path)."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: config/ws.backbone.laview.desktop.gschema.xml.h:2
|
#: config/ws.backbone.laview.desktop.gschema.xml.h:2
|
||||||
msgid "A greeting"
|
msgid "It is too lazy to select a directory each time..."
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: config/ws.backbone.laview.desktop.gschema.xml.h:3
|
|
||||||
msgid "Greeting of the invading martians"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: config/ws.backbone.laview.desktop.gschema.xml.h:4
|
|
||||||
msgid "Bottles of beer"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: config/ws.backbone.laview.desktop.gschema.xml.h:5
|
|
||||||
msgid "Number of bottles of beer on the wall"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: config/ws.backbone.laview.desktop.gschema.xml.h:6
|
|
||||||
msgid "Is the light switched on?"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: config/ws.backbone.laview.desktop.gschema.xml.h:7
|
|
||||||
msgid "State of an imaginary light switch."
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/MainWindow.vala:58
|
#: src/MainWindow.vala:58
|
||||||
|
@ -50,7 +30,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:302
|
#: src/MainWindow.vala:212 src/MainWindow.vala:312
|
||||||
msgid "Error"
|
msgid "Error"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -90,15 +70,15 @@ msgstr ""
|
||||||
msgid "_Save"
|
msgid "_Save"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/MainWindow.vala:297
|
#: src/MainWindow.vala:305
|
||||||
msgid "bytes copied/saved"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/MainWindow.vala:297
|
|
||||||
msgid "bytes of"
|
msgid "bytes of"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/MainWindow.vala:299
|
#: src/MainWindow.vala:306
|
||||||
|
msgid "bytes copied/saved"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/MainWindow.vala:309
|
||||||
msgid "Save/Copy operation complete! :-)"
|
msgid "Save/Copy operation complete! :-)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -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:59+0300\n"
|
"POT-Creation-Date: 2016-01-27 04:50+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"
|
||||||
|
@ -19,39 +19,19 @@ msgstr ""
|
||||||
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||||
|
|
||||||
#: config/ws.backbone.laview.desktop.gschema.xml.h:1
|
#: config/ws.backbone.laview.desktop.gschema.xml.h:1
|
||||||
msgid "\"Hello, earthlings\""
|
msgid "Directory to save pdf files (last selected path)."
|
||||||
msgstr "\"Привет, земляне\""
|
msgstr "Директория для сохранения pdf файлов (последний выбранный путь)."
|
||||||
|
|
||||||
#: config/ws.backbone.laview.desktop.gschema.xml.h:2
|
#: config/ws.backbone.laview.desktop.gschema.xml.h:2
|
||||||
msgid "A greeting"
|
msgid "It is too lazy to select a directory each time..."
|
||||||
msgstr "Приветствие"
|
msgstr "Слишком лениво выбирать каждый раз директорию для сохранения..."
|
||||||
|
|
||||||
#: config/ws.backbone.laview.desktop.gschema.xml.h:3
|
|
||||||
msgid "Greeting of the invading martians"
|
|
||||||
msgstr "Приветствие вторгнувшихся марсиан"
|
|
||||||
|
|
||||||
#: config/ws.backbone.laview.desktop.gschema.xml.h:4
|
|
||||||
msgid "Bottles of beer"
|
|
||||||
msgstr "Бутылки пива"
|
|
||||||
|
|
||||||
#: config/ws.backbone.laview.desktop.gschema.xml.h:5
|
|
||||||
msgid "Number of bottles of beer on the wall"
|
|
||||||
msgstr "Число бутылок пива на стене"
|
|
||||||
|
|
||||||
#: config/ws.backbone.laview.desktop.gschema.xml.h:6
|
|
||||||
msgid "Is the light switched on?"
|
|
||||||
msgstr "Включен ли свет?"
|
|
||||||
|
|
||||||
#: config/ws.backbone.laview.desktop.gschema.xml.h:7
|
|
||||||
msgid "State of an imaginary light switch."
|
|
||||||
msgstr "Состояние воображаемого выключателя света."
|
|
||||||
|
|
||||||
#: src/MainWindow.vala:58
|
#: src/MainWindow.vala:58
|
||||||
msgid "We're ready, Commander! Select or create a template. :-)"
|
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:302
|
#: src/MainWindow.vala:212 src/MainWindow.vala:312
|
||||||
msgid "Error"
|
msgid "Error"
|
||||||
msgstr "Ошибка"
|
msgstr "Ошибка"
|
||||||
|
|
||||||
|
@ -91,15 +71,15 @@ msgstr "Выберите назначение"
|
||||||
msgid "_Save"
|
msgid "_Save"
|
||||||
msgstr "_Сохранить"
|
msgstr "_Сохранить"
|
||||||
|
|
||||||
#: src/MainWindow.vala:297
|
#: src/MainWindow.vala:305
|
||||||
msgid "bytes copied/saved"
|
|
||||||
msgstr "байт скопировано/сохранено"
|
|
||||||
|
|
||||||
#: src/MainWindow.vala:297
|
|
||||||
msgid "bytes of"
|
msgid "bytes of"
|
||||||
msgstr "байт из"
|
msgstr "байт из"
|
||||||
|
|
||||||
#: src/MainWindow.vala:299
|
#: src/MainWindow.vala:306
|
||||||
|
msgid "bytes copied/saved"
|
||||||
|
msgstr "байт скопировано/сохранено"
|
||||||
|
|
||||||
|
#: src/MainWindow.vala:309
|
||||||
msgid "Save/Copy operation complete! :-)"
|
msgid "Save/Copy operation complete! :-)"
|
||||||
msgstr "Операция сохранения/копирования завершена! :-)"
|
msgstr "Операция сохранения/копирования завершена! :-)"
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,12 @@ namespace LAview.Desktop {
|
||||||
|
|
||||||
class AppCore {
|
class AppCore {
|
||||||
public static LAview.Core.Core core;
|
public static LAview.Core.Core core;
|
||||||
|
public static AppSettings settings;
|
||||||
|
|
||||||
public static void init (string[] args) throws Error {
|
public static void init (string[] args) throws Error {
|
||||||
core = new LAview.Core.Core();
|
core = new LAview.Core.Core();
|
||||||
|
settings = new AppSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,6 +273,10 @@ namespace LAview.Desktop {
|
||||||
filter.add_mime_type ("application/pdf");
|
filter.add_mime_type ("application/pdf");
|
||||||
filter.add_pattern ("*.pdf");
|
filter.add_pattern ("*.pdf");
|
||||||
|
|
||||||
|
// set folder
|
||||||
|
if (AppCore.settings.pdf_save_path != "")
|
||||||
|
chooser.set_current_folder(AppCore.settings.pdf_save_path);
|
||||||
|
|
||||||
// set current pdf file name or select an existance one
|
// set current pdf file name or select an existance one
|
||||||
var template_name = AppCore.core.get_template_path_by_index (indices[0]);
|
var template_name = AppCore.core.get_template_path_by_index (indices[0]);
|
||||||
template_name = File.new_for_path(template_name).get_basename ();
|
template_name = File.new_for_path(template_name).get_basename ();
|
||||||
|
@ -292,15 +296,13 @@ namespace LAview.Desktop {
|
||||||
|
|
||||||
// process response
|
// process response
|
||||||
if (response == ResponseType.ACCEPT) {
|
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 {
|
try {
|
||||||
file_src.copy (file_dest, FileCopyFlags.OVERWRITE, null,
|
File.new_for_path (tmp_pdf).copy (chooser.get_file(), FileCopyFlags.OVERWRITE, null,
|
||||||
(current_num_bytes, total_num_bytes) => {
|
(current_num_bytes, total_num_bytes) => {
|
||||||
statusbar_show (@"$current_num_bytes "+_("bytes of")+
|
statusbar_show (@"$current_num_bytes "+_("bytes of")+
|
||||||
@" $total_num_bytes "+_("bytes copied/saved")+".");
|
@" $total_num_bytes "+_("bytes copied/saved")+".");
|
||||||
});
|
});
|
||||||
|
AppCore.settings.pdf_save_path = chooser.get_file().get_parent().get_path();
|
||||||
statusbar_show (_("Save/Copy operation complete! :-)"));
|
statusbar_show (_("Save/Copy operation complete! :-)"));
|
||||||
} catch (Error err) {
|
} catch (Error err) {
|
||||||
var msg = new MessageDialog (chooser, DialogFlags.MODAL, MessageType.ERROR,
|
var msg = new MessageDialog (chooser, DialogFlags.MODAL, MessageType.ERROR,
|
||||||
|
|
|
@ -1,15 +1,31 @@
|
||||||
namespace LAview.Desktop {
|
namespace LAview.Desktop {
|
||||||
|
|
||||||
class AppSettings {
|
public class AppSettings {
|
||||||
//public static GLib.Settings settings;
|
Settings settings;
|
||||||
|
|
||||||
public static void init (string[] args) throws Error {
|
string _pdf_save_path;
|
||||||
|
public string pdf_save_path {
|
||||||
|
get { return _pdf_save_path; }
|
||||||
|
set {
|
||||||
|
if (settings != null) settings.set_string ("pdf-save-path", value);
|
||||||
|
_pdf_save_path = value;
|
||||||
|
}
|
||||||
|
default = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public AppSettings () throws Error {
|
||||||
SettingsSchemaSource sss = new SettingsSchemaSource.from_directory (AppDirs.settings_dir, null, false);
|
SettingsSchemaSource sss = new SettingsSchemaSource.from_directory (AppDirs.settings_dir, null, false);
|
||||||
//SettingsSchema schema = sss.lookup ("ws.backbone.laview.desktop-"+Config.VERSION_MAJOR.to_string(), false);
|
SettingsSchema schema = sss.lookup ("ws.backbone.laview.desktop-"+Config.VERSION_MAJOR.to_string(), false);
|
||||||
if (sss.lookup == null)
|
if (schema == null) {
|
||||||
throw new FileError.NOENT ("Schema ID not found");
|
stderr.printf ("ID not found.\n");
|
||||||
|
throw new IOError.NOT_FOUND ("File "+AppDirs.settings_dir+"/gschemas.compiled not found");
|
||||||
|
}
|
||||||
|
settings = new Settings.full (schema, null, null);
|
||||||
|
|
||||||
//settings = new Settings.full (schema, null, null);
|
_pdf_save_path = settings.get_string("pdf-save-path");
|
||||||
|
settings.changed["pdf-save-path"].connect (() => {
|
||||||
|
_pdf_save_path = settings.get_string("pdf-save-path");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,6 @@ namespace LAview.Desktop {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
AppDirs.init (args);
|
AppDirs.init (args);
|
||||||
AppSettings.init (args);
|
|
||||||
AppCore.init (args);
|
AppCore.init (args);
|
||||||
Resources.init (args);
|
Resources.init (args);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue