summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2018-02-06 21:03:07 +0100
committerDave Davenport <qball@gmpclient.org>2018-02-06 21:03:07 +0100
commitac29c537dd15677e42b4c4bb76fc4678b18f35f7 (patch)
treeeef2708d9a1b0fe396f9bdb82d79a76108da05d3
parent23b7af56d099a0bcc3f4280862a2811d2da3a8a7 (diff)
[SSH] Reload ssh when entry is deleted.
-rw-r--r--source/dialogs/ssh.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/source/dialogs/ssh.c b/source/dialogs/ssh.c
index 8b20ccb8..4f9bb46f 100644
--- a/source/dialogs/ssh.c
+++ b/source/dialogs/ssh.c
@@ -433,6 +433,20 @@ static unsigned int ssh_mode_get_num_entries ( const Mode *sw )
const SSHModePrivateData *rmpd = (const SSHModePrivateData *) mode_get_private_data ( sw );
return rmpd->hosts_list_length;
}
+/**
+ * @param sw Object handle to the SSH Mode object
+ *
+ * Cleanup the SSH Mode. Free all allocated memory and NULL the private data pointer.
+ */
+static void ssh_mode_destroy ( Mode *sw )
+{
+ SSHModePrivateData *rmpd = (SSHModePrivateData *) mode_get_private_data ( sw );
+ if ( rmpd != NULL ) {
+ g_strfreev ( rmpd->hosts_list );
+ g_free ( rmpd );
+ mode_set_private_data ( sw, NULL );
+ }
+}
/**
* @param sw Object handle to the SSH Mode object
@@ -465,29 +479,14 @@ static ModeMode ssh_mode_result ( Mode *sw, int mretv, char **input, unsigned in
}
else if ( ( mretv & MENU_ENTRY_DELETE ) && rmpd->hosts_list[selected_line] ) {
delete_ssh ( rmpd->hosts_list[selected_line] );
- g_strfreev ( rmpd->hosts_list );
- rmpd->hosts_list_length = 0;
- rmpd->hosts_list = NULL;
// Stay
retv = RELOAD_DIALOG;
+ ssh_mode_destroy ( sw );
+ ssh_mode_init ( sw );
}
return retv;
}
-/**
- * @param sw Object handle to the SSH Mode object
- *
- * Cleanup the SSH Mode. Free all allocated memory and NULL the private data pointer.
- */
-static void ssh_mode_destroy ( Mode *sw )
-{
- SSHModePrivateData *rmpd = (SSHModePrivateData *) mode_get_private_data ( sw );
- if ( rmpd != NULL ) {
- g_strfreev ( rmpd->hosts_list );
- g_free ( rmpd );
- mode_set_private_data ( sw, NULL );
- }
-}
/**
* @param sw Object handle to the SSH Mode object