[rygel] ruih: Style fixes for UIListing
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] ruih: Style fixes for UIListing
- Date: Sat, 8 Nov 2014 12:25:23 +0000 (UTC)
commit d3df7943aba6c10279096d10e0ba98a969fdc620
Author: Jens Georg <mail jensge org>
Date: Sun Oct 19 15:02:56 2014 +0200
ruih: Style fixes for UIListing
Signed-off-by: Jens Georg <mail jensge org>
src/librygel-ruih/rygel-ruih-ui-listing.vala | 37 +++++++++++++------------
1 files changed, 19 insertions(+), 18 deletions(-)
---
diff --git a/src/librygel-ruih/rygel-ruih-ui-listing.vala b/src/librygel-ruih/rygel-ruih-ui-listing.vala
index 9f15595..86bb45c 100644
--- a/src/librygel-ruih/rygel-ruih-ui-listing.vala
+++ b/src/librygel-ruih/rygel-ruih-ui-listing.vala
@@ -43,32 +43,33 @@ public abstract class UIListing
protected static const string URI = "uri";
protected static const string UIID = "uiID";
- public abstract bool match (Gee.ArrayList<ProtocolElem>? protocols,
- Gee.ArrayList<FilterEntry> filters);
- public abstract string to_ui_listing (Gee.ArrayList<FilterEntry> filters);
+ public abstract bool match (ArrayList<ProtocolElem>? protocols,
+ ArrayList<FilterEntry> filters);
+ public abstract string to_ui_listing (ArrayList<FilterEntry> filters);
- public string to_xml (Gee.HashMap<string, string> hashMap) {
- StringBuilder sb = new StringBuilder ();
- foreach (Map.Entry<string, string> e in hashMap.entries) {
- sb.append ("<").append (e.key).append (">")
- .append (e.value)
- .append ("</").append (e.key).append (">\n");
+ public string to_xml (Gee.HashMap<string, string> hash_map) {
+ var sb = new StringBuilder ();
+ foreach (var e in hash_map.entries) {
+ sb.append_printf ("<%s>%s</%s>\n", e.key, e.value, e.key);
}
+
return sb.str;
}
// Convenience method to avoid a lot of inline loops
- public bool filters_match (Gee.ArrayList<FilterEntry> filters,
- string name, string value) {
- if (filters != null && name != null && value != null) {
- foreach (FilterEntry fil in filters) {
- FilterEntry entry = (FilterEntry)fil;
+ public bool filters_match (ArrayList<FilterEntry>? filters,
+ string? name,
+ string? value) {
+ if (filters == null || name == null || value == null) {
+ return false;
+ }
- if ((entry != null) && (entry.matches (name, value))) {
- return true;
- }
+ foreach (var entry in filters) {
+ if ((entry != null) && (entry.matches (name, value))) {
+ return true;
}
}
+
return false;
}
-}
\ No newline at end of file
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]