diff --git a/mousepad/mousepad-application.c b/mousepad/mousepad-application.c index b2e09aa..cb2cd49 100644 --- a/mousepad/mousepad-application.c +++ b/mousepad/mousepad-application.c @@ -279,12 +279,18 @@ mousepad_application_new_window_with_files (MousepadApplication *application, GtkWidget *window; gboolean succeed = FALSE; MousepadDocument *document; + GSList *li; g_return_if_fail (MOUSEPAD_IS_APPLICATION (application)); g_return_if_fail (screen == NULL || GDK_IS_SCREEN (screen)); - /* create a new window (signals added and already hooked up) */ - window = mousepad_application_create_window (application); + /* use an existing window or create a + /* new window (signals added and already hooked up) */ + li = application->windows; + if(li != NULL) + window = GTK_WIDGET (li->data); + else + window = mousepad_application_create_window (application); /* place the window on the right screen */ gtk_window_set_screen (GTK_WINDOW (window), screen ? screen : gdk_screen_get_default ());