[libgnome-games-support/arnaudb/issue-18] Do not assume icon name.



commit d0db0e791bed121a2a16322806cd33ada6ebef05
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 | 14 +++++++++-----
 games/scores/dialog.vala  |  4 ++--
 2 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/games/scores/context.vala b/games/scores/context.vala
index d5a070a..ce3a6e6 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;
 
@@ -71,9 +72,10 @@ public class Context : Object
                     string category_type,
                     Gtk.Window? game_window,
                     CategoryRequestFunc category_request,
-                    Style style)
+                    Style style,
+                    string? icon_name = null)
     {
-        this.with_importer (app_name, category_type, game_window, category_request, style, null);
+        this.with_importer (app_name, category_type, game_window, category_request, style, null, icon_name);
     }
 
     public Context.with_importer (string app_name,
@@ -81,13 +83,15 @@ public class Context : Object
                                   Gtk.Window? game_window,
                                   CategoryRequestFunc category_request,
                                   Style style,
-                                  Importer? importer)
+                                  Importer? importer,
+                                  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 +339,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]