[gnome-games/wip/exalm/metadata: 1/21] genre: Use string array instead of list
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/metadata: 1/21] genre: Use string array instead of list
- Date: Mon, 8 Oct 2018 21:41:54 +0000 (UTC)
commit 4ec30f70ece22759fb847f12d7674500926c666a
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Sun Oct 7 22:50:52 2018 +0500
genre: Use string array instead of list
Genres are never modified in runtime, so it doesn't make sense to use
lists here.
src/core/genre.vala | 2 +-
src/dummy/dummy-genre.vala | 6 +++---
src/generic/generic-genre.vala | 6 +++---
src/grilo/grilo-genre.vala | 14 +++++++-------
4 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/src/core/genre.vala b/src/core/genre.vala
index 6c7237eb..8411d214 100644
--- a/src/core/genre.vala
+++ b/src/core/genre.vala
@@ -3,5 +3,5 @@
public interface Games.Genre : Object {
public signal void changed ();
- public abstract unowned List<string> get_genre ();
+ public abstract unowned string[] get_genre ();
}
diff --git a/src/dummy/dummy-genre.vala b/src/dummy/dummy-genre.vala
index 19379f80..b23b6c0f 100644
--- a/src/dummy/dummy-genre.vala
+++ b/src/dummy/dummy-genre.vala
@@ -2,13 +2,13 @@
public class Games.DummyGenre : Object, Genre {
// This is needed because get_genre() can't transfer ownership of the list.
- private List<string> genres;
+ private string[] genres;
construct {
- genres = new List<string> ();
+ genres = {};
}
- public unowned List<string> get_genre () {
+ public unowned string[] get_genre () {
return genres;
}
}
diff --git a/src/generic/generic-genre.vala b/src/generic/generic-genre.vala
index 3603cab8..3ffd7b2c 100644
--- a/src/generic/generic-genre.vala
+++ b/src/generic/generic-genre.vala
@@ -1,13 +1,13 @@
// This file is part of GNOME Games. License: GPL-3.0+.
public class Games.GenericGenre : Object, Genre {
- private List<string> genre;
+ private string[] genre;
- public GenericGenre (List<string> genre) {
+ public GenericGenre (string[] genre) {
this.genre = genre.copy ();
}
- public unowned List<string> get_genre () {
+ public unowned string[] get_genre () {
return genre;
}
}
diff --git a/src/grilo/grilo-genre.vala b/src/grilo/grilo-genre.vala
index 129fb1ee..32e6b7ad 100644
--- a/src/grilo/grilo-genre.vala
+++ b/src/grilo/grilo-genre.vala
@@ -2,7 +2,7 @@
public class Games.GriloGenre : Object, Genre {
private GriloMedia media;
- private List<string> genre;
+ private string[] genre;
private bool resolving;
public GriloGenre (GriloMedia media) {
@@ -11,7 +11,7 @@ public class Games.GriloGenre : Object, Genre {
resolving = false;
}
- public unowned List<string> get_genre () {
+ public unowned string[] get_genre () {
if (resolving)
return genre;
@@ -35,16 +35,16 @@ public class Games.GriloGenre : Object, Genre {
if (genre_count == 0)
return;
- var genre_list = new List<string> ();
+ string[] genres = {};
for (uint index = 0; index < genre_count; index++)
- genre_list.append (grl_media.get_genre_nth (index));
+ genres += grl_media.get_genre_nth (index);
- load_media_genre (genre_list);
+ load_media_genre (genres);
}
- private void load_media_genre (List<string> genre_list) {
- genre = genre_list.copy ();
+ private void load_media_genre (string[] genres) {
+ genre = genres.copy ();
changed ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]