Merge branch 'release-1.1.1'

This commit is contained in:
Kolan Sh 2016-01-28 02:32:24 +03:00
commit e252150ef1
11 changed files with 85 additions and 125 deletions

View File

@ -7,7 +7,7 @@ SET (PROJECT_DESCRIPTION "LAview Desktop Application.")
SET (MAJOR 1)
SET (MINOR 1)
SET (PATCH 0)
SET (PATCH 1)
LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/backbone)

View File

@ -1,22 +1,10 @@
<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">
<default l10n="messages">"Hello, earthlings"</default>
<summary>A greeting</summary>
<description>Greeting of the invading martians</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 name="pdf-save-path" type="s">
<default>""</default>
<summary>Directory to save pdf files (last selected path).</summary>
<description>It is too lazy to select a directory each time...</description>
</key>
</schema>

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: laview-desktop\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"
"Last-Translator: <backbone@backbone.ws>\n"
"Language-Team: German\n"
@ -18,31 +18,11 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: config/ws.backbone.laview.desktop.gschema.xml.h:1
msgid "\"Hello, earthlings\""
msgid "Directory to save pdf files (last selected path)."
msgstr ""
#: config/ws.backbone.laview.desktop.gschema.xml.h:2
msgid "A greeting"
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."
msgid "It is too lazy to select a directory each time..."
msgstr ""
#: src/MainWindow.vala:58
@ -50,7 +30,7 @@ msgid "We're ready, Commander! Select or create a template. :-)"
msgstr ""
#: 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"
msgstr ""
@ -90,15 +70,15 @@ msgstr ""
msgid "_Save"
msgstr ""
#: src/MainWindow.vala:297
msgid "bytes copied/saved"
msgstr ""
#: src/MainWindow.vala:297
#: src/MainWindow.vala:305
msgid "bytes of"
msgstr ""
#: src/MainWindow.vala:299
#: src/MainWindow.vala:306
msgid "bytes copied/saved"
msgstr ""
#: src/MainWindow.vala:309
msgid "Save/Copy operation complete! :-)"
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: laview-desktop\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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -18,31 +18,11 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
#: config/ws.backbone.laview.desktop.gschema.xml.h:1
msgid "\"Hello, earthlings\""
msgid "Directory to save pdf files (last selected path)."
msgstr ""
#: config/ws.backbone.laview.desktop.gschema.xml.h:2
msgid "A greeting"
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."
msgid "It is too lazy to select a directory each time..."
msgstr ""
#: src/MainWindow.vala:58
@ -50,7 +30,7 @@ msgid "We're ready, Commander! Select or create a template. :-)"
msgstr ""
#: 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"
msgstr ""
@ -90,15 +70,15 @@ msgstr ""
msgid "_Save"
msgstr ""
#: src/MainWindow.vala:297
msgid "bytes copied/saved"
msgstr ""
#: src/MainWindow.vala:297
#: src/MainWindow.vala:305
msgid "bytes of"
msgstr ""
#: src/MainWindow.vala:299
#: src/MainWindow.vala:306
msgid "bytes copied/saved"
msgstr ""
#: src/MainWindow.vala:309
msgid "Save/Copy operation complete! :-)"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: laview-desktop\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"
"Last-Translator: <backbone@backbone.ws>\n"
"Language-Team: Russian\n"
@ -19,39 +19,19 @@ msgstr ""
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#: config/ws.backbone.laview.desktop.gschema.xml.h:1
msgid "\"Hello, earthlings\""
msgstr "\"Привет, земляне\""
msgid "Directory to save pdf files (last selected path)."
msgstr "Директория для сохранения pdf файлов (последний выбранный путь)."
#: config/ws.backbone.laview.desktop.gschema.xml.h:2
msgid "A greeting"
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 "Состояние воображаемого выключателя света."
msgid "It is too lazy to select a directory each time..."
msgstr "Слишком лениво выбирать каждый раз директорию для сохранения..."
#: src/MainWindow.vala:58
msgid "We're ready, Commander! Select or create a template. :-)"
msgstr "Мы готовы, Командир! Выберите или создайте шаблон. :-)"
#: 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"
msgstr "Ошибка"
@ -91,15 +71,15 @@ msgstr "Выберите назначение"
msgid "_Save"
msgstr "_Сохранить"
#: src/MainWindow.vala:297
msgid "bytes copied/saved"
msgstr "байт скопировано/сохранено"
#: src/MainWindow.vala:297
#: src/MainWindow.vala:305
msgid "bytes of"
msgstr "байт из"
#: src/MainWindow.vala:299
#: src/MainWindow.vala:306
msgid "bytes copied/saved"
msgstr "байт скопировано/сохранено"
#: src/MainWindow.vala:309
msgid "Save/Copy operation complete! :-)"
msgstr "Операция сохранения/копирования завершена! :-)"

View File

@ -2,9 +2,12 @@ namespace LAview.Desktop {
class AppCore {
public static LAview.Core.Core core;
public static AppSettings settings;
public static void init (string[] args) throws Error {
core = new LAview.Core.Core();
settings = new AppSettings();
}
}
}

View File

@ -5,7 +5,7 @@ SET (BinPkgModules gtk+-3.0 gee-0.8 laview-core-0)
SET (BinCustomVapis ${CMAKE_SOURCE_DIR}/config/Config.vapi)
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/config")
SET (BinInstall ON)
SET (BinExtraSources "${CMAKE_SOURCE_DIR}/res/laview-desktop.rc")
SET (BinExtraSources "${CMAKE_SOURCE_DIR}/res/laview-desktop.rc" w32hooks.c)
IF (WIN32)
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mwindows")
SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--export-all-symbols")

View File

@ -273,11 +273,19 @@ namespace LAview.Desktop {
filter.add_mime_type ("application/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
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 ( template_name.down().has_suffix(".lyx")
|| template_name.down().has_suffix(".tex")
) {
var date = Time.local (time_t()).format("-%Y.%m.%d_%H-%M-%S");
template_name = template_name.splice (template_name.length-4, template_name.length, date+".pdf");
}
if (File.new_for_path(template_name).query_exists())
chooser.set_filename (template_name);
else
@ -288,15 +296,13 @@ namespace LAview.Desktop {
// 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,
File.new_for_path (tmp_pdf).copy (chooser.get_file(), FileCopyFlags.OVERWRITE, null,
(current_num_bytes, total_num_bytes) => {
statusbar_show (@"$current_num_bytes "+_("bytes of")+
@" $total_num_bytes "+_("bytes copied/saved")+".");
});
AppCore.settings.pdf_save_path = chooser.get_file().get_parent().get_path();
statusbar_show (_("Save/Copy operation complete! :-)"));
} catch (Error err) {
var msg = new MessageDialog (chooser, DialogFlags.MODAL, MessageType.ERROR,

View File

@ -1,15 +1,31 @@
namespace LAview.Desktop {
class AppSettings {
//public static GLib.Settings settings;
public class AppSettings {
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);
//SettingsSchema schema = sss.lookup ("ws.backbone.laview.desktop-"+Config.VERSION_MAJOR.to_string(), false);
if (sss.lookup == null)
throw new FileError.NOENT ("Schema ID not found");
SettingsSchema schema = sss.lookup ("ws.backbone.laview.desktop-"+Config.VERSION_MAJOR.to_string(), false);
if (schema == null) {
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");
});
}
}
}

View File

@ -45,7 +45,6 @@ namespace LAview.Desktop {
try {
AppDirs.init (args);
AppSettings.init (args);
AppCore.init (args);
Resources.init (args);

8
src/w32hooks.c Normal file
View File

@ -0,0 +1,8 @@
#if defined(_WIN32) || defined(_WIN64)
#include <time.h>
struct tm *localtime_r(const time_t *timep, struct tm *result)
{
localtime_s(result, timep);
return result;
}
#endif