aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorWynn Wolf Arbor2020-04-12 14:26:41 +0200
committerWynn Wolf Arbor2020-04-13 15:45:52 +0200
commitb9162f395b930c73cb23b2847e9fef86b98217df (patch)
treeabea745760502aff4f2522045cf1ef96de60b87a
parentb95ed4f6ab9fdf39f1bfaab07f953aa752e9ae2e (diff)
downloadweltschmerz-b9162f395b930c73cb23b2847e9fef86b98217df.tar.gz
Move get_shell to utils.vala
There was no VTE-related functionality in this method, so we can find a better place for it now that a dedicated utility class exists.
-rw-r--r--terminal.vala16
-rw-r--r--utils.vala14
2 files changed, 15 insertions, 15 deletions
diff --git a/terminal.vala b/terminal.vala
index c963a75..aef68a5 100644
--- a/terminal.vala
+++ b/terminal.vala
@@ -65,7 +65,7 @@ class Terminal : Gtk.Overlay {
var argv = args[1:args.length];
if (argv.length == 0) {
- argv = { get_shell() };
+ argv = { Utils.get_shell() };
}
vte.spawn_sync(DEFAULT, null, argv, null, SEARCH_PATH, null, null, null);
@@ -111,20 +111,6 @@ class Terminal : Gtk.Overlay {
}
}
- string get_shell() {
- var env_shell = Environment.get_variable("SHELL");
- if (env_shell != null && env_shell.length > 0){
- return env_shell;
- }
-
- unowned Posix.Passwd pw = Posix.getpwuid(Posix.getuid());
- if (pw != null && pw.pw_shell.length > 0) {
- return pw.pw_shell;
- }
-
- return "/bin/sh";
- }
-
bool match_modifiers(int state, Gdk.ModifierType modifiers) {
return (state & modifiers) == modifiers;
}
diff --git a/utils.vala b/utils.vala
index 845728b..0c5bd35 100644
--- a/utils.vala
+++ b/utils.vala
@@ -1,4 +1,18 @@
class Utils {
+ public static string get_shell() {
+ var env_shell = Environment.get_variable("SHELL");
+ if (env_shell != null && env_shell.length > 0){
+ return env_shell;
+ }
+
+ unowned Posix.Passwd pw = Posix.getpwuid(Posix.getuid());
+ if (pw != null && pw.pw_shell.length > 0) {
+ return pw.pw_shell;
+ }
+
+ return "/bin/sh";
+ }
+
public static string? normalize_uri(string? uri) {
if (uri == null)
return null;