diff --git a/src/bin/clapper-app/clapper-app-application.c b/src/bin/clapper-app/clapper-app-application.c index 85616278..c96a77e1 100644 --- a/src/bin/clapper-app/clapper-app-application.c +++ b/src/bin/clapper-app/clapper-app-application.c @@ -217,6 +217,21 @@ add_uri (GSimpleAction *action, GVariant *param, gpointer user_data) clapper_app_uri_dialog_open_uri (gtk_app); } +static void +new_window (GSimpleAction *action, GVariant *param, gpointer user_data) +{ + GtkApplication *gtk_app = GTK_APPLICATION (user_data); + GtkWidget *stack = gtk_window_get_child (gtk_application_get_active_window (gtk_app)); + const gchar *child_name = gtk_stack_get_visible_child_name (GTK_STACK (stack)); + + /* Do not allow to open new windows during initial state, + * there already is a free one to use */ + if (g_strcmp0 (child_name, "initial_state") != 0) { + GtkWidget *window = clapper_app_window_new (gtk_app); + gtk_window_present (GTK_WINDOW (window)); + } +} + static void show_preferences (GSimpleAction *action, GVariant *param, gpointer user_data) { @@ -648,6 +663,7 @@ clapper_app_application_constructed (GObject *object) static const GActionEntry app_actions[] = { { "add-files", add_files, NULL, NULL, NULL }, { "add-uri", add_uri, NULL, NULL, NULL }, + { "new-window", new_window, NULL, NULL, NULL }, { "info", show_info, NULL, NULL, NULL }, { "preferences", show_preferences, NULL, NULL, NULL }, { "about", show_about, NULL, NULL, NULL }, diff --git a/src/bin/clapper-app/ui/clapper-app-headerbar.ui b/src/bin/clapper-app/ui/clapper-app-headerbar.ui index f52fc4e4..5c15f04e 100644 --- a/src/bin/clapper-app/ui/clapper-app-headerbar.ui +++ b/src/bin/clapper-app/ui/clapper-app-headerbar.ui @@ -178,6 +178,12 @@ +
+ + New Window + app.new-window + +
Preferences