[gnome-usage] Standardize braces in if-else chains
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-usage] Standardize braces in if-else chains
- Date: Mon, 22 Nov 2021 12:27:29 +0000 (UTC)
commit 282bceadd0af254faa1fdca3a03fc06c3074e6ed
Author: Adrien Plazas <kekun plazas laposte net>
Date: Mon Nov 22 12:33:45 2021 +0100
Standardize braces in if-else chains
This makes the coding style more consistent.
src/animated-scrolled-window.vala | 3 +--
src/app-item.vala | 8 ++++----
src/cpu-graph-model.vala | 6 ++----
src/cpu-sub-view.vala | 3 +--
src/memory-graph-model.vala | 3 +--
src/memory-graph.vala | 4 ++--
src/memory-sub-view.vala | 3 +--
src/process-list-box.vala | 7 +++----
src/process-row.vala | 6 ++----
src/storage/storage-view.vala | 8 ++++----
src/utils.vala | 3 +--
src/window.vala | 3 +--
12 files changed, 23 insertions(+), 34 deletions(-)
---
diff --git a/src/animated-scrolled-window.vala b/src/animated-scrolled-window.vala
index 5660cf9..0002dd0 100644
--- a/src/animated-scrolled-window.vala
+++ b/src/animated-scrolled-window.vala
@@ -37,8 +37,7 @@ namespace Usage {
t = ease_out_cubic (t);
vadjustment.set_value(source + t * (target - source));
return true;
- }
- else {
+ } else {
vadjustment.set_value(target);
return false;
}
diff --git a/src/app-item.vala b/src/app-item.vala
index 6753c29..0d4c06f 100644
--- a/src/app-item.vala
+++ b/src/app-item.vala
@@ -75,9 +75,9 @@ namespace Usage {
try {
string[] segments = systemd_unit.split ("-");
- if (systemd_unit.has_suffix (".scope") && segments.length >= 2)
+ if (systemd_unit.has_suffix (".scope") && segments.length >= 2) {
escaped_id = segments[segments.length - 2];
- else if (systemd_unit.has_suffix (".service") && segments.length >= 1) {
+ } else if (systemd_unit.has_suffix (".service") && segments.length >= 1) {
string tmp = segments[segments.length - 1];
/* Strip .service */
tmp = tmp[0:tmp.length-8];
@@ -197,9 +197,9 @@ namespace Usage {
int games = 0;
foreach(var process in processes.get_values()) {
- if(!process.mark_as_updated)
+ if(!process.mark_as_updated) {
processes.remove(process.pid);
- else {
+ } else {
cpu_load += process.cpu_load;
mem_usage += process.mem_usage;
}
diff --git a/src/cpu-graph-model.vala b/src/cpu-graph-model.vala
index a1ed7ee..df6b8a0 100644
--- a/src/cpu-graph-model.vala
+++ b/src/cpu-graph-model.vala
@@ -65,8 +65,7 @@ namespace Usage {
change_big_process_usage[i] = false;
change_small_process_usage[i] = true;
}
- }
- else {
+ } else {
if(change_small_process_usage[i]) {
small_process_usage(i);
change_small_process_usage[i] = false;
@@ -116,8 +115,7 @@ namespace Usage {
change_big_process_usage = false;
change_small_process_usage = true;
}
- }
- else {
+ } else {
if(change_small_process_usage) {
small_process_usage();
change_small_process_usage = false;
diff --git a/src/cpu-sub-view.vala b/src/cpu-sub-view.vala
index a7bcce1..5304aea 100644
--- a/src/cpu-sub-view.vala
+++ b/src/cpu-sub-view.vala
@@ -59,8 +59,7 @@ namespace Usage {
if(system_monitor.process_list_ready) {
cpu_box.pack_start(process_list_box, false, false, 0);
cpu_box.remove(spinner);
- }
- else {
+ } else {
cpu_box.pack_start(spinner, true, true, 0);
cpu_box.remove(process_list_box);
}
diff --git a/src/memory-graph-model.vala b/src/memory-graph-model.vala
index 2e5f029..4a4a8c0 100644
--- a/src/memory-graph-model.vala
+++ b/src/memory-graph-model.vala
@@ -65,8 +65,7 @@ namespace Usage {
change_big_ram_usage = false;
change_small_ram_usage = true;
}
- }
- else {
+ } else {
if(change_small_ram_usage) {
small_ram_usage();
change_small_ram_usage = false;
diff --git a/src/memory-graph.vala b/src/memory-graph.vala
index 7f43a33..3b4b1da 100644
--- a/src/memory-graph.vala
+++ b/src/memory-graph.vala
@@ -49,9 +49,9 @@ namespace Usage {
if(graph_model == null) {
graph_model = new MemoryGraphModel();
set_model(graph_model);
- }
- else
+ } else {
set_model(graph_model);
+ }
var renderer_ram = new GraphStackedRenderer();
renderer_ram.column = MemoryGraphModel.COLUMN_RAM;
diff --git a/src/memory-sub-view.vala b/src/memory-sub-view.vala
index 6b18fc6..4382f00 100644
--- a/src/memory-sub-view.vala
+++ b/src/memory-sub-view.vala
@@ -62,8 +62,7 @@ namespace Usage {
if(system_monitor.process_list_ready) {
memory_box.pack_start(process_list_box, false, false, 0);
memory_box.remove(spinner);
- }
- else {
+ } else {
memory_box.pack_start(spinner, true, true, 0);
memory_box.remove(process_list_box);
}
diff --git a/src/process-list-box.vala b/src/process-list-box.vala
index 3e07328..f88f967 100644
--- a/src/process-list-box.vala
+++ b/src/process-list-box.vala
@@ -94,8 +94,7 @@ namespace Usage {
model.insert_sorted(app, app_cmp);
break;
}
- }
- else {
+ } else {
foreach(unowned AppItem app in system_monitor.get_apps()) {
if(app.display_name.down().contains(search_text.down()) ||
app.representative_cmdline.down().contains(search_text.down()))
model.insert_sorted(app, app_cmp);
@@ -111,9 +110,9 @@ namespace Usage {
}
private void update_header(Gtk.ListBoxRow row, Gtk.ListBoxRow? before_row) {
- if(before_row == null)
+ if(before_row == null) {
row.set_header(null);
- else {
+ } else {
var separator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL);
separator.get_style_context().add_class("list");
separator.show();
diff --git a/src/process-row.vala b/src/process-row.vala
index 86aa7fa..e8bb7bd 100644
--- a/src/process-row.vala
+++ b/src/process-row.vala
@@ -93,11 +93,9 @@ namespace Usage {
string class_name = "";
if(app.user.LocalAccount) {
class_name = CSS_TAG_USER;
- }
- else if(app.user.AccountType == UserAccountType.ADMINISTRATOR) {
+ } else if(app.user.AccountType == UserAccountType.ADMINISTRATOR) {
class_name = CSS_TAG_ROOT;
- }
- else if(app.user.SystemAccount) {
+ } else if(app.user.SystemAccount) {
class_name = CSS_TAG_SYSTEM;
}
diff --git a/src/storage/storage-view.vala b/src/storage/storage-view.vala
index caa6b8c..fbdfd31 100644
--- a/src/storage/storage-view.vala
+++ b/src/storage/storage-view.vala
@@ -97,9 +97,9 @@ public class Usage.StorageView : Usage.View {
selected_items_stack.push_head((owned) selected_items);
actual_item.push_head(item);
present_dir.begin (item.uri, item.dir, cancellable);
- }
- else
+ } else {
populate_view.begin ();
+ }
need_refresh_depth = listbox.get_depth();
});
@@ -162,9 +162,9 @@ public class Usage.StorageView : Usage.View {
populate_view.begin ();
else
present_dir.begin (item.uri, item.dir, cancellable);
- }
- else
+ } else {
graph.model = (ListStore) listbox.get_model();
+ }
}
private string get_user_special_dir_path (UserDirectory dir) {
diff --git a/src/utils.vala b/src/utils.vala
index 6b5f0c0..add1663 100644
--- a/src/utils.vala
+++ b/src/utils.vala
@@ -59,8 +59,7 @@ namespace Usage {
return Utils.color_lighter(default_color, percentage);
else
return Utils.color_darker(default_color, percentage);
- }
- else {
+ } else {
double percentage = step * (half_count - (order-1));
if(reverse)
return Utils.color_darker(default_color, percentage);
diff --git a/src/window.vala b/src/window.vala
index b132915..537889e 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -132,8 +132,7 @@ namespace Usage {
private void on_visible_child_changed() {
if(stack.visible_child_name == views[Views.PERFORMANCE].name) {
set_mode(HeaderBarMode.PERFORMANCE);
- }
- else if(stack.visible_child_name == views[Views.STORAGE].name) {
+ } else if(stack.visible_child_name == views[Views.STORAGE].name) {
set_mode(HeaderBarMode.STORAGE);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]