Skip to content

Commit

Permalink
Small features
Browse files Browse the repository at this point in the history
Former-commit-id: 4424a8a
  • Loading branch information
tkashkin committed Jul 7, 2018
1 parent 12fb5ed commit 1be81e1
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 38 deletions.
5 changes: 5 additions & 0 deletions data/com.github.tkashkin.gamehub.appdata.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
</screenshots>

<releases>
<release version="0.4.1" date="2018-07-07">
<description>
<p>Small features</p>
</description>
</release>
<release version="0.4.0" date="2018-07-03">
<description>
<p>Unneeded game sources now can be disabled</p>
Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
com.github.tkashkin.gamehub (0.4.1) xenial; urgency=low

* Small features

-- tkashkin <[email protected]> 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
Expand Down
2 changes: 2 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -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')
Expand Down
18 changes: 11 additions & 7 deletions po/com.github.tkashkin.gamehub.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -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 ""

Expand Down Expand Up @@ -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 ""

Expand Down
18 changes: 11 additions & 7 deletions po/ru.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 "Выбрать"

Expand Down Expand Up @@ -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 "Установить"

Expand Down
53 changes: 33 additions & 20 deletions src/data/sources/humble/HumbleGame.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}
Expand All @@ -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())
Expand Down
23 changes: 22 additions & 1 deletion src/ui/dialogs/GameInstallDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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();
Expand All @@ -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;
}

Expand All @@ -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)
Expand All @@ -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();
Expand Down
11 changes: 9 additions & 2 deletions src/ui/windows/WebAuthWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
Expand Down

0 comments on commit 1be81e1

Please sign in to comment.