From 1be81e155f727a3dd27cdaae81f92a3159741126 Mon Sep 17 00:00:00 2001 From: tkashkin Date: Sat, 7 Jul 2018 10:05:21 +0300 Subject: [PATCH] Small features Former-commit-id: 4424a8a9b0700998c4f2c2a6efb911b1daa6856f --- ...com.github.tkashkin.gamehub.appdata.xml.in | 5 ++ debian/changelog | 6 +++ debian/control | 2 + meson.build | 2 +- po/com.github.tkashkin.gamehub.pot | 18 ++++--- po/ru.po | 18 ++++--- src/data/sources/humble/HumbleGame.vala | 53 ++++++++++++------- src/ui/dialogs/GameInstallDialog.vala | 23 +++++++- src/ui/windows/WebAuthWindow.vala | 11 +++- 9 files changed, 100 insertions(+), 38 deletions(-) diff --git a/data/com.github.tkashkin.gamehub.appdata.xml.in b/data/com.github.tkashkin.gamehub.appdata.xml.in index bf92ad31..e55ad3fc 100644 --- a/data/com.github.tkashkin.gamehub.appdata.xml.in +++ b/data/com.github.tkashkin.gamehub.appdata.xml.in @@ -40,6 +40,11 @@ + + +

Small features

+
+

Unneeded game sources now can be disabled

diff --git a/debian/changelog b/debian/changelog index 040895ab..04272418 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +com.github.tkashkin.gamehub (0.4.1) xenial; urgency=low + + * Small features + + -- tkashkin Tue, 07 Jul 2018 09:40:55 +0300 + com.github.tkashkin.gamehub (0.4.0) xenial; urgency=low * Unneeded game sources now can be disabled diff --git a/debian/control b/debian/control index 9046cdda..00d2d11c 100644 --- a/debian/control +++ b/debian/control @@ -18,4 +18,6 @@ Standards-Version: 4.1.4 Package: com.github.tkashkin.gamehub Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends} +Recommends: file-roller +Suggests: steam Description: All your games in one place diff --git a/meson.build b/meson.build index fabba792..8b5a5c19 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('com.github.tkashkin.gamehub', 'vala', 'c', version: '0.4.0') +project('com.github.tkashkin.gamehub', 'vala', 'c', version: '0.4.1') i18n = import('i18n') gnome = import('gnome') diff --git a/po/com.github.tkashkin.gamehub.pot b/po/com.github.tkashkin.gamehub.pot index 168a2fc9..df9e5210 100644 --- a/po/com.github.tkashkin.gamehub.pot +++ b/po/com.github.tkashkin.gamehub.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: com.github.tkashkin.gamehub\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-07-03 04:35+0300\n" +"POT-Creation-Date: 2018-07-07 09:38+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -44,16 +44,16 @@ msgid "" "Login into your account in Steam client and return to GameHub" msgstr "" -#: src/data/sources/humble/HumbleGame.vala:166 +#: src/data/sources/humble/HumbleGame.vala:189 msgid "Select main executable of the game" msgstr "" -#: src/data/sources/humble/HumbleGame.vala:167 -#: src/ui/dialogs/GameInstallDialog.vala:75 +#: src/data/sources/humble/HumbleGame.vala:190 +#: src/ui/dialogs/GameInstallDialog.vala:84 msgid "Cancel" msgstr "" -#: src/data/sources/humble/HumbleGame.vala:167 +#: src/data/sources/humble/HumbleGame.vala:190 msgid "Select" msgstr "" @@ -89,11 +89,15 @@ msgstr "" msgid "Close" msgstr "" -#: src/ui/dialogs/GameInstallDialog.vala:48 +#: src/ui/dialogs/GameInstallDialog.vala:51 msgid "Select game installer" msgstr "" -#: src/ui/dialogs/GameInstallDialog.vala:76 +#: src/ui/dialogs/GameInstallDialog.vala:88 +msgid "Import" +msgstr "" + +#: src/ui/dialogs/GameInstallDialog.vala:91 msgid "Install" msgstr "" diff --git a/po/ru.po b/po/ru.po index af9cf749..9b98d9c1 100644 --- a/po/ru.po +++ b/po/ru.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: com.github.tkashkin.gamehub\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-07-03 04:35+0300\n" +"POT-Creation-Date: 2018-07-07 09:38+0300\n" "PO-Revision-Date: 2018-05-27 03:39+0300\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -46,16 +46,16 @@ msgstr "" "Файл конфигурации Steam не найден.\n" "Войдите в ваш аккаунт в клиенте Steam и вернитесь в GameHub" -#: src/data/sources/humble/HumbleGame.vala:166 +#: src/data/sources/humble/HumbleGame.vala:189 msgid "Select main executable of the game" msgstr "Выберите исполняемый файл игры" -#: src/data/sources/humble/HumbleGame.vala:167 -#: src/ui/dialogs/GameInstallDialog.vala:75 +#: src/data/sources/humble/HumbleGame.vala:190 +#: src/ui/dialogs/GameInstallDialog.vala:84 msgid "Cancel" msgstr "Отмена" -#: src/data/sources/humble/HumbleGame.vala:167 +#: src/data/sources/humble/HumbleGame.vala:190 msgid "Select" msgstr "Выбрать" @@ -91,11 +91,15 @@ msgstr "Папка игр Humble Bundle" msgid "Close" msgstr "Закрыть" -#: src/ui/dialogs/GameInstallDialog.vala:48 +#: src/ui/dialogs/GameInstallDialog.vala:51 msgid "Select game installer" msgstr "Выберите установочный файл игры" -#: src/ui/dialogs/GameInstallDialog.vala:76 +#: src/ui/dialogs/GameInstallDialog.vala:88 +msgid "Import" +msgstr "Импортировать" + +#: src/ui/dialogs/GameInstallDialog.vala:91 msgid "Install" msgstr "Установить" diff --git a/src/data/sources/humble/HumbleGame.vala b/src/data/sources/humble/HumbleGame.vala index 6d324ad9..2116a703 100644 --- a/src/data/sources/humble/HumbleGame.vala +++ b/src/data/sources/humble/HumbleGame.vala @@ -162,26 +162,7 @@ namespace GameHub.Data.Sources.Humble Utils.run_async.begin(cmd, true, (obj, res) => { Utils.run_async.end(res); Utils.run(@"chmod -R +x \"$(install_dir)\""); - - var chooser = new FileChooserDialog(_("Select main executable of the game"), GameHub.UI.Windows.MainWindow.instance, - FileChooserAction.OPEN, _("Cancel"), ResponseType.CANCEL, _("Select"), ResponseType.ACCEPT); - var filter = new FileFilter(); - filter.add_mime_type("application/x-executable"); - filter.add_mime_type("application/x-elf"); - filter.add_mime_type("application/x-sh"); - filter.add_mime_type("text/x-shellscript"); - chooser.set_filter(filter); - chooser.select_file(executable); - - if(chooser.run() == ResponseType.ACCEPT) - { - executable = chooser.get_file(); - custom_info = @"{\"order\":\"$(order_id)\",\"executable\":\"$(executable.get_path())\"}"; - GamesDB.get_instance().add_game(this); - } - - chooser.destroy(); - + choose_executable(); Idle.add(install.callback); }); } @@ -192,12 +173,44 @@ namespace GameHub.Data.Sources.Humble }); }); + wnd.import.connect(() => { + choose_executable(); + Idle.add(install.callback); + }); + wnd.show_all(); wnd.present(); yield; } + private void choose_executable() + { + var chooser = new FileChooserDialog(_("Select main executable of the game"), GameHub.UI.Windows.MainWindow.instance, FileChooserAction.OPEN); + var filter = new FileFilter(); + filter.add_mime_type("application/x-executable"); + filter.add_mime_type("application/x-elf"); + filter.add_mime_type("application/x-sh"); + filter.add_mime_type("text/x-shellscript"); + chooser.set_filter(filter); + chooser.select_file(executable); + + chooser.add_button(_("Cancel"), ResponseType.CANCEL); + var select_btn = chooser.add_button(_("Select"), ResponseType.ACCEPT); + + select_btn.get_style_context().add_class(STYLE_CLASS_SUGGESTED_ACTION); + select_btn.grab_default(); + + if(chooser.run() == ResponseType.ACCEPT) + { + executable = chooser.get_file(); + custom_info = @"{\"order\":\"$(order_id)\",\"executable\":\"$(executable.get_path())\"}"; + GamesDB.get_instance().add_game(this); + } + + chooser.destroy(); + } + public override async void run() { if(is_installed()) diff --git a/src/ui/dialogs/GameInstallDialog.vala b/src/ui/dialogs/GameInstallDialog.vala index 6f291906..7929fd3c 100644 --- a/src/ui/dialogs/GameInstallDialog.vala +++ b/src/ui/dialogs/GameInstallDialog.vala @@ -11,6 +11,9 @@ namespace GameHub.UI.Dialogs { public class GameInstallDialog: Granite.MessageDialog { + private const int RESPONSE_IMPORT = 123; + + public signal void import(); public signal void install(Game.Installer installer); public signal void canceled(); @@ -26,6 +29,11 @@ namespace GameHub.UI.Dialogs image_icon = Icon.new_for_string("go-down"); + if(game.icon != null) + { + image_icon = new FileIcon(File.new_for_uri(game.icon)); + } + primary_text = game.name; installers_list = new ListBox(); @@ -46,6 +54,7 @@ namespace GameHub.UI.Dialogs if(installers.size > 1) { secondary_text = _("Select game installer"); + custom_bin.hexpand = true; custom_bin.child = installers_list; } @@ -57,7 +66,13 @@ namespace GameHub.UI.Dialogs case ResponseType.CANCEL: destroy(); break; - + + case GameInstallDialog.RESPONSE_IMPORT: + is_finished = true; + import(); + destroy(); + break; + case ResponseType.ACCEPT: var installer = installers[0]; if(installers.size > 1) @@ -73,6 +88,12 @@ namespace GameHub.UI.Dialogs }); add_button(_("Cancel"), ResponseType.CANCEL); + + if(game is HumbleGame) + { + add_button(_("Import"), GameInstallDialog.RESPONSE_IMPORT); + } + var install_btn = add_button(_("Install"), ResponseType.ACCEPT); install_btn.get_style_context().add_class(STYLE_CLASS_SUGGESTED_ACTION); install_btn.grab_default(); diff --git a/src/ui/windows/WebAuthWindow.vala b/src/ui/windows/WebAuthWindow.vala index 7d8967cc..419ce689 100644 --- a/src/ui/windows/WebAuthWindow.vala +++ b/src/ui/windows/WebAuthWindow.vala @@ -25,6 +25,9 @@ namespace GameHub.UI.Windows titlebar.show_close_button = true; set_titlebar(titlebar); + var spinner = new Spinner(); + titlebar.pack_end(spinner); + set_size_request(640, 800); set_modal(true); @@ -39,14 +42,18 @@ namespace GameHub.UI.Windows webview.get_settings().enable_mediasource = true; webview.get_settings().enable_smooth_scrolling = true; - webview.user_content_manager.add_style_sheet(new UserStyleSheet(".account-bbm-wrapper{background:#333 !important}", UserContentInjectedFrames.TOP_FRAME, UserStyleLevel.USER, null, null)); + var style = ".banner,.navigation-container-v2,.tabbar,.base-main-wrapper,.site-footer,.evidon-banner{display:none !important}body{overflow:hidden !important}"; + string[] whitelist = {"https://*.humblebundle.com/*"}; + webview.user_content_manager.add_style_sheet(new UserStyleSheet(style, UserContentInjectedFrames.TOP_FRAME, UserStyleLevel.USER, whitelist, null)); webview.load_changed.connect(e => { var uri = webview.get_uri(); titlebar.title = webview.title; titlebar.subtitle = uri.split("?")[0]; titlebar.tooltip_text = uri; - + + spinner.active = e != LoadEvent.FINISHED; + debug("[WebAuth/%s] URI: `%s`", source, uri); if(!is_finished && success_cookie_name != null)