Commit 4ca341ba authored by Antenore Gatta's avatar Antenore Gatta Committed by GitHub

Merge pull request #1193 from FreeRDP/issues_933-rdpgateway

Implementing separate user and password for RD Gateway
Closes #511 #922 #933 #1179 #706
parents 41c8de66 609d9e07
......@@ -359,7 +359,7 @@ static gboolean remmina_plugin_nx_start_session(RemminaProtocolWidget *gp)
/* Login */
s1 = g_strdup(remmina_plugin_nx_service->file_get_string(remminafile, "username"));
s2 = remmina_plugin_nx_service->file_get_secret(remminafile, "password");
s2 = g_strdup(remmina_plugin_nx_service->file_get_string(remminafile, "password"));
if (s1 && s2)
{
......@@ -755,11 +755,11 @@ static gpointer quality_list[] =
*/
static const RemminaProtocolSetting remmina_plugin_nx_basic_settings[] =
{
{ REMMINA_PROTOCOL_SETTING_TYPE_SERVER, NULL, NULL, FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_SERVER, "server", NULL, FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_FILE, "nx_privatekey", N_("Identity file"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "username", N_("User name"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_PASSWORD, NULL, NULL, FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_RESOLUTION, NULL, NULL, FALSE, GINT_TO_POINTER(1), NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_PASSWORD, "password", N_("User password"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_RESOLUTION, "resolution", NULL, FALSE, GINT_TO_POINTER(1), NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_SELECT, "quality", N_("Quality"), FALSE, quality_list, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_COMBO, "exec", N_("Startup program"), FALSE, "GNOME,KDE,Xfce,Shadow", NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_END, NULL, NULL, FALSE, NULL, NULL }
......
......@@ -122,40 +122,6 @@ static BOOL rf_process_event_queue(RemminaProtocolWidget* gp)
return True;
}
static gboolean remmina_rdp_check_host_resolution(RemminaProtocolWidget *gp, char *hostname, int tcpport)
{
TRACE_CALL("remmina_rdp_check_host_resolution");
struct addrinfo hints;
struct addrinfo* result = NULL;
int status;
char service[16];
if (hostname[0] == 0) {
remmina_plugin_service->protocol_plugin_set_error(gp, _("The server name cannot be blank."));
return FALSE;
}
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = 0;
hints.ai_protocol = 0;
sprintf(service, "%d", tcpport);
status = getaddrinfo(hostname, service, &hints, &result);
if (status != 0) {
remmina_plugin_service->protocol_plugin_set_error(gp, _("Unable to find the address of RDP server %s."),
hostname);
if (result)
freeaddrinfo(result);
return FALSE;
}
freeaddrinfo(result);
return TRUE;
}
static gboolean remmina_rdp_tunnel_init(RemminaProtocolWidget* gp)
{
TRACE_CALL("remmina_rdp_tunnel_init");
......@@ -194,18 +160,6 @@ static gboolean remmina_rdp_tunnel_init(RemminaProtocolWidget* gp)
remmina_plugin_service->get_server_port(cert_hostport, 3389, &cert_host, &cert_port);
}
} else {
/* When SSH tunnel is not enabled, we can verify that host
* resolves correctly via DNS */
if (!remmina_plugin_service->file_get_string(remminafile, "gateway_server")) {
/* When SSH tunnel and gateway are disabled, we can verify that host
* resolves correctly via DNS */
if (!remmina_rdp_check_host_resolution(gp, host, port)) {
g_free(host);
g_free(hostport);
return FALSE;
}
}
}
if (!rfi->is_reconnecting) {
......@@ -739,7 +693,8 @@ static void remmina_rdp_send_ctrlaltdel(RemminaProtocolWidget *gp)
static gboolean remmina_rdp_main(RemminaProtocolWidget* gp)
{
TRACE_CALL("remmina_rdp_main");
gchar* s;
const gchar* s;
gchar *sm;
gchar* value;
gint rdpsnd_rate;
gint rdpsnd_channel;
......@@ -784,17 +739,16 @@ static gboolean remmina_rdp_main(RemminaProtocolWidget* gp)
if (remmina_plugin_service->file_get_string(remminafile, "domain"))
rfi->settings->Domain = strdup(remmina_plugin_service->file_get_string(remminafile, "domain"));
s = remmina_plugin_service->file_get_secret(remminafile, "password");
s = remmina_plugin_service->file_get_string(remminafile, "password");
if (s)
{
rfi->settings->Password = strdup(s);
rfi->settings->AutoLogonEnabled = 1;
g_free(s);
}
/* Remote Desktop Gateway server address */
rfi->settings->GatewayEnabled = FALSE;
s = (gchar *) remmina_plugin_service->file_get_string(remminafile, "gateway_server");
s = remmina_plugin_service->file_get_string(remminafile, "gateway_server");
if (s)
{
remmina_plugin_service->get_server_port(s, 443, &gateway_host, &gateway_port);
......@@ -816,9 +770,10 @@ static gboolean remmina_rdp_main(RemminaProtocolWidget* gp)
rfi->settings->GatewayUseSameCredentials = FALSE;
}
/* Remote Desktop Gateway password */
if (remmina_plugin_service->file_get_string(remminafile, "gateway_password"))
s = remmina_plugin_service->file_get_string(remminafile, "gateway_password");
if(s)
{
rfi->settings->GatewayPassword = strdup(remmina_plugin_service->file_get_string(remminafile, "gateway_password"));
rfi->settings->GatewayPassword = strdup(s);
rfi->settings->GatewayUseSameCredentials = FALSE;
}
/* If no different credentials were provided for the Remote Desktop Gateway
......@@ -835,7 +790,7 @@ static gboolean remmina_rdp_main(RemminaProtocolWidget* gp)
/* Remote Desktop Gateway usage */
if (rfi->settings->GatewayEnabled)
freerdp_set_gateway_usage_method(rfi->settings,
remmina_plugin_service->file_get_int(remminafile, "gateway_usage", FALSE) ? TSC_PROXY_MODE_DETECT : TSC_PROXY_MODE_DIRECT);
remmina_plugin_service->file_get_int(remminafile, "gateway_usage", FALSE) ? TSC_PROXY_MODE_DETECT : TSC_PROXY_MODE_DIRECT);
/* Certificate ignore */
rfi->settings->IgnoreCertificate = remmina_plugin_service->file_get_int(remminafile, "cert_ignore", 0);
......@@ -866,9 +821,9 @@ static gboolean remmina_rdp_main(RemminaProtocolWidget* gp)
rfi->settings->ShellWorkingDirectory = strdup(remmina_plugin_service->file_get_string(remminafile, "execpath"));
}
s = g_strdup_printf("rdp_quality_%i", remmina_plugin_service->file_get_int(remminafile, "quality", DEFAULT_QUALITY_0));
value = remmina_plugin_service->pref_get_value(s);
g_free(s);
sm = g_strdup_printf("rdp_quality_%i", remmina_plugin_service->file_get_int(remminafile, "quality", DEFAULT_QUALITY_0));
value = remmina_plugin_service->pref_get_value(sm);
g_free(sm);
if (value && value[0])
{
......@@ -1020,12 +975,12 @@ static gboolean remmina_rdp_main(RemminaProtocolWidget* gp)
s = remmina_rdp_plugin_default_drive_name;
else
s++;
s = g_convert_with_fallback(s, -1, "ascii", "utf-8", "_", NULL, &sz, NULL);
sm = g_convert_with_fallback(s, -1, "ascii", "utf-8", "_", NULL, &sz, NULL);
drive->Type = RDPDR_DTYP_FILESYSTEM;
drive->Name = _strdup(s);
drive->Name = _strdup(sm);
drive->Path = _strdup(cs);
g_free(s);
g_free(sm);
freerdp_device_collection_add(rfi->settings, (RDPDR_DEVICE*) drive);
rfi->settings->DeviceRedirection = TRUE;
......@@ -1099,6 +1054,9 @@ static gboolean remmina_rdp_main(RemminaProtocolWidget* gp)
case FREERDP_ERROR_CONNECT_FAILED:
remmina_plugin_service->protocol_plugin_set_error(gp, _("Connection to RDP server %s failed."), rfi->settings->ServerHostname );
break;
case FREERDP_ERROR_DNS_NAME_NOT_FOUND:
remmina_plugin_service->protocol_plugin_set_error(gp, _("Unable to find the address of RDP server %s."), rfi->settings->ServerHostname );
break;
default:
remmina_plugin_service->protocol_plugin_set_error(gp, _("Unable to connect to RDP server %s"), rfi->settings->ServerHostname);
break;
......@@ -1405,12 +1363,11 @@ static gpointer security_list[] =
*/
static const RemminaProtocolSetting remmina_rdp_basic_settings[] =
{
{ REMMINA_PROTOCOL_SETTING_TYPE_SERVER, NULL, NULL, FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_SERVER, "server", NULL, FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "username", N_("User name"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_PASSWORD, NULL, NULL, FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_PASSWORD, "password", N_("User password"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "domain", N_("Domain"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "gateway_server", N_("RD Gateway server"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_RESOLUTION, NULL, NULL, FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_RESOLUTION, "resolution", NULL, FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_SELECT, "colordepth", N_("Color depth"), FALSE, colordepth_list, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_FOLDER, "sharefolder", N_("Share folder"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_CHECK, "disableautoreconnect", N_("Disable automatic reconnection"), FALSE, NULL, NULL },
......@@ -1431,6 +1388,10 @@ static const RemminaProtocolSetting remmina_rdp_advanced_settings[] =
{ REMMINA_PROTOCOL_SETTING_TYPE_SELECT, "quality", N_("Quality"), FALSE, quality_list, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_SELECT, "sound", N_("Sound"), FALSE, sound_list, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_SELECT, "security", N_("Security"), FALSE, security_list, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "gateway_server", N_("RD Gateway server"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "gateway_username", N_("RD Gateway username"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_PASSWORD, "gateway_password", N_("RD Gateway password"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "gateway_domain", N_("RD Gateway domain"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "clientname", N_("Client name"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "exec", N_("Startup program"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "execpath", N_("Startup path"), FALSE, NULL, NULL },
......
......@@ -78,7 +78,7 @@ static void remmina_plugin_spice_init(RemminaProtocolWidget *gp)
gp);
g_object_set(gpdata->session,
"password", remmina_plugin_service->file_get_secret(remminafile, "password"),
"password", g_strdup(remmina_plugin_service->file_get_string(remminafile, "password")),
"read-only", remmina_plugin_service->file_get_int(remminafile, "viewonly", FALSE),
"enable-audio", remmina_plugin_service->file_get_int(remminafile, "enableaudio", FALSE),
"enable-smartcard", remmina_plugin_service->file_get_int(remminafile, "sharesmartcard", FALSE),
......@@ -428,8 +428,8 @@ static void remmina_plugin_spice_call_feature(RemminaProtocolWidget *gp, const R
*/
static const RemminaProtocolSetting remmina_plugin_spice_basic_settings[] =
{
{ REMMINA_PROTOCOL_SETTING_TYPE_SERVER, NULL, NULL, FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_PASSWORD, NULL, NULL, FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_SERVER, "server", NULL, FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_PASSWORD, "password", N_("User password"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_CHECK, "resizeguest", N_("Resize guest to match window size"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_CHECK, "usetls", N_("Use TLS encryption"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_FILE, "cacert", N_("Server CA certificate"), FALSE, NULL, NULL },
......
......@@ -855,7 +855,7 @@ remmina_plugin_vnc_rfb_password(rfbClient *cl)
if (gpdata->auth_first)
{
pwd = remmina_plugin_service->file_get_secret(remminafile, "password");
pwd = g_strdup(remmina_plugin_service->file_get_string(remminafile, "password"));
}
if (!pwd)
{
......@@ -898,7 +898,7 @@ remmina_plugin_vnc_rfb_credential (rfbClient *cl, int credentialType)
s1 = g_strdup (remmina_plugin_service->file_get_string (remminafile, "username"));
s2 = remmina_plugin_service->file_get_secret (remminafile, "password");
s2 = g_strdup (remmina_plugin_service->file_get_string (remminafile, "password"));
if (gpdata->auth_first && s1 && s2)
{
......@@ -1983,10 +1983,10 @@ static gpointer quality_list[] =
*/
static const RemminaProtocolSetting remmina_plugin_vnc_basic_settings[] =
{
{ REMMINA_PROTOCOL_SETTING_TYPE_SERVER, NULL, NULL, FALSE, "_rfb._tcp", NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_SERVER, "server", NULL, FALSE, "_rfb._tcp", NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "proxy", N_("Repeater"), FALSE, NULL, NULL},
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "username", N_("User name"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_PASSWORD, NULL, NULL, FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_PASSWORD, "password", N_("User password"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_SELECT, "colordepth", N_("Color depth"), FALSE, colordepth_list, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_SELECT, "quality", N_("Quality"), FALSE, quality_list, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_KEYMAP, NULL, NULL, FALSE, NULL, NULL },
......@@ -2006,7 +2006,7 @@ static const RemminaProtocolSetting remmina_plugin_vnci_basic_settings[] =
{
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "listenport", N_("Listen on port"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "username", N_("User name"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_PASSWORD, NULL, NULL, FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_PASSWORD, "password", N_("User password"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_SELECT, "colordepth", N_("Color depth"), FALSE, colordepth_list, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_SELECT, "quality", N_("Quality"), FALSE, quality_list, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_KEYMAP, NULL, NULL, FALSE, NULL, NULL },
......
......@@ -3530,7 +3530,7 @@ static void remmina_connection_object_on_connect(RemminaProtocolWidget* gp, Remm
}
/* Save credentials */
remmina_file_save_group(cnnobj->remmina_file, REMMINA_SETTING_GROUP_CREDENTIAL);
remmina_file_save(cnnobj->remmina_file);
if (!cnnhld->cnnwin)
{
......@@ -3600,14 +3600,7 @@ static void remmina_connection_object_on_disconnect(RemminaProtocolWidget* gp, R
{
remmina_file_set_int(cnnobj->remmina_file, "viewmode", cnnhld->cnnwin->priv->view_mode);
}
if (remmina_pref.save_when_connect)
{
remmina_file_save_all(cnnobj->remmina_file);
}
else
{
remmina_file_save_group(cnnobj->remmina_file, REMMINA_SETTING_GROUP_RUNTIME);
}
remmina_file_save(cnnobj->remmina_file);
}
if (remmina_protocol_widget_has_error(gp))
......
This diff is collapsed.
......@@ -51,14 +51,6 @@ enum
SSH_AUTH_PASSWORD, SSH_AUTH_PUBLICKEY, SSH_AUTH_AGENT, SSH_AUTH_AUTO_PUBLICKEY
};
typedef enum
{
REMMINA_SETTING_GROUP_NONE,
REMMINA_SETTING_GROUP_PROFILE,
REMMINA_SETTING_GROUP_CREDENTIAL,
REMMINA_SETTING_GROUP_RUNTIME,
REMMINA_SETTING_GROUP_ALL
} RemminaSettingGroup;
#define TOOLBAR_OPACITY_LEVEL 8
#define TOOLBAR_OPACITY_MIN 0.2
......@@ -79,8 +71,7 @@ gchar* remmina_file_get_secret(RemminaFile *remminafile, const gchar *setting);
void remmina_file_set_int(RemminaFile *remminafile, const gchar *setting, gint value);
gint remmina_file_get_int(RemminaFile *remminafile, const gchar *setting, gint default_value);
/* Create or overwrite the .remmina file */
void remmina_file_save_group(RemminaFile *remminafile, RemminaSettingGroup group);
void remmina_file_save_all(RemminaFile *remminafile);
void remmina_file_save(RemminaFile *remminafile);
/* Free the RemminaFile object */
void remmina_file_free(RemminaFile *remminafile);
/* Duplicate a RemminaFile object */
......
......@@ -103,10 +103,10 @@ struct _RemminaFileEditorPriv
GtkWidget* config_box;
GtkWidget* config_scrollable;
GtkWidget* config_viewport;
GtkWidget* config_container;
GtkWidget* server_combo;
GtkWidget* password_entry;
GtkWidget* resolution_auto_radio;
GtkWidget* resolution_custom_radio;
GtkWidget* resolution_custom_combo;
......@@ -212,14 +212,17 @@ static void remmina_file_editor_create_notebook_container(RemminaFileEditor* gfe
TRACE_CALL("remmina_file_editor_create_notebook_container");
/* Create the notebook */
gfe->priv->config_container = gtk_notebook_new();
gfe->priv->config_viewport = gtk_viewport_new(NULL, NULL);
gfe->priv->config_scrollable = gtk_scrolled_window_new (NULL, NULL);
gtk_container_set_border_width (GTK_CONTAINER (gfe->priv->config_scrollable), 2);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (gfe->priv->config_scrollable),
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
gtk_widget_show (gfe->priv->config_scrollable);
gtk_container_add (GTK_CONTAINER (gfe->priv->config_scrollable), gfe->priv->config_container);
gtk_container_add (GTK_CONTAINER (gfe->priv->config_viewport), gfe->priv->config_container);
gtk_container_set_border_width(GTK_CONTAINER(gfe->priv->config_viewport), 2);
gtk_widget_show(gfe->priv->config_viewport);
gtk_container_add (GTK_CONTAINER (gfe->priv->config_scrollable), gfe->priv->config_viewport);
gtk_container_set_border_width(GTK_CONTAINER(gfe->priv->config_container), 2);
gtk_widget_show(gfe->priv->config_container);
......@@ -417,14 +420,19 @@ static void remmina_file_editor_create_server(RemminaFileEditor* gfe, const Remm
}
}
static void remmina_file_editor_create_password(RemminaFileEditor* gfe, GtkWidget* grid, gint row)
static GtkWidget* remmina_file_editor_create_password(RemminaFileEditor* gfe, GtkWidget* grid,
gint row, gint col, const gchar* label, const gchar* value)
{
TRACE_CALL("remmina_file_editor_create_password");
TRACE_CALL("remmina_file_editor_create_custom_pwd");
GtkWidget* widget;
gchar* s;
widget = gtk_label_new(_("Password"));
widget = gtk_label_new(label);
gtk_widget_show(widget);
#if GTK_CHECK_VERSION(3, 12, 0)
gtk_widget_set_margin_end (widget, 40);
#else
gtk_widget_set_margin_right (widget, 40);
#endif
gtk_widget_set_valign (widget, GTK_ALIGN_START);
gtk_widget_set_halign (widget, GTK_ALIGN_START);
gtk_grid_attach(GTK_GRID(grid), widget, 0, row, 1, 1);
......@@ -434,14 +442,12 @@ static void remmina_file_editor_create_password(RemminaFileEditor* gfe, GtkWidge
gtk_grid_attach(GTK_GRID(grid), widget, 1, row, 1, 1);
gtk_entry_set_max_length(GTK_ENTRY(widget), 100);
gtk_entry_set_visibility(GTK_ENTRY(widget), FALSE);
gfe->priv->password_entry = widget;
s = remmina_file_get_secret(gfe->priv->remmina_file, "password");
if (s)
if (value)
{
gtk_entry_set_text(GTK_ENTRY(widget), s);
g_free(s);
gtk_entry_set_text(GTK_ENTRY(widget), value);
}
return widget;
}
static void remmina_file_editor_update_resolution(GtkWidget* widget, RemminaFileEditor* gfe)
......@@ -652,9 +658,12 @@ static void remmina_file_editor_create_settings(RemminaFileEditor* gfe, GtkWidge
gint grid_row = 0;
gint grid_column = 0;
gchar** strarr;
gchar* setting_name;
while (settings->type != REMMINA_PROTOCOL_SETTING_TYPE_END)
{
setting_name = (gchar *)(remmina_plugin_manager_get_canonical_setting_name(settings));
switch (settings->type)
{
case REMMINA_PROTOCOL_SETTING_TYPE_SERVER:
......@@ -662,7 +671,11 @@ static void remmina_file_editor_create_settings(RemminaFileEditor* gfe, GtkWidge
break;
case REMMINA_PROTOCOL_SETTING_TYPE_PASSWORD:
remmina_file_editor_create_password(gfe, grid, grid_row);
widget = remmina_file_editor_create_password(gfe, grid, grid_row, 0,
g_dgettext(priv->plugin->domain, settings->label),
remmina_file_get_string(priv->remmina_file, setting_name));
g_hash_table_insert(priv->setting_widgets, setting_name, widget);
grid_row++;
break;
case REMMINA_PROTOCOL_SETTING_TYPE_RESOLUTION:
......@@ -682,48 +695,49 @@ static void remmina_file_editor_create_settings(RemminaFileEditor* gfe, GtkWidge
case REMMINA_PROTOCOL_SETTING_TYPE_TEXT:
widget = remmina_file_editor_create_text(gfe, grid, grid_row, 0,
g_dgettext(priv->plugin->domain, settings->label),
remmina_file_get_string(priv->remmina_file, settings->name));
g_hash_table_insert(priv->setting_widgets, (gchar*) settings->name, widget);
g_dgettext(priv->plugin->domain, settings->label),
remmina_file_get_string(priv->remmina_file, setting_name));
g_hash_table_insert(priv->setting_widgets, setting_name, widget);
grid_row++;
break;
case REMMINA_PROTOCOL_SETTING_TYPE_SELECT:
widget = remmina_file_editor_create_select(gfe, grid, grid_row, 0,
g_dgettext(priv->plugin->domain, settings->label),
(const gpointer*) settings->opt1,
remmina_file_get_string(priv->remmina_file, settings->name));
g_hash_table_insert(priv->setting_widgets, (gchar*) settings->name, widget);
remmina_file_get_string(priv->remmina_file, setting_name));
g_hash_table_insert(priv->setting_widgets, setting_name, widget);
break;
case REMMINA_PROTOCOL_SETTING_TYPE_COMBO:
widget = remmina_file_editor_create_combo(gfe, grid, grid_row, 0,
g_dgettext(priv->plugin->domain, settings->label),
(const gchar*) settings->opt1,
remmina_file_get_string(priv->remmina_file, settings->name));
g_hash_table_insert(priv->setting_widgets, (gchar*) settings->name, widget);
remmina_file_get_string(priv->remmina_file, setting_name));
g_hash_table_insert(priv->setting_widgets, setting_name, widget);
break;
case REMMINA_PROTOCOL_SETTING_TYPE_CHECK:
widget = remmina_file_editor_create_check(gfe, grid, grid_row, grid_column,
g_dgettext (priv->plugin->domain, settings->label),
remmina_file_get_int (priv->remmina_file, (gchar*) settings->name, FALSE));
g_hash_table_insert(priv->setting_widgets, (gchar*) settings->name, widget);
remmina_file_get_int (priv->remmina_file, setting_name, FALSE));
g_hash_table_insert(priv->setting_widgets, setting_name, widget);
break;
case REMMINA_PROTOCOL_SETTING_TYPE_FILE:
widget = remmina_file_editor_create_chooser (gfe, grid, grid_row, 0,
g_dgettext (priv->plugin->domain, settings->label),
remmina_file_get_string (priv->remmina_file, settings->name),
remmina_file_get_string (priv->remmina_file, setting_name),
GTK_FILE_CHOOSER_ACTION_OPEN);
g_hash_table_insert(priv->setting_widgets, (gchar*) settings->name, widget);
g_hash_table_insert(priv->setting_widgets, setting_name, widget);
break;
case REMMINA_PROTOCOL_SETTING_TYPE_FOLDER:
widget = remmina_file_editor_create_chooser (gfe, grid, grid_row, 0,
g_dgettext (priv->plugin->domain, settings->label),
remmina_file_get_string (priv->remmina_file, settings->name),
remmina_file_get_string (priv->remmina_file, setting_name),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
g_hash_table_insert(priv->setting_widgets, (gchar*) settings->name, widget);
g_hash_table_insert(priv->setting_widgets, setting_name, widget);
break;
default:
......@@ -982,12 +996,13 @@ static void remmina_file_editor_protocol_combo_on_changed(GtkComboBox* combo, Re
{
gtk_widget_destroy(priv->config_container);
priv->config_container = NULL;
gtk_widget_destroy(priv->config_viewport);
priv->config_viewport = NULL;
gtk_widget_destroy(priv->config_scrollable);
priv->config_scrollable = NULL;
}
priv->server_combo = NULL;
priv->password_entry = NULL;
priv->resolution_auto_radio = NULL;
priv->resolution_custom_radio = NULL;
priv->resolution_custom_combo = NULL;
......@@ -1134,9 +1149,6 @@ static void remmina_file_editor_update(RemminaFileEditor* gfe)
remmina_file_set_string_ref(priv->remmina_file, "server",
(priv->server_combo ? remmina_public_combo_get_active_text(GTK_COMBO_BOX(priv->server_combo)) : NULL));
remmina_file_set_string(priv->remmina_file, "password",
(priv->password_entry ? gtk_entry_get_text(GTK_ENTRY(priv->password_entry)) : NULL));
if (priv->resolution_auto_radio)
{
remmina_file_set_string_ref(
......@@ -1177,7 +1189,7 @@ static void remmina_file_editor_on_default(GtkWidget* button, RemminaFileEditor*
remmina_file_set_string(gf, "precommand", NULL);
remmina_file_set_string(gf, "postcommand", NULL);
remmina_file_save_all(gf);
remmina_file_save(gf);
remmina_file_free(gf);
dialog = gtk_message_dialog_new(GTK_WINDOW(gfe), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK,
......@@ -1190,7 +1202,7 @@ static void remmina_file_editor_on_save(GtkWidget* button, RemminaFileEditor* gf
{
TRACE_CALL("remmina_file_editor_on_save");
remmina_file_editor_update(gfe);
remmina_file_save_all(gfe->priv->remmina_file);
remmina_file_save(gfe->priv->remmina_file);
remmina_icon_populate_menu();
gtk_widget_destroy(GTK_WIDGET(gfe));
}
......@@ -1201,11 +1213,10 @@ static void remmina_file_editor_on_connect(GtkWidget* button, RemminaFileEditor*
RemminaFile* gf;
remmina_file_editor_update(gfe);
if (remmina_pref.save_when_connect)
{
remmina_file_save_all(gfe->priv->remmina_file);
remmina_icon_populate_menu();
}
remmina_file_save(gfe->priv->remmina_file);
remmina_icon_populate_menu();
gf = remmina_file_dup(gfe->priv->remmina_file);
/* Put server into name for Quick Connect */
if (remmina_file_get_filename(gf) == NULL)
......
......@@ -676,6 +676,7 @@ void remmina_main_on_action_connection_delete(GtkAction *action, gpointer user_d
{
TRACE_CALL("remmina_main_on_action_connection_delete");
GtkWidget *dialog;
gchar *delfilename;
if (!remminamain->priv->selected_filename)
return;
......@@ -684,7 +685,9 @@ void remmina_main_on_action_connection_delete(GtkAction *action, gpointer user_d
_("Are you sure to delete '%s'"), remminamain->priv->selected_name);
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_YES)
{
remmina_file_delete(remminamain->priv->selected_filename);
delfilename = g_strdup(remminamain->priv->selected_filename);
remmina_file_delete(delfilename);
g_free(delfilename);
remmina_icon_populate_menu();
remmina_main_load_files();
}
......@@ -781,7 +784,7 @@ static void remmina_main_import_file_list(GSList *files)
if (plugin && (remminafile = plugin->import_func(path)) != NULL && remmina_file_get_string(remminafile, "name"))
{
remmina_file_generate_filename(remminafile);
remmina_file_save_all(remminafile);
remmina_file_save(remminafile);
imported = TRUE;
}
else
......
......@@ -58,8 +58,8 @@ static gboolean remmina_masterthread_exec_callback(RemminaMTExecData *d)
case FUNC_CHAT_RECEIVE:
remmina_protocol_widget_chat_receive(d->p.chat_receive.gp, d->p.chat_receive.text);
break;
case FUNC_FILE_GET_SECRET:
d->p.file_get_secret.retval = remmina_file_get_secret( d->p.file_get_secret.remminafile, d->p.file_get_secret.setting );
case FUNC_FILE_GET_STRING:
d->p.file_get_string.retval = remmina_file_get_string( d->p.file_get_string.remminafile, d->p.file_get_string.setting );
break;
case FUNC_DIALOG_SERVERKEY_CONFIRM:
d->p.dialog_serverkey_confirm.retval = remmina_init_dialog_serverkey_confirm( d->p.dialog_serverkey_confirm.dialog,
......
......@@ -44,7 +44,7 @@ typedef struct remmina_masterthread_exec_data
{
enum { FUNC_GTK_LABEL_SET_TEXT,
FUNC_INIT_SAVE_CRED, FUNC_CHAT_RECEIVE, FUNC_FILE_GET_SECRET,
FUNC_INIT_SAVE_CRED, FUNC_CHAT_RECEIVE, FUNC_FILE_GET_STRING,
FUNC_DIALOG_SERVERKEY_CONFIRM, FUNC_DIALOG_AUTHPWD, FUNC_DIALOG_AUTHUSERPWD,
FUNC_DIALOG_CERT, FUNC_DIALOG_CERTCHANGED, FUNC_DIALOG_AUTHX509,
FUNC_FTP_CLIENT_UPDATE_TASK, FUNC_FTP_CLIENT_GET_WAITING_TASK,
......@@ -73,8 +73,8 @@ typedef struct remmina_masterthread_exec_data
{
RemminaFile *remminafile;
const gchar *setting;
gchar* retval;
} file_get_secret;
const gchar* retval;
} file_get_string;
struct
{
RemminaInitDialog *dialog;
......
......@@ -266,6 +266,20 @@ RemminaPlugin* remmina_plugin_manager_get_plugin(RemminaPluginType type, const g
return NULL;
}
const gchar *remmina_plugin_manager_get_canonical_setting_name(const RemminaProtocolSetting* setting)
{
if (setting->name == NULL) {
if (setting->type == REMMINA_PROTOCOL_SETTING_TYPE_SERVER)
return "server";
if (setting->type == REMMINA_PROTOCOL_SETTING_TYPE_PASSWORD)
return "password";
if (setting->type == REMMINA_PROTOCOL_SETTING_TYPE_RESOLUTION)
return "resolution";
return "missing_setting_name_into_plugin_RemminaProtocolSetting";
}
return setting->name;
}
void remmina_plugin_manager_for_each_plugin(RemminaPluginType type, RemminaPluginFunc func, gpointer data)
{
TRACE_CALL("remmina_plugin_manager_for_each_plugin");
......
......@@ -52,6 +52,7 @@ void remmina_plugin_manager_show_stdout();
RemminaFilePlugin* remmina_plugin_manager_get_import_file_handler(const gchar *file);
RemminaFilePlugin* remmina_plugin_manager_get_export_file_handler(RemminaFile *remminafile);
RemminaSecretPlugin* remmina_plugin_manager_get_secret_plugin(void);
const gchar *remmina_plugin_manager_get_canonical_setting_name(const RemminaProtocolSetting* setting);
extern RemminaPluginService remmina_plugin_manager_service;
......
......@@ -245,11 +245,6 @@ void remmina_pref_init(void)
else
remmina_pref.save_view_mode = TRUE;
if (g_key_file_has_key(gkeyfile, "remmina_pref", "save_when_connect", NULL))
remmina_pref.save_when_connect = g_key_file_get_boolean(gkeyfile, "remmina_pref", "save_when_connect", NULL);
else
remmina_pref.save_when_connect = TRUE;
if (g_key_file_has_key(gkeyfile, "remmina_pref", "fullscreen_on_auto", NULL))
remmina_pref.fullscreen_on_auto = g_key_file_get_boolean(gkeyfile, "remmina_pref", "fullscreen_on_auto", NULL);
else
......@@ -593,7 +588,6 @@ void remmina_pref_save(void)
g_key_file_load_from_file(gkeyfile, remmina_pref_file, G_KEY_FILE_NONE, NULL);
g_key_file_set_boolean(gkeyfile, "remmina_pref", "save_view_mode", remmina_pref.save_view_mode);
g_key_file_set_boolean(gkeyfile, "remmina_pref", "save_when_connect", remmina_pref.save_when_connect);
g_key_file_set_integer(gkeyfile, "remmina_pref", "floating_toolbar_placement", remmina_pref.floating_toolbar_placement);
g_key_file_set_integer(gkeyfile, "remmina_pref", "toolbar_placement", remmina_pref.toolbar_placement);
g_key_file_set_boolean(gkeyfile, "remmina_pref", "always_show_tab", remmina_pref.always_show_tab);
......
......@@ -96,7 +96,6 @@ typedef struct _RemminaPref
{
/* In RemminaPrefDialog options tab */
gboolean save_view_mode;
gboolean save_when_connect;
gint default_action;
gint scale_quality;
const gchar *screenshot_path;
......
......@@ -124,7 +124,6 @@ void remmina_pref_on_dialog_destroy(GtkWidget *widget, gpointer user_data)
GdkRGBA color;
remmina_pref.save_view_mode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_options_remember_last_view_mode));
remmina_pref.save_when_connect = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_options_save_settings));
remmina_pref.fullscreen_on_auto = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_fullscreen_on_auto));
remmina_pref.always_show_tab = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_show_tabs));
remmina_pref.hide_connection_toolbar = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_hide_toolbar));
......@@ -286,7 +285,6 @@ static void remmina_pref_dialog_init(void)
gtk_dialog_set_default_response(GTK_DIALOG(remmina_pref_dialog->dialog), GTK_RESPONSE_CLOSE);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_options_remember_last_view_mode), remmina_pref.save_view_mode);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_options_save_settings), remmina_pref.save_when_connect);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_show_tabs), remmina_pref.always_show_tab);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_hide_toolbar), remmina_pref.hide_connection_toolbar);
......
......@@ -1158,7 +1158,7 @@ void remmina_protocol_widget_init_save_cred(RemminaProtocolWidget* gp)
}
if (save)
{
remmina_file_save_group(remminafile, REMMINA_SETTING_GROUP_CREDENTIAL);
remmina_file_save(remminafile);
}
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment