diff --git a/src/Application.vala b/src/Application.vala index 2c02f652e..c3bf18ea9 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -99,7 +99,7 @@ namespace Scratch { create_new_tab = true; } - if (options.contains ("new-window")) { + if (options.contains ("new-window") || has_no_command_line_args (options)) { create_new_window = true; } @@ -137,7 +137,8 @@ namespace Scratch { // Create a new document if requested if (create_new_tab) { create_new_tab = false; - activate_action (MainWindow.ACTION_PREFIX + MainWindow.ACTION_NEW_TAB, null); + var active_window_action_group = active_window.get_action_group (MainWindow.ACTION_GROUP); + active_window_action_group.activate_action (MainWindow.ACTION_NEW_TAB, null); } } @@ -165,5 +166,10 @@ namespace Scratch { public static int main (string[] args) { return new Application ().run (args); } + + private bool has_no_command_line_args (GLib.VariantDict options) { + return options.contains ("new-tab") == false + && options.contains (GLib.OPTION_REMAINING) == false; + } } }