From 184de2ed2d26542d519caefe87c86196b362c34b Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 10 Sep 2015 00:10:28 +0200 Subject: libssh depracation warnings --- remmina-plugins/nx/nx_session.c | 6 +-- remmina/src/remmina_protocol_widget.c | 14 +++--- remmina/src/remmina_ssh.c | 84 +++++++++++++++++------------------ 3 files changed, 51 insertions(+), 53 deletions(-) diff --git a/remmina-plugins/nx/nx_session.c b/remmina-plugins/nx/nx_session.c index c2836915b..0b085668a 100644 --- a/remmina-plugins/nx/nx_session.c +++ b/remmina-plugins/nx/nx_session.c @@ -276,12 +276,12 @@ static gboolean remmina_nx_session_get_response(RemminaNXSession *nx) timeout.tv_usec = 0; ch[0] = nx->channel; ch[1] = NULL; - channel_select(ch, NULL, NULL, &timeout); + ssh_channel_select(ch, NULL, NULL, &timeout); is_stderr = 0; while (is_stderr <= 1) { - len = channel_poll(nx->channel, is_stderr); + len = ssh_channel_poll(nx->channel, is_stderr); if (len == SSH_ERROR) { remmina_nx_session_set_error(nx, "Error reading channel: %s"); @@ -295,7 +295,7 @@ static gboolean remmina_nx_session_get_response(RemminaNXSession *nx) return FALSE; buffer = buffer_new(); - len = channel_read_buffer(nx->channel, buffer, len, is_stderr); + len = ssh_channel_read_buffer(nx->channel, buffer, len, is_stderr); if (len <= 0) { remmina_nx_session_set_application_error(nx, "Channel closed."); diff --git a/remmina/src/remmina_protocol_widget.c b/remmina/src/remmina_protocol_widget.c index f688c4a22..09e0d39d8 100644 --- a/remmina/src/remmina_protocol_widget.c +++ b/remmina/src/remmina_protocol_widget.c @@ -701,7 +701,7 @@ gboolean remmina_protocol_widget_ssh_exec(RemminaProtocolWidget* gp, gboolean wa gchar *cmd, *ptr; va_list args; - if ((channel = channel_new (REMMINA_SSH (tunnel)->session)) == NULL) + if ((channel = ssh_channel_new (REMMINA_SSH (tunnel)->session)) == NULL) { return FALSE; } @@ -710,13 +710,13 @@ gboolean remmina_protocol_widget_ssh_exec(RemminaProtocolWidget* gp, gboolean wa cmd = g_strdup_vprintf (fmt, args); va_end (args); - if (channel_open_session (channel) == SSH_OK && - channel_request_exec (channel, cmd) == SSH_OK) + if (ssh_channel_open_session (channel) == SSH_OK && + ssh_channel_request_exec (channel, cmd) == SSH_OK) { if (wait) { - channel_send_eof (channel); - status = channel_get_exit_status (channel); + ssh_channel_send_eof (channel); + status = ssh_channel_get_exit_status (channel); ptr = strchr (cmd, ' '); if (ptr) *ptr = '\0'; switch (status) @@ -745,8 +745,8 @@ gboolean remmina_protocol_widget_ssh_exec(RemminaProtocolWidget* gp, gboolean wa } g_free(cmd); if (wait) - channel_close (channel); - channel_free (channel); + ssh_channel_close (channel); + ssh_channel_free (channel); return ret; #else diff --git a/remmina/src/remmina_ssh.c b/remmina/src/remmina_ssh.c index ac6f09d28..d2584841b 100644 --- a/remmina/src/remmina_ssh.c +++ b/remmina/src/remmina_ssh.c @@ -375,7 +375,6 @@ remmina_ssh_init_session (RemminaSSH *ssh) { TRACE_CALL("remmina_ssh_init_session"); gint verbosity; - //gchar* verbosity; ssh->callback = g_new0 (struct ssh_callbacks_struct, 1); ssh->callback->userdata = ssh; @@ -418,7 +417,6 @@ remmina_ssh_init_from_file (RemminaSSH *ssh, RemminaFile *remminafile) const gchar *ssh_username; const gchar *ssh_privatekey; const gchar *server; - gint verbosity; gchar *s; ssh->session = NULL; @@ -617,8 +615,8 @@ remmina_ssh_tunnel_close_all_channels (RemminaSSHTunnel *tunnel) { close (tunnel->sockets[i]); remmina_ssh_tunnel_buffer_free (tunnel->socketbuffers[i]); - channel_close (tunnel->channels[i]); - channel_free (tunnel->channels[i]); + ssh_channel_close (tunnel->channels[i]); + ssh_channel_free (tunnel->channels[i]); } g_free(tunnel->channels); @@ -633,8 +631,8 @@ remmina_ssh_tunnel_close_all_channels (RemminaSSHTunnel *tunnel) if (tunnel->x11_channel) { - channel_close (tunnel->x11_channel); - channel_free (tunnel->x11_channel); + ssh_channel_close (tunnel->x11_channel); + ssh_channel_free (tunnel->x11_channel); tunnel->x11_channel = NULL; } } @@ -643,8 +641,8 @@ static void remmina_ssh_tunnel_remove_channel (RemminaSSHTunnel *tunnel, gint n) { TRACE_CALL("remmina_ssh_tunnel_remove_channel"); - channel_close (tunnel->channels[n]); - channel_free (tunnel->channels[n]); + ssh_channel_close (tunnel->channels[n]); + ssh_channel_free (tunnel->channels[n]); close (tunnel->sockets[n]); remmina_ssh_tunnel_buffer_free (tunnel->socketbuffers[n]); tunnel->num_channels--; @@ -721,7 +719,7 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) return NULL; } - if ((channel = channel_new (tunnel->ssh.session)) == NULL) + if ((channel = ssh_channel_new (tunnel->ssh.session)) == NULL) { close (sock); remmina_ssh_set_error (REMMINA_SSH (tunnel), "Failed to createt channel : %s"); @@ -729,11 +727,11 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) return NULL; } /* Request the SSH server to connect to the destination */ - if (channel_open_forward (channel, tunnel->dest, tunnel->port, "127.0.0.1", 0) != SSH_OK) + if (ssh_channel_open_forward (channel, tunnel->dest, tunnel->port, "127.0.0.1", 0) != SSH_OK) { close (sock); - channel_close (channel); - channel_free (channel); + ssh_channel_close (channel); + ssh_channel_free (channel); remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to connect to the SSH tunnel destination: %s")); tunnel->thread = 0; return NULL; @@ -742,7 +740,7 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) break; case REMMINA_SSH_TUNNEL_X11: - if ((tunnel->x11_channel = channel_new (tunnel->ssh.session)) == NULL) + if ((tunnel->x11_channel = ssh_channel_new (tunnel->ssh.session)) == NULL) { remmina_ssh_set_error (REMMINA_SSH (tunnel), "Failed to create channel : %s"); tunnel->thread = 0; @@ -755,8 +753,8 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) tunnel->thread = 0; return NULL; } - if (channel_open_session (tunnel->x11_channel) || - channel_request_x11 (tunnel->x11_channel, TRUE, NULL, ptr, + if (ssh_channel_open_session (tunnel->x11_channel) || + ssh_channel_request_x11 (tunnel->x11_channel, TRUE, NULL, ptr, gdk_screen_get_number (gdk_screen_get_default ()))) { g_free(ptr); @@ -765,7 +763,7 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) return NULL; } g_free(ptr); - if (channel_request_exec (tunnel->x11_channel, tunnel->dest)) + if (ssh_channel_request_exec (tunnel->x11_channel, tunnel->dest)) { ptr = g_strdup_printf(_("Failed to execute %s on SSH server : %%s"), tunnel->dest); remmina_ssh_set_error (REMMINA_SSH (tunnel), ptr); @@ -791,7 +789,7 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) /* Detect the next available port starting from 6010 on the server */ for (i = 10; i <= MAX_X_DISPLAY_NUMBER; i++) { - if (channel_forward_listen (REMMINA_SSH (tunnel)->session, + if (ssh_channel_listen_forward (REMMINA_SSH (tunnel)->session, (tunnel->bindlocalhost ? "localhost" : NULL), 6000 + i, NULL)) { continue; @@ -827,7 +825,7 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) break; case REMMINA_SSH_TUNNEL_REVERSE: - if (channel_forward_listen (REMMINA_SSH (tunnel)->session, NULL, tunnel->port, NULL)) + if (ssh_channel_listen_forward (REMMINA_SSH (tunnel)->session, NULL, tunnel->port, NULL)) { remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to request port forwarding : %s")); if (tunnel->disconnect_func) @@ -868,11 +866,11 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) /* Wait for a period of time for the first incoming connection */ if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_X11) { - channel = channel_accept_x11 (tunnel->x11_channel, 15000); + channel = ssh_channel_accept_x11 (tunnel->x11_channel, 15000); } else { - channel = channel_forward_accept (REMMINA_SSH (tunnel)->session, 15000); + channel = ssh_channel_accept_forward (REMMINA_SSH (tunnel)->session, 15000, &tunnel->port); } if (!channel) { @@ -891,7 +889,7 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_REVERSE) { /* For reverse tunnel, we only need one connection. */ - channel_forward_cancel (REMMINA_SSH (tunnel)->session, NULL, tunnel->port); + ssh_channel_cancel_forward (REMMINA_SSH (tunnel)->session, NULL, tunnel->port); } } else if (tunnel->tunnel_type != REMMINA_SSH_TUNNEL_REVERSE) @@ -904,11 +902,11 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) { if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_X11) { - channel = channel_accept_x11 (tunnel->x11_channel, 0); + channel = ssh_channel_accept_x11 (tunnel->x11_channel, 0); } else { - channel = channel_forward_accept (REMMINA_SSH (tunnel)->session, 0); + channel = ssh_channel_accept_forward (REMMINA_SSH (tunnel)->session, 0, &tunnel->port); } if (channel == NULL) { @@ -944,8 +942,8 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) else { /* Failed to create unix socket. Will this happen? */ - channel_close (channel); - channel_free (channel); + ssh_channel_close (channel); + ssh_channel_free (channel); } channel = NULL; } @@ -987,7 +985,7 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) { for (ptr = tunnel->buffer, lenw = 0; len > 0; len -= lenw, ptr += lenw) { - lenw = channel_write (tunnel->channels[i], (char*) ptr, len); + lenw = ssh_channel_write (tunnel->channels[i], (char*) ptr, len); if (lenw <= 0) { disconnected = TRUE; @@ -1013,7 +1011,7 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) if (!tunnel->socketbuffers[i]) { - len = channel_poll (tunnel->channels[i], 0); + len = ssh_channel_poll (tunnel->channels[i], 0); if (len == SSH_ERROR || len == SSH_EOF) { disconnected = TRUE; @@ -1021,7 +1019,7 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) else if (len > 0) { tunnel->socketbuffers[i] = remmina_ssh_tunnel_buffer_new (len); - len = channel_read_nonblocking (tunnel->channels[i], tunnel->socketbuffers[i]->data, len, 0); + len = ssh_channel_read_nonblocking (tunnel->channels[i], tunnel->socketbuffers[i]->data, len, 0); if (len <= 0) { disconnected = TRUE; @@ -1233,7 +1231,7 @@ remmina_ssh_tunnel_free (RemminaSSHTunnel* tunnel) if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_XPORT && tunnel->remotedisplay > 0) { - channel_forward_cancel (REMMINA_SSH (tunnel)->session, + ssh_channel_cancel_forward (REMMINA_SSH (tunnel)->session, NULL, 6000 + tunnel->remotedisplay); } if (tunnel->server_sock >= 0) @@ -1375,31 +1373,31 @@ remmina_ssh_shell_thread (gpointer data) LOCK_SSH (shell) - if ((channel = channel_new (REMMINA_SSH (shell)->session)) == NULL || - channel_open_session (channel)) + if ((channel = ssh_channel_new (REMMINA_SSH (shell)->session)) == NULL || + ssh_channel_open_session (channel)) { UNLOCK_SSH (shell) remmina_ssh_set_error (REMMINA_SSH (shell), "Failed to open channel : %s"); - if (channel) channel_free (channel); + if (channel) ssh_channel_free (channel); shell->thread = 0; return NULL; } - channel_request_pty (channel); + ssh_channel_request_pty (channel); if (shell->exec && shell->exec[0]) { - ret = channel_request_exec (channel, shell->exec); + ret = ssh_channel_request_exec (channel, shell->exec); } else { - ret = channel_request_shell (channel); + ret = ssh_channel_request_shell (channel); } if (ret) { UNLOCK_SSH (shell) remmina_ssh_set_error (REMMINA_SSH (shell), "Failed to request shell : %s"); - channel_close (channel); - channel_free (channel); + ssh_channel_close (channel); + ssh_channel_free (channel); shell->thread = 0; return NULL; } @@ -1431,13 +1429,13 @@ remmina_ssh_shell_thread (gpointer data) len = read (shell->master, buf, buf_len); if (len <= 0) break; LOCK_SSH (shell) - channel_write (channel, buf, len); + ssh_channel_write (channel, buf, len); UNLOCK_SSH (shell) } for (i = 0; i < 2; i++) { LOCK_SSH (shell) - len = channel_poll (channel, i); + len = ssh_channel_poll (channel, i); UNLOCK_SSH (shell) if (len == SSH_ERROR || len == SSH_EOF) { @@ -1451,7 +1449,7 @@ remmina_ssh_shell_thread (gpointer data) buf = (gchar*) g_realloc (buf, buf_len + 1); } LOCK_SSH (shell) - len = channel_read_nonblocking (channel, buf, len, i); + len = ssh_channel_read_nonblocking (channel, buf, len, i); UNLOCK_SSH (shell) if (len <= 0) { @@ -1469,8 +1467,8 @@ remmina_ssh_shell_thread (gpointer data) LOCK_SSH (shell) shell->channel = NULL; - channel_close (channel); - channel_free (channel); + ssh_channel_close (channel); + ssh_channel_free (channel); UNLOCK_SSH (shell) g_free(buf); @@ -1524,7 +1522,7 @@ remmina_ssh_shell_set_size (RemminaSSHShell *shell, gint columns, gint rows) LOCK_SSH (shell) if (shell->channel) { - channel_change_pty_size (shell->channel, columns, rows); + ssh_channel_change_pty_size (shell->channel, columns, rows); } UNLOCK_SSH (shell) } -- cgit v1.2.3 From bcb48e447090497faf4b6a57bf5a9c6874f3c88a Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 10 Sep 2015 00:10:49 +0200 Subject: libssh depracation warnings --- remmina/src/remmina_file_editor.c | 1 - 1 file changed, 1 deletion(-) diff --git a/remmina/src/remmina_file_editor.c b/remmina/src/remmina_file_editor.c index 984e96992..583ff430f 100644 --- a/remmina/src/remmina_file_editor.c +++ b/remmina/src/remmina_file_editor.c @@ -1405,4 +1405,3 @@ GtkWidget* remmina_file_editor_new_from_filename(const gchar* filename) return NULL; } } -// vim:noet:ci:pi:sts=0:sw=4:ts=4 -- cgit v1.2.3 From 1b235690049aff2565ad238a56a8856ef7a5bd98 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 10 Sep 2015 00:17:11 +0200 Subject: Code cleaning --- remmina-plugins/nx/nx_session.c | 347 +++++++++-------------- remmina/src/remmina_protocol_widget.c | 376 ++++++++++--------------- remmina/src/remmina_ssh.c | 503 ++++++++++++---------------------- 3 files changed, 457 insertions(+), 769 deletions(-) diff --git a/remmina-plugins/nx/nx_session.c b/remmina-plugins/nx/nx_session.c index 0b085668a..8fb4a2c8a 100644 --- a/remmina-plugins/nx/nx_session.c +++ b/remmina-plugins/nx/nx_session.c @@ -50,12 +50,10 @@ static gboolean remmina_get_keytype(const gchar *private_key_file, gint *keytype FILE *fp; gchar buf1[100], buf2[100]; - if ((fp = g_fopen(private_key_file, "r")) == NULL) - { + if ((fp = g_fopen(private_key_file, "r")) == NULL) { return FALSE; } - if (!fgets(buf1, sizeof(buf1), fp) || !fgets(buf2, sizeof(buf2), fp)) - { + if (!fgets(buf1, sizeof(buf1), fp) || !fgets(buf2, sizeof(buf2), fp)) { fclose(fp); return FALSE; } @@ -63,11 +61,10 @@ static gboolean remmina_get_keytype(const gchar *private_key_file, gint *keytype if (strstr(buf1, "BEGIN RSA")) *keytype = REMMINA_SSH_TYPE_RSA; + else if (strstr(buf1, "BEGIN DSA")) + *keytype = REMMINA_SSH_TYPE_DSS; else - if (strstr(buf1, "BEGIN DSA")) - *keytype = REMMINA_SSH_TYPE_DSS; - else - return FALSE; + return FALSE; *encrypted = (strstr(buf2, "ENCRYPTED") ? TRUE : FALSE); @@ -91,8 +88,7 @@ static const gchar nx_default_private_key[] = "-----BEGIN DSA PRIVATE KEY-----\n static const gchar nx_hello_server_msg[] = "hello nxserver - version "; -struct _RemminaNXSession -{ +struct _RemminaNXSession { /* Common SSH members */ ssh_session session; ssh_channel channel; @@ -149,32 +145,27 @@ void remmina_nx_session_free(RemminaNXSession *nx) TRACE_CALL("remmina_nx_session_free"); pthread_t thread; - if (nx->proxy_watch_source) - { + if (nx->proxy_watch_source) { g_source_remove(nx->proxy_watch_source); nx->proxy_watch_source = 0; } - if (nx->proxy_pid) - { + if (nx->proxy_pid) { kill(nx->proxy_pid, SIGTERM); g_spawn_close_pid(nx->proxy_pid); nx->proxy_pid = 0; } thread = nx->thread; - if (thread) - { + if (thread) { nx->running = FALSE; pthread_cancel(thread); pthread_join(thread, NULL); nx->thread = 0; } - if (nx->channel) - { + if (nx->channel) { ssh_channel_close(nx->channel); ssh_channel_free(nx->channel); } - if (nx->server_sock >= 0) - { + if (nx->server_sock >= 0) { close(nx->server_sock); nx->server_sock = -1; } @@ -187,13 +178,11 @@ void remmina_nx_session_free(RemminaNXSession *nx) g_free(nx->session_id); g_free(nx->proxy_cookie); - if (nx->session_list) - { + if (nx->session_list) { g_object_unref(nx->session_list); nx->session_list = NULL; } - if (nx->session) - { + if (nx->session) { ssh_free(nx->session); nx->session = NULL; } @@ -238,8 +227,7 @@ remmina_nx_session_get_error(RemminaNXSession *nx) void remmina_nx_session_clear_error(RemminaNXSession *nx) { TRACE_CALL("remmina_nx_session_clear_error"); - if (nx->error) - { + if (nx->error) { g_free(nx->error); nx->error = NULL; } @@ -279,11 +267,9 @@ static gboolean remmina_nx_session_get_response(RemminaNXSession *nx) ssh_channel_select(ch, NULL, NULL, &timeout); is_stderr = 0; - while (is_stderr <= 1) - { + while (is_stderr <= 1) { len = ssh_channel_poll(nx->channel, is_stderr); - if (len == SSH_ERROR) - { + if (len == SSH_ERROR) { remmina_nx_session_set_error(nx, "Error reading channel: %s"); return FALSE; } @@ -296,13 +282,11 @@ static gboolean remmina_nx_session_get_response(RemminaNXSession *nx) buffer = buffer_new(); len = ssh_channel_read_buffer(nx->channel, buffer, len, is_stderr); - if (len <= 0) - { + if (len <= 0) { remmina_nx_session_set_application_error(nx, "Channel closed."); return FALSE; } - if (len > 0) - { + if (len > 0) { g_string_append_len(nx->response, (const gchar*) buffer_get(buffer), len); } @@ -327,28 +311,26 @@ static void remmina_nx_session_parse_session_list_line(RemminaNXSession *nx, con gtk_list_store_append(nx->session_list, &iter); p1 = (char*) line; - for (i = 0; i < 7; i++) - { + for (i = 0; i < 7; i++) { p2 = strchr(p1, ' '); if (!p2) return; val = g_strndup(p1, (gint)(p2 - p1)); - switch (i) - { - case 0: - gtk_list_store_set(nx->session_list, &iter, REMMINA_NX_SESSION_COLUMN_DISPLAY, val, -1); - break; - case 1: - gtk_list_store_set(nx->session_list, &iter, REMMINA_NX_SESSION_COLUMN_TYPE, val, -1); - break; - case 2: - gtk_list_store_set(nx->session_list, &iter, REMMINA_NX_SESSION_COLUMN_ID, val, -1); - break; - case 6: - gtk_list_store_set(nx->session_list, &iter, REMMINA_NX_SESSION_COLUMN_STATUS, val, -1); - break; - default: - break; + switch (i) { + case 0: + gtk_list_store_set(nx->session_list, &iter, REMMINA_NX_SESSION_COLUMN_DISPLAY, val, -1); + break; + case 1: + gtk_list_store_set(nx->session_list, &iter, REMMINA_NX_SESSION_COLUMN_TYPE, val, -1); + break; + case 2: + gtk_list_store_set(nx->session_list, &iter, REMMINA_NX_SESSION_COLUMN_ID, val, -1); + break; + case 6: + gtk_list_store_set(nx->session_list, &iter, REMMINA_NX_SESSION_COLUMN_STATUS, val, -1); + break; + default: + break; } g_free(val); @@ -378,17 +360,13 @@ static gint remmina_nx_session_parse_line(RemminaNXSession *nx, const gchar *lin *valueptr = NULL; /* Get the server version from the initial line */ - if (!nx->version) - { + if (!nx->version) { s = g_ascii_strdown(line, -1); ptr = strstr(s, nx_hello_server_msg); - if (!ptr) - { + if (!ptr) { /* Try to use a default version */ nx->version = g_strdup("3.3.0"); - } - else - { + } else { nx->version = g_strdup(ptr + strlen(nx_hello_server_msg)); ptr = strchr(nx->version, ' '); if (ptr) @@ -402,19 +380,13 @@ static gint remmina_nx_session_parse_line(RemminaNXSession *nx, const gchar *lin return nx->status; } - if (sscanf(line, "NX> %i ", &status) < 1) - { - if (nx->session_list_state && nx->session_list) - { - if (nx->session_list_state == 1 && strncmp(line, "----", 4) == 0) - { + if (sscanf(line, "NX> %i ", &status) < 1) { + if (nx->session_list_state && nx->session_list) { + if (nx->session_list_state == 1 && strncmp(line, "----", 4) == 0) { nx->session_list_state = 2; + } else if (nx->session_list_state == 2) { + remmina_nx_session_parse_session_list_line(nx, line); } - else - if (nx->session_list_state == 2) - { - remmina_nx_session_parse_session_list_line(nx, line); - } return -1; } return nx->status; @@ -449,8 +421,7 @@ remmina_nx_session_get_line(RemminaNXSession *nx) line = g_strndup(pos, len - 1); l = strlen(line); - if (l > 0 && line[l - 1] == '\r') - { + if (l > 0 && line[l - 1] == '\r') { line[l - 1] = '\0'; } @@ -469,55 +440,44 @@ static gint remmina_nx_session_parse_response(RemminaNXSession *nx) if (nx->response_pos >= nx->response->len) return -1; - while ((line = remmina_nx_session_get_line(nx)) != NULL) - { + while ((line = remmina_nx_session_get_line(nx)) != NULL) { if (nx->log_callback) nx->log_callback("[NX] %s\n", line); status = remmina_nx_session_parse_line(nx, line, &p); - if (status == 500) - { + if (status == 500) { /* 500: Last operation failed. Should be ignored. */ - } - else - if (status >= 400 && status <= 599) - { - remmina_nx_session_set_application_error(nx, "%s", line); - } - else - { - switch (status) - { - case 127: /* Session list */ - nx->session_list_state = 1; - break; - case 148: /* Server capacity not reached for user xxx */ - nx->session_list_state = 0; - nx->allow_start = TRUE; - break; - case 700: - nx->session_id = g_strdup(p); - break; - case 705: - nx->session_display = atoi(p); - break; - case 701: - nx->proxy_cookie = g_strdup(p); - break; - } + } else if (status >= 400 && status <= 599) { + remmina_nx_session_set_application_error(nx, "%s", line); + } else { + switch (status) { + case 127: /* Session list */ + nx->session_list_state = 1; + break; + case 148: /* Server capacity not reached for user xxx */ + nx->session_list_state = 0; + nx->allow_start = TRUE; + break; + case 700: + nx->session_id = g_strdup(p); + break; + case 705: + nx->session_display = atoi(p); + break; + case 701: + nx->proxy_cookie = g_strdup(p); + break; } + } g_free(line); nx->status = status; } pos = nx->response->str + nx->response_pos; - if (sscanf(pos, "NX> %i ", &status) < 1) - { + if (sscanf(pos, "NX> %i ", &status) < 1) { status = nx->status; - } - else - { + } else { if (nx->log_callback) nx->log_callback("[NX] %s\n", pos); nx->response_pos += 8; @@ -531,8 +491,7 @@ static gint remmina_nx_session_expect_status2(RemminaNXSession *nx, gint status, TRACE_CALL("remmina_nx_session_expect_status2"); gint response; - while ((response = remmina_nx_session_parse_response(nx)) != status && response != status2) - { + while ((response = remmina_nx_session_parse_response(nx)) != status && response != status2) { if (response == 999) break; if (!remmina_nx_session_get_response(nx)) @@ -567,7 +526,7 @@ static void remmina_nx_session_send_command(RemminaNXSession *nx, const gchar *c } gboolean remmina_nx_session_open(RemminaNXSession *nx, const gchar *server, guint port, const gchar *private_key_file, - RemminaNXPassphraseCallback passphrase_func, gpointer userdata) + RemminaNXPassphraseCallback passphrase_func, gpointer userdata) { TRACE_CALL("remmina_nx_session_open"); gint ret; @@ -581,15 +540,12 @@ gboolean remmina_nx_session_open(RemminaNXSession *nx, const gchar *server, guin ssh_options_set(nx->session, SSH_OPTIONS_PORT, &port); ssh_options_set(nx->session, SSH_OPTIONS_USER, "nx"); - if (private_key_file && private_key_file[0]) - { - if (!remmina_get_keytype(private_key_file, &keytype, &encrypted)) - { + if (private_key_file && private_key_file[0]) { + if (!remmina_get_keytype(private_key_file, &keytype, &encrypted)) { remmina_nx_session_set_application_error(nx, "Invalid private key file."); return FALSE; } - if (encrypted && !passphrase_func(&passphrase, userdata)) - { + if (encrypted && !passphrase_func(&passphrase, userdata)) { return FALSE; } if ( ssh_pki_import_privkey_file(private_key_file, (passphrase ? passphrase : ""), NULL, NULL, &priv_key) != SSH_OK ) { @@ -598,9 +554,7 @@ gboolean remmina_nx_session_open(RemminaNXSession *nx, const gchar *server, guin return FALSE; } g_free(passphrase); - } - else - { + } else { /* Use NoMachine's default nx private key */ if ( ssh_pki_import_privkey_base64(nx_default_private_key, NULL, NULL, NULL, &priv_key) != SSH_OK ) { remmina_nx_session_set_application_error(nx, "Failed to import NX default private key."); @@ -608,8 +562,7 @@ gboolean remmina_nx_session_open(RemminaNXSession *nx, const gchar *server, guin } } - if (ssh_connect(nx->session)) - { + if (ssh_connect(nx->session)) { ssh_key_free(priv_key); remmina_nx_session_set_error(nx, "Failed to startup SSH session: %s"); return FALSE; @@ -619,19 +572,16 @@ gboolean remmina_nx_session_open(RemminaNXSession *nx, const gchar *server, guin ssh_key_free(priv_key); - if (ret != SSH_AUTH_SUCCESS) - { + if (ret != SSH_AUTH_SUCCESS) { remmina_nx_session_set_error(nx, "NX SSH authentication failed: %s"); return FALSE; } - if ((nx->channel = ssh_channel_new(nx->session)) == NULL || ssh_channel_open_session(nx->channel) != SSH_OK) - { + if ((nx->channel = ssh_channel_new(nx->session)) == NULL || ssh_channel_open_session(nx->channel) != SSH_OK) { return FALSE; } - if (ssh_channel_request_shell(nx->channel) != SSH_OK) - { + if (ssh_channel_request_shell(nx->channel) != SSH_OK) { return FALSE; } @@ -669,17 +619,13 @@ gboolean remmina_nx_session_login(RemminaNXSession *nx, const gchar *username, c remmina_nx_session_send_command(nx, username); /* NoMachine Testdrive does not prompt for password, in which case 105 response is received without 102 */ response = remmina_nx_session_expect_status2(nx, 102, 105); - if (response == 102) - { + if (response == 102) { remmina_nx_session_send_command(nx, password); if (!remmina_nx_session_expect_status(nx, 105)) return FALSE; + } else if (response != 105) { + return FALSE; } - else - if (response != 105) - { - return FALSE; - } return TRUE; } @@ -705,8 +651,7 @@ static gboolean remmina_nx_session_send_session_command(RemminaNXSession *nx, co cmd = g_string_new(cmd_type); g_hash_table_iter_init(&iter, nx->session_parameters); - while (g_hash_table_iter_next(&iter, (gpointer*) &key, (gpointer*) &value)) - { + while (g_hash_table_iter_next(&iter, (gpointer*) &key, (gpointer*) &value)) { g_string_append_printf(cmd, " --%s=\"%s\"", key, value); } @@ -723,13 +668,10 @@ gboolean remmina_nx_session_list(RemminaNXSession *nx) TRACE_CALL("remmina_nx_session_list"); gboolean ret; - if (nx->session_list == NULL) - { + if (nx->session_list == NULL) { nx->session_list = gtk_list_store_new(REMMINA_NX_SESSION_N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_STRING, G_TYPE_STRING); - } - else - { + G_TYPE_STRING, G_TYPE_STRING); + } else { gtk_list_store_clear(nx->session_list); } ret = remmina_nx_session_send_session_command(nx, "listsession", 105); @@ -849,8 +791,7 @@ static gpointer remmina_nx_session_tunnel_main_thread(gpointer data) /* Accept a local connection */ sock = accept(nx->server_sock, NULL, NULL); - if (sock < 0) - { + if (sock < 0) { remmina_nx_session_set_application_error(nx, "Failed to accept local socket"); nx->thread = 0; return NULL; @@ -862,8 +803,7 @@ static gpointer remmina_nx_session_tunnel_main_thread(gpointer data) channels[1] = NULL; /* Start the tunnel data transmittion */ - while (nx->running) - { + while (nx->running) { timeout.tv_sec = 1; timeout.tv_usec = 0; @@ -878,65 +818,49 @@ static gpointer remmina_nx_session_tunnel_main_thread(gpointer data) if (ret == -1) break; - if (FD_ISSET(sock, &set)) - { + if (FD_ISSET(sock, &set)) { len = read(sock, buffer, sizeof(buffer)); if (len == 0) nx->running = FALSE; - else - if (len > 0) - { - for (ptr = buffer, lenw = 0; len > 0; len -= lenw, ptr += lenw) - { - ssh_set_fd_towrite(nx->session); - lenw = channel_write(channels[0], (char*) ptr, len); - if (lenw <= 0) - { - nx->running = FALSE; - break; - } + else if (len > 0) { + for (ptr = buffer, lenw = 0; len > 0; len -= lenw, ptr += lenw) { + ssh_set_fd_towrite(nx->session); + lenw = channel_write(channels[0], (char*) ptr, len); + if (lenw <= 0) { + nx->running = FALSE; + break; } } + } } if (!nx->running) break; - if (channels_out[0] && socketbuffer_len <= 0) - { + if (channels_out[0] && socketbuffer_len <= 0) { len = channel_read_nonblocking(channels_out[0], socketbuffer, sizeof(socketbuffer), 0); - if (len == SSH_ERROR || len == SSH_EOF) - { + if (len == SSH_ERROR || len == SSH_EOF) { nx->running = FALSE; break; + } else if (len > 0) { + socketbuffer_ptr = socketbuffer; + socketbuffer_len = len; + } else { + /* Clean up the stderr buffer in case FreeNX send something there */ + len = channel_read_nonblocking(channels_out[0], buffer, sizeof(buffer), 1); } - else - if (len > 0) - { - socketbuffer_ptr = socketbuffer; - socketbuffer_len = len; - } - else - { - /* Clean up the stderr buffer in case FreeNX send something there */ - len = channel_read_nonblocking(channels_out[0], buffer, sizeof(buffer), 1); - } } - if (nx->running && socketbuffer_len > 0) - { - for (lenw = 0; socketbuffer_len > 0; socketbuffer_len -= lenw, socketbuffer_ptr += lenw) - { + if (nx->running && socketbuffer_len > 0) { + for (lenw = 0; socketbuffer_len > 0; socketbuffer_len -= lenw, socketbuffer_ptr += lenw) { lenw = write(sock, socketbuffer_ptr, socketbuffer_len); - if (lenw == -1 && errno == EAGAIN && nx->running) - { + if (lenw == -1 && errno == EAGAIN && nx->running) { /* Sometimes we cannot write to a socket (always EAGAIN), probably because it's internal * buffer is full. We need read the pending bytes from the socket first. so here we simply * break, leave the buffer there, and continue with other data */ break; } - if (lenw <= 0) - { + if (lenw <= 0) { nx->running = FALSE; break; } @@ -961,8 +885,7 @@ gboolean remmina_nx_session_tunnel_open(RemminaNXSession *nx) return TRUE; remmina_nx_session_send_command(nx, "bye"); - if (!remmina_nx_session_expect_status(nx, 999)) - { + if (!remmina_nx_session_expect_status(nx, 999)) { /* Shoud not happen, just in case */ remmina_nx_session_set_application_error(nx, "Server won't say bye to us?"); return FALSE; @@ -972,8 +895,7 @@ gboolean remmina_nx_session_tunnel_open(RemminaNXSession *nx) /* Create the server socket that listens on the local port */ sock = socket(AF_INET, SOCK_STREAM, 0); - if (sock < 0) - { + if (sock < 0) { remmina_nx_session_set_application_error(nx, "Failed to create socket."); return FALSE; } @@ -983,15 +905,13 @@ gboolean remmina_nx_session_tunnel_open(RemminaNXSession *nx) sin.sin_port = htons(port); sin.sin_addr.s_addr = inet_addr("127.0.0.1"); - if (bind(sock, (struct sockaddr *) &sin, sizeof(sin))) - { + if (bind(sock, (struct sockaddr *) &sin, sizeof(sin))) { remmina_nx_session_set_application_error(nx, "Failed to bind on local port."); close(sock); return FALSE; } - if (listen(sock, 1)) - { + if (listen(sock, 1)) { remmina_nx_session_set_application_error(nx, "Failed to listen on local port."); close(sock); return FALSE; @@ -1000,8 +920,7 @@ gboolean remmina_nx_session_tunnel_open(RemminaNXSession *nx) nx->server_sock = sock; nx->running = TRUE; - if (pthread_create(&nx->thread, NULL, remmina_nx_session_tunnel_main_thread, nx)) - { + if (pthread_create(&nx->thread, NULL, remmina_nx_session_tunnel_main_thread, nx)) { remmina_nx_session_set_application_error(nx, "Failed to initialize pthread."); nx->thread = 0; return FALSE; @@ -1013,17 +932,14 @@ static gchar* remmina_nx_session_get_proxy_option(RemminaNXSession *nx) { TRACE_CALL("remmina_nx_session_get_proxy_option"); - if (nx->encryption) - { + if (nx->encryption) { return g_strdup_printf("nx,session=%s,cookie=%s,id=%s,shmem=1,shpix=1,connect=127.0.0.1:%i", - (gchar*) g_hash_table_lookup(nx->session_parameters, "session"), nx->proxy_cookie, - nx->session_id, (nx->localport ? nx->localport : nx->session_display)); - } - else - { + (gchar*) g_hash_table_lookup(nx->session_parameters, "session"), nx->proxy_cookie, + nx->session_id, (nx->localport ? nx->localport : nx->session_display)); + } else { return g_strdup_printf("nx,session=%s,cookie=%s,id=%s,shmem=1,shpix=1,connect=%s:%i", - (gchar*) g_hash_table_lookup(nx->session_parameters, "session"), nx->proxy_cookie, - nx->session_id, nx->server, nx->session_display); + (gchar*) g_hash_table_lookup(nx->session_parameters, "session"), nx->proxy_cookie, + nx->session_id, nx->server, nx->session_display); } } @@ -1039,25 +955,18 @@ gboolean remmina_nx_session_invoke_proxy(RemminaNXSession *nx, gint display, GCh gint i; /* Copy all current environment variable, but change DISPLAY. Assume we should always have DISPLAY... */ - if (display >= 0) - { + if (display >= 0) { envp = g_listenv(); - for (i = 0; envp[i]; i++) - { - if (g_strcmp0(envp[i], "DISPLAY") == 0) - { + for (i = 0; envp[i]; i++) { + if (g_strcmp0(envp[i], "DISPLAY") == 0) { s = g_strdup_printf("DISPLAY=:%i", display); - } - else - { + } else { s = g_strdup_printf("%s=%s", envp[i], g_getenv(envp[i])); } g_free(envp[i]); envp[i] = s; } - } - else - { + } else { envp = NULL; } @@ -1068,19 +977,17 @@ gboolean remmina_nx_session_invoke_proxy(RemminaNXSession *nx, gint display, GCh argv[argc++] = NULL; ret = g_spawn_async(NULL, argv, envp, G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &nx->proxy_pid, - &error); + &error); g_strfreev(envp); for (i = 0; i < argc; i++) g_free(argv[i]); - if (!ret) - { + if (!ret) { remmina_nx_session_set_application_error(nx, "%s", error->message); return FALSE; } - if (exit_func) - { + if (exit_func) { nx->proxy_watch_source = g_child_watch_add(nx->proxy_pid, exit_func, user_data); } diff --git a/remmina/src/remmina_protocol_widget.c b/remmina/src/remmina_protocol_widget.c index 09e0d39d8..e08594bcf 100644 --- a/remmina/src/remmina_protocol_widget.c +++ b/remmina/src/remmina_protocol_widget.c @@ -50,8 +50,7 @@ #include "remmina_masterthread_exec.h" #include "remmina/remmina_trace_calls.h" -struct _RemminaProtocolWidgetPriv -{ +struct _RemminaProtocolWidgetPriv { GtkWidget* init_dialog; RemminaFile* remmina_file; @@ -78,8 +77,7 @@ struct _RemminaProtocolWidgetPriv G_DEFINE_TYPE(RemminaProtocolWidget, remmina_protocol_widget, GTK_TYPE_EVENT_BOX) -enum -{ +enum { CONNECT_SIGNAL, DISCONNECT_SIGNAL, DESKTOP_RESIZE_SIGNAL, @@ -87,8 +85,7 @@ enum LAST_SIGNAL }; -typedef struct _RemminaProtocolWidgetSignalData -{ +typedef struct _RemminaProtocolWidgetSignalData { RemminaProtocolWidget* gp; const gchar* signal_name; } RemminaProtocolWidgetSignalData; @@ -117,8 +114,7 @@ static void remmina_protocol_widget_init_cancel(RemminaInitDialog *dialog, gint { TRACE_CALL("remmina_protocol_widget_init_cancel"); if ((response_id == GTK_RESPONSE_CANCEL || response_id == GTK_RESPONSE_DELETE_EVENT) - && dialog->mode == REMMINA_INIT_MODE_CONNECTING) - { + && dialog->mode == REMMINA_INIT_MODE_CONNECTING) { remmina_protocol_widget_close_connection(gp); } } @@ -126,8 +122,7 @@ static void remmina_protocol_widget_init_cancel(RemminaInitDialog *dialog, gint static void remmina_protocol_widget_show_init_dialog(RemminaProtocolWidget* gp, const gchar *name) { TRACE_CALL("remmina_protocol_widget_show_init_dialog"); - if (gp->priv->init_dialog) - { + if (gp->priv->init_dialog) { gtk_widget_destroy(gp->priv->init_dialog); } gp->priv->init_dialog = remmina_init_dialog_new(_("Connecting to '%s'..."), (name ? name : "*")); @@ -157,8 +152,7 @@ static void remmina_protocol_widget_connect(RemminaProtocolWidget* gp, gpointer { TRACE_CALL("remmina_protocol_widget_connect"); #ifdef HAVE_LIBSSH - if (gp->priv->ssh_tunnel) - { + if (gp->priv->ssh_tunnel) { remmina_ssh_tunnel_cancel_accept (gp->priv->ssh_tunnel); } #endif @@ -178,8 +172,7 @@ void remmina_protocol_widget_grab_focus(RemminaProtocolWidget* gp) child = gtk_bin_get_child(GTK_BIN(gp)); - if (child) - { + if (child) { gtk_widget_set_can_focus(child, TRUE); gtk_widget_grab_focus(child); } @@ -210,12 +203,11 @@ void remmina_protocol_widget_open_connection_real(gpointer data) /* Locate the protocol plugin */ plugin = (RemminaProtocolPlugin*) remmina_plugin_manager_get_plugin(REMMINA_PLUGIN_TYPE_PROTOCOL, - remmina_file_get_string(remminafile, "protocol")); + remmina_file_get_string(remminafile, "protocol")); - if (!plugin || !plugin->init || !plugin->open_connection) - { + if (!plugin || !plugin->init || !plugin->open_connection) { remmina_protocol_widget_set_error(gp, _("Protocol plugin %s is not installed."), - remmina_file_get_string(remminafile, "protocol")); + remmina_file_get_string(remminafile, "protocol")); remmina_protocol_widget_close_connection(gp); return; } @@ -224,33 +216,26 @@ void remmina_protocol_widget_open_connection_real(gpointer data) gp->priv->plugin = plugin; - for (num_plugin = 0, feature = (RemminaProtocolFeature*) plugin->features; feature && feature->type; num_plugin++, feature++) - { + for (num_plugin = 0, feature = (RemminaProtocolFeature*) plugin->features; feature && feature->type; num_plugin++, feature++) { } num_ssh = 0; #ifdef HAVE_LIBSSH - if (remmina_file_get_int(gp->priv->remmina_file, "ssh_enabled", FALSE)) - { + if (remmina_file_get_int(gp->priv->remmina_file, "ssh_enabled", FALSE)) { num_ssh += 2; } #endif - if (num_plugin + num_ssh == 0) - { + if (num_plugin + num_ssh == 0) { gp->priv->features = NULL; - } - else - { + } else { gp->priv->features = g_new0(RemminaProtocolFeature, num_plugin + num_ssh + 1); feature = gp->priv->features; - if (plugin->features) - { + if (plugin->features) { memcpy(feature, plugin->features, sizeof(RemminaProtocolFeature) * num_plugin); feature += num_plugin; } #ifdef HAVE_LIBSSH - if (num_ssh) - { + if (num_ssh) { feature->type = REMMINA_PROTOCOL_FEATURE_TYPE_TOOL; feature->id = REMMINA_PROTOCOL_FEATURE_TOOL_SSH; feature->opt1 = _("Open Secure Shell in New Terminal..."); @@ -267,8 +252,7 @@ void remmina_protocol_widget_open_connection_real(gpointer data) #endif } - if (!plugin->open_connection(gp)) - { + if (!plugin->open_connection(gp)) { remmina_protocol_widget_close_connection(gp); } } @@ -301,32 +285,28 @@ gboolean remmina_protocol_widget_close_connection(RemminaProtocolWidget* gp) display = gtk_widget_get_display(GTK_WIDGET(gp)); manager = gdk_display_get_device_manager(display); device = gdk_device_manager_get_client_pointer(manager); - if (device != NULL) - { + if (device != NULL) { gdk_device_ungrab(device, GDK_CURRENT_TIME); } - if (gp->priv->chat_window) - { + if (gp->priv->chat_window) { gtk_widget_destroy(gp->priv->chat_window); gp->priv->chat_window = NULL; } - if (!gp->priv->plugin || !gp->priv->plugin->close_connection) - { + if (!gp->priv->plugin || !gp->priv->plugin->close_connection) { remmina_protocol_widget_emit_signal(gp, "disconnect"); return FALSE; } retval = gp->priv->plugin->close_connection(gp); - #ifdef HAVE_LIBSSH - if (gp->priv->ssh_tunnel) - { +#ifdef HAVE_LIBSSH + if (gp->priv->ssh_tunnel) { remmina_ssh_tunnel_free(gp->priv->ssh_tunnel); gp->priv->ssh_tunnel = NULL; } - #endif +#endif return retval; } @@ -366,14 +346,12 @@ void remmina_protocol_widget_send_keystrokes(RemminaProtocolWidget* gp, GtkMenuI { NULL, NULL, 0 } }; /* Keystrokes can be sent only to plugins that accepts them */ - if (remmina_protocol_widget_plugin_receives_keystrokes(gp)) - { + if (remmina_protocol_widget_plugin_receives_keystrokes(gp)) { /* Replace special characters */ - for (i = 0; keystrokes_replaces[i].replace; i++) - { + for (i = 0; keystrokes_replaces[i].replace; i++) { remmina_public_str_replace_in_place(keystrokes, - keystrokes_replaces[i].search, - keystrokes_replaces[i].replace); + keystrokes_replaces[i].search, + keystrokes_replaces[i].replace); } keyvals = (guint *) g_malloc(strlen(keystrokes)); while(TRUE) { @@ -383,10 +361,8 @@ void remmina_protocol_widget_send_keystrokes(RemminaProtocolWidget* gp, GtkMenuI break; keyval = gdk_unicode_to_keyval(character); /* Replace all the special character with its keyval */ - for (i = 0; keystrokes_replaces[i].replace; i++) - { - if (character == keystrokes_replaces[i].replace[0]) - { + for (i = 0; keystrokes_replaces[i].replace; i++) { + if (character == keystrokes_replaces[i].replace[0]) { keys = g_new0(GdkKeymapKey, 1); keyval = keystrokes_replaces[i].keyval; /* A special character was generated, no keyval lookup needed */ @@ -395,8 +371,7 @@ void remmina_protocol_widget_send_keystrokes(RemminaProtocolWidget* gp, GtkMenuI } } /* Decode character if it's not a special character */ - if (character) - { + if (character) { /* get keyval without modifications */ if (!gdk_keymap_get_entries_for_keyval(keymap, keyval, &keys, &n_keys)) { g_warning("keyval 0x%04x has no keycode!", keyval); @@ -461,13 +436,11 @@ gboolean remmina_protocol_widget_query_feature_by_type(RemminaProtocolWidget* gp #ifdef HAVE_LIBSSH if (type == REMMINA_PROTOCOL_FEATURE_TYPE_TOOL && - remmina_file_get_int (gp->priv->remmina_file, "ssh_enabled", FALSE)) - { + remmina_file_get_int (gp->priv->remmina_file, "ssh_enabled", FALSE)) { return TRUE; } #endif - for (feature = gp->priv->plugin->features; feature && feature->type; feature++) - { + for (feature = gp->priv->plugin->features; feature && feature->type; feature++) { if (feature->type == type) return TRUE; } @@ -485,10 +458,8 @@ void remmina_protocol_widget_call_feature_by_type(RemminaProtocolWidget* gp, Rem TRACE_CALL("remmina_protocol_widget_call_feature_by_type"); const RemminaProtocolFeature *feature; - for (feature = gp->priv->plugin->features; feature && feature->type; feature++) - { - if (feature->type == type && (id == 0 || feature->id == id)) - { + for (feature = gp->priv->plugin->features; feature && feature->type; feature++) { + if (feature->type == type && (id == 0 || feature->id == id)) { remmina_protocol_widget_call_feature_by_ref(gp, feature); break; } @@ -498,29 +469,26 @@ void remmina_protocol_widget_call_feature_by_type(RemminaProtocolWidget* gp, Rem void remmina_protocol_widget_call_feature_by_ref(RemminaProtocolWidget* gp, const RemminaProtocolFeature *feature) { TRACE_CALL("remmina_protocol_widget_call_feature_by_ref"); - switch (feature->id) - { + switch (feature->id) { #ifdef HAVE_LIBSSH - case REMMINA_PROTOCOL_FEATURE_TOOL_SSH: - if (gp->priv->ssh_tunnel) - { + case REMMINA_PROTOCOL_FEATURE_TOOL_SSH: + if (gp->priv->ssh_tunnel) { remmina_connection_window_open_from_file_full ( - remmina_file_dup_temp_protocol (gp->priv->remmina_file, "SSH"), NULL, gp->priv->ssh_tunnel, NULL); + remmina_file_dup_temp_protocol (gp->priv->remmina_file, "SSH"), NULL, gp->priv->ssh_tunnel, NULL); return; } break; - case REMMINA_PROTOCOL_FEATURE_TOOL_SFTP: - if (gp->priv->ssh_tunnel) - { + case REMMINA_PROTOCOL_FEATURE_TOOL_SFTP: + if (gp->priv->ssh_tunnel) { remmina_connection_window_open_from_file_full ( - remmina_file_dup_temp_protocol (gp->priv->remmina_file, "SFTP"), NULL, gp->priv->ssh_tunnel, NULL); + remmina_file_dup_temp_protocol (gp->priv->remmina_file, "SFTP"), NULL, gp->priv->ssh_tunnel, NULL); return; } break; #endif - default: - break; + default: + break; } gp->priv->plugin->call_feature(gp, feature); } @@ -528,8 +496,7 @@ void remmina_protocol_widget_call_feature_by_ref(RemminaProtocolWidget* gp, cons static gboolean remmina_protocol_widget_on_key_press(GtkWidget *widget, GdkEventKey *event, RemminaProtocolWidget* gp) { TRACE_CALL("remmina_protocol_widget_on_key_press"); - if (gp->priv->hostkey_func) - { + if (gp->priv->hostkey_func) { return gp->priv->hostkey_func(gp, event->keyval, FALSE, gp->priv->hostkey_func_data); } return FALSE; @@ -538,8 +505,7 @@ static gboolean remmina_protocol_widget_on_key_press(GtkWidget *widget, GdkEvent static gboolean remmina_protocol_widget_on_key_release(GtkWidget *widget, GdkEventKey *event, RemminaProtocolWidget* gp) { TRACE_CALL("remmina_protocol_widget_on_key_release"); - if (gp->priv->hostkey_func) - { + if (gp->priv->hostkey_func) { return gp->priv->hostkey_func(gp, event->keyval, TRUE, gp->priv->hostkey_func_data); } return FALSE; @@ -567,25 +533,21 @@ static gboolean remmina_protocol_widget_init_tunnel (RemminaProtocolWidget* gp) gint ret; /* Reuse existing SSH connection if it's reconnecting to destination */ - if (gp->priv->ssh_tunnel == NULL) - { + if (gp->priv->ssh_tunnel == NULL) { tunnel = remmina_ssh_tunnel_new_from_file (gp->priv->remmina_file); remmina_init_dialog_set_status (REMMINA_INIT_DIALOG (gp->priv->init_dialog), - _("Connecting to SSH server %s..."), REMMINA_SSH (tunnel)->server); + _("Connecting to SSH server %s..."), REMMINA_SSH (tunnel)->server); - if (!remmina_ssh_init_session (REMMINA_SSH (tunnel))) - { + if (!remmina_ssh_init_session (REMMINA_SSH (tunnel))) { remmina_protocol_widget_set_error (gp, REMMINA_SSH (tunnel)->error); remmina_ssh_tunnel_free (tunnel); return FALSE; } ret = remmina_ssh_auth_gui (REMMINA_SSH (tunnel), REMMINA_INIT_DIALOG (gp->priv->init_dialog)); - if (ret <= 0) - { - if (ret == 0) - { + if (ret <= 0) { + if (ret == 0) { remmina_protocol_widget_set_error (gp, REMMINA_SSH (tunnel)->error); } remmina_ssh_tunnel_free (tunnel); @@ -608,44 +570,38 @@ gchar* remmina_protocol_widget_start_direct_tunnel(RemminaProtocolWidget* gp, gi server = remmina_file_get_string(gp->priv->remmina_file, "server"); - if (!server) - { + if (!server) { return g_strdup(""); } remmina_public_get_server_port(server, default_port, &host, &port); - if (port_plus && port < 100) - { + if (port_plus && port < 100) { /* Protocols like VNC supports using instance number :0, :1, etc as port number. */ port += default_port; } #ifdef HAVE_LIBSSH - if (!remmina_file_get_int (gp->priv->remmina_file, "ssh_enabled", FALSE)) - { + if (!remmina_file_get_int (gp->priv->remmina_file, "ssh_enabled", FALSE)) { dest = g_strdup_printf("[%s]:%i", host, port); g_free(host); return dest; } - if (!remmina_protocol_widget_init_tunnel (gp)) - { + if (!remmina_protocol_widget_init_tunnel (gp)) { g_free(host); return NULL; } remmina_init_dialog_set_status (REMMINA_INIT_DIALOG (gp->priv->init_dialog), - _("Connecting to %s through SSH tunnel..."), server); + _("Connecting to %s through SSH tunnel..."), server); - if (remmina_file_get_int (gp->priv->remmina_file, "ssh_loopback", FALSE)) - { + if (remmina_file_get_int (gp->priv->remmina_file, "ssh_loopback", FALSE)) { g_free(host); host = g_strdup ("127.0.0.1"); } - if (!remmina_ssh_tunnel_open (gp->priv->ssh_tunnel, host, port, remmina_pref.sshtunnel_port)) - { + if (!remmina_ssh_tunnel_open (gp->priv->ssh_tunnel, host, port, remmina_pref.sshtunnel_port)) { g_free(host); remmina_protocol_widget_set_error (gp, REMMINA_SSH (gp->priv->ssh_tunnel)->error); return NULL; @@ -667,21 +623,18 @@ gboolean remmina_protocol_widget_start_reverse_tunnel(RemminaProtocolWidget* gp, { TRACE_CALL("remmina_protocol_widget_start_reverse_tunnel"); #ifdef HAVE_LIBSSH - if (!remmina_file_get_int (gp->priv->remmina_file, "ssh_enabled", FALSE)) - { + if (!remmina_file_get_int (gp->priv->remmina_file, "ssh_enabled", FALSE)) { return TRUE; } - if (!remmina_protocol_widget_init_tunnel (gp)) - { + if (!remmina_protocol_widget_init_tunnel (gp)) { return FALSE; } remmina_init_dialog_set_status (REMMINA_INIT_DIALOG (gp->priv->init_dialog), - _("Waiting for an incoming SSH tunnel at port %i..."), remmina_file_get_int (gp->priv->remmina_file, "listenport", 0)); + _("Waiting for an incoming SSH tunnel at port %i..."), remmina_file_get_int (gp->priv->remmina_file, "listenport", 0)); - if (!remmina_ssh_tunnel_reverse (gp->priv->ssh_tunnel, remmina_file_get_int (gp->priv->remmina_file, "listenport", 0), local_port)) - { + if (!remmina_ssh_tunnel_reverse (gp->priv->ssh_tunnel, remmina_file_get_int (gp->priv->remmina_file, "listenport", 0), local_port)) { remmina_protocol_widget_set_error (gp, REMMINA_SSH (gp->priv->ssh_tunnel)->error); return FALSE; } @@ -694,64 +647,56 @@ gboolean remmina_protocol_widget_ssh_exec(RemminaProtocolWidget* gp, gboolean wa { TRACE_CALL("remmina_protocol_widget_ssh_exec"); #ifdef HAVE_LIBSSH - RemminaSSHTunnel *tunnel = gp->priv->ssh_tunnel; - ssh_channel channel; - gint status; - gboolean ret = FALSE; - gchar *cmd, *ptr; - va_list args; - - if ((channel = ssh_channel_new (REMMINA_SSH (tunnel)->session)) == NULL) - { - return FALSE; - } + RemminaSSHTunnel *tunnel = gp->priv->ssh_tunnel; + ssh_channel channel; + gint status; + gboolean ret = FALSE; + gchar *cmd, *ptr; + va_list args; - va_start (args, fmt); - cmd = g_strdup_vprintf (fmt, args); - va_end (args); - - if (ssh_channel_open_session (channel) == SSH_OK && - ssh_channel_request_exec (channel, cmd) == SSH_OK) - { - if (wait) - { - ssh_channel_send_eof (channel); - status = ssh_channel_get_exit_status (channel); - ptr = strchr (cmd, ' '); - if (ptr) *ptr = '\0'; - switch (status) - { - case 0: - ret = TRUE; - break; - case 127: - remmina_ssh_set_application_error (REMMINA_SSH (tunnel), - _("Command %s not found on SSH server"), cmd); - break; - default: - remmina_ssh_set_application_error (REMMINA_SSH (tunnel), - _("Command %s failed on SSH server (status = %i)."), cmd,status); - break; - } - } - else - { + if ((channel = ssh_channel_new (REMMINA_SSH (tunnel)->session)) == NULL) { + return FALSE; + } + + va_start (args, fmt); + cmd = g_strdup_vprintf (fmt, args); + va_end (args); + + if (ssh_channel_open_session (channel) == SSH_OK && + ssh_channel_request_exec (channel, cmd) == SSH_OK) { + if (wait) { + ssh_channel_send_eof (channel); + status = ssh_channel_get_exit_status (channel); + ptr = strchr (cmd, ' '); + if (ptr) *ptr = '\0'; + switch (status) { + case 0: ret = TRUE; + break; + case 127: + remmina_ssh_set_application_error (REMMINA_SSH (tunnel), + _("Command %s not found on SSH server"), cmd); + break; + default: + remmina_ssh_set_application_error (REMMINA_SSH (tunnel), + _("Command %s failed on SSH server (status = %i)."), cmd,status); + break; } + } else { + ret = TRUE; } - else - { - remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to execute command: %s")); - } - g_free(cmd); - if (wait) - ssh_channel_close (channel); - ssh_channel_free (channel); - return ret; + } else { + remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to execute command: %s")); + } + g_free(cmd); + if (wait) + ssh_channel_close (channel); + ssh_channel_free (channel); + return ret; #else - return FALSE; + return FALSE; #endif } @@ -784,8 +729,7 @@ static gboolean remmina_protocol_widget_tunnel_disconnect_callback(RemminaSSHTun TRACE_CALL("remmina_protocol_widget_tunnel_disconnect_callback"); RemminaProtocolWidget* gp = REMMINA_PROTOCOL_WIDGET (data); - if (REMMINA_SSH (tunnel)->error) - { + if (REMMINA_SSH (tunnel)->error) { remmina_protocol_widget_set_error (gp, "%s", REMMINA_SSH (tunnel)->error); } @@ -804,7 +748,7 @@ gboolean remmina_protocol_widget_start_xport_tunnel(RemminaProtocolWidget* gp, R if (!remmina_protocol_widget_init_tunnel (gp)) return FALSE; remmina_init_dialog_set_status (REMMINA_INIT_DIALOG (gp->priv->init_dialog), - _("Connecting to %s through SSH tunnel..."), remmina_file_get_string (gp->priv->remmina_file, "server")); + _("Connecting to %s through SSH tunnel..."), remmina_file_get_string (gp->priv->remmina_file, "server")); gp->priv->init_func = init_func; gp->priv->ssh_tunnel->init_func = remmina_protocol_widget_tunnel_init_callback; @@ -816,10 +760,9 @@ gboolean remmina_protocol_widget_start_xport_tunnel(RemminaProtocolWidget* gp, R bindlocalhost = (g_strcmp0(REMMINA_SSH (gp->priv->ssh_tunnel)->server, server) == 0); g_free(server); - if (!remmina_ssh_tunnel_xport (gp->priv->ssh_tunnel, bindlocalhost)) - { + if (!remmina_ssh_tunnel_xport (gp->priv->ssh_tunnel, bindlocalhost)) { remmina_protocol_widget_set_error (gp, "Failed to open channel : %s", - ssh_get_error (REMMINA_SSH (gp->priv->ssh_tunnel)->session)); + ssh_get_error (REMMINA_SSH (gp->priv->ssh_tunnel)->session)); return FALSE; } @@ -939,28 +882,27 @@ gint remmina_protocol_widget_init_authpwd(RemminaProtocolWidget* gp, RemminaAuth gchar* s; gint ret; - switch (authpwd_type) - { - case REMMINA_AUTHPWD_TYPE_PROTOCOL: - s = g_strdup_printf(_("%s password"), remmina_file_get_string(remminafile, "protocol")); - break; - case REMMINA_AUTHPWD_TYPE_SSH_PWD: - s = g_strdup(_("SSH password")); - break; - case REMMINA_AUTHPWD_TYPE_SSH_PRIVKEY: - s = g_strdup(_("SSH private key passphrase")); - break; - default: - s = g_strdup(_("Password")); - break; + switch (authpwd_type) { + case REMMINA_AUTHPWD_TYPE_PROTOCOL: + s = g_strdup_printf(_("%s password"), remmina_file_get_string(remminafile, "protocol")); + break; + case REMMINA_AUTHPWD_TYPE_SSH_PWD: + s = g_strdup(_("SSH password")); + break; + case REMMINA_AUTHPWD_TYPE_SSH_PRIVKEY: + s = g_strdup(_("SSH private key passphrase")); + break; + default: + s = g_strdup(_("Password")); + break; } ret = remmina_init_dialog_authpwd( - REMMINA_INIT_DIALOG(gp->priv->init_dialog), - s, - remmina_file_get_filename(remminafile) != NULL && - allow_password_saving && - authpwd_type != REMMINA_AUTHPWD_TYPE_SSH_PWD && - authpwd_type != REMMINA_AUTHPWD_TYPE_SSH_PRIVKEY); + REMMINA_INIT_DIALOG(gp->priv->init_dialog), + s, + remmina_file_get_filename(remminafile) != NULL && + allow_password_saving && + authpwd_type != REMMINA_AUTHPWD_TYPE_SSH_PWD && + authpwd_type != REMMINA_AUTHPWD_TYPE_SSH_PRIVKEY); g_free(s); return ret; @@ -972,11 +914,11 @@ gint remmina_protocol_widget_init_authuserpwd(RemminaProtocolWidget* gp, gboolea RemminaFile* remminafile = gp->priv->remmina_file; return remmina_init_dialog_authuserpwd( - REMMINA_INIT_DIALOG(gp->priv->init_dialog), - want_domain, - remmina_file_get_string(remminafile, "username"), - want_domain ? remmina_file_get_string(remminafile, "domain") : NULL, - (remmina_file_get_filename(remminafile) != NULL) && allow_password_saving); + REMMINA_INIT_DIALOG(gp->priv->init_dialog), + want_domain, + remmina_file_get_string(remminafile, "username"), + want_domain ? remmina_file_get_string(remminafile, "domain") : NULL, + (remmina_file_get_filename(remminafile) != NULL) && allow_password_saving); } gint remmina_protocol_widget_init_certificate(RemminaProtocolWidget* gp, const gchar* subject, const gchar* issuer, const gchar* fingerprint) @@ -1020,8 +962,8 @@ gint remmina_protocol_widget_init_authx509(RemminaProtocolWidget* gp) RemminaFile* remminafile = gp->priv->remmina_file; return remmina_init_dialog_authx509(REMMINA_INIT_DIALOG(gp->priv->init_dialog), - remmina_file_get_string(remminafile, "cacert"), remmina_file_get_string(remminafile, "cacrl"), - remmina_file_get_string(remminafile, "clientcert"), remmina_file_get_string(remminafile, "clientkey")); + remmina_file_get_string(remminafile, "cacert"), remmina_file_get_string(remminafile, "cacrl"), + remmina_file_get_string(remminafile, "clientcert"), remmina_file_get_string(remminafile, "clientkey")); } gchar* remmina_protocol_widget_init_get_cacert(RemminaProtocolWidget* gp) @@ -1081,42 +1023,35 @@ void remmina_protocol_widget_init_save_cred(RemminaProtocolWidget* gp) /* Save user name and certificates if any; save the password if it's requested to do so */ s = REMMINA_INIT_DIALOG(gp->priv->init_dialog)->username; - if (s && s[0]) - { + if (s && s[0]) { remmina_file_set_string(remminafile, "username", s); save = TRUE; } s = REMMINA_INIT_DIALOG(gp->priv->init_dialog)->cacert; - if (s && s[0]) - { + if (s && s[0]) { remmina_file_set_string(remminafile, "cacert", s); save = TRUE; } s = REMMINA_INIT_DIALOG(gp->priv->init_dialog)->cacrl; - if (s && s[0]) - { + if (s && s[0]) { remmina_file_set_string(remminafile, "cacrl", s); save = TRUE; } s = REMMINA_INIT_DIALOG(gp->priv->init_dialog)->clientcert; - if (s && s[0]) - { + if (s && s[0]) { remmina_file_set_string(remminafile, "clientcert", s); save = TRUE; } s = REMMINA_INIT_DIALOG(gp->priv->init_dialog)->clientkey; - if (s && s[0]) - { + if (s && s[0]) { remmina_file_set_string(remminafile, "clientkey", s); save = TRUE; } - if (REMMINA_INIT_DIALOG(gp->priv->init_dialog)->save_password) - { + if (REMMINA_INIT_DIALOG(gp->priv->init_dialog)->save_password) { remmina_file_set_string(remminafile, "password", REMMINA_INIT_DIALOG(gp->priv->init_dialog)->password); save = TRUE; } - if (save) - { + if (save) { remmina_file_save_group(remminafile, REMMINA_SETTING_GROUP_CREDENTIAL); } } @@ -1126,15 +1061,15 @@ void remmina_protocol_widget_init_show_listen(RemminaProtocolWidget* gp, gint po { TRACE_CALL("remmina_protocol_widget_init_show_listen"); remmina_init_dialog_set_status(REMMINA_INIT_DIALOG(gp->priv->init_dialog), - _("Listening on port %i for an incoming %s connection..."), port, - remmina_file_get_string(gp->priv->remmina_file, "protocol")); + _("Listening on port %i for an incoming %s connection..."), port, + remmina_file_get_string(gp->priv->remmina_file, "protocol")); } void remmina_protocol_widget_init_show_retry(RemminaProtocolWidget* gp) { TRACE_CALL("remmina_protocol_widget_init_show_retry"); remmina_init_dialog_set_status_temp(REMMINA_INIT_DIALOG(gp->priv->init_dialog), - _("Authentication failed. Trying to reconnect...")); + _("Authentication failed. Trying to reconnect...")); } void remmina_protocol_widget_init_show(RemminaProtocolWidget* gp) @@ -1156,19 +1091,16 @@ static void remmina_protocol_widget_chat_on_destroy(RemminaProtocolWidget* gp) } void remmina_protocol_widget_chat_open(RemminaProtocolWidget* gp, const gchar *name, - void(*on_send)(RemminaProtocolWidget* gp, const gchar *text), void(*on_destroy)(RemminaProtocolWidget* gp)) + void(*on_send)(RemminaProtocolWidget* gp, const gchar *text), void(*on_destroy)(RemminaProtocolWidget* gp)) { TRACE_CALL("remmina_protocol_widget_chat_open"); - if (gp->priv->chat_window) - { + if (gp->priv->chat_window) { gtk_window_present(GTK_WINDOW(gp->priv->chat_window)); - } - else - { + } else { gp->priv->chat_window = remmina_chat_window_new(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(gp))), name); g_signal_connect_swapped(G_OBJECT(gp->priv->chat_window), "send", G_CALLBACK(on_send), gp); g_signal_connect_swapped(G_OBJECT(gp->priv->chat_window), "destroy", - G_CALLBACK(remmina_protocol_widget_chat_on_destroy), gp); + G_CALLBACK(remmina_protocol_widget_chat_on_destroy), gp); g_signal_connect_swapped(G_OBJECT(gp->priv->chat_window), "destroy", G_CALLBACK(on_destroy), gp); gtk_widget_show(gp->priv->chat_window); } @@ -1177,8 +1109,7 @@ void remmina_protocol_widget_chat_open(RemminaProtocolWidget* gp, const gchar *n void remmina_protocol_widget_chat_close(RemminaProtocolWidget* gp) { TRACE_CALL("remmina_protocol_widget_chat_close"); - if (gp->priv->chat_window) - { + if (gp->priv->chat_window) { gtk_widget_destroy(gp->priv->chat_window); } } @@ -1188,8 +1119,7 @@ void remmina_protocol_widget_chat_receive(RemminaProtocolWidget* gp, const gchar TRACE_CALL("remmina_protocol_widget_chat_receive"); /* This function can be called from a non main thread */ - if (gp->priv->chat_window) - { + if (gp->priv->chat_window) { if ( !remmina_masterthread_exec_is_main_thread() ) { /* Allow the execution of this function from a non main thread */ RemminaMTExecData *d; @@ -1234,8 +1164,7 @@ void remmina_protocol_widget_send_keys_signals(GtkWidget *widget, const guint *k if (action & GDK_KEY_PRESS) { /* Press the requested buttons */ event.type = GDK_KEY_PRESS; - for (i = 0; i < keyvals_length; i++) - { + for (i = 0; i < keyvals_length; i++) { event.keyval = keyvals[i]; event.hardware_keycode = remmina_public_get_keycode_for_keyval(keymap, event.keyval); event.is_modifier = (int) remmina_public_get_modifier_for_keycode(keymap, event.hardware_keycode); @@ -1246,8 +1175,7 @@ void remmina_protocol_widget_send_keys_signals(GtkWidget *widget, const guint *k if (action & GDK_KEY_RELEASE) { /* Release the requested buttons in reverse order */ event.type = GDK_KEY_RELEASE; - for (i = (keyvals_length - 1); i >= 0; i--) - { + for (i = (keyvals_length - 1); i >= 0; i--) { event.keyval = keyvals[i]; event.hardware_keycode = remmina_public_get_keycode_for_keyval(keymap, event.keyval); event.is_modifier = (int) remmina_public_get_modifier_for_keycode(keymap, event.hardware_keycode); diff --git a/remmina/src/remmina_ssh.c b/remmina/src/remmina_ssh.c index d2584841b..ed7f908b2 100644 --- a/remmina/src/remmina_ssh.c +++ b/remmina/src/remmina_ssh.c @@ -80,8 +80,7 @@ #define LOCK_SSH(ssh) pthread_mutex_lock (&REMMINA_SSH (ssh)->ssh_mutex); #define UNLOCK_SSH(ssh) pthread_mutex_unlock (&REMMINA_SSH (ssh)->ssh_mutex); -static const gchar *common_identities[] = -{ +static const gchar *common_identities[] = { ".ssh/id_rsa", ".ssh/id_dsa", ".ssh/identity", @@ -104,11 +103,9 @@ remmina_ssh_find_identity (void) gchar *path; gint i; - for (i = 0; common_identities[i]; i++) - { + for (i = 0; common_identities[i]; i++) { path = remmina_ssh_identity_path (common_identities[i]); - if (g_file_test (path, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_EXISTS)) - { + if (g_file_test (path, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_EXISTS)) { return path; } g_free(path); @@ -151,23 +148,18 @@ remmina_ssh_auth_password (RemminaSSH *ssh) if (ssh->password == NULL) return -1; authlist = ssh_userauth_list (ssh->session, NULL); - if (authlist & SSH_AUTH_METHOD_INTERACTIVE) - { - while ((ret = ssh_userauth_kbdint (ssh->session, NULL, NULL)) == SSH_AUTH_INFO) - { + if (authlist & SSH_AUTH_METHOD_INTERACTIVE) { + while ((ret = ssh_userauth_kbdint (ssh->session, NULL, NULL)) == SSH_AUTH_INFO) { n = ssh_userauth_kbdint_getnprompts (ssh->session); - for (i = 0; i < n; i++) - { + for (i = 0; i < n; i++) { ssh_userauth_kbdint_setanswer(ssh->session, i, ssh->password); } } } - if (ret != SSH_AUTH_SUCCESS && authlist & SSH_AUTH_METHOD_PASSWORD) - { + if (ret != SSH_AUTH_SUCCESS && authlist & SSH_AUTH_METHOD_PASSWORD) { ret = ssh_userauth_password (ssh->session, NULL, ssh->password); } - if (ret != SSH_AUTH_SUCCESS) - { + if (ret != SSH_AUTH_SUCCESS) { remmina_ssh_set_error (ssh, _("SSH password authentication failed: %s")); return 0; } @@ -185,16 +177,14 @@ remmina_ssh_auth_pubkey (RemminaSSH *ssh) if (ssh->authenticated) return 1; - if (ssh->privkeyfile == NULL) - { + if (ssh->privkeyfile == NULL) { ssh->error = g_strdup_printf(_("SSH public key authentication failed: %s"), - _("SSH Key file not yet set.")); + _("SSH Key file not yet set.")); return 0; } if ( ssh_pki_import_privkey_file( ssh->privkeyfile, (ssh->password ? ssh->password : ""), - NULL, NULL, &priv_key ) != SSH_OK ) - { + NULL, NULL, &priv_key ) != SSH_OK ) { if (ssh->password == NULL || ssh->password[0] == '\0') return -1; remmina_ssh_set_error (ssh, _("SSH public key authentication failed: %s")); @@ -204,8 +194,7 @@ remmina_ssh_auth_pubkey (RemminaSSH *ssh) ret = ssh_userauth_publickey (ssh->session, NULL, priv_key); ssh_key_free(priv_key); - if (ret != SSH_AUTH_SUCCESS) - { + if (ret != SSH_AUTH_SUCCESS) { remmina_ssh_set_error (ssh, _("SSH public key authentication failed: %s")); return 0; } @@ -221,8 +210,7 @@ remmina_ssh_auth_auto_pubkey (RemminaSSH* ssh) gint ret; ret = ssh_userauth_autopubkey (ssh->session, ""); - if (ret != SSH_AUTH_SUCCESS) - { + if (ret != SSH_AUTH_SUCCESS) { remmina_ssh_set_error (ssh, _("SSH automatic public key authentication failed: %s")); return 0; } @@ -237,31 +225,28 @@ remmina_ssh_auth (RemminaSSH *ssh, const gchar *password) TRACE_CALL("remmina_ssh_auth"); /* Check known host again to ensure it's still the original server when user forks a new session from existing one */ - if (ssh_is_server_known (ssh->session) != SSH_SERVER_KNOWN_OK) - { + if (ssh_is_server_known (ssh->session) != SSH_SERVER_KNOWN_OK) { remmina_ssh_set_application_error (ssh, "SSH public key has changed!"); return 0; } - if (password) - { + if (password) { g_free(ssh->password); ssh->password = g_strdup (password); } - switch (ssh->auth) - { + switch (ssh->auth) { - case SSH_AUTH_PASSWORD: + case SSH_AUTH_PASSWORD: return remmina_ssh_auth_password (ssh); - case SSH_AUTH_PUBLICKEY: + case SSH_AUTH_PUBLICKEY: return remmina_ssh_auth_pubkey (ssh); - case SSH_AUTH_AUTO_PUBLICKEY: + case SSH_AUTH_AUTO_PUBLICKEY: return remmina_ssh_auth_auto_pubkey (ssh); - default: + default: return 0; } } @@ -279,46 +264,41 @@ remmina_ssh_auth_gui (RemminaSSH *ssh, RemminaInitDialog *dialog) /* Check if the server's public key is known */ ret = ssh_is_server_known (ssh->session); - switch (ret) - { - case SSH_SERVER_KNOWN_OK: - break; + switch (ret) { + case SSH_SERVER_KNOWN_OK: + break; - case SSH_SERVER_NOT_KNOWN: - case SSH_SERVER_FILE_NOT_FOUND: - case SSH_SERVER_KNOWN_CHANGED: - case SSH_SERVER_FOUND_OTHER: - if ( ssh_get_publickey(ssh->session, &server_pubkey) != SSH_OK ) - { - remmina_ssh_set_error(ssh, "ssh_get_publickey() has failed: %s"); - return 0; - } - if ( ssh_get_publickey_hash(server_pubkey, SSH_PUBLICKEY_HASH_MD5, &pubkey, &len) != 0 ) { - ssh_key_free(server_pubkey); - remmina_ssh_set_error(ssh, "ssh_get_publickey_hash() has failed: %s"); - return 0; - } + case SSH_SERVER_NOT_KNOWN: + case SSH_SERVER_FILE_NOT_FOUND: + case SSH_SERVER_KNOWN_CHANGED: + case SSH_SERVER_FOUND_OTHER: + if ( ssh_get_publickey(ssh->session, &server_pubkey) != SSH_OK ) { + remmina_ssh_set_error(ssh, "ssh_get_publickey() has failed: %s"); + return 0; + } + if ( ssh_get_publickey_hash(server_pubkey, SSH_PUBLICKEY_HASH_MD5, &pubkey, &len) != 0 ) { ssh_key_free(server_pubkey); - keyname = ssh_get_hexa (pubkey, len); + remmina_ssh_set_error(ssh, "ssh_get_publickey_hash() has failed: %s"); + return 0; + } + ssh_key_free(server_pubkey); + keyname = ssh_get_hexa (pubkey, len); - if (ret == SSH_SERVER_NOT_KNOWN || ret == SSH_SERVER_FILE_NOT_FOUND) - { - ret = remmina_init_dialog_serverkey_unknown (dialog, keyname); - } - else - { - ret = remmina_init_dialog_serverkey_changed (dialog, keyname); - } + if (ret == SSH_SERVER_NOT_KNOWN || ret == SSH_SERVER_FILE_NOT_FOUND) { + ret = remmina_init_dialog_serverkey_unknown (dialog, keyname); + } else { + ret = remmina_init_dialog_serverkey_changed (dialog, keyname); + } - ssh_string_free_char(keyname); - ssh_clean_pubkey_hash (&pubkey); - if (ret != GTK_RESPONSE_OK) return -1; - ssh_write_knownhost (ssh->session); - break; - case SSH_SERVER_ERROR: - default: - remmina_ssh_set_error (ssh, "SSH known host checking failed: %s"); + ssh_string_free_char(keyname); + ssh_clean_pubkey_hash (&pubkey); + if (ret != GTK_RESPONSE_OK) return -1; + ssh_write_knownhost (ssh->session); + break; + case SSH_SERVER_ERROR: + default: + remmina_ssh_set_error (ssh, "SSH known host checking failed: %s"); return 0; } @@ -327,26 +307,23 @@ remmina_ssh_auth_gui (RemminaSSH *ssh, RemminaInitDialog *dialog) if (ret > 0) return 1; /* Requested for a non-empty password */ - if (ret < 0) - { + if (ret < 0) { if (!dialog) return -1; - switch (ssh->auth) - { - case SSH_AUTH_PASSWORD: + switch (ssh->auth) { + case SSH_AUTH_PASSWORD: tips = _("Authenticating %s's password to SSH server %s..."); keyname = _("SSH password"); break; - case SSH_AUTH_PUBLICKEY: + case SSH_AUTH_PUBLICKEY: tips = _("Authenticating %s's identity to SSH server %s..."); keyname = _("SSH private key passphrase"); break; - default: + default: return FALSE; } - if (ssh->auth != SSH_AUTH_AUTO_PUBLICKEY) - { + if (ssh->auth != SSH_AUTH_AUTO_PUBLICKEY) { remmina_init_dialog_set_status (dialog, tips, ssh->user, ssh->server); ret = remmina_init_dialog_authpwd (dialog, keyname, FALSE); @@ -355,8 +332,7 @@ remmina_ssh_auth_gui (RemminaSSH *ssh, RemminaInitDialog *dialog) ret = remmina_ssh_auth (ssh, dialog->password); } - if (ret <= 0) - { + if (ret <= 0) { return 0; } @@ -384,8 +360,7 @@ remmina_ssh_init_session (RemminaSSH *ssh) ssh_options_set (ssh->session, SSH_OPTIONS_HOST, ssh->server); ssh_options_set (ssh->session, SSH_OPTIONS_PORT, &ssh->port); ssh_options_set (ssh->session, SSH_OPTIONS_USER, ssh->user); - if (remmina_log_running ()) - { + if (remmina_log_running ()) { verbosity = remmina_pref.ssh_loglevel; ssh_options_set (ssh->session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity); ssh->callback->log_function = remmina_ssh_log_callback; @@ -395,15 +370,13 @@ remmina_ssh_init_session (RemminaSSH *ssh) /* As the latest parse the ~/.ssh/config file */ ssh_options_parse_config(ssh->session, NULL); - if (ssh_connect (ssh->session)) - { + if (ssh_connect (ssh->session)) { remmina_ssh_set_error (ssh, _("Failed to startup SSH session: %s")); return FALSE; } /* Try the "none" authentication */ - if (ssh_userauth_none (ssh->session, NULL) == SSH_AUTH_SUCCESS) - { + if (ssh_userauth_none (ssh->session, NULL) == SSH_AUTH_SUCCESS) { ssh->authenticated = TRUE; } return TRUE; @@ -430,22 +403,16 @@ remmina_ssh_init_from_file (RemminaSSH *ssh, RemminaFile *remminafile) ssh_username = remmina_file_get_string (remminafile, "ssh_username"); ssh_privatekey = remmina_file_get_string (remminafile, "ssh_privatekey"); server = remmina_file_get_string (remminafile, "server"); - if (ssh_server) - { + if (ssh_server) { remmina_public_get_server_port (ssh_server, 22, &ssh->server, &ssh->port); - if (ssh->server[0] == '\0') - { + if (ssh->server[0] == '\0') { g_free(ssh->server); remmina_public_get_server_port (server, 0, &ssh->server, NULL); } - } - else if (server == NULL) - { + } else if (server == NULL) { ssh->server = g_strdup ("localhost"); ssh->port = 22; - } - else - { + } else { remmina_public_get_server_port (server, 0, &ssh->server, NULL); ssh->port = 22; } @@ -457,13 +424,10 @@ remmina_ssh_init_from_file (RemminaSSH *ssh, RemminaFile *remminafile) /* Public/Private keys */ s = (ssh_privatekey ? g_strdup (ssh_privatekey) : remmina_ssh_find_identity ()); - if (s) - { + if (s) { ssh->privkeyfile = remmina_ssh_identity_path (s); g_free(s); - } - else - { + } else { ssh->privkeyfile = NULL; } @@ -496,8 +460,7 @@ remmina_ssh_convert (RemminaSSH *ssh, const gchar *from) TRACE_CALL("remmina_ssh_convert"); gchar *to = NULL; - if (ssh->charset && from) - { + if (ssh->charset && from) { to = g_convert (from, -1, "UTF-8", ssh->charset, NULL, NULL, NULL); } if (!to) to = g_strdup (from); @@ -510,8 +473,7 @@ remmina_ssh_unconvert (RemminaSSH *ssh, const gchar *from) TRACE_CALL("remmina_ssh_unconvert"); gchar *to = NULL; - if (ssh->charset && from) - { + if (ssh->charset && from) { to = g_convert (from, -1, ssh->charset, "UTF-8", NULL, NULL, NULL); } if (!to) to = g_strdup (from); @@ -522,8 +484,7 @@ void remmina_ssh_free (RemminaSSH *ssh) { TRACE_CALL("remmina_ssh_free"); - if (ssh->session) - { + if (ssh->session) { ssh_free (ssh->session); ssh->session = NULL; } @@ -539,8 +500,7 @@ remmina_ssh_free (RemminaSSH *ssh) } /*************************** SSH Tunnel *********************************/ -struct _RemminaSSHTunnelBuffer -{ +struct _RemminaSSHTunnelBuffer { gchar *data; gchar *ptr; ssize_t len; @@ -563,8 +523,7 @@ static void remmina_ssh_tunnel_buffer_free (RemminaSSHTunnelBuffer *buffer) { TRACE_CALL("remmina_ssh_tunnel_buffer_free"); - if (buffer) - { + if (buffer) { g_free(buffer->data); g_free(buffer); } @@ -611,8 +570,7 @@ remmina_ssh_tunnel_close_all_channels (RemminaSSHTunnel *tunnel) TRACE_CALL("remmina_ssh_tunnel_close_all_channels"); int i; - for (i = 0; i < tunnel->num_channels; i++) - { + for (i = 0; i < tunnel->num_channels; i++) { close (tunnel->sockets[i]); remmina_ssh_tunnel_buffer_free (tunnel->socketbuffers[i]); ssh_channel_close (tunnel->channels[i]); @@ -629,8 +587,7 @@ remmina_ssh_tunnel_close_all_channels (RemminaSSHTunnel *tunnel) tunnel->num_channels = 0; tunnel->max_channels = 0; - if (tunnel->x11_channel) - { + if (tunnel->x11_channel) { ssh_channel_close (tunnel->x11_channel); ssh_channel_free (tunnel->x11_channel); tunnel->x11_channel = NULL; @@ -661,19 +618,18 @@ remmina_ssh_tunnel_add_channel (RemminaSSHTunnel *tunnel, ssh_channel channel, g gint i; i = tunnel->num_channels++; - if (tunnel->num_channels > tunnel->max_channels) - { + if (tunnel->num_channels > tunnel->max_channels) { /* Allocate an extra NULL pointer in channels for ssh_select */ tunnel->channels = (ssh_channel*) g_realloc (tunnel->channels, - sizeof (ssh_channel) * (tunnel->num_channels + 1)); + sizeof (ssh_channel) * (tunnel->num_channels + 1)); tunnel->sockets = (gint*) g_realloc (tunnel->sockets, - sizeof (gint) * tunnel->num_channels); + sizeof (gint) * tunnel->num_channels); tunnel->socketbuffers = (RemminaSSHTunnelBuffer**) g_realloc (tunnel->socketbuffers, - sizeof (RemminaSSHTunnelBuffer*) * tunnel->num_channels); + sizeof (RemminaSSHTunnelBuffer*) * tunnel->num_channels); tunnel->max_channels = tunnel->num_channels; tunnel->channels_out = (ssh_channel*) g_realloc (tunnel->channels_out, - sizeof (ssh_channel) * (tunnel->num_channels + 1)); + sizeof (ssh_channel) * (tunnel->num_channels + 1)); } tunnel->channels[i] = channel; tunnel->channels[i + 1] = NULL; @@ -707,28 +663,24 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) g_get_current_time (&t1); t2 = t1; - switch (tunnel->tunnel_type) - { - case REMMINA_SSH_TUNNEL_OPEN: + switch (tunnel->tunnel_type) { + case REMMINA_SSH_TUNNEL_OPEN: /* Accept a local connection */ sock = accept (tunnel->server_sock, NULL, NULL); - if (sock < 0) - { + if (sock < 0) { REMMINA_SSH (tunnel)->error = g_strdup ("Failed to accept local socket"); tunnel->thread = 0; return NULL; } - if ((channel = ssh_channel_new (tunnel->ssh.session)) == NULL) - { + if ((channel = ssh_channel_new (tunnel->ssh.session)) == NULL) { close (sock); remmina_ssh_set_error (REMMINA_SSH (tunnel), "Failed to createt channel : %s"); tunnel->thread = 0; return NULL; } /* Request the SSH server to connect to the destination */ - if (ssh_channel_open_forward (channel, tunnel->dest, tunnel->port, "127.0.0.1", 0) != SSH_OK) - { + if (ssh_channel_open_forward (channel, tunnel->dest, tunnel->port, "127.0.0.1", 0) != SSH_OK) { close (sock); ssh_channel_close (channel); ssh_channel_free (channel); @@ -739,15 +691,13 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) remmina_ssh_tunnel_add_channel (tunnel, channel, sock); break; - case REMMINA_SSH_TUNNEL_X11: - if ((tunnel->x11_channel = ssh_channel_new (tunnel->ssh.session)) == NULL) - { + case REMMINA_SSH_TUNNEL_X11: + if ((tunnel->x11_channel = ssh_channel_new (tunnel->ssh.session)) == NULL) { remmina_ssh_set_error (REMMINA_SSH (tunnel), "Failed to create channel : %s"); tunnel->thread = 0; return NULL; } - if (!remmina_public_get_xauth_cookie (tunnel->localdisplay, &ptr)) - { + if (!remmina_public_get_xauth_cookie (tunnel->localdisplay, &ptr)) { remmina_ssh_set_application_error (REMMINA_SSH (tunnel), "%s", ptr); g_free(ptr); tunnel->thread = 0; @@ -755,16 +705,14 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) } if (ssh_channel_open_session (tunnel->x11_channel) || ssh_channel_request_x11 (tunnel->x11_channel, TRUE, NULL, ptr, - gdk_screen_get_number (gdk_screen_get_default ()))) - { + gdk_screen_get_number (gdk_screen_get_default ()))) { g_free(ptr); remmina_ssh_set_error (REMMINA_SSH (tunnel), "Failed to open channel : %s"); tunnel->thread = 0; return NULL; } g_free(ptr); - if (ssh_channel_request_exec (tunnel->x11_channel, tunnel->dest)) - { + if (ssh_channel_request_exec (tunnel->x11_channel, tunnel->dest)) { ptr = g_strdup_printf(_("Failed to execute %s on SSH server : %%s"), tunnel->dest); remmina_ssh_set_error (REMMINA_SSH (tunnel), ptr); g_free(ptr); @@ -773,10 +721,8 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) } if (tunnel->init_func && - ! (*tunnel->init_func) (tunnel, tunnel->callback_data)) - { - if (tunnel->disconnect_func) - { + ! (*tunnel->init_func) (tunnel, tunnel->callback_data)) { + if (tunnel->disconnect_func) { (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); } tunnel->thread = 0; @@ -785,26 +731,20 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) break; - case REMMINA_SSH_TUNNEL_XPORT: + case REMMINA_SSH_TUNNEL_XPORT: /* Detect the next available port starting from 6010 on the server */ - for (i = 10; i <= MAX_X_DISPLAY_NUMBER; i++) - { + for (i = 10; i <= MAX_X_DISPLAY_NUMBER; i++) { if (ssh_channel_listen_forward (REMMINA_SSH (tunnel)->session, - (tunnel->bindlocalhost ? "localhost" : NULL), 6000 + i, NULL)) - { + (tunnel->bindlocalhost ? "localhost" : NULL), 6000 + i, NULL)) { continue; - } - else - { + } else { tunnel->remotedisplay = i; break; } } - if (tunnel->remotedisplay < 1) - { + if (tunnel->remotedisplay < 1) { remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to request port forwarding : %s")); - if (tunnel->disconnect_func) - { + if (tunnel->disconnect_func) { (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); } tunnel->thread = 0; @@ -812,10 +752,8 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) } if (tunnel->init_func && - ! (*tunnel->init_func) (tunnel, tunnel->callback_data)) - { - if (tunnel->disconnect_func) - { + ! (*tunnel->init_func) (tunnel, tunnel->callback_data)) { + if (tunnel->disconnect_func) { (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); } tunnel->thread = 0; @@ -824,12 +762,10 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) break; - case REMMINA_SSH_TUNNEL_REVERSE: - if (ssh_channel_listen_forward (REMMINA_SSH (tunnel)->session, NULL, tunnel->port, NULL)) - { + case REMMINA_SSH_TUNNEL_REVERSE: + if (ssh_channel_listen_forward (REMMINA_SSH (tunnel)->session, NULL, tunnel->port, NULL)) { remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to request port forwarding : %s")); - if (tunnel->disconnect_func) - { + if (tunnel->disconnect_func) { (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); } tunnel->thread = 0; @@ -837,10 +773,8 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) } if (tunnel->init_func && - ! (*tunnel->init_func) (tunnel, tunnel->callback_data)) - { - if (tunnel->disconnect_func) - { + ! (*tunnel->init_func) (tunnel, tunnel->callback_data)) { + if (tunnel->disconnect_func) { (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); } tunnel->thread = 0; @@ -854,93 +788,68 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) tunnel->buffer = g_malloc (tunnel->buffer_len); /* Start the tunnel data transmittion */ - while (tunnel->running) - { + while (tunnel->running) { if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_XPORT || tunnel->tunnel_type == REMMINA_SSH_TUNNEL_X11 || - tunnel->tunnel_type == REMMINA_SSH_TUNNEL_REVERSE) - { - if (first) - { + tunnel->tunnel_type == REMMINA_SSH_TUNNEL_REVERSE) { + if (first) { first = FALSE; /* Wait for a period of time for the first incoming connection */ - if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_X11) - { + if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_X11) { channel = ssh_channel_accept_x11 (tunnel->x11_channel, 15000); - } - else - { + } else { channel = ssh_channel_accept_forward (REMMINA_SSH (tunnel)->session, 15000, &tunnel->port); } - if (!channel) - { + if (!channel) { remmina_ssh_set_application_error (REMMINA_SSH (tunnel), _("No response from the server.")); - if (tunnel->disconnect_func) - { + if (tunnel->disconnect_func) { (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); } tunnel->thread = 0; return NULL; } - if (tunnel->connect_func) - { + if (tunnel->connect_func) { (*tunnel->connect_func) (tunnel, tunnel->callback_data); } - if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_REVERSE) - { + if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_REVERSE) { /* For reverse tunnel, we only need one connection. */ ssh_channel_cancel_forward (REMMINA_SSH (tunnel)->session, NULL, tunnel->port); } - } - else if (tunnel->tunnel_type != REMMINA_SSH_TUNNEL_REVERSE) - { + } else if (tunnel->tunnel_type != REMMINA_SSH_TUNNEL_REVERSE) { /* Poll once per some period of time if no incoming connections. * Don't try to poll continuously as it will significantly slow down the loop */ g_get_current_time (&t1); diff = (t1.tv_sec - t2.tv_sec) * 10 + (t1.tv_usec - t2.tv_usec) / 100000; - if (diff > 1) - { - if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_X11) - { + if (diff > 1) { + if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_X11) { channel = ssh_channel_accept_x11 (tunnel->x11_channel, 0); - } - else - { + } else { channel = ssh_channel_accept_forward (REMMINA_SSH (tunnel)->session, 0, &tunnel->port); } - if (channel == NULL) - { + if (channel == NULL) { t2 = t1; } } } - if (channel) - { - if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_REVERSE) - { + if (channel) { + if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_REVERSE) { sin.sin_family = AF_INET; sin.sin_port = htons (tunnel->localport); sin.sin_addr.s_addr = inet_addr ("127.0.0.1"); sock = socket (AF_INET, SOCK_STREAM, 0); - if (connect (sock, (struct sockaddr *) &sin, sizeof (sin)) < 0) - { + if (connect (sock, (struct sockaddr *) &sin, sizeof (sin)) < 0) { remmina_ssh_set_application_error (REMMINA_SSH (tunnel), - "Cannot connect to local port %i.", tunnel->localport); + "Cannot connect to local port %i.", tunnel->localport); close (sock); sock = -1; } - } - else - { + } else { sock = remmina_public_open_xdisplay (tunnel->localdisplay); } - if (sock >= 0) - { + if (sock >= 0) { remmina_ssh_tunnel_add_channel (tunnel, channel, sock); - } - else - { + } else { /* Failed to create unix socket. Will this happen? */ ssh_channel_close (channel); ssh_channel_free (channel); @@ -949,8 +858,7 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) } } - if (tunnel->num_channels <= 0) - { + if (tunnel->num_channels <= 0) { /* No more connections. We should quit */ break; } @@ -960,10 +868,8 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) FD_ZERO (&set); maxfd = 0; - for (i = 0; i < tunnel->num_channels; i++) - { - if (tunnel->sockets[i] > maxfd) - { + for (i = 0; i < tunnel->num_channels; i++) { + if (tunnel->sockets[i] > maxfd) { maxfd = tunnel->sockets[i]; } FD_SET (tunnel->sockets[i], &set); @@ -975,19 +881,14 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) if (ret == -1) break; i = 0; - while (tunnel->running && i < tunnel->num_channels) - { + while (tunnel->running && i < tunnel->num_channels) { disconnected = FALSE; - if (FD_ISSET (tunnel->sockets[i], &set)) - { + if (FD_ISSET (tunnel->sockets[i], &set)) { while (!disconnected && - (len = read (tunnel->sockets[i], tunnel->buffer, tunnel->buffer_len)) > 0) - { - for (ptr = tunnel->buffer, lenw = 0; len > 0; len -= lenw, ptr += lenw) - { + (len = read (tunnel->sockets[i], tunnel->buffer, tunnel->buffer_len)) > 0) { + for (ptr = tunnel->buffer, lenw = 0; len > 0; len -= lenw, ptr += lenw) { lenw = ssh_channel_write (tunnel->channels[i], (char*) ptr, len); - if (lenw <= 0) - { + if (lenw <= 0) { disconnected = TRUE; break; } @@ -995,8 +896,7 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) } if (len == 0) disconnected = TRUE; } - if (disconnected) - { + if (disconnected) { remmina_ssh_tunnel_remove_channel (tunnel, i); continue; } @@ -1005,60 +905,46 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) if (!tunnel->running) break; i = 0; - while (tunnel->running && i < tunnel->num_channels) - { + while (tunnel->running && i < tunnel->num_channels) { disconnected = FALSE; - if (!tunnel->socketbuffers[i]) - { + if (!tunnel->socketbuffers[i]) { len = ssh_channel_poll (tunnel->channels[i], 0); - if (len == SSH_ERROR || len == SSH_EOF) - { + if (len == SSH_ERROR || len == SSH_EOF) { disconnected = TRUE; - } - else if (len > 0) - { + } else if (len > 0) { tunnel->socketbuffers[i] = remmina_ssh_tunnel_buffer_new (len); len = ssh_channel_read_nonblocking (tunnel->channels[i], tunnel->socketbuffers[i]->data, len, 0); - if (len <= 0) - { + if (len <= 0) { disconnected = TRUE; - } - else - { + } else { tunnel->socketbuffers[i]->len = len; } } } - if (!disconnected && tunnel->socketbuffers[i]) - { + if (!disconnected && tunnel->socketbuffers[i]) { for (lenw = 0; tunnel->socketbuffers[i]->len > 0; - tunnel->socketbuffers[i]->len -= lenw, tunnel->socketbuffers[i]->ptr += lenw) - { + tunnel->socketbuffers[i]->len -= lenw, tunnel->socketbuffers[i]->ptr += lenw) { lenw = write (tunnel->sockets[i], tunnel->socketbuffers[i]->ptr, tunnel->socketbuffers[i]->len); - if (lenw == -1 && errno == EAGAIN && tunnel->running) - { + if (lenw == -1 && errno == EAGAIN && tunnel->running) { /* Sometimes we cannot write to a socket (always EAGAIN), probably because it's internal * buffer is full. We need read the pending bytes from the socket first. so here we simply * break, leave the buffer there, and continue with other data */ break; } - if (lenw <= 0) - { + if (lenw <= 0) { disconnected = TRUE; break; } } - if (tunnel->socketbuffers[i]->len <= 0) - { + if (tunnel->socketbuffers[i]->len <= 0) { remmina_ssh_tunnel_buffer_free (tunnel->socketbuffers[i]); tunnel->socketbuffers[i] = NULL; } } - if (disconnected) - { + if (disconnected) { remmina_ssh_tunnel_remove_channel (tunnel, i); continue; } @@ -1079,8 +965,7 @@ remmina_ssh_tunnel_main_thread (gpointer data) pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL); - while (TRUE) - { + while (TRUE) { remmina_ssh_tunnel_main_thread_proc (data); if (tunnel->server_sock < 0 || tunnel->thread == 0 || !tunnel->running) break; } @@ -1092,8 +977,7 @@ void remmina_ssh_tunnel_cancel_accept (RemminaSSHTunnel *tunnel) { TRACE_CALL("remmina_ssh_tunnel_cancel_accept"); - if (tunnel->server_sock >= 0) - { + if (tunnel->server_sock >= 0) { close (tunnel->server_sock); tunnel->server_sock = -1; } @@ -1110,16 +994,14 @@ remmina_ssh_tunnel_open (RemminaSSHTunnel* tunnel, const gchar *host, gint port, tunnel->tunnel_type = REMMINA_SSH_TUNNEL_OPEN; tunnel->dest = g_strdup (host); tunnel->port = port; - if (tunnel->port == 0) - { + if (tunnel->port == 0) { REMMINA_SSH (tunnel)->error = g_strdup ("Destination port has not been assigned"); return FALSE; } /* Create the server socket that listens on the local port */ sock = socket (AF_INET, SOCK_STREAM, 0); - if (sock < 0) - { + if (sock < 0) { REMMINA_SSH (tunnel)->error = g_strdup ("Failed to create socket."); return FALSE; } @@ -1129,15 +1011,13 @@ remmina_ssh_tunnel_open (RemminaSSHTunnel* tunnel, const gchar *host, gint port, sin.sin_port = htons (local_port); sin.sin_addr.s_addr = inet_addr ("127.0.0.1"); - if (bind (sock, (struct sockaddr *) &sin, sizeof(sin))) - { + if (bind (sock, (struct sockaddr *) &sin, sizeof(sin))) { REMMINA_SSH (tunnel)->error = g_strdup ("Failed to bind on local port."); close (sock); return FALSE; } - if (listen (sock, 1)) - { + if (listen (sock, 1)) { REMMINA_SSH (tunnel)->error = g_strdup ("Failed to listen on local port."); close (sock); return FALSE; @@ -1146,8 +1026,7 @@ remmina_ssh_tunnel_open (RemminaSSHTunnel* tunnel, const gchar *host, gint port, tunnel->server_sock = sock; tunnel->running = TRUE; - if (pthread_create (&tunnel->thread, NULL, remmina_ssh_tunnel_main_thread, tunnel)) - { + if (pthread_create (&tunnel->thread, NULL, remmina_ssh_tunnel_main_thread, tunnel)) { remmina_ssh_set_application_error (REMMINA_SSH (tunnel), "Failed to initialize pthread."); tunnel->thread = 0; return FALSE; @@ -1163,8 +1042,7 @@ remmina_ssh_tunnel_x11 (RemminaSSHTunnel *tunnel, const gchar *cmd) tunnel->dest = g_strdup (cmd); tunnel->running = TRUE; - if (pthread_create (&tunnel->thread, NULL, remmina_ssh_tunnel_main_thread, tunnel)) - { + if (pthread_create (&tunnel->thread, NULL, remmina_ssh_tunnel_main_thread, tunnel)) { remmina_ssh_set_application_error (REMMINA_SSH (tunnel), "Failed to initialize pthread."); tunnel->thread = 0; return FALSE; @@ -1180,8 +1058,7 @@ remmina_ssh_tunnel_xport (RemminaSSHTunnel *tunnel, gboolean bindlocalhost) tunnel->bindlocalhost = bindlocalhost; tunnel->running = TRUE; - if (pthread_create (&tunnel->thread, NULL, remmina_ssh_tunnel_main_thread, tunnel)) - { + if (pthread_create (&tunnel->thread, NULL, remmina_ssh_tunnel_main_thread, tunnel)) { remmina_ssh_set_application_error (REMMINA_SSH (tunnel), "Failed to initialize pthread."); tunnel->thread = 0; return FALSE; @@ -1198,8 +1075,7 @@ remmina_ssh_tunnel_reverse (RemminaSSHTunnel *tunnel, gint port, gint local_port tunnel->localport = local_port; tunnel->running = TRUE; - if (pthread_create (&tunnel->thread, NULL, remmina_ssh_tunnel_main_thread, tunnel)) - { + if (pthread_create (&tunnel->thread, NULL, remmina_ssh_tunnel_main_thread, tunnel)) { remmina_ssh_set_application_error (REMMINA_SSH (tunnel), "Failed to initialize pthread."); tunnel->thread = 0; return FALSE; @@ -1221,21 +1097,18 @@ remmina_ssh_tunnel_free (RemminaSSHTunnel* tunnel) pthread_t thread; thread = tunnel->thread; - if (thread != 0) - { + if (thread != 0) { tunnel->running = FALSE; pthread_cancel (thread); pthread_join (thread, NULL); tunnel->thread = 0; } - if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_XPORT && tunnel->remotedisplay > 0) - { + if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_XPORT && tunnel->remotedisplay > 0) { ssh_channel_cancel_forward (REMMINA_SSH (tunnel)->session, - NULL, 6000 + tunnel->remotedisplay); + NULL, 6000 + tunnel->remotedisplay); } - if (tunnel->server_sock >= 0) - { + if (tunnel->server_sock >= 0) { close (tunnel->server_sock); tunnel->server_sock = -1; } @@ -1286,13 +1159,11 @@ remmina_sftp_open (RemminaSFTP *sftp) { TRACE_CALL("remmina_sftp_open"); sftp->sftp_sess = sftp_new (sftp->ssh.session); - if (!sftp->sftp_sess) - { + if (!sftp->sftp_sess) { remmina_ssh_set_error (REMMINA_SSH (sftp), _("Failed to create sftp session: %s")); return FALSE; } - if (sftp_init (sftp->sftp_sess)) - { + if (sftp_init (sftp->sftp_sess)) { remmina_ssh_set_error (REMMINA_SSH (sftp), _("Failed to initialize sftp session: %s")); return FALSE; } @@ -1303,8 +1174,7 @@ void remmina_sftp_free (RemminaSFTP *sftp) { TRACE_CALL("remmina_sftp_free"); - if (sftp->sftp_sess) - { + if (sftp->sftp_sess) { sftp_free (sftp->sftp_sess); sftp->sftp_sess = NULL; } @@ -1374,8 +1244,7 @@ remmina_ssh_shell_thread (gpointer data) LOCK_SSH (shell) if ((channel = ssh_channel_new (REMMINA_SSH (shell)->session)) == NULL || - ssh_channel_open_session (channel)) - { + ssh_channel_open_session (channel)) { UNLOCK_SSH (shell) remmina_ssh_set_error (REMMINA_SSH (shell), "Failed to open channel : %s"); if (channel) ssh_channel_free (channel); @@ -1384,16 +1253,12 @@ remmina_ssh_shell_thread (gpointer data) } ssh_channel_request_pty (channel); - if (shell->exec && shell->exec[0]) - { + if (shell->exec && shell->exec[0]) { ret = ssh_channel_request_exec (channel, shell->exec); - } - else - { + } else { ret = ssh_channel_request_shell (channel); } - if (ret) - { + if (ret) { UNLOCK_SSH (shell) remmina_ssh_set_error (REMMINA_SSH (shell), "Failed to request shell : %s"); ssh_channel_close (channel); @@ -1412,8 +1277,7 @@ remmina_ssh_shell_thread (gpointer data) ch[0] = channel; ch[1] = NULL; - while (!shell->closed) - { + while (!shell->closed) { timeout.tv_sec = 1; timeout.tv_usec = 0; @@ -1424,40 +1288,34 @@ remmina_ssh_shell_thread (gpointer data) if (ret == SSH_EINTR) continue; if (ret == -1) break; - if (FD_ISSET (shell->master, &fds)) - { + if (FD_ISSET (shell->master, &fds)) { len = read (shell->master, buf, buf_len); if (len <= 0) break; LOCK_SSH (shell) ssh_channel_write (channel, buf, len); UNLOCK_SSH (shell) } - for (i = 0; i < 2; i++) - { + for (i = 0; i < 2; i++) { LOCK_SSH (shell) len = ssh_channel_poll (channel, i); UNLOCK_SSH (shell) - if (len == SSH_ERROR || len == SSH_EOF) - { + if (len == SSH_ERROR || len == SSH_EOF) { shell->closed = TRUE; break; } if (len <= 0) continue; - if (len > buf_len) - { + if (len > buf_len) { buf_len = len; buf = (gchar*) g_realloc (buf, buf_len + 1); } LOCK_SSH (shell) len = ssh_channel_read_nonblocking (channel, buf, len, i); UNLOCK_SSH (shell) - if (len <= 0) - { + if (len <= 0) { shell->closed = TRUE; break; } - while (len > 0) - { + while (len > 0) { ret = write (shell->master, buf, len); if (ret <= 0) break; len -= ret; @@ -1474,8 +1332,7 @@ remmina_ssh_shell_thread (gpointer data) g_free(buf); shell->thread = 0; - if ( shell->exit_callback ) - { + if ( shell->exit_callback ) { IDLE_ADD ((GSourceFunc) remmina_ssh_call_exit_callback_on_main_thread, (gpointer)shell ); } return NULL; @@ -1494,8 +1351,7 @@ remmina_ssh_shell_open (RemminaSSHShell *shell, RemminaSSHExitFunc exit_callback grantpt (shell->master) == -1 || unlockpt (shell->master) == -1 || (slavedevice = ptsname (shell->master)) == NULL || - (shell->slave = open (slavedevice, O_RDWR | O_NOCTTY)) < 0) - { + (shell->slave = open (slavedevice, O_RDWR | O_NOCTTY)) < 0) { REMMINA_SSH (shell)->error = g_strdup ("Failed to create pty device."); return FALSE; } @@ -1520,8 +1376,7 @@ remmina_ssh_shell_set_size (RemminaSSHShell *shell, gint columns, gint rows) { TRACE_CALL("remmina_ssh_shell_set_size"); LOCK_SSH (shell) - if (shell->channel) - { + if (shell->channel) { ssh_channel_change_pty_size (shell->channel, columns, rows); } UNLOCK_SSH (shell) @@ -1534,14 +1389,12 @@ remmina_ssh_shell_free (RemminaSSHShell *shell) pthread_t thread = shell->thread; shell->exit_callback = NULL; - if (thread) - { + if (thread) { shell->closed = TRUE; pthread_join (thread, NULL); } close (shell->master); - if (shell->exec) - { + if (shell->exec) { g_free(shell->exec); shell->exec = NULL; } -- cgit v1.2.3 From a8331a6e3d7a672a8ef18af430ceeb306dfee706 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 10 Sep 2015 15:09:27 +0200 Subject: libssh deprecation warning - wrong name space --- remmina-plugins/nx/nx_session.c | 2 +- remmina/src/remmina_ssh.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/remmina-plugins/nx/nx_session.c b/remmina-plugins/nx/nx_session.c index 8fb4a2c8a..39df6ef59 100644 --- a/remmina-plugins/nx/nx_session.c +++ b/remmina-plugins/nx/nx_session.c @@ -281,7 +281,7 @@ static gboolean remmina_nx_session_get_response(RemminaNXSession *nx) return FALSE; buffer = buffer_new(); - len = ssh_channel_read_buffer(nx->channel, buffer, len, is_stderr); + len = channel_read_buffer(nx->channel, buffer, len, is_stderr); if (len <= 0) { remmina_nx_session_set_application_error(nx, "Channel closed."); return FALSE; diff --git a/remmina/src/remmina_ssh.c b/remmina/src/remmina_ssh.c index ed7f908b2..431ba82e9 100644 --- a/remmina/src/remmina_ssh.c +++ b/remmina/src/remmina_ssh.c @@ -40,6 +40,7 @@ /* Define this before stdlib.h to have posix_openpt */ #define _XOPEN_SOURCE 600 +#include #include #include #include @@ -734,8 +735,7 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) case REMMINA_SSH_TUNNEL_XPORT: /* Detect the next available port starting from 6010 on the server */ for (i = 10; i <= MAX_X_DISPLAY_NUMBER; i++) { - if (ssh_channel_listen_forward (REMMINA_SSH (tunnel)->session, - (tunnel->bindlocalhost ? "localhost" : NULL), 6000 + i, NULL)) { + if (ssh_forward_listen (REMMINA_SSH (tunnel)->session, (tunnel->bindlocalhost ? "localhost" : NULL), 6000 + i, NULL)) { continue; } else { tunnel->remotedisplay = i; @@ -763,7 +763,7 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) break; case REMMINA_SSH_TUNNEL_REVERSE: - if (ssh_channel_listen_forward (REMMINA_SSH (tunnel)->session, NULL, tunnel->port, NULL)) { + if (ssh_forward_listen (REMMINA_SSH (tunnel)->session, NULL, tunnel->port, NULL)) { remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to request port forwarding : %s")); if (tunnel->disconnect_func) { (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); @@ -813,7 +813,7 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) } if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_REVERSE) { /* For reverse tunnel, we only need one connection. */ - ssh_channel_cancel_forward (REMMINA_SSH (tunnel)->session, NULL, tunnel->port); + ssh_forward_cancel (REMMINA_SSH (tunnel)->session, NULL, tunnel->port); } } else if (tunnel->tunnel_type != REMMINA_SSH_TUNNEL_REVERSE) { /* Poll once per some period of time if no incoming connections. @@ -1105,7 +1105,7 @@ remmina_ssh_tunnel_free (RemminaSSHTunnel* tunnel) } if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_XPORT && tunnel->remotedisplay > 0) { - ssh_channel_cancel_forward (REMMINA_SSH (tunnel)->session, + ssh_forward_cancel (REMMINA_SSH (tunnel)->session, NULL, 6000 + tunnel->remotedisplay); } if (tunnel->server_sock >= 0) { -- cgit v1.2.3 From cf549960b03b4687f6c52cc1a8c1ec7250f46578 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 10 Sep 2015 22:21:04 +0200 Subject: code cleaning --- remmina/src/remmina_ssh.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/remmina/src/remmina_ssh.c b/remmina/src/remmina_ssh.c index 431ba82e9..a095fb8c4 100644 --- a/remmina/src/remmina_ssh.c +++ b/remmina/src/remmina_ssh.c @@ -622,15 +622,15 @@ remmina_ssh_tunnel_add_channel (RemminaSSHTunnel *tunnel, ssh_channel channel, g if (tunnel->num_channels > tunnel->max_channels) { /* Allocate an extra NULL pointer in channels for ssh_select */ tunnel->channels = (ssh_channel*) g_realloc (tunnel->channels, - sizeof (ssh_channel) * (tunnel->num_channels + 1)); + sizeof (ssh_channel) * (tunnel->num_channels + 1)); tunnel->sockets = (gint*) g_realloc (tunnel->sockets, - sizeof (gint) * tunnel->num_channels); + sizeof (gint) * tunnel->num_channels); tunnel->socketbuffers = (RemminaSSHTunnelBuffer**) g_realloc (tunnel->socketbuffers, - sizeof (RemminaSSHTunnelBuffer*) * tunnel->num_channels); + sizeof (RemminaSSHTunnelBuffer*) * tunnel->num_channels); tunnel->max_channels = tunnel->num_channels; tunnel->channels_out = (ssh_channel*) g_realloc (tunnel->channels_out, - sizeof (ssh_channel) * (tunnel->num_channels + 1)); + sizeof (ssh_channel) * (tunnel->num_channels + 1)); } tunnel->channels[i] = channel; tunnel->channels[i + 1] = NULL; @@ -706,7 +706,7 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) } if (ssh_channel_open_session (tunnel->x11_channel) || ssh_channel_request_x11 (tunnel->x11_channel, TRUE, NULL, ptr, - gdk_screen_get_number (gdk_screen_get_default ()))) { + gdk_screen_get_number (gdk_screen_get_default ()))) { g_free(ptr); remmina_ssh_set_error (REMMINA_SSH (tunnel), "Failed to open channel : %s"); tunnel->thread = 0; @@ -840,7 +840,7 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) sock = socket (AF_INET, SOCK_STREAM, 0); if (connect (sock, (struct sockaddr *) &sin, sizeof (sin)) < 0) { remmina_ssh_set_application_error (REMMINA_SSH (tunnel), - "Cannot connect to local port %i.", tunnel->localport); + "Cannot connect to local port %i.", tunnel->localport); close (sock); sock = -1; } @@ -1105,8 +1105,7 @@ remmina_ssh_tunnel_free (RemminaSSHTunnel* tunnel) } if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_XPORT && tunnel->remotedisplay > 0) { - ssh_forward_cancel (REMMINA_SSH (tunnel)->session, - NULL, 6000 + tunnel->remotedisplay); + ssh_forward_cancel (REMMINA_SSH (tunnel)->session, NULL, 6000 + tunnel->remotedisplay); } if (tunnel->server_sock >= 0) { close (tunnel->server_sock); -- cgit v1.2.3 From 177857df9c1b7381ce077aa0b59645b8434c9a16 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Fri, 11 Sep 2015 15:47:39 +0200 Subject: ssh_disconnect before ssh_free it's a better practice --- remmina/src/remmina_ssh.c | 17 +++++++++++++---- remmina/src/remmina_ssh.h | 18 +++++++++++++----- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/remmina/src/remmina_ssh.c b/remmina/src/remmina_ssh.c index a095fb8c4..8558371bf 100644 --- a/remmina/src/remmina_ssh.c +++ b/remmina/src/remmina_ssh.c @@ -76,7 +76,9 @@ #include "remmina_pref.h" #include "remmina/remmina_trace_calls.h" -/*************************** SSH Base *********************************/ +/*-----------------------------------------------------------------------------* + * SSH Base * + *-----------------------------------------------------------------------------*/ #define LOCK_SSH(ssh) pthread_mutex_lock (&REMMINA_SSH (ssh)->ssh_mutex); #define UNLOCK_SSH(ssh) pthread_mutex_unlock (&REMMINA_SSH (ssh)->ssh_mutex); @@ -486,6 +488,7 @@ remmina_ssh_free (RemminaSSH *ssh) { TRACE_CALL("remmina_ssh_free"); if (ssh->session) { + ssh_disconnect (ssh->session); ssh_free (ssh->session); ssh->session = NULL; } @@ -500,7 +503,9 @@ remmina_ssh_free (RemminaSSH *ssh) g_free(ssh); } -/*************************** SSH Tunnel *********************************/ +/*-----------------------------------------------------------------------------* + * SSH Tunnel * + *-----------------------------------------------------------------------------*/ struct _RemminaSSHTunnelBuffer { gchar *data; gchar *ptr; @@ -1121,7 +1126,9 @@ remmina_ssh_tunnel_free (RemminaSSHTunnel* tunnel) remmina_ssh_free (REMMINA_SSH (tunnel)); } -/*************************** SFTP *********************************/ +/*-----------------------------------------------------------------------------* + * SSH sFTP * + *-----------------------------------------------------------------------------*/ RemminaSFTP* remmina_sftp_new_from_file (RemminaFile *remminafile) @@ -1180,7 +1187,9 @@ remmina_sftp_free (RemminaSFTP *sftp) remmina_ssh_free (REMMINA_SSH (sftp)); } -/*************************** SSH Shell *********************************/ +/*-----------------------------------------------------------------------------* + * SSH Shell * + *-----------------------------------------------------------------------------*/ RemminaSSHShell* remmina_ssh_shell_new_from_file (RemminaFile *remminafile) diff --git a/remmina/src/remmina_ssh.h b/remmina/src/remmina_ssh.h index ce0935529..535742226 100644 --- a/remmina/src/remmina_ssh.h +++ b/remmina/src/remmina_ssh.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give @@ -49,7 +49,9 @@ G_BEGIN_DECLS -/* ----------------- SSH Base --------------- */ +/*-----------------------------------------------------------------------------* + * SSH Base * + *-----------------------------------------------------------------------------*/ #define REMMINA_SSH(a) ((RemminaSSH*)a) @@ -101,7 +103,9 @@ gchar* remmina_ssh_unconvert (RemminaSSH *ssh, const gchar *from); void remmina_ssh_free (RemminaSSH *ssh); -/* ------------------- SSH Tunnel ---------------------- */ +/*-----------------------------------------------------------------------------* + * SSH Tunnel * + *-----------------------------------------------------------------------------*/ typedef struct _RemminaSSHTunnel RemminaSSHTunnel; typedef struct _RemminaSSHTunnelBuffer RemminaSSHTunnelBuffer; @@ -187,7 +191,9 @@ gboolean remmina_ssh_tunnel_terminated (RemminaSSHTunnel *tunnel); /* Free the tunnel */ void remmina_ssh_tunnel_free (RemminaSSHTunnel *tunnel); -/*----------------------- SFTP ------------------------*/ +/*-----------------------------------------------------------------------------* + * SSH sFTP * + *-----------------------------------------------------------------------------*/ typedef struct _RemminaSFTP { @@ -208,7 +214,9 @@ gboolean remmina_sftp_open (RemminaSFTP *sftp); /* Free the SFTP session */ void remmina_sftp_free (RemminaSFTP *sftp); -/*----------------------- SSH Shell ------------------------*/ +/*-----------------------------------------------------------------------------* + * SSH Shell * + *-----------------------------------------------------------------------------*/ typedef void (*RemminaSSHExitFunc) (gpointer data); typedef struct _RemminaSSHShell -- cgit v1.2.3 From d77d84fc5ed12a414081739895c5324becfa84d2 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Fri, 11 Sep 2015 16:31:33 +0200 Subject: Wrong evaluation order in switch case, can causes weird issues --- remmina/src/remmina_ssh.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/remmina/src/remmina_ssh.c b/remmina/src/remmina_ssh.c index 8558371bf..2fc1a5efa 100644 --- a/remmina/src/remmina_ssh.c +++ b/remmina/src/remmina_ssh.c @@ -182,7 +182,7 @@ remmina_ssh_auth_pubkey (RemminaSSH *ssh) if (ssh->privkeyfile == NULL) { ssh->error = g_strdup_printf(_("SSH public key authentication failed: %s"), - _("SSH Key file not yet set.")); + _("SSH Key file not yet set.")); return 0; } @@ -269,10 +269,11 @@ remmina_ssh_auth_gui (RemminaSSH *ssh, RemminaInitDialog *dialog) ret = ssh_is_server_known (ssh->session); switch (ret) { case SSH_SERVER_KNOWN_OK: - break; + break; /* ok */ - case SSH_SERVER_NOT_KNOWN: case SSH_SERVER_FILE_NOT_FOUND: + /* fallback to SSH_SERVER_NOT_KNOWN behavior */ + case SSH_SERVER_NOT_KNOWN: case SSH_SERVER_KNOWN_CHANGED: case SSH_SERVER_FOUND_OTHER: if ( ssh_get_publickey(ssh->session, &server_pubkey) != SSH_OK ) { -- cgit v1.2.3 From 9efa1601548fab64495cb0112faf176a5d42a9ca Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Fri, 11 Sep 2015 17:23:37 +0200 Subject: setlocale was not set inside vte initialization. fixes #331 --- remmina/src/remmina_file_editor.c | 46 +++++++++++++++++++-------------------- remmina/src/remmina_ssh_plugin.c | 13 +++++++++-- 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/remmina/src/remmina_file_editor.c b/remmina/src/remmina_file_editor.c index 583ff430f..130211691 100644 --- a/remmina/src/remmina_file_editor.c +++ b/remmina/src/remmina_file_editor.c @@ -58,33 +58,33 @@ G_DEFINE_TYPE( RemminaFileEditor, remmina_file_editor, GTK_TYPE_DIALOG) #ifdef HAVE_LIBSSH static const gchar* charset_list = "ASCII,BIG5," - "CP437,CP720,CP737,CP775,CP850,CP852,CP855," - "CP857,CP858,CP862,CP866,CP874,CP1125,CP1250," - "CP1251,CP1252,CP1253,CP1254,CP1255,CP1256," - "CP1257,CP1258," - "EUC-JP,EUC-KR,GBK," - "ISO-8859-1,ISO-8859-2,ISO-8859-3,ISO-8859-4," - "ISO-8859-5,ISO-8859-6,ISO-8859-7,ISO-8859-8," - "ISO-8859-9,ISO-8859-10,ISO-8859-11,ISO-8859-12," - "ISO-8859-13,ISO-8859-14,ISO-8859-15,ISO-8859-16," - "KOI8-R,SJIS,UTF-8"; + "CP437,CP720,CP737,CP775,CP850,CP852,CP855," + "CP857,CP858,CP862,CP866,CP874,CP1125,CP1250," + "CP1251,CP1252,CP1253,CP1254,CP1255,CP1256," + "CP1257,CP1258," + "EUC-JP,EUC-KR,GBK," + "ISO-8859-1,ISO-8859-2,ISO-8859-3,ISO-8859-4," + "ISO-8859-5,ISO-8859-6,ISO-8859-7,ISO-8859-8," + "ISO-8859-9,ISO-8859-10,ISO-8859-11,ISO-8859-12," + "ISO-8859-13,ISO-8859-14,ISO-8859-15,ISO-8859-16," + "KOI8-R,SJIS,UTF-8"; #endif -static const gchar* server_tips = N_("" - "Supported formats\n" - "* server\n" - "* server:port\n" - "* [server]:port" - ""); +static const gchar* server_tips = N_( "" + "Supported formats\n" + "* server\n" + "* server:port\n" + "* [server]:port" + ""); #ifdef HAVE_LIBSSH -static const gchar* server_tips2 = N_("" - "Supported formats\n" - "* :port\n" - "* server\n" - "* server:port\n" - "* [server]:port" - ""); +static const gchar* server_tips2 = N_( "" + "Supported formats\n" + "* :port\n" + "* server\n" + "* server:port\n" + "* [server]:port" + ""); #endif struct _RemminaFileEditorPriv { diff --git a/remmina/src/remmina_ssh_plugin.c b/remmina/src/remmina_ssh_plugin.c index 49852600b..c72b2e0bc 100644 --- a/remmina/src/remmina_ssh_plugin.c +++ b/remmina/src/remmina_ssh_plugin.c @@ -41,6 +41,8 @@ #include #include #include +#include +#include #include "remmina_public.h" #include "remmina_plugin_manager.h" #include "remmina_ssh.h" @@ -89,7 +91,8 @@ remmina_plugin_ssh_main_thread (gpointer data) shell = remmina_ssh_shell_new_from_ssh (ssh); if (remmina_ssh_init_session (REMMINA_SSH (shell)) && remmina_ssh_auth (REMMINA_SSH (shell), NULL) > 0 && - remmina_ssh_shell_open (shell, (RemminaSSHExitFunc) remmina_plugin_service->protocol_plugin_close_connection, gp)) + remmina_ssh_shell_open (shell, (RemminaSSHExitFunc) + remmina_plugin_service->protocol_plugin_close_connection, gp)) { cont = TRUE; } @@ -118,7 +121,8 @@ remmina_plugin_ssh_main_thread (gpointer data) } if (ret <= 0) break; - if (!remmina_ssh_shell_open (shell, (RemminaSSHExitFunc) remmina_plugin_service->protocol_plugin_close_connection, gp)) + if (!remmina_ssh_shell_open (shell, (RemminaSSHExitFunc) + remmina_plugin_service->protocol_plugin_close_connection, gp)) { remmina_plugin_service->protocol_plugin_set_error (gp, "%s", REMMINA_SSH (shell)->error); break; @@ -161,15 +165,20 @@ void remmina_plugin_ssh_vte_terminal_set_encoding_and_pty(VteTerminal *terminal, return; } + setlocale(LC_ALL, ""); if (codeset && codeset[0] != '\0') { #if !VTE_CHECK_VERSION(0,38,0) + vte_terminal_set_emulation(terminal, "xterm") vte_terminal_set_encoding (terminal, codeset); #else vte_terminal_set_encoding (terminal, codeset, NULL); #endif } + vte_terminal_set_backspace_binding(terminal, VTE_ERASE_ASCII_DELETE); + vte_terminal_set_delete_binding(terminal, VTE_ERASE_DELETE_SEQUENCE); + #if !VTE_CHECK_VERSION(0,38,0) vte_terminal_set_pty (terminal, slave); #else -- cgit v1.2.3 From 20e7a847f8bc85d1c878387eb535130d9e7c2583 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Fri, 11 Sep 2015 22:50:12 +0200 Subject: libssh static linking --- remmina-plugins/nx/nx_plugin.c | 1 + remmina-plugins/nx/nx_session.c | 1 + remmina/src/remmina_ssh.c | 1 + remmina/src/remmina_ssh.h | 1 + 4 files changed, 4 insertions(+) diff --git a/remmina-plugins/nx/nx_plugin.c b/remmina-plugins/nx/nx_plugin.c index 4e8508cee..4de7a75ba 100644 --- a/remmina-plugins/nx/nx_plugin.c +++ b/remmina-plugins/nx/nx_plugin.c @@ -40,6 +40,7 @@ # include #endif #include +#define LIBSSH_STATIC 1 #include #include #include diff --git a/remmina-plugins/nx/nx_session.c b/remmina-plugins/nx/nx_session.c index 39df6ef59..6625ba8c6 100644 --- a/remmina-plugins/nx/nx_session.c +++ b/remmina-plugins/nx/nx_session.c @@ -37,6 +37,7 @@ #include #include "common/remmina_plugin.h" #include +#define LIBSSH_STATIC 1 #include #include "nx_session.h" diff --git a/remmina/src/remmina_ssh.c b/remmina/src/remmina_ssh.c index 2fc1a5efa..3e8720c1b 100644 --- a/remmina/src/remmina_ssh.c +++ b/remmina/src/remmina_ssh.c @@ -40,6 +40,7 @@ /* Define this before stdlib.h to have posix_openpt */ #define _XOPEN_SOURCE 600 +#define LIBSSH_STATIC 1 #include #include #include diff --git a/remmina/src/remmina_ssh.h b/remmina/src/remmina_ssh.h index 535742226..4f6e721d6 100644 --- a/remmina/src/remmina_ssh.h +++ b/remmina/src/remmina_ssh.h @@ -40,6 +40,7 @@ #ifdef HAVE_LIBSSH +#define LIBSSH_STATIC 1 #include #include #include -- cgit v1.2.3 From 509713aa6138c184dc6132e94484a7b641501c3d Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Mon, 14 Sep 2015 11:09:51 +0200 Subject: typo in vte terminal type --- remmina/src/remmina_ssh_plugin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remmina/src/remmina_ssh_plugin.c b/remmina/src/remmina_ssh_plugin.c index c72b2e0bc..9a7e48192 100644 --- a/remmina/src/remmina_ssh_plugin.c +++ b/remmina/src/remmina_ssh_plugin.c @@ -169,7 +169,7 @@ void remmina_plugin_ssh_vte_terminal_set_encoding_and_pty(VteTerminal *terminal, if (codeset && codeset[0] != '\0') { #if !VTE_CHECK_VERSION(0,38,0) - vte_terminal_set_emulation(terminal, "xterm") + vte_terminal_set_emulation(terminal, "xterm"); vte_terminal_set_encoding (terminal, codeset); #else vte_terminal_set_encoding (terminal, codeset, NULL); -- cgit v1.2.3 From 6e402c85766474d104a2632b1ae1a3c25a755f5f Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Mon, 14 Sep 2015 22:55:35 +0200 Subject: Added ssh_agent support. Closes #395 --- remmina/src/remmina_file.h | 2 +- remmina/src/remmina_file_editor.c | 224 ++++++++++++++++++++------------------ remmina/src/remmina_ssh.c | 19 ++++ 3 files changed, 140 insertions(+), 105 deletions(-) diff --git a/remmina/src/remmina_file.h b/remmina/src/remmina_file.h index a52b7ecde..dce413d4a 100644 --- a/remmina/src/remmina_file.h +++ b/remmina/src/remmina_file.h @@ -48,7 +48,7 @@ struct _RemminaFile enum { - SSH_AUTH_PASSWORD, SSH_AUTH_PUBLICKEY, SSH_AUTH_AUTO_PUBLICKEY + SSH_AUTH_PASSWORD, SSH_AUTH_PUBLICKEY, SSH_AUTH_AGENT, SSH_AUTH_AUTO_PUBLICKEY }; typedef enum diff --git a/remmina/src/remmina_file_editor.c b/remmina/src/remmina_file_editor.c index 130211691..d5e7091b6 100644 --- a/remmina/src/remmina_file_editor.c +++ b/remmina/src/remmina_file_editor.c @@ -113,6 +113,7 @@ struct _RemminaFileEditorPriv { GtkWidget* ssh_server_default_radio; GtkWidget* ssh_server_custom_radio; GtkWidget* ssh_server_entry; + GtkWidget* ssh_auth_agent_radio; GtkWidget* ssh_auth_password_radio; GtkWidget* ssh_auth_publickey_radio; GtkWidget* ssh_auth_auto_publickey_radio; @@ -284,6 +285,7 @@ static void remmina_file_editor_ssh_enabled_check_on_toggled(GtkToggleButton* to remmina_file_editor_ssh_server_custom_radio_on_toggled(NULL, gfe); gtk_widget_set_sensitive(gfe->priv->ssh_charset_combo, enabled); gtk_widget_set_sensitive(gfe->priv->ssh_username_entry, enabled); + gtk_widget_set_sensitive(gfe->priv->ssh_auth_agent_radio, enabled); gtk_widget_set_sensitive(gfe->priv->ssh_auth_password_radio, enabled); gtk_widget_set_sensitive(gfe->priv->ssh_auth_publickey_radio, enabled); gtk_widget_set_sensitive(gfe->priv->ssh_auth_auto_publickey_radio, enabled); @@ -310,7 +312,7 @@ static void remmina_file_editor_create_ssh_privatekey(RemminaFileEditor* gfe, Gt G_CALLBACK(remmina_file_editor_ssh_auth_publickey_radio_on_toggled), gfe); priv->ssh_auth_publickey_radio = widget; gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(grid), widget, 0, row + 15, 1, 1); + gtk_grid_attach(GTK_GRID(grid), widget, 0, row + 22, 1, 1); dialog = gtk_file_chooser_dialog_new (_("Identity file"), GTK_WINDOW(gfe), GTK_FILE_CHOOSER_ACTION_OPEN, _("_Cancel"), GTK_RESPONSE_CANCEL, @@ -324,7 +326,7 @@ static void remmina_file_editor_create_ssh_privatekey(RemminaFileEditor* gfe, Gt } g_free(s); gtk_widget_show(widget); - gtk_grid_attach (GTK_GRID(grid), widget, column + 1, row + 15, 1, 1); + gtk_grid_attach (GTK_GRID(grid), widget, column + 1, row + 22, 1, 1); priv->ssh_privatekey_chooser = widget; ssh_privatekey = remmina_file_get_string (priv->remmina_file, "ssh_privatekey"); @@ -636,9 +638,9 @@ static void remmina_file_editor_create_settings(RemminaFileEditor* gfe, GtkWidge case REMMINA_PROTOCOL_SETTING_TYPE_KEYMAP: strarr = remmina_pref_keymap_groups(); priv->keymap_combo = remmina_file_editor_create_select(gfe, grid, - grid_row + 1, 0, - _("Keyboard mapping"), (const gpointer*) strarr, - remmina_file_get_string(priv->remmina_file, "keymap")); + grid_row + 1, 0, + _("Keyboard mapping"), (const gpointer*) strarr, + remmina_file_get_string(priv->remmina_file, "keymap")); g_strfreev(strarr); grid_row++; break; @@ -742,7 +744,7 @@ static void remmina_file_editor_create_ssh_tab(RemminaFileEditor* gfe, RemminaPr gtk_widget_show(widget); gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(widget), "toggled", - G_CALLBACK(remmina_file_editor_ssh_enabled_check_on_toggled), gfe); + G_CALLBACK(remmina_file_editor_ssh_enabled_check_on_toggled), gfe); priv->ssh_enabled_check = widget; widget = gtk_check_button_new_with_label (_("Tunnel via loopback address")); @@ -755,75 +757,75 @@ static void remmina_file_editor_create_ssh_tab(RemminaFileEditor* gfe, RemminaPr row++; switch (ssh_setting) { - case REMMINA_PROTOCOL_SSH_SETTING_TUNNEL: - s = g_strdup_printf(_("Same server at port %i"), DEFAULT_SSH_PORT); - widget = gtk_radio_button_new_with_label (NULL, s); - g_free(s); - gtk_widget_show(widget); - gtk_grid_attach (GTK_GRID(grid), widget, 0, row, 3, 1); - priv->ssh_server_default_radio = widget; - row++; + case REMMINA_PROTOCOL_SSH_SETTING_TUNNEL: + s = g_strdup_printf(_("Same server at port %i"), DEFAULT_SSH_PORT); + widget = gtk_radio_button_new_with_label (NULL, s); + g_free(s); + gtk_widget_show(widget); + gtk_grid_attach (GTK_GRID(grid), widget, 0, row, 3, 1); + priv->ssh_server_default_radio = widget; + row++; + + widget = gtk_radio_button_new_with_label_from_widget ( + GTK_RADIO_BUTTON(priv->ssh_server_default_radio), _("Custom")); + gtk_widget_show(widget); + gtk_grid_attach (GTK_GRID(grid), widget, 0, row, 1, 1); + g_signal_connect(G_OBJECT(widget), "toggled", + G_CALLBACK(remmina_file_editor_ssh_server_custom_radio_on_toggled), gfe); + priv->ssh_server_custom_radio = widget; + + widget = gtk_entry_new (); + gtk_widget_show(widget); + gtk_entry_set_max_length (GTK_ENTRY(widget), 100); + gtk_widget_set_tooltip_markup (widget, _(server_tips2)); + gtk_grid_attach (GTK_GRID(grid), widget, 1, row, 2, 1); + priv->ssh_server_entry = widget; + row++; + break; - widget = gtk_radio_button_new_with_label_from_widget ( - GTK_RADIO_BUTTON(priv->ssh_server_default_radio), _("Custom")); - gtk_widget_show(widget); - gtk_grid_attach (GTK_GRID(grid), widget, 0, row, 1, 1); - g_signal_connect(G_OBJECT(widget), "toggled", - G_CALLBACK(remmina_file_editor_ssh_server_custom_radio_on_toggled), gfe); - priv->ssh_server_custom_radio = widget; + case REMMINA_PROTOCOL_SSH_SETTING_REVERSE_TUNNEL: + priv->ssh_server_default_radio = NULL; + priv->ssh_server_custom_radio = NULL; - widget = gtk_entry_new (); - gtk_widget_show(widget); - gtk_entry_set_max_length (GTK_ENTRY(widget), 100); - gtk_widget_set_tooltip_markup (widget, _(server_tips2)); - gtk_grid_attach (GTK_GRID(grid), widget, 1, row, 2, 1); - priv->ssh_server_entry = widget; - row++; - break; - - case REMMINA_PROTOCOL_SSH_SETTING_REVERSE_TUNNEL: - priv->ssh_server_default_radio = NULL; - priv->ssh_server_custom_radio = NULL; + priv->ssh_server_entry = remmina_file_editor_create_text (gfe, grid, 1, 0, + _("Server"), NULL); + gtk_widget_set_tooltip_markup (priv->ssh_server_entry, _(server_tips)); + row++; + break; - priv->ssh_server_entry = remmina_file_editor_create_text (gfe, grid, 1, 0, - _("Server"), NULL); - gtk_widget_set_tooltip_markup (priv->ssh_server_entry, _(server_tips)); - row++; - break; - - case REMMINA_PROTOCOL_SSH_SETTING_SSH: - case REMMINA_PROTOCOL_SSH_SETTING_SFTP: - priv->ssh_server_default_radio = NULL; - priv->ssh_server_custom_radio = NULL; - priv->ssh_server_entry = NULL; - - s = remmina_pref_get_recent ("SFTP"); - priv->server_combo = remmina_file_editor_create_combo (gfe, grid, row + 1, 1, - _("Server"), s, remmina_file_get_string (priv->remmina_file, "server")); - gtk_widget_set_tooltip_markup (priv->server_combo, _(server_tips)); - gtk_entry_set_activates_default (GTK_ENTRY(gtk_bin_get_child (GTK_BIN (priv->server_combo))), TRUE); - g_free(s); - row++; - break; + case REMMINA_PROTOCOL_SSH_SETTING_SSH: + case REMMINA_PROTOCOL_SSH_SETTING_SFTP: + priv->ssh_server_default_radio = NULL; + priv->ssh_server_custom_radio = NULL; + priv->ssh_server_entry = NULL; + + s = remmina_pref_get_recent ("SFTP"); + priv->server_combo = remmina_file_editor_create_combo (gfe, grid, row + 1, 1, + _("Server"), s, remmina_file_get_string (priv->remmina_file, "server")); + gtk_widget_set_tooltip_markup (priv->server_combo, _(server_tips)); + gtk_entry_set_activates_default (GTK_ENTRY(gtk_bin_get_child (GTK_BIN (priv->server_combo))), TRUE); + g_free(s); + row++; + break; - default: - break; + default: + break; } priv->ssh_charset_combo = remmina_file_editor_create_combo (gfe, grid, row + 3, 0, - _("Character set"), charset_list, remmina_file_get_string (priv->remmina_file, "ssh_charset")); + _("Character set"), charset_list, remmina_file_get_string (priv->remmina_file, "ssh_charset")); row++; if (ssh_setting == REMMINA_PROTOCOL_SSH_SETTING_SSH) { widget = remmina_file_editor_create_text (gfe, grid, row + 7, 1, - _("Startup program"), NULL); + _("Startup program"), NULL); cs = remmina_file_get_string (priv->remmina_file, "exec"); gtk_entry_set_text(GTK_ENTRY(widget), cs ? cs : ""); g_hash_table_insert(priv->setting_widgets, "exec", widget); row++; } else if (ssh_setting == REMMINA_PROTOCOL_SSH_SETTING_SFTP) { widget = remmina_file_editor_create_text (gfe, grid, row + 8, 1, - _("Startup path"), NULL); + _("Startup path"), NULL); cs = remmina_file_get_string (priv->remmina_file, "execpath"); gtk_entry_set_text(GTK_ENTRY(widget), cs ? cs : ""); g_hash_table_insert(priv->setting_widgets, "execpath", widget); @@ -831,23 +833,30 @@ static void remmina_file_editor_create_ssh_tab(RemminaFileEditor* gfe, RemminaPr } /* SSH Authentication frame */ - remmina_public_create_group (GTK_GRID(grid), _("SSH Authentication"), row + 8, 5, 1); + remmina_public_create_group (GTK_GRID(grid), _("SSH Authentication"), row + 8, 6, 1); row++; priv->ssh_username_entry = remmina_file_editor_create_text (gfe, grid, row + 10, 0, - _("User name"), NULL); + _("User name"), NULL); row++; - widget = gtk_radio_button_new_with_label (NULL, _("Password")); + widget = gtk_radio_button_new_with_label (NULL, _("SSH Agent (automatic)")); gtk_widget_show(widget); gtk_grid_attach (GTK_GRID(grid), widget, 0, row + 19, 1, 1); + priv->ssh_auth_agent_radio = widget; + row++; + + widget = gtk_radio_button_new_with_label_from_widget ( + GTK_RADIO_BUTTON(priv->ssh_auth_agent_radio), _("Password")); + gtk_widget_show(widget); + gtk_grid_attach (GTK_GRID(grid), widget, 0, row + 21, 1, 1); priv->ssh_auth_password_radio = widget; row++; widget = gtk_radio_button_new_with_label_from_widget ( - GTK_RADIO_BUTTON(priv->ssh_auth_password_radio), _("Public key (automatic)")); + GTK_RADIO_BUTTON(priv->ssh_auth_password_radio), _("Public key (automatic)")); gtk_widget_show(widget); - gtk_grid_attach (GTK_GRID(grid), widget, 0, row + 20, 1, 1); + gtk_grid_attach (GTK_GRID(grid), widget, 0, row + 22, 1, 1); priv->ssh_auth_auto_publickey_radio = widget; row++; @@ -858,31 +867,33 @@ static void remmina_file_editor_create_ssh_tab(RemminaFileEditor* gfe, RemminaPr cs = remmina_file_get_string (priv->remmina_file, "ssh_server"); if (ssh_setting == REMMINA_PROTOCOL_SSH_SETTING_TUNNEL) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(priv->ssh_enabled_check), - remmina_file_get_int (priv->remmina_file, "ssh_enabled", FALSE)); + remmina_file_get_int (priv->remmina_file, "ssh_enabled", FALSE)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(priv->ssh_loopback_check), - remmina_file_get_int (priv->remmina_file, "ssh_loopback", FALSE)); + remmina_file_get_int (priv->remmina_file, "ssh_loopback", FALSE)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(cs ? - priv->ssh_server_custom_radio : priv->ssh_server_default_radio), TRUE); + priv->ssh_server_custom_radio : priv->ssh_server_default_radio), TRUE); gtk_entry_set_text(GTK_ENTRY(priv->ssh_server_entry), - cs ? cs : ""); + cs ? cs : ""); } else if (ssh_setting == REMMINA_PROTOCOL_SSH_SETTING_REVERSE_TUNNEL) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(priv->ssh_enabled_check), - remmina_file_get_int (priv->remmina_file, "ssh_enabled", FALSE)); + remmina_file_get_int (priv->remmina_file, "ssh_enabled", FALSE)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(priv->ssh_loopback_check), - remmina_file_get_int (priv->remmina_file, "ssh_loopback", FALSE)); + remmina_file_get_int (priv->remmina_file, "ssh_loopback", FALSE)); gtk_entry_set_text(GTK_ENTRY(priv->ssh_server_entry), - cs ? cs : ""); + cs ? cs : ""); } cs = remmina_file_get_string (priv->remmina_file, "ssh_username"); gtk_entry_set_text(GTK_ENTRY(priv->ssh_username_entry), cs ? cs : ""); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON( - remmina_file_get_int (priv->remmina_file, "ssh_auth", 0) == SSH_AUTH_PUBLICKEY ? - priv->ssh_auth_publickey_radio : - remmina_file_get_int (priv->remmina_file, "ssh_auth", 0) == SSH_AUTH_AUTO_PUBLICKEY ? - priv->ssh_auth_auto_publickey_radio : - priv->ssh_auth_password_radio), TRUE); + remmina_file_get_int (priv->remmina_file, "ssh_auth", 0) == SSH_AUTH_PUBLICKEY ? + priv->ssh_auth_publickey_radio : + remmina_file_get_int (priv->remmina_file, "ssh_auth", 0) == SSH_AUTH_AUTO_PUBLICKEY ? + priv->ssh_auth_auto_publickey_radio : + remmina_file_get_int (priv->remmina_file, "ssh_auth", 0) == SSH_AUTH_AGENT ? + priv->ssh_auth_agent_radio : + priv->ssh_auth_password_radio), TRUE); remmina_file_editor_ssh_enabled_check_on_toggled (NULL, gfe); #endif @@ -936,6 +947,7 @@ static void remmina_file_editor_protocol_combo_on_changed(GtkComboBox* combo, Re priv->ssh_server_custom_radio = NULL; priv->ssh_server_entry = NULL; priv->ssh_username_entry = NULL; + priv->ssh_auth_agent_radio = NULL; priv->ssh_auth_password_radio = NULL; priv->ssh_auth_publickey_radio = NULL; priv->ssh_auth_auto_publickey_radio = NULL; @@ -961,7 +973,7 @@ static void remmina_file_editor_update_ssh(RemminaFileEditor* gfe) if (priv->ssh_charset_combo) { remmina_file_set_string_ref(priv->remmina_file, "ssh_charset", - remmina_public_combo_get_active_text(GTK_COMBO_BOX(priv->ssh_charset_combo))); + remmina_public_combo_get_active_text(GTK_COMBO_BOX(priv->ssh_charset_combo))); } if (g_strcmp0(remmina_file_get_string(priv->remmina_file, "protocol"), "SFTP") == 0 @@ -969,41 +981,45 @@ static void remmina_file_editor_update_ssh(RemminaFileEditor* gfe) ssh_enabled = TRUE; } else { ssh_enabled = (priv->ssh_enabled_check ? - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->ssh_enabled_check)) : FALSE); + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->ssh_enabled_check)) : FALSE); remmina_file_set_int( - priv->remmina_file, - "ssh_loopback", - (priv->ssh_loopback_check ? - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->ssh_loopback_check)) : - FALSE)); + priv->remmina_file, + "ssh_loopback", + (priv->ssh_loopback_check ? + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->ssh_loopback_check)) : + FALSE)); } remmina_file_set_int(priv->remmina_file, "ssh_enabled", ssh_enabled); remmina_file_set_string(priv->remmina_file, "ssh_username", - (ssh_enabled ? gtk_entry_get_text(GTK_ENTRY(priv->ssh_username_entry)) : NULL)); + (ssh_enabled ? gtk_entry_get_text(GTK_ENTRY(priv->ssh_username_entry)) : NULL)); remmina_file_set_string( - priv->remmina_file, - "ssh_server", - (ssh_enabled && priv->ssh_server_entry - && (priv->ssh_server_custom_radio == NULL - || gtk_toggle_button_get_active( - GTK_TOGGLE_BUTTON(priv->ssh_server_custom_radio))) ? - gtk_entry_get_text(GTK_ENTRY(priv->ssh_server_entry)) : NULL)); + priv->remmina_file, + "ssh_server", + (ssh_enabled && priv->ssh_server_entry + && (priv->ssh_server_custom_radio == NULL + || gtk_toggle_button_get_active( + GTK_TOGGLE_BUTTON(priv->ssh_server_custom_radio))) ? + gtk_entry_get_text(GTK_ENTRY(priv->ssh_server_entry)) : NULL)); remmina_file_set_int( - priv->remmina_file, - "ssh_auth", - (priv->ssh_auth_publickey_radio - && gtk_toggle_button_get_active( - GTK_TOGGLE_BUTTON(priv->ssh_auth_publickey_radio)) ? - SSH_AUTH_PUBLICKEY : - priv->ssh_auth_auto_publickey_radio - && gtk_toggle_button_get_active( - GTK_TOGGLE_BUTTON(priv->ssh_auth_auto_publickey_radio)) ? - SSH_AUTH_AUTO_PUBLICKEY : SSH_AUTH_PASSWORD)); + priv->remmina_file, + "ssh_auth", + (priv->ssh_auth_publickey_radio + && gtk_toggle_button_get_active( + GTK_TOGGLE_BUTTON(priv->ssh_auth_publickey_radio)) ? + SSH_AUTH_PUBLICKEY : + priv->ssh_auth_auto_publickey_radio + && gtk_toggle_button_get_active( + GTK_TOGGLE_BUTTON(priv->ssh_auth_auto_publickey_radio)) ? + SSH_AUTH_AUTO_PUBLICKEY : + priv->ssh_auth_agent_radio + && gtk_toggle_button_get_active( + GTK_TOGGLE_BUTTON(priv->ssh_auth_agent_radio)) ? + SSH_AUTH_AGENT: SSH_AUTH_PASSWORD)); remmina_file_set_string( - priv->remmina_file, - "ssh_privatekey", - (priv->ssh_privatekey_chooser ? - gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(priv->ssh_privatekey_chooser)) : NULL)); + priv->remmina_file, + "ssh_privatekey", + (priv->ssh_privatekey_chooser ? + gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(priv->ssh_privatekey_chooser)) : NULL)); } static void remmina_file_editor_update_settings(RemminaFileEditor* gfe) diff --git a/remmina/src/remmina_ssh.c b/remmina/src/remmina_ssh.c index 3e8720c1b..395f18f8b 100644 --- a/remmina/src/remmina_ssh.c +++ b/remmina/src/remmina_ssh.c @@ -223,6 +223,22 @@ remmina_ssh_auth_auto_pubkey (RemminaSSH* ssh) return 1; } +static gint +remmina_ssh_auth_agent (RemminaSSH* ssh) +{ + TRACE_CALL("remmina_ssh_auth_agent"); + gint ret; + ret = ssh_userauth_agent (ssh->session, NULL); + + if (ret != SSH_AUTH_SUCCESS) { + remmina_ssh_set_error (ssh, _("SSH public key authentication with ssh agent failed: %s")); + return 0; + } + + ssh->authenticated = TRUE; + return 1; +} + gint remmina_ssh_auth (RemminaSSH *ssh, const gchar *password) { @@ -247,6 +263,9 @@ remmina_ssh_auth (RemminaSSH *ssh, const gchar *password) case SSH_AUTH_PUBLICKEY: return remmina_ssh_auth_pubkey (ssh); + case SSH_AUTH_AGENT: + return remmina_ssh_auth_agent (ssh); + case SSH_AUTH_AUTO_PUBLICKEY: return remmina_ssh_auth_auto_pubkey (ssh); -- cgit v1.2.3 From 7acf446dacacafdd1f0ccad76ea091486d9aa8c0 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Tue, 15 Sep 2015 00:08:47 +0200 Subject: Code cleaning --- remmina/src/remmina_ssh.c | 446 +++++++++++++++++++++++----------------------- 1 file changed, 223 insertions(+), 223 deletions(-) diff --git a/remmina/src/remmina_ssh.c b/remmina/src/remmina_ssh.c index 395f18f8b..bbb09030f 100644 --- a/remmina/src/remmina_ssh.c +++ b/remmina/src/remmina_ssh.c @@ -91,7 +91,7 @@ static const gchar *common_identities[] = { NULL }; -gchar* + gchar* remmina_ssh_identity_path (const gchar *id) { TRACE_CALL("remmina_ssh_identity_path"); @@ -100,7 +100,7 @@ remmina_ssh_identity_path (const gchar *id) return g_strdup_printf("%s/%s", g_get_home_dir (), id); } -gchar* + gchar* remmina_ssh_find_identity (void) { TRACE_CALL("remmina_ssh_find_identity"); @@ -117,7 +117,7 @@ remmina_ssh_find_identity (void) return NULL; } -void + void remmina_ssh_set_error (RemminaSSH *ssh, const gchar *fmt) { TRACE_CALL("remmina_ssh_set_error"); @@ -127,7 +127,7 @@ remmina_ssh_set_error (RemminaSSH *ssh, const gchar *fmt) ssh->error = g_strdup_printf(fmt, err); } -void + void remmina_ssh_set_application_error (RemminaSSH *ssh, const gchar *fmt, ...) { TRACE_CALL("remmina_ssh_set_application_error"); @@ -138,7 +138,7 @@ remmina_ssh_set_application_error (RemminaSSH *ssh, const gchar *fmt, ...) va_end (args); } -static gint + static gint remmina_ssh_auth_password (RemminaSSH *ssh) { TRACE_CALL("remmina_ssh_auth_password"); @@ -172,7 +172,7 @@ remmina_ssh_auth_password (RemminaSSH *ssh) return 1; } -static gint + static gint remmina_ssh_auth_pubkey (RemminaSSH *ssh) { TRACE_CALL("remmina_ssh_auth_pubkey"); @@ -188,7 +188,7 @@ remmina_ssh_auth_pubkey (RemminaSSH *ssh) } if ( ssh_pki_import_privkey_file( ssh->privkeyfile, (ssh->password ? ssh->password : ""), - NULL, NULL, &priv_key ) != SSH_OK ) { + NULL, NULL, &priv_key ) != SSH_OK ) { if (ssh->password == NULL || ssh->password[0] == '\0') return -1; remmina_ssh_set_error (ssh, _("SSH public key authentication failed: %s")); @@ -207,7 +207,7 @@ remmina_ssh_auth_pubkey (RemminaSSH *ssh) return 1; } -static gint + static gint remmina_ssh_auth_auto_pubkey (RemminaSSH* ssh) { TRACE_CALL("remmina_ssh_auth_auto_pubkey"); @@ -223,7 +223,7 @@ remmina_ssh_auth_auto_pubkey (RemminaSSH* ssh) return 1; } -static gint + static gint remmina_ssh_auth_agent (RemminaSSH* ssh) { TRACE_CALL("remmina_ssh_auth_agent"); @@ -239,12 +239,12 @@ remmina_ssh_auth_agent (RemminaSSH* ssh) return 1; } -gint + gint remmina_ssh_auth (RemminaSSH *ssh, const gchar *password) { TRACE_CALL("remmina_ssh_auth"); /* Check known host again to ensure it's still the original server when user forks - a new session from existing one */ + a new session from existing one */ if (ssh_is_server_known (ssh->session) != SSH_SERVER_KNOWN_OK) { remmina_ssh_set_application_error (ssh, "SSH public key has changed!"); return 0; @@ -257,24 +257,24 @@ remmina_ssh_auth (RemminaSSH *ssh, const gchar *password) switch (ssh->auth) { - case SSH_AUTH_PASSWORD: - return remmina_ssh_auth_password (ssh); + case SSH_AUTH_PASSWORD: + return remmina_ssh_auth_password (ssh); - case SSH_AUTH_PUBLICKEY: - return remmina_ssh_auth_pubkey (ssh); + case SSH_AUTH_PUBLICKEY: + return remmina_ssh_auth_pubkey (ssh); - case SSH_AUTH_AGENT: - return remmina_ssh_auth_agent (ssh); + case SSH_AUTH_AGENT: + return remmina_ssh_auth_agent (ssh); - case SSH_AUTH_AUTO_PUBLICKEY: - return remmina_ssh_auth_auto_pubkey (ssh); + case SSH_AUTH_AUTO_PUBLICKEY: + return remmina_ssh_auth_auto_pubkey (ssh); - default: - return 0; + default: + return 0; } } -gint + gint remmina_ssh_auth_gui (RemminaSSH *ssh, RemminaInitDialog *dialog) { TRACE_CALL("remmina_ssh_auth_gui"); @@ -288,42 +288,42 @@ remmina_ssh_auth_gui (RemminaSSH *ssh, RemminaInitDialog *dialog) /* Check if the server's public key is known */ ret = ssh_is_server_known (ssh->session); switch (ret) { - case SSH_SERVER_KNOWN_OK: - break; /* ok */ - - case SSH_SERVER_FILE_NOT_FOUND: - /* fallback to SSH_SERVER_NOT_KNOWN behavior */ - case SSH_SERVER_NOT_KNOWN: - case SSH_SERVER_KNOWN_CHANGED: - case SSH_SERVER_FOUND_OTHER: - if ( ssh_get_publickey(ssh->session, &server_pubkey) != SSH_OK ) { - remmina_ssh_set_error(ssh, "ssh_get_publickey() has failed: %s"); - return 0; - } - if ( ssh_get_publickey_hash(server_pubkey, SSH_PUBLICKEY_HASH_MD5, &pubkey, &len) != 0 ) { + case SSH_SERVER_KNOWN_OK: + break; /* ok */ + + case SSH_SERVER_FILE_NOT_FOUND: + /* fallback to SSH_SERVER_NOT_KNOWN behavior */ + case SSH_SERVER_NOT_KNOWN: + case SSH_SERVER_KNOWN_CHANGED: + case SSH_SERVER_FOUND_OTHER: + if ( ssh_get_publickey(ssh->session, &server_pubkey) != SSH_OK ) { + remmina_ssh_set_error(ssh, "ssh_get_publickey() has failed: %s"); + return 0; + } + if ( ssh_get_publickey_hash(server_pubkey, SSH_PUBLICKEY_HASH_MD5, &pubkey, &len) != 0 ) { + ssh_key_free(server_pubkey); + remmina_ssh_set_error(ssh, "ssh_get_publickey_hash() has failed: %s"); + return 0; + } ssh_key_free(server_pubkey); - remmina_ssh_set_error(ssh, "ssh_get_publickey_hash() has failed: %s"); - return 0; - } - ssh_key_free(server_pubkey); - keyname = ssh_get_hexa (pubkey, len); + keyname = ssh_get_hexa (pubkey, len); - if (ret == SSH_SERVER_NOT_KNOWN || ret == SSH_SERVER_FILE_NOT_FOUND) { - ret = remmina_init_dialog_serverkey_unknown (dialog, keyname); - } else { - ret = remmina_init_dialog_serverkey_changed (dialog, keyname); - } + if (ret == SSH_SERVER_NOT_KNOWN || ret == SSH_SERVER_FILE_NOT_FOUND) { + ret = remmina_init_dialog_serverkey_unknown (dialog, keyname); + } else { + ret = remmina_init_dialog_serverkey_changed (dialog, keyname); + } - ssh_string_free_char(keyname); - ssh_clean_pubkey_hash (&pubkey); - if (ret != GTK_RESPONSE_OK) return -1; - ssh_write_knownhost (ssh->session); - break; - case SSH_SERVER_ERROR: - default: - remmina_ssh_set_error (ssh, "SSH known host checking failed: %s"); - return 0; + ssh_string_free_char(keyname); + ssh_clean_pubkey_hash (&pubkey); + if (ret != GTK_RESPONSE_OK) return -1; + ssh_write_knownhost (ssh->session); + break; + case SSH_SERVER_ERROR: + default: + remmina_ssh_set_error (ssh, "SSH known host checking failed: %s"); + return 0; } /* Try empty password or existing password first */ @@ -335,16 +335,16 @@ remmina_ssh_auth_gui (RemminaSSH *ssh, RemminaInitDialog *dialog) if (!dialog) return -1; switch (ssh->auth) { - case SSH_AUTH_PASSWORD: - tips = _("Authenticating %s's password to SSH server %s..."); - keyname = _("SSH password"); - break; - case SSH_AUTH_PUBLICKEY: - tips = _("Authenticating %s's identity to SSH server %s..."); - keyname = _("SSH private key passphrase"); - break; - default: - return FALSE; + case SSH_AUTH_PASSWORD: + tips = _("Authenticating %s's password to SSH server %s..."); + keyname = _("SSH password"); + break; + case SSH_AUTH_PUBLICKEY: + tips = _("Authenticating %s's identity to SSH server %s..."); + keyname = _("SSH private key passphrase"); + break; + default: + return FALSE; } if (ssh->auth != SSH_AUTH_AUTO_PUBLICKEY) { @@ -363,14 +363,14 @@ remmina_ssh_auth_gui (RemminaSSH *ssh, RemminaInitDialog *dialog) return 1; } -void + void remmina_ssh_log_callback(ssh_session session, int priority, const char *message, void *userdata) { TRACE_CALL("remmina_ssh_log_callback"); remmina_log_printf ("[SSH] %s\n", message); } -gboolean + gboolean remmina_ssh_init_session (RemminaSSH *ssh) { TRACE_CALL("remmina_ssh_init_session"); @@ -406,7 +406,7 @@ remmina_ssh_init_session (RemminaSSH *ssh) return TRUE; } -gboolean + gboolean remmina_ssh_init_from_file (RemminaSSH *ssh, RemminaFile *remminafile) { TRACE_CALL("remmina_ssh_init_from_file"); @@ -458,7 +458,7 @@ remmina_ssh_init_from_file (RemminaSSH *ssh, RemminaFile *remminafile) return TRUE; } -static gboolean + static gboolean remmina_ssh_init_from_ssh (RemminaSSH *ssh, const RemminaSSH *ssh_src) { TRACE_CALL("remmina_ssh_init_from_ssh"); @@ -478,7 +478,7 @@ remmina_ssh_init_from_ssh (RemminaSSH *ssh, const RemminaSSH *ssh_src) return TRUE; } -gchar* + gchar* remmina_ssh_convert (RemminaSSH *ssh, const gchar *from) { TRACE_CALL("remmina_ssh_convert"); @@ -491,7 +491,7 @@ remmina_ssh_convert (RemminaSSH *ssh, const gchar *from) return to; } -gchar* + gchar* remmina_ssh_unconvert (RemminaSSH *ssh, const gchar *from) { TRACE_CALL("remmina_ssh_unconvert"); @@ -504,7 +504,7 @@ remmina_ssh_unconvert (RemminaSSH *ssh, const gchar *from) return to; } -void + void remmina_ssh_free (RemminaSSH *ssh) { TRACE_CALL("remmina_ssh_free"); @@ -533,7 +533,7 @@ struct _RemminaSSHTunnelBuffer { ssize_t len; }; -static RemminaSSHTunnelBuffer* + static RemminaSSHTunnelBuffer* remmina_ssh_tunnel_buffer_new (ssize_t len) { TRACE_CALL("remmina_ssh_tunnel_buffer_new"); @@ -546,7 +546,7 @@ remmina_ssh_tunnel_buffer_new (ssize_t len) return buffer; } -static void + static void remmina_ssh_tunnel_buffer_free (RemminaSSHTunnelBuffer *buffer) { TRACE_CALL("remmina_ssh_tunnel_buffer_free"); @@ -556,7 +556,7 @@ remmina_ssh_tunnel_buffer_free (RemminaSSHTunnelBuffer *buffer) } } -RemminaSSHTunnel* + RemminaSSHTunnel* remmina_ssh_tunnel_new_from_file (RemminaFile *remminafile) { TRACE_CALL("remmina_ssh_tunnel_new_from_file"); @@ -591,7 +591,7 @@ remmina_ssh_tunnel_new_from_file (RemminaFile *remminafile) return tunnel; } -static void + static void remmina_ssh_tunnel_close_all_channels (RemminaSSHTunnel *tunnel) { TRACE_CALL("remmina_ssh_tunnel_close_all_channels"); @@ -621,7 +621,7 @@ remmina_ssh_tunnel_close_all_channels (RemminaSSHTunnel *tunnel) } } -static void + static void remmina_ssh_tunnel_remove_channel (RemminaSSHTunnel *tunnel, gint n) { TRACE_CALL("remmina_ssh_tunnel_remove_channel"); @@ -637,7 +637,7 @@ remmina_ssh_tunnel_remove_channel (RemminaSSHTunnel *tunnel, gint n) } /* Register the new channel/socket pair */ -static void + static void remmina_ssh_tunnel_add_channel (RemminaSSHTunnel *tunnel, ssh_channel channel, gint sock) { TRACE_CALL("remmina_ssh_tunnel_add_channel"); @@ -667,7 +667,7 @@ remmina_ssh_tunnel_add_channel (RemminaSSHTunnel *tunnel, ssh_channel channel, g fcntl (sock, F_SETFL, flags | O_NONBLOCK); } -static gpointer + static gpointer remmina_ssh_tunnel_main_thread_proc (gpointer data) { TRACE_CALL("remmina_ssh_tunnel_main_thread_proc"); @@ -691,123 +691,123 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) t2 = t1; switch (tunnel->tunnel_type) { - case REMMINA_SSH_TUNNEL_OPEN: - /* Accept a local connection */ - sock = accept (tunnel->server_sock, NULL, NULL); - if (sock < 0) { - REMMINA_SSH (tunnel)->error = g_strdup ("Failed to accept local socket"); - tunnel->thread = 0; - return NULL; - } + case REMMINA_SSH_TUNNEL_OPEN: + /* Accept a local connection */ + sock = accept (tunnel->server_sock, NULL, NULL); + if (sock < 0) { + REMMINA_SSH (tunnel)->error = g_strdup ("Failed to accept local socket"); + tunnel->thread = 0; + return NULL; + } - if ((channel = ssh_channel_new (tunnel->ssh.session)) == NULL) { - close (sock); - remmina_ssh_set_error (REMMINA_SSH (tunnel), "Failed to createt channel : %s"); - tunnel->thread = 0; - return NULL; - } - /* Request the SSH server to connect to the destination */ - if (ssh_channel_open_forward (channel, tunnel->dest, tunnel->port, "127.0.0.1", 0) != SSH_OK) { - close (sock); - ssh_channel_close (channel); - ssh_channel_free (channel); - remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to connect to the SSH tunnel destination: %s")); - tunnel->thread = 0; - return NULL; - } - remmina_ssh_tunnel_add_channel (tunnel, channel, sock); - break; + if ((channel = ssh_channel_new (tunnel->ssh.session)) == NULL) { + close (sock); + remmina_ssh_set_error (REMMINA_SSH (tunnel), "Failed to createt channel : %s"); + tunnel->thread = 0; + return NULL; + } + /* Request the SSH server to connect to the destination */ + if (ssh_channel_open_forward (channel, tunnel->dest, tunnel->port, "127.0.0.1", 0) != SSH_OK) { + close (sock); + ssh_channel_close (channel); + ssh_channel_free (channel); + remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to connect to the SSH tunnel destination: %s")); + tunnel->thread = 0; + return NULL; + } + remmina_ssh_tunnel_add_channel (tunnel, channel, sock); + break; - case REMMINA_SSH_TUNNEL_X11: - if ((tunnel->x11_channel = ssh_channel_new (tunnel->ssh.session)) == NULL) { - remmina_ssh_set_error (REMMINA_SSH (tunnel), "Failed to create channel : %s"); - tunnel->thread = 0; - return NULL; - } - if (!remmina_public_get_xauth_cookie (tunnel->localdisplay, &ptr)) { - remmina_ssh_set_application_error (REMMINA_SSH (tunnel), "%s", ptr); - g_free(ptr); - tunnel->thread = 0; - return NULL; - } - if (ssh_channel_open_session (tunnel->x11_channel) || - ssh_channel_request_x11 (tunnel->x11_channel, TRUE, NULL, ptr, - gdk_screen_get_number (gdk_screen_get_default ()))) { - g_free(ptr); - remmina_ssh_set_error (REMMINA_SSH (tunnel), "Failed to open channel : %s"); - tunnel->thread = 0; - return NULL; - } - g_free(ptr); - if (ssh_channel_request_exec (tunnel->x11_channel, tunnel->dest)) { - ptr = g_strdup_printf(_("Failed to execute %s on SSH server : %%s"), tunnel->dest); - remmina_ssh_set_error (REMMINA_SSH (tunnel), ptr); + case REMMINA_SSH_TUNNEL_X11: + if ((tunnel->x11_channel = ssh_channel_new (tunnel->ssh.session)) == NULL) { + remmina_ssh_set_error (REMMINA_SSH (tunnel), "Failed to create channel : %s"); + tunnel->thread = 0; + return NULL; + } + if (!remmina_public_get_xauth_cookie (tunnel->localdisplay, &ptr)) { + remmina_ssh_set_application_error (REMMINA_SSH (tunnel), "%s", ptr); + g_free(ptr); + tunnel->thread = 0; + return NULL; + } + if (ssh_channel_open_session (tunnel->x11_channel) || + ssh_channel_request_x11 (tunnel->x11_channel, TRUE, NULL, ptr, + gdk_screen_get_number (gdk_screen_get_default ()))) { + g_free(ptr); + remmina_ssh_set_error (REMMINA_SSH (tunnel), "Failed to open channel : %s"); + tunnel->thread = 0; + return NULL; + } g_free(ptr); - tunnel->thread = 0; - return NULL; - } + if (ssh_channel_request_exec (tunnel->x11_channel, tunnel->dest)) { + ptr = g_strdup_printf(_("Failed to execute %s on SSH server : %%s"), tunnel->dest); + remmina_ssh_set_error (REMMINA_SSH (tunnel), ptr); + g_free(ptr); + tunnel->thread = 0; + return NULL; + } - if (tunnel->init_func && - ! (*tunnel->init_func) (tunnel, tunnel->callback_data)) { - if (tunnel->disconnect_func) { - (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); + if (tunnel->init_func && + ! (*tunnel->init_func) (tunnel, tunnel->callback_data)) { + if (tunnel->disconnect_func) { + (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); + } + tunnel->thread = 0; + return NULL; } - tunnel->thread = 0; - return NULL; - } - break; + break; - case REMMINA_SSH_TUNNEL_XPORT: - /* Detect the next available port starting from 6010 on the server */ - for (i = 10; i <= MAX_X_DISPLAY_NUMBER; i++) { - if (ssh_forward_listen (REMMINA_SSH (tunnel)->session, (tunnel->bindlocalhost ? "localhost" : NULL), 6000 + i, NULL)) { - continue; - } else { - tunnel->remotedisplay = i; - break; + case REMMINA_SSH_TUNNEL_XPORT: + /* Detect the next available port starting from 6010 on the server */ + for (i = 10; i <= MAX_X_DISPLAY_NUMBER; i++) { + if (ssh_forward_listen (REMMINA_SSH (tunnel)->session, (tunnel->bindlocalhost ? "localhost" : NULL), 6000 + i, NULL)) { + continue; + } else { + tunnel->remotedisplay = i; + break; + } } - } - if (tunnel->remotedisplay < 1) { - remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to request port forwarding : %s")); - if (tunnel->disconnect_func) { - (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); + if (tunnel->remotedisplay < 1) { + remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to request port forwarding : %s")); + if (tunnel->disconnect_func) { + (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); + } + tunnel->thread = 0; + return NULL; } - tunnel->thread = 0; - return NULL; - } - if (tunnel->init_func && - ! (*tunnel->init_func) (tunnel, tunnel->callback_data)) { - if (tunnel->disconnect_func) { - (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); + if (tunnel->init_func && + ! (*tunnel->init_func) (tunnel, tunnel->callback_data)) { + if (tunnel->disconnect_func) { + (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); + } + tunnel->thread = 0; + return NULL; } - tunnel->thread = 0; - return NULL; - } - break; + break; - case REMMINA_SSH_TUNNEL_REVERSE: - if (ssh_forward_listen (REMMINA_SSH (tunnel)->session, NULL, tunnel->port, NULL)) { - remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to request port forwarding : %s")); - if (tunnel->disconnect_func) { - (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); + case REMMINA_SSH_TUNNEL_REVERSE: + if (ssh_forward_listen (REMMINA_SSH (tunnel)->session, NULL, tunnel->port, NULL)) { + remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to request port forwarding : %s")); + if (tunnel->disconnect_func) { + (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); + } + tunnel->thread = 0; + return NULL; } - tunnel->thread = 0; - return NULL; - } - if (tunnel->init_func && - ! (*tunnel->init_func) (tunnel, tunnel->callback_data)) { - if (tunnel->disconnect_func) { - (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); + if (tunnel->init_func && + ! (*tunnel->init_func) (tunnel, tunnel->callback_data)) { + if (tunnel->disconnect_func) { + (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); + } + tunnel->thread = 0; + return NULL; } - tunnel->thread = 0; - return NULL; - } - break; + break; } tunnel->buffer_len = 10240; @@ -983,7 +983,7 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) return NULL; } -static gpointer + static gpointer remmina_ssh_tunnel_main_thread (gpointer data) { TRACE_CALL("remmina_ssh_tunnel_main_thread"); @@ -999,7 +999,7 @@ remmina_ssh_tunnel_main_thread (gpointer data) return NULL; } -void + void remmina_ssh_tunnel_cancel_accept (RemminaSSHTunnel *tunnel) { TRACE_CALL("remmina_ssh_tunnel_cancel_accept"); @@ -1009,7 +1009,7 @@ remmina_ssh_tunnel_cancel_accept (RemminaSSHTunnel *tunnel) } } -gboolean + gboolean remmina_ssh_tunnel_open (RemminaSSHTunnel* tunnel, const gchar *host, gint port, gint local_port) { TRACE_CALL("remmina_ssh_tunnel_open"); @@ -1060,7 +1060,7 @@ remmina_ssh_tunnel_open (RemminaSSHTunnel* tunnel, const gchar *host, gint port, return TRUE; } -gboolean + gboolean remmina_ssh_tunnel_x11 (RemminaSSHTunnel *tunnel, const gchar *cmd) { TRACE_CALL("remmina_ssh_tunnel_x11"); @@ -1076,7 +1076,7 @@ remmina_ssh_tunnel_x11 (RemminaSSHTunnel *tunnel, const gchar *cmd) return TRUE; } -gboolean + gboolean remmina_ssh_tunnel_xport (RemminaSSHTunnel *tunnel, gboolean bindlocalhost) { TRACE_CALL("remmina_ssh_tunnel_xport"); @@ -1092,7 +1092,7 @@ remmina_ssh_tunnel_xport (RemminaSSHTunnel *tunnel, gboolean bindlocalhost) return TRUE; } -gboolean + gboolean remmina_ssh_tunnel_reverse (RemminaSSHTunnel *tunnel, gint port, gint local_port) { TRACE_CALL("remmina_ssh_tunnel_reverse"); @@ -1109,14 +1109,14 @@ remmina_ssh_tunnel_reverse (RemminaSSHTunnel *tunnel, gint port, gint local_port return TRUE; } -gboolean + gboolean remmina_ssh_tunnel_terminated (RemminaSSHTunnel* tunnel) { TRACE_CALL("remmina_ssh_tunnel_terminated"); return (tunnel->thread == 0); } -void + void remmina_ssh_tunnel_free (RemminaSSHTunnel* tunnel) { TRACE_CALL("remmina_ssh_tunnel_free"); @@ -1151,7 +1151,7 @@ remmina_ssh_tunnel_free (RemminaSSHTunnel* tunnel) * SSH sFTP * *-----------------------------------------------------------------------------*/ -RemminaSFTP* + RemminaSFTP* remmina_sftp_new_from_file (RemminaFile *remminafile) { TRACE_CALL("remmina_sftp_new_from_file"); @@ -1166,7 +1166,7 @@ remmina_sftp_new_from_file (RemminaFile *remminafile) return sftp; } -RemminaSFTP* + RemminaSFTP* remmina_sftp_new_from_ssh (RemminaSSH *ssh) { TRACE_CALL("remmina_sftp_new_from_ssh"); @@ -1181,7 +1181,7 @@ remmina_sftp_new_from_ssh (RemminaSSH *ssh) return sftp; } -gboolean + gboolean remmina_sftp_open (RemminaSFTP *sftp) { TRACE_CALL("remmina_sftp_open"); @@ -1197,7 +1197,7 @@ remmina_sftp_open (RemminaSFTP *sftp) return TRUE; } -void + void remmina_sftp_free (RemminaSFTP *sftp) { TRACE_CALL("remmina_sftp_free"); @@ -1212,7 +1212,7 @@ remmina_sftp_free (RemminaSFTP *sftp) * SSH Shell * *-----------------------------------------------------------------------------*/ -RemminaSSHShell* + RemminaSSHShell* remmina_ssh_shell_new_from_file (RemminaFile *remminafile) { TRACE_CALL("remmina_ssh_shell_new_from_file"); @@ -1229,7 +1229,7 @@ remmina_ssh_shell_new_from_file (RemminaFile *remminafile) return shell; } -RemminaSSHShell* + RemminaSSHShell* remmina_ssh_shell_new_from_ssh (RemminaSSH *ssh) { TRACE_CALL("remmina_ssh_shell_new_from_ssh"); @@ -1245,7 +1245,7 @@ remmina_ssh_shell_new_from_ssh (RemminaSSH *ssh) return shell; } -static gboolean + static gboolean remmina_ssh_call_exit_callback_on_main_thread(gpointer data) { TRACE_CALL("remmina_ssh_call_exit_callback_on_main_thread"); @@ -1256,7 +1256,7 @@ remmina_ssh_call_exit_callback_on_main_thread(gpointer data) return FALSE; } -static gpointer + static gpointer remmina_ssh_shell_thread (gpointer data) { TRACE_CALL("remmina_ssh_shell_thread"); @@ -1272,14 +1272,14 @@ remmina_ssh_shell_thread (gpointer data) LOCK_SSH (shell) - if ((channel = ssh_channel_new (REMMINA_SSH (shell)->session)) == NULL || - ssh_channel_open_session (channel)) { - UNLOCK_SSH (shell) - remmina_ssh_set_error (REMMINA_SSH (shell), "Failed to open channel : %s"); - if (channel) ssh_channel_free (channel); - shell->thread = 0; - return NULL; - } + if ((channel = ssh_channel_new (REMMINA_SSH (shell)->session)) == NULL || + ssh_channel_open_session (channel)) { + UNLOCK_SSH (shell) + remmina_ssh_set_error (REMMINA_SSH (shell), "Failed to open channel : %s"); + if (channel) ssh_channel_free (channel); + shell->thread = 0; + return NULL; + } ssh_channel_request_pty (channel); if (shell->exec && shell->exec[0]) { @@ -1289,7 +1289,7 @@ remmina_ssh_shell_thread (gpointer data) } if (ret) { UNLOCK_SSH (shell) - remmina_ssh_set_error (REMMINA_SSH (shell), "Failed to request shell : %s"); + remmina_ssh_set_error (REMMINA_SSH (shell), "Failed to request shell : %s"); ssh_channel_close (channel); ssh_channel_free (channel); shell->thread = 0; @@ -1300,7 +1300,7 @@ remmina_ssh_shell_thread (gpointer data) UNLOCK_SSH (shell) - buf_len = 1000; + buf_len = 1000; buf = g_malloc (buf_len + 1); ch[0] = channel; @@ -1321,29 +1321,29 @@ remmina_ssh_shell_thread (gpointer data) len = read (shell->master, buf, buf_len); if (len <= 0) break; LOCK_SSH (shell) - ssh_channel_write (channel, buf, len); + ssh_channel_write (channel, buf, len); UNLOCK_SSH (shell) } for (i = 0; i < 2; i++) { LOCK_SSH (shell) - len = ssh_channel_poll (channel, i); + len = ssh_channel_poll (channel, i); UNLOCK_SSH (shell) - if (len == SSH_ERROR || len == SSH_EOF) { - shell->closed = TRUE; - break; - } + if (len == SSH_ERROR || len == SSH_EOF) { + shell->closed = TRUE; + break; + } if (len <= 0) continue; if (len > buf_len) { buf_len = len; buf = (gchar*) g_realloc (buf, buf_len + 1); } LOCK_SSH (shell) - len = ssh_channel_read_nonblocking (channel, buf, len, i); + len = ssh_channel_read_nonblocking (channel, buf, len, i); UNLOCK_SSH (shell) - if (len <= 0) { - shell->closed = TRUE; - break; - } + if (len <= 0) { + shell->closed = TRUE; + break; + } while (len > 0) { ret = write (shell->master, buf, len); if (ret <= 0) break; @@ -1353,12 +1353,12 @@ remmina_ssh_shell_thread (gpointer data) } LOCK_SSH (shell) - shell->channel = NULL; + shell->channel = NULL; ssh_channel_close (channel); ssh_channel_free (channel); UNLOCK_SSH (shell) - g_free(buf); + g_free(buf); shell->thread = 0; if ( shell->exit_callback ) { @@ -1368,7 +1368,7 @@ remmina_ssh_shell_thread (gpointer data) } -gboolean + gboolean remmina_ssh_shell_open (RemminaSSHShell *shell, RemminaSSHExitFunc exit_callback, gpointer data) { TRACE_CALL("remmina_ssh_shell_open"); @@ -1400,18 +1400,18 @@ remmina_ssh_shell_open (RemminaSSHShell *shell, RemminaSSHExitFunc exit_callback return TRUE; } -void + void remmina_ssh_shell_set_size (RemminaSSHShell *shell, gint columns, gint rows) { TRACE_CALL("remmina_ssh_shell_set_size"); LOCK_SSH (shell) - if (shell->channel) { - ssh_channel_change_pty_size (shell->channel, columns, rows); - } + if (shell->channel) { + ssh_channel_change_pty_size (shell->channel, columns, rows); + } UNLOCK_SSH (shell) } -void + void remmina_ssh_shell_free (RemminaSSHShell *shell) { TRACE_CALL("remmina_ssh_shell_free"); -- cgit v1.2.3 From 68418e82579e55e0dd5f33a93911081b120362fc Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Tue, 15 Sep 2015 16:13:21 +0200 Subject: Code hidentation cleaning --- remmina/src/remmina_protocol_widget.c | 146 +++++++++++++++++----------------- 1 file changed, 73 insertions(+), 73 deletions(-) diff --git a/remmina/src/remmina_protocol_widget.c b/remmina/src/remmina_protocol_widget.c index e08594bcf..03daf5de4 100644 --- a/remmina/src/remmina_protocol_widget.c +++ b/remmina/src/remmina_protocol_widget.c @@ -77,13 +77,13 @@ struct _RemminaProtocolWidgetPriv { G_DEFINE_TYPE(RemminaProtocolWidget, remmina_protocol_widget, GTK_TYPE_EVENT_BOX) -enum { - CONNECT_SIGNAL, - DISCONNECT_SIGNAL, - DESKTOP_RESIZE_SIGNAL, - UPDATE_ALIGN_SIGNAL, - LAST_SIGNAL -}; + enum { + CONNECT_SIGNAL, + DISCONNECT_SIGNAL, + DESKTOP_RESIZE_SIGNAL, + UPDATE_ALIGN_SIGNAL, + LAST_SIGNAL + }; typedef struct _RemminaProtocolWidgetSignalData { RemminaProtocolWidget* gp; @@ -203,11 +203,11 @@ void remmina_protocol_widget_open_connection_real(gpointer data) /* Locate the protocol plugin */ plugin = (RemminaProtocolPlugin*) remmina_plugin_manager_get_plugin(REMMINA_PLUGIN_TYPE_PROTOCOL, - remmina_file_get_string(remminafile, "protocol")); + remmina_file_get_string(remminafile, "protocol")); if (!plugin || !plugin->init || !plugin->open_connection) { remmina_protocol_widget_set_error(gp, _("Protocol plugin %s is not installed."), - remmina_file_get_string(remminafile, "protocol")); + remmina_file_get_string(remminafile, "protocol")); remmina_protocol_widget_close_connection(gp); return; } @@ -350,8 +350,8 @@ void remmina_protocol_widget_send_keystrokes(RemminaProtocolWidget* gp, GtkMenuI /* Replace special characters */ for (i = 0; keystrokes_replaces[i].replace; i++) { remmina_public_str_replace_in_place(keystrokes, - keystrokes_replaces[i].search, - keystrokes_replaces[i].replace); + keystrokes_replaces[i].search, + keystrokes_replaces[i].replace); } keyvals = (guint *) g_malloc(strlen(keystrokes)); while(TRUE) { @@ -471,24 +471,24 @@ void remmina_protocol_widget_call_feature_by_ref(RemminaProtocolWidget* gp, cons TRACE_CALL("remmina_protocol_widget_call_feature_by_ref"); switch (feature->id) { #ifdef HAVE_LIBSSH - case REMMINA_PROTOCOL_FEATURE_TOOL_SSH: - if (gp->priv->ssh_tunnel) { - remmina_connection_window_open_from_file_full ( - remmina_file_dup_temp_protocol (gp->priv->remmina_file, "SSH"), NULL, gp->priv->ssh_tunnel, NULL); - return; - } - break; + case REMMINA_PROTOCOL_FEATURE_TOOL_SSH: + if (gp->priv->ssh_tunnel) { + remmina_connection_window_open_from_file_full ( + remmina_file_dup_temp_protocol (gp->priv->remmina_file, "SSH"), NULL, gp->priv->ssh_tunnel, NULL); + return; + } + break; - case REMMINA_PROTOCOL_FEATURE_TOOL_SFTP: - if (gp->priv->ssh_tunnel) { - remmina_connection_window_open_from_file_full ( - remmina_file_dup_temp_protocol (gp->priv->remmina_file, "SFTP"), NULL, gp->priv->ssh_tunnel, NULL); - return; - } - break; + case REMMINA_PROTOCOL_FEATURE_TOOL_SFTP: + if (gp->priv->ssh_tunnel) { + remmina_connection_window_open_from_file_full ( + remmina_file_dup_temp_protocol (gp->priv->remmina_file, "SFTP"), NULL, gp->priv->ssh_tunnel, NULL); + return; + } + break; #endif - default: - break; + default: + break; } gp->priv->plugin->call_feature(gp, feature); } @@ -537,7 +537,7 @@ static gboolean remmina_protocol_widget_init_tunnel (RemminaProtocolWidget* gp) tunnel = remmina_ssh_tunnel_new_from_file (gp->priv->remmina_file); remmina_init_dialog_set_status (REMMINA_INIT_DIALOG (gp->priv->init_dialog), - _("Connecting to SSH server %s..."), REMMINA_SSH (tunnel)->server); + _("Connecting to SSH server %s..."), REMMINA_SSH (tunnel)->server); if (!remmina_ssh_init_session (REMMINA_SSH (tunnel))) { remmina_protocol_widget_set_error (gp, REMMINA_SSH (tunnel)->error); @@ -594,7 +594,7 @@ gchar* remmina_protocol_widget_start_direct_tunnel(RemminaProtocolWidget* gp, gi } remmina_init_dialog_set_status (REMMINA_INIT_DIALOG (gp->priv->init_dialog), - _("Connecting to %s through SSH tunnel..."), server); + _("Connecting to %s through SSH tunnel..."), server); if (remmina_file_get_int (gp->priv->remmina_file, "ssh_loopback", FALSE)) { g_free(host); @@ -632,7 +632,7 @@ gboolean remmina_protocol_widget_start_reverse_tunnel(RemminaProtocolWidget* gp, } remmina_init_dialog_set_status (REMMINA_INIT_DIALOG (gp->priv->init_dialog), - _("Waiting for an incoming SSH tunnel at port %i..."), remmina_file_get_int (gp->priv->remmina_file, "listenport", 0)); + _("Waiting for an incoming SSH tunnel at port %i..."), remmina_file_get_int (gp->priv->remmina_file, "listenport", 0)); if (!remmina_ssh_tunnel_reverse (gp->priv->ssh_tunnel, remmina_file_get_int (gp->priv->remmina_file, "listenport", 0), local_port)) { remmina_protocol_widget_set_error (gp, REMMINA_SSH (gp->priv->ssh_tunnel)->error); @@ -670,17 +670,17 @@ gboolean remmina_protocol_widget_ssh_exec(RemminaProtocolWidget* gp, gboolean wa ptr = strchr (cmd, ' '); if (ptr) *ptr = '\0'; switch (status) { - case 0: - ret = TRUE; - break; - case 127: - remmina_ssh_set_application_error (REMMINA_SSH (tunnel), - _("Command %s not found on SSH server"), cmd); - break; - default: - remmina_ssh_set_application_error (REMMINA_SSH (tunnel), - _("Command %s failed on SSH server (status = %i)."), cmd,status); - break; + case 0: + ret = TRUE; + break; + case 127: + remmina_ssh_set_application_error (REMMINA_SSH (tunnel), + _("Command %s not found on SSH server"), cmd); + break; + default: + remmina_ssh_set_application_error (REMMINA_SSH (tunnel), + _("Command %s failed on SSH server (status = %i)."), cmd,status); + break; } } else { ret = TRUE; @@ -748,7 +748,7 @@ gboolean remmina_protocol_widget_start_xport_tunnel(RemminaProtocolWidget* gp, R if (!remmina_protocol_widget_init_tunnel (gp)) return FALSE; remmina_init_dialog_set_status (REMMINA_INIT_DIALOG (gp->priv->init_dialog), - _("Connecting to %s through SSH tunnel..."), remmina_file_get_string (gp->priv->remmina_file, "server")); + _("Connecting to %s through SSH tunnel..."), remmina_file_get_string (gp->priv->remmina_file, "server")); gp->priv->init_func = init_func; gp->priv->ssh_tunnel->init_func = remmina_protocol_widget_tunnel_init_callback; @@ -762,7 +762,7 @@ gboolean remmina_protocol_widget_start_xport_tunnel(RemminaProtocolWidget* gp, R if (!remmina_ssh_tunnel_xport (gp->priv->ssh_tunnel, bindlocalhost)) { remmina_protocol_widget_set_error (gp, "Failed to open channel : %s", - ssh_get_error (REMMINA_SSH (gp->priv->ssh_tunnel)->session)); + ssh_get_error (REMMINA_SSH (gp->priv->ssh_tunnel)->session)); return FALSE; } @@ -883,26 +883,26 @@ gint remmina_protocol_widget_init_authpwd(RemminaProtocolWidget* gp, RemminaAuth gint ret; switch (authpwd_type) { - case REMMINA_AUTHPWD_TYPE_PROTOCOL: - s = g_strdup_printf(_("%s password"), remmina_file_get_string(remminafile, "protocol")); - break; - case REMMINA_AUTHPWD_TYPE_SSH_PWD: - s = g_strdup(_("SSH password")); - break; - case REMMINA_AUTHPWD_TYPE_SSH_PRIVKEY: - s = g_strdup(_("SSH private key passphrase")); - break; - default: - s = g_strdup(_("Password")); - break; + case REMMINA_AUTHPWD_TYPE_PROTOCOL: + s = g_strdup_printf(_("%s password"), remmina_file_get_string(remminafile, "protocol")); + break; + case REMMINA_AUTHPWD_TYPE_SSH_PWD: + s = g_strdup(_("SSH password")); + break; + case REMMINA_AUTHPWD_TYPE_SSH_PRIVKEY: + s = g_strdup(_("SSH private key passphrase")); + break; + default: + s = g_strdup(_("Password")); + break; } ret = remmina_init_dialog_authpwd( - REMMINA_INIT_DIALOG(gp->priv->init_dialog), - s, - remmina_file_get_filename(remminafile) != NULL && - allow_password_saving && - authpwd_type != REMMINA_AUTHPWD_TYPE_SSH_PWD && - authpwd_type != REMMINA_AUTHPWD_TYPE_SSH_PRIVKEY); + REMMINA_INIT_DIALOG(gp->priv->init_dialog), + s, + remmina_file_get_filename(remminafile) != NULL && + allow_password_saving && + authpwd_type != REMMINA_AUTHPWD_TYPE_SSH_PWD && + authpwd_type != REMMINA_AUTHPWD_TYPE_SSH_PRIVKEY); g_free(s); return ret; @@ -914,11 +914,11 @@ gint remmina_protocol_widget_init_authuserpwd(RemminaProtocolWidget* gp, gboolea RemminaFile* remminafile = gp->priv->remmina_file; return remmina_init_dialog_authuserpwd( - REMMINA_INIT_DIALOG(gp->priv->init_dialog), - want_domain, - remmina_file_get_string(remminafile, "username"), - want_domain ? remmina_file_get_string(remminafile, "domain") : NULL, - (remmina_file_get_filename(remminafile) != NULL) && allow_password_saving); + REMMINA_INIT_DIALOG(gp->priv->init_dialog), + want_domain, + remmina_file_get_string(remminafile, "username"), + want_domain ? remmina_file_get_string(remminafile, "domain") : NULL, + (remmina_file_get_filename(remminafile) != NULL) && allow_password_saving); } gint remmina_protocol_widget_init_certificate(RemminaProtocolWidget* gp, const gchar* subject, const gchar* issuer, const gchar* fingerprint) @@ -962,8 +962,8 @@ gint remmina_protocol_widget_init_authx509(RemminaProtocolWidget* gp) RemminaFile* remminafile = gp->priv->remmina_file; return remmina_init_dialog_authx509(REMMINA_INIT_DIALOG(gp->priv->init_dialog), - remmina_file_get_string(remminafile, "cacert"), remmina_file_get_string(remminafile, "cacrl"), - remmina_file_get_string(remminafile, "clientcert"), remmina_file_get_string(remminafile, "clientkey")); + remmina_file_get_string(remminafile, "cacert"), remmina_file_get_string(remminafile, "cacrl"), + remmina_file_get_string(remminafile, "clientcert"), remmina_file_get_string(remminafile, "clientkey")); } gchar* remmina_protocol_widget_init_get_cacert(RemminaProtocolWidget* gp) @@ -1061,15 +1061,15 @@ void remmina_protocol_widget_init_show_listen(RemminaProtocolWidget* gp, gint po { TRACE_CALL("remmina_protocol_widget_init_show_listen"); remmina_init_dialog_set_status(REMMINA_INIT_DIALOG(gp->priv->init_dialog), - _("Listening on port %i for an incoming %s connection..."), port, - remmina_file_get_string(gp->priv->remmina_file, "protocol")); + _("Listening on port %i for an incoming %s connection..."), port, + remmina_file_get_string(gp->priv->remmina_file, "protocol")); } void remmina_protocol_widget_init_show_retry(RemminaProtocolWidget* gp) { TRACE_CALL("remmina_protocol_widget_init_show_retry"); remmina_init_dialog_set_status_temp(REMMINA_INIT_DIALOG(gp->priv->init_dialog), - _("Authentication failed. Trying to reconnect...")); + _("Authentication failed. Trying to reconnect...")); } void remmina_protocol_widget_init_show(RemminaProtocolWidget* gp) @@ -1091,7 +1091,7 @@ static void remmina_protocol_widget_chat_on_destroy(RemminaProtocolWidget* gp) } void remmina_protocol_widget_chat_open(RemminaProtocolWidget* gp, const gchar *name, - void(*on_send)(RemminaProtocolWidget* gp, const gchar *text), void(*on_destroy)(RemminaProtocolWidget* gp)) + void(*on_send)(RemminaProtocolWidget* gp, const gchar *text), void(*on_destroy)(RemminaProtocolWidget* gp)) { TRACE_CALL("remmina_protocol_widget_chat_open"); if (gp->priv->chat_window) { @@ -1100,7 +1100,7 @@ void remmina_protocol_widget_chat_open(RemminaProtocolWidget* gp, const gchar *n gp->priv->chat_window = remmina_chat_window_new(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(gp))), name); g_signal_connect_swapped(G_OBJECT(gp->priv->chat_window), "send", G_CALLBACK(on_send), gp); g_signal_connect_swapped(G_OBJECT(gp->priv->chat_window), "destroy", - G_CALLBACK(remmina_protocol_widget_chat_on_destroy), gp); + G_CALLBACK(remmina_protocol_widget_chat_on_destroy), gp); g_signal_connect_swapped(G_OBJECT(gp->priv->chat_window), "destroy", G_CALLBACK(on_destroy), gp); gtk_widget_show(gp->priv->chat_window); } -- cgit v1.2.3 From e5ca912d2d73857efe4038fdc650cd0784e50c20 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Wed, 16 Sep 2015 17:06:44 +0200 Subject: Updated version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f193db449..a87d00a86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,7 +96,7 @@ set(WITH_LIBRARY_VERSIONING "ON") set(REMMINA_VERSION_MAJOR "1") set(REMMINA_VERSION_MINOR "2") set(REMMINA_VERSION_REVISION "0") -set(REMMINA_VERSION_SUFFIX "rcgit.3") +set(REMMINA_VERSION_SUFFIX "rcgit.4") set(REMMINA_VERSION "${REMMINA_VERSION_MAJOR}.${REMMINA_VERSION_MINOR}.${REMMINA_VERSION_REVISION}-${REMMINA_VERSION_SUFFIX}") set(REMMINA_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}") -- cgit v1.2.3 From 4f2b474a43b44b50f81664a89708c6bdd84cf079 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Wed, 16 Sep 2015 17:09:29 +0200 Subject: First release --- CHANGELOG.md | 552 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 552 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..158a52d72 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,552 @@ +# Change Log + +## [Unreleased](https://github.com/FreeRDP/remmina/tree/HEAD) + +[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.2.0-rcgit.4...HEAD) + +**Closed issues:** + +- Remmina VS freerdp on 1.2.0 version [\#639](https://github.com/FreeRDP/Remmina/issues/639) + +## [v1.2.0-rcgit.4](https://github.com/FreeRDP/remmina/tree/v1.2.0-rcgit.4) (2015-09-15) +[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.2.0-rcgit.3...v1.2.0-rcgit.4) + +**Implemented enhancements:** + +- Remmina crashes using the Mir GTK backend [\#554](https://github.com/FreeRDP/Remmina/issues/554) +- Prior connections commands are executed in background [\#553](https://github.com/FreeRDP/Remmina/issues/553) +- Quick Search Textbox is Only 8 Characters Wide [\#547](https://github.com/FreeRDP/Remmina/issues/547) +- How about support XDG dir structure [\#129](https://github.com/FreeRDP/Remmina/issues/129) +- Gtk3 - Deprecation fixes [\#637](https://github.com/FreeRDP/Remmina/pull/637) ([antenore](https://github.com/antenore)) + +**Fixed bugs:** + +- Prior connections commands are executed in background [\#553](https://github.com/FreeRDP/Remmina/issues/553) +- Remmina fullscreen is wrongly placed - not real fullscreen [\#525](https://github.com/FreeRDP/Remmina/issues/525) + +**Closed issues:** + +- freeze when kvm setup finish [\#630](https://github.com/FreeRDP/Remmina/issues/630) +- Dependency problem on Ubuntu PPA remmina-next [\#629](https://github.com/FreeRDP/Remmina/issues/629) +- Remmina preferences are not being saved [\#627](https://github.com/FreeRDP/Remmina/issues/627) +- Redirection of audio to local fails [\#626](https://github.com/FreeRDP/Remmina/issues/626) +- RDP component not installed [\#620](https://github.com/FreeRDP/Remmina/issues/620) +- Wrong path in /usr/share/applications/remmina.desktop since version 1.1.1-1+766+next+201507170316~ubuntu14.04.1 [\#616](https://github.com/FreeRDP/Remmina/issues/616) +- Reverse layout switching doesn't work [\#605](https://github.com/FreeRDP/Remmina/issues/605) +- Cursor disappear and doesn't refresh in RDP [\#598](https://github.com/FreeRDP/Remmina/issues/598) +- support VNC on UNIX sockets [\#596](https://github.com/FreeRDP/Remmina/issues/596) +- Problem with RDP graphics [\#591](https://github.com/FreeRDP/Remmina/issues/591) +- Crash when using TortoiseGit over a remote Windows through Remmina [\#582](https://github.com/FreeRDP/Remmina/issues/582) +- Remmina 1.1.2 does not compile against FreeRDP 1.0.2 [\#579](https://github.com/FreeRDP/Remmina/issues/579) +- Sorting of hosts in notification pop-up area should not be case sensitive [\#574](https://github.com/FreeRDP/Remmina/issues/574) +- How to add custom keyboard layouts to RDP? [\#573](https://github.com/FreeRDP/Remmina/issues/573) +- provide Gnome 3 indicator [\#570](https://github.com/FreeRDP/Remmina/issues/570) +- New grouping mode: All-In-One [\#569](https://github.com/FreeRDP/Remmina/issues/569) +- Remmina nx won't connect with Ubuntu 15.04 [\#567](https://github.com/FreeRDP/Remmina/issues/567) +- Missing connection icons in tray menu [\#563](https://github.com/FreeRDP/Remmina/issues/563) +- undefined symbol: freerdp\_channels\_pop\_event in remmina-plugin-rdp.so [\#558](https://github.com/FreeRDP/Remmina/issues/558) +- Can't Sustain "Scale and Fill client window" Preference [\#557](https://github.com/FreeRDP/Remmina/issues/557) +- webbrowser support [\#551](https://github.com/FreeRDP/Remmina/issues/551) +- VNC connection crashes Remmina [\#546](https://github.com/FreeRDP/Remmina/issues/546) +- Remmina doesn't copy cells from libreoffice to WS2003R2 [\#541](https://github.com/FreeRDP/Remmina/issues/541) +- =net-misc/remmina-1.1.2 ssh quick connect always ask password, even if server don't support it [\#539](https://github.com/FreeRDP/Remmina/issues/539) +- Bring back Scaling WITHOUT respecting the remote destkop aspect ratio [\#537](https://github.com/FreeRDP/Remmina/issues/537) +- Remmina consistently crashes when I log out of an RDP Gateway session. [\#530](https://github.com/FreeRDP/Remmina/issues/530) +- remmina: gtk\_drag\_source\_info\_destroy\(\): remmina killed by SIGABRT [\#529](https://github.com/FreeRDP/Remmina/issues/529) +- Add ability to run an arbitrary command prior to connection. [\#520](https://github.com/FreeRDP/Remmina/issues/520) +- ssh key selection overwritten on edit [\#271](https://github.com/FreeRDP/Remmina/issues/271) +- VNC over SSH - Support for multiple keys for SSH authentication [\#256](https://github.com/FreeRDP/Remmina/issues/256) +- RDP: No caret on explorer address bar and white squares instead of small icons [\#251](https://github.com/FreeRDP/Remmina/issues/251) +- Remmina doesn't respect ssh config files... [\#235](https://github.com/FreeRDP/Remmina/issues/235) +- It does not move the text to scroll [\#208](https://github.com/FreeRDP/Remmina/issues/208) +- Crash in BitBlt\_SRCAND\_32bpp, BitBlt\_32bpp [\#186](https://github.com/FreeRDP/Remmina/issues/186) +- Can't attach to Windows console [\#177](https://github.com/FreeRDP/Remmina/issues/177) +- RDP disconnect from within Windows doesn't close session for 15-20 seconds [\#167](https://github.com/FreeRDP/Remmina/issues/167) +- No shared folder when connecting to console [\#161](https://github.com/FreeRDP/Remmina/issues/161) +- drive-client not copied/loaded properly [\#147](https://github.com/FreeRDP/Remmina/issues/147) +- Smartcard & sound redirection error [\#121](https://github.com/FreeRDP/Remmina/issues/121) +- Possibility to enter a remote command in SSH when I use it for VNC [\#94](https://github.com/FreeRDP/Remmina/issues/94) +- openpty\(3\) support for Remmina [\#73](https://github.com/FreeRDP/Remmina/issues/73) + +**Merged pull requests:** + +- libssh fixes - SSH\_OPTIONS\_LOG\_VERBOSITY [\#640](https://github.com/FreeRDP/Remmina/pull/640) ([antenore](https://github.com/antenore)) +- Updated AUTHORS list [\#636](https://github.com/FreeRDP/Remmina/pull/636) ([antenore](https://github.com/antenore)) +- Improve vnc rendering speed by using cairo surface directly [\#635](https://github.com/FreeRDP/Remmina/pull/635) ([mar-kolya](https://github.com/mar-kolya)) +- CMake rules adjustments when compiling under linux [\#634](https://github.com/FreeRDP/Remmina/pull/634) ([fundawang](https://github.com/fundawang)) +- Remove some legacy Xorg code, fixes \#554 [\#622](https://github.com/FreeRDP/Remmina/pull/622) ([giox069](https://github.com/giox069)) +- fix regression introduced by 190ea2f98ab0443b8a05f70c79e2af037f9fca94 [\#617](https://github.com/FreeRDP/Remmina/pull/617) ([zfil](https://github.com/zfil)) +- remmina.desktop: Use full path to execute remmina [\#612](https://github.com/FreeRDP/Remmina/pull/612) ([lanoxx](https://github.com/lanoxx)) +- remmina.desktop: Use full path to execute remmina [\#607](https://github.com/FreeRDP/Remmina/pull/607) ([lanoxx](https://github.com/lanoxx)) +- Filling out LoadBalanceInfo in the RDP settings struct [\#593](https://github.com/FreeRDP/Remmina/pull/593) ([qwertos](https://github.com/qwertos)) +- Exception when precommad in NULL. Reference \#591 [\#592](https://github.com/FreeRDP/Remmina/pull/592) ([antenore](https://github.com/antenore)) +- Xdg folders fixes \#129 \#197 [\#590](https://github.com/FreeRDP/Remmina/pull/590) ([antenore](https://github.com/antenore)) +- coredump when precommand is not quoted. Resolve \#520 [\#589](https://github.com/FreeRDP/Remmina/pull/589) ([antenore](https://github.com/antenore)) +- Support for ~/.ssh/config closes \#235 , libssh does not support most of the ssh options [\#588](https://github.com/FreeRDP/Remmina/pull/588) ([antenore](https://github.com/antenore)) +- Revert "License update" [\#587](https://github.com/FreeRDP/Remmina/pull/587) ([antenore](https://github.com/antenore)) +- Revert "License update" [\#586](https://github.com/FreeRDP/Remmina/pull/586) ([antenore](https://github.com/antenore)) +- Remmina freerdp subtree + fixes for FreeBSD [\#585](https://github.com/FreeRDP/Remmina/pull/585) ([antenore](https://github.com/antenore)) +- License update [\#581](https://github.com/FreeRDP/Remmina/pull/581) ([antenore](https://github.com/antenore)) +- Fix GTK+2 build failure [\#565](https://github.com/FreeRDP/Remmina/pull/565) ([heptalium](https://github.com/heptalium)) +- Prior Connection Command [\#562](https://github.com/FreeRDP/Remmina/pull/562) ([antenore](https://github.com/antenore)) +- Update Uzbek translation [\#561](https://github.com/FreeRDP/Remmina/pull/561) ([ozbek](https://github.com/ozbek)) +- Update for GTK+2 port [\#555](https://github.com/FreeRDP/Remmina/pull/555) ([repzilon](https://github.com/repzilon)) + +## [v1.2.0-rcgit.3](https://github.com/FreeRDP/remmina/tree/v1.2.0-rcgit.3) (2015-04-14) +[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.2.0-rcgit.2...v1.2.0-rcgit.3) + +**Implemented enhancements:** + +- Show or hide the icons near the menu [\#504](https://github.com/FreeRDP/Remmina/issues/504) +- Show or hide the icons near the buttons [\#503](https://github.com/FreeRDP/Remmina/issues/503) +- Show or hide the icons near the buttons and the menus [\#505](https://github.com/FreeRDP/Remmina/pull/505) ([muflone](https://github.com/muflone)) +- Fixes FreeRDP/Remmina\#473 - Customize button in the connection editor should show the resolutions dialog [\#501](https://github.com/FreeRDP/Remmina/pull/501) ([antenore](https://github.com/antenore)) +- The quick search doesn't list the folders [\#497](https://github.com/FreeRDP/Remmina/pull/497) ([muflone](https://github.com/muflone)) +- Enable and disable buttons in the string list dialog [\#496](https://github.com/FreeRDP/Remmina/pull/496) ([muflone](https://github.com/muflone)) +- Added Ctrl+F accelerator for quick search entry [\#494](https://github.com/FreeRDP/Remmina/pull/494) ([muflone](https://github.com/muflone)) +- Removed the RemminaMain GType and used a static RemminaMain struct instead [\#461](https://github.com/FreeRDP/Remmina/pull/461) ([muflone](https://github.com/muflone)) + +**Fixed bugs:** + +- Tab all connections [\#548](https://github.com/FreeRDP/Remmina/issues/548) +- Problem with shared folder on Windows Server 2012 [\#523](https://github.com/FreeRDP/Remmina/issues/523) +- Can't share a folder in KDE, due to Gtk issue [\#518](https://github.com/FreeRDP/Remmina/issues/518) +- Connection to all servers stopped working with last update of remmina-next PPA [\#506](https://github.com/FreeRDP/Remmina/issues/506) +- Unsupported properties on GTK 3.10 [\#486](https://github.com/FreeRDP/Remmina/issues/486) +- Buttons in the string list dialog [\#474](https://github.com/FreeRDP/Remmina/issues/474) +- Customize button in the connection editor should show the resolutions dialog [\#473](https://github.com/FreeRDP/Remmina/issues/473) +- The search shouldn't show every group in the list [\#471](https://github.com/FreeRDP/Remmina/issues/471) +- Enable the use of the menu key [\#470](https://github.com/FreeRDP/Remmina/issues/470) +- Connections list is not refreshed upon update or copy \(duplicate an existing connection\) [\#460](https://github.com/FreeRDP/Remmina/issues/460) +- Auto-highlighted "Quick Connect" connection name within new connection dialog copies the words "Quick Connect" into PRIMARY selection [\#263](https://github.com/FreeRDP/Remmina/issues/263) +- Double-clicking a column header to sort list of saved connections actually attempts connection [\#250](https://github.com/FreeRDP/Remmina/issues/250) +- Fix small memory leaks and a NULL ptr dereference. [\#500](https://github.com/FreeRDP/Remmina/pull/500) ([KyleSanderson](https://github.com/KyleSanderson)) +- Show the popup menu by pressing the menu key [\#495](https://github.com/FreeRDP/Remmina/pull/495) ([muflone](https://github.com/muflone)) +- Use the correct label for the font section [\#466](https://github.com/FreeRDP/Remmina/pull/466) ([weberhofer](https://github.com/weberhofer)) + +**Closed issues:** + +- Remmina main window can be opened multiple times [\#543](https://github.com/FreeRDP/Remmina/issues/543) +- =net-misc/remmina-1.1.2 Quick Connect should filter supported protocols similiarly with profile manager [\#540](https://github.com/FreeRDP/Remmina/issues/540) +- Remmina not showing entire desktop, Windows Remote Desktop Connection does. [\#534](https://github.com/FreeRDP/Remmina/issues/534) +- Copy and Paste between local and remote desktops failing in Ubuntu 15.04 [\#533](https://github.com/FreeRDP/Remmina/issues/533) +- Remmina does not report Host key Changed. [\#532](https://github.com/FreeRDP/Remmina/issues/532) +- compile with FreeRDP support failed on Funtoo Linux [\#526](https://github.com/FreeRDP/Remmina/issues/526) +- Exit VMWare Console via Remmina in 1.2.0 [\#522](https://github.com/FreeRDP/Remmina/issues/522) +- RDP Quality is not being stored [\#521](https://github.com/FreeRDP/Remmina/issues/521) +- Add the ability to place the floating toolbar on other sides of the screen [\#493](https://github.com/FreeRDP/Remmina/issues/493) +- Invisible toolbar in fullscreen mode grayed out [\#492](https://github.com/FreeRDP/Remmina/issues/492) +- Remarks to some setting's labels [\#489](https://github.com/FreeRDP/Remmina/issues/489) +- Open resolution list from connection editor [\#487](https://github.com/FreeRDP/Remmina/issues/487) +- Missing accelerators for search and quick connect entries [\#475](https://github.com/FreeRDP/Remmina/issues/475) +- Only one host key per domain name is allowed [\#465](https://github.com/FreeRDP/Remmina/issues/465) +- Latest changes causes compilation errors [\#464](https://github.com/FreeRDP/Remmina/issues/464) +- Host Name checking is erroneously case sensitive for RDP fingerprint [\#462](https://github.com/FreeRDP/Remmina/issues/462) +- Unable to connect "protocol security negotiation failure" [\#453](https://github.com/FreeRDP/Remmina/issues/453) +- Remmina crashes when using multiple RDP connections and closing one or more. [\#449](https://github.com/FreeRDP/Remmina/issues/449) +- Provide a way to send keys to the server connections [\#445](https://github.com/FreeRDP/Remmina/issues/445) +- Does \(or will\) Remmina support multi monitor RDP? [\#442](https://github.com/FreeRDP/Remmina/issues/442) +- xfreerdrp Crashes with segfault in find\_keyboard\_layout\_in\_xorg\_rules [\#441](https://github.com/FreeRDP/Remmina/issues/441) +- NX connection to freenx-client with custom key [\#436](https://github.com/FreeRDP/Remmina/issues/436) +- Unable to connect using \\server-name [\#435](https://github.com/FreeRDP/Remmina/issues/435) +- Regression: "Unknown authentication scheme from VNC server: 18" [\#433](https://github.com/FreeRDP/Remmina/issues/433) +- Copy file rdp [\#430](https://github.com/FreeRDP/Remmina/issues/430) +- Connection closes right away when trying to connect to Mac [\#427](https://github.com/FreeRDP/Remmina/issues/427) +- RDP clipboard and shared folder issue [\#406](https://github.com/FreeRDP/Remmina/issues/406) +- Crush RDP connect when copy file into clipboard on RDP server and clipboard sync ON [\#401](https://github.com/FreeRDP/Remmina/issues/401) +- Compilation failed on ubuntu 14.04 and 14.10 [\#381](https://github.com/FreeRDP/Remmina/issues/381) +- vertical text issue with excel [\#345](https://github.com/FreeRDP/Remmina/issues/345) +- Failure refresh image [\#341](https://github.com/FreeRDP/Remmina/issues/341) +- Segfault in rf\_Pointer\_Free of rdp plugin [\#269](https://github.com/FreeRDP/Remmina/issues/269) +- Auto-fit stucks the window [\#257](https://github.com/FreeRDP/Remmina/issues/257) +- Remmina-plugins-rdp fails to compile correctly with the latest version of gcc & freerdp [\#244](https://github.com/FreeRDP/Remmina/issues/244) +- Remmina has stopped showing shared folders [\#243](https://github.com/FreeRDP/Remmina/issues/243) +- Lost toolbar in keyboard captured mode [\#242](https://github.com/FreeRDP/Remmina/issues/242) +- Better user credentials management [\#229](https://github.com/FreeRDP/Remmina/issues/229) +- Command Line Arguments [\#227](https://github.com/FreeRDP/Remmina/issues/227) +- Copy paste clipboard does not work [\#207](https://github.com/FreeRDP/Remmina/issues/207) +- remmina not compiling on cent os 6.4 x64 [\#201](https://github.com/FreeRDP/Remmina/issues/201) +- sometimes gives black screen [\#198](https://github.com/FreeRDP/Remmina/issues/198) +- remmina remote desktop -- erratic partial display issue [\#181](https://github.com/FreeRDP/Remmina/issues/181) +- remmina incorrectly handles saved terminal size for ssh-connection [\#169](https://github.com/FreeRDP/Remmina/issues/169) +- net-misc/remmina-1.0.0\_p20121004 fails rsa-key auth on X11Forwarding-enabled OpenSSH server [\#168](https://github.com/FreeRDP/Remmina/issues/168) +- Remmina will not load RDP plugins [\#165](https://github.com/FreeRDP/Remmina/issues/165) +- cmake install prefix bug [\#160](https://github.com/FreeRDP/Remmina/issues/160) +- Graphical glitch with Total Commander and Remmina [\#157](https://github.com/FreeRDP/Remmina/issues/157) +- An Archer's tale - Unable to compile, compilation, followed by inability to path plugins. [\#152](https://github.com/FreeRDP/Remmina/issues/152) +- display off-center upon connection to RDP hosts [\#143](https://github.com/FreeRDP/Remmina/issues/143) +- RDP refresh/redraw problem [\#138](https://github.com/FreeRDP/Remmina/issues/138) +- Blank/black window contents when opening a new connection [\#127](https://github.com/FreeRDP/Remmina/issues/127) +- patch for launching external tools [\#126](https://github.com/FreeRDP/Remmina/issues/126) +- New connection type: VNC Reverse Connection [\#108](https://github.com/FreeRDP/Remmina/issues/108) +- Cannot connect to shared OS X screen protected with password only. [\#104](https://github.com/FreeRDP/Remmina/issues/104) +- Remote screen has wrong offset when using hide-toolbar [\#103](https://github.com/FreeRDP/Remmina/issues/103) +- Remmina Won't Maintain Multiple RDP Sessions at the Same Time [\#99](https://github.com/FreeRDP/Remmina/issues/99) +- Screen capture software crashes remmina client [\#98](https://github.com/FreeRDP/Remmina/issues/98) +- SSH terminal color customization [\#91](https://github.com/FreeRDP/Remmina/issues/91) +- \[Enhancement\] Start in background [\#85](https://github.com/FreeRDP/Remmina/issues/85) +- SSH Freeze [\#84](https://github.com/FreeRDP/Remmina/issues/84) +- Initial screen wonky opening VNC client [\#69](https://github.com/FreeRDP/Remmina/issues/69) +- Issues with viewport fullscreen [\#44](https://github.com/FreeRDP/Remmina/issues/44) +- make sessions in the NX session dialog double-clickable [\#16](https://github.com/FreeRDP/Remmina/issues/16) + +**Merged pull requests:** + +- Added an option to execute commands just before to connect to a remote server closes \#520 [\#552](https://github.com/FreeRDP/Remmina/pull/552) ([antenore](https://github.com/antenore)) +- Uzbek Cyrillic: use proper naming convention for filename [\#549](https://github.com/FreeRDP/Remmina/pull/549) ([ozbek](https://github.com/ozbek)) +- Uzbek Cyrillic: Add configure keystrokes and XDMCP feature text [\#538](https://github.com/FreeRDP/Remmina/pull/538) ([ozbek](https://github.com/ozbek)) +- Remmina 1.2.0-rcgit.3: new floating toolbar for GTK\>=3.10 and many other fixes [\#536](https://github.com/FreeRDP/Remmina/pull/536) ([giox069](https://github.com/giox069)) +- Fix for notebook tab drag and drop, fixes issues \#529 \#478 [\#531](https://github.com/FreeRDP/Remmina/pull/531) ([giox069](https://github.com/giox069)) +- Fix race condition in VNC event queue [\#519](https://github.com/FreeRDP/Remmina/pull/519) ([mar-kolya](https://github.com/mar-kolya)) +- Uzbek Cyrillic: apply latest additions [\#509](https://github.com/FreeRDP/Remmina/pull/509) ([ozbek](https://github.com/ozbek)) +- Implemented custom keystrokes for plugins [\#508](https://github.com/FreeRDP/Remmina/pull/508) ([muflone](https://github.com/muflone)) +- Add translations for Uzbek Cyrillic [\#502](https://github.com/FreeRDP/Remmina/pull/502) ([ozbek](https://github.com/ozbek)) +- Update Spanish translation [\#490](https://github.com/FreeRDP/Remmina/pull/490) ([fitojb](https://github.com/fitojb)) +- Fixes FreeRDP/Remmina\#460 [\#463](https://github.com/FreeRDP/Remmina/pull/463) ([antenore](https://github.com/antenore)) +- Updated German translation [\#458](https://github.com/FreeRDP/Remmina/pull/458) ([weberhofer](https://github.com/weberhofer)) +- Update es.po [\#455](https://github.com/FreeRDP/Remmina/pull/455) ([agdg](https://github.com/agdg)) +- Update es.po [\#454](https://github.com/FreeRDP/Remmina/pull/454) ([agdg](https://github.com/agdg)) +- Updated FSF address [\#451](https://github.com/FreeRDP/Remmina/pull/451) ([weberhofer](https://github.com/weberhofer)) +- Rework of scaler code [\#447](https://github.com/FreeRDP/Remmina/pull/447) ([giox069](https://github.com/giox069)) +- Added feature to send Ctrl+Alt+Del keys [\#446](https://github.com/FreeRDP/Remmina/pull/446) ([muflone](https://github.com/muflone)) +- Moved the double click event and the enter buttons press in the row-activated signal handler [\#438](https://github.com/FreeRDP/Remmina/pull/438) ([muflone](https://github.com/muflone)) +- Handle double click on the NX session rows to activate the default response [\#437](https://github.com/FreeRDP/Remmina/pull/437) ([muflone](https://github.com/muflone)) +- SSH terminal color customization [\#432](https://github.com/FreeRDP/Remmina/pull/432) ([muflone](https://github.com/muflone)) +- remmina: Actually install its headers. [\#428](https://github.com/FreeRDP/Remmina/pull/428) ([rakuco](https://github.com/rakuco)) + +## [v1.2.0-rcgit.2](https://github.com/FreeRDP/remmina/tree/v1.2.0-rcgit.2) (2014-12-30) +[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.1.2...v1.2.0-rcgit.2) + +**Fixed bugs:** + +- Position of popup menu is wrong [\#423](https://github.com/FreeRDP/Remmina/issues/423) +- Remmina crashes exporting a remote desktop file [\#412](https://github.com/FreeRDP/Remmina/issues/412) +- \[BUG\] RDP Preferences don't saving [\#391](https://github.com/FreeRDP/Remmina/issues/391) +- Command line help not showing all the options [\#327](https://github.com/FreeRDP/Remmina/issues/327) + +**Closed issues:** + +- Remmina crashes after Ctrl+X in a RDP session [\#422](https://github.com/FreeRDP/Remmina/issues/422) +- Remmina Crashes During RDP Session when Context Menu Item Clicked [\#418](https://github.com/FreeRDP/Remmina/issues/418) +- Host key change not indicated in Remmina GUI [\#407](https://github.com/FreeRDP/Remmina/issues/407) +- Copy/paste inop Windows to Mint 17 [\#404](https://github.com/FreeRDP/Remmina/issues/404) +- remmina/src/remmina\_ssh\_plugin.h should also check for HAVE\_LIBVTE [\#394](https://github.com/FreeRDP/Remmina/issues/394) +- I have to click on "Resize the window to fit remote resolution" to see my RDP session. [\#387](https://github.com/FreeRDP/Remmina/issues/387) +- Please create an AppData file for Remmina [\#272](https://github.com/FreeRDP/Remmina/issues/272) +- "Protocol plugin RDP is not installed."/The Application Not Recognizing the RDP Plugin [\#249](https://github.com/FreeRDP/Remmina/issues/249) +- "Overwrite all" button [\#238](https://github.com/FreeRDP/Remmina/issues/238) + +**Merged pull requests:** + +- .po files cleanup and updates [\#425](https://github.com/FreeRDP/Remmina/pull/425) ([giox069](https://github.com/giox069)) +- Fixes the position of popup menu [\#424](https://github.com/FreeRDP/Remmina/pull/424) ([muflone](https://github.com/muflone)) +- Add a "Overwrite all" button [\#420](https://github.com/FreeRDP/Remmina/pull/420) ([muflone](https://github.com/muflone)) +- New AppData specification file [\#419](https://github.com/FreeRDP/Remmina/pull/419) ([muflone](https://github.com/muflone)) +- Expose the arguments in the help text and parse --help and -h arguments locally [\#417](https://github.com/FreeRDP/Remmina/pull/417) ([muflone](https://github.com/muflone)) +- Clipboard: improved handling of time consuming clipboard transfer [\#416](https://github.com/FreeRDP/Remmina/pull/416) ([giox069](https://github.com/giox069)) +- Clipboard fixes [\#415](https://github.com/FreeRDP/Remmina/pull/415) ([giox069](https://github.com/giox069)) +- Next [\#414](https://github.com/FreeRDP/Remmina/pull/414) ([giox069](https://github.com/giox069)) +- GTK3 fixes [\#409](https://github.com/FreeRDP/Remmina/pull/409) ([giox069](https://github.com/giox069)) +- GTK3 migration of remmina\_ftp\_client, fixes \#365 [\#408](https://github.com/FreeRDP/Remmina/pull/408) ([giox069](https://github.com/giox069)) +- Update Remmina GTK+2 branch to 1.1.2 [\#405](https://github.com/FreeRDP/Remmina/pull/405) ([repzilon](https://github.com/repzilon)) + +## [v1.1.2](https://github.com/FreeRDP/remmina/tree/v1.1.2) (2014-12-08) +[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.1.1-gtk2...v1.1.2) + +**Fixed bugs:** + +- NX plugin broken [\#369](https://github.com/FreeRDP/Remmina/issues/369) +- XDMCP plugin broken [\#366](https://github.com/FreeRDP/Remmina/issues/366) + +**Closed issues:** + +- resize remote to fit window option [\#398](https://github.com/FreeRDP/Remmina/issues/398) +- Rename README to README.md [\#304](https://github.com/FreeRDP/Remmina/issues/304) + +**Merged pull requests:** + +- Fix RDP race condifion, fixes \#394 \(missing HAVE\_LIBVTE\), removed unused function [\#399](https://github.com/FreeRDP/Remmina/pull/399) ([giox069](https://github.com/giox069)) +- Merge pull request \#396 from FreeRDP/issue366 [\#397](https://github.com/FreeRDP/Remmina/pull/397) ([muflone](https://github.com/muflone)) +- Issue \#366 [\#396](https://github.com/FreeRDP/Remmina/pull/396) ([muflone](https://github.com/muflone)) + +## [v1.1.1-gtk2](https://github.com/FreeRDP/remmina/tree/v1.1.1-gtk2) (2014-12-07) +[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.1.1...v1.1.1-gtk2) + +**Closed issues:** + +- Password isn't saved [\#388](https://github.com/FreeRDP/Remmina/issues/388) +- undefined symbol: freerdp\_event\_new [\#379](https://github.com/FreeRDP/Remmina/issues/379) +- Compile failed [\#378](https://github.com/FreeRDP/Remmina/issues/378) +- Copy/Paste not working in 0.9.99.1 on Ubuntu 14.10 [\#377](https://github.com/FreeRDP/Remmina/issues/377) +- Crash when not accepting certificate for RDP server [\#375](https://github.com/FreeRDP/Remmina/issues/375) +- Can't get RDP to work in Remmina recently [\#374](https://github.com/FreeRDP/Remmina/issues/374) +- One IP, more RDP ports [\#373](https://github.com/FreeRDP/Remmina/issues/373) +- about box reports 1.1.0 rather than 1.1.1 [\#370](https://github.com/FreeRDP/Remmina/issues/370) +- Complete GTK3 migration [\#365](https://github.com/FreeRDP/Remmina/issues/365) +- Build failure with remmina-rdp\_cliprdr\_\* [\#363](https://github.com/FreeRDP/Remmina/issues/363) +- Key with code 95 si incorrectly mapped [\#361](https://github.com/FreeRDP/Remmina/issues/361) +- SSH connection not working: "ssh\_userauth\_password: Wrong state during pending SSH call" [\#305](https://github.com/FreeRDP/Remmina/issues/305) + +**Merged pull requests:** + +- Remmina 1.1.2 [\#402](https://github.com/FreeRDP/Remmina/pull/402) ([ic3d](https://github.com/ic3d)) +- Varoius fixes [\#393](https://github.com/FreeRDP/Remmina/pull/393) ([giox069](https://github.com/giox069)) +- install external tools to datadir, not user's home dir [\#385](https://github.com/FreeRDP/Remmina/pull/385) ([eworm-de](https://github.com/eworm-de)) +- Fix rdp\_cliprd for freerdp 1.2. Fixes \#378 \#379 [\#384](https://github.com/FreeRDP/Remmina/pull/384) ([giox069](https://github.com/giox069)) +- Update to work with vte 2.91 as well as 2.90 [\#372](https://github.com/FreeRDP/Remmina/pull/372) ([iainlane](https://github.com/iainlane)) +- Update to work with vte 2.91 as well as 2.90 [\#371](https://github.com/FreeRDP/Remmina/pull/371) ([iainlane](https://github.com/iainlane)) +- Added a Show quick connect menu item to show/hide the fast connection box [\#368](https://github.com/FreeRDP/Remmina/pull/368) ([muflone](https://github.com/muflone)) +- Fixed GTK3 issue [\#367](https://github.com/FreeRDP/Remmina/pull/367) ([weberhofer](https://github.com/weberhofer)) +- Rename relevant CB\_FORMAT to CF [\#364](https://github.com/FreeRDP/Remmina/pull/364) ([giox069](https://github.com/giox069)) +- Add printer and smartcard redirection, fix freerdp connection closing [\#359](https://github.com/FreeRDP/Remmina/pull/359) ([giox069](https://github.com/giox069)) +- Add printer and smartcard redirection, fix freerdp connection closing [\#358](https://github.com/FreeRDP/Remmina/pull/358) ([giox069](https://github.com/giox069)) +- Screenshots page with real screenshots! [\#355](https://github.com/FreeRDP/Remmina/pull/355) ([ic3d](https://github.com/ic3d)) +- Good News! [\#354](https://github.com/FreeRDP/Remmina/pull/354) ([ic3d](https://github.com/ic3d)) + +## [v1.1.1](https://github.com/FreeRDP/remmina/tree/v1.1.1) (2014-10-10) +[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.2.0-rcgit.1...v1.1.1) + +**Fixed bugs:** + +- Share local printer doesn't work [\#324](https://github.com/FreeRDP/Remmina/issues/324) +- VNC plugin settings - scaler too small [\#316](https://github.com/FreeRDP/Remmina/issues/316) +- Protocol settings compact flag don't seem to be honored in the gtk3 branch [\#314](https://github.com/FreeRDP/Remmina/issues/314) +- gtk\_widget\_set\_opacity not supported by GTK 3.4.2 \(for Debian 7.0\) [\#299](https://github.com/FreeRDP/Remmina/issues/299) +- Clipboard Sync with RDP [\#280](https://github.com/FreeRDP/Remmina/issues/280) +- Terminal windows disappearing [\#274](https://github.com/FreeRDP/Remmina/issues/274) +- Remmina crash when trying to connect to remote VNC [\#252](https://github.com/FreeRDP/Remmina/issues/252) +- Fix segfault reported by issue \#1 \#280 \#131 \#135 \#199 \#270 [\#282](https://github.com/FreeRDP/Remmina/pull/282) ([antenore](https://github.com/antenore)) + +**Closed issues:** + +- Stucked shift key [\#90](https://github.com/FreeRDP/Remmina/issues/90) +- New branch 'next' [\#313](https://github.com/FreeRDP/Remmina/issues/313) +- Laggy graphics with remmina [\#308](https://github.com/FreeRDP/Remmina/issues/308) +- does sound work for remmina RDP? [\#296](https://github.com/FreeRDP/Remmina/issues/296) +- Remmina install /usr/include/remmina/ empty [\#292](https://github.com/FreeRDP/Remmina/issues/292) +- Remmina freeze after system boots from suspend [\#284](https://github.com/FreeRDP/Remmina/issues/284) +- Sound connection not possible via RDP [\#281](https://github.com/FreeRDP/Remmina/issues/281) +- Blank window on connect - found whats causign it [\#273](https://github.com/FreeRDP/Remmina/issues/273) +- Shared folder on RDP does not work [\#270](https://github.com/FreeRDP/Remmina/issues/270) +- RDP connection cannot be established [\#248](https://github.com/FreeRDP/Remmina/issues/248) + +**Merged pull requests:** + +- Fix debian bug 764142 [\#353](https://github.com/FreeRDP/Remmina/pull/353) ([giox069](https://github.com/giox069)) +- Internationalization fixes [\#320](https://github.com/FreeRDP/Remmina/pull/320) ([giox069](https://github.com/giox069)) +- Merge antenore:master with FreeRDP:gtk3 - GTK3 migration - File editor [\#311](https://github.com/FreeRDP/Remmina/pull/311) ([antenore](https://github.com/antenore)) +- Help GNOME SHELL to not hide the floating toolbar [\#309](https://github.com/FreeRDP/Remmina/pull/309) ([giox069](https://github.com/giox069)) +- Enabled sound \(fixes \#296 \#281\) and improved disconnection detection. [\#297](https://github.com/FreeRDP/Remmina/pull/297) ([giox069](https://github.com/giox069)) +- Corrections to keyboard grab/ungrab. Fixes \#245 [\#295](https://github.com/FreeRDP/Remmina/pull/295) ([giox069](https://github.com/giox069)) +- Fixes for clipboard issues [\#294](https://github.com/FreeRDP/Remmina/pull/294) ([giox069](https://github.com/giox069)) +- Fix GTK2 compatibility [\#293](https://github.com/FreeRDP/Remmina/pull/293) ([amon-sha](https://github.com/amon-sha)) +- Indentation fix [\#290](https://github.com/FreeRDP/Remmina/pull/290) ([giox069](https://github.com/giox069)) +- Fix \#288 \#143 and deprecated gtk\_widget\_reparent\(\) [\#289](https://github.com/FreeRDP/Remmina/pull/289) ([giox069](https://github.com/giox069)) +- Issue \#286 - License OpenSSL linking exception [\#287](https://github.com/FreeRDP/Remmina/pull/287) ([antenore](https://github.com/antenore)) +- GTK+ 2 compatibility [\#276](https://github.com/FreeRDP/Remmina/pull/276) ([repzilon](https://github.com/repzilon)) +- Fix issue with invisible toolbar in fullscreen. [\#275](https://github.com/FreeRDP/Remmina/pull/275) ([jerrido](https://github.com/jerrido)) +- Fix for issue \#251 [\#253](https://github.com/FreeRDP/Remmina/pull/253) ([giox069](https://github.com/giox069)) + +## [v1.2.0-rcgit.1](https://github.com/FreeRDP/remmina/tree/v1.2.0-rcgit.1) (2014-10-08) +[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.1.0...v1.2.0-rcgit.1) + +**Closed issues:** + +- undefined symbol: freerdp\_channels\_global\_init in remmina-plugin-rdp.so [\#278](https://github.com/FreeRDP/Remmina/issues/278) + +**Merged pull requests:** + +- Fix issue \#90 and website URL [\#352](https://github.com/FreeRDP/Remmina/pull/352) ([giox069](https://github.com/giox069)) +- Fix issue \#90 and various updates [\#351](https://github.com/FreeRDP/Remmina/pull/351) ([giox069](https://github.com/giox069)) +- Updated menu links [\#350](https://github.com/FreeRDP/Remmina/pull/350) ([ic3d](https://github.com/ic3d)) +- Update links [\#349](https://github.com/FreeRDP/Remmina/pull/349) ([ic3d](https://github.com/ic3d)) +- Changed links [\#348](https://github.com/FreeRDP/Remmina/pull/348) ([ic3d](https://github.com/ic3d)) +- Remove call to freerdp\_get\_last\_error [\#346](https://github.com/FreeRDP/Remmina/pull/346) ([dktrkranz](https://github.com/dktrkranz)) + +## [v1.1.0](https://github.com/FreeRDP/remmina/tree/v1.1.0) (2014-10-03) +[Full Changelog](https://github.com/FreeRDP/remmina/compare/1.0.0...v1.1.0) + +**Fixed bugs:** + +- Black or white window when RDP connects at 32bpp [\#329](https://github.com/FreeRDP/Remmina/issues/329) +- Remmina RDP does not disconnect when closing the client window or tab [\#288](https://github.com/FreeRDP/Remmina/issues/288) +- Super/windows keypresses always present [\#7](https://github.com/FreeRDP/Remmina/issues/7) + +**Closed issues:** + +- Protocol plug-in RDP is not installed. [\#337](https://github.com/FreeRDP/Remmina/issues/337) +- FreeRDP / Remmina - is this a fork? [\#325](https://github.com/FreeRDP/Remmina/issues/325) +- RDP configuration tab garbled in GTK3 branch. [\#319](https://github.com/FreeRDP/Remmina/issues/319) +- Remmina hangs and doesn't let to switch to another program [\#310](https://github.com/FreeRDP/Remmina/issues/310) +- VNC plugin not available in Remmnia [\#307](https://github.com/FreeRDP/Remmina/issues/307) +- Identityfile not loaded properly [\#306](https://github.com/FreeRDP/Remmina/issues/306) +- Second Monitor in Portrait mode breaks dropdown. [\#298](https://github.com/FreeRDP/Remmina/issues/298) +- OpenSSL linking exception? [\#286](https://github.com/FreeRDP/Remmina/issues/286) +- Please tag 1.2.0-beta1 [\#285](https://github.com/FreeRDP/Remmina/issues/285) +- Remmina Remote Desktop Client doesn't save Quality option changes [\#283](https://github.com/FreeRDP/Remmina/issues/283) +- Cannot compile on Fedora 20 [\#277](https://github.com/FreeRDP/Remmina/issues/277) +- Cannot install Remmina [\#266](https://github.com/FreeRDP/Remmina/issues/266) +- Crash while trying to connect using iFreeRDP for iPad App. [\#264](https://github.com/FreeRDP/Remmina/issues/264) +- Public key should not be separately required for SSH PK authentication [\#262](https://github.com/FreeRDP/Remmina/issues/262) +- NX Session: Unresponsive to mouse input, window does not focus. [\#258](https://github.com/FreeRDP/Remmina/issues/258) +- GUI omits basic error information [\#247](https://github.com/FreeRDP/Remmina/issues/247) +- Super/ Windows key not grabbed [\#245](https://github.com/FreeRDP/Remmina/issues/245) +- Remmina fails to compile against latest freerdp on github [\#228](https://github.com/FreeRDP/Remmina/issues/228) +- Cannot connect to RDP over SSH to multiple hosts [\#223](https://github.com/FreeRDP/Remmina/issues/223) +- Bring Japanese translation from Ubuntu [\#216](https://github.com/FreeRDP/Remmina/issues/216) +- Bad colors on Ubuntu 13.04 [\#212](https://github.com/FreeRDP/Remmina/issues/212) +- Crash redirected folder / printer. [\#199](https://github.com/FreeRDP/Remmina/issues/199) +- FREERDP\_CLIENT\_LIBRARY, FREERDP\_LOCALE\_LIBRARY is not found [\#193](https://github.com/FreeRDP/Remmina/issues/193) +- Compile error building remmina-plugin-rdp [\#189](https://github.com/FreeRDP/Remmina/issues/189) +- error: unknown type name 'RDP\_EVENT' when compiled against current freerdp [\#187](https://github.com/FreeRDP/Remmina/issues/187) +- Warinig unimplemented brush style:2 and Beyond Compare in Win7 x64 [\#184](https://github.com/FreeRDP/Remmina/issues/184) +- Remmina crashes \(BSOD\) Windows NT 4 Terminal Server [\#183](https://github.com/FreeRDP/Remmina/issues/183) +- problems compiling [\#180](https://github.com/FreeRDP/Remmina/issues/180) +- SSH Problem to older linux servers. [\#175](https://github.com/FreeRDP/Remmina/issues/175) +- external\_tools directory should not be installed [\#171](https://github.com/FreeRDP/Remmina/issues/171) +- Unable to compile against current freerdp [\#159](https://github.com/FreeRDP/Remmina/issues/159) +- d5yt6guyhukijlkolpk;\['g [\#156](https://github.com/FreeRDP/Remmina/issues/156) +- Remmina full screen closes unexpectedly in a dual monitor setup [\#154](https://github.com/FreeRDP/Remmina/issues/154) +- Numeric keyboard doesn't sync [\#153](https://github.com/FreeRDP/Remmina/issues/153) +- ERRINFO\_DECRYPT\_FAILED and Invalid pointer gdi\_get\_bitmap\_pointer [\#151](https://github.com/FreeRDP/Remmina/issues/151) +- Segmentation fault when using Sessionbrooker and DNS round robin [\#150](https://github.com/FreeRDP/Remmina/issues/150) +- Failed to compile 2 [\#144](https://github.com/FreeRDP/Remmina/issues/144) +- Fails to compile [\#141](https://github.com/FreeRDP/Remmina/issues/141) +- Segfault connecting RDP [\#135](https://github.com/FreeRDP/Remmina/issues/135) +- RDP Plugin Not Found Linux Mint 14 [\#134](https://github.com/FreeRDP/Remmina/issues/134) +- icon fail to compile [\#133](https://github.com/FreeRDP/Remmina/issues/133) +- segfault on ubuntu 12.04 [\#131](https://github.com/FreeRDP/Remmina/issues/131) +- Segfault connecting RDP via SSH: invalid glyph / invalid brush \(0 bpp\) [\#130](https://github.com/FreeRDP/Remmina/issues/130) +- Saved Passwords Fail to Authenticate when .remmina Config is Symlinked [\#128](https://github.com/FreeRDP/Remmina/issues/128) +- can't compile, FREERDP\_CHANNELS\_LIBRARY not found [\#123](https://github.com/FreeRDP/Remmina/issues/123) +- The latest checkout fails to cmake --build=build . on ubuntu 12.10 [\#122](https://github.com/FreeRDP/Remmina/issues/122) +- avahi underlinking [\#120](https://github.com/FreeRDP/Remmina/issues/120) +- Compatibility with newest FreeRDP [\#119](https://github.com/FreeRDP/Remmina/issues/119) +- No visual indication of active tab [\#118](https://github.com/FreeRDP/Remmina/issues/118) +- Black Blocks and blocks misplaced [\#116](https://github.com/FreeRDP/Remmina/issues/116) +- avahi support not actually compiled in [\#113](https://github.com/FreeRDP/Remmina/issues/113) +- RDP session shows only white colors [\#111](https://github.com/FreeRDP/Remmina/issues/111) +- problems typing @ via RDP using pt-latin keyboard [\#110](https://github.com/FreeRDP/Remmina/issues/110) +- "Main Window" interface unusable \(odd toolbar, connection rendering\) [\#109](https://github.com/FreeRDP/Remmina/issues/109) +- remmina crash after rdp connection [\#107](https://github.com/FreeRDP/Remmina/issues/107) +- Wrong colours when connecting to a sunray terminal [\#102](https://github.com/FreeRDP/Remmina/issues/102) +- Add Chinese \(Taiwan\) translation [\#101](https://github.com/FreeRDP/Remmina/issues/101) +- Uses host cursors [\#100](https://github.com/FreeRDP/Remmina/issues/100) +- remmina new feature info [\#97](https://github.com/FreeRDP/Remmina/issues/97) +- Clipboard Sync from Mac OS X to Ubuntu over VNC Not Working [\#93](https://github.com/FreeRDP/Remmina/issues/93) +- SSH public key authentication failed: Public key file doesn't exist [\#92](https://github.com/FreeRDP/Remmina/issues/92) +- Remmina and numeric pad status [\#89](https://github.com/FreeRDP/Remmina/issues/89) +- Remmina disappears after minimizing, going fullscreen, or opening a 2nd window [\#87](https://github.com/FreeRDP/Remmina/issues/87) +- Timezone redirection not properly supported [\#80](https://github.com/FreeRDP/Remmina/issues/80) +- Wonky RDP display [\#79](https://github.com/FreeRDP/Remmina/issues/79) +- Unable to connect to RDP server XXX.XXX.XXX.XXX [\#78](https://github.com/FreeRDP/Remmina/issues/78) +- Remmina freezes when disconnecting vnc session with ssh tunnel [\#77](https://github.com/FreeRDP/Remmina/issues/77) +- Tray icon autostart option disappeared in 1.0 [\#76](https://github.com/FreeRDP/Remmina/issues/76) +- Unknown authentication scheme from VNC server: 5 [\#75](https://github.com/FreeRDP/Remmina/issues/75) +- Error Building Latest on Fedora 16 [\#74](https://github.com/FreeRDP/Remmina/issues/74) +- wake on lan [\#72](https://github.com/FreeRDP/Remmina/issues/72) +- Add "Download for Ubuntu button" on the website [\#71](https://github.com/FreeRDP/Remmina/issues/71) +- Specify GLIB requirements [\#70](https://github.com/FreeRDP/Remmina/issues/70) +- Can not RDP connect if host key has changed [\#68](https://github.com/FreeRDP/Remmina/issues/68) +- remmina/xfreerdp crashes while trying to use 'remote control' [\#66](https://github.com/FreeRDP/Remmina/issues/66) +- Resize Window to Fit in Remote Resolution Broken [\#63](https://github.com/FreeRDP/Remmina/issues/63) +- OpenBSD OpenSSH & SSH\_AUTH\_METHOD\_INTERACTIVE [\#59](https://github.com/FreeRDP/Remmina/issues/59) +- Crashes on launch on 12.04 [\#57](https://github.com/FreeRDP/Remmina/issues/57) +- CMake Error at CMakeLists.txt:96 \(find\_suggested\_package\): Unknown CMake command "find\_suggested\_package". [\#55](https://github.com/FreeRDP/Remmina/issues/55) +- Remmina/FreeRDP \(both v1.x\) - protocol security negotiation failure \(to any Windows host\) [\#54](https://github.com/FreeRDP/Remmina/issues/54) +- patch for support building with gtk-2.22 [\#46](https://github.com/FreeRDP/Remmina/issues/46) +- numlock setting is not exported [\#45](https://github.com/FreeRDP/Remmina/issues/45) +- use Enter key to open connection, not only Doubleclick [\#43](https://github.com/FreeRDP/Remmina/issues/43) +- FindGnuTLS.cmake with cmake 2.6 [\#42](https://github.com/FreeRDP/Remmina/issues/42) +- SSH connection with transparent background support [\#41](https://github.com/FreeRDP/Remmina/issues/41) +- Help\>About version is out of date [\#35](https://github.com/FreeRDP/Remmina/issues/35) +- Build error with -DWITH\_GETTEXT=OFF option [\#23](https://github.com/FreeRDP/Remmina/issues/23) +- .desktop.in file is no longer handled [\#21](https://github.com/FreeRDP/Remmina/issues/21) +- don't forget about the old bugs at SF.net [\#19](https://github.com/FreeRDP/Remmina/issues/19) +- Don't use convenience copy of libvncserver [\#15](https://github.com/FreeRDP/Remmina/issues/15) +- Start minimized to systray [\#14](https://github.com/FreeRDP/Remmina/issues/14) +- Clipboard redirect is not working. [\#13](https://github.com/FreeRDP/Remmina/issues/13) +- Accelerator is the same for "Cancel" and "Connect" [\#12](https://github.com/FreeRDP/Remmina/issues/12) +- linker problem [\#9](https://github.com/FreeRDP/Remmina/issues/9) +- rdp plugin crashes [\#1](https://github.com/FreeRDP/Remmina/issues/1) + +**Merged pull requests:** + +- Frdp 1.1 [\#344](https://github.com/FreeRDP/Remmina/pull/344) ([giox069](https://github.com/giox069)) +- Fixes for latest FreeRDP [\#343](https://github.com/FreeRDP/Remmina/pull/343) ([dktrkranz](https://github.com/dktrkranz)) +- GTK3 migration - about [\#339](https://github.com/FreeRDP/Remmina/pull/339) ([antenore](https://github.com/antenore)) +- GTK3 migration + gix069 fixes [\#338](https://github.com/FreeRDP/Remmina/pull/338) ([antenore](https://github.com/antenore)) +- Added more translations from launchpad, fixes \#216 [\#336](https://github.com/FreeRDP/Remmina/pull/336) ([giox069](https://github.com/giox069)) +- Make 8bpp and 32bpp working again. Fixes \#329 [\#334](https://github.com/FreeRDP/Remmina/pull/334) ([giox069](https://github.com/giox069)) +- Fix compilation issues with latest FreeRDP [\#333](https://github.com/FreeRDP/Remmina/pull/333) ([giox069](https://github.com/giox069)) +- Various SSH fixes, fixes \#262 and \#223 [\#330](https://github.com/FreeRDP/Remmina/pull/330) ([giox069](https://github.com/giox069)) +- Fix missing extended keycode and 'up' action when releasing all keys [\#328](https://github.com/FreeRDP/Remmina/pull/328) ([giox069](https://github.com/giox069)) +- Fix compilation problems with latest version of FreeRDP/FreeRDP master [\#326](https://github.com/FreeRDP/Remmina/pull/326) ([giox069](https://github.com/giox069)) +- GTK3 migration - preferences dialog upggraded to Grid Layout [\#322](https://github.com/FreeRDP/Remmina/pull/322) ([antenore](https://github.com/antenore)) +- GTK3 Migration - Move from GtkTable to GtkGrid - Chat window and auth dialogs [\#321](https://github.com/FreeRDP/Remmina/pull/321) ([antenore](https://github.com/antenore)) +- gtk\_widget\_set\_margin\_end too new as reported in \#commitcomment-7689638 [\#318](https://github.com/FreeRDP/Remmina/pull/318) ([antenore](https://github.com/antenore)) +- Scaler layout improvement - gtk\_widget\_set\_margin\_end [\#317](https://github.com/FreeRDP/Remmina/pull/317) ([antenore](https://github.com/antenore)) +- Should fix issue \#314 and other related problems [\#315](https://github.com/FreeRDP/Remmina/pull/315) ([antenore](https://github.com/antenore)) +- Fixes for ssh, floating toolbar and version number change [\#312](https://github.com/FreeRDP/Remmina/pull/312) ([giox069](https://github.com/giox069)) +- ssh, minimize to tray and file sharing fixes [\#303](https://github.com/FreeRDP/Remmina/pull/303) ([giox069](https://github.com/giox069)) +- Minor fixes to floating toolbar [\#301](https://github.com/FreeRDP/Remmina/pull/301) ([giox069](https://github.com/giox069)) +- GTK+ \< 3.8 compatibility, fixes \#299 [\#300](https://github.com/FreeRDP/Remmina/pull/300) ([giox069](https://github.com/giox069)) +- Added one-liner apt-get to install all dependencies, for the lazy people [\#240](https://github.com/FreeRDP/Remmina/pull/240) ([Photonios](https://github.com/Photonios)) +- Typo in preference name broke key mapping in VNC [\#236](https://github.com/FreeRDP/Remmina/pull/236) ([nopdotcom](https://github.com/nopdotcom)) +- fixes \#193: Instructions for compiling against master FreeRDP [\#231](https://github.com/FreeRDP/Remmina/pull/231) ([krlmlr](https://github.com/krlmlr)) +- rename context\_size to ContextSize to match changes in FreeRDP [\#215](https://github.com/FreeRDP/Remmina/pull/215) ([benkohler](https://github.com/benkohler)) +- Finish replacing the old stream macros [\#206](https://github.com/FreeRDP/Remmina/pull/206) ([floppym](https://github.com/floppym)) +- Fix compilation against freerdp master [\#191](https://github.com/FreeRDP/Remmina/pull/191) ([darklajid](https://github.com/darklajid)) +- Remove call to rfx\_context\_set\_cpu\_opt, which was removed from FreeRDP [\#172](https://github.com/FreeRDP/Remmina/pull/172) ([floppym](https://github.com/floppym)) +- DWORD is the replacement for RDP\_SCANCODE [\#166](https://github.com/FreeRDP/Remmina/pull/166) ([dktrkranz](https://github.com/dktrkranz)) +- Do not define any SONAME for the plugins [\#149](https://github.com/FreeRDP/Remmina/pull/149) ([dktrkranz](https://github.com/dktrkranz)) +- external tools [\#132](https://github.com/FreeRDP/Remmina/pull/132) ([loki36](https://github.com/loki36)) +- Couple of packaging fixes [\#114](https://github.com/FreeRDP/Remmina/pull/114) ([floppym](https://github.com/floppym)) +- Some improvements [\#105](https://github.com/FreeRDP/Remmina/pull/105) ([dupondje](https://github.com/dupondje)) +- Multiple fixes + Quickconnect [\#95](https://github.com/FreeRDP/Remmina/pull/95) ([dupondje](https://github.com/dupondje)) +- Porting to Cairo and some bugfixes/new features [\#67](https://github.com/FreeRDP/Remmina/pull/67) ([dupondje](https://github.com/dupondje)) +- GTK2 compatibility [\#65](https://github.com/FreeRDP/Remmina/pull/65) ([dupondje](https://github.com/dupondje)) +- A couple of build fixes [\#64](https://github.com/FreeRDP/Remmina/pull/64) ([floppym](https://github.com/floppym)) +- last clipboard commits [\#62](https://github.com/FreeRDP/Remmina/pull/62) ([dupondje](https://github.com/dupondje)) +- Some more clipboard fixes [\#60](https://github.com/FreeRDP/Remmina/pull/60) ([dupondje](https://github.com/dupondje)) +- Patches [\#58](https://github.com/FreeRDP/Remmina/pull/58) ([dupondje](https://github.com/dupondje)) +- Clipboard support [\#56](https://github.com/FreeRDP/Remmina/pull/56) ([dupondje](https://github.com/dupondje)) +- Some fixes [\#53](https://github.com/FreeRDP/Remmina/pull/53) ([dupondje](https://github.com/dupondje)) +- Fix all deprecated function calls [\#52](https://github.com/FreeRDP/Remmina/pull/52) ([dupondje](https://github.com/dupondje)) +- Fixes compiling on ubuntu [\#51](https://github.com/FreeRDP/Remmina/pull/51) ([dupondje](https://github.com/dupondje)) +- Fix for scrolling in Remmina [\#50](https://github.com/FreeRDP/Remmina/pull/50) ([dupondje](https://github.com/dupondje)) +- Fix app indicator when using custom install prefix [\#48](https://github.com/FreeRDP/Remmina/pull/48) ([rawlinc](https://github.com/rawlinc)) +- Issue \#9 [\#39](https://github.com/FreeRDP/Remmina/pull/39) ([Gankov](https://github.com/Gankov)) +- bump version to 1.0.0. fixed \#35 [\#38](https://github.com/FreeRDP/Remmina/pull/38) ([chihchun](https://github.com/chihchun)) +- Fixed missing system pointer update skeletons. [\#37](https://github.com/FreeRDP/Remmina/pull/37) ([chihchun](https://github.com/chihchun)) +- Add an option to remmina to redirect smartcard over rdp [\#36](https://github.com/FreeRDP/Remmina/pull/36) ([absmall](https://github.com/absmall)) +- Corrected mistake in desktop file [\#34](https://github.com/FreeRDP/Remmina/pull/34) ([krnekhelesh](https://github.com/krnekhelesh)) +- Updated Quicklists [\#33](https://github.com/FreeRDP/Remmina/pull/33) ([krnekhelesh](https://github.com/krnekhelesh)) +- update french translation [\#32](https://github.com/FreeRDP/Remmina/pull/32) ([emmanuelgrognet](https://github.com/emmanuelgrognet)) +- Fixes for recent git FreeRDP headers [\#31](https://github.com/FreeRDP/Remmina/pull/31) ([maelnor](https://github.com/maelnor)) +- GTK cleanup in remmina\_main.c [\#30](https://github.com/FreeRDP/Remmina/pull/30) ([floppym](https://github.com/floppym)) +- Install plugins under CMAKE\_INSTALL\_LIBDIR. [\#29](https://github.com/FreeRDP/Remmina/pull/29) ([floppym](https://github.com/floppym)) +- Implementing X-GNOME-FullName [\#28](https://github.com/FreeRDP/Remmina/pull/28) ([dktrkranz](https://github.com/dktrkranz)) +- Make Gnome Keyring an optional dependency. [\#27](https://github.com/FreeRDP/Remmina/pull/27) ([floppym](https://github.com/floppym)) +- Fix installation of desktop file and related icons. [\#26](https://github.com/FreeRDP/Remmina/pull/26) ([floppym](https://github.com/floppym)) +- Mark 'Connect' and 'New' as important tool items so they always have labels [\#25](https://github.com/FreeRDP/Remmina/pull/25) ([robert-ancell](https://github.com/robert-ancell)) +- Mark main toolbar as a primary toolbar \(so is correctly themed\) [\#24](https://github.com/FreeRDP/Remmina/pull/24) ([robert-ancell](https://github.com/robert-ancell)) +- Do not use convenience copy of libvncserver [\#22](https://github.com/FreeRDP/Remmina/pull/22) ([dktrkranz](https://github.com/dktrkranz)) +- remmina: install .desktop file [\#20](https://github.com/FreeRDP/Remmina/pull/20) ([jbicha](https://github.com/jbicha)) + +## [1.0.0](https://github.com/FreeRDP/remmina/tree/1.0.0) (2012-02-10) +**Closed issues:** + +- Can't compile with GTK+ [\#3](https://github.com/FreeRDP/Remmina/issues/3) + +**Merged pull requests:** + +- A few minor issues [\#11](https://github.com/FreeRDP/Remmina/pull/11) ([doctaweeks](https://github.com/doctaweeks)) +- remmina: menu separator fix if avahi is disabled [\#10](https://github.com/FreeRDP/Remmina/pull/10) ([doctaweeks](https://github.com/doctaweeks)) +- GTK2/3 issue + re-enable ssh [\#8](https://github.com/FreeRDP/Remmina/pull/8) ([doctaweeks](https://github.com/doctaweeks)) +- Fix missed header path, closes \#4 [\#5](https://github.com/FreeRDP/Remmina/pull/5) ([chihchun](https://github.com/chihchun)) +- CMake Migration [\#2](https://github.com/FreeRDP/Remmina/pull/2) ([awakecoding](https://github.com/awakecoding)) + + + +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file -- cgit v1.2.3 From 17874b0af6d440821b35bb12b77dd0ebfd297503 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Wed, 16 Sep 2015 17:09:29 +0200 Subject: CHANGELOG first release using git@github.com:skywinder/github-changelog-generator.git --- CHANGELOG.md | 552 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 552 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..158a52d72 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,552 @@ +# Change Log + +## [Unreleased](https://github.com/FreeRDP/remmina/tree/HEAD) + +[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.2.0-rcgit.4...HEAD) + +**Closed issues:** + +- Remmina VS freerdp on 1.2.0 version [\#639](https://github.com/FreeRDP/Remmina/issues/639) + +## [v1.2.0-rcgit.4](https://github.com/FreeRDP/remmina/tree/v1.2.0-rcgit.4) (2015-09-15) +[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.2.0-rcgit.3...v1.2.0-rcgit.4) + +**Implemented enhancements:** + +- Remmina crashes using the Mir GTK backend [\#554](https://github.com/FreeRDP/Remmina/issues/554) +- Prior connections commands are executed in background [\#553](https://github.com/FreeRDP/Remmina/issues/553) +- Quick Search Textbox is Only 8 Characters Wide [\#547](https://github.com/FreeRDP/Remmina/issues/547) +- How about support XDG dir structure [\#129](https://github.com/FreeRDP/Remmina/issues/129) +- Gtk3 - Deprecation fixes [\#637](https://github.com/FreeRDP/Remmina/pull/637) ([antenore](https://github.com/antenore)) + +**Fixed bugs:** + +- Prior connections commands are executed in background [\#553](https://github.com/FreeRDP/Remmina/issues/553) +- Remmina fullscreen is wrongly placed - not real fullscreen [\#525](https://github.com/FreeRDP/Remmina/issues/525) + +**Closed issues:** + +- freeze when kvm setup finish [\#630](https://github.com/FreeRDP/Remmina/issues/630) +- Dependency problem on Ubuntu PPA remmina-next [\#629](https://github.com/FreeRDP/Remmina/issues/629) +- Remmina preferences are not being saved [\#627](https://github.com/FreeRDP/Remmina/issues/627) +- Redirection of audio to local fails [\#626](https://github.com/FreeRDP/Remmina/issues/626) +- RDP component not installed [\#620](https://github.com/FreeRDP/Remmina/issues/620) +- Wrong path in /usr/share/applications/remmina.desktop since version 1.1.1-1+766+next+201507170316~ubuntu14.04.1 [\#616](https://github.com/FreeRDP/Remmina/issues/616) +- Reverse layout switching doesn't work [\#605](https://github.com/FreeRDP/Remmina/issues/605) +- Cursor disappear and doesn't refresh in RDP [\#598](https://github.com/FreeRDP/Remmina/issues/598) +- support VNC on UNIX sockets [\#596](https://github.com/FreeRDP/Remmina/issues/596) +- Problem with RDP graphics [\#591](https://github.com/FreeRDP/Remmina/issues/591) +- Crash when using TortoiseGit over a remote Windows through Remmina [\#582](https://github.com/FreeRDP/Remmina/issues/582) +- Remmina 1.1.2 does not compile against FreeRDP 1.0.2 [\#579](https://github.com/FreeRDP/Remmina/issues/579) +- Sorting of hosts in notification pop-up area should not be case sensitive [\#574](https://github.com/FreeRDP/Remmina/issues/574) +- How to add custom keyboard layouts to RDP? [\#573](https://github.com/FreeRDP/Remmina/issues/573) +- provide Gnome 3 indicator [\#570](https://github.com/FreeRDP/Remmina/issues/570) +- New grouping mode: All-In-One [\#569](https://github.com/FreeRDP/Remmina/issues/569) +- Remmina nx won't connect with Ubuntu 15.04 [\#567](https://github.com/FreeRDP/Remmina/issues/567) +- Missing connection icons in tray menu [\#563](https://github.com/FreeRDP/Remmina/issues/563) +- undefined symbol: freerdp\_channels\_pop\_event in remmina-plugin-rdp.so [\#558](https://github.com/FreeRDP/Remmina/issues/558) +- Can't Sustain "Scale and Fill client window" Preference [\#557](https://github.com/FreeRDP/Remmina/issues/557) +- webbrowser support [\#551](https://github.com/FreeRDP/Remmina/issues/551) +- VNC connection crashes Remmina [\#546](https://github.com/FreeRDP/Remmina/issues/546) +- Remmina doesn't copy cells from libreoffice to WS2003R2 [\#541](https://github.com/FreeRDP/Remmina/issues/541) +- =net-misc/remmina-1.1.2 ssh quick connect always ask password, even if server don't support it [\#539](https://github.com/FreeRDP/Remmina/issues/539) +- Bring back Scaling WITHOUT respecting the remote destkop aspect ratio [\#537](https://github.com/FreeRDP/Remmina/issues/537) +- Remmina consistently crashes when I log out of an RDP Gateway session. [\#530](https://github.com/FreeRDP/Remmina/issues/530) +- remmina: gtk\_drag\_source\_info\_destroy\(\): remmina killed by SIGABRT [\#529](https://github.com/FreeRDP/Remmina/issues/529) +- Add ability to run an arbitrary command prior to connection. [\#520](https://github.com/FreeRDP/Remmina/issues/520) +- ssh key selection overwritten on edit [\#271](https://github.com/FreeRDP/Remmina/issues/271) +- VNC over SSH - Support for multiple keys for SSH authentication [\#256](https://github.com/FreeRDP/Remmina/issues/256) +- RDP: No caret on explorer address bar and white squares instead of small icons [\#251](https://github.com/FreeRDP/Remmina/issues/251) +- Remmina doesn't respect ssh config files... [\#235](https://github.com/FreeRDP/Remmina/issues/235) +- It does not move the text to scroll [\#208](https://github.com/FreeRDP/Remmina/issues/208) +- Crash in BitBlt\_SRCAND\_32bpp, BitBlt\_32bpp [\#186](https://github.com/FreeRDP/Remmina/issues/186) +- Can't attach to Windows console [\#177](https://github.com/FreeRDP/Remmina/issues/177) +- RDP disconnect from within Windows doesn't close session for 15-20 seconds [\#167](https://github.com/FreeRDP/Remmina/issues/167) +- No shared folder when connecting to console [\#161](https://github.com/FreeRDP/Remmina/issues/161) +- drive-client not copied/loaded properly [\#147](https://github.com/FreeRDP/Remmina/issues/147) +- Smartcard & sound redirection error [\#121](https://github.com/FreeRDP/Remmina/issues/121) +- Possibility to enter a remote command in SSH when I use it for VNC [\#94](https://github.com/FreeRDP/Remmina/issues/94) +- openpty\(3\) support for Remmina [\#73](https://github.com/FreeRDP/Remmina/issues/73) + +**Merged pull requests:** + +- libssh fixes - SSH\_OPTIONS\_LOG\_VERBOSITY [\#640](https://github.com/FreeRDP/Remmina/pull/640) ([antenore](https://github.com/antenore)) +- Updated AUTHORS list [\#636](https://github.com/FreeRDP/Remmina/pull/636) ([antenore](https://github.com/antenore)) +- Improve vnc rendering speed by using cairo surface directly [\#635](https://github.com/FreeRDP/Remmina/pull/635) ([mar-kolya](https://github.com/mar-kolya)) +- CMake rules adjustments when compiling under linux [\#634](https://github.com/FreeRDP/Remmina/pull/634) ([fundawang](https://github.com/fundawang)) +- Remove some legacy Xorg code, fixes \#554 [\#622](https://github.com/FreeRDP/Remmina/pull/622) ([giox069](https://github.com/giox069)) +- fix regression introduced by 190ea2f98ab0443b8a05f70c79e2af037f9fca94 [\#617](https://github.com/FreeRDP/Remmina/pull/617) ([zfil](https://github.com/zfil)) +- remmina.desktop: Use full path to execute remmina [\#612](https://github.com/FreeRDP/Remmina/pull/612) ([lanoxx](https://github.com/lanoxx)) +- remmina.desktop: Use full path to execute remmina [\#607](https://github.com/FreeRDP/Remmina/pull/607) ([lanoxx](https://github.com/lanoxx)) +- Filling out LoadBalanceInfo in the RDP settings struct [\#593](https://github.com/FreeRDP/Remmina/pull/593) ([qwertos](https://github.com/qwertos)) +- Exception when precommad in NULL. Reference \#591 [\#592](https://github.com/FreeRDP/Remmina/pull/592) ([antenore](https://github.com/antenore)) +- Xdg folders fixes \#129 \#197 [\#590](https://github.com/FreeRDP/Remmina/pull/590) ([antenore](https://github.com/antenore)) +- coredump when precommand is not quoted. Resolve \#520 [\#589](https://github.com/FreeRDP/Remmina/pull/589) ([antenore](https://github.com/antenore)) +- Support for ~/.ssh/config closes \#235 , libssh does not support most of the ssh options [\#588](https://github.com/FreeRDP/Remmina/pull/588) ([antenore](https://github.com/antenore)) +- Revert "License update" [\#587](https://github.com/FreeRDP/Remmina/pull/587) ([antenore](https://github.com/antenore)) +- Revert "License update" [\#586](https://github.com/FreeRDP/Remmina/pull/586) ([antenore](https://github.com/antenore)) +- Remmina freerdp subtree + fixes for FreeBSD [\#585](https://github.com/FreeRDP/Remmina/pull/585) ([antenore](https://github.com/antenore)) +- License update [\#581](https://github.com/FreeRDP/Remmina/pull/581) ([antenore](https://github.com/antenore)) +- Fix GTK+2 build failure [\#565](https://github.com/FreeRDP/Remmina/pull/565) ([heptalium](https://github.com/heptalium)) +- Prior Connection Command [\#562](https://github.com/FreeRDP/Remmina/pull/562) ([antenore](https://github.com/antenore)) +- Update Uzbek translation [\#561](https://github.com/FreeRDP/Remmina/pull/561) ([ozbek](https://github.com/ozbek)) +- Update for GTK+2 port [\#555](https://github.com/FreeRDP/Remmina/pull/555) ([repzilon](https://github.com/repzilon)) + +## [v1.2.0-rcgit.3](https://github.com/FreeRDP/remmina/tree/v1.2.0-rcgit.3) (2015-04-14) +[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.2.0-rcgit.2...v1.2.0-rcgit.3) + +**Implemented enhancements:** + +- Show or hide the icons near the menu [\#504](https://github.com/FreeRDP/Remmina/issues/504) +- Show or hide the icons near the buttons [\#503](https://github.com/FreeRDP/Remmina/issues/503) +- Show or hide the icons near the buttons and the menus [\#505](https://github.com/FreeRDP/Remmina/pull/505) ([muflone](https://github.com/muflone)) +- Fixes FreeRDP/Remmina\#473 - Customize button in the connection editor should show the resolutions dialog [\#501](https://github.com/FreeRDP/Remmina/pull/501) ([antenore](https://github.com/antenore)) +- The quick search doesn't list the folders [\#497](https://github.com/FreeRDP/Remmina/pull/497) ([muflone](https://github.com/muflone)) +- Enable and disable buttons in the string list dialog [\#496](https://github.com/FreeRDP/Remmina/pull/496) ([muflone](https://github.com/muflone)) +- Added Ctrl+F accelerator for quick search entry [\#494](https://github.com/FreeRDP/Remmina/pull/494) ([muflone](https://github.com/muflone)) +- Removed the RemminaMain GType and used a static RemminaMain struct instead [\#461](https://github.com/FreeRDP/Remmina/pull/461) ([muflone](https://github.com/muflone)) + +**Fixed bugs:** + +- Tab all connections [\#548](https://github.com/FreeRDP/Remmina/issues/548) +- Problem with shared folder on Windows Server 2012 [\#523](https://github.com/FreeRDP/Remmina/issues/523) +- Can't share a folder in KDE, due to Gtk issue [\#518](https://github.com/FreeRDP/Remmina/issues/518) +- Connection to all servers stopped working with last update of remmina-next PPA [\#506](https://github.com/FreeRDP/Remmina/issues/506) +- Unsupported properties on GTK 3.10 [\#486](https://github.com/FreeRDP/Remmina/issues/486) +- Buttons in the string list dialog [\#474](https://github.com/FreeRDP/Remmina/issues/474) +- Customize button in the connection editor should show the resolutions dialog [\#473](https://github.com/FreeRDP/Remmina/issues/473) +- The search shouldn't show every group in the list [\#471](https://github.com/FreeRDP/Remmina/issues/471) +- Enable the use of the menu key [\#470](https://github.com/FreeRDP/Remmina/issues/470) +- Connections list is not refreshed upon update or copy \(duplicate an existing connection\) [\#460](https://github.com/FreeRDP/Remmina/issues/460) +- Auto-highlighted "Quick Connect" connection name within new connection dialog copies the words "Quick Connect" into PRIMARY selection [\#263](https://github.com/FreeRDP/Remmina/issues/263) +- Double-clicking a column header to sort list of saved connections actually attempts connection [\#250](https://github.com/FreeRDP/Remmina/issues/250) +- Fix small memory leaks and a NULL ptr dereference. [\#500](https://github.com/FreeRDP/Remmina/pull/500) ([KyleSanderson](https://github.com/KyleSanderson)) +- Show the popup menu by pressing the menu key [\#495](https://github.com/FreeRDP/Remmina/pull/495) ([muflone](https://github.com/muflone)) +- Use the correct label for the font section [\#466](https://github.com/FreeRDP/Remmina/pull/466) ([weberhofer](https://github.com/weberhofer)) + +**Closed issues:** + +- Remmina main window can be opened multiple times [\#543](https://github.com/FreeRDP/Remmina/issues/543) +- =net-misc/remmina-1.1.2 Quick Connect should filter supported protocols similiarly with profile manager [\#540](https://github.com/FreeRDP/Remmina/issues/540) +- Remmina not showing entire desktop, Windows Remote Desktop Connection does. [\#534](https://github.com/FreeRDP/Remmina/issues/534) +- Copy and Paste between local and remote desktops failing in Ubuntu 15.04 [\#533](https://github.com/FreeRDP/Remmina/issues/533) +- Remmina does not report Host key Changed. [\#532](https://github.com/FreeRDP/Remmina/issues/532) +- compile with FreeRDP support failed on Funtoo Linux [\#526](https://github.com/FreeRDP/Remmina/issues/526) +- Exit VMWare Console via Remmina in 1.2.0 [\#522](https://github.com/FreeRDP/Remmina/issues/522) +- RDP Quality is not being stored [\#521](https://github.com/FreeRDP/Remmina/issues/521) +- Add the ability to place the floating toolbar on other sides of the screen [\#493](https://github.com/FreeRDP/Remmina/issues/493) +- Invisible toolbar in fullscreen mode grayed out [\#492](https://github.com/FreeRDP/Remmina/issues/492) +- Remarks to some setting's labels [\#489](https://github.com/FreeRDP/Remmina/issues/489) +- Open resolution list from connection editor [\#487](https://github.com/FreeRDP/Remmina/issues/487) +- Missing accelerators for search and quick connect entries [\#475](https://github.com/FreeRDP/Remmina/issues/475) +- Only one host key per domain name is allowed [\#465](https://github.com/FreeRDP/Remmina/issues/465) +- Latest changes causes compilation errors [\#464](https://github.com/FreeRDP/Remmina/issues/464) +- Host Name checking is erroneously case sensitive for RDP fingerprint [\#462](https://github.com/FreeRDP/Remmina/issues/462) +- Unable to connect "protocol security negotiation failure" [\#453](https://github.com/FreeRDP/Remmina/issues/453) +- Remmina crashes when using multiple RDP connections and closing one or more. [\#449](https://github.com/FreeRDP/Remmina/issues/449) +- Provide a way to send keys to the server connections [\#445](https://github.com/FreeRDP/Remmina/issues/445) +- Does \(or will\) Remmina support multi monitor RDP? [\#442](https://github.com/FreeRDP/Remmina/issues/442) +- xfreerdrp Crashes with segfault in find\_keyboard\_layout\_in\_xorg\_rules [\#441](https://github.com/FreeRDP/Remmina/issues/441) +- NX connection to freenx-client with custom key [\#436](https://github.com/FreeRDP/Remmina/issues/436) +- Unable to connect using \\server-name [\#435](https://github.com/FreeRDP/Remmina/issues/435) +- Regression: "Unknown authentication scheme from VNC server: 18" [\#433](https://github.com/FreeRDP/Remmina/issues/433) +- Copy file rdp [\#430](https://github.com/FreeRDP/Remmina/issues/430) +- Connection closes right away when trying to connect to Mac [\#427](https://github.com/FreeRDP/Remmina/issues/427) +- RDP clipboard and shared folder issue [\#406](https://github.com/FreeRDP/Remmina/issues/406) +- Crush RDP connect when copy file into clipboard on RDP server and clipboard sync ON [\#401](https://github.com/FreeRDP/Remmina/issues/401) +- Compilation failed on ubuntu 14.04 and 14.10 [\#381](https://github.com/FreeRDP/Remmina/issues/381) +- vertical text issue with excel [\#345](https://github.com/FreeRDP/Remmina/issues/345) +- Failure refresh image [\#341](https://github.com/FreeRDP/Remmina/issues/341) +- Segfault in rf\_Pointer\_Free of rdp plugin [\#269](https://github.com/FreeRDP/Remmina/issues/269) +- Auto-fit stucks the window [\#257](https://github.com/FreeRDP/Remmina/issues/257) +- Remmina-plugins-rdp fails to compile correctly with the latest version of gcc & freerdp [\#244](https://github.com/FreeRDP/Remmina/issues/244) +- Remmina has stopped showing shared folders [\#243](https://github.com/FreeRDP/Remmina/issues/243) +- Lost toolbar in keyboard captured mode [\#242](https://github.com/FreeRDP/Remmina/issues/242) +- Better user credentials management [\#229](https://github.com/FreeRDP/Remmina/issues/229) +- Command Line Arguments [\#227](https://github.com/FreeRDP/Remmina/issues/227) +- Copy paste clipboard does not work [\#207](https://github.com/FreeRDP/Remmina/issues/207) +- remmina not compiling on cent os 6.4 x64 [\#201](https://github.com/FreeRDP/Remmina/issues/201) +- sometimes gives black screen [\#198](https://github.com/FreeRDP/Remmina/issues/198) +- remmina remote desktop -- erratic partial display issue [\#181](https://github.com/FreeRDP/Remmina/issues/181) +- remmina incorrectly handles saved terminal size for ssh-connection [\#169](https://github.com/FreeRDP/Remmina/issues/169) +- net-misc/remmina-1.0.0\_p20121004 fails rsa-key auth on X11Forwarding-enabled OpenSSH server [\#168](https://github.com/FreeRDP/Remmina/issues/168) +- Remmina will not load RDP plugins [\#165](https://github.com/FreeRDP/Remmina/issues/165) +- cmake install prefix bug [\#160](https://github.com/FreeRDP/Remmina/issues/160) +- Graphical glitch with Total Commander and Remmina [\#157](https://github.com/FreeRDP/Remmina/issues/157) +- An Archer's tale - Unable to compile, compilation, followed by inability to path plugins. [\#152](https://github.com/FreeRDP/Remmina/issues/152) +- display off-center upon connection to RDP hosts [\#143](https://github.com/FreeRDP/Remmina/issues/143) +- RDP refresh/redraw problem [\#138](https://github.com/FreeRDP/Remmina/issues/138) +- Blank/black window contents when opening a new connection [\#127](https://github.com/FreeRDP/Remmina/issues/127) +- patch for launching external tools [\#126](https://github.com/FreeRDP/Remmina/issues/126) +- New connection type: VNC Reverse Connection [\#108](https://github.com/FreeRDP/Remmina/issues/108) +- Cannot connect to shared OS X screen protected with password only. [\#104](https://github.com/FreeRDP/Remmina/issues/104) +- Remote screen has wrong offset when using hide-toolbar [\#103](https://github.com/FreeRDP/Remmina/issues/103) +- Remmina Won't Maintain Multiple RDP Sessions at the Same Time [\#99](https://github.com/FreeRDP/Remmina/issues/99) +- Screen capture software crashes remmina client [\#98](https://github.com/FreeRDP/Remmina/issues/98) +- SSH terminal color customization [\#91](https://github.com/FreeRDP/Remmina/issues/91) +- \[Enhancement\] Start in background [\#85](https://github.com/FreeRDP/Remmina/issues/85) +- SSH Freeze [\#84](https://github.com/FreeRDP/Remmina/issues/84) +- Initial screen wonky opening VNC client [\#69](https://github.com/FreeRDP/Remmina/issues/69) +- Issues with viewport fullscreen [\#44](https://github.com/FreeRDP/Remmina/issues/44) +- make sessions in the NX session dialog double-clickable [\#16](https://github.com/FreeRDP/Remmina/issues/16) + +**Merged pull requests:** + +- Added an option to execute commands just before to connect to a remote server closes \#520 [\#552](https://github.com/FreeRDP/Remmina/pull/552) ([antenore](https://github.com/antenore)) +- Uzbek Cyrillic: use proper naming convention for filename [\#549](https://github.com/FreeRDP/Remmina/pull/549) ([ozbek](https://github.com/ozbek)) +- Uzbek Cyrillic: Add configure keystrokes and XDMCP feature text [\#538](https://github.com/FreeRDP/Remmina/pull/538) ([ozbek](https://github.com/ozbek)) +- Remmina 1.2.0-rcgit.3: new floating toolbar for GTK\>=3.10 and many other fixes [\#536](https://github.com/FreeRDP/Remmina/pull/536) ([giox069](https://github.com/giox069)) +- Fix for notebook tab drag and drop, fixes issues \#529 \#478 [\#531](https://github.com/FreeRDP/Remmina/pull/531) ([giox069](https://github.com/giox069)) +- Fix race condition in VNC event queue [\#519](https://github.com/FreeRDP/Remmina/pull/519) ([mar-kolya](https://github.com/mar-kolya)) +- Uzbek Cyrillic: apply latest additions [\#509](https://github.com/FreeRDP/Remmina/pull/509) ([ozbek](https://github.com/ozbek)) +- Implemented custom keystrokes for plugins [\#508](https://github.com/FreeRDP/Remmina/pull/508) ([muflone](https://github.com/muflone)) +- Add translations for Uzbek Cyrillic [\#502](https://github.com/FreeRDP/Remmina/pull/502) ([ozbek](https://github.com/ozbek)) +- Update Spanish translation [\#490](https://github.com/FreeRDP/Remmina/pull/490) ([fitojb](https://github.com/fitojb)) +- Fixes FreeRDP/Remmina\#460 [\#463](https://github.com/FreeRDP/Remmina/pull/463) ([antenore](https://github.com/antenore)) +- Updated German translation [\#458](https://github.com/FreeRDP/Remmina/pull/458) ([weberhofer](https://github.com/weberhofer)) +- Update es.po [\#455](https://github.com/FreeRDP/Remmina/pull/455) ([agdg](https://github.com/agdg)) +- Update es.po [\#454](https://github.com/FreeRDP/Remmina/pull/454) ([agdg](https://github.com/agdg)) +- Updated FSF address [\#451](https://github.com/FreeRDP/Remmina/pull/451) ([weberhofer](https://github.com/weberhofer)) +- Rework of scaler code [\#447](https://github.com/FreeRDP/Remmina/pull/447) ([giox069](https://github.com/giox069)) +- Added feature to send Ctrl+Alt+Del keys [\#446](https://github.com/FreeRDP/Remmina/pull/446) ([muflone](https://github.com/muflone)) +- Moved the double click event and the enter buttons press in the row-activated signal handler [\#438](https://github.com/FreeRDP/Remmina/pull/438) ([muflone](https://github.com/muflone)) +- Handle double click on the NX session rows to activate the default response [\#437](https://github.com/FreeRDP/Remmina/pull/437) ([muflone](https://github.com/muflone)) +- SSH terminal color customization [\#432](https://github.com/FreeRDP/Remmina/pull/432) ([muflone](https://github.com/muflone)) +- remmina: Actually install its headers. [\#428](https://github.com/FreeRDP/Remmina/pull/428) ([rakuco](https://github.com/rakuco)) + +## [v1.2.0-rcgit.2](https://github.com/FreeRDP/remmina/tree/v1.2.0-rcgit.2) (2014-12-30) +[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.1.2...v1.2.0-rcgit.2) + +**Fixed bugs:** + +- Position of popup menu is wrong [\#423](https://github.com/FreeRDP/Remmina/issues/423) +- Remmina crashes exporting a remote desktop file [\#412](https://github.com/FreeRDP/Remmina/issues/412) +- \[BUG\] RDP Preferences don't saving [\#391](https://github.com/FreeRDP/Remmina/issues/391) +- Command line help not showing all the options [\#327](https://github.com/FreeRDP/Remmina/issues/327) + +**Closed issues:** + +- Remmina crashes after Ctrl+X in a RDP session [\#422](https://github.com/FreeRDP/Remmina/issues/422) +- Remmina Crashes During RDP Session when Context Menu Item Clicked [\#418](https://github.com/FreeRDP/Remmina/issues/418) +- Host key change not indicated in Remmina GUI [\#407](https://github.com/FreeRDP/Remmina/issues/407) +- Copy/paste inop Windows to Mint 17 [\#404](https://github.com/FreeRDP/Remmina/issues/404) +- remmina/src/remmina\_ssh\_plugin.h should also check for HAVE\_LIBVTE [\#394](https://github.com/FreeRDP/Remmina/issues/394) +- I have to click on "Resize the window to fit remote resolution" to see my RDP session. [\#387](https://github.com/FreeRDP/Remmina/issues/387) +- Please create an AppData file for Remmina [\#272](https://github.com/FreeRDP/Remmina/issues/272) +- "Protocol plugin RDP is not installed."/The Application Not Recognizing the RDP Plugin [\#249](https://github.com/FreeRDP/Remmina/issues/249) +- "Overwrite all" button [\#238](https://github.com/FreeRDP/Remmina/issues/238) + +**Merged pull requests:** + +- .po files cleanup and updates [\#425](https://github.com/FreeRDP/Remmina/pull/425) ([giox069](https://github.com/giox069)) +- Fixes the position of popup menu [\#424](https://github.com/FreeRDP/Remmina/pull/424) ([muflone](https://github.com/muflone)) +- Add a "Overwrite all" button [\#420](https://github.com/FreeRDP/Remmina/pull/420) ([muflone](https://github.com/muflone)) +- New AppData specification file [\#419](https://github.com/FreeRDP/Remmina/pull/419) ([muflone](https://github.com/muflone)) +- Expose the arguments in the help text and parse --help and -h arguments locally [\#417](https://github.com/FreeRDP/Remmina/pull/417) ([muflone](https://github.com/muflone)) +- Clipboard: improved handling of time consuming clipboard transfer [\#416](https://github.com/FreeRDP/Remmina/pull/416) ([giox069](https://github.com/giox069)) +- Clipboard fixes [\#415](https://github.com/FreeRDP/Remmina/pull/415) ([giox069](https://github.com/giox069)) +- Next [\#414](https://github.com/FreeRDP/Remmina/pull/414) ([giox069](https://github.com/giox069)) +- GTK3 fixes [\#409](https://github.com/FreeRDP/Remmina/pull/409) ([giox069](https://github.com/giox069)) +- GTK3 migration of remmina\_ftp\_client, fixes \#365 [\#408](https://github.com/FreeRDP/Remmina/pull/408) ([giox069](https://github.com/giox069)) +- Update Remmina GTK+2 branch to 1.1.2 [\#405](https://github.com/FreeRDP/Remmina/pull/405) ([repzilon](https://github.com/repzilon)) + +## [v1.1.2](https://github.com/FreeRDP/remmina/tree/v1.1.2) (2014-12-08) +[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.1.1-gtk2...v1.1.2) + +**Fixed bugs:** + +- NX plugin broken [\#369](https://github.com/FreeRDP/Remmina/issues/369) +- XDMCP plugin broken [\#366](https://github.com/FreeRDP/Remmina/issues/366) + +**Closed issues:** + +- resize remote to fit window option [\#398](https://github.com/FreeRDP/Remmina/issues/398) +- Rename README to README.md [\#304](https://github.com/FreeRDP/Remmina/issues/304) + +**Merged pull requests:** + +- Fix RDP race condifion, fixes \#394 \(missing HAVE\_LIBVTE\), removed unused function [\#399](https://github.com/FreeRDP/Remmina/pull/399) ([giox069](https://github.com/giox069)) +- Merge pull request \#396 from FreeRDP/issue366 [\#397](https://github.com/FreeRDP/Remmina/pull/397) ([muflone](https://github.com/muflone)) +- Issue \#366 [\#396](https://github.com/FreeRDP/Remmina/pull/396) ([muflone](https://github.com/muflone)) + +## [v1.1.1-gtk2](https://github.com/FreeRDP/remmina/tree/v1.1.1-gtk2) (2014-12-07) +[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.1.1...v1.1.1-gtk2) + +**Closed issues:** + +- Password isn't saved [\#388](https://github.com/FreeRDP/Remmina/issues/388) +- undefined symbol: freerdp\_event\_new [\#379](https://github.com/FreeRDP/Remmina/issues/379) +- Compile failed [\#378](https://github.com/FreeRDP/Remmina/issues/378) +- Copy/Paste not working in 0.9.99.1 on Ubuntu 14.10 [\#377](https://github.com/FreeRDP/Remmina/issues/377) +- Crash when not accepting certificate for RDP server [\#375](https://github.com/FreeRDP/Remmina/issues/375) +- Can't get RDP to work in Remmina recently [\#374](https://github.com/FreeRDP/Remmina/issues/374) +- One IP, more RDP ports [\#373](https://github.com/FreeRDP/Remmina/issues/373) +- about box reports 1.1.0 rather than 1.1.1 [\#370](https://github.com/FreeRDP/Remmina/issues/370) +- Complete GTK3 migration [\#365](https://github.com/FreeRDP/Remmina/issues/365) +- Build failure with remmina-rdp\_cliprdr\_\* [\#363](https://github.com/FreeRDP/Remmina/issues/363) +- Key with code 95 si incorrectly mapped [\#361](https://github.com/FreeRDP/Remmina/issues/361) +- SSH connection not working: "ssh\_userauth\_password: Wrong state during pending SSH call" [\#305](https://github.com/FreeRDP/Remmina/issues/305) + +**Merged pull requests:** + +- Remmina 1.1.2 [\#402](https://github.com/FreeRDP/Remmina/pull/402) ([ic3d](https://github.com/ic3d)) +- Varoius fixes [\#393](https://github.com/FreeRDP/Remmina/pull/393) ([giox069](https://github.com/giox069)) +- install external tools to datadir, not user's home dir [\#385](https://github.com/FreeRDP/Remmina/pull/385) ([eworm-de](https://github.com/eworm-de)) +- Fix rdp\_cliprd for freerdp 1.2. Fixes \#378 \#379 [\#384](https://github.com/FreeRDP/Remmina/pull/384) ([giox069](https://github.com/giox069)) +- Update to work with vte 2.91 as well as 2.90 [\#372](https://github.com/FreeRDP/Remmina/pull/372) ([iainlane](https://github.com/iainlane)) +- Update to work with vte 2.91 as well as 2.90 [\#371](https://github.com/FreeRDP/Remmina/pull/371) ([iainlane](https://github.com/iainlane)) +- Added a Show quick connect menu item to show/hide the fast connection box [\#368](https://github.com/FreeRDP/Remmina/pull/368) ([muflone](https://github.com/muflone)) +- Fixed GTK3 issue [\#367](https://github.com/FreeRDP/Remmina/pull/367) ([weberhofer](https://github.com/weberhofer)) +- Rename relevant CB\_FORMAT to CF [\#364](https://github.com/FreeRDP/Remmina/pull/364) ([giox069](https://github.com/giox069)) +- Add printer and smartcard redirection, fix freerdp connection closing [\#359](https://github.com/FreeRDP/Remmina/pull/359) ([giox069](https://github.com/giox069)) +- Add printer and smartcard redirection, fix freerdp connection closing [\#358](https://github.com/FreeRDP/Remmina/pull/358) ([giox069](https://github.com/giox069)) +- Screenshots page with real screenshots! [\#355](https://github.com/FreeRDP/Remmina/pull/355) ([ic3d](https://github.com/ic3d)) +- Good News! [\#354](https://github.com/FreeRDP/Remmina/pull/354) ([ic3d](https://github.com/ic3d)) + +## [v1.1.1](https://github.com/FreeRDP/remmina/tree/v1.1.1) (2014-10-10) +[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.2.0-rcgit.1...v1.1.1) + +**Fixed bugs:** + +- Share local printer doesn't work [\#324](https://github.com/FreeRDP/Remmina/issues/324) +- VNC plugin settings - scaler too small [\#316](https://github.com/FreeRDP/Remmina/issues/316) +- Protocol settings compact flag don't seem to be honored in the gtk3 branch [\#314](https://github.com/FreeRDP/Remmina/issues/314) +- gtk\_widget\_set\_opacity not supported by GTK 3.4.2 \(for Debian 7.0\) [\#299](https://github.com/FreeRDP/Remmina/issues/299) +- Clipboard Sync with RDP [\#280](https://github.com/FreeRDP/Remmina/issues/280) +- Terminal windows disappearing [\#274](https://github.com/FreeRDP/Remmina/issues/274) +- Remmina crash when trying to connect to remote VNC [\#252](https://github.com/FreeRDP/Remmina/issues/252) +- Fix segfault reported by issue \#1 \#280 \#131 \#135 \#199 \#270 [\#282](https://github.com/FreeRDP/Remmina/pull/282) ([antenore](https://github.com/antenore)) + +**Closed issues:** + +- Stucked shift key [\#90](https://github.com/FreeRDP/Remmina/issues/90) +- New branch 'next' [\#313](https://github.com/FreeRDP/Remmina/issues/313) +- Laggy graphics with remmina [\#308](https://github.com/FreeRDP/Remmina/issues/308) +- does sound work for remmina RDP? [\#296](https://github.com/FreeRDP/Remmina/issues/296) +- Remmina install /usr/include/remmina/ empty [\#292](https://github.com/FreeRDP/Remmina/issues/292) +- Remmina freeze after system boots from suspend [\#284](https://github.com/FreeRDP/Remmina/issues/284) +- Sound connection not possible via RDP [\#281](https://github.com/FreeRDP/Remmina/issues/281) +- Blank window on connect - found whats causign it [\#273](https://github.com/FreeRDP/Remmina/issues/273) +- Shared folder on RDP does not work [\#270](https://github.com/FreeRDP/Remmina/issues/270) +- RDP connection cannot be established [\#248](https://github.com/FreeRDP/Remmina/issues/248) + +**Merged pull requests:** + +- Fix debian bug 764142 [\#353](https://github.com/FreeRDP/Remmina/pull/353) ([giox069](https://github.com/giox069)) +- Internationalization fixes [\#320](https://github.com/FreeRDP/Remmina/pull/320) ([giox069](https://github.com/giox069)) +- Merge antenore:master with FreeRDP:gtk3 - GTK3 migration - File editor [\#311](https://github.com/FreeRDP/Remmina/pull/311) ([antenore](https://github.com/antenore)) +- Help GNOME SHELL to not hide the floating toolbar [\#309](https://github.com/FreeRDP/Remmina/pull/309) ([giox069](https://github.com/giox069)) +- Enabled sound \(fixes \#296 \#281\) and improved disconnection detection. [\#297](https://github.com/FreeRDP/Remmina/pull/297) ([giox069](https://github.com/giox069)) +- Corrections to keyboard grab/ungrab. Fixes \#245 [\#295](https://github.com/FreeRDP/Remmina/pull/295) ([giox069](https://github.com/giox069)) +- Fixes for clipboard issues [\#294](https://github.com/FreeRDP/Remmina/pull/294) ([giox069](https://github.com/giox069)) +- Fix GTK2 compatibility [\#293](https://github.com/FreeRDP/Remmina/pull/293) ([amon-sha](https://github.com/amon-sha)) +- Indentation fix [\#290](https://github.com/FreeRDP/Remmina/pull/290) ([giox069](https://github.com/giox069)) +- Fix \#288 \#143 and deprecated gtk\_widget\_reparent\(\) [\#289](https://github.com/FreeRDP/Remmina/pull/289) ([giox069](https://github.com/giox069)) +- Issue \#286 - License OpenSSL linking exception [\#287](https://github.com/FreeRDP/Remmina/pull/287) ([antenore](https://github.com/antenore)) +- GTK+ 2 compatibility [\#276](https://github.com/FreeRDP/Remmina/pull/276) ([repzilon](https://github.com/repzilon)) +- Fix issue with invisible toolbar in fullscreen. [\#275](https://github.com/FreeRDP/Remmina/pull/275) ([jerrido](https://github.com/jerrido)) +- Fix for issue \#251 [\#253](https://github.com/FreeRDP/Remmina/pull/253) ([giox069](https://github.com/giox069)) + +## [v1.2.0-rcgit.1](https://github.com/FreeRDP/remmina/tree/v1.2.0-rcgit.1) (2014-10-08) +[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.1.0...v1.2.0-rcgit.1) + +**Closed issues:** + +- undefined symbol: freerdp\_channels\_global\_init in remmina-plugin-rdp.so [\#278](https://github.com/FreeRDP/Remmina/issues/278) + +**Merged pull requests:** + +- Fix issue \#90 and website URL [\#352](https://github.com/FreeRDP/Remmina/pull/352) ([giox069](https://github.com/giox069)) +- Fix issue \#90 and various updates [\#351](https://github.com/FreeRDP/Remmina/pull/351) ([giox069](https://github.com/giox069)) +- Updated menu links [\#350](https://github.com/FreeRDP/Remmina/pull/350) ([ic3d](https://github.com/ic3d)) +- Update links [\#349](https://github.com/FreeRDP/Remmina/pull/349) ([ic3d](https://github.com/ic3d)) +- Changed links [\#348](https://github.com/FreeRDP/Remmina/pull/348) ([ic3d](https://github.com/ic3d)) +- Remove call to freerdp\_get\_last\_error [\#346](https://github.com/FreeRDP/Remmina/pull/346) ([dktrkranz](https://github.com/dktrkranz)) + +## [v1.1.0](https://github.com/FreeRDP/remmina/tree/v1.1.0) (2014-10-03) +[Full Changelog](https://github.com/FreeRDP/remmina/compare/1.0.0...v1.1.0) + +**Fixed bugs:** + +- Black or white window when RDP connects at 32bpp [\#329](https://github.com/FreeRDP/Remmina/issues/329) +- Remmina RDP does not disconnect when closing the client window or tab [\#288](https://github.com/FreeRDP/Remmina/issues/288) +- Super/windows keypresses always present [\#7](https://github.com/FreeRDP/Remmina/issues/7) + +**Closed issues:** + +- Protocol plug-in RDP is not installed. [\#337](https://github.com/FreeRDP/Remmina/issues/337) +- FreeRDP / Remmina - is this a fork? [\#325](https://github.com/FreeRDP/Remmina/issues/325) +- RDP configuration tab garbled in GTK3 branch. [\#319](https://github.com/FreeRDP/Remmina/issues/319) +- Remmina hangs and doesn't let to switch to another program [\#310](https://github.com/FreeRDP/Remmina/issues/310) +- VNC plugin not available in Remmnia [\#307](https://github.com/FreeRDP/Remmina/issues/307) +- Identityfile not loaded properly [\#306](https://github.com/FreeRDP/Remmina/issues/306) +- Second Monitor in Portrait mode breaks dropdown. [\#298](https://github.com/FreeRDP/Remmina/issues/298) +- OpenSSL linking exception? [\#286](https://github.com/FreeRDP/Remmina/issues/286) +- Please tag 1.2.0-beta1 [\#285](https://github.com/FreeRDP/Remmina/issues/285) +- Remmina Remote Desktop Client doesn't save Quality option changes [\#283](https://github.com/FreeRDP/Remmina/issues/283) +- Cannot compile on Fedora 20 [\#277](https://github.com/FreeRDP/Remmina/issues/277) +- Cannot install Remmina [\#266](https://github.com/FreeRDP/Remmina/issues/266) +- Crash while trying to connect using iFreeRDP for iPad App. [\#264](https://github.com/FreeRDP/Remmina/issues/264) +- Public key should not be separately required for SSH PK authentication [\#262](https://github.com/FreeRDP/Remmina/issues/262) +- NX Session: Unresponsive to mouse input, window does not focus. [\#258](https://github.com/FreeRDP/Remmina/issues/258) +- GUI omits basic error information [\#247](https://github.com/FreeRDP/Remmina/issues/247) +- Super/ Windows key not grabbed [\#245](https://github.com/FreeRDP/Remmina/issues/245) +- Remmina fails to compile against latest freerdp on github [\#228](https://github.com/FreeRDP/Remmina/issues/228) +- Cannot connect to RDP over SSH to multiple hosts [\#223](https://github.com/FreeRDP/Remmina/issues/223) +- Bring Japanese translation from Ubuntu [\#216](https://github.com/FreeRDP/Remmina/issues/216) +- Bad colors on Ubuntu 13.04 [\#212](https://github.com/FreeRDP/Remmina/issues/212) +- Crash redirected folder / printer. [\#199](https://github.com/FreeRDP/Remmina/issues/199) +- FREERDP\_CLIENT\_LIBRARY, FREERDP\_LOCALE\_LIBRARY is not found [\#193](https://github.com/FreeRDP/Remmina/issues/193) +- Compile error building remmina-plugin-rdp [\#189](https://github.com/FreeRDP/Remmina/issues/189) +- error: unknown type name 'RDP\_EVENT' when compiled against current freerdp [\#187](https://github.com/FreeRDP/Remmina/issues/187) +- Warinig unimplemented brush style:2 and Beyond Compare in Win7 x64 [\#184](https://github.com/FreeRDP/Remmina/issues/184) +- Remmina crashes \(BSOD\) Windows NT 4 Terminal Server [\#183](https://github.com/FreeRDP/Remmina/issues/183) +- problems compiling [\#180](https://github.com/FreeRDP/Remmina/issues/180) +- SSH Problem to older linux servers. [\#175](https://github.com/FreeRDP/Remmina/issues/175) +- external\_tools directory should not be installed [\#171](https://github.com/FreeRDP/Remmina/issues/171) +- Unable to compile against current freerdp [\#159](https://github.com/FreeRDP/Remmina/issues/159) +- d5yt6guyhukijlkolpk;\['g [\#156](https://github.com/FreeRDP/Remmina/issues/156) +- Remmina full screen closes unexpectedly in a dual monitor setup [\#154](https://github.com/FreeRDP/Remmina/issues/154) +- Numeric keyboard doesn't sync [\#153](https://github.com/FreeRDP/Remmina/issues/153) +- ERRINFO\_DECRYPT\_FAILED and Invalid pointer gdi\_get\_bitmap\_pointer [\#151](https://github.com/FreeRDP/Remmina/issues/151) +- Segmentation fault when using Sessionbrooker and DNS round robin [\#150](https://github.com/FreeRDP/Remmina/issues/150) +- Failed to compile 2 [\#144](https://github.com/FreeRDP/Remmina/issues/144) +- Fails to compile [\#141](https://github.com/FreeRDP/Remmina/issues/141) +- Segfault connecting RDP [\#135](https://github.com/FreeRDP/Remmina/issues/135) +- RDP Plugin Not Found Linux Mint 14 [\#134](https://github.com/FreeRDP/Remmina/issues/134) +- icon fail to compile [\#133](https://github.com/FreeRDP/Remmina/issues/133) +- segfault on ubuntu 12.04 [\#131](https://github.com/FreeRDP/Remmina/issues/131) +- Segfault connecting RDP via SSH: invalid glyph / invalid brush \(0 bpp\) [\#130](https://github.com/FreeRDP/Remmina/issues/130) +- Saved Passwords Fail to Authenticate when .remmina Config is Symlinked [\#128](https://github.com/FreeRDP/Remmina/issues/128) +- can't compile, FREERDP\_CHANNELS\_LIBRARY not found [\#123](https://github.com/FreeRDP/Remmina/issues/123) +- The latest checkout fails to cmake --build=build . on ubuntu 12.10 [\#122](https://github.com/FreeRDP/Remmina/issues/122) +- avahi underlinking [\#120](https://github.com/FreeRDP/Remmina/issues/120) +- Compatibility with newest FreeRDP [\#119](https://github.com/FreeRDP/Remmina/issues/119) +- No visual indication of active tab [\#118](https://github.com/FreeRDP/Remmina/issues/118) +- Black Blocks and blocks misplaced [\#116](https://github.com/FreeRDP/Remmina/issues/116) +- avahi support not actually compiled in [\#113](https://github.com/FreeRDP/Remmina/issues/113) +- RDP session shows only white colors [\#111](https://github.com/FreeRDP/Remmina/issues/111) +- problems typing @ via RDP using pt-latin keyboard [\#110](https://github.com/FreeRDP/Remmina/issues/110) +- "Main Window" interface unusable \(odd toolbar, connection rendering\) [\#109](https://github.com/FreeRDP/Remmina/issues/109) +- remmina crash after rdp connection [\#107](https://github.com/FreeRDP/Remmina/issues/107) +- Wrong colours when connecting to a sunray terminal [\#102](https://github.com/FreeRDP/Remmina/issues/102) +- Add Chinese \(Taiwan\) translation [\#101](https://github.com/FreeRDP/Remmina/issues/101) +- Uses host cursors [\#100](https://github.com/FreeRDP/Remmina/issues/100) +- remmina new feature info [\#97](https://github.com/FreeRDP/Remmina/issues/97) +- Clipboard Sync from Mac OS X to Ubuntu over VNC Not Working [\#93](https://github.com/FreeRDP/Remmina/issues/93) +- SSH public key authentication failed: Public key file doesn't exist [\#92](https://github.com/FreeRDP/Remmina/issues/92) +- Remmina and numeric pad status [\#89](https://github.com/FreeRDP/Remmina/issues/89) +- Remmina disappears after minimizing, going fullscreen, or opening a 2nd window [\#87](https://github.com/FreeRDP/Remmina/issues/87) +- Timezone redirection not properly supported [\#80](https://github.com/FreeRDP/Remmina/issues/80) +- Wonky RDP display [\#79](https://github.com/FreeRDP/Remmina/issues/79) +- Unable to connect to RDP server XXX.XXX.XXX.XXX [\#78](https://github.com/FreeRDP/Remmina/issues/78) +- Remmina freezes when disconnecting vnc session with ssh tunnel [\#77](https://github.com/FreeRDP/Remmina/issues/77) +- Tray icon autostart option disappeared in 1.0 [\#76](https://github.com/FreeRDP/Remmina/issues/76) +- Unknown authentication scheme from VNC server: 5 [\#75](https://github.com/FreeRDP/Remmina/issues/75) +- Error Building Latest on Fedora 16 [\#74](https://github.com/FreeRDP/Remmina/issues/74) +- wake on lan [\#72](https://github.com/FreeRDP/Remmina/issues/72) +- Add "Download for Ubuntu button" on the website [\#71](https://github.com/FreeRDP/Remmina/issues/71) +- Specify GLIB requirements [\#70](https://github.com/FreeRDP/Remmina/issues/70) +- Can not RDP connect if host key has changed [\#68](https://github.com/FreeRDP/Remmina/issues/68) +- remmina/xfreerdp crashes while trying to use 'remote control' [\#66](https://github.com/FreeRDP/Remmina/issues/66) +- Resize Window to Fit in Remote Resolution Broken [\#63](https://github.com/FreeRDP/Remmina/issues/63) +- OpenBSD OpenSSH & SSH\_AUTH\_METHOD\_INTERACTIVE [\#59](https://github.com/FreeRDP/Remmina/issues/59) +- Crashes on launch on 12.04 [\#57](https://github.com/FreeRDP/Remmina/issues/57) +- CMake Error at CMakeLists.txt:96 \(find\_suggested\_package\): Unknown CMake command "find\_suggested\_package". [\#55](https://github.com/FreeRDP/Remmina/issues/55) +- Remmina/FreeRDP \(both v1.x\) - protocol security negotiation failure \(to any Windows host\) [\#54](https://github.com/FreeRDP/Remmina/issues/54) +- patch for support building with gtk-2.22 [\#46](https://github.com/FreeRDP/Remmina/issues/46) +- numlock setting is not exported [\#45](https://github.com/FreeRDP/Remmina/issues/45) +- use Enter key to open connection, not only Doubleclick [\#43](https://github.com/FreeRDP/Remmina/issues/43) +- FindGnuTLS.cmake with cmake 2.6 [\#42](https://github.com/FreeRDP/Remmina/issues/42) +- SSH connection with transparent background support [\#41](https://github.com/FreeRDP/Remmina/issues/41) +- Help\>About version is out of date [\#35](https://github.com/FreeRDP/Remmina/issues/35) +- Build error with -DWITH\_GETTEXT=OFF option [\#23](https://github.com/FreeRDP/Remmina/issues/23) +- .desktop.in file is no longer handled [\#21](https://github.com/FreeRDP/Remmina/issues/21) +- don't forget about the old bugs at SF.net [\#19](https://github.com/FreeRDP/Remmina/issues/19) +- Don't use convenience copy of libvncserver [\#15](https://github.com/FreeRDP/Remmina/issues/15) +- Start minimized to systray [\#14](https://github.com/FreeRDP/Remmina/issues/14) +- Clipboard redirect is not working. [\#13](https://github.com/FreeRDP/Remmina/issues/13) +- Accelerator is the same for "Cancel" and "Connect" [\#12](https://github.com/FreeRDP/Remmina/issues/12) +- linker problem [\#9](https://github.com/FreeRDP/Remmina/issues/9) +- rdp plugin crashes [\#1](https://github.com/FreeRDP/Remmina/issues/1) + +**Merged pull requests:** + +- Frdp 1.1 [\#344](https://github.com/FreeRDP/Remmina/pull/344) ([giox069](https://github.com/giox069)) +- Fixes for latest FreeRDP [\#343](https://github.com/FreeRDP/Remmina/pull/343) ([dktrkranz](https://github.com/dktrkranz)) +- GTK3 migration - about [\#339](https://github.com/FreeRDP/Remmina/pull/339) ([antenore](https://github.com/antenore)) +- GTK3 migration + gix069 fixes [\#338](https://github.com/FreeRDP/Remmina/pull/338) ([antenore](https://github.com/antenore)) +- Added more translations from launchpad, fixes \#216 [\#336](https://github.com/FreeRDP/Remmina/pull/336) ([giox069](https://github.com/giox069)) +- Make 8bpp and 32bpp working again. Fixes \#329 [\#334](https://github.com/FreeRDP/Remmina/pull/334) ([giox069](https://github.com/giox069)) +- Fix compilation issues with latest FreeRDP [\#333](https://github.com/FreeRDP/Remmina/pull/333) ([giox069](https://github.com/giox069)) +- Various SSH fixes, fixes \#262 and \#223 [\#330](https://github.com/FreeRDP/Remmina/pull/330) ([giox069](https://github.com/giox069)) +- Fix missing extended keycode and 'up' action when releasing all keys [\#328](https://github.com/FreeRDP/Remmina/pull/328) ([giox069](https://github.com/giox069)) +- Fix compilation problems with latest version of FreeRDP/FreeRDP master [\#326](https://github.com/FreeRDP/Remmina/pull/326) ([giox069](https://github.com/giox069)) +- GTK3 migration - preferences dialog upggraded to Grid Layout [\#322](https://github.com/FreeRDP/Remmina/pull/322) ([antenore](https://github.com/antenore)) +- GTK3 Migration - Move from GtkTable to GtkGrid - Chat window and auth dialogs [\#321](https://github.com/FreeRDP/Remmina/pull/321) ([antenore](https://github.com/antenore)) +- gtk\_widget\_set\_margin\_end too new as reported in \#commitcomment-7689638 [\#318](https://github.com/FreeRDP/Remmina/pull/318) ([antenore](https://github.com/antenore)) +- Scaler layout improvement - gtk\_widget\_set\_margin\_end [\#317](https://github.com/FreeRDP/Remmina/pull/317) ([antenore](https://github.com/antenore)) +- Should fix issue \#314 and other related problems [\#315](https://github.com/FreeRDP/Remmina/pull/315) ([antenore](https://github.com/antenore)) +- Fixes for ssh, floating toolbar and version number change [\#312](https://github.com/FreeRDP/Remmina/pull/312) ([giox069](https://github.com/giox069)) +- ssh, minimize to tray and file sharing fixes [\#303](https://github.com/FreeRDP/Remmina/pull/303) ([giox069](https://github.com/giox069)) +- Minor fixes to floating toolbar [\#301](https://github.com/FreeRDP/Remmina/pull/301) ([giox069](https://github.com/giox069)) +- GTK+ \< 3.8 compatibility, fixes \#299 [\#300](https://github.com/FreeRDP/Remmina/pull/300) ([giox069](https://github.com/giox069)) +- Added one-liner apt-get to install all dependencies, for the lazy people [\#240](https://github.com/FreeRDP/Remmina/pull/240) ([Photonios](https://github.com/Photonios)) +- Typo in preference name broke key mapping in VNC [\#236](https://github.com/FreeRDP/Remmina/pull/236) ([nopdotcom](https://github.com/nopdotcom)) +- fixes \#193: Instructions for compiling against master FreeRDP [\#231](https://github.com/FreeRDP/Remmina/pull/231) ([krlmlr](https://github.com/krlmlr)) +- rename context\_size to ContextSize to match changes in FreeRDP [\#215](https://github.com/FreeRDP/Remmina/pull/215) ([benkohler](https://github.com/benkohler)) +- Finish replacing the old stream macros [\#206](https://github.com/FreeRDP/Remmina/pull/206) ([floppym](https://github.com/floppym)) +- Fix compilation against freerdp master [\#191](https://github.com/FreeRDP/Remmina/pull/191) ([darklajid](https://github.com/darklajid)) +- Remove call to rfx\_context\_set\_cpu\_opt, which was removed from FreeRDP [\#172](https://github.com/FreeRDP/Remmina/pull/172) ([floppym](https://github.com/floppym)) +- DWORD is the replacement for RDP\_SCANCODE [\#166](https://github.com/FreeRDP/Remmina/pull/166) ([dktrkranz](https://github.com/dktrkranz)) +- Do not define any SONAME for the plugins [\#149](https://github.com/FreeRDP/Remmina/pull/149) ([dktrkranz](https://github.com/dktrkranz)) +- external tools [\#132](https://github.com/FreeRDP/Remmina/pull/132) ([loki36](https://github.com/loki36)) +- Couple of packaging fixes [\#114](https://github.com/FreeRDP/Remmina/pull/114) ([floppym](https://github.com/floppym)) +- Some improvements [\#105](https://github.com/FreeRDP/Remmina/pull/105) ([dupondje](https://github.com/dupondje)) +- Multiple fixes + Quickconnect [\#95](https://github.com/FreeRDP/Remmina/pull/95) ([dupondje](https://github.com/dupondje)) +- Porting to Cairo and some bugfixes/new features [\#67](https://github.com/FreeRDP/Remmina/pull/67) ([dupondje](https://github.com/dupondje)) +- GTK2 compatibility [\#65](https://github.com/FreeRDP/Remmina/pull/65) ([dupondje](https://github.com/dupondje)) +- A couple of build fixes [\#64](https://github.com/FreeRDP/Remmina/pull/64) ([floppym](https://github.com/floppym)) +- last clipboard commits [\#62](https://github.com/FreeRDP/Remmina/pull/62) ([dupondje](https://github.com/dupondje)) +- Some more clipboard fixes [\#60](https://github.com/FreeRDP/Remmina/pull/60) ([dupondje](https://github.com/dupondje)) +- Patches [\#58](https://github.com/FreeRDP/Remmina/pull/58) ([dupondje](https://github.com/dupondje)) +- Clipboard support [\#56](https://github.com/FreeRDP/Remmina/pull/56) ([dupondje](https://github.com/dupondje)) +- Some fixes [\#53](https://github.com/FreeRDP/Remmina/pull/53) ([dupondje](https://github.com/dupondje)) +- Fix all deprecated function calls [\#52](https://github.com/FreeRDP/Remmina/pull/52) ([dupondje](https://github.com/dupondje)) +- Fixes compiling on ubuntu [\#51](https://github.com/FreeRDP/Remmina/pull/51) ([dupondje](https://github.com/dupondje)) +- Fix for scrolling in Remmina [\#50](https://github.com/FreeRDP/Remmina/pull/50) ([dupondje](https://github.com/dupondje)) +- Fix app indicator when using custom install prefix [\#48](https://github.com/FreeRDP/Remmina/pull/48) ([rawlinc](https://github.com/rawlinc)) +- Issue \#9 [\#39](https://github.com/FreeRDP/Remmina/pull/39) ([Gankov](https://github.com/Gankov)) +- bump version to 1.0.0. fixed \#35 [\#38](https://github.com/FreeRDP/Remmina/pull/38) ([chihchun](https://github.com/chihchun)) +- Fixed missing system pointer update skeletons. [\#37](https://github.com/FreeRDP/Remmina/pull/37) ([chihchun](https://github.com/chihchun)) +- Add an option to remmina to redirect smartcard over rdp [\#36](https://github.com/FreeRDP/Remmina/pull/36) ([absmall](https://github.com/absmall)) +- Corrected mistake in desktop file [\#34](https://github.com/FreeRDP/Remmina/pull/34) ([krnekhelesh](https://github.com/krnekhelesh)) +- Updated Quicklists [\#33](https://github.com/FreeRDP/Remmina/pull/33) ([krnekhelesh](https://github.com/krnekhelesh)) +- update french translation [\#32](https://github.com/FreeRDP/Remmina/pull/32) ([emmanuelgrognet](https://github.com/emmanuelgrognet)) +- Fixes for recent git FreeRDP headers [\#31](https://github.com/FreeRDP/Remmina/pull/31) ([maelnor](https://github.com/maelnor)) +- GTK cleanup in remmina\_main.c [\#30](https://github.com/FreeRDP/Remmina/pull/30) ([floppym](https://github.com/floppym)) +- Install plugins under CMAKE\_INSTALL\_LIBDIR. [\#29](https://github.com/FreeRDP/Remmina/pull/29) ([floppym](https://github.com/floppym)) +- Implementing X-GNOME-FullName [\#28](https://github.com/FreeRDP/Remmina/pull/28) ([dktrkranz](https://github.com/dktrkranz)) +- Make Gnome Keyring an optional dependency. [\#27](https://github.com/FreeRDP/Remmina/pull/27) ([floppym](https://github.com/floppym)) +- Fix installation of desktop file and related icons. [\#26](https://github.com/FreeRDP/Remmina/pull/26) ([floppym](https://github.com/floppym)) +- Mark 'Connect' and 'New' as important tool items so they always have labels [\#25](https://github.com/FreeRDP/Remmina/pull/25) ([robert-ancell](https://github.com/robert-ancell)) +- Mark main toolbar as a primary toolbar \(so is correctly themed\) [\#24](https://github.com/FreeRDP/Remmina/pull/24) ([robert-ancell](https://github.com/robert-ancell)) +- Do not use convenience copy of libvncserver [\#22](https://github.com/FreeRDP/Remmina/pull/22) ([dktrkranz](https://github.com/dktrkranz)) +- remmina: install .desktop file [\#20](https://github.com/FreeRDP/Remmina/pull/20) ([jbicha](https://github.com/jbicha)) + +## [1.0.0](https://github.com/FreeRDP/remmina/tree/1.0.0) (2012-02-10) +**Closed issues:** + +- Can't compile with GTK+ [\#3](https://github.com/FreeRDP/Remmina/issues/3) + +**Merged pull requests:** + +- A few minor issues [\#11](https://github.com/FreeRDP/Remmina/pull/11) ([doctaweeks](https://github.com/doctaweeks)) +- remmina: menu separator fix if avahi is disabled [\#10](https://github.com/FreeRDP/Remmina/pull/10) ([doctaweeks](https://github.com/doctaweeks)) +- GTK2/3 issue + re-enable ssh [\#8](https://github.com/FreeRDP/Remmina/pull/8) ([doctaweeks](https://github.com/doctaweeks)) +- Fix missed header path, closes \#4 [\#5](https://github.com/FreeRDP/Remmina/pull/5) ([chihchun](https://github.com/chihchun)) +- CMake Migration [\#2](https://github.com/FreeRDP/Remmina/pull/2) ([awakecoding](https://github.com/awakecoding)) + + + +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file -- cgit v1.2.3 From 598ee4d0b5f14654d046cf1ef5d712c3e19ffb75 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Wed, 16 Sep 2015 22:08:25 +0200 Subject: Warning about the new CHANGELOG. Added a warning in the ChangeLog regarding the use of the new CHANGELOG.md --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 04402f547..940f825d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +Don't edit anymore this file, use instead git@github.com:skywinder/github-changelog-generator.git to generate CHANGELOG.md + ***** 1.0.0 - 2014-07-14 ***** Pull requests o Typo in preference name broke key mapping in VNC -- cgit v1.2.3 From 0546b93893332fea33b91946cc29d25eb8aa08d2 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 17 Sep 2015 22:39:29 +0200 Subject: New remmina website adress is www.remmina.org --- remmina/ui/remmina_about.glade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remmina/ui/remmina_about.glade b/remmina/ui/remmina_about.glade index ee5044f76..0767c1433 100644 --- a/remmina/ui/remmina_about.glade +++ b/remmina/ui/remmina_about.glade @@ -13,7 +13,7 @@ Copyright (C) 2014-2015 Antenore Gatta, Giovanni Panozzo. Copyright (C) 2009-2014 Vic Lee See COPYING for more details - http://github.com/FreeRDP/Remmina + http://www.remmina.org/ Remmina Web Site Aaron Herting <aaron@herting.cc> -- cgit v1.2.3 From 1581d1689fba2f76043e75c548d1258dcf64ee9c Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Fri, 18 Sep 2015 10:40:54 +0200 Subject: Added LibFindMacros module to improve package lookup in cmake --- cmake/LibFindMacros.cmake | 265 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 265 insertions(+) create mode 100644 cmake/LibFindMacros.cmake diff --git a/cmake/LibFindMacros.cmake b/cmake/LibFindMacros.cmake new file mode 100644 index 000000000..81fef7d8e --- /dev/null +++ b/cmake/LibFindMacros.cmake @@ -0,0 +1,265 @@ +# Version 2.2 +# Public Domain, originally written by Lasse Kärkkäinen +# Maintained at https://github.com/Tronic/cmake-modules +# Please send your improvements as pull requests on Github. + +# Find another package and make it a dependency of the current package. +# This also automatically forwards the "REQUIRED" argument. +# Usage: libfind_package( [extra args to find_package]) +macro (libfind_package PREFIX PKG) + set(${PREFIX}_args ${PKG} ${ARGN}) + if (${PREFIX}_FIND_REQUIRED) + set(${PREFIX}_args ${${PREFIX}_args} REQUIRED) + endif() + find_package(${${PREFIX}_args}) + set(${PREFIX}_DEPENDENCIES ${${PREFIX}_DEPENDENCIES};${PKG}) + unset(${PREFIX}_args) +endmacro() + +# A simple wrapper to make pkg-config searches a bit easier. +# Works the same as CMake's internal pkg_check_modules but is always quiet. +macro (libfind_pkg_check_modules) + find_package(PkgConfig QUIET) + if (PKG_CONFIG_FOUND) + pkg_check_modules(${ARGN} QUIET) + endif() +endmacro() + +# Avoid useless copy&pasta by doing what most simple libraries do anyway: +# pkg-config, find headers, find library. +# Usage: libfind_pkg_detect( FIND_PATH [other args] FIND_LIBRARY [other args]) +# E.g. libfind_pkg_detect(SDL2 sdl2 FIND_PATH SDL.h PATH_SUFFIXES SDL2 FIND_LIBRARY SDL2) +function (libfind_pkg_detect PREFIX) + # Parse arguments + set(argname pkgargs) + foreach (i ${ARGN}) + if ("${i}" STREQUAL "FIND_PATH") + set(argname pathargs) + elseif ("${i}" STREQUAL "FIND_LIBRARY") + set(argname libraryargs) + else() + set(${argname} ${${argname}} ${i}) + endif() + endforeach() + if (NOT pkgargs) + message(FATAL_ERROR "libfind_pkg_detect requires at least a pkg_config package name to be passed.") + endif() + # Find library + libfind_pkg_check_modules(${PREFIX}_PKGCONF ${pkgargs}) + if (pathargs) + find_path(${PREFIX}_INCLUDE_DIR NAMES ${pathargs} HINTS ${${PREFIX}_PKGCONF_INCLUDE_DIRS}) + endif() + if (libraryargs) + find_library(${PREFIX}_LIBRARY NAMES ${libraryargs} HINTS ${${PREFIX}_PKGCONF_LIBRARY_DIRS}) + endif() +endfunction() + +# Extracts a version #define from a version.h file, output stored to _VERSION. +# Usage: libfind_version_header(Foobar foobar/version.h FOOBAR_VERSION_STR) +# Fourth argument "QUIET" may be used for silently testing different define names. +# This function does nothing if the version variable is already defined. +function (libfind_version_header PREFIX VERSION_H DEFINE_NAME) + # Skip processing if we already have a version or if the include dir was not found + if (${PREFIX}_VERSION OR NOT ${PREFIX}_INCLUDE_DIR) + return() + endif() + set(quiet ${${PREFIX}_FIND_QUIETLY}) + # Process optional arguments + foreach(arg ${ARGN}) + if (arg STREQUAL "QUIET") + set(quiet TRUE) + else() + message(AUTHOR_WARNING "Unknown argument ${arg} to libfind_version_header ignored.") + endif() + endforeach() + # Read the header and parse for version number + set(filename "${${PREFIX}_INCLUDE_DIR}/${VERSION_H}") + if (NOT EXISTS ${filename}) + if (NOT quiet) + message(AUTHOR_WARNING "Unable to find ${${PREFIX}_INCLUDE_DIR}/${VERSION_H}") + endif() + return() + endif() + file(READ "${filename}" header) + string(REGEX REPLACE ".*#[ \t]*define[ \t]*${DEFINE_NAME}[ \t]*\"([^\n]*)\".*" "\\1" match "${header}") + # No regex match? + if (match STREQUAL header) + if (NOT quiet) + message(AUTHOR_WARNING "Unable to find \#define ${DEFINE_NAME} \"\" from ${${PREFIX}_INCLUDE_DIR}/${VERSION_H}") + endif() + return() + endif() + # Export the version string + set(${PREFIX}_VERSION "${match}" PARENT_SCOPE) +endfunction() + +# Do the final processing once the paths have been detected. +# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain +# all the variables, each of which contain one include directory. +# Ditto for ${PREFIX}_PROCESS_LIBS and library files. +# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES. +# Also handles errors in case library detection was required, etc. +function (libfind_process PREFIX) + # Skip processing if already processed during this configuration run + if (${PREFIX}_FOUND) + return() + endif() + + set(found TRUE) # Start with the assumption that the package was found + + # Did we find any files? Did we miss includes? These are for formatting better error messages. + set(some_files FALSE) + set(missing_headers FALSE) + + # Shorthands for some variables that we need often + set(quiet ${${PREFIX}_FIND_QUIETLY}) + set(required ${${PREFIX}_FIND_REQUIRED}) + set(exactver ${${PREFIX}_FIND_VERSION_EXACT}) + set(findver "${${PREFIX}_FIND_VERSION}") + set(version "${${PREFIX}_VERSION}") + + # Lists of config option names (all, includes, libs) + unset(configopts) + set(includeopts ${${PREFIX}_PROCESS_INCLUDES}) + set(libraryopts ${${PREFIX}_PROCESS_LIBS}) + + # Process deps to add to + foreach (i ${PREFIX} ${${PREFIX}_DEPENDENCIES}) + if (DEFINED ${i}_INCLUDE_OPTS OR DEFINED ${i}_LIBRARY_OPTS) + # The package seems to export option lists that we can use, woohoo! + list(APPEND includeopts ${${i}_INCLUDE_OPTS}) + list(APPEND libraryopts ${${i}_LIBRARY_OPTS}) + else() + # If plural forms don't exist or they equal singular forms + if ((NOT DEFINED ${i}_INCLUDE_DIRS AND NOT DEFINED ${i}_LIBRARIES) OR + ({i}_INCLUDE_DIR STREQUAL ${i}_INCLUDE_DIRS AND ${i}_LIBRARY STREQUAL ${i}_LIBRARIES)) + # Singular forms can be used + if (DEFINED ${i}_INCLUDE_DIR) + list(APPEND includeopts ${i}_INCLUDE_DIR) + endif() + if (DEFINED ${i}_LIBRARY) + list(APPEND libraryopts ${i}_LIBRARY) + endif() + else() + # Oh no, we don't know the option names + message(FATAL_ERROR "We couldn't determine config variable names for ${i} includes and libs. Aieeh!") + endif() + endif() + endforeach() + + if (includeopts) + list(REMOVE_DUPLICATES includeopts) + endif() + + if (libraryopts) + list(REMOVE_DUPLICATES libraryopts) + endif() + + string(REGEX REPLACE ".*[ ;]([^ ;]*(_INCLUDE_DIRS|_LIBRARIES))" "\\1" tmp "${includeopts} ${libraryopts}") + if (NOT tmp STREQUAL "${includeopts} ${libraryopts}") + message(AUTHOR_WARNING "Plural form ${tmp} found in config options of ${PREFIX}. This works as before but is now deprecated. Please only use singular forms INCLUDE_DIR and LIBRARY, and update your find scripts for LibFindMacros > 2.0 automatic dependency system (most often you can simply remove the PROCESS variables entirely).") + endif() + + # Include/library names separated by spaces (notice: not CMake lists) + unset(includes) + unset(libs) + + # Process all includes and set found false if any are missing + foreach (i ${includeopts}) + list(APPEND configopts ${i}) + if (NOT "${${i}}" STREQUAL "${i}-NOTFOUND") + list(APPEND includes "${${i}}") + else() + set(found FALSE) + set(missing_headers TRUE) + endif() + endforeach() + + # Process all libraries and set found false if any are missing + foreach (i ${libraryopts}) + list(APPEND configopts ${i}) + if (NOT "${${i}}" STREQUAL "${i}-NOTFOUND") + list(APPEND libs "${${i}}") + else() + set (found FALSE) + endif() + endforeach() + + # Version checks + if (found AND findver) + if (NOT version) + message(WARNING "The find module for ${PREFIX} does not provide version information, so we'll just assume that it is OK. Please fix the module or remove package version requirements to get rid of this warning.") + elseif (version VERSION_LESS findver OR (exactver AND NOT version VERSION_EQUAL findver)) + set(found FALSE) + set(version_unsuitable TRUE) + endif() + endif() + + # If all-OK, hide all config options, export variables, print status and exit + if (found) + foreach (i ${configopts}) + mark_as_advanced(${i}) + endforeach() + if (NOT quiet) + message(STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}") + if (LIBFIND_DEBUG) + message(STATUS " ${PREFIX}_DEPENDENCIES=${${PREFIX}_DEPENDENCIES}") + message(STATUS " ${PREFIX}_INCLUDE_OPTS=${includeopts}") + message(STATUS " ${PREFIX}_INCLUDE_DIRS=${includes}") + message(STATUS " ${PREFIX}_LIBRARY_OPTS=${libraryopts}") + message(STATUS " ${PREFIX}_LIBRARIES=${libs}") + endif() + set (${PREFIX}_INCLUDE_OPTS ${includeopts} PARENT_SCOPE) + set (${PREFIX}_LIBRARY_OPTS ${libraryopts} PARENT_SCOPE) + set (${PREFIX}_INCLUDE_DIRS ${includes} PARENT_SCOPE) + set (${PREFIX}_LIBRARIES ${libs} PARENT_SCOPE) + set (${PREFIX}_FOUND TRUE PARENT_SCOPE) + endif() + return() + endif() + + # Format messages for debug info and the type of error + set(vars "Relevant CMake configuration variables:\n") + foreach (i ${configopts}) + mark_as_advanced(CLEAR ${i}) + set(val ${${i}}) + if ("${val}" STREQUAL "${i}-NOTFOUND") + set (val "") + elseif (val AND NOT EXISTS ${val}) + set (val "${val} (does not exist)") + else() + set(some_files TRUE) + endif() + set(vars "${vars} ${i}=${val}\n") + endforeach() + set(vars "${vars}You may use CMake GUI, cmake -D or ccmake to modify the values. Delete CMakeCache.txt to discard all values and force full re-detection if necessary.\n") + if (version_unsuitable) + set(msg "${PREFIX} ${${PREFIX}_VERSION} was found but") + if (exactver) + set(msg "${msg} only version ${findver} is acceptable.") + else() + set(msg "${msg} version ${findver} is the minimum requirement.") + endif() + else() + if (missing_headers) + set(msg "We could not find development headers for ${PREFIX}. Do you have the necessary dev package installed?") + elseif (some_files) + set(msg "We only found some files of ${PREFIX}, not all of them. Perhaps your installation is incomplete or maybe we just didn't look in the right place?") + if(findver) + set(msg "${msg} This could also be caused by incompatible version (if it helps, at least ${PREFIX} ${findver} should work).") + endif() + else() + set(msg "We were unable to find package ${PREFIX}.") + endif() + endif() + + # Fatal error out if REQUIRED + if (required) + set(msg "REQUIRED PACKAGE NOT FOUND\n${msg} This package is REQUIRED and you need to install it or adjust CMake configuration in order to continue building ${CMAKE_PROJECT_NAME}.") + message(FATAL_ERROR "${msg}\n${vars}") + endif() + # Otherwise just print a nasty warning + if (NOT quiet) + message(WARNING "WARNING: MISSING PACKAGE\n${msg} This package is NOT REQUIRED and you may ignore this warning but by doing so you may miss some functionality of ${CMAKE_PROJECT_NAME}. \n${vars}") + endif() +endfunction() -- cgit v1.2.3 From 415e95e5d38ac22e8c242e36fbc08ff19f44b85d Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Fri, 18 Sep 2015 10:41:24 +0200 Subject: Improved libssh lookup --- cmake/FindLIBSSH.cmake | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/cmake/FindLIBSSH.cmake b/cmake/FindLIBSSH.cmake index c65cd337a..f003e2d9c 100644 --- a/cmake/FindLIBSSH.cmake +++ b/cmake/FindLIBSSH.cmake @@ -14,21 +14,38 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Foundation, Inc., 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301, USA. +include(LibFindMacros) + +# Dependencies find_package(PkgConfig) -pkg_check_modules(PC_LIBSSH libssh>=0.6) -set(LIBSSH_DEFINITIONS ${PC_LIBSSH_CFLAGS_OTHER}) -find_path(LIBSSH_INCLUDE_DIR NAMES libssh/libssh.h - HINTS ${PC_LIBSSH_INCLUDEDIR} ${PC_LIBSSH_INCLUDE_DIRS}) +# Use pkg-config to get hints about paths +libfind_pkg_check_modules(PC_LIBSSH libssh>=0.6) -find_library(LIBSSH_LIBRARY NAMES ssh - HINTS ${PC_LIBSSH_LIBDIR} ${PC_LIBSSH_LIBRARY_DIRS}) -find_library(LIBSSH_THREADS_LIBRARY NAMES ssh_threads - HINTS ${PC_LIBSSH_LIBDIR} ${PC_LIBSSH_LIBRARY_DIRS}) +set(LIBSSH_DEFINITIONS ${PC_LIBSSH_CFLAGS_OTHER}) + +# Include dir +find_path(LIBSSH_INCLUDE_DIR + NAMES libssh/libssh.h + #HINTS ${PC_LIBSSH_INCLUDEDIR} ${PC_LIBSSH_INCLUDE_DIRS} + PATHS ${PC_LIBSSH_PKGCONF_INCLUDE_DIRS} +) + +# The library itself +find_library(LIBSSH_LIBRARY + NAMES ssh + #HINTS ${PC_LIBSSH_LIBDIR} ${PC_LIBSSH_LIBRARY_DIRS} + PATHS ${PC_LIBSSH_PKGCONF_LIBRARY_DIRS} +) + +find_library(LIBSSH_THREADS_LIBRARY + NAMES ssh_threads + PATHS ${PC_LIBSSH_LIBDIR} ${PC_LIBSSH_LIBRARY_DIRS} +) include(FindPackageHandleStandardArgs) -- cgit v1.2.3 From 72fe1fe7c32f93a513d6e39781fd09e28b76eb3b Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Fri, 18 Sep 2015 15:52:24 +0200 Subject: source code reformatted with astyle --indent=tab=4 -A1 *.[ch] (ANSI C style + TABS with 4 spaces) --- remmina/src/remmina.c | 2 +- remmina/src/remmina_about.c | 2 +- remmina/src/remmina_about.h | 2 +- remmina/src/remmina_applet_menu.c | 21 +- remmina/src/remmina_applet_menu.h | 4 +- remmina/src/remmina_applet_menu_item.c | 50 +- remmina/src/remmina_applet_menu_item.h | 4 +- remmina/src/remmina_avahi.c | 146 ++--- remmina/src/remmina_avahi.h | 4 +- remmina/src/remmina_chat_window.c | 10 +- remmina/src/remmina_chat_window.h | 4 +- remmina/src/remmina_connection_window.c | 968 ++++++++++++++++++++------------ remmina/src/remmina_connection_window.h | 8 +- remmina/src/remmina_crypt.c | 4 +- remmina/src/remmina_crypt.h | 4 +- remmina/src/remmina_exec.c | 140 ++--- remmina/src/remmina_exec.h | 4 +- remmina/src/remmina_file.c | 42 +- remmina/src/remmina_file_editor.c | 577 ++++++++++--------- remmina/src/remmina_file_editor.h | 6 +- remmina/src/remmina_file_manager.h | 4 +- remmina/src/remmina_ftp_client.c | 286 ++++++---- remmina/src/remmina_ftp_client.h | 24 +- remmina/src/remmina_icon.c | 63 +-- remmina/src/remmina_icon.h | 4 +- remmina/src/remmina_init_dialog.c | 103 ++-- remmina/src/remmina_init_dialog.h | 13 +- remmina/src/remmina_key_chooser.c | 37 +- remmina/src/remmina_key_chooser.h | 4 +- remmina/src/remmina_log.c | 6 +- remmina/src/remmina_log.h | 4 +- remmina/src/remmina_main.c | 149 ++--- remmina/src/remmina_marshals.c | 122 ++-- remmina/src/remmina_marshals.h | 4 +- remmina/src/remmina_masterthread_exec.c | 120 ++-- remmina/src/remmina_masterthread_exec.h | 61 +- remmina/src/remmina_plugin_manager.c | 141 ++--- remmina/src/remmina_preexec.c | 18 +- remmina/src/remmina_preexec.h | 3 +- remmina/src/remmina_pref.c | 40 +- remmina/src/remmina_pref_dialog.c | 4 +- remmina/src/remmina_protocol_widget.c | 390 ++++++++----- remmina/src/remmina_protocol_widget.h | 2 +- remmina/src/remmina_public.c | 40 +- remmina/src/remmina_public.h | 4 +- remmina/src/remmina_scrolled_viewport.h | 4 +- remmina/src/remmina_sftp_client.c | 151 ++--- remmina/src/remmina_sftp_client.h | 4 +- remmina/src/remmina_sftp_plugin.c | 44 +- remmina/src/remmina_ssh.c | 829 ++++++++++++++++----------- remmina/src/remmina_ssh.h | 6 +- remmina/src/remmina_ssh_plugin.c | 37 +- remmina/src/remmina_string_array.c | 4 +- remmina/src/remmina_string_array.h | 4 +- remmina/src/remmina_string_list.c | 28 +- remmina/src/remmina_string_list.h | 4 +- remmina/src/remmina_widget_pool.c | 4 +- remmina/src/remmina_widget_pool.h | 4 +- 58 files changed, 2729 insertions(+), 2042 deletions(-) diff --git a/remmina/src/remmina.c b/remmina/src/remmina.c index 45c58388d..36dd54f60 100644 --- a/remmina/src/remmina.c +++ b/remmina/src/remmina.c @@ -220,7 +220,7 @@ static void remmina_on_startup(GApplication *app) gtk_window_set_default_icon_name("remmina"); gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), - REMMINA_DATADIR G_DIR_SEPARATOR_S "icons"); + REMMINA_DATADIR G_DIR_SEPARATOR_S "icons"); } static gboolean remmina_on_local_cmdline (GApplication *app, gchar ***arguments, gint *exit_status) diff --git a/remmina/src/remmina_about.c b/remmina/src/remmina_about.c index 717bf6b27..91e62705f 100644 --- a/remmina/src/remmina_about.c +++ b/remmina/src/remmina_about.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give diff --git a/remmina/src/remmina_about.h b/remmina/src/remmina_about.h index 697b93180..399fd8c8f 100644 --- a/remmina/src/remmina_about.h +++ b/remmina/src/remmina_about.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give diff --git a/remmina/src/remmina_applet_menu.c b/remmina/src/remmina_applet_menu.c index 8ef4d6a0d..4eda4e6e2 100644 --- a/remmina/src/remmina_applet_menu.c +++ b/remmina/src/remmina_applet_menu.c @@ -67,11 +67,11 @@ static void remmina_applet_menu_class_init(RemminaAppletMenuClass *klass) { TRACE_CALL("remmina_applet_menu_class_init"); remmina_applet_menu_signals[LAUNCH_ITEM_SIGNAL] = g_signal_new("launch-item", G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaAppletMenuClass, launch_item), NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, G_TYPE_OBJECT); + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaAppletMenuClass, launch_item), NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, G_TYPE_OBJECT); remmina_applet_menu_signals[EDIT_ITEM_SIGNAL] = g_signal_new("edit-item", G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaAppletMenuClass, edit_item), NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, G_TYPE_OBJECT); + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaAppletMenuClass, edit_item), NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, G_TYPE_OBJECT); } static void remmina_applet_menu_init(RemminaAppletMenu *menu) @@ -90,7 +90,7 @@ static void remmina_applet_menu_on_item_activate(RemminaAppletMenuItem *menuitem static GtkWidget* remmina_applet_menu_add_group(GtkWidget *menu, const gchar *group, gint position, RemminaAppletMenuItem *menuitem, - GtkWidget **groupmenuitem) + GtkWidget **groupmenuitem) { TRACE_CALL("remmina_applet_menu_add_group"); GtkWidget *widget; @@ -101,9 +101,9 @@ remmina_applet_menu_add_group(GtkWidget *menu, const gchar *group, gint position gtk_widget_show(widget); image = - gtk_image_new_from_icon_name( - (menuitem->item_type == REMMINA_APPLET_MENU_ITEM_DISCOVERED ? - "folder-remote" : "folder"), GTK_ICON_SIZE_MENU); + gtk_image_new_from_icon_name( + (menuitem->item_type == REMMINA_APPLET_MENU_ITEM_DISCOVERED ? + "folder-remote" : "folder"), GTK_ICON_SIZE_MENU); gtk_widget_show(image); g_object_set_data_full(G_OBJECT(widget), "group", g_strdup(group), g_free); @@ -191,7 +191,7 @@ void remmina_applet_menu_add_item(RemminaAppletMenu *menu, RemminaAppletMenuItem if (strcoll(p1, mstr) < 0) { submenu = remmina_applet_menu_add_group(submenu, p1, position, menuitem, - &groupmenuitem); + &groupmenuitem); break; } } @@ -289,7 +289,8 @@ void remmina_applet_menu_populate(RemminaAppletMenu *menu) g_snprintf(filename, sizeof(filename), "%s/%s", dirname, name); menuitem = remmina_applet_menu_item_new(REMMINA_APPLET_MENU_ITEM_FILE, filename); - if (menuitem != NULL) { + if (menuitem != NULL) + { remmina_applet_menu_add_item(menu, REMMINA_APPLET_MENU_ITEM(menuitem)); gtk_widget_show(menuitem); } diff --git a/remmina/src/remmina_applet_menu.h b/remmina/src/remmina_applet_menu.h index 0f1ae1d4a..774721e0d 100644 --- a/remmina/src/remmina_applet_menu.h +++ b/remmina/src/remmina_applet_menu.h @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2010 Vic Lee + * Copyright (C) 2010 Vic Lee * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give diff --git a/remmina/src/remmina_applet_menu_item.c b/remmina/src/remmina_applet_menu_item.c index ef290dcd6..86d4598c8 100644 --- a/remmina/src/remmina_applet_menu_item.c +++ b/remmina/src/remmina_applet_menu_item.c @@ -88,37 +88,37 @@ GtkWidget* remmina_applet_menu_item_new(RemminaAppletMenuItemType item_type, ... switch (item_type) { - case REMMINA_APPLET_MENU_ITEM_FILE: - item->filename = g_strdup(va_arg(ap, const gchar*)); + case REMMINA_APPLET_MENU_ITEM_FILE: + item->filename = g_strdup(va_arg(ap, const gchar*)); - /* Load the file */ - gkeyfile = g_key_file_new(); + /* Load the file */ + gkeyfile = g_key_file_new(); - if (!g_key_file_load_from_file(gkeyfile, item->filename, G_KEY_FILE_NONE, NULL)) - { - g_key_file_free(gkeyfile); - va_end(ap); - return NULL; - } + if (!g_key_file_load_from_file(gkeyfile, item->filename, G_KEY_FILE_NONE, NULL)) + { + g_key_file_free(gkeyfile); + va_end(ap); + return NULL; + } - item->name = g_key_file_get_string(gkeyfile, "remmina", "name", NULL); - item->group = g_key_file_get_string(gkeyfile, "remmina", "group", NULL); - item->protocol = g_key_file_get_string(gkeyfile, "remmina", "protocol", NULL); - item->server = g_key_file_get_string(gkeyfile, "remmina", "server", NULL); - item->ssh_enabled = g_key_file_get_boolean(gkeyfile, "remmina", "ssh_enabled", NULL); + item->name = g_key_file_get_string(gkeyfile, "remmina", "name", NULL); + item->group = g_key_file_get_string(gkeyfile, "remmina", "group", NULL); + item->protocol = g_key_file_get_string(gkeyfile, "remmina", "protocol", NULL); + item->server = g_key_file_get_string(gkeyfile, "remmina", "server", NULL); + item->ssh_enabled = g_key_file_get_boolean(gkeyfile, "remmina", "ssh_enabled", NULL); - g_key_file_free(gkeyfile); - break; + g_key_file_free(gkeyfile); + break; - case REMMINA_APPLET_MENU_ITEM_DISCOVERED: - item->name = g_strdup(va_arg(ap, const gchar *)); - item->group = g_strdup(_("Discovered")); - item->protocol = g_strdup("VNC"); - break; + case REMMINA_APPLET_MENU_ITEM_DISCOVERED: + item->name = g_strdup(va_arg(ap, const gchar *)); + item->group = g_strdup(_("Discovered")); + item->protocol = g_strdup("VNC"); + break; - case REMMINA_APPLET_MENU_ITEM_NEW: - item->name = g_strdup(_("New Connection")); - break; + case REMMINA_APPLET_MENU_ITEM_NEW: + item->name = g_strdup(_("New Connection")); + break; } va_end(ap); diff --git a/remmina/src/remmina_applet_menu_item.h b/remmina/src/remmina_applet_menu_item.h index e4505b484..4cd4fa502 100644 --- a/remmina/src/remmina_applet_menu_item.h +++ b/remmina/src/remmina_applet_menu_item.h @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2009-2010 Vic Lee + * Copyright (C) 2009-2010 Vic Lee * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give diff --git a/remmina/src/remmina_avahi.c b/remmina/src/remmina_avahi.c index 38da28d00..9ec1ad46d 100644 --- a/remmina/src/remmina_avahi.c +++ b/remmina/src/remmina_avahi.c @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2009-2010 Vic Lee + * Copyright (C) 2009-2010 Vic Lee * Copyright (C) 2014-2015 Antenore Gatta, Fabio Castelli, Giovanni Panozzo * * This program is free software; you can redistribute it and/or modify @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give @@ -57,19 +57,19 @@ struct _RemminaAvahiPriv static void remmina_avahi_resolve_callback( - AvahiServiceResolver* r, - AVAHI_GCC_UNUSED AvahiIfIndex interface, - AVAHI_GCC_UNUSED AvahiProtocol protocol, - AvahiResolverEvent event, - const char* name, - const char* type, - const char* domain, - const char* host_name, - const AvahiAddress* address, - uint16_t port, - AvahiStringList* txt, - AvahiLookupResultFlags flags, - AVAHI_GCC_UNUSED void* userdata) + AvahiServiceResolver* r, + AVAHI_GCC_UNUSED AvahiIfIndex interface, + AVAHI_GCC_UNUSED AvahiProtocol protocol, + AvahiResolverEvent event, + const char* name, + const char* type, + const char* domain, + const char* host_name, + const AvahiAddress* address, + uint16_t port, + AvahiStringList* txt, + AvahiLookupResultFlags flags, + AVAHI_GCC_UNUSED void* userdata) { TRACE_CALL("remmina_avahi_resolve_callback"); gchar* key; @@ -82,25 +82,25 @@ remmina_avahi_resolve_callback( switch (event) { - case AVAHI_RESOLVER_FAILURE: - g_print("(remmina-applet avahi-resolver) Failed to resolve service '%s' of type '%s' in domain '%s': %s\n", - name, type, domain, avahi_strerror(avahi_client_errno(avahi_service_resolver_get_client(r)))); + case AVAHI_RESOLVER_FAILURE: + g_print("(remmina-applet avahi-resolver) Failed to resolve service '%s' of type '%s' in domain '%s': %s\n", + name, type, domain, avahi_strerror(avahi_client_errno(avahi_service_resolver_get_client(r)))); + break; + + case AVAHI_RESOLVER_FOUND: + key = g_strdup_printf("%s,%s,%s", name, type, domain); + if (g_hash_table_lookup(ga->discovered_services, key)) + { + g_free(key); break; + } + value = g_strdup_printf("[%s]:%i", host_name, port); + g_hash_table_insert(ga->discovered_services, key, value); + /* key and value will be freed with g_free when the has table is freed */ - case AVAHI_RESOLVER_FOUND: - key = g_strdup_printf("%s,%s,%s", name, type, domain); - if (g_hash_table_lookup(ga->discovered_services, key)) - { - g_free(key); - break; - } - value = g_strdup_printf("[%s]:%i", host_name, port); - g_hash_table_insert(ga->discovered_services, key, value); - /* key and value will be freed with g_free when the has table is freed */ - - g_print("(remmina-applet avahi-resolver) Added service '%s'\n", value); + g_print("(remmina-applet avahi-resolver) Added service '%s'\n", value); - break; + break; } avahi_service_resolver_free(r); @@ -108,15 +108,15 @@ remmina_avahi_resolve_callback( static void remmina_avahi_browse_callback( - AvahiServiceBrowser* b, - AvahiIfIndex interface, - AvahiProtocol protocol, - AvahiBrowserEvent event, - const char* name, - const char* type, - const char* domain, - AVAHI_GCC_UNUSED AvahiLookupResultFlags flags, - void* userdata) + AvahiServiceBrowser* b, + AvahiIfIndex interface, + AvahiProtocol protocol, + AvahiBrowserEvent event, + const char* name, + const char* type, + const char* domain, + AVAHI_GCC_UNUSED AvahiLookupResultFlags flags, + void* userdata) { TRACE_CALL("remmina_avahi_browse_callback"); gchar* key; @@ -128,40 +128,40 @@ remmina_avahi_browse_callback( switch (event) { - case AVAHI_BROWSER_FAILURE: - g_print("(remmina-applet avahi-browser) %s\n", - avahi_strerror(avahi_client_errno (avahi_service_browser_get_client (b)))); - return; - - case AVAHI_BROWSER_NEW: - key = g_strdup_printf("%s,%s,%s", name, type, domain); - if (g_hash_table_lookup(ga->discovered_services, key)) - { - g_free(key); - break; - } - g_free(key); - - g_print("(remmina-applet avahi-browser) Found service '%s' of type '%s' in domain '%s'\n", name, type, domain); - - if (!(avahi_service_resolver_new(ga->priv->client, interface, protocol, name, type, domain, - AVAHI_PROTO_UNSPEC, 0, remmina_avahi_resolve_callback, ga))) - { - g_print("(remmina-applet avahi-browser) Failed to resolve service '%s': %s\n", - name, avahi_strerror(avahi_client_errno (ga->priv->client))); - } - break; + case AVAHI_BROWSER_FAILURE: + g_print("(remmina-applet avahi-browser) %s\n", + avahi_strerror(avahi_client_errno (avahi_service_browser_get_client (b)))); + return; - case AVAHI_BROWSER_REMOVE: - g_print("(remmina-applet avahi-browser) Removed service '%s' of type '%s' in domain '%s'\n", name, type, domain); - key = g_strdup_printf("%s,%s,%s", name, type, domain); - g_hash_table_remove(ga->discovered_services, key); + case AVAHI_BROWSER_NEW: + key = g_strdup_printf("%s,%s,%s", name, type, domain); + if (g_hash_table_lookup(ga->discovered_services, key)) + { g_free(key); break; - - case AVAHI_BROWSER_ALL_FOR_NOW: - case AVAHI_BROWSER_CACHE_EXHAUSTED: - break; + } + g_free(key); + + g_print("(remmina-applet avahi-browser) Found service '%s' of type '%s' in domain '%s'\n", name, type, domain); + + if (!(avahi_service_resolver_new(ga->priv->client, interface, protocol, name, type, domain, + AVAHI_PROTO_UNSPEC, 0, remmina_avahi_resolve_callback, ga))) + { + g_print("(remmina-applet avahi-browser) Failed to resolve service '%s': %s\n", + name, avahi_strerror(avahi_client_errno (ga->priv->client))); + } + break; + + case AVAHI_BROWSER_REMOVE: + g_print("(remmina-applet avahi-browser) Removed service '%s' of type '%s' in domain '%s'\n", name, type, domain); + key = g_strdup_printf("%s,%s,%s", name, type, domain); + g_hash_table_remove(ga->discovered_services, key); + g_free(key); + break; + + case AVAHI_BROWSER_ALL_FOR_NOW: + case AVAHI_BROWSER_CACHE_EXHAUSTED: + break; } } @@ -229,7 +229,7 @@ void remmina_avahi_start(RemminaAvahi* ga) } ga->priv->client = avahi_client_new(avahi_simple_poll_get(ga->priv->simple_poll), 0, remmina_avahi_client_callback, ga, - &error); + &error); if (!ga->priv->client) { g_print("Failed to create client: %s\n", avahi_strerror(error)); @@ -238,7 +238,7 @@ void remmina_avahi_start(RemminaAvahi* ga) /* TODO: Customize the default domain here */ ga->priv->sb = avahi_service_browser_new(ga->priv->client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "_rfb._tcp", NULL, 0, - remmina_avahi_browse_callback, ga); + remmina_avahi_browse_callback, ga); if (!ga->priv->sb) { g_print("Failed to create service browser: %s\n", avahi_strerror(avahi_client_errno(ga->priv->client))); diff --git a/remmina/src/remmina_avahi.h b/remmina/src/remmina_avahi.h index ed3592c91..b4b317ad5 100644 --- a/remmina/src/remmina_avahi.h +++ b/remmina/src/remmina_avahi.h @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2009-2010 Vic Lee + * Copyright (C) 2009-2010 Vic Lee * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give diff --git a/remmina/src/remmina_chat_window.c b/remmina/src/remmina_chat_window.c index 158d0ac10..319088e23 100644 --- a/remmina/src/remmina_chat_window.c +++ b/remmina/src/remmina_chat_window.c @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2009 - Vic Lee + * Copyright (C) 2009 - Vic Lee * Copyright (C) 2014-2015 Antenore Gatta, Fabio Castelli, Giovanni Panozzo * * This program is free software; you can redistribute it and/or modify @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give @@ -53,8 +53,8 @@ static void remmina_chat_window_class_init(RemminaChatWindowClass* klass) { TRACE_CALL("remmina_chat_window_class_init"); remmina_chat_window_signals[SEND_SIGNAL] = g_signal_new("send", G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaChatWindowClass, send), NULL, NULL, - g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaChatWindowClass, send), NULL, NULL, + g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); } static void remmina_chat_window_init(RemminaChatWindow* window) @@ -88,7 +88,7 @@ static gboolean remmina_chat_window_scroll_proc(RemminaChatWindow* window) } static void remmina_chat_window_append_text(RemminaChatWindow* window, const gchar* name, const gchar* tagname, - const gchar* text) + const gchar* text) { TRACE_CALL("remmina_chat_window_append_text"); GtkTextBuffer* buffer; diff --git a/remmina/src/remmina_chat_window.h b/remmina/src/remmina_chat_window.h index c4fdfefcc..9257c0bca 100644 --- a/remmina/src/remmina_chat_window.h +++ b/remmina/src/remmina_chat_window.h @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2009 - Vic Lee + * Copyright (C) 2009 - Vic Lee * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give diff --git a/remmina/src/remmina_connection_window.c b/remmina/src/remmina_connection_window.c index 8ef18bfea..8f9190e33 100644 --- a/remmina/src/remmina_connection_window.c +++ b/remmina/src/remmina_connection_window.c @@ -59,7 +59,8 @@ G_DEFINE_TYPE( RemminaConnectionWindow, remmina_connection_window, GTK_TYPE_WIND typedef struct _RemminaConnectionHolder RemminaConnectionHolder; -struct _RemminaConnectionWindowPriv { +struct _RemminaConnectionWindowPriv +{ RemminaConnectionHolder* cnnhld; GtkWidget* notebook; @@ -108,7 +109,8 @@ struct _RemminaConnectionWindowPriv { }; -typedef struct _RemminaConnectionObject { +typedef struct _RemminaConnectionObject +{ RemminaConnectionHolder* cnnhld; RemminaFile* remmina_file; @@ -129,7 +131,8 @@ typedef struct _RemminaConnectionObject { gboolean connected; } RemminaConnectionObject; -struct _RemminaConnectionHolder { +struct _RemminaConnectionHolder +{ RemminaConnectionWindow* cnnwin; gint fullscreen_view_mode; @@ -151,9 +154,9 @@ struct _RemminaConnectionHolder { static void remmina_connection_holder_create_scrolled(RemminaConnectionHolder* cnnhld, RemminaConnectionObject* cnnobj); static void remmina_connection_holder_create_fullscreen(RemminaConnectionHolder* cnnhld, RemminaConnectionObject* cnnobj, - gint view_mode); + gint view_mode); static gboolean remmina_connection_window_hostkey_func(RemminaProtocolWidget* gp, guint keyval, gboolean release, - RemminaConnectionHolder* cnnhld); + RemminaConnectionHolder* cnnhld); static void remmina_connection_holder_grab_focus(GtkNotebook *notebook); @@ -162,7 +165,8 @@ static void remmina_connection_window_ftb_drag_begin(GtkWidget *widget, GdkDragC #endif -static const GtkTargetEntry dnd_targets[] = { +static const GtkTargetEntry dnd_targets[] = +{ { (char *)"text/x-remmina-ftb", GTK_TARGET_SAME_APP|GTK_TARGET_OTHER_WIDGET, @@ -182,50 +186,50 @@ static void remmina_connection_window_class_init(RemminaConnectionWindowClass* k * we will never know its internal area size, because GtkViweport::viewport_get_view_allocation, * which returns the internal size of the GtkViewport, is private and we cannot access it */ gtk_css_provider_load_from_data (provider, - "GtkViewport, GtkAspectFrame {\n" - " padding:0;\n" - " border:0;\n" - "}\n" - "#remmina-connection-window-fullscreen {\n" - " background-color: black;\n" - "}\n" - "#remmina-small-button {\n" - " -GtkWidget-focus-padding: 0;\n" - " -GtkWidget-focus-line-width: 0;\n" - " padding: 0;\n" - " border: 0;\n" - "}\n" - "#remmina-pin-button {\n" - " -GtkWidget-focus-padding: 0;\n" - " -GtkWidget-focus-line-width: 0;\n" - " padding: 2px;\n" - " border: 0;\n" - "}\n" - "#remmina-scrolled-container {\n" - " background-color: black;\n" - "}\n" - "#ftbbox-upper {\n" - " border-style: none solid solid solid;\n" - " border-width: 1px;\n" - " border-radius: 4px;\n" - " border-color: #808080;\n" - " padding: 0px;\n" - " background-color: #f0f0f0;\n" - "}\n" - "#ftbbox-lower {\n" - " border-style: solid solid none solid;\n" - " border-width: 1px;\n" - " border-radius: 4px;\n" - " border-color: #808080;\n" - " padding: 0px;\n" - " background-color: #f0f0f0;\n" - "}\n" - - ,-1, NULL); + "GtkViewport, GtkAspectFrame {\n" + " padding:0;\n" + " border:0;\n" + "}\n" + "#remmina-connection-window-fullscreen {\n" + " background-color: black;\n" + "}\n" + "#remmina-small-button {\n" + " -GtkWidget-focus-padding: 0;\n" + " -GtkWidget-focus-line-width: 0;\n" + " padding: 0;\n" + " border: 0;\n" + "}\n" + "#remmina-pin-button {\n" + " -GtkWidget-focus-padding: 0;\n" + " -GtkWidget-focus-line-width: 0;\n" + " padding: 2px;\n" + " border: 0;\n" + "}\n" + "#remmina-scrolled-container {\n" + " background-color: black;\n" + "}\n" + "#ftbbox-upper {\n" + " border-style: none solid solid solid;\n" + " border-width: 1px;\n" + " border-radius: 4px;\n" + " border-color: #808080;\n" + " padding: 0px;\n" + " background-color: #f0f0f0;\n" + "}\n" + "#ftbbox-lower {\n" + " border-style: solid solid none solid;\n" + " border-width: 1px;\n" + " border-radius: 4px;\n" + " border-color: #808080;\n" + " padding: 0px;\n" + " background-color: #f0f0f0;\n" + "}\n" + + ,-1, NULL); gtk_style_context_add_provider_for_screen (gdk_screen_get_default(), - GTK_STYLE_PROVIDER (provider), - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + GTK_STYLE_PROVIDER (provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref(provider); } @@ -252,15 +256,20 @@ static void remmina_connection_holder_keyboard_grab(RemminaConnectionHolder* cnn manager = gdk_display_get_device_manager(display); keyboard = gdk_device_manager_get_client_pointer(manager); - if (keyboard != NULL) { + if (keyboard != NULL) + { - if ( gdk_device_get_source (keyboard) != GDK_SOURCE_KEYBOARD) { + if ( gdk_device_get_source (keyboard) != GDK_SOURCE_KEYBOARD) + { keyboard = gdk_device_get_associated_device( keyboard ); } - if (remmina_file_get_int(cnnobj->remmina_file, "keyboard_grab", FALSE)) { + if (remmina_file_get_int(cnnobj->remmina_file, "keyboard_grab", FALSE)) + { gdk_device_grab(keyboard, gtk_widget_get_window(GTK_WIDGET(cnnhld->cnnwin)), GDK_OWNERSHIP_WINDOW, TRUE, GDK_KEY_PRESS | GDK_KEY_RELEASE, NULL, GDK_CURRENT_TIME); - } else { + } + else + { gdk_device_ungrab(keyboard, GDK_CURRENT_TIME); } } @@ -278,19 +287,22 @@ static gboolean remmina_connection_window_delete_event(GtkWidget* widget, GdkEve gint i, n; n = gtk_notebook_get_n_pages(notebook); - if (n > 1) { + if (n > 1) + { dialog = gtk_message_dialog_new(GTK_WINDOW(cnnhld->cnnwin), GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, - GTK_BUTTONS_YES_NO, - _("There are %i active connections in the current window. Are you sure to close?"), n); + GTK_BUTTONS_YES_NO, + _("There are %i active connections in the current window. Are you sure to close?"), n); i = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); if (i != GTK_RESPONSE_YES) return TRUE; } /* Just in case the connection already closed by the server before clicking yes */ - if (GTK_IS_WIDGET(notebook)) { + if (GTK_IS_WIDGET(notebook)) + { n = gtk_notebook_get_n_pages(notebook); - for (i = n - 1; i >= 0; i--) { + for (i = n - 1; i >= 0; i--) + { w = gtk_notebook_get_nth_page(notebook, i); cnnobj = (RemminaConnectionObject*) g_object_get_data(G_OBJECT(w), "cnnobj"); remmina_protocol_widget_close_connection(REMMINA_PROTOCOL_WIDGET(cnnobj->proto)); @@ -304,15 +316,18 @@ static void remmina_connection_window_destroy(GtkWidget* widget, RemminaConnecti TRACE_CALL("remmina_connection_window_destroy"); RemminaConnectionWindowPriv* priv = REMMINA_CONNECTION_WINDOW(widget)->priv; - if (priv->floating_toolbar_motion_handler) { + if (priv->floating_toolbar_motion_handler) + { g_source_remove(priv->floating_toolbar_motion_handler); priv->floating_toolbar_motion_handler = 0; } - if (priv->ftb_hide_eventsource) { + if (priv->ftb_hide_eventsource) + { g_source_remove(priv->ftb_hide_eventsource); priv->ftb_hide_eventsource = 0; } - if (priv->go_fullscreen_eventsource) { + if (priv->go_fullscreen_eventsource) + { g_source_remove(priv->go_fullscreen_eventsource); priv->go_fullscreen_eventsource = 0; } @@ -321,18 +336,21 @@ static void remmina_connection_window_destroy(GtkWidget* widget, RemminaConnecti /* There is no need to destroy priv->floating_toolbar_widget, * because it's our child and will be destroyed automatically */ #else - if (priv->floating_toolbar_window != NULL) { + if (priv->floating_toolbar_window != NULL) + { gtk_widget_destroy(priv->floating_toolbar_window); priv->floating_toolbar_window = NULL; } #endif - if (priv->switch_page_handler) { + if (priv->switch_page_handler) + { g_source_remove(priv->switch_page_handler); priv->switch_page_handler = 0; } g_free(priv); - if (GTK_WIDGET(cnnhld->cnnwin) == widget) { + if (GTK_WIDGET(cnnhld->cnnwin) == widget) + { cnnhld->cnnwin->priv = NULL; cnnhld->cnnwin = NULL; } @@ -345,14 +363,16 @@ static void remmina_connection_holder_update_toolbar_opacity(RemminaConnectionHo RemminaConnectionWindowPriv* priv = cnnhld->cnnwin->priv; priv->floating_toolbar_opacity = (1.0 - TOOLBAR_OPACITY_MIN) / ((gdouble) TOOLBAR_OPACITY_LEVEL) - * ((gdouble)(TOOLBAR_OPACITY_LEVEL - remmina_file_get_int(cnnobj->remmina_file, "toolbar_opacity", 0))) - + TOOLBAR_OPACITY_MIN; + * ((gdouble)(TOOLBAR_OPACITY_LEVEL - remmina_file_get_int(cnnobj->remmina_file, "toolbar_opacity", 0))) + + TOOLBAR_OPACITY_MIN; #if FLOATING_TOOLBAR_WIDGET - if (priv->floating_toolbar_widget) { + if (priv->floating_toolbar_widget) + { gtk_widget_set_opacity(GTK_WIDGET(priv->overlay_ftb_overlay), priv->floating_toolbar_opacity); } #else - if (priv->floating_toolbar_window) { + if (priv->floating_toolbar_window) + { #if GTK_CHECK_VERSION(3, 8, 0) gtk_widget_set_opacity(GTK_WIDGET(priv->floating_toolbar_window), priv->floating_toolbar_opacity); #else @@ -372,7 +392,8 @@ static gboolean remmina_connection_holder_floating_toolbar_motion(RemminaConnect GtkRequisition req; gint x, y, t, cnnwin_x, cnnwin_y; - if (priv->floating_toolbar_window == NULL) { + if (priv->floating_toolbar_window == NULL) + { priv->floating_toolbar_motion_handler = 0; return FALSE; } @@ -384,7 +405,8 @@ static gboolean remmina_connection_holder_floating_toolbar_motion(RemminaConnect x -= cnnwin_x; y -= cnnwin_y; - if (priv->floating_toolbar_motion_show || priv->floating_toolbar_motion_visible) { + if (priv->floating_toolbar_motion_show || priv->floating_toolbar_motion_visible) + { if (priv->floating_toolbar_motion_show) y += 2; else @@ -396,20 +418,24 @@ static gboolean remmina_connection_holder_floating_toolbar_motion(RemminaConnect y = t; gtk_window_move(GTK_WINDOW(priv->floating_toolbar_window), x + cnnwin_x, y + cnnwin_y); - if (remmina_pref.invisible_toolbar && !priv->pin_down) { + if (remmina_pref.invisible_toolbar && !priv->pin_down) + { #if GTK_CHECK_VERSION(3, 8, 0) gtk_widget_set_opacity(GTK_WIDGET(priv->floating_toolbar_window), - (gdouble)(y - t) / (gdouble)(-t) * priv->floating_toolbar_opacity); + (gdouble)(y - t) / (gdouble)(-t) * priv->floating_toolbar_opacity); #else gtk_window_set_opacity(GTK_WINDOW(priv->floating_toolbar_window), - (gdouble)(y - t) / (gdouble)(-t) * priv->floating_toolbar_opacity); + (gdouble)(y - t) / (gdouble)(-t) * priv->floating_toolbar_opacity); #endif } - if ((priv->floating_toolbar_motion_show && y >= 0) || (!priv->floating_toolbar_motion_show && y <= t)) { + if ((priv->floating_toolbar_motion_show && y >= 0) || (!priv->floating_toolbar_motion_show && y <= t)) + { priv->floating_toolbar_motion_handler = 0; return FALSE; } - } else { + } + else + { gtk_window_move(GTK_WINDOW(priv->floating_toolbar_window), x + cnnwin_x, -20 - req.height + cnnwin_y); priv->floating_toolbar_motion_handler = 0; return FALSE; @@ -422,15 +448,19 @@ static void remmina_connection_holder_floating_toolbar_update(RemminaConnectionH TRACE_CALL("remmina_connection_holder_floating_toolbar_update"); RemminaConnectionWindowPriv* priv = cnnhld->cnnwin->priv; - if (priv->floating_toolbar_motion_show || priv->floating_toolbar_motion_visible) { + if (priv->floating_toolbar_motion_show || priv->floating_toolbar_motion_visible) + { if (priv->floating_toolbar_motion_handler) g_source_remove(priv->floating_toolbar_motion_handler); priv->floating_toolbar_motion_handler = g_idle_add( - (GSourceFunc) remmina_connection_holder_floating_toolbar_motion, cnnhld); - } else { - if (priv->floating_toolbar_motion_handler == 0) { + (GSourceFunc) remmina_connection_holder_floating_toolbar_motion, cnnhld); + } + else + { + if (priv->floating_toolbar_motion_handler == 0) + { priv->floating_toolbar_motion_handler = g_timeout_add(MOTION_TIME, - (GSourceFunc) remmina_connection_holder_floating_toolbar_motion, cnnhld); + (GSourceFunc) remmina_connection_holder_floating_toolbar_motion, cnnhld); } } } @@ -456,18 +486,23 @@ static void remmina_connection_holder_floating_toolbar_show(RemminaConnectionHol if (priv->floating_toolbar_widget == NULL) return; - if (show || priv->pin_down) { + if (show || priv->pin_down) + { /* Make the FTB no longer transparent, in case we have an hidden toolbar */ remmina_connection_holder_update_toolbar_opacity(cnnhld); /* Remove outstanding hide events, if not yet active */ - if (priv->ftb_hide_eventsource) { + if (priv->ftb_hide_eventsource) + { g_source_remove(priv->ftb_hide_eventsource); priv->ftb_hide_eventsource = 0; } - } else { + } + else + { /* If we are hiding and the toolbar must be made invisible, schedule * a later toolbar hide */ - if (remmina_pref.invisible_toolbar) { + if (remmina_pref.invisible_toolbar) + { if (priv->ftb_hide_eventsource == 0) priv->ftb_hide_eventsource = g_timeout_add(1000, remmina_connection_holder_floating_toolbar_make_invisible, priv); } @@ -517,7 +552,7 @@ static void remmina_connection_object_set_scrolled_policy(RemminaConnectionObjec gboolean scale; scale = remmina_protocol_widget_get_scale(REMMINA_PROTOCOL_WIDGET(cnnobj->proto)); gtk_scrolled_window_set_policy(scrolled_window, scale ? GTK_POLICY_NEVER : GTK_POLICY_AUTOMATIC, - scale ? GTK_POLICY_NEVER : GTK_POLICY_AUTOMATIC); + scale ? GTK_POLICY_NEVER : GTK_POLICY_AUTOMATIC); } static gboolean remmina_connection_holder_toolbar_autofit_restore(RemminaConnectionHolder* cnnhld) @@ -528,16 +563,18 @@ static gboolean remmina_connection_holder_toolbar_autofit_restore(RemminaConnect gint width, height; GtkAllocation na, ca, ta; - if (cnnobj->connected && GTK_IS_SCROLLED_WINDOW(cnnobj->scrolled_container)) { + if (cnnobj->connected && GTK_IS_SCROLLED_WINDOW(cnnobj->scrolled_container)) + { remmina_connection_holder_get_desktop_size(cnnhld, &width, &height); gtk_widget_get_allocation(priv->notebook, &na); gtk_widget_get_allocation(cnnobj->scrolled_container, &ca); gtk_widget_get_allocation(priv->toolbar, &ta); gtk_window_resize(GTK_WINDOW(cnnhld->cnnwin), MAX(1, width + na.width - ca.width), - MAX(1, height + ta.height + na.height - ca.height)); + MAX(1, height + ta.height + na.height - ca.height)); gtk_container_check_resize(GTK_CONTAINER(cnnhld->cnnwin)); } - if (GTK_IS_SCROLLED_WINDOW(cnnobj->scrolled_container)) { + if (GTK_IS_SCROLLED_WINDOW(cnnobj->scrolled_container)) + { remmina_connection_object_set_scrolled_policy(cnnobj, GTK_SCROLLED_WINDOW(cnnobj->scrolled_container)); } return FALSE; @@ -548,15 +585,17 @@ static void remmina_connection_holder_toolbar_autofit(GtkWidget* widget, Remmina TRACE_CALL("remmina_connection_holder_toolbar_autofit"); DECLARE_CNNOBJ - if (GTK_IS_SCROLLED_WINDOW(cnnobj->scrolled_container)) { - if ((gdk_window_get_state(gtk_widget_get_window(GTK_WIDGET(cnnhld->cnnwin))) & GDK_WINDOW_STATE_MAXIMIZED) != 0) { + if (GTK_IS_SCROLLED_WINDOW(cnnobj->scrolled_container)) + { + if ((gdk_window_get_state(gtk_widget_get_window(GTK_WIDGET(cnnhld->cnnwin))) & GDK_WINDOW_STATE_MAXIMIZED) != 0) + { gtk_window_unmaximize(GTK_WINDOW(cnnhld->cnnwin)); } /* It's tricky to make the toolbars disappear automatically, while keeping scrollable. Please tell me if you know a better way to do this */ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(cnnobj->scrolled_container), GTK_POLICY_NEVER, - GTK_POLICY_NEVER); + GTK_POLICY_NEVER); /* ToDo: save returned source id in priv->something and then delete when main object is destroyed */ g_timeout_add(200, (GSourceFunc) remmina_connection_holder_toolbar_autofit_restore, cnnhld); @@ -589,23 +628,26 @@ static void remmina_connection_holder_check_resize(RemminaConnectionHolder* cnnh screen_height = screen_size.height; if (!remmina_protocol_widget_get_expand(REMMINA_PROTOCOL_WIDGET(cnnobj->proto)) - && (server_width <= 0 || server_height <= 0 || screen_width < server_width - || screen_height < server_height)) { + && (server_width <= 0 || server_height <= 0 || screen_width < server_width + || screen_height < server_height)) + { scroll_required = TRUE; } - switch (cnnhld->cnnwin->priv->view_mode) { + switch (cnnhld->cnnwin->priv->view_mode) + { case SCROLLED_FULLSCREEN_MODE: gtk_window_resize(GTK_WINDOW(cnnhld->cnnwin), screen_width, screen_height); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(cnnobj->scrolled_container), - (scroll_required ? GTK_POLICY_AUTOMATIC : GTK_POLICY_NEVER), - (scroll_required ? GTK_POLICY_AUTOMATIC : GTK_POLICY_NEVER)); + (scroll_required ? GTK_POLICY_AUTOMATIC : GTK_POLICY_NEVER), + (scroll_required ? GTK_POLICY_AUTOMATIC : GTK_POLICY_NEVER)); break; case VIEWPORT_FULLSCREEN_MODE: bordersz = scroll_required ? 1 : 0; gtk_window_resize (GTK_WINDOW(cnnhld->cnnwin), screen_width , screen_height); - if (REMMINA_IS_SCROLLED_VIEWPORT(cnnobj->scrolled_container)) { + if (REMMINA_IS_SCROLLED_VIEWPORT(cnnobj->scrolled_container)) + { /* Put a border around Notebook content (RemminaScrolledViewpord), so we can * move the mouse over the border to scroll */ gtk_container_set_border_width (GTK_CONTAINER (cnnobj->scrolled_container), bordersz); @@ -614,21 +656,28 @@ static void remmina_connection_holder_check_resize(RemminaConnectionHolder* cnnh break; case SCROLLED_WINDOW_MODE: - if (remmina_file_get_int (cnnobj->remmina_file, "viewmode", AUTO_MODE) == AUTO_MODE) { + if (remmina_file_get_int (cnnobj->remmina_file, "viewmode", AUTO_MODE) == AUTO_MODE) + { gtk_window_set_default_size (GTK_WINDOW(cnnhld->cnnwin), - MIN (server_width, screen_width), MIN (server_height, screen_height)); - if (server_width >= screen_width || server_height >= screen_height) { + MIN (server_width, screen_width), MIN (server_height, screen_height)); + if (server_width >= screen_width || server_height >= screen_height) + { gtk_window_maximize (GTK_WINDOW(cnnhld->cnnwin)); remmina_file_set_int (cnnobj->remmina_file, "window_maximize", TRUE); - } else { + } + else + { remmina_connection_holder_toolbar_autofit (NULL, cnnhld); remmina_file_set_int (cnnobj->remmina_file, "window_maximize", FALSE); } - } else { + } + else + { gtk_window_set_default_size (GTK_WINDOW(cnnhld->cnnwin), - remmina_file_get_int (cnnobj->remmina_file, "window_width", 640), - remmina_file_get_int (cnnobj->remmina_file, "window_height", 480)); - if (remmina_file_get_int (cnnobj->remmina_file, "window_maximize", FALSE)) { + remmina_file_get_int (cnnobj->remmina_file, "window_width", 640), + remmina_file_get_int (cnnobj->remmina_file, "window_height", 480)); + if (remmina_file_get_int (cnnobj->remmina_file, "window_maximize", FALSE)) + { gtk_window_maximize (GTK_WINDOW(cnnhld->cnnwin)); } } @@ -645,17 +694,25 @@ static void remmina_connection_holder_set_tooltip(GtkWidget* item, const gchar* gchar* s1; gchar* s2; - if (remmina_pref.hostkey && key1) { - if (key2) { + if (remmina_pref.hostkey && key1) + { + if (key2) + { s1 = g_strdup_printf(" (%s + %s,%s)", gdk_keyval_name(remmina_pref.hostkey), - gdk_keyval_name(gdk_keyval_to_upper(key1)), gdk_keyval_name(gdk_keyval_to_upper(key2))); - } else if (key1 == remmina_pref.hostkey) { + gdk_keyval_name(gdk_keyval_to_upper(key1)), gdk_keyval_name(gdk_keyval_to_upper(key2))); + } + else if (key1 == remmina_pref.hostkey) + { s1 = g_strdup_printf(" (%s)", gdk_keyval_name(remmina_pref.hostkey)); - } else { + } + else + { s1 = g_strdup_printf(" (%s + %s)", gdk_keyval_name(remmina_pref.hostkey), - gdk_keyval_name(gdk_keyval_to_upper(key1))); + gdk_keyval_name(gdk_keyval_to_upper(key1))); } - } else { + } + else + { s1 = NULL; } s2 = g_strdup_printf("%s%s", tip, s1 ? s1 : ""); @@ -672,24 +729,29 @@ static void remmina_protocol_widget_update_alignment(RemminaConnectionObject* cn int rdwidth, rdheight; gfloat aratio; - if (!cnnobj->plugin_can_scale) { + if (!cnnobj->plugin_can_scale) + { /* If we have a plugin that cannot scale, * (i.e. SFTP plugin), then we expand proto */ gtk_widget_set_halign(GTK_WIDGET(cnnobj->proto),GTK_ALIGN_FILL); gtk_widget_set_valign(GTK_WIDGET(cnnobj->proto),GTK_ALIGN_FILL); - } else { + } + else + { /* Plugin can scale */ scaledmode = remmina_protocol_widget_get_scale(REMMINA_PROTOCOL_WIDGET(cnnobj->proto)); scaledexpandedmode = remmina_protocol_widget_get_expand(REMMINA_PROTOCOL_WIDGET(cnnobj->proto)); /* Check if we need aspectframe and create/destroy it accordingly */ - if (scaledmode && !scaledexpandedmode) { + if (scaledmode && !scaledexpandedmode) + { /* We need an aspectframe as a parent of proto */ rdwidth = remmina_protocol_widget_get_width(REMMINA_PROTOCOL_WIDGET(cnnobj->proto)); rdheight = remmina_protocol_widget_get_height(REMMINA_PROTOCOL_WIDGET(cnnobj->proto)); aratio = (gfloat)rdwidth / (gfloat)rdheight; - if (!cnnobj->aspectframe) { + if (!cnnobj->aspectframe) + { /* We need a new aspectframe */ cnnobj->aspectframe = gtk_aspect_frame_new(NULL, 0.5, 0.5, aratio, FALSE); gtk_frame_set_shadow_type(GTK_FRAME(cnnobj->aspectframe), GTK_SHADOW_NONE); @@ -701,12 +763,17 @@ static void remmina_protocol_widget_update_alignment(RemminaConnectionObject* cn gtk_widget_show(cnnobj->aspectframe); if (cnnobj->cnnhld != NULL && cnnobj->cnnhld->cnnwin != NULL && cnnobj->cnnhld->cnnwin->priv->notebook != NULL) remmina_connection_holder_grab_focus(GTK_NOTEBOOK(cnnobj->cnnhld->cnnwin->priv->notebook)); - } else { + } + else + { gtk_aspect_frame_set(GTK_ASPECT_FRAME(cnnobj->aspectframe), 0.5, 0.5, aratio, FALSE); } - } else { + } + else + { /* We do not need an aspectframe as a parent of proto */ - if (cnnobj->aspectframe) { + if (cnnobj->aspectframe) + { /* We must remove the old aspectframe reparenting proto to viewport */ g_object_ref(cnnobj->aspectframe); g_object_ref(cnnobj->proto); @@ -721,13 +788,16 @@ static void remmina_protocol_widget_update_alignment(RemminaConnectionObject* cn } } - if (scaledmode) { + if (scaledmode) + { /* We have a plugin that can be scaled, and the scale button * has been pressed. Give it the correct WxH maintaining aspect * ratio of remote destkop size */ gtk_widget_set_halign(GTK_WIDGET(cnnobj->proto),GTK_ALIGN_FILL); gtk_widget_set_valign(GTK_WIDGET(cnnobj->proto),GTK_ALIGN_FILL); - } else { + } + else + { /* Plugin can scale, but no scaling is active. Ensure that we have * aspectframe with a ratio of 1 */ gtk_widget_set_halign(GTK_WIDGET(cnnobj->proto),GTK_ALIGN_CENTER); @@ -740,9 +810,12 @@ static void remmina_protocol_widget_update_alignment(RemminaConnectionObject* cn static void remmina_connection_holder_toolbar_fullscreen(GtkWidget* widget, RemminaConnectionHolder* cnnhld) { TRACE_CALL("remmina_connection_holder_toolbar_fullscreen"); - if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(widget))) { + if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(widget))) + { remmina_connection_holder_create_fullscreen(cnnhld, NULL, cnnhld->fullscreen_view_mode); - } else { + } + else + { remmina_connection_holder_create_scrolled(cnnhld, NULL); } } @@ -795,7 +868,8 @@ static void remmina_connection_holder_toolbar_fullscreen_option(GtkWidget* widge gtk_widget_show(menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); - if (priv->view_mode == VIEWPORT_FULLSCREEN_MODE) { + if (priv->view_mode == VIEWPORT_FULLSCREEN_MODE) + { gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE); } g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(remmina_connection_holder_viewport_fullscreen_mode), cnnhld); @@ -803,7 +877,8 @@ static void remmina_connection_holder_toolbar_fullscreen_option(GtkWidget* widge menuitem = gtk_radio_menu_item_new_with_label(group, _("Scrolled fullscreen mode")); gtk_widget_show(menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); - if (priv->view_mode == SCROLLED_FULLSCREEN_MODE) { + if (priv->view_mode == SCROLLED_FULLSCREEN_MODE) + { gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE); } g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(remmina_connection_holder_scrolled_fullscreen_mode), cnnhld); @@ -811,7 +886,7 @@ static void remmina_connection_holder_toolbar_fullscreen_option(GtkWidget* widge g_signal_connect(G_OBJECT(menu), "deactivate", G_CALLBACK(remmina_connection_holder_fullscreen_option_popdown), cnnhld); gtk_menu_popup(GTK_MENU(menu), NULL, NULL, remmina_public_popup_position, priv->toolitem_fullscreen, 0, - gtk_get_current_event_time()); + gtk_get_current_event_time()); } @@ -868,7 +943,8 @@ static void remmina_connection_holder_toolbar_scaler_option(GtkWidget* widget, R gtk_widget_show(menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); - if (!scaler_expand) { + if (!scaler_expand) + { gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE); } g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(remmina_connection_holder_scaler_keep_aspect), cnnhld); @@ -876,7 +952,8 @@ static void remmina_connection_holder_toolbar_scaler_option(GtkWidget* widget, R menuitem = gtk_radio_menu_item_new_with_label(group, _("Fill client window when scaled")); gtk_widget_show(menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); - if (scaler_expand) { + if (scaler_expand) + { gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE); } g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(remmina_connection_holder_scaler_expand), cnnhld); @@ -884,7 +961,7 @@ static void remmina_connection_holder_toolbar_scaler_option(GtkWidget* widget, R g_signal_connect(G_OBJECT(menu), "deactivate", G_CALLBACK(remmina_connection_holder_scaler_option_popdown), cnnhld); gtk_menu_popup(GTK_MENU(menu), NULL, NULL, remmina_public_popup_position, priv->toolitem_fullscreen, 0, - gtk_get_current_event_time()); + gtk_get_current_event_time()); } static void remmina_connection_holder_switch_page_activate(GtkMenuItem* menuitem, RemminaConnectionHolder* cnnhld) @@ -927,7 +1004,8 @@ static void remmina_connection_holder_toolbar_switch_page(GtkWidget* widget, Rem menu = gtk_menu_new(); n = gtk_notebook_get_n_pages(GTK_NOTEBOOK(priv->notebook)); - for (i = 0; i < n; i++) { + for (i = 0; i < n; i++) + { page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(priv->notebook), i); if (!page) break; @@ -942,14 +1020,15 @@ static void remmina_connection_holder_toolbar_switch_page(GtkWidget* widget, Rem g_object_set_data(G_OBJECT(menuitem), "new-page-num", GINT_TO_POINTER(i)); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(remmina_connection_holder_switch_page_activate), - cnnhld); - if (i == gtk_notebook_get_current_page(GTK_NOTEBOOK(priv->notebook))) { + cnnhld); + if (i == gtk_notebook_get_current_page(GTK_NOTEBOOK(priv->notebook))) + { gtk_widget_set_sensitive(menuitem, FALSE); } } g_signal_connect(G_OBJECT(menu), "deactivate", G_CALLBACK(remmina_connection_holder_toolbar_switch_page_popdown), - cnnhld); + cnnhld); gtk_menu_popup(GTK_MENU(menu), NULL, NULL, remmina_public_popup_position, widget, 0, gtk_get_current_event_time()); } @@ -963,10 +1042,14 @@ static void remmina_connection_holder_update_toolbar_autofit_button(RemminaConne gboolean bval; toolitem = priv->toolitem_autofit; - if (toolitem) { - if (priv->view_mode != SCROLLED_WINDOW_MODE) { + if (toolitem) + { + if (priv->view_mode != SCROLLED_WINDOW_MODE) + { gtk_widget_set_sensitive(GTK_WIDGET(toolitem), FALSE); - } else { + } + else + { bval = remmina_protocol_widget_get_scale(REMMINA_PROTOCOL_WIDGET(cnnobj->proto)); gtk_widget_set_sensitive(GTK_WIDGET(toolitem), !bval); } @@ -987,11 +1070,13 @@ static void remmina_connection_holder_toolbar_scaled_mode(GtkWidget* widget, Rem gtk_widget_set_sensitive(GTK_WIDGET(priv->scaler_option_button), scale); remmina_protocol_widget_call_feature_by_type(REMMINA_PROTOCOL_WIDGET(cnnobj->proto), - REMMINA_PROTOCOL_FEATURE_TYPE_SCALE, 0); - if (cnnhld->cnnwin->priv->view_mode != SCROLLED_WINDOW_MODE) { + REMMINA_PROTOCOL_FEATURE_TYPE_SCALE, 0); + if (cnnhld->cnnwin->priv->view_mode != SCROLLED_WINDOW_MODE) + { remmina_connection_holder_check_resize(cnnhld); } - if (GTK_IS_SCROLLED_WINDOW(cnnobj->scrolled_container)) { + if (GTK_IS_SCROLLED_WINDOW(cnnobj->scrolled_container)) + { remmina_connection_object_set_scrolled_policy(cnnobj, GTK_SCROLLED_WINDOW(cnnobj->scrolled_container)); } remmina_connection_holder_update_toolbar_autofit_button(cnnhld); @@ -1033,7 +1118,8 @@ static void remmina_connection_holder_call_protocol_feature_radio(GtkMenuItem* m RemminaProtocolFeature* feature; gpointer value; - if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem))) { + if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem))) + { feature = (RemminaProtocolFeature*) g_object_get_data(G_OBJECT(menuitem), "feature-type"); value = g_object_get_data(G_OBJECT(menuitem), "feature-value"); @@ -1066,7 +1152,7 @@ static void remmina_connection_holder_call_protocol_feature_activate(GtkMenuItem } static void remmina_connection_holder_toolbar_preferences_radio(RemminaConnectionHolder* cnnhld, RemminaFile* remminafile, - GtkWidget* menu, const RemminaProtocolFeature* feature, const gchar* domain, gboolean enabled) + GtkWidget* menu, const RemminaProtocolFeature* feature, const gchar* domain, gboolean enabled) { TRACE_CALL("remmina_connection_holder_toolbar_preferences_radio"); GtkWidget* menuitem; @@ -1078,30 +1164,35 @@ static void remmina_connection_holder_toolbar_preferences_radio(RemminaConnectio group = NULL; value = remmina_file_get_string(remminafile, (const gchar*) feature->opt2); list = (const gchar**) feature->opt3; - for (i = 0; list[i]; i += 2) { + for (i = 0; list[i]; i += 2) + { menuitem = gtk_radio_menu_item_new_with_label(group, g_dgettext(domain, list[i + 1])); group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); gtk_widget_show(menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); - if (enabled) { + if (enabled) + { g_object_set_data(G_OBJECT(menuitem), "feature-type", (gpointer) feature); g_object_set_data(G_OBJECT(menuitem), "feature-value", (gpointer) list[i]); - if (value && g_strcmp0(list[i], value) == 0) { + if (value && g_strcmp0(list[i], value) == 0) + { gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE); } g_signal_connect(G_OBJECT(menuitem), "toggled", - G_CALLBACK(remmina_connection_holder_call_protocol_feature_radio), cnnhld); - } else { + G_CALLBACK(remmina_connection_holder_call_protocol_feature_radio), cnnhld); + } + else + { gtk_widget_set_sensitive(menuitem, FALSE); } } } static void remmina_connection_holder_toolbar_preferences_check(RemminaConnectionHolder* cnnhld, RemminaFile* remminafile, - GtkWidget* menu, const RemminaProtocolFeature* feature, const gchar* domain, gboolean enabled) + GtkWidget* menu, const RemminaProtocolFeature* feature, const gchar* domain, gboolean enabled) { TRACE_CALL("remmina_connection_holder_toolbar_preferences_check"); GtkWidget* menuitem; @@ -1110,15 +1201,18 @@ static void remmina_connection_holder_toolbar_preferences_check(RemminaConnectio gtk_widget_show(menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); - if (enabled) { + if (enabled) + { g_object_set_data(G_OBJECT(menuitem), "feature-type", (gpointer) feature); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), - remmina_file_get_int(remminafile, (const gchar*) feature->opt2, FALSE)); + remmina_file_get_int(remminafile, (const gchar*) feature->opt2, FALSE)); g_signal_connect(G_OBJECT(menuitem), "toggled", - G_CALLBACK(remmina_connection_holder_call_protocol_feature_check), cnnhld); - } else { + G_CALLBACK(remmina_connection_holder_call_protocol_feature_check), cnnhld); + } + else + { gtk_widget_set_sensitive(menuitem, FALSE); } } @@ -1145,32 +1239,35 @@ static void remmina_connection_holder_toolbar_preferences(GtkWidget* widget, Rem domain = remmina_protocol_widget_get_domain(REMMINA_PROTOCOL_WIDGET(cnnobj->proto)); menu = gtk_menu_new(); for (feature = remmina_protocol_widget_get_features(REMMINA_PROTOCOL_WIDGET(cnnobj->proto)); feature && feature->type; - feature++) { + feature++) + { if (feature->type != REMMINA_PROTOCOL_FEATURE_TYPE_PREF) continue; - if (separator) { + if (separator) + { menuitem = gtk_separator_menu_item_new(); gtk_widget_show(menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); separator = FALSE; } enabled = remmina_protocol_widget_query_feature_by_ref(REMMINA_PROTOCOL_WIDGET(cnnobj->proto), feature); - switch (GPOINTER_TO_INT(feature->opt1)) { + switch (GPOINTER_TO_INT(feature->opt1)) + { case REMMINA_PROTOCOL_FEATURE_PREF_RADIO: remmina_connection_holder_toolbar_preferences_radio(cnnhld, cnnobj->remmina_file, menu, feature, - domain, enabled); + domain, enabled); separator = TRUE; break; case REMMINA_PROTOCOL_FEATURE_PREF_CHECK: remmina_connection_holder_toolbar_preferences_check(cnnhld, cnnobj->remmina_file, menu, feature, - domain, enabled); + domain, enabled); break; } } g_signal_connect(G_OBJECT(menu), "deactivate", G_CALLBACK(remmina_connection_holder_toolbar_preferences_popdown), - cnnhld); + cnnhld); gtk_menu_popup(GTK_MENU(menu), NULL, NULL, remmina_public_popup_position, widget, 0, gtk_get_current_event_time()); } @@ -1198,26 +1295,32 @@ static void remmina_connection_holder_toolbar_tools(GtkWidget* widget, RemminaCo domain = remmina_protocol_widget_get_domain(REMMINA_PROTOCOL_WIDGET(cnnobj->proto)); menu = gtk_menu_new(); for (feature = remmina_protocol_widget_get_features(REMMINA_PROTOCOL_WIDGET(cnnobj->proto)); feature && feature->type; - feature++) { + feature++) + { if (feature->type != REMMINA_PROTOCOL_FEATURE_TYPE_TOOL) continue; - if (feature->opt1) { + if (feature->opt1) + { menuitem = gtk_menu_item_new_with_label(g_dgettext(domain, (const gchar*) feature->opt1)); } - if (feature->opt3) { + if (feature->opt3) + { remmina_connection_holder_set_tooltip(menuitem, "", GPOINTER_TO_UINT(feature->opt3), 0); } gtk_widget_show(menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); enabled = remmina_protocol_widget_query_feature_by_ref(REMMINA_PROTOCOL_WIDGET(cnnobj->proto), feature); - if (enabled) { + if (enabled) + { g_object_set_data(G_OBJECT(menuitem), "feature-type", (gpointer) feature); g_signal_connect(G_OBJECT(menuitem), "activate", - G_CALLBACK(remmina_connection_holder_call_protocol_feature_activate), cnnhld); - } else { + G_CALLBACK(remmina_connection_holder_call_protocol_feature_activate), cnnhld); + } + else + { gtk_widget_set_sensitive(menuitem, FALSE); } } @@ -1225,10 +1328,12 @@ static void remmina_connection_holder_toolbar_tools(GtkWidget* widget, RemminaCo g_signal_connect(G_OBJECT(menu), "deactivate", G_CALLBACK(remmina_connection_holder_toolbar_tools_popdown), cnnhld); /* If the plugin accepts keystrokes include the keystrokes menu */ - if (remmina_protocol_widget_plugin_receives_keystrokes(REMMINA_PROTOCOL_WIDGET(cnnobj->proto))) { + if (remmina_protocol_widget_plugin_receives_keystrokes(REMMINA_PROTOCOL_WIDGET(cnnobj->proto))) + { /* Get the registered keystrokes list */ keystrokes = g_strsplit(remmina_pref.keystrokes, STRING_DELIMITOR, -1); - if (g_strv_length(keystrokes)) { + if (g_strv_length(keystrokes)) + { /* Add a keystrokes submenu */ menuitem = gtk_menu_item_new_with_label(_("Keystrokes")); submenu_keystrokes = GTK_MENU(gtk_menu_new()); @@ -1236,16 +1341,18 @@ static void remmina_connection_holder_toolbar_tools(GtkWidget* widget, RemminaCo gtk_widget_show(menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); /* Add each registered keystroke */ - for (i = 0; i < g_strv_length(keystrokes); i++) { + for (i = 0; i < g_strv_length(keystrokes); i++) + { keystroke_values = g_strsplit(keystrokes[i], STRING_DELIMITOR2, -1); - if (g_strv_length(keystroke_values) > 1) { + if (g_strv_length(keystroke_values) > 1) + { /* Add the keystroke if no description was available */ menuitem = gtk_menu_item_new_with_label( - g_strdup(keystroke_values[strlen(keystroke_values[0]) ? 0 : 1])); + g_strdup(keystroke_values[strlen(keystroke_values[0]) ? 0 : 1])); g_object_set_data(G_OBJECT(menuitem), "keystrokes", g_strdup(keystroke_values[1])); g_signal_connect_swapped(G_OBJECT(menuitem), "activate", - G_CALLBACK(remmina_protocol_widget_send_keystrokes), - REMMINA_PROTOCOL_WIDGET(cnnobj->proto)); + G_CALLBACK(remmina_protocol_widget_send_keystrokes), + REMMINA_PROTOCOL_WIDGET(cnnobj->proto)); gtk_widget_show(menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(submenu_keystrokes), menuitem); } @@ -1277,7 +1384,7 @@ static void remmina_connection_holder_toolbar_grab(GtkWidget* widget, RemminaCon DECLARE_CNNOBJ remmina_file_set_int(cnnobj->remmina_file, "keyboard_grab", - gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(widget))); + gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(widget))); remmina_connection_holder_keyboard_grab(cnnhld); } @@ -1295,7 +1402,8 @@ remmina_connection_holder_create_toolbar(RemminaConnectionHolder* cnnhld, gint m gtk_widget_show(toolbar); gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS); gtk_toolbar_set_show_arrow(GTK_TOOLBAR(toolbar), FALSE); - if (remmina_pref.small_toolbutton) { + if (remmina_pref.small_toolbutton) + { gtk_toolbar_set_icon_size(GTK_TOOLBAR(toolbar), GTK_ICON_SIZE_MENU); } @@ -1303,7 +1411,7 @@ remmina_connection_holder_create_toolbar(RemminaConnectionHolder* cnnhld, gint m toolitem = gtk_tool_button_new(NULL, NULL); gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(toolitem), "remmina-fit-window"); remmina_connection_holder_set_tooltip(GTK_WIDGET(toolitem), _("Resize the window to fit in remote resolution"), - remmina_pref.shortcutkey_autofit, 0); + remmina_pref.shortcutkey_autofit, 0); g_signal_connect(G_OBJECT(toolitem), "clicked", G_CALLBACK(remmina_connection_holder_toolbar_autofit), cnnhld); priv->toolitem_autofit = toolitem; gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem, -1); @@ -1313,7 +1421,7 @@ remmina_connection_holder_create_toolbar(RemminaConnectionHolder* cnnhld, gint m toolitem = gtk_toggle_tool_button_new(); gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(toolitem), "remmina-fullscreen"); remmina_connection_holder_set_tooltip(GTK_WIDGET(toolitem), _("Toggle fullscreen mode"), - remmina_pref.shortcutkey_fullscreen, 0); + remmina_pref.shortcutkey_fullscreen, 0); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem, -1); gtk_widget_show(GTK_WIDGET(toolitem)); priv->toolitem_fullscreen = toolitem; @@ -1329,7 +1437,8 @@ remmina_connection_holder_create_toolbar(RemminaConnectionHolder* cnnhld, gint m gtk_container_set_border_width(GTK_CONTAINER(widget), 0); gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NONE); gtk_button_set_focus_on_click(GTK_BUTTON(widget), FALSE); - if (remmina_pref.small_toolbutton) { + if (remmina_pref.small_toolbutton) + { gtk_widget_set_name(widget, "remmina-small-button"); } gtk_container_add(GTK_CONTAINER(toolitem), widget); @@ -1343,7 +1452,8 @@ remmina_connection_holder_create_toolbar(RemminaConnectionHolder* cnnhld, gint m gtk_container_add(GTK_CONTAINER(widget), arrow); g_signal_connect(G_OBJECT(widget), "toggled", G_CALLBACK(remmina_connection_holder_toolbar_fullscreen_option), cnnhld); priv->fullscreen_option_button = widget; - if (mode == SCROLLED_WINDOW_MODE) { + if (mode == SCROLLED_WINDOW_MODE) + { gtk_widget_set_sensitive(GTK_WIDGET(widget), FALSE); } @@ -1351,7 +1461,7 @@ remmina_connection_holder_create_toolbar(RemminaConnectionHolder* cnnhld, gint m toolitem = gtk_toggle_tool_button_new(); gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(toolitem), "remmina-switch-page"); remmina_connection_holder_set_tooltip(GTK_WIDGET(toolitem), _("Switch tab pages"), remmina_pref.shortcutkey_prevtab, - remmina_pref.shortcutkey_nexttab); + remmina_pref.shortcutkey_nexttab); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem, -1); gtk_widget_show(GTK_WIDGET(toolitem)); g_signal_connect(G_OBJECT(toolitem), "toggled", G_CALLBACK(remmina_connection_holder_toolbar_switch_page), cnnhld); @@ -1379,7 +1489,8 @@ remmina_connection_holder_create_toolbar(RemminaConnectionHolder* cnnhld, gint m gtk_container_set_border_width(GTK_CONTAINER(widget), 0); gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NONE); gtk_button_set_focus_on_click(GTK_BUTTON(widget), FALSE); - if (remmina_pref.small_toolbutton) { + if (remmina_pref.small_toolbutton) + { gtk_widget_set_name(widget, "remmina-small-button"); } gtk_container_add(GTK_CONTAINER(toolitem), widget); @@ -1397,7 +1508,7 @@ remmina_connection_holder_create_toolbar(RemminaConnectionHolder* cnnhld, gint m toolitem = gtk_toggle_tool_button_new(); gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(toolitem), "input-keyboard"); remmina_connection_holder_set_tooltip(GTK_WIDGET(toolitem), _("Grab all keyboard events"), - remmina_pref.shortcutkey_grab, 0); + remmina_pref.shortcutkey_grab, 0); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem, -1); gtk_widget_show(GTK_WIDGET(toolitem)); g_signal_connect(G_OBJECT(toolitem), "toggled", G_CALLBACK(remmina_connection_holder_toolbar_grab), cnnhld); @@ -1461,21 +1572,21 @@ static void remmina_connection_holder_update_toolbar(RemminaConnectionHolder* cn gtk_widget_set_sensitive(GTK_WIDGET(priv->scaler_option_button), bval); bval = remmina_protocol_widget_query_feature_by_type(REMMINA_PROTOCOL_WIDGET(cnnobj->proto), - REMMINA_PROTOCOL_FEATURE_TYPE_SCALE); + REMMINA_PROTOCOL_FEATURE_TYPE_SCALE); gtk_widget_set_sensitive(GTK_WIDGET(toolitem), bval); toolitem = priv->toolitem_grab; gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(toolitem), - remmina_file_get_int(cnnobj->remmina_file, "keyboard_grab", FALSE)); + remmina_file_get_int(cnnobj->remmina_file, "keyboard_grab", FALSE)); toolitem = priv->toolitem_preferences; bval = remmina_protocol_widget_query_feature_by_type(REMMINA_PROTOCOL_WIDGET(cnnobj->proto), - REMMINA_PROTOCOL_FEATURE_TYPE_PREF); + REMMINA_PROTOCOL_FEATURE_TYPE_PREF); gtk_widget_set_sensitive(GTK_WIDGET(toolitem), bval); toolitem = priv->toolitem_tools; bval = remmina_protocol_widget_query_feature_by_type(REMMINA_PROTOCOL_WIDGET(cnnobj->proto), - REMMINA_PROTOCOL_FEATURE_TYPE_TOOL); + REMMINA_PROTOCOL_FEATURE_TYPE_TOOL); gtk_widget_set_sensitive(GTK_WIDGET(toolitem), bval); gtk_window_set_title(GTK_WINDOW(cnnhld->cnnwin), remmina_file_get_string(cnnobj->remmina_file, "name")); @@ -1487,7 +1598,7 @@ static void remmina_connection_holder_update_toolbar(RemminaConnectionHolder* cn #endif { gtk_label_set_text(GTK_LABEL(priv->floating_toolbar_label), - remmina_file_get_string(cnnobj->remmina_file, "name")); + remmina_file_get_string(cnnobj->remmina_file, "name")); } } @@ -1499,24 +1610,34 @@ static void remmina_connection_holder_showhide_toolbar(RemminaConnectionHolder* GtkRequisition req; gint width, height; - if (priv->view_mode == SCROLLED_WINDOW_MODE) { + if (priv->view_mode == SCROLLED_WINDOW_MODE) + { if (resize - && (gdk_window_get_state(gtk_widget_get_window(GTK_WIDGET(cnnhld->cnnwin))) - & GDK_WINDOW_STATE_MAXIMIZED) == 0) { + && (gdk_window_get_state(gtk_widget_get_window(GTK_WIDGET(cnnhld->cnnwin))) + & GDK_WINDOW_STATE_MAXIMIZED) == 0) + { gtk_window_get_size(GTK_WINDOW(cnnhld->cnnwin), &width, &height); gtk_widget_get_preferred_size(priv->toolbar, &req, NULL); - if (remmina_pref.hide_connection_toolbar) { + if (remmina_pref.hide_connection_toolbar) + { gtk_widget_hide(priv->toolbar); gtk_window_resize(GTK_WINDOW(cnnhld->cnnwin), width, height - req.height); - } else { + } + else + { gtk_window_resize(GTK_WINDOW(cnnhld->cnnwin), width, height + req.height); gtk_widget_show(priv->toolbar); } - } else { - if (remmina_pref.hide_connection_toolbar) { + } + else + { + if (remmina_pref.hide_connection_toolbar) + { gtk_widget_hide(priv->toolbar); - } else { + } + else + { gtk_widget_show(priv->toolbar); } } @@ -1524,7 +1645,7 @@ static void remmina_connection_holder_showhide_toolbar(RemminaConnectionHolder* } static gboolean remmina_connection_holder_floating_toolbar_on_enter(GtkWidget* widget, GdkEventCrossing* event, - RemminaConnectionHolder* cnnhld) + RemminaConnectionHolder* cnnhld) { TRACE_CALL("remmina_connection_holder_floating_toolbar_on_enter"); remmina_connection_holder_floating_toolbar_show(cnnhld, TRUE); @@ -1532,12 +1653,13 @@ static gboolean remmina_connection_holder_floating_toolbar_on_enter(GtkWidget* w } static gboolean remmina_connection_object_enter_protocol_widget(GtkWidget* widget, GdkEventCrossing* event, - RemminaConnectionObject* cnnobj) + RemminaConnectionObject* cnnobj) { TRACE_CALL("remmina_connection_object_enter_protocol_widget"); RemminaConnectionHolder* cnnhld = cnnobj->cnnhld; RemminaConnectionWindowPriv* priv = cnnhld->cnnwin->priv; - if (!priv->sticky && event->mode == GDK_CROSSING_NORMAL) { + if (!priv->sticky && event->mode == GDK_CROSSING_NORMAL) + { remmina_connection_holder_floating_toolbar_show(cnnhld, FALSE); return TRUE; } @@ -1552,7 +1674,8 @@ static gboolean remmina_connection_window_focus_in(GtkWidget* widget, GdkEventFo #if !FLOATING_TOOLBAR_WIDGET RemminaConnectionWindowPriv* priv = cnnhld->cnnwin->priv; - if (priv->floating_toolbar_window) { + if (priv->floating_toolbar_window) + { remmina_connection_holder_floating_toolbar_visible(cnnhld, TRUE); } #endif @@ -1570,15 +1693,17 @@ static gboolean remmina_connection_window_focus_out(GtkWidget* widget, GdkEventF cnnhld->hostkey_activated = FALSE; #if !FLOATING_TOOLBAR_WIDGET - if (!priv->sticky && priv->floating_toolbar_window) { + if (!priv->sticky && priv->floating_toolbar_window) + { remmina_connection_holder_floating_toolbar_visible(cnnhld, FALSE); } #endif - if (REMMINA_IS_SCROLLED_VIEWPORT(cnnobj->scrolled_container)) { + if (REMMINA_IS_SCROLLED_VIEWPORT(cnnobj->scrolled_container)) + { remmina_scrolled_viewport_remove_motion(REMMINA_SCROLLED_VIEWPORT(cnnobj->scrolled_container)); } remmina_protocol_widget_call_feature_by_type(REMMINA_PROTOCOL_WIDGET(cnnobj->proto), - REMMINA_PROTOCOL_FEATURE_TYPE_UNFOCUS, 0); + REMMINA_PROTOCOL_FEATURE_TYPE_UNFOCUS, 0); return FALSE; } @@ -1587,7 +1712,8 @@ static gboolean remmina_connection_window_on_enter(GtkWidget* widget, GdkEventCr { TRACE_CALL("remmina_connection_window_on_enter"); if (event->detail == GDK_NOTIFY_VIRTUAL || event->detail == GDK_NOTIFY_NONLINEAR - || event->detail == GDK_NOTIFY_NONLINEAR_VIRTUAL) { + || event->detail == GDK_NOTIFY_NONLINEAR_VIRTUAL) + { remmina_connection_holder_keyboard_grab(cnnhld); } return FALSE; @@ -1602,12 +1728,15 @@ static gboolean remmina_connection_window_on_leave(GtkWidget* widget, GdkEventCr GdkDevice *device = NULL; if (event->detail == GDK_NOTIFY_VIRTUAL || event->detail == GDK_NOTIFY_NONLINEAR - || event->detail == GDK_NOTIFY_NONLINEAR_VIRTUAL) { + || event->detail == GDK_NOTIFY_NONLINEAR_VIRTUAL) + { display = gtk_widget_get_display(widget); manager = gdk_display_get_device_manager(display); device = gdk_device_manager_get_client_pointer(manager); - if (device != NULL) { - if ( gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD ) { + if (device != NULL) + { + if ( gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD ) + { device = gdk_device_get_associated_device (device); } gdk_device_ungrab(device, GDK_CURRENT_TIME); @@ -1617,23 +1746,26 @@ static gboolean remmina_connection_window_on_leave(GtkWidget* widget, GdkEventCr } static gboolean remmina_connection_holder_floating_toolbar_on_scroll(GtkWidget* widget, GdkEventScroll* event, - RemminaConnectionHolder* cnnhld) + RemminaConnectionHolder* cnnhld) { TRACE_CALL("remmina_connection_holder_floating_toolbar_on_scroll"); DECLARE_CNNOBJ_WITH_RETURN(FALSE) int opacity; opacity = remmina_file_get_int(cnnobj->remmina_file, "toolbar_opacity", 0); - switch (event->direction) { + switch (event->direction) + { case GDK_SCROLL_UP: - if (opacity > 0) { + if (opacity > 0) + { remmina_file_set_int(cnnobj->remmina_file, "toolbar_opacity", opacity - 1); remmina_connection_holder_update_toolbar_opacity(cnnhld); return TRUE; } break; case GDK_SCROLL_DOWN: - if (opacity < TOOLBAR_OPACITY_LEVEL) { + if (opacity < TOOLBAR_OPACITY_LEVEL) + { remmina_file_set_int(cnnobj->remmina_file, "toolbar_opacity", opacity + 1); remmina_connection_holder_update_toolbar_opacity(cnnhld); return TRUE; @@ -1641,12 +1773,14 @@ static gboolean remmina_connection_holder_floating_toolbar_on_scroll(GtkWidget* break; #ifdef GDK_SCROLL_SMOOTH case GDK_SCROLL_SMOOTH: - if (event->delta_y < 0 && opacity > 0) { + if (event->delta_y < 0 && opacity > 0) + { remmina_file_set_int(cnnobj->remmina_file, "toolbar_opacity", opacity - 1); remmina_connection_holder_update_toolbar_opacity(cnnhld); return TRUE; } - if (event->delta_y > 0 && opacity < TOOLBAR_OPACITY_LEVEL) { + if (event->delta_y > 0 && opacity < TOOLBAR_OPACITY_LEVEL) + { remmina_file_set_int(cnnobj->remmina_file, "toolbar_opacity", opacity + 1); remmina_connection_holder_update_toolbar_opacity(cnnhld); return TRUE; @@ -1660,7 +1794,7 @@ static gboolean remmina_connection_holder_floating_toolbar_on_scroll(GtkWidget* } static gboolean remmina_connection_window_on_configure(GtkWidget* widget, GdkEventConfigure* event, - RemminaConnectionHolder* cnnhld) + RemminaConnectionHolder* cnnhld) { TRACE_CALL("remmina_connection_window_on_configure"); DECLARE_CNNOBJ_WITH_RETURN(FALSE) @@ -1672,20 +1806,25 @@ static gboolean remmina_connection_window_on_configure(GtkWidget* widget, GdkEve #endif if (cnnhld->cnnwin && gtk_widget_get_window(GTK_WIDGET(cnnhld->cnnwin)) - && cnnhld->cnnwin->priv->view_mode == SCROLLED_WINDOW_MODE) { + && cnnhld->cnnwin->priv->view_mode == SCROLLED_WINDOW_MODE) + { /* Here we store the window state in real-time */ - if ((gdk_window_get_state(gtk_widget_get_window(GTK_WIDGET(cnnhld->cnnwin))) & GDK_WINDOW_STATE_MAXIMIZED) == 0) { + if ((gdk_window_get_state(gtk_widget_get_window(GTK_WIDGET(cnnhld->cnnwin))) & GDK_WINDOW_STATE_MAXIMIZED) == 0) + { gtk_window_get_size(GTK_WINDOW(cnnhld->cnnwin), &width, &height); remmina_file_set_int(cnnobj->remmina_file, "window_width", width); remmina_file_set_int(cnnobj->remmina_file, "window_height", height); remmina_file_set_int(cnnobj->remmina_file, "window_maximize", FALSE); - } else { + } + else + { remmina_file_set_int(cnnobj->remmina_file, "window_maximize", TRUE); } } #if !FLOATING_TOOLBAR_WIDGET - if (priv->floating_toolbar_window) { + if (priv->floating_toolbar_window) + { gtk_widget_get_preferred_size(priv->floating_toolbar_window, &req, NULL); gtk_window_get_position(GTK_WINDOW(priv->floating_toolbar_window), NULL, &y); @@ -1695,7 +1834,8 @@ static gboolean remmina_connection_window_on_configure(GtkWidget* widget, GdkEve } #endif - if (cnnhld->cnnwin->priv->view_mode != SCROLLED_WINDOW_MODE) { + if (cnnhld->cnnwin->priv->view_mode != SCROLLED_WINDOW_MODE) + { /* Notify window of change so that scroll border can be hidden or shown if needed */ remmina_connection_holder_check_resize(cnnobj->cnnhld); } @@ -1705,12 +1845,15 @@ static gboolean remmina_connection_window_on_configure(GtkWidget* widget, GdkEve static void remmina_connection_holder_update_pin(RemminaConnectionHolder* cnnhld) { TRACE_CALL("remmina_connection_holder_update_pin"); - if (cnnhld->cnnwin->priv->pin_down) { + if (cnnhld->cnnwin->priv->pin_down) + { gtk_button_set_image(GTK_BUTTON(cnnhld->cnnwin->priv->pin_button), - gtk_image_new_from_icon_name("remmina-pin-down", GTK_ICON_SIZE_MENU)); - } else { + gtk_image_new_from_icon_name("remmina-pin-down", GTK_ICON_SIZE_MENU)); + } + else + { gtk_button_set_image(GTK_BUTTON(cnnhld->cnnwin->priv->pin_button), - gtk_image_new_from_icon_name("remmina-pin-up", GTK_ICON_SIZE_MENU)); + gtk_image_new_from_icon_name("remmina-pin-up", GTK_ICON_SIZE_MENU)); } } @@ -1795,10 +1938,13 @@ static void remmina_connection_holder_create_floating_toolbar(RemminaConnectionH #if FLOATING_TOOLBAR_WIDGET - if (remmina_pref.floating_toolbar_placement == FLOATING_TOOLBAR_PLACEMENT_BOTTOM) { + if (remmina_pref.floating_toolbar_placement == FLOATING_TOOLBAR_PLACEMENT_BOTTOM) + { gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), tb, FALSE, FALSE, 0); - } else { + } + else + { gtk_box_pack_start(GTK_BOX(vbox), tb, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); } @@ -1819,7 +1965,8 @@ static void remmina_connection_holder_create_floating_toolbar(RemminaConnectionH priv->floating_toolbar_window = ftb_popup_window; remmina_connection_holder_update_toolbar_opacity(cnnhld); - if (remmina_pref.invisible_toolbar && !priv->pin_down) { + if (remmina_pref.invisible_toolbar && !priv->pin_down) + { #if GTK_CHECK_VERSION(3, 8, 0) gtk_widget_set_opacity(GTK_WIDGET(ftb_popup_window), 0.0); #else @@ -1857,10 +2004,11 @@ static gboolean remmina_connection_window_state_event(GtkWidget* widget, GdkEven screen = gdk_screen_get_default(); if (remmina_pref.minimize_to_tray && (event->changed_mask & GDK_WINDOW_STATE_ICONIFIED) != 0 - && (event->new_window_state & GDK_WINDOW_STATE_ICONIFIED) != 0 - && remmina_public_get_current_workspace(screen) - == remmina_public_get_window_workspace(GTK_WINDOW(widget)) - && gdk_screen_get_number(screen) == gdk_screen_get_number(gtk_widget_get_screen(widget))) { + && (event->new_window_state & GDK_WINDOW_STATE_ICONIFIED) != 0 + && remmina_public_get_current_workspace(screen) + == remmina_public_get_window_workspace(GTK_WINDOW(widget)) + && gdk_screen_get_number(screen) == gdk_screen_get_number(gtk_widget_get_screen(widget))) + { gtk_widget_hide(widget); return TRUE; } @@ -1900,7 +2048,8 @@ static void remmina_connection_window_update_tag(RemminaConnectionWindow* cnnwin TRACE_CALL("remmina_connection_window_update_tag"); gchar* tag; - switch (remmina_pref.tab_mode) { + switch (remmina_pref.tab_mode) + { case REMMINA_TAB_BY_GROUP: tag = g_strdup(remmina_file_get_string(cnnobj->remmina_file, "group")); break; @@ -1919,9 +2068,12 @@ static void remmina_connection_object_create_scrolled_container(RemminaConnectio TRACE_CALL("remmina_connection_object_create_scrolled_container"); GtkWidget* container; - if (view_mode == VIEWPORT_FULLSCREEN_MODE) { + if (view_mode == VIEWPORT_FULLSCREEN_MODE) + { container = remmina_scrolled_viewport_new(); - } else { + } + else + { container = gtk_scrolled_window_new(NULL, NULL); remmina_connection_object_set_scrolled_policy(cnnobj, GTK_SCROLLED_WINDOW(container)); gtk_container_set_border_width(GTK_CONTAINER(container), 0); @@ -1946,7 +2098,8 @@ static void remmina_connection_holder_grab_focus(GtkNotebook *notebook) child = gtk_notebook_get_nth_page(notebook, gtk_notebook_get_current_page(notebook)); cnnobj = g_object_get_data(G_OBJECT(child), "cnnobj"); - if (GTK_IS_WIDGET(cnnobj->proto)) { + if (GTK_IS_WIDGET(cnnobj->proto)) + { remmina_protocol_widget_grab_focus(REMMINA_PROTOCOL_WIDGET(cnnobj->proto)); } } @@ -1954,7 +2107,8 @@ static void remmina_connection_holder_grab_focus(GtkNotebook *notebook) static void remmina_connection_object_on_close_button_clicked(GtkButton* button, RemminaConnectionObject* cnnobj) { TRACE_CALL("remmina_connection_object_on_close_button_clicked"); - if (REMMINA_IS_PROTOCOL_WIDGET(cnnobj->proto)) { + if (REMMINA_IS_PROTOCOL_WIDGET(cnnobj->proto)) + { remmina_protocol_widget_close_connection(REMMINA_PROTOCOL_WIDGET(cnnobj->proto)); } } @@ -1999,7 +2153,7 @@ static GtkWidget* remmina_connection_object_create_tab(RemminaConnectionObject* } static gint remmina_connection_object_append_page(RemminaConnectionObject* cnnobj, GtkNotebook* notebook, GtkWidget* tab, - gint view_mode) + gint view_mode) { TRACE_CALL("remmina_connection_object_append_page"); gint i; @@ -2014,7 +2168,7 @@ static gint remmina_connection_object_append_page(RemminaConnectionObject* cnnob } static void remmina_connection_window_initialize_notebook(GtkNotebook* to, GtkNotebook* from, RemminaConnectionObject* cnnobj, - gint view_mode) + gint view_mode) { TRACE_CALL("remmina_connection_window_initialize_notebook"); gint i, n, c; @@ -2023,7 +2177,8 @@ static void remmina_connection_window_initialize_notebook(GtkNotebook* to, GtkNo RemminaConnectionObject* tc; /* Init connection */ - if (cnnobj) { + if (cnnobj) + { /* Initial connection for a newly created window */ tab = remmina_connection_object_create_tab(cnnobj); remmina_connection_object_append_page(cnnobj, to, tab, view_mode); @@ -2032,16 +2187,21 @@ static void remmina_connection_window_initialize_notebook(GtkNotebook* to, GtkNo gtk_widget_reparent(cnnobj->viewport, cnnobj->scrolled_container); G_GNUC_END_IGNORE_DEPRECATIONS - if (cnnobj->window) { + if (cnnobj->window) + { gtk_widget_destroy(cnnobj->window); cnnobj->window = NULL; } - } else { + } + else + { /* View mode changed. Migrate all existing connections to the new notebook */ - if (from != NULL && GTK_IS_NOTEBOOK(from)) { + if (from != NULL && GTK_IS_NOTEBOOK(from)) + { c = gtk_notebook_get_current_page(from); n = gtk_notebook_get_n_pages(from); - for (i = 0; i < n; i++) { + for (i = 0; i < n; i++) + { widget = gtk_notebook_get_nth_page(from, i); tc = (RemminaConnectionObject*) g_object_get_data(G_OBJECT(widget), "cnnobj"); @@ -2069,7 +2229,8 @@ static void remmina_connection_holder_update_notebook(RemminaConnectionHolder* c notebook = GTK_NOTEBOOK(cnnhld->cnnwin->priv->notebook); - switch (cnnhld->cnnwin->priv->view_mode) { + switch (cnnhld->cnnwin->priv->view_mode) + { case SCROLLED_WINDOW_MODE: n = gtk_notebook_get_n_pages(notebook); gtk_notebook_set_show_tabs(notebook, remmina_pref.always_show_tab ? TRUE : n > 1); @@ -2088,10 +2249,12 @@ static gboolean remmina_connection_holder_on_switch_page_real(gpointer data) RemminaConnectionHolder* cnnhld = (RemminaConnectionHolder*) data; RemminaConnectionWindowPriv* priv = cnnhld->cnnwin->priv; - if (GTK_IS_WIDGET(cnnhld->cnnwin)) { + if (GTK_IS_WIDGET(cnnhld->cnnwin)) + { remmina_connection_holder_update_toolbar(cnnhld); remmina_connection_holder_grab_focus(GTK_NOTEBOOK(priv->notebook)); - if (cnnhld->cnnwin->priv->view_mode != SCROLLED_WINDOW_MODE) { + if (cnnhld->cnnwin->priv->view_mode != SCROLLED_WINDOW_MODE) + { remmina_connection_holder_check_resize(cnnhld); } } @@ -2100,24 +2263,28 @@ static gboolean remmina_connection_holder_on_switch_page_real(gpointer data) } static void remmina_connection_holder_on_switch_page(GtkNotebook* notebook, GtkWidget* page, guint page_num, - RemminaConnectionHolder* cnnhld) + RemminaConnectionHolder* cnnhld) { TRACE_CALL("remmina_connection_holder_on_switch_page"); RemminaConnectionWindowPriv* priv = cnnhld->cnnwin->priv; - if (!priv->switch_page_handler) { + if (!priv->switch_page_handler) + { priv->switch_page_handler = g_idle_add(remmina_connection_holder_on_switch_page_real, cnnhld); } } static void remmina_connection_holder_on_page_added(GtkNotebook* notebook, GtkWidget* child, guint page_num, - RemminaConnectionHolder* cnnhld) + RemminaConnectionHolder* cnnhld) { TRACE_CALL("remmina_connection_holder_on_page_added"); - if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(cnnhld->cnnwin->priv->notebook)) <= 0) { + if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(cnnhld->cnnwin->priv->notebook)) <= 0) + { gtk_widget_destroy(GTK_WIDGET(cnnhld->cnnwin)); g_free(cnnhld); - } else { + } + else + { remmina_connection_holder_update_notebook(cnnhld); } } @@ -2151,11 +2318,15 @@ remmina_connection_holder_on_notebook_create_window(GtkNotebook* notebook, GtkWi cnnobj = (RemminaConnectionObject*) g_object_get_data(G_OBJECT(page), "cnnobj"); srcpagenum = gtk_notebook_page_num(GTK_NOTEBOOK(srccnnwin->priv->notebook), cnnobj->scrolled_container); - if (dstcnnwin) { + if (dstcnnwin) + { cnnobj->cnnhld = dstcnnwin->priv->cnnhld; - } else { + } + else + { cnnobj->cnnhld = g_new0(RemminaConnectionHolder, 1); - if (!cnnobj->cnnhld->cnnwin) { + if (!cnnobj->cnnhld->cnnwin) + { /* Create a new scrolled window to accomodate the dropped connection */ remmina_connection_holder_create_scrolled(cnnobj->cnnhld, NULL); @@ -2163,13 +2334,13 @@ remmina_connection_holder_on_notebook_create_window(GtkNotebook* notebook, GtkWi * to set initial size because it has no notebook page on the window. So, we do resize * manually here */ gtk_window_resize( GTK_WINDOW(cnnobj->cnnhld->cnnwin), - remmina_file_get_int (cnnobj->remmina_file, "window_width", 640), - remmina_file_get_int (cnnobj->remmina_file, "window_height", 480)); + remmina_file_get_int (cnnobj->remmina_file, "window_width", 640), + remmina_file_get_int (cnnobj->remmina_file, "window_height", 480)); } } remmina_protocol_widget_set_hostkey_func(REMMINA_PROTOCOL_WIDGET(cnnobj->proto), - (RemminaHostkeyFunc) remmina_connection_window_hostkey_func, cnnobj->cnnhld); + (RemminaHostkeyFunc) remmina_connection_window_hostkey_func, cnnobj->cnnhld); return GTK_NOTEBOOK(cnnobj->cnnhld->cnnwin->priv->notebook); } @@ -2185,7 +2356,7 @@ remmina_connection_holder_create_notebook(RemminaConnectionHolder* cnnhld) gtk_widget_show(notebook); g_signal_connect(G_OBJECT(notebook), "create-window", G_CALLBACK(remmina_connection_holder_on_notebook_create_window), - cnnhld); + cnnhld); g_signal_connect(G_OBJECT(notebook), "switch-page", G_CALLBACK(remmina_connection_holder_on_switch_page), cnnhld); g_signal_connect(G_OBJECT(notebook), "page-added", G_CALLBACK(remmina_connection_holder_on_page_added), cnnhld); g_signal_connect(G_OBJECT(notebook), "page-removed", G_CALLBACK(remmina_connection_holder_on_page_added), cnnhld); @@ -2229,17 +2400,20 @@ static void remmina_connection_holder_create_scrolled(RemminaConnectionHolder* c cnnhld->cnnwin->priv->notebook = notebook; remmina_connection_window_initialize_notebook(GTK_NOTEBOOK(notebook), - (oldwindow ? GTK_NOTEBOOK(REMMINA_CONNECTION_WINDOW(oldwindow)->priv->notebook) : NULL), cnnobj, - SCROLLED_WINDOW_MODE); + (oldwindow ? GTK_NOTEBOOK(REMMINA_CONNECTION_WINDOW(oldwindow)->priv->notebook) : NULL), cnnobj, + SCROLLED_WINDOW_MODE); - if (cnnobj) { + if (cnnobj) + { remmina_connection_window_update_tag(cnnhld->cnnwin, cnnobj); - if (remmina_file_get_int(cnnobj->remmina_file, "window_maximize", FALSE)) { + if (remmina_file_get_int(cnnobj->remmina_file, "window_maximize", FALSE)) + { gtk_window_maximize(GTK_WINDOW(cnnhld->cnnwin)); } } - if (oldwindow) { + if (oldwindow) + { tag = g_strdup((gchar*) g_object_get_data(G_OBJECT(oldwindow), "tag")); g_object_set_data_full(G_OBJECT(cnnhld->cnnwin), "tag", tag, (GDestroyNotify) g_free); gtk_widget_destroy(oldwindow); @@ -2276,7 +2450,8 @@ static void remmina_connection_holder_create_overlay_ftb_overlay(RemminaConnecti RemminaConnectionWindowPriv* priv; priv = cnnhld->cnnwin->priv; - if (priv->overlay_ftb_overlay != NULL) { + if (priv->overlay_ftb_overlay != NULL) + { gtk_widget_destroy(priv->overlay_ftb_overlay); priv->overlay_ftb_overlay = NULL; priv->revealer = NULL; @@ -2297,12 +2472,15 @@ static void remmina_connection_holder_create_overlay_ftb_overlay(RemminaConnecti gtk_widget_set_halign(GTK_WIDGET(priv->overlay_ftb_overlay), GTK_ALIGN_CENTER); - if (remmina_pref.floating_toolbar_placement == FLOATING_TOOLBAR_PLACEMENT_BOTTOM) { + if (remmina_pref.floating_toolbar_placement == FLOATING_TOOLBAR_PLACEMENT_BOTTOM) + { gtk_box_pack_start(GTK_BOX(vbox), handle, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), revealer, FALSE, FALSE, 0); gtk_revealer_set_transition_type(GTK_REVEALER(revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP); gtk_widget_set_valign(GTK_WIDGET(priv->overlay_ftb_overlay), GTK_ALIGN_END); - } else { + } + else + { gtk_box_pack_start(GTK_BOX(vbox), revealer, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), handle, FALSE, FALSE, 0); gtk_revealer_set_transition_type(GTK_REVEALER(revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN); @@ -2327,9 +2505,12 @@ static void remmina_connection_holder_create_overlay_ftb_overlay(RemminaConnecti gtk_widget_show(priv->overlay_ftb_overlay); gtk_widget_show(fr); - if (remmina_pref.floating_toolbar_placement == FLOATING_TOOLBAR_PLACEMENT_BOTTOM) { + if (remmina_pref.floating_toolbar_placement == FLOATING_TOOLBAR_PLACEMENT_BOTTOM) + { gtk_widget_set_name(fr, "ftbbox-lower"); - } else { + } + else + { gtk_widget_set_name(fr, "ftbbox-upper"); } @@ -2344,14 +2525,14 @@ static void remmina_connection_holder_create_overlay_ftb_overlay(RemminaConnecti /* Add drag and drop capabilities to the source */ gtk_drag_source_set(GTK_WIDGET(priv->overlay_ftb_overlay), GDK_BUTTON1_MASK, - dnd_targets, sizeof dnd_targets / sizeof *dnd_targets, GDK_ACTION_MOVE); + dnd_targets, sizeof dnd_targets / sizeof *dnd_targets, GDK_ACTION_MOVE); g_signal_connect_after(GTK_WIDGET(priv->overlay_ftb_overlay), "drag-begin", G_CALLBACK(remmina_connection_window_ftb_drag_begin), cnnhld); } static gboolean remmina_connection_window_ftb_drag_drop(GtkWidget *widget, GdkDragContext *context, - gint x, gint y, guint time, gpointer user_data) + gint x, gint y, guint time, gpointer user_data) { TRACE_CALL("remmina_connection_window_ftb_drag_drop"); GtkAllocation wa; @@ -2365,15 +2546,19 @@ static gboolean remmina_connection_window_ftb_drag_drop(GtkWidget *widget, GdkDr gtk_widget_get_allocation(widget, &wa); - if (y >= wa.height / 2) { + if (y >= wa.height / 2) + { new_floating_toolbar_placement = FLOATING_TOOLBAR_PLACEMENT_BOTTOM; - } else { + } + else + { new_floating_toolbar_placement = FLOATING_TOOLBAR_PLACEMENT_TOP; } gtk_drag_finish(context, TRUE, TRUE, time); - if (new_floating_toolbar_placement != remmina_pref.floating_toolbar_placement) { + if (new_floating_toolbar_placement != remmina_pref.floating_toolbar_placement) + { /* Destroy and recreate the FTB */ remmina_pref.floating_toolbar_placement = new_floating_toolbar_placement; remmina_pref_save(); @@ -2418,7 +2603,7 @@ static void remmina_connection_window_ftb_drag_begin(GtkWidget *widget, GdkDragC #endif static void remmina_connection_holder_create_fullscreen(RemminaConnectionHolder* cnnhld, RemminaConnectionObject* cnnobj, - gint view_mode) + gint view_mode) { TRACE_CALL("remmina_connection_holder_create_fullscreen"); GtkWidget* window; @@ -2455,13 +2640,15 @@ static void remmina_connection_holder_create_fullscreen(RemminaConnectionHolder* cnnhld->fullscreen_view_mode = view_mode; remmina_connection_window_initialize_notebook(GTK_NOTEBOOK(notebook), - (oldwindow ? GTK_NOTEBOOK(REMMINA_CONNECTION_WINDOW(oldwindow)->priv->notebook) : NULL), cnnobj, - view_mode); + (oldwindow ? GTK_NOTEBOOK(REMMINA_CONNECTION_WINDOW(oldwindow)->priv->notebook) : NULL), cnnobj, + view_mode); - if (cnnobj) { + if (cnnobj) + { remmina_connection_window_update_tag(cnnhld->cnnwin, cnnobj); } - if (oldwindow) { + if (oldwindow) + { tag = g_strdup((gchar*) g_object_get_data(G_OBJECT(oldwindow), "tag")); g_object_set_data_full(G_OBJECT(cnnhld->cnnwin), "tag", tag, (GDestroyNotify) g_free); gtk_widget_destroy(oldwindow); @@ -2477,7 +2664,7 @@ static void remmina_connection_holder_create_fullscreen(RemminaConnectionHolder* /* Add drag and drop capabilities to the drop/dest target */ gtk_drag_dest_set(GTK_WIDGET(priv->overlay), GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT, - dnd_targets, sizeof dnd_targets / sizeof *dnd_targets, GDK_ACTION_MOVE); + dnd_targets, sizeof dnd_targets / sizeof *dnd_targets, GDK_ACTION_MOVE); gtk_drag_dest_set_track_motion(GTK_WIDGET(priv->notebook), TRUE); @@ -2502,14 +2689,15 @@ static void remmina_connection_holder_create_fullscreen(RemminaConnectionHolder* * Going immediately into fullscreen makes a black border on the top of the window * under gnome shell */ - if (!priv->go_fullscreen_eventsource) { + if (!priv->go_fullscreen_eventsource) + { priv->go_fullscreen_eventsource = g_idle_add(remmina_connection_window_go_fullscreen, (gpointer)cnnhld); } } static gboolean remmina_connection_window_hostkey_func(RemminaProtocolWidget* gp, guint keyval, gboolean release, - RemminaConnectionHolder* cnnhld) + RemminaConnectionHolder* cnnhld) { TRACE_CALL("remmina_connection_window_hostkey_func"); DECLARE_CNNOBJ_WITH_RETURN(FALSE); @@ -2517,39 +2705,52 @@ static gboolean remmina_connection_window_hostkey_func(RemminaProtocolWidget* gp const RemminaProtocolFeature* feature; gint i; - if (release) { - if (remmina_pref.hostkey && keyval == remmina_pref.hostkey) { + if (release) + { + if (remmina_pref.hostkey && keyval == remmina_pref.hostkey) + { cnnhld->hostkey_activated = FALSE; - if (cnnhld->hostkey_used) { + if (cnnhld->hostkey_used) + { return TRUE; } /* If hostkey is released without pressing other keys, we should execute the * shortcut key which is the same as hostkey. Be default, this is grab/ungrab * keyboard */ - } else if (cnnhld->hostkey_activated) { + } + else if (cnnhld->hostkey_activated) + { /* Trap all key releases when hostkey is pressed */ return TRUE; - } else { + } + else + { return FALSE; } - } else if (remmina_pref.hostkey && keyval == remmina_pref.hostkey) { + } + else if (remmina_pref.hostkey && keyval == remmina_pref.hostkey) + { cnnhld->hostkey_activated = TRUE; cnnhld->hostkey_used = FALSE; return TRUE; - } else if (!cnnhld->hostkey_activated) { + } + else if (!cnnhld->hostkey_activated) + { return FALSE; } cnnhld->hostkey_used = TRUE; keyval = gdk_keyval_to_lower(keyval); - if (keyval == remmina_pref.shortcutkey_fullscreen) { - switch (priv->view_mode) { + if (keyval == remmina_pref.shortcutkey_fullscreen) + { + switch (priv->view_mode) + { case SCROLLED_WINDOW_MODE: remmina_connection_holder_create_fullscreen( - cnnhld, - NULL, - cnnhld->fullscreen_view_mode ? - cnnhld->fullscreen_view_mode : VIEWPORT_FULLSCREEN_MODE); + cnnhld, + NULL, + cnnhld->fullscreen_view_mode ? + cnnhld->fullscreen_view_mode : VIEWPORT_FULLSCREEN_MODE); break; case SCROLLED_FULLSCREEN_MODE: case VIEWPORT_FULLSCREEN_MODE: @@ -2558,62 +2759,85 @@ static gboolean remmina_connection_window_hostkey_func(RemminaProtocolWidget* gp default: break; } - } else if (keyval == remmina_pref.shortcutkey_autofit) { - if (priv->toolitem_autofit && gtk_widget_is_sensitive(GTK_WIDGET(priv->toolitem_autofit))) { + } + else if (keyval == remmina_pref.shortcutkey_autofit) + { + if (priv->toolitem_autofit && gtk_widget_is_sensitive(GTK_WIDGET(priv->toolitem_autofit))) + { remmina_connection_holder_toolbar_autofit(GTK_WIDGET(gp), cnnhld); } - } else if (keyval == remmina_pref.shortcutkey_nexttab) { + } + else if (keyval == remmina_pref.shortcutkey_nexttab) + { i = gtk_notebook_get_current_page(GTK_NOTEBOOK(priv->notebook)) + 1; if (i >= gtk_notebook_get_n_pages(GTK_NOTEBOOK(priv->notebook))) i = 0; gtk_notebook_set_current_page(GTK_NOTEBOOK(priv->notebook), i); - } else if (keyval == remmina_pref.shortcutkey_prevtab) { + } + else if (keyval == remmina_pref.shortcutkey_prevtab) + { i = gtk_notebook_get_current_page(GTK_NOTEBOOK(priv->notebook)) - 1; if (i < 0) i = gtk_notebook_get_n_pages(GTK_NOTEBOOK(priv->notebook)) - 1; gtk_notebook_set_current_page(GTK_NOTEBOOK(priv->notebook), i); - } else if (keyval == remmina_pref.shortcutkey_scale) { - if (gtk_widget_is_sensitive(GTK_WIDGET(priv->toolitem_scale))) { + } + else if (keyval == remmina_pref.shortcutkey_scale) + { + if (gtk_widget_is_sensitive(GTK_WIDGET(priv->toolitem_scale))) + { gtk_toggle_tool_button_set_active( - GTK_TOGGLE_TOOL_BUTTON(priv->toolitem_scale), - !gtk_toggle_tool_button_get_active( - GTK_TOGGLE_TOOL_BUTTON( - priv->toolitem_scale))); + GTK_TOGGLE_TOOL_BUTTON(priv->toolitem_scale), + !gtk_toggle_tool_button_get_active( + GTK_TOGGLE_TOOL_BUTTON( + priv->toolitem_scale))); } - } else if (keyval == remmina_pref.shortcutkey_grab) { + } + else if (keyval == remmina_pref.shortcutkey_grab) + { gtk_toggle_tool_button_set_active( - GTK_TOGGLE_TOOL_BUTTON(priv->toolitem_grab), - !gtk_toggle_tool_button_get_active( - GTK_TOGGLE_TOOL_BUTTON( - priv->toolitem_grab))); - } else if (keyval == remmina_pref.shortcutkey_minimize) { + GTK_TOGGLE_TOOL_BUTTON(priv->toolitem_grab), + !gtk_toggle_tool_button_get_active( + GTK_TOGGLE_TOOL_BUTTON( + priv->toolitem_grab))); + } + else if (keyval == remmina_pref.shortcutkey_minimize) + { remmina_connection_holder_toolbar_minimize(GTK_WIDGET(gp), - cnnhld); - } else if (keyval == remmina_pref.shortcutkey_disconnect) { + cnnhld); + } + else if (keyval == remmina_pref.shortcutkey_disconnect) + { remmina_connection_holder_disconnect(cnnhld); - } else if (keyval == remmina_pref.shortcutkey_toolbar) { - if (priv->view_mode == SCROLLED_WINDOW_MODE) { + } + else if (keyval == remmina_pref.shortcutkey_toolbar) + { + if (priv->view_mode == SCROLLED_WINDOW_MODE) + { remmina_pref.hide_connection_toolbar = - !remmina_pref.hide_connection_toolbar; + !remmina_pref.hide_connection_toolbar; remmina_connection_holder_showhide_toolbar( - cnnhld, TRUE); + cnnhld, TRUE); } - } else { + } + else + { for (feature = - remmina_protocol_widget_get_features( - REMMINA_PROTOCOL_WIDGET( - cnnobj->proto)); - feature && feature->type; - feature++) { + remmina_protocol_widget_get_features( + REMMINA_PROTOCOL_WIDGET( + cnnobj->proto)); + feature && feature->type; + feature++) + { if (feature->type - == REMMINA_PROTOCOL_FEATURE_TYPE_TOOL - && GPOINTER_TO_UINT( - feature->opt3) - == keyval) { + == REMMINA_PROTOCOL_FEATURE_TYPE_TOOL + && GPOINTER_TO_UINT( + feature->opt3) + == keyval) + { remmina_protocol_widget_call_feature_by_ref( - REMMINA_PROTOCOL_WIDGET( - cnnobj->proto), - feature); + REMMINA_PROTOCOL_WIDGET( + cnnobj->proto), + feature); break; } } @@ -2627,7 +2851,8 @@ static RemminaConnectionWindow* remmina_connection_window_find(RemminaFile* remm TRACE_CALL("remmina_connection_window_find"); const gchar* tag; - switch (remmina_pref.tab_mode) { + switch (remmina_pref.tab_mode) + { case REMMINA_TAB_BY_GROUP: tag = remmina_file_get_string(remminafile, "group"); break; @@ -2652,32 +2877,41 @@ static void remmina_connection_object_on_connect(RemminaProtocolWidget* gp, Remm GtkWidget* tab; gint i; - if (!cnnobj->cnnhld) { + if (!cnnobj->cnnhld) + { cnnwin = remmina_connection_window_find(cnnobj->remmina_file); - if (cnnwin) { + if (cnnwin) + { cnnhld = cnnwin->priv->cnnhld; - } else { + } + else + { cnnhld = g_new0(RemminaConnectionHolder, 1); } cnnobj->cnnhld = cnnhld; - } else { + } + else + { cnnhld = cnnobj->cnnhld; } cnnobj->connected = TRUE; remmina_protocol_widget_set_hostkey_func(REMMINA_PROTOCOL_WIDGET(cnnobj->proto), - (RemminaHostkeyFunc) remmina_connection_window_hostkey_func, cnnhld); + (RemminaHostkeyFunc) remmina_connection_window_hostkey_func, cnnhld); /* Remember recent list for quick connect */ - if (remmina_file_get_filename(cnnobj->remmina_file) == NULL) { + if (remmina_file_get_filename(cnnobj->remmina_file) == NULL) + { remmina_pref_add_recent(remmina_file_get_string(cnnobj->remmina_file, "protocol"), - remmina_file_get_string(cnnobj->remmina_file, "server")); + remmina_file_get_string(cnnobj->remmina_file, "server")); } - if (!cnnhld->cnnwin) { + if (!cnnhld->cnnwin) + { i = remmina_file_get_int(cnnobj->remmina_file, "viewmode", 0); - switch (i) { + switch (i) + { case SCROLLED_FULLSCREEN_MODE: case VIEWPORT_FULLSCREEN_MODE: remmina_connection_holder_create_fullscreen(cnnhld, cnnobj, i); @@ -2687,10 +2921,12 @@ static void remmina_connection_object_on_connect(RemminaProtocolWidget* gp, Remm remmina_connection_holder_create_scrolled(cnnhld, cnnobj); break; } - } else { + } + else + { tab = remmina_connection_object_create_tab(cnnobj); i = remmina_connection_object_append_page(cnnobj, GTK_NOTEBOOK(cnnhld->cnnwin->priv->notebook), tab, - cnnhld->cnnwin->priv->view_mode); + cnnhld->cnnwin->priv->view_mode); G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_widget_reparent(cnnobj->viewport, cnnobj->scrolled_container); G_GNUC_END_IGNORE_DEPRECATIONS @@ -2700,11 +2936,13 @@ static void remmina_connection_object_on_connect(RemminaProtocolWidget* gp, Remm } #if FLOATING_TOOLBAR_WIDGET - if (cnnhld->cnnwin->priv->floating_toolbar_widget) { + if (cnnhld->cnnwin->priv->floating_toolbar_widget) + { gtk_widget_show(cnnhld->cnnwin->priv->floating_toolbar_widget); } #else - if (cnnhld->cnnwin->priv->floating_toolbar_window) { + if (cnnhld->cnnwin->priv->floating_toolbar_window) + { gtk_widget_show(cnnhld->cnnwin->priv->floating_toolbar_window); } #endif @@ -2718,36 +2956,44 @@ static void remmina_connection_object_on_disconnect(RemminaProtocolWidget* gp, R cnnobj->connected = FALSE; - if (cnnhld && remmina_pref.save_view_mode) { - if (cnnhld->cnnwin) { + if (cnnhld && remmina_pref.save_view_mode) + { + if (cnnhld->cnnwin) + { remmina_file_set_int(cnnobj->remmina_file, "viewmode", cnnhld->cnnwin->priv->view_mode); } - if (remmina_pref.save_when_connect) { + if (remmina_pref.save_when_connect) + { remmina_file_save_all(cnnobj->remmina_file); - } else { + } + else + { remmina_file_save_group(cnnobj->remmina_file, REMMINA_SETTING_GROUP_RUNTIME); } } remmina_file_free(cnnobj->remmina_file); - if (remmina_protocol_widget_has_error(gp)) { + if (remmina_protocol_widget_has_error(gp)) + { dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - remmina_protocol_widget_get_error_message(gp), NULL); + remmina_protocol_widget_get_error_message(gp), NULL); g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(gtk_widget_destroy), NULL); gtk_widget_show(dialog); remmina_widget_pool_register(dialog); } - if (cnnobj->window) { + if (cnnobj->window) + { gtk_widget_destroy(cnnobj->window); cnnobj->window = NULL; } - if (cnnhld && cnnhld->cnnwin && cnnobj->scrolled_container) { + if (cnnhld && cnnhld->cnnwin && cnnobj->scrolled_container) + { gtk_notebook_remove_page( - GTK_NOTEBOOK(cnnhld->cnnwin->priv->notebook), - gtk_notebook_page_num(GTK_NOTEBOOK(cnnhld->cnnwin->priv->notebook), - cnnobj->scrolled_container)); + GTK_NOTEBOOK(cnnhld->cnnwin->priv->notebook), + gtk_notebook_page_num(GTK_NOTEBOOK(cnnhld->cnnwin->priv->notebook), + cnnobj->scrolled_container)); } g_free(cnnobj); } @@ -2755,7 +3001,8 @@ static void remmina_connection_object_on_disconnect(RemminaProtocolWidget* gp, R static void remmina_connection_object_on_desktop_resize(RemminaProtocolWidget* gp, RemminaConnectionObject* cnnobj) { TRACE_CALL("remmina_connection_object_on_desktop_resize"); - if (cnnobj->cnnhld && cnnobj->cnnhld->cnnwin && cnnobj->cnnhld->cnnwin->priv->view_mode != SCROLLED_WINDOW_MODE) { + if (cnnobj->cnnhld && cnnobj->cnnhld->cnnwin && cnnobj->cnnhld->cnnwin->priv->view_mode != SCROLLED_WINDOW_MODE) + { remmina_connection_holder_check_resize(cnnobj->cnnhld); } } @@ -2773,12 +3020,15 @@ gboolean remmina_connection_window_open_from_filename(const gchar* filename) GtkWidget* dialog; remminafile = remmina_file_manager_load_file(filename); - if (remminafile) { + if (remminafile) + { remmina_connection_window_open_from_file(remminafile); return TRUE; - } else { + } + else + { dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, - _("File %s not found."), filename); + _("File %s not found."), filename); g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(gtk_widget_destroy), NULL); gtk_widget_show(dialog); remmina_widget_pool_register(dialog); @@ -2815,20 +3065,22 @@ remmina_connection_window_open_from_file_full(RemminaFile* remminafile, GCallbac gtk_widget_set_halign(GTK_WIDGET(cnnobj->proto),GTK_ALIGN_FILL); gtk_widget_set_valign(GTK_WIDGET(cnnobj->proto),GTK_ALIGN_FILL); - if (data) { + if (data) + { g_object_set_data(G_OBJECT(cnnobj->proto), "user-data", data); } gtk_widget_show(cnnobj->proto); g_signal_connect(G_OBJECT(cnnobj->proto), "connect", G_CALLBACK(remmina_connection_object_on_connect), cnnobj); - if (disconnect_cb) { + if (disconnect_cb) + { *handler = g_signal_connect(G_OBJECT(cnnobj->proto), "disconnect", disconnect_cb, data); } g_signal_connect(G_OBJECT(cnnobj->proto), "disconnect", G_CALLBACK(remmina_connection_object_on_disconnect), cnnobj); g_signal_connect(G_OBJECT(cnnobj->proto), "desktop-resize", G_CALLBACK(remmina_connection_object_on_desktop_resize), - cnnobj); + cnnobj); g_signal_connect(G_OBJECT(cnnobj->proto), "update-align", G_CALLBACK(remmina_connection_object_on_update_align), - cnnobj); + cnnobj); /* Create the viewport to make the RemminaProtocolWidget scrollable */ cnnobj->viewport = gtk_viewport_new(NULL, NULL); @@ -2839,8 +3091,8 @@ remmina_connection_window_open_from_file_full(RemminaFile* remminafile, GCallbac /* Determine whether the plugin can scale or not. If the plugin can scale and we do * not want to expand, then we add a GtkAspectFrame to maintain aspect ratio during scaling */ cnnobj->plugin_can_scale = remmina_plugin_manager_query_feature_by_type(REMMINA_PLUGIN_TYPE_PROTOCOL, - remmina_file_get_string(remminafile, "protocol"), - REMMINA_PROTOCOL_FEATURE_TYPE_SCALE); + remmina_file_get_string(remminafile, "protocol"), + REMMINA_PROTOCOL_FEATURE_TYPE_SCALE); cnnobj->aspectframe = NULL; gtk_container_add(GTK_CONTAINER(cnnobj->viewport), cnnobj->proto); diff --git a/remmina/src/remmina_connection_window.h b/remmina/src/remmina_connection_window.h index a5b1fd185..a31def93b 100644 --- a/remmina/src/remmina_connection_window.h +++ b/remmina/src/remmina_connection_window.h @@ -49,13 +49,15 @@ G_BEGIN_DECLS typedef struct _RemminaConnectionWindowPriv RemminaConnectionWindowPriv; -typedef struct _RemminaConnectionWindow { +typedef struct _RemminaConnectionWindow +{ GtkWindow window; RemminaConnectionWindowPriv* priv; } RemminaConnectionWindow; -typedef struct _RemminaConnectionWindowClass { +typedef struct _RemminaConnectionWindowClass +{ GtkWindowClass parent_class; } RemminaConnectionWindowClass; @@ -67,7 +69,7 @@ gboolean remmina_connection_window_open_from_filename(const gchar* filename); /* Open a new connection window for a given RemminaFile struct. The struct will be freed after the call */ void remmina_connection_window_open_from_file(RemminaFile* remminafile); GtkWidget* remmina_connection_window_open_from_file_full(RemminaFile* remminafile, GCallback disconnect_cb, gpointer data, - guint* handler); + guint* handler); G_END_DECLS diff --git a/remmina/src/remmina_crypt.c b/remmina/src/remmina_crypt.c index 5531c6740..a476f5f6b 100644 --- a/remmina/src/remmina_crypt.c +++ b/remmina/src/remmina_crypt.c @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2009 - Vic Lee + * Copyright (C) 2009 - Vic Lee * Copyright (C) 2014-2015 Antenore Gatta, Fabio Castelli, Giovanni Panozzo * * This program is free software; you can redistribute it and/or modify @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give diff --git a/remmina/src/remmina_crypt.h b/remmina/src/remmina_crypt.h index c3792b4e6..1bd395526 100644 --- a/remmina/src/remmina_crypt.h +++ b/remmina/src/remmina_crypt.h @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2009 - Vic Lee + * Copyright (C) 2009 - Vic Lee * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give diff --git a/remmina/src/remmina_exec.c b/remmina/src/remmina_exec.c index 24c5467c2..1532a2760 100644 --- a/remmina/src/remmina_exec.c +++ b/remmina/src/remmina_exec.c @@ -60,82 +60,84 @@ void remmina_exec_command(RemminaCommandType command, const gchar* data) switch (command) { - case REMMINA_COMMAND_MAIN: - mainwindow = remmina_main_get_window(); - if (mainwindow) - { - gtk_window_present(mainwindow); - gtk_window_deiconify(GTK_WINDOW(mainwindow)); - } - else - { - widget = remmina_main_new(); - gtk_widget_show(widget); - } - break; - - case REMMINA_COMMAND_PREF: - prefdialog = remmina_pref_dialog_get_dialog(); - if (prefdialog) - { - gtk_window_present(GTK_WINDOW(prefdialog)); - gtk_window_deiconify(GTK_WINDOW(prefdialog)); - } else { - /* Create a new preference dialog */ - widget = GTK_WIDGET(remmina_pref_dialog_new(atoi(data), NULL)); - gtk_widget_show(widget); - } - break; + case REMMINA_COMMAND_MAIN: + mainwindow = remmina_main_get_window(); + if (mainwindow) + { + gtk_window_present(mainwindow); + gtk_window_deiconify(GTK_WINDOW(mainwindow)); + } + else + { + widget = remmina_main_new(); + gtk_widget_show(widget); + } + break; - case REMMINA_COMMAND_NEW: - s1 = (data ? strchr(data, ',') : NULL); - if (s1) - { - s1 = g_strdup(data); - s2 = strchr(s1, ','); - *s2++ = '\0'; - widget = remmina_file_editor_new_full(s2, s1); - g_free(s1); - } - else - { - widget = remmina_file_editor_new_full(NULL, data); - } + case REMMINA_COMMAND_PREF: + prefdialog = remmina_pref_dialog_get_dialog(); + if (prefdialog) + { + gtk_window_present(GTK_WINDOW(prefdialog)); + gtk_window_deiconify(GTK_WINDOW(prefdialog)); + } + else + { + /* Create a new preference dialog */ + widget = GTK_WIDGET(remmina_pref_dialog_new(atoi(data), NULL)); gtk_widget_show(widget); - break; + } + break; - case REMMINA_COMMAND_CONNECT: - remmina_connection_window_open_from_filename(data); - break; + case REMMINA_COMMAND_NEW: + s1 = (data ? strchr(data, ',') : NULL); + if (s1) + { + s1 = g_strdup(data); + s2 = strchr(s1, ','); + *s2++ = '\0'; + widget = remmina_file_editor_new_full(s2, s1); + g_free(s1); + } + else + { + widget = remmina_file_editor_new_full(NULL, data); + } + gtk_widget_show(widget); + break; - case REMMINA_COMMAND_EDIT: - widget = remmina_file_editor_new_from_filename(data); - if (widget) - gtk_widget_show(widget); - break; + case REMMINA_COMMAND_CONNECT: + remmina_connection_window_open_from_filename(data); + break; - case REMMINA_COMMAND_ABOUT: - remmina_about_open(NULL); - break; + case REMMINA_COMMAND_EDIT: + widget = remmina_file_editor_new_from_filename(data); + if (widget) + gtk_widget_show(widget); + break; - case REMMINA_COMMAND_PLUGIN: - plugin = (RemminaEntryPlugin*) remmina_plugin_manager_get_plugin(REMMINA_PLUGIN_TYPE_ENTRY, data); - if (plugin) - { - plugin->entry_func(); - } - else - { - widget = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - _("Plugin %s is not registered."), data); - g_signal_connect(G_OBJECT(widget), "response", G_CALLBACK(gtk_widget_destroy), NULL); - gtk_widget_show(widget); - remmina_widget_pool_register(widget); - } - break; + case REMMINA_COMMAND_ABOUT: + remmina_about_open(NULL); + break; + + case REMMINA_COMMAND_PLUGIN: + plugin = (RemminaEntryPlugin*) remmina_plugin_manager_get_plugin(REMMINA_PLUGIN_TYPE_ENTRY, data); + if (plugin) + { + plugin->entry_func(); + } + else + { + widget = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + _("Plugin %s is not registered."), data); + g_signal_connect(G_OBJECT(widget), "response", G_CALLBACK(gtk_widget_destroy), NULL); + gtk_widget_show(widget); + remmina_widget_pool_register(widget); + } + break; - default: - break; + default: + break; } } diff --git a/remmina/src/remmina_exec.h b/remmina/src/remmina_exec.h index 6d9a493ca..fe087eeb1 100644 --- a/remmina/src/remmina_exec.h +++ b/remmina/src/remmina_exec.h @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2010 Vic Lee + * Copyright (C) 2010 Vic Lee * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give diff --git a/remmina/src/remmina_file.c b/remmina/src/remmina_file.c index 719ab45b0..e85ac39b5 100644 --- a/remmina/src/remmina_file.c +++ b/remmina/src/remmina_file.c @@ -58,25 +58,26 @@ typedef struct _RemminaSetting const RemminaSetting remmina_system_settings[] = { -{ "resolution_width", REMMINA_SETTING_GROUP_NONE, FALSE }, -{ "resolution_height", REMMINA_SETTING_GROUP_NONE, FALSE }, + { "resolution_width", REMMINA_SETTING_GROUP_NONE, FALSE }, + { "resolution_height", REMMINA_SETTING_GROUP_NONE, FALSE }, -{ "username", REMMINA_SETTING_GROUP_CREDENTIAL, FALSE }, -{ "password", REMMINA_SETTING_GROUP_CREDENTIAL, TRUE }, -{ "cacert", REMMINA_SETTING_GROUP_CREDENTIAL, FALSE }, -{ "cacrl", REMMINA_SETTING_GROUP_CREDENTIAL, FALSE }, -{ "clientcert", REMMINA_SETTING_GROUP_CREDENTIAL, FALSE }, -{ "clientkey", REMMINA_SETTING_GROUP_CREDENTIAL, FALSE }, + { "username", REMMINA_SETTING_GROUP_CREDENTIAL, FALSE }, + { "password", REMMINA_SETTING_GROUP_CREDENTIAL, TRUE }, + { "cacert", REMMINA_SETTING_GROUP_CREDENTIAL, FALSE }, + { "cacrl", REMMINA_SETTING_GROUP_CREDENTIAL, FALSE }, + { "clientcert", REMMINA_SETTING_GROUP_CREDENTIAL, FALSE }, + { "clientkey", REMMINA_SETTING_GROUP_CREDENTIAL, FALSE }, -{ "viewmode", REMMINA_SETTING_GROUP_RUNTIME, FALSE }, -{ "scale", REMMINA_SETTING_GROUP_RUNTIME, FALSE }, -{ "keyboard_grab", REMMINA_SETTING_GROUP_RUNTIME, FALSE }, -{ "window_width", REMMINA_SETTING_GROUP_RUNTIME, FALSE }, -{ "window_height", REMMINA_SETTING_GROUP_RUNTIME, FALSE }, -{ "window_maximize", REMMINA_SETTING_GROUP_RUNTIME, FALSE }, -{ "toolbar_opacity", REMMINA_SETTING_GROUP_RUNTIME, FALSE }, + { "viewmode", REMMINA_SETTING_GROUP_RUNTIME, FALSE }, + { "scale", REMMINA_SETTING_GROUP_RUNTIME, FALSE }, + { "keyboard_grab", REMMINA_SETTING_GROUP_RUNTIME, FALSE }, + { "window_width", REMMINA_SETTING_GROUP_RUNTIME, FALSE }, + { "window_height", REMMINA_SETTING_GROUP_RUNTIME, FALSE }, + { "window_maximize", REMMINA_SETTING_GROUP_RUNTIME, FALSE }, + { "toolbar_opacity", REMMINA_SETTING_GROUP_RUNTIME, FALSE }, -{ NULL, 0, FALSE } }; + { NULL, 0, FALSE } +}; static RemminaSettingGroup remmina_setting_get_group(const gchar *setting, gboolean *encrypted) @@ -151,7 +152,7 @@ void remmina_file_generate_filename(RemminaFile *remminafile) dir = g_dir_open(dirname, 0, NULL); if (dir != NULL) remminafile->filename = g_strdup_printf("%s/%li%03li.remmina", dirname, gtime.tv_sec, - gtime.tv_usec / 1000); + gtime.tv_usec / 1000); } void remmina_file_set_filename(RemminaFile *remminafile, const gchar *filename) @@ -229,7 +230,7 @@ remmina_file_load(const gchar *filename) else { remmina_file_set_string_ref(remminafile, key, - g_key_file_get_string(gkeyfile, "remmina", key, NULL)); + g_key_file_get_string(gkeyfile, "remmina", key, NULL)); } } g_strfreev(keys); @@ -283,7 +284,8 @@ remmina_file_get_secret(RemminaFile *remminafile, const gchar *setting) RemminaSecretPlugin *plugin; const gchar *cs; - if ( !remmina_masterthread_exec_is_main_thread() ) { + if ( !remmina_masterthread_exec_is_main_thread() ) + { /* Allow the execution of this function from a non main thread */ RemminaMTExecData *d; gchar *retval; @@ -517,7 +519,7 @@ remmina_file_get_icon_name(RemminaFile *remminafile) RemminaProtocolPlugin *plugin; plugin = (RemminaProtocolPlugin *) remmina_plugin_manager_get_plugin(REMMINA_PLUGIN_TYPE_PROTOCOL, - remmina_file_get_string(remminafile, "protocol")); + remmina_file_get_string(remminafile, "protocol")); if (!plugin) return "remmina"; diff --git a/remmina/src/remmina_file_editor.c b/remmina/src/remmina_file_editor.c index d5e7091b6..eedee74c0 100644 --- a/remmina/src/remmina_file_editor.c +++ b/remmina/src/remmina_file_editor.c @@ -58,36 +58,37 @@ G_DEFINE_TYPE( RemminaFileEditor, remmina_file_editor, GTK_TYPE_DIALOG) #ifdef HAVE_LIBSSH static const gchar* charset_list = "ASCII,BIG5," - "CP437,CP720,CP737,CP775,CP850,CP852,CP855," - "CP857,CP858,CP862,CP866,CP874,CP1125,CP1250," - "CP1251,CP1252,CP1253,CP1254,CP1255,CP1256," - "CP1257,CP1258," - "EUC-JP,EUC-KR,GBK," - "ISO-8859-1,ISO-8859-2,ISO-8859-3,ISO-8859-4," - "ISO-8859-5,ISO-8859-6,ISO-8859-7,ISO-8859-8," - "ISO-8859-9,ISO-8859-10,ISO-8859-11,ISO-8859-12," - "ISO-8859-13,ISO-8859-14,ISO-8859-15,ISO-8859-16," - "KOI8-R,SJIS,UTF-8"; + "CP437,CP720,CP737,CP775,CP850,CP852,CP855," + "CP857,CP858,CP862,CP866,CP874,CP1125,CP1250," + "CP1251,CP1252,CP1253,CP1254,CP1255,CP1256," + "CP1257,CP1258," + "EUC-JP,EUC-KR,GBK," + "ISO-8859-1,ISO-8859-2,ISO-8859-3,ISO-8859-4," + "ISO-8859-5,ISO-8859-6,ISO-8859-7,ISO-8859-8," + "ISO-8859-9,ISO-8859-10,ISO-8859-11,ISO-8859-12," + "ISO-8859-13,ISO-8859-14,ISO-8859-15,ISO-8859-16," + "KOI8-R,SJIS,UTF-8"; #endif static const gchar* server_tips = N_( "" - "Supported formats\n" - "* server\n" - "* server:port\n" - "* [server]:port" - ""); + "Supported formats\n" + "* server\n" + "* server:port\n" + "* [server]:port" + ""); #ifdef HAVE_LIBSSH static const gchar* server_tips2 = N_( "" - "Supported formats\n" - "* :port\n" - "* server\n" - "* server:port\n" - "* [server]:port" - ""); + "Supported formats\n" + "* :port\n" + "* server\n" + "* server:port\n" + "* [server]:port" + ""); #endif -struct _RemminaFileEditorPriv { +struct _RemminaFileEditorPriv +{ RemminaFile* remmina_file; RemminaProtocolPlugin* plugin; const gchar* avahi_service_type; @@ -138,27 +139,31 @@ static void remmina_file_editor_browse_avahi(GtkWidget* button, RemminaFileEdito gchar* host; dialog = aui_service_dialog_new(_("Choose a Remote Desktop Server"), - GTK_WINDOW(gfe), - _("_Cancel"), GTK_RESPONSE_CANCEL, - _("_OK"), GTK_RESPONSE_ACCEPT, - NULL); + GTK_WINDOW(gfe), + _("_Cancel"), GTK_RESPONSE_CANCEL, + _("_OK"), GTK_RESPONSE_ACCEPT, + NULL); gtk_window_set_transient_for (GTK_WINDOW(dialog), GTK_WINDOW(gfe)); aui_service_dialog_set_resolve_service (AUI_SERVICE_DIALOG (dialog), TRUE); aui_service_dialog_set_resolve_host_name (AUI_SERVICE_DIALOG (dialog), TRUE); aui_service_dialog_set_browse_service_types (AUI_SERVICE_DIALOG (dialog), - gfe->priv->avahi_service_type, NULL); + gfe->priv->avahi_service_type, NULL); - if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) + { host = g_strdup_printf("[%s]:%i", - aui_service_dialog_get_host_name (AUI_SERVICE_DIALOG (dialog)), - aui_service_dialog_get_port (AUI_SERVICE_DIALOG (dialog))); - } else { + aui_service_dialog_get_host_name (AUI_SERVICE_DIALOG (dialog)), + aui_service_dialog_get_port (AUI_SERVICE_DIALOG (dialog))); + } + else + { host = NULL; } gtk_widget_destroy (dialog); - if (host) { + if (host) + { gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child (GTK_BIN (gfe->priv->server_combo))), host); g_free(host); } @@ -175,8 +180,10 @@ static void remmina_file_editor_on_realize(GtkWidget* widget, gpointer user_data defaultwidget = gfe->priv->name_entry; - if (defaultwidget) { - if (GTK_IS_EDITABLE(defaultwidget)) { + if (defaultwidget) + { + if (GTK_IS_EDITABLE(defaultwidget)) + { gtk_editable_select_region(GTK_EDITABLE(defaultwidget), 0, -1); } gtk_widget_grab_focus(defaultwidget); @@ -208,7 +215,7 @@ static void remmina_file_editor_create_notebook_container(RemminaFileEditor* gfe } static GtkWidget* remmina_file_editor_create_notebook_tab(RemminaFileEditor* gfe, - const gchar* stock_id, const gchar* label, gint rows, gint cols) + const gchar* stock_id, const gchar* label, gint rows, gint cols) { TRACE_CALL("remmina_file_editor_create_notebook_tab"); GtkWidget* tablabel; @@ -247,10 +254,10 @@ static void remmina_file_editor_ssh_server_custom_radio_on_toggled(GtkToggleButt { TRACE_CALL("remmina_file_editor_ssh_server_custom_radio_on_toggled"); gtk_widget_set_sensitive(gfe->priv->ssh_server_entry, - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gfe->priv->ssh_enabled_check)) && - (gfe->priv->ssh_server_custom_radio == NULL || - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gfe->priv->ssh_server_custom_radio))) - ); + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gfe->priv->ssh_enabled_check)) && + (gfe->priv->ssh_server_custom_radio == NULL || + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gfe->priv->ssh_server_custom_radio))) + ); } static void remmina_file_editor_ssh_auth_publickey_radio_on_toggled(GtkToggleButton* togglebutton, RemminaFileEditor* gfe) @@ -260,11 +267,12 @@ static void remmina_file_editor_ssh_auth_publickey_radio_on_toggled(GtkToggleBut const gchar* s; b = ((!gfe->priv->ssh_enabled_check || - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gfe->priv->ssh_enabled_check))) && - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gfe->priv->ssh_auth_publickey_radio))); + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gfe->priv->ssh_enabled_check))) && + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gfe->priv->ssh_auth_publickey_radio))); gtk_widget_set_sensitive(gfe->priv->ssh_privatekey_chooser, b); - if (b && ( s = remmina_file_get_string (gfe->priv->remmina_file, "ssh_privatekey")) ) { + if (b && ( s = remmina_file_get_string (gfe->priv->remmina_file, "ssh_privatekey")) ) + { gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (gfe->priv->ssh_privatekey_chooser), s); } } @@ -274,7 +282,8 @@ static void remmina_file_editor_ssh_enabled_check_on_toggled(GtkToggleButton* to TRACE_CALL("remmina_file_editor_ssh_enabled_check_on_toggled"); gboolean enabled = TRUE; - if (gfe->priv->ssh_enabled_check) { + if (gfe->priv->ssh_enabled_check) + { enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gfe->priv->ssh_enabled_check)); if (gfe->priv->ssh_loopback_check) gtk_widget_set_sensitive(gfe->priv->ssh_loopback_check, enabled); @@ -292,7 +301,8 @@ static void remmina_file_editor_ssh_enabled_check_on_toggled(GtkToggleButton* to } remmina_file_editor_ssh_auth_publickey_radio_on_toggled(NULL, gfe); - if (enabled && gtk_entry_get_text(GTK_ENTRY(gfe->priv->ssh_username_entry)) [0] == '\0') { + if (enabled && gtk_entry_get_text(GTK_ENTRY(gfe->priv->ssh_username_entry)) [0] == '\0') + { gtk_entry_set_text(GTK_ENTRY(gfe->priv->ssh_username_entry), g_get_user_name()); } } @@ -307,21 +317,22 @@ static void remmina_file_editor_create_ssh_privatekey(RemminaFileEditor* gfe, Gt RemminaFileEditorPriv* priv = gfe->priv; widget = gtk_radio_button_new_with_label_from_widget( - GTK_RADIO_BUTTON(priv->ssh_auth_password_radio), _("Identity file")); + GTK_RADIO_BUTTON(priv->ssh_auth_password_radio), _("Identity file")); g_signal_connect(G_OBJECT(widget), "toggled", - G_CALLBACK(remmina_file_editor_ssh_auth_publickey_radio_on_toggled), gfe); + G_CALLBACK(remmina_file_editor_ssh_auth_publickey_radio_on_toggled), gfe); priv->ssh_auth_publickey_radio = widget; gtk_widget_show(widget); gtk_grid_attach(GTK_GRID(grid), widget, 0, row + 22, 1, 1); dialog = gtk_file_chooser_dialog_new (_("Identity file"), GTK_WINDOW(gfe), GTK_FILE_CHOOSER_ACTION_OPEN, - _("_Cancel"), GTK_RESPONSE_CANCEL, - _("_Open"), GTK_RESPONSE_ACCEPT, - NULL); + _("_Cancel"), GTK_RESPONSE_CANCEL, + _("_Open"), GTK_RESPONSE_ACCEPT, + NULL); widget = gtk_file_chooser_button_new_with_dialog (dialog); s = g_strdup_printf("%s/.ssh", g_get_home_dir ()); - if (g_file_test (s, G_FILE_TEST_IS_DIR)) { + if (g_file_test (s, G_FILE_TEST_IS_DIR)) + { gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (widget), s); } g_free(s); @@ -331,17 +342,20 @@ static void remmina_file_editor_create_ssh_privatekey(RemminaFileEditor* gfe, Gt ssh_privatekey = remmina_file_get_string (priv->remmina_file, "ssh_privatekey"); if (ssh_privatekey && - g_file_test (ssh_privatekey, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_EXISTS)) { + g_file_test (ssh_privatekey, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_EXISTS)) + { gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (priv->ssh_privatekey_chooser), - ssh_privatekey); - } else { + ssh_privatekey); + } + else + { remmina_file_set_string (priv->remmina_file, "ssh_privatekey", NULL); } } #endif static void remmina_file_editor_create_server(RemminaFileEditor* gfe, const RemminaProtocolSetting* setting, GtkWidget* grid, - gint row) + gint row) { TRACE_CALL("remmina_file_editor_create_server"); RemminaProtocolPlugin* plugin = gfe->priv->plugin; @@ -366,7 +380,8 @@ static void remmina_file_editor_create_server(RemminaFileEditor* gfe, const Remm g_free(s); #ifdef HAVE_LIBAVAHI_UI - if (setting->opt1) { + if (setting->opt1) + { gfe->priv->avahi_service_type = (const gchar*) setting->opt1; hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); @@ -382,7 +397,8 @@ static void remmina_file_editor_create_server(RemminaFileEditor* gfe, const Remm g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(remmina_file_editor_browse_avahi), gfe); gtk_grid_attach (GTK_GRID(grid), hbox, 1, row , 1, 1); - } else + } + else #endif { gtk_grid_attach(GTK_GRID(grid), widget, 1, row, 1, 1); @@ -409,7 +425,8 @@ static void remmina_file_editor_create_password(RemminaFileEditor* gfe, GtkWidge gfe->priv->password_entry = widget; s = remmina_file_get_secret(gfe->priv->remmina_file, "password"); - if (s) { + if (s) + { gtk_entry_set_text(GTK_ENTRY(widget), s); g_free(s); } @@ -419,7 +436,7 @@ static void remmina_file_editor_update_resolution(GtkWidget* widget, RemminaFile { TRACE_CALL("remmina_file_editor_update_resolution"); remmina_public_load_combo_text_d(gfe->priv->resolution_custom_combo, remmina_pref.resolutions, - remmina_file_get_string(gfe->priv->remmina_file, "resolution"), NULL); + remmina_file_get_string(gfe->priv->remmina_file, "resolution"), NULL); } static void remmina_file_editor_browse_resolution(GtkWidget* button, RemminaFileEditor* gfe) @@ -440,7 +457,7 @@ static void remmina_file_editor_browse_resolution(GtkWidget* button, RemminaFile } static void remmina_file_editor_create_resolution(RemminaFileEditor* gfe, const RemminaProtocolSetting* setting, - GtkWidget* grid, gint row) + GtkWidget* grid, gint row) { TRACE_CALL("remmina_file_editor_create_resolution"); GtkWidget* widget; @@ -480,18 +497,21 @@ static void remmina_file_editor_create_resolution(RemminaFileEditor* gfe, const g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(remmina_file_editor_browse_resolution), gfe); g_signal_connect(G_OBJECT(gfe->priv->resolution_custom_radio), "toggled", - G_CALLBACK(remmina_file_editor_button_on_toggled), gfe->priv->resolution_custom_combo); + G_CALLBACK(remmina_file_editor_button_on_toggled), gfe->priv->resolution_custom_combo); - if (!resolution || strchr(resolution, 'x') == NULL) { + if (!resolution || strchr(resolution, 'x') == NULL) + { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gfe->priv->resolution_auto_radio), TRUE); gtk_widget_set_sensitive(gfe->priv->resolution_custom_combo, FALSE); - } else { + } + else + { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gfe->priv->resolution_custom_radio), TRUE); } } static GtkWidget* remmina_file_editor_create_text(RemminaFileEditor* gfe, GtkWidget* grid, - gint row, gint col, const gchar* label, const gchar* value) + gint row, gint col, const gchar* label, const gchar* value) { TRACE_CALL("remmina_file_editor_create_text"); GtkWidget* widget; @@ -519,7 +539,7 @@ static GtkWidget* remmina_file_editor_create_text(RemminaFileEditor* gfe, GtkWid } static GtkWidget* remmina_file_editor_create_select(RemminaFileEditor* gfe, GtkWidget* grid, - gint row, gint col, const gchar* label, const gpointer* list, const gchar* value) + gint row, gint col, const gchar* label, const gpointer* list, const gchar* value) { TRACE_CALL("remmina_file_editor_create_select"); GtkWidget* widget; @@ -538,7 +558,7 @@ static GtkWidget* remmina_file_editor_create_select(RemminaFileEditor* gfe, GtkW } static GtkWidget* remmina_file_editor_create_combo(RemminaFileEditor* gfe, GtkWidget* grid, - gint row, gint col, const gchar* label, const gchar* list, const gchar* value) + gint row, gint col, const gchar* label, const gchar* list, const gchar* value) { TRACE_CALL("remmina_file_editor_create_combo"); GtkWidget* widget; @@ -558,7 +578,7 @@ static GtkWidget* remmina_file_editor_create_combo(RemminaFileEditor* gfe, GtkWi } static GtkWidget* remmina_file_editor_create_check(RemminaFileEditor* gfe, GtkWidget* grid, - gint row, gint top, const gchar* label, gboolean value) + gint row, gint top, const gchar* label, gboolean value) { TRACE_CALL("remmina_file_editor_create_check"); GtkWidget* widget; @@ -575,7 +595,7 @@ static GtkWidget* remmina_file_editor_create_check(RemminaFileEditor* gfe, GtkWi static GtkWidget* remmina_file_editor_create_chooser(RemminaFileEditor* gfe, GtkWidget* grid, gint row, gint col, const gchar* label, - const gchar* value, gint type) + const gchar* value, gint type) { TRACE_CALL("remmina_file_editor_create_chooser"); GtkWidget* check; @@ -599,7 +619,8 @@ remmina_file_editor_create_chooser(RemminaFileEditor* gfe, GtkWidget* grid, gint widget = gtk_file_chooser_button_new(label, type); gtk_widget_show(widget); - if (value) { + if (value) + { gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(widget), value); } gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0); @@ -611,7 +632,7 @@ remmina_file_editor_create_chooser(RemminaFileEditor* gfe, GtkWidget* grid, gint } static void remmina_file_editor_create_settings(RemminaFileEditor* gfe, GtkWidget* grid, - const RemminaProtocolSetting* settings) + const RemminaProtocolSetting* settings) { TRACE_CALL("remmina_file_editor_create_settings"); RemminaFileEditorPriv* priv = gfe->priv; @@ -620,8 +641,10 @@ static void remmina_file_editor_create_settings(RemminaFileEditor* gfe, GtkWidge gint grid_column = 0; gchar** strarr; - while (settings->type != REMMINA_PROTOCOL_SETTING_TYPE_END) { - switch (settings->type) { + while (settings->type != REMMINA_PROTOCOL_SETTING_TYPE_END) + { + switch (settings->type) + { case REMMINA_PROTOCOL_SETTING_TYPE_SERVER: remmina_file_editor_create_server(gfe, settings, grid, grid_row); break; @@ -638,56 +661,56 @@ static void remmina_file_editor_create_settings(RemminaFileEditor* gfe, GtkWidge case REMMINA_PROTOCOL_SETTING_TYPE_KEYMAP: strarr = remmina_pref_keymap_groups(); priv->keymap_combo = remmina_file_editor_create_select(gfe, grid, - grid_row + 1, 0, - _("Keyboard mapping"), (const gpointer*) strarr, - remmina_file_get_string(priv->remmina_file, "keymap")); + grid_row + 1, 0, + _("Keyboard mapping"), (const gpointer*) strarr, + remmina_file_get_string(priv->remmina_file, "keymap")); g_strfreev(strarr); grid_row++; break; 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_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); 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_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); 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_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); 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_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); 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), - GTK_FILE_CHOOSER_ACTION_OPEN); + g_dgettext (priv->plugin->domain, settings->label), + remmina_file_get_string (priv->remmina_file, settings->name), + GTK_FILE_CHOOSER_ACTION_OPEN); g_hash_table_insert(priv->setting_widgets, (gchar*) settings->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), - GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); + g_dgettext (priv->plugin->domain, settings->label), + remmina_file_get_string (priv->remmina_file, settings->name), + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); g_hash_table_insert(priv->setting_widgets, (gchar*) settings->name, widget); break; @@ -695,13 +718,15 @@ static void remmina_file_editor_create_settings(RemminaFileEditor* gfe, GtkWidge break; } /* If the setting wants compactness, move to the next column */ - if (settings->compact) { + if (settings->compact) + { grid_column++; } /* Add a new settings row and move to the first column * if the setting doesn't want the compactness * or we already have two columns */ - if (!settings->compact || grid_column > 1) { + if (!settings->compact || grid_column > 1) + { grid_row++; grid_column = 0; } @@ -726,14 +751,17 @@ static void remmina_file_editor_create_ssh_tab(RemminaFileEditor* gfe, RemminaPr /* The SSH tab (implementation) */ if (ssh_setting == REMMINA_PROTOCOL_SSH_SETTING_SSH || - ssh_setting == REMMINA_PROTOCOL_SSH_SETTING_SFTP) { + ssh_setting == REMMINA_PROTOCOL_SSH_SETTING_SFTP) + { s = remmina_public_combo_get_active_text (GTK_COMBO_BOX (priv->protocol_combo)); grid = remmina_file_editor_create_notebook_tab (gfe, "dialog-password", - (s ? s : "SSH"), 8, 3); + (s ? s : "SSH"), 8, 3); g_free(s); - } else { + } + else + { grid = remmina_file_editor_create_notebook_tab (gfe, "dialog-password", - "SSH", 9, 3); + "SSH", 9, 3); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_show(hbox); @@ -744,7 +772,7 @@ static void remmina_file_editor_create_ssh_tab(RemminaFileEditor* gfe, RemminaPr gtk_widget_show(widget); gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(widget), "toggled", - G_CALLBACK(remmina_file_editor_ssh_enabled_check_on_toggled), gfe); + G_CALLBACK(remmina_file_editor_ssh_enabled_check_on_toggled), gfe); priv->ssh_enabled_check = widget; widget = gtk_check_button_new_with_label (_("Tunnel via loopback address")); @@ -756,76 +784,80 @@ static void remmina_file_editor_create_ssh_tab(RemminaFileEditor* gfe, RemminaPr /* SSH Server group */ row++; - switch (ssh_setting) { - case REMMINA_PROTOCOL_SSH_SETTING_TUNNEL: - s = g_strdup_printf(_("Same server at port %i"), DEFAULT_SSH_PORT); - widget = gtk_radio_button_new_with_label (NULL, s); - g_free(s); - gtk_widget_show(widget); - gtk_grid_attach (GTK_GRID(grid), widget, 0, row, 3, 1); - priv->ssh_server_default_radio = widget; - row++; - - widget = gtk_radio_button_new_with_label_from_widget ( - GTK_RADIO_BUTTON(priv->ssh_server_default_radio), _("Custom")); - gtk_widget_show(widget); - gtk_grid_attach (GTK_GRID(grid), widget, 0, row, 1, 1); - g_signal_connect(G_OBJECT(widget), "toggled", - G_CALLBACK(remmina_file_editor_ssh_server_custom_radio_on_toggled), gfe); - priv->ssh_server_custom_radio = widget; - - widget = gtk_entry_new (); - gtk_widget_show(widget); - gtk_entry_set_max_length (GTK_ENTRY(widget), 100); - gtk_widget_set_tooltip_markup (widget, _(server_tips2)); - gtk_grid_attach (GTK_GRID(grid), widget, 1, row, 2, 1); - priv->ssh_server_entry = widget; - row++; - break; + switch (ssh_setting) + { + case REMMINA_PROTOCOL_SSH_SETTING_TUNNEL: + s = g_strdup_printf(_("Same server at port %i"), DEFAULT_SSH_PORT); + widget = gtk_radio_button_new_with_label (NULL, s); + g_free(s); + gtk_widget_show(widget); + gtk_grid_attach (GTK_GRID(grid), widget, 0, row, 3, 1); + priv->ssh_server_default_radio = widget; + row++; - case REMMINA_PROTOCOL_SSH_SETTING_REVERSE_TUNNEL: - priv->ssh_server_default_radio = NULL; - priv->ssh_server_custom_radio = NULL; + widget = gtk_radio_button_new_with_label_from_widget ( + GTK_RADIO_BUTTON(priv->ssh_server_default_radio), _("Custom")); + gtk_widget_show(widget); + gtk_grid_attach (GTK_GRID(grid), widget, 0, row, 1, 1); + g_signal_connect(G_OBJECT(widget), "toggled", + G_CALLBACK(remmina_file_editor_ssh_server_custom_radio_on_toggled), gfe); + priv->ssh_server_custom_radio = widget; - priv->ssh_server_entry = remmina_file_editor_create_text (gfe, grid, 1, 0, - _("Server"), NULL); - gtk_widget_set_tooltip_markup (priv->ssh_server_entry, _(server_tips)); - row++; - break; + widget = gtk_entry_new (); + gtk_widget_show(widget); + gtk_entry_set_max_length (GTK_ENTRY(widget), 100); + gtk_widget_set_tooltip_markup (widget, _(server_tips2)); + gtk_grid_attach (GTK_GRID(grid), widget, 1, row, 2, 1); + priv->ssh_server_entry = widget; + row++; + break; - case REMMINA_PROTOCOL_SSH_SETTING_SSH: - case REMMINA_PROTOCOL_SSH_SETTING_SFTP: - priv->ssh_server_default_radio = NULL; - priv->ssh_server_custom_radio = NULL; - priv->ssh_server_entry = NULL; - - s = remmina_pref_get_recent ("SFTP"); - priv->server_combo = remmina_file_editor_create_combo (gfe, grid, row + 1, 1, - _("Server"), s, remmina_file_get_string (priv->remmina_file, "server")); - gtk_widget_set_tooltip_markup (priv->server_combo, _(server_tips)); - gtk_entry_set_activates_default (GTK_ENTRY(gtk_bin_get_child (GTK_BIN (priv->server_combo))), TRUE); - g_free(s); - row++; - break; + case REMMINA_PROTOCOL_SSH_SETTING_REVERSE_TUNNEL: + priv->ssh_server_default_radio = NULL; + priv->ssh_server_custom_radio = NULL; - default: - break; + priv->ssh_server_entry = remmina_file_editor_create_text (gfe, grid, 1, 0, + _("Server"), NULL); + gtk_widget_set_tooltip_markup (priv->ssh_server_entry, _(server_tips)); + row++; + break; + + case REMMINA_PROTOCOL_SSH_SETTING_SSH: + case REMMINA_PROTOCOL_SSH_SETTING_SFTP: + priv->ssh_server_default_radio = NULL; + priv->ssh_server_custom_radio = NULL; + priv->ssh_server_entry = NULL; + + s = remmina_pref_get_recent ("SFTP"); + priv->server_combo = remmina_file_editor_create_combo (gfe, grid, row + 1, 1, + _("Server"), s, remmina_file_get_string (priv->remmina_file, "server")); + gtk_widget_set_tooltip_markup (priv->server_combo, _(server_tips)); + gtk_entry_set_activates_default (GTK_ENTRY(gtk_bin_get_child (GTK_BIN (priv->server_combo))), TRUE); + g_free(s); + row++; + break; + + default: + break; } priv->ssh_charset_combo = remmina_file_editor_create_combo (gfe, grid, row + 3, 0, - _("Character set"), charset_list, remmina_file_get_string (priv->remmina_file, "ssh_charset")); + _("Character set"), charset_list, remmina_file_get_string (priv->remmina_file, "ssh_charset")); row++; - if (ssh_setting == REMMINA_PROTOCOL_SSH_SETTING_SSH) { + if (ssh_setting == REMMINA_PROTOCOL_SSH_SETTING_SSH) + { widget = remmina_file_editor_create_text (gfe, grid, row + 7, 1, - _("Startup program"), NULL); + _("Startup program"), NULL); cs = remmina_file_get_string (priv->remmina_file, "exec"); gtk_entry_set_text(GTK_ENTRY(widget), cs ? cs : ""); g_hash_table_insert(priv->setting_widgets, "exec", widget); row++; - } else if (ssh_setting == REMMINA_PROTOCOL_SSH_SETTING_SFTP) { + } + else if (ssh_setting == REMMINA_PROTOCOL_SSH_SETTING_SFTP) + { widget = remmina_file_editor_create_text (gfe, grid, row + 8, 1, - _("Startup path"), NULL); + _("Startup path"), NULL); cs = remmina_file_get_string (priv->remmina_file, "execpath"); gtk_entry_set_text(GTK_ENTRY(widget), cs ? cs : ""); g_hash_table_insert(priv->setting_widgets, "execpath", widget); @@ -837,7 +869,7 @@ static void remmina_file_editor_create_ssh_tab(RemminaFileEditor* gfe, RemminaPr row++; priv->ssh_username_entry = remmina_file_editor_create_text (gfe, grid, row + 10, 0, - _("User name"), NULL); + _("User name"), NULL); row++; widget = gtk_radio_button_new_with_label (NULL, _("SSH Agent (automatic)")); @@ -847,14 +879,14 @@ static void remmina_file_editor_create_ssh_tab(RemminaFileEditor* gfe, RemminaPr row++; widget = gtk_radio_button_new_with_label_from_widget ( - GTK_RADIO_BUTTON(priv->ssh_auth_agent_radio), _("Password")); + GTK_RADIO_BUTTON(priv->ssh_auth_agent_radio), _("Password")); gtk_widget_show(widget); gtk_grid_attach (GTK_GRID(grid), widget, 0, row + 21, 1, 1); priv->ssh_auth_password_radio = widget; row++; widget = gtk_radio_button_new_with_label_from_widget ( - GTK_RADIO_BUTTON(priv->ssh_auth_password_radio), _("Public key (automatic)")); + GTK_RADIO_BUTTON(priv->ssh_auth_password_radio), _("Public key (automatic)")); gtk_widget_show(widget); gtk_grid_attach (GTK_GRID(grid), widget, 0, row + 22, 1, 1); priv->ssh_auth_auto_publickey_radio = widget; @@ -865,35 +897,38 @@ static void remmina_file_editor_create_ssh_tab(RemminaFileEditor* gfe, RemminaPr /* Set the values */ cs = remmina_file_get_string (priv->remmina_file, "ssh_server"); - if (ssh_setting == REMMINA_PROTOCOL_SSH_SETTING_TUNNEL) { + if (ssh_setting == REMMINA_PROTOCOL_SSH_SETTING_TUNNEL) + { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(priv->ssh_enabled_check), - remmina_file_get_int (priv->remmina_file, "ssh_enabled", FALSE)); + remmina_file_get_int (priv->remmina_file, "ssh_enabled", FALSE)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(priv->ssh_loopback_check), - remmina_file_get_int (priv->remmina_file, "ssh_loopback", FALSE)); + remmina_file_get_int (priv->remmina_file, "ssh_loopback", FALSE)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(cs ? - priv->ssh_server_custom_radio : priv->ssh_server_default_radio), TRUE); + priv->ssh_server_custom_radio : priv->ssh_server_default_radio), TRUE); gtk_entry_set_text(GTK_ENTRY(priv->ssh_server_entry), - cs ? cs : ""); - } else if (ssh_setting == REMMINA_PROTOCOL_SSH_SETTING_REVERSE_TUNNEL) { + cs ? cs : ""); + } + else if (ssh_setting == REMMINA_PROTOCOL_SSH_SETTING_REVERSE_TUNNEL) + { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(priv->ssh_enabled_check), - remmina_file_get_int (priv->remmina_file, "ssh_enabled", FALSE)); + remmina_file_get_int (priv->remmina_file, "ssh_enabled", FALSE)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(priv->ssh_loopback_check), - remmina_file_get_int (priv->remmina_file, "ssh_loopback", FALSE)); + remmina_file_get_int (priv->remmina_file, "ssh_loopback", FALSE)); gtk_entry_set_text(GTK_ENTRY(priv->ssh_server_entry), - cs ? cs : ""); + cs ? cs : ""); } cs = remmina_file_get_string (priv->remmina_file, "ssh_username"); gtk_entry_set_text(GTK_ENTRY(priv->ssh_username_entry), cs ? cs : ""); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON( - remmina_file_get_int (priv->remmina_file, "ssh_auth", 0) == SSH_AUTH_PUBLICKEY ? - priv->ssh_auth_publickey_radio : - remmina_file_get_int (priv->remmina_file, "ssh_auth", 0) == SSH_AUTH_AUTO_PUBLICKEY ? - priv->ssh_auth_auto_publickey_radio : - remmina_file_get_int (priv->remmina_file, "ssh_auth", 0) == SSH_AUTH_AGENT ? - priv->ssh_auth_agent_radio : - priv->ssh_auth_password_radio), TRUE); + remmina_file_get_int (priv->remmina_file, "ssh_auth", 0) == SSH_AUTH_PUBLICKEY ? + priv->ssh_auth_publickey_radio : + remmina_file_get_int (priv->remmina_file, "ssh_auth", 0) == SSH_AUTH_AUTO_PUBLICKEY ? + priv->ssh_auth_auto_publickey_radio : + remmina_file_get_int (priv->remmina_file, "ssh_auth", 0) == SSH_AUTH_AGENT ? + priv->ssh_auth_agent_radio : + priv->ssh_auth_password_radio), TRUE); remmina_file_editor_ssh_enabled_check_on_toggled (NULL, gfe); #endif @@ -908,13 +943,15 @@ static void remmina_file_editor_create_all_settings(RemminaFileEditor* gfe) remmina_file_editor_create_notebook_container(gfe); /* The Basic tab */ - if (priv->plugin->basic_settings) { + if (priv->plugin->basic_settings) + { grid = remmina_file_editor_create_notebook_tab(gfe, "dialog-information", _("Basic"), 20, 2); remmina_file_editor_create_settings(gfe, grid, priv->plugin->basic_settings); } /* The Advanced tab */ - if (priv->plugin->advanced_settings) { + if (priv->plugin->advanced_settings) + { grid = remmina_file_editor_create_notebook_tab(gfe, "dialog-warning", _("Advanced"), 20, 2); remmina_file_editor_create_settings(gfe, grid, priv->plugin->advanced_settings); } @@ -929,7 +966,8 @@ static void remmina_file_editor_protocol_combo_on_changed(GtkComboBox* combo, Re RemminaFileEditorPriv* priv = gfe->priv; gchar* protocol; - if (priv->config_container) { + if (priv->config_container) + { gtk_container_remove(GTK_CONTAINER(priv->config_box), priv->config_container); priv->config_container = NULL; } @@ -957,9 +995,10 @@ static void remmina_file_editor_protocol_combo_on_changed(GtkComboBox* combo, Re g_hash_table_remove_all(priv->setting_widgets); protocol = remmina_public_combo_get_active_text(combo); - if (protocol) { + if (protocol) + { priv->plugin = (RemminaProtocolPlugin*) remmina_plugin_manager_get_plugin(REMMINA_PLUGIN_TYPE_PROTOCOL, - protocol); + protocol); g_free(protocol); remmina_file_editor_create_all_settings(gfe); } @@ -971,55 +1010,59 @@ static void remmina_file_editor_update_ssh(RemminaFileEditor* gfe) RemminaFileEditorPriv* priv = gfe->priv; gboolean ssh_enabled; - if (priv->ssh_charset_combo) { + if (priv->ssh_charset_combo) + { remmina_file_set_string_ref(priv->remmina_file, "ssh_charset", - remmina_public_combo_get_active_text(GTK_COMBO_BOX(priv->ssh_charset_combo))); + remmina_public_combo_get_active_text(GTK_COMBO_BOX(priv->ssh_charset_combo))); } if (g_strcmp0(remmina_file_get_string(priv->remmina_file, "protocol"), "SFTP") == 0 - || g_strcmp0(remmina_file_get_string(priv->remmina_file, "protocol"), "SSH") == 0) { + || g_strcmp0(remmina_file_get_string(priv->remmina_file, "protocol"), "SSH") == 0) + { ssh_enabled = TRUE; - } else { + } + else + { ssh_enabled = (priv->ssh_enabled_check ? - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->ssh_enabled_check)) : FALSE); + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->ssh_enabled_check)) : FALSE); remmina_file_set_int( - priv->remmina_file, - "ssh_loopback", - (priv->ssh_loopback_check ? - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->ssh_loopback_check)) : - FALSE)); + priv->remmina_file, + "ssh_loopback", + (priv->ssh_loopback_check ? + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->ssh_loopback_check)) : + FALSE)); } remmina_file_set_int(priv->remmina_file, "ssh_enabled", ssh_enabled); remmina_file_set_string(priv->remmina_file, "ssh_username", - (ssh_enabled ? gtk_entry_get_text(GTK_ENTRY(priv->ssh_username_entry)) : NULL)); + (ssh_enabled ? gtk_entry_get_text(GTK_ENTRY(priv->ssh_username_entry)) : NULL)); remmina_file_set_string( - priv->remmina_file, - "ssh_server", - (ssh_enabled && priv->ssh_server_entry - && (priv->ssh_server_custom_radio == NULL - || gtk_toggle_button_get_active( - GTK_TOGGLE_BUTTON(priv->ssh_server_custom_radio))) ? - gtk_entry_get_text(GTK_ENTRY(priv->ssh_server_entry)) : NULL)); + priv->remmina_file, + "ssh_server", + (ssh_enabled && priv->ssh_server_entry + && (priv->ssh_server_custom_radio == NULL + || gtk_toggle_button_get_active( + GTK_TOGGLE_BUTTON(priv->ssh_server_custom_radio))) ? + gtk_entry_get_text(GTK_ENTRY(priv->ssh_server_entry)) : NULL)); remmina_file_set_int( - priv->remmina_file, - "ssh_auth", - (priv->ssh_auth_publickey_radio - && gtk_toggle_button_get_active( - GTK_TOGGLE_BUTTON(priv->ssh_auth_publickey_radio)) ? - SSH_AUTH_PUBLICKEY : - priv->ssh_auth_auto_publickey_radio - && gtk_toggle_button_get_active( - GTK_TOGGLE_BUTTON(priv->ssh_auth_auto_publickey_radio)) ? - SSH_AUTH_AUTO_PUBLICKEY : - priv->ssh_auth_agent_radio - && gtk_toggle_button_get_active( - GTK_TOGGLE_BUTTON(priv->ssh_auth_agent_radio)) ? - SSH_AUTH_AGENT: SSH_AUTH_PASSWORD)); + priv->remmina_file, + "ssh_auth", + (priv->ssh_auth_publickey_radio + && gtk_toggle_button_get_active( + GTK_TOGGLE_BUTTON(priv->ssh_auth_publickey_radio)) ? + SSH_AUTH_PUBLICKEY : + priv->ssh_auth_auto_publickey_radio + && gtk_toggle_button_get_active( + GTK_TOGGLE_BUTTON(priv->ssh_auth_auto_publickey_radio)) ? + SSH_AUTH_AUTO_PUBLICKEY : + priv->ssh_auth_agent_radio + && gtk_toggle_button_get_active( + GTK_TOGGLE_BUTTON(priv->ssh_auth_agent_radio)) ? + SSH_AUTH_AGENT: SSH_AUTH_PASSWORD)); remmina_file_set_string( - priv->remmina_file, - "ssh_privatekey", - (priv->ssh_privatekey_chooser ? - gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(priv->ssh_privatekey_chooser)) : NULL)); + priv->remmina_file, + "ssh_privatekey", + (priv->ssh_privatekey_chooser ? + gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(priv->ssh_privatekey_chooser)) : NULL)); } static void remmina_file_editor_update_settings(RemminaFileEditor* gfe) @@ -1030,22 +1073,30 @@ static void remmina_file_editor_update_settings(RemminaFileEditor* gfe) gpointer key, value; g_hash_table_iter_init(&iter, priv->setting_widgets); - while (g_hash_table_iter_next(&iter, &key, &value)) { - if (GTK_IS_ENTRY(value)) { + while (g_hash_table_iter_next(&iter, &key, &value)) + { + if (GTK_IS_ENTRY(value)) + { remmina_file_set_string(priv->remmina_file, (gchar*) key, gtk_entry_get_text(GTK_ENTRY(value))); - } else if (GTK_IS_COMBO_BOX(value)) { + } + else if (GTK_IS_COMBO_BOX(value)) + { remmina_file_set_string_ref(priv->remmina_file, (gchar*) key, - remmina_public_combo_get_active_text(GTK_COMBO_BOX(value))); - } else if (GTK_IS_FILE_CHOOSER(value)) { + remmina_public_combo_get_active_text(GTK_COMBO_BOX(value))); + } + else if (GTK_IS_FILE_CHOOSER(value)) + { remmina_file_set_string( - priv->remmina_file, - (gchar*) key, - gtk_widget_get_sensitive(GTK_WIDGET(value)) ? - gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(value)) : - NULL); - } else if (GTK_IS_TOGGLE_BUTTON(value)) { + priv->remmina_file, + (gchar*) key, + gtk_widget_get_sensitive(GTK_WIDGET(value)) ? + gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(value)) : + NULL); + } + else if (GTK_IS_TOGGLE_BUTTON(value)) + { remmina_file_set_int(priv->remmina_file, (gchar*) key, - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(value))); + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(value))); } } } @@ -1058,32 +1109,34 @@ static void remmina_file_editor_update(RemminaFileEditor* gfe) remmina_file_set_string(priv->remmina_file, "name", gtk_entry_get_text(GTK_ENTRY(priv->name_entry))); remmina_file_set_string_ref(priv->remmina_file, "group", - (priv->group_combo ? remmina_public_combo_get_active_text(GTK_COMBO_BOX(priv->group_combo)) : NULL)); + (priv->group_combo ? remmina_public_combo_get_active_text(GTK_COMBO_BOX(priv->group_combo)) : NULL)); remmina_file_set_string_ref(priv->remmina_file, "protocol", - remmina_public_combo_get_active_text(GTK_COMBO_BOX(priv->protocol_combo))); + remmina_public_combo_get_active_text(GTK_COMBO_BOX(priv->protocol_combo))); remmina_file_set_string(priv->remmina_file, "precommand", gtk_entry_get_text(GTK_ENTRY(priv->precommand_entry))); 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)); + (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)); + (priv->password_entry ? gtk_entry_get_text(GTK_ENTRY(priv->password_entry)) : NULL)); - if (priv->resolution_auto_radio) { + if (priv->resolution_auto_radio) + { remmina_file_set_string_ref( - priv->remmina_file, - "resolution", - (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->resolution_auto_radio)) ? - NULL : - remmina_public_combo_get_active_text( - GTK_COMBO_BOX(priv->resolution_custom_combo)))); + priv->remmina_file, + "resolution", + (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->resolution_auto_radio)) ? + NULL : + remmina_public_combo_get_active_text( + GTK_COMBO_BOX(priv->resolution_custom_combo)))); } - if (priv->keymap_combo) { + if (priv->keymap_combo) + { remmina_file_set_string_ref(priv->remmina_file, "keymap", - remmina_public_combo_get_active_text(GTK_COMBO_BOX(priv->keymap_combo))); + remmina_public_combo_get_active_text(GTK_COMBO_BOX(priv->keymap_combo))); } remmina_file_editor_update_ssh(gfe); @@ -1112,7 +1165,7 @@ static void remmina_file_editor_on_default(GtkWidget* button, RemminaFileEditor* remmina_file_free(gf); dialog = gtk_message_dialog_new(GTK_WINDOW(gfe), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, - _("Default settings saved.")); + _("Default settings saved.")); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); } @@ -1132,13 +1185,15 @@ static void remmina_file_editor_on_connect(GtkWidget* button, RemminaFileEditor* RemminaFile* gf; remmina_file_editor_update(gfe); - if (remmina_pref.save_when_connect) { + if (remmina_pref.save_when_connect) + { remmina_file_save_all(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) { + if (remmina_file_get_filename(gf) == NULL) + { remmina_file_set_string(gf, "name", remmina_file_get_string(gf, "server")); } gtk_widget_destroy(GTK_WIDGET(gfe)); @@ -1213,9 +1268,10 @@ static gboolean remmina_file_editor_iterate_protocol(gchar* protocol, RemminaPlu gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, protocol, 1, g_dgettext(plugin->domain, plugin->description), 2, - ((RemminaProtocolPlugin*) plugin)->icon_name, -1); + ((RemminaProtocolPlugin*) plugin)->icon_name, -1); - if (first || g_strcmp0(protocol, remmina_file_get_string(gfe->priv->remmina_file, "protocol")) == 0) { + if (first || g_strcmp0(protocol, remmina_file_get_string(gfe->priv->remmina_file, "protocol")) == 0) + { gtk_combo_box_set_active_iter(GTK_COMBO_BOX(gfe->priv->protocol_combo), &iter); } @@ -1228,7 +1284,8 @@ static void remmina_file_editor_check_profile(RemminaFileEditor* gfe) RemminaFileEditorPriv* priv; priv = gfe->priv; - if (remmina_file_get_filename(priv->remmina_file)) { + if (remmina_file_get_filename(priv->remmina_file)) + { gtk_widget_set_sensitive(priv->group_combo, TRUE); gtk_widget_set_sensitive(priv->save_button, TRUE); } @@ -1240,7 +1297,8 @@ static void remmina_file_editor_name_on_changed(GtkEditable* editable, RemminaFi RemminaFileEditorPriv* priv; priv = gfe->priv; - if (remmina_file_get_filename(priv->remmina_file) == NULL) { + if (remmina_file_get_filename(priv->remmina_file) == NULL) + { remmina_file_generate_filename(priv->remmina_file); remmina_file_editor_check_profile(gfe); } @@ -1261,7 +1319,8 @@ GtkWidget* remmina_file_editor_new_from_file(RemminaFile* remminafile) priv = gfe->priv; priv->remmina_file = remminafile; - if (remmina_file_get_filename(remminafile) == NULL) { + if (remmina_file_get_filename(remminafile) == NULL) + { gtk_dialog_set_response_sensitive(GTK_DIALOG(gfe), GTK_RESPONSE_APPLY, FALSE); } @@ -1290,10 +1349,13 @@ GtkWidget* remmina_file_editor_new_from_file(RemminaFile* remminafile) gtk_entry_set_max_length(GTK_ENTRY(widget), 100); priv->name_entry = widget; - if (remmina_file_get_filename(remminafile) == NULL) { + if (remmina_file_get_filename(remminafile) == NULL) + { gtk_entry_set_text(GTK_ENTRY(widget), _("Quick Connect")); g_signal_connect(G_OBJECT(widget), "changed", G_CALLBACK(remmina_file_editor_name_on_changed), gfe); - } else { + } + else + { cs = remmina_file_get_string(remminafile, "name"); gtk_entry_set_text(GTK_ENTRY(widget), cs ? cs : ""); } @@ -1345,7 +1407,8 @@ GtkWidget* remmina_file_editor_new_from_file(RemminaFile* remminafile) priv->precommand_entry = widget; cs = remmina_file_get_string(remminafile, "precommand"); gtk_entry_set_text(GTK_ENTRY(widget), cs ? cs : ""); - if (!cs) { + if (!cs) + { s = g_strdup_printf(_("A command or a script name/path.")); gtk_widget_set_tooltip_text (widget, s); g_free(s); @@ -1393,11 +1456,14 @@ GtkWidget* remmina_file_editor_new_copy(const gchar* filename) GtkWidget* dialog; remminafile = remmina_file_copy(filename); - if (remminafile) { + if (remminafile) + { return remmina_file_editor_new_from_file(remminafile); - } else { + } + else + { dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, - _("File %s not found."), filename); + _("File %s not found."), filename); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); return NULL; @@ -1411,11 +1477,14 @@ GtkWidget* remmina_file_editor_new_from_filename(const gchar* filename) GtkWidget* dialog; remminafile = remmina_file_manager_load_file(filename); - if (remminafile) { + if (remminafile) + { return remmina_file_editor_new_from_file(remminafile); - } else { + } + else + { dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, - _("File %s not found."), filename); + _("File %s not found."), filename); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); return NULL; diff --git a/remmina/src/remmina_file_editor.h b/remmina/src/remmina_file_editor.h index 15677a2a4..653e9e7e3 100644 --- a/remmina/src/remmina_file_editor.h +++ b/remmina/src/remmina_file_editor.h @@ -47,13 +47,15 @@ G_BEGIN_DECLS typedef struct _RemminaFileEditorPriv RemminaFileEditorPriv; -typedef struct _RemminaFileEditor { +typedef struct _RemminaFileEditor +{ GtkDialog dialog; RemminaFileEditorPriv* priv; } RemminaFileEditor; -typedef struct _RemminaFileEditorClass { +typedef struct _RemminaFileEditorClass +{ GtkDialogClass parent_class; } RemminaFileEditorClass; diff --git a/remmina/src/remmina_file_manager.h b/remmina/src/remmina_file_manager.h index fae9e977d..241759556 100644 --- a/remmina/src/remmina_file_manager.h +++ b/remmina/src/remmina_file_manager.h @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2009-2010 Vic Lee + * Copyright (C) 2009-2010 Vic Lee * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give diff --git a/remmina/src/remmina_ftp_client.c b/remmina/src/remmina_ftp_client.c index 30f4e97d8..7c4bca04d 100644 --- a/remmina/src/remmina_ftp_client.c +++ b/remmina/src/remmina_ftp_client.c @@ -59,11 +59,13 @@ #define REMMINA_IS_CELL_RENDERER_PIXBUF(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), REMMINA_TYPE_CELL_RENDERER_PIXBUF)) -typedef struct _RemminaCellRendererPixbuf { +typedef struct _RemminaCellRendererPixbuf +{ GtkCellRendererPixbuf renderer; } RemminaCellRendererPixbuf; -typedef struct _RemminaCellRendererPixbufClass { +typedef struct _RemminaCellRendererPixbufClass +{ GtkCellRendererPixbufClass parent_class; void (*activate)(RemminaCellRendererPixbuf *renderer); @@ -79,12 +81,12 @@ static guint remmina_cell_renderer_pixbuf_signals[1] = #if GTK_VERSION == 2 static gboolean remmina_cell_renderer_pixbuf_activate(GtkCellRenderer *renderer, GdkEvent *event, GtkWidget *widget, - const gchar *path, GdkRectangle *background_area, GdkRectangle *cell_area, - GtkCellRendererState flags) + const gchar *path, GdkRectangle *background_area, GdkRectangle *cell_area, + GtkCellRendererState flags) #elif GTK_VERSION == 3 static gboolean remmina_cell_renderer_pixbuf_activate(GtkCellRenderer *renderer, GdkEvent *event, GtkWidget *widget, - const gchar *path, const GdkRectangle *background_area, const GdkRectangle *cell_area, - GtkCellRendererState flags) + const gchar *path, const GdkRectangle *background_area, const GdkRectangle *cell_area, + GtkCellRendererState flags) #endif { TRACE_CALL("remmina_cell_renderer_pixbuf_activate"); @@ -100,8 +102,8 @@ static void remmina_cell_renderer_pixbuf_class_init(RemminaCellRendererPixbufCla renderer_class->activate = remmina_cell_renderer_pixbuf_activate; remmina_cell_renderer_pixbuf_signals[0] = g_signal_new("activate", G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaCellRendererPixbufClass, activate), NULL, - NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaCellRendererPixbufClass, activate), NULL, + NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); } static void remmina_cell_renderer_pixbuf_init(RemminaCellRendererPixbuf *renderer) @@ -136,7 +138,8 @@ G_DEFINE_TYPE( RemminaFTPClient, remmina_ftp_client, GTK_TYPE_GRID) gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (client)), NULL); \ } -struct _RemminaFTPClientPriv { +struct _RemminaFTPClientPriv +{ GtkWidget *directory_combo; GtkWidget *vpaned; @@ -159,7 +162,8 @@ struct _RemminaFTPClientPriv { static gint remmina_ftp_client_taskid = 1; -enum { +enum +{ OPEN_DIR_SIGNAL, NEW_TASK_SIGNAL, CANCEL_TASK_SIGNAL, DELETE_FILE_SIGNAL, LAST_SIGNAL }; @@ -170,17 +174,17 @@ static void remmina_ftp_client_class_init(RemminaFTPClientClass *klass) { TRACE_CALL("remmina_ftp_client_class_init"); remmina_ftp_client_signals[OPEN_DIR_SIGNAL] = g_signal_new("open-dir", G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaFTPClientClass, open_dir), NULL, NULL, - g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaFTPClientClass, open_dir), NULL, NULL, + g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); remmina_ftp_client_signals[NEW_TASK_SIGNAL] = g_signal_new("new-task", G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaFTPClientClass, new_task), NULL, NULL, - g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaFTPClientClass, new_task), NULL, NULL, + g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); remmina_ftp_client_signals[CANCEL_TASK_SIGNAL] = g_signal_new("cancel-task", G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaFTPClientClass, cancel_task), NULL, NULL, - remmina_marshal_BOOLEAN__INT, G_TYPE_BOOLEAN, 1, G_TYPE_INT); + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaFTPClientClass, cancel_task), NULL, NULL, + remmina_marshal_BOOLEAN__INT, G_TYPE_BOOLEAN, 1, G_TYPE_INT); remmina_ftp_client_signals[DELETE_FILE_SIGNAL] = g_signal_new("delete-file", G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaFTPClientClass, delete_file), NULL, NULL, - remmina_marshal_BOOLEAN__INT_STRING, G_TYPE_BOOLEAN, 2, G_TYPE_INT, G_TYPE_STRING); + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaFTPClientClass, delete_file), NULL, NULL, + remmina_marshal_BOOLEAN__INT_STRING, G_TYPE_BOOLEAN, 2, G_TYPE_INT, G_TYPE_STRING); } static void remmina_ftp_client_destroy(RemminaFTPClient *client, gpointer data) @@ -193,7 +197,7 @@ static void remmina_ftp_client_destroy(RemminaFTPClient *client, gpointer data) } static void remmina_ftp_client_cell_data_filetype_pixbuf(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model, - GtkTreeIter *iter, gpointer user_data) + GtkTreeIter *iter, gpointer user_data) { TRACE_CALL("remmina_ftp_client_cell_data_filetype_pixbuf"); gint type; @@ -201,7 +205,8 @@ static void remmina_ftp_client_cell_data_filetype_pixbuf(GtkTreeViewColumn *col, /* Same as REMMINA_FTP_TASK_COLUMN_TYPE */ gtk_tree_model_get(model, iter, REMMINA_FTP_FILE_COLUMN_TYPE, &type, -1); - switch (type) { + switch (type) + { case REMMINA_FTP_FILE_TYPE_DIR: g_object_set(renderer, "stock-id", "folder", NULL); break; @@ -212,21 +217,22 @@ static void remmina_ftp_client_cell_data_filetype_pixbuf(GtkTreeViewColumn *col, } static void remmina_ftp_client_cell_data_progress_pixbuf(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model, - GtkTreeIter *iter, gpointer user_data) + GtkTreeIter *iter, gpointer user_data) { TRACE_CALL("remmina_ftp_client_cell_data_progress_pixbuf"); gint tasktype, status; gtk_tree_model_get(model, iter, REMMINA_FTP_TASK_COLUMN_TASKTYPE, &tasktype, REMMINA_FTP_TASK_COLUMN_STATUS, &status, - -1); + -1); - switch (status) { + switch (status) + { case REMMINA_FTP_TASK_STATUS_WAIT: g_object_set(renderer, "stock-id", "P_ause", NULL); break; case REMMINA_FTP_TASK_STATUS_RUN: g_object_set(renderer, "stock-id", - (tasktype == REMMINA_FTP_TASK_TYPE_UPLOAD ? "go-up" : "go-down"), NULL); + (tasktype == REMMINA_FTP_TASK_TYPE_UPLOAD ? "go-up" : "go-down"), NULL); break; case REMMINA_FTP_TASK_STATUS_FINISH: g_object_set(renderer, "stock-id", "_Yes", NULL); @@ -243,20 +249,27 @@ remmina_ftp_client_size_to_str(gfloat size) TRACE_CALL("remmina_ftp_client_size_to_str"); gchar *str; - if (size < 1024.0) { + if (size < 1024.0) + { str = g_strdup_printf("%i", (gint) size); - } else if (size < 1024.0 * 1024.0) { + } + else if (size < 1024.0 * 1024.0) + { str = g_strdup_printf("%iK", (gint)(size / 1024.0)); - } else if (size < 1024.0 * 1024.0 * 1024.0) { + } + else if (size < 1024.0 * 1024.0 * 1024.0) + { str = g_strdup_printf("%.1fM", size / 1024.0 / 1024.0); - } else { + } + else + { str = g_strdup_printf("%.1fG", size / 1024.0 / 1024.0 / 1024.0); } return str; } static void remmina_ftp_client_cell_data_size(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model, - GtkTreeIter *iter, gpointer user_data) + GtkTreeIter *iter, gpointer user_data) { TRACE_CALL("remmina_ftp_client_cell_data_size"); gfloat size; @@ -271,7 +284,7 @@ static void remmina_ftp_client_cell_data_size(GtkTreeViewColumn *col, GtkCellRen } static void remmina_ftp_client_cell_data_permission(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model, - GtkTreeIter *iter, gpointer user_data) + GtkTreeIter *iter, gpointer user_data) { TRACE_CALL("remmina_ftp_client_cell_data_permission"); gint permission; @@ -295,7 +308,7 @@ static void remmina_ftp_client_cell_data_permission(GtkTreeViewColumn *col, GtkC } static void remmina_ftp_client_cell_data_size_progress(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model, - GtkTreeIter *iter, gpointer user_data) + GtkTreeIter *iter, gpointer user_data) { TRACE_CALL("remmina_ftp_client_cell_data_size_progress"); gint status; @@ -303,11 +316,14 @@ static void remmina_ftp_client_cell_data_size_progress(GtkTreeViewColumn *col, G gchar *strsize, *strdonesize, *str; gtk_tree_model_get(model, iter, REMMINA_FTP_TASK_COLUMN_STATUS, &status, REMMINA_FTP_TASK_COLUMN_SIZE, &size, - REMMINA_FTP_TASK_COLUMN_DONESIZE, &donesize, -1); + REMMINA_FTP_TASK_COLUMN_DONESIZE, &donesize, -1); - if (status == REMMINA_FTP_TASK_STATUS_FINISH) { + if (status == REMMINA_FTP_TASK_STATUS_FINISH) + { str = remmina_ftp_client_size_to_str(size); - } else { + } + else + { strsize = remmina_ftp_client_size_to_str(size); strdonesize = remmina_ftp_client_size_to_str(donesize); str = g_strdup_printf("%s / %s", strdonesize, strsize); @@ -321,7 +337,7 @@ static void remmina_ftp_client_cell_data_size_progress(GtkTreeViewColumn *col, G } static void remmina_ftp_client_cell_data_progress(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model, - GtkTreeIter *iter, gpointer user_data) + GtkTreeIter *iter, gpointer user_data) { TRACE_CALL("remmina_ftp_client_cell_data_progress"); gint status; @@ -329,13 +345,19 @@ static void remmina_ftp_client_cell_data_progress(GtkTreeViewColumn *col, GtkCel gint progress; gtk_tree_model_get(model, iter, REMMINA_FTP_TASK_COLUMN_STATUS, &status, REMMINA_FTP_TASK_COLUMN_SIZE, &size, - REMMINA_FTP_TASK_COLUMN_DONESIZE, &donesize, -1); - if (status == REMMINA_FTP_TASK_STATUS_FINISH) { + REMMINA_FTP_TASK_COLUMN_DONESIZE, &donesize, -1); + if (status == REMMINA_FTP_TASK_STATUS_FINISH) + { progress = 100; - } else { - if (size <= 1) { + } + else + { + if (size <= 1) + { progress = 0; - } else { + } + else + { progress = (gint)(donesize / size * 100); if (progress > 99) progress = 99; @@ -363,7 +385,8 @@ static void remmina_ftp_client_dir_on_changed(GtkWidget *widget, RemminaFTPClien TRACE_CALL("remmina_ftp_client_dir_on_changed"); GtkWidget *entry = gtk_bin_get_child(GTK_BIN(widget)); - if (!gtk_widget_is_focus(entry)) { + if (!gtk_widget_is_focus(entry)) + { gtk_widget_grab_focus(entry); /* If the text was changed but the entry is not the focus, it should be changed by the drop-down list. Not sure this will always work in the future, but it works right now :) */ @@ -375,7 +398,8 @@ static void remmina_ftp_client_set_file_action_sensitive(RemminaFTPClient *clien { TRACE_CALL("remmina_ftp_client_set_file_action_sensitive"); gint i; - for (i = 0; client->priv->file_action_widgets[i]; i++) { + for (i = 0; client->priv->file_action_widgets[i]; i++) + { gtk_widget_set_sensitive(client->priv->file_action_widgets[i], sensitive); } client->priv->sensitive = sensitive; @@ -400,12 +424,14 @@ remmina_ftp_client_get_download_dir(RemminaFTPClient *client) gchar *localdir = NULL; dialog = gtk_file_chooser_dialog_new(_("Choose download location"), - GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(client))), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, - "_Cancel", GTK_RESPONSE_CANCEL, "_OK", GTK_RESPONSE_ACCEPT, NULL); - if (priv->working_directory) { + GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(client))), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, + "_Cancel", GTK_RESPONSE_CANCEL, "_OK", GTK_RESPONSE_ACCEPT, NULL); + if (priv->working_directory) + { gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), priv->working_directory); } - if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) + { g_free(priv->working_directory); priv->working_directory = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(dialog)); localdir = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); @@ -425,15 +451,15 @@ static void remmina_ftp_client_download(RemminaFTPClient *client, GtkTreeIter *p gfloat size; gtk_tree_model_get(priv->file_list_sort, piter, REMMINA_FTP_FILE_COLUMN_TYPE, &type, REMMINA_FTP_FILE_COLUMN_NAME, - &name, REMMINA_FTP_FILE_COLUMN_SIZE, &size, -1); + &name, REMMINA_FTP_FILE_COLUMN_SIZE, &size, -1); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, REMMINA_FTP_TASK_COLUMN_TYPE, type, REMMINA_FTP_TASK_COLUMN_NAME, name, - REMMINA_FTP_TASK_COLUMN_SIZE, size, REMMINA_FTP_TASK_COLUMN_TASKID, remmina_ftp_client_taskid++, - REMMINA_FTP_TASK_COLUMN_TASKTYPE, REMMINA_FTP_TASK_TYPE_DOWNLOAD, REMMINA_FTP_TASK_COLUMN_REMOTEDIR, - priv->current_directory, REMMINA_FTP_TASK_COLUMN_LOCALDIR, localdir, REMMINA_FTP_TASK_COLUMN_STATUS, - REMMINA_FTP_TASK_STATUS_WAIT, REMMINA_FTP_TASK_COLUMN_DONESIZE, 0.0, REMMINA_FTP_TASK_COLUMN_TOOLTIP, - NULL, -1); + REMMINA_FTP_TASK_COLUMN_SIZE, size, REMMINA_FTP_TASK_COLUMN_TASKID, remmina_ftp_client_taskid++, + REMMINA_FTP_TASK_COLUMN_TASKTYPE, REMMINA_FTP_TASK_TYPE_DOWNLOAD, REMMINA_FTP_TASK_COLUMN_REMOTEDIR, + priv->current_directory, REMMINA_FTP_TASK_COLUMN_LOCALDIR, localdir, REMMINA_FTP_TASK_COLUMN_STATUS, + REMMINA_FTP_TASK_STATUS_WAIT, REMMINA_FTP_TASK_COLUMN_DONESIZE, 0.0, REMMINA_FTP_TASK_COLUMN_TOOLTIP, + NULL, -1); g_free(name); @@ -441,7 +467,7 @@ static void remmina_ftp_client_download(RemminaFTPClient *client, GtkTreeIter *p } static gboolean remmina_ftp_client_task_list_on_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboard_tip, - GtkTooltip *tooltip, RemminaFTPClient *client) + GtkTooltip *tooltip, RemminaFTPClient *client) { TRACE_CALL("remmina_ftp_client_task_list_on_query_tooltip"); RemminaFTPClientPriv *priv = (RemminaFTPClientPriv*) client->priv; @@ -449,7 +475,8 @@ static gboolean remmina_ftp_client_task_list_on_query_tooltip(GtkWidget *widget, GtkTreePath *path = NULL; gchar *tmp; - if (!gtk_tree_view_get_tooltip_context(GTK_TREE_VIEW(priv->task_list_view), &x, &y, keyboard_tip, NULL, &path, &iter)) { + if (!gtk_tree_view_get_tooltip_context(GTK_TREE_VIEW(priv->task_list_view), &x, &y, keyboard_tip, NULL, &path, &iter)) + { return FALSE; } @@ -502,13 +529,15 @@ static void remmina_ftp_client_action_download(GObject *object, RemminaFTPClient return; localdir = remmina_ftp_client_get_download_dir(client); - if (!localdir) { + if (!localdir) + { g_list_free(list); return; } list_iter = g_list_first(list); - while (list_iter) { + while (list_iter) + { gtk_tree_model_get_iter(priv->file_list_sort, &iter, (GtkTreePath*) list_iter->data); remmina_ftp_client_download(client, &iter, localdir); list_iter = g_list_next(list_iter); @@ -539,7 +568,7 @@ static void remmina_ftp_client_action_delete(GObject *object, RemminaFTPClient * return; dialog = gtk_message_dialog_new(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(client))), GTK_DIALOG_MODAL, - GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, _("Are you sure to delete the selected files on server?")); + GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, _("Are you sure to delete the selected files on server?")); response = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); if (response != GTK_RESPONSE_YES) @@ -548,11 +577,12 @@ static void remmina_ftp_client_action_delete(GObject *object, RemminaFTPClient * BUSY_CURSOR list_iter = g_list_first(list); - while (list_iter) { + while (list_iter) + { gtk_tree_model_get_iter(priv->file_list_sort, &iter, (GtkTreePath*) list_iter->data); gtk_tree_model_get(priv->file_list_sort, &iter, REMMINA_FTP_FILE_COLUMN_TYPE, &type, - REMMINA_FTP_FILE_COLUMN_NAME, &name, -1); + REMMINA_FTP_FILE_COLUMN_NAME, &name, -1); path = remmina_public_combine_path(priv->current_directory, name); g_signal_emit(G_OBJECT(client), remmina_ftp_client_signals[DELETE_FILE_SIGNAL], 0, type, path, &ret); @@ -567,7 +597,8 @@ static void remmina_ftp_client_action_delete(GObject *object, RemminaFTPClient * NORMAL_CURSOR - if (ret) { + if (ret) + { remmina_ftp_client_action_refresh(object, client); } } @@ -576,9 +607,9 @@ static void remmina_ftp_client_upload_folder_on_toggled(GtkToggleButton *toggleb { TRACE_CALL("remmina_ftp_client_upload_folder_on_toggled"); gtk_file_chooser_set_action( - GTK_FILE_CHOOSER(widget), - gtk_toggle_button_get_active(togglebutton) ? - GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER : GTK_FILE_CHOOSER_ACTION_OPEN); + GTK_FILE_CHOOSER(widget), + gtk_toggle_button_get_active(togglebutton) ? + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER : GTK_FILE_CHOOSER_ACTION_OPEN); } static void remmina_ftp_client_action_upload(GObject *object, RemminaFTPClient *client) @@ -597,50 +628,56 @@ static void remmina_ftp_client_action_upload(GObject *object, RemminaFTPClient * struct stat st; dialog = gtk_file_chooser_dialog_new(_("Choose a file to upload"), - GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(client))), GTK_FILE_CHOOSER_ACTION_OPEN, "_Cancel", - GTK_RESPONSE_CANCEL, "_OK", GTK_RESPONSE_ACCEPT, NULL); + GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(client))), GTK_FILE_CHOOSER_ACTION_OPEN, "_Cancel", + GTK_RESPONSE_CANCEL, "_OK", GTK_RESPONSE_ACCEPT, NULL); gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), TRUE); - if (priv->working_directory) { + if (priv->working_directory) + { gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), priv->working_directory); } upload_folder_check = gtk_check_button_new_with_label(_("Upload folder")); gtk_widget_show(upload_folder_check); g_signal_connect(G_OBJECT(upload_folder_check), "toggled", G_CALLBACK(remmina_ftp_client_upload_folder_on_toggled), - dialog); + dialog); gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(dialog), upload_folder_check); - if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) + { g_free(priv->working_directory); priv->working_directory = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(dialog)); files = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog)); } type = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(upload_folder_check)) ? - REMMINA_FTP_FILE_TYPE_DIR : REMMINA_FTP_FILE_TYPE_FILE; + REMMINA_FTP_FILE_TYPE_DIR : REMMINA_FTP_FILE_TYPE_FILE; gtk_widget_destroy(dialog); if (!files) return; - for (element = files; element; element = element->next) { + for (element = files; element; element = element->next) + { path = (gchar*) element->data; if (g_stat(path, &st) < 0) continue; name = g_strrstr(path, "/"); - if (name) { + if (name) + { *name++ = '\0'; dir = path; - } else { + } + else + { name = path; dir = NULL; } gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, REMMINA_FTP_TASK_COLUMN_TYPE, type, REMMINA_FTP_TASK_COLUMN_NAME, name, - REMMINA_FTP_TASK_COLUMN_SIZE, (gfloat) st.st_size, REMMINA_FTP_TASK_COLUMN_TASKID, - remmina_ftp_client_taskid++, REMMINA_FTP_TASK_COLUMN_TASKTYPE, REMMINA_FTP_TASK_TYPE_UPLOAD, - REMMINA_FTP_TASK_COLUMN_REMOTEDIR, priv->current_directory, REMMINA_FTP_TASK_COLUMN_LOCALDIR, - dir, REMMINA_FTP_TASK_COLUMN_STATUS, REMMINA_FTP_TASK_STATUS_WAIT, - REMMINA_FTP_TASK_COLUMN_DONESIZE, 0.0, REMMINA_FTP_TASK_COLUMN_TOOLTIP, NULL, -1); + REMMINA_FTP_TASK_COLUMN_SIZE, (gfloat) st.st_size, REMMINA_FTP_TASK_COLUMN_TASKID, + remmina_ftp_client_taskid++, REMMINA_FTP_TASK_COLUMN_TASKTYPE, REMMINA_FTP_TASK_TYPE_UPLOAD, + REMMINA_FTP_TASK_COLUMN_REMOTEDIR, priv->current_directory, REMMINA_FTP_TASK_COLUMN_LOCALDIR, + dir, REMMINA_FTP_TASK_COLUMN_STATUS, REMMINA_FTP_TASK_STATUS_WAIT, + REMMINA_FTP_TASK_COLUMN_DONESIZE, 0.0, REMMINA_FTP_TASK_COLUMN_TOOLTIP, NULL, -1); g_free(path); } @@ -691,23 +728,29 @@ static gboolean remmina_ftp_client_file_list_on_button_press(GtkWidget *widget, gchar *name; gchar *localdir; - if (event->button == 3) { + if (event->button == 3) + { remmina_ftp_client_popup_menu(client, event); - } else if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { + } + else if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) + { list = gtk_tree_selection_get_selected_rows( - gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->file_list_view)), NULL); - if (list) { + gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->file_list_view)), NULL); + if (list) + { gtk_tree_model_get_iter(priv->file_list_sort, &iter, (GtkTreePath*) list->data); gtk_tree_model_get(priv->file_list_sort, &iter, REMMINA_FTP_FILE_COLUMN_TYPE, &type, - REMMINA_FTP_FILE_COLUMN_NAME, &name, -1); - switch (type) { + REMMINA_FTP_FILE_COLUMN_NAME, &name, -1); + switch (type) + { case REMMINA_FTP_FILE_TYPE_DIR: remmina_ftp_client_open_dir(client, name); break; case REMMINA_FTP_FILE_TYPE_FILE: default: localdir = remmina_ftp_client_get_download_dir(client); - if (localdir) { + if (localdir) + { remmina_ftp_client_download(client, &iter, localdir); g_free(localdir); } @@ -738,7 +781,8 @@ static void remmina_ftp_client_task_list_cell_on_activate(GtkCellRenderer *rende g_signal_emit(G_OBJECT(client), remmina_ftp_client_signals[CANCEL_TASK_SIGNAL], 0, taskid, &ret); - if (ret) { + if (ret) + { gtk_list_store_remove(GTK_LIST_STORE(priv->task_list_model), &iter); } } @@ -826,7 +870,8 @@ static gboolean remmina_ftp_client_filter_visible_func(GtkTreeModel *model, GtkT return TRUE; gtk_tree_model_get(model, iter, REMMINA_FTP_FILE_COLUMN_NAME, &name, -1); - if (name && name[0] == '.') { + if (name && name[0] == '.') + { result = FALSE; } g_free(name); @@ -944,7 +989,7 @@ static void remmina_ftp_client_init(RemminaFTPClient *client) renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Permission"), renderer, "text", REMMINA_FTP_FILE_COLUMN_PERMISSION, - NULL); + NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_column_set_cell_data_func(column, renderer, remmina_ftp_client_cell_data_permission, NULL, NULL); gtk_tree_view_column_set_sort_column_id(column, REMMINA_FTP_FILE_COLUMN_PERMISSION); @@ -952,16 +997,16 @@ static void remmina_ftp_client_init(RemminaFTPClient *client) /* Remote File List - Model */ priv->file_list_model = GTK_TREE_MODEL( - gtk_list_store_new(REMMINA_FTP_FILE_N_COLUMNS, G_TYPE_INT, G_TYPE_STRING, G_TYPE_FLOAT, G_TYPE_STRING, - G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING)); + gtk_list_store_new(REMMINA_FTP_FILE_N_COLUMNS, G_TYPE_INT, G_TYPE_STRING, G_TYPE_FLOAT, G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING)); priv->file_list_filter = gtk_tree_model_filter_new(priv->file_list_model, NULL); gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(priv->file_list_filter), - (GtkTreeModelFilterVisibleFunc) remmina_ftp_client_filter_visible_func, client, NULL); + (GtkTreeModelFilterVisibleFunc) remmina_ftp_client_filter_visible_func, client, NULL); priv->file_list_sort = gtk_tree_model_sort_new_with_model(priv->file_list_filter); gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(priv->file_list_sort), REMMINA_FTP_FILE_COLUMN_NAME_SORT, - GTK_SORT_ASCENDING); + GTK_SORT_ASCENDING); gtk_tree_view_set_model(GTK_TREE_VIEW(priv->file_list_view), priv->file_list_sort); /* Task List */ @@ -996,7 +1041,7 @@ static void remmina_ftp_client_init(RemminaFTPClient *client) renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Remote"), renderer, "text", REMMINA_FTP_TASK_COLUMN_REMOTEDIR, - NULL); + NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_column_set_sort_column_id(column, REMMINA_FTP_TASK_COLUMN_REMOTEDIR); gtk_tree_view_append_column(GTK_TREE_VIEW(priv->task_list_view), column); @@ -1031,21 +1076,21 @@ static void remmina_ftp_client_init(RemminaFTPClient *client) /* Task List - Model */ priv->task_list_model = GTK_TREE_MODEL( - gtk_list_store_new(REMMINA_FTP_TASK_N_COLUMNS, G_TYPE_INT, G_TYPE_STRING, G_TYPE_FLOAT, G_TYPE_INT, - G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_FLOAT, G_TYPE_STRING)); + gtk_list_store_new(REMMINA_FTP_TASK_N_COLUMNS, G_TYPE_INT, G_TYPE_STRING, G_TYPE_FLOAT, G_TYPE_INT, + G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_FLOAT, G_TYPE_STRING)); gtk_tree_view_set_model(GTK_TREE_VIEW(priv->task_list_view), priv->task_list_model); /* Setup the internal signals */ g_signal_connect(G_OBJECT(client), "destroy", G_CALLBACK(remmina_ftp_client_destroy), NULL); g_signal_connect(G_OBJECT(gtk_bin_get_child(GTK_BIN(priv->directory_combo))), "activate", - G_CALLBACK(remmina_ftp_client_dir_on_activate), client); + G_CALLBACK(remmina_ftp_client_dir_on_activate), client); g_signal_connect(G_OBJECT(priv->directory_combo), "changed", G_CALLBACK(remmina_ftp_client_dir_on_changed), client); g_signal_connect(G_OBJECT(priv->file_list_view), "button-press-event", - G_CALLBACK(remmina_ftp_client_file_list_on_button_press), client); + G_CALLBACK(remmina_ftp_client_file_list_on_button_press), client); g_signal_connect(G_OBJECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->file_list_view))), "changed", - G_CALLBACK(remmina_ftp_client_file_selection_on_changed), client); + G_CALLBACK(remmina_ftp_client_file_selection_on_changed), client); g_signal_connect(G_OBJECT(priv->task_list_view), "query-tooltip", - G_CALLBACK(remmina_ftp_client_task_list_on_query_tooltip), client); + G_CALLBACK(remmina_ftp_client_task_list_on_query_tooltip), client); } GtkWidget* @@ -1075,9 +1120,11 @@ void remmina_ftp_client_load_state(RemminaFTPClient *client, RemminaFile *remmin GtkAllocation a; pos = remmina_file_get_int(remminafile, "ftp_vpanedpos", 0); - if (pos) { + if (pos) + { gtk_widget_get_allocation(client->priv->vpaned, &a); - if (a.height > 0 && pos > a.height - 60) { + if (a.height > 0 && pos > a.height - 60) + { pos = a.height - 60; } gtk_paned_set_position(GTK_PANED(client->priv->vpaned), pos); @@ -1110,9 +1157,9 @@ void remmina_ftp_client_add_file(RemminaFTPClient *client, ...) va_end (args); gtk_tree_model_get (GTK_TREE_MODEL(store), &iter, - REMMINA_FTP_FILE_COLUMN_TYPE, &type, - REMMINA_FTP_FILE_COLUMN_NAME, &name, - -1); + REMMINA_FTP_FILE_COLUMN_TYPE, &type, + REMMINA_FTP_FILE_COLUMN_NAME, &name, + -1); ptr = g_strdup_printf("%i%s", type, name); gtk_list_store_set (store, &iter, REMMINA_FTP_FILE_COLUMN_NAME_SORT, ptr, -1); @@ -1133,9 +1180,11 @@ void remmina_ftp_client_set_dir(RemminaFTPClient *client, const gchar *dir) return; model = gtk_combo_box_get_model(GTK_COMBO_BOX(priv->directory_combo)); - for (ret = gtk_tree_model_get_iter_first(model, &iter); ret; ret = gtk_tree_model_iter_next(model, &iter)) { + for (ret = gtk_tree_model_get_iter_first(model, &iter); ret; ret = gtk_tree_model_iter_next(model, &iter)) + { gtk_tree_model_get(model, &iter, 0, &t, -1); - if (g_strcmp0(t, dir) == 0) { + if (g_strcmp0(t, dir) == 0) + { gtk_list_store_remove(GTK_LIST_STORE(model), &iter); g_free(t); break; @@ -1168,7 +1217,8 @@ remmina_ftp_client_get_waiting_task(RemminaFTPClient *client) GtkTreeIter iter; RemminaFTPTask task; - if ( !remmina_masterthread_exec_is_main_thread() ) { + if ( !remmina_masterthread_exec_is_main_thread() ) + { /* Allow the execution of this function from a non main thread */ RemminaMTExecData *d; RemminaFTPTask* retval; @@ -1184,14 +1234,16 @@ remmina_ftp_client_get_waiting_task(RemminaFTPClient *client) if (!gtk_tree_model_get_iter_first(priv->task_list_model, &iter)) return NULL; - while (1) { + while (1) + { gtk_tree_model_get(priv->task_list_model, &iter, REMMINA_FTP_TASK_COLUMN_TYPE, &task.type, - REMMINA_FTP_TASK_COLUMN_NAME, &task.name, REMMINA_FTP_TASK_COLUMN_SIZE, &task.size, - REMMINA_FTP_TASK_COLUMN_TASKID, &task.taskid, REMMINA_FTP_TASK_COLUMN_TASKTYPE, &task.tasktype, - REMMINA_FTP_TASK_COLUMN_REMOTEDIR, &task.remotedir, REMMINA_FTP_TASK_COLUMN_LOCALDIR, - &task.localdir, REMMINA_FTP_TASK_COLUMN_STATUS, &task.status, REMMINA_FTP_TASK_COLUMN_DONESIZE, - &task.donesize, REMMINA_FTP_TASK_COLUMN_TOOLTIP, &task.tooltip, -1); - if (task.status == REMMINA_FTP_TASK_STATUS_WAIT) { + REMMINA_FTP_TASK_COLUMN_NAME, &task.name, REMMINA_FTP_TASK_COLUMN_SIZE, &task.size, + REMMINA_FTP_TASK_COLUMN_TASKID, &task.taskid, REMMINA_FTP_TASK_COLUMN_TASKTYPE, &task.tasktype, + REMMINA_FTP_TASK_COLUMN_REMOTEDIR, &task.remotedir, REMMINA_FTP_TASK_COLUMN_LOCALDIR, + &task.localdir, REMMINA_FTP_TASK_COLUMN_STATUS, &task.status, REMMINA_FTP_TASK_COLUMN_DONESIZE, + &task.donesize, REMMINA_FTP_TASK_COLUMN_TOOLTIP, &task.tooltip, -1); + if (task.status == REMMINA_FTP_TASK_STATUS_WAIT) + { path = gtk_tree_model_get_path(priv->task_list_model, &iter); task.rowref = gtk_tree_row_reference_new(priv->task_list_model, path); gtk_tree_path_free(path); @@ -1212,7 +1264,8 @@ void remmina_ftp_client_update_task(RemminaFTPClient *client, RemminaFTPTask* ta GtkTreePath *path; GtkTreeIter iter; - if ( !remmina_masterthread_exec_is_main_thread() ) { + if ( !remmina_masterthread_exec_is_main_thread() ) + { /* Allow the execution of this function from a non main thread */ RemminaMTExecData *d; d = (RemminaMTExecData*)g_malloc( sizeof(RemminaMTExecData) ); @@ -1232,13 +1285,14 @@ void remmina_ftp_client_update_task(RemminaFTPClient *client, RemminaFTPTask* ta gtk_tree_model_get_iter(priv->task_list_model, &iter, path); gtk_tree_path_free(path); gtk_list_store_set(store, &iter, REMMINA_FTP_TASK_COLUMN_SIZE, task->size, REMMINA_FTP_TASK_COLUMN_STATUS, task->status, - REMMINA_FTP_TASK_COLUMN_DONESIZE, task->donesize, REMMINA_FTP_TASK_COLUMN_TOOLTIP, task->tooltip, -1); + REMMINA_FTP_TASK_COLUMN_DONESIZE, task->donesize, REMMINA_FTP_TASK_COLUMN_TOOLTIP, task->tooltip, -1); } void remmina_ftp_task_free(RemminaFTPTask *task) { TRACE_CALL("remmina_ftp_task_free"); - if (task) { + if (task) + { g_free(task->name); g_free(task->remotedir); g_free(task->localdir); diff --git a/remmina/src/remmina_ftp_client.h b/remmina/src/remmina_ftp_client.h index 14f37b03e..4eed76cdc 100644 --- a/remmina/src/remmina_ftp_client.h +++ b/remmina/src/remmina_ftp_client.h @@ -47,13 +47,15 @@ G_BEGIN_DECLS typedef struct _RemminaFTPClientPriv RemminaFTPClientPriv; -typedef struct _RemminaFTPClient { +typedef struct _RemminaFTPClient +{ GtkVBox vbox; RemminaFTPClientPriv *priv; } RemminaFTPClient; -typedef struct _RemminaFTPClientClass { +typedef struct _RemminaFTPClientClass +{ GtkVBoxClass parent_class; void (*open_dir)(RemminaFTPClient *client); @@ -65,11 +67,13 @@ typedef struct _RemminaFTPClientClass { GType remmina_ftp_client_get_type(void) G_GNUC_CONST; -enum { +enum +{ REMMINA_FTP_FILE_TYPE_DIR, REMMINA_FTP_FILE_TYPE_FILE, REMMINA_FTP_FILE_N_TYPES, }; -enum { +enum +{ REMMINA_FTP_FILE_COLUMN_TYPE, REMMINA_FTP_FILE_COLUMN_NAME, REMMINA_FTP_FILE_COLUMN_SIZE, @@ -80,11 +84,13 @@ enum { REMMINA_FTP_FILE_N_COLUMNS }; -enum { +enum +{ REMMINA_FTP_TASK_TYPE_DOWNLOAD, REMMINA_FTP_TASK_TYPE_UPLOAD, REMMINA_FTP_TASK_N_TYPES }; -enum { +enum +{ REMMINA_FTP_TASK_STATUS_WAIT, REMMINA_FTP_TASK_STATUS_RUN, REMMINA_FTP_TASK_STATUS_FINISH, @@ -92,7 +98,8 @@ enum { REMMINA_FTP_TASK_N_STATUSES }; -enum { +enum +{ REMMINA_FTP_TASK_COLUMN_TYPE, REMMINA_FTP_TASK_COLUMN_NAME, REMMINA_FTP_TASK_COLUMN_SIZE, @@ -106,7 +113,8 @@ enum { REMMINA_FTP_TASK_N_COLUMNS }; -typedef struct _RemminaFTPTask { +typedef struct _RemminaFTPTask +{ /* Read-only */ gint type; gchar *name; diff --git a/remmina/src/remmina_icon.c b/remmina/src/remmina_icon.c index a53053bf3..d2b8f3da8 100644 --- a/remmina/src/remmina_icon.c +++ b/remmina/src/remmina_icon.c @@ -179,17 +179,17 @@ static void remmina_icon_on_launch_item(RemminaAppletMenu *menu, RemminaAppletMe switch (menuitem->item_type) { - case REMMINA_APPLET_MENU_ITEM_NEW: - remmina_exec_command(REMMINA_COMMAND_NEW, NULL); - break; - case REMMINA_APPLET_MENU_ITEM_FILE: - remmina_exec_command(REMMINA_COMMAND_CONNECT, menuitem->filename); - break; - case REMMINA_APPLET_MENU_ITEM_DISCOVERED: - s = g_strdup_printf("%s,%s", menuitem->protocol, menuitem->name); - remmina_exec_command(REMMINA_COMMAND_NEW, s); - g_free(s); - break; + case REMMINA_APPLET_MENU_ITEM_NEW: + remmina_exec_command(REMMINA_COMMAND_NEW, NULL); + break; + case REMMINA_APPLET_MENU_ITEM_FILE: + remmina_exec_command(REMMINA_COMMAND_CONNECT, menuitem->filename); + break; + case REMMINA_APPLET_MENU_ITEM_DISCOVERED: + s = g_strdup_printf("%s,%s", menuitem->protocol, menuitem->name); + remmina_exec_command(REMMINA_COMMAND_NEW, s); + g_free(s); + break; } } @@ -200,17 +200,17 @@ static void remmina_icon_on_edit_item(RemminaAppletMenu *menu, RemminaAppletMenu switch (menuitem->item_type) { - case REMMINA_APPLET_MENU_ITEM_NEW: - remmina_exec_command(REMMINA_COMMAND_NEW, NULL); - break; - case REMMINA_APPLET_MENU_ITEM_FILE: - remmina_exec_command(REMMINA_COMMAND_EDIT, menuitem->filename); - break; - case REMMINA_APPLET_MENU_ITEM_DISCOVERED: - s = g_strdup_printf("%s,%s", menuitem->protocol, menuitem->name); - remmina_exec_command(REMMINA_COMMAND_NEW, s); - g_free(s); - break; + case REMMINA_APPLET_MENU_ITEM_NEW: + remmina_exec_command(REMMINA_COMMAND_NEW, NULL); + break; + case REMMINA_APPLET_MENU_ITEM_FILE: + remmina_exec_command(REMMINA_COMMAND_EDIT, menuitem->filename); + break; + case REMMINA_APPLET_MENU_ITEM_DISCOVERED: + s = g_strdup_printf("%s,%s", menuitem->protocol, menuitem->name); + remmina_exec_command(REMMINA_COMMAND_NEW, s); + g_free(s); + break; } } @@ -395,7 +395,7 @@ static void remmina_icon_create_autostart_file(void) g_key_file_set_string(gkeyfile, "Desktop Entry", "Version", "1.0"); g_key_file_set_string(gkeyfile, "Desktop Entry", "Name", _("Remmina Applet")); g_key_file_set_string(gkeyfile, "Desktop Entry", "Comment", - _("Connect to remote desktops through the applet menu")); + _("Connect to remote desktops through the applet menu")); g_key_file_set_string(gkeyfile, "Desktop Entry", "Icon", "remmina"); g_key_file_set_string(gkeyfile, "Desktop Entry", "Exec", "remmina -i"); g_key_file_set_boolean(gkeyfile, "Desktop Entry", "Terminal", FALSE); @@ -429,17 +429,16 @@ void remmina_icon_init(void) #endif remmina_widget_pool_hold(TRUE); } - else - if (remmina_icon.icon) - { + else if (remmina_icon.icon) + { #ifdef HAVE_LIBAPPINDICATOR - app_indicator_set_status (remmina_icon.icon, remmina_pref.disable_tray_icon ? - APP_INDICATOR_STATUS_PASSIVE : APP_INDICATOR_STATUS_ACTIVE); + app_indicator_set_status (remmina_icon.icon, remmina_pref.disable_tray_icon ? + APP_INDICATOR_STATUS_PASSIVE : APP_INDICATOR_STATUS_ACTIVE); #else - gtk_status_icon_set_visible(remmina_icon.icon, !remmina_pref.disable_tray_icon); + gtk_status_icon_set_visible(remmina_icon.icon, !remmina_pref.disable_tray_icon); #endif - remmina_widget_pool_hold(!remmina_pref.disable_tray_icon); - } + remmina_widget_pool_hold(!remmina_pref.disable_tray_icon); + } if (!remmina_icon.avahi) { remmina_icon.avahi = remmina_avahi_new(); @@ -491,7 +490,7 @@ void remmina_icon_set_autostart(gboolean autostart) /* Refresh it in case translation is updated */ g_key_file_set_string(gkeyfile, "Desktop Entry", "Name", _("Remmina Applet")); g_key_file_set_string(gkeyfile, "Desktop Entry", "Comment", - _("Connect to remote desktops through the applet menu")); + _("Connect to remote desktops through the applet menu")); remmina_icon_save_autostart_file(gkeyfile); } g_key_file_free(gkeyfile); diff --git a/remmina/src/remmina_icon.h b/remmina/src/remmina_icon.h index 2fd116748..c6ec92313 100644 --- a/remmina/src/remmina_icon.h +++ b/remmina/src/remmina_icon.h @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2010 Vic Lee + * Copyright (C) 2010 Vic Lee * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give diff --git a/remmina/src/remmina_init_dialog.c b/remmina/src/remmina_init_dialog.c index 098b4fe7c..3ddb9733e 100644 --- a/remmina/src/remmina_init_dialog.c +++ b/remmina/src/remmina_init_dialog.c @@ -166,7 +166,8 @@ void remmina_init_dialog_set_status(RemminaInitDialog *dialog, const gchar *stat va_list args; - if (status_format) { + if (status_format) + { if (dialog->status) g_free(dialog->status); @@ -174,9 +175,12 @@ void remmina_init_dialog_set_status(RemminaInitDialog *dialog, const gchar *stat dialog->status = g_strdup_vprintf(status_format, args); va_end(args); - if ( remmina_masterthread_exec_is_main_thread() ) { + if ( remmina_masterthread_exec_is_main_thread() ) + { gtk_label_set_text(GTK_LABEL(dialog->status_label), dialog->status); - } else { + } + else + { RemminaMTExecData *d; d = (RemminaMTExecData*)g_malloc( sizeof(RemminaMTExecData) ); d->func = FUNC_GTK_LABEL_SET_TEXT; @@ -197,14 +201,18 @@ void remmina_init_dialog_set_status_temp(RemminaInitDialog *dialog, const gchar gchar* s; va_list args; - if (status_format) { + if (status_format) + { va_start(args, status_format); s = g_strdup_vprintf(status_format, args); va_end(args); - if ( remmina_masterthread_exec_is_main_thread() ) { + if ( remmina_masterthread_exec_is_main_thread() ) + { gtk_label_set_text(GTK_LABEL(dialog->status_label), dialog->status); - } else { + } + else + { RemminaMTExecData *d; d = (RemminaMTExecData*)g_malloc( sizeof(RemminaMTExecData) ); d->func = FUNC_GTK_LABEL_SET_TEXT; @@ -229,7 +237,8 @@ gint remmina_init_dialog_authpwd(RemminaInitDialog *dialog, const gchar *label, gint ret; gchar *s; - if ( !remmina_masterthread_exec_is_main_thread() ) { + if ( !remmina_masterthread_exec_is_main_thread() ) + { /* Allow the execution of this function from a non main thread */ RemminaMTExecData *d; gint retval; @@ -272,12 +281,15 @@ gint remmina_init_dialog_authpwd(RemminaInitDialog *dialog, const gchar *label, s = g_strdup_printf(_("Save %s"), label); save_password_check = gtk_check_button_new_with_label(s); g_free(s); - if (allow_save) { + if (allow_save) + { gtk_widget_show(save_password_check); gtk_grid_attach(GTK_GRID(grid), save_password_check, 0, 1, 2, 1); if (dialog->save_password) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(save_password_check), TRUE); - } else { + } + else + { gtk_widget_set_sensitive(save_password_check, FALSE); } @@ -293,7 +305,8 @@ gint remmina_init_dialog_authpwd(RemminaInitDialog *dialog, const gchar *label, /* Now run it */ ret = gtk_dialog_run(GTK_DIALOG(dialog)); - if (ret == GTK_RESPONSE_OK) { + if (ret == GTK_RESPONSE_OK) + { dialog->password = g_strdup(gtk_entry_get_text(GTK_ENTRY(password_entry))); dialog->save_password = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(save_password_check)); } @@ -306,7 +319,7 @@ gint remmina_init_dialog_authpwd(RemminaInitDialog *dialog, const gchar *label, } gint remmina_init_dialog_authuserpwd(RemminaInitDialog *dialog, gboolean want_domain, const gchar *default_username, - const gchar *default_domain, gboolean allow_save) + const gchar *default_domain, gboolean allow_save) { TRACE_CALL("remmina_init_dialog_authuserpwd"); @@ -318,7 +331,8 @@ gint remmina_init_dialog_authuserpwd(RemminaInitDialog *dialog, gboolean want_do GtkWidget *widget; gint ret; - if ( !remmina_masterthread_exec_is_main_thread() ) { + if ( !remmina_masterthread_exec_is_main_thread() ) + { /* Allow the execution of this function from a non main thread */ RemminaMTExecData *d; gint retval; @@ -357,7 +371,8 @@ gint remmina_init_dialog_authuserpwd(RemminaInitDialog *dialog, gboolean want_do gtk_widget_show(username_entry); gtk_grid_attach(GTK_GRID(grid), username_entry, 1, 0, 2, 1); gtk_entry_set_max_length(GTK_ENTRY(username_entry), 100); - if (default_username && default_username[0] != '\0') { + if (default_username && default_username[0] != '\0') + { gtk_entry_set_text(GTK_ENTRY(username_entry), default_username); } @@ -374,7 +389,8 @@ gint remmina_init_dialog_authuserpwd(RemminaInitDialog *dialog, gboolean want_do gtk_entry_set_activates_default(GTK_ENTRY(password_entry), TRUE); - if (want_domain) { + if (want_domain) + { widget = gtk_label_new(_("Domain")); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); gtk_widget_show(widget); @@ -384,18 +400,22 @@ gint remmina_init_dialog_authuserpwd(RemminaInitDialog *dialog, gboolean want_do gtk_widget_show(domain_entry); gtk_grid_attach(GTK_GRID(grid), domain_entry, 1, 3, 2, 1); gtk_entry_set_max_length(GTK_ENTRY(domain_entry), 100); - if (default_domain && default_domain[0] != '\0') { + if (default_domain && default_domain[0] != '\0') + { gtk_entry_set_text(GTK_ENTRY(domain_entry), default_domain); } } save_password_check = gtk_check_button_new_with_label(_("Save password")); - if (allow_save) { + if (allow_save) + { gtk_widget_show(save_password_check); gtk_grid_attach(GTK_GRID(grid), save_password_check, 0, 4, 2, 3); if (dialog->save_password) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(save_password_check), TRUE); - } else { + } + else + { gtk_widget_set_sensitive(save_password_check, FALSE); } @@ -404,9 +424,12 @@ gint remmina_init_dialog_authuserpwd(RemminaInitDialog *dialog, gboolean want_do gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), GTK_RESPONSE_OK, TRUE); - if (default_username && default_username[0] != '\0') { + if (default_username && default_username[0] != '\0') + { gtk_widget_grab_focus(password_entry); - } else { + } + else + { gtk_widget_grab_focus(username_entry); } @@ -414,7 +437,8 @@ gint remmina_init_dialog_authuserpwd(RemminaInitDialog *dialog, gboolean want_do /* Now run it */ ret = gtk_dialog_run(GTK_DIALOG(dialog)); - if (ret == GTK_RESPONSE_OK) { + if (ret == GTK_RESPONSE_OK) + { dialog->username = g_strdup(gtk_entry_get_text(GTK_ENTRY(username_entry))); dialog->password = g_strdup(gtk_entry_get_text(GTK_ENTRY(password_entry))); dialog->save_password = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(save_password_check)); @@ -439,7 +463,8 @@ gint remmina_init_dialog_certificate(RemminaInitDialog* dialog, const gchar* sub GtkWidget* widget; gchar* s; - if ( !remmina_masterthread_exec_is_main_thread() ) { + if ( !remmina_masterthread_exec_is_main_thread() ) + { /* Allow the execution of this function from a non main thread */ RemminaMTExecData *d; gint retval; @@ -516,7 +541,8 @@ gint remmina_init_dialog_certificate(RemminaInitDialog* dialog, const gchar* sub /* Now run it */ status = gtk_dialog_run(GTK_DIALOG(dialog)); - if (status == GTK_RESPONSE_OK) { + if (status == GTK_RESPONSE_OK) + { } @@ -533,7 +559,8 @@ gint remmina_init_dialog_certificate_changed(RemminaInitDialog* dialog, const gc GtkWidget* widget; gchar* s; - if ( !remmina_masterthread_exec_is_main_thread() ) { + if ( !remmina_masterthread_exec_is_main_thread() ) + { /* Allow the execution of this function from a non main thread */ RemminaMTExecData *d; gint retval; @@ -622,7 +649,8 @@ gint remmina_init_dialog_certificate_changed(RemminaInitDialog* dialog, const gc /* Now run it */ status = gtk_dialog_run(GTK_DIALOG(dialog)); - if (status == GTK_RESPONSE_OK) { + if (status == GTK_RESPONSE_OK) + { } @@ -647,11 +675,15 @@ static GtkWidget* remmina_init_dialog_create_file_button(GtkGrid *grid, const gc gtk_file_chooser_button_set_width_chars(GTK_FILE_CHOOSER_BUTTON(widget), 25); gtk_widget_show(widget); gtk_grid_attach(grid, widget, 1, row, 2, row + 1); - if (filename && filename[0] != '\0') { + if (filename && filename[0] != '\0') + { gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(widget), filename); - } else { + } + else + { pkidir = g_strdup_printf("%s/.pki", g_get_home_dir()); - if (g_file_test(pkidir, G_FILE_TEST_IS_DIR)) { + if (g_file_test(pkidir, G_FILE_TEST_IS_DIR)) + { gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(widget), pkidir); } g_free(pkidir); @@ -661,7 +693,7 @@ static GtkWidget* remmina_init_dialog_create_file_button(GtkGrid *grid, const gc } gint remmina_init_dialog_authx509(RemminaInitDialog *dialog, const gchar *cacert, const gchar *cacrl, const gchar *clientcert, - const gchar *clientkey) + const gchar *clientkey) { TRACE_CALL("remmina_init_dialog_authx509"); @@ -673,7 +705,8 @@ gint remmina_init_dialog_authx509(RemminaInitDialog *dialog, const gchar *cacert gint ret; - if ( !remmina_masterthread_exec_is_main_thread() ) { + if ( !remmina_masterthread_exec_is_main_thread() ) + { /* Allow the execution of this function from a non main thread */ RemminaMTExecData *d; gint retval; @@ -716,7 +749,8 @@ gint remmina_init_dialog_authx509(RemminaInitDialog *dialog, const gchar *cacert /* Now run it */ ret = gtk_dialog_run(GTK_DIALOG(dialog)); - if (ret == GTK_RESPONSE_OK) { + if (ret == GTK_RESPONSE_OK) + { dialog->cacert = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(cacert_button)); dialog->cacrl = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(cacrl_button)); dialog->clientcert = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(clientcert_button)); @@ -738,7 +772,8 @@ gint remmina_init_dialog_serverkey_confirm(RemminaInitDialog *dialog, const gcha GtkWidget *widget; gint ret; - if ( !remmina_masterthread_exec_is_main_thread() ) { + if ( !remmina_masterthread_exec_is_main_thread() ) + { /* Allow the execution of this function from a non main thread */ RemminaMTExecData *d; gint retval; @@ -804,7 +839,7 @@ gint remmina_init_dialog_serverkey_unknown(RemminaInitDialog *dialog, const gcha /* This function can be called from a non main thread */ return remmina_init_dialog_serverkey_confirm(dialog, serverkey, - _("The server is unknown. The public key fingerprint is:")); + _("The server is unknown. The public key fingerprint is:")); } gint remmina_init_dialog_serverkey_changed(RemminaInitDialog *dialog, const gchar *serverkey) @@ -813,7 +848,7 @@ gint remmina_init_dialog_serverkey_changed(RemminaInitDialog *dialog, const gcha /* This function can be called from a non main thread */ return remmina_init_dialog_serverkey_confirm(dialog, serverkey, - _("WARNING: The server has changed its public key. This means either you are under attack,\n" - "or the administrator has changed the key. The new public key fingerprint is:")); + _("WARNING: The server has changed its public key. This means either you are under attack,\n" + "or the administrator has changed the key. The new public key fingerprint is:")); } diff --git a/remmina/src/remmina_init_dialog.h b/remmina/src/remmina_init_dialog.h index 76aef21f0..67f58938b 100644 --- a/remmina/src/remmina_init_dialog.h +++ b/remmina/src/remmina_init_dialog.h @@ -45,7 +45,8 @@ G_BEGIN_DECLS #define REMMINA_IS_INIT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), REMMINA_TYPE_INIT_DIALOG)) #define REMMINA_INIT_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), REMMINA_TYPE_INIT_DIALOG, RemminaInitDialogClass)) -enum { +enum +{ REMMINA_INIT_MODE_CONNECTING, REMMINA_INIT_MODE_AUTHPWD, REMMINA_INIT_MODE_AUTHUSERPWD, @@ -54,7 +55,8 @@ enum { REMMINA_INIT_MODE_CERTIFICATE }; -typedef struct _RemminaInitDialog { +typedef struct _RemminaInitDialog +{ GtkDialog dialog; GtkWidget *image; @@ -75,7 +77,8 @@ typedef struct _RemminaInitDialog { gchar *clientkey; } RemminaInitDialog; -typedef struct _RemminaInitDialogClass { +typedef struct _RemminaInitDialogClass +{ GtkDialogClass parent_class; } RemminaInitDialogClass; @@ -88,11 +91,11 @@ void remmina_init_dialog_set_status_temp(RemminaInitDialog *dialog, const gchar /* Run authentication. Return GTK_RESPONSE_OK or GTK_RESPONSE_CANCEL. Caller is blocked. */ gint remmina_init_dialog_authpwd(RemminaInitDialog *dialog, const gchar *label, gboolean allow_save); gint remmina_init_dialog_authuserpwd(RemminaInitDialog *dialog, gboolean want_domain, const gchar *default_username, - const gchar *default_domain, gboolean allow_save); + const gchar *default_domain, gboolean allow_save); gint remmina_init_dialog_certificate(RemminaInitDialog* dialog, const gchar* subject, const gchar* issuer, const gchar* fingerprint); gint remmina_init_dialog_certificate_changed(RemminaInitDialog* dialog, const gchar* subject, const gchar* issuer, const gchar* old_fingerprint, const gchar* new_fingerprint); gint remmina_init_dialog_authx509(RemminaInitDialog *dialog, const gchar *cacert, const gchar *cacrl, const gchar *clientcert, - const gchar *clientkey); + const gchar *clientkey); gint remmina_init_dialog_serverkey_unknown(RemminaInitDialog *dialog, const gchar *serverkey); gint remmina_init_dialog_serverkey_changed(RemminaInitDialog *dialog, const gchar *serverkey); gint remmina_init_dialog_serverkey_confirm(RemminaInitDialog *dialog, const gchar *serverkey, const gchar *prompt); diff --git a/remmina/src/remmina_key_chooser.c b/remmina/src/remmina_key_chooser.c index 64977df5e..2c0726134 100644 --- a/remmina/src/remmina_key_chooser.c +++ b/remmina/src/remmina_key_chooser.c @@ -48,7 +48,7 @@ static gboolean remmina_key_chooser_dialog_on_key_press(GtkWidget *widget, GdkEv arguments->state = event->state; arguments->keyval = gdk_keyval_to_lower(event->keyval); gtk_dialog_response(GTK_DIALOG(gtk_widget_get_toplevel(widget)), - event->keyval == GDK_KEY_Escape ? GTK_RESPONSE_CANCEL : GTK_RESPONSE_OK); + event->keyval == GDK_KEY_Escape ? GTK_RESPONSE_CANCEL : GTK_RESPONSE_OK); } return TRUE; } @@ -69,7 +69,7 @@ RemminaKeyChooserArguments* remmina_key_chooser_new(GtkWindow *parent_window, gb gtk_window_set_transient_for(GTK_WINDOW(dialog), parent_window); /* Connect the GtkEventBox signal */ g_signal_connect(gtk_builder_get_object(builder, "eventbox_key_chooser"), "key-press-event", - G_CALLBACK(remmina_key_chooser_dialog_on_key_press), arguments); + G_CALLBACK(remmina_key_chooser_dialog_on_key_press), arguments); /* Show the dialog and destroy it after the use */ arguments->response = gtk_dialog_run(dialog); gtk_widget_destroy(GTK_WIDGET(dialog)); @@ -88,27 +88,28 @@ gchar* remmina_key_chooser_get_value(guint keyval, guint state) return KEY_CHOOSER_NONE; return g_strdup_printf("%s%s%s%s%s%s%s", - state & GDK_SHIFT_MASK ? KEY_MODIFIER_SHIFT : "", - state & GDK_CONTROL_MASK ? KEY_MODIFIER_CTRL : "", - state & GDK_MOD1_MASK ? KEY_MODIFIER_ALT : "", - state & GDK_SUPER_MASK ? KEY_MODIFIER_SUPER : "", - state & GDK_HYPER_MASK ? KEY_MODIFIER_HYPER : "", - state & GDK_META_MASK ? KEY_MODIFIER_META : "", - gdk_keyval_name(gdk_keyval_to_upper(keyval))); + state & GDK_SHIFT_MASK ? KEY_MODIFIER_SHIFT : "", + state & GDK_CONTROL_MASK ? KEY_MODIFIER_CTRL : "", + state & GDK_MOD1_MASK ? KEY_MODIFIER_ALT : "", + state & GDK_SUPER_MASK ? KEY_MODIFIER_SUPER : "", + state & GDK_HYPER_MASK ? KEY_MODIFIER_HYPER : "", + state & GDK_META_MASK ? KEY_MODIFIER_META : "", + gdk_keyval_name(gdk_keyval_to_upper(keyval))); } /* Get the keyval of a (lowercase) character value */ guint remmina_key_chooser_get_keyval(const gchar *value) { TRACE_CALL("remmina_key_chooser_get_keyval"); - gchar *patterns[] = { - KEY_MODIFIER_SHIFT, - KEY_MODIFIER_CTRL, - KEY_MODIFIER_ALT, - KEY_MODIFIER_SUPER, - KEY_MODIFIER_HYPER, - KEY_MODIFIER_META, - NULL + gchar *patterns[] = + { + KEY_MODIFIER_SHIFT, + KEY_MODIFIER_CTRL, + KEY_MODIFIER_ALT, + KEY_MODIFIER_SUPER, + KEY_MODIFIER_HYPER, + KEY_MODIFIER_META, + NULL }; gint i; gchar *tmpvalue; @@ -117,7 +118,7 @@ guint remmina_key_chooser_get_keyval(const gchar *value) if (g_strcmp0(value, KEY_CHOOSER_NONE) == 0) return 0; - + /* Remove any modifier text before to get the keyval */ newvalue = g_strdup(value); for (i = 0; i < g_strv_length(patterns); i++) diff --git a/remmina/src/remmina_key_chooser.h b/remmina/src/remmina_key_chooser.h index fd65d5bf0..1603bc2ec 100644 --- a/remmina/src/remmina_key_chooser.h +++ b/remmina/src/remmina_key_chooser.h @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2010 Vic Lee + * Copyright (C) 2010 Vic Lee * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give diff --git a/remmina/src/remmina_log.c b/remmina/src/remmina_log.c index 7160206a3..c08a3b0a1 100644 --- a/remmina/src/remmina_log.c +++ b/remmina/src/remmina_log.c @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2010 Vic Lee + * Copyright (C) 2010 Vic Lee * Copyright (C) 2014-2015 Antenore Gatta, Fabio Castelli, Giovanni Panozzo * * This program is free software; you can redistribute it and/or modify @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give @@ -139,7 +139,7 @@ static gboolean remmina_log_scroll_to_end(gpointer data) { gtk_text_buffer_get_end_iter(REMMINA_LOG_WINDOW (log_window)->log_buffer, &iter); gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(REMMINA_LOG_WINDOW (log_window)->log_view), &iter, 0.0, FALSE, 0.0, - 0.0); + 0.0); } return FALSE; } diff --git a/remmina/src/remmina_log.h b/remmina/src/remmina_log.h index 41d3ef411..3390896ca 100644 --- a/remmina/src/remmina_log.h +++ b/remmina/src/remmina_log.h @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2010 Vic Lee + * Copyright (C) 2010 Vic Lee * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give diff --git a/remmina/src/remmina_main.c b/remmina/src/remmina_main.c index 23fe0defd..9d250ea45 100644 --- a/remmina/src/remmina_main.c +++ b/remmina/src/remmina_main.c @@ -68,7 +68,8 @@ static GtkTargetEntry remmina_drop_types[] = { "text/uri-list", 0, 1 } }; -static char *quick_connect_plugin_list[] = { +static char *quick_connect_plugin_list[] = +{ "RDP", "VNC", "SSH", "NX" }; @@ -112,7 +113,7 @@ static void remmina_main_save_expanded_group(void) } remminamain->priv->expanded_group = remmina_string_array_new(); gtk_tree_view_map_expanded_rows(remminamain->tree_files_list, - (GtkTreeViewMappingFunc) remmina_main_save_expanded_group_func, NULL); + (GtkTreeViewMappingFunc) remmina_main_save_expanded_group_func, NULL); } } @@ -155,7 +156,7 @@ static void remmina_main_clear_selection_data(void) } static gboolean remmina_main_selection_func(GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path, - gboolean path_currently_selected, gpointer user_data) + gboolean path_currently_selected, gpointer user_data) { TRACE_CALL("remmina_main_selection_func"); guint context_id; @@ -171,7 +172,7 @@ static gboolean remmina_main_selection_func(GtkTreeSelection *selection, GtkTree remmina_main_clear_selection_data(); gtk_tree_model_get(model, &iter, NAME_COLUMN, &remminamain->priv->selected_name, FILENAME_COLUMN, - &remminamain->priv->selected_filename, -1); + &remminamain->priv->selected_filename, -1); context_id = gtk_statusbar_get_context_id(remminamain->statusbar_main, "status"); gtk_statusbar_pop(remminamain->statusbar_main, context_id); @@ -202,11 +203,11 @@ static void remmina_main_load_file_list_callback(RemminaFile *remminafile, gpoin gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, PROTOCOL_COLUMN, - remmina_file_get_icon_name(remminafile), NAME_COLUMN, - remmina_file_get_string(remminafile, "name"), GROUP_COLUMN, - remmina_file_get_string(remminafile, "group"), SERVER_COLUMN, - remmina_file_get_string(remminafile, "server"), FILENAME_COLUMN, remmina_file_get_filename(remminafile), - -1); + remmina_file_get_icon_name(remminafile), NAME_COLUMN, + remmina_file_get_string(remminafile, "name"), GROUP_COLUMN, + remmina_file_get_string(remminafile, "group"), SERVER_COLUMN, + remmina_file_get_string(remminafile, "server"), FILENAME_COLUMN, remmina_file_get_filename(remminafile), + -1); } static gboolean remmina_main_load_file_tree_traverse(GNode *node, GtkTreeStore *store, GtkTreeIter *parent) @@ -223,11 +224,11 @@ static gboolean remmina_main_load_file_tree_traverse(GNode *node, GtkTreeStore * iter = g_new0(GtkTreeIter, 1); gtk_tree_store_append(store, iter, parent); gtk_tree_store_set(store, iter, - PROTOCOL_COLUMN, "folder", - NAME_COLUMN, data->name, - GROUP_COLUMN, data->group, - FILENAME_COLUMN, NULL, - -1); + PROTOCOL_COLUMN, "folder", + NAME_COLUMN, data->name, + GROUP_COLUMN, data->group, + FILENAME_COLUMN, NULL, + -1); } for (child = g_node_first_child(node); child; child = g_node_next_sibling(child)) { @@ -336,17 +337,17 @@ static void remmina_main_load_file_tree_callback(RemminaFile *remminafile, gpoin if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter)) { found = remmina_main_load_file_tree_find(GTK_TREE_MODEL(store), &iter, - remmina_file_get_string(remminafile, "group")); + remmina_file_get_string(remminafile, "group")); } gtk_tree_store_append(store, &child, (found ? &iter : NULL)); gtk_tree_store_set(store, &child, - PROTOCOL_COLUMN, remmina_file_get_icon_name(remminafile), - NAME_COLUMN, remmina_file_get_string(remminafile, "name"), - GROUP_COLUMN, remmina_file_get_string(remminafile, "group"), - SERVER_COLUMN, remmina_file_get_string(remminafile, "server"), - FILENAME_COLUMN, remmina_file_get_filename(remminafile), - -1); + PROTOCOL_COLUMN, remmina_file_get_icon_name(remminafile), + NAME_COLUMN, remmina_file_get_string(remminafile, "name"), + GROUP_COLUMN, remmina_file_get_string(remminafile, "group"), + SERVER_COLUMN, remmina_file_get_string(remminafile, "server"), + FILENAME_COLUMN, remmina_file_get_filename(remminafile), + -1); } static void remmina_main_file_model_on_sort(GtkTreeSortable *sortable, gpointer user_data) @@ -375,11 +376,11 @@ static gboolean remmina_main_filter_visible_func(GtkTreeModel *model, GtkTreeIte if (text && text[0]) { gtk_tree_model_get(model, iter, - PROTOCOL_COLUMN, &protocol, - NAME_COLUMN, &name, - GROUP_COLUMN, &group, - SERVER_COLUMN, &server, - -1); + PROTOCOL_COLUMN, &protocol, + NAME_COLUMN, &name, + GROUP_COLUMN, &group, + SERVER_COLUMN, &server, + -1); if (g_strcmp0(protocol, "folder") != 0) { s = g_ascii_strdown(name ? name : "", -1); @@ -421,7 +422,7 @@ static void remmina_main_select_file(const gchar *filename) if (cmp == 0) { gtk_tree_selection_select_iter(gtk_tree_view_get_selection(remminamain->tree_files_list), - &iter); + &iter); path = gtk_tree_model_get_path(remminamain->priv->file_model_sort, &iter); gtk_tree_view_scroll_to_cell(remminamain->tree_files_list, path, NULL, TRUE, 0.5, 0.0); gtk_tree_path_free(path); @@ -446,43 +447,43 @@ static void remmina_main_load_files(gboolean refresh) switch (remmina_pref.view_file_mode) { - case REMMINA_VIEW_FILE_TREE: - /* Hide the Group column in the tree view mode */ - gtk_tree_view_column_set_visible(remminamain->column_files_list_group, FALSE); - /* Use the TreeStore model to store data */ - remminamain->priv->file_model = GTK_TREE_MODEL(remminamain->treestore_files_list); - /* Clear any previous data in the model */ - gtk_tree_store_clear(GTK_TREE_STORE(remminamain->priv->file_model)); - /* Load groups first */ - remmina_main_load_file_tree_group(GTK_TREE_STORE(remminamain->priv->file_model)); - /* Load files list */ - items_count = remmina_file_manager_iterate((GFunc) remmina_main_load_file_tree_callback, NULL); - break; - - case REMMINA_VIEW_FILE_LIST: - default: - /* Show the Group column in the list view mode */ - gtk_tree_view_column_set_visible(remminamain->column_files_list_group, TRUE); - /* Use the ListStore model to store data */ - remminamain->priv->file_model = GTK_TREE_MODEL(remminamain->liststore_files_list); - /* Clear any previous data in the model */ - gtk_list_store_clear(GTK_LIST_STORE(remminamain->priv->file_model)); - /* Load files list */ - items_count = remmina_file_manager_iterate((GFunc) remmina_main_load_file_list_callback, NULL); - break; + case REMMINA_VIEW_FILE_TREE: + /* Hide the Group column in the tree view mode */ + gtk_tree_view_column_set_visible(remminamain->column_files_list_group, FALSE); + /* Use the TreeStore model to store data */ + remminamain->priv->file_model = GTK_TREE_MODEL(remminamain->treestore_files_list); + /* Clear any previous data in the model */ + gtk_tree_store_clear(GTK_TREE_STORE(remminamain->priv->file_model)); + /* Load groups first */ + remmina_main_load_file_tree_group(GTK_TREE_STORE(remminamain->priv->file_model)); + /* Load files list */ + items_count = remmina_file_manager_iterate((GFunc) remmina_main_load_file_tree_callback, NULL); + break; + + case REMMINA_VIEW_FILE_LIST: + default: + /* Show the Group column in the list view mode */ + gtk_tree_view_column_set_visible(remminamain->column_files_list_group, TRUE); + /* Use the ListStore model to store data */ + remminamain->priv->file_model = GTK_TREE_MODEL(remminamain->liststore_files_list); + /* Clear any previous data in the model */ + gtk_list_store_clear(GTK_LIST_STORE(remminamain->priv->file_model)); + /* Load files list */ + items_count = remmina_file_manager_iterate((GFunc) remmina_main_load_file_list_callback, NULL); + break; } /* Apply sorted filtered model to the TreeView */ remminamain->priv->file_model_filter = gtk_tree_model_filter_new(remminamain->priv->file_model, NULL); gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(remminamain->priv->file_model_filter), - (GtkTreeModelFilterVisibleFunc) remmina_main_filter_visible_func, NULL, NULL); + (GtkTreeModelFilterVisibleFunc) remmina_main_filter_visible_func, NULL, NULL); remminamain->priv->file_model_sort = gtk_tree_model_sort_new_with_model(remminamain->priv->file_model_filter); gtk_tree_view_set_model(remminamain->tree_files_list, remminamain->priv->file_model_sort); gtk_tree_sortable_set_sort_column_id( - GTK_TREE_SORTABLE(remminamain->priv->file_model_sort), - remmina_pref.main_sort_column_id, - remmina_pref.main_sort_order); + GTK_TREE_SORTABLE(remminamain->priv->file_model_sort), + remmina_pref.main_sort_column_id, + remmina_pref.main_sort_order); g_signal_connect(G_OBJECT(remminamain->priv->file_model_sort), "sort-column-changed", - G_CALLBACK(remmina_main_file_model_on_sort), NULL); + G_CALLBACK(remmina_main_file_model_on_sort), NULL); remmina_main_expand_group(); /* Select the file previously selected */ if (remminamain->priv->selected_filename) @@ -574,7 +575,7 @@ void remmina_main_on_action_connection_delete(GtkAction *action, gpointer user_d return; dialog = gtk_message_dialog_new(remminamain->window, GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, - _("Are you sure to delete '%s'"), remminamain->priv->selected_name); + _("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); @@ -780,7 +781,7 @@ static void remmina_main_import_file_list(GSList *files) if (err->len > 0) { dlg = gtk_message_dialog_new(remminamain->window, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - _("Unable to import:\n%s"), err->str); + _("Unable to import:\n%s"), err->str); g_signal_connect(G_OBJECT(dlg), "response", G_CALLBACK(gtk_widget_destroy), NULL); gtk_widget_show(dlg); } @@ -810,7 +811,7 @@ void remmina_main_on_action_tools_import(GtkAction *action, gpointer user_data) GtkWidget *dialog; dialog = gtk_file_chooser_dialog_new(_("Import"), remminamain->window, GTK_FILE_CHOOSER_ACTION_OPEN, "document-open", - GTK_RESPONSE_ACCEPT, NULL); + GTK_RESPONSE_ACCEPT, NULL); gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), TRUE); g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(remmina_main_action_tools_import_on_response), NULL); gtk_widget_show(dialog); @@ -833,7 +834,7 @@ void remmina_main_on_action_tools_export(GtkAction *action, gpointer user_data) if (plugin) { dialog = gtk_file_chooser_dialog_new(plugin->export_hints, remminamain->window, - GTK_FILE_CHOOSER_ACTION_SAVE, _("_Save"), GTK_RESPONSE_ACCEPT, NULL); + GTK_FILE_CHOOSER_ACTION_SAVE, _("_Save"), GTK_RESPONSE_ACCEPT, NULL); if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { plugin->export_func(remminafile, gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog))); @@ -843,7 +844,7 @@ void remmina_main_on_action_tools_export(GtkAction *action, gpointer user_data) else { dialog = gtk_message_dialog_new(remminamain->window, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - _("This protocol does not support exporting.")); + _("This protocol does not support exporting.")); g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(gtk_widget_destroy), NULL); gtk_widget_show(dialog); } @@ -893,7 +894,7 @@ static gboolean remmina_main_quickconnect(void) remmina_file_set_string(remminafile, "server", server); remmina_file_set_string(remminafile, "name", server); remmina_file_set_string(remminafile, "protocol", - gtk_combo_box_text_get_active_text(remminamain->combo_quick_connect_protocol)); + gtk_combo_box_text_get_active_text(remminamain->combo_quick_connect_protocol)); remmina_connection_window_open_from_file(remminafile); @@ -915,13 +916,13 @@ void remmina_main_file_list_on_row_activated(GtkTreeView *tree, GtkTreePath *pat { switch (remmina_pref.default_action) { - case REMMINA_ACTION_EDIT: - remmina_main_on_action_connection_edit(NULL, NULL); - break; - case REMMINA_ACTION_CONNECT: - default: - remmina_main_on_action_connection_connect(NULL, NULL); - break; + case REMMINA_ACTION_EDIT: + remmina_main_on_action_connection_edit(NULL, NULL); + break; + case REMMINA_ACTION_CONNECT: + default: + remmina_main_on_action_connection_connect(NULL, NULL); + break; } } } @@ -962,13 +963,13 @@ void remmina_main_quick_search_on_changed(GtkEditable *editable, gpointer user_d TRACE_CALL("remmina_main_quick_search_on_changed"); /* If a search text was input then temporary set the file mode to list */ remmina_pref.view_file_mode = gtk_entry_get_text_length(remminamain->entry_quick_search) ? - REMMINA_VIEW_FILE_LIST : remminamain->priv->previous_file_mode; + REMMINA_VIEW_FILE_LIST : remminamain->priv->previous_file_mode; remmina_main_load_files(FALSE); gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(remminamain->priv->file_model_filter)); } void remmina_main_on_drag_data_received(GtkWidget *widget, GdkDragContext *drag_context, gint x, gint y, - GtkSelectionData *data, guint info, guint time, gpointer user_data) + GtkSelectionData *data, guint info, guint time, gpointer user_data) { TRACE_CALL("remmina_main_on_drag_data_received"); gchar **uris; @@ -1024,7 +1025,7 @@ static void remmina_main_init(void) remmina_plugin_manager_for_each_plugin(REMMINA_PLUGIN_TYPE_TOOL, remmina_main_add_tool_plugin, remminamain); /* Add available quick connect protocols to remminamain->combo_quick_connect_protocol */ - for(i=0;ibutton_quick_connect)); /* Set the TreeView for the files list */ gtk_tree_selection_set_select_function( - gtk_tree_view_get_selection(remminamain->tree_files_list), - remmina_main_selection_func, NULL, NULL); + gtk_tree_view_get_selection(remminamain->tree_files_list), + remmina_main_selection_func, NULL, NULL); /* Load the files list */ remmina_main_load_files(FALSE); /* Load the preferences */ diff --git a/remmina/src/remmina_marshals.c b/remmina/src/remmina_marshals.c index cf5fb00fd..c3f203a29 100644 --- a/remmina/src/remmina_marshals.c +++ b/remmina/src/remmina_marshals.c @@ -84,83 +84,83 @@ /* BOOLEAN:INT (remminamarshals.list:4) */ void remmina_marshal_BOOLEAN__INT (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) { TRACE_CALL("remmina_marshal_BOOLEAN__INT"); - typedef gboolean (*GMarshalFunc_BOOLEAN__INT) (gpointer data1, - gint arg_1, - gpointer data2); - register GMarshalFunc_BOOLEAN__INT callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - gboolean v_return; + typedef gboolean (*GMarshalFunc_BOOLEAN__INT) (gpointer data1, + gint arg_1, + gpointer data2); + register GMarshalFunc_BOOLEAN__INT callback; + register GCClosure *cc = (GCClosure*) closure; + register gpointer data1, data2; + gboolean v_return; - g_return_if_fail (return_value != NULL); - g_return_if_fail (n_param_values == 2); + g_return_if_fail (return_value != NULL); + g_return_if_fail (n_param_values == 2); - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_BOOLEAN__INT) (marshal_data ? marshal_data : cc->callback); + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__INT) (marshal_data ? marshal_data : cc->callback); - v_return = callback (data1, - g_marshal_value_peek_int(param_values + 1) -, -data2); + v_return = callback (data1, + g_marshal_value_peek_int(param_values + 1) + , + data2); -g_value_set_boolean (return_value, v_return); + g_value_set_boolean (return_value, v_return); } /* BOOLEAN:INT,STRING (remminamarshals.list:5) */ void remmina_marshal_BOOLEAN__INT_STRING (GClosure *closure, -GValue *return_value G_GNUC_UNUSED, -guint n_param_values, -const GValue *param_values, -gpointer invocation_hint G_GNUC_UNUSED, -gpointer marshal_data) + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) { TRACE_CALL("remmina_marshal_BOOLEAN__INT_STRING"); -typedef gboolean (*GMarshalFunc_BOOLEAN__INT_STRING) (gpointer data1, -gint arg_1, -gpointer arg_2, -gpointer data2); -register GMarshalFunc_BOOLEAN__INT_STRING callback; -register GCClosure *cc = (GCClosure*) closure; -register gpointer data1, data2; -gboolean v_return; + typedef gboolean (*GMarshalFunc_BOOLEAN__INT_STRING) (gpointer data1, + gint arg_1, + gpointer arg_2, + gpointer data2); + register GMarshalFunc_BOOLEAN__INT_STRING callback; + register GCClosure *cc = (GCClosure*) closure; + register gpointer data1, data2; + gboolean v_return; -g_return_if_fail (return_value != NULL); -g_return_if_fail (n_param_values == 3); + g_return_if_fail (return_value != NULL); + g_return_if_fail (n_param_values == 3); -if (G_CCLOSURE_SWAP_DATA (closure)) -{ - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); -} -else -{ - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; -} -callback = (GMarshalFunc_BOOLEAN__INT_STRING) (marshal_data ? marshal_data : cc->callback); + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__INT_STRING) (marshal_data ? marshal_data : cc->callback); -v_return = callback (data1, -g_marshal_value_peek_int (param_values + 1), -g_marshal_value_peek_string (param_values + 2), -data2); + v_return = callback (data1, + g_marshal_value_peek_int (param_values + 1), + g_marshal_value_peek_string (param_values + 2), + data2); -g_value_set_boolean (return_value, v_return); + g_value_set_boolean (return_value, v_return); } diff --git a/remmina/src/remmina_marshals.h b/remmina/src/remmina_marshals.h index 4a25e6e1d..4ca2e452e 100644 --- a/remmina/src/remmina_marshals.h +++ b/remmina/src/remmina_marshals.h @@ -7,11 +7,11 @@ G_BEGIN_DECLS /* BOOLEAN:INT (remminamarshals.list:4) */ extern void remmina_marshal_BOOLEAN__INT(GClosure *closure, GValue *return_value, guint n_param_values, - const GValue *param_values, gpointer invocation_hint, gpointer marshal_data); + const GValue *param_values, gpointer invocation_hint, gpointer marshal_data); /* BOOLEAN:INT,STRING (remminamarshals.list:5) */ extern void remmina_marshal_BOOLEAN__INT_STRING(GClosure *closure, GValue *return_value, guint n_param_values, - const GValue *param_values, gpointer invocation_hint, gpointer marshal_data); + const GValue *param_values, gpointer invocation_hint, gpointer marshal_data); G_END_DECLS diff --git a/remmina/src/remmina_masterthread_exec.c b/remmina/src/remmina_masterthread_exec.c index 12d6bf1d4..3f269e7ee 100644 --- a/remmina/src/remmina_masterthread_exec.c +++ b/remmina/src/remmina_masterthread_exec.c @@ -51,67 +51,71 @@ static gboolean remmina_masterthread_exec_callback(RemminaMTExecData *d) /* This function is called on main GTK Thread via gdk_threads_add_idlde() * from remmina_masterthread_exec_and_wait() */ - if (!d->cancelled) { - switch(d->func) { - case FUNC_INIT_SAVE_CRED: - remmina_protocol_widget_init_save_cred(d->p.init_save_creds.gp); - break; - 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 ); - break; - case FUNC_DIALOG_SERVERKEY_CONFIRM: - d->p.dialog_serverkey_confirm.retval = remmina_init_dialog_serverkey_confirm( d->p.dialog_serverkey_confirm.dialog, - d->p.dialog_serverkey_confirm.serverkey, d->p.dialog_serverkey_confirm.prompt ); - break; - case FUNC_DIALOG_AUTHPWD: - d->p.dialog_authpwd.retval = remmina_init_dialog_authpwd(d->p.dialog_authpwd.dialog, - d->p.dialog_authpwd.label, d->p.dialog_authpwd.allow_save); - break; - case FUNC_GTK_LABEL_SET_TEXT: - gtk_label_set_text( d->p.gtk_label_set_text.label, d->p.gtk_label_set_text.str ); - break; - case FUNC_DIALOG_AUTHUSERPWD: - d->p.dialog_authuserpwd.retval = remmina_init_dialog_authuserpwd( d->p.dialog_authuserpwd.dialog, - d->p.dialog_authuserpwd.want_domain, d->p.dialog_authuserpwd.default_username, - d->p.dialog_authuserpwd.default_domain, d->p.dialog_authuserpwd.allow_save ); - break; - case FUNC_DIALOG_CERT: - d->p.dialog_certificate.retval = remmina_init_dialog_certificate( d->p.dialog_certificate.dialog, - d->p.dialog_certificate.subject, d->p.dialog_certificate.issuer, d->p.dialog_certificate.fingerprint ); - break; - case FUNC_DIALOG_CERTCHANGED: - d->p.dialog_certchanged.retval = remmina_init_dialog_certificate_changed( d->p.dialog_certchanged.dialog, - d->p.dialog_certchanged.subject, d->p.dialog_certchanged.issuer, d->p.dialog_certchanged.new_fingerprint, - d->p.dialog_certchanged.old_fingerprint ); - break; - case FUNC_DIALOG_AUTHX509: - d->p.dialog_authx509.retval = remmina_init_dialog_authx509( d->p.dialog_authx509.dialog, d->p.dialog_authx509.cacert, - d->p.dialog_authx509.cacrl, d->p.dialog_authx509.clientcert, d->p.dialog_authx509.clientkey ); - break; - case FUNC_FTP_CLIENT_UPDATE_TASK: - remmina_ftp_client_update_task( d->p.ftp_client_update_task.client, d->p.ftp_client_update_task.task ); - break; - case FUNC_FTP_CLIENT_GET_WAITING_TASK: - d->p.ftp_client_get_waiting_task.retval = remmina_ftp_client_get_waiting_task( d->p.ftp_client_get_waiting_task.client ); - break; - case FUNC_SFTP_CLIENT_CONFIRM_RESUME: + if (!d->cancelled) + { + switch(d->func) + { + case FUNC_INIT_SAVE_CRED: + remmina_protocol_widget_init_save_cred(d->p.init_save_creds.gp); + break; + 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 ); + break; + case FUNC_DIALOG_SERVERKEY_CONFIRM: + d->p.dialog_serverkey_confirm.retval = remmina_init_dialog_serverkey_confirm( d->p.dialog_serverkey_confirm.dialog, + d->p.dialog_serverkey_confirm.serverkey, d->p.dialog_serverkey_confirm.prompt ); + break; + case FUNC_DIALOG_AUTHPWD: + d->p.dialog_authpwd.retval = remmina_init_dialog_authpwd(d->p.dialog_authpwd.dialog, + d->p.dialog_authpwd.label, d->p.dialog_authpwd.allow_save); + break; + case FUNC_GTK_LABEL_SET_TEXT: + gtk_label_set_text( d->p.gtk_label_set_text.label, d->p.gtk_label_set_text.str ); + break; + case FUNC_DIALOG_AUTHUSERPWD: + d->p.dialog_authuserpwd.retval = remmina_init_dialog_authuserpwd( d->p.dialog_authuserpwd.dialog, + d->p.dialog_authuserpwd.want_domain, d->p.dialog_authuserpwd.default_username, + d->p.dialog_authuserpwd.default_domain, d->p.dialog_authuserpwd.allow_save ); + break; + case FUNC_DIALOG_CERT: + d->p.dialog_certificate.retval = remmina_init_dialog_certificate( d->p.dialog_certificate.dialog, + d->p.dialog_certificate.subject, d->p.dialog_certificate.issuer, d->p.dialog_certificate.fingerprint ); + break; + case FUNC_DIALOG_CERTCHANGED: + d->p.dialog_certchanged.retval = remmina_init_dialog_certificate_changed( d->p.dialog_certchanged.dialog, + d->p.dialog_certchanged.subject, d->p.dialog_certchanged.issuer, d->p.dialog_certchanged.new_fingerprint, + d->p.dialog_certchanged.old_fingerprint ); + break; + case FUNC_DIALOG_AUTHX509: + d->p.dialog_authx509.retval = remmina_init_dialog_authx509( d->p.dialog_authx509.dialog, d->p.dialog_authx509.cacert, + d->p.dialog_authx509.cacrl, d->p.dialog_authx509.clientcert, d->p.dialog_authx509.clientkey ); + break; + case FUNC_FTP_CLIENT_UPDATE_TASK: + remmina_ftp_client_update_task( d->p.ftp_client_update_task.client, d->p.ftp_client_update_task.task ); + break; + case FUNC_FTP_CLIENT_GET_WAITING_TASK: + d->p.ftp_client_get_waiting_task.retval = remmina_ftp_client_get_waiting_task( d->p.ftp_client_get_waiting_task.client ); + break; + case FUNC_SFTP_CLIENT_CONFIRM_RESUME: #ifdef HAVE_LIBSSH - d->p.sftp_client_confirm_resume.retval = remmina_sftp_client_confirm_resume( d->p.sftp_client_confirm_resume.client, - d->p.sftp_client_confirm_resume.path ); + d->p.sftp_client_confirm_resume.retval = remmina_sftp_client_confirm_resume( d->p.sftp_client_confirm_resume.client, + d->p.sftp_client_confirm_resume.path ); #endif - break; - case FUNC_VTE_TERMINAL_SET_ENCODING_AND_PTY: + break; + case FUNC_VTE_TERMINAL_SET_ENCODING_AND_PTY: #if defined (HAVE_LIBSSH) && defined (HAVE_LIBVTE) - remmina_plugin_ssh_vte_terminal_set_encoding_and_pty( d->p.vte_terminal_set_encoding_and_pty.terminal, - d->p.vte_terminal_set_encoding_and_pty.codeset, d->p.vte_terminal_set_encoding_and_pty.slave ); + remmina_plugin_ssh_vte_terminal_set_encoding_and_pty( d->p.vte_terminal_set_encoding_and_pty.terminal, + d->p.vte_terminal_set_encoding_and_pty.codeset, d->p.vte_terminal_set_encoding_and_pty.slave ); #endif - break; + break; } pthread_mutex_unlock(&d->mu); - } else { + } + else + { /* thread has been cancelled, so we must free d memory here */ g_free(d); } @@ -136,12 +140,14 @@ void remmina_masterthread_exec_and_wait(RemminaMTExecData *d) pthread_mutex_destroy(&d->mu); } -void remmina_masterthread_exec_save_main_thread_id() { +void remmina_masterthread_exec_save_main_thread_id() +{ /* To be called from main thread at startup */ gMainThreadID = pthread_self(); } -gboolean remmina_masterthread_exec_is_main_thread() { +gboolean remmina_masterthread_exec_is_main_thread() +{ return pthread_equal(gMainThreadID, pthread_self()) != 0; } diff --git a/remmina/src/remmina_masterthread_exec.h b/remmina/src/remmina_masterthread_exec.h index 545fa1e85..3bb47ea6a 100644 --- a/remmina/src/remmina_masterthread_exec.h +++ b/remmina/src/remmina_masterthread_exec.h @@ -40,46 +40,56 @@ #include "remmina_ftp_client.h" #include "remmina_ssh_plugin.h" -typedef struct remmina_masterthread_exec_data { +typedef struct remmina_masterthread_exec_data +{ enum { FUNC_GTK_LABEL_SET_TEXT, - FUNC_INIT_SAVE_CRED, FUNC_CHAT_RECEIVE, FUNC_FILE_GET_SECRET, - 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, - FUNC_SFTP_CLIENT_CONFIRM_RESUME, - FUNC_VTE_TERMINAL_SET_ENCODING_AND_PTY } func; + FUNC_INIT_SAVE_CRED, FUNC_CHAT_RECEIVE, FUNC_FILE_GET_SECRET, + 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, + FUNC_SFTP_CLIENT_CONFIRM_RESUME, + FUNC_VTE_TERMINAL_SET_ENCODING_AND_PTY + } func; - union { - struct { + union + { + struct + { GtkLabel *label; const gchar *str; } gtk_label_set_text; - struct { + struct + { RemminaProtocolWidget* gp; } init_save_creds; - struct { + struct + { RemminaProtocolWidget* gp; const gchar *text; } chat_receive; - struct { + struct + { RemminaFile *remminafile; const gchar *setting; gchar* retval; } file_get_secret; - struct { + struct + { RemminaInitDialog *dialog; const gchar *serverkey; const gchar *prompt; gint retval; } dialog_serverkey_confirm; - struct { + struct + { RemminaInitDialog *dialog; gboolean allow_save; const gchar *label; gint retval; } dialog_authpwd; - struct { + struct + { RemminaInitDialog *dialog; gboolean want_domain; gboolean allow_save; @@ -87,14 +97,16 @@ typedef struct remmina_masterthread_exec_data { const gchar *default_domain; gint retval; } dialog_authuserpwd; - struct { + struct + { RemminaInitDialog *dialog; const gchar* subject; const gchar* issuer; const gchar* fingerprint; gint retval; } dialog_certificate; - struct { + struct + { RemminaInitDialog *dialog; const gchar* subject; const gchar* issuer; @@ -102,7 +114,8 @@ typedef struct remmina_masterthread_exec_data { const gchar* old_fingerprint; gint retval; } dialog_certchanged; - struct { + struct + { RemminaInitDialog *dialog; const gchar *cacert; const gchar *cacrl; @@ -110,23 +123,27 @@ typedef struct remmina_masterthread_exec_data { const gchar *clientkey; gint retval; } dialog_authx509; - struct { + struct + { RemminaFTPClient *client; RemminaFTPTask* task; } ftp_client_update_task; - struct { + struct + { RemminaFTPClient *client; RemminaFTPTask* retval; } ftp_client_get_waiting_task; #if defined (HAVE_LIBSSH) && defined (HAVE_LIBVTE) - struct { + struct + { RemminaSFTPClient *client; const gchar *path; gint retval; } sftp_client_confirm_resume; #endif #ifdef HAVE_LIBVTE - struct { + struct + { VteTerminal *terminal; const char *codeset; int slave; diff --git a/remmina/src/remmina_plugin_manager.c b/remmina/src/remmina_plugin_manager.c index 6461cec15..8b9d9f58b 100644 --- a/remmina/src/remmina_plugin_manager.c +++ b/remmina/src/remmina_plugin_manager.c @@ -71,7 +71,7 @@ static gboolean remmina_plugin_manager_register_plugin(RemminaPlugin *plugin) if (remmina_secret_plugin) { g_print("Remmina plugin %s (type=%s) bypassed.\n", plugin->name, - _(remmina_plugin_type_name[plugin->type])); + _(remmina_plugin_type_name[plugin->type])); return FALSE; } remmina_secret_plugin = (RemminaSecretPlugin*) plugin; @@ -84,73 +84,73 @@ static gboolean remmina_plugin_manager_register_plugin(RemminaPlugin *plugin) RemminaPluginService remmina_plugin_manager_service = { - remmina_plugin_manager_register_plugin, - remmina_protocol_widget_get_width, - remmina_protocol_widget_set_width, - remmina_protocol_widget_get_height, - remmina_protocol_widget_set_height, - remmina_protocol_widget_get_scale, - remmina_protocol_widget_get_expand, - remmina_protocol_widget_set_expand, - remmina_protocol_widget_has_error, - remmina_protocol_widget_set_error, - remmina_protocol_widget_is_closed, - remmina_protocol_widget_get_file, - remmina_protocol_widget_emit_signal, - remmina_protocol_widget_register_hostkey, - remmina_protocol_widget_start_direct_tunnel, - remmina_protocol_widget_start_reverse_tunnel, - remmina_protocol_widget_start_xport_tunnel, - remmina_protocol_widget_set_display, - remmina_protocol_widget_close_connection, - remmina_protocol_widget_init_authpwd, - remmina_protocol_widget_init_authuserpwd, - remmina_protocol_widget_init_certificate, - remmina_protocol_widget_changed_certificate, - remmina_protocol_widget_init_get_username, - remmina_protocol_widget_init_get_password, - remmina_protocol_widget_init_get_domain, - remmina_protocol_widget_init_get_savepassword, - remmina_protocol_widget_init_authx509, - remmina_protocol_widget_init_get_cacert, - remmina_protocol_widget_init_get_cacrl, - remmina_protocol_widget_init_get_clientcert, - remmina_protocol_widget_init_get_clientkey, - remmina_protocol_widget_init_save_cred, - remmina_protocol_widget_init_show_listen, - remmina_protocol_widget_init_show_retry, - remmina_protocol_widget_init_show, - remmina_protocol_widget_init_hide, - remmina_protocol_widget_ssh_exec, - remmina_protocol_widget_chat_open, - remmina_protocol_widget_chat_close, - remmina_protocol_widget_chat_receive, - remmina_protocol_widget_send_keys_signals, - - remmina_file_new, - remmina_file_get_filename, - remmina_file_set_string, - remmina_file_get_string, - remmina_file_get_secret, - remmina_file_set_int, - remmina_file_get_int, - remmina_file_unsave_password, - - remmina_pref_set_value, - remmina_pref_get_value, - remmina_pref_get_scale_quality, - remmina_pref_get_sshtunnel_port, - remmina_pref_get_ssh_loglevel, - remmina_pref_keymap_get_keyval, - - remmina_log_print, - remmina_log_printf, - - remmina_widget_pool_register, - - remmina_connection_window_open_from_file_full, - remmina_public_get_server_port, - remmina_masterthread_exec_is_main_thread + remmina_plugin_manager_register_plugin, + remmina_protocol_widget_get_width, + remmina_protocol_widget_set_width, + remmina_protocol_widget_get_height, + remmina_protocol_widget_set_height, + remmina_protocol_widget_get_scale, + remmina_protocol_widget_get_expand, + remmina_protocol_widget_set_expand, + remmina_protocol_widget_has_error, + remmina_protocol_widget_set_error, + remmina_protocol_widget_is_closed, + remmina_protocol_widget_get_file, + remmina_protocol_widget_emit_signal, + remmina_protocol_widget_register_hostkey, + remmina_protocol_widget_start_direct_tunnel, + remmina_protocol_widget_start_reverse_tunnel, + remmina_protocol_widget_start_xport_tunnel, + remmina_protocol_widget_set_display, + remmina_protocol_widget_close_connection, + remmina_protocol_widget_init_authpwd, + remmina_protocol_widget_init_authuserpwd, + remmina_protocol_widget_init_certificate, + remmina_protocol_widget_changed_certificate, + remmina_protocol_widget_init_get_username, + remmina_protocol_widget_init_get_password, + remmina_protocol_widget_init_get_domain, + remmina_protocol_widget_init_get_savepassword, + remmina_protocol_widget_init_authx509, + remmina_protocol_widget_init_get_cacert, + remmina_protocol_widget_init_get_cacrl, + remmina_protocol_widget_init_get_clientcert, + remmina_protocol_widget_init_get_clientkey, + remmina_protocol_widget_init_save_cred, + remmina_protocol_widget_init_show_listen, + remmina_protocol_widget_init_show_retry, + remmina_protocol_widget_init_show, + remmina_protocol_widget_init_hide, + remmina_protocol_widget_ssh_exec, + remmina_protocol_widget_chat_open, + remmina_protocol_widget_chat_close, + remmina_protocol_widget_chat_receive, + remmina_protocol_widget_send_keys_signals, + + remmina_file_new, + remmina_file_get_filename, + remmina_file_set_string, + remmina_file_get_string, + remmina_file_get_secret, + remmina_file_set_int, + remmina_file_get_int, + remmina_file_unsave_password, + + remmina_pref_set_value, + remmina_pref_get_value, + remmina_pref_get_scale_quality, + remmina_pref_get_sshtunnel_port, + remmina_pref_get_ssh_loglevel, + remmina_pref_keymap_get_keyval, + + remmina_log_print, + remmina_log_printf, + + remmina_widget_pool_register, + + remmina_connection_window_open_from_file_full, + remmina_public_get_server_port, + remmina_masterthread_exec_is_main_thread }; @@ -208,7 +208,8 @@ void remmina_plugin_manager_init(void) continue; ptr++; if (g_strcmp0(ptr, G_MODULE_SUFFIX) != 0) - continue; fullpath = g_strdup_printf(REMMINA_PLUGINDIR "/%s", name); + continue; + fullpath = g_strdup_printf(REMMINA_PLUGINDIR "/%s", name); remmina_plugin_manager_load_plugin(fullpath); g_free(fullpath); } @@ -255,7 +256,7 @@ static gboolean remmina_plugin_manager_show_for_each(RemminaPlugin *plugin, GtkL gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, plugin->name, 1, _(remmina_plugin_type_name[plugin->type]), 2, - g_dgettext(plugin->domain, plugin->description), 3, plugin->version, -1); + g_dgettext(plugin->domain, plugin->description), 3, plugin->version, -1); return FALSE; } diff --git a/remmina/src/remmina_preexec.c b/remmina/src/remmina_preexec.c index cc3dd9e03..72ab6ac25 100644 --- a/remmina/src/remmina_preexec.c +++ b/remmina/src/remmina_preexec.c @@ -95,21 +95,21 @@ GtkDialog* remmina_preexec_new(RemminaFile* remminafile) /* Consider using G_SPAWN_SEARCH_PATH_FROM_ENVP (from glib 2.38)*/ g_spawn_async( NULL, // cwd - argv, // argv - NULL, // envp - G_SPAWN_SEARCH_PATH | - G_SPAWN_DO_NOT_REAP_CHILD, // flags - NULL, // child_setup - NULL, // child_setup user data - &child_pid, // exit status - &error); // error + argv, // argv + NULL, // envp + G_SPAWN_SEARCH_PATH | + G_SPAWN_DO_NOT_REAP_CHILD, // flags + NULL, // child_setup + NULL, // child_setup user data + &child_pid, // exit status + &error); // error if (!error) { gtk_spinner_start (GTK_SPINNER (pcspinner->spinner)); g_child_watch_add (child_pid, wait_for_child, (gpointer) pcspinner); gtk_dialog_run(pcspinner->dialog); } - else + else { g_warning ("%s\n", error->message); g_error_free(error); diff --git a/remmina/src/remmina_preexec.h b/remmina/src/remmina_preexec.h index 22004da26..91ab1ec61 100644 --- a/remmina/src/remmina_preexec.h +++ b/remmina/src/remmina_preexec.h @@ -38,7 +38,8 @@ G_BEGIN_DECLS -typedef struct { +typedef struct +{ GtkDialog *dialog; GtkLabel *label_pleasewait; GtkButton *button_cancel; diff --git a/remmina/src/remmina_pref.c b/remmina/src/remmina_pref.c index 6a9c85947..e86b125f1 100644 --- a/remmina/src/remmina_pref.c +++ b/remmina/src/remmina_pref.c @@ -54,12 +54,12 @@ static GHashTable *remmina_keymap_table = NULL; /* We could customize this further if there are more requirements */ static const gchar *default_keymap_data = "# Please check gdk/gdkkeysyms.h for a full list of all key names or hex key values\n" - "\n" - "[Map Meta Keys]\n" - "Super_L = Meta_L\n" - "Super_R = Meta_R\n" - "Meta_L = Super_L\n" - "Meta_R = Super_R\n"; + "\n" + "[Map Meta Keys]\n" + "Super_L = Meta_L\n" + "Super_R = Meta_R\n" + "Meta_L = Super_L\n" + "Meta_R = Super_R\n"; static void remmina_pref_gen_secret(void) { @@ -129,7 +129,7 @@ static void remmina_pref_init_keymap(void) if (!g_key_file_load_from_file(gkeyfile, remmina_keymap_file, G_KEY_FILE_NONE, NULL)) { if (!g_key_file_load_from_data(gkeyfile, default_keymap_data, strlen(default_keymap_data), G_KEY_FILE_NONE, - NULL)) + NULL)) { g_print("Failed to initialize keymap table\n"); g_key_file_free(gkeyfile); @@ -212,7 +212,7 @@ void remmina_pref_init(void) if (g_key_file_has_key(gkeyfile, "remmina_pref", "hide_connection_toolbar", NULL)) remmina_pref.hide_connection_toolbar = g_key_file_get_boolean(gkeyfile, "remmina_pref", - "hide_connection_toolbar", NULL); + "hide_connection_toolbar", NULL); else remmina_pref.hide_connection_toolbar = FALSE; @@ -283,7 +283,7 @@ void remmina_pref_init(void) if (g_key_file_has_key(gkeyfile, "remmina_pref", "main_sort_column_id", NULL)) remmina_pref.main_sort_column_id = g_key_file_get_integer(gkeyfile, "remmina_pref", "main_sort_column_id", - NULL); + NULL); else remmina_pref.main_sort_column_id = 1; @@ -324,7 +324,7 @@ void remmina_pref_init(void) if (g_key_file_has_key(gkeyfile, "remmina_pref", "applet_enable_avahi", NULL)) remmina_pref.applet_enable_avahi = g_key_file_get_boolean(gkeyfile, "remmina_pref", "applet_enable_avahi", - NULL); + NULL); else remmina_pref.applet_enable_avahi = FALSE; @@ -382,25 +382,25 @@ void remmina_pref_init(void) if (g_key_file_has_key(gkeyfile, "remmina_pref", "shortcutkey_fullscreen", NULL)) remmina_pref.shortcutkey_fullscreen = g_key_file_get_integer(gkeyfile, "remmina_pref", "shortcutkey_fullscreen", - NULL); + NULL); else remmina_pref.shortcutkey_fullscreen = GDK_KEY_f; if (g_key_file_has_key(gkeyfile, "remmina_pref", "shortcutkey_autofit", NULL)) remmina_pref.shortcutkey_autofit = g_key_file_get_integer(gkeyfile, "remmina_pref", "shortcutkey_autofit", - NULL); + NULL); else remmina_pref.shortcutkey_autofit = GDK_KEY_1; if (g_key_file_has_key(gkeyfile, "remmina_pref", "shortcutkey_nexttab", NULL)) remmina_pref.shortcutkey_nexttab = g_key_file_get_integer(gkeyfile, "remmina_pref", "shortcutkey_nexttab", - NULL); + NULL); else remmina_pref.shortcutkey_nexttab = GDK_KEY_Right; if (g_key_file_has_key(gkeyfile, "remmina_pref", "shortcutkey_prevtab", NULL)) remmina_pref.shortcutkey_prevtab = g_key_file_get_integer(gkeyfile, "remmina_pref", "shortcutkey_prevtab", - NULL); + NULL); else remmina_pref.shortcutkey_prevtab = GDK_KEY_Left; @@ -416,19 +416,19 @@ void remmina_pref_init(void) if (g_key_file_has_key(gkeyfile, "remmina_pref", "shortcutkey_minimize", NULL)) remmina_pref.shortcutkey_minimize = g_key_file_get_integer(gkeyfile, "remmina_pref", "shortcutkey_minimize", - NULL); + NULL); else remmina_pref.shortcutkey_minimize = GDK_KEY_F9; if (g_key_file_has_key(gkeyfile, "remmina_pref", "shortcutkey_disconnect", NULL)) remmina_pref.shortcutkey_disconnect = g_key_file_get_integer(gkeyfile, "remmina_pref", "shortcutkey_disconnect", - NULL); + NULL); else remmina_pref.shortcutkey_disconnect = GDK_KEY_F4; if (g_key_file_has_key(gkeyfile, "remmina_pref", "shortcutkey_toolbar", NULL)) remmina_pref.shortcutkey_toolbar = g_key_file_get_integer(gkeyfile, "remmina_pref", "shortcutkey_toolbar", - NULL); + NULL); else remmina_pref.shortcutkey_toolbar = GDK_KEY_t; @@ -444,7 +444,7 @@ void remmina_pref_init(void) if (g_key_file_has_key(gkeyfile, "remmina_pref", "vte_allow_bold_text", NULL)) remmina_pref.vte_allow_bold_text = g_key_file_get_boolean(gkeyfile, "remmina_pref", "vte_allow_bold_text", - NULL); + NULL); else remmina_pref.vte_allow_bold_text = TRUE; /* Default system theme colors or default vte colors */ @@ -470,13 +470,13 @@ void remmina_pref_init(void) if (g_key_file_has_key(gkeyfile, "remmina_pref", "vte_shortcutkey_copy", NULL)) remmina_pref.vte_shortcutkey_copy = g_key_file_get_integer(gkeyfile, "remmina_pref", "vte_shortcutkey_copy", - NULL); + NULL); else remmina_pref.vte_shortcutkey_copy = GDK_KEY_c; if (g_key_file_has_key(gkeyfile, "remmina_pref", "vte_shortcutkey_paste", NULL)) remmina_pref.vte_shortcutkey_paste = g_key_file_get_integer(gkeyfile, "remmina_pref", "vte_shortcutkey_paste", - NULL); + NULL); else remmina_pref.vte_shortcutkey_paste = GDK_KEY_v; diff --git a/remmina/src/remmina_pref_dialog.c b/remmina/src/remmina_pref_dialog.c index 0c133127a..f32d6b2da 100644 --- a/remmina/src/remmina_pref_dialog.c +++ b/remmina/src/remmina_pref_dialog.c @@ -87,8 +87,8 @@ void remmina_pref_dialog_clear_recent(GtkWidget *widget, gpointer user_data) remmina_pref_clear_recent(); dialog = GTK_DIALOG(gtk_message_dialog_new(GTK_WINDOW(remmina_pref_dialog->dialog), - GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, - _("Recent lists cleared."))); + GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, + _("Recent lists cleared."))); gtk_dialog_run(dialog); gtk_widget_destroy(GTK_WIDGET(dialog)); } diff --git a/remmina/src/remmina_protocol_widget.c b/remmina/src/remmina_protocol_widget.c index 03daf5de4..22911d126 100644 --- a/remmina/src/remmina_protocol_widget.c +++ b/remmina/src/remmina_protocol_widget.c @@ -50,7 +50,8 @@ #include "remmina_masterthread_exec.h" #include "remmina/remmina_trace_calls.h" -struct _RemminaProtocolWidgetPriv { +struct _RemminaProtocolWidgetPriv +{ GtkWidget* init_dialog; RemminaFile* remmina_file; @@ -77,15 +78,17 @@ struct _RemminaProtocolWidgetPriv { G_DEFINE_TYPE(RemminaProtocolWidget, remmina_protocol_widget, GTK_TYPE_EVENT_BOX) - enum { - CONNECT_SIGNAL, - DISCONNECT_SIGNAL, - DESKTOP_RESIZE_SIGNAL, - UPDATE_ALIGN_SIGNAL, - LAST_SIGNAL - }; +enum +{ + CONNECT_SIGNAL, + DISCONNECT_SIGNAL, + DESKTOP_RESIZE_SIGNAL, + UPDATE_ALIGN_SIGNAL, + LAST_SIGNAL +}; -typedef struct _RemminaProtocolWidgetSignalData { +typedef struct _RemminaProtocolWidgetSignalData +{ RemminaProtocolWidget* gp; const gchar* signal_name; } RemminaProtocolWidgetSignalData; @@ -97,24 +100,25 @@ static void remmina_protocol_widget_class_init(RemminaProtocolWidgetClass *klass { TRACE_CALL("remmina_protocol_widget_class_init"); remmina_protocol_widget_signals[CONNECT_SIGNAL] = g_signal_new("connect", G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaProtocolWidgetClass, connect), NULL, NULL, - g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaProtocolWidgetClass, connect), NULL, NULL, + g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); remmina_protocol_widget_signals[DISCONNECT_SIGNAL] = g_signal_new("disconnect", G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaProtocolWidgetClass, disconnect), NULL, NULL, - g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaProtocolWidgetClass, disconnect), NULL, NULL, + g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); remmina_protocol_widget_signals[DESKTOP_RESIZE_SIGNAL] = g_signal_new("desktop-resize", G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaProtocolWidgetClass, desktop_resize), NULL, NULL, - g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaProtocolWidgetClass, desktop_resize), NULL, NULL, + g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); remmina_protocol_widget_signals[UPDATE_ALIGN_SIGNAL] = g_signal_new("update-align", G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaProtocolWidgetClass, update_align), NULL, NULL, - g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaProtocolWidgetClass, update_align), NULL, NULL, + g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); } static void remmina_protocol_widget_init_cancel(RemminaInitDialog *dialog, gint response_id, RemminaProtocolWidget* gp) { TRACE_CALL("remmina_protocol_widget_init_cancel"); if ((response_id == GTK_RESPONSE_CANCEL || response_id == GTK_RESPONSE_DELETE_EVENT) - && dialog->mode == REMMINA_INIT_MODE_CONNECTING) { + && dialog->mode == REMMINA_INIT_MODE_CONNECTING) + { remmina_protocol_widget_close_connection(gp); } } @@ -122,7 +126,8 @@ static void remmina_protocol_widget_init_cancel(RemminaInitDialog *dialog, gint static void remmina_protocol_widget_show_init_dialog(RemminaProtocolWidget* gp, const gchar *name) { TRACE_CALL("remmina_protocol_widget_show_init_dialog"); - if (gp->priv->init_dialog) { + if (gp->priv->init_dialog) + { gtk_widget_destroy(gp->priv->init_dialog); } gp->priv->init_dialog = remmina_init_dialog_new(_("Connecting to '%s'..."), (name ? name : "*")); @@ -152,7 +157,8 @@ static void remmina_protocol_widget_connect(RemminaProtocolWidget* gp, gpointer { TRACE_CALL("remmina_protocol_widget_connect"); #ifdef HAVE_LIBSSH - if (gp->priv->ssh_tunnel) { + if (gp->priv->ssh_tunnel) + { remmina_ssh_tunnel_cancel_accept (gp->priv->ssh_tunnel); } #endif @@ -172,7 +178,8 @@ void remmina_protocol_widget_grab_focus(RemminaProtocolWidget* gp) child = gtk_bin_get_child(GTK_BIN(gp)); - if (child) { + if (child) + { gtk_widget_set_can_focus(child, TRUE); gtk_widget_grab_focus(child); } @@ -203,11 +210,12 @@ void remmina_protocol_widget_open_connection_real(gpointer data) /* Locate the protocol plugin */ plugin = (RemminaProtocolPlugin*) remmina_plugin_manager_get_plugin(REMMINA_PLUGIN_TYPE_PROTOCOL, - remmina_file_get_string(remminafile, "protocol")); + remmina_file_get_string(remminafile, "protocol")); - if (!plugin || !plugin->init || !plugin->open_connection) { + if (!plugin || !plugin->init || !plugin->open_connection) + { remmina_protocol_widget_set_error(gp, _("Protocol plugin %s is not installed."), - remmina_file_get_string(remminafile, "protocol")); + remmina_file_get_string(remminafile, "protocol")); remmina_protocol_widget_close_connection(gp); return; } @@ -216,26 +224,33 @@ void remmina_protocol_widget_open_connection_real(gpointer data) gp->priv->plugin = plugin; - for (num_plugin = 0, feature = (RemminaProtocolFeature*) plugin->features; feature && feature->type; num_plugin++, feature++) { + for (num_plugin = 0, feature = (RemminaProtocolFeature*) plugin->features; feature && feature->type; num_plugin++, feature++) + { } num_ssh = 0; #ifdef HAVE_LIBSSH - if (remmina_file_get_int(gp->priv->remmina_file, "ssh_enabled", FALSE)) { + if (remmina_file_get_int(gp->priv->remmina_file, "ssh_enabled", FALSE)) + { num_ssh += 2; } #endif - if (num_plugin + num_ssh == 0) { + if (num_plugin + num_ssh == 0) + { gp->priv->features = NULL; - } else { + } + else + { gp->priv->features = g_new0(RemminaProtocolFeature, num_plugin + num_ssh + 1); feature = gp->priv->features; - if (plugin->features) { + if (plugin->features) + { memcpy(feature, plugin->features, sizeof(RemminaProtocolFeature) * num_plugin); feature += num_plugin; } #ifdef HAVE_LIBSSH - if (num_ssh) { + if (num_ssh) + { feature->type = REMMINA_PROTOCOL_FEATURE_TYPE_TOOL; feature->id = REMMINA_PROTOCOL_FEATURE_TOOL_SSH; feature->opt1 = _("Open Secure Shell in New Terminal..."); @@ -252,7 +267,8 @@ void remmina_protocol_widget_open_connection_real(gpointer data) #endif } - if (!plugin->open_connection(gp)) { + if (!plugin->open_connection(gp)) + { remmina_protocol_widget_close_connection(gp); } } @@ -285,16 +301,19 @@ gboolean remmina_protocol_widget_close_connection(RemminaProtocolWidget* gp) display = gtk_widget_get_display(GTK_WIDGET(gp)); manager = gdk_display_get_device_manager(display); device = gdk_device_manager_get_client_pointer(manager); - if (device != NULL) { + if (device != NULL) + { gdk_device_ungrab(device, GDK_CURRENT_TIME); } - if (gp->priv->chat_window) { + if (gp->priv->chat_window) + { gtk_widget_destroy(gp->priv->chat_window); gp->priv->chat_window = NULL; } - if (!gp->priv->plugin || !gp->priv->plugin->close_connection) { + if (!gp->priv->plugin || !gp->priv->plugin->close_connection) + { remmina_protocol_widget_emit_signal(gp, "disconnect"); return FALSE; } @@ -302,7 +321,8 @@ gboolean remmina_protocol_widget_close_connection(RemminaProtocolWidget* gp) retval = gp->priv->plugin->close_connection(gp); #ifdef HAVE_LIBSSH - if (gp->priv->ssh_tunnel) { + if (gp->priv->ssh_tunnel) + { remmina_ssh_tunnel_free(gp->priv->ssh_tunnel); gp->priv->ssh_tunnel = NULL; } @@ -331,13 +351,15 @@ void remmina_protocol_widget_send_keystrokes(RemminaProtocolWidget* gp, GtkMenuI GdkKeymapKey *keys; gint n_keys; /* Single keystroke replace */ - typedef struct _KeystrokeReplace { + typedef struct _KeystrokeReplace + { gchar *search; gchar *replace; guint keyval; } KeystrokeReplace; /* Special characters to replace */ - KeystrokeReplace keystrokes_replaces[] = { + KeystrokeReplace keystrokes_replaces[] = + { { "\\n", "\n", GDK_KEY_Return }, { "\\t", "\t", GDK_KEY_Tab }, { "\\b", "\b", GDK_KEY_BackSpace }, @@ -346,23 +368,28 @@ void remmina_protocol_widget_send_keystrokes(RemminaProtocolWidget* gp, GtkMenuI { NULL, NULL, 0 } }; /* Keystrokes can be sent only to plugins that accepts them */ - if (remmina_protocol_widget_plugin_receives_keystrokes(gp)) { + if (remmina_protocol_widget_plugin_receives_keystrokes(gp)) + { /* Replace special characters */ - for (i = 0; keystrokes_replaces[i].replace; i++) { + for (i = 0; keystrokes_replaces[i].replace; i++) + { remmina_public_str_replace_in_place(keystrokes, - keystrokes_replaces[i].search, - keystrokes_replaces[i].replace); + keystrokes_replaces[i].search, + keystrokes_replaces[i].replace); } keyvals = (guint *) g_malloc(strlen(keystrokes)); - while(TRUE) { + while(TRUE) + { /* Process each character in the keystrokes */ character = g_utf8_get_char_validated(iter, -1); if (character == 0) break; keyval = gdk_unicode_to_keyval(character); /* Replace all the special character with its keyval */ - for (i = 0; keystrokes_replaces[i].replace; i++) { - if (character == keystrokes_replaces[i].replace[0]) { + for (i = 0; keystrokes_replaces[i].replace; i++) + { + if (character == keystrokes_replaces[i].replace[0]) + { keys = g_new0(GdkKeymapKey, 1); keyval = keystrokes_replaces[i].keyval; /* A special character was generated, no keyval lookup needed */ @@ -371,9 +398,11 @@ void remmina_protocol_widget_send_keystrokes(RemminaProtocolWidget* gp, GtkMenuI } } /* Decode character if it's not a special character */ - if (character) { + if (character) + { /* get keyval without modifications */ - if (!gdk_keymap_get_entries_for_keyval(keymap, keyval, &keys, &n_keys)) { + if (!gdk_keymap_get_entries_for_keyval(keymap, keyval, &keys, &n_keys)) + { g_warning("keyval 0x%04x has no keycode!", keyval); iter = g_utf8_find_next_char(iter, NULL); continue; @@ -436,11 +465,13 @@ gboolean remmina_protocol_widget_query_feature_by_type(RemminaProtocolWidget* gp #ifdef HAVE_LIBSSH if (type == REMMINA_PROTOCOL_FEATURE_TYPE_TOOL && - remmina_file_get_int (gp->priv->remmina_file, "ssh_enabled", FALSE)) { + remmina_file_get_int (gp->priv->remmina_file, "ssh_enabled", FALSE)) + { return TRUE; } #endif - for (feature = gp->priv->plugin->features; feature && feature->type; feature++) { + for (feature = gp->priv->plugin->features; feature && feature->type; feature++) + { if (feature->type == type) return TRUE; } @@ -458,8 +489,10 @@ void remmina_protocol_widget_call_feature_by_type(RemminaProtocolWidget* gp, Rem TRACE_CALL("remmina_protocol_widget_call_feature_by_type"); const RemminaProtocolFeature *feature; - for (feature = gp->priv->plugin->features; feature && feature->type; feature++) { - if (feature->type == type && (id == 0 || feature->id == id)) { + for (feature = gp->priv->plugin->features; feature && feature->type; feature++) + { + if (feature->type == type && (id == 0 || feature->id == id)) + { remmina_protocol_widget_call_feature_by_ref(gp, feature); break; } @@ -469,26 +502,29 @@ void remmina_protocol_widget_call_feature_by_type(RemminaProtocolWidget* gp, Rem void remmina_protocol_widget_call_feature_by_ref(RemminaProtocolWidget* gp, const RemminaProtocolFeature *feature) { TRACE_CALL("remmina_protocol_widget_call_feature_by_ref"); - switch (feature->id) { + switch (feature->id) + { #ifdef HAVE_LIBSSH - case REMMINA_PROTOCOL_FEATURE_TOOL_SSH: - if (gp->priv->ssh_tunnel) { - remmina_connection_window_open_from_file_full ( - remmina_file_dup_temp_protocol (gp->priv->remmina_file, "SSH"), NULL, gp->priv->ssh_tunnel, NULL); - return; - } - break; + case REMMINA_PROTOCOL_FEATURE_TOOL_SSH: + if (gp->priv->ssh_tunnel) + { + remmina_connection_window_open_from_file_full ( + remmina_file_dup_temp_protocol (gp->priv->remmina_file, "SSH"), NULL, gp->priv->ssh_tunnel, NULL); + return; + } + break; - case REMMINA_PROTOCOL_FEATURE_TOOL_SFTP: - if (gp->priv->ssh_tunnel) { - remmina_connection_window_open_from_file_full ( - remmina_file_dup_temp_protocol (gp->priv->remmina_file, "SFTP"), NULL, gp->priv->ssh_tunnel, NULL); - return; - } - break; + case REMMINA_PROTOCOL_FEATURE_TOOL_SFTP: + if (gp->priv->ssh_tunnel) + { + remmina_connection_window_open_from_file_full ( + remmina_file_dup_temp_protocol (gp->priv->remmina_file, "SFTP"), NULL, gp->priv->ssh_tunnel, NULL); + return; + } + break; #endif - default: - break; + default: + break; } gp->priv->plugin->call_feature(gp, feature); } @@ -496,7 +532,8 @@ void remmina_protocol_widget_call_feature_by_ref(RemminaProtocolWidget* gp, cons static gboolean remmina_protocol_widget_on_key_press(GtkWidget *widget, GdkEventKey *event, RemminaProtocolWidget* gp) { TRACE_CALL("remmina_protocol_widget_on_key_press"); - if (gp->priv->hostkey_func) { + if (gp->priv->hostkey_func) + { return gp->priv->hostkey_func(gp, event->keyval, FALSE, gp->priv->hostkey_func_data); } return FALSE; @@ -505,7 +542,8 @@ static gboolean remmina_protocol_widget_on_key_press(GtkWidget *widget, GdkEvent static gboolean remmina_protocol_widget_on_key_release(GtkWidget *widget, GdkEventKey *event, RemminaProtocolWidget* gp) { TRACE_CALL("remmina_protocol_widget_on_key_release"); - if (gp->priv->hostkey_func) { + if (gp->priv->hostkey_func) + { return gp->priv->hostkey_func(gp, event->keyval, TRUE, gp->priv->hostkey_func_data); } return FALSE; @@ -533,21 +571,25 @@ static gboolean remmina_protocol_widget_init_tunnel (RemminaProtocolWidget* gp) gint ret; /* Reuse existing SSH connection if it's reconnecting to destination */ - if (gp->priv->ssh_tunnel == NULL) { + if (gp->priv->ssh_tunnel == NULL) + { tunnel = remmina_ssh_tunnel_new_from_file (gp->priv->remmina_file); remmina_init_dialog_set_status (REMMINA_INIT_DIALOG (gp->priv->init_dialog), - _("Connecting to SSH server %s..."), REMMINA_SSH (tunnel)->server); + _("Connecting to SSH server %s..."), REMMINA_SSH (tunnel)->server); - if (!remmina_ssh_init_session (REMMINA_SSH (tunnel))) { + if (!remmina_ssh_init_session (REMMINA_SSH (tunnel))) + { remmina_protocol_widget_set_error (gp, REMMINA_SSH (tunnel)->error); remmina_ssh_tunnel_free (tunnel); return FALSE; } ret = remmina_ssh_auth_gui (REMMINA_SSH (tunnel), REMMINA_INIT_DIALOG (gp->priv->init_dialog)); - if (ret <= 0) { - if (ret == 0) { + if (ret <= 0) + { + if (ret == 0) + { remmina_protocol_widget_set_error (gp, REMMINA_SSH (tunnel)->error); } remmina_ssh_tunnel_free (tunnel); @@ -570,38 +612,44 @@ gchar* remmina_protocol_widget_start_direct_tunnel(RemminaProtocolWidget* gp, gi server = remmina_file_get_string(gp->priv->remmina_file, "server"); - if (!server) { + if (!server) + { return g_strdup(""); } remmina_public_get_server_port(server, default_port, &host, &port); - if (port_plus && port < 100) { + if (port_plus && port < 100) + { /* Protocols like VNC supports using instance number :0, :1, etc as port number. */ port += default_port; } #ifdef HAVE_LIBSSH - if (!remmina_file_get_int (gp->priv->remmina_file, "ssh_enabled", FALSE)) { + if (!remmina_file_get_int (gp->priv->remmina_file, "ssh_enabled", FALSE)) + { dest = g_strdup_printf("[%s]:%i", host, port); g_free(host); return dest; } - if (!remmina_protocol_widget_init_tunnel (gp)) { + if (!remmina_protocol_widget_init_tunnel (gp)) + { g_free(host); return NULL; } remmina_init_dialog_set_status (REMMINA_INIT_DIALOG (gp->priv->init_dialog), - _("Connecting to %s through SSH tunnel..."), server); + _("Connecting to %s through SSH tunnel..."), server); - if (remmina_file_get_int (gp->priv->remmina_file, "ssh_loopback", FALSE)) { + if (remmina_file_get_int (gp->priv->remmina_file, "ssh_loopback", FALSE)) + { g_free(host); host = g_strdup ("127.0.0.1"); } - if (!remmina_ssh_tunnel_open (gp->priv->ssh_tunnel, host, port, remmina_pref.sshtunnel_port)) { + if (!remmina_ssh_tunnel_open (gp->priv->ssh_tunnel, host, port, remmina_pref.sshtunnel_port)) + { g_free(host); remmina_protocol_widget_set_error (gp, REMMINA_SSH (gp->priv->ssh_tunnel)->error); return NULL; @@ -623,18 +671,21 @@ gboolean remmina_protocol_widget_start_reverse_tunnel(RemminaProtocolWidget* gp, { TRACE_CALL("remmina_protocol_widget_start_reverse_tunnel"); #ifdef HAVE_LIBSSH - if (!remmina_file_get_int (gp->priv->remmina_file, "ssh_enabled", FALSE)) { + if (!remmina_file_get_int (gp->priv->remmina_file, "ssh_enabled", FALSE)) + { return TRUE; } - if (!remmina_protocol_widget_init_tunnel (gp)) { + if (!remmina_protocol_widget_init_tunnel (gp)) + { return FALSE; } remmina_init_dialog_set_status (REMMINA_INIT_DIALOG (gp->priv->init_dialog), - _("Waiting for an incoming SSH tunnel at port %i..."), remmina_file_get_int (gp->priv->remmina_file, "listenport", 0)); + _("Waiting for an incoming SSH tunnel at port %i..."), remmina_file_get_int (gp->priv->remmina_file, "listenport", 0)); - if (!remmina_ssh_tunnel_reverse (gp->priv->ssh_tunnel, remmina_file_get_int (gp->priv->remmina_file, "listenport", 0), local_port)) { + if (!remmina_ssh_tunnel_reverse (gp->priv->ssh_tunnel, remmina_file_get_int (gp->priv->remmina_file, "listenport", 0), local_port)) + { remmina_protocol_widget_set_error (gp, REMMINA_SSH (gp->priv->ssh_tunnel)->error); return FALSE; } @@ -654,7 +705,8 @@ gboolean remmina_protocol_widget_ssh_exec(RemminaProtocolWidget* gp, gboolean wa gchar *cmd, *ptr; va_list args; - if ((channel = ssh_channel_new (REMMINA_SSH (tunnel)->session)) == NULL) { + if ((channel = ssh_channel_new (REMMINA_SSH (tunnel)->session)) == NULL) + { return FALSE; } @@ -663,29 +715,36 @@ gboolean remmina_protocol_widget_ssh_exec(RemminaProtocolWidget* gp, gboolean wa va_end (args); if (ssh_channel_open_session (channel) == SSH_OK && - ssh_channel_request_exec (channel, cmd) == SSH_OK) { - if (wait) { + ssh_channel_request_exec (channel, cmd) == SSH_OK) + { + if (wait) + { ssh_channel_send_eof (channel); status = ssh_channel_get_exit_status (channel); ptr = strchr (cmd, ' '); if (ptr) *ptr = '\0'; - switch (status) { - case 0: - ret = TRUE; - break; - case 127: - remmina_ssh_set_application_error (REMMINA_SSH (tunnel), - _("Command %s not found on SSH server"), cmd); - break; - default: - remmina_ssh_set_application_error (REMMINA_SSH (tunnel), - _("Command %s failed on SSH server (status = %i)."), cmd,status); - break; + switch (status) + { + case 0: + ret = TRUE; + break; + case 127: + remmina_ssh_set_application_error (REMMINA_SSH (tunnel), + _("Command %s not found on SSH server"), cmd); + break; + default: + remmina_ssh_set_application_error (REMMINA_SSH (tunnel), + _("Command %s failed on SSH server (status = %i)."), cmd,status); + break; } - } else { + } + else + { ret = TRUE; } - } else { + } + else + { remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to execute command: %s")); } g_free(cmd); @@ -712,7 +771,7 @@ static gboolean remmina_protocol_widget_tunnel_init_callback (RemminaSSHTunnel * remmina_public_get_server_port (remmina_file_get_string (gp->priv->remmina_file, "server"), 177, &server, &port); ret = ((RemminaXPortTunnelInitFunc) gp->priv->init_func) (gp, - tunnel->remotedisplay, (tunnel->bindlocalhost ? "localhost" : server), port); + tunnel->remotedisplay, (tunnel->bindlocalhost ? "localhost" : server), port); g_free(server); return ret; @@ -729,7 +788,8 @@ static gboolean remmina_protocol_widget_tunnel_disconnect_callback(RemminaSSHTun TRACE_CALL("remmina_protocol_widget_tunnel_disconnect_callback"); RemminaProtocolWidget* gp = REMMINA_PROTOCOL_WIDGET (data); - if (REMMINA_SSH (tunnel)->error) { + if (REMMINA_SSH (tunnel)->error) + { remmina_protocol_widget_set_error (gp, "%s", REMMINA_SSH (tunnel)->error); } @@ -748,7 +808,7 @@ gboolean remmina_protocol_widget_start_xport_tunnel(RemminaProtocolWidget* gp, R if (!remmina_protocol_widget_init_tunnel (gp)) return FALSE; remmina_init_dialog_set_status (REMMINA_INIT_DIALOG (gp->priv->init_dialog), - _("Connecting to %s through SSH tunnel..."), remmina_file_get_string (gp->priv->remmina_file, "server")); + _("Connecting to %s through SSH tunnel..."), remmina_file_get_string (gp->priv->remmina_file, "server")); gp->priv->init_func = init_func; gp->priv->ssh_tunnel->init_func = remmina_protocol_widget_tunnel_init_callback; @@ -760,9 +820,10 @@ gboolean remmina_protocol_widget_start_xport_tunnel(RemminaProtocolWidget* gp, R bindlocalhost = (g_strcmp0(REMMINA_SSH (gp->priv->ssh_tunnel)->server, server) == 0); g_free(server); - if (!remmina_ssh_tunnel_xport (gp->priv->ssh_tunnel, bindlocalhost)) { + if (!remmina_ssh_tunnel_xport (gp->priv->ssh_tunnel, bindlocalhost)) + { remmina_protocol_widget_set_error (gp, "Failed to open channel : %s", - ssh_get_error (REMMINA_SSH (gp->priv->ssh_tunnel)->session)); + ssh_get_error (REMMINA_SSH (gp->priv->ssh_tunnel)->session)); return FALSE; } @@ -882,27 +943,28 @@ gint remmina_protocol_widget_init_authpwd(RemminaProtocolWidget* gp, RemminaAuth gchar* s; gint ret; - switch (authpwd_type) { - case REMMINA_AUTHPWD_TYPE_PROTOCOL: - s = g_strdup_printf(_("%s password"), remmina_file_get_string(remminafile, "protocol")); - break; - case REMMINA_AUTHPWD_TYPE_SSH_PWD: - s = g_strdup(_("SSH password")); - break; - case REMMINA_AUTHPWD_TYPE_SSH_PRIVKEY: - s = g_strdup(_("SSH private key passphrase")); - break; - default: - s = g_strdup(_("Password")); - break; + switch (authpwd_type) + { + case REMMINA_AUTHPWD_TYPE_PROTOCOL: + s = g_strdup_printf(_("%s password"), remmina_file_get_string(remminafile, "protocol")); + break; + case REMMINA_AUTHPWD_TYPE_SSH_PWD: + s = g_strdup(_("SSH password")); + break; + case REMMINA_AUTHPWD_TYPE_SSH_PRIVKEY: + s = g_strdup(_("SSH private key passphrase")); + break; + default: + s = g_strdup(_("Password")); + break; } ret = remmina_init_dialog_authpwd( - REMMINA_INIT_DIALOG(gp->priv->init_dialog), - s, - remmina_file_get_filename(remminafile) != NULL && - allow_password_saving && - authpwd_type != REMMINA_AUTHPWD_TYPE_SSH_PWD && - authpwd_type != REMMINA_AUTHPWD_TYPE_SSH_PRIVKEY); + REMMINA_INIT_DIALOG(gp->priv->init_dialog), + s, + remmina_file_get_filename(remminafile) != NULL && + allow_password_saving && + authpwd_type != REMMINA_AUTHPWD_TYPE_SSH_PWD && + authpwd_type != REMMINA_AUTHPWD_TYPE_SSH_PRIVKEY); g_free(s); return ret; @@ -914,11 +976,11 @@ gint remmina_protocol_widget_init_authuserpwd(RemminaProtocolWidget* gp, gboolea RemminaFile* remminafile = gp->priv->remmina_file; return remmina_init_dialog_authuserpwd( - REMMINA_INIT_DIALOG(gp->priv->init_dialog), - want_domain, - remmina_file_get_string(remminafile, "username"), - want_domain ? remmina_file_get_string(remminafile, "domain") : NULL, - (remmina_file_get_filename(remminafile) != NULL) && allow_password_saving); + REMMINA_INIT_DIALOG(gp->priv->init_dialog), + want_domain, + remmina_file_get_string(remminafile, "username"), + want_domain ? remmina_file_get_string(remminafile, "domain") : NULL, + (remmina_file_get_filename(remminafile) != NULL) && allow_password_saving); } gint remmina_protocol_widget_init_certificate(RemminaProtocolWidget* gp, const gchar* subject, const gchar* issuer, const gchar* fingerprint) @@ -962,8 +1024,8 @@ gint remmina_protocol_widget_init_authx509(RemminaProtocolWidget* gp) RemminaFile* remminafile = gp->priv->remmina_file; return remmina_init_dialog_authx509(REMMINA_INIT_DIALOG(gp->priv->init_dialog), - remmina_file_get_string(remminafile, "cacert"), remmina_file_get_string(remminafile, "cacrl"), - remmina_file_get_string(remminafile, "clientcert"), remmina_file_get_string(remminafile, "clientkey")); + remmina_file_get_string(remminafile, "cacert"), remmina_file_get_string(remminafile, "cacrl"), + remmina_file_get_string(remminafile, "clientcert"), remmina_file_get_string(remminafile, "clientkey")); } gchar* remmina_protocol_widget_init_get_cacert(RemminaProtocolWidget* gp) @@ -1010,7 +1072,8 @@ void remmina_protocol_widget_init_save_cred(RemminaProtocolWidget* gp) gchar* s; gboolean save = FALSE; - if ( !remmina_masterthread_exec_is_main_thread() ) { + if ( !remmina_masterthread_exec_is_main_thread() ) + { /* Allow the execution of this function from a non main thread */ RemminaMTExecData *d; d = (RemminaMTExecData*)g_malloc( sizeof(RemminaMTExecData) ); @@ -1023,35 +1086,42 @@ void remmina_protocol_widget_init_save_cred(RemminaProtocolWidget* gp) /* Save user name and certificates if any; save the password if it's requested to do so */ s = REMMINA_INIT_DIALOG(gp->priv->init_dialog)->username; - if (s && s[0]) { + if (s && s[0]) + { remmina_file_set_string(remminafile, "username", s); save = TRUE; } s = REMMINA_INIT_DIALOG(gp->priv->init_dialog)->cacert; - if (s && s[0]) { + if (s && s[0]) + { remmina_file_set_string(remminafile, "cacert", s); save = TRUE; } s = REMMINA_INIT_DIALOG(gp->priv->init_dialog)->cacrl; - if (s && s[0]) { + if (s && s[0]) + { remmina_file_set_string(remminafile, "cacrl", s); save = TRUE; } s = REMMINA_INIT_DIALOG(gp->priv->init_dialog)->clientcert; - if (s && s[0]) { + if (s && s[0]) + { remmina_file_set_string(remminafile, "clientcert", s); save = TRUE; } s = REMMINA_INIT_DIALOG(gp->priv->init_dialog)->clientkey; - if (s && s[0]) { + if (s && s[0]) + { remmina_file_set_string(remminafile, "clientkey", s); save = TRUE; } - if (REMMINA_INIT_DIALOG(gp->priv->init_dialog)->save_password) { + if (REMMINA_INIT_DIALOG(gp->priv->init_dialog)->save_password) + { remmina_file_set_string(remminafile, "password", REMMINA_INIT_DIALOG(gp->priv->init_dialog)->password); save = TRUE; } - if (save) { + if (save) + { remmina_file_save_group(remminafile, REMMINA_SETTING_GROUP_CREDENTIAL); } } @@ -1061,15 +1131,15 @@ void remmina_protocol_widget_init_show_listen(RemminaProtocolWidget* gp, gint po { TRACE_CALL("remmina_protocol_widget_init_show_listen"); remmina_init_dialog_set_status(REMMINA_INIT_DIALOG(gp->priv->init_dialog), - _("Listening on port %i for an incoming %s connection..."), port, - remmina_file_get_string(gp->priv->remmina_file, "protocol")); + _("Listening on port %i for an incoming %s connection..."), port, + remmina_file_get_string(gp->priv->remmina_file, "protocol")); } void remmina_protocol_widget_init_show_retry(RemminaProtocolWidget* gp) { TRACE_CALL("remmina_protocol_widget_init_show_retry"); remmina_init_dialog_set_status_temp(REMMINA_INIT_DIALOG(gp->priv->init_dialog), - _("Authentication failed. Trying to reconnect...")); + _("Authentication failed. Trying to reconnect...")); } void remmina_protocol_widget_init_show(RemminaProtocolWidget* gp) @@ -1091,16 +1161,19 @@ static void remmina_protocol_widget_chat_on_destroy(RemminaProtocolWidget* gp) } void remmina_protocol_widget_chat_open(RemminaProtocolWidget* gp, const gchar *name, - void(*on_send)(RemminaProtocolWidget* gp, const gchar *text), void(*on_destroy)(RemminaProtocolWidget* gp)) + void(*on_send)(RemminaProtocolWidget* gp, const gchar *text), void(*on_destroy)(RemminaProtocolWidget* gp)) { TRACE_CALL("remmina_protocol_widget_chat_open"); - if (gp->priv->chat_window) { + if (gp->priv->chat_window) + { gtk_window_present(GTK_WINDOW(gp->priv->chat_window)); - } else { + } + else + { gp->priv->chat_window = remmina_chat_window_new(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(gp))), name); g_signal_connect_swapped(G_OBJECT(gp->priv->chat_window), "send", G_CALLBACK(on_send), gp); g_signal_connect_swapped(G_OBJECT(gp->priv->chat_window), "destroy", - G_CALLBACK(remmina_protocol_widget_chat_on_destroy), gp); + G_CALLBACK(remmina_protocol_widget_chat_on_destroy), gp); g_signal_connect_swapped(G_OBJECT(gp->priv->chat_window), "destroy", G_CALLBACK(on_destroy), gp); gtk_widget_show(gp->priv->chat_window); } @@ -1109,7 +1182,8 @@ void remmina_protocol_widget_chat_open(RemminaProtocolWidget* gp, const gchar *n void remmina_protocol_widget_chat_close(RemminaProtocolWidget* gp) { TRACE_CALL("remmina_protocol_widget_chat_close"); - if (gp->priv->chat_window) { + if (gp->priv->chat_window) + { gtk_widget_destroy(gp->priv->chat_window); } } @@ -1119,8 +1193,10 @@ void remmina_protocol_widget_chat_receive(RemminaProtocolWidget* gp, const gchar TRACE_CALL("remmina_protocol_widget_chat_receive"); /* This function can be called from a non main thread */ - if (gp->priv->chat_window) { - if ( !remmina_masterthread_exec_is_main_thread() ) { + if (gp->priv->chat_window) + { + if ( !remmina_masterthread_exec_is_main_thread() ) + { /* Allow the execution of this function from a non main thread */ RemminaMTExecData *d; d = (RemminaMTExecData*)g_malloc( sizeof(RemminaMTExecData) ); @@ -1161,10 +1237,12 @@ void remmina_protocol_widget_send_keys_signals(GtkWidget *widget, const guint *k event.string = ""; event.group = 0; - if (action & GDK_KEY_PRESS) { + if (action & GDK_KEY_PRESS) + { /* Press the requested buttons */ event.type = GDK_KEY_PRESS; - for (i = 0; i < keyvals_length; i++) { + for (i = 0; i < keyvals_length; i++) + { event.keyval = keyvals[i]; event.hardware_keycode = remmina_public_get_keycode_for_keyval(keymap, event.keyval); event.is_modifier = (int) remmina_public_get_modifier_for_keycode(keymap, event.hardware_keycode); @@ -1172,10 +1250,12 @@ void remmina_protocol_widget_send_keys_signals(GtkWidget *widget, const guint *k } } - if (action & GDK_KEY_RELEASE) { + if (action & GDK_KEY_RELEASE) + { /* Release the requested buttons in reverse order */ event.type = GDK_KEY_RELEASE; - for (i = (keyvals_length - 1); i >= 0; i--) { + for (i = (keyvals_length - 1); i >= 0; i--) + { event.keyval = keyvals[i]; event.hardware_keycode = remmina_public_get_keycode_for_keyval(keymap, event.keyval); event.is_modifier = (int) remmina_public_get_modifier_for_keycode(keymap, event.hardware_keycode); diff --git a/remmina/src/remmina_protocol_widget.h b/remmina/src/remmina_protocol_widget.h index c696bd9b4..2b4213626 100644 --- a/remmina/src/remmina_protocol_widget.h +++ b/remmina/src/remmina_protocol_widget.h @@ -140,7 +140,7 @@ void remmina_protocol_widget_init_show(RemminaProtocolWidget *gp); void remmina_protocol_widget_init_hide(RemminaProtocolWidget *gp); void remmina_protocol_widget_chat_open(RemminaProtocolWidget *gp, const gchar *name, - void(*on_send)(RemminaProtocolWidget *gp, const gchar *text), void(*on_destroy)(RemminaProtocolWidget *gp)); + void(*on_send)(RemminaProtocolWidget *gp, const gchar *text), void(*on_destroy)(RemminaProtocolWidget *gp)); void remmina_protocol_widget_chat_close(RemminaProtocolWidget *gp); void remmina_protocol_widget_chat_receive(RemminaProtocolWidget *gp, const gchar *text); void remmina_protocol_widget_send_keys_signals(GtkWidget *widget, const guint *keyvals, int length, GdkEventType action); diff --git a/remmina/src/remmina_public.c b/remmina/src/remmina_public.c index ea946fe4d..c83c231b2 100644 --- a/remmina/src/remmina_public.c +++ b/remmina/src/remmina_public.c @@ -198,7 +198,7 @@ remmina_public_create_combo(gboolean use_icon) store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); } combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store)); - gtk_widget_set_hexpand(combo, TRUE); + gtk_widget_set_hexpand(combo, TRUE); if (use_icon) { @@ -231,13 +231,13 @@ remmina_public_create_combo_map(const gpointer *key_value_list, const gchar *def { gtk_list_store_append(store, &iter); gtk_list_store_set( - store, - &iter, - 0, - key_value_list[i], - 1, - key_value_list[i + 1] && ((char*) key_value_list[i + 1])[0] ? - g_dgettext(domain, key_value_list[i + 1]) : "", -1); + store, + &iter, + 0, + key_value_list[i], + 1, + key_value_list[i + 1] && ((char*) key_value_list[i + 1])[0] ? + g_dgettext(domain, key_value_list[i + 1]) : "", -1); if (use_icon) { gtk_list_store_set(store, &iter, 2, key_value_list[i + 2], -1); @@ -325,7 +325,7 @@ void remmina_public_popup_position(GtkMenu *menu, gint *x, gint *y, gboolean *pu * While leaving the previous check intact I'm checking also if the provided * widget is a GtkToggleToolButton and position the menu accordingly. */ if (gtk_widget_get_has_window(widget) || - g_strcmp0(gtk_widget_get_name(widget), "GtkToggleToolButton") == 0) + g_strcmp0(gtk_widget_get_name(widget), "GtkToggleToolButton") == 0) { tx += allocation.x; ty += allocation.y; @@ -494,16 +494,16 @@ guint remmina_public_get_current_workspace(GdkScreen *screen) gdk_error_trap_push (); result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (root_win), - gdk_x11_get_xatom_by_name_for_display (display, "_NET_CURRENT_DESKTOP"), - 0, G_MAXLONG, False, XA_CARDINAL, &type, &format, &nitems, - &bytes_after, (gpointer) ¤t_desktop); + gdk_x11_get_xatom_by_name_for_display (display, "_NET_CURRENT_DESKTOP"), + 0, G_MAXLONG, False, XA_CARDINAL, &type, &format, &nitems, + &bytes_after, (gpointer) ¤t_desktop); err = gdk_error_trap_pop (); if (err != Success || result != Success) - return ret; + return ret; if (type == XA_CARDINAL && format == 32 && nitems > 0) - ret = current_desktop[0]; + ret = current_desktop[0]; XFree (current_desktop); return ret; @@ -545,16 +545,16 @@ guint remmina_public_get_window_workspace(GtkWindow *gtkwindow) gdk_error_trap_push (); result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), - gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_DESKTOP"), - 0, G_MAXLONG, False, XA_CARDINAL, &type, &format, &nitems, - &bytes_after, (gpointer) &workspace); + gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_DESKTOP"), + 0, G_MAXLONG, False, XA_CARDINAL, &type, &format, &nitems, + &bytes_after, (gpointer) &workspace); err = gdk_error_trap_pop (); if (err != Success || result != Success) - return ret; + return ret; if (type == XA_CARDINAL && format == 32 && nitems > 0) - ret = workspace[0]; + ret = workspace[0]; XFree (workspace); return ret; @@ -690,7 +690,7 @@ gboolean remmina_public_resolution_validation_func(const gchar *new_str, gchar * return result; } -/* Replaces all occurences of search in a new copy of string by replacement +/* Replaces all occurences of search in a new copy of string by replacement * and overwrites the original string */ void remmina_public_str_replace_in_place(gchar *string, const gchar *search, const gchar *replacement) { diff --git a/remmina/src/remmina_public.h b/remmina/src/remmina_public.h index 34b2d6973..9dc015a12 100644 --- a/remmina/src/remmina_public.h +++ b/remmina/src/remmina_public.h @@ -73,7 +73,7 @@ GtkWidget* remmina_public_create_combo_text_d(const gchar *text, const gchar *de void remmina_public_load_combo_text_d(GtkWidget *combo, const gchar *text, const gchar *def, const gchar *empty_choice); GtkWidget* remmina_public_create_combo(gboolean use_icon); GtkWidget* remmina_public_create_combo_map(const gpointer *key_value_list, const gchar *def, gboolean use_icon, - const gchar *domain); + const gchar *domain); GtkWidget* remmina_public_create_combo_mapint(const gpointer *key_value_list, gint def, gboolean use_icon, const gchar *domain); void remmina_public_create_group(GtkGrid *table, const gchar *group, gint row, gint rows, gint cols); @@ -107,7 +107,7 @@ void remmina_public_gtk_widget_reparent(GtkWidget *widget, GtkContainer *contain gchar* remmina_public_str_replace(const gchar *string, const gchar *search, const gchar *replacement); /* Validate the inserted value for a new resolution */ gboolean remmina_public_resolution_validation_func(const gchar *new_str, gchar **error); -/* Replaces all occurences of search in a new copy of string by replacement +/* Replaces all occurences of search in a new copy of string by replacement * and overwrites the original string */ void remmina_public_str_replace_in_place(gchar *string, const gchar *search, const gchar *replacement); #endif /* __REMMINAPUBLIC_H__ */ diff --git a/remmina/src/remmina_scrolled_viewport.h b/remmina/src/remmina_scrolled_viewport.h index 0d4fcef4c..3b75252f3 100644 --- a/remmina/src/remmina_scrolled_viewport.h +++ b/remmina/src/remmina_scrolled_viewport.h @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2009 - Vic Lee + * Copyright (C) 2009 - Vic Lee * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give diff --git a/remmina/src/remmina_sftp_client.c b/remmina/src/remmina_sftp_client.c index dca64e942..1928ad34d 100644 --- a/remmina/src/remmina_sftp_client.c +++ b/remmina/src/remmina_sftp_client.c @@ -152,7 +152,7 @@ remmina_sftp_client_thread_get_task (RemminaSFTPClient *client) static gboolean remmina_sftp_client_thread_download_file (RemminaSFTPClient *client, RemminaSFTP *sftp, RemminaFTPTask *task, - const gchar *remote_path, const gchar *local_path, guint64 *donesize) + const gchar *remote_path, const gchar *local_path, guint64 *donesize) { TRACE_CALL("remmina_sftp_client_thread_download_file"); sftp_file remote_file; @@ -193,13 +193,13 @@ remmina_sftp_client_thread_download_file (RemminaSFTPClient *client, RemminaSFTP switch (response) { - case GTK_RESPONSE_CANCEL: - case GTK_RESPONSE_DELETE_EVENT: + case GTK_RESPONSE_CANCEL: + case GTK_RESPONSE_DELETE_EVENT: fclose (local_file); remmina_sftp_client_thread_set_error (client, task, NULL); return FALSE; - case GTK_RESPONSE_ACCEPT: + case GTK_RESPONSE_ACCEPT: fclose (local_file); local_file = g_fopen (local_path, "wb"); if (!local_file) @@ -210,7 +210,7 @@ remmina_sftp_client_thread_download_file (RemminaSFTPClient *client, RemminaSFTP size = 0; break; - case GTK_RESPONSE_APPLY: + case GTK_RESPONSE_APPLY: break; } } @@ -223,7 +223,7 @@ remmina_sftp_client_thread_download_file (RemminaSFTPClient *client, RemminaSFTP { fclose (local_file); remmina_sftp_client_thread_set_error (client, task, _("Error opening file %s on server. %s"), - remote_path, ssh_get_error (REMMINA_SSH (client->sftp)->session)); + remote_path, ssh_get_error (REMMINA_SSH (client->sftp)->session)); return FALSE; } @@ -234,7 +234,7 @@ remmina_sftp_client_thread_download_file (RemminaSFTPClient *client, RemminaSFTP sftp_close (remote_file); fclose (local_file); remmina_sftp_client_thread_set_error (client, task, "Error seeking remote file %s. %s", - remote_path, ssh_get_error (REMMINA_SSH (client->sftp)->session)); + remote_path, ssh_get_error (REMMINA_SSH (client->sftp)->session)); return FALSE; } *donesize = size; @@ -265,7 +265,7 @@ remmina_sftp_client_thread_download_file (RemminaSFTPClient *client, RemminaSFTP static gboolean remmina_sftp_client_thread_recursive_dir (RemminaSFTPClient *client, RemminaSFTP *sftp, RemminaFTPTask *task, - const gchar *rootdir_path, const gchar *subdir_path, GPtrArray *array) + const gchar *rootdir_path, const gchar *subdir_path, GPtrArray *array) { TRACE_CALL("remmina_sftp_client_thread_recursive_dir"); sftp_dir sftpdir; @@ -293,7 +293,7 @@ remmina_sftp_client_thread_recursive_dir (RemminaSFTPClient *client, RemminaSFTP if (!sftpdir) { remmina_sftp_client_thread_set_error (client, task, _("Error opening directory %s. %s"), - dir_path, ssh_get_error (REMMINA_SSH (client->sftp)->session)); + dir_path, ssh_get_error (REMMINA_SSH (client->sftp)->session)); g_free(dir_path); return FALSE; } @@ -303,7 +303,7 @@ remmina_sftp_client_thread_recursive_dir (RemminaSFTPClient *client, RemminaSFTP while ((sftpattr = sftp_readdir (sftp->sftp_sess, sftpdir))) { if (g_strcmp0(sftpattr->name, ".") != 0 && - g_strcmp0(sftpattr->name, "..") != 0) + g_strcmp0(sftpattr->name, "..") != 0) { GET_SFTPATTR_TYPE (sftpattr, type); @@ -351,7 +351,7 @@ remmina_sftp_client_thread_recursive_dir (RemminaSFTPClient *client, RemminaSFTP static gboolean remmina_sftp_client_thread_recursive_localdir (RemminaSFTPClient *client, RemminaFTPTask *task, - const gchar *rootdir_path, const gchar *subdir_path, GPtrArray *array) + const gchar *rootdir_path, const gchar *subdir_path, GPtrArray *array) { TRACE_CALL("remmina_sftp_client_thread_recursive_localdir"); GDir *dir; @@ -416,7 +416,7 @@ remmina_sftp_client_thread_mkdir (RemminaSFTPClient *client, RemminaSFTP *sftp, if (sftp_mkdir (sftp->sftp_sess, path, 0755) < 0) { remmina_sftp_client_thread_set_error (client, task, _("Error creating folder %s on server. %s"), - path, ssh_get_error (REMMINA_SSH (client->sftp)->session)); + path, ssh_get_error (REMMINA_SSH (client->sftp)->session)); return FALSE; } return TRUE; @@ -424,7 +424,7 @@ remmina_sftp_client_thread_mkdir (RemminaSFTPClient *client, RemminaSFTP *sftp, static gboolean remmina_sftp_client_thread_upload_file (RemminaSFTPClient *client, RemminaSFTP *sftp, RemminaFTPTask *task, - const gchar *remote_path, const gchar *local_path, guint64 *donesize) + const gchar *remote_path, const gchar *local_path, guint64 *donesize) { TRACE_CALL("remmina_sftp_client_thread_upload_file"); sftp_file remote_file; @@ -445,7 +445,7 @@ remmina_sftp_client_thread_upload_file (RemminaSFTPClient *client, RemminaSFTP * if (!remote_file) { remmina_sftp_client_thread_set_error (client, task, _("Error creating file %s on server. %s"), - remote_path, ssh_get_error (REMMINA_SSH (client->sftp)->session)); + remote_path, ssh_get_error (REMMINA_SSH (client->sftp)->session)); return FALSE; } attr = sftp_fstat (remote_file); @@ -456,13 +456,13 @@ remmina_sftp_client_thread_upload_file (RemminaSFTPClient *client, RemminaSFTP * response = remmina_sftp_client_confirm_resume (client, remote_path); switch (response) { - case GTK_RESPONSE_CANCEL: - case GTK_RESPONSE_DELETE_EVENT: + case GTK_RESPONSE_CANCEL: + case GTK_RESPONSE_DELETE_EVENT: sftp_close (remote_file); remmina_sftp_client_thread_set_error (client, task, NULL); return FALSE; - case GTK_RESPONSE_ACCEPT: + case GTK_RESPONSE_ACCEPT: sftp_close (remote_file); tmp = remmina_ssh_unconvert (REMMINA_SSH (sftp), remote_path); remote_file = sftp_open (sftp->sftp_sess, tmp, O_WRONLY | O_CREAT | O_TRUNC, 0644); @@ -470,18 +470,18 @@ remmina_sftp_client_thread_upload_file (RemminaSFTPClient *client, RemminaSFTP * if (!remote_file) { remmina_sftp_client_thread_set_error (client, task, _("Error creating file %s on server. %s"), - remote_path, ssh_get_error (REMMINA_SSH (client->sftp)->session)); + remote_path, ssh_get_error (REMMINA_SSH (client->sftp)->session)); return FALSE; } size = 0; break; - case GTK_RESPONSE_APPLY: + case GTK_RESPONSE_APPLY: if (sftp_seek64 (remote_file, size) < 0) { sftp_close (remote_file); remmina_sftp_client_thread_set_error (client, task, "Error seeking remote file %s. %s", - remote_path, ssh_get_error (REMMINA_SSH (client->sftp)->session)); + remote_path, ssh_get_error (REMMINA_SSH (client->sftp)->session)); return FALSE; } break; @@ -517,7 +517,7 @@ remmina_sftp_client_thread_upload_file (RemminaSFTPClient *client, RemminaSFTP * sftp_close (remote_file); fclose (local_file); remmina_sftp_client_thread_set_error (client, task, _("Error writing file %s on server. %s"), - remote_path, ssh_get_error (REMMINA_SSH (client->sftp)->session)); + remote_path, ssh_get_error (REMMINA_SSH (client->sftp)->session)); return FALSE; } @@ -557,8 +557,8 @@ remmina_sftp_client_thread_main (gpointer data) { sftp = remmina_sftp_new_from_ssh (REMMINA_SSH (client->sftp)); if (!remmina_ssh_init_session (REMMINA_SSH (sftp)) || - remmina_ssh_auth (REMMINA_SSH (sftp), NULL) <= 0 || - !remmina_sftp_open (sftp)) + remmina_ssh_auth (REMMINA_SSH (sftp), NULL) <= 0 || + !remmina_sftp_open (sftp)) { remmina_sftp_client_thread_set_error (client, task, (REMMINA_SSH (sftp))->error); remmina_ftp_task_free (task); @@ -571,15 +571,15 @@ remmina_sftp_client_thread_main (gpointer data) switch (task->tasktype) { - case REMMINA_FTP_TASK_TYPE_DOWNLOAD: + case REMMINA_FTP_TASK_TYPE_DOWNLOAD: switch (task->type) { - case REMMINA_FTP_FILE_TYPE_FILE: + case REMMINA_FTP_FILE_TYPE_FILE: ret = remmina_sftp_client_thread_download_file (client, sftp, task, - remote, local, &size); + remote, local, &size); break; - case REMMINA_FTP_FILE_TYPE_DIR: + case REMMINA_FTP_FILE_TYPE_DIR: array = g_ptr_array_new (); ret = remmina_sftp_client_thread_recursive_dir (client, sftp, task, remote, NULL, array); if (ret) @@ -594,7 +594,7 @@ remmina_sftp_client_thread_main (gpointer data) remote_file = remmina_public_combine_path (remote, (gchar*) g_ptr_array_index (array, i)); local_file = remmina_public_combine_path (local, (gchar*) g_ptr_array_index (array, i)); ret = remmina_sftp_client_thread_download_file (client, sftp, task, - remote_file, local_file, &size); + remote_file, local_file, &size); g_free(remote_file); g_free(local_file); if (!ret) break; @@ -604,7 +604,7 @@ remmina_sftp_client_thread_main (gpointer data) g_ptr_array_free (array, TRUE); break; - default: + default: ret = 0; break; } @@ -614,15 +614,15 @@ remmina_sftp_client_thread_main (gpointer data) } break; - case REMMINA_FTP_TASK_TYPE_UPLOAD: + case REMMINA_FTP_TASK_TYPE_UPLOAD: switch (task->type) { - case REMMINA_FTP_FILE_TYPE_FILE: + case REMMINA_FTP_FILE_TYPE_FILE: ret = remmina_sftp_client_thread_upload_file (client, sftp, task, - remote, local, &size); + remote, local, &size); break; - case REMMINA_FTP_FILE_TYPE_DIR: + case REMMINA_FTP_FILE_TYPE_DIR: ret = remmina_sftp_client_thread_mkdir (client, sftp, task, remote); if (!ret) break; array = g_ptr_array_new (); @@ -645,7 +645,7 @@ remmina_sftp_client_thread_main (gpointer data) else { ret = remmina_sftp_client_thread_upload_file (client, sftp, task, - remote_file, local_file, &size); + remote_file, local_file, &size); } g_free(remote_file); g_free(local_file); @@ -656,7 +656,7 @@ remmina_sftp_client_thread_main (gpointer data) g_ptr_array_free (array, TRUE); break; - default: + default: ret = 0; break; } @@ -741,9 +741,9 @@ remmina_sftp_client_sftp_session_opendir (RemminaSFTPClient *client, const gchar if (!sftpdir) { dialog = gtk_message_dialog_new (GTK_WINDOW(gtk_widget_get_toplevel (GTK_WIDGET (client))), - GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - _("Failed to open directory %s. %s"), dir, - ssh_get_error (REMMINA_SSH (client->sftp)->session)); + GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + _("Failed to open directory %s. %s"), dir, + ssh_get_error (REMMINA_SSH (client->sftp)->session)); gtk_dialog_run (GTK_DIALOG(dialog)); gtk_widget_destroy (dialog); return NULL; @@ -760,8 +760,8 @@ remmina_sftp_client_sftp_session_closedir (RemminaSFTPClient *client, sftp_dir s if (!sftp_dir_eof (sftpdir)) { dialog = gtk_message_dialog_new (GTK_WINDOW(gtk_widget_get_toplevel (GTK_WIDGET (client))), - GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - _("Failed reading directory. %s"), ssh_get_error (REMMINA_SSH (client->sftp)->session)); + GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + _("Failed reading directory. %s"), ssh_get_error (REMMINA_SSH (client->sftp)->session)); gtk_dialog_run (GTK_DIALOG(dialog)); gtk_widget_destroy (dialog); return FALSE; @@ -814,9 +814,9 @@ remmina_sftp_client_on_opendir (RemminaSFTPClient *client, gchar *dir, gpointer if (!newdir) { dialog = gtk_message_dialog_new (NULL, - GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - _("Failed to open directory %s. %s"), dir, - ssh_get_error (REMMINA_SSH (client->sftp)->session)); + GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + _("Failed to open directory %s. %s"), dir, + ssh_get_error (REMMINA_SSH (client->sftp)->session)); gtk_widget_show(dialog); g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(gtk_widget_destroy), NULL); g_free(newdir_conv); @@ -836,19 +836,19 @@ remmina_sftp_client_on_opendir (RemminaSFTPClient *client, gchar *dir, gpointer while ((sftpattr = sftp_readdir (client->sftp->sftp_sess, sftpdir))) { if (g_strcmp0(sftpattr->name, ".") != 0 && - g_strcmp0(sftpattr->name, "..") != 0) + g_strcmp0(sftpattr->name, "..") != 0) { GET_SFTPATTR_TYPE (sftpattr, type); tmp = remmina_ssh_convert (REMMINA_SSH (client->sftp), sftpattr->name); remmina_ftp_client_add_file (REMMINA_FTP_CLIENT (client), - REMMINA_FTP_FILE_COLUMN_TYPE, type, - REMMINA_FTP_FILE_COLUMN_NAME, tmp, - REMMINA_FTP_FILE_COLUMN_SIZE, (gfloat) sftpattr->size, - REMMINA_FTP_FILE_COLUMN_USER, sftpattr->owner, - REMMINA_FTP_FILE_COLUMN_GROUP, sftpattr->group, - REMMINA_FTP_FILE_COLUMN_PERMISSION, sftpattr->permissions, - -1); + REMMINA_FTP_FILE_COLUMN_TYPE, type, + REMMINA_FTP_FILE_COLUMN_NAME, tmp, + REMMINA_FTP_FILE_COLUMN_SIZE, (gfloat) sftpattr->size, + REMMINA_FTP_FILE_COLUMN_USER, sftpattr->owner, + REMMINA_FTP_FILE_COLUMN_GROUP, sftpattr->group, + REMMINA_FTP_FILE_COLUMN_PERMISSION, sftpattr->permissions, + -1); g_free(tmp); } sftp_attributes_free (sftpattr); @@ -881,8 +881,8 @@ remmina_sftp_client_on_canceltask (RemminaSFTPClient *client, gint taskid, gpoin if (client->taskid != taskid) return TRUE; dialog = gtk_message_dialog_new (GTK_WINDOW(gtk_widget_get_toplevel (GTK_WIDGET (client))), - GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, - _("File transfer currently in progress.\nAre you sure to cancel it?")); + GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, + _("File transfer currently in progress.\nAre you sure to cancel it?")); ret = gtk_dialog_run (GTK_DIALOG(dialog)); gtk_widget_destroy (dialog); if (ret == GTK_RESPONSE_YES) @@ -905,11 +905,11 @@ remmina_sftp_client_on_deletefile (RemminaSFTPClient *client, gint type, gchar * tmp = remmina_ssh_unconvert (REMMINA_SSH (client->sftp), name); switch (type) { - case REMMINA_FTP_FILE_TYPE_DIR: + case REMMINA_FTP_FILE_TYPE_DIR: ret = sftp_rmdir (client->sftp->sftp_sess, tmp); break; - case REMMINA_FTP_FILE_TYPE_FILE: + case REMMINA_FTP_FILE_TYPE_FILE: ret = sftp_unlink (client->sftp->sftp_sess, tmp); break; } @@ -918,9 +918,9 @@ remmina_sftp_client_on_deletefile (RemminaSFTPClient *client, gint type, gchar * if (ret != 0) { dialog = gtk_message_dialog_new (GTK_WINDOW(gtk_widget_get_toplevel (GTK_WIDGET (client))), - GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - _("Failed to delete '%s'. %s"), - name, ssh_get_error (REMMINA_SSH (client->sftp)->session)); + GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + _("Failed to delete '%s'. %s"), + name, ssh_get_error (REMMINA_SSH (client->sftp)->session)); gtk_dialog_run (GTK_DIALOG(dialog)); gtk_widget_destroy (dialog); return FALSE; @@ -939,15 +939,15 @@ remmina_sftp_client_init (RemminaSFTPClient *client) /* Setup the internal signals */ g_signal_connect(G_OBJECT(client), "destroy", - G_CALLBACK(remmina_sftp_client_destroy), NULL); + G_CALLBACK(remmina_sftp_client_destroy), NULL); g_signal_connect(G_OBJECT(client), "open-dir", - G_CALLBACK(remmina_sftp_client_on_opendir), NULL); + G_CALLBACK(remmina_sftp_client_on_opendir), NULL); g_signal_connect(G_OBJECT(client), "new-task", - G_CALLBACK(remmina_sftp_client_on_newtask), NULL); + G_CALLBACK(remmina_sftp_client_on_newtask), NULL); g_signal_connect(G_OBJECT(client), "cancel-task", - G_CALLBACK(remmina_sftp_client_on_canceltask), NULL); + G_CALLBACK(remmina_sftp_client_on_canceltask), NULL); g_signal_connect(G_OBJECT(client), "delete-file", - G_CALLBACK(remmina_sftp_client_on_deletefile), NULL); + G_CALLBACK(remmina_sftp_client_on_deletefile), NULL); } static gboolean @@ -980,7 +980,8 @@ remmina_sftp_client_confirm_resume (RemminaSFTPClient *client, const gchar *path if (remmina_ftp_client_get_overwrite_status(REMMINA_FTP_CLIENT(client))) return GTK_RESPONSE_ACCEPT; - if ( !remmina_masterthread_exec_is_main_thread() ) { + if ( !remmina_masterthread_exec_is_main_thread() ) + { /* Allow the execution of this function from a non main thread */ RemminaMTExecData *d; gint retval; @@ -998,12 +999,12 @@ remmina_sftp_client_confirm_resume (RemminaSFTPClient *client, const gchar *path filename = filename ? filename + 1 : path; dialog = gtk_dialog_new_with_buttons (_("File exists"), - GTK_WINDOW(gtk_widget_get_toplevel (GTK_WIDGET (client))), - GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, - _("Resume"), GTK_RESPONSE_APPLY, - _("Overwrite"), GTK_RESPONSE_ACCEPT, - _("_Cancel"), GTK_RESPONSE_CANCEL, - NULL); + GTK_WINDOW(gtk_widget_get_toplevel (GTK_WIDGET (client))), + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + _("Resume"), GTK_RESPONSE_APPLY, + _("Overwrite"), GTK_RESPONSE_ACCEPT, + _("_Cancel"), GTK_RESPONSE_CANCEL, + NULL); gtk_container_set_border_width (GTK_CONTAINER (dialog), 4); #if GTK_VERSION == 3 @@ -1013,7 +1014,7 @@ remmina_sftp_client_confirm_resume (RemminaSFTPClient *client, const gchar *path #endif gtk_widget_show(hbox); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG(dialog))), - hbox, TRUE, TRUE, 4); + hbox, TRUE, TRUE, 4); widget = gtk_image_new_from_icon_name (_("Question"), GTK_ICON_SIZE_DIALOG); gtk_widget_show(widget); @@ -1071,12 +1072,12 @@ remmina_sftp_client_new_init (RemminaSFTP *sftp) gdk_flush (); if (!remmina_ssh_init_session (REMMINA_SSH (sftp)) || - remmina_ssh_auth (REMMINA_SSH (sftp), NULL) <= 0 || - !remmina_sftp_open (sftp)) + remmina_ssh_auth (REMMINA_SSH (sftp), NULL) <= 0 || + !remmina_sftp_open (sftp)) { dialog = gtk_message_dialog_new (GTK_WINDOW(gtk_widget_get_toplevel (client)), - GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - (REMMINA_SSH (sftp))->error, NULL); + GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + (REMMINA_SSH (sftp))->error, NULL); gtk_dialog_run (GTK_DIALOG(dialog)); gtk_widget_destroy (dialog); gtk_widget_destroy (client); diff --git a/remmina/src/remmina_sftp_client.h b/remmina/src/remmina_sftp_client.h index e6fe3c8c6..b84e96fd0 100644 --- a/remmina/src/remmina_sftp_client.h +++ b/remmina/src/remmina_sftp_client.h @@ -62,13 +62,13 @@ typedef struct _RemminaSFTPClient pthread_t thread; gint taskid; gboolean thread_abort; -}RemminaSFTPClient; +} RemminaSFTPClient; typedef struct _RemminaSFTPClientClass { RemminaFTPClientClass parent_class; -}RemminaSFTPClientClass; +} RemminaSFTPClientClass; GType remmina_sftp_client_get_type (void) G_GNUC_CONST; diff --git a/remmina/src/remmina_sftp_plugin.c b/remmina/src/remmina_sftp_plugin.c index 328edb2d7..243535f69 100644 --- a/remmina/src/remmina_sftp_plugin.c +++ b/remmina/src/remmina_sftp_plugin.c @@ -59,7 +59,7 @@ typedef struct _RemminaPluginSftpData GtkWidget *client; pthread_t thread; RemminaSFTP *sftp; -}RemminaPluginSftpData; +} RemminaPluginSftpData; static RemminaPluginService *remmina_plugin_service = NULL; @@ -87,8 +87,8 @@ remmina_plugin_sftp_main_thread (gpointer data) /* Create SFTP connection based on existing SSH session */ sftp = remmina_sftp_new_from_ssh (ssh); if (remmina_ssh_init_session (REMMINA_SSH (sftp)) && - remmina_ssh_auth (REMMINA_SSH (sftp), NULL) > 0 && - remmina_sftp_open (sftp)) + remmina_ssh_auth (REMMINA_SSH (sftp), NULL) > 0 && + remmina_sftp_open (sftp)) { cont = TRUE; } @@ -98,7 +98,7 @@ remmina_plugin_sftp_main_thread (gpointer data) /* New SFTP connection */ remminafile = remmina_plugin_service->protocol_plugin_get_file (gp); remmina_plugin_service->file_set_string (remminafile, "ssh_server", - remmina_plugin_service->file_get_string (remminafile, "server")); + remmina_plugin_service->file_get_string (remminafile, "server")); sftp = remmina_sftp_new_from_file (remminafile); while (1) @@ -110,7 +110,7 @@ remmina_plugin_sftp_main_thread (gpointer data) } ret = remmina_ssh_auth_gui (REMMINA_SSH (sftp), - REMMINA_INIT_DIALOG (remmina_protocol_widget_get_init_dialog (gp))); + REMMINA_INIT_DIALOG (remmina_protocol_widget_get_init_dialog (gp))); if (ret == 0) { remmina_plugin_service->protocol_plugin_set_error (gp, "%s", REMMINA_SSH (sftp)->error); @@ -177,16 +177,16 @@ remmina_plugin_sftp_init (RemminaProtocolWidget *gp) gtk_container_add(GTK_CONTAINER (gp), gpdata->client); remmina_ftp_client_set_show_hidden (REMMINA_FTP_CLIENT (gpdata->client), - remmina_plugin_service->file_get_int (remminafile, "showhidden", FALSE)); + remmina_plugin_service->file_get_int (remminafile, "showhidden", FALSE)); remmina_ftp_client_set_overwrite_status (REMMINA_FTP_CLIENT (gpdata->client), - remmina_plugin_service->file_get_int (remminafile, - REMMINA_PLUGIN_SFTP_FEATURE_PREF_OVERWRITE_ALL_KEY, FALSE)); + remmina_plugin_service->file_get_int (remminafile, + REMMINA_PLUGIN_SFTP_FEATURE_PREF_OVERWRITE_ALL_KEY, FALSE)); remmina_plugin_service->protocol_plugin_register_hostkey (gp, gpdata->client); g_signal_connect(G_OBJECT(gpdata->client), - "realize", G_CALLBACK(remmina_plugin_sftp_client_on_realize), gp); + "realize", G_CALLBACK(remmina_plugin_sftp_client_on_realize), gp); } static gboolean @@ -202,7 +202,7 @@ remmina_plugin_sftp_open_connection (RemminaProtocolWidget *gp) if (pthread_create (&gpdata->thread, NULL, remmina_plugin_sftp_main_thread, gp)) { remmina_plugin_service->protocol_plugin_set_error (gp, - "Failed to initialize pthread. Falling back to non-thread mode..."); + "Failed to initialize pthread. Falling back to non-thread mode..."); gpdata->thread = 0; return FALSE; } @@ -233,7 +233,7 @@ remmina_plugin_sftp_close_connection (RemminaProtocolWidget *gp) * to avoid unwanted overwriting. * If we'd change idea just remove the next line to save the preference. */ remmina_file_set_int(remminafile, - REMMINA_PLUGIN_SFTP_FEATURE_PREF_OVERWRITE_ALL_KEY, FALSE); + REMMINA_PLUGIN_SFTP_FEATURE_PREF_OVERWRITE_ALL_KEY, FALSE); return FALSE; } @@ -254,24 +254,24 @@ remmina_plugin_sftp_call_feature (RemminaProtocolWidget *gp, const RemminaProtoc remminafile = remmina_plugin_service->protocol_plugin_get_file (gp); switch (feature->id) { - case REMMINA_PROTOCOL_FEATURE_TOOL_SSH: + case REMMINA_PROTOCOL_FEATURE_TOOL_SSH: remmina_plugin_service->open_connection ( - remmina_file_dup_temp_protocol (remmina_plugin_service->protocol_plugin_get_file (gp), "SSH"), - NULL, gpdata->sftp, NULL); + remmina_file_dup_temp_protocol (remmina_plugin_service->protocol_plugin_get_file (gp), "SSH"), + NULL, gpdata->sftp, NULL); return; - case REMMINA_PROTOCOL_FEATURE_TOOL_SFTP: + case REMMINA_PROTOCOL_FEATURE_TOOL_SFTP: remmina_plugin_service->open_connection ( - remmina_file_dup_temp_protocol (remmina_plugin_service->protocol_plugin_get_file (gp), "SFTP"), - NULL, gpdata->sftp, NULL); + remmina_file_dup_temp_protocol (remmina_plugin_service->protocol_plugin_get_file (gp), "SFTP"), + NULL, gpdata->sftp, NULL); return; - case REMMINA_PLUGIN_SFTP_FEATURE_PREF_SHOW_HIDDEN: + case REMMINA_PLUGIN_SFTP_FEATURE_PREF_SHOW_HIDDEN: remmina_ftp_client_set_show_hidden (REMMINA_FTP_CLIENT (gpdata->client), - remmina_plugin_service->file_get_int (remminafile, "showhidden", FALSE)); + remmina_plugin_service->file_get_int (remminafile, "showhidden", FALSE)); return; - case REMMINA_PLUGIN_SFTP_FEATURE_PREF_OVERWRITE_ALL: + case REMMINA_PLUGIN_SFTP_FEATURE_PREF_OVERWRITE_ALL: remmina_ftp_client_set_overwrite_status (REMMINA_FTP_CLIENT (gpdata->client), - remmina_plugin_service->file_get_int (remminafile, - REMMINA_PLUGIN_SFTP_FEATURE_PREF_OVERWRITE_ALL_KEY, FALSE)); + remmina_plugin_service->file_get_int (remminafile, + REMMINA_PLUGIN_SFTP_FEATURE_PREF_OVERWRITE_ALL_KEY, FALSE)); return; } } diff --git a/remmina/src/remmina_ssh.c b/remmina/src/remmina_ssh.c index bbb09030f..fcb714241 100644 --- a/remmina/src/remmina_ssh.c +++ b/remmina/src/remmina_ssh.c @@ -84,14 +84,15 @@ #define LOCK_SSH(ssh) pthread_mutex_lock (&REMMINA_SSH (ssh)->ssh_mutex); #define UNLOCK_SSH(ssh) pthread_mutex_unlock (&REMMINA_SSH (ssh)->ssh_mutex); -static const gchar *common_identities[] = { +static const gchar *common_identities[] = +{ ".ssh/id_rsa", ".ssh/id_dsa", ".ssh/identity", NULL }; - gchar* +gchar* remmina_ssh_identity_path (const gchar *id) { TRACE_CALL("remmina_ssh_identity_path"); @@ -100,16 +101,18 @@ remmina_ssh_identity_path (const gchar *id) return g_strdup_printf("%s/%s", g_get_home_dir (), id); } - gchar* +gchar* remmina_ssh_find_identity (void) { TRACE_CALL("remmina_ssh_find_identity"); gchar *path; gint i; - for (i = 0; common_identities[i]; i++) { + for (i = 0; common_identities[i]; i++) + { path = remmina_ssh_identity_path (common_identities[i]); - if (g_file_test (path, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_EXISTS)) { + if (g_file_test (path, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_EXISTS)) + { return path; } g_free(path); @@ -117,7 +120,7 @@ remmina_ssh_find_identity (void) return NULL; } - void +void remmina_ssh_set_error (RemminaSSH *ssh, const gchar *fmt) { TRACE_CALL("remmina_ssh_set_error"); @@ -127,7 +130,7 @@ remmina_ssh_set_error (RemminaSSH *ssh, const gchar *fmt) ssh->error = g_strdup_printf(fmt, err); } - void +void remmina_ssh_set_application_error (RemminaSSH *ssh, const gchar *fmt, ...) { TRACE_CALL("remmina_ssh_set_application_error"); @@ -138,7 +141,7 @@ remmina_ssh_set_application_error (RemminaSSH *ssh, const gchar *fmt, ...) va_end (args); } - static gint +static gint remmina_ssh_auth_password (RemminaSSH *ssh) { TRACE_CALL("remmina_ssh_auth_password"); @@ -152,18 +155,23 @@ remmina_ssh_auth_password (RemminaSSH *ssh) if (ssh->password == NULL) return -1; authlist = ssh_userauth_list (ssh->session, NULL); - if (authlist & SSH_AUTH_METHOD_INTERACTIVE) { - while ((ret = ssh_userauth_kbdint (ssh->session, NULL, NULL)) == SSH_AUTH_INFO) { + if (authlist & SSH_AUTH_METHOD_INTERACTIVE) + { + while ((ret = ssh_userauth_kbdint (ssh->session, NULL, NULL)) == SSH_AUTH_INFO) + { n = ssh_userauth_kbdint_getnprompts (ssh->session); - for (i = 0; i < n; i++) { + for (i = 0; i < n; i++) + { ssh_userauth_kbdint_setanswer(ssh->session, i, ssh->password); } } } - if (ret != SSH_AUTH_SUCCESS && authlist & SSH_AUTH_METHOD_PASSWORD) { + if (ret != SSH_AUTH_SUCCESS && authlist & SSH_AUTH_METHOD_PASSWORD) + { ret = ssh_userauth_password (ssh->session, NULL, ssh->password); } - if (ret != SSH_AUTH_SUCCESS) { + if (ret != SSH_AUTH_SUCCESS) + { remmina_ssh_set_error (ssh, _("SSH password authentication failed: %s")); return 0; } @@ -172,7 +180,7 @@ remmina_ssh_auth_password (RemminaSSH *ssh) return 1; } - static gint +static gint remmina_ssh_auth_pubkey (RemminaSSH *ssh) { TRACE_CALL("remmina_ssh_auth_pubkey"); @@ -181,14 +189,16 @@ remmina_ssh_auth_pubkey (RemminaSSH *ssh) if (ssh->authenticated) return 1; - if (ssh->privkeyfile == NULL) { + if (ssh->privkeyfile == NULL) + { ssh->error = g_strdup_printf(_("SSH public key authentication failed: %s"), - _("SSH Key file not yet set.")); + _("SSH Key file not yet set.")); return 0; } if ( ssh_pki_import_privkey_file( ssh->privkeyfile, (ssh->password ? ssh->password : ""), - NULL, NULL, &priv_key ) != SSH_OK ) { + NULL, NULL, &priv_key ) != SSH_OK ) + { if (ssh->password == NULL || ssh->password[0] == '\0') return -1; remmina_ssh_set_error (ssh, _("SSH public key authentication failed: %s")); @@ -198,7 +208,8 @@ remmina_ssh_auth_pubkey (RemminaSSH *ssh) ret = ssh_userauth_publickey (ssh->session, NULL, priv_key); ssh_key_free(priv_key); - if (ret != SSH_AUTH_SUCCESS) { + if (ret != SSH_AUTH_SUCCESS) + { remmina_ssh_set_error (ssh, _("SSH public key authentication failed: %s")); return 0; } @@ -207,14 +218,15 @@ remmina_ssh_auth_pubkey (RemminaSSH *ssh) return 1; } - static gint +static gint remmina_ssh_auth_auto_pubkey (RemminaSSH* ssh) { TRACE_CALL("remmina_ssh_auth_auto_pubkey"); gint ret; ret = ssh_userauth_autopubkey (ssh->session, ""); - if (ret != SSH_AUTH_SUCCESS) { + if (ret != SSH_AUTH_SUCCESS) + { remmina_ssh_set_error (ssh, _("SSH automatic public key authentication failed: %s")); return 0; } @@ -223,14 +235,15 @@ remmina_ssh_auth_auto_pubkey (RemminaSSH* ssh) return 1; } - static gint +static gint remmina_ssh_auth_agent (RemminaSSH* ssh) { TRACE_CALL("remmina_ssh_auth_agent"); gint ret; ret = ssh_userauth_agent (ssh->session, NULL); - if (ret != SSH_AUTH_SUCCESS) { + if (ret != SSH_AUTH_SUCCESS) + { remmina_ssh_set_error (ssh, _("SSH public key authentication with ssh agent failed: %s")); return 0; } @@ -239,42 +252,45 @@ remmina_ssh_auth_agent (RemminaSSH* ssh) return 1; } - gint +gint remmina_ssh_auth (RemminaSSH *ssh, const gchar *password) { TRACE_CALL("remmina_ssh_auth"); /* Check known host again to ensure it's still the original server when user forks a new session from existing one */ - if (ssh_is_server_known (ssh->session) != SSH_SERVER_KNOWN_OK) { + if (ssh_is_server_known (ssh->session) != SSH_SERVER_KNOWN_OK) + { remmina_ssh_set_application_error (ssh, "SSH public key has changed!"); return 0; } - if (password) { + if (password) + { g_free(ssh->password); ssh->password = g_strdup (password); } - switch (ssh->auth) { + switch (ssh->auth) + { - case SSH_AUTH_PASSWORD: - return remmina_ssh_auth_password (ssh); + case SSH_AUTH_PASSWORD: + return remmina_ssh_auth_password (ssh); - case SSH_AUTH_PUBLICKEY: - return remmina_ssh_auth_pubkey (ssh); + case SSH_AUTH_PUBLICKEY: + return remmina_ssh_auth_pubkey (ssh); - case SSH_AUTH_AGENT: - return remmina_ssh_auth_agent (ssh); + case SSH_AUTH_AGENT: + return remmina_ssh_auth_agent (ssh); - case SSH_AUTH_AUTO_PUBLICKEY: - return remmina_ssh_auth_auto_pubkey (ssh); + case SSH_AUTH_AUTO_PUBLICKEY: + return remmina_ssh_auth_auto_pubkey (ssh); - default: - return 0; + default: + return 0; } } - gint +gint remmina_ssh_auth_gui (RemminaSSH *ssh, RemminaInitDialog *dialog) { TRACE_CALL("remmina_ssh_auth_gui"); @@ -287,43 +303,49 @@ remmina_ssh_auth_gui (RemminaSSH *ssh, RemminaInitDialog *dialog) /* Check if the server's public key is known */ ret = ssh_is_server_known (ssh->session); - switch (ret) { - case SSH_SERVER_KNOWN_OK: - break; /* ok */ - - case SSH_SERVER_FILE_NOT_FOUND: - /* fallback to SSH_SERVER_NOT_KNOWN behavior */ - case SSH_SERVER_NOT_KNOWN: - case SSH_SERVER_KNOWN_CHANGED: - case SSH_SERVER_FOUND_OTHER: - if ( ssh_get_publickey(ssh->session, &server_pubkey) != SSH_OK ) { - remmina_ssh_set_error(ssh, "ssh_get_publickey() has failed: %s"); - return 0; - } - if ( ssh_get_publickey_hash(server_pubkey, SSH_PUBLICKEY_HASH_MD5, &pubkey, &len) != 0 ) { - ssh_key_free(server_pubkey); - remmina_ssh_set_error(ssh, "ssh_get_publickey_hash() has failed: %s"); - return 0; - } + switch (ret) + { + case SSH_SERVER_KNOWN_OK: + break; /* ok */ + + case SSH_SERVER_FILE_NOT_FOUND: + /* fallback to SSH_SERVER_NOT_KNOWN behavior */ + case SSH_SERVER_NOT_KNOWN: + case SSH_SERVER_KNOWN_CHANGED: + case SSH_SERVER_FOUND_OTHER: + if ( ssh_get_publickey(ssh->session, &server_pubkey) != SSH_OK ) + { + remmina_ssh_set_error(ssh, "ssh_get_publickey() has failed: %s"); + return 0; + } + if ( ssh_get_publickey_hash(server_pubkey, SSH_PUBLICKEY_HASH_MD5, &pubkey, &len) != 0 ) + { ssh_key_free(server_pubkey); - keyname = ssh_get_hexa (pubkey, len); + remmina_ssh_set_error(ssh, "ssh_get_publickey_hash() has failed: %s"); + return 0; + } + ssh_key_free(server_pubkey); + keyname = ssh_get_hexa (pubkey, len); - if (ret == SSH_SERVER_NOT_KNOWN || ret == SSH_SERVER_FILE_NOT_FOUND) { - ret = remmina_init_dialog_serverkey_unknown (dialog, keyname); - } else { - ret = remmina_init_dialog_serverkey_changed (dialog, keyname); - } + if (ret == SSH_SERVER_NOT_KNOWN || ret == SSH_SERVER_FILE_NOT_FOUND) + { + ret = remmina_init_dialog_serverkey_unknown (dialog, keyname); + } + else + { + ret = remmina_init_dialog_serverkey_changed (dialog, keyname); + } - ssh_string_free_char(keyname); - ssh_clean_pubkey_hash (&pubkey); - if (ret != GTK_RESPONSE_OK) return -1; - ssh_write_knownhost (ssh->session); - break; - case SSH_SERVER_ERROR: - default: - remmina_ssh_set_error (ssh, "SSH known host checking failed: %s"); - return 0; + ssh_string_free_char(keyname); + ssh_clean_pubkey_hash (&pubkey); + if (ret != GTK_RESPONSE_OK) return -1; + ssh_write_knownhost (ssh->session); + break; + case SSH_SERVER_ERROR: + default: + remmina_ssh_set_error (ssh, "SSH known host checking failed: %s"); + return 0; } /* Try empty password or existing password first */ @@ -331,23 +353,26 @@ remmina_ssh_auth_gui (RemminaSSH *ssh, RemminaInitDialog *dialog) if (ret > 0) return 1; /* Requested for a non-empty password */ - if (ret < 0) { + if (ret < 0) + { if (!dialog) return -1; - switch (ssh->auth) { - case SSH_AUTH_PASSWORD: - tips = _("Authenticating %s's password to SSH server %s..."); - keyname = _("SSH password"); - break; - case SSH_AUTH_PUBLICKEY: - tips = _("Authenticating %s's identity to SSH server %s..."); - keyname = _("SSH private key passphrase"); - break; - default: - return FALSE; + switch (ssh->auth) + { + case SSH_AUTH_PASSWORD: + tips = _("Authenticating %s's password to SSH server %s..."); + keyname = _("SSH password"); + break; + case SSH_AUTH_PUBLICKEY: + tips = _("Authenticating %s's identity to SSH server %s..."); + keyname = _("SSH private key passphrase"); + break; + default: + return FALSE; } - if (ssh->auth != SSH_AUTH_AUTO_PUBLICKEY) { + if (ssh->auth != SSH_AUTH_AUTO_PUBLICKEY) + { remmina_init_dialog_set_status (dialog, tips, ssh->user, ssh->server); ret = remmina_init_dialog_authpwd (dialog, keyname, FALSE); @@ -356,21 +381,22 @@ remmina_ssh_auth_gui (RemminaSSH *ssh, RemminaInitDialog *dialog) ret = remmina_ssh_auth (ssh, dialog->password); } - if (ret <= 0) { + if (ret <= 0) + { return 0; } return 1; } - void +void remmina_ssh_log_callback(ssh_session session, int priority, const char *message, void *userdata) { TRACE_CALL("remmina_ssh_log_callback"); remmina_log_printf ("[SSH] %s\n", message); } - gboolean +gboolean remmina_ssh_init_session (RemminaSSH *ssh) { TRACE_CALL("remmina_ssh_init_session"); @@ -384,7 +410,8 @@ remmina_ssh_init_session (RemminaSSH *ssh) ssh_options_set (ssh->session, SSH_OPTIONS_HOST, ssh->server); ssh_options_set (ssh->session, SSH_OPTIONS_PORT, &ssh->port); ssh_options_set (ssh->session, SSH_OPTIONS_USER, ssh->user); - if (remmina_log_running ()) { + if (remmina_log_running ()) + { verbosity = remmina_pref.ssh_loglevel; ssh_options_set (ssh->session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity); ssh->callback->log_function = remmina_ssh_log_callback; @@ -394,19 +421,21 @@ remmina_ssh_init_session (RemminaSSH *ssh) /* As the latest parse the ~/.ssh/config file */ ssh_options_parse_config(ssh->session, NULL); - if (ssh_connect (ssh->session)) { + if (ssh_connect (ssh->session)) + { remmina_ssh_set_error (ssh, _("Failed to startup SSH session: %s")); return FALSE; } /* Try the "none" authentication */ - if (ssh_userauth_none (ssh->session, NULL) == SSH_AUTH_SUCCESS) { + if (ssh_userauth_none (ssh->session, NULL) == SSH_AUTH_SUCCESS) + { ssh->authenticated = TRUE; } return TRUE; } - gboolean +gboolean remmina_ssh_init_from_file (RemminaSSH *ssh, RemminaFile *remminafile) { TRACE_CALL("remmina_ssh_init_from_file"); @@ -427,16 +456,22 @@ remmina_ssh_init_from_file (RemminaSSH *ssh, RemminaFile *remminafile) ssh_username = remmina_file_get_string (remminafile, "ssh_username"); ssh_privatekey = remmina_file_get_string (remminafile, "ssh_privatekey"); server = remmina_file_get_string (remminafile, "server"); - if (ssh_server) { + if (ssh_server) + { remmina_public_get_server_port (ssh_server, 22, &ssh->server, &ssh->port); - if (ssh->server[0] == '\0') { + if (ssh->server[0] == '\0') + { g_free(ssh->server); remmina_public_get_server_port (server, 0, &ssh->server, NULL); } - } else if (server == NULL) { + } + else if (server == NULL) + { ssh->server = g_strdup ("localhost"); ssh->port = 22; - } else { + } + else + { remmina_public_get_server_port (server, 0, &ssh->server, NULL); ssh->port = 22; } @@ -448,17 +483,20 @@ remmina_ssh_init_from_file (RemminaSSH *ssh, RemminaFile *remminafile) /* Public/Private keys */ s = (ssh_privatekey ? g_strdup (ssh_privatekey) : remmina_ssh_find_identity ()); - if (s) { + if (s) + { ssh->privkeyfile = remmina_ssh_identity_path (s); g_free(s); - } else { + } + else + { ssh->privkeyfile = NULL; } return TRUE; } - static gboolean +static gboolean remmina_ssh_init_from_ssh (RemminaSSH *ssh, const RemminaSSH *ssh_src) { TRACE_CALL("remmina_ssh_init_from_ssh"); @@ -478,37 +516,40 @@ remmina_ssh_init_from_ssh (RemminaSSH *ssh, const RemminaSSH *ssh_src) return TRUE; } - gchar* +gchar* remmina_ssh_convert (RemminaSSH *ssh, const gchar *from) { TRACE_CALL("remmina_ssh_convert"); gchar *to = NULL; - if (ssh->charset && from) { + if (ssh->charset && from) + { to = g_convert (from, -1, "UTF-8", ssh->charset, NULL, NULL, NULL); } if (!to) to = g_strdup (from); return to; } - gchar* +gchar* remmina_ssh_unconvert (RemminaSSH *ssh, const gchar *from) { TRACE_CALL("remmina_ssh_unconvert"); gchar *to = NULL; - if (ssh->charset && from) { + if (ssh->charset && from) + { to = g_convert (from, -1, ssh->charset, "UTF-8", NULL, NULL, NULL); } if (!to) to = g_strdup (from); return to; } - void +void remmina_ssh_free (RemminaSSH *ssh) { TRACE_CALL("remmina_ssh_free"); - if (ssh->session) { + if (ssh->session) + { ssh_disconnect (ssh->session); ssh_free (ssh->session); ssh->session = NULL; @@ -527,13 +568,14 @@ remmina_ssh_free (RemminaSSH *ssh) /*-----------------------------------------------------------------------------* * SSH Tunnel * *-----------------------------------------------------------------------------*/ -struct _RemminaSSHTunnelBuffer { +struct _RemminaSSHTunnelBuffer +{ gchar *data; gchar *ptr; ssize_t len; }; - static RemminaSSHTunnelBuffer* +static RemminaSSHTunnelBuffer* remmina_ssh_tunnel_buffer_new (ssize_t len) { TRACE_CALL("remmina_ssh_tunnel_buffer_new"); @@ -546,17 +588,18 @@ remmina_ssh_tunnel_buffer_new (ssize_t len) return buffer; } - static void +static void remmina_ssh_tunnel_buffer_free (RemminaSSHTunnelBuffer *buffer) { TRACE_CALL("remmina_ssh_tunnel_buffer_free"); - if (buffer) { + if (buffer) + { g_free(buffer->data); g_free(buffer); } } - RemminaSSHTunnel* +RemminaSSHTunnel* remmina_ssh_tunnel_new_from_file (RemminaFile *remminafile) { TRACE_CALL("remmina_ssh_tunnel_new_from_file"); @@ -591,13 +634,14 @@ remmina_ssh_tunnel_new_from_file (RemminaFile *remminafile) return tunnel; } - static void +static void remmina_ssh_tunnel_close_all_channels (RemminaSSHTunnel *tunnel) { TRACE_CALL("remmina_ssh_tunnel_close_all_channels"); int i; - for (i = 0; i < tunnel->num_channels; i++) { + for (i = 0; i < tunnel->num_channels; i++) + { close (tunnel->sockets[i]); remmina_ssh_tunnel_buffer_free (tunnel->socketbuffers[i]); ssh_channel_close (tunnel->channels[i]); @@ -614,14 +658,15 @@ remmina_ssh_tunnel_close_all_channels (RemminaSSHTunnel *tunnel) tunnel->num_channels = 0; tunnel->max_channels = 0; - if (tunnel->x11_channel) { + if (tunnel->x11_channel) + { ssh_channel_close (tunnel->x11_channel); ssh_channel_free (tunnel->x11_channel); tunnel->x11_channel = NULL; } } - static void +static void remmina_ssh_tunnel_remove_channel (RemminaSSHTunnel *tunnel, gint n) { TRACE_CALL("remmina_ssh_tunnel_remove_channel"); @@ -637,7 +682,7 @@ remmina_ssh_tunnel_remove_channel (RemminaSSHTunnel *tunnel, gint n) } /* Register the new channel/socket pair */ - static void +static void remmina_ssh_tunnel_add_channel (RemminaSSHTunnel *tunnel, ssh_channel channel, gint sock) { TRACE_CALL("remmina_ssh_tunnel_add_channel"); @@ -645,18 +690,19 @@ remmina_ssh_tunnel_add_channel (RemminaSSHTunnel *tunnel, ssh_channel channel, g gint i; i = tunnel->num_channels++; - if (tunnel->num_channels > tunnel->max_channels) { + if (tunnel->num_channels > tunnel->max_channels) + { /* Allocate an extra NULL pointer in channels for ssh_select */ tunnel->channels = (ssh_channel*) g_realloc (tunnel->channels, - sizeof (ssh_channel) * (tunnel->num_channels + 1)); + sizeof (ssh_channel) * (tunnel->num_channels + 1)); tunnel->sockets = (gint*) g_realloc (tunnel->sockets, - sizeof (gint) * tunnel->num_channels); + sizeof (gint) * tunnel->num_channels); tunnel->socketbuffers = (RemminaSSHTunnelBuffer**) g_realloc (tunnel->socketbuffers, - sizeof (RemminaSSHTunnelBuffer*) * tunnel->num_channels); + sizeof (RemminaSSHTunnelBuffer*) * tunnel->num_channels); tunnel->max_channels = tunnel->num_channels; tunnel->channels_out = (ssh_channel*) g_realloc (tunnel->channels_out, - sizeof (ssh_channel) * (tunnel->num_channels + 1)); + sizeof (ssh_channel) * (tunnel->num_channels + 1)); } tunnel->channels[i] = channel; tunnel->channels[i + 1] = NULL; @@ -667,7 +713,7 @@ remmina_ssh_tunnel_add_channel (RemminaSSHTunnel *tunnel, ssh_channel channel, g fcntl (sock, F_SETFL, flags | O_NONBLOCK); } - static gpointer +static gpointer remmina_ssh_tunnel_main_thread_proc (gpointer data) { TRACE_CALL("remmina_ssh_tunnel_main_thread_proc"); @@ -690,192 +736,239 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) g_get_current_time (&t1); t2 = t1; - switch (tunnel->tunnel_type) { - case REMMINA_SSH_TUNNEL_OPEN: - /* Accept a local connection */ - sock = accept (tunnel->server_sock, NULL, NULL); - if (sock < 0) { - REMMINA_SSH (tunnel)->error = g_strdup ("Failed to accept local socket"); - tunnel->thread = 0; - return NULL; - } - - if ((channel = ssh_channel_new (tunnel->ssh.session)) == NULL) { - close (sock); - remmina_ssh_set_error (REMMINA_SSH (tunnel), "Failed to createt channel : %s"); - tunnel->thread = 0; - return NULL; - } - /* Request the SSH server to connect to the destination */ - if (ssh_channel_open_forward (channel, tunnel->dest, tunnel->port, "127.0.0.1", 0) != SSH_OK) { - close (sock); - ssh_channel_close (channel); - ssh_channel_free (channel); - remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to connect to the SSH tunnel destination: %s")); - tunnel->thread = 0; - return NULL; - } - remmina_ssh_tunnel_add_channel (tunnel, channel, sock); - break; + switch (tunnel->tunnel_type) + { + case REMMINA_SSH_TUNNEL_OPEN: + /* Accept a local connection */ + sock = accept (tunnel->server_sock, NULL, NULL); + if (sock < 0) + { + REMMINA_SSH (tunnel)->error = g_strdup ("Failed to accept local socket"); + tunnel->thread = 0; + return NULL; + } - case REMMINA_SSH_TUNNEL_X11: - if ((tunnel->x11_channel = ssh_channel_new (tunnel->ssh.session)) == NULL) { - remmina_ssh_set_error (REMMINA_SSH (tunnel), "Failed to create channel : %s"); - tunnel->thread = 0; - return NULL; - } - if (!remmina_public_get_xauth_cookie (tunnel->localdisplay, &ptr)) { - remmina_ssh_set_application_error (REMMINA_SSH (tunnel), "%s", ptr); - g_free(ptr); - tunnel->thread = 0; - return NULL; - } - if (ssh_channel_open_session (tunnel->x11_channel) || - ssh_channel_request_x11 (tunnel->x11_channel, TRUE, NULL, ptr, - gdk_screen_get_number (gdk_screen_get_default ()))) { - g_free(ptr); - remmina_ssh_set_error (REMMINA_SSH (tunnel), "Failed to open channel : %s"); - tunnel->thread = 0; - return NULL; - } + if ((channel = ssh_channel_new (tunnel->ssh.session)) == NULL) + { + close (sock); + remmina_ssh_set_error (REMMINA_SSH (tunnel), "Failed to createt channel : %s"); + tunnel->thread = 0; + return NULL; + } + /* Request the SSH server to connect to the destination */ + if (ssh_channel_open_forward (channel, tunnel->dest, tunnel->port, "127.0.0.1", 0) != SSH_OK) + { + close (sock); + ssh_channel_close (channel); + ssh_channel_free (channel); + remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to connect to the SSH tunnel destination: %s")); + tunnel->thread = 0; + return NULL; + } + remmina_ssh_tunnel_add_channel (tunnel, channel, sock); + break; + + case REMMINA_SSH_TUNNEL_X11: + if ((tunnel->x11_channel = ssh_channel_new (tunnel->ssh.session)) == NULL) + { + remmina_ssh_set_error (REMMINA_SSH (tunnel), "Failed to create channel : %s"); + tunnel->thread = 0; + return NULL; + } + if (!remmina_public_get_xauth_cookie (tunnel->localdisplay, &ptr)) + { + remmina_ssh_set_application_error (REMMINA_SSH (tunnel), "%s", ptr); g_free(ptr); - if (ssh_channel_request_exec (tunnel->x11_channel, tunnel->dest)) { - ptr = g_strdup_printf(_("Failed to execute %s on SSH server : %%s"), tunnel->dest); - remmina_ssh_set_error (REMMINA_SSH (tunnel), ptr); - g_free(ptr); - tunnel->thread = 0; - return NULL; - } + tunnel->thread = 0; + return NULL; + } + if (ssh_channel_open_session (tunnel->x11_channel) || + ssh_channel_request_x11 (tunnel->x11_channel, TRUE, NULL, ptr, + gdk_screen_get_number (gdk_screen_get_default ()))) + { + g_free(ptr); + remmina_ssh_set_error (REMMINA_SSH (tunnel), "Failed to open channel : %s"); + tunnel->thread = 0; + return NULL; + } + g_free(ptr); + if (ssh_channel_request_exec (tunnel->x11_channel, tunnel->dest)) + { + ptr = g_strdup_printf(_("Failed to execute %s on SSH server : %%s"), tunnel->dest); + remmina_ssh_set_error (REMMINA_SSH (tunnel), ptr); + g_free(ptr); + tunnel->thread = 0; + return NULL; + } - if (tunnel->init_func && - ! (*tunnel->init_func) (tunnel, tunnel->callback_data)) { - if (tunnel->disconnect_func) { - (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); - } - tunnel->thread = 0; - return NULL; + if (tunnel->init_func && + ! (*tunnel->init_func) (tunnel, tunnel->callback_data)) + { + if (tunnel->disconnect_func) + { + (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); } + tunnel->thread = 0; + return NULL; + } - break; + break; - case REMMINA_SSH_TUNNEL_XPORT: - /* Detect the next available port starting from 6010 on the server */ - for (i = 10; i <= MAX_X_DISPLAY_NUMBER; i++) { - if (ssh_forward_listen (REMMINA_SSH (tunnel)->session, (tunnel->bindlocalhost ? "localhost" : NULL), 6000 + i, NULL)) { - continue; - } else { - tunnel->remotedisplay = i; - break; - } + case REMMINA_SSH_TUNNEL_XPORT: + /* Detect the next available port starting from 6010 on the server */ + for (i = 10; i <= MAX_X_DISPLAY_NUMBER; i++) + { + if (ssh_forward_listen (REMMINA_SSH (tunnel)->session, (tunnel->bindlocalhost ? "localhost" : NULL), 6000 + i, NULL)) + { + continue; } - if (tunnel->remotedisplay < 1) { - remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to request port forwarding : %s")); - if (tunnel->disconnect_func) { - (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); - } - tunnel->thread = 0; - return NULL; + else + { + tunnel->remotedisplay = i; + break; + } + } + if (tunnel->remotedisplay < 1) + { + remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to request port forwarding : %s")); + if (tunnel->disconnect_func) + { + (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); } + tunnel->thread = 0; + return NULL; + } - if (tunnel->init_func && - ! (*tunnel->init_func) (tunnel, tunnel->callback_data)) { - if (tunnel->disconnect_func) { - (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); - } - tunnel->thread = 0; - return NULL; + if (tunnel->init_func && + ! (*tunnel->init_func) (tunnel, tunnel->callback_data)) + { + if (tunnel->disconnect_func) + { + (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); } + tunnel->thread = 0; + return NULL; + } - break; + break; - case REMMINA_SSH_TUNNEL_REVERSE: - if (ssh_forward_listen (REMMINA_SSH (tunnel)->session, NULL, tunnel->port, NULL)) { - remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to request port forwarding : %s")); - if (tunnel->disconnect_func) { - (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); - } - tunnel->thread = 0; - return NULL; + case REMMINA_SSH_TUNNEL_REVERSE: + if (ssh_forward_listen (REMMINA_SSH (tunnel)->session, NULL, tunnel->port, NULL)) + { + remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to request port forwarding : %s")); + if (tunnel->disconnect_func) + { + (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); } + tunnel->thread = 0; + return NULL; + } - if (tunnel->init_func && - ! (*tunnel->init_func) (tunnel, tunnel->callback_data)) { - if (tunnel->disconnect_func) { - (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); - } - tunnel->thread = 0; - return NULL; + if (tunnel->init_func && + ! (*tunnel->init_func) (tunnel, tunnel->callback_data)) + { + if (tunnel->disconnect_func) + { + (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); } + tunnel->thread = 0; + return NULL; + } - break; + break; } tunnel->buffer_len = 10240; tunnel->buffer = g_malloc (tunnel->buffer_len); /* Start the tunnel data transmittion */ - while (tunnel->running) { + while (tunnel->running) + { if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_XPORT || - tunnel->tunnel_type == REMMINA_SSH_TUNNEL_X11 || - tunnel->tunnel_type == REMMINA_SSH_TUNNEL_REVERSE) { - if (first) { + tunnel->tunnel_type == REMMINA_SSH_TUNNEL_X11 || + tunnel->tunnel_type == REMMINA_SSH_TUNNEL_REVERSE) + { + if (first) + { first = FALSE; /* Wait for a period of time for the first incoming connection */ - if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_X11) { + if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_X11) + { channel = ssh_channel_accept_x11 (tunnel->x11_channel, 15000); - } else { + } + else + { channel = ssh_channel_accept_forward (REMMINA_SSH (tunnel)->session, 15000, &tunnel->port); } - if (!channel) { + if (!channel) + { remmina_ssh_set_application_error (REMMINA_SSH (tunnel), _("No response from the server.")); - if (tunnel->disconnect_func) { + if (tunnel->disconnect_func) + { (*tunnel->disconnect_func) (tunnel, tunnel->callback_data); } tunnel->thread = 0; return NULL; } - if (tunnel->connect_func) { + if (tunnel->connect_func) + { (*tunnel->connect_func) (tunnel, tunnel->callback_data); } - if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_REVERSE) { + if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_REVERSE) + { /* For reverse tunnel, we only need one connection. */ ssh_forward_cancel (REMMINA_SSH (tunnel)->session, NULL, tunnel->port); } - } else if (tunnel->tunnel_type != REMMINA_SSH_TUNNEL_REVERSE) { + } + else if (tunnel->tunnel_type != REMMINA_SSH_TUNNEL_REVERSE) + { /* Poll once per some period of time if no incoming connections. * Don't try to poll continuously as it will significantly slow down the loop */ g_get_current_time (&t1); diff = (t1.tv_sec - t2.tv_sec) * 10 + (t1.tv_usec - t2.tv_usec) / 100000; - if (diff > 1) { - if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_X11) { + if (diff > 1) + { + if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_X11) + { channel = ssh_channel_accept_x11 (tunnel->x11_channel, 0); - } else { + } + else + { channel = ssh_channel_accept_forward (REMMINA_SSH (tunnel)->session, 0, &tunnel->port); } - if (channel == NULL) { + if (channel == NULL) + { t2 = t1; } } } - if (channel) { - if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_REVERSE) { + if (channel) + { + if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_REVERSE) + { sin.sin_family = AF_INET; sin.sin_port = htons (tunnel->localport); sin.sin_addr.s_addr = inet_addr ("127.0.0.1"); sock = socket (AF_INET, SOCK_STREAM, 0); - if (connect (sock, (struct sockaddr *) &sin, sizeof (sin)) < 0) { + if (connect (sock, (struct sockaddr *) &sin, sizeof (sin)) < 0) + { remmina_ssh_set_application_error (REMMINA_SSH (tunnel), - "Cannot connect to local port %i.", tunnel->localport); + "Cannot connect to local port %i.", tunnel->localport); close (sock); sock = -1; } - } else { + } + else + { sock = remmina_public_open_xdisplay (tunnel->localdisplay); } - if (sock >= 0) { + if (sock >= 0) + { remmina_ssh_tunnel_add_channel (tunnel, channel, sock); - } else { + } + else + { /* Failed to create unix socket. Will this happen? */ ssh_channel_close (channel); ssh_channel_free (channel); @@ -884,7 +977,8 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) } } - if (tunnel->num_channels <= 0) { + if (tunnel->num_channels <= 0) + { /* No more connections. We should quit */ break; } @@ -894,8 +988,10 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) FD_ZERO (&set); maxfd = 0; - for (i = 0; i < tunnel->num_channels; i++) { - if (tunnel->sockets[i] > maxfd) { + for (i = 0; i < tunnel->num_channels; i++) + { + if (tunnel->sockets[i] > maxfd) + { maxfd = tunnel->sockets[i]; } FD_SET (tunnel->sockets[i], &set); @@ -907,14 +1003,19 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) if (ret == -1) break; i = 0; - while (tunnel->running && i < tunnel->num_channels) { + while (tunnel->running && i < tunnel->num_channels) + { disconnected = FALSE; - if (FD_ISSET (tunnel->sockets[i], &set)) { + if (FD_ISSET (tunnel->sockets[i], &set)) + { while (!disconnected && - (len = read (tunnel->sockets[i], tunnel->buffer, tunnel->buffer_len)) > 0) { - for (ptr = tunnel->buffer, lenw = 0; len > 0; len -= lenw, ptr += lenw) { + (len = read (tunnel->sockets[i], tunnel->buffer, tunnel->buffer_len)) > 0) + { + for (ptr = tunnel->buffer, lenw = 0; len > 0; len -= lenw, ptr += lenw) + { lenw = ssh_channel_write (tunnel->channels[i], (char*) ptr, len); - if (lenw <= 0) { + if (lenw <= 0) + { disconnected = TRUE; break; } @@ -922,7 +1023,8 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) } if (len == 0) disconnected = TRUE; } - if (disconnected) { + if (disconnected) + { remmina_ssh_tunnel_remove_channel (tunnel, i); continue; } @@ -931,46 +1033,60 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) if (!tunnel->running) break; i = 0; - while (tunnel->running && i < tunnel->num_channels) { + while (tunnel->running && i < tunnel->num_channels) + { disconnected = FALSE; - if (!tunnel->socketbuffers[i]) { + if (!tunnel->socketbuffers[i]) + { len = ssh_channel_poll (tunnel->channels[i], 0); - if (len == SSH_ERROR || len == SSH_EOF) { + if (len == SSH_ERROR || len == SSH_EOF) + { disconnected = TRUE; - } else if (len > 0) { + } + else if (len > 0) + { tunnel->socketbuffers[i] = remmina_ssh_tunnel_buffer_new (len); len = ssh_channel_read_nonblocking (tunnel->channels[i], tunnel->socketbuffers[i]->data, len, 0); - if (len <= 0) { + if (len <= 0) + { disconnected = TRUE; - } else { + } + else + { tunnel->socketbuffers[i]->len = len; } } } - if (!disconnected && tunnel->socketbuffers[i]) { + if (!disconnected && tunnel->socketbuffers[i]) + { for (lenw = 0; tunnel->socketbuffers[i]->len > 0; - tunnel->socketbuffers[i]->len -= lenw, tunnel->socketbuffers[i]->ptr += lenw) { + tunnel->socketbuffers[i]->len -= lenw, tunnel->socketbuffers[i]->ptr += lenw) + { lenw = write (tunnel->sockets[i], tunnel->socketbuffers[i]->ptr, tunnel->socketbuffers[i]->len); - if (lenw == -1 && errno == EAGAIN && tunnel->running) { + if (lenw == -1 && errno == EAGAIN && tunnel->running) + { /* Sometimes we cannot write to a socket (always EAGAIN), probably because it's internal * buffer is full. We need read the pending bytes from the socket first. so here we simply * break, leave the buffer there, and continue with other data */ break; } - if (lenw <= 0) { + if (lenw <= 0) + { disconnected = TRUE; break; } } - if (tunnel->socketbuffers[i]->len <= 0) { + if (tunnel->socketbuffers[i]->len <= 0) + { remmina_ssh_tunnel_buffer_free (tunnel->socketbuffers[i]); tunnel->socketbuffers[i] = NULL; } } - if (disconnected) { + if (disconnected) + { remmina_ssh_tunnel_remove_channel (tunnel, i); continue; } @@ -983,7 +1099,7 @@ remmina_ssh_tunnel_main_thread_proc (gpointer data) return NULL; } - static gpointer +static gpointer remmina_ssh_tunnel_main_thread (gpointer data) { TRACE_CALL("remmina_ssh_tunnel_main_thread"); @@ -991,7 +1107,8 @@ remmina_ssh_tunnel_main_thread (gpointer data) pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL); - while (TRUE) { + while (TRUE) + { remmina_ssh_tunnel_main_thread_proc (data); if (tunnel->server_sock < 0 || tunnel->thread == 0 || !tunnel->running) break; } @@ -999,17 +1116,18 @@ remmina_ssh_tunnel_main_thread (gpointer data) return NULL; } - void +void remmina_ssh_tunnel_cancel_accept (RemminaSSHTunnel *tunnel) { TRACE_CALL("remmina_ssh_tunnel_cancel_accept"); - if (tunnel->server_sock >= 0) { + if (tunnel->server_sock >= 0) + { close (tunnel->server_sock); tunnel->server_sock = -1; } } - gboolean +gboolean remmina_ssh_tunnel_open (RemminaSSHTunnel* tunnel, const gchar *host, gint port, gint local_port) { TRACE_CALL("remmina_ssh_tunnel_open"); @@ -1020,14 +1138,16 @@ remmina_ssh_tunnel_open (RemminaSSHTunnel* tunnel, const gchar *host, gint port, tunnel->tunnel_type = REMMINA_SSH_TUNNEL_OPEN; tunnel->dest = g_strdup (host); tunnel->port = port; - if (tunnel->port == 0) { + if (tunnel->port == 0) + { REMMINA_SSH (tunnel)->error = g_strdup ("Destination port has not been assigned"); return FALSE; } /* Create the server socket that listens on the local port */ sock = socket (AF_INET, SOCK_STREAM, 0); - if (sock < 0) { + if (sock < 0) + { REMMINA_SSH (tunnel)->error = g_strdup ("Failed to create socket."); return FALSE; } @@ -1037,13 +1157,15 @@ remmina_ssh_tunnel_open (RemminaSSHTunnel* tunnel, const gchar *host, gint port, sin.sin_port = htons (local_port); sin.sin_addr.s_addr = inet_addr ("127.0.0.1"); - if (bind (sock, (struct sockaddr *) &sin, sizeof(sin))) { + if (bind (sock, (struct sockaddr *) &sin, sizeof(sin))) + { REMMINA_SSH (tunnel)->error = g_strdup ("Failed to bind on local port."); close (sock); return FALSE; } - if (listen (sock, 1)) { + if (listen (sock, 1)) + { REMMINA_SSH (tunnel)->error = g_strdup ("Failed to listen on local port."); close (sock); return FALSE; @@ -1052,7 +1174,8 @@ remmina_ssh_tunnel_open (RemminaSSHTunnel* tunnel, const gchar *host, gint port, tunnel->server_sock = sock; tunnel->running = TRUE; - if (pthread_create (&tunnel->thread, NULL, remmina_ssh_tunnel_main_thread, tunnel)) { + if (pthread_create (&tunnel->thread, NULL, remmina_ssh_tunnel_main_thread, tunnel)) + { remmina_ssh_set_application_error (REMMINA_SSH (tunnel), "Failed to initialize pthread."); tunnel->thread = 0; return FALSE; @@ -1060,7 +1183,7 @@ remmina_ssh_tunnel_open (RemminaSSHTunnel* tunnel, const gchar *host, gint port, return TRUE; } - gboolean +gboolean remmina_ssh_tunnel_x11 (RemminaSSHTunnel *tunnel, const gchar *cmd) { TRACE_CALL("remmina_ssh_tunnel_x11"); @@ -1068,7 +1191,8 @@ remmina_ssh_tunnel_x11 (RemminaSSHTunnel *tunnel, const gchar *cmd) tunnel->dest = g_strdup (cmd); tunnel->running = TRUE; - if (pthread_create (&tunnel->thread, NULL, remmina_ssh_tunnel_main_thread, tunnel)) { + if (pthread_create (&tunnel->thread, NULL, remmina_ssh_tunnel_main_thread, tunnel)) + { remmina_ssh_set_application_error (REMMINA_SSH (tunnel), "Failed to initialize pthread."); tunnel->thread = 0; return FALSE; @@ -1076,7 +1200,7 @@ remmina_ssh_tunnel_x11 (RemminaSSHTunnel *tunnel, const gchar *cmd) return TRUE; } - gboolean +gboolean remmina_ssh_tunnel_xport (RemminaSSHTunnel *tunnel, gboolean bindlocalhost) { TRACE_CALL("remmina_ssh_tunnel_xport"); @@ -1084,7 +1208,8 @@ remmina_ssh_tunnel_xport (RemminaSSHTunnel *tunnel, gboolean bindlocalhost) tunnel->bindlocalhost = bindlocalhost; tunnel->running = TRUE; - if (pthread_create (&tunnel->thread, NULL, remmina_ssh_tunnel_main_thread, tunnel)) { + if (pthread_create (&tunnel->thread, NULL, remmina_ssh_tunnel_main_thread, tunnel)) + { remmina_ssh_set_application_error (REMMINA_SSH (tunnel), "Failed to initialize pthread."); tunnel->thread = 0; return FALSE; @@ -1092,7 +1217,7 @@ remmina_ssh_tunnel_xport (RemminaSSHTunnel *tunnel, gboolean bindlocalhost) return TRUE; } - gboolean +gboolean remmina_ssh_tunnel_reverse (RemminaSSHTunnel *tunnel, gint port, gint local_port) { TRACE_CALL("remmina_ssh_tunnel_reverse"); @@ -1101,7 +1226,8 @@ remmina_ssh_tunnel_reverse (RemminaSSHTunnel *tunnel, gint port, gint local_port tunnel->localport = local_port; tunnel->running = TRUE; - if (pthread_create (&tunnel->thread, NULL, remmina_ssh_tunnel_main_thread, tunnel)) { + if (pthread_create (&tunnel->thread, NULL, remmina_ssh_tunnel_main_thread, tunnel)) + { remmina_ssh_set_application_error (REMMINA_SSH (tunnel), "Failed to initialize pthread."); tunnel->thread = 0; return FALSE; @@ -1109,31 +1235,34 @@ remmina_ssh_tunnel_reverse (RemminaSSHTunnel *tunnel, gint port, gint local_port return TRUE; } - gboolean +gboolean remmina_ssh_tunnel_terminated (RemminaSSHTunnel* tunnel) { TRACE_CALL("remmina_ssh_tunnel_terminated"); return (tunnel->thread == 0); } - void +void remmina_ssh_tunnel_free (RemminaSSHTunnel* tunnel) { TRACE_CALL("remmina_ssh_tunnel_free"); pthread_t thread; thread = tunnel->thread; - if (thread != 0) { + if (thread != 0) + { tunnel->running = FALSE; pthread_cancel (thread); pthread_join (thread, NULL); tunnel->thread = 0; } - if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_XPORT && tunnel->remotedisplay > 0) { + if (tunnel->tunnel_type == REMMINA_SSH_TUNNEL_XPORT && tunnel->remotedisplay > 0) + { ssh_forward_cancel (REMMINA_SSH (tunnel)->session, NULL, 6000 + tunnel->remotedisplay); } - if (tunnel->server_sock >= 0) { + if (tunnel->server_sock >= 0) + { close (tunnel->server_sock); tunnel->server_sock = -1; } @@ -1151,7 +1280,7 @@ remmina_ssh_tunnel_free (RemminaSSHTunnel* tunnel) * SSH sFTP * *-----------------------------------------------------------------------------*/ - RemminaSFTP* +RemminaSFTP* remmina_sftp_new_from_file (RemminaFile *remminafile) { TRACE_CALL("remmina_sftp_new_from_file"); @@ -1166,7 +1295,7 @@ remmina_sftp_new_from_file (RemminaFile *remminafile) return sftp; } - RemminaSFTP* +RemminaSFTP* remmina_sftp_new_from_ssh (RemminaSSH *ssh) { TRACE_CALL("remmina_sftp_new_from_ssh"); @@ -1181,27 +1310,30 @@ remmina_sftp_new_from_ssh (RemminaSSH *ssh) return sftp; } - gboolean +gboolean remmina_sftp_open (RemminaSFTP *sftp) { TRACE_CALL("remmina_sftp_open"); sftp->sftp_sess = sftp_new (sftp->ssh.session); - if (!sftp->sftp_sess) { + if (!sftp->sftp_sess) + { remmina_ssh_set_error (REMMINA_SSH (sftp), _("Failed to create sftp session: %s")); return FALSE; } - if (sftp_init (sftp->sftp_sess)) { + if (sftp_init (sftp->sftp_sess)) + { remmina_ssh_set_error (REMMINA_SSH (sftp), _("Failed to initialize sftp session: %s")); return FALSE; } return TRUE; } - void +void remmina_sftp_free (RemminaSFTP *sftp) { TRACE_CALL("remmina_sftp_free"); - if (sftp->sftp_sess) { + if (sftp->sftp_sess) + { sftp_free (sftp->sftp_sess); sftp->sftp_sess = NULL; } @@ -1212,7 +1344,7 @@ remmina_sftp_free (RemminaSFTP *sftp) * SSH Shell * *-----------------------------------------------------------------------------*/ - RemminaSSHShell* +RemminaSSHShell* remmina_ssh_shell_new_from_file (RemminaFile *remminafile) { TRACE_CALL("remmina_ssh_shell_new_from_file"); @@ -1229,7 +1361,7 @@ remmina_ssh_shell_new_from_file (RemminaFile *remminafile) return shell; } - RemminaSSHShell* +RemminaSSHShell* remmina_ssh_shell_new_from_ssh (RemminaSSH *ssh) { TRACE_CALL("remmina_ssh_shell_new_from_ssh"); @@ -1245,7 +1377,7 @@ remmina_ssh_shell_new_from_ssh (RemminaSSH *ssh) return shell; } - static gboolean +static gboolean remmina_ssh_call_exit_callback_on_main_thread(gpointer data) { TRACE_CALL("remmina_ssh_call_exit_callback_on_main_thread"); @@ -1256,7 +1388,7 @@ remmina_ssh_call_exit_callback_on_main_thread(gpointer data) return FALSE; } - static gpointer +static gpointer remmina_ssh_shell_thread (gpointer data) { TRACE_CALL("remmina_ssh_shell_thread"); @@ -1272,24 +1404,29 @@ remmina_ssh_shell_thread (gpointer data) LOCK_SSH (shell) - if ((channel = ssh_channel_new (REMMINA_SSH (shell)->session)) == NULL || - ssh_channel_open_session (channel)) { - UNLOCK_SSH (shell) - remmina_ssh_set_error (REMMINA_SSH (shell), "Failed to open channel : %s"); - if (channel) ssh_channel_free (channel); - shell->thread = 0; - return NULL; - } + if ((channel = ssh_channel_new (REMMINA_SSH (shell)->session)) == NULL || + ssh_channel_open_session (channel)) + { + UNLOCK_SSH (shell) + remmina_ssh_set_error (REMMINA_SSH (shell), "Failed to open channel : %s"); + if (channel) ssh_channel_free (channel); + shell->thread = 0; + return NULL; + } ssh_channel_request_pty (channel); - if (shell->exec && shell->exec[0]) { + if (shell->exec && shell->exec[0]) + { ret = ssh_channel_request_exec (channel, shell->exec); - } else { + } + else + { ret = ssh_channel_request_shell (channel); } - if (ret) { + if (ret) + { UNLOCK_SSH (shell) - remmina_ssh_set_error (REMMINA_SSH (shell), "Failed to request shell : %s"); + remmina_ssh_set_error (REMMINA_SSH (shell), "Failed to request shell : %s"); ssh_channel_close (channel); ssh_channel_free (channel); shell->thread = 0; @@ -1300,13 +1437,14 @@ remmina_ssh_shell_thread (gpointer data) UNLOCK_SSH (shell) - buf_len = 1000; + buf_len = 1000; buf = g_malloc (buf_len + 1); ch[0] = channel; ch[1] = NULL; - while (!shell->closed) { + while (!shell->closed) + { timeout.tv_sec = 1; timeout.tv_usec = 0; @@ -1317,34 +1455,40 @@ remmina_ssh_shell_thread (gpointer data) if (ret == SSH_EINTR) continue; if (ret == -1) break; - if (FD_ISSET (shell->master, &fds)) { + if (FD_ISSET (shell->master, &fds)) + { len = read (shell->master, buf, buf_len); if (len <= 0) break; LOCK_SSH (shell) - ssh_channel_write (channel, buf, len); + ssh_channel_write (channel, buf, len); UNLOCK_SSH (shell) } - for (i = 0; i < 2; i++) { + for (i = 0; i < 2; i++) + { LOCK_SSH (shell) - len = ssh_channel_poll (channel, i); + len = ssh_channel_poll (channel, i); UNLOCK_SSH (shell) - if (len == SSH_ERROR || len == SSH_EOF) { - shell->closed = TRUE; - break; - } + if (len == SSH_ERROR || len == SSH_EOF) + { + shell->closed = TRUE; + break; + } if (len <= 0) continue; - if (len > buf_len) { + if (len > buf_len) + { buf_len = len; buf = (gchar*) g_realloc (buf, buf_len + 1); } LOCK_SSH (shell) - len = ssh_channel_read_nonblocking (channel, buf, len, i); + len = ssh_channel_read_nonblocking (channel, buf, len, i); UNLOCK_SSH (shell) - if (len <= 0) { - shell->closed = TRUE; - break; - } - while (len > 0) { + if (len <= 0) + { + shell->closed = TRUE; + break; + } + while (len > 0) + { ret = write (shell->master, buf, len); if (ret <= 0) break; len -= ret; @@ -1353,22 +1497,23 @@ remmina_ssh_shell_thread (gpointer data) } LOCK_SSH (shell) - shell->channel = NULL; + shell->channel = NULL; ssh_channel_close (channel); ssh_channel_free (channel); UNLOCK_SSH (shell) - g_free(buf); + g_free(buf); shell->thread = 0; - if ( shell->exit_callback ) { + if ( shell->exit_callback ) + { IDLE_ADD ((GSourceFunc) remmina_ssh_call_exit_callback_on_main_thread, (gpointer)shell ); } return NULL; } - gboolean +gboolean remmina_ssh_shell_open (RemminaSSHShell *shell, RemminaSSHExitFunc exit_callback, gpointer data) { TRACE_CALL("remmina_ssh_shell_open"); @@ -1377,10 +1522,11 @@ remmina_ssh_shell_open (RemminaSSHShell *shell, RemminaSSHExitFunc exit_callback shell->master = posix_openpt (O_RDWR | O_NOCTTY); if (shell->master == -1 || - grantpt (shell->master) == -1 || - unlockpt (shell->master) == -1 || - (slavedevice = ptsname (shell->master)) == NULL || - (shell->slave = open (slavedevice, O_RDWR | O_NOCTTY)) < 0) { + grantpt (shell->master) == -1 || + unlockpt (shell->master) == -1 || + (slavedevice = ptsname (shell->master)) == NULL || + (shell->slave = open (slavedevice, O_RDWR | O_NOCTTY)) < 0) + { REMMINA_SSH (shell)->error = g_strdup ("Failed to create pty device."); return FALSE; } @@ -1400,30 +1546,33 @@ remmina_ssh_shell_open (RemminaSSHShell *shell, RemminaSSHExitFunc exit_callback return TRUE; } - void +void remmina_ssh_shell_set_size (RemminaSSHShell *shell, gint columns, gint rows) { TRACE_CALL("remmina_ssh_shell_set_size"); LOCK_SSH (shell) - if (shell->channel) { - ssh_channel_change_pty_size (shell->channel, columns, rows); - } + if (shell->channel) + { + ssh_channel_change_pty_size (shell->channel, columns, rows); + } UNLOCK_SSH (shell) } - void +void remmina_ssh_shell_free (RemminaSSHShell *shell) { TRACE_CALL("remmina_ssh_shell_free"); pthread_t thread = shell->thread; shell->exit_callback = NULL; - if (thread) { + if (thread) + { shell->closed = TRUE; pthread_join (thread, NULL); } close (shell->master); - if (shell->exec) { + if (shell->exec) + { g_free(shell->exec); shell->exec = NULL; } diff --git a/remmina/src/remmina_ssh.h b/remmina/src/remmina_ssh.h index 4f6e721d6..acfc51a55 100644 --- a/remmina/src/remmina_ssh.h +++ b/remmina/src/remmina_ssh.h @@ -73,7 +73,7 @@ typedef struct _RemminaSSH gchar *error; pthread_mutex_t ssh_mutex; -}RemminaSSH; +} RemminaSSH; gchar* remmina_ssh_identity_path (const gchar *id); @@ -201,7 +201,7 @@ typedef struct _RemminaSFTP RemminaSSH ssh; sftp_session sftp_sess; -}RemminaSFTP; +} RemminaSFTP; /* Create a new SFTP session object from RemminaFile */ RemminaSFTP* remmina_sftp_new_from_file (RemminaFile *remminafile); @@ -232,7 +232,7 @@ typedef struct _RemminaSSHShell gboolean closed; RemminaSSHExitFunc exit_callback; gpointer user_data; -}RemminaSSHShell; +} RemminaSSHShell; /* Create a new SSH Shell session object from RemminaFile */ RemminaSSHShell* remmina_ssh_shell_new_from_file (RemminaFile *remminafile); diff --git a/remmina/src/remmina_ssh_plugin.c b/remmina/src/remmina_ssh_plugin.c index 9a7e48192..8a3aef7e1 100644 --- a/remmina/src/remmina_ssh_plugin.c +++ b/remmina/src/remmina_ssh_plugin.c @@ -62,7 +62,7 @@ typedef struct _RemminaPluginSshData RemminaSSHShell *shell; GtkWidget *vte; pthread_t thread; -}RemminaPluginSshData; +} RemminaPluginSshData; static RemminaPluginService *remmina_plugin_service = NULL; @@ -90,9 +90,9 @@ remmina_plugin_ssh_main_thread (gpointer data) /* Create SSH Shell connection based on existing SSH session */ shell = remmina_ssh_shell_new_from_ssh (ssh); if (remmina_ssh_init_session (REMMINA_SSH (shell)) && - remmina_ssh_auth (REMMINA_SSH (shell), NULL) > 0 && - remmina_ssh_shell_open (shell, (RemminaSSHExitFunc) - remmina_plugin_service->protocol_plugin_close_connection, gp)) + remmina_ssh_auth (REMMINA_SSH (shell), NULL) > 0 && + remmina_ssh_shell_open (shell, (RemminaSSHExitFunc) + remmina_plugin_service->protocol_plugin_close_connection, gp)) { cont = TRUE; } @@ -102,7 +102,7 @@ remmina_plugin_ssh_main_thread (gpointer data) /* New SSH Shell connection */ remminafile = remmina_plugin_service->protocol_plugin_get_file (gp); remmina_plugin_service->file_set_string (remminafile, "ssh_server", - remmina_plugin_service->file_get_string (remminafile, "server")); + remmina_plugin_service->file_get_string (remminafile, "server")); shell = remmina_ssh_shell_new_from_file (remminafile); while (1) @@ -114,7 +114,7 @@ remmina_plugin_ssh_main_thread (gpointer data) } ret = remmina_ssh_auth_gui (REMMINA_SSH (shell), - REMMINA_INIT_DIALOG (remmina_protocol_widget_get_init_dialog (gp))); + REMMINA_INIT_DIALOG (remmina_protocol_widget_get_init_dialog (gp))); if (ret == 0) { remmina_plugin_service->protocol_plugin_set_error (gp, "%s", REMMINA_SSH (shell)->error); @@ -122,7 +122,7 @@ remmina_plugin_ssh_main_thread (gpointer data) if (ret <= 0) break; if (!remmina_ssh_shell_open (shell, (RemminaSSHExitFunc) - remmina_plugin_service->protocol_plugin_close_connection, gp)) + remmina_plugin_service->protocol_plugin_close_connection, gp)) { remmina_plugin_service->protocol_plugin_set_error (gp, "%s", REMMINA_SSH (shell)->error); break; @@ -152,7 +152,8 @@ remmina_plugin_ssh_main_thread (gpointer data) void remmina_plugin_ssh_vte_terminal_set_encoding_and_pty(VteTerminal *terminal, const char *codeset, int slave) { TRACE_CALL("remmina_plugin_ssh_vte_terminal_set_encoding_and_pty"); - if ( !remmina_masterthread_exec_is_main_thread() ) { + if ( !remmina_masterthread_exec_is_main_thread() ) + { /* Allow the execution of this function from a non main thread */ RemminaMTExecData *d; d = (RemminaMTExecData*)g_malloc( sizeof(RemminaMTExecData) ); @@ -227,7 +228,7 @@ remmina_plugin_ssh_set_vte_pref (RemminaProtocolWidget *gp) vte_terminal_set_font_from_string (VTE_TERMINAL (gpdata->vte), remmina_pref.vte_font); #else vte_terminal_set_font (VTE_TERMINAL (gpdata->vte), - pango_font_description_from_string (remmina_pref.vte_font)); + pango_font_description_from_string (remmina_pref.vte_font)); #endif } vte_terminal_set_allow_bold (VTE_TERMINAL (gpdata->vte), remmina_pref.vte_allow_bold_text); @@ -320,7 +321,7 @@ remmina_plugin_ssh_open_connection (RemminaProtocolWidget *gp) if (pthread_create (&gpdata->thread, NULL, remmina_plugin_ssh_main_thread, gp)) { remmina_plugin_service->protocol_plugin_set_error (gp, - "Failed to initialize pthread. Falling back to non-thread mode..."); + "Failed to initialize pthread. Falling back to non-thread mode..."); gpdata->thread = 0; return FALSE; } @@ -367,20 +368,20 @@ remmina_plugin_ssh_call_feature (RemminaProtocolWidget *gp, const RemminaProtoco switch (feature->id) { - case REMMINA_PROTOCOL_FEATURE_TOOL_SSH: + case REMMINA_PROTOCOL_FEATURE_TOOL_SSH: remmina_plugin_service->open_connection ( - remmina_file_dup_temp_protocol (remmina_plugin_service->protocol_plugin_get_file (gp), "SSH"), - NULL, gpdata->shell, NULL); + remmina_file_dup_temp_protocol (remmina_plugin_service->protocol_plugin_get_file (gp), "SSH"), + NULL, gpdata->shell, NULL); return; - case REMMINA_PROTOCOL_FEATURE_TOOL_SFTP: + case REMMINA_PROTOCOL_FEATURE_TOOL_SFTP: remmina_plugin_service->open_connection ( - remmina_file_dup_temp_protocol (remmina_plugin_service->protocol_plugin_get_file (gp), "SFTP"), - NULL, gpdata->shell, NULL); + remmina_file_dup_temp_protocol (remmina_plugin_service->protocol_plugin_get_file (gp), "SFTP"), + NULL, gpdata->shell, NULL); return; - case REMMINA_PLUGIN_SSH_FEATURE_TOOL_COPY: + case REMMINA_PLUGIN_SSH_FEATURE_TOOL_COPY: vte_terminal_copy_clipboard (VTE_TERMINAL (gpdata->vte)); return; - case REMMINA_PLUGIN_SSH_FEATURE_TOOL_PASTE: + case REMMINA_PLUGIN_SSH_FEATURE_TOOL_PASTE: vte_terminal_paste_clipboard (VTE_TERMINAL (gpdata->vte)); return; } diff --git a/remmina/src/remmina_string_array.c b/remmina/src/remmina_string_array.c index 484788fb2..7a7a3ab9c 100644 --- a/remmina/src/remmina_string_array.c +++ b/remmina/src/remmina_string_array.c @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2009 - Vic Lee + * Copyright (C) 2009 - Vic Lee * Copyright (C) 2014-2015 Antenore Gatta, Fabio Castelli, Giovanni Panozzo * * This program is free software; you can redistribute it and/or modify @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give diff --git a/remmina/src/remmina_string_array.h b/remmina/src/remmina_string_array.h index 22fa18f44..7443c474f 100644 --- a/remmina/src/remmina_string_array.h +++ b/remmina/src/remmina_string_array.h @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2009 - Vic Lee + * Copyright (C) 2009 - Vic Lee * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give diff --git a/remmina/src/remmina_string_list.c b/remmina/src/remmina_string_list.c index 091dda8fb..fc93fbb8c 100644 --- a/remmina/src/remmina_string_list.c +++ b/remmina/src/remmina_string_list.c @@ -50,8 +50,8 @@ static RemminaStringList *string_list; void remmina_string_list_update_buttons_state(void) { gint items_count = gtk_tree_model_iter_n_children( - GTK_TREE_MODEL(string_list->liststore_items), NULL); - + GTK_TREE_MODEL(string_list->liststore_items), NULL); + gtk_widget_set_sensitive(GTK_WIDGET(string_list->button_remove), items_count > 0); gtk_widget_set_sensitive(GTK_WIDGET(string_list->button_up), items_count > 1); gtk_widget_set_sensitive(GTK_WIDGET(string_list->button_down), items_count > 1); @@ -158,9 +158,9 @@ void remmina_string_list_on_action_add(GtkWidget *widget, gpointer user_data) path = gtk_tree_model_get_path(GTK_TREE_MODEL(string_list->liststore_items), &iter); gtk_tree_view_set_cursor_on_cell(string_list->treeview_items, path, - string_list->treeviewcolumn_item, - GTK_CELL_RENDERER(string_list->priv->two_columns ? string_list->cellrenderertext_item1 : string_list->cellrenderertext_item2), - TRUE); + string_list->treeviewcolumn_item, + GTK_CELL_RENDERER(string_list->priv->two_columns ? string_list->cellrenderertext_item1 : string_list->cellrenderertext_item2), + TRUE); gtk_tree_path_free(path); remmina_string_list_update_buttons_state(); } @@ -200,16 +200,16 @@ void remmina_string_list_set_text(const gchar *text, const gboolean clear_data) { /* Two columns data */ gtk_list_store_set(string_list->liststore_items, &iter, - COLUMN_DESCRIPTION, values[0], - COLUMN_VALUE, values[1], - -1); + COLUMN_DESCRIPTION, values[0], + COLUMN_VALUE, values[1], + -1); } else { /* Single column data */ gtk_list_store_set(string_list->liststore_items, &iter, - COLUMN_VALUE, values[0], - -1); + COLUMN_VALUE, values[0], + -1); } g_strfreev(values); } @@ -235,9 +235,9 @@ gchar* remmina_string_list_get_text(void) while (ret) { gtk_tree_model_get(GTK_TREE_MODEL(string_list->liststore_items), &iter, - COLUMN_DESCRIPTION, &item_description, - COLUMN_VALUE, &item_value, - -1); + COLUMN_DESCRIPTION, &item_description, + COLUMN_VALUE, &item_value, + -1); if (!item_description) item_description = ""; if (item_value && strlen(item_value) > 0) @@ -277,7 +277,7 @@ void remmina_string_list_set_titles(gchar *title1, gchar *title2) { /* Set dialog titlebar */ gtk_window_set_title(GTK_WINDOW(string_list->dialog), - (title1 && strlen(title1) > 0) ? title1 : ""); + (title1 && strlen(title1) > 0) ? title1 : ""); /* Set title label */ if (title2 && strlen(title2) > 0) { diff --git a/remmina/src/remmina_string_list.h b/remmina/src/remmina_string_list.h index 18b1862f1..e713a2ada 100644 --- a/remmina/src/remmina_string_list.h +++ b/remmina/src/remmina_string_list.h @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2009 - Vic Lee + * Copyright (C) 2009 - Vic Lee * Copyright (C) 2014-2015 Antenore Gatta, Fabio Castelli, Giovanni Panozzo * * This program is free software; you can redistribute it and/or modify @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give diff --git a/remmina/src/remmina_widget_pool.c b/remmina/src/remmina_widget_pool.c index 917dcde64..41045f74e 100644 --- a/remmina/src/remmina_widget_pool.c +++ b/remmina/src/remmina_widget_pool.c @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2009 - Vic Lee + * Copyright (C) 2009 - Vic Lee * Copyright (C) 2014-2015 Antenore Gatta, Fabio Castelli, Giovanni Panozzo * * This program is free software; you can redistribute it and/or modify @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give diff --git a/remmina/src/remmina_widget_pool.h b/remmina/src/remmina_widget_pool.h index 9a7be6abf..7f4e371f5 100644 --- a/remmina/src/remmina_widget_pool.h +++ b/remmina/src/remmina_widget_pool.h @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2009 - Vic Lee + * Copyright (C) 2009 - Vic Lee * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give -- cgit v1.2.3 From 9b8c87fe591bbc18eb0685bd056d7b88011ff097 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Tue, 22 Sep 2015 22:47:01 +0200 Subject: Preparing for release v1.2.0-rcgit.4 --- CHANGELOG.md | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 158a52d72..e8d55c43f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,16 @@ # Change Log -## [Unreleased](https://github.com/FreeRDP/remmina/tree/HEAD) +## [Unreleased](https://github.com/FreeRDP/Remmina/tree/HEAD) -[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.2.0-rcgit.4...HEAD) +[Full Changelog](https://github.com/FreeRDP/Remmina/compare/v1.2.0-rcgit.4...HEAD) **Closed issues:** - Remmina VS freerdp on 1.2.0 version [\#639](https://github.com/FreeRDP/Remmina/issues/639) +- Remmina does not connect to remote host by FQDN [\#632](https://github.com/FreeRDP/Remmina/issues/632) -## [v1.2.0-rcgit.4](https://github.com/FreeRDP/remmina/tree/v1.2.0-rcgit.4) (2015-09-15) -[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.2.0-rcgit.3...v1.2.0-rcgit.4) +## [v1.2.0-rcgit.4](https://github.com/FreeRDP/Remmina/tree/v1.2.0-rcgit.4) (2015-09-15) +[Full Changelog](https://github.com/FreeRDP/Remmina/compare/v1.2.0-rcgit.3...v1.2.0-rcgit.4) **Implemented enhancements:** @@ -92,8 +93,8 @@ - Update Uzbek translation [\#561](https://github.com/FreeRDP/Remmina/pull/561) ([ozbek](https://github.com/ozbek)) - Update for GTK+2 port [\#555](https://github.com/FreeRDP/Remmina/pull/555) ([repzilon](https://github.com/repzilon)) -## [v1.2.0-rcgit.3](https://github.com/FreeRDP/remmina/tree/v1.2.0-rcgit.3) (2015-04-14) -[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.2.0-rcgit.2...v1.2.0-rcgit.3) +## [v1.2.0-rcgit.3](https://github.com/FreeRDP/Remmina/tree/v1.2.0-rcgit.3) (2015-04-14) +[Full Changelog](https://github.com/FreeRDP/Remmina/compare/v1.2.0-rcgit.2...v1.2.0-rcgit.3) **Implemented enhancements:** @@ -214,8 +215,8 @@ - SSH terminal color customization [\#432](https://github.com/FreeRDP/Remmina/pull/432) ([muflone](https://github.com/muflone)) - remmina: Actually install its headers. [\#428](https://github.com/FreeRDP/Remmina/pull/428) ([rakuco](https://github.com/rakuco)) -## [v1.2.0-rcgit.2](https://github.com/FreeRDP/remmina/tree/v1.2.0-rcgit.2) (2014-12-30) -[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.1.2...v1.2.0-rcgit.2) +## [v1.2.0-rcgit.2](https://github.com/FreeRDP/Remmina/tree/v1.2.0-rcgit.2) (2014-12-30) +[Full Changelog](https://github.com/FreeRDP/Remmina/compare/v1.1.2...v1.2.0-rcgit.2) **Fixed bugs:** @@ -250,8 +251,8 @@ - GTK3 migration of remmina\_ftp\_client, fixes \#365 [\#408](https://github.com/FreeRDP/Remmina/pull/408) ([giox069](https://github.com/giox069)) - Update Remmina GTK+2 branch to 1.1.2 [\#405](https://github.com/FreeRDP/Remmina/pull/405) ([repzilon](https://github.com/repzilon)) -## [v1.1.2](https://github.com/FreeRDP/remmina/tree/v1.1.2) (2014-12-08) -[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.1.1-gtk2...v1.1.2) +## [v1.1.2](https://github.com/FreeRDP/Remmina/tree/v1.1.2) (2014-12-08) +[Full Changelog](https://github.com/FreeRDP/Remmina/compare/v1.1.1-gtk2...v1.1.2) **Fixed bugs:** @@ -269,8 +270,8 @@ - Merge pull request \#396 from FreeRDP/issue366 [\#397](https://github.com/FreeRDP/Remmina/pull/397) ([muflone](https://github.com/muflone)) - Issue \#366 [\#396](https://github.com/FreeRDP/Remmina/pull/396) ([muflone](https://github.com/muflone)) -## [v1.1.1-gtk2](https://github.com/FreeRDP/remmina/tree/v1.1.1-gtk2) (2014-12-07) -[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.1.1...v1.1.1-gtk2) +## [v1.1.1-gtk2](https://github.com/FreeRDP/Remmina/tree/v1.1.1-gtk2) (2014-12-07) +[Full Changelog](https://github.com/FreeRDP/Remmina/compare/v1.1.1...v1.1.1-gtk2) **Closed issues:** @@ -303,8 +304,8 @@ - Screenshots page with real screenshots! [\#355](https://github.com/FreeRDP/Remmina/pull/355) ([ic3d](https://github.com/ic3d)) - Good News! [\#354](https://github.com/FreeRDP/Remmina/pull/354) ([ic3d](https://github.com/ic3d)) -## [v1.1.1](https://github.com/FreeRDP/remmina/tree/v1.1.1) (2014-10-10) -[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.2.0-rcgit.1...v1.1.1) +## [v1.1.1](https://github.com/FreeRDP/Remmina/tree/v1.1.1) (2014-10-10) +[Full Changelog](https://github.com/FreeRDP/Remmina/compare/v1.2.0-rcgit.1...v1.1.1) **Fixed bugs:** @@ -347,8 +348,8 @@ - Fix issue with invisible toolbar in fullscreen. [\#275](https://github.com/FreeRDP/Remmina/pull/275) ([jerrido](https://github.com/jerrido)) - Fix for issue \#251 [\#253](https://github.com/FreeRDP/Remmina/pull/253) ([giox069](https://github.com/giox069)) -## [v1.2.0-rcgit.1](https://github.com/FreeRDP/remmina/tree/v1.2.0-rcgit.1) (2014-10-08) -[Full Changelog](https://github.com/FreeRDP/remmina/compare/v1.1.0...v1.2.0-rcgit.1) +## [v1.2.0-rcgit.1](https://github.com/FreeRDP/Remmina/tree/v1.2.0-rcgit.1) (2014-10-08) +[Full Changelog](https://github.com/FreeRDP/Remmina/compare/v1.1.0...v1.2.0-rcgit.1) **Closed issues:** @@ -363,8 +364,8 @@ - Changed links [\#348](https://github.com/FreeRDP/Remmina/pull/348) ([ic3d](https://github.com/ic3d)) - Remove call to freerdp\_get\_last\_error [\#346](https://github.com/FreeRDP/Remmina/pull/346) ([dktrkranz](https://github.com/dktrkranz)) -## [v1.1.0](https://github.com/FreeRDP/remmina/tree/v1.1.0) (2014-10-03) -[Full Changelog](https://github.com/FreeRDP/remmina/compare/1.0.0...v1.1.0) +## [v1.1.0](https://github.com/FreeRDP/Remmina/tree/v1.1.0) (2014-10-03) +[Full Changelog](https://github.com/FreeRDP/Remmina/compare/1.0.0...v1.1.0) **Fixed bugs:** @@ -534,7 +535,7 @@ - Do not use convenience copy of libvncserver [\#22](https://github.com/FreeRDP/Remmina/pull/22) ([dktrkranz](https://github.com/dktrkranz)) - remmina: install .desktop file [\#20](https://github.com/FreeRDP/Remmina/pull/20) ([jbicha](https://github.com/jbicha)) -## [1.0.0](https://github.com/FreeRDP/remmina/tree/1.0.0) (2012-02-10) +## [1.0.0](https://github.com/FreeRDP/Remmina/tree/1.0.0) (2012-02-10) **Closed issues:** - Can't compile with GTK+ [\#3](https://github.com/FreeRDP/Remmina/issues/3) -- cgit v1.2.3