[libgnome-games-support/arnaudb/issue-18: 2/2] Do not assume icon name.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgnome-games-support/arnaudb/issue-18: 2/2] Do not assume icon name.
- Date: Mon, 22 Jun 2020 13:06:58 +0000 (UTC)
commit a8872419841332055b67fd65aaf27137315324cc
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Thu Mar 12 14:37:31 2020 +0100
Do not assume icon name.
Icon has now usually a different name
than the one used by the application.
Fixes #18.
games/scores/context.vala | 29 ++++++++++++++++++++++++++---
games/scores/dialog.vala | 4 ++--
2 files changed, 28 insertions(+), 5 deletions(-)
---
diff --git a/games/scores/context.vala b/games/scores/context.vala
index d5a070a..89ca6e4 100644
--- a/games/scores/context.vala
+++ b/games/scores/context.vala
@@ -37,6 +37,7 @@ public class Context : Object
public Gtk.Window? game_window { get; construct; }
public Style style { get; construct; }
public Importer? importer { get; construct; }
+ public string icon_name { get; construct; }
private Category? current_category = null;
@@ -73,7 +74,17 @@ public class Context : Object
CategoryRequestFunc category_request,
Style style)
{
- this.with_importer (app_name, category_type, game_window, category_request, style, null);
+ this.with_importer_and_icon_name (app_name, category_type, game_window, category_request, style,
null, null);
+ }
+
+ public Context.with_icon_name (string app_name,
+ string category_type,
+ Gtk.Window? game_window,
+ CategoryRequestFunc category_request,
+ Style style,
+ string icon_name)
+ {
+ this.with_importer_and_icon_name (app_name, category_type, game_window, category_request, style,
null, icon_name);
}
public Context.with_importer (string app_name,
@@ -82,12 +93,24 @@ public class Context : Object
CategoryRequestFunc category_request,
Style style,
Importer? importer)
+ {
+ this.with_importer_and_icon_name (app_name, category_type, game_window, category_request, style,
importer, null);
+ }
+
+ public Context.with_importer_and_icon_name (string app_name,
+ string category_type,
+ Gtk.Window? game_window,
+ CategoryRequestFunc category_request,
+ Style style,
+ Importer? importer = null,
+ string? icon_name = null)
{
Object (app_name: app_name,
category_type: category_type,
game_window: game_window,
style: style,
- importer: importer);
+ importer: importer,
+ icon_name: icon_name ?? app_name);
/* Note: the following functionality can be performed manually by
* calling Context.load_scores, to ensure Context is usable even if
@@ -335,7 +358,7 @@ public class Context : Object
internal void run_dialog_internal (Score? new_high_score)
requires (game_window != null)
{
- var dialog = new Dialog (this, category_type, style, new_high_score, current_category, game_window,
app_name);
+ var dialog = new Dialog (this, category_type, style, new_high_score, current_category, game_window,
icon_name);
dialog.run ();
dialog.destroy ();
}
diff --git a/games/scores/dialog.vala b/games/scores/dialog.vala
index d00a4b9..0f53c38 100644
--- a/games/scores/dialog.vala
+++ b/games/scores/dialog.vala
@@ -36,7 +36,7 @@ private class Dialog : Gtk.Dialog
private Score? new_high_score;
private Category? scores_active_category;
- public Dialog (Context context, string category_type, Style style, Score? new_high_score, Category?
current_cat, Gtk.Window window, string app_name)
+ public Dialog (Context context, string category_type, Style style, Score? new_high_score, Category?
current_cat, Gtk.Window window, string icon_name)
{
Object (use_header_bar : 1);
@@ -73,7 +73,7 @@ private class Dialog : Gtk.Dialog
vbox.get_style_context ().add_class ("dim-label");
var image = new Gtk.Image ();
- image.icon_name = app_name + "-symbolic";
+ image.icon_name = icon_name + "-symbolic";
image.pixel_size = 64;
image.opacity = 0.2;
vbox.add (image);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]