diff --git a/data/com.github.tkashkin.gamehub.gresource.xml b/data/com.github.tkashkin.gamehub.gresource.xml index 6f9b6ab4..127a483e 100644 --- a/data/com.github.tkashkin.gamehub.gresource.xml +++ b/data/com.github.tkashkin.gamehub.gresource.xml @@ -1,6 +1,7 @@ - - GameHub.css + + css/app.css + css/themes/elementary.css diff --git a/data/GameHub.css b/data/css/app.css similarity index 98% rename from data/GameHub.css rename to data/css/app.css index 9bc97f78..ee317064 100755 --- a/data/GameHub.css +++ b/data/css/app.css @@ -1,7 +1,3 @@ -@define-color colorAccent #a56de2; -@define-color selected_bg_color @colorAccent; -@define-color theme_selected_bg_color @colorAccent; - .gamecard { opacity: 0.75; diff --git a/data/css/themes/elementary.css b/data/css/themes/elementary.css new file mode 100644 index 00000000..de76ae11 --- /dev/null +++ b/data/css/themes/elementary.css @@ -0,0 +1,5 @@ +@define-color colorPrimary mix(#7239b3, @titlebar_color, 0.2); +@define-color colorAccent #8c53cb; +@define-color theme_selected_bg_color @colorAccent; +@define-color textColorPrimary mix(@colorPrimary, #fafafa, 0.95); +@define-color textColorPrimaryShadow alpha(#7239b3, 0.4); diff --git a/src/app.vala b/src/app.vala index ac138e71..9fbeba9d 100644 --- a/src/app.vala +++ b/src/app.vala @@ -151,9 +151,28 @@ namespace GameHub weak IconTheme default_theme = IconTheme.get_default(); default_theme.add_resource_path("/com/github/tkashkin/gamehub/icons"); - var provider = new CssProvider(); - provider.load_from_resource("/com/github/tkashkin/gamehub/GameHub.css"); - StyleContext.add_provider_for_screen(Screen.get_default(), provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + var screen = Screen.get_default(); + + var app_provider = new CssProvider(); + app_provider.load_from_resource("/com/github/tkashkin/gamehub/css/app.css"); + + var elementary_provider = new CssProvider(); + elementary_provider.load_from_resource("/com/github/tkashkin/gamehub/css/themes/elementary.css"); + + StyleContext.add_provider_for_screen(screen, app_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + + var settings = Gtk.Settings.get_for_screen(screen); + settings.notify["gtk-theme-name"].connect(() => { + if(settings.gtk_theme_name == "elementary") + { + StyleContext.add_provider_for_screen(screen, elementary_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + } + else + { + StyleContext.remove_provider_for_screen(screen, elementary_provider); + } + }); + settings.notify_property("gtk-theme-name"); } protected override void activate() diff --git a/src/data/sources/humble/HumbleGame.vala b/src/data/sources/humble/HumbleGame.vala index 7545deb7..49d637bc 100644 --- a/src/data/sources/humble/HumbleGame.vala +++ b/src/data/sources/humble/HumbleGame.vala @@ -419,7 +419,7 @@ namespace GameHub.Data.Sources.Humble public bool is_url_update_required() { - if(part.url == null || part.url.length == 0) return true; + if(part.url == null || part.url.length == 0 || part.url.has_prefix("humble-trove-unsigned://")) return true; if(!part.url.contains("&ttl=")) return false; var ttl_string = part.url.split("&ttl=")[1].split("&")[0]; var ttl = new DateTime.from_unix_utc(int64.parse(ttl_string)); @@ -432,9 +432,13 @@ namespace GameHub.Data.Sources.Humble { if(!(game.source is Trove) || !is_url_update_required()) return null; - //debug("[HumbleGame.Installer.update_url] Old URL: '%s'; (%s)", part.url, game.full_id); var new_url = Trove.sign_url(id, dl_id, ((Humble) game.source).user_token); - //debug("[HumbleGame.Installer.update_url] New URL: '%s'; (%s)", new_url, game.full_id); + + if(GameHub.Application.log_verbose) + { + debug("[HumbleGame.Installer.update_url] Old URL: '%s'; (%s)", part.url, game.full_id); + debug("[HumbleGame.Installer.update_url] New URL: '%s'; (%s)", new_url, game.full_id); + } if(new_url != null) part.url = new_url; diff --git a/src/data/sources/humble/Trove.vala b/src/data/sources/humble/Trove.vala index 15b57a6c..846629ed 100644 --- a/src/data/sources/humble/Trove.vala +++ b/src/data/sources/humble/Trove.vala @@ -153,7 +153,14 @@ namespace GameHub.Data.Sources.Humble var signed_node = Parser.parse_remote_json_file(Trove.SIGN_URL, "POST", null, headers, data); var signed = signed_node != null && signed_node.get_node_type() == Json.NodeType.OBJECT ? signed_node.get_object() : null; - return signed != null && signed.has_member("signed_url") ? signed.get_string_member("signed_url") : null; + var signed_url = signed != null && signed.has_member("signed_url") ? signed.get_string_member("signed_url") : null; + + if(GameHub.Application.log_verbose) + { + debug("[Trove.sign_url] '%s':'%s' -> '%s'", machine_name, filename, signed_url); + } + + return signed_url; } } }