Hello community, here is the log from the commit of package translator for openSUSE:Factory checked in at 2018-02-24 16:39:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/translator (Old) and /work/SRC/openSUSE:Factory/.translator.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "translator" Sat Feb 24 16:39:13 2018 rev:3 rq:579629 version:1.1.0 Changes: -------- --- /work/SRC/openSUSE:Factory/translator/translator.changes 2018-01-24 15:29:17.685756624 +0100 +++ /work/SRC/openSUSE:Factory/.translator.new/translator.changes 2018-02-24 16:39:17.501639155 +0100 @@ -1,0 +2,13 @@ +Fri Feb 16 19:23:50 UTC 2018 - [email protected] + +- Update to 1.1.0: + * Removed custom icons + * Homepage fix + * Site fix + * Update README.md + * Set theme jekyll-theme-cayman + * Fix app data + * Fix dark theme + * Slovak lang; Refactor GlobalSettings + +------------------------------------------------------------------- Old: ---- Translator-1.0.6.tar.gz New: ---- Translator-1.1.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ translator.spec ++++++ --- /var/tmp/diff_new_pack.cRZybl/_old 2018-02-24 16:39:18.421606047 +0100 +++ /var/tmp/diff_new_pack.cRZybl/_new 2018-02-24 16:39:18.425605903 +0100 @@ -17,12 +17,12 @@ Name: translator -Version: 1.0.6 +Version: 1.1.0 Release: 0 Summary: Translation program License: GPL-3.0+ Group: Productivity/Office/Dictionary -URL: https://github.com/Grabli66 +URL: https://rapidfingers.github.io/Translator Source: https://github.com/RapidFingers/Translator/archive/%{version}.tar.gz#/Translator-%{version}.tar.gz BuildRequires: cmake BuildRequires: fdupes @@ -80,7 +80,6 @@ %dir %{_datadir}/appdata %{_datadir}/appdata/com.github.rapidfingers.translator.appdata.xml %{_datadir}/applications/com.github.rapidfingers.translator.desktop -%{_datadir}/com.github.rapidfingers.translator/ %{_datadir}/glib-2.0/schemas/com.github.rapidfingers.translator.gschema.xml %{_datadir}/icons/hicolor/*/apps/com.github.rapidfingers.translator.??g ++++++ Translator-1.0.6.tar.gz -> Translator-1.1.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Translator-1.0.6/CMakeLists.txt new/Translator-1.1.0/CMakeLists.txt --- old/Translator-1.0.6/CMakeLists.txt 2018-01-20 08:30:51.000000000 +0100 +++ new/Translator-1.1.0/CMakeLists.txt 2018-02-14 19:45:17.000000000 +0100 @@ -36,8 +36,7 @@ src/widgets/PopoverCombo.vala src/TranslatorApplication.vala src/TranslatorWindow.vala - src/GlobalSettings.vala - src/Assets.vala + src/GlobalSettings.vala src/AsyncTaskExecuter.vala src/TranslatorService.vala src/DictionaryService.vala @@ -56,7 +55,6 @@ add_subdirectory (po) install (TARGETS ${EXEC_NAME} RUNTIME DESTINATION bin) -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/images DESTINATION "${PKGDATADIR}") install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/${CMAKE_PROJECT_NAME}.desktop DESTINATION "${DATADIR}/applications") install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/${CMAKE_PROJECT_NAME}.appdata.xml DESTINATION ${DATADIR}/metainfo/) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Translator-1.0.6/README.md new/Translator-1.1.0/README.md --- old/Translator-1.0.6/README.md 2018-01-20 08:30:51.000000000 +0100 +++ new/Translator-1.1.0/README.md 2018-02-14 19:45:17.000000000 +0100 @@ -6,6 +6,10 @@  +# Donate + +<iframe frameborder="0" allowtransparency="true" scrolling="no" src="https://money.yandex.ru/embed/donate.xml?account=410013012437926&quickpay=donate&payment-type-choice=on&default-sum=100&targets=For+develop&target-visibility=on&project-name=Translator&project-site=&button-text=01&successURL=" width="439" height="117"></iframe> + # MIT License Copyright 2017 Grabli66 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Translator-1.0.6/_config.yml new/Translator-1.1.0/_config.yml --- old/Translator-1.0.6/_config.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/Translator-1.1.0/_config.yml 2018-02-14 19:45:17.000000000 +0100 @@ -0,0 +1 @@ +theme: jekyll-theme-cayman \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Translator-1.0.6/data/com.github.rapidfingers.translator.appdata.xml new/Translator-1.1.0/data/com.github.rapidfingers.translator.appdata.xml --- old/Translator-1.0.6/data/com.github.rapidfingers.translator.appdata.xml 2018-01-20 08:30:51.000000000 +0100 +++ new/Translator-1.1.0/data/com.github.rapidfingers.translator.appdata.xml 2018-02-14 19:45:17.000000000 +0100 @@ -10,7 +10,7 @@ <description> <p>Simple and fast translator</p> </description> - <url type="homepage">https://github.com/RapidFingers/Translator</url> + <url type="homepage">https://rapidfingers.github.io/Translator/</url> <url type="bugtracker">https://github.com/RapidFingers/Translator/issues</url> <screenshots> <screenshot type="default"> @@ -32,5 +32,35 @@ </ul> </description> </release> + <release version="1.0.7" date="2018-02-10"> + <description> + <ul> + <li>Slovak language</li> + <li>Translate progress</li> + </ul> + </description> + </release> + <release version="1.0.8" date="2018-02-14"> + <description> + <ul> + <li>Fix for dark theme</li> + </ul> + </description> + </release> + <release version="1.0.9" date="2018-02-14"> + <description> + <ul> + <li>Homepage fix</li> + </ul> + </description> + </release> + <release version="1.1.0" date="2018-02-14"> + <description> + <ul> + <li>System icons</li> + <li>Better dark theme look</li> + </ul> + </description> + </release> </releases> </component> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Translator-1.0.6/debian/changelog new/Translator-1.1.0/debian/changelog --- old/Translator-1.0.6/debian/changelog 2018-01-20 08:30:51.000000000 +0100 +++ new/Translator-1.1.0/debian/changelog 2018-02-14 19:45:17.000000000 +0100 @@ -1,3 +1,21 @@ +translate (1.1.0) precise; urgency=low + * System icons + * Better dark theme look + -- Grabli66 <[email protected]> Tue, 14 February 2018 21:44:00 -0500 + +translate (1.0.9) precise; urgency=low + * Site fix + -- Grabli66 <[email protected]> Tue, 14 February 2018 20:57:00 -0500 + +translate (1.0.8) precise; urgency=low + * Fix for dark theme + -- Grabli66 <[email protected]> Tue, 14 February 2018 20:25:00 -0500 + +translate (1.0.7) precise; urgency=low + * Slovak language + * Translate progress + -- Grabli66 <[email protected]> Tue, 10 February 2018 20:22:00 -0500 + translate (0.7.3) precise; urgency=low * Serbian language * Better desktop info diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Translator-1.0.6/images/book.svg new/Translator-1.1.0/images/book.svg --- old/Translator-1.0.6/images/book.svg 2018-01-20 08:30:51.000000000 +0100 +++ new/Translator-1.1.0/images/book.svg 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Generated by IcoMoon.io --> -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> -<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> -<path fill="#555555" d="M14 2v13h-10.5c-0.829 0-1.5-0.672-1.5-1.5s0.671-1.5 1.5-1.5h9.5v-12h-10c-1.1 0-2 0.9-2 2v12c0 1.1 0.9 2 2 2h12v-14h-1z"></path> -<path fill="#555555" d="M3.501 13v0c-0 0-0.001 0-0.001 0-0.276 0-0.5 0.224-0.5 0.5s0.224 0.5 0.5 0.5c0 0 0.001-0 0.001-0v0h9.498v-1h-9.498z"></path> -</svg> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Translator-1.0.6/images/caret-down.svg new/Translator-1.1.0/images/caret-down.svg --- old/Translator-1.0.6/images/caret-down.svg 2018-01-20 08:30:51.000000000 +0100 +++ new/Translator-1.1.0/images/caret-down.svg 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ -<!-- Generated by IcoMoon.io --> -<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="11" height="17" viewBox="0 0 16 28"> -<title>caret-down</title> -<path fill="#555555" d="M16 11c0 0.266-0.109 0.516-0.297 0.703l-7 7c-0.187 0.187-0.438 0.297-0.703 0.297s-0.516-0.109-0.703-0.297l-7-7c-0.187-0.187-0.297-0.438-0.297-0.703 0-0.547 0.453-1 1-1h14c0.547 0 1 0.453 1 1z"></path> -</svg> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Translator-1.0.6/images/cog.svg new/Translator-1.1.0/images/cog.svg --- old/Translator-1.0.6/images/cog.svg 2018-01-20 08:30:51.000000000 +0100 +++ new/Translator-1.1.0/images/cog.svg 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Generated by IcoMoon.io --> -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> -<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> -<path fill="#555555" d="M14.59 9.535c-0.839-1.454-0.335-3.317 1.127-4.164l-1.572-2.723c-0.449 0.263-0.972 0.414-1.529 0.414-1.68 0-3.042-1.371-3.042-3.062h-3.145c0.004 0.522-0.126 1.051-0.406 1.535-0.839 1.454-2.706 1.948-4.17 1.106l-1.572 2.723c0.453 0.257 0.845 0.634 1.123 1.117 0.838 1.452 0.336 3.311-1.12 4.16l1.572 2.723c0.448-0.261 0.967-0.41 1.522-0.41 1.675 0 3.033 1.362 3.042 3.046h3.145c-0.001-0.517 0.129-1.040 0.406-1.519 0.838-1.452 2.7-1.947 4.163-1.11l1.572-2.723c-0.45-0.257-0.839-0.633-1.116-1.113zM8 11.24c-1.789 0-3.24-1.45-3.24-3.24s1.45-3.24 3.24-3.24c1.789 0 3.24 1.45 3.24 3.24s-1.45 3.24-3.24 3.24z"></path> -</svg> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Translator-1.0.6/images/loop.svg new/Translator-1.1.0/images/loop.svg --- old/Translator-1.0.6/images/loop.svg 2018-01-20 08:30:51.000000000 +0100 +++ new/Translator-1.1.0/images/loop.svg 1970-01-01 01:00:00.000000000 +0100 @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Generated by IcoMoon.io --> -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> -<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> -<g id="icomoon-ignore"> - <line stroke-width="1" x1="" y1="" x2="" y2="" stroke="#449FDB" opacity=""></line> -</g> - <path d="M2 5h10v3l4-4-4-4v3h-12v6h2zM14 11h-10v-3l-4 4 4 4v-3h12v-6h-2z" fill="#555555"></path> -</svg> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Translator-1.0.6/images/mic.svg new/Translator-1.1.0/images/mic.svg --- old/Translator-1.0.6/images/mic.svg 2018-01-20 08:30:51.000000000 +0100 +++ new/Translator-1.1.0/images/mic.svg 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Generated by IcoMoon.io --> -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> -<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> -<path fill="#555555" d="M7.5 11c1.381 0 2.5-1.119 2.5-2.5v-6c0-1.381-1.119-2.5-2.5-2.5s-2.5 1.119-2.5 2.5v6c0 1.381 1.119 2.5 2.5 2.5zM11 7v1.5c0 1.933-1.567 3.5-3.5 3.5s-3.5-1.567-3.5-3.5v-1.5h-1v1.5c0 2.316 1.75 4.223 4 4.472v2.028h-2v1h5v-1h-2v-2.028c2.25-0.249 4-2.156 4-4.472v-1.5h-1z"></path> -</svg> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Translator-1.0.6/images/search.svg new/Translator-1.1.0/images/search.svg --- old/Translator-1.0.6/images/search.svg 2018-01-20 08:30:51.000000000 +0100 +++ new/Translator-1.1.0/images/search.svg 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Generated by IcoMoon.io --> -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> -<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> -<path fill="#444444" d="M15.504 13.616l-3.79-3.223c-0.392-0.353-0.811-0.514-1.149-0.499 0.895-1.048 1.435-2.407 1.435-3.893 0-3.314-2.686-6-6-6s-6 2.686-6 6 2.686 6 6 6c1.486 0 2.845-0.54 3.893-1.435-0.016 0.338 0.146 0.757 0.499 1.149l3.223 3.79c0.552 0.613 1.453 0.665 2.003 0.115s0.498-1.452-0.115-2.003zM6 10c-2.209 0-4-1.791-4-4s1.791-4 4-4 4 1.791 4 4-1.791 4-4 4z"></path> -</svg> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Translator-1.0.6/src/Assets.vala new/Translator-1.1.0/src/Assets.vala --- old/Translator-1.0.6/src/Assets.vala 2018-01-20 08:30:51.000000000 +0100 +++ new/Translator-1.1.0/src/Assets.vala 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +0,0 @@ -public class Assets : GLib.Object { - public static Gtk.Image getImage(string name) { - var global = GlobalSettings.instance(); - return new Gtk.Image.from_file(global.getPath(name)); - } -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Translator-1.0.6/src/GlobalSettings.vala new/Translator-1.1.0/src/GlobalSettings.vala --- old/Translator-1.0.6/src/GlobalSettings.vala 2018-01-20 08:30:51.000000000 +0100 +++ new/Translator-1.1.0/src/GlobalSettings.vala 2018-02-14 19:45:17.000000000 +0100 @@ -1,26 +1,88 @@ - // Global settings public class GlobalSettings : Object { + /// No proxy mode public static int PROXY_MODE_NONE = 0; + + /// Timeout for server respond public static int SERVER_RESPOND_TIMEOUT = 10; + + /// Name of settings schema public static string SCHEMA_NAME = "com.github.rapidfingers.translator"; + + /// Path of translator + /// TODO: remove private string TRANSLATOR_PATH = "/usr/share/com.github.rapidfingers.translator"; + + /// Source lang private string _sourceStartLang = "en"; + + /// Destination lang private string _destStartLang = "ru"; - private LangInfo[] _langs; - private static GlobalSettings _instance; + + /// Possible languages + private Gee.ArrayList<LangInfo> _langs; + + /// Settings of app private Settings _settings; + /// Instance + private static GlobalSettings _instance; + + /// Add language to list + private void addLang(string id, string name) { + _langs.add(new LangInfo() { + id = id, + name = _(name) + }); + } + + /// Init languages + private void initLanguages() { + _langs = new Gee.ArrayList<LangInfo>(); + addLang("en", _("English")); + addLang("ru", _("Russian")); + addLang("uk", _("Ukrainian")); + addLang("de", _("German")); + addLang("pl", _("Polish")); + addLang("fr", _("French")); + addLang("es", _("Spanish")); + addLang("nl", _("Dutch")); + addLang("it", _("Italian")); + addLang("la", _("Latin")); + addLang("el", _("Greek")); + addLang("fi", _("Finnish")); + addLang("sv", _("Swedish")); + addLang("tr", _("Turkish")); + addLang("zh", _("Chinese")); + addLang("ko", _("Korean")); + addLang("ja", _("Japanese")); + addLang("pt", _("Portuguese")); + addLang("cs", _("Czech")); + addLang("et", _("Estonian")); + addLang("sr", _("Serbian")); + addLang("sk", _("Slovak")); + + _langs.sort ((e1, e2) => { + if (e1.name > e2.name) return 1; + if (e1.name == e2.name) return 0; + return -1; + }); + } + + /// Private constructor private GlobalSettings() { _settings = new Settings (SCHEMA_NAME); + initLanguages(); } + /// Get instance of global settings public static GlobalSettings instance() { if (_instance != null) return _instance; _instance = new GlobalSettings(); return _instance; } + /// Set start language for source public void setSourceStartLang(string e) { var lngs = getLangs(); foreach (var l in lngs) { @@ -31,10 +93,12 @@ } } + /// Return start source language public string getSourceStartLang() { return _sourceStartLang; } + /// Set destination start language public void setDestStartLang(string e) { var lngs = getLangs(); foreach (var l in lngs) { @@ -45,10 +109,13 @@ } } + /// Return destination start language public string getDestStartLang() { return _destStartLang; } + /// Return uri for proxy + /// Get proxy settings from system public static Soup.URI getProxyUri() { var settings = new Settings("org.gnome.system.proxy"); var mode = settings.get_enum("mode"); @@ -62,127 +129,13 @@ var proxyUri = new Soup.URI(@"http://$host:$port"); return proxyUri; } - - public LangInfo[] getLangs() { - if (_langs != null) return _langs; - - var res = new Gee.ArrayList<LangInfo>(); - res.add(new LangInfo() { - id = "en", - name = _("English") - }); - - res.add(new LangInfo() { - id = "ru", - name = _("Russian") - }); - - res.add(new LangInfo() { - id = "uk", - name = _("Ukrainian") - }); - - res.add(new LangInfo() { - id = "de", - name = _("German") - }); - - res.add(new LangInfo() { - id = "pl", - name = _("Polish") - }); - - res.add(new LangInfo() { - id = "fr", - name = _("French") - }); - - res.add(new LangInfo() { - id = "es", - name = _("Spanish") - }); - - res.add(new LangInfo() { - id = "nl", - name = _("Dutch") - }); - - res.add(new LangInfo() { - id = "it", - name = _("Italian") - }); - - res.add(new LangInfo() { - id = "la", - name = _("Latin") - }); - - res.add(new LangInfo() { - id = "el", - name = _("Greek") - }); - - res.add(new LangInfo() { - id = "fi", - name = _("Finnish") - }); - - res.add(new LangInfo() { - id = "sv", - name = _("Swedish") - }); - - res.add(new LangInfo() { - id = "tr", - name = _("Turkish") - }); - - res.add(new LangInfo() { - id = "zh", - name = _("Chinese") - }); - - res.add(new LangInfo() { - id = "ko", - name = _("Korean") - }); - - res.add(new LangInfo() { - id = "ja", - name = _("Japanese") - }); - - res.add(new LangInfo() { - id = "pt", - name = _("Portuguese") - }); - - res.add(new LangInfo() { - id = "cs", - name = _("Czech") - }); - - res.add(new LangInfo() { - id = "et", - name = _("Estonian") - }); - - res.add(new LangInfo() { - id = "sr", - name = _("Serbian") - }); - - res.sort ((e1, e2) => { - if (e1.name > e2.name) return 1; - if (e1.name == e2.name) return 0; - return -1; - }); - - _langs = res.to_array(); - - return _langs; + + /// Return possible lang array + public LangInfo[] getLangs() { + return _langs.to_array(); } + /// Return language index public int getLangIndex(string langId) { var lngs = getLangs(); for (var i=0; i < lngs.length; i++) { @@ -194,23 +147,28 @@ return -1; } + /// TODO: Remove? public string getPath(string name) { string path = @"$(TRANSLATOR_PATH)/$(name)"; return path; } + /// Get source lang from settings public string LoadSourceLang() { return _settings.get_string("source-lang"); } + /// Get destination lang from settings public string LoadDestLang() { return _settings.get_string("dest-lang"); } + /// Save source lang to settings public void SaveSourceLang(string s) { _settings.set_string("source-lang", s); } + /// Save destination lang to settings public void SaveDestLang(string s) { _settings.set_string("dest-lang", s); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Translator-1.0.6/src/Main.vala new/Translator-1.1.0/src/Main.vala --- old/Translator-1.0.6/src/Main.vala 2018-01-20 08:30:51.000000000 +0100 +++ new/Translator-1.1.0/src/Main.vala 2018-02-14 19:45:17.000000000 +0100 @@ -2,12 +2,14 @@ private static string? source = null; private static string? dest = null; + /// App console options private const GLib.OptionEntry[] options = { { "source", 's', 0, OptionArg.STRING, ref source, "Source language", "SOURCE" }, { "dest", 'd', 0, OptionArg.STRING, ref dest, "Destination language ", "DESTINATION" }, { null } }; + /// Entry point public static int main (string[] args) { try { var opt_context = new OptionContext ("- Translator app"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Translator-1.0.6/src/TranslatorWindow.vala new/Translator-1.1.0/src/TranslatorWindow.vala --- old/Translator-1.0.6/src/TranslatorWindow.vala 2018-01-20 08:30:51.000000000 +0100 +++ new/Translator-1.1.0/src/TranslatorWindow.vala 2018-02-14 19:45:17.000000000 +0100 @@ -28,6 +28,9 @@ private Gtk.Separator _contentSeparator; private Gtk.TextView topText; private Gtk.TextView bottomText; + /// Translate progress spinner + private Gtk.Spinner _progressSpinner; + private Gtk.Label topLabelLen; private Gtk.Label topLabelLang; private Gtk.Label bottomLabelLang; @@ -52,6 +55,9 @@ // Right language info private LangInfo rightLang; + /// Is translate in progress + private bool _isTranslating = false; + // Create language combos private void languageCombo () { leftLangCombo = new PopoverCombo (); @@ -60,7 +66,26 @@ rightLangCombo.set_margin_right(10); } + // Apply styles + private void styleWindow() { + var style = @" + GtkTextView { + background-color: RGBA(255,0,0,0); + } + .dark-separator { + color: #888; + } + .popovercombo { + border: 1px solid #AAA; + box-shadow: 1px 1px 1px #DDD; + border-radius: 3px; + } + "; + Granite.Widgets.Utils.set_theming_for_screen (this.get_screen (), style, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + } + // Constructor + // TODO: separate to methods public TranslateWindow() { langs = global.getLangs(); @@ -74,12 +99,6 @@ this.set_gravity(Gdk.Gravity.CENTER); this.set_resizable(false); - Gdk.RGBA bgColor = Gdk.RGBA(); - bgColor.red = 1; - bgColor.green = 1; - bgColor.blue = 1; - bgColor.alpha = 1; - _headerPane = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); // Left header @@ -89,22 +108,22 @@ // Create language combo languageCombo (); - changeButton = new Gtk.Button(); - changeButton.set_image(Assets.getImage("images/loop.svg")); + changeButton = new Gtk.Button.from_icon_name("media-playlist-repeat-symbolic"); changeButton.set_tooltip_text(_("Switch language")); changeButton.clicked.connect(onSwap); voiceButton = new Gtk.ToggleButton(); - voiceButton.set_image (Assets.getImage("images/mic.svg")); + //voiceButton.set_image (Assets.getImage("images/mic.svg")); voiceButton.set_tooltip_text(_("Dictation")); dictButton = new Gtk.ToggleButton(); - dictButton.set_image (Assets.getImage("images/book.svg")); + //dictButton.set_image (Assets.getImage("images/book.svg")); + dictButton.set_image(new Gtk.Image.from_icon_name("accessories-dictionary-symbolic", Gtk.IconSize.SMALL_TOOLBAR)); dictButton.set_tooltip_text(_("Dictionary")); dictButton.toggled.connect(onDictToggle); settingsButton = new Gtk.ToggleButton(); - settingsButton.set_image (Assets.getImage("images/cog.svg")); + settingsButton.set_image (new Gtk.Image.from_icon_name("open-menu-symbolic", Gtk.IconSize.SMALL_TOOLBAR)); settingsButton.set_tooltip_text(_("Settings")); _leftHeader.pack_start(leftLangCombo); @@ -122,8 +141,7 @@ _wordInput = new Gtk.Entry(); _wordInput.set_size_request(200,20); _wordInput.activate.connect(onDictSearch); - _searchWordButton = new Gtk.Button(); - _searchWordButton.set_image(Assets.getImage("images/search.svg")); + _searchWordButton = new Gtk.Button.from_icon_name("edit-find-symbolic"); _searchWordButton.set_tooltip_text(_("Search")); _searchWordButton.clicked.connect(onDictSearch); _searchWordButton.margin_right = 6; @@ -163,7 +181,6 @@ _contentBox.pack_start(_rightBox, true, true); var paned = new Gtk.Paned(Gtk.Orientation.VERTICAL); - paned.override_background_color(Gtk.StateFlags.NORMAL, bgColor); _leftBox.pack_start(paned); topText = new Gtk.TextView(); @@ -177,6 +194,9 @@ topScroll.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC); topScroll.add (topText); + /// Translate destination + var bottomOverlay = new Gtk.Overlay(); + bottomText = new Gtk.TextView(); bottomText.set_editable(false); bottomText.set_margin_top(7); @@ -185,18 +205,25 @@ bottomText.override_font(fd); bottomText.set_cursor_visible(false); bottomText.set_wrap_mode(Gtk.WrapMode.WORD_CHAR); - + var bottomScroll = new Gtk.ScrolledWindow (null, null); bottomScroll.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC); - bottomScroll.add (bottomText); + bottomScroll.add (bottomText); + + _progressSpinner = new Gtk.Spinner (); + _progressSpinner.active = false; + _progressSpinner.margin = 70; + + bottomOverlay.add(bottomScroll); + bottomOverlay.add_overlay(_progressSpinner); var topBox = new Gtk.Box(Gtk.Orientation.VERTICAL, 0); var topLabelBox = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 0); topLabelLang = new Gtk.Label(""); topLabelLang.set_margin_bottom(3); - topLabelLen = new Gtk.Label(""); - topLabelLen.set_markup(@"<span size=\"small\" color=\"#555555\">0/$MAX_CHARS</span>"); + topLabelLen = new Gtk.Label(""); + topLabelLen.set_markup(@"<span size=\"small\">0/$MAX_CHARS</span>"); topLabelLen.set_margin_bottom(3); topLabelBox.pack_start(topLabelLang, false, true, 5); @@ -211,7 +238,7 @@ bottomLabelLang.set_margin_bottom(3); bottomLabelBox.pack_start(bottomLabelLang, false, true, 5); - bottomBox.pack_start(bottomScroll); + bottomBox.pack_start(bottomOverlay); bottomBox.pack_start(bottomLabelBox, false, true, 0); paned.pack1(topBox, true, true); @@ -219,11 +246,7 @@ var dictBox = new Gtk.Box(Gtk.Orientation.VERTICAL, 0); var dictLabelBox = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 0); - var bgColor2 = Gdk.RGBA(); - bgColor.red = 0.9; - bgColor.green = 0.9; - bgColor.blue = 0.9; - bgColor.alpha = 1; + _dictText = new Gtk.TextView(); _dictText.set_editable(false); _dictText.set_margin_top(7); @@ -232,13 +255,11 @@ _dictText.set_wrap_mode(Gtk.WrapMode.WORD); _dictText.set_cursor_visible(false); var dictScroll = new Gtk.ScrolledWindow (null, null); - dictScroll.set_policy (Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC); - _dictText.override_background_color(Gtk.StateFlags.NORMAL, bgColor2); - dictScroll.override_background_color(Gtk.StateFlags.NORMAL, bgColor2); + dictScroll.set_policy (Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC); dictScroll.add (_dictText); _dictLangLabel = new Gtk.Label(""); - _dictLangLabel.set_markup(@"<span size=\"small\" color=\"#555555\">en-ru</span>"); + _dictLangLabel.set_markup(@"<span size=\"small\">en-ru</span>"); _dictLangLabel.set_margin_bottom(3); dictLabelBox.pack_start(_dictLangLabel, false, true, 5); @@ -255,32 +276,24 @@ populateLangs(); refreshLangLabels(); - HideDictionary(); + hideDictionary(); - var style = @" - .dark-separator { - color: #888; - } - .popovercombo { - border: 1px solid #AAA; - box-shadow: 1px 1px 1px #DDD; - border-radius: 3px; - } - "; - Granite.Widgets.Utils.set_theming_for_screen (this.get_screen (), style, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + styleWindow(); this.destroy.connect(onWindowDestroy); } + /// On toggle dictionary panel private void onDictToggle() { if (!dictButton.active) { - HideDictionary(); + hideDictionary(); } else { - ShowDictionary(); + showDictionary(); } } - private void ShowDictionary() { + /// Show dictionary + private void showDictionary() { _rightHeader.no_show_all = false; _rightHeader.show_all(); _rightBox.no_show_all = false; @@ -289,7 +302,7 @@ _contentSeparator.show_all(); } - private void HideDictionary() { + private void hideDictionary() { _rightHeader.no_show_all = true; _rightHeader.hide(); _rightBox.no_show_all = true; @@ -321,9 +334,9 @@ private void refreshLangLabels() { var llang = getLeftLang().name; var rlang = getRightLang().name; - topLabelLang.set_markup(@"<span size=\"small\" color=\"#555555\">$llang</span>"); - bottomLabelLang.set_markup(@"<span size=\"small\" color=\"#555555\">$rlang</span>"); - _dictLangLabel.set_markup(@"<span size=\"small\" color=\"#555555\">$llang - $rlang</span>"); + topLabelLang.set_markup(@"<span size=\"small\">$llang</span>"); + bottomLabelLang.set_markup(@"<span size=\"small\">$rlang</span>"); + _dictLangLabel.set_markup(@"<span size=\"small\">$llang - $rlang</span>"); } // Get language id from left combobox @@ -381,9 +394,11 @@ // On text update private void onUpdate() { + if (_isTranslating) return; + if (topText.buffer.text.length < 1) { bottomText.buffer.text = ""; - topLabelLen.set_markup(@"<span size=\"small\" color=\"#555555\">0/$MAX_CHARS</span>"); + topLabelLen.set_markup(@"<span size=\"small\">0/$MAX_CHARS</span>"); return; } @@ -394,12 +409,18 @@ topText.buffer.set_text(txt, MAX_CHARS); return; } - topLabelLen.set_markup(@"<span size=\"small\" color=\"#555555\">$len/$MAX_CHARS</span>"); + topLabelLen.set_markup(@"<span size=\"small\">$len/$MAX_CHARS</span>"); - service.Translate(leftLang.id, rightLang.id, topText.buffer.text); + _isTranslating = true; + _progressSpinner.active = true; + service.Translate(leftLang.id, rightLang.id, topText.buffer.text); } + /// On translate complete private void onTranslate(string[] text) { + _isTranslating = false; + _progressSpinner.active = false; + if ((text == null) || (text.length < 1)) return; if (topText.buffer.text.length < 1) { bottomText.buffer.text = ""; @@ -434,6 +455,7 @@ } } + /// On window destroy private void onWindowDestroy() { var global = GlobalSettings.instance(); global.SaveSourceLang(leftLang.id); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Translator-1.0.6/src/widgets/PopoverCombo.vala new/Translator-1.1.0/src/widgets/PopoverCombo.vala --- old/Translator-1.0.6/src/widgets/PopoverCombo.vala 2018-01-20 08:30:51.000000000 +0100 +++ new/Translator-1.1.0/src/widgets/PopoverCombo.vala 2018-02-14 19:45:17.000000000 +0100 @@ -54,7 +54,7 @@ label = new Gtk.Label (""); label.halign = Gtk.Align.START; - image = Assets.getImage ("images/caret-down.svg"); + image = new Gtk.Image.from_icon_name("pan-down-symbolic", Gtk.IconSize.SMALL_TOOLBAR); image.margin_right = 4; box.pack_start(label, true, true); box.pack_start(image, false, false);
