Skip to content

Commit

Permalink
linted
Browse files Browse the repository at this point in the history
linted

more linted

fix newlines at the EOF

linted one more time

baby, one more time

the final fix
  • Loading branch information
Stanisław committed Sep 16, 2020
1 parent 8e9d7a7 commit 863017c
Show file tree
Hide file tree
Showing 47 changed files with 2,994 additions and 1,624 deletions.
11 changes: 5 additions & 6 deletions src/Indicator/Indicator.vala
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// TODO: Change namespace
public class Monitor.Indicator : Wingpanel.Indicator {

private Widgets.DisplayWidget? display_widget = null;
private Widgets.PopoverWidget? popover_widget = null;
private Widgets.DisplayWidget ? display_widget = null;
private Widgets.PopoverWidget ? popover_widget = null;
private Settings settings;
private DBusClient dbusclient;

Expand Down Expand Up @@ -43,7 +42,6 @@ public class Monitor.Indicator : Wingpanel.Indicator {
warning (e.message);
}
});

}

public Indicator () {
Expand All @@ -54,7 +52,7 @@ public class Monitor.Indicator : Wingpanel.Indicator {
return display_widget;
}

public override Gtk.Widget? get_widget () {
public override Gtk.Widget ? get_widget () {
return popover_widget;
}

Expand All @@ -63,9 +61,10 @@ public class Monitor.Indicator : Wingpanel.Indicator {

public override void closed () {
}

}

public Wingpanel.Indicator? get_indicator (Module module, Wingpanel.IndicatorManager.ServerType server_type) {
public Wingpanel.Indicator ? get_indicator (Module module, Wingpanel.IndicatorManager.ServerType server_type) {
debug ("Activating Monitor Indicator");

if (server_type != Wingpanel.IndicatorManager.ServerType.SESSION) {
Expand Down
8 changes: 3 additions & 5 deletions src/Indicator/Services/DBusClient.vala
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ public interface Monitor.DBusClientInterface : Object {
public abstract void show_monitor () throws Error;
public signal void update (ResourcesSerialized data);
public signal void indicator_state (bool state);

}

public class Monitor.DBusClient : Object {
public DBusClientInterface? interface = null;
public DBusClientInterface ? interface = null;

private static GLib.Once<DBusClient> instance;
public static unowned DBusClient get_default () {
Expand All @@ -31,10 +32,7 @@ public class Monitor.DBusClient : Object {
BusNameWatcherFlags.NONE,
() => monitor_appeared (),
() => monitor_vanished ()
);



);
} catch (IOError e) {
error ("Monitor Indicator DBus: %s\n", e.message);
}
Expand Down
6 changes: 4 additions & 2 deletions src/Indicator/Widgets/IndicatorWidget.vala
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ public class Monitor.Widgets.IndicatorWidget : Gtk.Box {

public string icon_name { get; construct; }
public int percentage {
set { percentage_label.label = "%i%%".printf (value); }
set {
percentage_label.label = "%i%%".printf (value);
}
}

public IndicatorWidget (string icon_name) {
Object (
orientation: Gtk.Orientation.HORIZONTAL,
icon_name: icon_name
);
);
}

construct {
Expand Down
4 changes: 3 additions & 1 deletion src/Indicator/Widgets/TemperatureWidget.vala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ public class Monitor.Widgets.TemperatureWidget : Gtk.Box {

public string icon_name { get; construct; }
public double degree {
set { degree_label.label = "%d".printf ((int)Math.round (value)); }
set {
degree_label.label = "%d".printf ((int) Math.round (value));
}
}

public TemperatureWidget (string icon_name) {
Expand Down
5 changes: 3 additions & 2 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public class Monitor.MainWindow : Gtk.Window {

stack = new Gtk.Stack ();
stack.set_transition_type (Gtk.StackTransitionType.SLIDE_LEFT_RIGHT);
stack.add_titled (process_view, "process_view", _ ("Processes"));
stack.add_titled (system_view, "system_view", _ ("System"));
stack.add_titled (process_view, "process_view", _("Processes"));
stack.add_titled (system_view, "system_view", _("System"));

Gtk.StackSwitcher stack_switcher = new Gtk.StackSwitcher ();
stack_switcher.set_stack (stack);
Expand Down Expand Up @@ -130,4 +130,5 @@ public class Monitor.MainWindow : Gtk.Window {
move (position_x, position_y);
}
}

}
58 changes: 27 additions & 31 deletions src/Managers/AppManager.vala
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
namespace Monitor {

public struct App {
public string name;
public string icon;
public string? desktop_file;
public string ? desktop_file;
public int[] pids;
public uint32 xid;
}
Expand All @@ -14,8 +13,8 @@ namespace Monitor {
public signal void application_opened (App app);
public signal void application_closed (App app);

static AppManager? app_manager = null;
private Bamf.Matcher? matcher;
static AppManager ? app_manager = null;
private Bamf.Matcher ? matcher;
private Gee.ArrayList<uint> transient_xids;

public static AppManager get_default () {
Expand All @@ -24,7 +23,6 @@ namespace Monitor {
return app_manager;
}


public AppManager () {
transient_xids = new Gee.ArrayList<uint> ();

Expand All @@ -33,7 +31,6 @@ namespace Monitor {
matcher.view_closed.connect_after (handle_view_closed);
}


~AppManager () {
matcher.view_opened.disconnect (handle_view_opened);
matcher.view_closed.disconnect (handle_view_closed);
Expand All @@ -49,18 +46,17 @@ namespace Monitor {
int[] win_pids = {};
var window = (Bamf.Window)view;
var app = matcher.get_application_for_window (window);
win_pids += (int)window.get_pid ();
win_pids += (int) window.get_pid ();
if (has_desktop_file (app.get_desktop_file ())) {
debug ("Handle View Opened: %s", view.get_name ());
application_opened (
App () {
name = app.get_name (),
icon = app.get_icon (),
desktop_file = app.get_desktop_file (),
pids = win_pids,
xid = app.get_xids ().index (0)
}
);
name = app.get_name (),
icon = app.get_icon (),
desktop_file = app.get_desktop_file (),
pids = win_pids,
xid = app.get_xids ().index (0)
});
}
}
}
Expand All @@ -70,23 +66,22 @@ namespace Monitor {
int[] win_pids = {};
var window = (Bamf.Window)view;
var app = matcher.get_application_for_window (window);
win_pids += (int)window.get_pid ();
win_pids += (int) window.get_pid ();
if (has_desktop_file (app.get_desktop_file ())) {
debug ("Handle View Closed: %s", view.get_name ());
application_closed (
App () {
name = app.get_name (),
icon = app.get_icon (),
desktop_file = app.get_desktop_file (),
pids = win_pids,
xid = app.get_xids ().index (0)
}
);
name = app.get_name (),
icon = app.get_icon (),
desktop_file = app.get_desktop_file (),
pids = win_pids,
xid = app.get_xids ().index (0)
});
}
}
}

private bool has_desktop_file (string? desktop_file) {
private bool has_desktop_file (string ? desktop_file) {
return !(desktop_file == null || desktop_file == "");
}

Expand All @@ -99,24 +94,24 @@ namespace Monitor {
// go through the windows of the application and add all of the pids
var windows = bamf_app.get_windows ();
foreach (var window in windows) {
win_pids += (int)window.get_pid ();
win_pids += (int) window.get_pid ();
}
if (has_desktop_file (bamf_app.get_desktop_file ())) {
apps += App () {
name = bamf_app.get_name (),
icon = bamf_app.get_icon (),
desktop_file = bamf_app.get_desktop_file (),
pids = win_pids,
xid = bamf_app.get_xids ().index (0)
};
name = bamf_app.get_name (),
icon = bamf_app.get_icon (),
desktop_file = bamf_app.get_desktop_file (),
pids = win_pids,
xid = bamf_app.get_xids ().index (0)
};
}
}
return apps;
}

private bool is_main_window (Bamf.View view) {
var window_type = ((Bamf.Window)view).get_window_type ();
debug ("Window type: %d, Is transient: %d", window_type, (int)is_transient (view));
debug ("Window type: %d, Is transient: %d", window_type, (int) is_transient (view));
return (window_type == Bamf.WindowType.NORMAL ||
window_type == Bamf.WindowType.DOCK) && !is_transient (view);
}
Expand All @@ -132,5 +127,6 @@ namespace Monitor {
}
return false;
}

}
}
Loading

0 comments on commit 863017c

Please sign in to comment.