mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-25 01:02:24 +00:00
If there are no saved sessions, put a grayed "(No sessions)" entry on the saved
sessions submenu of the terminal window context menu (as Pageant does), rather than an empty menu (which often renders poorly). [originally from svn r8648]
This commit is contained in:
parent
b802ee0c16
commit
5094b58a20
@ -3199,6 +3199,7 @@ static void update_savedsess_menu(GtkMenuItem *menuitem, gpointer data)
|
||||
(GtkCallback)gtk_widget_destroy, NULL);
|
||||
|
||||
get_sesslist(&sesslist, TRUE);
|
||||
/* skip sesslist.sessions[0] == Default Settings */
|
||||
for (i = 1; i < sesslist.nsessions; i++) {
|
||||
GtkWidget *menuitem =
|
||||
gtk_menu_item_new_with_label(sesslist.sessions[i]);
|
||||
@ -3213,6 +3214,13 @@ static void update_savedsess_menu(GtkMenuItem *menuitem, gpointer data)
|
||||
GTK_SIGNAL_FUNC(saved_session_freedata),
|
||||
inst);
|
||||
}
|
||||
if (sesslist.nsessions <= 1) {
|
||||
GtkWidget *menuitem =
|
||||
gtk_menu_item_new_with_label("(No sessions)");
|
||||
gtk_widget_set_sensitive(menuitem, FALSE);
|
||||
gtk_container_add(GTK_CONTAINER(inst->sessionsmenu), menuitem);
|
||||
gtk_widget_show(menuitem);
|
||||
}
|
||||
get_sesslist(&sesslist, FALSE); /* free up */
|
||||
}
|
||||
|
||||
|
@ -636,7 +636,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
guess_height = extra_height + font_height * cfg.height;
|
||||
{
|
||||
RECT r;
|
||||
get_fullscreen_rect(&r);
|
||||
get_fullscreen_rect(&r);
|
||||
if (guess_width > r.right - r.left)
|
||||
guess_width = r.right - r.left;
|
||||
if (guess_height > r.bottom - r.top)
|
||||
@ -912,6 +912,8 @@ static void update_savedsess_menu(void)
|
||||
AppendMenu(savedsess_menu, MF_ENABLED,
|
||||
IDM_SAVED_MIN + (i-1)*MENU_SAVED_STEP,
|
||||
sesslist.sessions[i]);
|
||||
if (sesslist.nsessions <= 1)
|
||||
AppendMenu(savedsess_menu, MF_GRAYED, IDM_SAVED_MIN, "(No sessions)");
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user