Index: terminal/terminal-app.h =================================================================== --- terminal/terminal-app.h (revisione 22641) +++ terminal/terminal-app.h (copia locale) @@ -60,7 +60,8 @@ GError **error); void terminal_app_open_window (TerminalApp *app, - TerminalWindowAttr *attr); + TerminalWindowAttr *attr, + gboolean use_last); G_END_DECLS; Index: terminal/terminal-options.c =================================================================== --- terminal/terminal-options.c (revisione 22641) +++ terminal/terminal-options.c (copia locale) @@ -91,6 +91,11 @@ if (options_return != NULL) (*options_return)->disable_server = TRUE; } + else if ((strcmp ("--last", argv[n]) == 0) || (strcmp ("-l", argv[n]) == 0)) + { + if (options_return != NULL) + (*options_return)->use_last = TRUE; + } else if (strcmp ("--sm-client-id", argv[n]) == 0 || strncmp ("--sm-client-id=", argv[n], 15) == 0) { Index: terminal/terminal-options.h =================================================================== --- terminal/terminal-options.h (revisione 22641) +++ terminal/terminal-options.h (copia locale) @@ -43,6 +43,7 @@ gboolean show_help; gboolean show_version; gboolean disable_server; + gboolean use_last; }; struct _TerminalTabAttr Index: terminal/main.c =================================================================== --- terminal/main.c (revisione 22641) +++ terminal/main.c (copia locale) @@ -45,6 +45,7 @@ g_print ("%s\n", _(" -v, --version Print version information and exit")); g_print ("%s\n", _(" --disable-server Do not register with the D-BUS\n" " session message bus")); + g_print ("%s\n", _(" -l, --last Re-use the last opened window")); g_print ("\n"); g_print ("%s\n", _(" -x, --execute Execute the remainder of the command\n" " line inside the terminal")); Index: terminal/terminal-app.c =================================================================== --- terminal/terminal-app.c (revisione 22641) +++ terminal/terminal-app.c (copia locale) @@ -242,7 +242,7 @@ } } - terminal_app_open_window (app, win_attr); + terminal_app_open_window (app, win_attr, FALSE); terminal_window_attr_free (win_attr); } @@ -441,12 +441,13 @@ { GList *attrs; GList *lp; + TerminalOptions* term_opt; - if (!terminal_options_parse (argc, argv, &attrs, NULL, error)) + if (!terminal_options_parse (argc, argv, &attrs, &term_opt, error)) return FALSE; for (lp = attrs; lp != NULL; lp = lp->next) - terminal_app_open_window (app, lp->data); + terminal_app_open_window (app, lp->data, term_opt->use_last); g_list_foreach (attrs, (GFunc) terminal_window_attr_free, NULL); g_list_free (attrs); @@ -463,7 +464,8 @@ **/ void terminal_app_open_window (TerminalApp *app, - TerminalWindowAttr *attr) + TerminalWindowAttr *attr, + gboolean use_last) { TerminalTabAttr *tab_attr; GdkDisplay *display; @@ -477,12 +479,21 @@ g_return_if_fail (TERMINAL_IS_APP (app)); g_return_if_fail (attr != NULL); - window = terminal_app_create_window (app, - attr->fullscreen, - attr->menubar, - attr->borders, - attr->toolbars); + if (use_last && (g_list_length(app->windows) > 0)) + { + GList* last = g_list_last (app->windows); + window = GTK_WINDOW (last->data); + } + else + { + window = terminal_app_create_window (app, + attr->fullscreen, + attr->menubar, + attr->borders, + attr->toolbars); + } + if (attr->role != NULL) gtk_window_set_role (GTK_WINDOW (window), attr->role); if (attr->startup_id != NULL)