Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
Former-commit-id: e0f80f7
  • Loading branch information
tkashkin committed Jun 1, 2018
1 parent 3204386 commit d8fd6d6
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 45 deletions.
2 changes: 1 addition & 1 deletion data/com.github.tkashkin.gamehub.appdata.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</custom>

<releases>
<release version="0.2.2" date="2018-06-01">
<release version="0.2.3" date="2018-06-01">
<description>
<p>GOG games installation and running</p>
<p>Various improvements</p>
Expand Down
4 changes: 2 additions & 2 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
com.github.tkashkin.gamehub (0.2.2) xenial; urgency=low
com.github.tkashkin.gamehub (0.2.3) xenial; urgency=low

* GOG games installation and running
* Various improvements

-- tkashkin <[email protected]> Fri, 01 Jun 2018 04:12:18 +0300
-- tkashkin <[email protected]> Fri, 01 Jun 2018 14:36:24 +0300

com.github.tkashkin.gamehub (0.1.3) xenial; urgency=low

Expand Down
6 changes: 3 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ project('com.github.tkashkin.gamehub', 'vala', 'c', version: '0.2.2')
i18n = import('i18n')
gnome = import('gnome')

add_global_arguments('-g', language: 'vala')
add_global_arguments('-X', language: 'vala')
add_global_arguments('-rdynamic', language: 'vala')
#add_global_arguments('-g', language: 'vala')
#add_global_arguments('-X', language: 'vala')
#add_global_arguments('-rdynamic', language: 'vala')
add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()), language: 'c')

subdir('data')
Expand Down
2 changes: 1 addition & 1 deletion src/data/GamesDB.vala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace GameHub.Data

if(Database.open(path, out db) != Sqlite.OK)
{
error("Can't open games database: " + db.errmsg());
warning("Can't open games database: " + db.errmsg());
db = null;
return;
}
Expand Down
19 changes: 12 additions & 7 deletions src/data/sources/gog/GOGGame.vala
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,19 @@ namespace GameHub.Data.Sources.GOG
var local = FSUtils.expand(FSUtils.Paths.GOG.Installers, "gog_" + id + "_" + installer.id + ".sh");

Downloader.get_instance().download.begin(File.new_for_uri(link), { local }, progress, null, (obj, res) => {
var file = Downloader.get_instance().download.end(res).get_path();
FSUtils.mkdir(FSUtils.Paths.GOG.Games);
var install_dir = FSUtils.expand(FSUtils.Paths.GOG.Games, name.escape().replace(" ", "_").replace("'", "\\'"));
Utils.run(@"chmod +x '$(file)'");
Utils.run_async.begin(@"'$(file)' -- --i-agree-to-all-licenses --noreadme --nooptions --noprompt --destination \"$(install_dir)\"", (obj, res) => {
Utils.run_async.end(res);
try
{
var file = Downloader.get_instance().download.end(res).get_path();
FSUtils.mkdir(FSUtils.Paths.GOG.Games);
var install_dir = FSUtils.expand(FSUtils.Paths.GOG.Games, name.escape().replace(" ", "_").replace("'", "\\'"));
Utils.run(@"chmod +x '$(file)'");
Utils.run_async(@"'$(file)' -- --i-agree-to-all-licenses --noreadme --nooptions --noprompt --destination \"$(install_dir)\"");
Idle.add(install.callback);
});
}
catch(Error e)
{
warning(e.message);
}
});
});

Expand Down
1 change: 0 additions & 1 deletion src/data/sources/steam/SteamGame.vala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace GameHub.Data.Sources.Steam
id = json.get_int_member("appid").to_string();
name = json.get_string_member("name");
var icon_hash = json.get_string_member("img_icon_url");
var image_hash = json.get_string_member("img_logo_url");
icon = @"https://media.steampowered.com/steamcommunity/public/images/apps/$(id)/$(icon_hash).jpg";
image = @"https://cdn.akamai.steamstatic.com/steam/apps/$(id)/header.jpg";
int64 minutes = json.get_int_member("playtime_forever");
Expand Down
1 change: 0 additions & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ executable(
dependency('libsoup-2.4'),
dependency('sqlite3'),
#dependency('ivy'),
meson.get_compiler('vala').find_library('posix'),
],
install: true
)
3 changes: 1 addition & 2 deletions src/ui/views/GamesGridView/GameCard.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ namespace GameHub.UI.Views
private Label label;

private Box actions;
private Button run;

private const int CARD_WIDTH_MIN = 320;
private const int CARD_WIDTH_MAX = 680;
Expand Down Expand Up @@ -138,7 +137,7 @@ namespace GameHub.UI.Views
}
catch(Error e)
{
error(e.message);
warning(e.message);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/ui/widgets/AutoSizeImage.vala
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ namespace GameHub.UI.Widgets
switch(constraint)
{
case Orientation.HORIZONTAL:
set_size_request(cmin, -1);
set_size_request(cmin, (int) (cmin * ratio));
break;

case Orientation.VERTICAL:
set_size_request(-1, cmin);
set_size_request((int) (cmin / ratio), cmin);
break;
}
}
Expand Down Expand Up @@ -55,7 +55,7 @@ namespace GameHub.UI.Widgets

case Orientation.VERTICAL:
new_height = int.max(cmin, int.min(cmax, rect.height));
new_width = (int) (new_height * ratio);
new_width = (int) (new_height / ratio);
break;
}

Expand Down
9 changes: 0 additions & 9 deletions src/ui/windows/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ namespace GameHub.UI.Windows

saved_state = SavedState.get_instance();

Unix.signal_add(Posix.Signal.INT, quit_source_func, Priority.HIGH);
Unix.signal_add(Posix.Signal.TERM, quit_source_func, Priority.HIGH);

delete_event.connect(() => { quit(); return false; });

restore_saved_state();
Expand Down Expand Up @@ -117,12 +114,6 @@ namespace GameHub.UI.Windows
saved_state.window_x = x;
saved_state.window_y = y;
}

public bool quit_source_func()
{
quit();
return false;
}

private void quit()
{
Expand Down
12 changes: 6 additions & 6 deletions src/utils/Downloader.vala
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ namespace GameHub.Utils
public File cached_file;
public DownloadProgress progress;

public Download(File remote_file, File cached_file, DownloadProgress progress)
public Download(File remote_file, File cached_file, owned DownloadProgress progress)
{
this.remote_file = remote_file;
this.uri = remote_file.get_uri();
this.cached_file = cached_file;
this.progress = progress;
this.progress = (owned) progress;
}
}

Expand Down Expand Up @@ -57,7 +57,7 @@ namespace GameHub.Utils
var cached_path = cached_paths[0];

if(download != null)
return yield await_download(download, cached_path, progress);
return yield await_download(download, cached_path, (d, t) => progress(d, t));

var cached_file = get_cached_file(remote_file, cached_paths);
if(cached_file != null)
Expand All @@ -66,7 +66,7 @@ namespace GameHub.Utils
var tmp_path = cached_path + "~";
var tmp_file = GLib.File.new_for_path(tmp_path);
debug("Downloading '%s'...", uri);
download = new Download(remote_file, tmp_file, progress);
download = new Download(remote_file, tmp_file, (d, t) => progress(d, t));
downloads.set(uri, download);

try
Expand Down Expand Up @@ -162,7 +162,7 @@ namespace GameHub.Utils
}
}

private async File? await_download(Download download, string cached_path, DownloadProgress progress) throws GLib.Error
private async File? await_download(Download download, string cached_path, owned DownloadProgress progress) throws GLib.Error
{
File downloaded_file = null;
GLib.Error download_error = null;
Expand All @@ -173,7 +173,7 @@ namespace GameHub.Utils
return;

downloaded_file = downloaded.cached_file;
callback ();
callback();
});
var downloaded_failed_id = download_failed.connect((downloader, failed_download, error) => {
if (failed_download.uri != download.uri)
Expand Down
4 changes: 2 additions & 2 deletions src/utils/FSUtils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ namespace GameHub.Utils
}
catch(Error e)
{
error(e.message);
warning(e.message);
}
return null;
}
Expand All @@ -96,7 +96,7 @@ namespace GameHub.Utils
}
catch(Error e)
{
error(e.message);
warning(e.message);
}
return null;
}
Expand Down
6 changes: 3 additions & 3 deletions src/utils/Parser.vala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace GameHub.Utils
}
catch(Error e)
{
error(e.message);
warning(e.message);
}
return data;
}
Expand Down Expand Up @@ -67,7 +67,7 @@ namespace GameHub.Utils
}
catch(GLib.Error e)
{
error(e.message);
warning(e.message);
}
return new Json.Object();
}
Expand Down Expand Up @@ -136,7 +136,7 @@ namespace GameHub.Utils
}
catch(Error e)
{
error(e.message);
warning(e.message);
}

return "{" + json + "}";
Expand Down
8 changes: 4 additions & 4 deletions src/utils/Utils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace GameHub.Utils
}
catch(Error e)
{
error(e.message);
warning(e.message);
}
}

Expand All @@ -28,20 +28,20 @@ namespace GameHub.Utils
}
catch (Error e)
{
error(e.message);
warning(e.message);
}
return stdout;
}

public static async void run_async(string cmd)
public static void run_async(string cmd)
{
try
{
Process.spawn_command_line_async(cmd);
}
catch (Error e)
{
error(e.message);
warning(e.message);
}
}

Expand Down

0 comments on commit d8fd6d6

Please sign in to comment.